From 2f76c2bcb6701f7561f92c14942fb4a83a5b68b6 Mon Sep 17 00:00:00 2001 From: Sepehr Rasouli Date: Tue, 25 Aug 2026 19:29:55 +0330 Subject: [PATCH 1/5] Improve translations --- glossary.po | 42 ++++++++++++++++++++--------------------- tutorial/errors.po | 2 +- tutorial/inputoutput.po | 2 +- tutorial/stdlib.po | 2 +- tutorial/stdlib2.po | 6 +++--- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/glossary.po b/glossary.po index 37da348b1..2dc5ac2e9 100644 --- a/glossary.po +++ b/glossary.po @@ -150,22 +150,22 @@ msgid "atomic operation" msgstr "عملیات اتمی" msgid "An operation that appears to execute as a single, indivisible step: no other thread can observe it half-done, and its effects become visible all at once. Python does not guarantee that high-level statements are atomic (for example, ``x += 1`` performs multiple bytecode operations and is not atomic). Atomicity is only guaranteed where explicitly documented. See also :term:`race condition` and :term:`data race`." -msgstr "عملیاتی که به نظر می‌رسد به‌عنوان یک گام واحد و تقسیم‌ناپذیر اجرا می‌شود: هیچ نخٔ دیگری نمی‌تواند اجرای ناقص آن را مشاهده کند و اثرات آن یکباره قابل مشاهده می‌شوند. پایتون تضمین نمی‌کند که دستورهای سطح بالا اتمی باشند (برای مثال، ``x += 1`` چندین عملیات بایت‌کد انجام می‌دهد و اتمی نیست). اتمی بودن فقط در مواردی تضمین می‌شود که به‌صراحت مستند شده باشند. همچنین :term:`شرط رقابت ` و :term:`رقابت داده ` را ببینید." +msgstr "عملیاتی که به نظر می‌رسد به‌عنوان یک گام واحد و تقسیم‌ناپذیر اجرا می‌شود: هیچ نخ دیگری نمی‌تواند اجرای ناقص آن را مشاهده کند و اثرات آن یکباره قابل مشاهده می‌شوند. پایتون تضمین نمی‌کند که دستورهای سطح بالا اتمی باشند (برای مثال، ``x += 1`` چندین عملیات بایت‌کد انجام می‌دهد و اتمی نیست). اتمی بودن فقط در مواردی تضمین می‌شود که به‌صراحت مستند شده باشند. همچنین :term:`شرط رقابت ` و :term:`رقابت داده ` را ببینید." msgid "attached thread state" -msgstr "وضعیت نخٔ متصل" +msgstr "وضعیت نخ متصل" msgid "A :term:`thread state` that is active for the current OS thread." -msgstr "یک :term:`وضعیت نخٔ اجرایی ` که برای نخٔ فعلی سیستم‌عامل فعال است." +msgstr "یک :term:`وضعیت نخ اجرایی ` که برای نخ فعلی سیستم‌عامل فعال است." msgid "When a :term:`thread state` is attached, the OS thread has access to the full Python C API and can safely invoke the bytecode interpreter." -msgstr "هنگامی که یک :term:`وضعیت نخٔ اجرایی ` متصل است، نخٔ سیستم‌عامل به تمام API زبان C پایتون دسترسی دارد و می‌تواند به‌طور ایمن مفسر بایت‌کد را فراخوانی کند." +msgstr "هنگامی که یک :term:`وضعیت نخ اجرایی ` متصل است، نخ سیستم‌عامل به تمام API زبان C پایتون دسترسی دارد و می‌تواند به‌طور ایمن مفسر بایت‌کد را فراخوانی کند." msgid "Unless a function explicitly notes otherwise, attempting to call the C API without an attached thread state will result in a fatal error or undefined behavior. A thread state can be attached and detached explicitly by the user through the C API, or implicitly by the runtime, including during blocking C calls and by the bytecode interpreter in between calls." -msgstr "مگر این‌که یک تابع به‌طور صریح خلاف آن را ذکر کند، تلاش برای فراخوانی API زبان C بدون یک وضعیت نخٔ متصل، به یک خطای مهلک یا رفتار تعریف‌نشده منجر خواهد شد. یک وضعیت نخ می‌تواند به‌صورت صریح توسط کاربر از طریق API زبان C متصل و جدا شود، یا به‌صورت ضمنی توسط ران‌تایم، از جمله در طول فراخوانی‌های C مسدودکننده و توسط مفسر بایت‌کد در بین فراخوانی‌ها، مدیریت شود." +msgstr "مگر این‌که یک تابع به‌طور صریح خلاف آن را ذکر کند، تلاش برای فراخوانی API زبان C بدون یک وضعیت نخ متصل، به یک خطای مهلک یا رفتار تعریف‌نشده منجر خواهد شد. یک وضعیت نخ می‌تواند به‌صورت صریح توسط کاربر از طریق API زبان C متصل و جدا شود، یا به‌صورت ضمنی توسط ران‌تایم، از جمله در طول فراخوانی‌های C مسدودکننده و توسط مفسر بایت‌کد در بین فراخوانی‌ها، مدیریت شود." msgid "On most builds of Python, having an attached thread state implies that the caller holds the :term:`GIL` for the current interpreter, so only one OS thread can have an attached thread state at a given moment. In :term:`free-threaded builds ` of Python, threads can concurrently hold an attached thread state, allowing for true parallelism of the bytecode interpreter." -msgstr "در بیشتر ساخت‌های پایتون، داشتن یک وضعیت نخٔ متصل به این معناست که فراخواننده :term:`GIL ` را برای مفسر فعلی در اختیار دارد، بنابراین در یک لحظهٔ مشخص فقط یک نخٔ سیستم‌عامل می‌تواند یک وضعیت نخٔ متصل داشته باشد. در :term:`ساخت نخ‌آزاد ` پایتون، نخ‌ها می‌توانند به‌طور هم‌زمان وضعیت نخٔ متصل داشته باشند، که امکان موازی‌سازی واقعی مفسر بایت‌کد را فراهم می‌کند." +msgstr "در بیشتر ساخت‌های پایتون، داشتن یک وضعیت نخ متصل به این معناست که فراخواننده :term:`GIL ` را برای مفسر فعلی در اختیار دارد، بنابراین در یک لحظهٔ مشخص فقط یک نخ سیستم‌عامل می‌تواند یک وضعیت نخ متصل داشته باشد. در :term:`ساخت نخ‌آزاد ` پایتون، نخ‌ها می‌توانند به‌طور هم‌زمان وضعیت نخ متصل داشته باشند، که امکان موازی‌سازی واقعی مفسر بایت‌کد را فراهم می‌کند." msgid "attribute" msgstr "ویژگی" @@ -380,7 +380,7 @@ msgid "deadlock" msgstr "بن‌بست" msgid "A situation in which two or more tasks (threads, processes, or coroutines) wait indefinitely for each other to release resources or complete actions, preventing any from making progress. For example, if thread A holds lock 1 and waits for lock 2, while thread B holds lock 2 and waits for lock 1, both threads will wait indefinitely. In Python this often arises from acquiring multiple locks in conflicting orders or from circular join/await dependencies. Deadlocks can be avoided by always acquiring multiple :term:`locks ` in a consistent order. See also :term:`lock` and :term:`reentrant`." -msgstr "وضعیتی که در آن دو یا چند وظیفه (نخ‌ها، پردازه‌ها یا هم‌روال‌ها) به‌طور نامحدود منتظر می‌مانند تا یکدیگر منابع را آزاد کنند یا اقداماتی را کامل کنند، و در نتیجه هیچ‌کدام نمی‌توانند پیشرفت کنند. برای مثال، اگر نخٔ A قفل ۱ را در اختیار داشته باشد و منتظر قفل ۲ باشد، در حالی که نخٔ B قفل ۲ را در اختیار دارد و منتظر قفل ۱ است، هر دو نخ به‌طور نامحدود منتظر خواهند ماند. در پایتون، این وضعیت اغلب از دریافت چندین قفل با ترتیب‌های ناسازگار یا از وابستگی‌های join/await چرخه‌ای ایجاد می‌شود. می‌توان با همیشه دریافت کردن چندین :term:`قفل ` به یک ترتیب ثابت از بن‌بست‌ها جلوگیری کرد. همچنین :term:`قفل ` و :term:`بازورودپذیر ` را ببینید." +msgstr "وضعیتی که در آن دو یا چند وظیفه (نخ‌ها، پردازه‌ها یا هم‌روال‌ها) به‌طور نامحدود منتظر می‌مانند تا یکدیگر منابع را آزاد کنند یا اقداماتی را کامل کنند، و در نتیجه هیچ‌کدام نمی‌توانند پیشرفت کنند. برای مثال، اگر نخ A قفل ۱ را در اختیار داشته باشد و منتظر قفل ۲ باشد، در حالی که نخ B قفل ۲ را در اختیار دارد و منتظر قفل ۱ است، هر دو نخ به‌طور نامحدود منتظر خواهند ماند. در پایتون، این وضعیت اغلب از دریافت چندین قفل با ترتیب‌های ناسازگار یا از وابستگی‌های join/await چرخه‌ای ایجاد می‌شود. می‌توان با همیشه دریافت کردن چندین :term:`قفل ` به یک ترتیب ثابت از بن‌بست‌ها جلوگیری کرد. همچنین :term:`قفل ` و :term:`بازورودپذیر ` را ببینید." msgid "decorator" msgstr "دکوراتور" @@ -678,7 +678,7 @@ msgid "As of Python 3.13, the GIL can be disabled using the :option:`--disable-g msgstr "از پایتون ۳.۱۳، می‌توان GIL را با استفاده از پیکربندی ساخت :option:`--disable-gil` غیرفعال کرد. پس از ساخت پایتون با این گزینه، کد باید با :option:`-X gil=0 <-X>` یا پس از تنظیم متغیر محیطی :envvar:`PYTHON_GIL=0 ` اجرا شود. این ویژگی عملکرد بهتر برای برنامه‌های چندنخی را فراهم می‌کند و استفادهٔ مؤثرتر از CPUهای چند‌هسته‌ای را آسان‌تر می‌سازد. برای جزئیات بیشتر، :pep:`703` را ببینید." msgid "In prior versions of Python's C API, a function might declare that it requires the GIL to be held in order to use it. This refers to having an :term:`attached thread state`." -msgstr "در نسخه‌های پیشین API زبان C پایتون، یک تابع ممکن بود اعلام کند که برای استفاده از آن، لازم است GIL در اختیار گرفته شده باشد. این موضوع به داشتن یک :term:`وضعیت نخٔ متصل ` اشاره دارد." +msgstr "در نسخه‌های پیشین API زبان C پایتون، یک تابع ممکن بود اعلام کند که برای استفاده از آن، لازم است GIL در اختیار گرفته شده باشد. این موضوع به داشتن یک :term:`وضعیت نخ متصل ` اشاره دارد." msgid "global state" msgstr "وضعیت سراسری" @@ -1083,7 +1083,7 @@ msgid "parallelism" msgstr "موازی‌سازی" msgid "Executing multiple operations at the same time (e.g. on multiple CPU cores). In Python builds with the :term:`global interpreter lock (GIL) `, only one thread runs Python bytecode at a time, so taking advantage of multiple CPU cores typically involves multiple processes (e.g. :mod:`multiprocessing`) or native extensions that release the GIL. In :term:`free-threaded ` Python, multiple Python threads can run Python code simultaneously on different cores." -msgstr "اجرای چندین عملیات در یک زمان (برای مثال روی چند هستهٔ CPU). در ساخت‌های پایتون با :term:`قفل مفسر سراسری `، تنها یک نخ در هر لحظه بایت‌کد پایتون را اجرا می‌کند، بنابراین بهره‌گیری از چند هستهٔ CPU معمولاً شامل چند فرایند (برای مثال :mod:`multiprocessing`) یا افزونه‌های بومی است که GIL را آزاد می‌کنند. در پایتون :term:`نخ‌گذاری آزاد `، چندین نخٔ پایتون می‌توانند به‌طور هم‌زمان کد پایتون را روی هسته‌های مختلف اجرا کنند." +msgstr "اجرای چندین عملیات در یک زمان (برای مثال روی چند هستهٔ CPU). در ساخت‌های پایتون با :term:`قفل مفسر سراسری `، تنها یک نخ در هر لحظه بایت‌کد پایتون را اجرا می‌کند، بنابراین بهره‌گیری از چند هستهٔ CPU معمولاً شامل چند فرایند (برای مثال :mod:`multiprocessing`) یا افزونه‌های بومی است که GIL را آزاد می‌کنند. در پایتون :term:`نخ‌گذاری آزاد `، چندین نخ پایتون می‌توانند به‌طور هم‌زمان کد پایتون را روی هسته‌های مختلف اجرا کنند." msgid "parameter" msgstr "پارامتر" @@ -1092,7 +1092,7 @@ msgid "A named entity in a :term:`function` (or method) definition that specifie msgstr "یک موجودیت نام‌گذاری‌شده در تعریف یک :term:`تابع ` (یا متد) که یک :term:`آرگومان ` (یا در برخی موارد، آرگومان‌ها) را مشخص می‌کند که تابع می‌تواند بپذیرد. پنج نوع پارامتر وجود دارد:" msgid ":dfn:`positional-or-keyword`: specifies an argument that can be passed either :term:`positionally ` or as a :term:`keyword argument `. This is the default kind of parameter, for example *foo* and *bar* in the following::" -msgstr ":dfn:`positional-or-keyword`: آرگومانی را مشخص می‌کند که می‌تواند به‌صورت :term:`آرگومان ` یا به‌عنوان یک :term:`آرگومان ` ارسال شود. این نوع پیش‌فرض پارامتر است، برای مثال *foo* و *bar* در موارد زیر::" +msgstr ":dfn:`positional-or-keyword`: آرگومانی را مشخص می‌کند که می‌تواند به‌صورت :term:`آرگومان جایگاهی ` یا به‌عنوان یک :term:`آرگومان کلیدواژه‌ای ` ارسال شود. این نوع پیش‌فرض پارامتر است، برای مثال *foo* و *bar* در موارد زیر::" msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." @@ -1302,13 +1302,13 @@ msgid "reentrant" msgstr "بازورودپذیر" msgid "A property of a function or :term:`lock` that allows it to be called or acquired multiple times by the same thread without causing errors or a :term:`deadlock`." -msgstr "ویژگی یک تابع یا :term:`قفل ` که به آن اجازه می‌دهد بدون ایجاد خطا یا یک :term:`بن‌بست `، چندین بار توسط یک نخٔ اجرایی یکسان فراخوانی یا دریافت شود." +msgstr "ویژگی یک تابع یا :term:`قفل ` که به آن اجازه می‌دهد بدون ایجاد خطا یا یک :term:`بن‌بست `، چندین بار توسط یک نخ اجرایی یکسان فراخوانی یا دریافت شود." msgid "For functions, reentrancy means the function can be safely called again before a previous invocation has completed, which is important when functions may be called recursively or from signal handlers. Thread-unsafe functions may be :term:`non-deterministic` if they're called reentrantly in a multithreaded program." msgstr "در مورد توابع، بازورودپذیری به این معناست که می‌توان تابع را پیش از کامل‌شدن یک فراخوانی قبلی، دوباره با ایمنی فراخوانی کرد؛ این موضوع زمانی اهمیت دارد که توابع ممکن است به‌صورت بازگشتی یا از درون دستگردان‌های سیگنال فراخوانی شوند. توابع ناایمن برای نخ‌های اجرایی ممکن است در صورتی که در یک برنامهٔ چندنخی به‌صورت بازورودپذیر فراخوانی شوند، :term:`غیرقطعی ` باشند." msgid "For locks, Python's :class:`threading.RLock` (reentrant lock) is reentrant, meaning a thread that already holds the lock can acquire it again without blocking. In contrast, :class:`threading.Lock` is not reentrant - attempting to acquire it twice from the same thread will cause a deadlock." -msgstr "در مورد قفل‌ها، :class:`threading.RLock` پایتون (قفل بازورودپذیر) بازورودپذیر است؛ یعنی نخٔ اجرایی‌ای که از پیش قفل را در اختیار دارد، می‌تواند دوباره آن را دریافت کند، بدون آنکه مسدود شود. در مقابل، :class:`threading.Lock` بازورودپذیر نیست؛ تلاش برای دریافت آن دو بار از همان نخٔ اجرایی باعث یک بن‌بست می‌شود." +msgstr "در مورد قفل‌ها، :class:`threading.RLock` پایتون (قفل بازورودپذیر) بازورودپذیر است؛ یعنی نخ اجرایی‌ای که از پیش قفل را در اختیار دارد، می‌تواند دوباره آن را دریافت کند، بدون آنکه مسدود شود. در مقابل، :class:`threading.Lock` بازورودپذیر نیست؛ تلاش برای دریافت آن دو بار از همان نخ اجرایی باعث یک بن‌بست می‌شود." msgid "See also :term:`lock` and :term:`deadlock`." msgstr "همچنین :term:`قفل ` و :term:`بن‌بست ` را ببینید." @@ -1419,13 +1419,13 @@ msgid "synchronization primitive" msgstr "اولیه" msgid "A basic building block for coordinating (synchronizing) the execution of multiple threads to ensure :term:`thread-safe` access to shared resources. Python's :mod:`threading` module provides several synchronization primitives including :class:`~threading.Lock`, :class:`~threading.RLock`, :class:`~threading.Semaphore`, :class:`~threading.Condition`, :class:`~threading.Event`, and :class:`~threading.Barrier`. Additionally, the :mod:`queue` module provides multi-producer, multi-consumer queues that are especially useful in multithreaded programs. These primitives help prevent :term:`race conditions ` and coordinate thread execution. See also :term:`lock`." -msgstr "یک سازهٔ پایه برای هماهنگ‌سازی اجرای چند نخٔ اجرایی، با هدف اطمینان از دسترسی :term:`ایمن برای نخ‌های اجرایی ` به منابع مشترک. ماژول :mod:`threading` پایتون چندین اولیهٔ همگام‌سازی، از جمله :class:`~threading.Lock`، :class:`~threading.RLock`، :class:`~threading.Semaphore`، :class:`~threading.Condition`، :class:`~threading.Event` و :class:`~threading.Barrier` را فراهم می‌کند. افزون بر این، ماژول :mod:`queue` صف‌های چندتولیدکننده، چندمصرف‌کننده‌ای را فراهم می‌کند که به‌ویژه در برنامه‌های چندنخی مفید هستند. این اولیه‌ها به جلوگیری از :term:`شرط رقابت ` و هماهنگ‌سازی اجرای نخ‌های اجرایی کمک می‌کنند. همچنین :term:`قفل ` را ببینید." +msgstr "یک سازهٔ پایه برای هماهنگ‌سازی اجرای چند نخ اجرایی، با هدف اطمینان از دسترسی :term:`ایمن برای نخ‌های اجرایی ` به منابع مشترک. ماژول :mod:`threading` پایتون چندین اولیهٔ همگام‌سازی، از جمله :class:`~threading.Lock`، :class:`~threading.RLock`، :class:`~threading.Semaphore`، :class:`~threading.Condition`، :class:`~threading.Event` و :class:`~threading.Barrier` را فراهم می‌کند. افزون بر این، ماژول :mod:`queue` صف‌های چندتولیدکننده، چندمصرف‌کننده‌ای را فراهم می‌کند که به‌ویژه در برنامه‌های چندنخی مفید هستند. این اولیه‌ها به جلوگیری از :term:`شرط رقابت ` و هماهنگ‌سازی اجرای نخ‌های اجرایی کمک می‌کنند. همچنین :term:`قفل ` را ببینید." msgid "t-string" -msgstr "t-string" +msgstr "تی‌استرینگ" msgid "t-strings" -msgstr "t-strings" +msgstr "تی‌استرینگ‌ها" msgid "String literals prefixed with ``t`` or ``T`` are commonly called \"t-strings\" which is short for :ref:`template string literals `." msgstr "لیترال‌های رشته‌ای که با ``t`` یا ``T`` پیشوندگذاری شده‌اند، معمولاً «t-string» نامیده می‌شوند که شکل کوتاه‌شدهٔ :ref:`template string literals ` است." @@ -1452,19 +1452,19 @@ msgid "See also :term:`binary file` for a file object able to read and write :te msgstr "همچنین برای یک شیء فایل که می‌تواند :term:`شیء شبه‌بایت ` را بخواند و بنویسد، :term:`فایل دودویی ` را ببینید." msgid "thread state" -msgstr "وضعیت نخٔ اجرایی" +msgstr "وضعیت نخ اجرایی" msgid "The information used by the :term:`CPython` runtime to run in an OS thread. For example, this includes the current exception, if any, and the state of the bytecode interpreter." -msgstr "اطلاعاتی که :term:`CPython ` ران‌تایم برای اجرا در یک نخٔ اجرایی سیستم‌عامل استفاده می‌کند. برای مثال، این اطلاعات شامل استثنای فعلی، در صورت وجود، و وضعیت مفسر بایت‌کد است." +msgstr "اطلاعاتی که :term:`CPython ` ران‌تایم برای اجرا در یک نخ اجرایی سیستم‌عامل استفاده می‌کند. برای مثال، این اطلاعات شامل استثنای فعلی، در صورت وجود، و وضعیت مفسر بایت‌کد است." msgid "Each thread state is bound to a single OS thread, but threads may have many thread states available. At most, one of them may be :term:`attached ` at once." -msgstr "هر وضعیت نخٔ اجرایی به یک نخٔ اجرایی سیستم‌عامل واحد وابسته است، اما نخ‌های اجرایی ممکن است وضعیت‌های نخٔ اجرایی متعددی در دسترس داشته باشند. در هر لحظه حداکثر یکی از آن‌ها می‌تواند :term:`وضعیت نخٔ متصل ` باشد." +msgstr "هر وضعیت نخ اجرایی به یک نخ اجرایی سیستم‌عامل واحد وابسته است، اما نخ‌های اجرایی ممکن است وضعیت‌های نخ اجرایی متعددی در دسترس داشته باشند. در هر لحظه حداکثر یکی از آن‌ها می‌تواند :term:`وضعیت نخ متصل ` باشد." msgid "An :term:`attached thread state` is required to call most of Python's C API, unless a function explicitly documents otherwise. The bytecode interpreter only runs under an attached thread state." -msgstr "برای فراخوانی بیشتر API زبان C پایتون، یک :term:`وضعیت نخٔ متصل ` لازم است، مگر اینکه تابعی صراحتاً خلاف آن را مستند کرده باشد. مفسر بایت‌کد فقط در یک وضعیت نخٔ اجرایی پیوست‌شده اجرا می‌شود." +msgstr "برای فراخوانی بیشتر API زبان C پایتون، یک :term:`وضعیت نخ متصل ` لازم است، مگر اینکه تابعی صراحتاً خلاف آن را مستند کرده باشد. مفسر بایت‌کد فقط در یک وضعیت نخ اجرایی پیوست‌شده اجرا می‌شود." msgid "Each thread state belongs to a single interpreter, but each interpreter may have many thread states, including multiple for the same OS thread. Thread states from multiple interpreters may be bound to the same thread, but only one can be :term:`attached ` in that thread at any given moment." -msgstr "هر وضعیت نخٔ اجرایی به یک مفسر واحد تعلق دارد، اما هر مفسر ممکن است وضعیت‌های نخٔ اجرایی متعددی داشته باشد، از جمله چند وضعیت برای یک نخٔ اجرایی سیستم‌عامل یکسان. وضعیت‌های نخٔ اجرایی از مفسرهای متعدد ممکن است به یک نخٔ اجرایی یکسان وابسته باشند، اما در هر لحظه فقط یکی از آن‌ها می‌تواند در آن نخٔ اجرایی :term:`وضعیت نخٔ متصل ` باشد." +msgstr "هر وضعیت نخ اجرایی به یک مفسر واحد تعلق دارد، اما هر مفسر ممکن است وضعیت‌های نخ اجرایی متعددی داشته باشد، از جمله چند وضعیت برای یک نخ اجرایی سیستم‌عامل یکسان. وضعیت‌های نخ اجرایی از مفسرهای متعدد ممکن است به یک نخ اجرایی یکسان وابسته باشند، اما در هر لحظه فقط یکی از آن‌ها می‌تواند در آن نخ اجرایی :term:`وضعیت نخ متصل ` باشد." msgid "See :ref:`Thread State and the Global Interpreter Lock ` for more information." msgstr "برای اطلاعات بیشتر، :ref:`Thread State and the Global Interpreter Lock ` را ببینید." @@ -1473,7 +1473,7 @@ msgid "thread-safe" msgstr "ایمن برای نخ‌های اجرایی" msgid "A module, function, or class that behaves correctly when used by multiple threads concurrently. Thread-safe code uses appropriate :term:`synchronization primitives ` like :term:`locks ` to protect shared mutable state, or is designed to avoid shared mutable state entirely. In the :term:`free-threaded ` build, built-in types like :class:`dict`, :class:`list`, and :class:`set` use internal locking to make many operations thread-safe, although thread safety is not necessarily guaranteed. Code that is not thread-safe may experience :term:`race conditions ` and :term:`data races ` when used in multi-threaded programs." -msgstr "یک ماژول، تابع یا کلاس که هنگام استفادهٔ هم‌زمان توسط چند نخٔ اجرایی، به‌درستی رفتار می‌کند. کد ایمن برای نخ‌های اجرایی از :term:`اولیه ` مناسب، مانند :term:`قفل `، برای محافظت از وضعیت تغییرپذیر مشترک استفاده می‌کند یا به‌گونه‌ای طراحی شده است که به‌طور کامل از وضعیت تغییرپذیر مشترک اجتناب کند. در ساخت :term:`نخ‌گذاری آزاد `، نوع‌های توکار مانند :class:`dict`، :class:`list` و :class:`set` از قفل‌گذاری داخلی برای ایمن‌کردن بسیاری از عملیات در برابر اجرای هم‌زمان نخ‌های اجرایی استفاده می‌کنند، هرچند ایمنی در برابر نخ‌های اجرایی لزوماً تضمین‌شده نیست. کدی که برای نخ‌های اجرایی ایمن نیست، هنگام استفاده در برنامه‌های چندنخی ممکن است دچار :term:`شرط رقابت ` و :term:`رقابت داده ` شود." +msgstr "یک ماژول، تابع یا کلاس که هنگام استفادهٔ هم‌زمان توسط چند نخ اجرایی، به‌درستی رفتار می‌کند. کد ایمن برای نخ‌های اجرایی از :term:`اولیه ` مناسب، مانند :term:`قفل `، برای محافظت از وضعیت تغییرپذیر مشترک استفاده می‌کند یا به‌گونه‌ای طراحی شده است که به‌طور کامل از وضعیت تغییرپذیر مشترک اجتناب کند. در ساخت :term:`نخ‌گذاری آزاد `، نوع‌های توکار مانند :class:`dict`، :class:`list` و :class:`set` از قفل‌گذاری داخلی برای ایمن‌کردن بسیاری از عملیات در برابر اجرای هم‌زمان نخ‌های اجرایی استفاده می‌کنند، هرچند ایمنی در برابر نخ‌های اجرایی لزوماً تضمین‌شده نیست. کدی که برای نخ‌های اجرایی ایمن نیست، هنگام استفاده در برنامه‌های چندنخی ممکن است دچار :term:`شرط رقابت ` و :term:`رقابت داده ` شود." msgid "token" msgstr "توکن" diff --git a/tutorial/errors.po b/tutorial/errors.po index a89758c8b..c023e77d6 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -363,7 +363,7 @@ msgid "The sole argument to :keyword:`raise` indicates the exception to be raise msgstr "تنها آرگومان دستور :keyword:`raise` مشخص می‌کند که چه استثنایی باید پرتاب شود. این آرگومان باید یا یک نمونهٔ استثنا (exception instance) باشد یا یک کلاس استثنا (کلاسی که از :class:`BaseException` مشتق شده باشد، مانند :exc:`Exception` یا یکی از زیرکلاس‌های آن). اگر یک کلاس استثنا ارسال شود، پایتون به‌طور ضمنی با فراخوانی سازندهٔ آن بدون هیچ آرگومانی، یک نمونه از آن ایجاد می‌کند::" msgid "raise ValueError # shorthand for 'raise ValueError()'" -msgstr "raise ValueError # کوتاه‌شده برای # exc must be exception instance or None.'raise ValueError()'" +msgstr "raise ValueError # کوتاه‌شده برای 'raise ValueError()'" msgid "If you need to determine whether an exception was raised but don't intend to handle it, a simpler form of the :keyword:`raise` statement allows you to re-raise the exception::" msgstr "اگر فقط لازم است تشخیص دهید که آیا استثنایی رخ داده است یا نه، اما قصد مدیریت آن را ندارید، می‌توانید از شکل ساده‌تری از دستور :keyword:`raise` برای پرتاب مجدد همان استثنا استفاده کنید::" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 9417739db..09c678c91 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -126,7 +126,7 @@ msgstr "" "'hello, world\\n'\n" ">>> # آرگومان repr() می‌تواند هر شیء پایتونی باشد:\n" ">>> repr((x, y, ('spam', 'eggs')))\n" -"\"(32.5, 40000, ('spam', 'eggs'))\"closed." +"\"(32.5, 40000, ('spam', 'eggs'))\"" msgid "The :mod:`string` module contains support for a simple templating approach based upon regular expressions, via :class:`string.Template`. This offers yet another way to substitute values into strings, using placeholders like ``$x`` and replacing them with values from a dictionary. This syntax is easy to use, although it offers much less control for formatting." msgstr "ماژول :mod:`string` شامل پشتیبانی از یک رویکرد ساده‌ی قالب‌بندی (templating) است که بر اساس عبارت‌های منظم (regular expressions) و از طریق :class:`string.Template` کار می‌کند. این روشی دیگر برای جایگزینی مقادیر در رشته‌ها ارائه می‌دهد، با استفاده از جانشین‌هایی (placeholders) مانند ``$x`` و جایگزینی آن‌ها با مقادیر یک دیکشنری. این نحو (سینتکس) آسان است، اگرچه کنترل بسیار کمتری برای قالب‌بندی ارائه می‌دهد." diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index dec35512b..91dccbe70 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -471,7 +471,7 @@ msgid "The :mod:`xmlrpc.client` and :mod:`xmlrpc.server` modules make implementi msgstr "ماژول‌های :mod:`xmlrpc.client` و :mod:`xmlrpc.server` پیاده‌سازی فراخوانی رویه‌های راه‌دور (Remote Procedure Calls یا RPC) را به کاری تقریباً ساده و بدیهی تبدیل می‌کنند. با وجود نام این ماژول‌ها، نیازی به دانش یا کار مستقیم با XML نیست." msgid "The :mod:`email` package is a library for managing email messages, including MIME and other :rfc:`5322`-based message documents. Unlike :mod:`smtplib` and :mod:`poplib` which actually send and receive messages, the email package has a complete toolset for building or decoding complex message structures (including attachments) and for implementing internet encoding and header protocols." -msgstr "بستهٔ :mod:`email` کتابخانه‌ای برای مدیریت پیام‌های ایمیل است که از MIME و سایر قالب‌های پیام مبتنی بر :rfc:`5322` نیز پشتیبانی می‌کند. برخلاف ماژول‌های :mod:`smtplib` و :mod:`poplib` که وظیفهٔ ارسال و دریافت پیام‌ها را بر عهده دارند، بستهٔ `email` مجموعه‌ای کامل از ابزارها را برای ساخت یا کدگشایی ساختارهای پیچیدهٔ پیام (از جمله پیوست‌ها) و همچنین پیاده‌سازی پروتکل‌های کدگذاری اینترنتی و سرآیندهای پیام فراهم می‌کند." +msgstr "بستهٔ :mod:`email` کتابخانه‌ای برای مدیریت پیام‌های ایمیل است که از MIME و سایر قالب‌های پیام مبتنی بر :rfc:`5322` نیز پشتیبانی می‌کند. برخلاف ماژول‌های :mod:`smtplib` و :mod:`poplib` که وظیفهٔ ارسال و دریافت پیام‌ها را بر عهده دارند، بستهٔ email مجموعه‌ای کامل از ابزارها را برای ساخت یا کدگشایی ساختارهای پیچیدهٔ پیام (از جمله پیوست‌ها) و همچنین پیاده‌سازی پروتکل‌های کدگذاری اینترنتی و سرآیندهای پیام فراهم می‌کند." msgid "The :mod:`json` package provides robust support for parsing this popular data interchange format. The :mod:`csv` module supports direct reading and writing of files in Comma-Separated Value format, commonly supported by databases and spreadsheets. XML processing is supported by the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, these modules and packages greatly simplify data interchange between Python applications and other tools." msgstr "بستهٔ :mod:`json` از تجزیه و پردازش این قالب پرکاربرد تبادل داده به‌خوبی پشتیبانی می‌کند. ماژول :mod:`csv` امکان خواندن و نوشتن مستقیم فایل‌ها در قالب مقادیر جداشده با ویرگول (CSV) را فراهم می‌کند؛ قالبی که معمولاً توسط پایگاه‌های داده و نرم‌افزارهای صفحه‌گسترده پشتیبانی می‌شود. پردازش XML نیز توسط بسته‌های :mod:`xml.etree.ElementTree`، :mod:`xml.dom` و :mod:`xml.sax` پشتیبانی می‌شود. در کنار هم، این ماژول‌ها و بسته‌ها تبادل داده میان برنامه‌های پایتون و سایر ابزارها را تا حد زیادی ساده می‌کنند." diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index 31d3b8482..dc595c1bb 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -409,10 +409,10 @@ msgid "Tools for working with lists" msgstr "ابزارهایی برای کار با فهرست‌ها" msgid "Many data structure needs can be met with the built-in list type. However, sometimes there is a need for alternative implementations with different performance trade-offs." -msgstr "بسیاری از نیازهای مربوط به ساختارهای داده را می‌توان با استفاده از نوع داخلی `list` برآورده کرد. با این حال، گاهی به پیاده‌سازی‌های جایگزینی نیاز است که توازن متفاوتی میان کارایی و عملکرد ارائه می‌دهند." +msgstr "بسیاری از نیازهای مربوط به ساختارهای داده را می‌توان با استفاده از نوع داخلی list برآورده کرد. با این حال، گاهی به پیاده‌سازی‌های جایگزینی نیاز است که توازن متفاوتی میان کارایی و عملکرد ارائه می‌دهند." msgid "The :mod:`array` module provides an :class:`~array.array` object that is like a list that stores only homogeneous data and stores it more compactly. The following example shows an array of numbers stored as two byte unsigned binary numbers (typecode ``\"H\"``) rather than the usual 16 bytes per entry for regular lists of Python int objects::" -msgstr "ماژول :mod:`array` شیء :class:`~array.array` را فراهم می‌کند که شبیه یک فهرست است، اما تنها داده‌های هم‌نوع را ذخیره می‌کند و آن‌ها را به‌شکلی فشرده‌تر در حافظه نگه می‌دارد. مثال زیر آرایه‌ای از اعداد را نشان می‌دهد که به‌جای ذخیره شدن به‌صورت اعداد دودویی بدون علامتِ دو بایتی (با کد نوع ``\"H\"``)، به‌صورت اشیای معمولی `int` پایتون (که معمولاً برای هر عضو ۱۶ بایت فضا اشغال می‌کنند) ذخیره شده‌اند::" +msgstr "ماژول :mod:`array` شیء :class:`~array.array` را فراهم می‌کند که شبیه یک فهرست است، اما تنها داده‌های هم‌نوع را ذخیره می‌کند و آن‌ها را به‌شکلی فشرده‌تر در حافظه نگه می‌دارد. مثال زیر آرایه‌ای از اعداد را نشان می‌دهد که به‌جای ذخیره شدن به‌صورت اعداد دودویی بدون علامتِ دو بایتی (با کد نوع ``\"H\"``)، به‌صورت اشیای معمولی int پایتون (که معمولاً برای هر عضو ۱۶ بایت فضا اشغال می‌کنند) ذخیره شده‌اند::" msgid "" ">>> from array import array\n" @@ -534,7 +534,7 @@ msgstr "" "0.73" msgid "The :class:`~decimal.Decimal` result keeps a trailing zero, automatically inferring four place significance from multiplicands with two place significance. Decimal reproduces mathematics as done by hand and avoids issues that can arise when binary floating point cannot exactly represent decimal quantities." -msgstr "نتیجهٔ :class:`~decimal.Decimal` صفر انتهایی را حفظ می‌کند و به‌طور خودکار از عملوندهایی که هرکدام دو رقم اعشار معنادار دارند، چهار رقم اعشار معنادار برای حاصل استنباط می‌کند. `Decimal` محاسبات را همان‌گونه انجام می‌دهد که به‌صورت دستی انجام می‌شوند و از مشکلاتی که به‌دلیل ناتوانی ممیز شناور دودویی در نمایش دقیق مقادیر ده‌دهی ایجاد می‌شود، جلوگیری می‌کند." +msgstr "نتیجهٔ :class:`~decimal.Decimal` صفر انتهایی را حفظ می‌کند و به‌طور خودکار از عملوندهایی که هرکدام دو رقم اعشار معنادار دارند، چهار رقم اعشار معنادار برای حاصل استنباط می‌کند. Decimal محاسبات را همان‌گونه انجام می‌دهد که به‌صورت دستی انجام می‌شوند و از مشکلاتی که به‌دلیل ناتوانی ممیز شناور دودویی در نمایش دقیق مقادیر ده‌دهی ایجاد می‌شود، جلوگیری می‌کند." msgid "Exact representation enables the :class:`~decimal.Decimal` class to perform modulo calculations and equality tests that are unsuitable for binary floating point::" msgstr "نمایش دقیق مقادیر به کلاس :class:`~decimal.Decimal` این امکان را می‌دهد که محاسبات باقیمانده و آزمون‌های برابری را به‌درستی انجام دهد؛ عملیاتی که استفاده از آن‌ها با ممیز شناور دودویی مناسب نیست::" From 9b7f3fab87e42a450edae14f5a904b98b87a29dc Mon Sep 17 00:00:00 2001 From: Sepehr Rasouli Date: Tue, 25 Aug 2026 21:23:53 +0330 Subject: [PATCH 2/5] Bump translations to 3.14.7 --- about.po | 76 +- bugs.po | 253 +- c-api/abstract.po | 29 +- c-api/allocation.po | 241 +- c-api/apiabiversion.po | 156 +- c-api/arg.po | 813 +- c-api/bool.po | 60 +- c-api/buffer.po | 527 +- c-api/bytearray.po | 110 +- c-api/bytes.po | 246 +- c-api/call.po | 375 +- c-api/capsule.po | 165 +- c-api/cell.po | 53 +- c-api/code.po | 302 +- c-api/codec.po | 112 +- c-api/complex.po | 139 +- c-api/concrete.po | 42 +- c-api/contextvars.po | 146 +- c-api/conversion.po | 230 +- c-api/coro.po | 22 +- c-api/curses.po | 91 +- c-api/datetime.po | 225 +- c-api/descriptor.po | 200 +- c-api/dict.po | 504 +- c-api/exceptions.po | 1056 ++- c-api/extension-modules.po | 227 +- c-api/file.po | 146 +- c-api/float.po | 214 +- c-api/frame.po | 206 +- c-api/function.po | 179 +- c-api/gcsupport.po | 326 +- c-api/gen.po | 69 +- c-api/hash.po | 89 +- c-api/import.po | 304 +- c-api/index.po | 10 +- c-api/init.po | 10 +- c-api/init_config.po | 1717 +++- c-api/interp-lifecycle.po | 908 +- c-api/intro.po | 1023 ++- c-api/iter.po | 53 +- c-api/iterator.po | 79 +- c-api/lifecycle.po | 290 +- c-api/list.po | 183 +- c-api/long.po | 707 +- c-api/mapping.po | 117 +- c-api/marshal.po | 83 +- c-api/memory.po | 781 +- c-api/memoryview.po | 68 +- c-api/method.po | 66 +- c-api/module.po | 618 +- c-api/monitoring.po | 164 +- c-api/none.po | 19 +- c-api/number.po | 247 +- c-api/object.po | 672 +- c-api/objimpl.po | 8 +- c-api/perfmaps.po | 127 +- c-api/picklebuffer.po | 56 +- c-api/profiling.po | 209 +- c-api/refcounting.po | 199 +- c-api/reflection.po | 86 +- c-api/sequence.po | 161 +- c-api/set.po | 178 +- c-api/slice.po | 109 +- c-api/stable.po | 227 +- c-api/structures.po | 742 +- c-api/subinterpreters.po | 433 +- c-api/synchronization.po | 206 +- c-api/sys.po | 433 +- c-api/threads.po | 789 +- c-api/time.po | 107 +- c-api/tls.po | 137 +- c-api/tuple.po | 186 +- c-api/type.po | 609 +- c-api/typehints.po | 34 +- c-api/typeobj.po | 2788 ++++++- c-api/unicode.po | 1586 +++- c-api/utilities.po | 10 +- c-api/veryhigh.po | 504 +- c-api/weakref.po | 114 +- contents.po | 3 +- copyright.po | 31 +- deprecations/c-api-pending-removal-in-3.14.po | 13 +- deprecations/c-api-pending-removal-in-3.15.po | 219 +- deprecations/c-api-pending-removal-in-3.16.po | 4 +- deprecations/c-api-pending-removal-in-3.18.po | 89 +- .../c-api-pending-removal-in-future.po | 62 +- deprecations/index.po | 869 +- deprecations/pending-removal-in-3.13.po | 35 +- deprecations/pending-removal-in-3.14.po | 108 +- deprecations/pending-removal-in-3.15.po | 117 +- deprecations/pending-removal-in-3.16.po | 108 +- deprecations/pending-removal-in-3.17.po | 49 +- deprecations/pending-removal-in-3.18.po | 11 +- deprecations/pending-removal-in-3.19.po | 10 +- deprecations/pending-removal-in-future.po | 218 +- distributing/index.po | 9 +- extending/building.po | 22 +- extending/embedding.po | 276 +- extending/extending.po | 1257 ++- extending/index.po | 51 +- extending/newtypes.po | 514 +- extending/newtypes_tutorial.po | 800 +- extending/windows.po | 178 +- faq/design.po | 811 +- faq/extending.po | 228 +- faq/general.po | 496 +- faq/gui.po | 66 +- faq/index.po | 3 +- faq/installed.po | 68 +- faq/library.po | 575 +- faq/programming.po | 1810 +++- faq/windows.po | 291 +- glossary.po | 2213 ++++- howto/a-conceptual-overview-of-asyncio.po | 469 +- howto/annotations.po | 280 +- howto/argparse-optparse.po | 86 +- howto/argparse.po | 469 +- howto/clinic.po | 8 +- howto/cporting.po | 26 +- howto/curses.po | 571 +- howto/descriptor.po | 852 +- howto/enum.po | 901 +- howto/free-threading-extensions.po | 408 +- howto/free-threading-python.po | 318 +- howto/functional.po | 1095 ++- howto/gdb_helpers.po | 481 +- howto/index.po | 38 +- howto/instrumentation.po | 326 +- howto/ipaddress.po | 229 +- howto/isolating-extensions.po | 554 +- howto/logging-cookbook.po | 2188 ++++- howto/logging.po | 1114 ++- howto/mro.po | 476 +- howto/perf_profiling.po | 309 +- howto/pyporting.po | 41 +- howto/regex.po | 1406 +++- howto/remote_debugging.po | 654 +- howto/sockets.po | 405 +- howto/sorting.po | 339 +- howto/timerfd.po | 79 +- howto/unicode.po | 718 +- howto/urllib2.po | 467 +- improve-page-nojs.po | 46 +- improve-page.po | 70 +- installing/index.po | 219 +- library/__future__.po | 199 +- library/__main__.po | 305 +- library/_thread.po | 196 +- library/abc.po | 252 +- library/aifc.po | 14 +- library/allos.po | 11 +- library/annotationlib.po | 733 +- library/archiving.po | 10 +- library/argparse.po | 1693 +++- library/array.po | 242 +- library/ast.po | 1508 +++- library/asynchat.po | 15 +- library/asyncio-api-index.po | 143 +- library/asyncio-dev.po | 283 +- library/asyncio-eventloop.po | 1769 +++- library/asyncio-exceptions.po | 40 +- library/asyncio-extending.po | 83 +- library/asyncio-future.po | 233 +- library/asyncio-graph.po | 119 +- library/asyncio-llapi-index.po | 336 +- library/asyncio-platforms.po | 101 +- library/asyncio-policy.po | 123 +- library/asyncio-protocol.po | 699 +- library/asyncio-queue.po | 168 +- library/asyncio-runner.po | 153 +- library/asyncio-stream.po | 331 +- library/asyncio-subprocess.po | 297 +- library/asyncio-sync.po | 288 +- library/asyncio-task.po | 1069 ++- library/asyncio-threading.po | 211 + library/asyncio-tools.po | 222 + library/asyncio.po | 112 +- library/asyncore.po | 15 +- library/atexit.po | 101 +- library/audioop.po | 14 +- library/audit_events.po | 50 +- library/base64.po | 377 +- library/bdb.po | 420 +- library/binary.po | 21 +- library/binascii.po | 146 +- library/bisect.po | 172 +- library/builtins.po | 30 +- library/bz2.po | 278 +- library/calendar.po | 472 +- library/cgi.po | 20 +- library/cgitb.po | 20 +- library/chunk.po | 14 +- library/cmath.po | 313 +- library/cmd.po | 261 +- library/cmdline.po | 55 +- library/cmdlinelibs.po | 9 +- library/code.po | 192 +- library/codecs.po | 1637 +++- library/codeop.po | 74 +- library/collections.abc.po | 415 +- library/collections.po | 1059 ++- library/colorsys.po | 29 +- library/compileall.po | 298 +- library/compression.po | 20 +- library/compression.zstd.po | 826 +- library/concurrency.po | 12 +- library/concurrent.futures.po | 661 +- library/concurrent.interpreters.po | 298 +- library/concurrent.po | 9 +- library/configparser.po | 1011 ++- library/constants.po | 108 +- library/contextlib.po | 708 +- library/contextvars.po | 224 +- library/copy.po | 129 +- library/copyreg.po | 45 +- library/crypt.po | 21 +- library/crypto.po | 10 +- library/csv.po | 544 +- library/ctypes.po | 2608 +++++- library/curses.ascii.po | 160 +- library/curses.panel.po | 74 +- library/curses.po | 1617 +++- library/custominterp.po | 12 +- library/dataclasses.po | 790 +- library/datatypes.po | 18 +- library/datetime.po | 2266 ++++- library/dbm.po | 365 +- library/debug.po | 12 +- library/decimal.po | 1607 +++- library/development.po | 12 +- library/devmode.po | 209 +- library/dialog.po | 267 +- library/difflib.po | 718 +- library/dis.po | 1391 +++- library/distribution.po | 10 +- library/distutils.po | 16 +- library/doctest.po | 1740 +++- library/email.charset.po | 214 +- library/email.compat32-message.po | 733 +- library/email.contentmanager.po | 213 +- library/email.encoders.po | 79 +- library/email.errors.po | 132 +- library/email.examples.po | 119 +- library/email.generator.po | 273 +- library/email.header.po | 252 +- library/email.headerregistry.po | 461 +- library/email.iterators.po | 58 +- library/email.message.po | 726 +- library/email.mime.po | 251 +- library/email.parser.po | 307 +- library/email.po | 147 +- library/email.policy.po | 618 +- library/email.utils.po | 195 +- library/ensurepip.po | 158 +- library/enum.po | 765 +- library/errno.po | 260 +- library/exceptions.po | 1013 ++- library/faulthandler.po | 230 +- library/fcntl.po | 270 +- library/filecmp.po | 149 +- library/fileformats.po | 8 +- library/fileinput.po | 223 +- library/filesys.po | 24 +- library/fnmatch.po | 98 +- library/fractions.po | 193 +- library/frameworks.po | 11 +- library/ftplib.po | 392 +- library/functional.po | 9 +- library/functions.po | 2860 +++++-- library/functools.po | 615 +- library/gc.po | 319 +- library/getopt.po | 163 +- library/getpass.po | 61 +- library/gettext.po | 590 +- library/glob.po | 172 +- library/graphlib.po | 185 +- library/grp.po | 58 +- library/gzip.po | 277 +- library/hashlib.po | 626 +- library/heapq.po | 385 +- library/hmac.po | 115 +- library/html.entities.po | 32 +- library/html.parser.po | 244 +- library/html.po | 26 +- library/http.client.po | 505 +- library/http.cookiejar.po | 698 +- library/http.cookies.po | 198 +- library/http.po | 314 +- library/http.server.po | 616 +- library/i18n.po | 11 +- library/idle.po | 1097 ++- library/imaplib.po | 596 +- library/imghdr.po | 20 +- library/imp.po | 19 +- library/importlib.metadata.po | 504 +- library/importlib.po | 1198 ++- library/importlib.resources.abc.po | 144 +- library/importlib.resources.po | 238 +- library/index.po | 37 +- library/inspect.po | 1396 +++- library/internet.po | 16 +- library/intro.po | 212 +- library/io.po | 1302 ++- library/ipaddress.po | 758 +- library/ipc.po | 15 +- library/itertools.po | 558 +- library/json.po | 621 +- library/keyword.po | 25 +- library/language.po | 10 +- library/linecache.po | 64 +- library/locale.po | 659 +- library/logging.config.po | 932 ++- library/logging.handlers.po | 1143 ++- library/logging.po | 1563 +++- library/lzma.po | 569 +- library/mailbox.po | 1344 ++- library/mailcap.po | 14 +- library/markup.po | 10 +- library/marshal.po | 204 +- library/math.po | 723 +- library/mimetypes.po | 308 +- library/mm.po | 9 +- library/mmap.po | 318 +- library/modulefinder.po | 53 +- library/modules.po | 9 +- library/msilib.po | 14 +- library/msvcrt.po | 201 +- library/multiprocessing.po | 2779 ++++++- library/multiprocessing.shared_memory.po | 296 +- library/netdata.po | 8 +- library/netrc.po | 74 +- library/nis.po | 14 +- library/nntplib.po | 14 +- library/numbers.po | 160 +- library/numeric.po | 13 +- library/operator.po | 330 +- library/optparse.po | 1969 ++++- library/os.path.po | 516 +- library/os.po | 4939 +++++++++-- library/ossaudiodev.po | 14 +- library/pathlib.po | 1457 +++- library/pdb.po | 707 +- library/persistence.po | 12 +- library/pickle.po | 1149 ++- library/pickletools.po | 74 +- library/pipes.po | 15 +- library/pkgutil.po | 224 +- library/platform.po | 367 +- library/plistlib.po | 148 +- library/poplib.po | 218 +- library/posix.po | 88 +- library/pprint.po | 212 +- library/profile.po | 705 +- library/pty.po | 105 +- library/pwd.po | 63 +- library/py_compile.po | 151 +- library/pyclbr.po | 98 +- library/pydoc.po | 126 +- library/pyexpat.po | 764 +- library/python.po | 14 +- library/queue.po | 285 +- library/quopri.po | 51 +- library/random.po | 617 +- library/re.po | 1634 +++- library/readline.po | 295 +- library/removed.po | 8 +- library/reprlib.po | 151 +- library/resource.po | 300 +- library/rlcompleter.po | 61 +- library/runpy.po | 198 +- library/sched.po | 106 +- library/secrets.po | 129 +- library/security_warnings.po | 68 +- library/select.po | 493 +- library/selectors.po | 206 +- library/shelve.po | 190 +- library/shlex.po | 400 +- library/shutil.po | 864 +- library/signal.po | 607 +- library/site.po | 271 +- library/smtpd.po | 19 +- library/smtplib.po | 561 +- library/sndhdr.po | 20 +- library/socket.po | 2055 ++++- library/socketserver.po | 472 +- library/spwd.po | 19 +- library/sqlite3.po | 1809 +++- library/ssl.po | 2402 +++++- library/stat.po | 210 +- library/statistics.po | 948 ++- library/stdtypes.po | 5050 ++++++++++-- library/string.po | 916 +- library/string.templatelib.po | 194 +- library/stringprep.po | 104 +- library/struct.po | 599 +- library/subprocess.po | 1408 +++- library/sunau.po | 14 +- library/superseded.po | 26 +- library/symtable.po | 205 +- library/sys.monitoring.po | 380 +- library/sys.po | 2058 ++++- library/sys_path_init.po | 163 +- library/sysconfig.po | 413 +- library/syslog.po | 142 +- library/tabnanny.po | 46 +- library/tarfile.po | 1212 ++- library/telnetlib.po | 20 +- library/tempfile.po | 433 +- library/termios.po | 98 +- library/test.po | 1390 +++- library/text.po | 14 +- library/textwrap.po | 258 +- library/threading.po | 1255 ++- library/threadsafety.po | 457 +- library/time.po | 903 +- library/timeit.po | 265 +- library/tk.po | 33 +- library/tkinter.colorchooser.po | 35 +- library/tkinter.dnd.po | 67 +- library/tkinter.font.po | 96 +- library/tkinter.messagebox.po | 157 +- library/tkinter.po | 7337 ++++++++++++++++- library/tkinter.scrolledtext.po | 30 +- library/tkinter.ttk.po | 1717 +++- library/token.po | 248 +- library/tokenize.po | 196 +- library/tomllib.po | 101 +- library/trace.po | 165 +- library/traceback.po | 517 +- library/tracemalloc.po | 545 +- library/tty.po | 66 +- library/turtle.po | 1725 +++- library/types.po | 396 +- library/typing.po | 2922 ++++++- library/unicodedata.po | 175 +- library/unittest.mock-examples.po | 836 +- library/unittest.mock.po | 1960 ++++- library/unittest.po | 2242 ++++- library/unix.po | 9 +- library/urllib.error.po | 62 +- library/urllib.parse.po | 699 +- library/urllib.po | 15 +- library/urllib.request.po | 1276 ++- library/urllib.robotparser.po | 64 +- library/uu.po | 21 +- library/uuid.po | 298 +- library/venv.po | 566 +- library/warnings.po | 712 +- library/wave.po | 182 +- library/weakref.po | 461 +- library/webbrowser.po | 233 +- library/windows.po | 8 +- library/winreg.po | 631 +- library/winsound.po | 110 +- library/wsgiref.po | 755 +- library/xdrlib.po | 14 +- library/xml.dom.minidom.po | 277 +- library/xml.dom.po | 879 +- library/xml.dom.pulldom.po | 105 +- library/xml.etree.elementtree.po | 1146 ++- library/xml.po | 99 +- library/xml.sax.handler.po | 405 +- library/xml.sax.po | 155 +- library/xml.sax.reader.po | 259 +- library/xml.sax.utils.po | 81 +- library/xmlrpc.client.po | 421 +- library/xmlrpc.po | 16 +- library/xmlrpc.server.po | 268 +- library/zipapp.po | 343 +- library/zipfile.po | 835 +- library/zipimport.po | 152 +- library/zlib.po | 429 +- library/zoneinfo.po | 393 +- license.po | 677 +- reference/compound_stmts.po | 1740 +++- reference/datamodel.po | 3769 +++++++-- reference/executionmodel.po | 615 +- reference/expressions.po | 2256 ++++- reference/grammar.po | 1953 ++++- reference/import.po | 1075 ++- reference/index.po | 14 +- reference/introduction.po | 253 +- reference/lexical_analysis.po | 1275 ++- reference/simple_stmts.po | 1018 ++- reference/toplevel_components.po | 79 +- sphinx.po | 182 +- tutorial/appendix.po | 239 +- tutorial/appetite.po | 218 +- tutorial/classes.po | 1398 +++- tutorial/controlflow.po | 1493 +++- tutorial/datastructures.po | 864 +- tutorial/errors.po | 759 +- tutorial/floatingpoint.po | 563 +- tutorial/index.po | 101 +- tutorial/inputoutput.po | 796 +- tutorial/interactive.po | 78 +- tutorial/interpreter.po | 281 +- tutorial/introduction.po | 704 +- tutorial/modules.po | 978 ++- tutorial/stdlib.po | 381 +- tutorial/stdlib2.po | 455 +- tutorial/venv.po | 264 +- tutorial/whatnow.po | 169 +- using/android.po | 97 +- using/cmdline.po | 1263 ++- using/configure.po | 1295 ++- using/editors.po | 27 +- using/index.po | 9 +- using/ios.po | 427 +- using/mac.po | 496 +- using/unix.po | 170 +- using/windows.po | 2366 +++++- whatsnew/2.0.po | 1342 ++- whatsnew/2.1.po | 816 +- whatsnew/2.2.po | 1332 ++- whatsnew/2.3.po | 1987 ++++- whatsnew/2.4.po | 1500 +++- whatsnew/2.5.po | 2281 ++++- whatsnew/2.6.po | 3096 ++++++- whatsnew/2.7.po | 2783 ++++++- whatsnew/3.0.po | 990 ++- whatsnew/3.1.po | 508 +- whatsnew/3.10.po | 2334 +++++- whatsnew/3.11.po | 2674 +++++- whatsnew/3.12.po | 3376 ++++++-- whatsnew/3.13.po | 3959 +++++++-- whatsnew/3.14.po | 4301 ++++++++-- whatsnew/3.2.po | 2540 +++++- whatsnew/3.3.po | 2626 +++++- whatsnew/3.4.po | 2826 ++++++- whatsnew/3.5.po | 2477 +++++- whatsnew/3.6.po | 2436 +++++- whatsnew/3.7.po | 2813 ++++++- whatsnew/3.8.po | 2341 +++++- whatsnew/3.9.po | 1848 ++++- whatsnew/changelog.po | 3 +- whatsnew/index.po | 15 +- 537 files changed, 252462 insertions(+), 41343 deletions(-) create mode 100644 library/asyncio-threading.po create mode 100644 library/asyncio-tools.po diff --git a/about.po b/about.po index 92d447c5d..168c55ded 100644 --- a/about.po +++ b/about.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,32 +24,78 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../about.rst:3 msgid "About this documentation" msgstr "دربارهٔ این مستندات" -msgid "Python's documentation is generated from `reStructuredText`_ sources using `Sphinx`_, a documentation generator originally created for Python and now maintained as an independent project." -msgstr "مستندات پایتون از طریق منابع `reStructuredText`_ با استفاده از `Sphinx`_ تولید می‌شوند، که یک تولیدگر مستندات است که در ابتدا برای پایتون ساخته شد و اکنون به‌عنوان یک پروژه مستقل نگهداری می‌شود." +#: ../../about.rst:6 +msgid "" +"Python's documentation is generated from `reStructuredText`_ sources using " +"`Sphinx`_, a documentation generator originally created for Python and now " +"maintained as an independent project." +msgstr "" +"مستندات پایتون از طریق منابع `reStructuredText`_ با استفاده از `Sphinx`_ " +"تولید می‌شوند، که یک تولیدگر مستندات است که در ابتدا برای پایتون ساخته شد و " +"اکنون به‌عنوان یک پروژه مستقل نگهداری می‌شود." -msgid "Development of the documentation and its toolchain is an entirely volunteer effort, just like Python itself. If you want to contribute, please take a look at the :ref:`reporting-bugs` page for information on how to do so. New volunteers are always welcome!" -msgstr "توسعهٔ مستندات و زنجیرهٔ ابزارهایش، همانند خود پایتون تلاشی کاملاً داوطلبانه است. اگر می‌خواهید مشارکت کنید برای اطّلاعات در مورد چگونگی آن نگاهی به صفحهٔ :ref:`reporting-bugs` بیندازید. همیشه از داوطلبان جدید استقبال می‌شود!" +#: ../../about.rst:16 +msgid "" +"Development of the documentation and its toolchain is an entirely volunteer " +"effort, just like Python itself. If you want to contribute, please take a " +"look at the :ref:`reporting-bugs` page for information on how to do so. New " +"volunteers are always welcome!" +msgstr "" +"توسعهٔ مستندات و زنجیرهٔ ابزارهایش، همانند خود پایتون تلاشی کاملاً داوطلبانه " +"است. اگر می‌خواهید مشارکت کنید برای اطّلاعات در مورد چگونگی آن نگاهی به " +"صفحهٔ :ref:`reporting-bugs` بیندازید. همیشه از داوطلبان جدید استقبال می‌شود!" +#: ../../about.rst:21 msgid "Many thanks go to:" msgstr "سپاس بسیار از:" -msgid "Fred L. Drake, Jr., the creator of the original Python documentation toolset and author of much of the content;" -msgstr "فرد ال. درک جونیور خالق مجموعه ابزارهای اصلی مستندات پایتون و نویسنده بسیاری از محتواها:" +#: ../../about.rst:23 +msgid "" +"Fred L. Drake, Jr., the creator of the original Python documentation toolset " +"and author of much of the content;" +msgstr "" +"فرد ال. درک جونیور خالق مجموعه ابزارهای اصلی مستندات پایتون و نویسنده بسیاری " +"از محتواها:" -msgid "the `Docutils `_ project for creating reStructuredText and the Docutils suite;" -msgstr "پروژه `Docutils `_ برای ایجاد reStructuredText و مجموعهٔ Docutils؛" +#: ../../about.rst:25 +msgid "" +"the `Docutils `_ project for creating " +"reStructuredText and the Docutils suite;" +msgstr "" +"پروژه `Docutils `_ برای ایجاد " +"reStructuredText و مجموعهٔ Docutils؛" -msgid "Fredrik Lundh for his Alternative Python Reference project from which Sphinx got many good ideas." -msgstr "فردریک لوند (Fredrik Lundh) برای پروژه‌ی \"Alternative Python Reference\" (مرجع جایگزین پایتون) که از آن بسیاری از ایده‌های خوب برای Sphinx (اسفینکس) گرفته شد." +#: ../../about.rst:27 +msgid "" +"Fredrik Lundh for his Alternative Python Reference project from which Sphinx " +"got many good ideas." +msgstr "" +"فردریک لوند (Fredrik Lundh) برای پروژه‌ی \"Alternative Python Reference\" " +"(مرجع جایگزین پایتون) که از آن بسیاری از ایده‌های خوب برای Sphinx (اسفینکس) " +"گرفته شد." +#: ../../about.rst:32 msgid "Contributors to the Python documentation" msgstr "مشارکت کنندگان مستندات پایتون" -msgid "Many people have contributed to the Python language, the Python standard library, and the Python documentation. See :source:`Misc/ACKS` in the Python source distribution for a partial list of contributors." -msgstr "افراد زیادی در توسعه زبان پایتون، کتابخانه استاندارد پایتون، و مستندات پایتون مشارکت داشته‌اند. برای مشاهده فهرستی از برخی از این مشارکت‌کنندگان، به :source:`Misc/ACKS` در توزیع سورس پایتون مراجعه کنید." +#: ../../about.rst:34 +msgid "" +"Many people have contributed to the Python language, the Python standard " +"library, and the Python documentation. See :source:`Misc/ACKS` in the " +"Python source distribution for a partial list of contributors." +msgstr "" +"افراد زیادی در توسعه زبان پایتون، کتابخانه استاندارد پایتون، و مستندات " +"پایتون مشارکت داشته‌اند. برای مشاهده فهرستی از برخی از این مشارکت‌کنندگان، " +"به :source:`Misc/ACKS` در توزیع سورس پایتون مراجعه کنید." -msgid "It is only with the input and contributions of the Python community that Python has such wonderful documentation -- Thank You!" -msgstr "فقط با مشارکت‌ها و کمک‌های جامعه پایتون است که پایتون چنین مستندات فوق‌العاده‌ای دارد -- سپاس از شما!" +#: ../../about.rst:38 +msgid "" +"It is only with the input and contributions of the Python community that " +"Python has such wonderful documentation -- Thank You!" +msgstr "" +"فقط با مشارکت‌ها و کمک‌های جامعه پایتون است که پایتون چنین مستندات فوق‌العاده‌ای " +"دارد -- سپاس از شما!" diff --git a/bugs.po b/bugs.po index 8fd79f19c..99d2d6608 100644 --- a/bugs.po +++ b/bugs.po @@ -16,7 +16,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-26 07:53+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/)\n" @@ -27,95 +27,252 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.6\n" +#: ../../bugs.rst:5 msgid "Dealing with Bugs" msgstr "رفع مشکلات" -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." -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." +msgstr "" +"پایتون زبان برنامه نویسی بالغیست که پایداریش شهرتی به هم زده. توسعه‌دهندگانش " +"مایلند برای حفظ این شهرت از هر نقصی که در پایتون می‌یابید آگاه شوند." -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:11 +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 msgid "Documentation bugs" msgstr "مشکلات مستندات" -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." -msgstr "اگر مشکلی در این مستندات یافته یا می‌خواهید بهبودی را پیشنهاد دهید، گزارش مشکلی روی :ref:`issue tracker `. ثبت کنید. اگر برای حلش پیشنهادی دارید، آن را هم بنویسید." +#: ../../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." +msgstr "" +"اگر مشکلی در این مستندات یافته یا می‌خواهید بهبودی را پیشنهاد دهید، گزارش " +"مشکلی روی :ref:`issue tracker `. ثبت کنید. اگر برای حلش " +"پیشنهادی دارید، آن را هم بنویسید." -msgid "If the bug or suggested improvement concerns the translation of this documentation, submit the report to the `translation’s repository `_ instead." -msgstr "اگر اشکال یا پیشنهاد بهبودی مربوط به ترجمهٔ این مستندات است، گزارش را به `مخزن ترجمه `_ ارسال کنید." +#: ../../bugs.rst:24 +msgid "" +"If the bug or suggested improvement concerns the translation of this " +"documentation, submit the report to the `translation’s repository " +"`_ instead." +msgstr "" +"اگر اشکال یا پیشنهاد بهبودی مربوط به ترجمهٔ این مستندات است، گزارش را به " +"`مخزن ترجمه `_ ارسال کنید." -msgid "You can also open a discussion item on our `Documentation Discourse forum `_." -msgstr "همچنین می‌توانید گفت‌وگویی در `انجمن‌های گفتمان مستندات `_ بگشایید." +#: ../../bugs.rst:28 +msgid "" +"You can also open a discussion item on our `Documentation Discourse forum " +"`_." +msgstr "" +"همچنین می‌توانید گفت‌وگویی در `انجمن‌های گفتمان مستندات `_ بگشایید." -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 `_." -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 `_." +msgstr "" +"اگر شما یک باگ در نحوه نمایش تم ها (اچ تی ام ال - سی اس اس - جاوا اسکریپت) " +"در مستندات پیدا کردید, لطفا یک گزارش باگ بر روی `آدرس `_ ثبت کنید." +#: ../../bugs.rst:37 msgid "`Documentation bugs`_" msgstr "`اشکالات مستندات`_" -msgid "A list of documentation bugs that have been submitted to the Python issue tracker." -msgstr "فهرستی از باگ‌های مستندات که به پایگاه پیگیری مشکلات پایتون ارسال شده‌اند." +#: ../../bugs.rst:38 +msgid "" +"A list of documentation bugs that have been submitted to the Python issue " +"tracker." +msgstr "" +"فهرستی از باگ‌های مستندات که به پایگاه پیگیری مشکلات پایتون ارسال شده‌اند." +#: ../../bugs.rst:40 msgid "`Issue Tracking `_" msgstr "`پیگیری مشکل `_" -msgid "Overview of the process involved in reporting an improvement on the tracker." +#: ../../bugs.rst:41 +msgid "" +"Overview of the process involved in reporting an improvement on the tracker." msgstr "مروری بر فرایند ثبت پیشنهاد بهبود در پایگاه پیگیری مشکلات." -msgid "`Helping with Documentation `_" -msgstr "`کمک به مستندسازی `_" +#: ../../bugs.rst:43 +msgid "" +"`Helping with Documentation `_" +msgstr "" +"`کمک به مستندسازی `_" -msgid "Comprehensive guide for individuals that are interested in contributing to Python documentation." -msgstr "راهنمای جامع برای افرادی که علاقه‌مند به مشارکت در مستندات Python هستند." +#: ../../bugs.rst:44 +msgid "" +"Comprehensive guide for individuals that are interested in contributing to " +"Python documentation." +msgstr "" +"راهنمای جامع برای افرادی که علاقه‌مند به مشارکت در مستندات Python هستند." -msgid "`Documentation Translations `_" -msgstr "`ترجمه های مستندات `_" +#: ../../bugs.rst:46 +msgid "" +"`Documentation Translations `_" +msgstr "" +"`ترجمه های مستندات `_" -msgid "A list of GitHub pages for documentation translation and their primary contacts." -msgstr "فهرستی از صفحات GitHub مربوط به ترجمهٔ مستندات و راه‌های ارتباطی مسئولان هر یک." +#: ../../bugs.rst:47 +msgid "" +"A list of GitHub pages for documentation translation and their primary " +"contacts." +msgstr "" +"فهرستی از صفحات GitHub مربوط به ترجمهٔ مستندات و راه‌های ارتباطی مسئولان هر یک." +#: ../../bugs.rst:53 msgid "Using the Python issue tracker" msgstr "استفاده از پایگاه پیگیری مشکلات پایتون" -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." -msgstr "گزارش‌های خطا برای پایتون باید از طریق پایگاه پیگیری مشکلات گیت‌هاب (https://github.com/python/cpython/issues) ارسال شوند. پایگاه پیگیری مشکلات گیت‌هاب یک فرم وب ارائه می‌دهد که امکان وارد کردن اطلاعات مرتبط و ارسال آن به توسعه‌دهندگان را فراهم می‌کند." +#: ../../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." +msgstr "" +"گزارش‌های خطا برای پایتون باید از طریق پایگاه پیگیری مشکلات گیت‌هاب (https://" +"github.com/python/cpython/issues) ارسال شوند. پایگاه پیگیری مشکلات گیت‌هاب یک " +"فرم وب ارائه می‌دهد که امکان وارد کردن اطلاعات مرتبط و ارسال آن به " +"توسعه‌دهندگان را فراهم می‌کند." -msgid "The first step in filing a report is to determine whether the problem has already been reported. The advantage in doing so, aside from saving the developers' time, is that you learn what has been done to fix it; it may be that the problem has already been fixed for the next release, or additional information is needed (in which case you are welcome to provide it if you can!). To do this, search the tracker using the search box at the top of the page." -msgstr "اولین گام در ارائه یک گزارش این است که مشخص کنید آیا مشکل قبلاً گزارش شده است یا خیر. مزیت انجام این کار، علاوه بر صرفه جویی در وقت توسعه دهندگان، این است که می‌توانید بفهمید چه اقداماتی برای رفع آن انجام شده است؛ ممکن است مشکل برای نسخه بعدی قبلاً رفع شده باشد، یا اطلاعات بیشتری مورد نیاز باشد (در این صورت، اگر می‌توانید، خوشحال می‌شویم آن را ارائه دهید!). برای انجام این کار، در نوار جست‌وجو بالای صفحه \"tracker\" را جست‌وجو کنید." +#: ../../bugs.rst:60 +msgid "" +"The first step in filing a report is to determine whether the problem has " +"already been reported. The advantage in doing so, aside from saving the " +"developers' time, is that you learn what has been done to fix it; it may be " +"that the problem has already been fixed for the next release, or additional " +"information is needed (in which case you are welcome to provide it if you " +"can!). To do this, search the tracker using the search box at the top of the " +"page." +msgstr "" +"اولین گام در ارائه یک گزارش این است که مشخص کنید آیا مشکل قبلاً گزارش شده است " +"یا خیر. مزیت انجام این کار، علاوه بر صرفه جویی در وقت توسعه دهندگان، این است " +"که می‌توانید بفهمید چه اقداماتی برای رفع آن انجام شده است؛ ممکن است مشکل برای " +"نسخه بعدی قبلاً رفع شده باشد، یا اطلاعات بیشتری مورد نیاز باشد (در این صورت، " +"اگر می‌توانید، خوشحال می‌شویم آن را ارائه دهید!). برای انجام این کار، در نوار " +"جست‌وجو بالای صفحه \"tracker\" را جست‌وجو کنید." -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." -msgstr "اگر مشکلی که گزارش می‌دهید در فهرست موجود نباشد، وارد GitHub شوید. اگر قبلاً حساب GitHub ندارید، با استفاده از لینک \"Sign up\" یک حساب جدید ایجاد کنید. ارسال گزارش باگ به صورت ناشناس امکان پذیر نیست." +#: ../../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." +msgstr "" +"اگر مشکلی که گزارش می‌دهید در فهرست موجود نباشد، وارد GitHub شوید. اگر قبلاً " +"حساب GitHub ندارید، با استفاده از لینک \"Sign up\" یک حساب جدید ایجاد کنید. " +"ارسال گزارش باگ به صورت ناشناس امکان پذیر نیست." -msgid "Being now logged in, you can submit an issue. Click on the \"New issue\" button in the top bar to report a new issue." -msgstr "اکنون که وارد سیستم شده اید، می توانید یک مشکل ثبت کنید. برای گزارش یک مشکل جدید، روی دکمه \"New issue\" در نوار بالا کلیک کنید." +#: ../../bugs.rst:72 +msgid "" +"Being now logged in, you can submit an issue. Click on the \"New issue\" " +"button in the top bar to report a new issue." +msgstr "" +"اکنون که وارد سیستم شده اید، می توانید یک مشکل ثبت کنید. برای گزارش یک مشکل " +"جدید، روی دکمه \"New issue\" در نوار بالا کلیک کنید." +#: ../../bugs.rst:75 msgid "The submission form has two fields, \"Title\" and \"Comment\"." msgstr "فرم ارسال شامل دو فیلد است، \"Title\" و \"Comment\"." -msgid "For the \"Title\" field, enter a *very* short description of the problem; fewer than ten words is good." -msgstr "برای بخش \"Title\", یک توضیح کوتاه از مشکل وارد کنید؛ کمتر از ده کلمه مناسب است." +#: ../../bugs.rst:77 +msgid "" +"For the \"Title\" field, enter a *very* short description of the problem; " +"fewer than ten words is good." +msgstr "" +"برای بخش \"Title\", یک توضیح کوتاه از مشکل وارد کنید؛ کمتر از ده کلمه مناسب " +"است." -msgid "In the \"Comment\" field, describe the problem in detail, including what you expected to happen and what did happen. Be sure to include whether any extension modules were involved, and what hardware and software platform you were using (including version information as appropriate)." -msgstr "در قسمت \"Comment\", مشکل را با جزئیات بیان کنید، از جمله اینکه انتظار داشتید چه اتفاقی بیفتد و چه چیزی واقعاً اتفاق افتاد. حتماً اشاره کنید که آیا ماژول‌های افزونه‌ای درگیر بودند یا خیر و از چه سخت افزار و پلتفرم نرم‌‌افزاری استفاده می‌کردید (شامل اطلاعات نسخه در صورت لزوم)." +#: ../../bugs.rst:80 +msgid "" +"In the \"Comment\" field, describe the problem in detail, including what you " +"expected to happen and what did happen. Be sure to include whether any " +"extension modules were involved, and what hardware and software platform you " +"were using (including version information as appropriate)." +msgstr "" +"در قسمت \"Comment\", مشکل را با جزئیات بیان کنید، از جمله اینکه انتظار " +"داشتید چه اتفاقی بیفتد و چه چیزی واقعاً اتفاق افتاد. حتماً اشاره کنید که آیا " +"ماژول‌های افزونه‌ای درگیر بودند یا خیر و از چه سخت افزار و پلتفرم نرم‌‌افزاری " +"استفاده می‌کردید (شامل اطلاعات نسخه در صورت لزوم)." -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." -msgstr "هر گزارش خطا توسط یک توسعه‌دهنده بررسی خواهد شد که تصمیم می‌گیرد چه اقداماتی برای رفع مشکل نیاز است. هر بار که اقدامی روی گزارش انجام شود، به شما اطلاع‌رسانی خواهد شد." +#: ../../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." +msgstr "" +"هر گزارش خطا توسط یک توسعه‌دهنده بررسی خواهد شد که تصمیم می‌گیرد چه اقداماتی " +"برای رفع مشکل نیاز است. هر بار که اقدامی روی گزارش انجام شود، به شما " +"اطلاع‌رسانی خواهد شد." -msgid "`How to Report Bugs Effectively `_" -msgstr "`نحوه گزارش اشکالات به طور موثر `_" +#: ../../bugs.rst:92 +msgid "" +"`How to Report Bugs Effectively `_" +msgstr "" +"`نحوه گزارش اشکالات به طور موثر `_" -msgid "Article which goes into some detail about how to create a useful bug report. This describes what kind of information is useful and why it is useful." -msgstr "مقاله‌ای که به‌طور مفصل به چگونگی ایجاد یک گزارش باگ مفید می‌پردازد. این مقاله بیان می‌کند که چه نوع اطلاعاتی مفید هستند و چرا این اطلاعات مفید می‌باشند." +#: ../../bugs.rst:93 +msgid "" +"Article which goes into some detail about how to create a useful bug report. " +"This describes what kind of information is useful and why it is useful." +msgstr "" +"مقاله‌ای که به‌طور مفصل به چگونگی ایجاد یک گزارش باگ مفید می‌پردازد. این مقاله " +"بیان می‌کند که چه نوع اطلاعاتی مفید هستند و چرا این اطلاعات مفید می‌باشند." -msgid "`Bug Writing Guidelines `_" -msgstr "`راهنمای نوشتن گزارش خطا `_" +#: ../../bugs.rst:96 +msgid "" +"`Bug Writing Guidelines `_" +msgstr "" +"`راهنمای نوشتن گزارش خطا `_" -msgid "Information about writing a good bug report. Some of this is specific to the Mozilla project, but describes general good practices." -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." +msgstr "" +"اطلاعاتی دربارهٔ نحوهٔ نگارش یک گزارش خطای خوب. بخشی از این اطلاعات به پروژهٔ " +"موزیلا اختصاص دارد، اما اصول کلی و خوبِ گزارش‌دهی را نیز توضیح می‌دهد." +#: ../../bugs.rst:103 msgid "Getting started contributing to Python yourself" msgstr "شروع مشارکت در توسعهٔ پایتون" -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." -msgstr "علاوه بر گزارش اشکالاتی که پیدا می‌کنید، می توانید وصله‌هایی برای رفع آن ها ارسال کنید. می‌توانید اطلاعات بیشتری درباره‌ی نحوه‌ی شروع به وصله زدن Python را در \"`Python Developer's Guide`_\" پیدا کنید. اگر سوالی دارید، \"`core-mentorship mailing list`_\" جای دوستانه‌ای برای دریافت پاسخ به هر سوال مربوط به فرآیند رفع اشکالات در Python است." +#: ../../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." +msgstr "" +"علاوه بر گزارش اشکالاتی که پیدا می‌کنید، می توانید وصله‌هایی برای رفع آن ها " +"ارسال کنید. می‌توانید اطلاعات بیشتری درباره‌ی نحوه‌ی شروع به وصله زدن Python را " +"در \"`Python Developer's Guide`_\" پیدا کنید. اگر سوالی دارید، \"`core-" +"mentorship mailing list`_\" جای دوستانه‌ای برای دریافت پاسخ به هر سوال مربوط " +"به فرآیند رفع اشکالات در Python است." diff --git a/c-api/abstract.po b/c-api/abstract.po index 9627d8c51..0fe0d085c 100644 --- a/c-api/abstract.po +++ b/c-api/abstract.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,11 +24,30 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/abstract.rst:7 msgid "Abstract Objects Layer" msgstr "لایه اشیاء انتزاعی (Abstract Objects Layer)" -msgid "The functions in this chapter interact with Python objects regardless of their type, or with wide classes of object types (e.g. all numerical types, or all sequence types). When used on object types for which they do not apply, they will raise a Python exception." -msgstr "توابع در این فصل با انواع اشیاء صرف نظر از نوع آنها یا با کلاس‌های گسترده‌ای از انواع اشیاء ( برای مثال همه‌ی اعداد یا همه‌ی انواع توالی) تعامل دارند. اگر این توابع بر روی نوعی از اشیاء استفاده شوند که برای آن‌ها تعریف نشده‌اند، یک استثنا در پایتون پرتاب خواهند کرد." +#: ../../c-api/abstract.rst:9 +msgid "" +"The functions in this chapter interact with Python objects regardless of " +"their type, or with wide classes of object types (e.g. all numerical types, " +"or all sequence types). When used on object types for which they do not " +"apply, they will raise a Python exception." +msgstr "" +"توابع در این فصل با انواع اشیاء صرف نظر از نوع آنها یا با کلاس‌های گسترده‌ای " +"از انواع اشیاء ( برای مثال همه‌ی اعداد یا همه‌ی انواع توالی) تعامل دارند. اگر " +"این توابع بر روی نوعی از اشیاء استفاده شوند که برای آن‌ها تعریف نشده‌اند، یک " +"استثنا در پایتون پرتاب خواهند کرد." -msgid "It is not possible to use these functions on objects that are not properly initialized, such as a list object that has been created by :c:func:`PyList_New`, but whose items have not been set to some non-\\ ``NULL`` value yet." -msgstr "امکان استفاده از این توابع بر روی اشیایی که به‌درستی مقداردهی اولیه نشده‌اند وجود ندارد؛ برای مثال، یک فهرست از اشیاء که با استفاده از :c:func:`PyList_New` ایجاد شده اما مقادیر آیتم‌های آن هنوز به مقداری غیر از ``NULL`` داده نشده است." +#: ../../c-api/abstract.rst:14 +msgid "" +"It is not possible to use these functions on objects that are not properly " +"initialized, such as a list object that has been created " +"by :c:func:`PyList_New`, but whose items have not been set to some non-\\ " +"``NULL`` value yet." +msgstr "" +"امکان استفاده از این توابع بر روی اشیایی که به‌درستی مقداردهی اولیه نشده‌اند " +"وجود ندارد؛ برای مثال، یک فهرست از اشیاء که با استفاده " +"از :c:func:`PyList_New` ایجاد شده اما مقادیر آیتم‌های آن هنوز به مقداری غیر " +"از ``NULL`` داده نشده است." diff --git a/c-api/allocation.po b/c-api/allocation.po index 5e573f30e..963b5774c 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 14:55+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/)\n" @@ -31,124 +31,283 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.6\n" +#: ../../c-api/allocation.rst:6 msgid "Allocating objects on the heap" msgstr "تخصیص اشیاء روی پشته" -msgid "Initialize a newly allocated object *op* with its type and initial reference. Returns the initialized object. Other fields of the object are not initialized. Despite its name, this function is unrelated to the object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` slot). Specifically, this function does **not** call the object's :meth:`!__init__` method." -msgstr "یک شیء *op* که به‌تازگی تخصیص داده شده را با نوع و مرجع اولیه‌اش مقداردهی اولیه می‌کند. شیء مقداردهی‌شده را برمی‌گرداند. سایر فیلدهای شیء مقداردهی اولیه نمی‌شوند. با وجود نام این تابع، آن به متد :meth:`~object.__init__` شیء (درگاه :c:member:`~PyTypeObject.tp_init`) مربوط نیست. به‌طور خاص، این تابع متد :meth:`!__init__` شیء را **فراخوانی نمی‌کند**." +#: ../../c-api/allocation.rst:17 +msgid "" +"Initialize a newly allocated object *op* with its type and initial " +"reference. Returns the initialized object. Other fields of the object are " +"not initialized. Despite its name, this function is unrelated to the " +"object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` " +"slot). Specifically, this function does **not** call the object's :meth:`!" +"__init__` method." +msgstr "" +"یک شیء *op* که به‌تازگی تخصیص داده شده را با نوع و مرجع اولیه‌اش مقداردهی " +"اولیه می‌کند. شیء مقداردهی‌شده را برمی‌گرداند. سایر فیلدهای شیء مقداردهی اولیه " +"نمی‌شوند. با وجود نام این تابع، آن به متد :meth:`~object.__init__` شیء " +"(درگاه :c:member:`~PyTypeObject.tp_init`) مربوط نیست. به‌طور خاص، این تابع " +"متد :meth:`!__init__` شیء را **فراخوانی نمی‌کند**." -msgid "In general, consider this function to be a low-level routine. Use :c:member:`~PyTypeObject.tp_alloc` where possible. For implementing :c:member:`!tp_alloc` for your type, prefer :c:func:`PyType_GenericAlloc` or :c:func:`PyObject_New`." -msgstr "در کل، این تابع را یک روتین سطح پایین در نظر بگیرید. تا جایی که ممکن است از :c:member:`~PyTypeObject.tp_alloc` استفاده کنید. برای پیاده‌سازی :c:member:`!tp_alloc` برای نوع خود، از :c:func:`PyType_GenericAlloc` یا :c:func:`PyObject_New` استفاده کنید." +#: ../../c-api/allocation.rst:24 +msgid "" +"In general, consider this function to be a low-level routine. " +"Use :c:member:`~PyTypeObject.tp_alloc` where possible. For " +"implementing :c:member:`!tp_alloc` for your type, " +"prefer :c:func:`PyType_GenericAlloc` or :c:func:`PyObject_New`." +msgstr "" +"در کل، این تابع را یک روتین سطح پایین در نظر بگیرید. تا جایی که ممکن است " +"از :c:member:`~PyTypeObject.tp_alloc` استفاده کنید. برای " +"پیاده‌سازی :c:member:`!tp_alloc` برای نوع خود، " +"از :c:func:`PyType_GenericAlloc` یا :c:func:`PyObject_New` استفاده کنید." -msgid "This function only initializes the object's memory corresponding to the initial :c:type:`PyObject` structure. It does not zero the rest." -msgstr "این تابع فقط حافظه‌ی شیء را که مربوط به ساختار ابتدایی :c:type:`PyObject` است، مقداردهی اولیه می‌کند. بقیه‌ی حافظه را صفر نمی‌کند." +#: ../../c-api/allocation.rst:31 +msgid "" +"This function only initializes the object's memory corresponding to the " +"initial :c:type:`PyObject` structure. It does not zero the rest." +msgstr "" +"این تابع فقط حافظه‌ی شیء را که مربوط به ساختار ابتدایی :c:type:`PyObject` " +"است، مقداردهی اولیه می‌کند. بقیه‌ی حافظه را صفر نمی‌کند." -msgid "This does everything :c:func:`PyObject_Init` does, and also initializes the length information for a variable-size object." -msgstr "این تابع همهٔ کارهایی را انجام می‌دهد که :c:func:`PyObject_Init` انجام می‌دهد، و همچنین اطلاعات مربوط به طول را برای یک شیء با اندازهٔ متغیر مقداردهی می‌کند." +#: ../../c-api/allocation.rst:37 +msgid "" +"This does everything :c:func:`PyObject_Init` does, and also initializes the " +"length information for a variable-size object." +msgstr "" +"این تابع همهٔ کارهایی را انجام می‌دهد که :c:func:`PyObject_Init` انجام می‌دهد، " +"و همچنین اطلاعات مربوط به طول را برای یک شیء با اندازهٔ متغیر مقداردهی می‌کند." -msgid "This function only initializes some of the object's memory. It does not zero the rest." -msgstr "این تابع فقط بخشی از حافظه‌ی شیء را مقداردهی اولیه می‌کند. بقیه‌ی حافظه را صفر نمی‌کند." +#: ../../c-api/allocation.rst:42 +msgid "" +"This function only initializes some of the object's memory. It does not " +"zero the rest." +msgstr "" +"این تابع فقط بخشی از حافظه‌ی شیء را مقداردهی اولیه می‌کند. بقیه‌ی حافظه را صفر " +"نمی‌کند." -msgid "Allocates a new Python object using the C structure type *TYPE* and the Python type object *typeobj* (``PyTypeObject*``) by calling :c:func:`PyObject_Malloc` to allocate memory and initializing it like :c:func:`PyObject_Init`. The caller will own the only reference to the object (i.e. its reference count will be one)." -msgstr "یک شیء پایتونی جدید با استفاده از نوع ساختار C یعنی *TYPE* و شیء نوع پایتون یعنی *typeobj* (``PyTypeObject*``) با فراخوانی :c:func:`PyObject_Malloc` برای تخصیص حافظه و مقداردهی اولیه‌ی آن مانند :c:func:`PyObject_Init` تخصیص می‌دهد. فراخوان‌نده، تنها مرجع به شیء را در اختیار خواهد داشت (یعنی شمارنده‌ی ارجاع آن یک خواهد بود)." +#: ../../c-api/allocation.rst:48 +msgid "" +"Allocates a new Python object using the C structure type *TYPE* and the " +"Python type object *typeobj* (``PyTypeObject*``) by " +"calling :c:func:`PyObject_Malloc` to allocate memory and initializing it " +"like :c:func:`PyObject_Init`. The caller will own the only reference to the " +"object (i.e. its reference count will be one)." +msgstr "" +"یک شیء پایتونی جدید با استفاده از نوع ساختار C یعنی *TYPE* و شیء نوع پایتون " +"یعنی *typeobj* (``PyTypeObject*``) با فراخوانی :c:func:`PyObject_Malloc` " +"برای تخصیص حافظه و مقداردهی اولیه‌ی آن مانند :c:func:`PyObject_Init` تخصیص " +"می‌دهد. فراخوان‌نده، تنها مرجع به شیء را در اختیار خواهد داشت (یعنی شمارنده‌ی " +"ارجاع آن یک خواهد بود)." -msgid "Avoid calling this directly to allocate memory for an object; call the type's :c:member:`~PyTypeObject.tp_alloc` slot instead." -msgstr "از فراخوانی مستقیم این تابع برای تخصیص حافظه به یک شیء خودداری کنید؛ به جای آن، درگاه :c:member:`~PyTypeObject.tp_alloc` تایپ را فراخوانی کنید." +#: ../../c-api/allocation.rst:54 ../../c-api/allocation.rst:107 +msgid "" +"Avoid calling this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +msgstr "" +"از فراخوانی مستقیم این تابع برای تخصیص حافظه به یک شیء خودداری کنید؛ به جای " +"آن، درگاه :c:member:`~PyTypeObject.tp_alloc` تایپ را فراخوانی کنید." -msgid "When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that simply calls this macro." -msgstr "هنگام پر کردن درگاه :c:member:`~PyTypeObject.tp_alloc` یک تایپ، :c:func:`PyType_GenericAlloc` بر یک تابع سفارشی که صرفاً این ماکرو را فراخوانی می‌کند، ترجیح داده می‌شود." +#: ../../c-api/allocation.rst:57 ../../c-api/allocation.rst:110 +msgid "" +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` " +"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that " +"simply calls this macro." +msgstr "" +"هنگام پر کردن درگاه :c:member:`~PyTypeObject.tp_alloc` یک " +"تایپ، :c:func:`PyType_GenericAlloc` بر یک تابع سفارشی که صرفاً این ماکرو را " +"فراخوانی می‌کند، ترجیح داده می‌شود." -msgid "This macro does not call :c:member:`~PyTypeObject.tp_alloc`, :c:member:`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or :c:member:`~PyTypeObject.tp_init` (:meth:`~object.__init__`)." -msgstr "این ماکرو :c:member:`~PyTypeObject.tp_alloc`، :c:member:`~PyTypeObject.tp_new` (:meth:`~object.__new__`) یا :c:member:`~PyTypeObject.tp_init` (:meth:`~object.__init__`) را فراخوانی نمی‌کند." +#: ../../c-api/allocation.rst:61 +msgid "" +"This macro does not " +"call :c:member:`~PyTypeObject.tp_alloc`, :c:member:`~PyTypeObject.tp_new` " +"(:meth:`~object.__new__`), or :c:member:`~PyTypeObject.tp_init` " +"(:meth:`~object.__init__`)." +msgstr "" +"این " +"ماکرو :c:member:`~PyTypeObject.tp_alloc`، :c:member:`~PyTypeObject.tp_new` " +"(:meth:`~object.__new__`) یا :c:member:`~PyTypeObject.tp_init` " +"(:meth:`~object.__init__`) را فراخوانی نمی‌کند." -msgid "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead." -msgstr "این را نمی‌توان برای اشیایی که :c:macro:`Py_TPFLAGS_HAVE_GC` در :c:member:`~PyTypeObject.tp_flags` آنها تنظیم شده است، استفاده کرد؛ به جای آن از :c:macro:`PyObject_GC_New` استفاده کنید." +#: ../../c-api/allocation.rst:65 +msgid "" +"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set " +"in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` " +"instead." +msgstr "" +"این را نمی‌توان برای اشیایی که :c:macro:`Py_TPFLAGS_HAVE_GC` " +"در :c:member:`~PyTypeObject.tp_flags` آنها تنظیم شده است، استفاده کرد؛ به " +"جای آن از :c:macro:`PyObject_GC_New` استفاده کنید." -msgid "Memory allocated by this macro must be freed with :c:func:`PyObject_Free` (usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." -msgstr "حافظه‌ای که توسط این ماکرو تخصیص داده می‌شود، باید با :c:func:`PyObject_Free` آزاد شود (معمولاً از طریق درگاه :c:member:`~PyTypeObject.tp_free` شیء فراخوانی می‌شود)." +#: ../../c-api/allocation.rst:68 +msgid "" +"Memory allocated by this macro must be freed with :c:func:`PyObject_Free` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" +"حافظه‌ای که توسط این ماکرو تخصیص داده می‌شود، باید با :c:func:`PyObject_Free` " +"آزاد شود (معمولاً از طریق درگاه :c:member:`~PyTypeObject.tp_free` شیء " +"فراخوانی می‌شود)." -msgid "The returned memory is not guaranteed to have been completely zeroed before it was initialized." -msgstr "حافظه‌ی برگشتی تضمین نمی‌شود که به‌طور کامل صفر شده باشد قبل از این‌که مقداردهی اولیه شود." +#: ../../c-api/allocation.rst:73 ../../c-api/allocation.rst:123 +msgid "" +"The returned memory is not guaranteed to have been completely zeroed before " +"it was initialized." +msgstr "" +"حافظه‌ی برگشتی تضمین نمی‌شود که به‌طور کامل صفر شده باشد قبل از این‌که مقداردهی " +"اولیه شود." -msgid "This macro does not construct a fully initialized object of the given type; it merely allocates memory and prepares it for further initialization by :c:member:`~PyTypeObject.tp_init`. To construct a fully initialized object, call *typeobj* instead. For example::" -msgstr "این ماکرو یک شیء کاملاً مقداردهی‌شده از نوع داده‌شده را نمی‌سازد؛ بلکه صرفاً حافظه تخصیص می‌دهد و آن را برای مقداردهی اولیه‌ی بیشتر توسط :c:member:`~PyTypeObject.tp_init` آماده می‌کند. برای ساختن یک شیء کاملاً مقداردهی‌شده، به جای آن *typeobj* را فراخوانی کنید. برای مثال::" +#: ../../c-api/allocation.rst:78 ../../c-api/allocation.rst:128 +msgid "" +"This macro does not construct a fully initialized object of the given type; " +"it merely allocates memory and prepares it for further initialization " +"by :c:member:`~PyTypeObject.tp_init`. To construct a fully initialized " +"object, call *typeobj* instead. For example::" +msgstr "" +"این ماکرو یک شیء کاملاً مقداردهی‌شده از نوع داده‌شده را نمی‌سازد؛ بلکه صرفاً " +"حافظه تخصیص می‌دهد و آن را برای مقداردهی اولیه‌ی بیشتر " +"توسط :c:member:`~PyTypeObject.tp_init` آماده می‌کند. برای ساختن یک شیء کاملاً " +"مقداردهی‌شده، به جای آن *typeobj* را فراخوانی کنید. برای مثال::" +#: ../../c-api/allocation.rst:83 msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" msgstr "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" +#: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137 +#: ../../c-api/allocation.rst:184 ../../c-api/allocation.rst:186 +#: ../../c-api/allocation.rst:188 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" +#: ../../c-api/allocation.rst:88 msgid ":c:macro:`PyObject_GC_New`" msgstr ":c:macro:`PyObject_GC_New`" +#: ../../c-api/allocation.rst:89 ../../c-api/allocation.rst:139 msgid ":c:func:`PyType_GenericAlloc`" msgstr ":c:func:`PyType_GenericAlloc`" +#: ../../c-api/allocation.rst:90 ../../c-api/allocation.rst:140 msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr ":c:member:`~PyTypeObject.tp_alloc`" +#: ../../c-api/allocation.rst:95 msgid "Like :c:macro:`PyObject_New` except:" msgstr "مثل :c:macro:`PyObject_New` جز:" -msgid "It allocates enough memory for the *TYPE* structure plus *size* (``Py_ssize_t``) fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*." -msgstr "این (ماکرو) به اندازه‌ی کافی برای ساختار *TYPE* به اضافه‌ی *size* (``Py_ssize_t``) فیلد به اندازه‌ای که توسط فیلد :c:member:`~PyTypeObject.tp_itemsize` از *typeobj* مشخص شده، حافظه تخصیص می‌دهد." +#: ../../c-api/allocation.rst:97 +msgid "" +"It allocates enough memory for the *TYPE* structure plus *size* " +"(``Py_ssize_t``) fields of the size given by " +"the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*." +msgstr "" +"این (ماکرو) به اندازه‌ی کافی برای ساختار *TYPE* به اضافه‌ی *size* " +"(``Py_ssize_t``) فیلد به اندازه‌ای که توسط " +"فیلد :c:member:`~PyTypeObject.tp_itemsize` از *typeobj* مشخص شده، حافظه " +"تخصیص می‌دهد." +#: ../../c-api/allocation.rst:100 msgid "The memory is initialized like :c:func:`PyObject_InitVar`." msgstr "حافظه، مانند :c:func:`PyObject_InitVar` مقداردهی اولیه می‌شود." -msgid "This is useful for implementing objects like tuples, which are able to determine their size at construction time. Embedding the array of fields into the same allocation decreases the number of allocations, improving the memory management efficiency." -msgstr "این (روش) برای پیاده‌سازی اشیایی مثل تاپل‌ها مفید است، که می‌توانند اندازه‌ی خود را در زمان ساخت تعیین کنند. جاسازی آرایه‌ی فیلدها در همان تخصیص، تعداد تخصیص‌ها را کاهش می‌دهد و بازدهی مدیریت حافظه را بهبود می‌بخشد." +#: ../../c-api/allocation.rst:102 +msgid "" +"This is useful for implementing objects like tuples, which are able to " +"determine their size at construction time. Embedding the array of fields " +"into the same allocation decreases the number of allocations, improving the " +"memory management efficiency." +msgstr "" +"این (روش) برای پیاده‌سازی اشیایی مثل تاپل‌ها مفید است، که می‌توانند اندازه‌ی خود " +"را در زمان ساخت تعیین کنند. جاسازی آرایه‌ی فیلدها در همان تخصیص، تعداد " +"تخصیص‌ها را کاهش می‌دهد و بازدهی مدیریت حافظه را بهبود می‌بخشد." -msgid "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` instead." -msgstr "این را نمی‌توان برای اشیایی که :c:macro:`Py_TPFLAGS_HAVE_GC` در :c:member:`~PyTypeObject.tp_flags` آنها تنظیم شده است، استفاده کرد؛ به جای آن از :c:macro:`PyObject_GC_NewVar` استفاده کنید." +#: ../../c-api/allocation.rst:114 +msgid "" +"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set " +"in :c:member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` " +"instead." +msgstr "" +"این را نمی‌توان برای اشیایی که :c:macro:`Py_TPFLAGS_HAVE_GC` " +"در :c:member:`~PyTypeObject.tp_flags` آنها تنظیم شده است، استفاده کرد؛ به " +"جای آن از :c:macro:`PyObject_GC_NewVar` استفاده کنید." -msgid "Memory allocated by this function must be freed with :c:func:`PyObject_Free` (usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." -msgstr "حافظه‌ای که توسط این تابع تخصیص داده می‌شود، باید با :c:func:`PyObject_Free` آزاد شود (معمولاً از طریق درگاه :c:member:`~PyTypeObject.tp_free` شیء فراخوانی می‌شود)." +#: ../../c-api/allocation.rst:118 +msgid "" +"Memory allocated by this function must be freed with :c:func:`PyObject_Free` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" +"حافظه‌ای که توسط این تابع تخصیص داده می‌شود، باید با :c:func:`PyObject_Free` " +"آزاد شود (معمولاً از طریق درگاه :c:member:`~PyTypeObject.tp_free` شیء " +"فراخوانی می‌شود)." -msgid "PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" -msgstr "PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" +#: ../../c-api/allocation.rst:133 +msgid "" +"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" +msgstr "" +"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" +#: ../../c-api/allocation.rst:138 msgid ":c:macro:`PyObject_GC_NewVar`" msgstr ":c:macro:`PyObject_GC_NewVar`" -msgid "Object which is visible in Python as ``None``. This should only be accessed using the :c:macro:`Py_None` macro, which evaluates to a pointer to this object." +#: ../../c-api/allocation.rst:145 +msgid "" +"Object which is visible in Python as ``None``. This should only be accessed " +"using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " +"object." msgstr "" "شیء‌ای که در پایتون به صورت ``None`` قابل مشاهده است\n" -"این فقط باید با استفاده از ماکرو :c:macro:`Py_None`، که به یک اشاره‌گر به این شیء ارزیابی می‌شود، دسترسی پذیر باشد." +"این فقط باید با استفاده از ماکرو :c:macro:`Py_None`، که به یک اشاره‌گر به این " +"شیء ارزیابی می‌شود، دسترسی پذیر باشد." +#: ../../c-api/allocation.rst:152 msgid ":ref:`moduleobjects`" msgstr ":ref:`moduleobjects`" +#: ../../c-api/allocation.rst:153 msgid "To allocate and create extension modules." msgstr "برای تخصیص و ایجاد ماژول‌های افزونه." +#: ../../c-api/allocation.rst:157 msgid "Soft-deprecated aliases" msgstr "نامهای مستعار با منسوخ‌سازی نرم" -msgid "These are aliases to existing functions and macros. They exist solely for backwards compatibility." -msgstr "اینها نامهای مستعاری برای توابع و ماکروهای موجود هستند. آن‌ها صرفاً برای سازگاری با نسخه‌های قبلی وجود دارند." +#: ../../c-api/allocation.rst:161 +msgid "" +"These are aliases to existing functions and macros. They exist solely for " +"backwards compatibility." +msgstr "" +"اینها نامهای مستعاری برای توابع و ماکروهای موجود هستند. آن‌ها صرفاً برای " +"سازگاری با نسخه‌های قبلی وجود دارند." +#: ../../c-api/allocation.rst:169 msgid "Soft-deprecated alias" msgstr "نامهای مستعار با منسوخ‌سازی نرم" +#: ../../c-api/allocation.rst:170 msgid "Function" msgstr "تابع" +#: ../../c-api/allocation.rst:172 msgid ":c:macro:`PyObject_New`" msgstr ":c:macro:`PyObject_New`" +#: ../../c-api/allocation.rst:174 msgid ":c:macro:`PyObject_NewVar`" msgstr ":c:macro:`PyObject_NewVar`" +#: ../../c-api/allocation.rst:176 msgid ":c:func:`PyObject_Init`" msgstr ":c:func:`PyObject_Init`" +#: ../../c-api/allocation.rst:178 msgid ":c:func:`PyObject_InitVar`" msgstr ":c:func:`PyObject_InitVar`" +#: ../../c-api/allocation.rst:180 msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" +#: ../../c-api/allocation.rst:182 msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index cb82275a4..70800ad66 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -17,7 +17,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -27,177 +27,275 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/apiabiversion.rst:7 msgid "API and ABI Versioning" msgstr "نسخه‌گذاری API و ABI" +#: ../../c-api/apiabiversion.rst:11 msgid "Build-time version constants" msgstr "ثابتهای نسخه در زمان ساخت" -msgid "CPython exposes its version number in the following macros. Note that these correspond to the version code is **built** with. See :c:var:`Py_Version` for the version used at **run time**." -msgstr "CPython شماره‌ی نسخه‌ی خود را در ماکروهای زیر در معرض دید قرار می‌دهد. توجه داشته باشید که اینها مربوط به نسخه‌ای هستند که کد با آن **ساخته (build)** شده است. برای نسخه‌ای که در **زمان اجرا (run time)** استفاده می‌شود، به :c:var:`Py_Version` مراجعه کنید." +#: ../../c-api/apiabiversion.rst:13 +msgid "" +"CPython exposes its version number in the following macros. Note that these " +"correspond to the version code is **built** with. See :c:var:`Py_Version` " +"for the version used at **run time**." +msgstr "" +"CPython شماره‌ی نسخه‌ی خود را در ماکروهای زیر در معرض دید قرار می‌دهد. توجه " +"داشته باشید که اینها مربوط به نسخه‌ای هستند که کد با آن **ساخته (build)** شده " +"است. برای نسخه‌ای که در **زمان اجرا (run time)** استفاده می‌شود، " +"به :c:var:`Py_Version` مراجعه کنید." -msgid "See :ref:`stable` for a discussion of API and ABI stability across versions." -msgstr "برای بحث درباره‌ی پایداری API و ABI در میان نسخه‌ها، به :ref:`stable` مراجعه کنید." +#: ../../c-api/apiabiversion.rst:17 +msgid "" +"See :ref:`stable` for a discussion of API and ABI stability across versions." +msgstr "" +"برای بحث درباره‌ی پایداری API و ABI در میان نسخه‌ها، به :ref:`stable` مراجعه " +"کنید." +#: ../../c-api/apiabiversion.rst:21 msgid "The ``3`` in ``3.4.1a2``." msgstr "``3`` در ``3.4.1a2``." +#: ../../c-api/apiabiversion.rst:25 msgid "The ``4`` in ``3.4.1a2``." msgstr "``4`` در ``3.4.1a2``." +#: ../../c-api/apiabiversion.rst:29 msgid "The ``1`` in ``3.4.1a2``." msgstr "``1`` در ``3.4.1a2``." -msgid "The ``a`` in ``3.4.1a2``. This can be ``0xA`` for alpha, ``0xB`` for beta, ``0xC`` for release candidate or ``0xF`` for final." -msgstr "``a`` در ``3.4.1a2``. این می‌تواند ``0xA`` برای آلفا باشد، ``0xB`` برای بتا، ``0xC`` برای کاندیدای انتشار (release candidate) یا ``0xF`` برای نهایی (final)." +#: ../../c-api/apiabiversion.rst:33 +msgid "" +"The ``a`` in ``3.4.1a2``. This can be ``0xA`` for alpha, ``0xB`` for beta, " +"``0xC`` for release candidate or ``0xF`` for final." +msgstr "" +"``a`` در ``3.4.1a2``. این می‌تواند ``0xA`` برای آلفا باشد، ``0xB`` برای بتا، " +"``0xC`` برای کاندیدای انتشار (release candidate) یا ``0xF`` برای نهایی " +"(final)." +#: ../../c-api/apiabiversion.rst:39 msgid "The ``2`` in ``3.4.1a2``. Zero for final releases." msgstr "``2`` در ``3.4.1a2``. برای انتشارهای نهایی، صفر است." -msgid "The Python version number encoded in a single integer. See :c:func:`Py_PACK_FULL_VERSION` for the encoding details." -msgstr "شماره‌ی نسخه‌ی پایتون که در یک عدد صحیح کدگذاری شده است. برای جزئیات کدگذاری، به :c:func:`Py_PACK_FULL_VERSION` مراجعه کنید." +#: ../../c-api/apiabiversion.rst:43 +msgid "" +"The Python version number encoded in a single integer. " +"See :c:func:`Py_PACK_FULL_VERSION` for the encoding details." +msgstr "" +"شماره‌ی نسخه‌ی پایتون که در یک عدد صحیح کدگذاری شده است. برای جزئیات کدگذاری، " +"به :c:func:`Py_PACK_FULL_VERSION` مراجعه کنید." -msgid "Use this for numeric comparisons, for example, ``#if PY_VERSION_HEX >= ...``." -msgstr "از این (مقدار) برای مقایسه‌های عددی استفاده کنید، برای مثال، ``#if PY_VERSION_HEX >= ...``." +#: ../../c-api/apiabiversion.rst:46 +msgid "" +"Use this for numeric comparisons, for example, ``#if PY_VERSION_HEX >= ...``." +msgstr "" +"از این (مقدار) برای مقایسه‌های عددی استفاده کنید، برای مثال، ``#if " +"PY_VERSION_HEX >= ...``." +#: ../../c-api/apiabiversion.rst:49 msgid "These macros are defined in :source:`Include/patchlevel.h`." msgstr "این ماکروها در :source:`Include/patchlevel.h` تعریف می‌شوند." +#: ../../c-api/apiabiversion.rst:53 msgid "Run-time version" msgstr "نسخه‌ی زمان اجرا" -msgid "The Python runtime version number encoded in a single constant integer. See :c:func:`Py_PACK_FULL_VERSION` for the encoding details. This contains the Python version used at run time." -msgstr "شماره‌ی نسخه‌ی زمان اجرای پایتون که در یک عدد صحیح ثابت کدگذاری شده است. برای جزئیات کدگذاری، به :c:func:`Py_PACK_FULL_VERSION` مراجعه کنید. این (مقدار) شامل نسخه‌ی پایتون است که در زمان اجرا استفاده می‌شود." +#: ../../c-api/apiabiversion.rst:57 +msgid "" +"The Python runtime version number encoded in a single constant integer. " +"See :c:func:`Py_PACK_FULL_VERSION` for the encoding details. This contains " +"the Python version used at run time." +msgstr "" +"شماره‌ی نسخه‌ی زمان اجرای پایتون که در یک عدد صحیح ثابت کدگذاری شده است. برای " +"جزئیات کدگذاری، به :c:func:`Py_PACK_FULL_VERSION` مراجعه کنید. این (مقدار) " +"شامل نسخه‌ی پایتون است که در زمان اجرا استفاده می‌شود." -msgid "Use this for numeric comparisons, for example, ``if (Py_Version >= ...)``." -msgstr "از این (مقدار) برای مقایسه‌های عددی استفاده کنید، برای مثال، ``if (Py_Version >= ...)``." +#: ../../c-api/apiabiversion.rst:61 +msgid "" +"Use this for numeric comparisons, for example, ``if (Py_Version >= ...)``." +msgstr "" +"از این (مقدار) برای مقایسه‌های عددی استفاده کنید، برای مثال، ``if (Py_Version " +">= ...)``." +#: ../../c-api/apiabiversion.rst:67 msgid "Bit-packing macros" msgstr "ماکروهای بسته‌بندی بیتی" -msgid "Return the given version, encoded as a single 32-bit integer with the following structure:" -msgstr "نسخه‌ی داده‌شده را که به صورت یک عدد صحیح ۳۲-بیتی با ساختار زیر کدگذاری شده است، برمی‌گرداند:" +#: ../../c-api/apiabiversion.rst:71 +msgid "" +"Return the given version, encoded as a single 32-bit integer with the " +"following structure:" +msgstr "" +"نسخه‌ی داده‌شده را که به صورت یک عدد صحیح ۳۲-بیتی با ساختار زیر کدگذاری شده " +"است، برمی‌گرداند:" +#: ../../c-api/apiabiversion.rst:77 msgid "Argument" msgstr "آرگومان" +#: ../../c-api/apiabiversion.rst:75 msgid "No. of bits" msgstr "تعداد بیت‌ها" +#: ../../c-api/apiabiversion.rst:77 msgid "Bit mask" msgstr "ماسک بیتی" +#: ../../c-api/apiabiversion.rst:77 msgid "Bit shift" msgstr "شیفت بیتی" +#: ../../c-api/apiabiversion.rst:75 msgid "Example values" msgstr "مقادیر نمونه" +#: ../../c-api/apiabiversion.rst:77 ../../c-api/apiabiversion.rst:95 msgid "``3.4.1a2``" msgstr "``3.4.1a2``" +#: ../../c-api/apiabiversion.rst:77 ../../c-api/apiabiversion.rst:97 msgid "``3.10.0``" msgstr "``3.10.0``" +#: ../../c-api/apiabiversion.rst:79 msgid "*major*" msgstr "*major*" +#: ../../c-api/apiabiversion.rst:79 ../../c-api/apiabiversion.rst:81 +#: ../../c-api/apiabiversion.rst:83 msgid "8" msgstr "8" +#: ../../c-api/apiabiversion.rst:79 msgid "``0xFF000000``" msgstr "``0xFF000000``" +#: ../../c-api/apiabiversion.rst:79 msgid "24" msgstr "24" +#: ../../c-api/apiabiversion.rst:79 msgid "``0x03``" msgstr "``0x03``" +#: ../../c-api/apiabiversion.rst:81 msgid "*minor*" msgstr "*minor*" +#: ../../c-api/apiabiversion.rst:81 msgid "``0x00FF0000``" msgstr "``0x00FF0000``" +#: ../../c-api/apiabiversion.rst:81 msgid "16" msgstr "16" +#: ../../c-api/apiabiversion.rst:81 msgid "``0x04``" msgstr "``0x04``" +#: ../../c-api/apiabiversion.rst:81 msgid "``0x0A``" msgstr "``0x0A``" +#: ../../c-api/apiabiversion.rst:83 msgid "*micro*" msgstr "*micro*" +#: ../../c-api/apiabiversion.rst:83 msgid "``0x0000FF00``" msgstr "``0x0000FF00``" +#: ../../c-api/apiabiversion.rst:83 msgid "``0x01``" msgstr "``0x01``" +#: ../../c-api/apiabiversion.rst:83 msgid "``0x00``" msgstr "``0x00``" +#: ../../c-api/apiabiversion.rst:85 msgid "*release_level*" msgstr "*release_level*" +#: ../../c-api/apiabiversion.rst:85 ../../c-api/apiabiversion.rst:87 msgid "4" msgstr "4" +#: ../../c-api/apiabiversion.rst:85 msgid "``0x000000F0``" msgstr "``0x000000F0``" +#: ../../c-api/apiabiversion.rst:85 msgid "``0xA``" msgstr "``0xA``" +#: ../../c-api/apiabiversion.rst:85 msgid "``0xF``" msgstr "``0xF``" +#: ../../c-api/apiabiversion.rst:87 msgid "*release_serial*" msgstr "*release_serial*" +#: ../../c-api/apiabiversion.rst:87 msgid "``0x0000000F``" msgstr "``0x0000000F``" +#: ../../c-api/apiabiversion.rst:87 msgid "0" msgstr "0" +#: ../../c-api/apiabiversion.rst:87 msgid "``0x2``" msgstr "``0x2``" +#: ../../c-api/apiabiversion.rst:87 msgid "``0x0``" msgstr "``0x0``" +#: ../../c-api/apiabiversion.rst:90 msgid "For example:" msgstr "برای مثال:" +#: ../../c-api/apiabiversion.rst:93 msgid "Version" msgstr "نسخه" +#: ../../c-api/apiabiversion.rst:93 msgid "``Py_PACK_FULL_VERSION`` arguments" msgstr "آرگومان‌های ``Py_PACK_FULL_VERSION``" +#: ../../c-api/apiabiversion.rst:93 msgid "Encoded version" msgstr "نسخه‌ی کدگذاری شده" +#: ../../c-api/apiabiversion.rst:95 msgid "``(3, 4, 1, 0xA, 2)``" msgstr "``(3, 4, 1, 0xA, 2)``" +#: ../../c-api/apiabiversion.rst:95 msgid "``0x030401a2``" msgstr "``0x030401a2``" +#: ../../c-api/apiabiversion.rst:97 msgid "``(3, 10, 0, 0xF, 0)``" msgstr "``(3, 10, 0, 0xF, 0)``" +#: ../../c-api/apiabiversion.rst:97 msgid "``0x030a00f0``" msgstr "``0x030a00f0``" -msgid "Out-of range bits in the arguments are ignored. That is, the macro can be defined as:" -msgstr "بیت‌های خارج از محدوده در آرگومان‌ها نادیده گرفته می‌شوند. به عبارت دیگر، این ماکرو را می‌توان به صورت زیر تعریف کرد:" +#: ../../c-api/apiabiversion.rst:100 +msgid "" +"Out-of range bits in the arguments are ignored. That is, the macro can be " +"defined as:" +msgstr "" +"بیت‌های خارج از محدوده در آرگومان‌ها نادیده گرفته می‌شوند. به عبارت دیگر، این " +"ماکرو را می‌توان به صورت زیر تعریف کرد:" +#: ../../c-api/apiabiversion.rst:103 msgid "" "#ifndef Py_PACK_FULL_VERSION\n" "#define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \\\n" @@ -217,8 +315,20 @@ msgstr "" " (((SERIAL) & 0xf) << 0))\n" "#endif" -msgid "``Py_PACK_FULL_VERSION`` is primarily a macro, intended for use in ``#if`` directives, but it is also available as an exported function." -msgstr "``Py_PACK_FULL_VERSION`` در درجه‌ی اول یک ماکرو است که برای استفاده در دستورات ``#if`` در نظر گرفته شده است، اما به‌عنوان یک تابع صادرشده نیز در دسترس است." +#: ../../c-api/apiabiversion.rst:114 +msgid "" +"``Py_PACK_FULL_VERSION`` is primarily a macro, intended for use in ``#if`` " +"directives, but it is also available as an exported function." +msgstr "" +"``Py_PACK_FULL_VERSION`` در درجه‌ی اول یک ماکرو است که برای استفاده در " +"دستورات ``#if`` در نظر گرفته شده است، اما به‌عنوان یک تابع صادرشده نیز در " +"دسترس است." -msgid "Equivalent to ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)``. The result does not correspond to any Python release, but is useful in numeric comparisons." -msgstr "معادل ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)`` است. نتیجه با هیچ نسخه‌ی انتشار یافته‌ای از پایتون مطابقت ندارد، اما در مقایسه‌های عددی مفید است." +#: ../../c-api/apiabiversion.rst:121 +msgid "" +"Equivalent to ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)``. The result " +"does not correspond to any Python release, but is useful in numeric " +"comparisons." +msgstr "" +"معادل ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)`` است. نتیجه با هیچ " +"نسخه‌ی انتشار یافته‌ای از پایتون مطابقت ندارد، اما در مقایسه‌های عددی مفید است." diff --git a/c-api/arg.po b/c-api/arg.po index ca883a002..e9d52ca17 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,423 +25,843 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/arg.rst:6 msgid "Parsing arguments and building values" msgstr "" -msgid "These functions are useful when creating your own extension functions and methods. Additional information and examples are available in :ref:`extending-index`." +#: ../../c-api/arg.rst:8 +msgid "" +"These functions are useful when creating your own extension functions and " +"methods. Additional information and examples are available " +"in :ref:`extending-index`." msgstr "" -msgid "The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell the function about the expected arguments. The format strings use the same syntax for each of these functions." +#: ../../c-api/arg.rst:12 +msgid "" +"The first three of these functions " +"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " +"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " +"the function about the expected arguments. The format strings use the same " +"syntax for each of these functions." msgstr "" +#: ../../c-api/arg.rst:19 msgid "Parsing arguments" msgstr "" -msgid "A format string consists of zero or more \"format units.\" A format unit describes one Python object; it is usually a single character or a parenthesized sequence of format units. With a few exceptions, a format unit that is not a parenthesized sequence normally corresponds to a single address argument to these functions. In the following description, the quoted form is the format unit; the entry in (round) parentheses is the Python object type that matches the format unit; and the entry in [square] brackets is the type of the C variable(s) whose address should be passed." +#: ../../c-api/arg.rst:21 +msgid "" +"A format string consists of zero or more \"format units.\" A format unit " +"describes one Python object; it is usually a single character or a " +"parenthesized sequence of format units. With a few exceptions, a format " +"unit that is not a parenthesized sequence normally corresponds to a single " +"address argument to these functions. In the following description, the " +"quoted form is the format unit; the entry in (round) parentheses is the " +"Python object type that matches the format unit; and the entry in [square] " +"brackets is the type of the C variable(s) whose address should be passed." msgstr "" +#: ../../c-api/arg.rst:33 msgid "Strings and buffers" msgstr "" -msgid "On Python 3.12 and older, the macro :c:macro:`!PY_SSIZE_T_CLEAN` must be defined before including :file:`Python.h` to use all ``#`` variants of formats (``s#``, ``y#``, etc.) explained below. This is not necessary on Python 3.13 and later." +#: ../../c-api/arg.rst:37 +msgid "" +"On Python 3.12 and older, the macro :c:macro:`!PY_SSIZE_T_CLEAN` must be " +"defined before including :file:`Python.h` to use all ``#`` variants of " +"formats (``s#``, ``y#``, etc.) explained below. This is not necessary on " +"Python 3.13 and later." msgstr "" -msgid "These formats allow accessing an object as a contiguous chunk of memory. You don't have to provide raw storage for the returned unicode or bytes area." +#: ../../c-api/arg.rst:42 +msgid "" +"These formats allow accessing an object as a contiguous chunk of memory. You " +"don't have to provide raw storage for the returned unicode or bytes area." msgstr "" +#: ../../c-api/arg.rst:46 msgid "Unless otherwise stated, buffers are not NUL-terminated." msgstr "" +#: ../../c-api/arg.rst:48 msgid "There are three ways strings and buffers can be converted to C:" msgstr "" -msgid "Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This locks the underlying buffer so that the caller can subsequently use the buffer even inside a :c:type:`Py_BEGIN_ALLOW_THREADS` block without the risk of mutable data being resized or destroyed. As a result, **you have to call** :c:func:`PyBuffer_Release` after you have finished processing the data (or in any early abort case)." +#: ../../c-api/arg.rst:50 +msgid "" +"Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This " +"locks the underlying buffer so that the caller can subsequently use the " +"buffer even inside a :c:type:`Py_BEGIN_ALLOW_THREADS` block without the risk " +"of mutable data being resized or destroyed. As a result, **you have to " +"call** :c:func:`PyBuffer_Release` after you have finished processing the " +"data (or in any early abort case)." msgstr "" -msgid "The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. **You have to call** :c:func:`PyMem_Free` after you have finished processing the data (or in any early abort case)." +#: ../../c-api/arg.rst:57 +msgid "" +"The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. " +"**You have to call** :c:func:`PyMem_Free` after you have finished processing " +"the data (or in any early abort case)." msgstr "" -msgid "Other formats take a :class:`str` or a read-only :term:`bytes-like object`, such as :class:`bytes`, and provide a ``const char *`` pointer to its buffer. In this case the buffer is \"borrowed\": it is managed by the corresponding Python object, and shares the lifetime of this object. You won't have to release any memory yourself." +#: ../../c-api/arg.rst:63 +msgid "" +"Other formats take a :class:`str` or a read-only :term:`bytes-like object`, " +"such as :class:`bytes`, and provide a ``const char *`` pointer to its " +"buffer. In this case the buffer is \"borrowed\": it is managed by the " +"corresponding Python object, and shares the lifetime of this object. You " +"won't have to release any memory yourself." msgstr "" -msgid "To ensure that the underlying buffer may be safely borrowed, the object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This disallows common mutable objects such as :class:`bytearray`, but also some read-only objects such as :class:`memoryview` of :class:`bytes`." +#: ../../c-api/arg.rst:70 +msgid "" +"To ensure that the underlying buffer may be safely borrowed, the " +"object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. " +"This disallows common mutable objects such as :class:`bytearray`, but also " +"some read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" -msgid "Besides this ``bf_releasebuffer`` requirement, there is no check to verify whether the input object is immutable (e.g. whether it would honor a request for a writable buffer, or whether another thread can mutate the data)." +#: ../../c-api/arg.rst:76 +msgid "" +"Besides this ``bf_releasebuffer`` requirement, there is no check to verify " +"whether the input object is immutable (e.g. whether it would honor a request " +"for a writable buffer, or whether another thread can mutate the data)." msgstr "" +#: ../../c-api/arg.rst:80 msgid "``s`` (:class:`str`) [const char \\*]" msgstr "" -msgid "Convert a Unicode object to a C pointer to a character string. A pointer to an existing string is stored in the character pointer variable whose address you pass. The C string is NUL-terminated. The Python string must not contain embedded null code points; if it does, a :exc:`ValueError` exception is raised. Unicode objects are converted to C strings using ``'utf-8'`` encoding. If this conversion fails, a :exc:`UnicodeError` is raised." +#: ../../c-api/arg.rst:81 +msgid "" +"Convert a Unicode object to a C pointer to a character string. A pointer to " +"an existing string is stored in the character pointer variable whose address " +"you pass. The C string is NUL-terminated. The Python string must not " +"contain embedded null code points; if it does, a :exc:`ValueError` exception " +"is raised. Unicode objects are converted to C strings using ``'utf-8'`` " +"encoding. If this conversion fails, a :exc:`UnicodeError` is raised." msgstr "" -msgid "This format does not accept :term:`bytes-like objects `. If you want to accept filesystem paths and convert them to C character strings, it is preferable to use the ``O&`` format with :c:func:`PyUnicode_FSConverter` as *converter*." +#: ../../c-api/arg.rst:90 +msgid "" +"This format does not accept :term:`bytes-like objects `. " +"If you want to accept filesystem paths and convert them to C character " +"strings, it is preferable to use the ``O&`` format " +"with :c:func:`PyUnicode_FSConverter` as *converter*." msgstr "" -msgid "Previously, :exc:`TypeError` was raised when embedded null code points were encountered in the Python string." +#: ../../c-api/arg.rst:96 +msgid "" +"Previously, :exc:`TypeError` was raised when embedded null code points were " +"encountered in the Python string." msgstr "" +#: ../../c-api/arg.rst:100 msgid "``s*`` (:class:`str` or :term:`bytes-like object`) [Py_buffer]" msgstr "" -msgid "This format accepts Unicode objects as well as bytes-like objects. It fills a :c:type:`Py_buffer` structure provided by the caller. In this case the resulting C string may contain embedded NUL bytes. Unicode objects are converted to C strings using ``'utf-8'`` encoding." +#: ../../c-api/arg.rst:101 +msgid "" +"This format accepts Unicode objects as well as bytes-like objects. It fills " +"a :c:type:`Py_buffer` structure provided by the caller. In this case the " +"resulting C string may contain embedded NUL bytes. Unicode objects are " +"converted to C strings using ``'utf-8'`` encoding." msgstr "" -msgid "``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :c:type:`Py_ssize_t`]" +#: ../../c-api/arg.rst:106 +msgid "" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" -msgid "Like ``s*``, except that it provides a :ref:`borrowed buffer `. The result is stored into two C variables, the first one a pointer to a C string, the second one its length. The string may contain embedded null bytes. Unicode objects are converted to C strings using ``'utf-8'`` encoding." +#: ../../c-api/arg.rst:107 +msgid "" +"Like ``s*``, except that it provides a :ref:`borrowed buffer `. The result is stored into two C variables, the first one a pointer " +"to a C string, the second one its length. The string may contain embedded " +"null bytes. Unicode objects are converted to C strings using ``'utf-8'`` " +"encoding." msgstr "" +#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:614 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" msgstr "" -msgid "Like ``s``, but the Python object may also be ``None``, in which case the C pointer is set to ``NULL``." +#: ../../c-api/arg.rst:114 +msgid "" +"Like ``s``, but the Python object may also be ``None``, in which case the C " +"pointer is set to ``NULL``." msgstr "" -msgid "``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]" +#: ../../c-api/arg.rst:117 +msgid "" +"``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]" msgstr "" -msgid "Like ``s*``, but the Python object may also be ``None``, in which case the ``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``." +#: ../../c-api/arg.rst:118 +msgid "" +"Like ``s*``, but the Python object may also be ``None``, in which case the " +"``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``." msgstr "" -msgid "``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" +#: ../../c-api/arg.rst:121 +msgid "" +"``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) " +"[const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -msgid "Like ``s#``, but the Python object may also be ``None``, in which case the C pointer is set to ``NULL``." +#: ../../c-api/arg.rst:122 +msgid "" +"Like ``s#``, but the Python object may also be ``None``, in which case the C " +"pointer is set to ``NULL``." msgstr "" +#: ../../c-api/arg.rst:125 msgid "``y`` (read-only :term:`bytes-like object`) [const char \\*]" msgstr "" -msgid "This format converts a bytes-like object to a C pointer to a :ref:`borrowed ` character string; it does not accept Unicode objects. The bytes buffer must not contain embedded null bytes; if it does, a :exc:`ValueError` exception is raised." +#: ../../c-api/arg.rst:126 +msgid "" +"This format converts a bytes-like object to a C pointer to a :ref:`borrowed " +"` character string; it does not accept Unicode " +"objects. The bytes buffer must not contain embedded null bytes; if it does, " +"a :exc:`ValueError` exception is raised." msgstr "" -msgid "Previously, :exc:`TypeError` was raised when embedded null bytes were encountered in the bytes buffer." +#: ../../c-api/arg.rst:132 +msgid "" +"Previously, :exc:`TypeError` was raised when embedded null bytes were " +"encountered in the bytes buffer." msgstr "" +#: ../../c-api/arg.rst:136 msgid "``y*`` (:term:`bytes-like object`) [Py_buffer]" msgstr "" -msgid "This variant on ``s*`` doesn't accept Unicode objects, only bytes-like objects. **This is the recommended way to accept binary data.**" +#: ../../c-api/arg.rst:137 +msgid "" +"This variant on ``s*`` doesn't accept Unicode objects, only bytes-like " +"objects. **This is the recommended way to accept binary data.**" msgstr "" -msgid "``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:`Py_ssize_t`]" +#: ../../c-api/arg.rst:141 +msgid "" +"``y#`` (read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" -msgid "This variant on ``s#`` doesn't accept Unicode objects, only bytes-like objects." +#: ../../c-api/arg.rst:142 +msgid "" +"This variant on ``s#`` doesn't accept Unicode objects, only bytes-like " +"objects." msgstr "" +#: ../../c-api/arg.rst:145 msgid "``S`` (:class:`bytes`) [PyBytesObject \\*]" msgstr "" -msgid "Requires that the Python object is a :class:`bytes` object, without attempting any conversion. Raises :exc:`TypeError` if the object is not a bytes object. The C variable may also be declared as :c:expr:`PyObject*`." +#: ../../c-api/arg.rst:146 +msgid "" +"Requires that the Python object is a :class:`bytes` object, without " +"attempting any conversion. Raises :exc:`TypeError` if the object is not a " +"bytes object. The C variable may also be declared as :c:expr:`PyObject*`." msgstr "" +#: ../../c-api/arg.rst:150 msgid "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" msgstr "" -msgid "Requires that the Python object is a :class:`bytearray` object, without attempting any conversion. Raises :exc:`TypeError` if the object is not a :class:`bytearray` object. The C variable may also be declared as :c:expr:`PyObject*`." +#: ../../c-api/arg.rst:151 +msgid "" +"Requires that the Python object is a :class:`bytearray` object, without " +"attempting any conversion. Raises :exc:`TypeError` if the object is not " +"a :class:`bytearray` object. The C variable may also be declared " +"as :c:expr:`PyObject*`." msgstr "" +#: ../../c-api/arg.rst:155 msgid "``U`` (:class:`str`) [PyObject \\*]" msgstr "" -msgid "Requires that the Python object is a Unicode object, without attempting any conversion. Raises :exc:`TypeError` if the object is not a Unicode object. The C variable may also be declared as :c:expr:`PyObject*`." +#: ../../c-api/arg.rst:156 +msgid "" +"Requires that the Python object is a Unicode object, without attempting any " +"conversion. Raises :exc:`TypeError` if the object is not a Unicode object. " +"The C variable may also be declared as :c:expr:`PyObject*`." msgstr "" +#: ../../c-api/arg.rst:160 msgid "``w*`` (read-write :term:`bytes-like object`) [Py_buffer]" msgstr "" -msgid "This format accepts any object which implements the read-write buffer interface. It fills a :c:type:`Py_buffer` structure provided by the caller. The buffer may contain embedded null bytes. The caller has to call :c:func:`PyBuffer_Release` when it is done with the buffer." +#: ../../c-api/arg.rst:161 +msgid "" +"This format accepts any object which implements the read-write buffer " +"interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " +"The buffer may contain embedded null bytes. The caller has to " +"call :c:func:`PyBuffer_Release` when it is done with the buffer." msgstr "" +#: ../../c-api/arg.rst:166 msgid "``es`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer]" msgstr "" -msgid "This variant on ``s`` is used for encoding Unicode into a character buffer. It only works for encoded data without embedded NUL bytes." -msgstr "" - -msgid "This format requires two arguments. The first is only used as input, and must be a :c:expr:`const char*` which points to the name of an encoding as a NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. An exception is raised if the named encoding is not known to Python. The second argument must be a :c:expr:`char**`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument." +#: ../../c-api/arg.rst:167 +msgid "" +"This variant on ``s`` is used for encoding Unicode into a character buffer. " +"It only works for encoded data without embedded NUL bytes." msgstr "" -msgid ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy the encoded data into this buffer and adjust *\\*buffer* to reference the newly allocated storage. The caller is responsible for calling :c:func:`PyMem_Free` to free the allocated buffer after use." +#: ../../c-api/arg.rst:170 +msgid "" +"This format requires two arguments. The first is only used as input, and " +"must be a :c:expr:`const char*` which points to the name of an encoding as a " +"NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is " +"used. An exception is raised if the named encoding is not known to Python. " +"The second argument must be a :c:expr:`char**`; the value of the pointer it " +"references will be set to a buffer with the contents of the argument text. " +"The text will be encoded in the encoding specified by the first argument." msgstr "" -msgid "``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \\*encoding, char \\*\\*buffer]" +#: ../../c-api/arg.rst:178 +msgid "" +":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " +"the encoded data into this buffer and adjust *\\*buffer* to reference the " +"newly allocated storage. The caller is responsible for " +"calling :c:func:`PyMem_Free` to free the allocated buffer after use." msgstr "" -msgid "Same as ``es`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter." +#: ../../c-api/arg.rst:183 +msgid "" +"``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " +"\\*encoding, char \\*\\*buffer]" msgstr "" -msgid "``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +#: ../../c-api/arg.rst:184 +msgid "" +"Same as ``es`` except that byte string objects are passed through without " +"recoding them. Instead, the implementation assumes that the byte string " +"object uses the encoding passed in as parameter." msgstr "" -msgid "This variant on ``s#`` is used for encoding Unicode into a character buffer. Unlike the ``es`` format, this variant allows input data which contains NUL characters." +#: ../../c-api/arg.rst:188 +msgid "" +"``es#`` (:class:`str`) [const char \\*encoding, char " +"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" msgstr "" -msgid "It requires three arguments. The first is only used as input, and must be a :c:expr:`const char*` which points to the name of an encoding as a NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. An exception is raised if the named encoding is not known to Python. The second argument must be a :c:expr:`char**`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument. The third argument must be a pointer to an integer; the referenced integer will be set to the number of bytes in the output buffer." +#: ../../c-api/arg.rst:189 +msgid "" +"This variant on ``s#`` is used for encoding Unicode into a character buffer. " +"Unlike the ``es`` format, this variant allows input data which contains NUL " +"characters." msgstr "" +#: ../../c-api/arg.rst:193 +msgid "" +"It requires three arguments. The first is only used as input, and must be " +"a :c:expr:`const char*` which points to the name of an encoding as a NUL-" +"terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. " +"An exception is raised if the named encoding is not known to Python. The " +"second argument must be a :c:expr:`char**`; the value of the pointer it " +"references will be set to a buffer with the contents of the argument text. " +"The text will be encoded in the encoding specified by the first argument. " +"The third argument must be a pointer to an integer; the referenced integer " +"will be set to the number of bytes in the output buffer." +msgstr "" + +#: ../../c-api/arg.rst:203 msgid "There are two modes of operation:" msgstr "" -msgid "If *\\*buffer* points a ``NULL`` pointer, the function will allocate a buffer of the needed size, copy the encoded data into this buffer and set *\\*buffer* to reference the newly allocated storage. The caller is responsible for calling :c:func:`PyMem_Free` to free the allocated buffer after usage." +#: ../../c-api/arg.rst:205 +msgid "" +"If *\\*buffer* points a ``NULL`` pointer, the function will allocate a " +"buffer of the needed size, copy the encoded data into this buffer and set " +"*\\*buffer* to reference the newly allocated storage. The caller is " +"responsible for calling :c:func:`PyMem_Free` to free the allocated buffer " +"after usage." msgstr "" -msgid "If *\\*buffer* points to a non-``NULL`` pointer (an already allocated buffer), :c:func:`PyArg_ParseTuple` will use this location as the buffer and interpret the initial value of *\\*buffer_length* as the buffer size. It will then copy the encoded data into the buffer and NUL-terminate it. If the buffer is not large enough, a :exc:`ValueError` will be set." +#: ../../c-api/arg.rst:210 +msgid "" +"If *\\*buffer* points to a non-``NULL`` pointer (an already allocated " +"buffer), :c:func:`PyArg_ParseTuple` will use this location as the buffer and " +"interpret the initial value of *\\*buffer_length* as the buffer size. It " +"will then copy the encoded data into the buffer and NUL-terminate it. If " +"the buffer is not large enough, a :exc:`ValueError` will be set." msgstr "" -msgid "In both cases, *\\*buffer_length* is set to the length of the encoded data without the trailing NUL byte." +#: ../../c-api/arg.rst:216 +msgid "" +"In both cases, *\\*buffer_length* is set to the length of the encoded data " +"without the trailing NUL byte." msgstr "" -msgid "``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \\*encoding, char \\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +#: ../../c-api/arg.rst:219 +msgid "" +"``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " +"\\*encoding, char \\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" msgstr "" -msgid "Same as ``es#`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter." +#: ../../c-api/arg.rst:220 +msgid "" +"Same as ``es#`` except that byte string objects are passed through without " +"recoding them. Instead, the implementation assumes that the byte string " +"object uses the encoding passed in as parameter." msgstr "" -msgid "``u``, ``u#``, ``Z``, and ``Z#`` are removed because they used a legacy ``Py_UNICODE*`` representation." +#: ../../c-api/arg.rst:224 +msgid "" +"``u``, ``u#``, ``Z``, and ``Z#`` are removed because they used a legacy " +"``Py_UNICODE*`` representation." msgstr "" +#: ../../c-api/arg.rst:230 msgid "Numbers" msgstr "" -msgid "These formats allow representing Python numbers or single characters as C numbers. Formats that require :class:`int`, :class:`float` or :class:`complex` can also use the corresponding special methods :meth:`~object.__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to convert the Python object to the required type." +#: ../../c-api/arg.rst:232 +msgid "" +"These formats allow representing Python numbers or single characters as C " +"numbers. Formats that require :class:`int`, :class:`float` " +"or :class:`complex` can also use the corresponding special " +"methods :meth:`~object.__index__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` to convert the Python object to the required " +"type." msgstr "" -msgid "For signed integer formats, :exc:`OverflowError` is raised if the value is out of range for the C type. For unsigned integer formats, no range checking is done --- the most significant bits are silently truncated when the receiving field is too small to receive the value." +#: ../../c-api/arg.rst:238 +msgid "" +"For signed integer formats, :exc:`OverflowError` is raised if the value is " +"out of range for the C type. For unsigned integer formats, no range checking " +"is done --- the most significant bits are silently truncated when the " +"receiving field is too small to receive the value." msgstr "" +#: ../../c-api/arg.rst:244 msgid "``b`` (:class:`int`) [unsigned char]" msgstr "" -msgid "Convert a nonnegative Python integer to an unsigned tiny integer, stored in a C :c:expr:`unsigned char`." +#: ../../c-api/arg.rst:245 +msgid "" +"Convert a nonnegative Python integer to an unsigned tiny integer, stored in " +"a C :c:expr:`unsigned char`." msgstr "" +#: ../../c-api/arg.rst:248 ../../c-api/arg.rst:648 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "" -msgid "Convert a Python integer to a tiny integer without overflow checking, stored in a C :c:expr:`unsigned char`." +#: ../../c-api/arg.rst:249 +msgid "" +"Convert a Python integer to a tiny integer without overflow checking, stored " +"in a C :c:expr:`unsigned char`." msgstr "" +#: ../../c-api/arg.rst:252 ../../c-api/arg.rst:642 msgid "``h`` (:class:`int`) [short int]" msgstr "" +#: ../../c-api/arg.rst:253 msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "" +#: ../../c-api/arg.rst:255 ../../c-api/arg.rst:651 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "" -msgid "Convert a Python integer to a C :c:expr:`unsigned short int`, without overflow checking." +#: ../../c-api/arg.rst:256 +msgid "" +"Convert a Python integer to a C :c:expr:`unsigned short int`, without " +"overflow checking." msgstr "" +#: ../../c-api/arg.rst:259 ../../c-api/arg.rst:636 msgid "``i`` (:class:`int`) [int]" msgstr "" +#: ../../c-api/arg.rst:260 msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "" +#: ../../c-api/arg.rst:262 ../../c-api/arg.rst:654 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "" -msgid "Convert a Python integer to a C :c:expr:`unsigned int`, without overflow checking." +#: ../../c-api/arg.rst:263 +msgid "" +"Convert a Python integer to a C :c:expr:`unsigned int`, without overflow " +"checking." msgstr "" +#: ../../c-api/arg.rst:266 ../../c-api/arg.rst:645 msgid "``l`` (:class:`int`) [long int]" msgstr "" +#: ../../c-api/arg.rst:267 msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "" +#: ../../c-api/arg.rst:269 ../../c-api/arg.rst:657 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "" -msgid "Convert a Python integer to a C :c:expr:`unsigned long` without overflow checking." +#: ../../c-api/arg.rst:270 +msgid "" +"Convert a Python integer to a C :c:expr:`unsigned long` without overflow " +"checking." msgstr "" +#: ../../c-api/arg.rst:273 ../../c-api/arg.rst:283 msgid "Use :meth:`~object.__index__` if available." msgstr "" +#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:660 msgid "``L`` (:class:`int`) [long long]" msgstr "" +#: ../../c-api/arg.rst:277 msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "" +#: ../../c-api/arg.rst:279 ../../c-api/arg.rst:665 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "" -msgid "Convert a Python integer to a C :c:expr:`unsigned long long` without overflow checking." +#: ../../c-api/arg.rst:280 +msgid "" +"Convert a Python integer to a C :c:expr:`unsigned long long` without " +"overflow checking." msgstr "" +#: ../../c-api/arg.rst:286 ../../c-api/arg.rst:668 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "" +#: ../../c-api/arg.rst:287 msgid "Convert a Python integer to a C :c:type:`Py_ssize_t`." msgstr "" +#: ../../c-api/arg.rst:289 msgid "``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]" msgstr "" -msgid "Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` object of length 1, to a C :c:expr:`char`." +#: ../../c-api/arg.rst:290 +msgid "" +"Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` " +"object of length 1, to a C :c:expr:`char`." msgstr "" +#: ../../c-api/arg.rst:293 msgid "Allow :class:`bytearray` objects." msgstr "" +#: ../../c-api/arg.rst:296 ../../c-api/arg.rst:686 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "" -msgid "Convert a Python character, represented as a :class:`str` object of length 1, to a C :c:expr:`int`." +#: ../../c-api/arg.rst:297 +msgid "" +"Convert a Python character, represented as a :class:`str` object of length " +"1, to a C :c:expr:`int`." msgstr "" +#: ../../c-api/arg.rst:300 ../../c-api/arg.rst:693 msgid "``f`` (:class:`float`) [float]" msgstr "" +#: ../../c-api/arg.rst:301 msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "" +#: ../../c-api/arg.rst:303 ../../c-api/arg.rst:690 msgid "``d`` (:class:`float`) [double]" msgstr "" +#: ../../c-api/arg.rst:304 msgid "Convert a Python floating-point number to a C :c:expr:`double`." msgstr "" +#: ../../c-api/arg.rst:306 msgid "``D`` (:class:`complex`) [Py_complex]" msgstr "" +#: ../../c-api/arg.rst:307 msgid "Convert a Python complex number to a C :c:type:`Py_complex` structure." msgstr "" +#: ../../c-api/arg.rst:310 msgid "Other objects" msgstr "" +#: ../../c-api/arg.rst:312 ../../c-api/arg.rst:699 msgid "``O`` (object) [PyObject \\*]" msgstr "" -msgid "Store a Python object (without any conversion) in a C object pointer. The C program thus receives the actual object that was passed. A new :term:`strong reference` to the object is not created (i.e. its reference count is not increased). The pointer stored is not ``NULL``." +#: ../../c-api/arg.rst:313 +msgid "" +"Store a Python object (without any conversion) in a C object pointer. The C " +"program thus receives the actual object that was passed. A " +"new :term:`strong reference` to the object is not created (i.e. its " +"reference count is not increased). The pointer stored is not ``NULL``." msgstr "" +#: ../../c-api/arg.rst:319 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" msgstr "" -msgid "Store a Python object in a C object pointer. This is similar to ``O``, but takes two C arguments: the first is the address of a Python type object, the second is the address of the C variable (of type :c:expr:`PyObject*`) into which the object pointer is stored. If the Python object does not have the required type, :exc:`TypeError` is raised." +#: ../../c-api/arg.rst:320 +msgid "" +"Store a Python object in a C object pointer. This is similar to ``O``, but " +"takes two C arguments: the first is the address of a Python type object, the " +"second is the address of the C variable (of type :c:expr:`PyObject*`) into " +"which the object pointer is stored. If the Python object does not have the " +"required type, :exc:`TypeError` is raised." msgstr "" +#: ../../c-api/arg.rst:328 msgid "``O&`` (object) [*converter*, *address*]" msgstr "" -msgid "Convert a Python object to a C variable through a *converter* function. This takes two arguments: the first is a function, the second is the address of a C variable (of arbitrary type), converted to :c:expr:`void *`. The *converter* function in turn is called as follows::" +#: ../../c-api/arg.rst:329 +msgid "" +"Convert a Python object to a C variable through a *converter* function. " +"This takes two arguments: the first is a function, the second is the address " +"of a C variable (of arbitrary type), converted to :c:expr:`void *`. The " +"*converter* function in turn is called as follows::" msgstr "" +#: ../../c-api/arg.rst:334 msgid "status = converter(object, address);" msgstr "" -msgid "where *object* is the Python object to be converted and *address* is the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The returned *status* should be ``1`` for a successful conversion and ``0`` if the conversion has failed. When the conversion fails, the *converter* function should raise an exception and leave the content of *address* unmodified." +#: ../../c-api/arg.rst:336 +msgid "" +"where *object* is the Python object to be converted and *address* is " +"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " +"function. The returned *status* should be ``1`` for a successful conversion " +"and ``0`` if the conversion has failed. When the conversion fails, the " +"*converter* function should raise an exception and leave the content of " +"*address* unmodified." msgstr "" -msgid "If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get called a second time if the argument parsing eventually fails, giving the converter a chance to release any memory that it had already allocated. In this second call, the *object* parameter will be ``NULL``; *address* will have the same value as in the original call." +#: ../../c-api/arg.rst:345 +msgid "" +"If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get " +"called a second time if the argument parsing eventually fails, giving the " +"converter a chance to release any memory that it had already allocated. In " +"this second call, the *object* parameter will be ``NULL``; *address* will " +"have the same value as in the original call." msgstr "" -msgid "Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:`PyUnicode_FSDecoder`." +#: ../../c-api/arg.rst:351 +msgid "" +"Examples of converters: :c:func:`PyUnicode_FSConverter` " +"and :c:func:`PyUnicode_FSDecoder`." msgstr "" +#: ../../c-api/arg.rst:354 msgid ":c:macro:`!Py_CLEANUP_SUPPORTED` was added." msgstr "" +#: ../../c-api/arg.rst:357 ../../c-api/arg.rst:671 msgid "``p`` (:class:`bool`) [int]" msgstr "" -msgid "Tests the value passed in for truth (a boolean **p**\\ redicate) and converts the result to its equivalent C true/false integer value. Sets the int to ``1`` if the expression was true and ``0`` if it was false. This accepts any valid Python value. See :ref:`truth` for more information about how Python tests values for truth." +#: ../../c-api/arg.rst:358 +msgid "" +"Tests the value passed in for truth (a boolean **p**\\ redicate) and " +"converts the result to its equivalent C true/false integer value. Sets the " +"int to ``1`` if the expression was true and ``0`` if it was false. This " +"accepts any valid Python value. See :ref:`truth` for more information about " +"how Python tests values for truth." msgstr "" +#: ../../c-api/arg.rst:366 msgid "``(items)`` (sequence) [*matching-items*]" msgstr "" -msgid "The object must be a Python sequence (except :class:`str`, :class:`bytes` or :class:`bytearray`) whose length is the number of format units in *items*. The C arguments must correspond to the individual format units in *items*. Format units for sequences may be nested." +#: ../../c-api/arg.rst:367 +msgid "" +"The object must be a Python sequence (except :class:`str`, :class:`bytes` " +"or :class:`bytearray`) whose length is the number of format units in " +"*items*. The C arguments must correspond to the individual format units in " +"*items*. Format units for sequences may be nested." msgstr "" -msgid "If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the object must be a Python tuple. The *converter* for the ``O&`` format unit in *items* must not store a borrowed buffer or a borrowed reference." +#: ../../c-api/arg.rst:372 +msgid "" +"If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or " +"a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " +"object must be a Python tuple. The *converter* for the ``O&`` format unit in " +"*items* must not store a borrowed buffer or a borrowed reference." msgstr "" -msgid ":class:`str` and :class:`bytearray` objects no longer accepted as a sequence." +#: ../../c-api/arg.rst:379 +msgid "" +":class:`str` and :class:`bytearray` objects no longer accepted as a sequence." msgstr "" -msgid "Non-tuple sequences are deprecated if *items* contains format units which store a borrowed buffer or a borrowed reference." +#: ../../c-api/arg.rst:382 +msgid "" +"Non-tuple sequences are deprecated if *items* contains format units which " +"store a borrowed buffer or a borrowed reference." msgstr "" -msgid "A few other characters have a meaning in a format string. These may not occur inside nested parentheses. They are:" +#: ../../c-api/arg.rst:386 +msgid "" +"A few other characters have a meaning in a format string. These may not " +"occur inside nested parentheses. They are:" msgstr "" +#: ../../c-api/arg.rst:389 msgid "``|``" msgstr "" -msgid "Indicates that the remaining arguments in the Python argument list are optional. The C variables corresponding to optional arguments should be initialized to their default value --- when an optional argument is not specified, :c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding C variable(s)." +#: ../../c-api/arg.rst:390 +msgid "" +"Indicates that the remaining arguments in the Python argument list are " +"optional. The C variables corresponding to optional arguments should be " +"initialized to their default value --- when an optional argument is not " +"specified, :c:func:`PyArg_ParseTuple` does not touch the contents of the " +"corresponding C variable(s)." msgstr "" +#: ../../c-api/arg.rst:396 msgid "``$``" msgstr "" -msgid ":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining arguments in the Python argument list are keyword-only. Currently, all keyword-only arguments must also be optional arguments, so ``|`` must always be specified before ``$`` in the format string." +#: ../../c-api/arg.rst:397 +msgid "" +":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining " +"arguments in the Python argument list are keyword-only. Currently, all " +"keyword-only arguments must also be optional arguments, so ``|`` must always " +"be specified before ``$`` in the format string." msgstr "" +#: ../../c-api/arg.rst:405 msgid "``:``" msgstr "" -msgid "The list of format units ends here; the string after the colon is used as the function name in error messages (the \"associated value\" of the exception that :c:func:`PyArg_ParseTuple` raises)." +#: ../../c-api/arg.rst:406 +msgid "" +"The list of format units ends here; the string after the colon is used as " +"the function name in error messages (the \"associated value\" of the " +"exception that :c:func:`PyArg_ParseTuple` raises)." msgstr "" +#: ../../c-api/arg.rst:410 msgid "``;``" msgstr "" -msgid "The list of format units ends here; the string after the semicolon is used as the error message *instead* of the default error message. ``:`` and ``;`` mutually exclude each other." +#: ../../c-api/arg.rst:411 +msgid "" +"The list of format units ends here; the string after the semicolon is used " +"as the error message *instead* of the default error message. ``:`` and " +"``;`` mutually exclude each other." msgstr "" -msgid "Note that any Python object references which are provided to the caller are *borrowed* references; do not release them (i.e. do not decrement their reference count)!" +#: ../../c-api/arg.rst:415 +msgid "" +"Note that any Python object references which are provided to the caller are " +"*borrowed* references; do not release them (i.e. do not decrement their " +"reference count)!" msgstr "" -msgid "Additional arguments passed to these functions must be addresses of variables whose type is determined by the format string; these are used to store values from the input tuple. There are a few cases, as described in the list of format units above, where these parameters are used as input values; they should match what is specified for the corresponding format unit in that case." +#: ../../c-api/arg.rst:419 +msgid "" +"Additional arguments passed to these functions must be addresses of " +"variables whose type is determined by the format string; these are used to " +"store values from the input tuple. There are a few cases, as described in " +"the list of format units above, where these parameters are used as input " +"values; they should match what is specified for the corresponding format " +"unit in that case." msgstr "" -msgid "For the conversion to succeed, the *arg* object must match the format and the format must be exhausted. On success, the ``PyArg_Parse*`` functions return true, otherwise they return false and raise an appropriate exception. When the ``PyArg_Parse*`` functions fail due to conversion failure in one of the format units, the variables at the addresses corresponding to that and the following format units are left untouched." +#: ../../c-api/arg.rst:425 +msgid "" +"For the conversion to succeed, the *arg* object must match the format and " +"the format must be exhausted. On success, the ``PyArg_Parse*`` functions " +"return true, otherwise they return false and raise an appropriate exception. " +"When the ``PyArg_Parse*`` functions fail due to conversion failure in one of " +"the format units, the variables at the addresses corresponding to that and " +"the following format units are left untouched." msgstr "" +#: ../../c-api/arg.rst:434 msgid "API Functions" msgstr "" -msgid "Parse the parameters of a function that takes only positional parameters into local variables. Returns true on success; on failure, it returns false and raises the appropriate exception." +#: ../../c-api/arg.rst:438 +msgid "" +"Parse the parameters of a function that takes only positional parameters " +"into local variables. Returns true on success; on failure, it returns false " +"and raises the appropriate exception." msgstr "" -msgid "Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list rather than a variable number of arguments." +#: ../../c-api/arg.rst:445 +msgid "" +"Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list " +"rather than a variable number of arguments." msgstr "" -msgid "Parse the parameters of a function that takes both positional and keyword parameters into local variables. The *keywords* argument is a ``NULL``-terminated array of keyword parameter names specified as null-terminated ASCII or UTF-8 encoded C strings. Empty names denote :ref:`positional-only parameters `. Returns true on success; on failure, it returns false and raises the appropriate exception." +#: ../../c-api/arg.rst:451 +msgid "" +"Parse the parameters of a function that takes both positional and keyword " +"parameters into local variables. The *keywords* argument is a ``NULL``-" +"terminated array of keyword parameter names specified as null-terminated " +"ASCII or UTF-8 encoded C strings. Empty names denote :ref:`positional-only " +"parameters `. Returns true on success; on " +"failure, it returns false and raises the appropriate exception." msgstr "" -msgid "The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:expr:`const char * const *` in C++. This can be overridden with the :c:macro:`PY_CXX_CONST` macro." +#: ../../c-api/arg.rst:462 +msgid "" +"The *keywords* parameter declaration is :c:expr:`char * const *` in C " +"and :c:expr:`const char * const *` in C++. This can be overridden with " +"the :c:macro:`PY_CXX_CONST` macro." msgstr "" -msgid "Added support for :ref:`positional-only parameters `." +#: ../../c-api/arg.rst:466 +msgid "" +"Added support for :ref:`positional-only parameters `." msgstr "" -msgid "The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added support for non-ASCII keyword parameter names." +#: ../../c-api/arg.rst:470 +msgid "" +"The *keywords* parameter has now type :c:expr:`char * const *` in C " +"and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. " +"Added support for non-ASCII keyword parameter names." msgstr "" -msgid "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a va_list rather than a variable number of arguments." +#: ../../c-api/arg.rst:479 +msgid "" +"Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " +"va_list rather than a variable number of arguments." msgstr "" -msgid "Ensure that the keys in the keywords argument dictionary are strings. This is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since the latter already does this check." +#: ../../c-api/arg.rst:485 +msgid "" +"Ensure that the keys in the keywords argument dictionary are strings. This " +"is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " +"the latter already does this check." msgstr "" -msgid "Parse the parameter of a function that takes a single positional parameter into a local variable. Returns true on success; on failure, it returns false and raises the appropriate exception." +#: ../../c-api/arg.rst:494 +msgid "" +"Parse the parameter of a function that takes a single positional parameter " +"into a local variable. Returns true on success; on failure, it returns " +"false and raises the appropriate exception." msgstr "" +#: ../../c-api/arg.rst:498 msgid "Example::" msgstr "" +#: ../../c-api/arg.rst:500 msgid "" "// Function using METH_O calling convention\n" "static PyObject*\n" @@ -455,12 +875,31 @@ msgid "" "}" msgstr "" -msgid "A simpler form of parameter retrieval which does not use a format string to specify the types of the arguments. Functions which use this method to retrieve their parameters should be declared as :c:macro:`METH_VARARGS` in function or method tables. The tuple containing the actual parameters should be passed as *args*; it must actually be a tuple. The length of the tuple must be at least *min* and no more than *max*; *min* and *max* may be equal. Additional arguments must be passed to the function, each of which should be a pointer to a :c:expr:`PyObject*` variable; these will be filled in with the values from *args*; they will contain :term:`borrowed references `. The variables which correspond to optional parameters not given by *args* will not be filled in; these should be initialized by the caller. This function returns true on success and false if *args* is not a tuple or contains the wrong number of elements; an exception will be set if there was a failure." -msgstr "" - -msgid "This is an example of the use of this function, taken from the sources for the :mod:`!_weakref` helper module for weak references::" +#: ../../c-api/arg.rst:514 +msgid "" +"A simpler form of parameter retrieval which does not use a format string to " +"specify the types of the arguments. Functions which use this method to " +"retrieve their parameters should be declared as :c:macro:`METH_VARARGS` in " +"function or method tables. The tuple containing the actual parameters " +"should be passed as *args*; it must actually be a tuple. The length of the " +"tuple must be at least *min* and no more than *max*; *min* and *max* may be " +"equal. Additional arguments must be passed to the function, each of which " +"should be a pointer to a :c:expr:`PyObject*` variable; these will be filled " +"in with the values from *args*; they will contain :term:`borrowed references " +"`. The variables which correspond to optional parameters " +"not given by *args* will not be filled in; these should be initialized by " +"the caller. This function returns true on success and false if *args* is not " +"a tuple or contains the wrong number of elements; an exception will be set " +"if there was a failure." +msgstr "" + +#: ../../c-api/arg.rst:529 +msgid "" +"This is an example of the use of this function, taken from the sources for " +"the :mod:`!_weakref` helper module for weak references::" msgstr "" +#: ../../c-api/arg.rst:532 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -476,188 +915,330 @@ msgid "" "}" msgstr "" -msgid "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely equivalent to this call to :c:func:`PyArg_ParseTuple`::" +#: ../../c-api/arg.rst:545 +msgid "" +"The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " +"equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" +#: ../../c-api/arg.rst:548 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" msgstr "" -msgid "The value to be inserted, if any, before :c:expr:`char * const *` in the *keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` and :c:func:`PyArg_VaParseTupleAndKeywords`. Default empty for C and ``const`` for C++ (:c:expr:`const char * const *`). To override, define it to the desired value before including :file:`Python.h`." +#: ../../c-api/arg.rst:552 +msgid "" +"The value to be inserted, if any, before :c:expr:`char * const *` in the " +"*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " +"and :c:func:`PyArg_VaParseTupleAndKeywords`. Default empty for C and " +"``const`` for C++ (:c:expr:`const char * const *`). To override, define it " +"to the desired value before including :file:`Python.h`." msgstr "" +#: ../../c-api/arg.rst:566 msgid "Building values" msgstr "" -msgid "Create a new value based on a format string similar to those accepted by the ``PyArg_Parse*`` family of functions and a sequence of values. Returns the value or ``NULL`` in the case of an error; an exception will be raised if ``NULL`` is returned." +#: ../../c-api/arg.rst:570 +msgid "" +"Create a new value based on a format string similar to those accepted by the " +"``PyArg_Parse*`` family of functions and a sequence of values. Returns the " +"value or ``NULL`` in the case of an error; an exception will be raised if " +"``NULL`` is returned." msgstr "" -msgid ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple only if its format string contains two or more format units. If the format string is empty, it returns ``None``; if it contains exactly one format unit, it returns whatever object is described by that format unit. To force it to return a tuple of size 0 or one, parenthesize the format string." +#: ../../c-api/arg.rst:575 +msgid "" +":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " +"only if its format string contains two or more format units. If the format " +"string is empty, it returns ``None``; if it contains exactly one format " +"unit, it returns whatever object is described by that format unit. To force " +"it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -msgid "When memory buffers are passed as parameters to supply data to build objects, as for the ``s`` and ``s#`` formats, the required data is copied. Buffers provided by the caller are never referenced by the objects created by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your code is responsible for calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." +#: ../../c-api/arg.rst:581 +msgid "" +"When memory buffers are passed as parameters to supply data to build " +"objects, as for the ``s`` and ``s#`` formats, the required data is copied. " +"Buffers provided by the caller are never referenced by the objects created " +"by :c:func:`Py_BuildValue`. In other words, if your code " +"invokes :c:func:`malloc` and passes the allocated memory " +"to :c:func:`Py_BuildValue`, your code is responsible for " +"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." msgstr "" -msgid "In the following description, the quoted form is the format unit; the entry in (round) parentheses is the Python object type that the format unit will return; and the entry in [square] brackets is the type of the C value(s) to be passed." +#: ../../c-api/arg.rst:589 +msgid "" +"In the following description, the quoted form is the format unit; the entry " +"in (round) parentheses is the Python object type that the format unit will " +"return; and the entry in [square] brackets is the type of the C value(s) to " +"be passed." msgstr "" -msgid "The characters space, tab, colon and comma are ignored in format strings (but not within format units such as ``s#``). This can be used to make long format strings a tad more readable." +#: ../../c-api/arg.rst:593 +msgid "" +"The characters space, tab, colon and comma are ignored in format strings " +"(but not within format units such as ``s#``). This can be used to make long " +"format strings a tad more readable." msgstr "" +#: ../../c-api/arg.rst:597 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" msgstr "" -msgid "Convert a null-terminated C string to a Python :class:`str` object using ``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." +#: ../../c-api/arg.rst:598 +msgid "" +"Convert a null-terminated C string to a Python :class:`str` object using " +"``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -msgid "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" +#: ../../c-api/arg.rst:601 +msgid "" +"``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -msgid "Convert a C string and its length to a Python :class:`str` object using ``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is ignored and ``None`` is returned." +#: ../../c-api/arg.rst:602 +msgid "" +"Convert a C string and its length to a Python :class:`str` object using " +"``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " +"ignored and ``None`` is returned." msgstr "" +#: ../../c-api/arg.rst:606 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "" -msgid "This converts a C string to a Python :class:`bytes` object. If the C string pointer is ``NULL``, ``None`` is returned." +#: ../../c-api/arg.rst:607 +msgid "" +"This converts a C string to a Python :class:`bytes` object. If the C string " +"pointer is ``NULL``, ``None`` is returned." msgstr "" +#: ../../c-api/arg.rst:610 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -msgid "This converts a C string and its lengths to a Python object. If the C string pointer is ``NULL``, ``None`` is returned." +#: ../../c-api/arg.rst:611 +msgid "" +"This converts a C string and its lengths to a Python object. If the C " +"string pointer is ``NULL``, ``None`` is returned." msgstr "" +#: ../../c-api/arg.rst:615 ../../c-api/arg.rst:631 msgid "Same as ``s``." msgstr "" -msgid "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" +#: ../../c-api/arg.rst:617 +msgid "" +"``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" +#: ../../c-api/arg.rst:618 ../../c-api/arg.rst:634 msgid "Same as ``s#``." msgstr "" +#: ../../c-api/arg.rst:620 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "" -msgid "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``, ``None`` is returned." +#: ../../c-api/arg.rst:621 +msgid "" +"Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " +"UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " +"``NULL``, ``None`` is returned." msgstr "" +#: ../../c-api/arg.rst:625 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "" -msgid "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python Unicode object. If the Unicode buffer pointer is ``NULL``, the length is ignored and ``None`` is returned." +#: ../../c-api/arg.rst:626 +msgid "" +"Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " +"Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " +"ignored and ``None`` is returned." msgstr "" +#: ../../c-api/arg.rst:630 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" msgstr "" -msgid "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" +#: ../../c-api/arg.rst:633 +msgid "" +"``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" +#: ../../c-api/arg.rst:637 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:639 msgid "``b`` (:class:`int`) [char]" msgstr "" +#: ../../c-api/arg.rst:640 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:643 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:646 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:649 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:652 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:655 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:658 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:661 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:666 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "" +#: ../../c-api/arg.rst:669 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "" +#: ../../c-api/arg.rst:672 msgid "Convert a C :c:expr:`int` to a Python :class:`bool` object." msgstr "" -msgid "Be aware that this format requires an ``int`` argument. Unlike most other contexts in C, variadic arguments are not coerced to a suitable type automatically. You can convert another type (for example, a pointer or a float) to a suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``." +#: ../../c-api/arg.rst:674 +msgid "" +"Be aware that this format requires an ``int`` argument. Unlike most other " +"contexts in C, variadic arguments are not coerced to a suitable type " +"automatically. You can convert another type (for example, a pointer or a " +"float) to a suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``." msgstr "" +#: ../../c-api/arg.rst:682 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "" -msgid "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` object of length 1." +#: ../../c-api/arg.rst:683 +msgid "" +"Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " +"object of length 1." msgstr "" -msgid "Convert a C :c:expr:`int` representing a character to Python :class:`str` object of length 1." +#: ../../c-api/arg.rst:687 +msgid "" +"Convert a C :c:expr:`int` representing a character to Python :class:`str` " +"object of length 1." msgstr "" +#: ../../c-api/arg.rst:691 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "" +#: ../../c-api/arg.rst:694 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "" +#: ../../c-api/arg.rst:696 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "" +#: ../../c-api/arg.rst:697 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "" -msgid "Pass a Python object untouched but create a new :term:`strong reference` to it (i.e. its reference count is incremented by one). If the object passed in is a ``NULL`` pointer, it is assumed that this was caused because the call producing the argument found an error and set an exception. Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If no exception has been raised yet, :exc:`SystemError` is set." +#: ../../c-api/arg.rst:700 +msgid "" +"Pass a Python object untouched but create a new :term:`strong reference` to " +"it (i.e. its reference count is incremented by one). If the object passed in " +"is a ``NULL`` pointer, it is assumed that this was caused because the call " +"producing the argument found an error and set an exception. " +"Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an " +"exception. If no exception has been raised yet, :exc:`SystemError` is set." msgstr "" +#: ../../c-api/arg.rst:709 msgid "``S`` (object) [PyObject \\*]" msgstr "" +#: ../../c-api/arg.rst:710 msgid "Same as ``O``." msgstr "" +#: ../../c-api/arg.rst:712 msgid "``N`` (object) [PyObject \\*]" msgstr "" -msgid "Same as ``O``, except it doesn't create a new :term:`strong reference`. Useful when the object is created by a call to an object constructor in the argument list." +#: ../../c-api/arg.rst:713 +msgid "" +"Same as ``O``, except it doesn't create a new :term:`strong reference`. " +"Useful when the object is created by a call to an object constructor in the " +"argument list." msgstr "" +#: ../../c-api/arg.rst:717 msgid "``O&`` (object) [*converter*, *anything*]" msgstr "" -msgid "Convert *anything* to a Python object through a *converter* function. The function is called with *anything* (which should be compatible with :c:expr:`void*`) as its argument and should return a \"new\" Python object, or ``NULL`` if an error occurred." +#: ../../c-api/arg.rst:718 +msgid "" +"Convert *anything* to a Python object through a *converter* function. The " +"function is called with *anything* (which should be compatible " +"with :c:expr:`void*`) as its argument and should return a \"new\" Python " +"object, or ``NULL`` if an error occurred." msgstr "" +#: ../../c-api/arg.rst:723 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "" -msgid "Convert a sequence of C values to a Python tuple with the same number of items." +#: ../../c-api/arg.rst:724 +msgid "" +"Convert a sequence of C values to a Python tuple with the same number of " +"items." msgstr "" +#: ../../c-api/arg.rst:726 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "" -msgid "Convert a sequence of C values to a Python list with the same number of items." +#: ../../c-api/arg.rst:727 +msgid "" +"Convert a sequence of C values to a Python list with the same number of " +"items." msgstr "" +#: ../../c-api/arg.rst:729 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "" -msgid "Convert a sequence of C values to a Python dictionary. Each pair of consecutive C values adds one item to the dictionary, serving as key and value, respectively." +#: ../../c-api/arg.rst:730 +msgid "" +"Convert a sequence of C values to a Python dictionary. Each pair of " +"consecutive C values adds one item to the dictionary, serving as key and " +"value, respectively." msgstr "" -msgid "If there is an error in the format string, the :exc:`SystemError` exception is set and ``NULL`` returned." +#: ../../c-api/arg.rst:734 +msgid "" +"If there is an error in the format string, the :exc:`SystemError` exception " +"is set and ``NULL`` returned." msgstr "" -msgid "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list rather than a variable number of arguments." +#: ../../c-api/arg.rst:739 +msgid "" +"Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " +"rather than a variable number of arguments." msgstr "" diff --git a/c-api/bool.po b/c-api/bool.po index ccddc5deb..958c6fc85 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -22,35 +22,71 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/bool.rst:6 msgid "Boolean Objects" msgstr "اشیاء بولین" -msgid "Booleans in Python are implemented as a subclass of integers. There are only two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the normal creation and deletion functions don't apply to booleans. The following macros are available, however." -msgstr "مقدارهای بولین در پایتون به‌عنوان زیرکلاسی از اعداد صحیح پیاده‌سازی شده‌اند. تنها دو مقدار بولین وجود دارد: :c:data:`Py_False` و :c:data:`Py_True`. بنابراین، توابع معمول ایجاد و حذف برای مقدارهای بولین کاربرد ندارند. با این حال، ماکروهای زیر در دسترس هستند." +#: ../../c-api/bool.rst:8 +msgid "" +"Booleans in Python are implemented as a subclass of integers. There are " +"only two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the " +"normal creation and deletion functions don't apply to booleans. The " +"following macros are available, however." +msgstr "" +"مقدارهای بولین در پایتون به‌عنوان زیرکلاسی از اعداد صحیح پیاده‌سازی شده‌اند. " +"تنها دو مقدار بولین وجود دارد: :c:data:`Py_False` و :c:data:`Py_True`. " +"بنابراین، توابع معمول ایجاد و حذف برای مقدارهای بولین کاربرد ندارند. با این " +"حال، ماکروهای زیر در دسترس هستند." -msgid "This instance of :c:type:`PyTypeObject` represents the Python boolean type; it is the same object as :class:`bool` in the Python layer." -msgstr "این نمونه از :c:type:`PyTypeObject` نوع داده‌ی بولین پایتون را نشان می‌دهد؛ این همان شیء‌ای است که در لایه‌ی پایتون با نام :class:`bool` شناخته می‌شود." +#: ../../c-api/bool.rst:16 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python boolean type; " +"it is the same object as :class:`bool` in the Python layer." +msgstr "" +"این نمونه از :c:type:`PyTypeObject` نوع داده‌ی بولین پایتون را نشان می‌دهد؛ " +"این همان شیء‌ای است که در لایه‌ی پایتون با نام :class:`bool` شناخته می‌شود." -msgid "Return true if *o* is of type :c:data:`PyBool_Type`. This function always succeeds." -msgstr "اگر *o* از نوع :c:data:`PyBool_Type` باشد، مقدار True را برمی‌گرداند. این تابع همیشه با موفقیت اجرا می‌شود." +#: ../../c-api/bool.rst:22 +msgid "" +"Return true if *o* is of type :c:data:`PyBool_Type`. This function always " +"succeeds." +msgstr "" +"اگر *o* از نوع :c:data:`PyBool_Type` باشد، مقدار True را برمی‌گرداند. این " +"تابع همیشه با موفقیت اجرا می‌شود." -msgid "The Python ``False`` object. This object has no methods and is :term:`immortal`." -msgstr "شیء ``False`` در پایتون. این شیء هیچ متدی ندارد و :term:`immortal` است." +#: ../../c-api/bool.rst:28 +msgid "" +"The Python ``False`` object. This object has no methods and " +"is :term:`immortal`." +msgstr "" +"شیء ``False`` در پایتون. این شیء هیچ متدی ندارد و :term:`immortal` است." +#: ../../c-api/bool.rst:31 msgid ":c:data:`Py_False` is :term:`immortal`." msgstr ":c:data:`Py_False` :term:`immortal` است." -msgid "The Python ``True`` object. This object has no methods and is :term:`immortal`." +#: ../../c-api/bool.rst:37 +msgid "" +"The Python ``True`` object. This object has no methods and " +"is :term:`immortal`." msgstr "شیء ``True`` در پایتون. این شیء هیچ متدی ندارد و :term:`immortal` است." +#: ../../c-api/bool.rst:40 msgid ":c:data:`Py_True` is :term:`immortal`." msgstr ":c:data:`Py_True` :term:`immortal` است." +#: ../../c-api/bool.rst:46 msgid "Return :c:data:`Py_False` from a function." msgstr ":c:data:`Py_False` را از یک تابع برگردانید." +#: ../../c-api/bool.rst:51 msgid "Return :c:data:`Py_True` from a function." msgstr ":c:data:`Py_True` را از یک تابع برگردانید." -msgid "Return :c:data:`Py_True` or :c:data:`Py_False`, depending on the truth value of *v*." -msgstr ":c:data:`Py_True` یا :c:data:`Py_False` را، بسته به مقدار صحت (truth value) *v*، برگردانید." +#: ../../c-api/bool.rst:56 +msgid "" +"Return :c:data:`Py_True` or :c:data:`Py_False`, depending on the truth value " +"of *v*." +msgstr "" +":c:data:`Py_True` یا :c:data:`Py_False` را، بسته به مقدار صحت (truth value) " +"*v*، برگردانید." diff --git a/c-api/buffer.po b/c-api/buffer.po index a2f555fbd..98e2e71f0 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,266 +24,553 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/buffer.rst:11 msgid "Buffer Protocol" msgstr "" -msgid "Certain objects available in Python wrap access to an underlying memory array or *buffer*. Such objects include the built-in :class:`bytes` and :class:`bytearray`, and some extension types like :class:`array.array`. Third-party libraries may define their own types for special purposes, such as image processing or numeric analysis." +#: ../../c-api/buffer.rst:18 +msgid "" +"Certain objects available in Python wrap access to an underlying memory " +"array or *buffer*. Such objects include the built-in :class:`bytes` " +"and :class:`bytearray`, and some extension types like :class:`array.array`. " +"Third-party libraries may define their own types for special purposes, such " +"as image processing or numeric analysis." msgstr "" -msgid "While each of these types have their own semantics, they share the common characteristic of being backed by a possibly large memory buffer. It is then desirable, in some situations, to access that buffer directly and without intermediate copying." +#: ../../c-api/buffer.rst:24 +msgid "" +"While each of these types have their own semantics, they share the common " +"characteristic of being backed by a possibly large memory buffer. It is " +"then desirable, in some situations, to access that buffer directly and " +"without intermediate copying." msgstr "" -msgid "Python provides such a facility at the C and Python level in the form of the :ref:`buffer protocol `. This protocol has two sides:" +#: ../../c-api/buffer.rst:29 +msgid "" +"Python provides such a facility at the C and Python level in the form of " +"the :ref:`buffer protocol `. This protocol has two sides:" msgstr "" -msgid "on the producer side, a type can export a \"buffer interface\" which allows objects of that type to expose information about their underlying buffer. This interface is described in the section :ref:`buffer-structs`; for Python see :ref:`python-buffer-protocol`." +#: ../../c-api/buffer.rst:34 +msgid "" +"on the producer side, a type can export a \"buffer interface\" which allows " +"objects of that type to expose information about their underlying buffer. " +"This interface is described in the section :ref:`buffer-structs`; for Python " +"see :ref:`python-buffer-protocol`." msgstr "" -msgid "on the consumer side, several means are available to obtain a pointer to the raw underlying data of an object (for example a method parameter). For Python see :class:`memoryview`." +#: ../../c-api/buffer.rst:39 +msgid "" +"on the consumer side, several means are available to obtain a pointer to the " +"raw underlying data of an object (for example a method parameter). For " +"Python see :class:`memoryview`." msgstr "" -msgid "Simple objects such as :class:`bytes` and :class:`bytearray` expose their underlying buffer in byte-oriented form. Other forms are possible; for example, the elements exposed by an :class:`array.array` can be multi-byte values." +#: ../../c-api/buffer.rst:43 +msgid "" +"Simple objects such as :class:`bytes` and :class:`bytearray` expose their " +"underlying buffer in byte-oriented form. Other forms are possible; for " +"example, the elements exposed by an :class:`array.array` can be multi-byte " +"values." msgstr "" -msgid "An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write` method of file objects: any object that can export a series of bytes through the buffer interface can be written to a file. While :meth:`!write` only needs read-only access to the internal contents of the object passed to it, other methods such as :meth:`~io.BufferedIOBase.readinto` need write access to the contents of their argument. The buffer interface allows objects to selectively allow or reject exporting of read-write and read-only buffers." +#: ../../c-api/buffer.rst:47 +msgid "" +"An example consumer of the buffer interface is " +"the :meth:`~io.BufferedIOBase.write` method of file objects: any object that " +"can export a series of bytes through the buffer interface can be written to " +"a file. While :meth:`!write` only needs read-only access to the internal " +"contents of the object passed to it, other methods such " +"as :meth:`~io.BufferedIOBase.readinto` need write access to the contents of " +"their argument. The buffer interface allows objects to selectively allow or " +"reject exporting of read-write and read-only buffers." msgstr "" -msgid "There are two ways for a consumer of the buffer interface to acquire a buffer over a target object:" +#: ../../c-api/buffer.rst:55 +msgid "" +"There are two ways for a consumer of the buffer interface to acquire a " +"buffer over a target object:" msgstr "" +#: ../../c-api/buffer.rst:58 msgid "call :c:func:`PyObject_GetBuffer` with the right parameters;" msgstr "" -msgid "call :c:func:`PyArg_ParseTuple` (or one of its siblings) with one of the ``y*``, ``w*`` or ``s*`` :ref:`format codes `." +#: ../../c-api/buffer.rst:60 +msgid "" +"call :c:func:`PyArg_ParseTuple` (or one of its siblings) with one of the " +"``y*``, ``w*`` or ``s*`` :ref:`format codes `." msgstr "" -msgid "In both cases, :c:func:`PyBuffer_Release` must be called when the buffer isn't needed anymore. Failure to do so could lead to various issues such as resource leaks." +#: ../../c-api/buffer.rst:63 +msgid "" +"In both cases, :c:func:`PyBuffer_Release` must be called when the buffer " +"isn't needed anymore. Failure to do so could lead to various issues such as " +"resource leaks." msgstr "" -msgid "The buffer protocol is now accessible in Python, see :ref:`python-buffer-protocol` and :class:`memoryview`." +#: ../../c-api/buffer.rst:69 +msgid "" +"The buffer protocol is now accessible in Python, see :ref:`python-buffer-" +"protocol` and :class:`memoryview`." msgstr "" +#: ../../c-api/buffer.rst:75 msgid "Buffer structure" msgstr "" -msgid "Buffer structures (or simply \"buffers\") are useful as a way to expose the binary data from another object to the Python programmer. They can also be used as a zero-copy slicing mechanism. Using their ability to reference a block of memory, it is possible to expose any data to the Python programmer quite easily. The memory could be a large, constant array in a C extension, it could be a raw block of memory for manipulation before passing to an operating system library, or it could be used to pass around structured data in its native, in-memory format." +#: ../../c-api/buffer.rst:77 +msgid "" +"Buffer structures (or simply \"buffers\") are useful as a way to expose the " +"binary data from another object to the Python programmer. They can also be " +"used as a zero-copy slicing mechanism. Using their ability to reference a " +"block of memory, it is possible to expose any data to the Python programmer " +"quite easily. The memory could be a large, constant array in a C extension, " +"it could be a raw block of memory for manipulation before passing to an " +"operating system library, or it could be used to pass around structured data " +"in its native, in-memory format." msgstr "" -msgid "Contrary to most data types exposed by the Python interpreter, buffers are not :c:type:`PyObject` pointers but rather simple C structures. This allows them to be created and copied very simply. When a generic wrapper around a buffer is needed, a :ref:`memoryview ` object can be created." +#: ../../c-api/buffer.rst:86 +msgid "" +"Contrary to most data types exposed by the Python interpreter, buffers are " +"not :c:type:`PyObject` pointers but rather simple C structures. This allows " +"them to be created and copied very simply. When a generic wrapper around a " +"buffer is needed, a :ref:`memoryview ` object can be " +"created." msgstr "" -msgid "For short instructions how to write an exporting object, see :ref:`Buffer Object Structures `. For obtaining a buffer, see :c:func:`PyObject_GetBuffer`." +#: ../../c-api/buffer.rst:92 +msgid "" +"For short instructions how to write an exporting object, see :ref:`Buffer " +"Object Structures `. For obtaining a buffer, " +"see :c:func:`PyObject_GetBuffer`." msgstr "" -msgid "A pointer to the start of the logical structure described by the buffer fields. This can be any location within the underlying physical memory block of the exporter. For example, with negative :c:member:`~Py_buffer.strides` the value may point to the end of the memory block." +#: ../../c-api/buffer.rst:100 +msgid "" +"A pointer to the start of the logical structure described by the buffer " +"fields. This can be any location within the underlying physical memory block " +"of the exporter. For example, with negative :c:member:`~Py_buffer.strides` " +"the value may point to the end of the memory block." msgstr "" -msgid "For :term:`contiguous` arrays, the value points to the beginning of the memory block." +#: ../../c-api/buffer.rst:105 +msgid "" +"For :term:`contiguous` arrays, the value points to the beginning of the " +"memory block." msgstr "" -msgid "A new reference to the exporting object. The reference is owned by the consumer and automatically released (i.e. reference count decremented) and set to ``NULL`` by :c:func:`PyBuffer_Release`. The field is the equivalent of the return value of any standard C-API function." +#: ../../c-api/buffer.rst:110 +msgid "" +"A new reference to the exporting object. The reference is owned by the " +"consumer and automatically released (i.e. reference count decremented) and " +"set to ``NULL`` by :c:func:`PyBuffer_Release`. The field is the equivalent " +"of the return value of any standard C-API function." msgstr "" -msgid "As a special case, for *temporary* buffers that are wrapped by :c:func:`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this field is ``NULL``. In general, exporting objects MUST NOT use this scheme." +#: ../../c-api/buffer.rst:117 +msgid "" +"As a special case, for *temporary* buffers that are wrapped " +"by :c:func:`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this " +"field is ``NULL``. In general, exporting objects MUST NOT use this scheme." msgstr "" -msgid "``product(shape) * itemsize``. For contiguous arrays, this is the length of the underlying memory block. For non-contiguous arrays, it is the length that the logical structure would have if it were copied to a contiguous representation." +#: ../../c-api/buffer.rst:124 +msgid "" +"``product(shape) * itemsize``. For contiguous arrays, this is the length of " +"the underlying memory block. For non-contiguous arrays, it is the length " +"that the logical structure would have if it were copied to a contiguous " +"representation." msgstr "" -msgid "Accessing ``((char *)buf)[0] up to ((char *)buf)[len-1]`` is only valid if the buffer has been obtained by a request that guarantees contiguity. In most cases such a request will be :c:macro:`PyBUF_SIMPLE` or :c:macro:`PyBUF_WRITABLE`." +#: ../../c-api/buffer.rst:129 +msgid "" +"Accessing ``((char *)buf)[0] up to ((char *)buf)[len-1]`` is only valid if " +"the buffer has been obtained by a request that guarantees contiguity. In " +"most cases such a request will be :c:macro:`PyBUF_SIMPLE` " +"or :c:macro:`PyBUF_WRITABLE`." msgstr "" -msgid "An indicator of whether the buffer is read-only. This field is controlled by the :c:macro:`PyBUF_WRITABLE` flag." +#: ../../c-api/buffer.rst:135 +msgid "" +"An indicator of whether the buffer is read-only. This field is controlled by " +"the :c:macro:`PyBUF_WRITABLE` flag." msgstr "" -msgid "Item size in bytes of a single element. Same as the value of :func:`struct.calcsize` called on non-``NULL`` :c:member:`~Py_buffer.format` values." +#: ../../c-api/buffer.rst:140 +msgid "" +"Item size in bytes of a single element. Same as the value " +"of :func:`struct.calcsize` called on non-" +"``NULL`` :c:member:`~Py_buffer.format` values." msgstr "" -msgid "Important exception: If a consumer requests a buffer without the :c:macro:`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will be set to ``NULL``, but :c:member:`~Py_buffer.itemsize` still has the value for the original format." +#: ../../c-api/buffer.rst:143 +msgid "" +"Important exception: If a consumer requests a buffer without " +"the :c:macro:`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will be set " +"to ``NULL``, but :c:member:`~Py_buffer.itemsize` still has the value for " +"the original format." msgstr "" -msgid "If :c:member:`~Py_buffer.shape` is present, the equality ``product(shape) * itemsize == len`` still holds and the consumer can use :c:member:`~Py_buffer.itemsize` to navigate the buffer." +#: ../../c-api/buffer.rst:148 +msgid "" +"If :c:member:`~Py_buffer.shape` is present, the equality ``product(shape) * " +"itemsize == len`` still holds and the consumer can " +"use :c:member:`~Py_buffer.itemsize` to navigate the buffer." msgstr "" -msgid "If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of a :c:macro:`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the consumer must disregard :c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``." +#: ../../c-api/buffer.rst:152 +msgid "" +"If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of " +"a :c:macro:`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the " +"consumer must disregard :c:member:`~Py_buffer.itemsize` and assume " +"``itemsize == 1``." msgstr "" -msgid "A *NULL* terminated string in :mod:`struct` module style syntax describing the contents of a single item. If this is ``NULL``, ``\"B\"`` (unsigned bytes) is assumed." +#: ../../c-api/buffer.rst:158 +msgid "" +"A *NULL* terminated string in :mod:`struct` module style syntax describing " +"the contents of a single item. If this is ``NULL``, ``\"B\"`` (unsigned " +"bytes) is assumed." msgstr "" +#: ../../c-api/buffer.rst:162 msgid "This field is controlled by the :c:macro:`PyBUF_FORMAT` flag." msgstr "" -msgid "The number of dimensions the memory represents as an n-dimensional array. If it is ``0``, :c:member:`~Py_buffer.buf` points to a single item representing a scalar. In this case, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides` and :c:member:`~Py_buffer.suboffsets` MUST be ``NULL``. The maximum number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." +#: ../../c-api/buffer.rst:166 +msgid "" +"The number of dimensions the memory represents as an n-dimensional array. If " +"it is ``0``, :c:member:`~Py_buffer.buf` points to a single item representing " +"a scalar. In this " +"case, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides` " +"and :c:member:`~Py_buffer.suboffsets` MUST be ``NULL``. The maximum number " +"of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." msgstr "" -msgid "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` indicating the shape of the memory as an n-dimensional array. Note that ``shape[0] * ... * shape[ndim-1] * itemsize`` MUST be equal to :c:member:`~Py_buffer.len`." +#: ../../c-api/buffer.rst:174 +msgid "" +"An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " +"indicating the shape of the memory as an n-dimensional array. Note that " +"``shape[0] * ... * shape[ndim-1] * itemsize`` MUST be equal " +"to :c:member:`~Py_buffer.len`." msgstr "" -msgid "Shape values are restricted to ``shape[n] >= 0``. The case ``shape[n] == 0`` requires special attention. See `complex arrays`_ for further information." +#: ../../c-api/buffer.rst:179 +msgid "" +"Shape values are restricted to ``shape[n] >= 0``. The case ``shape[n] == 0`` " +"requires special attention. See `complex arrays`_ for further information." msgstr "" +#: ../../c-api/buffer.rst:183 msgid "The shape array is read-only for the consumer." msgstr "" -msgid "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` giving the number of bytes to skip to get to a new element in each dimension." +#: ../../c-api/buffer.rst:187 +msgid "" +"An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " +"giving the number of bytes to skip to get to a new element in each dimension." msgstr "" -msgid "Stride values can be any integer. For regular arrays, strides are usually positive, but a consumer MUST be able to handle the case ``strides[n] <= 0``. See `complex arrays`_ for further information." +#: ../../c-api/buffer.rst:191 +msgid "" +"Stride values can be any integer. For regular arrays, strides are usually " +"positive, but a consumer MUST be able to handle the case ``strides[n] <= " +"0``. See `complex arrays`_ for further information." msgstr "" +#: ../../c-api/buffer.rst:195 msgid "The strides array is read-only for the consumer." msgstr "" -msgid "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim`. If ``suboffsets[n] >= 0``, the values stored along the nth dimension are pointers and the suboffset value dictates how many bytes to add to each pointer after de-referencing. A suboffset value that is negative indicates that no de-referencing should occur (striding in a contiguous memory block)." +#: ../../c-api/buffer.rst:199 +msgid "" +"An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim`. If " +"``suboffsets[n] >= 0``, the values stored along the nth dimension are " +"pointers and the suboffset value dictates how many bytes to add to each " +"pointer after de-referencing. A suboffset value that is negative indicates " +"that no de-referencing should occur (striding in a contiguous memory block)." msgstr "" -msgid "If all suboffsets are negative (i.e. no de-referencing is needed), then this field must be ``NULL`` (the default value)." +#: ../../c-api/buffer.rst:206 +msgid "" +"If all suboffsets are negative (i.e. no de-referencing is needed), then this " +"field must be ``NULL`` (the default value)." msgstr "" -msgid "This type of array representation is used by the Python Imaging Library (PIL). See `complex arrays`_ for further information how to access elements of such an array." +#: ../../c-api/buffer.rst:209 +msgid "" +"This type of array representation is used by the Python Imaging Library " +"(PIL). See `complex arrays`_ for further information how to access elements " +"of such an array." msgstr "" +#: ../../c-api/buffer.rst:213 msgid "The suboffsets array is read-only for the consumer." msgstr "" -msgid "This is for use internally by the exporting object. For example, this might be re-cast as an integer by the exporter and used to store flags about whether or not the shape, strides, and suboffsets arrays must be freed when the buffer is released. The consumer MUST NOT alter this value." +#: ../../c-api/buffer.rst:217 +msgid "" +"This is for use internally by the exporting object. For example, this might " +"be re-cast as an integer by the exporter and used to store flags about " +"whether or not the shape, strides, and suboffsets arrays must be freed when " +"the buffer is released. The consumer MUST NOT alter this value." msgstr "" +#: ../../c-api/buffer.rst:224 msgid "Constants:" msgstr "" -msgid "The maximum number of dimensions the memory represents. Exporters MUST respect this limit, consumers of multi-dimensional buffers SHOULD be able to handle up to :c:macro:`!PyBUF_MAX_NDIM` dimensions. Currently set to 64." +#: ../../c-api/buffer.rst:228 +msgid "" +"The maximum number of dimensions the memory represents. Exporters MUST " +"respect this limit, consumers of multi-dimensional buffers SHOULD be able to " +"handle up to :c:macro:`!PyBUF_MAX_NDIM` dimensions. Currently set to 64." msgstr "" +#: ../../c-api/buffer.rst:237 msgid "Buffer request types" msgstr "" -msgid "Buffers are usually obtained by sending a buffer request to an exporting object via :c:func:`PyObject_GetBuffer`. Since the complexity of the logical structure of the memory can vary drastically, the consumer uses the *flags* argument to specify the exact buffer type it can handle." +#: ../../c-api/buffer.rst:239 +msgid "" +"Buffers are usually obtained by sending a buffer request to an exporting " +"object via :c:func:`PyObject_GetBuffer`. Since the complexity of the logical " +"structure of the memory can vary drastically, the consumer uses the *flags* " +"argument to specify the exact buffer type it can handle." msgstr "" -msgid "All :c:type:`Py_buffer` fields are unambiguously defined by the request type." +#: ../../c-api/buffer.rst:244 +msgid "" +"All :c:type:`Py_buffer` fields are unambiguously defined by the request type." msgstr "" +#: ../../c-api/buffer.rst:248 msgid "request-independent fields" msgstr "" -msgid "The following fields are not influenced by *flags* and must always be filled in with the correct values: :c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`, :c:member:`~Py_buffer.len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`." +#: ../../c-api/buffer.rst:249 +msgid "" +"The following fields are not influenced by *flags* and must always be filled " +"in with the correct " +"values: :c:member:`~Py_buffer.obj`, :c:member:`~Py_buffer.buf`, :c:member:`~Py_buffer.len`, :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" +#: ../../c-api/buffer.rst:254 msgid "readonly, format" msgstr "" -msgid "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter MUST provide a writable buffer or else report failure. Otherwise, the exporter MAY provide either a read-only or writable buffer, but the choice MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE` can be used to request a simple writable buffer." +#: ../../c-api/buffer.rst:258 +msgid "" +"Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " +"MUST provide a writable buffer or else report failure. Otherwise, the " +"exporter MAY provide either a read-only or writable buffer, but the choice " +"MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | " +"PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" -msgid "This is a :term:`soft deprecated` alias to :c:macro:`PyBUF_WRITABLE`." +#: ../../c-api/buffer.rst:266 +msgid "This is an alias to :c:macro:`PyBUF_WRITABLE`." msgstr "" -msgid "Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST be filled in correctly. Otherwise, this field MUST be ``NULL``." +#: ../../c-api/buffer.rst:272 +msgid "" +"Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST be " +"filled in correctly. Otherwise, this field MUST be ``NULL``." msgstr "" -msgid ":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next section. Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:`PyBUF_WRITABLE` can be used as a stand-alone flag to request a simple writable buffer." +#: ../../c-api/buffer.rst:276 +msgid "" +":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next " +"section. Since :c:macro:`PyBUF_SIMPLE` is defined as " +"0, :c:macro:`PyBUF_WRITABLE` can be used as a stand-alone flag to request a " +"simple writable buffer." msgstr "" -msgid ":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." +#: ../../c-api/buffer.rst:280 +msgid "" +":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags " +"except :c:macro:`PyBUF_SIMPLE`, because the latter already implies format " +"``B`` (unsigned bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" +#: ../../c-api/buffer.rst:286 msgid "shape, strides, suboffsets" msgstr "" -msgid "The flags that control the logical structure of the memory are listed in decreasing order of complexity. Note that each flag contains all bits of the flags below it." +#: ../../c-api/buffer.rst:288 +msgid "" +"The flags that control the logical structure of the memory are listed in " +"decreasing order of complexity. Note that each flag contains all bits of the " +"flags below it." msgstr "" +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:344 msgid "Request" msgstr "" +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:344 msgid "shape" msgstr "" +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:344 msgid "strides" msgstr "" +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:344 msgid "suboffsets" msgstr "" +#: ../../c-api/buffer.rst:297 ../../c-api/buffer.rst:299 +#: ../../c-api/buffer.rst:301 ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:323 ../../c-api/buffer.rst:325 +#: ../../c-api/buffer.rst:327 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:350 +#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:354 +#: ../../c-api/buffer.rst:356 ../../c-api/buffer.rst:358 +#: ../../c-api/buffer.rst:360 msgid "yes" msgstr "" +#: ../../c-api/buffer.rst:297 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "if needed" msgstr "" +#: ../../c-api/buffer.rst:299 ../../c-api/buffer.rst:301 +#: ../../c-api/buffer.rst:303 ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:323 ../../c-api/buffer.rst:325 +#: ../../c-api/buffer.rst:327 ../../c-api/buffer.rst:350 +#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:354 +#: ../../c-api/buffer.rst:356 ../../c-api/buffer.rst:358 +#: ../../c-api/buffer.rst:360 msgid "NULL" msgstr "" +#: ../../c-api/buffer.rst:310 msgid "contiguity requests" msgstr "" -msgid "C or Fortran :term:`contiguity ` can be explicitly requested, with and without stride information. Without stride information, the buffer must be C-contiguous." +#: ../../c-api/buffer.rst:312 +msgid "" +"C or Fortran :term:`contiguity ` can be explicitly requested, " +"with and without stride information. Without stride information, the buffer " +"must be C-contiguous." msgstr "" +#: ../../c-api/buffer.rst:319 ../../c-api/buffer.rst:344 msgid "contig" msgstr "" +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:327 +#: ../../c-api/buffer.rst:358 ../../c-api/buffer.rst:360 msgid "C" msgstr "" +#: ../../c-api/buffer.rst:323 msgid "F" msgstr "" +#: ../../c-api/buffer.rst:325 msgid "C or F" msgstr "" +#: ../../c-api/buffer.rst:327 msgid ":c:macro:`PyBUF_ND`" msgstr "" +#: ../../c-api/buffer.rst:332 msgid "compound requests" msgstr "" -msgid "All possible requests are fully defined by some combination of the flags in the previous section. For convenience, the buffer protocol provides frequently used combinations as single flags." +#: ../../c-api/buffer.rst:334 +msgid "" +"All possible requests are fully defined by some combination of the flags in " +"the previous section. For convenience, the buffer protocol provides " +"frequently used combinations as single flags." msgstr "" -msgid "In the following table *U* stands for undefined contiguity. The consumer would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." +#: ../../c-api/buffer.rst:338 +msgid "" +"In the following table *U* stands for undefined contiguity. The consumer " +"would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" +#: ../../c-api/buffer.rst:344 msgid "readonly" msgstr "" +#: ../../c-api/buffer.rst:344 msgid "format" msgstr "" +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:354 ../../c-api/buffer.rst:356 msgid "U" msgstr "" +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:350 +#: ../../c-api/buffer.rst:354 ../../c-api/buffer.rst:358 msgid "0" msgstr "" +#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:356 ../../c-api/buffer.rst:360 msgid "1 or 0" msgstr "" +#: ../../c-api/buffer.rst:365 msgid "Complex arrays" msgstr "" +#: ../../c-api/buffer.rst:368 msgid "NumPy-style: shape and strides" msgstr "" -msgid "The logical structure of NumPy-style arrays is defined by :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer.strides`." +#: ../../c-api/buffer.rst:370 +msgid "" +"The logical structure of NumPy-style arrays is defined " +"by :c:member:`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer.shape` " +"and :c:member:`~Py_buffer.strides`." msgstr "" -msgid "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer.buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In that case, both :c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer.strides` are ``NULL``." +#: ../../c-api/buffer.rst:373 +msgid "" +"If ``ndim == 0``, the memory location pointed to " +"by :c:member:`~Py_buffer.buf` is interpreted as a scalar of " +"size :c:member:`~Py_buffer.itemsize`. In that case, " +"both :c:member:`~Py_buffer.shape` and :c:member:`~Py_buffer.strides` are " +"``NULL``." msgstr "" -msgid "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a standard n-dimensional C-array. Otherwise, the consumer must access an n-dimensional array as follows:" +#: ../../c-api/buffer.rst:377 +msgid "" +"If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " +"standard n-dimensional C-array. Otherwise, the consumer must access an n-" +"dimensional array as follows:" msgstr "" +#: ../../c-api/buffer.rst:381 msgid "" -"ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];\n" +"ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " +"strides[n-1];\n" "item = *((typeof(item) *)ptr);" msgstr "" -msgid "As noted above, :c:member:`~Py_buffer.buf` can point to any location within the actual memory block. An exporter can check the validity of a buffer with this function:" +#: ../../c-api/buffer.rst:387 +msgid "" +"As noted above, :c:member:`~Py_buffer.buf` can point to any location within " +"the actual memory block. An exporter can check the validity of a buffer with " +"this function:" msgstr "" +#: ../../c-api/buffer.rst:391 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -312,15 +599,29 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" +#: ../../c-api/buffer.rst:421 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -msgid "In addition to the regular items, PIL-style arrays can contain pointers that must be followed in order to get to the next element in a dimension. For example, the regular three-dimensional C-array ``char v[2][2][3]`` can also be viewed as an array of 2 pointers to 2 two-dimensional arrays: ``char (*v[2])[2][3]``. In suboffsets representation, those two pointers can be embedded at the start of :c:member:`~Py_buffer.buf`, pointing to two ``char x[2][3]`` arrays that can be located anywhere in memory." +#: ../../c-api/buffer.rst:423 +msgid "" +"In addition to the regular items, PIL-style arrays can contain pointers that " +"must be followed in order to get to the next element in a dimension. For " +"example, the regular three-dimensional C-array ``char v[2][2][3]`` can also " +"be viewed as an array of 2 pointers to 2 two-dimensional arrays: ``char " +"(*v[2])[2][3]``. In suboffsets representation, those two pointers can be " +"embedded at the start of :c:member:`~Py_buffer.buf`, pointing to two ``char " +"x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -msgid "Here is a function that returns a pointer to the element in an N-D array pointed to by an N-dimensional index when there are both non-``NULL`` strides and suboffsets::" +#: ../../c-api/buffer.rst:432 +msgid "" +"Here is a function that returns a pointer to the element in an N-D array " +"pointed to by an N-dimensional index when there are both non-``NULL`` " +"strides and suboffsets::" msgstr "" +#: ../../c-api/buffer.rst:436 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -336,86 +637,166 @@ msgid "" "}" msgstr "" +#: ../../c-api/buffer.rst:451 msgid "Buffer-related functions" msgstr "" -msgid "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When ``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` will succeed. This function always succeeds." +#: ../../c-api/buffer.rst:455 +msgid "" +"Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " +"``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. This function always succeeds." msgstr "" -msgid "Send a request to *exporter* to fill in *view* as specified by *flags*. If the exporter cannot provide a buffer of the exact type, it MUST raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." +#: ../../c-api/buffer.rst:462 +msgid "" +"Send a request to *exporter* to fill in *view* as specified by *flags*. If " +"the exporter cannot provide a buffer of the exact type, it MUST " +"raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -msgid "On success, fill in *view*, set ``view->obj`` to a new reference to *exporter* and return 0. In the case of chained buffer providers that redirect requests to a single object, ``view->obj`` MAY refer to this object instead of *exporter* (See :ref:`Buffer Object Structures `)." +#: ../../c-api/buffer.rst:467 +msgid "" +"On success, fill in *view*, set ``view->obj`` to a new reference to " +"*exporter* and return 0. In the case of chained buffer providers that " +"redirect requests to a single object, ``view->obj`` MAY refer to this object " +"instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -msgid "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:`free`. Thus, after the consumer is done with the buffer, :c:func:`PyBuffer_Release` must be called exactly once." +#: ../../c-api/buffer.rst:472 +msgid "" +"Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " +"to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` " +"and :c:func:`free`. Thus, after the consumer is done with the " +"buffer, :c:func:`PyBuffer_Release` must be called exactly once." msgstr "" -msgid "Release the buffer *view* and release the :term:`strong reference` (i.e. decrement the reference count) to the view's supporting object, ``view->obj``. This function MUST be called when the buffer is no longer being used, otherwise reference leaks may occur." +#: ../../c-api/buffer.rst:480 +msgid "" +"Release the buffer *view* and release the :term:`strong reference` (i.e. " +"decrement the reference count) to the view's supporting object, ``view-" +">obj``. This function MUST be called when the buffer is no longer being " +"used, otherwise reference leaks may occur." msgstr "" -msgid "It is an error to call this function on a buffer that was not obtained via :c:func:`PyObject_GetBuffer`." +#: ../../c-api/buffer.rst:485 +msgid "" +"It is an error to call this function on a buffer that was not obtained " +"via :c:func:`PyObject_GetBuffer`." msgstr "" -msgid "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:`~Py_buffer.format`. On error, raise an exception and return -1." +#: ../../c-api/buffer.rst:491 +msgid "" +"Return the implied :c:member:`~Py_buffer.itemsize` " +"from :c:member:`~Py_buffer.format`. On error, raise an exception and return " +"-1." msgstr "" -msgid "Return ``1`` if the memory defined by the *view* is C-style (*order* is ``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either one (*order* is ``'A'``). Return ``0`` otherwise. This function always succeeds." +#: ../../c-api/buffer.rst:499 +msgid "" +"Return ``1`` if the memory defined by the *view* is C-style (*order* is " +"``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " +"one (*order* is ``'A'``). Return ``0`` otherwise. This function always " +"succeeds." msgstr "" -msgid "Get the memory area pointed to by the *indices* inside the given *view*. *indices* must point to an array of ``view->ndim`` indices." +#: ../../c-api/buffer.rst:506 +msgid "" +"Get the memory area pointed to by the *indices* inside the given *view*. " +"*indices* must point to an array of ``view->ndim`` indices." msgstr "" -msgid "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or ``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on success, ``-1`` on error." +#: ../../c-api/buffer.rst:512 +msgid "" +"Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " +"``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " +"success, ``-1`` on error." msgstr "" -msgid "Copy *len* bytes from *src* to its contiguous representation in *buf*. *order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style ordering or either one). ``0`` is returned on success, ``-1`` on error." +#: ../../c-api/buffer.rst:519 +msgid "" +"Copy *len* bytes from *src* to its contiguous representation in *buf*. " +"*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " +"ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" +#: ../../c-api/buffer.rst:523 msgid "This function fails if *len* != *src->len*." msgstr "" -msgid "Copy data from *src* to *dest* buffer. Can convert between C-style and or Fortran-style buffers." +#: ../../c-api/buffer.rst:528 +msgid "" +"Copy data from *src* to *dest* buffer. Can convert between C-style and or " +"Fortran-style buffers." msgstr "" +#: ../../c-api/buffer.rst:531 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -msgid "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the given shape with the given number of bytes per element." +#: ../../c-api/buffer.rst:535 +msgid "" +"Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " +"if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " +"given shape with the given number of bytes per element." msgstr "" -msgid "Handle buffer requests for an exporter that wants to expose *buf* of size *len* with writability set according to *readonly*. *buf* is interpreted as a sequence of unsigned bytes." +#: ../../c-api/buffer.rst:542 +msgid "" +"Handle buffer requests for an exporter that wants to expose *buf* of size " +"*len* with writability set according to *readonly*. *buf* is interpreted as " +"a sequence of unsigned bytes." msgstr "" -msgid "The *flags* argument indicates the request type. This function always fills in *view* as specified by flags, unless *buf* has been designated as read-only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." +#: ../../c-api/buffer.rst:546 +msgid "" +"The *flags* argument indicates the request type. This function always fills " +"in *view* as specified by flags, unless *buf* has been designated as read-" +"only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -msgid "On success, set ``view->obj`` to a new reference to *exporter* and return 0. Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``;" +#: ../../c-api/buffer.rst:550 +msgid "" +"On success, set ``view->obj`` to a new reference to *exporter* and return 0. " +"Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " +"return ``-1``;" msgstr "" -msgid "If this function is used as part of a :ref:`getbufferproc `, *exporter* MUST be set to the exporting object and *flags* must be passed unmodified. Otherwise, *exporter* MUST be ``NULL``." +#: ../../c-api/buffer.rst:554 +msgid "" +"If this function is used as part of a :ref:`getbufferproc `, " +"*exporter* MUST be set to the exporting object and *flags* must be passed " +"unmodified. Otherwise, *exporter* MUST be ``NULL``." msgstr "" +#: ../../c-api/buffer.rst:3 msgid "buffer protocol" msgstr "" +#: ../../c-api/buffer.rst:3 msgid "buffer interface" msgstr "" +#: ../../c-api/buffer.rst:3 msgid "(see buffer protocol)" msgstr "" +#: ../../c-api/buffer.rst:3 msgid "buffer object" msgstr "" +#: ../../c-api/buffer.rst:32 msgid "PyBufferProcs (C type)" msgstr "" +#: ../../c-api/buffer.rst:307 msgid "contiguous" msgstr "" +#: ../../c-api/buffer.rst:307 msgid "C-contiguous" msgstr "" +#: ../../c-api/buffer.rst:307 msgid "Fortran contiguous" msgstr "" diff --git a/c-api/bytearray.po b/c-api/bytearray.po index 6ef87c5e7..444f2a46e 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,71 +25,135 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/bytearray.rst:6 msgid "Byte Array Objects" msgstr "اشیاء آرایه‌ی بایت" -msgid "This subtype of :c:type:`PyObject` represents a Python bytearray object." -msgstr "این زیرنوع از :c:type:`PyObject` نشان‌دهنده‌ی یک شیء bytearray پایتون است." +#: ../../c-api/bytearray.rst:13 +msgid "" +"This subtype of :c:type:`PyObject` represents a Python bytearray object." +msgstr "" +"این زیرنوع از :c:type:`PyObject` نشان‌دهنده‌ی یک شیء bytearray پایتون است." -msgid "This instance of :c:type:`PyTypeObject` represents the Python bytearray type; it is the same object as :class:`bytearray` in the Python layer." -msgstr "این نمونه از :c:type:`PyTypeObject` نشان‌دهنده‌ی نوع bytearray پایتون است؛ این همان شیء‌ای است که در لایه‌ی پایتون با نام :class:`bytearray` شناخته می‌شود." +#: ../../c-api/bytearray.rst:18 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python bytearray " +"type; it is the same object as :class:`bytearray` in the Python layer." +msgstr "" +"این نمونه از :c:type:`PyTypeObject` نشان‌دهنده‌ی نوع bytearray پایتون است؛ این " +"همان شیء‌ای است که در لایه‌ی پایتون با نام :class:`bytearray` شناخته می‌شود." +#: ../../c-api/bytearray.rst:23 msgid "Type check macros" msgstr "ماکروهای بررسی نوع" -msgid "Return true if the object *o* is a bytearray object or an instance of a subtype of the bytearray type. This function always succeeds." -msgstr "اگر شیء *o* یک شیء bytearray یا نمونه‌ای از زیرنوعی از نوع bytearray باشد، مقدار True را برمی‌گرداند. این تابع همیشه با موفقیت اجرا می‌شود." +#: ../../c-api/bytearray.rst:27 +msgid "" +"Return true if the object *o* is a bytearray object or an instance of a " +"subtype of the bytearray type. This function always succeeds." +msgstr "" +"اگر شیء *o* یک شیء bytearray یا نمونه‌ای از زیرنوعی از نوع bytearray باشد، " +"مقدار True را برمی‌گرداند. این تابع همیشه با موفقیت اجرا می‌شود." -msgid "Return true if the object *o* is a bytearray object, but not an instance of a subtype of the bytearray type. This function always succeeds." -msgstr "اگر شیء *o* یک شیء bytearray باشد، اما نمونه‌ای از زیرنوعی از نوع bytearray نباشد، مقدار True را برمی‌گرداند. این تابع همیشه با موفقیت اجرا می‌شود." +#: ../../c-api/bytearray.rst:33 +msgid "" +"Return true if the object *o* is a bytearray object, but not an instance of " +"a subtype of the bytearray type. This function always succeeds." +msgstr "" +"اگر شیء *o* یک شیء bytearray باشد، اما نمونه‌ای از زیرنوعی از نوع bytearray " +"نباشد، مقدار True را برمی‌گرداند. این تابع همیشه با موفقیت اجرا می‌شود." +#: ../../c-api/bytearray.rst:38 msgid "Direct API functions" msgstr "توابع مستقیم API" -msgid "Return a new bytearray object from any object, *o*, that implements the :ref:`buffer protocol `." -msgstr "یک شیء bytearray جدید از هر شیء *o* که :ref:`پروتکل بافر ` را پیاده‌سازی کرده است، برمی‌گرداند." +#: ../../c-api/bytearray.rst:42 +msgid "" +"Return a new bytearray object from any object, *o*, that implements " +"the :ref:`buffer protocol `." +msgstr "" +"یک شیء bytearray جدید از هر شیء *o* که :ref:`پروتکل بافر ` را " +"پیاده‌سازی کرده است، برمی‌گرداند." +#: ../../c-api/bytearray.rst:45 ../../c-api/bytearray.rst:56 +#: ../../c-api/bytearray.rst:63 msgid "On failure, return ``NULL`` with an exception set." msgstr "در صورت شکست، مقدار ``NULL`` را با یک استثنا باز می‌گرداند." -msgid "If the object implements the buffer protocol, then the buffer must not be mutated while the bytearray object is being created." -msgstr "اگر شیء پروتکل بافر را پیاده‌سازی کرده باشد، در حین ایجاد شیء bytearray نباید بافر تغییر داده شود." +#: ../../c-api/bytearray.rst:48 ../../c-api/bytearray.rst:66 +msgid "" +"If the object implements the buffer protocol, then the buffer must not be " +"mutated while the bytearray object is being created." +msgstr "" +"اگر شیء پروتکل بافر را پیاده‌سازی کرده باشد، در حین ایجاد شیء bytearray نباید " +"بافر تغییر داده شود." +#: ../../c-api/bytearray.rst:54 msgid "Create a new bytearray object from *string* and its length, *len*." msgstr "یک شیء bytearray جدید از *string* و طول آن *len*، ایجاد کنید." -msgid "Concat bytearrays *a* and *b* and return a new bytearray with the result." -msgstr "bytearrayهای *a* و *b* را به هم متصل کنید و یک bytearray جدید با نتیجه بازگردانید." +#: ../../c-api/bytearray.rst:61 +msgid "" +"Concat bytearrays *a* and *b* and return a new bytearray with the result." +msgstr "" +"bytearrayهای *a* و *b* را به هم متصل کنید و یک bytearray جدید با نتیجه " +"بازگردانید." +#: ../../c-api/bytearray.rst:72 msgid "Return the size of *bytearray* after checking for a ``NULL`` pointer." msgstr "اندازهٔ *bytearray* را پس از بررسی اشاره‌گر ``NULL`` بازگردانید." -msgid "Return the contents of *bytearray* as a char array after checking for a ``NULL`` pointer. The returned array always has an extra null byte appended." -msgstr "محتوای *bytearray* را پس از بررسی اشاره‌گر ``NULL`` به‌صورت یک آرایه نویسه‌ای (char array) بازگردانید. آرایه‌ی برگشتی همیشه دارای یک بایت null اضافی در انتها است." +#: ../../c-api/bytearray.rst:77 +msgid "" +"Return the contents of *bytearray* as a char array after checking for a " +"``NULL`` pointer. The returned array always has an extra null byte appended." +msgstr "" +"محتوای *bytearray* را پس از بررسی اشاره‌گر ``NULL`` به‌صورت یک آرایه نویسه‌ای " +"(char array) بازگردانید. آرایه‌ی برگشتی همیشه دارای یک بایت null اضافی در " +"انتها است." -msgid "It is not thread-safe to mutate the bytearray object while using the returned char array." -msgstr "زمانی که از آرایه‌ی نویسه‌ای برگشتی استفاده می‌شود، تغییر دادن شیء bytearray ایمن از نظر ریسه‌ها نیست." +#: ../../c-api/bytearray.rst:82 ../../c-api/bytearray.rst:104 +msgid "" +"It is not thread-safe to mutate the bytearray object while using the " +"returned char array." +msgstr "" +"زمانی که از آرایه‌ی نویسه‌ای برگشتی استفاده می‌شود، تغییر دادن شیء bytearray " +"ایمن از نظر ریسه‌ها نیست." -msgid "Resize the internal buffer of *bytearray* to *len*. Failure is a ``-1`` return with an exception set." -msgstr "بافر داخلی *bytearray* را به اندازه‌ی *len* تغییر اندازه دهید. در صورت شکست، مقدار ``-1`` به همراه یک استثنا بازگردانده می‌شود." +#: ../../c-api/bytearray.rst:87 +msgid "" +"Resize the internal buffer of *bytearray* to *len*. Failure is a ``-1`` " +"return with an exception set." +msgstr "" +"بافر داخلی *bytearray* را به اندازه‌ی *len* تغییر اندازه دهید. در صورت شکست، " +"مقدار ``-1`` به همراه یک استثنا بازگردانده می‌شود." -msgid "A negative *len* will now result in an exception being set and -1 returned." -msgstr "اکنون *len* منفی باعث می‌شود که یک استثنا تنظیم شده و مقدار -1 بازگردانده شود." +#: ../../c-api/bytearray.rst:90 +msgid "" +"A negative *len* will now result in an exception being set and -1 returned." +msgstr "" +"اکنون *len* منفی باعث می‌شود که یک استثنا تنظیم شده و مقدار -1 بازگردانده شود." +#: ../../c-api/bytearray.rst:95 msgid "Macros" msgstr "ماکروها" +#: ../../c-api/bytearray.rst:97 msgid "These macros trade safety for speed and they don't check pointers." msgstr "این ماکروها ایمنی را فدای سرعت می‌کنند و اشاره‌گرها را بررسی نمی‌کنند." +#: ../../c-api/bytearray.rst:101 msgid "Similar to :c:func:`PyByteArray_AsString`, but without error checking." msgstr "مشابه :c:func:`PyByteArray_AsString`، اما بدون بررسی خطا." +#: ../../c-api/bytearray.rst:109 msgid "Similar to :c:func:`PyByteArray_Size`, but without error checking." msgstr "مشابه :c:func:`PyByteArray_Size`، اما بدون بررسی خطا." +#: ../../c-api/bytearray.rst:8 msgid "object" msgstr "شیء" +#: ../../c-api/bytearray.rst:8 msgid "bytearray" msgstr "bytearray" diff --git a/c-api/bytes.po b/c-api/bytes.po index 3d969b276..dbf7e32cb 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,233 +24,411 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/bytes.rst:6 msgid "Bytes Objects" msgstr "" -msgid "These functions raise :exc:`TypeError` when expecting a bytes parameter and called with a non-bytes parameter." +#: ../../c-api/bytes.rst:8 +msgid "" +"These functions raise :exc:`TypeError` when expecting a bytes parameter and " +"called with a non-bytes parameter." msgstr "" +#: ../../c-api/bytes.rst:16 msgid "This subtype of :c:type:`PyObject` represents a Python bytes object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python bytes type; it is the same object as :class:`bytes` in the Python layer." +#: ../../c-api/bytes.rst:21 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python bytes type; it " +"is the same object as :class:`bytes` in the Python layer." msgstr "" -msgid "Return true if the object *o* is a bytes object or an instance of a subtype of the bytes type. This function always succeeds." +#: ../../c-api/bytes.rst:27 +msgid "" +"Return true if the object *o* is a bytes object or an instance of a subtype " +"of the bytes type. This function always succeeds." msgstr "" -msgid "Return true if the object *o* is a bytes object, but not an instance of a subtype of the bytes type. This function always succeeds." +#: ../../c-api/bytes.rst:33 +msgid "" +"Return true if the object *o* is a bytes object, but not an instance of a " +"subtype of the bytes type. This function always succeeds." msgstr "" -msgid "Return a new bytes object with a copy of the string *v* as value on success, and ``NULL`` on failure. The parameter *v* must not be ``NULL``; it will not be checked." +#: ../../c-api/bytes.rst:39 +msgid "" +"Return a new bytes object with a copy of the string *v* as value on success, " +"and ``NULL`` on failure. The parameter *v* must not be ``NULL``; it will " +"not be checked." msgstr "" -msgid "Return a new bytes object with a copy of the string *v* as value and length *len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents of the bytes object are uninitialized." +#: ../../c-api/bytes.rst:46 +msgid "" +"Return a new bytes object with a copy of the string *v* as value and length " +"*len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents " +"of the bytes object are uninitialized." msgstr "" -msgid "Take a C :c:func:`printf`\\ -style *format* string and a variable number of arguments, calculate the size of the resulting Python bytes object and return a bytes object with the values formatted into it. The variable arguments must be C types and must correspond exactly to the format characters in the *format* string. The following format characters are allowed:" +#: ../../c-api/bytes.rst:53 +msgid "" +"Take a C :c:func:`printf`\\ -style *format* string and a variable number of " +"arguments, calculate the size of the resulting Python bytes object and " +"return a bytes object with the values formatted into it. The variable " +"arguments must be C types and must correspond exactly to the format " +"characters in the *format* string. The following format characters are " +"allowed:" msgstr "" +#: ../../c-api/bytes.rst:65 msgid "Format Characters" msgstr "" +#: ../../c-api/bytes.rst:65 msgid "Type" msgstr "" +#: ../../c-api/bytes.rst:65 msgid "Comment" msgstr "" +#: ../../c-api/bytes.rst:67 msgid "``%%``" msgstr "" +#: ../../c-api/bytes.rst:67 msgid "*n/a*" msgstr "" +#: ../../c-api/bytes.rst:67 msgid "The literal % character." msgstr "" +#: ../../c-api/bytes.rst:69 msgid "``%c``" msgstr "" +#: ../../c-api/bytes.rst:69 ../../c-api/bytes.rst:72 ../../c-api/bytes.rst:90 +#: ../../c-api/bytes.rst:93 msgid "int" msgstr "" +#: ../../c-api/bytes.rst:69 msgid "A single byte, represented as a C int." msgstr "" +#: ../../c-api/bytes.rst:72 msgid "``%d``" msgstr "" +#: ../../c-api/bytes.rst:72 msgid "Equivalent to ``printf(\"%d\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:75 msgid "``%u``" msgstr "" +#: ../../c-api/bytes.rst:75 msgid "unsigned int" msgstr "" +#: ../../c-api/bytes.rst:75 msgid "Equivalent to ``printf(\"%u\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:78 msgid "``%ld``" msgstr "" +#: ../../c-api/bytes.rst:78 msgid "long" msgstr "" +#: ../../c-api/bytes.rst:78 msgid "Equivalent to ``printf(\"%ld\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:81 msgid "``%lu``" msgstr "" +#: ../../c-api/bytes.rst:81 msgid "unsigned long" msgstr "" +#: ../../c-api/bytes.rst:81 msgid "Equivalent to ``printf(\"%lu\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:84 msgid "``%zd``" msgstr "" +#: ../../c-api/bytes.rst:84 msgid ":c:type:`\\ Py_ssize_t`" msgstr "" +#: ../../c-api/bytes.rst:84 msgid "Equivalent to ``printf(\"%zd\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:87 msgid "``%zu``" msgstr "" +#: ../../c-api/bytes.rst:87 msgid "size_t" msgstr "" +#: ../../c-api/bytes.rst:87 msgid "Equivalent to ``printf(\"%zu\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:90 msgid "``%i``" msgstr "" +#: ../../c-api/bytes.rst:90 msgid "Equivalent to ``printf(\"%i\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:93 msgid "``%x``" msgstr "" +#: ../../c-api/bytes.rst:93 msgid "Equivalent to ``printf(\"%x\")``. [1]_" msgstr "" +#: ../../c-api/bytes.rst:96 msgid "``%s``" msgstr "" +#: ../../c-api/bytes.rst:96 msgid "const char\\*" msgstr "" +#: ../../c-api/bytes.rst:96 msgid "A null-terminated C character array." msgstr "" +#: ../../c-api/bytes.rst:99 msgid "``%p``" msgstr "" +#: ../../c-api/bytes.rst:99 msgid "const void\\*" msgstr "" -msgid "The hex representation of a C pointer. Mostly equivalent to ``printf(\"%p\")`` except that it is guaranteed to start with the literal ``0x`` regardless of what the platform's ``printf`` yields." +#: ../../c-api/bytes.rst:99 +msgid "" +"The hex representation of a C pointer. Mostly equivalent to " +"``printf(\"%p\")`` except that it is guaranteed to start with the literal " +"``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -msgid "An unrecognized format character causes all the rest of the format string to be copied as-is to the result object, and any extra arguments discarded." +#: ../../c-api/bytes.rst:108 +msgid "" +"An unrecognized format character causes all the rest of the format string to " +"be copied as-is to the result object, and any extra arguments discarded." msgstr "" -msgid "For integer specifiers (d, u, ld, lu, zd, zu, i, x): the 0-conversion flag has effect even when a precision is given." +#: ../../c-api/bytes.rst:111 +msgid "" +"For integer specifiers (d, u, ld, lu, zd, zu, i, x): the 0-conversion flag " +"has effect even when a precision is given." msgstr "" -msgid "Identical to :c:func:`PyBytes_FromFormat` except that it takes exactly two arguments." +#: ../../c-api/bytes.rst:117 +msgid "" +"Identical to :c:func:`PyBytes_FromFormat` except that it takes exactly two " +"arguments." msgstr "" -msgid "Return the bytes representation of object *o* that implements the buffer protocol." +#: ../../c-api/bytes.rst:123 +msgid "" +"Return the bytes representation of object *o* that implements the buffer " +"protocol." msgstr "" -msgid "If the object implements the buffer protocol, then the buffer must not be mutated while the bytes object is being created." +#: ../../c-api/bytes.rst:127 +msgid "" +"If the object implements the buffer protocol, then the buffer must not be " +"mutated while the bytes object is being created." msgstr "" +#: ../../c-api/bytes.rst:133 msgid "Return the length of the bytes in bytes object *o*." msgstr "" +#: ../../c-api/bytes.rst:138 msgid "Similar to :c:func:`PyBytes_Size`, but without error checking." msgstr "" -msgid "Return a pointer to the contents of *o*. The pointer refers to the internal buffer of *o*, which consists of ``len(o) + 1`` bytes. The last byte in the buffer is always null, regardless of whether there are any other null bytes. The data must not be modified in any way, unless the object was just created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be deallocated. If *o* is not a bytes object at all, :c:func:`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`." +#: ../../c-api/bytes.rst:143 +msgid "" +"Return a pointer to the contents of *o*. The pointer refers to the internal " +"buffer of *o*, which consists of ``len(o) + 1`` bytes. The last byte in the " +"buffer is always null, regardless of whether there are any other null " +"bytes. The data must not be modified in any way, unless the object was just " +"created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be " +"deallocated. If *o* is not a bytes object at " +"all, :c:func:`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`." msgstr "" +#: ../../c-api/bytes.rst:155 msgid "Similar to :c:func:`PyBytes_AsString`, but without error checking." msgstr "" -msgid "Return the null-terminated contents of the object *obj* through the output variables *buffer* and *length*. Returns ``0`` on success." +#: ../../c-api/bytes.rst:160 +msgid "" +"Return the null-terminated contents of the object *obj* through the output " +"variables *buffer* and *length*. Returns ``0`` on success." msgstr "" -msgid "If *length* is ``NULL``, the bytes object may not contain embedded null bytes; if it does, the function returns ``-1`` and a :exc:`ValueError` is raised." +#: ../../c-api/bytes.rst:164 +msgid "" +"If *length* is ``NULL``, the bytes object may not contain embedded null " +"bytes; if it does, the function returns ``-1`` and a :exc:`ValueError` is " +"raised." msgstr "" -msgid "The buffer refers to an internal buffer of *obj*, which includes an additional null byte at the end (not counted in *length*). The data must not be modified in any way, unless the object was just created using ``PyBytes_FromStringAndSize(NULL, size)``. It must not be deallocated. If *obj* is not a bytes object at all, :c:func:`PyBytes_AsStringAndSize` returns ``-1`` and raises :exc:`TypeError`." +#: ../../c-api/bytes.rst:168 +msgid "" +"The buffer refers to an internal buffer of *obj*, which includes an " +"additional null byte at the end (not counted in *length*). The data must " +"not be modified in any way, unless the object was just created using " +"``PyBytes_FromStringAndSize(NULL, size)``. It must not be deallocated. If " +"*obj* is not a bytes object at all, :c:func:`PyBytes_AsStringAndSize` " +"returns ``-1`` and raises :exc:`TypeError`." msgstr "" -msgid "Previously, :exc:`TypeError` was raised when embedded null bytes were encountered in the bytes object." +#: ../../c-api/bytes.rst:175 +msgid "" +"Previously, :exc:`TypeError` was raised when embedded null bytes were " +"encountered in the bytes object." msgstr "" -msgid "Create a new bytes object in *\\*bytes* containing the contents of *newpart* appended to *bytes*; the caller will own the new reference. The reference to the old value of *bytes* will be stolen. If the new object cannot be created, the old reference to *bytes* will still be discarded and the value of *\\*bytes* will be set to ``NULL``; the appropriate exception will be set." +#: ../../c-api/bytes.rst:182 +msgid "" +"Create a new bytes object in *\\*bytes* containing the contents of *newpart* " +"appended to *bytes*; the caller will own the new reference. The reference to " +"the old value of *bytes* will be \":term:`stolen `\". If the new " +"object cannot be created, the old reference to *bytes* will still be " +"\"stolen\", the value of *\\*bytes* will be set to ``NULL``, and the " +"appropriate exception will be set." msgstr "" -msgid "If *newpart* implements the buffer protocol, then the buffer must not be mutated while the new bytes object is being created." +#: ../../c-api/bytes.rst:190 ../../c-api/bytes.rst:200 +msgid "" +"If *newpart* implements the buffer protocol, then the buffer must not be " +"mutated while the new bytes object is being created." msgstr "" -msgid "Create a new bytes object in *\\*bytes* containing the contents of *newpart* appended to *bytes*. This version releases the :term:`strong reference` to *newpart* (i.e. decrements its reference count)." +#: ../../c-api/bytes.rst:195 +msgid "" +"Create a new bytes object in *\\*bytes* containing the contents of *newpart* " +"appended to *bytes*. This version releases the :term:`strong reference` to " +"*newpart* (i.e. decrements its reference count)." msgstr "" +#: ../../c-api/bytes.rst:206 msgid "Similar to ``sep.join(iterable)`` in Python." msgstr "" -msgid "*sep* must be Python :class:`bytes` object. (Note that :c:func:`PyUnicode_Join` accepts ``NULL`` separator and treats it as a space, whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)" +#: ../../c-api/bytes.rst:208 +msgid "" +"*sep* must be Python :class:`bytes` object. (Note " +"that :c:func:`PyUnicode_Join` accepts ``NULL`` separator and treats it as a " +"space, whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)" msgstr "" -msgid "*iterable* must be an iterable object yielding objects that implement the :ref:`buffer protocol `." +#: ../../c-api/bytes.rst:213 +msgid "" +"*iterable* must be an iterable object yielding objects that implement " +"the :ref:`buffer protocol `." msgstr "" -msgid "On success, return a new :class:`bytes` object. On error, set an exception and return ``NULL``." +#: ../../c-api/bytes.rst:216 +msgid "" +"On success, return a new :class:`bytes` object. On error, set an exception " +"and return ``NULL``." msgstr "" -msgid "If *iterable* objects implement the buffer protocol, then the buffers must not be mutated while the new bytes object is being created." +#: ../../c-api/bytes.rst:222 +msgid "" +"If *iterable* objects implement the buffer protocol, then the buffers must " +"not be mutated while the new bytes object is being created." msgstr "" -msgid "Resize a bytes object. *newsize* will be the new length of the bytes object. You can think of it as creating a new bytes object and destroying the old one, only more efficiently. Pass the address of an existing bytes object as an lvalue (it may be written into), and the new size desired. On success, *\\*bytes* holds the resized bytes object and ``0`` is returned; the address in *\\*bytes* may differ from its input value. If the reallocation fails, the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned." +#: ../../c-api/bytes.rst:227 +msgid "" +"Resize a bytes object. *newsize* will be the new length of the bytes object. " +"You can think of it as creating a new bytes object and destroying the old " +"one, only more efficiently. Pass the address of an existing bytes object as " +"an lvalue (it may be written into), and the new size desired. On success, " +"*\\*bytes* holds the resized bytes object and ``0`` is returned; the address " +"in *\\*bytes* may differ from its input value. If the reallocation fails, " +"the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to " +"``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned." msgstr "" -msgid "Get the string representation of *bytes*. This function is currently used to implement :meth:`!bytes.__repr__` in Python." +#: ../../c-api/bytes.rst:241 +msgid "" +"Get the string representation of *bytes*. This function is currently used to " +"implement :meth:`!bytes.__repr__` in Python." msgstr "" -msgid "This function does not do type checking; it is undefined behavior to pass *bytes* as a non-bytes object or ``NULL``." +#: ../../c-api/bytes.rst:244 +msgid "" +"This function does not do type checking; it is undefined behavior to pass " +"*bytes* as a non-bytes object or ``NULL``." msgstr "" -msgid "If *smartquotes* is true, the representation will use a double-quoted string instead of single-quoted string when single-quotes are present in *bytes*. For example, the byte string ``'Python'`` would be represented as ``b\"'Python'\"`` when *smartquotes* is true, or ``b'\\'Python\\''`` when it is false." +#: ../../c-api/bytes.rst:247 +msgid "" +"If *smartquotes* is true, the representation will use a double-quoted string " +"instead of single-quoted string when single-quotes are present in *bytes*. " +"For example, the byte string ``'Python'`` would be represented as " +"``b\"'Python'\"`` when *smartquotes* is true, or ``b'\\'Python\\''`` when it " +"is false." msgstr "" -msgid "On success, this function returns a :term:`strong reference` to a :class:`str` object containing the representation. On failure, this returns ``NULL`` with an exception set." +#: ../../c-api/bytes.rst:253 +msgid "" +"On success, this function returns a :term:`strong reference` to " +"a :class:`str` object containing the representation. On failure, this " +"returns ``NULL`` with an exception set." msgstr "" -msgid "Unescape a backslash-escaped string *s*. *s* must not be ``NULL``. *len* must be the size of *s*." +#: ../../c-api/bytes.rst:260 +msgid "" +"Unescape a backslash-escaped string *s*. *s* must not be ``NULL``. *len* " +"must be the size of *s*." msgstr "" -msgid "*errors* must be one of ``\"strict\"``, ``\"replace\"``, or ``\"ignore\"``. If *errors* is ``NULL``, then ``\"strict\"`` is used by default." +#: ../../c-api/bytes.rst:263 +msgid "" +"*errors* must be one of ``\"strict\"``, ``\"replace\"``, or ``\"ignore\"``. " +"If *errors* is ``NULL``, then ``\"strict\"`` is used by default." msgstr "" -msgid "On success, this function returns a :term:`strong reference` to a Python :class:`bytes` object containing the unescaped string. On failure, this function returns ``NULL`` with an exception set." +#: ../../c-api/bytes.rst:266 +msgid "" +"On success, this function returns a :term:`strong reference` to a " +"Python :class:`bytes` object containing the unescaped string. On failure, " +"this function returns ``NULL`` with an exception set." msgstr "" +#: ../../c-api/bytes.rst:270 msgid "*unicode* and *recode_encoding* are now unused." msgstr "" +#: ../../c-api/bytes.rst:11 msgid "object" msgstr "" +#: ../../c-api/bytes.rst:11 msgid "bytes" msgstr "" diff --git a/c-api/call.po b/c-api/call.po index 9747bb6df..65cc4c0ea 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,299 +24,560 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/call.rst:6 msgid "Call Protocol" msgstr "" -msgid "CPython supports two different calling protocols: *tp_call* and vectorcall." +#: ../../c-api/call.rst:8 +msgid "" +"CPython supports two different calling protocols: *tp_call* and vectorcall." msgstr "" +#: ../../c-api/call.rst:12 msgid "The *tp_call* Protocol" msgstr "" -msgid "Instances of classes that set :c:member:`~PyTypeObject.tp_call` are callable. The signature of the slot is::" +#: ../../c-api/call.rst:14 +msgid "" +"Instances of classes that set :c:member:`~PyTypeObject.tp_call` are " +"callable. The signature of the slot is::" msgstr "" -msgid "PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);" +#: ../../c-api/call.rst:17 +msgid "" +"PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);" msgstr "" -msgid "A call is made using a tuple for the positional arguments and a dict for the keyword arguments, similarly to ``callable(*args, **kwargs)`` in Python code. *args* must be non-NULL (use an empty tuple if there are no arguments) but *kwargs* may be *NULL* if there are no keyword arguments." +#: ../../c-api/call.rst:19 +msgid "" +"A call is made using a tuple for the positional arguments and a dict for the " +"keyword arguments, similarly to ``callable(*args, **kwargs)`` in Python " +"code. *args* must be non-NULL (use an empty tuple if there are no arguments) " +"but *kwargs* may be *NULL* if there are no keyword arguments." msgstr "" -msgid "This convention is not only used by *tp_call*: :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_init` also pass arguments this way." +#: ../../c-api/call.rst:25 +msgid "" +"This convention is not only used by " +"*tp_call*: :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_init` also pass arguments this way." msgstr "" -msgid "To call an object, use :c:func:`PyObject_Call` or another :ref:`call API `." +#: ../../c-api/call.rst:29 +msgid "" +"To call an object, use :c:func:`PyObject_Call` or another :ref:`call API " +"`." msgstr "" +#: ../../c-api/call.rst:36 msgid "The Vectorcall Protocol" msgstr "" -msgid "The vectorcall protocol was introduced in :pep:`590` as an additional protocol for making calls more efficient." -msgstr "" - -msgid "As rule of thumb, CPython will prefer the vectorcall for internal calls if the callable supports it. However, this is not a hard rule. Additionally, some third-party extensions use *tp_call* directly (rather than using :c:func:`PyObject_Call`). Therefore, a class supporting vectorcall must also implement :c:member:`~PyTypeObject.tp_call`. Moreover, the callable must behave the same regardless of which protocol is used. The recommended way to achieve this is by setting :c:member:`~PyTypeObject.tp_call` to :c:func:`PyVectorcall_Call`. This bears repeating:" +#: ../../c-api/call.rst:40 +msgid "" +"The vectorcall protocol was introduced in :pep:`590` as an additional " +"protocol for making calls more efficient." msgstr "" -msgid "A class supporting vectorcall **must** also implement :c:member:`~PyTypeObject.tp_call` with the same semantics." +#: ../../c-api/call.rst:43 +msgid "" +"As rule of thumb, CPython will prefer the vectorcall for internal calls if " +"the callable supports it. However, this is not a hard rule. Additionally, " +"some third-party extensions use *tp_call* directly (rather than " +"using :c:func:`PyObject_Call`). Therefore, a class supporting vectorcall " +"must also implement :c:member:`~PyTypeObject.tp_call`. Moreover, the " +"callable must behave the same regardless of which protocol is used. The " +"recommended way to achieve this is by " +"setting :c:member:`~PyTypeObject.tp_call` to :c:func:`PyVectorcall_Call`. " +"This bears repeating:" +msgstr "" + +#: ../../c-api/call.rst:57 +msgid "" +"A class supporting vectorcall **must** also " +"implement :c:member:`~PyTypeObject.tp_call` with the same semantics." msgstr "" -msgid "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class when the class's :py:meth:`~object.__call__` method is reassigned. (This internally sets :c:member:`~PyTypeObject.tp_call` only, and thus may make it behave differently than the vectorcall function.) In earlier Python versions, vectorcall should only be used with :c:macro:`immutable ` or static types." +#: ../../c-api/call.rst:62 +msgid "" +"The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " +"when the class's :py:meth:`~object.__call__` method is reassigned. (This " +"internally sets :c:member:`~PyTypeObject.tp_call` only, and thus may make it " +"behave differently than the vectorcall function.) In earlier Python " +"versions, vectorcall should only be used with :c:macro:`immutable " +"` or static types." msgstr "" -msgid "A class should not implement vectorcall if that would be slower than *tp_call*. For example, if the callee needs to convert the arguments to an args tuple and kwargs dict anyway, then there is no point in implementing vectorcall." +#: ../../c-api/call.rst:69 +msgid "" +"A class should not implement vectorcall if that would be slower than " +"*tp_call*. For example, if the callee needs to convert the arguments to an " +"args tuple and kwargs dict anyway, then there is no point in implementing " +"vectorcall." msgstr "" -msgid "Classes can implement the vectorcall protocol by enabling the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag and setting :c:member:`~PyTypeObject.tp_vectorcall_offset` to the offset inside the object structure where a *vectorcallfunc* appears. This is a pointer to a function with the following signature:" +#: ../../c-api/call.rst:74 +msgid "" +"Classes can implement the vectorcall protocol by enabling " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag and " +"setting :c:member:`~PyTypeObject.tp_vectorcall_offset` to the offset inside " +"the object structure where a *vectorcallfunc* appears. This is a pointer to " +"a function with the following signature:" msgstr "" +#: ../../c-api/call.rst:82 msgid "*callable* is the object being called." msgstr "" -msgid "*args* is a C array consisting of the positional arguments followed by the" +#: ../../c-api/call.rst:83 +msgid "" +"*args* is a C array consisting of the positional arguments followed by the" msgstr "" -msgid "values of the keyword arguments. This can be *NULL* if there are no arguments." +#: ../../c-api/call.rst:84 +msgid "" +"values of the keyword arguments. This can be *NULL* if there are no " +"arguments." msgstr "" +#: ../../c-api/call.rst:86 msgid "*nargsf* is the number of positional arguments plus possibly the" msgstr "" -msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag. To get the actual number of positional arguments from *nargsf*, use :c:func:`PyVectorcall_NARGS`." +#: ../../c-api/call.rst:87 +msgid "" +":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` flag. To get the actual number of " +"positional arguments from *nargsf*, use :c:func:`PyVectorcall_NARGS`." msgstr "" +#: ../../c-api/call.rst:90 msgid "*kwnames* is a tuple containing the names of the keyword arguments;" msgstr "" -msgid "in other words, the keys of the kwargs dict. These names must be strings (instances of ``str`` or a subclass) and they must be unique. If there are no keyword arguments, then *kwnames* can instead be *NULL*." +#: ../../c-api/call.rst:91 +msgid "" +"in other words, the keys of the kwargs dict. These names must be strings " +"(instances of ``str`` or a subclass) and they must be unique. If there are " +"no keyword arguments, then *kwnames* can instead be *NULL*." msgstr "" -msgid "If this flag is set in a vectorcall *nargsf* argument, the callee is allowed to temporarily change ``args[-1]``. In other words, *args* points to argument 1 (not 0) in the allocated vector. The callee must restore the value of ``args[-1]`` before returning." +#: ../../c-api/call.rst:98 +msgid "" +"If this flag is set in a vectorcall *nargsf* argument, the callee is allowed " +"to temporarily change ``args[-1]``. In other words, *args* points to " +"argument 1 (not 0) in the allocated vector. The callee must restore the " +"value of ``args[-1]`` before returning." msgstr "" -msgid "For :c:func:`PyObject_VectorcallMethod`, this flag means instead that ``args[0]`` may be changed." +#: ../../c-api/call.rst:103 +msgid "" +"For :c:func:`PyObject_VectorcallMethod`, this flag means instead that " +"``args[0]`` may be changed." msgstr "" -msgid "Whenever they can do so cheaply (without additional allocation), callers are encouraged to use :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`. Doing so will allow callables such as bound methods to make their onward calls (which include a prepended *self* argument) very efficiently." +#: ../../c-api/call.rst:106 +msgid "" +"Whenever they can do so cheaply (without additional allocation), callers are " +"encouraged to use :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`. Doing so will " +"allow callables such as bound methods to make their onward calls (which " +"include a prepended *self* argument) very efficiently." msgstr "" -msgid "To call an object that implements vectorcall, use a :ref:`call API ` function as with any other callable. :c:func:`PyObject_Vectorcall` will usually be most efficient." +#: ../../c-api/call.rst:113 +msgid "" +"To call an object that implements vectorcall, use a :ref:`call API ` function as with any other callable. :c:func:`PyObject_Vectorcall` " +"will usually be most efficient." msgstr "" +#: ../../c-api/call.rst:119 msgid "Recursion Control" msgstr "" -msgid "When using *tp_call*, callees do not need to worry about :ref:`recursion `: CPython uses :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` for calls made using *tp_call*." +#: ../../c-api/call.rst:121 +msgid "" +"When using *tp_call*, callees do not need to worry about :ref:`recursion " +"`: CPython uses :c:func:`Py_EnterRecursiveCall` " +"and :c:func:`Py_LeaveRecursiveCall` for calls made using *tp_call*." msgstr "" -msgid "For efficiency, this is not the case for calls done using vectorcall: the callee should use *Py_EnterRecursiveCall* and *Py_LeaveRecursiveCall* if needed." +#: ../../c-api/call.rst:126 +msgid "" +"For efficiency, this is not the case for calls done using vectorcall: the " +"callee should use *Py_EnterRecursiveCall* and *Py_LeaveRecursiveCall* if " +"needed." msgstr "" +#: ../../c-api/call.rst:132 msgid "Vectorcall Support API" msgstr "" -msgid "Given a vectorcall *nargsf* argument, return the actual number of arguments. Currently equivalent to::" +#: ../../c-api/call.rst:136 +msgid "" +"Given a vectorcall *nargsf* argument, return the actual number of arguments. " +"Currently equivalent to::" msgstr "" +#: ../../c-api/call.rst:140 msgid "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" msgstr "" -msgid "However, the function ``PyVectorcall_NARGS`` should be used to allow for future extensions." +#: ../../c-api/call.rst:142 +msgid "" +"However, the function ``PyVectorcall_NARGS`` should be used to allow for " +"future extensions." msgstr "" -msgid "If *op* does not support the vectorcall protocol (either because the type does not or because the specific instance does not), return *NULL*. Otherwise, return the vectorcall function pointer stored in *op*. This function never raises an exception." +#: ../../c-api/call.rst:149 +msgid "" +"If *op* does not support the vectorcall protocol (either because the type " +"does not or because the specific instance does not), return *NULL*. " +"Otherwise, return the vectorcall function pointer stored in *op*. This " +"function never raises an exception." msgstr "" -msgid "This is mostly useful to check whether or not *op* supports vectorcall, which can be done by checking ``PyVectorcall_Function(op) != NULL``." +#: ../../c-api/call.rst:154 +msgid "" +"This is mostly useful to check whether or not *op* supports vectorcall, " +"which can be done by checking ``PyVectorcall_Function(op) != NULL``." msgstr "" -msgid "Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword arguments given in a tuple and dict, respectively." +#: ../../c-api/call.rst:161 +msgid "" +"Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword " +"arguments given in a tuple and dict, respectively." msgstr "" -msgid "This is a specialized function, intended to be put in the :c:member:`~PyTypeObject.tp_call` slot or be used in an implementation of ``tp_call``. It does not check the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag and it does not fall back to ``tp_call``." +#: ../../c-api/call.rst:164 +msgid "" +"This is a specialized function, intended to be put in " +"the :c:member:`~PyTypeObject.tp_call` slot or be used in an implementation " +"of ``tp_call``. It does not check the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` " +"flag and it does not fall back to ``tp_call``." msgstr "" +#: ../../c-api/call.rst:175 msgid "Object Calling API" msgstr "" -msgid "Various functions are available for calling a Python object. Each converts its arguments to a convention supported by the called object – either *tp_call* or vectorcall. In order to do as little conversion as possible, pick one that best fits the format of data you have available." +#: ../../c-api/call.rst:177 +msgid "" +"Various functions are available for calling a Python object. Each converts " +"its arguments to a convention supported by the called object – either " +"*tp_call* or vectorcall. In order to do as little conversion as possible, " +"pick one that best fits the format of data you have available." msgstr "" -msgid "The following table summarizes the available functions; please see individual documentation for details." +#: ../../c-api/call.rst:183 +msgid "" +"The following table summarizes the available functions; please see " +"individual documentation for details." msgstr "" +#: ../../c-api/call.rst:187 msgid "Function" msgstr "" +#: ../../c-api/call.rst:187 msgid "callable" msgstr "" +#: ../../c-api/call.rst:187 msgid "args" msgstr "" +#: ../../c-api/call.rst:187 msgid "kwargs" msgstr "" +#: ../../c-api/call.rst:189 msgid ":c:func:`PyObject_Call`" msgstr "" +#: ../../c-api/call.rst:189 ../../c-api/call.rst:191 ../../c-api/call.rst:193 +#: ../../c-api/call.rst:195 ../../c-api/call.rst:197 ../../c-api/call.rst:201 +#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 msgid "``PyObject *``" msgstr "" +#: ../../c-api/call.rst:189 msgid "tuple" msgstr "" +#: ../../c-api/call.rst:189 ../../c-api/call.rst:211 msgid "dict/``NULL``" msgstr "" +#: ../../c-api/call.rst:191 msgid ":c:func:`PyObject_CallNoArgs`" msgstr "" +#: ../../c-api/call.rst:191 ../../c-api/call.rst:193 ../../c-api/call.rst:195 +#: ../../c-api/call.rst:197 ../../c-api/call.rst:199 ../../c-api/call.rst:201 +#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "---" msgstr "" +#: ../../c-api/call.rst:193 msgid ":c:func:`PyObject_CallOneArg`" msgstr "" +#: ../../c-api/call.rst:193 ../../c-api/call.rst:207 msgid "1 object" msgstr "" +#: ../../c-api/call.rst:195 msgid ":c:func:`PyObject_CallObject`" msgstr "" +#: ../../c-api/call.rst:195 msgid "tuple/``NULL``" msgstr "" +#: ../../c-api/call.rst:197 msgid ":c:func:`PyObject_CallFunction`" msgstr "" +#: ../../c-api/call.rst:197 ../../c-api/call.rst:199 msgid "format" msgstr "" +#: ../../c-api/call.rst:199 msgid ":c:func:`PyObject_CallMethod`" msgstr "" +#: ../../c-api/call.rst:199 msgid "obj + ``char*``" msgstr "" +#: ../../c-api/call.rst:201 msgid ":c:func:`PyObject_CallFunctionObjArgs`" msgstr "" +#: ../../c-api/call.rst:201 ../../c-api/call.rst:203 msgid "variadic" msgstr "" +#: ../../c-api/call.rst:203 msgid ":c:func:`PyObject_CallMethodObjArgs`" msgstr "" +#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "obj + name" msgstr "" +#: ../../c-api/call.rst:205 msgid ":c:func:`PyObject_CallMethodNoArgs`" msgstr "" +#: ../../c-api/call.rst:207 msgid ":c:func:`PyObject_CallMethodOneArg`" msgstr "" +#: ../../c-api/call.rst:209 msgid ":c:func:`PyObject_Vectorcall`" msgstr "" +#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 ../../c-api/call.rst:213 msgid "vectorcall" msgstr "" +#: ../../c-api/call.rst:211 msgid ":c:func:`PyObject_VectorcallDict`" msgstr "" +#: ../../c-api/call.rst:213 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr "" +#: ../../c-api/call.rst:213 msgid "arg + name" msgstr "" -msgid "Call a callable Python object *callable*, with arguments given by the tuple *args*, and named arguments given by the dictionary *kwargs*." +#: ../../c-api/call.rst:219 +msgid "" +"Call a callable Python object *callable*, with arguments given by the tuple " +"*args*, and named arguments given by the dictionary *kwargs*." msgstr "" -msgid "*args* must not be *NULL*; use an empty tuple if no arguments are needed. If no named arguments are needed, *kwargs* can be *NULL*." +#: ../../c-api/call.rst:222 +msgid "" +"*args* must not be *NULL*; use an empty tuple if no arguments are needed. If " +"no named arguments are needed, *kwargs* can be *NULL*." msgstr "" -msgid "Return the result of the call on success, or raise an exception and return *NULL* on failure." +#: ../../c-api/call.rst:225 ../../c-api/call.rst:237 ../../c-api/call.rst:248 +#: ../../c-api/call.rst:259 ../../c-api/call.rst:271 ../../c-api/call.rst:291 +#: ../../c-api/call.rst:310 ../../c-api/call.rst:324 ../../c-api/call.rst:333 +#: ../../c-api/call.rst:345 ../../c-api/call.rst:360 ../../c-api/call.rst:399 +msgid "" +"Return the result of the call on success, or raise an exception and return " +"*NULL* on failure." msgstr "" -msgid "This is the equivalent of the Python expression: ``callable(*args, **kwargs)``." +#: ../../c-api/call.rst:228 +msgid "" +"This is the equivalent of the Python expression: ``callable(*args, " +"**kwargs)``." msgstr "" -msgid "Call a callable Python object *callable* without any arguments. It is the most efficient way to call a callable Python object without any argument." +#: ../../c-api/call.rst:234 +msgid "" +"Call a callable Python object *callable* without any arguments. It is the " +"most efficient way to call a callable Python object without any argument." msgstr "" -msgid "Call a callable Python object *callable* with exactly 1 positional argument *arg* and no keyword arguments." +#: ../../c-api/call.rst:245 +msgid "" +"Call a callable Python object *callable* with exactly 1 positional argument " +"*arg* and no keyword arguments." msgstr "" -msgid "Call a callable Python object *callable*, with arguments given by the tuple *args*. If no arguments are needed, then *args* can be *NULL*." +#: ../../c-api/call.rst:256 +msgid "" +"Call a callable Python object *callable*, with arguments given by the tuple " +"*args*. If no arguments are needed, then *args* can be *NULL*." msgstr "" +#: ../../c-api/call.rst:262 ../../c-api/call.rst:274 msgid "This is the equivalent of the Python expression: ``callable(*args)``." msgstr "" -msgid "Call a callable Python object *callable*, with a variable number of C arguments. The C arguments are described using a :c:func:`Py_BuildValue` style format string. The format can be *NULL*, indicating that no arguments are provided." +#: ../../c-api/call.rst:267 +msgid "" +"Call a callable Python object *callable*, with a variable number of C " +"arguments. The C arguments are described using a :c:func:`Py_BuildValue` " +"style format string. The format can be *NULL*, indicating that no arguments " +"are provided." msgstr "" -msgid "Note that if you only pass :c:expr:`PyObject *` args, :c:func:`PyObject_CallFunctionObjArgs` is a faster alternative." +#: ../../c-api/call.rst:276 +msgid "" +"Note that if you only pass :c:expr:`PyObject *` " +"args, :c:func:`PyObject_CallFunctionObjArgs` is a faster alternative." msgstr "" +#: ../../c-api/call.rst:279 msgid "The type of *format* was changed from ``char *``." msgstr "" -msgid "Call the method named *name* of object *obj* with a variable number of C arguments. The C arguments are described by a :c:func:`Py_BuildValue` format string that should produce a tuple." +#: ../../c-api/call.rst:285 +msgid "" +"Call the method named *name* of object *obj* with a variable number of C " +"arguments. The C arguments are described by a :c:func:`Py_BuildValue` " +"format string that should produce a tuple." msgstr "" +#: ../../c-api/call.rst:289 msgid "The format can be *NULL*, indicating that no arguments are provided." msgstr "" -msgid "This is the equivalent of the Python expression: ``obj.name(arg1, arg2, ...)``." +#: ../../c-api/call.rst:294 +msgid "" +"This is the equivalent of the Python expression: ``obj.name(arg1, " +"arg2, ...)``." msgstr "" -msgid "Note that if you only pass :c:expr:`PyObject *` args, :c:func:`PyObject_CallMethodObjArgs` is a faster alternative." +#: ../../c-api/call.rst:297 +msgid "" +"Note that if you only pass :c:expr:`PyObject *` " +"args, :c:func:`PyObject_CallMethodObjArgs` is a faster alternative." msgstr "" +#: ../../c-api/call.rst:300 msgid "The types of *name* and *format* were changed from ``char *``." msgstr "" -msgid "Call a callable Python object *callable*, with a variable number of :c:expr:`PyObject *` arguments. The arguments are provided as a variable number of parameters followed by *NULL*." +#: ../../c-api/call.rst:306 +msgid "" +"Call a callable Python object *callable*, with a variable number " +"of :c:expr:`PyObject *` arguments. The arguments are provided as a variable " +"number of parameters followed by *NULL*." msgstr "" -msgid "This is the equivalent of the Python expression: ``callable(arg1, arg2, ...)``." +#: ../../c-api/call.rst:313 +msgid "" +"This is the equivalent of the Python expression: ``callable(arg1, " +"arg2, ...)``." msgstr "" -msgid "Call a method of the Python object *obj*, where the name of the method is given as a Python string object in *name*. It is called with a variable number of :c:expr:`PyObject *` arguments. The arguments are provided as a variable number of parameters followed by *NULL*." +#: ../../c-api/call.rst:319 +msgid "" +"Call a method of the Python object *obj*, where the name of the method is " +"given as a Python string object in *name*. It is called with a variable " +"number of :c:expr:`PyObject *` arguments. The arguments are provided as a " +"variable number of parameters followed by *NULL*." msgstr "" -msgid "Call a method of the Python object *obj* without arguments, where the name of the method is given as a Python string object in *name*." +#: ../../c-api/call.rst:330 +msgid "" +"Call a method of the Python object *obj* without arguments, where the name " +"of the method is given as a Python string object in *name*." msgstr "" -msgid "Call a method of the Python object *obj* with a single positional argument *arg*, where the name of the method is given as a Python string object in *name*." +#: ../../c-api/call.rst:341 +msgid "" +"Call a method of the Python object *obj* with a single positional argument " +"*arg*, where the name of the method is given as a Python string object in " +"*name*." msgstr "" -msgid "Call a callable Python object *callable*. The arguments are the same as for :c:type:`vectorcallfunc`. If *callable* supports vectorcall_, this directly calls the vectorcall function stored in *callable*." +#: ../../c-api/call.rst:355 +msgid "" +"Call a callable Python object *callable*. The arguments are the same as " +"for :c:type:`vectorcallfunc`. If *callable* supports vectorcall_, this " +"directly calls the vectorcall function stored in *callable*." msgstr "" +#: ../../c-api/call.rst:363 msgid "as ``_PyObject_Vectorcall``" msgstr "" -msgid "Renamed to the current name, without the leading underscore. The old provisional name is :term:`soft deprecated`." +#: ../../c-api/call.rst:367 +msgid "" +"Renamed to the current name, without the leading underscore. The old " +"provisional name is :term:`soft deprecated`." msgstr "" -msgid "Call *callable* with positional arguments passed exactly as in the vectorcall_ protocol, but with keyword arguments passed as a dictionary *kwdict*. The *args* array contains only the positional arguments." +#: ../../c-api/call.rst:372 +msgid "" +"Call *callable* with positional arguments passed exactly as in the " +"vectorcall_ protocol, but with keyword arguments passed as a dictionary " +"*kwdict*. The *args* array contains only the positional arguments." msgstr "" -msgid "Regardless of which protocol is used internally, a conversion of arguments needs to be done. Therefore, this function should only be used if the caller already has a dictionary ready to use for the keyword arguments, but not a tuple for the positional arguments." +#: ../../c-api/call.rst:376 +msgid "" +"Regardless of which protocol is used internally, a conversion of arguments " +"needs to be done. Therefore, this function should only be used if the caller " +"already has a dictionary ready to use for the keyword arguments, but not a " +"tuple for the positional arguments." msgstr "" -msgid "Call a method using the vectorcall calling convention. The name of the method is given as a Python string *name*. The object whose method is called is *args[0]*, and the *args* array starting at *args[1]* represents the arguments of the call. There must be at least one positional argument. *nargsf* is the number of positional arguments including *args[0]*, plus :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` if the value of ``args[0]`` may temporarily be changed. Keyword arguments can be passed just like in :c:func:`PyObject_Vectorcall`." +#: ../../c-api/call.rst:386 +msgid "" +"Call a method using the vectorcall calling convention. The name of the " +"method is given as a Python string *name*. The object whose method is called " +"is *args[0]*, and the *args* array starting at *args[1]* represents the " +"arguments of the call. There must be at least one positional argument. " +"*nargsf* is the number of positional arguments including *args[0]*, " +"plus :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` if the value of ``args[0]`` " +"may temporarily be changed. Keyword arguments can be passed just like " +"in :c:func:`PyObject_Vectorcall`." msgstr "" -msgid "If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature, this will call the unbound method object with the full *args* vector as arguments." +#: ../../c-api/call.rst:395 +msgid "" +"If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature, this " +"will call the unbound method object with the full *args* vector as arguments." msgstr "" +#: ../../c-api/call.rst:406 msgid "Call Support API" msgstr "" -msgid "Determine if the object *o* is callable. Return ``1`` if the object is callable and ``0`` otherwise. This function always succeeds." +#: ../../c-api/call.rst:410 +msgid "" +"Determine if the object *o* is callable. Return ``1`` if the object is " +"callable and ``0`` otherwise. This function always succeeds." msgstr "" diff --git a/c-api/capsule.po b/c-api/capsule.po index d69bdb21b..96e89c2bd 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,110 +22,219 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/capsule.rst:6 msgid "Capsules" msgstr "" -msgid "Refer to :ref:`using-capsules` for more information on using these objects." +#: ../../c-api/capsule.rst:10 +msgid "" +"Refer to :ref:`using-capsules` for more information on using these objects." msgstr "" -msgid "This subtype of :c:type:`PyObject` represents an opaque value, useful for C extension modules which need to pass an opaque value (as a :c:expr:`void*` pointer) through Python code to other C code. It is often used to make a C function pointer defined in one module available to other modules, so the regular import mechanism can be used to access C APIs defined in dynamically loaded modules." +#: ../../c-api/capsule.rst:17 +msgid "" +"This subtype of :c:type:`PyObject` represents an opaque value, useful for C " +"extension modules which need to pass an opaque value (as a :c:expr:`void*` " +"pointer) through Python code to other C code. It is often used to make a C " +"function pointer defined in one module available to other modules, so the " +"regular import mechanism can be used to access C APIs defined in dynamically " +"loaded modules." msgstr "" -msgid "The type object corresponding to capsule objects. This is the same object as :class:`types.CapsuleType` in the Python layer." +#: ../../c-api/capsule.rst:27 +msgid "" +"The type object corresponding to capsule objects. This is the same object " +"as :class:`types.CapsuleType` in the Python layer." msgstr "" +#: ../../c-api/capsule.rst:33 msgid "The type of a destructor callback for a capsule. Defined as::" msgstr "" +#: ../../c-api/capsule.rst:35 msgid "typedef void (*PyCapsule_Destructor)(PyObject *);" msgstr "" -msgid "See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor callbacks." +#: ../../c-api/capsule.rst:37 +msgid "" +"See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor " +"callbacks." msgstr "" -msgid "Return true if its argument is a :c:type:`PyCapsule`. This function always succeeds." +#: ../../c-api/capsule.rst:43 +msgid "" +"Return true if its argument is a :c:type:`PyCapsule`. This function always " +"succeeds." msgstr "" -msgid "Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer* argument may not be ``NULL``." +#: ../../c-api/capsule.rst:49 +msgid "" +"Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer* " +"argument may not be ``NULL``." msgstr "" +#: ../../c-api/capsule.rst:52 msgid "On failure, set an exception and return ``NULL``." msgstr "" -msgid "The *name* string may either be ``NULL`` or a pointer to a valid C string. If non-``NULL``, this string must outlive the capsule. (Though it is permitted to free it inside the *destructor*.)" +#: ../../c-api/capsule.rst:54 +msgid "" +"The *name* string may either be ``NULL`` or a pointer to a valid C string. " +"If non-``NULL``, this string must outlive the capsule. (Though it is " +"permitted to free it inside the *destructor*.)" msgstr "" -msgid "If the *destructor* argument is not ``NULL``, it will be called with the capsule as its argument when it is destroyed." +#: ../../c-api/capsule.rst:58 +msgid "" +"If the *destructor* argument is not ``NULL``, it will be called with the " +"capsule as its argument when it is destroyed." msgstr "" -msgid "If this capsule will be stored as an attribute of a module, the *name* should be specified as ``modulename.attributename``. This will enable other modules to import the capsule using :c:func:`PyCapsule_Import`." +#: ../../c-api/capsule.rst:61 +msgid "" +"If this capsule will be stored as an attribute of a module, the *name* " +"should be specified as ``modulename.attributename``. This will enable other " +"modules to import the capsule using :c:func:`PyCapsule_Import`." msgstr "" -msgid "Retrieve the *pointer* stored in the capsule. On failure, set an exception and return ``NULL``." +#: ../../c-api/capsule.rst:68 +msgid "" +"Retrieve the *pointer* stored in the capsule. On failure, set an exception " +"and return ``NULL``." msgstr "" -msgid "The *name* parameter must compare exactly to the name stored in the capsule. If the name stored in the capsule is ``NULL``, the *name* passed in must also be ``NULL``. Python uses the C function :c:func:`!strcmp` to compare capsule names." +#: ../../c-api/capsule.rst:71 +msgid "" +"The *name* parameter must compare exactly to the name stored in the capsule. " +"If the name stored in the capsule is ``NULL``, the *name* passed in must " +"also be ``NULL``. Python uses the C function :c:func:`!strcmp` to compare " +"capsule names." msgstr "" -msgid "Return the current destructor stored in the capsule. On failure, set an exception and return ``NULL``." +#: ../../c-api/capsule.rst:79 +msgid "" +"Return the current destructor stored in the capsule. On failure, set an " +"exception and return ``NULL``." msgstr "" -msgid "It is legal for a capsule to have a ``NULL`` destructor. This makes a ``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/capsule.rst:82 +msgid "" +"It is legal for a capsule to have a ``NULL`` destructor. This makes a " +"``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` " +"or :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -msgid "Return the current context stored in the capsule. On failure, set an exception and return ``NULL``." +#: ../../c-api/capsule.rst:89 +msgid "" +"Return the current context stored in the capsule. On failure, set an " +"exception and return ``NULL``." msgstr "" -msgid "It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/capsule.rst:92 +msgid "" +"It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL`` " +"return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` " +"or :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -msgid "Return the current name stored in the capsule. On failure, set an exception and return ``NULL``." +#: ../../c-api/capsule.rst:99 +msgid "" +"Return the current name stored in the capsule. On failure, set an exception " +"and return ``NULL``." msgstr "" -msgid "It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/capsule.rst:102 +msgid "" +"It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` " +"return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` " +"or :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -msgid "Import a pointer to a C object from a capsule attribute in a module. The *name* parameter should specify the full name to the attribute, as in ``module.attribute``. The *name* stored in the capsule must match this string exactly." +#: ../../c-api/capsule.rst:109 +msgid "" +"Import a pointer to a C object from a capsule attribute in a module. The " +"*name* parameter should specify the full name to the attribute, as in " +"``module.attribute``. The *name* stored in the capsule must match this " +"string exactly." msgstr "" -msgid "This function splits *name* on the ``.`` character, and imports the first element. It then processes further elements using attribute lookups." +#: ../../c-api/capsule.rst:114 +msgid "" +"This function splits *name* on the ``.`` character, and imports the first " +"element. It then processes further elements using attribute lookups." msgstr "" -msgid "Return the capsule's internal *pointer* on success. On failure, set an exception and return ``NULL``." +#: ../../c-api/capsule.rst:117 +msgid "" +"Return the capsule's internal *pointer* on success. On failure, set an " +"exception and return ``NULL``." msgstr "" -msgid "If *name* points to an attribute of some submodule or subpackage, this submodule or subpackage must be previously imported using other means (for example, by using :c:func:`PyImport_ImportModule`) for the attribute lookups to succeed." +#: ../../c-api/capsule.rst:122 +msgid "" +"If *name* points to an attribute of some submodule or subpackage, this " +"submodule or subpackage must be previously imported using other means (for " +"example, by using :c:func:`PyImport_ImportModule`) for the attribute lookups " +"to succeed." msgstr "" +#: ../../c-api/capsule.rst:127 msgid "*no_block* has no effect anymore." msgstr "" -msgid "Determines whether or not *capsule* is a valid capsule. A valid capsule is non-``NULL``, passes :c:func:`PyCapsule_CheckExact`, has a non-``NULL`` pointer stored in it, and its internal name matches the *name* parameter. (See :c:func:`PyCapsule_GetPointer` for information on how capsule names are compared.)" +#: ../../c-api/capsule.rst:133 +msgid "" +"Determines whether or not *capsule* is a valid capsule. A valid capsule is " +"non-``NULL``, passes :c:func:`PyCapsule_CheckExact`, has a non-``NULL`` " +"pointer stored in it, and its internal name matches the *name* parameter. " +"(See :c:func:`PyCapsule_GetPointer` for information on how capsule names are " +"compared.)" msgstr "" -msgid "In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls to any of the accessors (any function starting with ``PyCapsule_Get``) are guaranteed to succeed." +#: ../../c-api/capsule.rst:139 +msgid "" +"In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls " +"to any of the accessors (any function starting with ``PyCapsule_Get``) are " +"guaranteed to succeed." msgstr "" -msgid "Return a nonzero value if the object is valid and matches the name passed in. Return ``0`` otherwise. This function will not fail." +#: ../../c-api/capsule.rst:143 +msgid "" +"Return a nonzero value if the object is valid and matches the name passed " +"in. Return ``0`` otherwise. This function will not fail." msgstr "" +#: ../../c-api/capsule.rst:149 msgid "Set the context pointer inside *capsule* to *context*." msgstr "" -msgid "Return ``0`` on success. Return nonzero and set an exception on failure." +#: ../../c-api/capsule.rst:151 ../../c-api/capsule.rst:158 +#: ../../c-api/capsule.rst:167 ../../c-api/capsule.rst:175 +msgid "" +"Return ``0`` on success. Return nonzero and set an exception on failure." msgstr "" +#: ../../c-api/capsule.rst:156 msgid "Set the destructor inside *capsule* to *destructor*." msgstr "" -msgid "Set the name inside *capsule* to *name*. If non-``NULL``, the name must outlive the capsule. If the previous *name* stored in the capsule was not ``NULL``, no attempt is made to free it." +#: ../../c-api/capsule.rst:163 +msgid "" +"Set the name inside *capsule* to *name*. If non-``NULL``, the name must " +"outlive the capsule. If the previous *name* stored in the capsule was not " +"``NULL``, no attempt is made to free it." msgstr "" -msgid "Set the void pointer inside *capsule* to *pointer*. The pointer may not be ``NULL``." +#: ../../c-api/capsule.rst:172 +msgid "" +"Set the void pointer inside *capsule* to *pointer*. The pointer may not be " +"``NULL``." msgstr "" +#: ../../c-api/capsule.rst:8 msgid "object" msgstr "" +#: ../../c-api/capsule.rst:8 msgid "Capsule" msgstr "" diff --git a/c-api/cell.po b/c-api/cell.po index 1c9405925..9754ac94d 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,35 +21,70 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/cell.rst:6 msgid "Cell Objects" msgstr "" -msgid "\"Cell\" objects are used to implement variables referenced by multiple scopes. For each such variable, a cell object is created to store the value; the local variables of each stack frame that references the value contain a reference to the cells from outer scopes which also use that variable. When the value is accessed, the value contained in the cell is used instead of the cell object itself. This de-referencing of the cell object requires support from the generated byte-code; these are not automatically de-referenced when accessed. Cell objects are not likely to be useful elsewhere." +#: ../../c-api/cell.rst:8 +msgid "" +"\"Cell\" objects are used to implement variables referenced by multiple " +"scopes. For each such variable, a cell object is created to store the value; " +"the local variables of each stack frame that references the value contain a " +"reference to the cells from outer scopes which also use that variable. When " +"the value is accessed, the value contained in the cell is used instead of " +"the cell object itself. This de-referencing of the cell object requires " +"support from the generated byte-code; these are not automatically de-" +"referenced when accessed. Cell objects are not likely to be useful elsewhere." msgstr "" +#: ../../c-api/cell.rst:20 msgid "The C structure used for cell objects." msgstr "" +#: ../../c-api/cell.rst:25 msgid "The type object corresponding to cell objects." msgstr "" -msgid "Return true if *ob* is a cell object; *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/cell.rst:30 +msgid "" +"Return true if *ob* is a cell object; *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Create and return a new cell object containing the value *ob*. The parameter may be ``NULL``." +#: ../../c-api/cell.rst:36 +msgid "" +"Create and return a new cell object containing the value *ob*. The parameter " +"may be ``NULL``." msgstr "" -msgid "Return the contents of the cell *cell*, which can be ``NULL``. If *cell* is not a cell object, returns ``NULL`` with an exception set." +#: ../../c-api/cell.rst:42 +msgid "" +"Return the contents of the cell *cell*, which can be ``NULL``. If *cell* is " +"not a cell object, returns ``NULL`` with an exception set." msgstr "" -msgid "Return the contents of the cell *cell*, but without checking that *cell* is non-``NULL`` and a cell object." +#: ../../c-api/cell.rst:48 +msgid "" +"Return the contents of the cell *cell*, but without checking that *cell* is " +"non-``NULL`` and a cell object." msgstr "" -msgid "Set the contents of the cell object *cell* to *value*. This releases the reference to any current content of the cell. *value* may be ``NULL``. *cell* must be non-``NULL``." +#: ../../c-api/cell.rst:54 +msgid "" +"Set the contents of the cell object *cell* to *value*. This releases the " +"reference to any current content of the cell. *value* may be ``NULL``. " +"*cell* must be non-``NULL``." msgstr "" -msgid "On success, return ``0``. If *cell* is not a cell object, set an exception and return ``-1``." +#: ../../c-api/cell.rst:58 +msgid "" +"On success, return ``0``. If *cell* is not a cell object, set an exception " +"and return ``-1``." msgstr "" -msgid "Sets the value of the cell object *cell* to *value*. No reference counts are adjusted, and no checks are made for safety; *cell* must be non-``NULL`` and must be a cell object." +#: ../../c-api/cell.rst:64 +msgid "" +"Sets the value of the cell object *cell* to *value*. No reference counts " +"are adjusted, and no checks are made for safety; *cell* must be non-``NULL`` " +"and must be a cell object." msgstr "" diff --git a/c-api/code.po b/c-api/code.po index 18f4900d4..f74c72d40 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,248 +23,458 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/code.rst:8 msgid "Code Objects" msgstr "" -msgid "Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn't yet been bound into a function." +#: ../../c-api/code.rst:12 +msgid "" +"Code objects are a low-level detail of the CPython implementation. Each one " +"represents a chunk of executable code that hasn't yet been bound into a " +"function." msgstr "" -msgid "The C structure of the objects used to describe code objects. The fields of this type are subject to change at any time." +#: ../../c-api/code.rst:18 +msgid "" +"The C structure of the objects used to describe code objects. The fields of " +"this type are subject to change at any time." msgstr "" -msgid "This is an instance of :c:type:`PyTypeObject` representing the Python :ref:`code object `." +#: ../../c-api/code.rst:24 +msgid "" +"This is an instance of :c:type:`PyTypeObject` representing the " +"Python :ref:`code object `." msgstr "" -msgid "Return true if *co* is a :ref:`code object `. This function always succeeds." +#: ../../c-api/code.rst:30 +msgid "" +"Return true if *co* is a :ref:`code object `. This function " +"always succeeds." msgstr "" -msgid "Return the number of :term:`free (closure) variables ` in a code object." +#: ../../c-api/code.rst:35 +msgid "" +"Return the number of :term:`free (closure) variables ` in " +"a code object." msgstr "" -msgid "Return the position of the first :term:`free (closure) variable ` in a code object." +#: ../../c-api/code.rst:40 +msgid "" +"Return the position of the first :term:`free (closure) variable ` in a code object." msgstr "" -msgid "Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The old name is deprecated, but will remain available until the signature changes again." +#: ../../c-api/code.rst:45 +msgid "" +"Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The " +"old name is deprecated, but will remain available until the signature " +"changes again." msgstr "" -msgid "Return a new code object. If you need a dummy code object to create a frame, use :c:func:`PyCode_NewEmpty` instead." +#: ../../c-api/code.rst:51 +msgid "" +"Return a new code object. If you need a dummy code object to create a " +"frame, use :c:func:`PyCode_NewEmpty` instead." msgstr "" -msgid "Since the definition of the bytecode changes often, calling :c:func:`PyUnstable_Code_New` directly can bind you to a precise Python version." +#: ../../c-api/code.rst:54 +msgid "" +"Since the definition of the bytecode changes often, " +"calling :c:func:`PyUnstable_Code_New` directly can bind you to a precise " +"Python version." msgstr "" -msgid "The many arguments of this function are inter-dependent in complex ways, meaning that subtle changes to values are likely to result in incorrect execution or VM crashes. Use this function only with extreme care." +#: ../../c-api/code.rst:57 +msgid "" +"The many arguments of this function are inter-dependent in complex ways, " +"meaning that subtle changes to values are likely to result in incorrect " +"execution or VM crashes. Use this function only with extreme care." msgstr "" +#: ../../c-api/code.rst:61 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "" -msgid "Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name is deprecated, but will remain available until the signature changes again." +#: ../../c-api/code.rst:68 +msgid "" +"Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name " +"is deprecated, but will remain available until the signature changes again." msgstr "" -msgid "Similar to :c:func:`PyUnstable_Code_New`, but with an extra \"posonlyargcount\" for positional-only arguments. The same caveats that apply to ``PyUnstable_Code_New`` also apply to this function." +#: ../../c-api/code.rst:77 +msgid "" +"Similar to :c:func:`PyUnstable_Code_New`, but with an extra " +"\"posonlyargcount\" for positional-only arguments. The same caveats that " +"apply to ``PyUnstable_Code_New`` also apply to this function." msgstr "" +#: ../../c-api/code.rst:80 msgid "as ``PyCode_NewWithPosOnlyArgs``" msgstr "" +#: ../../c-api/code.rst:82 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "" -msgid "Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is deprecated, but will remain available until the signature changes again." +#: ../../c-api/code.rst:87 +msgid "" +"Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is " +"deprecated, but will remain available until the signature changes again." msgstr "" -msgid "Return a new empty code object with the specified filename, function name, and first line number. The resulting code object will raise an ``Exception`` if executed." +#: ../../c-api/code.rst:93 +msgid "" +"Return a new empty code object with the specified filename, function name, " +"and first line number. The resulting code object will raise an ``Exception`` " +"if executed." msgstr "" -msgid "Return the line number of the instruction that occurs on or before ``byte_offset`` and ends after it. If you just need the line number of a frame, use :c:func:`PyFrame_GetLineNumber` instead." +#: ../../c-api/code.rst:99 +msgid "" +"Return the line number of the instruction that occurs on or before " +"``byte_offset`` and ends after it. If you just need the line number of a " +"frame, use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -msgid "For efficiently iterating over the line numbers in a code object, use :pep:`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." +#: ../../c-api/code.rst:102 +msgid "" +"For efficiently iterating over the line numbers in a code object, " +"use :pep:`the API described in PEP 626 <0626#out-of-process-debuggers-and-" +"profilers>`." msgstr "" -msgid "Sets the passed ``int`` pointers to the source code line and column numbers for the instruction at ``byte_offset``. Sets the value to ``0`` when information is not available for any particular element." +#: ../../c-api/code.rst:107 +msgid "" +"Sets the passed ``int`` pointers to the source code line and column numbers " +"for the instruction at ``byte_offset``. Sets the value to ``0`` when " +"information is not available for any particular element." msgstr "" +#: ../../c-api/code.rst:111 msgid "Returns ``1`` if the function succeeds and 0 otherwise." msgstr "" -msgid "Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong reference to a :c:type:`PyBytesObject` representing the bytecode in a code object. On error, ``NULL`` is returned and an exception is raised." +#: ../../c-api/code.rst:117 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " +"reference to a :c:type:`PyBytesObject` representing the bytecode in a code " +"object. On error, ``NULL`` is returned and an exception is raised." msgstr "" -msgid "This ``PyBytesObject`` may be created on-demand by the interpreter and does not necessarily represent the bytecode actually executed by CPython. The primary use case for this function is debuggers and profilers." +#: ../../c-api/code.rst:122 +msgid "" +"This ``PyBytesObject`` may be created on-demand by the interpreter and does " +"not necessarily represent the bytecode actually executed by CPython. The " +"primary use case for this function is debuggers and profilers." msgstr "" -msgid "Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new reference to a :c:type:`PyTupleObject` containing the names of the local variables. On error, ``NULL`` is returned and an exception is raised." +#: ../../c-api/code.rst:130 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " +"reference to a :c:type:`PyTupleObject` containing the names of the local " +"variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -msgid "Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new reference to a :c:type:`PyTupleObject` containing the names of the local variables that are referenced by nested functions. On error, ``NULL`` is returned and an exception is raised." +#: ../../c-api/code.rst:139 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " +"reference to a :c:type:`PyTupleObject` containing the names of the local " +"variables that are referenced by nested functions. On error, ``NULL`` is " +"returned and an exception is raised." msgstr "" -msgid "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new reference to a :c:type:`PyTupleObject` containing the names of the :term:`free (closure) variables `. On error, ``NULL`` is returned and an exception is raised." +#: ../../c-api/code.rst:148 +msgid "" +"Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " +"reference to a :c:type:`PyTupleObject` containing the names of " +"the :term:`free (closure) variables `. On error, ``NULL`` " +"is returned and an exception is raised." msgstr "" -msgid "Register *callback* as a code object watcher for the current interpreter. Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case of error (e.g. no more watcher IDs available), return ``-1`` and set an exception." +#: ../../c-api/code.rst:157 +msgid "" +"Register *callback* as a code object watcher for the current interpreter. " +"Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case " +"of error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." msgstr "" -msgid "Clear watcher identified by *watcher_id* previously returned from :c:func:`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or ``-1`` and set an exception on error (e.g. if the given *watcher_id* was never registered.)" +#: ../../c-api/code.rst:166 +msgid "" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyCode_AddWatcher` for the current interpreter. Return ``0`` " +"on success, or ``-1`` and set an exception on error (e.g. if the given " +"*watcher_id* was never registered.)" msgstr "" -msgid "Enumeration of possible code object watcher events: - ``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" +#: ../../c-api/code.rst:175 +msgid "" +"Enumeration of possible code object watcher events: - " +"``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" msgstr "" +#: ../../c-api/code.rst:183 msgid "Type of a code object watcher callback function." msgstr "" -msgid "If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked after *co* has been fully initialized. Otherwise, the callback is invoked before the destruction of *co* takes place, so the prior state of *co* can be inspected." +#: ../../c-api/code.rst:185 +msgid "" +"If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked after " +"*co* has been fully initialized. Otherwise, the callback is invoked before " +"the destruction of *co* takes place, so the prior state of *co* can be " +"inspected." msgstr "" -msgid "If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback to the about-to-be-destroyed code object will resurrect it and prevent it from being freed at this time. When the resurrected object is destroyed later, any watcher callbacks active at that time will be called again." +#: ../../c-api/code.rst:190 +msgid "" +"If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback " +"to the about-to-be-destroyed code object will resurrect it and prevent it " +"from being freed at this time. When the resurrected object is destroyed " +"later, any watcher callbacks active at that time will be called again." msgstr "" -msgid "Users of this API should not rely on internal runtime implementation details. Such details may include, but are not limited to, the exact order and timing of creation and destruction of code objects. While changes in these details may result in differences observable by watchers (including whether a callback is invoked or not), it does not change the semantics of the Python code being executed." +#: ../../c-api/code.rst:195 +msgid "" +"Users of this API should not rely on internal runtime implementation " +"details. Such details may include, but are not limited to, the exact order " +"and timing of creation and destruction of code objects. While changes in " +"these details may result in differences observable by watchers (including " +"whether a callback is invoked or not), it does not change the semantics of " +"the Python code being executed." msgstr "" -msgid "If the callback sets an exception, it must return ``-1``; this exception will be printed as an unraisable exception using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +#: ../../c-api/code.rst:202 +msgid "" +"If the callback sets an exception, it must return ``-1``; this exception " +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -msgid "There may already be a pending exception set on entry to the callback. In this case, the callback should return ``0`` with the same exception still set. This means the callback may not call any other API that can set an exception unless it saves and clears the exception state first, and restores it before returning." +#: ../../c-api/code.rst:206 +msgid "" +"There may already be a pending exception set on entry to the callback. In " +"this case, the callback should return ``0`` with the same exception still " +"set. This means the callback may not call any other API that can set an " +"exception unless it saves and clears the exception state first, and restores " +"it before returning." msgstr "" -msgid "This is a :term:`soft deprecated` function that does nothing." +#: ../../c-api/code.rst:217 +msgid "This is a function that does nothing." msgstr "" -msgid "Prior to Python 3.10, this function would perform basic optimizations to a code object." +#: ../../c-api/code.rst:219 +msgid "" +"Prior to Python 3.10, this function would perform basic optimizations to a " +"code object." msgstr "" +#: ../../c-api/code.rst:222 msgid "This function now does nothing." msgstr "" +#: ../../c-api/code.rst:231 msgid "Code Object Flags" msgstr "" -msgid "Code objects contain a bit-field of flags, which can be retrieved as the :attr:`~codeobject.co_flags` Python attribute (for example using :c:func:`PyObject_GetAttrString`), and set using a *flags* argument to :c:func:`PyUnstable_Code_New` and similar functions." +#: ../../c-api/code.rst:233 +msgid "" +"Code objects contain a bit-field of flags, which can be retrieved as " +"the :attr:`~codeobject.co_flags` Python attribute (for example " +"using :c:func:`PyObject_GetAttrString`), and set using a *flags* argument " +"to :c:func:`PyUnstable_Code_New` and similar functions." msgstr "" -msgid "Flags whose names start with ``CO_FUTURE_`` correspond to features normally selectable by :ref:`future statements `. These flags can be used in :c:member:`PyCompilerFlags.cf_flags`. Note that many ``CO_FUTURE_`` flags are mandatory in current versions of Python, and setting them has no effect." +#: ../../c-api/code.rst:238 +msgid "" +"Flags whose names start with ``CO_FUTURE_`` correspond to features normally " +"selectable by :ref:`future statements `. These flags can be used " +"in :c:member:`PyCompilerFlags.cf_flags`. Note that many ``CO_FUTURE_`` flags " +"are mandatory in current versions of Python, and setting them has no effect." msgstr "" -msgid "The following flags are available. For their meaning, see the linked documentation of their Python equivalents." +#: ../../c-api/code.rst:244 +msgid "" +"The following flags are available. For their meaning, see the linked " +"documentation of their Python equivalents." msgstr "" +#: ../../c-api/code.rst:252 msgid "Flag" msgstr "" +#: ../../c-api/code.rst:253 msgid "Meaning" msgstr "" +#: ../../c-api/code.rst:255 msgid ":py:data:`inspect.CO_OPTIMIZED`" msgstr "" +#: ../../c-api/code.rst:257 msgid ":py:data:`inspect.CO_NEWLOCALS`" msgstr "" +#: ../../c-api/code.rst:259 msgid ":py:data:`inspect.CO_VARARGS`" msgstr "" +#: ../../c-api/code.rst:261 msgid ":py:data:`inspect.CO_VARKEYWORDS`" msgstr "" +#: ../../c-api/code.rst:263 msgid ":py:data:`inspect.CO_NESTED`" msgstr "" +#: ../../c-api/code.rst:265 msgid ":py:data:`inspect.CO_GENERATOR`" msgstr "" +#: ../../c-api/code.rst:267 msgid ":py:data:`inspect.CO_COROUTINE`" msgstr "" +#: ../../c-api/code.rst:269 msgid ":py:data:`inspect.CO_ITERABLE_COROUTINE`" msgstr "" +#: ../../c-api/code.rst:271 msgid ":py:data:`inspect.CO_ASYNC_GENERATOR`" msgstr "" +#: ../../c-api/code.rst:273 msgid ":py:data:`inspect.CO_HAS_DOCSTRING`" msgstr "" +#: ../../c-api/code.rst:275 msgid ":py:data:`inspect.CO_METHOD`" msgstr "" +#: ../../c-api/code.rst:278 msgid "no effect (:py:data:`__future__.division`)" msgstr "" +#: ../../c-api/code.rst:280 msgid "no effect (:py:data:`__future__.absolute_import`)" msgstr "" +#: ../../c-api/code.rst:282 msgid "no effect (:py:data:`__future__.with_statement`)" msgstr "" +#: ../../c-api/code.rst:284 msgid "no effect (:py:data:`__future__.print_function`)" msgstr "" +#: ../../c-api/code.rst:286 msgid "no effect (:py:data:`__future__.unicode_literals`)" msgstr "" +#: ../../c-api/code.rst:288 msgid "no effect (:py:data:`__future__.generator_stop`)" msgstr "" +#: ../../c-api/code.rst:290 msgid ":py:data:`__future__.annotations`" msgstr "" +#: ../../c-api/code.rst:294 msgid "Extra information" msgstr "" -msgid "To support low-level extensions to frame evaluation, such as external just-in-time compilers, it is possible to attach arbitrary extra data to code objects." +#: ../../c-api/code.rst:296 +msgid "" +"To support low-level extensions to frame evaluation, such as external just-" +"in-time compilers, it is possible to attach arbitrary extra data to code " +"objects." msgstr "" -msgid "These functions are part of the unstable C API tier: this functionality is a CPython implementation detail, and the API may change without deprecation warnings." +#: ../../c-api/code.rst:300 +msgid "" +"These functions are part of the unstable C API tier: this functionality is a " +"CPython implementation detail, and the API may change without deprecation " +"warnings." msgstr "" +#: ../../c-api/code.rst:309 msgid "Return a new opaque index value used to adding data to code objects." msgstr "" -msgid "You generally call this function once (per interpreter) and use the result with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on individual code objects." +#: ../../c-api/code.rst:311 +msgid "" +"You generally call this function once (per interpreter) and use the result " +"with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " +"individual code objects." msgstr "" -msgid "If *free* is not ``NULL``: when a code object is deallocated, *free* will be called on non-``NULL`` data stored under the new index. Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`." +#: ../../c-api/code.rst:315 +msgid "" +"If *free* is not ``NULL``: when a code object is deallocated, *free* will be " +"called on non-``NULL`` data stored under the new index. " +"Use :c:func:`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" +#: ../../c-api/code.rst:319 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -msgid "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name is deprecated, but will be available until the API changes." +#: ../../c-api/code.rst:323 +msgid "" +"Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " +"is deprecated, but will be available until the API changes." msgstr "" -msgid "Set *extra* to the extra data stored under the given index. Return 0 on success. Set an exception and return -1 on failure." +#: ../../c-api/code.rst:332 +msgid "" +"Set *extra* to the extra data stored under the given index. Return 0 on " +"success. Set an exception and return -1 on failure." msgstr "" -msgid "If no data was set under the index, set *extra* to ``NULL`` and return 0 without setting an exception." +#: ../../c-api/code.rst:335 +msgid "" +"If no data was set under the index, set *extra* to ``NULL`` and return 0 " +"without setting an exception." msgstr "" +#: ../../c-api/code.rst:338 msgid "as ``_PyCode_GetExtra``" msgstr "" -msgid "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, but will be available until the API changes." +#: ../../c-api/code.rst:342 +msgid "" +"Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " +"but will be available until the API changes." msgstr "" -msgid "Set the extra data stored under the given index to *extra*. Return 0 on success. Set an exception and return -1 on failure." +#: ../../c-api/code.rst:351 +msgid "" +"Set the extra data stored under the given index to *extra*. Return 0 on " +"success. Set an exception and return -1 on failure." msgstr "" +#: ../../c-api/code.rst:354 msgid "as ``_PyCode_SetExtra``" msgstr "" -msgid "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, but will be available until the API changes." +#: ../../c-api/code.rst:358 +msgid "" +"Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " +"but will be available until the API changes." msgstr "" +#: ../../c-api/code.rst:3 msgid "object" msgstr "" +#: ../../c-api/code.rst:3 msgid "code" msgstr "" +#: ../../c-api/code.rst:3 msgid "code object" msgstr "" +#: ../../c-api/code.rst:64 msgid "PyCode_New (C function)" msgstr "" diff --git a/c-api/codec.po b/c-api/codec.po index fc52e9dfe..d2bd48d29 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,92 +21,168 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/codec.rst:4 msgid "Codec registry and support functions" msgstr "" +#: ../../c-api/codec.rst:8 msgid "Register a new codec search function." msgstr "" -msgid "As a side effect, this tries to load the :mod:`!encodings` package, if not yet done, to make sure that it is always first in the list of search functions." +#: ../../c-api/codec.rst:10 +msgid "" +"As a side effect, this tries to load the :mod:`!encodings` package, if not " +"yet done, to make sure that it is always first in the list of search " +"functions." msgstr "" -msgid "Unregister a codec search function and clear the registry's cache. If the search function is not registered, do nothing. Return 0 on success. Raise an exception and return -1 on error." +#: ../../c-api/codec.rst:15 +msgid "" +"Unregister a codec search function and clear the registry's cache. If the " +"search function is not registered, do nothing. Return 0 on success. Raise an " +"exception and return -1 on error." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether there is a registered codec for the given *encoding*. This function always succeeds." +#: ../../c-api/codec.rst:23 +msgid "" +"Return ``1`` or ``0`` depending on whether there is a registered codec for " +"the given *encoding*. This function always succeeds." msgstr "" +#: ../../c-api/codec.rst:28 msgid "Generic codec based encoding API." msgstr "" -msgid "*object* is passed through the encoder function found for the given *encoding* using the error handling method defined by *errors*. *errors* may be ``NULL`` to use the default method defined for the codec. Raises a :exc:`LookupError` if no encoder can be found." +#: ../../c-api/codec.rst:30 +msgid "" +"*object* is passed through the encoder function found for the given " +"*encoding* using the error handling method defined by *errors*. *errors* " +"may be ``NULL`` to use the default method defined for the codec. Raises " +"a :exc:`LookupError` if no encoder can be found." msgstr "" +#: ../../c-api/codec.rst:37 msgid "Generic codec based decoding API." msgstr "" -msgid "*object* is passed through the decoder function found for the given *encoding* using the error handling method defined by *errors*. *errors* may be ``NULL`` to use the default method defined for the codec. Raises a :exc:`LookupError` if no decoder can be found." +#: ../../c-api/codec.rst:39 +msgid "" +"*object* is passed through the decoder function found for the given " +"*encoding* using the error handling method defined by *errors*. *errors* " +"may be ``NULL`` to use the default method defined for the codec. Raises " +"a :exc:`LookupError` if no decoder can be found." msgstr "" +#: ../../c-api/codec.rst:46 msgid "Codec lookup API" msgstr "" -msgid "In the following functions, the *encoding* string is looked up converted to all lower-case characters, which makes encodings looked up through this mechanism effectively case-insensitive. If no codec is found, a :exc:`KeyError` is set and ``NULL`` returned." +#: ../../c-api/codec.rst:48 +msgid "" +"In the following functions, the *encoding* string is looked up converted to " +"all lower-case characters, which makes encodings looked up through this " +"mechanism effectively case-insensitive. If no codec is found, " +"a :exc:`KeyError` is set and ``NULL`` returned." msgstr "" +#: ../../c-api/codec.rst:55 msgid "Get an encoder function for the given *encoding*." msgstr "" +#: ../../c-api/codec.rst:59 msgid "Get a decoder function for the given *encoding*." msgstr "" -msgid "Get an :class:`~codecs.IncrementalEncoder` object for the given *encoding*." +#: ../../c-api/codec.rst:63 +msgid "" +"Get an :class:`~codecs.IncrementalEncoder` object for the given *encoding*." msgstr "" -msgid "Get an :class:`~codecs.IncrementalDecoder` object for the given *encoding*." +#: ../../c-api/codec.rst:67 +msgid "" +"Get an :class:`~codecs.IncrementalDecoder` object for the given *encoding*." msgstr "" -msgid "Get a :class:`~codecs.StreamReader` factory function for the given *encoding*." +#: ../../c-api/codec.rst:71 +msgid "" +"Get a :class:`~codecs.StreamReader` factory function for the given " +"*encoding*." msgstr "" -msgid "Get a :class:`~codecs.StreamWriter` factory function for the given *encoding*." +#: ../../c-api/codec.rst:75 +msgid "" +"Get a :class:`~codecs.StreamWriter` factory function for the given " +"*encoding*." msgstr "" +#: ../../c-api/codec.rst:79 msgid "Registry API for Unicode encoding error handlers" msgstr "" -msgid "Register the error handling callback function *error* under the given *name*. This callback function will be called by a codec when it encounters unencodable characters/undecodable bytes and *name* is specified as the error parameter in the call to the encode/decode function." -msgstr "" - -msgid "The callback gets a single argument, an instance of :exc:`UnicodeEncodeError`, :exc:`UnicodeDecodeError` or :exc:`UnicodeTranslateError` that holds information about the problematic sequence of characters or bytes and their offset in the original string (see :ref:`unicodeexceptions` for functions to extract this information). The callback must either raise the given exception, or return a two-item tuple containing the replacement for the problematic sequence, and an integer giving the offset in the original string at which encoding/decoding should be resumed." +#: ../../c-api/codec.rst:83 +msgid "" +"Register the error handling callback function *error* under the given " +"*name*. This callback function will be called by a codec when it encounters " +"unencodable characters/undecodable bytes and *name* is specified as the " +"error parameter in the call to the encode/decode function." msgstr "" +#: ../../c-api/codec.rst:88 +msgid "" +"The callback gets a single argument, an instance " +"of :exc:`UnicodeEncodeError`, :exc:`UnicodeDecodeError` " +"or :exc:`UnicodeTranslateError` that holds information about the problematic " +"sequence of characters or bytes and their offset in the original string " +"(see :ref:`unicodeexceptions` for functions to extract this information). " +"The callback must either raise the given exception, or return a two-item " +"tuple containing the replacement for the problematic sequence, and an " +"integer giving the offset in the original string at which encoding/decoding " +"should be resumed." +msgstr "" + +#: ../../c-api/codec.rst:98 msgid "Return ``0`` on success, ``-1`` on error." msgstr "" -msgid "Lookup the error handling callback function registered under *name*. As a special case ``NULL`` can be passed, in which case the error handling callback for \"strict\" will be returned." +#: ../../c-api/codec.rst:102 +msgid "" +"Lookup the error handling callback function registered under *name*. As a " +"special case ``NULL`` can be passed, in which case the error handling " +"callback for \"strict\" will be returned." msgstr "" +#: ../../c-api/codec.rst:108 msgid "Raise *exc* as an exception." msgstr "" +#: ../../c-api/codec.rst:112 msgid "Ignore the unicode error, skipping the faulty input." msgstr "" +#: ../../c-api/codec.rst:116 msgid "Replace the unicode encode error with ``?`` or ``U+FFFD``." msgstr "" +#: ../../c-api/codec.rst:120 msgid "Replace the unicode encode error with XML character references." msgstr "" -msgid "Replace the unicode encode error with backslash escapes (``\\x``, ``\\u`` and ``\\U``)." +#: ../../c-api/codec.rst:124 +msgid "" +"Replace the unicode encode error with backslash escapes (``\\x``, ``\\u`` " +"and ``\\U``)." msgstr "" +#: ../../c-api/codec.rst:129 msgid "Replace the unicode encode error with ``\\N{...}`` escapes." msgstr "" +#: ../../c-api/codec.rst:135 msgid "Codec utility variables" msgstr "" -msgid "A string constant containing the lowercase hexadecimal digits: ``\"0123456789abcdef\"``." +#: ../../c-api/codec.rst:139 +msgid "" +"A string constant containing the lowercase hexadecimal digits: " +"``\"0123456789abcdef\"``." msgstr "" diff --git a/c-api/complex.po b/c-api/complex.po index 43926010f..355a60d37 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,24 +22,42 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/complex.rst:6 msgid "Complex Number Objects" msgstr "" -msgid "Python's complex number objects are implemented as two distinct types when viewed from the C API: one is the Python object exposed to Python programs, and the other is a C structure which represents the actual complex number value. The API provides functions for working with both." +#: ../../c-api/complex.rst:10 +msgid "" +"Python's complex number objects are implemented as two distinct types when " +"viewed from the C API: one is the Python object exposed to Python programs, " +"and the other is a C structure which represents the actual complex number " +"value. The API provides functions for working with both." msgstr "" +#: ../../c-api/complex.rst:17 msgid "Complex Numbers as C Structures" msgstr "" -msgid "Note that the functions which accept these structures as parameters and return them as results do so *by value* rather than dereferencing them through pointers. This is consistent throughout the API." +#: ../../c-api/complex.rst:19 +msgid "" +"Note that the functions which accept these structures as parameters and " +"return them as results do so *by value* rather than dereferencing them " +"through pointers. This is consistent throughout the API." msgstr "" -msgid "The C structure which corresponds to the value portion of a Python complex number object. Most of the functions for dealing with complex number objects use structures of this type as input or output values, as appropriate." +#: ../../c-api/complex.rst:26 +msgid "" +"The C structure which corresponds to the value portion of a Python complex " +"number object. Most of the functions for dealing with complex number " +"objects use structures of this type as input or output values, as " +"appropriate." msgstr "" +#: ../../c-api/complex.rst:33 msgid "The structure is defined as::" msgstr "" +#: ../../c-api/complex.rst:35 msgid "" "typedef struct {\n" " double real;\n" @@ -47,86 +65,161 @@ msgid "" "} Py_complex;" msgstr "" -msgid "Return the sum of two complex numbers, using the C :c:type:`Py_complex` representation." +#: ../../c-api/complex.rst:43 +msgid "" +"Return the sum of two complex numbers, using the C :c:type:`Py_complex` " +"representation." msgstr "" -msgid "Return the difference between two complex numbers, using the C :c:type:`Py_complex` representation." +#: ../../c-api/complex.rst:49 +msgid "" +"Return the difference between two complex numbers, using the " +"C :c:type:`Py_complex` representation." msgstr "" -msgid "Return the negation of the complex number *num*, using the C :c:type:`Py_complex` representation." +#: ../../c-api/complex.rst:55 +msgid "" +"Return the negation of the complex number *num*, using the " +"C :c:type:`Py_complex` representation." msgstr "" -msgid "Return the product of two complex numbers, using the C :c:type:`Py_complex` representation." +#: ../../c-api/complex.rst:61 +msgid "" +"Return the product of two complex numbers, using the C :c:type:`Py_complex` " +"representation." msgstr "" -msgid "Return the quotient of two complex numbers, using the C :c:type:`Py_complex` representation." +#: ../../c-api/complex.rst:67 +msgid "" +"Return the quotient of two complex numbers, using the C :c:type:`Py_complex` " +"representation." msgstr "" -msgid "If *divisor* is null, this method returns zero and sets :c:data:`errno` to :c:macro:`!EDOM`." +#: ../../c-api/complex.rst:70 +msgid "" +"If *divisor* is null, this method returns zero and sets :c:data:`errno` " +"to :c:macro:`!EDOM`." msgstr "" -msgid "Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex` representation." +#: ../../c-api/complex.rst:76 +msgid "" +"Return the exponentiation of *num* by *exp*, using the " +"C :c:type:`Py_complex` representation." msgstr "" -msgid "If *num* is null and *exp* is not a positive real number, this method returns zero and sets :c:data:`errno` to :c:macro:`!EDOM`." +#: ../../c-api/complex.rst:79 +msgid "" +"If *num* is null and *exp* is not a positive real number, this method " +"returns zero and sets :c:data:`errno` to :c:macro:`!EDOM`." msgstr "" +#: ../../c-api/complex.rst:82 msgid "Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows." msgstr "" +#: ../../c-api/complex.rst:86 msgid "Complex Numbers as Python Objects" msgstr "" -msgid "This subtype of :c:type:`PyObject` represents a Python complex number object." +#: ../../c-api/complex.rst:91 +msgid "" +"This subtype of :c:type:`PyObject` represents a Python complex number object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python complex number type. It is the same object as :class:`complex` in the Python layer." +#: ../../c-api/complex.rst:96 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python complex number " +"type. It is the same object as :class:`complex` in the Python layer." msgstr "" -msgid "Return true if its argument is a :c:type:`PyComplexObject` or a subtype of :c:type:`PyComplexObject`. This function always succeeds." +#: ../../c-api/complex.rst:102 +msgid "" +"Return true if its argument is a :c:type:`PyComplexObject` or a subtype " +"of :c:type:`PyComplexObject`. This function always succeeds." msgstr "" -msgid "Return true if its argument is a :c:type:`PyComplexObject`, but not a subtype of :c:type:`PyComplexObject`. This function always succeeds." +#: ../../c-api/complex.rst:108 +msgid "" +"Return true if its argument is a :c:type:`PyComplexObject`, but not a " +"subtype of :c:type:`PyComplexObject`. This function always succeeds." msgstr "" -msgid "Create a new Python complex number object from a C :c:type:`Py_complex` value. Return ``NULL`` with an exception set on error." +#: ../../c-api/complex.rst:114 +msgid "" +"Create a new Python complex number object from a C :c:type:`Py_complex` " +"value. Return ``NULL`` with an exception set on error." msgstr "" -msgid "Return a new :c:type:`PyComplexObject` object from *real* and *imag*. Return ``NULL`` with an exception set on error." +#: ../../c-api/complex.rst:120 +msgid "" +"Return a new :c:type:`PyComplexObject` object from *real* and *imag*. Return " +"``NULL`` with an exception set on error." msgstr "" +#: ../../c-api/complex.rst:126 msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "" -msgid "If *op* is not a Python complex number object but has a :meth:`~object.__complex__` method, this method will first be called to convert *op* to a Python complex number object. If :meth:`!__complex__` is not defined then it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." +#: ../../c-api/complex.rst:128 +msgid "" +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to call :c:func:`PyFloat_AsDouble` and " +"returns its result." msgstr "" -msgid "Upon failure, this method returns ``-1.0`` with an exception set, so one should call :c:func:`PyErr_Occurred` to check for errors." +#: ../../c-api/complex.rst:134 ../../c-api/complex.rst:150 +msgid "" +"Upon failure, this method returns ``-1.0`` with an exception set, so one " +"should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +#: ../../c-api/complex.rst:137 ../../c-api/complex.rst:153 msgid "Use :meth:`~object.__complex__` if available." msgstr "" +#: ../../c-api/complex.rst:142 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "" -msgid "If *op* is not a Python complex number object but has a :meth:`~object.__complex__` method, this method will first be called to convert *op* to a Python complex number object. If :meth:`!__complex__` is not defined then it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on success." +#: ../../c-api/complex.rst:144 +msgid "" +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to call :c:func:`PyFloat_AsDouble` and " +"returns ``0.0`` on success." msgstr "" +#: ../../c-api/complex.rst:158 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." msgstr "" -msgid "If *op* is not a Python complex number object but has a :meth:`~object.__complex__` method, this method will first be called to convert *op* to a Python complex number object. If :meth:`!__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__`." +#: ../../c-api/complex.rst:160 +msgid "" +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__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 "" -msgid "Upon failure, this method returns :c:type:`Py_complex` with :c:member:`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should call :c:func:`PyErr_Occurred` to check for errors." +#: ../../c-api/complex.rst:166 +msgid "" +"Upon failure, this method returns :c:type:`Py_complex` " +"with :c:member:`~Py_complex.real` set to ``-1.0`` and with an exception set, " +"so one should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +#: ../../c-api/complex.rst:170 msgid "Use :meth:`~object.__index__` if available." msgstr "" +#: ../../c-api/complex.rst:8 msgid "object" msgstr "" +#: ../../c-api/complex.rst:8 msgid "complex number" msgstr "" diff --git a/c-api/concrete.po b/c-api/concrete.po index a6ac052f1..48c17d1f4 100644 --- a/c-api/concrete.po +++ b/c-api/concrete.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,50 +23,82 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/concrete.rst:8 msgid "Concrete Objects Layer" msgstr "" -msgid "The functions in this chapter are specific to certain Python object types. Passing them an object of the wrong type is not a good idea; if you receive an object from a Python program and you are not sure that it has the right type, you must perform a type check first; for example, to check that an object is a dictionary, use :c:func:`PyDict_Check`. The chapter is structured like the \"family tree\" of Python object types." +#: ../../c-api/concrete.rst:10 +msgid "" +"The functions in this chapter are specific to certain Python object types. " +"Passing them an object of the wrong type is not a good idea; if you receive " +"an object from a Python program and you are not sure that it has the right " +"type, you must perform a type check first; for example, to check that an " +"object is a dictionary, use :c:func:`PyDict_Check`. The chapter is " +"structured like the \"family tree\" of Python object types." msgstr "" -msgid "While the functions described in this chapter carefully check the type of the objects which are passed in, many of them do not check for ``NULL`` being passed instead of a valid object. Allowing ``NULL`` to be passed in can cause memory access violations and immediate termination of the interpreter." +#: ../../c-api/concrete.rst:19 +msgid "" +"While the functions described in this chapter carefully check the type of " +"the objects which are passed in, many of them do not check for ``NULL`` " +"being passed instead of a valid object. Allowing ``NULL`` to be passed in " +"can cause memory access violations and immediate termination of the " +"interpreter." msgstr "" +#: ../../c-api/concrete.rst:28 msgid "Fundamental Objects" msgstr "" -msgid "This section describes Python type objects and the singleton object ``None``." +#: ../../c-api/concrete.rst:30 +msgid "" +"This section describes Python type objects and the singleton object ``None``." msgstr "" +#: ../../c-api/concrete.rst:41 msgid "Numeric Objects" msgstr "" +#: ../../c-api/concrete.rst:56 msgid "Sequence Objects" msgstr "" -msgid "Generic operations on sequence objects were discussed in the previous chapter; this section deals with the specific kinds of sequence objects that are intrinsic to the Python language." +#: ../../c-api/concrete.rst:60 +msgid "" +"Generic operations on sequence objects were discussed in the previous " +"chapter; this section deals with the specific kinds of sequence objects that " +"are intrinsic to the Python language." msgstr "" +#: ../../c-api/concrete.rst:78 msgid "Container Objects" msgstr "" +#: ../../c-api/concrete.rst:91 msgid "Function Objects" msgstr "" +#: ../../c-api/concrete.rst:102 msgid "Other Objects" msgstr "" +#: ../../c-api/concrete.rst:123 msgid "C API for extension modules" msgstr "" +#: ../../c-api/concrete.rst:43 ../../c-api/concrete.rst:58 +#: ../../c-api/concrete.rst:80 msgid "object" msgstr "" +#: ../../c-api/concrete.rst:43 msgid "numeric" msgstr "" +#: ../../c-api/concrete.rst:58 msgid "sequence" msgstr "" +#: ../../c-api/concrete.rst:80 msgid "mapping" msgstr "" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index 2a82d9245..026daba25 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,12 +24,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/contextvars.rst:6 msgid "Context Variables Objects" msgstr "" -msgid "In Python 3.7.1 the signatures of all context variables C APIs were **changed** to use :c:type:`PyObject` pointers instead of :c:type:`PyContext`, :c:type:`PyContextVar`, and :c:type:`PyContextToken`, e.g.::" +#: ../../c-api/contextvars.rst:15 +msgid "" +"In Python 3.7.1 the signatures of all context variables C APIs were " +"**changed** to use :c:type:`PyObject` pointers instead " +"of :c:type:`PyContext`, :c:type:`PyContextVar`, " +"and :c:type:`PyContextToken`, e.g.::" msgstr "" +#: ../../c-api/contextvars.rst:20 msgid "" "// in 3.7.0:\n" "PyContext *PyContext_New(void);\n" @@ -38,107 +45,198 @@ msgid "" "PyObject *PyContext_New(void);" msgstr "" +#: ../../c-api/contextvars.rst:26 msgid "See :issue:`34762` for more details." msgstr "" -msgid "This section details the public C API for the :mod:`contextvars` module." +#: ../../c-api/contextvars.rst:29 +msgid "" +"This section details the public C API for the :mod:`contextvars` module." msgstr "" -msgid "The C structure used to represent a :class:`contextvars.Context` object." +#: ../../c-api/contextvars.rst:33 +msgid "" +"The C structure used to represent a :class:`contextvars.Context` object." msgstr "" -msgid "The C structure used to represent a :class:`contextvars.ContextVar` object." +#: ../../c-api/contextvars.rst:38 +msgid "" +"The C structure used to represent a :class:`contextvars.ContextVar` object." msgstr "" +#: ../../c-api/contextvars.rst:43 msgid "The C structure used to represent a :class:`contextvars.Token` object." msgstr "" +#: ../../c-api/contextvars.rst:47 msgid "The type object representing the *context* type." msgstr "" +#: ../../c-api/contextvars.rst:51 msgid "The type object representing the *context variable* type." msgstr "" +#: ../../c-api/contextvars.rst:55 msgid "The type object representing the *context variable token* type." msgstr "" +#: ../../c-api/contextvars.rst:58 msgid "Type-check macros:" msgstr "" -msgid "Return true if *o* is of type :c:data:`PyContext_Type`. *o* must not be ``NULL``. This function always succeeds." +#: ../../c-api/contextvars.rst:62 +msgid "" +"Return true if *o* is of type :c:data:`PyContext_Type`. *o* must not be " +"``NULL``. This function always succeeds." msgstr "" -msgid "Return true if *o* is of type :c:data:`PyContextVar_Type`. *o* must not be ``NULL``. This function always succeeds." +#: ../../c-api/contextvars.rst:67 +msgid "" +"Return true if *o* is of type :c:data:`PyContextVar_Type`. *o* must not be " +"``NULL``. This function always succeeds." msgstr "" -msgid "Return true if *o* is of type :c:data:`PyContextToken_Type`. *o* must not be ``NULL``. This function always succeeds." +#: ../../c-api/contextvars.rst:72 +msgid "" +"Return true if *o* is of type :c:data:`PyContextToken_Type`. *o* must not be " +"``NULL``. This function always succeeds." msgstr "" +#: ../../c-api/contextvars.rst:76 msgid "Context object management functions:" msgstr "" -msgid "Create a new empty context object. Returns ``NULL`` if an error has occurred." +#: ../../c-api/contextvars.rst:80 +msgid "" +"Create a new empty context object. Returns ``NULL`` if an error has " +"occurred." msgstr "" -msgid "Create a shallow copy of the passed *ctx* context object. Returns ``NULL`` if an error has occurred." +#: ../../c-api/contextvars.rst:85 +msgid "" +"Create a shallow copy of the passed *ctx* context object. Returns ``NULL`` " +"if an error has occurred." msgstr "" -msgid "Create a shallow copy of the current thread context. Returns ``NULL`` if an error has occurred." +#: ../../c-api/contextvars.rst:90 +msgid "" +"Create a shallow copy of the current thread context. Returns ``NULL`` if an " +"error has occurred." msgstr "" -msgid "Set *ctx* as the current context for the current thread. Returns ``0`` on success, and ``-1`` on error." +#: ../../c-api/contextvars.rst:95 +msgid "" +"Set *ctx* as the current context for the current thread. Returns ``0`` on " +"success, and ``-1`` on error." msgstr "" -msgid "Deactivate the *ctx* context and restore the previous context as the current context for the current thread. Returns ``0`` on success, and ``-1`` on error." +#: ../../c-api/contextvars.rst:100 +msgid "" +"Deactivate the *ctx* context and restore the previous context as the current " +"context for the current thread. Returns ``0`` on success, and ``-1`` on " +"error." msgstr "" -msgid "Register *callback* as a context object watcher for the current interpreter. Return an ID which may be passed to :c:func:`PyContext_ClearWatcher`. In case of error (e.g. no more watcher IDs available), return ``-1`` and set an exception." +#: ../../c-api/contextvars.rst:106 +msgid "" +"Register *callback* as a context object watcher for the current interpreter. " +"Return an ID which may be passed to :c:func:`PyContext_ClearWatcher`. In " +"case of error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." msgstr "" -msgid "Clear watcher identified by *watcher_id* previously returned from :c:func:`PyContext_AddWatcher` for the current interpreter. Return ``0`` on success, or ``-1`` and set an exception on error (e.g. if the given *watcher_id* was never registered.)" +#: ../../c-api/contextvars.rst:115 +msgid "" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyContext_AddWatcher` for the current interpreter. Return " +"``0`` on success, or ``-1`` and set an exception on error (e.g. if the given " +"*watcher_id* was never registered.)" msgstr "" +#: ../../c-api/contextvars.rst:124 msgid "Enumeration of possible context object watcher events:" msgstr "" -msgid "``Py_CONTEXT_SWITCHED``: The :term:`current context` has switched to a different context. The object passed to the watch callback is the now-current :class:`contextvars.Context` object, or None if no context is current." +#: ../../c-api/contextvars.rst:126 +msgid "" +"``Py_CONTEXT_SWITCHED``: The :term:`current context` has switched to a " +"different context. The object passed to the watch callback is the now-" +"current :class:`contextvars.Context` object, or None if no context is " +"current." msgstr "" -msgid "Context object watcher callback function. The object passed to the callback is event-specific; see :c:type:`PyContextEvent` for details." +#: ../../c-api/contextvars.rst:135 +msgid "" +"Context object watcher callback function. The object passed to the callback " +"is event-specific; see :c:type:`PyContextEvent` for details." msgstr "" -msgid "If the callback returns with an exception set, it must return ``-1``; this exception will be printed as an unraisable exception using :c:func:`PyErr_FormatUnraisable`. Otherwise it should return ``0``." +#: ../../c-api/contextvars.rst:138 +msgid "" +"If the callback returns with an exception set, it must return ``-1``; this " +"exception will be printed as an unraisable exception " +"using :c:func:`PyErr_FormatUnraisable`. Otherwise it should return ``0``." msgstr "" -msgid "There may already be a pending exception set on entry to the callback. In this case, the callback should return ``0`` with the same exception still set. This means the callback may not call any other API that can set an exception unless it saves and clears the exception state first, and restores it before returning." +#: ../../c-api/contextvars.rst:142 +msgid "" +"There may already be a pending exception set on entry to the callback. In " +"this case, the callback should return ``0`` with the same exception still " +"set. This means the callback may not call any other API that can set an " +"exception unless it saves and clears the exception state first, and restores " +"it before returning." msgstr "" +#: ../../c-api/contextvars.rst:151 msgid "Context variable functions:" msgstr "" -msgid "Create a new ``ContextVar`` object. The *name* parameter is used for introspection and debug purposes. The *def* parameter specifies a default value for the context variable, or ``NULL`` for no default. If an error has occurred, this function returns ``NULL``." +#: ../../c-api/contextvars.rst:155 +msgid "" +"Create a new ``ContextVar`` object. The *name* parameter is used for " +"introspection and debug purposes. The *def* parameter specifies a default " +"value for the context variable, or ``NULL`` for no default. If an error has " +"occurred, this function returns ``NULL``." msgstr "" -msgid "Get the value of a context variable. Returns ``-1`` if an error has occurred during lookup, and ``0`` if no error occurred, whether or not a value was found." +#: ../../c-api/contextvars.rst:162 +msgid "" +"Get the value of a context variable. Returns ``-1`` if an error has " +"occurred during lookup, and ``0`` if no error occurred, whether or not a " +"value was found." msgstr "" -msgid "If the context variable was found, *value* will be a pointer to it. If the context variable was *not* found, *value* will point to:" +#: ../../c-api/contextvars.rst:166 +msgid "" +"If the context variable was found, *value* will be a pointer to it. If the " +"context variable was *not* found, *value* will point to:" msgstr "" +#: ../../c-api/contextvars.rst:169 msgid "*default_value*, if not ``NULL``;" msgstr "" +#: ../../c-api/contextvars.rst:170 msgid "the default value of *var*, if not ``NULL``;" msgstr "" +#: ../../c-api/contextvars.rst:171 msgid "``NULL``" msgstr "" +#: ../../c-api/contextvars.rst:173 msgid "Except for ``NULL``, the function returns a new reference." msgstr "" -msgid "Set the value of *var* to *value* in the current context. Returns a new token object for this change, or ``NULL`` if an error has occurred." +#: ../../c-api/contextvars.rst:177 +msgid "" +"Set the value of *var* to *value* in the current context. Returns a new " +"token object for this change, or ``NULL`` if an error has occurred." msgstr "" -msgid "Reset the state of the *var* context variable to that it was in before :c:func:`PyContextVar_Set` that returned the *token* was called. This function returns ``0`` on success and ``-1`` on error." +#: ../../c-api/contextvars.rst:182 +msgid "" +"Reset the state of the *var* context variable to that it was in " +"before :c:func:`PyContextVar_Set` that returned the *token* was called. This " +"function returns ``0`` on success and ``-1`` on error." msgstr "" diff --git a/c-api/conversion.po b/c-api/conversion.po index 28af6eb84..db1e1c15a 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,167 +21,325 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/conversion.rst:6 msgid "String conversion and formatting" msgstr "" +#: ../../c-api/conversion.rst:8 msgid "Functions for number conversion and formatted string output." msgstr "" -msgid "Output not more than *size* bytes to *str* according to the format string *format* and the extra arguments. See the Unix man page :manpage:`snprintf(3)`." +#: ../../c-api/conversion.rst:13 +msgid "" +"Output not more than *size* bytes to *str* according to the format string " +"*format* and the extra arguments. See the Unix man " +"page :manpage:`snprintf(3)`." msgstr "" -msgid "Output not more than *size* bytes to *str* according to the format string *format* and the variable argument list *va*. Unix man page :manpage:`vsnprintf(3)`." +#: ../../c-api/conversion.rst:19 +msgid "" +"Output not more than *size* bytes to *str* according to the format string " +"*format* and the variable argument list *va*. Unix man " +"page :manpage:`vsnprintf(3)`." msgstr "" -msgid ":c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C library functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose is to guarantee consistent behavior in corner cases, which the Standard C functions do not." +#: ../../c-api/conversion.rst:23 +msgid "" +":c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C " +"library functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose " +"is to guarantee consistent behavior in corner cases, which the Standard C " +"functions do not." msgstr "" -msgid "The wrappers ensure that ``str[size-1]`` is always ``'\\0'`` upon return. They never write more than *size* bytes (including the trailing ``'\\0'``) into str. Both functions require that ``str != NULL``, ``size > 0``, ``format != NULL`` and ``size < INT_MAX``. Note that this means there is no equivalent to the C99 ``n = snprintf(NULL, 0, ...)`` which would determine the necessary buffer size." +#: ../../c-api/conversion.rst:28 +msgid "" +"The wrappers ensure that ``str[size-1]`` is always ``'\\0'`` upon return. " +"They never write more than *size* bytes (including the trailing ``'\\0'``) " +"into str. Both functions require that ``str != NULL``, ``size > 0``, " +"``format != NULL`` and ``size < INT_MAX``. Note that this means there is no " +"equivalent to the C99 ``n = snprintf(NULL, 0, ...)`` which would determine " +"the necessary buffer size." msgstr "" -msgid "The return value (*rv*) for these functions should be interpreted as follows:" +#: ../../c-api/conversion.rst:34 +msgid "" +"The return value (*rv*) for these functions should be interpreted as follows:" msgstr "" -msgid "When ``0 <= rv < size``, the output conversion was successful and *rv* characters were written to *str* (excluding the trailing ``'\\0'`` byte at ``str[rv]``)." +#: ../../c-api/conversion.rst:36 +msgid "" +"When ``0 <= rv < size``, the output conversion was successful and *rv* " +"characters were written to *str* (excluding the trailing ``'\\0'`` byte at " +"``str[rv]``)." msgstr "" -msgid "When ``rv >= size``, the output conversion was truncated and a buffer with ``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is ``'\\0'`` in this case." +#: ../../c-api/conversion.rst:40 +msgid "" +"When ``rv >= size``, the output conversion was truncated and a buffer with " +"``rv + 1`` bytes would have been needed to succeed. ``str[size-1]`` is " +"``'\\0'`` in this case." msgstr "" -msgid "When ``rv < 0``, the output conversion failed and ``str[size-1]`` is ``'\\0'`` in this case too, but the rest of *str* is undefined. The exact cause of the error depends on the underlying platform." +#: ../../c-api/conversion.rst:44 +msgid "" +"When ``rv < 0``, the output conversion failed and ``str[size-1]`` is " +"``'\\0'`` in this case too, but the rest of *str* is undefined. The exact " +"cause of the error depends on the underlying platform." msgstr "" -msgid "The following functions provide locale-independent string to number conversions." +#: ../../c-api/conversion.rst:49 +msgid "" +"The following functions provide locale-independent string to number " +"conversions." msgstr "" -msgid "Convert the initial part of the string in ``str`` to an :c:expr:`unsigned long` value according to the given ``base``, which must be between ``2`` and ``36`` inclusive, or be the special value ``0``." +#: ../../c-api/conversion.rst:53 +msgid "" +"Convert the initial part of the string in ``str`` to an :c:expr:`unsigned " +"long` value according to the given ``base``, which must be between ``2`` and " +"``36`` inclusive, or be the special value ``0``." msgstr "" -msgid "Leading white space and case of characters are ignored. If ``base`` is zero it looks for a leading ``0b``, ``0o`` or ``0x`` to tell which base. If these are absent it defaults to ``10``. Base must be 0 or between 2 and 36 (inclusive). If ``ptr`` is non-``NULL`` it will contain a pointer to the end of the scan." +#: ../../c-api/conversion.rst:57 +msgid "" +"Leading white space and case of characters are ignored. If ``base`` is zero " +"it looks for a leading ``0b``, ``0o`` or ``0x`` to tell which base. If " +"these are absent it defaults to ``10``. Base must be 0 or between 2 and 36 " +"(inclusive). If ``ptr`` is non-``NULL`` it will contain a pointer to the " +"end of the scan." msgstr "" -msgid "If the converted value falls out of range of corresponding return type, range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) and :c:macro:`!ULONG_MAX` is returned. If no conversion can be performed, ``0`` is returned." +#: ../../c-api/conversion.rst:63 +msgid "" +"If the converted value falls out of range of corresponding return type, " +"range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) " +"and :c:macro:`!ULONG_MAX` is returned. If no conversion can be performed, " +"``0`` is returned." msgstr "" +#: ../../c-api/conversion.rst:68 msgid "See also the Unix man page :manpage:`strtoul(3)`." msgstr "" -msgid "Convert the initial part of the string in ``str`` to an :c:expr:`long` value according to the given ``base``, which must be between ``2`` and ``36`` inclusive, or be the special value ``0``." +#: ../../c-api/conversion.rst:75 +msgid "" +"Convert the initial part of the string in ``str`` to an :c:expr:`long` value " +"according to the given ``base``, which must be between ``2`` and ``36`` " +"inclusive, or be the special value ``0``." msgstr "" -msgid "Same as :c:func:`PyOS_strtoul`, but return a :c:expr:`long` value instead and :c:macro:`LONG_MAX` on overflows." +#: ../../c-api/conversion.rst:79 +msgid "" +"Same as :c:func:`PyOS_strtoul`, but return a :c:expr:`long` value instead " +"and :c:macro:`LONG_MAX` on overflows." msgstr "" +#: ../../c-api/conversion.rst:82 msgid "See also the Unix man page :manpage:`strtol(3)`." msgstr "" -msgid "Convert a string ``s`` to a :c:expr:`double`, raising a Python exception on failure. The set of accepted strings corresponds to the set of strings accepted by Python's :func:`float` constructor, except that ``s`` must not have leading or trailing whitespace. The conversion is independent of the current locale." +#: ../../c-api/conversion.rst:89 +msgid "" +"Convert a string ``s`` to a :c:expr:`double`, raising a Python exception on " +"failure. The set of accepted strings corresponds to the set of strings " +"accepted by Python's :func:`float` constructor, except that ``s`` must not " +"have leading or trailing whitespace. The conversion is independent of the " +"current locale." msgstr "" -msgid "If ``endptr`` is ``NULL``, convert the whole string. Raise :exc:`ValueError` and return ``-1.0`` if the string is not a valid representation of a floating-point number." +#: ../../c-api/conversion.rst:95 +msgid "" +"If ``endptr`` is ``NULL``, convert the whole string. " +"Raise :exc:`ValueError` and return ``-1.0`` if the string is not a valid " +"representation of a floating-point number." msgstr "" -msgid "If endptr is not ``NULL``, convert as much of the string as possible and set ``*endptr`` to point to the first unconverted character. If no initial segment of the string is the valid representation of a floating-point number, set ``*endptr`` to point to the beginning of the string, raise ValueError, and return ``-1.0``." +#: ../../c-api/conversion.rst:99 +msgid "" +"If endptr is not ``NULL``, convert as much of the string as possible and set " +"``*endptr`` to point to the first unconverted character. If no initial " +"segment of the string is the valid representation of a floating-point " +"number, set ``*endptr`` to point to the beginning of the string, raise " +"ValueError, and return ``-1.0``." msgstr "" -msgid "If ``s`` represents a value that is too large to store in a float (for example, ``\"1e500\"`` is such a string on many platforms) then if ``overflow_exception`` is ``NULL`` return ``Py_INFINITY`` (with an appropriate sign) and don't set any exception. Otherwise, ``overflow_exception`` must point to a Python exception object; raise that exception and return ``-1.0``. In both cases, set ``*endptr`` to point to the first character after the converted value." +#: ../../c-api/conversion.rst:106 +msgid "" +"If ``s`` represents a value that is too large to store in a float (for " +"example, ``\"1e500\"`` is such a string on many platforms) then if " +"``overflow_exception`` is ``NULL`` return ``Py_INFINITY`` (with an " +"appropriate sign) and don't set any exception. Otherwise, " +"``overflow_exception`` must point to a Python exception object; raise that " +"exception and return ``-1.0``. In both cases, set ``*endptr`` to point to " +"the first character after the converted value." msgstr "" -msgid "If any other error occurs during the conversion (for example an out-of-memory error), set the appropriate Python exception and return ``-1.0``." +#: ../../c-api/conversion.rst:114 +msgid "" +"If any other error occurs during the conversion (for example an out-of-" +"memory error), set the appropriate Python exception and return ``-1.0``." msgstr "" -msgid "Convert a :c:expr:`double` *val* to a string using supplied *format_code*, *precision*, and *flags*." +#: ../../c-api/conversion.rst:123 +msgid "" +"Convert a :c:expr:`double` *val* to a string using supplied *format_code*, " +"*precision*, and *flags*." msgstr "" -msgid "*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or ``'r'``. For ``'r'``, the supplied *precision* must be 0 and is ignored. The ``'r'`` format code specifies the standard :func:`repr` format." +#: ../../c-api/conversion.rst:126 +msgid "" +"*format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, " +"``'G'`` or ``'r'``. For ``'r'``, the supplied *precision* must be 0 and is " +"ignored. The ``'r'`` format code specifies the standard :func:`repr` format." msgstr "" +#: ../../c-api/conversion.rst:131 msgid "*flags* can be zero or more of the following values or-ed together:" msgstr "" -msgid "Always precede the returned string with a sign character, even if *val* is non-negative." +#: ../../c-api/conversion.rst:137 +msgid "" +"Always precede the returned string with a sign character, even if *val* is " +"non-negative." msgstr "" +#: ../../c-api/conversion.rst:142 msgid "Ensure that the returned string will not look like an integer." msgstr "" -msgid "Apply \"alternate\" formatting rules. See the documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for details." +#: ../../c-api/conversion.rst:146 +msgid "" +"Apply \"alternate\" formatting rules. See the documentation for " +"the :c:func:`PyOS_snprintf` ``'#'`` specifier for details." msgstr "" +#: ../../c-api/conversion.rst:152 msgid "Negative zero is converted to positive zero." msgstr "" -msgid "If *ptype* is non-``NULL``, then the value it points to will be set to one of the following constants depending on the type of *val*:" +#: ../../c-api/conversion.rst:156 +msgid "" +"If *ptype* is non-``NULL``, then the value it points to will be set to one " +"of the following constants depending on the type of *val*:" msgstr "" +#: ../../c-api/conversion.rst:163 msgid "*\\*ptype*" msgstr "" +#: ../../c-api/conversion.rst:164 msgid "type of *val*" msgstr "" +#: ../../c-api/conversion.rst:166 msgid "finite number" msgstr "" +#: ../../c-api/conversion.rst:168 msgid "infinite number" msgstr "" +#: ../../c-api/conversion.rst:170 msgid "not a number" msgstr "" -msgid "The return value is a pointer to *buffer* with the converted string or ``NULL`` if the conversion failed. The caller is responsible for freeing the returned string by calling :c:func:`PyMem_Free`." +#: ../../c-api/conversion.rst:172 +msgid "" +"The return value is a pointer to *buffer* with the converted string or " +"``NULL`` if the conversion failed. The caller is responsible for freeing the " +"returned string by calling :c:func:`PyMem_Free`." msgstr "" -msgid "Case insensitive comparison of strings. These functions work almost identically to :c:func:`!strcmp` and :c:func:`!strncmp` (respectively), except that they ignore the case of ASCII characters." +#: ../../c-api/conversion.rst:182 +msgid "" +"Case insensitive comparison of strings. These functions work almost " +"identically to :c:func:`!strcmp` and :c:func:`!strncmp` (respectively), " +"except that they ignore the case of ASCII characters." msgstr "" -msgid "Return ``0`` if the strings are equal, a negative value if *str1* sorts lexicographically before *str2*, or a positive value if it sorts after." +#: ../../c-api/conversion.rst:186 +msgid "" +"Return ``0`` if the strings are equal, a negative value if *str1* sorts " +"lexicographically before *str2*, or a positive value if it sorts after." msgstr "" -msgid "In the *str1* or *str2* arguments, a NUL byte marks the end of the string. For :c:func:`!PyOS_mystrnicmp`, the *size* argument gives the maximum size of the string, as if NUL was present at the index given by *size*." +#: ../../c-api/conversion.rst:189 +msgid "" +"In the *str1* or *str2* arguments, a NUL byte marks the end of the string. " +"For :c:func:`!PyOS_mystrnicmp`, the *size* argument gives the maximum size " +"of the string, as if NUL was present at the index given by *size*." msgstr "" +#: ../../c-api/conversion.rst:193 msgid "These functions do not use the locale." msgstr "" +#: ../../c-api/conversion.rst:199 msgid "Case insensitive comparison of strings." msgstr "" -msgid "On Windows, these are aliases of :c:func:`!stricmp` and :c:func:`!strnicmp`, respectively." +#: ../../c-api/conversion.rst:201 +msgid "" +"On Windows, these are aliases of :c:func:`!stricmp` and :c:func:`!strnicmp`, " +"respectively." msgstr "" -msgid "On other platforms, they are aliases of :c:func:`PyOS_mystricmp` and :c:func:`PyOS_mystrnicmp`, respectively." +#: ../../c-api/conversion.rst:204 +msgid "" +"On other platforms, they are aliases of :c:func:`PyOS_mystricmp` " +"and :c:func:`PyOS_mystrnicmp`, respectively." msgstr "" +#: ../../c-api/conversion.rst:209 msgid "Character classification and conversion" msgstr "" -msgid "The following macros provide locale-independent (unlike the C standard library ``ctype.h``) character classification and conversion. The argument must be a signed or unsigned :c:expr:`char`." +#: ../../c-api/conversion.rst:211 +msgid "" +"The following macros provide locale-independent (unlike the C standard " +"library ``ctype.h``) character classification and conversion. The argument " +"must be a signed or unsigned :c:expr:`char`." msgstr "" +#: ../../c-api/conversion.rst:218 msgid "Return true if the character *c* is an alphanumeric character." msgstr "" -msgid "Return true if the character *c* is an alphabetic character (``a-z`` and ``A-Z``)." +#: ../../c-api/conversion.rst:223 +msgid "" +"Return true if the character *c* is an alphabetic character (``a-z`` and ``A-" +"Z``)." msgstr "" +#: ../../c-api/conversion.rst:228 msgid "Return true if the character *c* is a decimal digit (``0-9``)." msgstr "" +#: ../../c-api/conversion.rst:233 msgid "Return true if the character *c* is a lowercase ASCII letter (``a-z``)." msgstr "" -msgid "Return true if the character *c* is an uppercase ASCII letter (``A-Z``)." +#: ../../c-api/conversion.rst:238 +msgid "" +"Return true if the character *c* is an uppercase ASCII letter (``A-Z``)." msgstr "" -msgid "Return true if the character *c* is a whitespace character (space, tab, carriage return, newline, vertical tab, or form feed)." +#: ../../c-api/conversion.rst:243 +msgid "" +"Return true if the character *c* is a whitespace character (space, tab, " +"carriage return, newline, vertical tab, or form feed)." msgstr "" -msgid "Return true if the character *c* is a hexadecimal digit (``0-9``, ``a-f``, and ``A-F``)." +#: ../../c-api/conversion.rst:249 +msgid "" +"Return true if the character *c* is a hexadecimal digit (``0-9``, ``a-f``, " +"and ``A-F``)." msgstr "" +#: ../../c-api/conversion.rst:255 msgid "Return the lowercase equivalent of the character *c*." msgstr "" +#: ../../c-api/conversion.rst:260 msgid "Return the uppercase equivalent of the character *c*." msgstr "" diff --git a/c-api/coro.po b/c-api/coro.po index 1290c85c3..d8d7fb734 100644 --- a/c-api/coro.po +++ b/c-api/coro.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,20 +23,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/coro.rst:6 msgid "Coroutine Objects" msgstr "" -msgid "Coroutine objects are what functions declared with an ``async`` keyword return." +#: ../../c-api/coro.rst:10 +msgid "" +"Coroutine objects are what functions declared with an ``async`` keyword " +"return." msgstr "" +#: ../../c-api/coro.rst:16 msgid "The C structure used for coroutine objects." msgstr "" +#: ../../c-api/coro.rst:21 msgid "The type object corresponding to coroutine objects." msgstr "" -msgid "Return true if *ob*'s type is :c:type:`PyCoro_Type`; *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/coro.rst:26 +msgid "" +"Return true if *ob*'s type is :c:type:`PyCoro_Type`; *ob* must not be " +"``NULL``. This function always succeeds." msgstr "" -msgid "Create and return a new coroutine object based on the *frame* object, with ``__name__`` and ``__qualname__`` set to *name* and *qualname*. A reference to *frame* is stolen by this function. The *frame* argument must not be ``NULL``." +#: ../../c-api/coro.rst:32 +msgid "" +"Create and return a new coroutine object based on the *frame* object, with " +"``__name__`` and ``__qualname__`` set to *name* and *qualname*. A reference " +"to *frame* is stolen by this function. The *frame* argument must not be " +"``NULL``." msgstr "" diff --git a/c-api/curses.po b/c-api/curses.po index ece122d41..57cab6354 100644 --- a/c-api/curses.po +++ b/c-api/curses.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,65 +19,116 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/curses.rst:4 msgid "Curses C API" msgstr "" -msgid ":mod:`curses` exposes a small C interface for extension modules. Consumers must include the header file :file:`py_curses.h` (which is not included by default by :file:`Python.h`) and :c:func:`import_curses` must be invoked, usually as part of the module initialisation function, to populate :c:var:`PyCurses_API`." +#: ../../c-api/curses.rst:6 +msgid "" +":mod:`curses` exposes a small C interface for extension modules. Consumers " +"must include the header file :file:`py_curses.h` (which is not included by " +"default by :file:`Python.h`) and :c:func:`import_curses` must be invoked, " +"usually as part of the module initialisation function, to " +"populate :c:var:`PyCurses_API`." msgstr "" -msgid "Neither the C API nor the pure Python :mod:`curses` module are compatible with subinterpreters." +#: ../../c-api/curses.rst:14 +msgid "" +"Neither the C API nor the pure Python :mod:`curses` module are compatible " +"with subinterpreters." msgstr "" -msgid "Import the curses C API. The macro does not need a semi-colon to be called." +#: ../../c-api/curses.rst:19 +msgid "" +"Import the curses C API. The macro does not need a semi-colon to be called." msgstr "" +#: ../../c-api/curses.rst:21 msgid "On success, populate the :c:var:`PyCurses_API` pointer." msgstr "" -msgid "On failure, set :c:var:`PyCurses_API` to NULL and set an exception. The caller must check if an error occurred via :c:func:`PyErr_Occurred`:" +#: ../../c-api/curses.rst:23 +msgid "" +"On failure, set :c:var:`PyCurses_API` to NULL and set an exception. The " +"caller must check if an error occurred via :c:func:`PyErr_Occurred`:" msgstr "" +#: ../../c-api/curses.rst:26 msgid "" "import_curses(); // semi-colon is optional but recommended\n" "if (PyErr_Occurred()) { /* cleanup */ }" msgstr "" -msgid "Dynamically allocated object containing the curses C API. This variable is only available once :c:macro:`import_curses` succeeds." +#: ../../c-api/curses.rst:34 +msgid "" +"Dynamically allocated object containing the curses C API. This variable is " +"only available once :c:macro:`import_curses` succeeds." msgstr "" +#: ../../c-api/curses.rst:37 msgid "``PyCurses_API[0]`` corresponds to :c:data:`PyCursesWindow_Type`." msgstr "" -msgid "``PyCurses_API[1]``, ``PyCurses_API[2]``, and ``PyCurses_API[3]`` are pointers to predicate functions of type ``int (*)(void)``." +#: ../../c-api/curses.rst:39 +msgid "" +"``PyCurses_API[1]``, ``PyCurses_API[2]``, and ``PyCurses_API[3]`` are " +"pointers to predicate functions of type ``int (*)(void)``." msgstr "" -msgid "When called, these predicates return whether :func:`curses.setupterm`, :func:`curses.initscr`, and :func:`curses.start_color` have been called respectively." +#: ../../c-api/curses.rst:42 +msgid "" +"When called, these predicates return " +"whether :func:`curses.setupterm`, :func:`curses.initscr`, " +"and :func:`curses.start_color` have been called respectively." msgstr "" -msgid "See also the convenience macros :c:macro:`PyCursesSetupTermCalled`, :c:macro:`PyCursesInitialised`, and :c:macro:`PyCursesInitialisedColor`." +#: ../../c-api/curses.rst:46 +msgid "" +"See also the convenience " +"macros :c:macro:`PyCursesSetupTermCalled`, :c:macro:`PyCursesInitialised`, " +"and :c:macro:`PyCursesInitialisedColor`." msgstr "" -msgid "The number of entries in this structure is subject to changes. Consider using :c:macro:`PyCurses_API_pointers` to check if new fields are available or not." +#: ../../c-api/curses.rst:51 +msgid "" +"The number of entries in this structure is subject to changes. Consider " +"using :c:macro:`PyCurses_API_pointers` to check if new fields are available " +"or not." msgstr "" -msgid "The number of accessible fields (``4``) in :c:var:`PyCurses_API`. This number is incremented whenever new fields are added." +#: ../../c-api/curses.rst:58 +msgid "" +"The number of accessible fields (``4``) in :c:var:`PyCurses_API`. This " +"number is incremented whenever new fields are added." msgstr "" -msgid "The :ref:`heap type ` corresponding to :class:`curses.window`." +#: ../../c-api/curses.rst:64 +msgid "" +"The :ref:`heap type ` corresponding to :class:`curses.window`." msgstr "" -msgid "Return true if *op* is a :class:`curses.window` instance, false otherwise." +#: ../../c-api/curses.rst:69 +msgid "" +"Return true if *op* is a :class:`curses.window` instance, false otherwise." msgstr "" -msgid "The following macros are convenience macros expanding into C statements. In particular, they can only be used as ``macro;`` or ``macro``, but not ``macro()`` or ``macro();``." +#: ../../c-api/curses.rst:72 +msgid "" +"The following macros are convenience macros expanding into C statements. In " +"particular, they can only be used as ``macro;`` or ``macro``, but not " +"``macro()`` or ``macro();``." msgstr "" +#: ../../c-api/curses.rst:78 msgid "Macro checking if :func:`curses.setupterm` has been called." msgstr "" +#: ../../c-api/curses.rst:80 ../../c-api/curses.rst:97 +#: ../../c-api/curses.rst:114 msgid "The macro expansion is roughly equivalent to:" msgstr "" +#: ../../c-api/curses.rst:82 msgid "" "{\n" " typedef int (*predicate_t)(void);\n" @@ -88,9 +139,11 @@ msgid "" "}" msgstr "" +#: ../../c-api/curses.rst:95 msgid "Macro checking if :func:`curses.initscr` has been called." msgstr "" +#: ../../c-api/curses.rst:99 msgid "" "{\n" " typedef int (*predicate_t)(void);\n" @@ -101,9 +154,11 @@ msgid "" "}" msgstr "" +#: ../../c-api/curses.rst:112 msgid "Macro checking if :func:`curses.start_color` has been called." msgstr "" +#: ../../c-api/curses.rst:116 msgid "" "{\n" " typedef int (*predicate_t)(void);\n" @@ -114,14 +169,20 @@ msgid "" "}" msgstr "" +#: ../../c-api/curses.rst:128 msgid "Internal data" msgstr "" -msgid "The following objects are exposed by the C API but should be considered internal-only." +#: ../../c-api/curses.rst:130 +msgid "" +"The following objects are exposed by the C API but should be considered " +"internal-only." msgstr "" +#: ../../c-api/curses.rst:135 msgid "Name of the curses capsule to pass to :c:func:`PyCapsule_Import`." msgstr "" +#: ../../c-api/curses.rst:137 msgid "Internal usage only. Use :c:macro:`import_curses` instead." msgstr "" diff --git a/c-api/datetime.po b/c-api/datetime.po index 3841a7423..bae9a8dc0 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,199 +23,352 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/datetime.rst:6 msgid "DateTime Objects" msgstr "" -msgid "Various date and time objects are supplied by the :mod:`datetime` module. Before using any of these functions, the header file :file:`datetime.h` must be included in your source (note that this is not included by :file:`Python.h`), and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of the module initialisation function. The macro puts a pointer to a C structure into a static variable, :c:data:`PyDateTimeAPI`, that is used by the following macros." +#: ../../c-api/datetime.rst:8 +msgid "" +"Various date and time objects are supplied by the :mod:`datetime` module. " +"Before using any of these functions, the header file :file:`datetime.h` must " +"be included in your source (note that this is not included " +"by :file:`Python.h`), and the macro :c:macro:`PyDateTime_IMPORT` must be " +"invoked, usually as part of the module initialisation function. The macro " +"puts a pointer to a C structure into a static " +"variable, :c:data:`PyDateTimeAPI`, that is used by the following macros." msgstr "" +#: ../../c-api/datetime.rst:18 msgid "Import the datetime C API." msgstr "" -msgid "On success, populate the :c:var:`PyDateTimeAPI` pointer. On failure, set :c:var:`PyDateTimeAPI` to ``NULL`` and set an exception. The caller must check if an error occurred via :c:func:`PyErr_Occurred`:" +#: ../../c-api/datetime.rst:20 +msgid "" +"On success, populate the :c:var:`PyDateTimeAPI` pointer. On failure, " +"set :c:var:`PyDateTimeAPI` to ``NULL`` and set an exception. The caller must " +"check if an error occurred via :c:func:`PyErr_Occurred`:" msgstr "" +#: ../../c-api/datetime.rst:24 msgid "" "PyDateTime_IMPORT;\n" "if (PyErr_Occurred()) { /* cleanup */ }" msgstr "" +#: ../../c-api/datetime.rst:31 msgid "This is not compatible with subinterpreters." msgstr "" +#: ../../c-api/datetime.rst:35 msgid "Structure containing the fields for the datetime C API." msgstr "" +#: ../../c-api/datetime.rst:37 msgid "The fields of this structure are private and subject to change." msgstr "" +#: ../../c-api/datetime.rst:39 msgid "Do not use this directly; prefer ``PyDateTime_*`` APIs instead." msgstr "" +#: ../../c-api/datetime.rst:43 msgid "Dynamically allocated object containing the datetime C API." msgstr "" -msgid "This variable is only available once :c:macro:`PyDateTime_IMPORT` succeeds." +#: ../../c-api/datetime.rst:45 +msgid "" +"This variable is only available once :c:macro:`PyDateTime_IMPORT` succeeds." msgstr "" +#: ../../c-api/datetime.rst:49 msgid "This subtype of :c:type:`PyObject` represents a Python date object." msgstr "" +#: ../../c-api/datetime.rst:53 msgid "This subtype of :c:type:`PyObject` represents a Python datetime object." msgstr "" +#: ../../c-api/datetime.rst:57 msgid "This subtype of :c:type:`PyObject` represents a Python time object." msgstr "" -msgid "This subtype of :c:type:`PyObject` represents the difference between two datetime values." +#: ../../c-api/datetime.rst:61 +msgid "" +"This subtype of :c:type:`PyObject` represents the difference between two " +"datetime values." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python date type; it is the same object as :class:`datetime.date` in the Python layer." +#: ../../c-api/datetime.rst:65 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python date type; it " +"is the same object as :class:`datetime.date` in the Python layer." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python datetime type; it is the same object as :class:`datetime.datetime` in the Python layer." +#: ../../c-api/datetime.rst:70 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python datetime type; " +"it is the same object as :class:`datetime.datetime` in the Python layer." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python time type; it is the same object as :class:`datetime.time` in the Python layer." +#: ../../c-api/datetime.rst:75 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python time type; it " +"is the same object as :class:`datetime.time` in the Python layer." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python type for the difference between two datetime values; it is the same object as :class:`datetime.timedelta` in the Python layer." +#: ../../c-api/datetime.rst:80 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python type for the " +"difference between two datetime values; it is the same object " +"as :class:`datetime.timedelta` in the Python layer." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python time zone info type; it is the same object as :class:`datetime.tzinfo` in the Python layer." +#: ../../c-api/datetime.rst:86 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python time zone info " +"type; it is the same object as :class:`datetime.tzinfo` in the Python layer." msgstr "" +#: ../../c-api/datetime.rst:90 msgid "Macro for access to the UTC singleton:" msgstr "" -msgid "Returns the time zone singleton representing UTC, the same object as :attr:`datetime.timezone.utc`." +#: ../../c-api/datetime.rst:94 +msgid "" +"Returns the time zone singleton representing UTC, the same object " +"as :attr:`datetime.timezone.utc`." msgstr "" +#: ../../c-api/datetime.rst:100 msgid "Type-check macros:" msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype of :c:data:`!PyDateTime_DateType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:104 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype " +"of :c:data:`!PyDateTime_DateType`. *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:111 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not " +"be ``NULL``. This function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a subtype of :c:data:`!PyDateTime_DateTimeType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:117 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a " +"subtype of :c:data:`!PyDateTime_DateTimeType`. *ob* must not be ``NULL``. " +"This function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:124 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must " +"not be ``NULL``. This function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype of :c:data:`!PyDateTime_TimeType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:130 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype " +"of :c:data:`!PyDateTime_TimeType`. *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:137 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not " +"be ``NULL``. This function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype of :c:data:`!PyDateTime_DeltaType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:143 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype " +"of :c:data:`!PyDateTime_DeltaType`. *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:150 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not " +"be ``NULL``. This function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype of :c:data:`!PyDateTime_TZInfoType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:156 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype " +"of :c:data:`!PyDateTime_TZInfoType`. *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/datetime.rst:163 +msgid "" +"Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must " +"not be ``NULL``. This function always succeeds." msgstr "" +#: ../../c-api/datetime.rst:167 msgid "Macros to create objects:" msgstr "" -msgid "Return a :class:`datetime.date` object with the specified year, month and day." +#: ../../c-api/datetime.rst:171 +msgid "" +"Return a :class:`datetime.date` object with the specified year, month and " +"day." msgstr "" -msgid "Return a :class:`datetime.datetime` object with the specified year, month, day, hour, minute, second and microsecond." +#: ../../c-api/datetime.rst:176 +msgid "" +"Return a :class:`datetime.datetime` object with the specified year, month, " +"day, hour, minute, second and microsecond." msgstr "" -msgid "Return a :class:`datetime.datetime` object with the specified year, month, day, hour, minute, second, microsecond and fold." +#: ../../c-api/datetime.rst:182 +msgid "" +"Return a :class:`datetime.datetime` object with the specified year, month, " +"day, hour, minute, second, microsecond and fold." msgstr "" -msgid "Return a :class:`datetime.time` object with the specified hour, minute, second and microsecond." +#: ../../c-api/datetime.rst:190 +msgid "" +"Return a :class:`datetime.time` object with the specified hour, minute, " +"second and microsecond." msgstr "" -msgid "Return a :class:`datetime.time` object with the specified hour, minute, second, microsecond and fold." +#: ../../c-api/datetime.rst:196 +msgid "" +"Return a :class:`datetime.time` object with the specified hour, minute, " +"second, microsecond and fold." msgstr "" -msgid "Return a :class:`datetime.timedelta` object representing the given number of days, seconds and microseconds. Normalization is performed so that the resulting number of microseconds and seconds lie in the ranges documented for :class:`datetime.timedelta` objects." +#: ../../c-api/datetime.rst:204 +msgid "" +"Return a :class:`datetime.timedelta` object representing the given number of " +"days, seconds and microseconds. Normalization is performed so that the " +"resulting number of microseconds and seconds lie in the ranges documented " +"for :class:`datetime.timedelta` objects." msgstr "" -msgid "Return a :class:`datetime.timezone` object with an unnamed fixed offset represented by the *offset* argument." +#: ../../c-api/datetime.rst:212 +msgid "" +"Return a :class:`datetime.timezone` object with an unnamed fixed offset " +"represented by the *offset* argument." msgstr "" -msgid "Return a :class:`datetime.timezone` object with a fixed offset represented by the *offset* argument and with tzname *name*." +#: ../../c-api/datetime.rst:220 +msgid "" +"Return a :class:`datetime.timezone` object with a fixed offset represented " +"by the *offset* argument and with tzname *name*." msgstr "" -msgid "Macros to extract fields from date objects. The argument must be an instance of :c:type:`PyDateTime_Date`, including subclasses (such as :c:type:`PyDateTime_DateTime`). The argument must not be ``NULL``, and the type is not checked:" +#: ../../c-api/datetime.rst:226 +msgid "" +"Macros to extract fields from date objects. The argument must be an " +"instance of :c:type:`PyDateTime_Date`, including subclasses (such " +"as :c:type:`PyDateTime_DateTime`). The argument must not be ``NULL``, and " +"the type is not checked:" msgstr "" +#: ../../c-api/datetime.rst:233 msgid "Return the year, as a positive int." msgstr "" +#: ../../c-api/datetime.rst:238 msgid "Return the month, as an int from 1 through 12." msgstr "" +#: ../../c-api/datetime.rst:243 msgid "Return the day, as an int from 1 through 31." msgstr "" -msgid "Macros to extract fields from datetime objects. The argument must be an instance of :c:type:`PyDateTime_DateTime`, including subclasses. The argument must not be ``NULL``, and the type is not checked:" +#: ../../c-api/datetime.rst:246 +msgid "" +"Macros to extract fields from datetime objects. The argument must be an " +"instance of :c:type:`PyDateTime_DateTime`, including subclasses. The " +"argument must not be ``NULL``, and the type is not checked:" msgstr "" +#: ../../c-api/datetime.rst:252 ../../c-api/datetime.rst:290 msgid "Return the hour, as an int from 0 through 23." msgstr "" +#: ../../c-api/datetime.rst:257 ../../c-api/datetime.rst:295 msgid "Return the minute, as an int from 0 through 59." msgstr "" +#: ../../c-api/datetime.rst:262 ../../c-api/datetime.rst:300 msgid "Return the second, as an int from 0 through 59." msgstr "" +#: ../../c-api/datetime.rst:267 ../../c-api/datetime.rst:305 msgid "Return the microsecond, as an int from 0 through 999999." msgstr "" +#: ../../c-api/datetime.rst:272 ../../c-api/datetime.rst:310 msgid "Return the fold, as an int from 0 through 1." msgstr "" +#: ../../c-api/datetime.rst:279 ../../c-api/datetime.rst:317 msgid "Return the tzinfo (which may be ``None``)." msgstr "" -msgid "Macros to extract fields from time objects. The argument must be an instance of :c:type:`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``, and the type is not checked:" +#: ../../c-api/datetime.rst:284 +msgid "" +"Macros to extract fields from time objects. The argument must be an " +"instance of :c:type:`PyDateTime_Time`, including subclasses. The argument " +"must not be ``NULL``, and the type is not checked:" msgstr "" -msgid "Macros to extract fields from time delta objects. The argument must be an instance of :c:type:`PyDateTime_Delta`, including subclasses. The argument must not be ``NULL``, and the type is not checked:" +#: ../../c-api/datetime.rst:322 +msgid "" +"Macros to extract fields from time delta objects. The argument must be an " +"instance of :c:type:`PyDateTime_Delta`, including subclasses. The argument " +"must not be ``NULL``, and the type is not checked:" msgstr "" +#: ../../c-api/datetime.rst:328 msgid "Return the number of days, as an int from -999999999 to 999999999." msgstr "" +#: ../../c-api/datetime.rst:335 msgid "Return the number of seconds, as an int from 0 through 86399." msgstr "" +#: ../../c-api/datetime.rst:342 msgid "Return the number of microseconds, as an int from 0 through 999999." msgstr "" +#: ../../c-api/datetime.rst:347 msgid "Macros for the convenience of modules implementing the DB API:" msgstr "" -msgid "Create and return a new :class:`datetime.datetime` object given an argument tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp`." +#: ../../c-api/datetime.rst:351 +msgid "" +"Create and return a new :class:`datetime.datetime` object given an argument " +"tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp`." msgstr "" -msgid "Create and return a new :class:`datetime.date` object given an argument tuple suitable for passing to :meth:`datetime.date.fromtimestamp`." +#: ../../c-api/datetime.rst:357 +msgid "" +"Create and return a new :class:`datetime.date` object given an argument " +"tuple suitable for passing to :meth:`datetime.date.fromtimestamp`." msgstr "" +#: ../../c-api/datetime.rst:362 msgid "Internal data" msgstr "" -msgid "The following symbols are exposed by the C API but should be considered internal-only." +#: ../../c-api/datetime.rst:364 +msgid "" +"The following symbols are exposed by the C API but should be considered " +"internal-only." msgstr "" +#: ../../c-api/datetime.rst:369 msgid "Name of the datetime capsule to pass to :c:func:`PyCapsule_Import`." msgstr "" +#: ../../c-api/datetime.rst:371 msgid "Internal usage only. Use :c:macro:`PyDateTime_IMPORT` instead." msgstr "" diff --git a/c-api/descriptor.po b/c-api/descriptor.po index f73f9dc02..b2938bac3 100644 --- a/c-api/descriptor.po +++ b/c-api/descriptor.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,53 +23,223 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/descriptor.rst:6 msgid "Descriptor Objects" msgstr "" -msgid "\"Descriptors\" are objects that describe some attribute of an object. They are found in the dictionary of type objects." +#: ../../c-api/descriptor.rst:8 +msgid "" +"\"Descriptors\" are objects that describe some attribute of an object. They " +"are found in the dictionary of type objects." msgstr "" +#: ../../c-api/descriptor.rst:13 msgid "The type object for the built-in descriptor types." msgstr "" -msgid "The type object for member descriptor objects created from :c:type:`PyMemberDef` structures. These descriptors expose fields of a C struct as attributes on a type, and correspond to :class:`types.MemberDescriptorType` objects in Python." +#: ../../c-api/descriptor.rst:18 +msgid "" +"Create a new get-set descriptor for extension type *type* from " +"the :c:type:`PyGetSetDef` structure *getset*." +msgstr "" + +#: ../../c-api/descriptor.rst:21 +msgid "" +"Get-set descriptors expose attributes implemented by C getter and setter " +"functions rather than stored directly in the instance. This is the same kind " +"of descriptor created for entries in :c:member:`~PyTypeObject.tp_getset`, " +"and it appears in Python as a :class:`types.GetSetDescriptorType` object." +msgstr "" + +#: ../../c-api/descriptor.rst:26 ../../c-api/descriptor.rst:39 +#: ../../c-api/descriptor.rst:70 ../../c-api/descriptor.rst:101 +#: ../../c-api/descriptor.rst:123 +msgid "" +"On success, return a :term:`strong reference` to the descriptor. Return " +"``NULL`` with an exception set on failure." +msgstr "" + +#: ../../c-api/descriptor.rst:31 +msgid "" +"Create a new member descriptor for extension type *type* from " +"the :c:type:`PyMemberDef` structure *member*." msgstr "" -msgid "The type object for get/set descriptor objects created from :c:type:`PyGetSetDef` structures. These descriptors implement attributes whose value is computed by C getter and setter functions, and are used for many built-in type attributes." +#: ../../c-api/descriptor.rst:34 +msgid "" +"Member descriptors expose fields in the type's C struct as Python " +"attributes. This is the same kind of descriptor created for entries " +"in :c:member:`~PyTypeObject.tp_members`, and it appears in Python as " +"a :class:`types.MemberDescriptorType` object." msgstr "" -msgid "The type object for method descriptor objects created from :c:type:`PyMethodDef` structures. These descriptors expose C functions as methods on a type, and correspond to :class:`types.MemberDescriptorType` objects in Python." +#: ../../c-api/descriptor.rst:44 +msgid "" +"The type object for member descriptor objects created " +"from :c:type:`PyMemberDef` structures. These descriptors expose fields of a " +"C struct as attributes on a type, and correspond " +"to :class:`types.MemberDescriptorType` objects in Python." msgstr "" -msgid "The type object for wrapper descriptor objects created by :c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper descriptors are used internally to expose special methods implemented via wrapper structures, and appear in Python as :class:`types.WrapperDescriptorType` objects." +#: ../../c-api/descriptor.rst:53 +msgid "" +"The type object for get/set descriptor objects created " +"from :c:type:`PyGetSetDef` structures. These descriptors implement " +"attributes whose value is computed by C getter and setter functions, and are " +"used for many built-in type attributes. They correspond " +"to :class:`types.GetSetDescriptorType` objects in Python." msgstr "" -msgid "Return non-zero if the descriptor object *descr* describes a data attribute, or ``0`` if it describes a method. *descr* must be a descriptor object; there is no error checking." +#: ../../c-api/descriptor.rst:62 +msgid "" +"Create a new method descriptor for extension type *type* from " +"the :c:type:`PyMethodDef` structure *meth*." msgstr "" +#: ../../c-api/descriptor.rst:65 +msgid "" +"Method descriptors expose C functions as methods on a type. This is the same " +"kind of descriptor created for entries " +"in :c:member:`~PyTypeObject.tp_methods`, and it appears in Python as " +"a :class:`types.MethodDescriptorType` object." +msgstr "" + +#: ../../c-api/descriptor.rst:75 +msgid "" +"The type object for method descriptor objects created " +"from :c:type:`PyMethodDef` structures. These descriptors expose C functions " +"as methods on a type, and correspond to :class:`types.MethodDescriptorType` " +"objects in Python." +msgstr "" + +#: ../../c-api/descriptor.rst:83 +msgid "Describes a slot wrapper used by :c:func:`PyDescr_NewWrapper`." +msgstr "" + +#: ../../c-api/descriptor.rst:85 +msgid "" +"Each ``wrapperbase`` record stores the Python-visible name and metadata for " +"a special method implemented by a type slot, together with the wrapper " +"function used to adapt that slot to Python's calling convention." +msgstr "" + +#: ../../c-api/descriptor.rst:91 +msgid "" +"Create a new wrapper descriptor for extension type *type* from " +"the :c:struct:`wrapperbase` structure *base* and the wrapped slot function " +"pointer *wrapped*." +msgstr "" + +#: ../../c-api/descriptor.rst:96 +msgid "" +"Wrapper descriptors expose special methods implemented by type slots. This " +"is the same kind of descriptor that CPython creates for slot-based special " +"methods such as ``__repr__`` or ``__add__``, and it appears in Python as " +"a :class:`types.WrapperDescriptorType` object." +msgstr "" + +#: ../../c-api/descriptor.rst:106 +msgid "" +"The type object for wrapper descriptor objects created " +"by :c:func:`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper " +"descriptors are used internally to expose special methods implemented via " +"wrapper structures, and appear in Python " +"as :class:`types.WrapperDescriptorType` objects." +msgstr "" + +#: ../../c-api/descriptor.rst:115 +msgid "" +"Create a new class method descriptor for extension type *type* from " +"the :c:type:`PyMethodDef` structure *method*." +msgstr "" + +#: ../../c-api/descriptor.rst:118 +msgid "" +"Class method descriptors expose C methods that receive the class rather than " +"an instance when accessed. This is the same kind of descriptor created for " +"``METH_CLASS`` entries in :c:member:`~PyTypeObject.tp_methods`, and it " +"appears in Python as a :class:`types.ClassMethodDescriptorType` object." +msgstr "" + +#: ../../c-api/descriptor.rst:128 +msgid "" +"Return non-zero if the descriptor object *descr* describes a data attribute, " +"or ``0`` if it describes a method. *descr* must be a descriptor object; " +"there is no error checking." +msgstr "" + +#: ../../c-api/descriptor.rst:135 +msgid "" +"Create a new bound wrapper object from the wrapper descriptor *d* and the " +"instance *self*." +msgstr "" + +#: ../../c-api/descriptor.rst:138 +msgid "" +"This is the bound form of a wrapper descriptor created " +"by :c:func:`PyDescr_NewWrapper`. CPython creates these objects when a slot " +"wrapper is accessed through an instance, and they appear in Python " +"as :class:`types.MethodWrapperType` objects." +msgstr "" + +#: ../../c-api/descriptor.rst:143 +msgid "" +"On success, return a :term:`strong reference` to the wrapper object. Return " +"``NULL`` with an exception set on failure." +msgstr "" + +#: ../../c-api/descriptor.rst:147 msgid "Built-in descriptors" msgstr "" -msgid "The type object for super objects. This is the same object as :class:`super` in the Python layer." +#: ../../c-api/descriptor.rst:151 +msgid "" +"The type object for super objects. This is the same object as :class:`super` " +"in the Python layer." msgstr "" -msgid "The type of class method objects. This is the same object as :class:`classmethod` in the Python layer." +#: ../../c-api/descriptor.rst:157 +msgid "" +"The type of class method objects. This is the same object " +"as :class:`classmethod` in the Python layer." msgstr "" -msgid "The type object for C-level class method descriptor objects. This is the type of the descriptors created for :func:`classmethod` defined in C extension types, and is the same object as :class:`classmethod` in Python." +#: ../../c-api/descriptor.rst:163 +msgid "" +"The type object for C-level class method descriptor objects. This is the " +"type of the descriptors created for :func:`classmethod` defined in C " +"extension types, and corresponds to :class:`types.ClassMethodDescriptorType` " +"objects in Python." msgstr "" -msgid "Create a new :class:`classmethod` object wrapping *callable*. *callable* must be a callable object and must not be ``NULL``." +#: ../../c-api/descriptor.rst:171 +msgid "" +"Create a new :class:`classmethod` object wrapping *callable*. *callable* " +"must be a callable object and must not be ``NULL``." msgstr "" -msgid "On success, this function returns a :term:`strong reference` to a new class method descriptor. On failure, this function returns ``NULL`` with an exception set." +#: ../../c-api/descriptor.rst:174 +msgid "" +"On success, this function returns a :term:`strong reference` to a new class " +"method descriptor. On failure, this function returns ``NULL`` with an " +"exception set." msgstr "" -msgid "The type of static method objects. This is the same object as :class:`staticmethod` in the Python layer." +#: ../../c-api/descriptor.rst:181 +msgid "" +"The type of static method objects. This is the same object " +"as :class:`staticmethod` in the Python layer." msgstr "" -msgid "Create a new :class:`staticmethod` object wrapping *callable*. *callable* must be a callable object and must not be ``NULL``." +#: ../../c-api/descriptor.rst:187 +msgid "" +"Create a new :class:`staticmethod` object wrapping *callable*. *callable* " +"must be a callable object and must not be ``NULL``." msgstr "" -msgid "On success, this function returns a :term:`strong reference` to a new static method descriptor. On failure, this function returns ``NULL`` with an exception set." +#: ../../c-api/descriptor.rst:190 +msgid "" +"On success, this function returns a :term:`strong reference` to a new static " +"method descriptor. On failure, this function returns ``NULL`` with an " +"exception set." msgstr "" diff --git a/c-api/dict.po b/c-api/dict.po index 110f87749..6d60b0342 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,150 +24,324 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/dict.rst:6 msgid "Dictionary Objects" msgstr "اشیاء دیکشنری «Dictionary Objecte»" -msgid "This subtype of :c:type:`PyObject` represents a Python dictionary object." -msgstr "این زیرنوع «subtype» از :c:type:`PyObject` نمایانگر یک شیء دیکشنری پایتون است." +#: ../../c-api/dict.rst:13 +msgid "" +"This subtype of :c:type:`PyObject` represents a Python dictionary object." +msgstr "" +"این زیرنوع «subtype» از :c:type:`PyObject` نمایانگر یک شیء دیکشنری پایتون " +"است." -msgid "This instance of :c:type:`PyTypeObject` represents the Python dictionary type. This is the same object as :class:`dict` in the Python layer." +#: ../../c-api/dict.rst:18 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python dictionary " +"type. This is the same object as :class:`dict` in the Python layer." msgstr "" -msgid "Return true if *p* is a dict object or an instance of a subtype of the dict type. This function always succeeds." +#: ../../c-api/dict.rst:24 +msgid "" +"Return true if *p* is a dict object or an instance of a subtype of the dict " +"type. This function always succeeds." msgstr "" -msgid "Return true if *p* is a dict object, but not an instance of a subtype of the dict type. This function always succeeds." +#: ../../c-api/dict.rst:30 +msgid "" +"Return true if *p* is a dict object, but not an instance of a subtype of the " +"dict type. This function always succeeds." msgstr "" +#: ../../c-api/dict.rst:36 msgid "Return a new empty dictionary, or ``NULL`` on failure." msgstr "" -msgid "Return a :class:`types.MappingProxyType` object for a mapping which enforces read-only behavior. This is normally used to create a view to prevent modification of the dictionary for non-dynamic class types." +#: ../../c-api/dict.rst:41 +msgid "" +"Return a :class:`types.MappingProxyType` object for a mapping which enforces " +"read-only behavior. This is normally used to create a view to prevent " +"modification of the dictionary for non-dynamic class types." msgstr "" -msgid "The type object for mapping proxy objects created by :c:func:`PyDictProxy_New` and for the read-only ``__dict__`` attribute of many built-in types. A :c:type:`PyDictProxy_Type` instance provides a dynamic, read-only view of an underlying dictionary: changes to the underlying dictionary are reflected in the proxy, but the proxy itself does not support mutation operations. This corresponds to :class:`types.MappingProxyType` in Python." +#: ../../c-api/dict.rst:48 +msgid "" +"The type object for mapping proxy objects created " +"by :c:func:`PyDictProxy_New` and for the read-only ``__dict__`` attribute of " +"many built-in types. A :c:type:`PyDictProxy_Type` instance provides a " +"dynamic, read-only view of an underlying dictionary: changes to the " +"underlying dictionary are reflected in the proxy, but the proxy itself does " +"not support mutation operations. This corresponds " +"to :class:`types.MappingProxyType` in Python." msgstr "" +#: ../../c-api/dict.rst:59 msgid "Empty an existing dictionary of all key-value pairs." msgstr "" -msgid "Determine if dictionary *p* contains *key*. If an item in *p* matches *key*, return ``1``, otherwise return ``0``. On error, return ``-1``. This is equivalent to the Python expression ``key in p``." +#: ../../c-api/dict.rst:64 +msgid "" +"Determine if dictionary *p* contains *key*. If an item in *p* matches " +"*key*, return ``1``, otherwise return ``0``. On error, return ``-1``. This " +"is equivalent to the Python expression ``key in p``." msgstr "" -msgid "The operation is atomic on :term:`free threading ` when *key* is :class:`str`, :class:`int`, :class:`float`, :class:`bool` or :class:`bytes`." +#: ../../c-api/dict.rst:70 ../../c-api/dict.rst:97 ../../c-api/dict.rst:117 +#: ../../c-api/dict.rst:140 ../../c-api/dict.rst:257 ../../c-api/dict.rst:279 +msgid "" +"The operation is atomic on :term:`free threading ` when " +"*key* is :class:`str`, :class:`int`, :class:`float`, :class:`bool` " +"or :class:`bytes`." msgstr "" -msgid "This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/dict.rst:76 +msgid "" +"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" +#: ../../c-api/dict.rst:85 msgid "Return a new dictionary that contains the same key-value pairs as *p*." msgstr "" -msgid "Insert *val* into the dictionary *p* with a key of *key*. *key* must be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` on success or ``-1`` on failure. This function *does not* steal a reference to *val*." +#: ../../c-api/dict.rst:90 +msgid "" +"Insert *val* into the dictionary *p* with a key of *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return " +"``0`` on success or ``-1`` on failure. This function *does not* " +"\":term:`steal`\" a reference to *val*." msgstr "" -msgid "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/dict.rst:103 +msgid "" +"This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Remove the entry in dictionary *p* with key *key*. *key* must be :term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on failure." +#: ../../c-api/dict.rst:110 +msgid "" +"Remove the entry in dictionary *p* with key *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is " +"not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or " +"``-1`` on failure." msgstr "" -msgid "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/dict.rst:123 +msgid "" +"This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Return a new :term:`strong reference` to the object from dictionary *p* which has a key *key*:" +#: ../../c-api/dict.rst:130 +msgid "" +"Return a new :term:`strong reference` to the object from dictionary *p* " +"which has a key *key*:" msgstr "" -msgid "If the key is present, set *\\*result* to a new :term:`strong reference` to the value and return ``1``." +#: ../../c-api/dict.rst:133 +msgid "" +"If the key is present, set *\\*result* to a new :term:`strong reference` to " +"the value and return ``1``." msgstr "" +#: ../../c-api/dict.rst:135 msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``." msgstr "" -msgid "On error, raise an exception, set *\\*result* to ``NULL`` and return ``-1``." +#: ../../c-api/dict.rst:136 +msgid "" +"On error, raise an exception, set *\\*result* to ``NULL`` and return ``-1``." msgstr "" +#: ../../c-api/dict.rst:145 msgid "See also the :c:func:`PyObject_GetItem` function." msgstr "" -msgid "Return a :term:`borrowed reference` to the object from dictionary *p* which has a key *key*. Return ``NULL`` if the key *key* is missing *without* setting an exception." +#: ../../c-api/dict.rst:150 +msgid "" +"Return a :term:`borrowed reference` to the object from dictionary *p* which " +"has a key *key*. Return ``NULL`` if the key *key* is missing *without* " +"setting an exception." msgstr "" -msgid "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:`~object.__eq__` methods are silently ignored. Prefer the :c:func:`PyDict_GetItemWithError` function instead." +#: ../../c-api/dict.rst:156 +msgid "" +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods are silently ignored. Prefer " +"the :c:func:`PyDict_GetItemWithError` function instead." msgstr "" -msgid "In the :term:`free-threaded build`, the returned :term:`borrowed reference` may become invalid if another thread modifies the dictionary concurrently. Prefer :c:func:`PyDict_GetItemRef`, which returns a :term:`strong reference`." +#: ../../c-api/dict.rst:162 ../../c-api/dict.rst:181 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the dictionary concurrently. " +"Prefer :c:func:`PyDict_GetItemRef`, which returns a :term:`strong reference`." msgstr "" -msgid "Calling this API without an :term:`attached thread state` had been allowed for historical reason. It is no longer allowed." +#: ../../c-api/dict.rst:167 +msgid "" +"Calling this API without an :term:`attached thread state` had been allowed " +"for historical reason. It is no longer allowed." msgstr "" -msgid "Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. Return ``NULL`` **with** an exception set if an exception occurred. Return ``NULL`` **without** an exception set if the key wasn't present." +#: ../../c-api/dict.rst:174 +msgid "" +"Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. " +"Return ``NULL`` **with** an exception set if an exception occurred. Return " +"``NULL`` **without** an exception set if the key wasn't present." msgstr "" -msgid "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/dict.rst:189 +msgid "" +"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:`~object.__eq__` methods or while creating the temporary :class:`str` object are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` function with your own :c:func:`PyUnicode_FromString` *key* instead." +#: ../../c-api/dict.rst:195 +msgid "" +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods or while creating the " +"temporary :class:`str` object are silently ignored. Prefer using " +"the :c:func:`PyDict_GetItemWithError` function with your " +"own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" -msgid "In the :term:`free-threaded build`, the returned :term:`borrowed reference` may become invalid if another thread modifies the dictionary concurrently. Prefer :c:func:`PyDict_GetItemStringRef`, which returns a :term:`strong reference`." +#: ../../c-api/dict.rst:203 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the dictionary concurrently. " +"Prefer :c:func:`PyDict_GetItemStringRef`, which returns a :term:`strong " +"reference`." msgstr "" -msgid "Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/dict.rst:211 +msgid "" +"Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "This is the same as the Python-level :meth:`dict.setdefault`. If present, it returns the value corresponding to *key* from the dictionary *p*. If the key is not in the dict, it is inserted with value *defaultobj* and *defaultobj* is returned. This function evaluates the hash function of *key* only once, instead of evaluating it independently for the lookup and the insertion." +#: ../../c-api/dict.rst:220 +msgid "" +"This is the same as the Python-level :meth:`dict.setdefault`. If present, " +"it returns the value corresponding to *key* from the dictionary *p*. If the " +"key is not in the dict, it is inserted with value *defaultobj* and " +"*defaultobj* is returned. This function evaluates the hash function of " +"*key* only once, instead of evaluating it independently for the lookup and " +"the insertion." msgstr "" -msgid "In the :term:`free-threaded build`, the returned :term:`borrowed reference` may become invalid if another thread modifies the dictionary concurrently. Prefer :c:func:`PyDict_SetDefaultRef`, which returns a :term:`strong reference`." +#: ../../c-api/dict.rst:230 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the dictionary concurrently. " +"Prefer :c:func:`PyDict_SetDefaultRef`, which returns a :term:`strong " +"reference`." msgstr "" -msgid "Inserts *default_value* into the dictionary *p* with a key of *key* if the key is not already present in the dictionary. If *result* is not ``NULL``, then *\\*result* is set to a :term:`strong reference` to either *default_value*, if the key was not present, or the existing value, if *key* was already present in the dictionary. Returns ``1`` if the key was present and *default_value* was not inserted, or ``0`` if the key was not present and *default_value* was inserted. On failure, returns ``-1``, sets an exception, and sets ``*result`` to ``NULL``." +#: ../../c-api/dict.rst:239 +msgid "" +"Inserts *default_value* into the dictionary *p* with a key of *key* if the " +"key is not already present in the dictionary. If *result* is not ``NULL``, " +"then *\\*result* is set to a :term:`strong reference` to either " +"*default_value*, if the key was not present, or the existing value, if *key* " +"was already present in the dictionary. Returns ``1`` if the key was present " +"and *default_value* was not inserted, or ``0`` if the key was not present " +"and *default_value* was inserted. On failure, returns ``-1``, sets an " +"exception, and sets ``*result`` to ``NULL``." msgstr "" -msgid "For clarity: if you have a strong reference to *default_value* before calling this function, then after it returns, you hold a strong reference to both *default_value* and *\\*result* (if it's not ``NULL``). These may refer to the same object: in that case you hold two separate references to it." +#: ../../c-api/dict.rst:249 +msgid "" +"For clarity: if you have a strong reference to *default_value* before " +"calling this function, then after it returns, you hold a strong reference to " +"both *default_value* and *\\*result* (if it's not ``NULL``). These may refer " +"to the same object: in that case you hold two separate references to it." msgstr "" -msgid "Remove *key* from dictionary *p* and optionally return the removed value. Do not raise :exc:`KeyError` if the key is missing." +#: ../../c-api/dict.rst:265 +msgid "" +"Remove *key* from dictionary *p* and optionally return the removed value. Do " +"not raise :exc:`KeyError` if the key is missing." msgstr "" -msgid "If the key is present, set *\\*result* to a new reference to the removed value if *result* is not ``NULL``, and return ``1``." +#: ../../c-api/dict.rst:268 +msgid "" +"If the key is present, set *\\*result* to a new reference to the removed " +"value if *result* is not ``NULL``, and return ``1``." msgstr "" -msgid "If the key is missing, set *\\*result* to ``NULL`` if *result* is not ``NULL``, and return ``0``." +#: ../../c-api/dict.rst:270 +msgid "" +"If the key is missing, set *\\*result* to ``NULL`` if *result* is not " +"``NULL``, and return ``0``." msgstr "" +#: ../../c-api/dict.rst:272 msgid "On error, raise an exception and return ``-1``." msgstr "" -msgid "Similar to :meth:`dict.pop`, but without the default value and not raising :exc:`KeyError` if the key is missing." +#: ../../c-api/dict.rst:274 +msgid "" +"Similar to :meth:`dict.pop`, but without the default value and not " +"raising :exc:`KeyError` if the key is missing." msgstr "" -msgid "Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/dict.rst:287 +msgid "" +"Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const " +"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." msgstr "" -msgid "Return a :c:type:`PyListObject` containing all the items from the dictionary." +#: ../../c-api/dict.rst:296 +msgid "" +"Return a :c:type:`PyListObject` containing all the items from the dictionary." msgstr "" -msgid "Return a :c:type:`PyListObject` containing all the keys from the dictionary." +#: ../../c-api/dict.rst:301 +msgid "" +"Return a :c:type:`PyListObject` containing all the keys from the dictionary." msgstr "" -msgid "Return a :c:type:`PyListObject` containing all the values from the dictionary *p*." +#: ../../c-api/dict.rst:306 +msgid "" +"Return a :c:type:`PyListObject` containing all the values from the " +"dictionary *p*." msgstr "" -msgid "Return the number of items in the dictionary. This is equivalent to ``len(p)`` on a dictionary." +#: ../../c-api/dict.rst:314 +msgid "" +"Return the number of items in the dictionary. This is equivalent to " +"``len(p)`` on a dictionary." msgstr "" +#: ../../c-api/dict.rst:320 msgid "Similar to :c:func:`PyDict_Size`, but without error checking." msgstr "" -msgid "Iterate over all key-value pairs in the dictionary *p*. The :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the first call to this function to start the iteration; the function returns true for each pair in the dictionary, and false once all pairs have been reported. The parameters *pkey* and *pvalue* should either point to :c:expr:`PyObject*` variables that will be filled in with each key and value, respectively, or may be ``NULL``. Any references returned through them are borrowed. *ppos* should not be altered during iteration. Its value represents offsets within the internal dictionary structure, and since the structure is sparse, the offsets are not consecutive." -msgstr "" - +#: ../../c-api/dict.rst:325 +msgid "" +"Iterate over all key-value pairs in the dictionary *p*. " +"The :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` " +"prior to the first call to this function to start the iteration; the " +"function returns true for each pair in the dictionary, and false once all " +"pairs have been reported. The parameters *pkey* and *pvalue* should either " +"point to :c:expr:`PyObject*` variables that will be filled in with each key " +"and value, respectively, or may be ``NULL``. Any references returned " +"through them are borrowed. *ppos* should not be altered during iteration. " +"Its value represents offsets within the internal dictionary structure, and " +"since the structure is sparse, the offsets are not consecutive." +msgstr "" + +#: ../../c-api/dict.rst:336 msgid "For example::" msgstr "" +#: ../../c-api/dict.rst:338 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -178,9 +352,14 @@ msgid "" "}" msgstr "" -msgid "The dictionary *p* should not be mutated during iteration. It is safe to modify the values of the keys as you iterate over the dictionary, but only so long as the set of keys does not change. For example::" +#: ../../c-api/dict.rst:346 +msgid "" +"The dictionary *p* should not be mutated during iteration. It is safe to " +"modify the values of the keys as you iterate over the dictionary, but only " +"so long as the set of keys does not change. For example::" msgstr "" +#: ../../c-api/dict.rst:350 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -201,9 +380,15 @@ msgid "" "}" msgstr "" -msgid "The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +#: ../../c-api/dict.rst:368 +msgid "" +"The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while " +"iterating over it::" msgstr "" +#: ../../c-api/dict.rst:373 msgid "" "Py_BEGIN_CRITICAL_SECTION(self->dict);\n" "while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" @@ -212,21 +397,54 @@ msgid "" "Py_END_CRITICAL_SECTION();" msgstr "" -msgid "On the free-threaded build, this function can be used safely inside a critical section. However, the references returned for *pkey* and *pvalue* are :term:`borrowed ` and are only valid while the critical section is held. If you need to use these objects outside the critical section or when the critical section can be suspended, create a :term:`strong reference ` (for example, using :c:func:`Py_NewRef`)." +#: ../../c-api/dict.rst:381 +msgid "" +"On the free-threaded build, this function can be used safely inside a " +"critical section. However, the references returned for *pkey* and *pvalue* " +"are :term:`borrowed ` and are only valid while the " +"critical section is held. If you need to use these objects outside the " +"critical section or when the critical section can be suspended, create " +"a :term:`strong reference ` (for example, " +"using :c:func:`Py_NewRef`)." msgstr "" -msgid "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. *b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` and :c:func:`PyObject_GetItem`. If *override* is true, existing pairs in *a* will be replaced if a matching key is found in *b*, otherwise pairs will only be added if there is not a matching key in *a*. Return ``0`` on success or ``-1`` if an exception was raised." +#: ../../c-api/dict.rst:391 +msgid "" +"Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " +"*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " +"and :c:func:`PyObject_GetItem`. If *override* is true, existing pairs in *a* " +"will be replaced if a matching key is found in *b*, otherwise pairs will " +"only be added if there is not a matching key in *a*. Return ``0`` on success " +"or ``-1`` if an exception was raised." msgstr "" -msgid "In the :term:`free-threaded build`, when *b* is a :class:`dict` (with the standard iterator), both *a* and *b* are locked for the duration of the operation. When *b* is a non-dict mapping, only *a* is locked; *b* may be concurrently modified by another thread." +#: ../../c-api/dict.rst:400 ../../c-api/dict.rst:416 +msgid "" +"In the :term:`free-threaded build`, when *b* is a :class:`dict` (with the " +"standard iterator), both *a* and *b* are locked for the duration of the " +"operation. When *b* is a non-dict mapping, only *a* is locked; *b* may be " +"concurrently modified by another thread." msgstr "" -msgid "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back to the iterating over a sequence of key value pairs if the second argument has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an exception was raised." +#: ../../c-api/dict.rst:408 +msgid "" +"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to " +"``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall " +"back to the iterating over a sequence of key value pairs if the second " +"argument has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " +"exception was raised." msgstr "" -msgid "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. *seq2* must be an iterable object producing iterable objects of length 2, viewed as key-value pairs. In case of duplicate keys, the last wins if *override* is true, else the first wins. Return ``0`` on success or ``-1`` if an exception was raised. Equivalent Python (except for the return value)::" +#: ../../c-api/dict.rst:424 +msgid "" +"Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " +"*seq2* must be an iterable object producing iterable objects of length 2, " +"viewed as key-value pairs. In case of duplicate keys, the last wins if " +"*override* is true, else the first wins. Return ``0`` on success or ``-1`` " +"if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" +#: ../../c-api/dict.rst:431 msgid "" "def PyDict_MergeFromSeq2(a, seq2, override):\n" " for key, value in seq2:\n" @@ -234,152 +452,284 @@ msgid "" " a[key] = value" msgstr "" -msgid "In the :term:`free-threaded ` build, only *a* is locked. The iteration over *seq2* is not synchronized; *seq2* may be concurrently modified by another thread." +#: ../../c-api/dict.rst:438 +msgid "" +"In the :term:`free-threaded ` build, only *a* is locked. The " +"iteration over *seq2* is not synchronized; *seq2* may be concurrently " +"modified by another thread." msgstr "" -msgid "Register *callback* as a dictionary watcher. Return a non-negative integer id which must be passed to future calls to :c:func:`PyDict_Watch`. In case of error (e.g. no more watcher IDs available), return ``-1`` and set an exception." +#: ../../c-api/dict.rst:445 +msgid "" +"Register *callback* as a dictionary watcher. Return a non-negative integer " +"id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " +"of error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." msgstr "" -msgid "This function is not internally synchronized. In the :term:`free-threaded ` build, callers should ensure no concurrent calls to :c:func:`PyDict_AddWatcher` or :c:func:`PyDict_ClearWatcher` are in progress." +#: ../../c-api/dict.rst:452 ../../c-api/dict.rst:467 +msgid "" +"This function is not internally synchronized. In the :term:`free-threaded " +"` build, callers should ensure no concurrent calls " +"to :c:func:`PyDict_AddWatcher` or :c:func:`PyDict_ClearWatcher` are in " +"progress." msgstr "" -msgid "Clear watcher identified by *watcher_id* previously returned from :c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the given *watcher_id* was never registered.)" +#: ../../c-api/dict.rst:461 +msgid "" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error " +"(e.g. if the given *watcher_id* was never registered.)" msgstr "" -msgid "Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:func:`PyDict_AddWatcher` will be called when *dict* is modified or deallocated. Return ``0`` on success or ``-1`` on error." +#: ../../c-api/dict.rst:476 +msgid "" +"Mark dictionary *dict* as watched. The callback granted *watcher_id* " +"by :c:func:`PyDict_AddWatcher` will be called when *dict* is modified or " +"deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" -msgid "Mark dictionary *dict* as no longer watched. The callback granted *watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when *dict* is modified or deallocated. The dict must previously have been watched by this watcher. Return ``0`` on success or ``-1`` on error." +#: ../../c-api/dict.rst:484 +msgid "" +"Mark dictionary *dict* as no longer watched. The callback granted " +"*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " +"*dict* is modified or deallocated. The dict must previously have been " +"watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" -msgid "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, ``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, ``PyDict_EVENT_CLONED``, ``PyDict_EVENT_CLEARED``, or ``PyDict_EVENT_DEALLOCATED``." +#: ../../c-api/dict.rst:493 +msgid "" +"Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " +"``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " +"``PyDict_EVENT_CLONED``, ``PyDict_EVENT_CLEARED``, or " +"``PyDict_EVENT_DEALLOCATED``." msgstr "" +#: ../../c-api/dict.rst:501 msgid "Type of a dict watcher callback function." msgstr "" -msgid "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both *key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` or ``PyDict_EVENT_MODIFIED``, *new_value* will be the new value for *key*. If *event* is ``PyDict_EVENT_DELETED``, *key* is being deleted from the dictionary and *new_value* will be ``NULL``." +#: ../../c-api/dict.rst:503 +msgid "" +"If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " +"*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " +"or ``PyDict_EVENT_MODIFIED``, *new_value* will be the new value for *key*. " +"If *event* is ``PyDict_EVENT_DELETED``, *key* is being deleted from the " +"dictionary and *new_value* will be ``NULL``." msgstr "" -msgid "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another dict is merged into it. To maintain efficiency of this operation, per-key ``PyDict_EVENT_ADDED`` events are not issued in this case; instead a single ``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." +#: ../../c-api/dict.rst:509 +msgid "" +"``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " +"dict is merged into it. To maintain efficiency of this operation, per-key " +"``PyDict_EVENT_ADDED`` events are not issued in this case; instead a single " +"``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" -msgid "The callback may inspect but must not modify *dict*; doing so could have unpredictable effects, including infinite recursion. Do not trigger Python code execution in the callback, as it could modify the dict as a side effect." +#: ../../c-api/dict.rst:515 +msgid "" +"The callback may inspect but must not modify *dict*; doing so could have " +"unpredictable effects, including infinite recursion. Do not trigger Python " +"code execution in the callback, as it could modify the dict as a side effect." msgstr "" -msgid "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the callback to the about-to-be-destroyed dictionary will resurrect it and prevent it from being freed at this time. When the resurrected object is destroyed later, any watcher callbacks active at that time will be called again." +#: ../../c-api/dict.rst:519 +msgid "" +"If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " +"callback to the about-to-be-destroyed dictionary will resurrect it and " +"prevent it from being freed at this time. When the resurrected object is " +"destroyed later, any watcher callbacks active at that time will be called " +"again." msgstr "" -msgid "Callbacks occur before the notified modification to *dict* takes place, so the prior state of *dict* can be inspected." +#: ../../c-api/dict.rst:525 +msgid "" +"Callbacks occur before the notified modification to *dict* takes place, so " +"the prior state of *dict* can be inspected." msgstr "" -msgid "If the callback sets an exception, it must return ``-1``; this exception will be printed as an unraisable exception using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +#: ../../c-api/dict.rst:528 +msgid "" +"If the callback sets an exception, it must return ``-1``; this exception " +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -msgid "There may already be a pending exception set on entry to the callback. In this case, the callback should return ``0`` with the same exception still set. This means the callback may not call any other API that can set an exception unless it saves and clears the exception state first, and restores it before returning." +#: ../../c-api/dict.rst:532 +msgid "" +"There may already be a pending exception set on entry to the callback. In " +"this case, the callback should return ``0`` with the same exception still " +"set. This means the callback may not call any other API that can set an " +"exception unless it saves and clears the exception state first, and restores " +"it before returning." msgstr "" +#: ../../c-api/dict.rst:542 msgid "Dictionary View Objects" msgstr "اشیاء نمای دیکشنری" -msgid "Return true if *op* is a view of a set inside a dictionary. This is currently equivalent to :c:expr:`PyDictKeys_Check(op) || PyDictItems_Check(op)`. This function always succeeds." +#: ../../c-api/dict.rst:546 +msgid "" +"Return true if *op* is a view of a set inside a dictionary. This is " +"currently equivalent to :c:expr:`PyDictKeys_Check(op) || " +"PyDictItems_Check(op)`. This function always succeeds." msgstr "" -msgid "Type object for a view of dictionary keys. In Python, this is the type of the object returned by :meth:`dict.keys`." +#: ../../c-api/dict.rst:553 +msgid "" +"Type object for a view of dictionary keys. In Python, this is the type of " +"the object returned by :meth:`dict.keys`." msgstr "" -msgid "Return true if *op* is an instance of a dictionary keys view. This function always succeeds." +#: ../../c-api/dict.rst:559 +msgid "" +"Return true if *op* is an instance of a dictionary keys view. This function " +"always succeeds." msgstr "" -msgid "Type object for a view of dictionary values. In Python, this is the type of the object returned by :meth:`dict.values`." +#: ../../c-api/dict.rst:565 +msgid "" +"Type object for a view of dictionary values. In Python, this is the type of " +"the object returned by :meth:`dict.values`." msgstr "" -msgid "Return true if *op* is an instance of a dictionary values view. This function always succeeds." +#: ../../c-api/dict.rst:571 +msgid "" +"Return true if *op* is an instance of a dictionary values view. This " +"function always succeeds." msgstr "" -msgid "Type object for a view of dictionary items. In Python, this is the type of the object returned by :meth:`dict.items`." +#: ../../c-api/dict.rst:577 +msgid "" +"Type object for a view of dictionary items. In Python, this is the type of " +"the object returned by :meth:`dict.items`." msgstr "" -msgid "Return true if *op* is an instance of a dictionary items view. This function always succeeds." +#: ../../c-api/dict.rst:583 +msgid "" +"Return true if *op* is an instance of a dictionary items view. This function " +"always succeeds." msgstr "" +#: ../../c-api/dict.rst:588 msgid "Ordered Dictionaries" msgstr "" -msgid "Python's C API provides interface for :class:`collections.OrderedDict` from C. Since Python 3.7, dictionaries are ordered by default, so there is usually little need for these functions; prefer ``PyDict*`` where possible." +#: ../../c-api/dict.rst:590 +msgid "" +"Python's C API provides interface for :class:`collections.OrderedDict` from " +"C. Since Python 3.7, dictionaries are ordered by default, so there is " +"usually little need for these functions; prefer ``PyDict*`` where possible." msgstr "" -msgid "Type object for ordered dictionaries. This is the same object as :class:`collections.OrderedDict` in the Python layer." +#: ../../c-api/dict.rst:597 +msgid "" +"Type object for ordered dictionaries. This is the same object " +"as :class:`collections.OrderedDict` in the Python layer." msgstr "" -msgid "Return true if *od* is an ordered dictionary object or an instance of a subtype of the :class:`~collections.OrderedDict` type. This function always succeeds." +#: ../../c-api/dict.rst:603 +msgid "" +"Return true if *od* is an ordered dictionary object or an instance of a " +"subtype of the :class:`~collections.OrderedDict` type. This function always " +"succeeds." msgstr "" -msgid "Return true if *od* is an ordered dictionary object, but not an instance of a subtype of the :class:`~collections.OrderedDict` type. This function always succeeds." +#: ../../c-api/dict.rst:610 +msgid "" +"Return true if *od* is an ordered dictionary object, but not an instance of " +"a subtype of the :class:`~collections.OrderedDict` type. This function " +"always succeeds." msgstr "" +#: ../../c-api/dict.rst:617 msgid "Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries." msgstr "" +#: ../../c-api/dict.rst:622 msgid "Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries." msgstr "" +#: ../../c-api/dict.rst:627 msgid "Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries." msgstr "" +#: ../../c-api/dict.rst:632 msgid "Return a new empty ordered dictionary, or ``NULL`` on failure." msgstr "" +#: ../../c-api/dict.rst:634 msgid "This is analogous to :c:func:`PyDict_New`." msgstr "" -msgid "Insert *value* into the ordered dictionary *od* with a key of *key*. Return ``0`` on success or ``-1`` with an exception set on failure." +#: ../../c-api/dict.rst:639 +msgid "" +"Insert *value* into the ordered dictionary *od* with a key of *key*. Return " +"``0`` on success or ``-1`` with an exception set on failure." msgstr "" +#: ../../c-api/dict.rst:642 msgid "This is analogous to :c:func:`PyDict_SetItem`." msgstr "" -msgid "Remove the entry in the ordered dictionary *od* with key *key*. Return ``0`` on success or ``-1`` with an exception set on failure." +#: ../../c-api/dict.rst:647 +msgid "" +"Remove the entry in the ordered dictionary *od* with key *key*. Return ``0`` " +"on success or ``-1`` with an exception set on failure." msgstr "" +#: ../../c-api/dict.rst:650 msgid "This is analogous to :c:func:`PyDict_DelItem`." msgstr "" +#: ../../c-api/dict.rst:653 msgid "These are :term:`soft deprecated` aliases to ``PyDict`` APIs:" msgstr "" +#: ../../c-api/dict.rst:660 msgid "``PyODict``" msgstr "" +#: ../../c-api/dict.rst:661 msgid "``PyDict``" msgstr "" +#: ../../c-api/dict.rst:663 msgid ":c:func:`PyDict_GetItem`" msgstr "" +#: ../../c-api/dict.rst:665 msgid ":c:func:`PyDict_GetItemWithError`" msgstr "" +#: ../../c-api/dict.rst:667 msgid ":c:func:`PyDict_GetItemString`" msgstr "" +#: ../../c-api/dict.rst:669 msgid ":c:func:`PyDict_Contains`" msgstr "" +#: ../../c-api/dict.rst:671 msgid ":c:func:`PyDict_Size`" msgstr "" +#: ../../c-api/dict.rst:673 msgid ":c:func:`PyDict_GET_SIZE`" msgstr "" +#: ../../c-api/dict.rst:8 msgid "object" msgstr "" +#: ../../c-api/dict.rst:8 msgid "dictionary" msgstr "" +#: ../../c-api/dict.rst:312 msgid "built-in function" msgstr "" +#: ../../c-api/dict.rst:312 msgid "len" msgstr "" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 76e610b9e..0925fe58a 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,213 +24,523 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/exceptions.rst:8 msgid "Exception Handling" msgstr "" -msgid "The functions described in this chapter will let you handle and raise Python exceptions. It is important to understand some of the basics of Python exception handling. It works somewhat like the POSIX :c:data:`errno` variable: there is a global indicator (per thread) of the last error that occurred. Most C API functions don't clear this on success, but will set it to indicate the cause of the error on failure. Most C API functions also return an error indicator, usually ``NULL`` if they are supposed to return a pointer, or ``-1`` if they return an integer (exception: the ``PyArg_*`` functions return ``1`` for success and ``0`` for failure)." -msgstr "" - -msgid "Concretely, the error indicator consists of three object pointers: the exception's type, the exception's value, and the traceback object. Any of those pointers can be ``NULL`` if non-set (although some combinations are forbidden, for example you can't have a non-``NULL`` traceback if the exception type is ``NULL``)." -msgstr "" - -msgid "When a function must fail because some function it called failed, it generally doesn't set the error indicator; the function it called already set it. It is responsible for either handling the error and clearing the exception or returning after cleaning up any resources it holds (such as object references or memory allocations); it should *not* continue normally if it is not prepared to handle the error. If returning due to an error, it is important to indicate to the caller that an error has been set. If the error is not handled or carefully propagated, additional calls into the Python/C API may not behave as intended and may fail in mysterious ways." +#: ../../c-api/exceptions.rst:10 +msgid "" +"The functions described in this chapter will let you handle and raise Python " +"exceptions. It is important to understand some of the basics of Python " +"exception handling. It works somewhat like the POSIX :c:data:`errno` " +"variable: there is a global indicator (per thread) of the last error that " +"occurred. Most C API functions don't clear this on success, but will set it " +"to indicate the cause of the error on failure. Most C API functions also " +"return an error indicator, usually ``NULL`` if they are supposed to return a " +"pointer, or ``-1`` if they return an integer (exception: the ``PyArg_*`` " +"functions return ``1`` for success and ``0`` for failure)." +msgstr "" + +#: ../../c-api/exceptions.rst:20 +msgid "" +"Concretely, the error indicator consists of three object pointers: the " +"exception's type, the exception's value, and the traceback object. Any of " +"those pointers can be ``NULL`` if non-set (although some combinations are " +"forbidden, for example you can't have a non-``NULL`` traceback if the " +"exception type is ``NULL``)." msgstr "" -msgid "The error indicator is **not** the result of :func:`sys.exc_info`. The former corresponds to an exception that is not yet caught (and is therefore still propagating), while the latter returns an exception after it is caught (and has therefore stopped propagating)." +#: ../../c-api/exceptions.rst:26 +msgid "" +"When a function must fail because some function it called failed, it " +"generally doesn't set the error indicator; the function it called already " +"set it. It is responsible for either handling the error and clearing the " +"exception or returning after cleaning up any resources it holds (such as " +"object references or memory allocations); it should *not* continue normally " +"if it is not prepared to handle the error. If returning due to an error, it " +"is important to indicate to the caller that an error has been set. If the " +"error is not handled or carefully propagated, additional calls into the " +"Python/C API may not behave as intended and may fail in mysterious ways." +msgstr "" + +#: ../../c-api/exceptions.rst:37 +msgid "" +"The error indicator is **not** the result of :func:`sys.exc_info`. The " +"former corresponds to an exception that is not yet caught (and is therefore " +"still propagating), while the latter returns an exception after it is caught " +"(and has therefore stopped propagating)." msgstr "" +#: ../../c-api/exceptions.rst:44 msgid "Printing and clearing" msgstr "" -msgid "Clear the error indicator. If the error indicator is not set, there is no effect." +#: ../../c-api/exceptions.rst:49 +msgid "" +"Clear the error indicator. If the error indicator is not set, there is no " +"effect." msgstr "" -msgid "Print a standard traceback to ``sys.stderr`` and clear the error indicator. **Unless** the error is a ``SystemExit``, in that case no traceback is printed and the Python process will exit with the error code specified by the ``SystemExit`` instance." +#: ../../c-api/exceptions.rst:55 +msgid "" +"Print a standard traceback to ``sys.stderr`` and clear the error indicator. " +"**Unless** the error is a ``SystemExit``, in that case no traceback is " +"printed and the Python process will exit with the error code specified by " +"the ``SystemExit`` instance." msgstr "" -msgid "Call this function **only** when the error indicator is set. Otherwise it will cause a fatal error!" +#: ../../c-api/exceptions.rst:60 +msgid "" +"Call this function **only** when the error indicator is set. Otherwise it " +"will cause a fatal error!" msgstr "" -msgid "If *set_sys_last_vars* is nonzero, the variable :data:`sys.last_exc` is set to the printed exception. For backwards compatibility, the deprecated variables :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys.last_traceback` are also set to the type, value and traceback of this exception, respectively." +#: ../../c-api/exceptions.rst:63 +msgid "" +"If *set_sys_last_vars* is nonzero, the variable :data:`sys.last_exc` is set " +"to the printed exception. For backwards compatibility, the deprecated " +"variables :data:`sys.last_type`, :data:`sys.last_value` " +"and :data:`sys.last_traceback` are also set to the type, value and traceback " +"of this exception, respectively." msgstr "" +#: ../../c-api/exceptions.rst:69 msgid "The setting of :data:`sys.last_exc` was added." msgstr "" +#: ../../c-api/exceptions.rst:75 msgid "Alias for ``PyErr_PrintEx(1)``." msgstr "" -msgid "Call :func:`sys.unraisablehook` using the current exception and *obj* argument." +#: ../../c-api/exceptions.rst:80 +msgid "" +"Call :func:`sys.unraisablehook` using the current exception and *obj* " +"argument." msgstr "" -msgid "This utility function prints a warning message to ``sys.stderr`` when an exception has been set but it is impossible for the interpreter to actually raise the exception. It is used, for example, when an exception occurs in an :meth:`~object.__del__` method." +#: ../../c-api/exceptions.rst:83 +msgid "" +"This utility function prints a warning message to ``sys.stderr`` when an " +"exception has been set but it is impossible for the interpreter to actually " +"raise the exception. It is used, for example, when an exception occurs in " +"an :meth:`~object.__del__` method." msgstr "" -msgid "The function is called with a single argument *obj* that identifies the context in which the unraisable exception occurred. If possible, the repr of *obj* will be printed in the warning message. If *obj* is ``NULL``, only the traceback is printed." +#: ../../c-api/exceptions.rst:88 +msgid "" +"The function is called with a single argument *obj* that identifies the " +"context in which the unraisable exception occurred. If possible, the repr of " +"*obj* will be printed in the warning message. If *obj* is ``NULL``, only the " +"traceback is printed." msgstr "" +#: ../../c-api/exceptions.rst:93 msgid "An exception must be set when calling this function." msgstr "" +#: ../../c-api/exceptions.rst:95 msgid "Print a traceback. Print only traceback if *obj* is ``NULL``." msgstr "" +#: ../../c-api/exceptions.rst:98 msgid "Use :func:`sys.unraisablehook`." msgstr "" -msgid "Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent parameters help format the warning message; they have the same meaning and values as in :c:func:`PyUnicode_FromFormat`. ``PyErr_WriteUnraisable(obj)`` is roughly equivalent to ``PyErr_FormatUnraisable(\"Exception ignored in: %R\", obj)``. If *format* is ``NULL``, only the traceback is printed." +#: ../../c-api/exceptions.rst:104 +msgid "" +"Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent " +"parameters help format the warning message; they have the same meaning and " +"values as in :c:func:`PyUnicode_FromFormat`. ``PyErr_WriteUnraisable(obj)`` " +"is roughly equivalent to ``PyErr_FormatUnraisable(\"Exception ignored in: " +"%R\", obj)``. If *format* is ``NULL``, only the traceback is printed." msgstr "" -msgid "Print the standard traceback display of ``exc`` to ``sys.stderr``, including chained exceptions and notes." +#: ../../c-api/exceptions.rst:116 +msgid "" +"Print the standard traceback display of ``exc`` to ``sys.stderr``, including " +"chained exceptions and notes." msgstr "" -msgid "Raising exceptions" +#: ../../c-api/exceptions.rst:124 +msgid "Legacy variant of :c:func:`PyErr_DisplayException`." msgstr "" -msgid "These functions help you set the current thread's error indicator. For convenience, some of these functions will always return a ``NULL`` pointer for use in a ``return`` statement." +#: ../../c-api/exceptions.rst:126 +msgid "" +"Print the exception *value* with its traceback to :data:`sys.stderr`. If " +"*value* has no traceback set, *tb* is used as its traceback. The first " +"argument is ignored." msgstr "" -msgid "This is the most common way to set the error indicator. The first argument specifies the exception type; it is normally one of the standard exceptions, e.g. :c:data:`PyExc_RuntimeError`. You need not create a new :term:`strong reference` to it (e.g. with :c:func:`Py_INCREF`). The second argument is an error message; it is decoded from ``'utf-8'``." +#: ../../c-api/exceptions.rst:130 +msgid "" +"If :data:`sys.stderr` is ``None``, nothing is printed. If :data:`sys.stderr` " +"is not set, the exception is dumped to the C ``stderr`` stream instead." msgstr "" -msgid "This function is similar to :c:func:`PyErr_SetString` but lets you specify an arbitrary Python object for the \"value\" of the exception." +#: ../../c-api/exceptions.rst:134 +msgid "Use :c:func:`PyErr_DisplayException` instead." msgstr "" -msgid "This function sets the error indicator and returns ``NULL``. *exception* should be a Python exception class. The *format* and subsequent parameters help format the error message; they have the same meaning and values as in :c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." +#: ../../c-api/exceptions.rst:138 +msgid "Raising exceptions" msgstr "" -msgid "Same as :c:func:`PyErr_Format`, but taking a :c:type:`va_list` argument rather than a variable number of arguments." +#: ../../c-api/exceptions.rst:140 +msgid "" +"These functions help you set the current thread's error indicator. For " +"convenience, some of these functions will always return a ``NULL`` pointer " +"for use in a ``return`` statement." msgstr "" -msgid "This is a shorthand for ``PyErr_SetObject(type, Py_None)``." +#: ../../c-api/exceptions.rst:147 +msgid "" +"This is the most common way to set the error indicator. The first argument " +"specifies the exception type; it is normally one of the standard exceptions, " +"e.g. :c:data:`PyExc_RuntimeError`. You need not create a new :term:`strong " +"reference` to it (e.g. with :c:func:`Py_INCREF`). The second argument is an " +"error message; it is decoded from ``'utf-8'``." msgstr "" -msgid "This is a shorthand for ``PyErr_SetString(PyExc_TypeError, message)``, where *message* indicates that a built-in operation was invoked with an illegal argument. It is mostly for internal use." +#: ../../c-api/exceptions.rst:156 +msgid "" +"This function is similar to :c:func:`PyErr_SetString` but lets you specify " +"an arbitrary Python object for the \"value\" of the exception." msgstr "" -msgid "This is a shorthand for ``PyErr_SetNone(PyExc_MemoryError)``; it returns ``NULL`` so an object allocation function can write ``return PyErr_NoMemory();`` when it runs out of memory." +#: ../../c-api/exceptions.rst:162 +msgid "" +"This function sets the error indicator and returns ``NULL``. *exception* " +"should be a Python exception class. The *format* and subsequent parameters " +"help format the error message; they have the same meaning and values as " +"in :c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." msgstr "" -msgid "This is a convenience function to raise an exception when a C library function has returned an error and set the C variable :c:data:`errno`. It constructs a tuple object whose first item is the integer :c:data:`errno` value and whose second item is the corresponding error message (gotten from :c:func:`!strerror`), and then calls ``PyErr_SetObject(type, object)``. On Unix, when the :c:data:`errno` value is :c:macro:`!EINTR`, indicating an interrupted system call, this calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator, leaves it set to that. The function always returns ``NULL``, so a wrapper function around a system call can write ``return PyErr_SetFromErrno(type);`` when the system call returns an error." +#: ../../c-api/exceptions.rst:171 +msgid "" +"Same as :c:func:`PyErr_Format`, but taking a :c:type:`va_list` argument " +"rather than a variable number of arguments." msgstr "" -msgid "Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that if *filenameObject* is not ``NULL``, it is passed to the constructor of *type* as a third parameter. In the case of :exc:`OSError` exception, this is used to define the :attr:`!filename` attribute of the exception instance." +#: ../../c-api/exceptions.rst:179 +msgid "This is a shorthand for ``PyErr_SetObject(type, Py_None)``." msgstr "" -msgid "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but takes a second filename object, for raising errors when a function that takes two filenames fails." +#: ../../c-api/exceptions.rst:184 +msgid "" +"This is a shorthand for ``PyErr_SetString(PyExc_TypeError, message)``, where " +"*message* indicates that a built-in operation was invoked with an illegal " +"argument. It is mostly for internal use." msgstr "" -msgid "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename is given as a C string. *filename* is decoded from the :term:`filesystem encoding and error handler`." +#: ../../c-api/exceptions.rst:191 +msgid "" +"This is a shorthand for ``PyErr_SetNone(PyExc_MemoryError)``; it returns " +"``NULL`` so an object allocation function can write ``return " +"PyErr_NoMemory();`` when it runs out of memory." msgstr "" -msgid "This is a convenience function to raise :exc:`OSError`. If called with *ierr* of ``0``, the error code returned by a call to :c:func:`!GetLastError` is used instead. It calls the Win32 function :c:func:`!FormatMessage` to retrieve the Windows description of error code given by *ierr* or :c:func:`!GetLastError`, then it constructs a :exc:`OSError` object with the :attr:`~OSError.winerror` attribute set to the error code, the :attr:`~OSError.strerror` attribute set to the corresponding error message (gotten from :c:func:`!FormatMessage`), and then calls ``PyErr_SetObject(PyExc_OSError, object)``. This function always returns ``NULL``." +#: ../../c-api/exceptions.rst:200 +msgid "" +"This is a convenience function to raise an exception when a C library " +"function has returned an error and set the C variable :c:data:`errno`. It " +"constructs a tuple object whose first item is the integer :c:data:`errno` " +"value and whose second item is the corresponding error message (gotten " +"from :c:func:`!strerror`), and then calls ``PyErr_SetObject(type, " +"object)``. On Unix, when the :c:data:`errno` value is :c:macro:`!EINTR`, " +"indicating an interrupted system call, this " +"calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator, " +"leaves it set to that. The function always returns ``NULL``, so a wrapper " +"function around a system call can write ``return PyErr_SetFromErrno(type);`` " +"when the system call returns an error." +msgstr "" + +#: ../../c-api/exceptions.rst:214 +msgid "" +"Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that " +"if *filenameObject* is not ``NULL``, it is passed to the constructor of " +"*type* as a third parameter. In the case of :exc:`OSError` exception, this " +"is used to define the :attr:`!filename` attribute of the exception instance." msgstr "" -msgid "Availability" +#: ../../c-api/exceptions.rst:223 +msgid "" +"Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but takes a " +"second filename object, for raising errors when a function that takes two " +"filenames fails." msgstr "" -msgid "Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter specifying the exception type to be raised." +#: ../../c-api/exceptions.rst:232 +msgid "" +"Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename " +"is given as a C string. *filename* is decoded from the :term:`filesystem " +"encoding and error handler`." msgstr "" -msgid "Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior that if *filename* is not ``NULL``, it is decoded from the filesystem encoding (:func:`os.fsdecode`) and passed to the constructor of :exc:`OSError` as a third parameter to be used to define the :attr:`!filename` attribute of the exception instance." +#: ../../c-api/exceptions.rst:239 +msgid "" +"This is a convenience function to raise :exc:`OSError`. If called with " +"*ierr* of ``0``, the error code returned by a call to :c:func:`!" +"GetLastError` is used instead. It calls the Win32 function :c:func:`!" +"FormatMessage` to retrieve the Windows description of error code given by " +"*ierr* or :c:func:`!GetLastError`, then it constructs a :exc:`OSError` " +"object with the :attr:`~OSError.winerror` attribute set to the error code, " +"the :attr:`~OSError.strerror` attribute set to the corresponding error " +"message (gotten from :c:func:`!FormatMessage`), and then calls " +"``PyErr_SetObject(PyExc_OSError, object)``. This function always returns " +"``NULL``." +msgstr "" + +#: ../../c-api/exceptions.rst:249 ../../c-api/exceptions.rst:257 +#: ../../c-api/exceptions.rst:268 ../../c-api/exceptions.rst:278 +#: ../../c-api/exceptions.rst:286 ../../c-api/exceptions.rst:296 +msgid "Availability" msgstr "" -msgid "Similar to :c:func:`PyErr_SetExcFromWindowsErr`, with the additional behavior that if *filename* is not ``NULL``, it is passed to the constructor of :exc:`OSError` as a third parameter to be used to define the :attr:`!filename` attribute of the exception instance." +#: ../../c-api/exceptions.rst:254 +msgid "" +"Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter " +"specifying the exception type to be raised." msgstr "" -msgid "Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`, but accepts a second filename object." +#: ../../c-api/exceptions.rst:262 +msgid "" +"Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior " +"that if *filename* is not ``NULL``, it is decoded from the filesystem " +"encoding (:func:`os.fsdecode`) and passed to the constructor " +"of :exc:`OSError` as a third parameter to be used to define the :attr:`!" +"filename` attribute of the exception instance." msgstr "" -msgid "Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional parameter specifying the exception type to be raised." +#: ../../c-api/exceptions.rst:273 +msgid "" +"Similar to :c:func:`PyErr_SetExcFromWindowsErr`, with the additional " +"behavior that if *filename* is not ``NULL``, it is passed to the constructor " +"of :exc:`OSError` as a third parameter to be used to define the :attr:`!" +"filename` attribute of the exception instance." msgstr "" -msgid "This is a convenience function to raise :exc:`ImportError`. *msg* will be set as the exception's message string. *name* and *path*, both of which can be ``NULL``, will be set as the :exc:`ImportError`'s respective ``name`` and ``path`` attributes." +#: ../../c-api/exceptions.rst:283 +msgid "" +"Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`, but " +"accepts a second filename object." msgstr "" -msgid "Much like :c:func:`PyErr_SetImportError` but this function allows for specifying a subclass of :exc:`ImportError` to raise." +#: ../../c-api/exceptions.rst:293 +msgid "" +"Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional " +"parameter specifying the exception type to be raised." msgstr "" -msgid "Set file, line, and offset information for the current exception. If the current exception is not a :exc:`SyntaxError`, then it sets additional attributes, which make the exception printing subsystem think the exception is a :exc:`SyntaxError`." +#: ../../c-api/exceptions.rst:301 +msgid "" +"This is a convenience function to raise :exc:`ImportError`. *msg* will be " +"set as the exception's message string. *name* and *path*, both of which can " +"be ``NULL``, will be set as the :exc:`ImportError`'s respective ``name`` and " +"``path`` attributes." msgstr "" -msgid "Similar to :c:func:`PyErr_SyntaxLocationObject`, but also sets the *end_lineno* and *end_col_offset* information for the current exception." +#: ../../c-api/exceptions.rst:311 +msgid "" +"Much like :c:func:`PyErr_SetImportError` but this function allows for " +"specifying a subclass of :exc:`ImportError` to raise." msgstr "" -msgid "Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string decoded from the :term:`filesystem encoding and error handler`." +#: ../../c-api/exceptions.rst:319 +msgid "" +"Set file, line, and offset information for the current exception. If the " +"current exception is not a :exc:`SyntaxError`, then it sets additional " +"attributes, which make the exception printing subsystem think the exception " +"is a :exc:`SyntaxError`." msgstr "" -msgid "Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is omitted." +#: ../../c-api/exceptions.rst:329 +msgid "" +"Similar to :c:func:`PyErr_SyntaxLocationObject`, but also sets the " +"*end_lineno* and *end_col_offset* information for the current exception." msgstr "" -msgid "This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, where *message* indicates that an internal operation (e.g. a Python/C API function) was invoked with an illegal argument. It is mostly for internal use." +#: ../../c-api/exceptions.rst:337 +msgid "" +"Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string " +"decoded from the :term:`filesystem encoding and error handler`." msgstr "" -msgid "Get the source line in *filename* at line *lineno*. *filename* should be a Python :class:`str` object." +#: ../../c-api/exceptions.rst:345 +msgid "" +"Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is " +"omitted." msgstr "" -msgid "On success, this function returns a Python string object with the found line. On failure, this function returns ``NULL`` without an exception set." +#: ../../c-api/exceptions.rst:351 +msgid "" +"This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, " +"where *message* indicates that an internal operation (e.g. a Python/C API " +"function) was invoked with an illegal argument. It is mostly for internal " +"use." msgstr "" -msgid "Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a :c:expr:`const char *`, which is decoded with the :term:`filesystem encoding and error handler`, instead of a Python object reference." +#: ../../c-api/exceptions.rst:359 +msgid "" +"Get the source line in *filename* at line *lineno*. *filename* should be a " +"Python :class:`str` object." msgstr "" -msgid "Issuing warnings" +#: ../../c-api/exceptions.rst:362 +msgid "" +"On success, this function returns a Python string object with the found " +"line. On failure, this function returns ``NULL`` without an exception set." msgstr "" -msgid "Use these functions to issue warnings from C code. They mirror similar functions exported by the Python :mod:`warnings` module. They normally print a warning message to *sys.stderr*; however, it is also possible that the user has specified that warnings are to be turned into errors, and in that case they will raise an exception. It is also possible that the functions raise an exception because of a problem with the warning machinery. The return value is ``0`` if no exception is raised, or ``-1`` if an exception is raised. (It is not possible to determine whether a warning message is actually printed, nor what the reason is for the exception; this is intentional.) If an exception is raised, the caller should do its normal exception handling (for example, :c:func:`Py_DECREF` owned references and return an error value)." +#: ../../c-api/exceptions.rst:368 +msgid "" +"Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is " +"a :c:expr:`const char *`, which is decoded with the :term:`filesystem " +"encoding and error handler`, instead of a Python object reference." msgstr "" -msgid "Issue a warning message. The *category* argument is a warning category (see below) or ``NULL``; the *message* argument is a UTF-8 encoded string. *stack_level* is a positive number giving a number of stack frames; the warning will be issued from the currently executing line of code in that stack frame. A *stack_level* of 1 is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that, and so forth." +#: ../../c-api/exceptions.rst:375 +msgid "Issuing warnings" +msgstr "" + +#: ../../c-api/exceptions.rst:377 +msgid "" +"Use these functions to issue warnings from C code. They mirror similar " +"functions exported by the Python :mod:`warnings` module. They normally " +"print a warning message to *sys.stderr*; however, it is also possible that " +"the user has specified that warnings are to be turned into errors, and in " +"that case they will raise an exception. It is also possible that the " +"functions raise an exception because of a problem with the warning " +"machinery. The return value is ``0`` if no exception is raised, or ``-1`` if " +"an exception is raised. (It is not possible to determine whether a warning " +"message is actually printed, nor what the reason is for the exception; this " +"is intentional.) If an exception is raised, the caller should do its normal " +"exception handling (for example, :c:func:`Py_DECREF` owned references and " +"return an error value)." +msgstr "" + +#: ../../c-api/exceptions.rst:392 +msgid "" +"Issue a warning message. The *category* argument is a warning category (see " +"below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " +"*stack_level* is a positive number giving a number of stack frames; the " +"warning will be issued from the currently executing line of code in that " +"stack frame. A *stack_level* of 1 is the function " +"calling :c:func:`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" -msgid "Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default warning category is :c:data:`PyExc_RuntimeWarning`. The standard Python warning categories are available as global variables whose names are enumerated at :ref:`standardwarningcategories`." +#: ../../c-api/exceptions.rst:399 +msgid "" +"Warning categories must be subclasses " +"of :c:data:`PyExc_Warning`; :c:data:`PyExc_Warning` is a subclass " +"of :c:data:`PyExc_Exception`; the default warning category " +"is :c:data:`PyExc_RuntimeWarning`. The standard Python warning categories " +"are available as global variables whose names are enumerated " +"at :ref:`standardwarningcategories`." msgstr "" -msgid "For information about warning control, see the documentation for the :mod:`warnings` module and the :option:`-W` option in the command line documentation. There is no C API for warning control." +#: ../../c-api/exceptions.rst:405 +msgid "" +"For information about warning control, see the documentation for " +"the :mod:`warnings` module and the :option:`-W` option in the command line " +"documentation. There is no C API for warning control." msgstr "" -msgid "Issue a warning message with explicit control over all warning attributes. This is a straightforward wrapper around the Python function :func:`warnings.warn_explicit`; see there for more information. The *module* and *registry* arguments may be set to ``NULL`` to get the default effect described there." +#: ../../c-api/exceptions.rst:412 +msgid "" +"Issue a warning message with explicit control over all warning attributes. " +"This is a straightforward wrapper around the Python " +"function :func:`warnings.warn_explicit`; see there for more information. " +"The *module* and *registry* arguments may be set to ``NULL`` to get the " +"default effect described there." msgstr "" -msgid "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and *module* are UTF-8 encoded strings, and *filename* is decoded from the :term:`filesystem encoding and error handler`." +#: ../../c-api/exceptions.rst:423 +msgid "" +"Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " +"*module* are UTF-8 encoded strings, and *filename* is decoded from " +"the :term:`filesystem encoding and error handler`." msgstr "" -msgid "Function similar to :c:func:`PyErr_WarnEx`, but uses :c:func:`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-encoded string." +#: ../../c-api/exceptions.rst:430 +msgid "" +"Function similar to :c:func:`PyErr_WarnEx`, but " +"uses :c:func:`PyUnicode_FromFormat` to format the warning message. *format* " +"is an ASCII-encoded string." msgstr "" -msgid "Similar to :c:func:`PyErr_WarnExplicit`, but uses :c:func:`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-encoded string." +#: ../../c-api/exceptions.rst:439 +msgid "" +"Similar to :c:func:`PyErr_WarnExplicit`, but " +"uses :c:func:`PyUnicode_FromFormat` to format the warning message. *format* " +"is an ASCII-encoded string." msgstr "" -msgid "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:`ResourceWarning` and it passes *source* to :class:`!warnings.WarningMessage`." +#: ../../c-api/exceptions.rst:448 +msgid "" +"Function similar to :c:func:`PyErr_WarnFormat`, but *category* " +"is :exc:`ResourceWarning` and it passes *source* to :class:`!" +"warnings.WarningMessage`." msgstr "" +#: ../../c-api/exceptions.rst:455 msgid "Querying the error indicator" msgstr "" -msgid "Test whether the error indicator is set. If set, return the exception *type* (the first argument to the last call to one of the ``PyErr_Set*`` functions or to :c:func:`PyErr_Restore`). If not set, return ``NULL``. You do not own a reference to the return value, so you do not need to :c:func:`Py_DECREF` it." +#: ../../c-api/exceptions.rst:459 +msgid "" +"Test whether the error indicator is set. If set, return the exception " +"*type* (the first argument to the last call to one of the ``PyErr_Set*`` " +"functions or to :c:func:`PyErr_Restore`). If not set, return ``NULL``. You " +"do not own a reference to the return value, so you do not need " +"to :c:func:`Py_DECREF` it." msgstr "" +#: ../../c-api/exceptions.rst:465 msgid "The caller must have an :term:`attached thread state`." msgstr "" -msgid "Do not compare the return value to a specific exception; use :c:func:`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily fail since the exception may be an instance instead of a class, in the case of a class exception, or it may be a subclass of the expected exception.)" +#: ../../c-api/exceptions.rst:469 +msgid "" +"Do not compare the return value to a specific exception; " +"use :c:func:`PyErr_ExceptionMatches` instead, shown below. (The comparison " +"could easily fail since the exception may be an instance instead of a class, " +"in the case of a class exception, or it may be a subclass of the expected " +"exception.)" msgstr "" -msgid "Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This should only be called when an exception is actually set; a memory access violation will occur if no exception has been raised." +#: ../../c-api/exceptions.rst:477 +msgid "" +"Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This " +"should only be called when an exception is actually set; a memory access " +"violation will occur if no exception has been raised." msgstr "" -msgid "Return true if the *given* exception matches the exception type in *exc*. If *exc* is a class object, this also returns true when *given* is an instance of a subclass. If *exc* is a tuple, all exception types in the tuple (and recursively in subtuples) are searched for a match." +#: ../../c-api/exceptions.rst:484 +msgid "" +"Return true if the *given* exception matches the exception type in *exc*. " +"If *exc* is a class object, this also returns true when *given* is an " +"instance of a subclass. If *exc* is a tuple, all exception types in the " +"tuple (and recursively in subtuples) are searched for a match." msgstr "" -msgid "Return the exception currently being raised, clearing the error indicator at the same time. Return ``NULL`` if the error indicator is not set." +#: ../../c-api/exceptions.rst:492 +msgid "" +"Return the exception currently being raised, clearing the error indicator at " +"the same time. Return ``NULL`` if the error indicator is not set." msgstr "" -msgid "This function is used by code that needs to catch exceptions, or code that needs to save and restore the error indicator temporarily." +#: ../../c-api/exceptions.rst:495 +msgid "" +"This function is used by code that needs to catch exceptions, or code that " +"needs to save and restore the error indicator temporarily." msgstr "" +#: ../../c-api/exceptions.rst:498 ../../c-api/exceptions.rst:543 msgid "For example::" msgstr "" +#: ../../c-api/exceptions.rst:500 msgid "" "{\n" " PyObject *exc = PyErr_GetRaisedException();\n" @@ -241,24 +551,47 @@ msgid "" "}" msgstr "" -msgid ":c:func:`PyErr_GetHandledException`, to save the exception currently being handled." +#: ../../c-api/exceptions.rst:508 +msgid "" +":c:func:`PyErr_GetHandledException`, to save the exception currently being " +"handled." msgstr "" -msgid "Set *exc* as the exception currently being raised, clearing the existing exception if one is set." +#: ../../c-api/exceptions.rst:516 +msgid "" +"Set *exc* as the exception currently being raised, clearing the existing " +"exception if one is set. If *exc* is ``NULL``, just clear the existing " +"exception." msgstr "" -msgid "This call steals a reference to *exc*, which must be a valid exception." +#: ../../c-api/exceptions.rst:520 +msgid "*exc* must be a valid exception or ``NULL``." msgstr "" +#: ../../c-api/exceptions.rst:522 +msgid "This call \":term:`steals `\" a reference to *exc*." +msgstr "" + +#: ../../c-api/exceptions.rst:531 msgid "Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -msgid "Retrieve the error indicator into three variables whose addresses are passed. If the error indicator is not set, set all three variables to ``NULL``. If it is set, it will be cleared and you own a reference to each object retrieved. The value and traceback object may be ``NULL`` even when the type object is not." +#: ../../c-api/exceptions.rst:533 +msgid "" +"Retrieve the error indicator into three variables whose addresses are " +"passed. If the error indicator is not set, set all three variables to " +"``NULL``. If it is set, it will be cleared and you own a reference to each " +"object retrieved. The value and traceback object may be ``NULL`` even when " +"the type object is not." msgstr "" -msgid "This function is normally only used by legacy code that needs to catch exceptions or save and restore the error indicator temporarily." +#: ../../c-api/exceptions.rst:540 +msgid "" +"This function is normally only used by legacy code that needs to catch " +"exceptions or save and restore the error indicator temporarily." msgstr "" +#: ../../c-api/exceptions.rst:545 msgid "" "{\n" " PyObject *type, *value, *traceback;\n" @@ -270,581 +603,1014 @@ msgid "" "}" msgstr "" +#: ../../c-api/exceptions.rst:559 msgid "Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -msgid "Set the error indicator from the three objects, *type*, *value*, and *traceback*, clearing the existing exception if one is set. If the objects are ``NULL``, the error indicator is cleared. Do not pass a ``NULL`` type and non-``NULL`` value or traceback. The exception type should be a class. Do not pass an invalid exception type or value. (Violating these rules will cause subtle problems later.) This call takes away a reference to each object: you must own a reference to each object before the call and after the call you no longer own these references. (If you don't understand this, don't use this function. I warned you.)" -msgstr "" - -msgid "This function is normally only used by legacy code that needs to save and restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save the current error indicator." +#: ../../c-api/exceptions.rst:561 +msgid "" +"Set the error indicator from the three objects, *type*, *value*, and " +"*traceback*, clearing the existing exception if one is set. If the objects " +"are ``NULL``, the error indicator is cleared. Do not pass a ``NULL`` type " +"and non-``NULL`` value or traceback. The exception type should be a class. " +"Do not pass an invalid exception type or value. (Violating these rules will " +"cause subtle problems later.) This call takes away a reference to each " +"object: you must own a reference to each object before the call and after " +"the call you no longer own these references. (If you don't understand this, " +"don't use this function. I warned you.)" +msgstr "" + +#: ../../c-api/exceptions.rst:575 +msgid "" +"This function is normally only used by legacy code that needs to save and " +"restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " +"the current error indicator." msgstr "" -msgid "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-normalization." +#: ../../c-api/exceptions.rst:584 +msgid "" +"Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" +"normalization." msgstr "" -msgid "Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` below can be \"unnormalized\", meaning that ``*exc`` is a class object but ``*val`` is not an instance of the same class. This function can be used to instantiate the class in that case. If the values are already normalized, nothing happens. The delayed normalization is implemented to improve performance." +#: ../../c-api/exceptions.rst:587 +msgid "" +"Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` " +"below can be \"unnormalized\", meaning that ``*exc`` is a class object but " +"``*val`` is not an instance of the same class. This function can be used " +"to instantiate the class in that case. If the values are already " +"normalized, nothing happens. The delayed normalization is implemented to " +"improve performance." msgstr "" -msgid "This function *does not* implicitly set the :attr:`~BaseException.__traceback__` attribute on the exception value. If setting the traceback appropriately is desired, the following additional snippet is needed::" +#: ../../c-api/exceptions.rst:595 +msgid "" +"This function *does not* implicitly set " +"the :attr:`~BaseException.__traceback__` attribute on the exception value. " +"If setting the traceback appropriately is desired, the following additional " +"snippet is needed::" msgstr "" +#: ../../c-api/exceptions.rst:600 msgid "" "if (tb != NULL) {\n" " PyException_SetTraceback(val, tb);\n" "}" msgstr "" -msgid "Retrieve the active exception instance, as would be returned by :func:`sys.exception`. This refers to an exception that was *already caught*, not to an exception that was freshly raised. Returns a new reference to the exception or ``NULL``. Does not modify the interpreter's exception state." +#: ../../c-api/exceptions.rst:607 +msgid "" +"Retrieve the active exception instance, as would be returned " +"by :func:`sys.exception`. This refers to an exception that was *already " +"caught*, not to an exception that was freshly raised. Returns a new " +"reference to the exception or ``NULL``. Does not modify the interpreter's " +"exception state." msgstr "" -msgid "This function is not normally used by code that wants to handle exceptions. Rather, it can be used when code needs to save and restore the exception state temporarily. Use :c:func:`PyErr_SetHandledException` to restore or clear the exception state." +#: ../../c-api/exceptions.rst:614 +msgid "" +"This function is not normally used by code that wants to handle exceptions. " +"Rather, it can be used when code needs to save and restore the exception " +"state temporarily. Use :c:func:`PyErr_SetHandledException` to restore or " +"clear the exception state." msgstr "" -msgid "Set the active exception, as known from ``sys.exception()``. This refers to an exception that was *already caught*, not to an exception that was freshly raised. To clear the exception state, pass ``NULL``." +#: ../../c-api/exceptions.rst:623 +msgid "" +"Set the active exception, as known from ``sys.exception()``. This refers to " +"an exception that was *already caught*, not to an exception that was freshly " +"raised. To clear the exception state, pass ``NULL``." msgstr "" -msgid "This function is not normally used by code that wants to handle exceptions. Rather, it can be used when code needs to save and restore the exception state temporarily. Use :c:func:`PyErr_GetHandledException` to get the exception state." +#: ../../c-api/exceptions.rst:630 +msgid "" +"This function is not normally used by code that wants to handle exceptions. " +"Rather, it can be used when code needs to save and restore the exception " +"state temporarily. Use :c:func:`PyErr_GetHandledException` to get the " +"exception state." msgstr "" -msgid "Retrieve the old-style representation of the exception info, as known from :func:`sys.exc_info`. This refers to an exception that was *already caught*, not to an exception that was freshly raised. Returns new references for the three objects, any of which may be ``NULL``. Does not modify the exception info state. This function is kept for backwards compatibility. Prefer using :c:func:`PyErr_GetHandledException`." +#: ../../c-api/exceptions.rst:639 +msgid "" +"Retrieve the old-style representation of the exception info, as known " +"from :func:`sys.exc_info`. This refers to an exception that was *already " +"caught*, not to an exception that was freshly raised. Returns new " +"references for the three objects, any of which may be ``NULL``. Does not " +"modify the exception info state. This function is kept for backwards " +"compatibility. Prefer using :c:func:`PyErr_GetHandledException`." msgstr "" -msgid "This function is not normally used by code that wants to handle exceptions. Rather, it can be used when code needs to save and restore the exception state temporarily. Use :c:func:`PyErr_SetExcInfo` to restore or clear the exception state." +#: ../../c-api/exceptions.rst:648 +msgid "" +"This function is not normally used by code that wants to handle exceptions. " +"Rather, it can be used when code needs to save and restore the exception " +"state temporarily. Use :c:func:`PyErr_SetExcInfo` to restore or clear the " +"exception state." msgstr "" -msgid "Set the exception info, as known from ``sys.exc_info()``. This refers to an exception that was *already caught*, not to an exception that was freshly raised. This function steals the references of the arguments. To clear the exception state, pass ``NULL`` for all three arguments. This function is kept for backwards compatibility. Prefer using :c:func:`PyErr_SetHandledException`." +#: ../../c-api/exceptions.rst:658 +msgid "" +"Set the exception info, as known from ``sys.exc_info()``. This refers to an " +"exception that was *already caught*, not to an exception that was freshly " +"raised. This function \":term:`steals `\" the references of the " +"arguments. To clear the exception state, pass ``NULL`` for all three " +"arguments. This function is kept for backwards compatibility. Prefer " +"using :c:func:`PyErr_SetHandledException`." msgstr "" -msgid "This function is not normally used by code that wants to handle exceptions. Rather, it can be used when code needs to save and restore the exception state temporarily. Use :c:func:`PyErr_GetExcInfo` to read the exception state." +#: ../../c-api/exceptions.rst:668 +msgid "" +"This function is not normally used by code that wants to handle exceptions. " +"Rather, it can be used when code needs to save and restore the exception " +"state temporarily. Use :c:func:`PyErr_GetExcInfo` to read the exception " +"state." msgstr "" -msgid "The ``type`` and ``traceback`` arguments are no longer used and can be NULL. The interpreter now derives them from the exception instance (the ``value`` argument). The function still steals references of all three arguments." +#: ../../c-api/exceptions.rst:675 +msgid "" +"The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " +"The interpreter now derives them from the exception instance (the ``value`` " +"argument). The function still \":term:`steals `\" references of all " +"three arguments." msgstr "" +#: ../../c-api/exceptions.rst:683 msgid "Signal Handling" msgstr "" -msgid "Handle external interruptions, such as signals or activating a debugger, whose processing has been delayed until it is safe to run Python code and/or raise exceptions." +#: ../../c-api/exceptions.rst:693 +msgid "" +"Handle external interruptions, such as signals or activating a debugger, " +"whose processing has been delayed until it is safe to run Python code and/or " +"raise exceptions." msgstr "" -msgid "For example, pressing :kbd:`Ctrl-C` causes a terminal to send the :py:data:`signal.SIGINT` signal. This function executes the corresponding Python signal handler, which, by default, raises the :exc:`KeyboardInterrupt` exception." +#: ../../c-api/exceptions.rst:697 +msgid "" +"For example, pressing :kbd:`Ctrl-C` causes a terminal to send " +"the :py:data:`signal.SIGINT` signal. This function executes the " +"corresponding Python signal handler, which, by default, raises " +"the :exc:`KeyboardInterrupt` exception." msgstr "" -msgid ":c:func:`!PyErr_CheckSignals` should be called by long-running C code frequently enough so that the response appears immediate to humans." +#: ../../c-api/exceptions.rst:702 +msgid "" +":c:func:`!PyErr_CheckSignals` should be called by long-running C code " +"frequently enough so that the response appears immediate to humans." msgstr "" +#: ../../c-api/exceptions.rst:705 msgid "Handlers invoked by this function currently include:" msgstr "" -msgid "Signal handlers, including Python functions registered using the :mod:`signal` module." +#: ../../c-api/exceptions.rst:707 +msgid "" +"Signal handlers, including Python functions registered using " +"the :mod:`signal` module." msgstr "" -msgid "Signal handlers are only run in the main thread of the main interpreter." +#: ../../c-api/exceptions.rst:710 +msgid "" +"Signal handlers are only run in the main thread of the main interpreter." msgstr "" -msgid "(This is where the function got the name: originally, signals were the only way to interrupt the interpreter.)" +#: ../../c-api/exceptions.rst:712 +msgid "" +"(This is where the function got the name: originally, signals were the only " +"way to interrupt the interpreter.)" msgstr "" +#: ../../c-api/exceptions.rst:715 msgid "Running the garbage collector, if necessary." msgstr "" +#: ../../c-api/exceptions.rst:717 msgid "Executing a pending :ref:`remote debugger ` script." msgstr "" -msgid "If any handler raises an exception, immediately return ``-1`` with that exception set. Any remaining interruptions are left to be processed on the next :c:func:`PyErr_CheckSignals()` invocation, if appropriate." +#: ../../c-api/exceptions.rst:719 +msgid "" +"If any handler raises an exception, immediately return ``-1`` with that " +"exception set. Any remaining interruptions are left to be processed on the " +"next :c:func:`PyErr_CheckSignals()` invocation, if appropriate." msgstr "" -msgid "If all handlers finish successfully, or there are no handlers to run, return ``0``." +#: ../../c-api/exceptions.rst:724 +msgid "" +"If all handlers finish successfully, or there are no handlers to run, return " +"``0``." msgstr "" +#: ../../c-api/exceptions.rst:727 msgid "This function may now invoke the garbage collector." msgstr "" -msgid "This function may now execute a remote debugger script, if remote debugging is enabled." +#: ../../c-api/exceptions.rst:730 +msgid "" +"This function may now execute a remote debugger script, if remote debugging " +"is enabled." msgstr "" -msgid "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is equivalent to ``PyErr_SetInterruptEx(SIGINT)``." +#: ../../c-api/exceptions.rst:742 +msgid "" +"Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " +"equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -msgid "This function is async-signal-safe. It can be called without an :term:`attached thread state` and from a C signal handler." +#: ../../c-api/exceptions.rst:746 ../../c-api/exceptions.rst:773 +msgid "" +"This function is async-signal-safe. It can be called without " +"an :term:`attached thread state` and from a C signal handler." msgstr "" -msgid "Simulate the effect of a signal arriving. The next time :c:func:`PyErr_CheckSignals` is called, the Python signal handler for the given signal number will be called." +#: ../../c-api/exceptions.rst:756 +msgid "" +"Simulate the effect of a signal arriving. The next " +"time :c:func:`PyErr_CheckSignals` is called, the Python signal handler for " +"the given signal number will be called." msgstr "" -msgid "This function can be called by C code that sets up its own signal handling and wants Python signal handlers to be invoked as expected when an interruption is requested (for example when the user presses Ctrl-C to interrupt an operation)." +#: ../../c-api/exceptions.rst:760 +msgid "" +"This function can be called by C code that sets up its own signal handling " +"and wants Python signal handlers to be invoked as expected when an " +"interruption is requested (for example when the user presses Ctrl-C to " +"interrupt an operation)." msgstr "" -msgid "If the given signal isn't handled by Python (it was set to :py:const:`signal.SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." +#: ../../c-api/exceptions.rst:765 +msgid "" +"If the given signal isn't handled by Python (it was set " +"to :py:const:`signal.SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be " +"ignored." msgstr "" -msgid "If *signum* is outside of the allowed range of signal numbers, ``-1`` is returned. Otherwise, ``0`` is returned. The error indicator is never changed by this function." +#: ../../c-api/exceptions.rst:768 +msgid "" +"If *signum* is outside of the allowed range of signal numbers, ``-1`` is " +"returned. Otherwise, ``0`` is returned. The error indicator is never " +"changed by this function." msgstr "" -msgid "This utility function specifies a file descriptor to which the signal number is written as a single byte whenever a signal is received. *fd* must be non-blocking. It returns the previous such file descriptor." +#: ../../c-api/exceptions.rst:781 +msgid "" +"This utility function specifies a file descriptor to which the signal number " +"is written as a single byte whenever a signal is received. *fd* must be non-" +"blocking. It returns the previous such file descriptor." msgstr "" -msgid "The value ``-1`` disables the feature; this is the initial state. This is equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error checking. *fd* should be a valid file descriptor. The function should only be called from the main thread." +#: ../../c-api/exceptions.rst:785 +msgid "" +"The value ``-1`` disables the feature; this is the initial state. This is " +"equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " +"checking. *fd* should be a valid file descriptor. The function should only " +"be called from the main thread." msgstr "" +#: ../../c-api/exceptions.rst:790 msgid "On Windows, the function now also supports socket handles." msgstr "" +#: ../../c-api/exceptions.rst:795 msgid "Exception Classes" msgstr "" -msgid "This utility function creates and returns a new exception class. The *name* argument must be the name of the new exception, a C string of the form ``module.classname``. The *base* and *dict* arguments are normally ``NULL``. This creates a class object derived from :exc:`Exception` (accessible in C as :c:data:`PyExc_Exception`)." +#: ../../c-api/exceptions.rst:799 +msgid "" +"This utility function creates and returns a new exception class. The *name* " +"argument must be the name of the new exception, a C string of the form " +"``module.classname``. The *base* and *dict* arguments are normally " +"``NULL``. This creates a class object derived from :exc:`Exception` " +"(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -msgid "The :attr:`~type.__module__` attribute of the new class is set to the first part (up to the last dot) of the *name* argument, and the class name is set to the last part (after the last dot). The *base* argument can be used to specify alternate base classes; it can either be only one class or a tuple of classes. The *dict* argument can be used to specify a dictionary of class variables and methods." +#: ../../c-api/exceptions.rst:805 +msgid "" +"The :attr:`~type.__module__` attribute of the new class is set to the first " +"part (up to the last dot) of the *name* argument, and the class name is set " +"to the last part (after the last dot). The *base* argument can be used to " +"specify alternate base classes; it can either be only one class or a tuple " +"of classes. The *dict* argument can be used to specify a dictionary of class " +"variables and methods." msgstr "" -msgid "Same as :c:func:`PyErr_NewException`, except that the new exception class can easily be given a docstring: If *doc* is non-``NULL``, it will be used as the docstring for the exception class." +#: ../../c-api/exceptions.rst:814 +msgid "" +"Same as :c:func:`PyErr_NewException`, except that the new exception class " +"can easily be given a docstring: If *doc* is non-``NULL``, it will be used " +"as the docstring for the exception class." msgstr "" -msgid "Return non-zero if *ob* is an exception class, zero otherwise. This function always succeeds." +#: ../../c-api/exceptions.rst:823 +msgid "" +"Return non-zero if *ob* is an exception class, zero otherwise. This function " +"always succeeds." msgstr "" +#: ../../c-api/exceptions.rst:828 msgid "Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*." msgstr "" +#: ../../c-api/exceptions.rst:832 msgid "Exception Objects" msgstr "" -msgid "Return true if *op* is an instance of :class:`BaseException`, false otherwise. This function always succeeds." +#: ../../c-api/exceptions.rst:836 +msgid "" +"Return true if *op* is an instance of :class:`BaseException`, false " +"otherwise. This function always succeeds." msgstr "" +#: ../../c-api/exceptions.rst:842 msgid "Equivalent to :c:func:`Py_TYPE(op) `." msgstr "" -msgid "Return the traceback associated with the exception as a new reference, as accessible from Python through the :attr:`~BaseException.__traceback__` attribute. If there is no traceback associated, this returns ``NULL``." +#: ../../c-api/exceptions.rst:847 +msgid "" +"Return the traceback associated with the exception as a new reference, as " +"accessible from Python through the :attr:`~BaseException.__traceback__` " +"attribute. If there is no traceback associated, this returns ``NULL``." msgstr "" -msgid "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to clear it." +#: ../../c-api/exceptions.rst:855 +msgid "" +"Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " +"clear it." msgstr "" -msgid "Return the context (another exception instance during whose handling *ex* was raised) associated with the exception as a new reference, as accessible from Python through the :attr:`~BaseException.__context__` attribute. If there is no context associated, this returns ``NULL``." +#: ../../c-api/exceptions.rst:861 +msgid "" +"Return the context (another exception instance during whose handling *ex* " +"was raised) associated with the exception as a new reference, as accessible " +"from Python through the :attr:`~BaseException.__context__` attribute. If " +"there is no context associated, this returns ``NULL``." msgstr "" -msgid "Set the context associated with the exception to *ctx*. Use ``NULL`` to clear it. There is no type check to make sure that *ctx* is an exception instance. This steals a reference to *ctx*." +#: ../../c-api/exceptions.rst:869 +msgid "" +"Set the context associated with the exception to *ctx*. Use ``NULL`` to " +"clear it. There is no type check to make sure that *ctx* is an exception " +"instance. This \":term:`steals `\" a reference to *ctx*." msgstr "" -msgid "Return the cause (either an exception instance, or ``None``, set by ``raise ... from ...``) associated with the exception as a new reference, as accessible from Python through the :attr:`~BaseException.__cause__` attribute." +#: ../../c-api/exceptions.rst:876 +msgid "" +"Return the cause (either an exception instance, or ``None``, set by " +"``raise ... from ...``) associated with the exception as a new reference, as " +"accessible from Python through the :attr:`~BaseException.__cause__` " +"attribute." msgstr "" -msgid "Set the cause associated with the exception to *cause*. Use ``NULL`` to clear it. There is no type check to make sure that *cause* is either an exception instance or ``None``. This steals a reference to *cause*." +#: ../../c-api/exceptions.rst:884 +msgid "" +"Set the cause associated with the exception to *cause*. Use ``NULL`` to " +"clear it. There is no type check to make sure that *cause* is either an " +"exception instance or ``None``. This \":term:`steals `\" a reference " +"to *cause*." msgstr "" -msgid "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set to ``True`` by this function." +#: ../../c-api/exceptions.rst:889 +msgid "" +"The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " +"to ``True`` by this function." msgstr "" +#: ../../c-api/exceptions.rst:895 msgid "Return :attr:`~BaseException.args` of exception *ex*." msgstr "" +#: ../../c-api/exceptions.rst:900 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." msgstr "" -msgid "Implement part of the interpreter's implementation of :keyword:`!except*`. *orig* is the original exception that was caught, and *excs* is the list of the exceptions that need to be raised. This list contains the unhandled part of *orig*, if any, as well as the exceptions that were raised from the :keyword:`!except*` clauses (so they have a different traceback from *orig*) and those that were reraised (and have the same traceback as *orig*). Return the :exc:`ExceptionGroup` that needs to be reraised in the end, or ``None`` if there is nothing to reraise." +#: ../../c-api/exceptions.rst:904 +msgid "" +"Implement part of the interpreter's implementation of :keyword:`!except*`. " +"*orig* is the original exception that was caught, and *excs* is the list of " +"the exceptions that need to be raised. This list contains the unhandled part " +"of *orig*, if any, as well as the exceptions that were raised from " +"the :keyword:`!except*` clauses (so they have a different traceback from " +"*orig*) and those that were reraised (and have the same traceback as " +"*orig*). Return the :exc:`ExceptionGroup` that needs to be reraised in the " +"end, or ``None`` if there is nothing to reraise." msgstr "" +#: ../../c-api/exceptions.rst:918 msgid "Unicode Exception Objects" msgstr "" -msgid "The following functions are used to create and modify Unicode exceptions from C." +#: ../../c-api/exceptions.rst:920 +msgid "" +"The following functions are used to create and modify Unicode exceptions " +"from C." msgstr "" -msgid "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, *object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are UTF-8 encoded strings." +#: ../../c-api/exceptions.rst:924 +msgid "" +"Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " +"*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " +"UTF-8 encoded strings." msgstr "" +#: ../../c-api/exceptions.rst:931 msgid "Return the *encoding* attribute of the given exception object." msgstr "" +#: ../../c-api/exceptions.rst:937 msgid "Return the *object* attribute of the given exception object." msgstr "" -msgid "Get the *start* attribute of the given exception object and place it into *\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` on failure." +#: ../../c-api/exceptions.rst:943 +msgid "" +"Get the *start* attribute of the given exception object and place it into " +"*\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " +"on failure." msgstr "" -msgid "If the :attr:`UnicodeError.object` is an empty sequence, the resulting *start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." +#: ../../c-api/exceptions.rst:947 +msgid "" +"If the :attr:`UnicodeError.object` is an empty sequence, the resulting " +"*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." msgstr "" +#: ../../c-api/exceptions.rst:950 msgid ":attr:`UnicodeError.start`" msgstr "" -msgid "Set the *start* attribute of the given exception object to *start*. Return ``0`` on success, ``-1`` on failure." +#: ../../c-api/exceptions.rst:956 +msgid "" +"Set the *start* attribute of the given exception object to *start*. Return " +"``0`` on success, ``-1`` on failure." msgstr "" -msgid "While passing a negative *start* does not raise an exception, the corresponding getters will not consider it as a relative offset." +#: ../../c-api/exceptions.rst:961 +msgid "" +"While passing a negative *start* does not raise an exception, the " +"corresponding getters will not consider it as a relative offset." msgstr "" -msgid "Get the *end* attribute of the given exception object and place it into *\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on failure." +#: ../../c-api/exceptions.rst:969 +msgid "" +"Get the *end* attribute of the given exception object and place it into " +"*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " +"failure." msgstr "" -msgid "If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." +#: ../../c-api/exceptions.rst:973 +msgid "" +"If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* " +"is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." msgstr "" -msgid "Set the *end* attribute of the given exception object to *end*. Return ``0`` on success, ``-1`` on failure." +#: ../../c-api/exceptions.rst:980 +msgid "" +"Set the *end* attribute of the given exception object to *end*. Return " +"``0`` on success, ``-1`` on failure." msgstr "" +#: ../../c-api/exceptions.rst:983 msgid ":attr:`UnicodeError.end`" msgstr "" +#: ../../c-api/exceptions.rst:989 msgid "Return the *reason* attribute of the given exception object." msgstr "" -msgid "Set the *reason* attribute of the given exception object to *reason*. Return ``0`` on success, ``-1`` on failure." +#: ../../c-api/exceptions.rst:995 +msgid "" +"Set the *reason* attribute of the given exception object to *reason*. " +"Return ``0`` on success, ``-1`` on failure." msgstr "" +#: ../../c-api/exceptions.rst:1002 msgid "Recursion Control" msgstr "" -msgid "These two functions provide a way to perform safe recursive calls at the C level, both in the core and in extension modules. They are needed if the recursive code does not necessarily invoke Python code (which tracks its recursion depth automatically). They are also not needed for *tp_call* implementations because the :ref:`call protocol ` takes care of recursion handling." +#: ../../c-api/exceptions.rst:1004 +msgid "" +"These two functions provide a way to perform safe recursive calls at the C " +"level, both in the core and in extension modules. They are needed if the " +"recursive code does not necessarily invoke Python code (which tracks its " +"recursion depth automatically). They are also not needed for *tp_call* " +"implementations because the :ref:`call protocol ` takes care of " +"recursion handling." msgstr "" +#: ../../c-api/exceptions.rst:1013 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -msgid "The function then checks if the stack limit is reached. If this is the case, a :exc:`RecursionError` is set and a nonzero value is returned. Otherwise, zero is returned." +#: ../../c-api/exceptions.rst:1015 +msgid "" +"The function then checks if the stack limit is reached. If this is the " +"case, a :exc:`RecursionError` is set and a nonzero value is returned. " +"Otherwise, zero is returned." msgstr "" -msgid "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` to be concatenated to the :exc:`RecursionError` message caused by the recursion depth limit." +#: ../../c-api/exceptions.rst:1019 +msgid "" +"*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " +"to be concatenated to the :exc:`RecursionError` message caused by the " +"recursion depth limit." msgstr "" +#: ../../c-api/exceptions.rst:1024 msgid "The :c:func:`PyUnstable_ThreadState_SetStackProtection` function." msgstr "" -msgid "This function is now also available in the :ref:`limited API `." +#: ../../c-api/exceptions.rst:1026 ../../c-api/exceptions.rst:1034 +msgid "" +"This function is now also available in the :ref:`limited API `." msgstr "" -msgid "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each *successful* invocation of :c:func:`Py_EnterRecursiveCall`." +#: ../../c-api/exceptions.rst:1031 +msgid "" +"Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " +"*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -msgid "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types requires special recursion handling. In addition to protecting the stack, :c:member:`~PyTypeObject.tp_repr` also needs to track objects to prevent cycles. The following two functions facilitate this functionality. Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." +#: ../../c-api/exceptions.rst:1037 +msgid "" +"Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " +"requires special recursion handling. In addition to protecting the " +"stack, :c:member:`~PyTypeObject.tp_repr` also needs to track objects to " +"prevent cycles. The following two functions facilitate this functionality. " +"Effectively, these are the C equivalent to :deco:`reprlib.recursive_repr`." msgstr "" -msgid "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` implementation to detect cycles." +#: ../../c-api/exceptions.rst:1045 +msgid "" +"Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " +"implementation to detect cycles." msgstr "" -msgid "If the object has already been processed, the function returns a positive integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation should return a string object indicating a cycle. As examples, :class:`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." +#: ../../c-api/exceptions.rst:1048 +msgid "" +"If the object has already been processed, the function returns a positive " +"integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " +"should return a string object indicating a cycle. As " +"examples, :class:`dict` objects return ``{...}`` and :class:`list` objects " +"return ``[...]``." msgstr "" -msgid "The function will return a negative integer if the recursion limit is reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation should typically return ``NULL``." +#: ../../c-api/exceptions.rst:1054 +msgid "" +"The function will return a negative integer if the recursion limit is " +"reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " +"should typically return ``NULL``." msgstr "" -msgid "Otherwise, the function returns zero and the :c:member:`~PyTypeObject.tp_repr` implementation can continue normally." +#: ../../c-api/exceptions.rst:1058 +msgid "" +"Otherwise, the function returns zero and " +"the :c:member:`~PyTypeObject.tp_repr` implementation can continue normally." msgstr "" -msgid "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :c:func:`Py_ReprEnter` that returns zero." +#: ../../c-api/exceptions.rst:1063 +msgid "" +"Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation " +"of :c:func:`Py_ReprEnter` that returns zero." msgstr "" -msgid "Get the recursion limit for the current interpreter. It can be set with :c:func:`Py_SetRecursionLimit`. The recursion limit prevents the Python interpreter stack from growing infinitely." +#: ../../c-api/exceptions.rst:1068 +msgid "" +"Get the recursion limit for the current interpreter. It can be set " +"with :c:func:`Py_SetRecursionLimit`. The recursion limit prevents the Python " +"interpreter stack from growing infinitely." msgstr "" -msgid "This function cannot fail, and the caller must hold an :term:`attached thread state`." +#: ../../c-api/exceptions.rst:1072 ../../c-api/exceptions.rst:1082 +msgid "" +"This function cannot fail, and the caller must hold an :term:`attached " +"thread state`." msgstr "" +#: ../../c-api/exceptions.rst:1076 msgid ":py:func:`sys.getrecursionlimit`" msgstr "" +#: ../../c-api/exceptions.rst:1080 msgid "Set the recursion limit for the current interpreter." msgstr "" +#: ../../c-api/exceptions.rst:1086 msgid ":py:func:`sys.setrecursionlimit`" msgstr "" +#: ../../c-api/exceptions.rst:1091 msgid "Exception and warning types" msgstr "" -msgid "All standard Python exceptions and warning categories are available as global variables whose names are ``PyExc_`` followed by the Python exception name. These have the type :c:expr:`PyObject*`; they are all class objects." +#: ../../c-api/exceptions.rst:1093 +msgid "" +"All standard Python exceptions and warning categories are available as " +"global variables whose names are ``PyExc_`` followed by the Python exception " +"name. These have the type :c:expr:`PyObject*`; they are all class objects." msgstr "" +#: ../../c-api/exceptions.rst:1097 msgid "For completeness, here are all the variables:" msgstr "" +#: ../../c-api/exceptions.rst:1100 msgid "Exception types" msgstr "" +#: ../../c-api/exceptions.rst:1107 ../../c-api/exceptions.rst:1253 +#: ../../c-api/exceptions.rst:1283 msgid "C name" msgstr "" +#: ../../c-api/exceptions.rst:1108 ../../c-api/exceptions.rst:1254 +#: ../../c-api/exceptions.rst:1284 msgid "Python name" msgstr "" +#: ../../c-api/exceptions.rst:1110 msgid ":exc:`BaseException`" msgstr "" +#: ../../c-api/exceptions.rst:1112 msgid ":exc:`BaseExceptionGroup`" msgstr "" +#: ../../c-api/exceptions.rst:1114 msgid ":exc:`Exception`" msgstr "" +#: ../../c-api/exceptions.rst:1116 msgid ":exc:`ArithmeticError`" msgstr "" +#: ../../c-api/exceptions.rst:1118 msgid ":exc:`AssertionError`" msgstr "" +#: ../../c-api/exceptions.rst:1120 msgid ":exc:`AttributeError`" msgstr "" +#: ../../c-api/exceptions.rst:1122 msgid ":exc:`BlockingIOError`" msgstr "" +#: ../../c-api/exceptions.rst:1124 msgid ":exc:`BrokenPipeError`" msgstr "" +#: ../../c-api/exceptions.rst:1126 msgid ":exc:`BufferError`" msgstr "" +#: ../../c-api/exceptions.rst:1128 msgid ":exc:`ChildProcessError`" msgstr "" +#: ../../c-api/exceptions.rst:1130 msgid ":exc:`ConnectionAbortedError`" msgstr "" +#: ../../c-api/exceptions.rst:1132 msgid ":exc:`ConnectionError`" msgstr "" +#: ../../c-api/exceptions.rst:1134 msgid ":exc:`ConnectionRefusedError`" msgstr "" +#: ../../c-api/exceptions.rst:1136 msgid ":exc:`ConnectionResetError`" msgstr "" +#: ../../c-api/exceptions.rst:1138 msgid ":exc:`EOFError`" msgstr "" +#: ../../c-api/exceptions.rst:1140 msgid ":exc:`FileExistsError`" msgstr "" +#: ../../c-api/exceptions.rst:1142 msgid ":exc:`FileNotFoundError`" msgstr "" +#: ../../c-api/exceptions.rst:1144 msgid ":exc:`FloatingPointError`" msgstr "" +#: ../../c-api/exceptions.rst:1146 msgid ":exc:`GeneratorExit`" msgstr "" +#: ../../c-api/exceptions.rst:1148 msgid ":exc:`ImportError`" msgstr "" +#: ../../c-api/exceptions.rst:1150 msgid ":exc:`IndentationError`" msgstr "" +#: ../../c-api/exceptions.rst:1152 msgid ":exc:`IndexError`" msgstr "" +#: ../../c-api/exceptions.rst:1154 msgid ":exc:`InterruptedError`" msgstr "" +#: ../../c-api/exceptions.rst:1156 msgid ":exc:`IsADirectoryError`" msgstr "" +#: ../../c-api/exceptions.rst:1158 msgid ":exc:`KeyError`" msgstr "" +#: ../../c-api/exceptions.rst:1160 msgid ":exc:`KeyboardInterrupt`" msgstr "" +#: ../../c-api/exceptions.rst:1162 msgid ":exc:`LookupError`" msgstr "" +#: ../../c-api/exceptions.rst:1164 msgid ":exc:`MemoryError`" msgstr "" +#: ../../c-api/exceptions.rst:1166 msgid ":exc:`ModuleNotFoundError`" msgstr "" +#: ../../c-api/exceptions.rst:1168 msgid ":exc:`NameError`" msgstr "" +#: ../../c-api/exceptions.rst:1170 msgid ":exc:`NotADirectoryError`" msgstr "" +#: ../../c-api/exceptions.rst:1172 msgid ":exc:`NotImplementedError`" msgstr "" +#: ../../c-api/exceptions.rst:1174 ../../c-api/exceptions.rst:1257 +#: ../../c-api/exceptions.rst:1260 ../../c-api/exceptions.rst:1263 msgid ":exc:`OSError`" msgstr "" +#: ../../c-api/exceptions.rst:1176 msgid ":exc:`OverflowError`" msgstr "" +#: ../../c-api/exceptions.rst:1178 msgid ":exc:`PermissionError`" msgstr "" +#: ../../c-api/exceptions.rst:1180 msgid ":exc:`ProcessLookupError`" msgstr "" +#: ../../c-api/exceptions.rst:1182 msgid ":exc:`PythonFinalizationError`" msgstr "" +#: ../../c-api/exceptions.rst:1184 msgid ":exc:`RecursionError`" msgstr "" +#: ../../c-api/exceptions.rst:1186 msgid ":exc:`ReferenceError`" msgstr "" +#: ../../c-api/exceptions.rst:1188 msgid ":exc:`RuntimeError`" msgstr "" +#: ../../c-api/exceptions.rst:1190 msgid ":exc:`StopAsyncIteration`" msgstr "" +#: ../../c-api/exceptions.rst:1192 msgid ":exc:`StopIteration`" msgstr "" +#: ../../c-api/exceptions.rst:1194 msgid ":exc:`SyntaxError`" msgstr "" +#: ../../c-api/exceptions.rst:1196 msgid ":exc:`SystemError`" msgstr "" +#: ../../c-api/exceptions.rst:1198 msgid ":exc:`SystemExit`" msgstr "" +#: ../../c-api/exceptions.rst:1200 msgid ":exc:`TabError`" msgstr "" +#: ../../c-api/exceptions.rst:1202 msgid ":exc:`TimeoutError`" msgstr "" +#: ../../c-api/exceptions.rst:1204 msgid ":exc:`TypeError`" msgstr "" +#: ../../c-api/exceptions.rst:1206 msgid ":exc:`UnboundLocalError`" msgstr "" +#: ../../c-api/exceptions.rst:1208 msgid ":exc:`UnicodeDecodeError`" msgstr "" +#: ../../c-api/exceptions.rst:1210 msgid ":exc:`UnicodeEncodeError`" msgstr "" +#: ../../c-api/exceptions.rst:1212 msgid ":exc:`UnicodeError`" msgstr "" +#: ../../c-api/exceptions.rst:1214 msgid ":exc:`UnicodeTranslateError`" msgstr "" +#: ../../c-api/exceptions.rst:1216 msgid ":exc:`ValueError`" msgstr "" +#: ../../c-api/exceptions.rst:1218 msgid ":exc:`ZeroDivisionError`" msgstr "" -msgid ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`." +#: ../../c-api/exceptions.rst:1220 +msgid "" +":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`, :c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`, :c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`, :c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`, :c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` " +"and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`." msgstr "" +#: ../../c-api/exceptions.rst:1230 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr "" +#: ../../c-api/exceptions.rst:1233 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr "" +#: ../../c-api/exceptions.rst:1236 msgid ":c:data:`PyExc_BaseExceptionGroup`." msgstr "" +#: ../../c-api/exceptions.rst:1241 msgid "OSError aliases" msgstr "" +#: ../../c-api/exceptions.rst:1243 msgid "The following are a compatibility aliases to :c:data:`PyExc_OSError`." msgstr "" +#: ../../c-api/exceptions.rst:1245 msgid "These aliases used to be separate exception types." msgstr "" +#: ../../c-api/exceptions.rst:1255 msgid "Notes" msgstr "" +#: ../../c-api/exceptions.rst:1264 msgid "[win]_" msgstr "" +#: ../../c-api/exceptions.rst:1266 msgid "Notes:" msgstr "" -msgid ":c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined." +#: ../../c-api/exceptions.rst:1269 +msgid "" +":c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that " +"uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" +#: ../../c-api/exceptions.rst:1276 msgid "Warning types" msgstr "" +#: ../../c-api/exceptions.rst:1286 msgid ":exc:`Warning`" msgstr "" +#: ../../c-api/exceptions.rst:1288 msgid ":exc:`BytesWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1290 msgid ":exc:`DeprecationWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1292 msgid ":exc:`EncodingWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1294 msgid ":exc:`FutureWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1296 msgid ":exc:`ImportWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1298 msgid ":exc:`PendingDeprecationWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1300 msgid ":exc:`ResourceWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1302 msgid ":exc:`RuntimeWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1304 msgid ":exc:`SyntaxWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1306 msgid ":exc:`UnicodeWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1308 msgid ":exc:`UserWarning`" msgstr "" +#: ../../c-api/exceptions.rst:1310 msgid ":c:data:`PyExc_ResourceWarning`." msgstr "" +#: ../../c-api/exceptions.rst:1313 msgid ":c:data:`PyExc_EncodingWarning`." msgstr "" +#: ../../c-api/exceptions.rst:1318 msgid "Tracebacks" msgstr "" -msgid "Type object for traceback objects. This is available as :class:`types.TracebackType` in the Python layer." +#: ../../c-api/exceptions.rst:1322 +msgid "" +"Type object for traceback objects. This is available " +"as :class:`types.TracebackType` in the Python layer." msgstr "" -msgid "Return true if *op* is a traceback object, false otherwise. This function does not account for subtypes." +#: ../../c-api/exceptions.rst:1328 +msgid "" +"Return true if *op* is a traceback object, false otherwise. This function " +"does not account for subtypes." msgstr "" -msgid "Replace the :attr:`~BaseException.__traceback__` attribute on the current exception with a new traceback prepending *f* to the existing chain." +#: ../../c-api/exceptions.rst:1334 +msgid "" +"Replace the :attr:`~BaseException.__traceback__` attribute on the current " +"exception with a new traceback prepending *f* to the existing chain." msgstr "" +#: ../../c-api/exceptions.rst:1337 msgid "Calling this function without an exception set is undefined behavior." msgstr "" -msgid "This function returns ``0`` on success, and returns ``-1`` with an exception set on failure." +#: ../../c-api/exceptions.rst:1339 ../../c-api/exceptions.rst:1347 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." msgstr "" +#: ../../c-api/exceptions.rst:1345 msgid "Write the traceback *tb* into the file *f*." msgstr "" +#: ../../c-api/exceptions.rst:198 msgid "strerror (C function)" msgstr "" +#: ../../c-api/exceptions.rst:688 ../../c-api/exceptions.rst:737 +#: ../../c-api/exceptions.rst:752 msgid "module" msgstr "" +#: ../../c-api/exceptions.rst:688 ../../c-api/exceptions.rst:737 +#: ../../c-api/exceptions.rst:752 msgid "signal" msgstr "" +#: ../../c-api/exceptions.rst:688 ../../c-api/exceptions.rst:737 msgid "SIGINT (C macro)" msgstr "" +#: ../../c-api/exceptions.rst:688 ../../c-api/exceptions.rst:737 +#: ../../c-api/exceptions.rst:752 msgid "KeyboardInterrupt (built-in exception)" msgstr "" diff --git a/c-api/extension-modules.po b/c-api/extension-modules.po index ec3a3911f..18b75a08a 100644 --- a/c-api/extension-modules.po +++ b/c-api/extension-modules.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,66 +19,148 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/extension-modules.rst:6 msgid "Defining extension modules" msgstr "" -msgid "A C extension for CPython is a shared library (for example, a ``.so`` file on Linux, ``.pyd`` DLL on Windows), which is loadable into the Python process (for example, it is compiled with compatible compiler settings), and which exports an :ref:`initialization function `." +#: ../../c-api/extension-modules.rst:8 +msgid "" +"A C extension for CPython is a shared library (for example, a ``.so`` file " +"on Linux, ``.pyd`` DLL on Windows), which is loadable into the Python " +"process (for example, it is compiled with compatible compiler settings), and " +"which exports an :ref:`initialization function `." msgstr "" -msgid "To be importable by default (that is, by :py:class:`importlib.machinery.ExtensionFileLoader`), the shared library must be available on :py:attr:`sys.path`, and must be named after the module name plus an extension listed in :py:attr:`importlib.machinery.EXTENSION_SUFFIXES`." +#: ../../c-api/extension-modules.rst:13 +msgid "" +"To be importable by default (that is, " +"by :py:class:`importlib.machinery.ExtensionFileLoader`), the shared library " +"must be available on :py:attr:`sys.path`, and must be named after the module " +"name plus an extension listed " +"in :py:attr:`importlib.machinery.EXTENSION_SUFFIXES`." msgstr "" -msgid "Building, packaging and distributing extension modules is best done with third-party tools, and is out of scope of this document. One suitable tool is Setuptools, whose documentation can be found at https://setuptools.pypa.io/en/latest/setuptools.html." +#: ../../c-api/extension-modules.rst:21 +msgid "" +"Building, packaging and distributing extension modules is best done with " +"third-party tools, and is out of scope of this document. One suitable tool " +"is Setuptools, whose documentation can be found at https://" +"setuptools.pypa.io/en/latest/setuptools.html." msgstr "" -msgid "Normally, the initialization function returns a module definition initialized using :c:func:`PyModuleDef_Init`. This allows splitting the creation process into several phases:" +#: ../../c-api/extension-modules.rst:26 +msgid "" +"Normally, the initialization function returns a module definition " +"initialized using :c:func:`PyModuleDef_Init`. This allows splitting the " +"creation process into several phases:" msgstr "" -msgid "Before any substantial code is executed, Python can determine which capabilities the module supports, and it can adjust the environment or refuse loading an incompatible extension." +#: ../../c-api/extension-modules.rst:30 +msgid "" +"Before any substantial code is executed, Python can determine which " +"capabilities the module supports, and it can adjust the environment or " +"refuse loading an incompatible extension." msgstr "" -msgid "By default, Python itself creates the module object -- that is, it does the equivalent of :py:meth:`object.__new__` for classes. It also sets initial attributes like :attr:`~module.__package__` and :attr:`~module.__loader__`." +#: ../../c-api/extension-modules.rst:33 +msgid "" +"By default, Python itself creates the module object -- that is, it does the " +"equivalent of :py:meth:`object.__new__` for classes. It also sets initial " +"attributes like :attr:`~module.__package__` and :attr:`~module.__loader__`." msgstr "" -msgid "Afterwards, the module object is initialized using extension-specific code -- the equivalent of :py:meth:`~object.__init__` on classes." +#: ../../c-api/extension-modules.rst:37 +msgid "" +"Afterwards, the module object is initialized using extension-specific code " +"-- the equivalent of :py:meth:`~object.__init__` on classes." msgstr "" -msgid "This is called *multi-phase initialization* to distinguish it from the legacy (but still supported) *single-phase initialization* scheme, where the initialization function returns a fully constructed module. See the :ref:`single-phase-initialization section below ` for details." +#: ../../c-api/extension-modules.rst:40 +msgid "" +"This is called *multi-phase initialization* to distinguish it from the " +"legacy (but still supported) *single-phase initialization* scheme, where the " +"initialization function returns a fully constructed module. See " +"the :ref:`single-phase-initialization section below ` for details." msgstr "" +#: ../../c-api/extension-modules.rst:48 msgid "Added support for multi-phase initialization (:pep:`489`)." msgstr "" +#: ../../c-api/extension-modules.rst:52 msgid "Multiple module instances" msgstr "" -msgid "By default, extension modules are not singletons. For example, if the :py:attr:`sys.modules` entry is removed and the module is re-imported, a new module object is created, and typically populated with fresh method and type objects. The old module is subject to normal garbage collection. This mirrors the behavior of pure-Python modules." +#: ../../c-api/extension-modules.rst:54 +msgid "" +"By default, extension modules are not singletons. For example, if " +"the :py:attr:`sys.modules` entry is removed and the module is re-imported, a " +"new module object is created, and typically populated with fresh method and " +"type objects. The old module is subject to normal garbage collection. This " +"mirrors the behavior of pure-Python modules." msgstr "" -msgid "Additional module instances may be created in :ref:`sub-interpreters ` or after Python runtime reinitialization (:c:func:`Py_Finalize` and :c:func:`Py_Initialize`). In these cases, sharing Python objects between module instances would likely cause crashes or undefined behavior." +#: ../../c-api/extension-modules.rst:61 +msgid "" +"Additional module instances may be created in :ref:`sub-interpreters ` or after Python runtime reinitialization " +"(:c:func:`Py_Finalize` and :c:func:`Py_Initialize`). In these cases, sharing " +"Python objects between module instances would likely cause crashes or " +"undefined behavior." msgstr "" -msgid "To avoid such issues, each instance of an extension module should be *isolated*: changes to one instance should not implicitly affect the others, and all state owned by the module, including references to Python objects, should be specific to a particular module instance. See :ref:`isolating-extensions-howto` for more details and a practical guide." +#: ../../c-api/extension-modules.rst:68 +msgid "" +"To avoid such issues, each instance of an extension module should be " +"*isolated*: changes to one instance should not implicitly affect the others, " +"and all state owned by the module, including references to Python objects, " +"should be specific to a particular module instance. See :ref:`isolating-" +"extensions-howto` for more details and a practical guide." msgstr "" -msgid "A simpler way to avoid these issues is :ref:`raising an error on repeated initialization `." +#: ../../c-api/extension-modules.rst:74 +msgid "" +"A simpler way to avoid these issues is :ref:`raising an error on repeated " +"initialization `." msgstr "" -msgid "All modules are expected to support :ref:`sub-interpreters `, or otherwise explicitly signal a lack of support. This is usually achieved by isolation or blocking repeated initialization, as above. A module may also be limited to the main interpreter using the :c:data:`Py_mod_multiple_interpreters` slot." +#: ../../c-api/extension-modules.rst:77 +msgid "" +"All modules are expected to support :ref:`sub-interpreters `, or otherwise explicitly signal a lack of support. This is usually " +"achieved by isolation or blocking repeated initialization, as above. A " +"module may also be limited to the main interpreter using " +"the :c:data:`Py_mod_multiple_interpreters` slot." msgstr "" +#: ../../c-api/extension-modules.rst:89 msgid "Initialization function" msgstr "" -msgid "The initialization function defined by an extension module has the following signature:" +#: ../../c-api/extension-modules.rst:91 +msgid "" +"The initialization function defined by an extension module has the following " +"signature:" msgstr "" -msgid "Its name should be :samp:`PyInit_{}`, with ```` replaced by the name of the module." +#: ../../c-api/extension-modules.rst:96 +msgid "" +"Its name should be :samp:`PyInit_{}`, with ```` replaced by the " +"name of the module." msgstr "" -msgid "For modules with ASCII-only names, the function must instead be named :samp:`PyInit_{}`, with ```` replaced by the name of the module. When using :ref:`multi-phase-initialization`, non-ASCII module names are allowed. In this case, the initialization function name is :samp:`PyInitU_{}`, with ```` encoded using Python's *punycode* encoding with hyphens replaced by underscores. In Python:" +#: ../../c-api/extension-modules.rst:99 +msgid "" +"For modules with ASCII-only names, the function must instead be " +"named :samp:`PyInit_{}`, with ```` replaced by the name of the " +"module. When using :ref:`multi-phase-initialization`, non-ASCII module names " +"are allowed. In this case, the initialization function name " +"is :samp:`PyInitU_{}`, with ```` encoded using Python's " +"*punycode* encoding with hyphens replaced by underscores. In Python:" msgstr "" +#: ../../c-api/extension-modules.rst:106 msgid "" "def initfunc_name(name):\n" " try:\n" @@ -88,24 +170,32 @@ msgid "" " return b'PyInit' + suffix" msgstr "" -msgid "It is recommended to define the initialization function using a helper macro:" +#: ../../c-api/extension-modules.rst:115 +msgid "" +"It is recommended to define the initialization function using a helper macro:" msgstr "" +#: ../../c-api/extension-modules.rst:119 msgid "Declare an extension module initialization function. This macro:" msgstr "" +#: ../../c-api/extension-modules.rst:122 msgid "specifies the :c:expr:`PyObject*` return type," msgstr "" +#: ../../c-api/extension-modules.rst:123 msgid "adds any special linkage declarations required by the platform, and" msgstr "" +#: ../../c-api/extension-modules.rst:124 msgid "for C++, declares the function as ``extern \"C\"``." msgstr "" +#: ../../c-api/extension-modules.rst:126 msgid "For example, a module called ``spam`` would be defined like this::" msgstr "" +#: ../../c-api/extension-modules.rst:128 msgid "" "static struct PyModuleDef spam_module = {\n" " .m_base = PyModuleDef_HEAD_INIT,\n" @@ -120,51 +210,102 @@ msgid "" "}" msgstr "" -msgid "It is possible to export multiple modules from a single shared library by defining multiple initialization functions. However, importing them requires using symbolic links or a custom importer, because by default only the function corresponding to the filename is found. See the `Multiple modules in one library `__ section in :pep:`489` for details." +#: ../../c-api/extension-modules.rst:140 +msgid "" +"It is possible to export multiple modules from a single shared library by " +"defining multiple initialization functions. However, importing them requires " +"using symbolic links or a custom importer, because by default only the " +"function corresponding to the filename is found. See the `Multiple modules " +"in one library `__ section in :pep:`489` for details." msgstr "" -msgid "The initialization function is typically the only non-\\ ``static`` item defined in the module's C source." +#: ../../c-api/extension-modules.rst:147 +msgid "" +"The initialization function is typically the only non-\\ ``static`` item " +"defined in the module's C source." msgstr "" +#: ../../c-api/extension-modules.rst:154 msgid "Multi-phase initialization" msgstr "" -msgid "Normally, the :ref:`initialization function ` (``PyInit_modulename``) returns a :c:type:`PyModuleDef` instance with non-``NULL`` :c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` instance must be initialized using the following function:" +#: ../../c-api/extension-modules.rst:156 +msgid "" +"Normally, the :ref:`initialization function ` " +"(``PyInit_modulename``) returns a :c:type:`PyModuleDef` instance with non-" +"``NULL`` :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized using the following function:" msgstr "" -msgid "Ensure a module definition is a properly initialized Python object that correctly reports its type and a reference count." +#: ../../c-api/extension-modules.rst:165 +msgid "" +"Ensure a module definition is a properly initialized Python object that " +"correctly reports its type and a reference count." msgstr "" +#: ../../c-api/extension-modules.rst:168 msgid "Return *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." msgstr "" -msgid "Calling this function is required for :ref:`multi-phase-initialization`. It should not be used in other contexts." +#: ../../c-api/extension-modules.rst:170 +msgid "" +"Calling this function is required for :ref:`multi-phase-initialization`. It " +"should not be used in other contexts." msgstr "" -msgid "Note that Python assumes that ``PyModuleDef`` structures are statically allocated. This function may return either a new reference or a borrowed one; this reference must not be released." +#: ../../c-api/extension-modules.rst:173 +msgid "" +"Note that Python assumes that ``PyModuleDef`` structures are statically " +"allocated. This function may return either a new reference or a borrowed " +"one; this reference must not be released." msgstr "" +#: ../../c-api/extension-modules.rst:184 msgid "Legacy single-phase initialization" msgstr "" -msgid "Single-phase initialization is a legacy mechanism to initialize extension modules, with known drawbacks and design flaws. Extension module authors are encouraged to use multi-phase initialization instead." +#: ../../c-api/extension-modules.rst:187 +msgid "" +"Single-phase initialization is a legacy mechanism to initialize extension " +"modules, with known drawbacks and design flaws. Extension module authors are " +"encouraged to use multi-phase initialization instead." msgstr "" -msgid "In single-phase initialization, the :ref:`initialization function ` (``PyInit_modulename``) should create, populate and return a module object. This is typically done using :c:func:`PyModule_Create` and functions like :c:func:`PyModule_AddObjectRef`." +#: ../../c-api/extension-modules.rst:191 +msgid "" +"In single-phase initialization, the :ref:`initialization function ` (``PyInit_modulename``) should create, populate and return a " +"module object. This is typically done using :c:func:`PyModule_Create` and " +"functions like :c:func:`PyModule_AddObjectRef`." msgstr "" -msgid "Single-phase initialization differs from the :ref:`default ` in the following ways:" +#: ../../c-api/extension-modules.rst:197 +msgid "" +"Single-phase initialization differs from the :ref:`default ` in the following ways:" msgstr "" +#: ../../c-api/extension-modules.rst:200 msgid "Single-phase modules are, or rather *contain*, “singletons”." msgstr "" -msgid "When the module is first initialized, Python saves the contents of the module's ``__dict__`` (that is, typically, the module's functions and types)." +#: ../../c-api/extension-modules.rst:202 +msgid "" +"When the module is first initialized, Python saves the contents of the " +"module's ``__dict__`` (that is, typically, the module's functions and types)." msgstr "" -msgid "For subsequent imports, Python does not call the initialization function again. Instead, it creates a new module object with a new ``__dict__``, and copies the saved contents to it. For example, given a single-phase module ``_testsinglephase`` [#testsinglephase]_ that defines a function ``sum`` and an exception class ``error``:" +#: ../../c-api/extension-modules.rst:206 +msgid "" +"For subsequent imports, Python does not call the initialization function " +"again. Instead, it creates a new module object with a new ``__dict__``, and " +"copies the saved contents to it. For example, given a single-phase module " +"``_testsinglephase`` [#testsinglephase]_ that defines a function ``sum`` and " +"an exception class ``error``:" msgstr "" +#: ../../c-api/extension-modules.rst:214 msgid "" ">>> import sys\n" ">>> import _testsinglephase as one\n" @@ -180,20 +321,38 @@ msgid "" "True" msgstr "" -msgid "The exact behavior should be considered a CPython implementation detail." +#: ../../c-api/extension-modules.rst:229 +msgid "" +"The exact behavior should be considered a CPython implementation detail." msgstr "" -msgid "To work around the fact that ``PyInit_modulename`` does not take a *spec* argument, some state of the import machinery is saved and applied to the first suitable module created during the ``PyInit_modulename`` call. Specifically, when a sub-module is imported, this mechanism prepends the parent package name to the name of the module." +#: ../../c-api/extension-modules.rst:231 +msgid "" +"To work around the fact that ``PyInit_modulename`` does not take a *spec* " +"argument, some state of the import machinery is saved and applied to the " +"first suitable module created during the ``PyInit_modulename`` call. " +"Specifically, when a sub-module is imported, this mechanism prepends the " +"parent package name to the name of the module." msgstr "" -msgid "A single-phase ``PyInit_modulename`` function should create “its” module object as soon as possible, before any other module objects can be created." +#: ../../c-api/extension-modules.rst:237 +msgid "" +"A single-phase ``PyInit_modulename`` function should create “its” module " +"object as soon as possible, before any other module objects can be created." msgstr "" +#: ../../c-api/extension-modules.rst:240 msgid "Non-ASCII module names (``PyInitU_modulename``) are not supported." msgstr "" -msgid "Single-phase modules support module lookup functions like :c:func:`PyState_FindModule`." +#: ../../c-api/extension-modules.rst:242 +msgid "" +"Single-phase modules support module lookup functions " +"like :c:func:`PyState_FindModule`." msgstr "" -msgid "``_testsinglephase`` is an internal module used in CPython's self-test suite; your installation may or may not include it." +#: ../../c-api/extension-modules.rst:245 +msgid "" +"``_testsinglephase`` is an internal module used in CPython's self-test " +"suite; your installation may or may not include it." msgstr "" diff --git a/c-api/file.po b/c-api/file.po index 0cc630fa6..a42e42527 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,95 +22,195 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/file.rst:6 msgid "File objects" msgstr "" -msgid "These APIs are a minimal emulation of the Python 2 C API for built-in file objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support from the C standard library. In Python 3, files and streams use the new :mod:`io` module, which defines several layers over the low-level unbuffered I/O of the operating system. The functions described below are convenience C wrappers over these new APIs, and meant mostly for internal error reporting in the interpreter; third-party code is advised to access the :mod:`io` APIs instead." +#: ../../c-api/file.rst:10 +msgid "" +"These APIs are a minimal emulation of the Python 2 C API for built-in file " +"objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support " +"from the C standard library. In Python 3, files and streams use the " +"new :mod:`io` module, which defines several layers over the low-level " +"unbuffered I/O of the operating system. The functions described below are " +"convenience C wrappers over these new APIs, and meant mostly for internal " +"error reporting in the interpreter; third-party code is advised to access " +"the :mod:`io` APIs instead." msgstr "" -msgid "Create a Python file object from the file descriptor of an already opened file *fd*. The arguments *name*, *encoding*, *errors* and *newline* can be ``NULL`` to use the defaults; *buffering* can be *-1* to use the default. *name* is ignored and kept for backward compatibility. Return ``NULL`` on failure. For a more comprehensive description of the arguments, please refer to the :func:`io.open` function documentation." +#: ../../c-api/file.rst:22 +msgid "" +"Create a Python file object from the file descriptor of an already opened " +"file *fd*. The arguments *name*, *encoding*, *errors* and *newline* can be " +"``NULL`` to use the defaults; *buffering* can be *-1* to use the default. " +"*name* is ignored and kept for backward compatibility. Return ``NULL`` on " +"failure. For a more comprehensive description of the arguments, please refer " +"to the :func:`io.open` function documentation." msgstr "" -msgid "Since Python streams have their own buffering layer, mixing them with OS-level file descriptors can produce various issues (such as unexpected ordering of data)." +#: ../../c-api/file.rst:31 +msgid "" +"Since Python streams have their own buffering layer, mixing them with OS-" +"level file descriptors can produce various issues (such as unexpected " +"ordering of data)." msgstr "" +#: ../../c-api/file.rst:35 msgid "Ignore *name* attribute." msgstr "" -msgid "Return the file descriptor associated with *p* as an :c:expr:`int`. If the object is an integer, its value is returned. If not, the object's :meth:`~io.IOBase.fileno` method is called if it exists; the method must return an integer, which is returned as the file descriptor value. Sets an exception and returns ``-1`` on failure." -msgstr "" - -msgid "Equivalent to ``p.readline([n])``, this function reads one line from the object *p*. *p* may be a file object or any object with a :meth:`~io.IOBase.readline` method. If *n* is ``0``, exactly one line is read, regardless of the length of the line. If *n* is greater than ``0``, no more than *n* bytes will be read from the file; a partial line can be returned. In both cases, an empty string is returned if the end of the file is reached immediately. If *n* is less than ``0``, however, one line is read regardless of length, but :exc:`EOFError` is raised if the end of the file is reached immediately." +#: ../../c-api/file.rst:41 +msgid "" +"Return the file descriptor associated with *p* as an :c:expr:`int`. If the " +"object is an integer, its value is returned. If not, the " +"object's :meth:`~io.IOBase.fileno` method is called if it exists; the method " +"must return an integer, which is returned as the file descriptor value. " +"Sets an exception and returns ``-1`` on failure." msgstr "" -msgid "Overrides the normal behavior of :func:`io.open_code` to pass its parameter through the provided handler." +#: ../../c-api/file.rst:52 +msgid "" +"Equivalent to ``p.readline([n])``, this function reads one line from the " +"object *p*. *p* may be a file object or any object with " +"a :meth:`~io.IOBase.readline` method. If *n* is ``0``, exactly one line is " +"read, regardless of the length of the line. If *n* is greater than ``0``, " +"no more than *n* bytes will be read from the file; a partial line can be " +"returned. In both cases, an empty string is returned if the end of the file " +"is reached immediately. If *n* is less than ``0``, however, one line is " +"read regardless of length, but :exc:`EOFError` is raised if the end of the " +"file is reached immediately." +msgstr "" + +#: ../../c-api/file.rst:65 +msgid "" +"Overrides the normal behavior of :func:`io.open_code` to pass its parameter " +"through the provided handler." msgstr "" +#: ../../c-api/file.rst:68 msgid "The *handler* is a function of type:" msgstr "" -msgid "Equivalent of :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`, where *path* is guaranteed to be :c:type:`PyUnicodeObject`." +#: ../../c-api/file.rst:73 +msgid "" +"Equivalent of :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`, " +"where *path* is guaranteed to be :c:type:`PyUnicodeObject`." msgstr "" -msgid "The *userData* pointer is passed into the hook function. Since hook functions may be called from different runtimes, this pointer should not refer directly to Python state." +#: ../../c-api/file.rst:77 +msgid "" +"The *userData* pointer is passed into the hook function. Since hook " +"functions may be called from different runtimes, this pointer should not " +"refer directly to Python state." msgstr "" -msgid "As this hook is intentionally used during import, avoid importing new modules during its execution unless they are known to be frozen or available in ``sys.modules``." +#: ../../c-api/file.rst:81 +msgid "" +"As this hook is intentionally used during import, avoid importing new " +"modules during its execution unless they are known to be frozen or available " +"in ``sys.modules``." msgstr "" -msgid "Once a hook has been set, it cannot be removed or replaced, and later calls to :c:func:`PyFile_SetOpenCodeHook` will fail. On failure, the function returns -1 and sets an exception if the interpreter has been initialized." +#: ../../c-api/file.rst:85 +msgid "" +"Once a hook has been set, it cannot be removed or replaced, and later calls " +"to :c:func:`PyFile_SetOpenCodeHook` will fail. On failure, the function " +"returns -1 and sets an exception if the interpreter has been initialized." msgstr "" +#: ../../c-api/file.rst:89 msgid "This function is safe to call before :c:func:`Py_Initialize`." msgstr "" -msgid "Raises an :ref:`auditing event ` ``setopencodehook`` with no arguments." +#: ../../c-api/file.rst:91 +msgid "" +"Raises an :ref:`auditing event ` ``setopencodehook`` with no " +"arguments." msgstr "" -msgid "Open *path* with the mode ``'rb'``. *path* must be a Python :class:`str` object. The behavior of this function may be overridden by :c:func:`PyFile_SetOpenCodeHook` to allow for some preprocessing of the text." +#: ../../c-api/file.rst:98 +msgid "" +"Open *path* with the mode ``'rb'``. *path* must be a Python :class:`str` " +"object. The behavior of this function may be overridden " +"by :c:func:`PyFile_SetOpenCodeHook` to allow for some preprocessing of the " +"text." msgstr "" +#: ../../c-api/file.rst:103 msgid "This is analogous to :func:`io.open_code` in Python." msgstr "" -msgid "On success, this function returns a :term:`strong reference` to a Python file object. On failure, this function returns ``NULL`` with an exception set." +#: ../../c-api/file.rst:105 +msgid "" +"On success, this function returns a :term:`strong reference` to a Python " +"file object. On failure, this function returns ``NULL`` with an exception " +"set." msgstr "" -msgid "Similar to :c:func:`PyFile_OpenCodeObject`, but *path* is a UTF-8 encoded :c:expr:`const char*`." +#: ../../c-api/file.rst:114 +msgid "" +"Similar to :c:func:`PyFile_OpenCodeObject`, but *path* is a UTF-8 " +"encoded :c:expr:`const char*`." msgstr "" -msgid "Write object *obj* to file object *p*. The only supported flag for *flags* is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is written instead of the :func:`repr`." +#: ../../c-api/file.rst:124 +msgid "" +"Write object *obj* to file object *p*. The only supported flag for *flags* " +"is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is " +"written instead of the :func:`repr`." msgstr "" +#: ../../c-api/file.rst:128 msgid "If *obj* is ``NULL``, write the string ``\"\"``." msgstr "" -msgid "Return ``0`` on success or ``-1`` on failure; the appropriate exception will be set." +#: ../../c-api/file.rst:130 +msgid "" +"Return ``0`` on success or ``-1`` on failure; the appropriate exception will " +"be set." msgstr "" -msgid "Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on failure; the appropriate exception will be set." +#: ../../c-api/file.rst:135 +msgid "" +"Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on " +"failure; the appropriate exception will be set." msgstr "" +#: ../../c-api/file.rst:140 msgid "Soft-deprecated API" msgstr "" -msgid "These are APIs that were included in Python's C API by mistake. They are documented solely for completeness; use other ``PyFile*`` APIs instead." +#: ../../c-api/file.rst:144 +msgid "" +"These are APIs that were included in Python's C API by mistake. They are " +"documented solely for completeness; use other ``PyFile*`` APIs instead." msgstr "" -msgid "Use :c:func:`PyFile_FromFd` with defaults (``fd, NULL, \"w\", -1, NULL, NULL, NULL, 0``) instead." +#: ../../c-api/file.rst:150 +msgid "" +"Use :c:func:`PyFile_FromFd` with defaults (``fd, NULL, \"w\", -1, NULL, " +"NULL, NULL, 0``) instead." msgstr "" -msgid "Type of file-like objects used internally at Python startup when :py:mod:`io` is not yet available. Use Python :py:func:`open` or :c:func:`PyFile_FromFd` to create file objects instead." +#: ../../c-api/file.rst:154 +msgid "" +"Type of file-like objects used internally at Python startup " +"when :py:mod:`io` is not yet available. Use Python :py:func:`open` " +"or :c:func:`PyFile_FromFd` to create file objects instead." msgstr "" +#: ../../c-api/file.rst:8 msgid "object" msgstr "" +#: ../../c-api/file.rst:8 msgid "file" msgstr "" +#: ../../c-api/file.rst:50 msgid "EOFError (built-in exception)" msgstr "" +#: ../../c-api/file.rst:122 msgid "Py_PRINT_RAW (C macro)" msgstr "" diff --git a/c-api/float.po b/c-api/float.po index beb30aff7..bffd676bb 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,176 +22,322 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/float.rst:6 msgid "Floating-Point Objects" msgstr "" -msgid "This subtype of :c:type:`PyObject` represents a Python floating-point object." +#: ../../c-api/float.rst:13 +msgid "" +"This subtype of :c:type:`PyObject` represents a Python floating-point object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python floating-point type. This is the same object as :class:`float` in the Python layer." +#: ../../c-api/float.rst:18 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python floating-point " +"type. This is the same object as :class:`float` in the Python layer." msgstr "" -msgid "Return true if its argument is a :c:type:`PyFloatObject` or a subtype of :c:type:`PyFloatObject`. This function always succeeds." +#: ../../c-api/float.rst:24 +msgid "" +"Return true if its argument is a :c:type:`PyFloatObject` or a subtype " +"of :c:type:`PyFloatObject`. This function always succeeds." msgstr "" -msgid "Return true if its argument is a :c:type:`PyFloatObject`, but not a subtype of :c:type:`PyFloatObject`. This function always succeeds." +#: ../../c-api/float.rst:30 +msgid "" +"Return true if its argument is a :c:type:`PyFloatObject`, but not a subtype " +"of :c:type:`PyFloatObject`. This function always succeeds." msgstr "" -msgid "Create a :c:type:`PyFloatObject` object based on the string value in *str*, or ``NULL`` on failure." +#: ../../c-api/float.rst:36 +msgid "" +"Create a :c:type:`PyFloatObject` object based on the string value in *str*, " +"or ``NULL`` on failure." msgstr "" -msgid "Create a :c:type:`PyFloatObject` object from *v*, or ``NULL`` on failure." +#: ../../c-api/float.rst:42 +msgid "" +"Create a :c:type:`PyFloatObject` object from *v*, or ``NULL`` on failure." msgstr "" -msgid "Return a C :c:expr:`double` representation of the contents of *pyfloat*. If *pyfloat* is not a Python floating-point object but has a :meth:`~object.__float__` method, this method will first be called to convert *pyfloat* into a float. If :meth:`!__float__` is not defined then it falls back to :meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one should call :c:func:`PyErr_Occurred` to check for errors." +#: ../../c-api/float.rst:47 +msgid "" +"Return a C :c:expr:`double` representation of the contents of *pyfloat*. If " +"*pyfloat* is not a Python floating-point object but has " +"a :meth:`~object.__float__` method, this method will first be called to " +"convert *pyfloat* into a float. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`. This method returns ``-1.0`` upon " +"failure, so one should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +#: ../../c-api/float.rst:54 msgid "Use :meth:`~object.__index__` if available." msgstr "" -msgid "Return a C :c:expr:`double` representation of the contents of *pyfloat*, but without error checking." +#: ../../c-api/float.rst:60 +msgid "" +"Return a C :c:expr:`double` representation of the contents of *pyfloat*, but " +"without error checking." msgstr "" -msgid "Return a structseq instance which contains information about the precision, minimum and maximum values of a float. It's a thin wrapper around the header file :file:`float.h`." +#: ../../c-api/float.rst:66 +msgid "" +"Return a structseq instance which contains information about the precision, " +"minimum and maximum values of a float. It's a thin wrapper around the header " +"file :file:`float.h`." msgstr "" -msgid "Return the maximum representable finite float *DBL_MAX* as C :c:expr:`double`." +#: ../../c-api/float.rst:73 +msgid "" +"Return the maximum representable finite float *DBL_MAX* as " +"C :c:expr:`double`." msgstr "" -msgid "Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`." +#: ../../c-api/float.rst:78 +msgid "" +"Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`." msgstr "" -msgid "This macro expands to a constant expression of type :c:expr:`double`, that represents the positive infinity." +#: ../../c-api/float.rst:83 +msgid "" +"This macro expands to a constant expression of type :c:expr:`double`, that " +"represents the positive infinity." msgstr "" -msgid "On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from the C11 standard ```` header." +#: ../../c-api/float.rst:86 +msgid "" +"On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from " +"the C11 standard ```` header." msgstr "" -msgid "This macro expands to a constant expression of type :c:expr:`double`, that represents a quiet not-a-number (qNaN) value." +#: ../../c-api/float.rst:92 +msgid "" +"This macro expands to a constant expression of type :c:expr:`double`, that " +"represents a quiet not-a-number (qNaN) value." msgstr "" -msgid "On most platforms, this is equivalent to the :c:macro:`!NAN` macro from the C11 standard ```` header." +#: ../../c-api/float.rst:95 +msgid "" +"On most platforms, this is equivalent to the :c:macro:`!NAN` macro from the " +"C11 standard ```` header." msgstr "" +#: ../../c-api/float.rst:101 msgid "Equivalent to :c:macro:`!INFINITY`." msgstr "" +#: ../../c-api/float.rst:103 msgid "The macro is :term:`soft deprecated`." msgstr "" -msgid "The definition (accurate for a :c:expr:`double` type) of the :data:`math.e` constant." +#: ../../c-api/float.rst:109 +msgid "" +"The definition (accurate for a :c:expr:`double` type) of the :data:`math.e` " +"constant." msgstr "" +#: ../../c-api/float.rst:114 msgid "High precision (long double) definition of :data:`~math.e` constant." msgstr "" -msgid "The definition (accurate for a :c:expr:`double` type) of the :data:`math.pi` constant." +#: ../../c-api/float.rst:119 +msgid "" +"The definition (accurate for a :c:expr:`double` type) of the :data:`math.pi` " +"constant." msgstr "" +#: ../../c-api/float.rst:124 msgid "High precision (long double) definition of :data:`~math.pi` constant." msgstr "" -msgid "The definition (accurate for a :c:expr:`double` type) of the :data:`math.tau` constant." +#: ../../c-api/float.rst:129 +msgid "" +"The definition (accurate for a :c:expr:`double` type) of " +"the :data:`math.tau` constant." msgstr "" +#: ../../c-api/float.rst:136 msgid "Return :data:`math.nan` from a function." msgstr "" -msgid "On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``." +#: ../../c-api/float.rst:138 +msgid "" +"On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``." msgstr "" -msgid "Return :data:`math.inf` or :data:`-math.inf ` from a function, depending on the sign of *sign*." +#: ../../c-api/float.rst:143 +msgid "" +"Return :data:`math.inf` or :data:`-math.inf ` from a function, " +"depending on the sign of *sign*." msgstr "" +#: ../../c-api/float.rst:146 msgid "On most platforms, this is equivalent to the following::" msgstr "" +#: ../../c-api/float.rst:148 msgid "return PyFloat_FromDouble(copysign(INFINITY, sign));" msgstr "" -msgid "Return ``1`` if the given floating-point number *X* is finite, that is, it is normal, subnormal or zero, but not infinite or NaN. Return ``0`` otherwise." +#: ../../c-api/float.rst:153 +msgid "" +"Return ``1`` if the given floating-point number *X* is finite, that is, it " +"is normal, subnormal or zero, but not infinite or NaN. Return ``0`` " +"otherwise." msgstr "" -msgid "The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead." +#: ../../c-api/float.rst:157 +msgid "" +"The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead." msgstr "" -msgid "Return ``1`` if the given floating-point number *X* is positive or negative infinity. Return ``0`` otherwise." +#: ../../c-api/float.rst:163 +msgid "" +"Return ``1`` if the given floating-point number *X* is positive or negative " +"infinity. Return ``0`` otherwise." msgstr "" +#: ../../c-api/float.rst:166 msgid "The macro is :term:`soft deprecated`. Use :c:macro:`!isinf` instead." msgstr "" -msgid "Return ``1`` if the given floating-point number *X* is a not-a-number (NaN) value. Return ``0`` otherwise." +#: ../../c-api/float.rst:172 +msgid "" +"Return ``1`` if the given floating-point number *X* is a not-a-number (NaN) " +"value. Return ``0`` otherwise." msgstr "" +#: ../../c-api/float.rst:175 msgid "The macro is :term:`soft deprecated`. Use :c:macro:`!isnan` instead." msgstr "" +#: ../../c-api/float.rst:180 msgid "Pack and Unpack functions" msgstr "" -msgid "The pack and unpack functions provide an efficient platform-independent way to store floating-point values as byte strings. The Pack routines produce a bytes string from a C :c:expr:`double`, and the Unpack routines produce a C :c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) specifies the number of bytes in the bytes string." +#: ../../c-api/float.rst:182 +msgid "" +"The pack and unpack functions provide an efficient platform-independent way " +"to store floating-point values as byte strings. The Pack routines produce a " +"bytes string from a C :c:expr:`double`, and the Unpack routines produce a " +"C :c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) " +"specifies the number of bytes in the bytes string." msgstr "" -msgid "On platforms that appear to use IEEE 754 formats these functions work by copying bits. On other platforms, the 2-byte format is identical to the IEEE 754 binary16 half-precision format, the 4-byte format (32-bit) is identical to the IEEE 754 binary32 single precision format, and the 8-byte format to the IEEE 754 binary64 double precision format, although the packing of INFs and NaNs (if such things exist on the platform) isn't handled correctly, and attempting to unpack a bytes string containing an IEEE INF or NaN will raise an exception." +#: ../../c-api/float.rst:188 +msgid "" +"On platforms that appear to use IEEE 754 formats these functions work by " +"copying bits. On other platforms, the 2-byte format is identical to the IEEE " +"754 binary16 half-precision format, the 4-byte format (32-bit) is identical " +"to the IEEE 754 binary32 single precision format, and the 8-byte format to " +"the IEEE 754 binary64 double precision format, although the packing of INFs " +"and NaNs (if such things exist on the platform) isn't handled correctly, and " +"attempting to unpack a bytes string containing an IEEE INF or NaN will raise " +"an exception." msgstr "" -msgid "Note that NaN type may not be preserved on IEEE platforms (signaling NaNs become quiet NaNs), for example on x86 systems in 32-bit mode." +#: ../../c-api/float.rst:197 +msgid "" +"Note that NaN type may not be preserved on IEEE platforms (signaling NaNs " +"become quiet NaNs), for example on x86 systems in 32-bit mode." msgstr "" -msgid "On non-IEEE platforms with more precision, or larger dynamic range, than IEEE 754 supports, not all values can be packed; on non-IEEE platforms with less precision, or smaller dynamic range, not all values can be unpacked. What happens in such cases is partly accidental (alas)." +#: ../../c-api/float.rst:200 +msgid "" +"On non-IEEE platforms with more precision, or larger dynamic range, than " +"IEEE 754 supports, not all values can be packed; on non-IEEE platforms with " +"less precision, or smaller dynamic range, not all values can be unpacked. " +"What happens in such cases is partly accidental (alas)." msgstr "" +#: ../../c-api/float.rst:208 msgid "Pack functions" msgstr "" -msgid "The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an :c:expr:`int` argument, non-zero if you want the bytes string in little-endian format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` and ``p+7``), zero if you want big-endian format (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant can be used to use the native endian: it is equal to ``1`` on big endian processor, or ``0`` on little endian processor." +#: ../../c-api/float.rst:210 +msgid "" +"The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is " +"an :c:expr:`int` argument, non-zero if you want the bytes string in little-" +"endian format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` and ``p+7``), " +"zero if you want big-endian format (exponent first, at *p*). " +"The :c:macro:`PY_BIG_ENDIAN` constant can be used to use the native endian: " +"it is equal to ``1`` on big endian processor, or ``0`` on little endian " +"processor." msgstr "" -msgid "Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, most likely :exc:`OverflowError`)." +#: ../../c-api/float.rst:217 +msgid "" +"Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, " +"most likely :exc:`OverflowError`)." msgstr "" +#: ../../c-api/float.rst:220 msgid "There are two problems on non-IEEE platforms:" msgstr "" +#: ../../c-api/float.rst:222 msgid "What this does is undefined if *x* is a NaN or infinity." msgstr "" +#: ../../c-api/float.rst:223 msgid "``-0.0`` and ``+0.0`` produce the same bytes string." msgstr "" +#: ../../c-api/float.rst:227 msgid "Pack a C double as the IEEE 754 binary16 half-precision format." msgstr "" +#: ../../c-api/float.rst:231 msgid "Pack a C double as the IEEE 754 binary32 single precision format." msgstr "" +#: ../../c-api/float.rst:235 msgid "Pack a C double as the IEEE 754 binary64 double precision format." msgstr "" +#: ../../c-api/float.rst:239 msgid "Unpack functions" msgstr "" -msgid "The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an :c:expr:`int` argument, non-zero if the bytes string is in little-endian format (exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-endian (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant can be used to use the native endian: it is equal to ``1`` on big endian processor, or ``0`` on little endian processor." +#: ../../c-api/float.rst:241 +msgid "" +"The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is " +"an :c:expr:`int` argument, non-zero if the bytes string is in little-endian " +"format (exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if " +"big-endian (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant " +"can be used to use the native endian: it is equal to ``1`` on big endian " +"processor, or ``0`` on little endian processor." msgstr "" -msgid "Return value: The unpacked double. On error, this is ``-1.0`` and :c:func:`PyErr_Occurred` is true (and an exception is set, most likely :exc:`OverflowError`)." +#: ../../c-api/float.rst:248 +msgid "" +"Return value: The unpacked double. On error, this is ``-1.0`` " +"and :c:func:`PyErr_Occurred` is true (and an exception is set, most " +"likely :exc:`OverflowError`)." msgstr "" -msgid "Note that on a non-IEEE platform this will refuse to unpack a bytes string that represents a NaN or infinity." +#: ../../c-api/float.rst:252 +msgid "" +"Note that on a non-IEEE platform this will refuse to unpack a bytes string " +"that represents a NaN or infinity." msgstr "" +#: ../../c-api/float.rst:257 msgid "Unpack the IEEE 754 binary16 half-precision format as a C double." msgstr "" +#: ../../c-api/float.rst:261 msgid "Unpack the IEEE 754 binary32 single precision format as a C double." msgstr "" +#: ../../c-api/float.rst:265 msgid "Unpack the IEEE 754 binary64 double precision format as a C double." msgstr "" +#: ../../c-api/float.rst:8 msgid "object" msgstr "" +#: ../../c-api/float.rst:8 msgid "floating-point" msgstr "" diff --git a/c-api/frame.po b/c-api/frame.po index 19c854f4c..243a8c8c1 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2022-11-05 19:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,152 +23,320 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/frame.rst:4 msgid "Frame objects" msgstr "" +#: ../../c-api/frame.rst:8 msgid "The C structure of the objects used to describe frame objects." msgstr "" +#: ../../c-api/frame.rst:10 msgid "There are no public members in this structure." msgstr "" -msgid "The members of this structure were removed from the public C API. Refer to the :ref:`What's New entry ` for details." +#: ../../c-api/frame.rst:12 +msgid "" +"The members of this structure were removed from the public C API. Refer to " +"the :ref:`What's New entry ` for details." msgstr "" -msgid "The :c:func:`PyEval_GetFrame` and :c:func:`PyThreadState_GetFrame` functions can be used to get a frame object." +#: ../../c-api/frame.rst:17 +msgid "" +"The :c:func:`PyEval_GetFrame` and :c:func:`PyThreadState_GetFrame` functions " +"can be used to get a frame object." msgstr "" +#: ../../c-api/frame.rst:20 msgid "See also :ref:`Reflection `." msgstr "" -msgid "The type of frame objects. It is the same object as :py:class:`types.FrameType` in the Python layer." +#: ../../c-api/frame.rst:24 +msgid "" +"The type of frame objects. It is the same object " +"as :py:class:`types.FrameType` in the Python layer." msgstr "" -msgid "Previously, this type was only available after including ````." +#: ../../c-api/frame.rst:29 +msgid "" +"Previously, this type was only available after including ````." msgstr "" -msgid "Create a new frame object. This function returns a :term:`strong reference` to the new frame object on success, and returns ``NULL`` with an exception set on failure." +#: ../../c-api/frame.rst:34 +msgid "" +"Create a new frame object. This function returns a :term:`strong reference` " +"to the new frame object on success, and returns ``NULL`` with an exception " +"set on failure." msgstr "" +#: ../../c-api/frame.rst:40 msgid "Return non-zero if *obj* is a frame object." msgstr "" -msgid "Previously, this function was only available after including ````." +#: ../../c-api/frame.rst:44 +msgid "" +"Previously, this function was only available after including " +"````." msgstr "" +#: ../../c-api/frame.rst:49 msgid "Get the *frame* next outer frame." msgstr "" -msgid "Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame. This raises no exceptions." +#: ../../c-api/frame.rst:51 +msgid "" +"Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer " +"frame. This raises no exceptions." msgstr "" +#: ../../c-api/frame.rst:60 msgid "Get the *frame*'s :attr:`~frame.f_builtins` attribute." msgstr "" +#: ../../c-api/frame.rst:62 ../../c-api/frame.rst:93 msgid "Return a :term:`strong reference`. The result cannot be ``NULL``." msgstr "" +#: ../../c-api/frame.rst:69 msgid "Get the *frame* code." msgstr "" +#: ../../c-api/frame.rst:71 ../../c-api/frame.rst:137 msgid "Return a :term:`strong reference`." msgstr "" +#: ../../c-api/frame.rst:73 msgid "The result (frame code) cannot be ``NULL``." msgstr "" -msgid "Get the generator, coroutine, or async generator that owns this frame, or ``NULL`` if this frame is not owned by a generator. Does not raise an exception, even if the return value is ``NULL``." +#: ../../c-api/frame.rst:80 +msgid "" +"Get the generator, coroutine, or async generator that owns this frame, or " +"``NULL`` if this frame is not owned by a generator. Does not raise an " +"exception, even if the return value is ``NULL``." msgstr "" +#: ../../c-api/frame.rst:84 msgid "Return a :term:`strong reference`, or ``NULL``." msgstr "" +#: ../../c-api/frame.rst:91 msgid "Get the *frame*'s :attr:`~frame.f_globals` attribute." msgstr "" +#: ../../c-api/frame.rst:100 msgid "Get the *frame*'s :attr:`~frame.f_lasti` attribute." msgstr "" +#: ../../c-api/frame.rst:102 msgid "Returns -1 if ``frame.f_lasti`` is ``None``." msgstr "" +#: ../../c-api/frame.rst:109 msgid "Get the variable *name* of *frame*." msgstr "" +#: ../../c-api/frame.rst:111 msgid "Return a :term:`strong reference` to the variable value on success." msgstr "" -msgid "Raise :exc:`NameError` and return ``NULL`` if the variable does not exist." +#: ../../c-api/frame.rst:112 +msgid "" +"Raise :exc:`NameError` and return ``NULL`` if the variable does not exist." msgstr "" +#: ../../c-api/frame.rst:113 msgid "Raise an exception and return ``NULL`` on error." msgstr "" +#: ../../c-api/frame.rst:115 msgid "*name* type must be a :class:`str`." msgstr "" -msgid "Similar to :c:func:`PyFrame_GetVar`, but the variable name is a C string encoded in UTF-8." +#: ../../c-api/frame.rst:122 +msgid "" +"Similar to :c:func:`PyFrame_GetVar`, but the variable name is a C string " +"encoded in UTF-8." msgstr "" -msgid "Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to an :term:`optimized scope`, this returns a write-through proxy object that allows modifying the locals. In all other cases (classes, modules, :func:`exec`, :func:`eval`) it returns the mapping representing the frame locals directly (as described for :func:`locals`)." +#: ../../c-api/frame.rst:130 +msgid "" +"Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to " +"an :term:`optimized scope`, this returns a write-through proxy object that " +"allows modifying the locals. In all other cases (classes, " +"modules, :func:`exec`, :func:`eval`) it returns the mapping representing the " +"frame locals directly (as described for :func:`locals`)." msgstr "" -msgid "As part of :pep:`667`, return an instance of :c:var:`PyFrameLocalsProxy_Type`." +#: ../../c-api/frame.rst:141 +msgid "" +"As part of :pep:`667`, return an instance " +"of :c:var:`PyFrameLocalsProxy_Type`." msgstr "" +#: ../../c-api/frame.rst:147 msgid "Return the line number that *frame* is currently executing." msgstr "" +#: ../../c-api/frame.rst:151 msgid "Frame locals proxies" msgstr "" -msgid "The :attr:`~frame.f_locals` attribute on a :ref:`frame object ` is an instance of a \"frame-locals proxy\". The proxy object exposes a write-through view of the underlying locals dictionary for the frame. This ensures that the variables exposed by ``f_locals`` are always up to date with the live local variables in the frame itself." +#: ../../c-api/frame.rst:155 +msgid "" +"The :attr:`~frame.f_locals` attribute on a :ref:`frame object ` is an instance of a \"frame-locals proxy\". The proxy object " +"exposes a write-through view of the underlying locals dictionary for the " +"frame. This ensures that the variables exposed by ``f_locals`` are always up " +"to date with the live local variables in the frame itself." msgstr "" +#: ../../c-api/frame.rst:161 msgid "See :pep:`667` for more information." msgstr "" +#: ../../c-api/frame.rst:165 msgid "The type of frame :func:`locals` proxy objects." msgstr "" +#: ../../c-api/frame.rst:169 msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." msgstr "" +#: ../../c-api/frame.rst:173 msgid "Legacy local variable APIs" msgstr "" -msgid "These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing. They exist solely for backwards compatibility." +#: ../../c-api/frame.rst:175 +msgid "" +"These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing. " +"They exist solely for backwards compatibility." msgstr "" -msgid "Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals` attribute of *f* to the internal \"fast\" array of local variables, allowing changes in frame objects to be visible to the interpreter. If *clear* was true, this function would process variables that were unset in the locals dictionary." +#: ../../c-api/frame.rst:181 +msgid "" +"Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals` " +"attribute of *f* to the internal \"fast\" array of local variables, allowing " +"changes in frame objects to be visible to the interpreter. If *clear* was " +"true, this function would process variables that were unset in the locals " +"dictionary." msgstr "" +#: ../../c-api/frame.rst:187 ../../c-api/frame.rst:198 +#: ../../c-api/frame.rst:208 msgid "This function now does nothing." msgstr "" -msgid "Prior to Python 3.13, this function would copy the internal \"fast\" array of local variables (which is used by the interpreter) to the :attr:`~frame.f_locals` attribute of *f*, allowing changes in local variables to be visible to frame objects." +#: ../../c-api/frame.rst:193 +msgid "" +"Prior to Python 3.13, this function would copy the internal \"fast\" array " +"of local variables (which is used by the interpreter) to " +"the :attr:`~frame.f_locals` attribute of *f*, allowing changes in local " +"variables to be visible to frame objects." msgstr "" -msgid "Prior to Python 3.13, this function was similar to :c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and ``-1`` with an exception set on failure." +#: ../../c-api/frame.rst:204 +msgid "" +"Prior to Python 3.13, this function was similar " +"to :c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and " +"``-1`` with an exception set on failure." msgstr "" +#: ../../c-api/frame.rst:213 msgid ":pep:`667`" msgstr "" +#: ../../c-api/frame.rst:217 msgid "Internal frames" msgstr "" +#: ../../c-api/frame.rst:219 msgid "Unless using :pep:`523`, you will not need this." msgstr "" +#: ../../c-api/frame.rst:223 msgid "The interpreter's internal frame representation." msgstr "" +#: ../../c-api/frame.rst:229 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" +#: ../../c-api/frame.rst:236 msgid "Return the byte offset into the last executed instruction." msgstr "" -msgid "Return the currently executing line number, or -1 if there is no line number." +#: ../../c-api/frame.rst:243 +msgid "" +"Return the currently executing line number, or -1 if there is no line number." +msgstr "" + +#: ../../c-api/frame.rst:250 +msgid "" +"An array of executable kinds (executor types) for frames, used for internal " +"debugging and tracing." +msgstr "" + +#: ../../c-api/frame.rst:253 +msgid "" +"Tools like debuggers and profilers can use this to identify the type of " +"execution context associated with a frame (such as to filter out internal " +"frames). The entries are indexed by the following constants:" +msgstr "" + +#: ../../c-api/frame.rst:261 +msgid "Constant" +msgstr "" + +#: ../../c-api/frame.rst:262 +msgid "Description" +msgstr "" + +#: ../../c-api/frame.rst:264 +msgid "" +"The frame is internal (For example: inlined) and should be skipped by tools." +msgstr "" + +#: ../../c-api/frame.rst:266 +msgid "The frame corresponds to a standard Python function." +msgstr "" + +#: ../../c-api/frame.rst:268 +msgid "The frame corresponds to a function defined in native code." +msgstr "" + +#: ../../c-api/frame.rst:270 +msgid "The frame corresponds to a method on a class instance." +msgstr "" + +#: ../../c-api/frame.rst:272 +msgid "" +"However, Python's C API lacks a function to read the executable kind from a " +"frame. Instead, use this recipe:" +msgstr "" + +#: ../../c-api/frame.rst:275 +msgid "" +"int\n" +"get_executable_kind(PyFrameObject *frame)\n" +"{\n" +" _PyInterpreterFrame *f = frame->f_frame;\n" +" PyObject *exec = PyStackRef_AsPyObjectBorrow(f->f_executable);\n" +"\n" +" if (PyCode_Check(exec)) {\n" +" return PyUnstable_EXECUTABLE_KIND_PY_FUNCTION;\n" +" }\n" +" if (PyMethod_Check(exec)) {\n" +" return PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION;\n" +" }\n" +" if (Py_IS_TYPE(exec, &PyMethodDescr_Type)) {\n" +" return PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR;\n" +" }\n" +"\n" +" return PyUnstable_EXECUTABLE_KIND_SKIP;\n" +"}" +msgstr "" + +#: ../../c-api/frame.rst:301 +msgid "The number of entries in :c:data:`PyUnstable_ExecutableKinds`." msgstr "" diff --git a/c-api/function.po b/c-api/function.po index 5c381d71b..7c71502c9 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,131 +23,256 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/function.rst:6 msgid "Function Objects" msgstr "" +#: ../../c-api/function.rst:10 msgid "There are a few functions specific to Python functions." msgstr "" +#: ../../c-api/function.rst:15 msgid "The C structure used for functions." msgstr "" -msgid "This is an instance of :c:type:`PyTypeObject` and represents the Python function type. It is exposed to Python programmers as ``types.FunctionType``." +#: ../../c-api/function.rst:22 +msgid "" +"This is an instance of :c:type:`PyTypeObject` and represents the Python " +"function type. It is exposed to Python programmers as " +"``types.FunctionType``." msgstr "" -msgid "Return true if *o* is a function object (has type :c:data:`PyFunction_Type`). The parameter must not be ``NULL``. This function always succeeds." +#: ../../c-api/function.rst:28 +msgid "" +"Return true if *o* is a function object (has " +"type :c:data:`PyFunction_Type`). The parameter must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return a new function object associated with the code object *code*. *globals* must be a dictionary with the global variables accessible to the function." +#: ../../c-api/function.rst:34 +msgid "" +"Return a new function object associated with the code object *code*. " +"*globals* must be a dictionary with the global variables accessible to the " +"function." msgstr "" -msgid "The function's docstring and name are retrieved from the code object. :attr:`~function.__module__` is retrieved from *globals*. The argument defaults, annotations and closure are set to ``NULL``. :attr:`~function.__qualname__` is set to the same value as the code object's :attr:`~codeobject.co_qualname` field." +#: ../../c-api/function.rst:37 +msgid "" +"The function's docstring and name are retrieved from the code " +"object. :attr:`~function.__module__` is retrieved from *globals*. The " +"argument defaults, annotations and closure are set to " +"``NULL``. :attr:`~function.__qualname__` is set to the same value as the " +"code object's :attr:`~codeobject.co_qualname` field." msgstr "" -msgid "As :c:func:`PyFunction_New`, but also allows setting the function object's :attr:`~function.__qualname__` attribute. *qualname* should be a unicode object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute is set to the same value as the code object's :attr:`~codeobject.co_qualname` field." +#: ../../c-api/function.rst:46 +msgid "" +"As :c:func:`PyFunction_New`, but also allows setting the function " +"object's :attr:`~function.__qualname__` attribute. *qualname* should be a " +"unicode object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute " +"is set to the same value as the code " +"object's :attr:`~codeobject.co_qualname` field." msgstr "" +#: ../../c-api/function.rst:57 msgid "Return the code object associated with the function object *op*." msgstr "" +#: ../../c-api/function.rst:62 msgid "Return the globals dictionary associated with the function object *op*." msgstr "" -msgid "Return a :term:`borrowed reference` to the :attr:`~function.__module__` attribute of the :ref:`function object ` *op*. It can be *NULL*." +#: ../../c-api/function.rst:67 +msgid "" +"Return a :term:`borrowed reference` to the :attr:`~function.__module__` " +"attribute of the :ref:`function object ` *op*. It can be " +"*NULL*." msgstr "" -msgid "This is normally a :class:`string ` containing the module name, but can be set to any other object by Python code." +#: ../../c-api/function.rst:71 +msgid "" +"This is normally a :class:`string ` containing the module name, but can " +"be set to any other object by Python code." msgstr "" -msgid "Return the argument default values of the function object *op*. This can be a tuple of arguments or ``NULL``." +#: ../../c-api/function.rst:77 +msgid "" +"Return the argument default values of the function object *op*. This can be " +"a tuple of arguments or ``NULL``." msgstr "" -msgid "Set the argument default values for the function object *op*. *defaults* must be ``Py_None`` or a tuple." +#: ../../c-api/function.rst:83 +msgid "" +"Set the argument default values for the function object *op*. *defaults* " +"must be ``Py_None`` or a tuple." msgstr "" +#: ../../c-api/function.rst:86 ../../c-api/function.rst:125 +#: ../../c-api/function.rst:139 msgid "Raises :exc:`SystemError` and returns ``-1`` on failure." msgstr "" +#: ../../c-api/function.rst:91 msgid "Set the vectorcall field of a given function object *func*." msgstr "" -msgid "Warning: extensions using this API must preserve the behavior of the unaltered (default) vectorcall function!" +#: ../../c-api/function.rst:93 +msgid "" +"Warning: extensions using this API must preserve the behavior of the " +"unaltered (default) vectorcall function!" msgstr "" -msgid "Return the keyword-only argument default values of the function object *op*. This can be a dictionary of arguments or ``NULL``." +#: ../../c-api/function.rst:101 +msgid "" +"Return the keyword-only argument default values of the function object *op*. " +"This can be a dictionary of arguments or ``NULL``." msgstr "" -msgid "Set the keyword-only argument default values of the function object *op*. *defaults* must be a dictionary of keyword-only arguments or ``Py_None``." +#: ../../c-api/function.rst:107 +msgid "" +"Set the keyword-only argument default values of the function object *op*. " +"*defaults* must be a dictionary of keyword-only arguments or ``Py_None``." msgstr "" -msgid "This function returns ``0`` on success, and returns ``-1`` with an exception set on failure." +#: ../../c-api/function.rst:110 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." msgstr "" -msgid "Return the closure associated with the function object *op*. This can be ``NULL`` or a tuple of cell objects." +#: ../../c-api/function.rst:116 +msgid "" +"Return the closure associated with the function object *op*. This can be " +"``NULL`` or a tuple of cell objects." msgstr "" -msgid "Set the closure associated with the function object *op*. *closure* must be ``Py_None`` or a tuple of cell objects." +#: ../../c-api/function.rst:122 +msgid "" +"Set the closure associated with the function object *op*. *closure* must be " +"``Py_None`` or a tuple of cell objects." msgstr "" -msgid "Return the annotations of the function object *op*. This can be a mutable dictionary or ``NULL``." +#: ../../c-api/function.rst:130 +msgid "" +"Return the annotations of the function object *op*. This can be a mutable " +"dictionary or ``NULL``." msgstr "" -msgid "Set the annotations for the function object *op*. *annotations* must be a dictionary or ``Py_None``." +#: ../../c-api/function.rst:136 +msgid "" +"Set the annotations for the function object *op*. *annotations* must be a " +"dictionary or ``Py_None``." msgstr "" -msgid "These functions are similar to their ``PyFunction_Get*`` counterparts, but do not do type checking. Passing anything other than an instance of :c:data:`PyFunction_Type` is undefined behavior." +#: ../../c-api/function.rst:150 +msgid "" +"These functions are similar to their ``PyFunction_Get*`` counterparts, but " +"do not do type checking. Passing anything other than an instance " +"of :c:data:`PyFunction_Type` is undefined behavior." msgstr "" -msgid "Register *callback* as a function watcher for the current interpreter. Return an ID which may be passed to :c:func:`PyFunction_ClearWatcher`. In case of error (e.g. no more watcher IDs available), return ``-1`` and set an exception." +#: ../../c-api/function.rst:157 +msgid "" +"Register *callback* as a function watcher for the current interpreter. " +"Return an ID which may be passed to :c:func:`PyFunction_ClearWatcher`. In " +"case of error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." msgstr "" -msgid "Clear watcher identified by *watcher_id* previously returned from :c:func:`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on success, or ``-1`` and set an exception on error (e.g. if the given *watcher_id* was never registered.)" +#: ../../c-api/function.rst:167 +msgid "" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyFunction_AddWatcher` for the current interpreter. Return " +"``0`` on success, or ``-1`` and set an exception on error (e.g. if the " +"given *watcher_id* was never registered.)" msgstr "" +#: ../../c-api/function.rst:177 msgid "Enumeration of possible function watcher events:" msgstr "" +#: ../../c-api/function.rst:179 msgid "``PyFunction_EVENT_CREATE``" msgstr "" +#: ../../c-api/function.rst:180 msgid "``PyFunction_EVENT_DESTROY``" msgstr "" +#: ../../c-api/function.rst:181 msgid "``PyFunction_EVENT_MODIFY_CODE``" msgstr "" +#: ../../c-api/function.rst:182 msgid "``PyFunction_EVENT_MODIFY_DEFAULTS``" msgstr "" +#: ../../c-api/function.rst:183 msgid "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" msgstr "" +#: ../../c-api/function.rst:190 msgid "Type of a function watcher callback function." msgstr "" -msgid "If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:`borrowed reference` to the new value that is about to be stored in *func* for the attribute that is being modified." +#: ../../c-api/function.rst:192 +msgid "" +"If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` " +"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold " +"a :term:`borrowed reference` to the new value that is about to be stored in " +"*func* for the attribute that is being modified." msgstr "" -msgid "The callback may inspect but must not modify *func*; doing so could have unpredictable effects, including infinite recursion." +#: ../../c-api/function.rst:197 +msgid "" +"The callback may inspect but must not modify *func*; doing so could have " +"unpredictable effects, including infinite recursion." msgstr "" -msgid "If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked after *func* has been fully initialized. Otherwise, the callback is invoked before the modification to *func* takes place, so the prior state of *func* can be inspected. The runtime is permitted to optimize away the creation of function objects when possible. In such cases no event will be emitted. Although this creates the possibility of an observable difference of runtime behavior depending on optimization decisions, it does not change the semantics of the Python code being executed." +#: ../../c-api/function.rst:200 +msgid "" +"If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked " +"after *func* has been fully initialized. Otherwise, the callback is invoked " +"before the modification to *func* takes place, so the prior state of *func* " +"can be inspected. The runtime is permitted to optimize away the creation of " +"function objects when possible. In such cases no event will be emitted. " +"Although this creates the possibility of an observable difference of runtime " +"behavior depending on optimization decisions, it does not change the " +"semantics of the Python code being executed." msgstr "" -msgid "If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the callback to the about-to-be-destroyed function will resurrect it, preventing it from being freed at this time. When the resurrected object is destroyed later, any watcher callbacks active at that time will be called again." +#: ../../c-api/function.rst:209 +msgid "" +"If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the " +"callback to the about-to-be-destroyed function will resurrect it, preventing " +"it from being freed at this time. When the resurrected object is destroyed " +"later, any watcher callbacks active at that time will be called again." msgstr "" -msgid "If the callback sets an exception, it must return ``-1``; this exception will be printed as an unraisable exception using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +#: ../../c-api/function.rst:214 +msgid "" +"If the callback sets an exception, it must return ``-1``; this exception " +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -msgid "There may already be a pending exception set on entry to the callback. In this case, the callback should return ``0`` with the same exception still set. This means the callback may not call any other API that can set an exception unless it saves and clears the exception state first, and restores it before returning." +#: ../../c-api/function.rst:218 +msgid "" +"There may already be a pending exception set on entry to the callback. In " +"this case, the callback should return ``0`` with the same exception still " +"set. This means the callback may not call any other API that can set an " +"exception unless it saves and clears the exception state first, and restores " +"it before returning." msgstr "" +#: ../../c-api/function.rst:8 msgid "object" msgstr "" +#: ../../c-api/function.rst:8 msgid "function" msgstr "" +#: ../../c-api/function.rst:20 msgid "MethodType (in module types)" msgstr "" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index afecfea8a..f1d07edec 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,162 +23,333 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/gcsupport.rst:6 msgid "Supporting Cyclic Garbage Collection" msgstr "" -msgid "Python's support for detecting and collecting garbage which involves circular references requires support from object types which are \"containers\" for other objects which may also be containers. Types which do not store references to other objects, or which only store references to atomic types (such as numbers or strings), do not need to provide any explicit support for garbage collection." +#: ../../c-api/gcsupport.rst:8 +msgid "" +"Python's support for detecting and collecting garbage which involves " +"circular references requires support from object types which are " +"\"containers\" for other objects which may also be containers. Types which " +"do not store references to other objects, or which only store references to " +"atomic types (such as numbers or strings), do not need to provide any " +"explicit support for garbage collection." msgstr "" -msgid "To create a container type, the :c:member:`~PyTypeObject.tp_flags` field of the type object must include the :c:macro:`Py_TPFLAGS_HAVE_GC` and provide an implementation of the :c:member:`~PyTypeObject.tp_traverse` handler. If instances of the type are mutable, a :c:member:`~PyTypeObject.tp_clear` implementation must also be provided." +#: ../../c-api/gcsupport.rst:15 +msgid "" +"To create a container type, the :c:member:`~PyTypeObject.tp_flags` field of " +"the type object must include the :c:macro:`Py_TPFLAGS_HAVE_GC` and provide " +"an implementation of the :c:member:`~PyTypeObject.tp_traverse` handler. If " +"instances of the type are mutable, a :c:member:`~PyTypeObject.tp_clear` " +"implementation must also be provided." msgstr "" +#: ../../c-api/gcsupport.rst:21 msgid ":c:macro:`Py_TPFLAGS_HAVE_GC`" msgstr "" -msgid "Objects with a type with this flag set must conform with the rules documented here. For convenience these objects will be referred to as container objects." +#: ../../c-api/gcsupport.rst:22 +msgid "" +"Objects with a type with this flag set must conform with the rules " +"documented here. For convenience these objects will be referred to as " +"container objects." msgstr "" +#: ../../c-api/gcsupport.rst:26 msgid "Constructors for container types must conform to two rules:" msgstr "" -msgid "The memory for the object must be allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." +#: ../../c-api/gcsupport.rst:28 +msgid "" +"The memory for the object must be allocated using :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`." msgstr "" -msgid "Once all the fields which may contain references to other containers are initialized, it must call :c:func:`PyObject_GC_Track`." +#: ../../c-api/gcsupport.rst:31 +msgid "" +"Once all the fields which may contain references to other containers are " +"initialized, it must call :c:func:`PyObject_GC_Track`." msgstr "" -msgid "Similarly, the deallocator for the object must conform to a similar pair of rules:" +#: ../../c-api/gcsupport.rst:34 +msgid "" +"Similarly, the deallocator for the object must conform to a similar pair of " +"rules:" msgstr "" -msgid "Before fields which refer to other containers are invalidated, :c:func:`PyObject_GC_UnTrack` must be called." +#: ../../c-api/gcsupport.rst:37 +msgid "" +"Before fields which refer to other containers are " +"invalidated, :c:func:`PyObject_GC_UnTrack` must be called." msgstr "" -msgid "The object's memory must be deallocated using :c:func:`PyObject_GC_Del`." +#: ../../c-api/gcsupport.rst:40 +msgid "" +"The object's memory must be deallocated using :c:func:`PyObject_GC_Del`." msgstr "" -msgid "If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its subclass or subclasses." +#: ../../c-api/gcsupport.rst:43 +msgid "" +"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least " +"a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from " +"its subclass or subclasses." msgstr "" -msgid "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the interpreter will automatically populate the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a class that implements the garbage collector protocol and the child class does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +#: ../../c-api/gcsupport.rst:47 +msgid "" +"When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call " +"it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the " +"interpreter will automatically populate " +"the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a " +"class that implements the garbage collector protocol and the child class " +"does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -msgid "Analogous to :c:macro:`PyObject_New` but for container objects with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +#: ../../c-api/gcsupport.rst:57 +msgid "" +"Analogous to :c:macro:`PyObject_New` but for container objects with " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" -msgid "Do not call this directly to allocate memory for an object; call the type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +#: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84 +msgid "" +"Do not call this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" -msgid "When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that simply calls this macro." +#: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87 +msgid "" +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` " +"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that " +"simply calls this macro." msgstr "" -msgid "Memory allocated by this macro must be freed with :c:func:`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +#: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91 +msgid "" +"Memory allocated by this macro must be freed with :c:func:`PyObject_GC_Del` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." msgstr "" +#: ../../c-api/gcsupport.rst:73 ../../c-api/gcsupport.rst:97 msgid ":c:func:`PyObject_GC_Del`" msgstr "" +#: ../../c-api/gcsupport.rst:74 msgid ":c:macro:`PyObject_New`" msgstr "" +#: ../../c-api/gcsupport.rst:75 ../../c-api/gcsupport.rst:99 +#: ../../c-api/gcsupport.rst:193 msgid ":c:func:`PyType_GenericAlloc`" msgstr "" +#: ../../c-api/gcsupport.rst:76 ../../c-api/gcsupport.rst:100 msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr "" -msgid "Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." +#: ../../c-api/gcsupport.rst:81 +msgid "" +"Analogous to :c:macro:`PyObject_NewVar` but for container objects with " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" +#: ../../c-api/gcsupport.rst:98 msgid ":c:macro:`PyObject_NewVar`" msgstr "" -msgid "Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size* bytes at the end of the object (at offset :c:member:`~PyTypeObject.tp_basicsize`). The allocated memory is initialized to zeros, except for the :c:type:`Python object header `." +#: ../../c-api/gcsupport.rst:105 +msgid "" +"Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size* bytes at " +"the end of the object (at offset :c:member:`~PyTypeObject.tp_basicsize`). " +"The allocated memory is initialized to zeros, except for the :c:type:`Python " +"object header `." msgstr "" -msgid "The extra data will be deallocated with the object, but otherwise it is not managed by Python." +#: ../../c-api/gcsupport.rst:111 +msgid "" +"The extra data will be deallocated with the object, but otherwise it is not " +"managed by Python." msgstr "" -msgid "Memory allocated by this function must be freed with :c:func:`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +#: ../../c-api/gcsupport.rst:114 +msgid "" +"Memory allocated by this function must be freed " +"with :c:func:`PyObject_GC_Del` (usually called via the " +"object's :c:member:`~PyTypeObject.tp_free` slot)." msgstr "" -msgid "The function is marked as unstable because the final mechanism for reserving extra data after an instance is not yet decided. For allocating a variable number of fields, prefer using :c:type:`PyVarObject` and :c:member:`~PyTypeObject.tp_itemsize` instead." +#: ../../c-api/gcsupport.rst:119 +msgid "" +"The function is marked as unstable because the final mechanism for reserving " +"extra data after an instance is not yet decided. For allocating a variable " +"number of fields, prefer using :c:type:`PyVarObject` " +"and :c:member:`~PyTypeObject.tp_itemsize` instead." msgstr "" -msgid "Resize an object allocated by :c:macro:`PyObject_NewVar`. Returns the resized object of type ``TYPE*`` (refers to any C type) or ``NULL`` on failure." +#: ../../c-api/gcsupport.rst:130 +msgid "" +"Resize an object allocated by :c:macro:`PyObject_NewVar`. Returns the " +"resized object of type ``TYPE*`` (refers to any C type) or ``NULL`` on " +"failure." msgstr "" -msgid "*op* must be of type :c:expr:`PyVarObject *` and must not be tracked by the collector yet. *newsize* must be of type :c:type:`Py_ssize_t`." +#: ../../c-api/gcsupport.rst:134 +msgid "" +"*op* must be of type :c:expr:`PyVarObject *` and must not be tracked by the " +"collector yet. *newsize* must be of type :c:type:`Py_ssize_t`." msgstr "" -msgid "Adds the object *op* to the set of container objects tracked by the collector. The collector can run at unexpected times so objects must be valid while being tracked. This should be called once all the fields followed by the :c:member:`~PyTypeObject.tp_traverse` handler become valid, usually near the end of the constructor." +#: ../../c-api/gcsupport.rst:141 +msgid "" +"Adds the object *op* to the set of container objects tracked by the " +"collector. The collector can run at unexpected times so objects must be " +"valid while being tracked. This should be called once all the fields " +"followed by the :c:member:`~PyTypeObject.tp_traverse` handler become valid, " +"usually near the end of the constructor." msgstr "" -msgid "Returns non-zero if the object implements the garbage collector protocol, otherwise returns 0." +#: ../../c-api/gcsupport.rst:150 +msgid "" +"Returns non-zero if the object implements the garbage collector protocol, " +"otherwise returns 0." msgstr "" -msgid "The object cannot be tracked by the garbage collector if this function returns 0." +#: ../../c-api/gcsupport.rst:153 +msgid "" +"The object cannot be tracked by the garbage collector if this function " +"returns 0." msgstr "" -msgid "Returns 1 if the object type of *op* implements the GC protocol and *op* is being currently tracked by the garbage collector and 0 otherwise." +#: ../../c-api/gcsupport.rst:158 +msgid "" +"Returns 1 if the object type of *op* implements the GC protocol and *op* is " +"being currently tracked by the garbage collector and 0 otherwise." msgstr "" +#: ../../c-api/gcsupport.rst:161 msgid "This is analogous to the Python function :func:`gc.is_tracked`." msgstr "" -msgid "Returns 1 if the object type of *op* implements the GC protocol and *op* has been already finalized by the garbage collector and 0 otherwise." +#: ../../c-api/gcsupport.rst:168 +msgid "" +"Returns 1 if the object type of *op* implements the GC protocol and *op* has " +"been already finalized by the garbage collector and 0 otherwise." msgstr "" +#: ../../c-api/gcsupport.rst:171 msgid "This is analogous to the Python function :func:`gc.is_finalized`." msgstr "" -msgid "Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." +#: ../../c-api/gcsupport.rst:178 +msgid "" +"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`." msgstr "" -msgid "Do not call this directly to free an object's memory; call the type's :c:member:`~PyTypeObject.tp_free` slot instead." +#: ../../c-api/gcsupport.rst:181 +msgid "" +"Do not call this directly to free an object's memory; call the " +"type's :c:member:`~PyTypeObject.tp_free` slot instead." msgstr "" -msgid "Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, or related allocation functions; use :c:func:`PyObject_Free` instead." +#: ../../c-api/gcsupport.rst:184 +msgid "" +"Do not use this for memory allocated " +"by :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, or related " +"allocation functions; use :c:func:`PyObject_Free` instead." msgstr "" +#: ../../c-api/gcsupport.rst:190 msgid ":c:func:`PyObject_Free` is the non-GC equivalent of this function." msgstr "" +#: ../../c-api/gcsupport.rst:191 msgid ":c:macro:`PyObject_GC_New`" msgstr "" +#: ../../c-api/gcsupport.rst:192 msgid ":c:macro:`PyObject_GC_NewVar`" msgstr "" +#: ../../c-api/gcsupport.rst:194 msgid ":c:member:`~PyTypeObject.tp_free`" msgstr "" -msgid "Remove the object *op* from the set of container objects tracked by the collector. Note that :c:func:`PyObject_GC_Track` can be called again on this object to add it back to the set of tracked objects. The deallocator (:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." +#: ../../c-api/gcsupport.rst:199 +msgid "" +"Remove the object *op* from the set of container objects tracked by the " +"collector. Note that :c:func:`PyObject_GC_Track` can be called again on " +"this object to add it back to the set of tracked objects. The deallocator " +"(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the " +"object before any of the fields used by " +"the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." msgstr "" -msgid "The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros have been removed from the public C API." +#: ../../c-api/gcsupport.rst:208 +msgid "" +"The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros " +"have been removed from the public C API." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function parameter of this type:" +#: ../../c-api/gcsupport.rst:211 +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function " +"parameter of this type:" msgstr "" -msgid "Type of the visitor function passed to the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be called with an object to traverse as *object* and the third parameter to the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core uses several visitor functions to implement cyclic garbage detection; it's not expected that users will need to write their own visitor functions." +#: ../../c-api/gcsupport.rst:216 +msgid "" +"Type of the visitor function passed to " +"the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be " +"called with an object to traverse as *object* and the third parameter to " +"the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core " +"uses several visitor functions to implement cyclic garbage detection; it's " +"not expected that users will need to write their own visitor functions." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_traverse` handler must have the following type:" +#: ../../c-api/gcsupport.rst:223 +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` handler must have the following " +"type:" msgstr "" -msgid "Traversal function for a container object. Implementations must call the *visit* function for each object directly contained by *self*, with the parameters to *visit* being the contained object and the *arg* value passed to the handler. The *visit* function must not be called with a ``NULL`` object argument. If *visit* returns a non-zero value that value should be returned immediately." +#: ../../c-api/gcsupport.rst:228 +msgid "" +"Traversal function for a container object. Implementations must call the " +"*visit* function for each object directly contained by *self*, with the " +"parameters to *visit* being the contained object and the *arg* value passed " +"to the handler. The *visit* function must not be called with a ``NULL`` " +"object argument. If *visit* returns a non-zero value that value should be " +"returned immediately." msgstr "" -msgid "The traversal function must not have any side effects. Implementations may not modify the reference counts of any Python objects nor create or destroy any Python objects." +#: ../../c-api/gcsupport.rst:235 +msgid "" +"The traversal function must not have any side effects. Implementations may " +"not modify the reference counts of any Python objects nor create or destroy " +"any Python objects." msgstr "" -msgid "To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:func:`Py_VISIT` macro is provided. In order to use this macro, the :c:member:`~PyTypeObject.tp_traverse` implementation must name its arguments exactly *visit* and *arg*:" +#: ../../c-api/gcsupport.rst:239 +msgid "" +"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, " +"a :c:func:`Py_VISIT` macro is provided. In order to use this macro, " +"the :c:member:`~PyTypeObject.tp_traverse` implementation must name its " +"arguments exactly *visit* and *arg*:" msgstr "" -msgid "If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, with arguments *o* and *arg*. If *visit* returns a non-zero value, then return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers look like::" +#: ../../c-api/gcsupport.rst:246 +msgid "" +"If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " +"with arguments *o* and *arg*. If *visit* returns a non-zero value, then " +"return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers " +"look like::" msgstr "" +#: ../../c-api/gcsupport.rst:251 msgid "" "static int\n" "my_traverse(Noddy *self, visitproc visit, void *arg)\n" @@ -189,47 +360,98 @@ msgid "" "}" msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:`inquiry` type, or ``NULL`` if the object is immutable." +#: ../../c-api/gcsupport.rst:259 +msgid "" +"The :c:member:`~PyTypeObject.tp_clear` handler must be of " +"the :c:type:`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" -msgid "Drop references that may have created reference cycles. Immutable objects do not have to define this method since they can never directly create reference cycles. Note that the object must still be valid after calling this method (don't just call :c:func:`Py_DECREF` on a reference). The collector will call this method if it detects that this object is involved in a reference cycle." +#: ../../c-api/gcsupport.rst:265 +msgid "" +"Drop references that may have created reference cycles. Immutable objects " +"do not have to define this method since they can never directly create " +"reference cycles. Note that the object must still be valid after calling " +"this method (don't just call :c:func:`Py_DECREF` on a reference). The " +"collector will call this method if it detects that this object is involved " +"in a reference cycle." msgstr "" +#: ../../c-api/gcsupport.rst:274 msgid "Controlling the Garbage Collector State" msgstr "" -msgid "The C-API provides the following functions for controlling garbage collection runs." +#: ../../c-api/gcsupport.rst:276 +msgid "" +"The C-API provides the following functions for controlling garbage " +"collection runs." msgstr "" -msgid "Perform a full garbage collection, if the garbage collector is enabled. (Note that :func:`gc.collect` runs it unconditionally.)" +#: ../../c-api/gcsupport.rst:281 +msgid "" +"Perform a full garbage collection, if the garbage collector is enabled. " +"(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" -msgid "Returns the number of collected + unreachable objects which cannot be collected. If the garbage collector is disabled or already collecting, returns ``0`` immediately. Errors during garbage collection are passed to :data:`sys.unraisablehook`. This function does not raise exceptions." +#: ../../c-api/gcsupport.rst:284 +msgid "" +"Returns the number of collected + unreachable objects which cannot be " +"collected. If the garbage collector is disabled or already collecting, " +"returns ``0`` immediately. Errors during garbage collection are passed " +"to :data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" -msgid "Enable the garbage collector: similar to :func:`gc.enable`. Returns the previous state, 0 for disabled and 1 for enabled." +#: ../../c-api/gcsupport.rst:294 +msgid "" +"Enable the garbage collector: similar to :func:`gc.enable`. Returns the " +"previous state, 0 for disabled and 1 for enabled." msgstr "" -msgid "Disable the garbage collector: similar to :func:`gc.disable`. Returns the previous state, 0 for disabled and 1 for enabled." +#: ../../c-api/gcsupport.rst:302 +msgid "" +"Disable the garbage collector: similar to :func:`gc.disable`. Returns the " +"previous state, 0 for disabled and 1 for enabled." msgstr "" -msgid "Query the state of the garbage collector: similar to :func:`gc.isenabled`. Returns the current state, 0 for disabled and 1 for enabled." +#: ../../c-api/gcsupport.rst:310 +msgid "" +"Query the state of the garbage collector: similar to :func:`gc.isenabled`. " +"Returns the current state, 0 for disabled and 1 for enabled." msgstr "" +#: ../../c-api/gcsupport.rst:317 msgid "Querying Garbage Collector State" msgstr "" -msgid "The C-API provides the following interface for querying information about the garbage collector." +#: ../../c-api/gcsupport.rst:319 +msgid "" +"The C-API provides the following interface for querying information about " +"the garbage collector." msgstr "" -msgid "Run supplied *callback* on all live GC-capable objects. *arg* is passed through to all invocations of *callback*." +#: ../../c-api/gcsupport.rst:324 +msgid "" +"Run supplied *callback* on all live GC-capable objects. *arg* is passed " +"through to all invocations of *callback*." msgstr "" -msgid "If new objects are (de)allocated by the callback it is undefined if they will be visited." +#: ../../c-api/gcsupport.rst:328 +msgid "" +"If new objects are (de)allocated by the callback it is undefined if they " +"will be visited." msgstr "" -msgid "Garbage collection is disabled during operation. Explicitly running a collection in the callback may lead to undefined behaviour e.g. visiting the same objects multiple times or not at all." +#: ../../c-api/gcsupport.rst:331 +msgid "" +"Garbage collection is disabled during operation. Explicitly running a " +"collection in the callback may lead to undefined behaviour e.g. visiting the " +"same objects multiple times or not at all." msgstr "" -msgid "Type of the visitor function to be passed to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return ``0`` to stop iteration. Other return values are reserved for now so behavior on returning anything else is undefined." +#: ../../c-api/gcsupport.rst:339 +msgid "" +"Type of the visitor function to be passed " +"to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* " +"passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue " +"iteration, return ``0`` to stop iteration. Other return values are reserved " +"for now so behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/gen.po b/c-api/gen.po index 6920d84f9..ad0527a17 100644 --- a/c-api/gen.po +++ b/c-api/gen.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,56 +21,101 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/gen.rst:6 msgid "Generator Objects" msgstr "" -msgid "Generator objects are what Python uses to implement generator iterators. They are normally created by iterating over a function that yields values, rather than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`." +#: ../../c-api/gen.rst:8 +msgid "" +"Generator objects are what Python uses to implement generator iterators. " +"They are normally created by iterating over a function that yields values, " +"rather than explicitly calling :c:func:`PyGen_New` " +"or :c:func:`PyGen_NewWithQualName`." msgstr "" +#: ../../c-api/gen.rst:15 msgid "The C structure used for generator objects." msgstr "" +#: ../../c-api/gen.rst:20 msgid "The type object corresponding to generator objects." msgstr "" -msgid "Return true if *ob* is a generator object; *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/gen.rst:25 +msgid "" +"Return true if *ob* is a generator object; *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return true if *ob*'s type is :c:type:`PyGen_Type`; *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/gen.rst:31 +msgid "" +"Return true if *ob*'s type is :c:type:`PyGen_Type`; *ob* must not be " +"``NULL``. This function always succeeds." msgstr "" -msgid "Create and return a new generator object based on the *frame* object. A reference to *frame* is stolen by this function. The argument must not be ``NULL``." +#: ../../c-api/gen.rst:37 +msgid "" +"Create and return a new generator object based on the *frame* object. A " +"reference to *frame* is \":term:`stolen `\" by this function (even on " +"error). The argument must not be ``NULL``." msgstr "" -msgid "Create and return a new generator object based on the *frame* object, with ``__name__`` and ``__qualname__`` set to *name* and *qualname*. A reference to *frame* is stolen by this function. The *frame* argument must not be ``NULL``." +#: ../../c-api/gen.rst:43 +msgid "" +"Create and return a new generator object based on the *frame* object, with " +"``__name__`` and ``__qualname__`` set to *name* and *qualname*. A reference " +"to *frame* is \":term:`stolen `\" by this function (even on error). " +"The *frame* argument must not be ``NULL``." msgstr "" -msgid "Return a new :term:`strong reference` to the code object wrapped by *gen*. This function always succeeds." +#: ../../c-api/gen.rst:51 +msgid "" +"Return a new :term:`strong reference` to the code object wrapped by *gen*. " +"This function always succeeds." msgstr "" +#: ../../c-api/gen.rst:56 msgid "Asynchronous Generator Objects" msgstr "" +#: ../../c-api/gen.rst:59 msgid ":pep:`525`" msgstr "" -msgid "The type object corresponding to asynchronous generator objects. This is available as :class:`types.AsyncGeneratorType` in the Python layer." +#: ../../c-api/gen.rst:63 +msgid "" +"The type object corresponding to asynchronous generator objects. This is " +"available as :class:`types.AsyncGeneratorType` in the Python layer." msgstr "" -msgid "Create a new asynchronous generator wrapping *frame*, with ``__name__`` and ``__qualname__`` set to *name* and *qualname*. *frame* is stolen by this function and must not be ``NULL``." +#: ../../c-api/gen.rst:70 +msgid "" +"Create a new asynchronous generator wrapping *frame*, with ``__name__`` and " +"``__qualname__`` set to *name* and *qualname*. *frame* is \":term:`stolen " +"`\" by this function (even on error) and must not be ``NULL``." msgstr "" -msgid "On success, this function returns a :term:`strong reference` to the new asynchronous generator. On failure, this function returns ``NULL`` with an exception set." +#: ../../c-api/gen.rst:75 +msgid "" +"On success, this function returns a :term:`strong reference` to the new " +"asynchronous generator. On failure, this function returns ``NULL`` with an " +"exception set." msgstr "" -msgid "Return true if *op* is an asynchronous generator object, false otherwise. This function always succeeds." +#: ../../c-api/gen.rst:83 +msgid "" +"Return true if *op* is an asynchronous generator object, false otherwise. " +"This function always succeeds." msgstr "" +#: ../../c-api/gen.rst:90 msgid "Deprecated API" msgstr "" -msgid "This is a :term:`soft deprecated` API that was included in Python's C API by mistake." +#: ../../c-api/gen.rst:94 +msgid "This is an API that was included in Python's C API by mistake." msgstr "" +#: ../../c-api/gen.rst:97 msgid "It is solely here for completeness; do not use this API." msgstr "" diff --git a/c-api/hash.po b/c-api/hash.po index 33a2612ce..b1c16684d 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-02-23 14:15+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,122 +21,187 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/hash.rst:4 msgid "PyHash API" msgstr "" -msgid "See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." +#: ../../c-api/hash.rst:6 +msgid "" +"See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." msgstr "" +#: ../../c-api/hash.rst:10 msgid "Hash value type: signed integer." msgstr "" +#: ../../c-api/hash.rst:17 msgid "Hash value type: unsigned integer." msgstr "" -msgid "A numerical value indicating the algorithm for hashing of :class:`str`, :class:`bytes`, and :class:`memoryview`." +#: ../../c-api/hash.rst:24 +msgid "" +"A numerical value indicating the algorithm for hashing " +"of :class:`str`, :class:`bytes`, and :class:`memoryview`." msgstr "" +#: ../../c-api/hash.rst:27 msgid "The algorithm name is exposed by :data:`sys.hash_info.algorithm`." msgstr "" -msgid "Numerical values to compare to :c:macro:`Py_HASH_ALGORITHM` to determine which algorithm is used for hashing. The hash algorithm can be configured via the configure :option:`--with-hash-algorithm` option." +#: ../../c-api/hash.rst:36 +msgid "" +"Numerical values to compare to :c:macro:`Py_HASH_ALGORITHM` to determine " +"which algorithm is used for hashing. The hash algorithm can be configured " +"via the configure :option:`--with-hash-algorithm` option." msgstr "" +#: ../../c-api/hash.rst:40 msgid "Add :c:macro:`!Py_HASH_FNV` and :c:macro:`!Py_HASH_SIPHASH24`." msgstr "" +#: ../../c-api/hash.rst:43 msgid "Add :c:macro:`!Py_HASH_SIPHASH13`." msgstr "" -msgid "Buffers of length in range ``[1, Py_HASH_CUTOFF)`` are hashed using DJBX33A instead of the algorithm described by :c:macro:`Py_HASH_ALGORITHM`." +#: ../../c-api/hash.rst:49 +msgid "" +"Buffers of length in range ``[1, Py_HASH_CUTOFF)`` are hashed using DJBX33A " +"instead of the algorithm described by :c:macro:`Py_HASH_ALGORITHM`." msgstr "" +#: ../../c-api/hash.rst:52 msgid "A :c:macro:`!Py_HASH_CUTOFF` of 0 disables the optimization." msgstr "" -msgid ":c:macro:`!Py_HASH_CUTOFF` must be non-negative and less or equal than 7." +#: ../../c-api/hash.rst:53 +msgid "" +":c:macro:`!Py_HASH_CUTOFF` must be non-negative and less or equal than 7." msgstr "" -msgid "32-bit platforms should use a cutoff smaller than 64-bit platforms because it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms and 5 on 32-bit platforms should provide a decent safety margin." +#: ../../c-api/hash.rst:55 +msgid "" +"32-bit platforms should use a cutoff smaller than 64-bit platforms because " +"it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms " +"and 5 on 32-bit platforms should provide a decent safety margin." msgstr "" +#: ../../c-api/hash.rst:59 msgid "This corresponds to the :data:`sys.hash_info.cutoff` constant." msgstr "" -msgid "The `Mersenne prime `_ ``P = 2**n -1``, used for numeric hash scheme." +#: ../../c-api/hash.rst:66 +msgid "" +"The `Mersenne prime `_ ``P = " +"2**n -1``, used for numeric hash scheme." msgstr "" +#: ../../c-api/hash.rst:69 msgid "This corresponds to the :data:`sys.hash_info.modulus` constant." msgstr "" +#: ../../c-api/hash.rst:76 msgid "The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`." msgstr "" +#: ../../c-api/hash.rst:83 msgid "Prime multiplier used in string and various other hashes." msgstr "" +#: ../../c-api/hash.rst:90 msgid "The hash value returned for a positive infinity." msgstr "" +#: ../../c-api/hash.rst:92 msgid "This corresponds to the :data:`sys.hash_info.inf` constant." msgstr "" +#: ../../c-api/hash.rst:99 msgid "The multiplier used for the imaginary part of a complex number." msgstr "" +#: ../../c-api/hash.rst:101 msgid "This corresponds to the :data:`sys.hash_info.imag` constant." msgstr "" +#: ../../c-api/hash.rst:108 msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr "" +#: ../../c-api/hash.rst:112 msgid "Hash function." msgstr "" +#: ../../c-api/hash.rst:116 msgid "Hash function name (UTF-8 encoded string)." msgstr "" +#: ../../c-api/hash.rst:118 msgid "This corresponds to the :data:`sys.hash_info.algorithm` constant." msgstr "" +#: ../../c-api/hash.rst:122 msgid "Internal size of the hash value in bits." msgstr "" +#: ../../c-api/hash.rst:124 msgid "This corresponds to the :data:`sys.hash_info.hash_bits` constant." msgstr "" +#: ../../c-api/hash.rst:128 msgid "Size of seed input in bits." msgstr "" +#: ../../c-api/hash.rst:130 msgid "This corresponds to the :data:`sys.hash_info.seed_bits` constant." msgstr "" +#: ../../c-api/hash.rst:137 msgid "Get the hash function definition." msgstr "" +#: ../../c-api/hash.rst:140 msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." msgstr "" -msgid "Hash a pointer value: process the pointer value as an integer (cast it to ``uintptr_t`` internally). The pointer is not dereferenced." +#: ../../c-api/hash.rst:147 +msgid "" +"Hash a pointer value: process the pointer value as an integer (cast it to " +"``uintptr_t`` internally). The pointer is not dereferenced." msgstr "" +#: ../../c-api/hash.rst:150 msgid "The function cannot fail: it cannot return ``-1``." msgstr "" -msgid "Compute and return the hash value of a buffer of *len* bytes starting at address *ptr*. The hash is guaranteed to match that of :class:`bytes`, :class:`memoryview`, and other built-in objects that implement the :ref:`buffer protocol `." +#: ../../c-api/hash.rst:157 +msgid "" +"Compute and return the hash value of a buffer of *len* bytes starting at " +"address *ptr*. The hash is guaranteed to match that " +"of :class:`bytes`, :class:`memoryview`, and other built-in objects that " +"implement the :ref:`buffer protocol `." msgstr "" -msgid "Use this function to implement hashing for immutable objects whose :c:member:`~PyTypeObject.tp_richcompare` function compares to another object's buffer." +#: ../../c-api/hash.rst:162 +msgid "" +"Use this function to implement hashing for immutable objects " +"whose :c:member:`~PyTypeObject.tp_richcompare` function compares to another " +"object's buffer." msgstr "" +#: ../../c-api/hash.rst:166 msgid "*len* must be greater than or equal to ``0``." msgstr "" +#: ../../c-api/hash.rst:168 msgid "This function always succeeds." msgstr "" -msgid "Generic hashing function that is meant to be put into a type object's ``tp_hash`` slot. Its result only depends on the object's identity." +#: ../../c-api/hash.rst:175 +msgid "" +"Generic hashing function that is meant to be put into a type object's " +"``tp_hash`` slot. Its result only depends on the object's identity." msgstr "" +#: ../../c-api/hash.rst:180 msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." msgstr "" diff --git a/c-api/import.po b/c-api/import.po index 1a3c11abb..419050229 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,141 +22,296 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/import.rst:6 msgid "Importing Modules" msgstr "" -msgid "This is a wrapper around :c:func:`PyImport_Import()` which takes a :c:expr:`const char *` as an argument instead of a :c:expr:`PyObject *`." +#: ../../c-api/import.rst:16 +msgid "" +"This is a wrapper around :c:func:`PyImport_Import()` which takes " +"a :c:expr:`const char *` as an argument instead of a :c:expr:`PyObject *`." msgstr "" +#: ../../c-api/import.rst:21 msgid "This function is a deprecated alias of :c:func:`PyImport_ImportModule`." msgstr "" -msgid "This function used to fail immediately when the import lock was held by another thread. In Python 3.3 though, the locking scheme switched to per-module locks for most purposes, so this function's special behaviour isn't needed anymore." +#: ../../c-api/import.rst:23 +msgid "" +"This function used to fail immediately when the import lock was held by " +"another thread. In Python 3.3 though, the locking scheme switched to per-" +"module locks for most purposes, so this function's special behaviour isn't " +"needed anymore." msgstr "" +#: ../../c-api/import.rst:29 msgid "Use :c:func:`PyImport_ImportModule` instead." msgstr "" -msgid "Import a module. This is best described by referring to the built-in Python function :func:`__import__`." +#: ../../c-api/import.rst:37 +msgid "" +"Import a module. This is best described by referring to the built-in Python " +"function :func:`__import__`." msgstr "" -msgid "The return value is a new reference to the imported module or top-level package, or ``NULL`` with an exception set on failure. Like for :func:`__import__`, the return value when a submodule of a package was requested is normally the top-level package, unless a non-empty *fromlist* was given." +#: ../../c-api/import.rst:40 ../../c-api/import.rst:56 +msgid "" +"The return value is a new reference to the imported module or top-level " +"package, or ``NULL`` with an exception set on failure. Like " +"for :func:`__import__`, the return value when a submodule of a package was " +"requested is normally the top-level package, unless a non-empty *fromlist* " +"was given." msgstr "" -msgid "Failing imports remove incomplete module objects, like with :c:func:`PyImport_ImportModule`." +#: ../../c-api/import.rst:46 +msgid "" +"Failing imports remove incomplete module objects, like " +"with :c:func:`PyImport_ImportModule`." msgstr "" -msgid "Import a module. This is best described by referring to the built-in Python function :func:`__import__`, as the standard :func:`__import__` function calls this function directly." +#: ../../c-api/import.rst:52 +msgid "" +"Import a module. This is best described by referring to the built-in Python " +"function :func:`__import__`, as the standard :func:`__import__` function " +"calls this function directly." msgstr "" -msgid "Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a UTF-8 encoded string instead of a Unicode object." +#: ../../c-api/import.rst:66 +msgid "" +"Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a " +"UTF-8 encoded string instead of a Unicode object." msgstr "" +#: ../../c-api/import.rst:69 msgid "Negative values for *level* are no longer accepted." msgstr "" -msgid "This is a higher-level interface that calls the current \"import hook function\" (with an explicit *level* of 0, meaning absolute import). It invokes the :func:`__import__` function from the ``__builtins__`` of the current globals. This means that the import is done using whatever import hooks are installed in the current environment." +#: ../../c-api/import.rst:74 +msgid "" +"This is a higher-level interface that calls the current \"import hook " +"function\" (with an explicit *level* of 0, meaning absolute import). It " +"invokes the :func:`__import__` function from the ``__builtins__`` of the " +"current globals. This means that the import is done using whatever import " +"hooks are installed in the current environment." msgstr "" +#: ../../c-api/import.rst:80 msgid "This function always uses absolute imports." msgstr "" -msgid "Reload a module. Return a new reference to the reloaded module, or ``NULL`` with an exception set on failure (the module still exists in this case)." +#: ../../c-api/import.rst:85 +msgid "" +"Reload a module. Return a new reference to the reloaded module, or ``NULL`` " +"with an exception set on failure (the module still exists in this case)." msgstr "" +#: ../../c-api/import.rst:91 msgid "Return the module object corresponding to a module name." msgstr "" -msgid "The *name* argument may be of the form ``package.module``. First check the modules dictionary if there's one there, and if not, create a new one and insert it in the modules dictionary." +#: ../../c-api/import.rst:93 +msgid "" +"The *name* argument may be of the form ``package.module``. First check the " +"modules dictionary if there's one there, and if not, create a new one and " +"insert it in the modules dictionary." msgstr "" -msgid "Return a :term:`strong reference` to the module on success. Return ``NULL`` with an exception set on failure." +#: ../../c-api/import.rst:97 +msgid "" +"Return a :term:`strong reference` to the module on success. Return ``NULL`` " +"with an exception set on failure." msgstr "" +#: ../../c-api/import.rst:100 msgid "The module name *name* is decoded from UTF-8." msgstr "" -msgid "This function does not load or import the module; if the module wasn't already loaded, you will get an empty module object. Use :c:func:`PyImport_ImportModule` or one of its variants to import a module. Package structures implied by a dotted name for *name* are not created if not already present." -msgstr "" - -msgid "Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed reference` and *name* is a Python :class:`str` object." +#: ../../c-api/import.rst:102 +msgid "" +"This function does not load or import the module; if the module wasn't " +"already loaded, you will get an empty module object. " +"Use :c:func:`PyImport_ImportModule` or one of its variants to import a " +"module. Package structures implied by a dotted name for *name* are not " +"created if not already present." msgstr "" -msgid "Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed reference`." +#: ../../c-api/import.rst:113 +msgid "" +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference` and *name* is a Python :class:`str` object." msgstr "" -msgid "Given a module name (possibly of the form ``package.module``) and a code object read from a Python bytecode file or obtained from the built-in function :func:`compile`, load the module. Return a new reference to the module object, or ``NULL`` with an exception set if an error occurred. *name* is removed from :data:`sys.modules` in error cases, even if *name* was already in :data:`sys.modules` on entry to :c:func:`PyImport_ExecCodeModule`. Leaving incompletely initialized modules in :data:`sys.modules` is dangerous, as imports of such modules have no way to know that the module object is an unknown (and probably damaged with respect to the module author's intents) state." +#: ../../c-api/import.rst:121 +msgid "" +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference`." msgstr "" -msgid "The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be set, if not set already, with the appropriate values. The spec's loader will be set to the module's :attr:`!__loader__` (if set) and to an instance of :class:`~importlib.machinery.SourceFileLoader` otherwise." +#: ../../c-api/import.rst:129 +msgid "" +"Given a module name (possibly of the form ``package.module``) and a code " +"object read from a Python bytecode file or obtained from the built-in " +"function :func:`compile`, load the module. Return a new reference to the " +"module object, or ``NULL`` with an exception set if an error occurred. " +"*name* is removed from :data:`sys.modules` in error cases, even if *name* " +"was already in :data:`sys.modules` on entry " +"to :c:func:`PyImport_ExecCodeModule`. Leaving incompletely initialized " +"modules in :data:`sys.modules` is dangerous, as imports of such modules have " +"no way to know that the module object is an unknown (and probably damaged " +"with respect to the module author's intents) state." +msgstr "" + +#: ../../c-api/import.rst:139 +msgid "" +"The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be " +"set, if not set already, with the appropriate values. The spec's loader " +"will be set to the module's :attr:`!__loader__` (if set) and to an instance " +"of :class:`~importlib.machinery.SourceFileLoader` otherwise." msgstr "" -msgid "The module's :attr:`~module.__file__` attribute will be set to the code object's :attr:`~codeobject.co_filename`. If applicable, :attr:`~module.__cached__` will also be set." +#: ../../c-api/import.rst:144 +msgid "" +"The module's :attr:`~module.__file__` attribute will be set to the code " +"object's :attr:`~codeobject.co_filename`. If " +"applicable, :attr:`~module.__cached__` will also be set." msgstr "" -msgid "This function will reload the module if it was already imported. See :c:func:`PyImport_ReloadModule` for the intended way to reload a module." +#: ../../c-api/import.rst:148 +msgid "" +"This function will reload the module if it was already imported. " +"See :c:func:`PyImport_ReloadModule` for the intended way to reload a module." msgstr "" -msgid "If *name* points to a dotted name of the form ``package.module``, any package structures not already created will still not be created." +#: ../../c-api/import.rst:151 +msgid "" +"If *name* points to a dotted name of the form ``package.module``, any " +"package structures not already created will still not be created." msgstr "" -msgid "See also :c:func:`PyImport_ExecCodeModuleEx` and :c:func:`PyImport_ExecCodeModuleWithPathnames`." +#: ../../c-api/import.rst:154 +msgid "" +"See also :c:func:`PyImport_ExecCodeModuleEx` " +"and :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -msgid "The setting of :attr:`~module.__cached__` and :attr:`~module.__loader__` is deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." +#: ../../c-api/import.rst:157 +msgid "" +"The setting of :attr:`~module.__cached__` and :attr:`~module.__loader__` is " +"deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" -msgid "Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__` attribute of the module object is set to *pathname* if it is non-``NULL``." +#: ../../c-api/import.rst:165 +msgid "" +"Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__` " +"attribute of the module object is set to *pathname* if it is non-``NULL``." msgstr "" +#: ../../c-api/import.rst:168 msgid "See also :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -msgid "Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`~module.__cached__` attribute of the module object is set to *cpathname* if it is non-``NULL``. Of the three functions, this is the preferred one to use." +#: ../../c-api/import.rst:173 +msgid "" +"Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`~module.__cached__` " +"attribute of the module object is set to *cpathname* if it is non-``NULL``. " +"Of the three functions, this is the preferred one to use." msgstr "" -msgid "Setting :attr:`~module.__cached__` is deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." +#: ../../c-api/import.rst:179 +msgid "" +"Setting :attr:`~module.__cached__` is deprecated. " +"See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" -msgid "Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and *cpathname* are UTF-8 encoded strings. Attempts are also made to figure out what the value for *pathname* should be from *cpathname* if the former is set to ``NULL``." +#: ../../c-api/import.rst:186 +msgid "" +"Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and " +"*cpathname* are UTF-8 encoded strings. Attempts are also made to figure out " +"what the value for *pathname* should be from *cpathname* if the former is " +"set to ``NULL``." msgstr "" -msgid "Uses :func:`!imp.source_from_cache` in calculating the source path if only the bytecode path is provided." +#: ../../c-api/import.rst:192 +msgid "" +"Uses :func:`!imp.source_from_cache` in calculating the source path if only " +"the bytecode path is provided." msgstr "" +#: ../../c-api/import.rst:195 msgid "No longer uses the removed :mod:`!imp` module." msgstr "" -msgid "Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` file). The magic number should be present in the first four bytes of the bytecode file, in little-endian byte order. Returns ``-1`` on error." +#: ../../c-api/import.rst:201 +msgid "" +"Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` " +"file). The magic number should be present in the first four bytes of the " +"bytecode file, in little-endian byte order. Returns ``-1`` on error." msgstr "" +#: ../../c-api/import.rst:205 msgid "Return value of ``-1`` upon failure." msgstr "" -msgid "Return the magic tag string for :pep:`3147` format Python bytecode file names. Keep in mind that the value at ``sys.implementation.cache_tag`` is authoritative and should be used instead of this function." +#: ../../c-api/import.rst:211 +msgid "" +"Return the magic tag string for :pep:`3147` format Python bytecode file " +"names. Keep in mind that the value at ``sys.implementation.cache_tag`` is " +"authoritative and should be used instead of this function." msgstr "" -msgid "Return the dictionary used for the module administration (a.k.a. ``sys.modules``). Note that this is a per-interpreter variable." +#: ../../c-api/import.rst:219 +msgid "" +"Return the dictionary used for the module administration (a.k.a. " +"``sys.modules``). Note that this is a per-interpreter variable." msgstr "" -msgid "Return the already imported module with the given name. If the module has not been imported yet then returns ``NULL`` but does not set an error. Returns ``NULL`` and sets an error if the lookup failed." +#: ../../c-api/import.rst:224 +msgid "" +"Return the already imported module with the given name. If the module has " +"not been imported yet then returns ``NULL`` but does not set an error. " +"Returns ``NULL`` and sets an error if the lookup failed." msgstr "" -msgid "Return a finder object for a :data:`sys.path`/:attr:`!pkg.__path__` item *path*, possibly by fetching it from the :data:`sys.path_importer_cache` dict. If it wasn't yet cached, traverse :data:`sys.path_hooks` until a hook is found that can handle the path item. Return ``None`` if no hook could; this tells our caller that the :term:`path based finder` could not find a finder for this path item. Cache the result in :data:`sys.path_importer_cache`. Return a new reference to the finder object." +#: ../../c-api/import.rst:232 +msgid "" +"Return a finder object for a :data:`sys.path`/:attr:`!pkg.__path__` item " +"*path*, possibly by fetching it from the :data:`sys.path_importer_cache` " +"dict. If it wasn't yet cached, traverse :data:`sys.path_hooks` until a hook " +"is found that can handle the path item. Return ``None`` if no hook could; " +"this tells our caller that the :term:`path based finder` could not find a " +"finder for this path item. Cache the result " +"in :data:`sys.path_importer_cache`. Return a new reference to the finder " +"object." msgstr "" -msgid "Load a frozen module named *name*. Return ``1`` for success, ``0`` if the module is not found, and ``-1`` with an exception set if the initialization failed. To access the imported module on a successful load, use :c:func:`PyImport_ImportModule`. (Note the misnomer --- this function would reload the module if it was already imported.)" +#: ../../c-api/import.rst:243 +msgid "" +"Load a frozen module named *name*. Return ``1`` for success, ``0`` if the " +"module is not found, and ``-1`` with an exception set if the initialization " +"failed. To access the imported module on a successful load, " +"use :c:func:`PyImport_ImportModule`. (Note the misnomer --- this function " +"would reload the module if it was already imported.)" msgstr "" +#: ../../c-api/import.rst:251 msgid "The ``__file__`` attribute is no longer set on the module." msgstr "" -msgid "Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a UTF-8 encoded string instead of a Unicode object." +#: ../../c-api/import.rst:257 +msgid "" +"Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a " +"UTF-8 encoded string instead of a Unicode object." msgstr "" -msgid "This is the structure type definition for frozen module descriptors, as generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the Python source distribution). Its definition, found in :file:`Include/import.h`, is::" +#: ../../c-api/import.rst:265 +msgid "" +"This is the structure type definition for frozen module descriptors, as " +"generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the " +"Python source distribution). Its definition, found in :file:`Include/" +"import.h`, is::" msgstr "" +#: ../../c-api/import.rst:270 msgid "" "struct _frozen {\n" " const char *name;\n" @@ -166,65 +321,122 @@ msgid "" "};" msgstr "" -msgid "The new ``is_package`` field indicates whether the module is a package or not. This replaces setting the ``size`` field to a negative value." +#: ../../c-api/import.rst:277 +msgid "" +"The new ``is_package`` field indicates whether the module is a package or " +"not. This replaces setting the ``size`` field to a negative value." msgstr "" -msgid "This pointer is initialized to point to an array of :c:struct:`_frozen` records, terminated by one whose members are all ``NULL`` or zero. When a frozen module is imported, it is searched in this table. Third-party code could play tricks with this to provide a dynamically created collection of frozen modules." +#: ../../c-api/import.rst:283 +msgid "" +"This pointer is initialized to point to an array of :c:struct:`_frozen` " +"records, terminated by one whose members are all ``NULL`` or zero. When a " +"frozen module is imported, it is searched in this table. Third-party code " +"could play tricks with this to provide a dynamically created collection of " +"frozen modules." msgstr "" -msgid "Add a single module to the existing table of built-in modules. This is a convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning ``-1`` if the table could not be extended. The new module can be imported by the name *name*, and uses the function *initfunc* as the initialization function called on the first attempted import. This should be called before :c:func:`Py_Initialize`." +#: ../../c-api/import.rst:291 +msgid "" +"Add a single module to the existing table of built-in modules. This is a " +"convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning " +"``-1`` if the table could not be extended. The new module can be imported " +"by the name *name*, and uses the function *initfunc* as the initialization " +"function called on the first attempted import. This should be called " +"before :c:func:`Py_Initialize`." msgstr "" -msgid "Structure describing a single entry in the list of built-in modules. Programs which embed Python may use an array of these structures in conjunction with :c:func:`PyImport_ExtendInittab` to provide additional built-in modules. The structure consists of two members:" +#: ../../c-api/import.rst:301 +msgid "" +"Structure describing a single entry in the list of built-in modules. " +"Programs which embed Python may use an array of these structures in " +"conjunction with :c:func:`PyImport_ExtendInittab` to provide additional " +"built-in modules. The structure consists of two members:" msgstr "" +#: ../../c-api/import.rst:309 msgid "The module name, as an ASCII encoded string." msgstr "" +#: ../../c-api/import.rst:313 msgid "Initialization function for a module built into the interpreter." msgstr "" -msgid "Add a collection of modules to the table of built-in modules. The *newtab* array must end with a sentinel entry which contains ``NULL`` for the :c:member:`~_inittab.name` field; failure to provide the sentinel value can result in a memory fault. Returns ``0`` on success or ``-1`` if insufficient memory could be allocated to extend the internal table. In the event of failure, no modules are added to the internal table. This must be called before :c:func:`Py_Initialize`." +#: ../../c-api/import.rst:318 +msgid "" +"Add a collection of modules to the table of built-in modules. The *newtab* " +"array must end with a sentinel entry which contains ``NULL`` for " +"the :c:member:`~_inittab.name` field; failure to provide the sentinel value " +"can result in a memory fault. Returns ``0`` on success or ``-1`` if " +"insufficient memory could be allocated to extend the internal table. In the " +"event of failure, no modules are added to the internal table. This must be " +"called before :c:func:`Py_Initialize`." msgstr "" -msgid "If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` or :c:func:`PyImport_ExtendInittab` must be called before each Python initialization." +#: ../../c-api/import.rst:325 +msgid "" +"If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " +"or :c:func:`PyImport_ExtendInittab` must be called before each Python " +"initialization." msgstr "" -msgid "The table of built-in modules used by Python initialization. Do not use this directly; use :c:func:`PyImport_AppendInittab` and :c:func:`PyImport_ExtendInittab` instead." +#: ../../c-api/import.rst:332 +msgid "" +"The table of built-in modules used by Python initialization. Do not use this " +"directly; use :c:func:`PyImport_AppendInittab` " +"and :c:func:`PyImport_ExtendInittab` instead." msgstr "" +#: ../../c-api/import.rst:339 msgid "Import the module *mod_name* and get its attribute *attr_name*." msgstr "" +#: ../../c-api/import.rst:341 msgid "Names must be Python :class:`str` objects." msgstr "" -msgid "Helper function combining :c:func:`PyImport_Import` and :c:func:`PyObject_GetAttr`. For example, it can raise :exc:`ImportError` if the module is not found, and :exc:`AttributeError` if the attribute doesn't exist." +#: ../../c-api/import.rst:343 +msgid "" +"Helper function combining :c:func:`PyImport_Import` " +"and :c:func:`PyObject_GetAttr`. For example, it can raise :exc:`ImportError` " +"if the module is not found, and :exc:`AttributeError` if the attribute " +"doesn't exist." msgstr "" -msgid "Similar to :c:func:`PyImport_ImportModuleAttr`, but names are UTF-8 encoded strings instead of Python :class:`str` objects." +#: ../../c-api/import.rst:352 +msgid "" +"Similar to :c:func:`PyImport_ImportModuleAttr`, but names are UTF-8 encoded " +"strings instead of Python :class:`str` objects." msgstr "" +#: ../../c-api/import.rst:11 msgid "package variable" msgstr "" +#: ../../c-api/import.rst:11 msgid "__all__" msgstr "" +#: ../../c-api/import.rst:11 msgid "__all__ (package variable)" msgstr "" +#: ../../c-api/import.rst:11 msgid "modules (in module sys)" msgstr "" +#: ../../c-api/import.rst:35 ../../c-api/import.rst:127 msgid "built-in function" msgstr "" +#: ../../c-api/import.rst:35 msgid "__import__" msgstr "" +#: ../../c-api/import.rst:127 msgid "compile" msgstr "" +#: ../../c-api/import.rst:263 msgid "freeze utility" msgstr "" diff --git a/c-api/index.po b/c-api/index.po index 4dc2519e3..b216ea4ba 100644 --- a/c-api/index.po +++ b/c-api/index.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,8 +23,14 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/index.rst:5 msgid "Python/C API reference manual" msgstr "" -msgid "This manual documents the API used by C and C++ programmers who want to write extension modules or embed Python. It is a companion to :ref:`extending-index`, which describes the general principles of extension writing but does not document the API functions in detail." +#: ../../c-api/index.rst:7 +msgid "" +"This manual documents the API used by C and C++ programmers who want to " +"write extension modules or embed Python. It is a companion " +"to :ref:`extending-index`, which describes the general principles of " +"extension writing but does not document the API functions in detail." msgstr "" diff --git a/c-api/init.po b/c-api/init.po index f27f4b0c3..6e6b1df9f 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-17 04:35+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,26 +24,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/init.rst:4 msgid "Initialization, finalization, and threads" msgstr "" +#: ../../c-api/init.rst:6 msgid "This page has been split up into the following:" msgstr "" +#: ../../c-api/init.rst:8 msgid ":ref:`initialization`" msgstr "" +#: ../../c-api/init.rst:9 msgid ":ref:`threads`" msgstr "" +#: ../../c-api/init.rst:10 msgid ":ref:`synchronization`" msgstr "" +#: ../../c-api/init.rst:11 msgid ":ref:`thread-local-storage`" msgstr "" +#: ../../c-api/init.rst:12 msgid ":ref:`sub-interpreter-support`" msgstr "" +#: ../../c-api/init.rst:13 msgid ":ref:`profiling`" msgstr "" diff --git a/c-api/init_config.po b/c-api/init_config.po index 1bdd49b73..59a199d4c 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,30 +24,44 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/init_config.rst:7 msgid "Python Initialization Configuration" msgstr "" +#: ../../c-api/init_config.rst:13 msgid "PyInitConfig C API" msgstr "" +#: ../../c-api/init_config.rst:17 msgid "Python can be initialized with :c:func:`Py_InitializeFromInitConfig`." msgstr "" -msgid "The :c:func:`Py_RunMain` function can be used to write a customized Python program." +#: ../../c-api/init_config.rst:19 ../../c-api/init_config.rst:654 +msgid "" +"The :c:func:`Py_RunMain` function can be used to write a customized Python " +"program." msgstr "" -msgid "See also :ref:`Initialization, Finalization, and Threads `." +#: ../../c-api/init_config.rst:22 ../../c-api/init_config.rst:657 +msgid "" +"See also :ref:`Initialization, Finalization, and Threads `." msgstr "" +#: ../../c-api/init_config.rst:25 msgid ":pep:`741` \"Python Configuration C API\"." msgstr "" +#: ../../c-api/init_config.rst:29 ../../c-api/init_config.rst:664 msgid "Example" msgstr "" -msgid "Example of customized Python always running with the :ref:`Python Development Mode ` enabled; return ``-1`` on error:" +#: ../../c-api/init_config.rst:31 +msgid "" +"Example of customized Python always running with the :ref:`Python " +"Development Mode ` enabled; return ``-1`` on error:" msgstr "" +#: ../../c-api/init_config.rst:34 msgid "" "int init_python(void)\n" "{\n" @@ -84,681 +98,1045 @@ msgid "" "}" msgstr "" +#: ../../c-api/init_config.rst:71 msgid "Create Config" msgstr "" +#: ../../c-api/init_config.rst:75 msgid "Opaque structure to configure the Python initialization." msgstr "" -msgid "Create a new initialization configuration using :ref:`Isolated Configuration ` default values." +#: ../../c-api/init_config.rst:80 +msgid "" +"Create a new initialization configuration using :ref:`Isolated Configuration " +"` default values." msgstr "" +#: ../../c-api/init_config.rst:83 msgid "It must be freed by :c:func:`PyInitConfig_Free`." msgstr "" +#: ../../c-api/init_config.rst:85 msgid "Return ``NULL`` on memory allocation failure." msgstr "" +#: ../../c-api/init_config.rst:90 msgid "Free memory of the initialization configuration *config*." msgstr "" +#: ../../c-api/init_config.rst:92 msgid "If *config* is ``NULL``, no operation is performed." msgstr "" +#: ../../c-api/init_config.rst:96 msgid "Error Handling" msgstr "" +#: ../../c-api/init_config.rst:100 msgid "Get the *config* error message." msgstr "" +#: ../../c-api/init_config.rst:102 msgid "Set *\\*err_msg* and return ``1`` if an error is set." msgstr "" +#: ../../c-api/init_config.rst:103 msgid "Set *\\*err_msg* to ``NULL`` and return ``0`` otherwise." msgstr "" +#: ../../c-api/init_config.rst:105 msgid "An error message is a UTF-8 encoded string." msgstr "" +#: ../../c-api/init_config.rst:107 msgid "If *config* has an exit code, format the exit code as an error message." msgstr "" -msgid "The error message remains valid until another ``PyInitConfig`` function is called with *config*. The caller doesn't have to free the error message." +#: ../../c-api/init_config.rst:110 +msgid "" +"The error message remains valid until another ``PyInitConfig`` function is " +"called with *config*. The caller doesn't have to free the error message." msgstr "" +#: ../../c-api/init_config.rst:117 msgid "Get the *config* exit code." msgstr "" +#: ../../c-api/init_config.rst:119 msgid "Set *\\*exitcode* and return ``1`` if *config* has an exit code set." msgstr "" +#: ../../c-api/init_config.rst:120 msgid "Return ``0`` if *config* has no exit code set." msgstr "" -msgid "Only the ``Py_InitializeFromInitConfig()`` function can set an exit code if the ``parse_argv`` option is non-zero." +#: ../../c-api/init_config.rst:122 +msgid "" +"Only the ``Py_InitializeFromInitConfig()`` function can set an exit code if " +"the ``parse_argv`` option is non-zero." msgstr "" -msgid "An exit code can be set when parsing the command line failed (exit code ``2``) or when a command line option asks to display the command line help (exit code ``0``)." +#: ../../c-api/init_config.rst:125 +msgid "" +"An exit code can be set when parsing the command line failed (exit code " +"``2``) or when a command line option asks to display the command line help " +"(exit code ``0``)." msgstr "" +#: ../../c-api/init_config.rst:131 msgid "Get Options" msgstr "" -msgid "The configuration option *name* parameter must be a non-NULL null-terminated UTF-8 encoded string. See :ref:`Configuration Options `." +#: ../../c-api/init_config.rst:133 ../../c-api/init_config.rst:187 +#: ../../c-api/init_config.rst:559 +msgid "" +"The configuration option *name* parameter must be a non-NULL null-terminated " +"UTF-8 encoded string. See :ref:`Configuration Options `." msgstr "" +#: ../../c-api/init_config.rst:138 msgid "Test if the configuration has an option called *name*." msgstr "" +#: ../../c-api/init_config.rst:140 msgid "Return ``1`` if the option exists, or return ``0`` otherwise." msgstr "" +#: ../../c-api/init_config.rst:145 msgid "Get an integer configuration option." msgstr "" +#: ../../c-api/init_config.rst:147 ../../c-api/init_config.rst:156 msgid "Set *\\*value*, and return ``0`` on success." msgstr "" +#: ../../c-api/init_config.rst:148 ../../c-api/init_config.rst:157 +#: ../../c-api/init_config.rst:172 ../../c-api/init_config.rst:200 +#: ../../c-api/init_config.rst:209 ../../c-api/init_config.rst:218 +#: ../../c-api/init_config.rst:233 ../../c-api/init_config.rst:249 msgid "Set an error in *config* and return ``-1`` on error." msgstr "" -msgid "Get a string configuration option as a null-terminated UTF-8 encoded string." +#: ../../c-api/init_config.rst:153 +msgid "" +"Get a string configuration option as a null-terminated UTF-8 encoded string." msgstr "" -msgid "*\\*value* can be set to ``NULL`` if the option is an optional string and the option is unset." +#: ../../c-api/init_config.rst:159 +msgid "" +"*\\*value* can be set to ``NULL`` if the option is an optional string and " +"the option is unset." msgstr "" -msgid "On success, the string must be released with ``free(value)`` if it's not ``NULL``." +#: ../../c-api/init_config.rst:162 +msgid "" +"On success, the string must be released with ``free(value)`` if it's not " +"``NULL``." msgstr "" -msgid "Get a string list configuration option as an array of null-terminated UTF-8 encoded strings." +#: ../../c-api/init_config.rst:168 +msgid "" +"Get a string list configuration option as an array of null-terminated UTF-8 " +"encoded strings." msgstr "" +#: ../../c-api/init_config.rst:171 msgid "Set *\\*length* and *\\*value*, and return ``0`` on success." msgstr "" -msgid "On success, the string list must be released with ``PyInitConfig_FreeStrList(length, items)``." +#: ../../c-api/init_config.rst:174 +msgid "" +"On success, the string list must be released with " +"``PyInitConfig_FreeStrList(length, items)``." msgstr "" +#: ../../c-api/init_config.rst:180 msgid "Free memory of a string list created by ``PyInitConfig_GetStrList()``." msgstr "" +#: ../../c-api/init_config.rst:185 msgid "Set Options" msgstr "" -msgid "Some configuration options have side effects on other options. This logic is only implemented when ``Py_InitializeFromInitConfig()`` is called, not by the \"Set\" functions below. For example, setting ``dev_mode`` to ``1`` does not set ``faulthandler`` to ``1``." +#: ../../c-api/init_config.rst:190 +msgid "" +"Some configuration options have side effects on other options. This logic is " +"only implemented when ``Py_InitializeFromInitConfig()`` is called, not by " +"the \"Set\" functions below. For example, setting ``dev_mode`` to ``1`` does " +"not set ``faulthandler`` to ``1``." msgstr "" +#: ../../c-api/init_config.rst:197 msgid "Set an integer configuration option." msgstr "" +#: ../../c-api/init_config.rst:199 ../../c-api/init_config.rst:208 +#: ../../c-api/init_config.rst:217 ../../c-api/init_config.rst:232 +#: ../../c-api/init_config.rst:248 ../../c-api/init_config.rst:591 msgid "Return ``0`` on success." msgstr "" -msgid "Set a string configuration option from a null-terminated UTF-8 encoded string. The string is copied." +#: ../../c-api/init_config.rst:205 +msgid "" +"Set a string configuration option from a null-terminated UTF-8 encoded " +"string. The string is copied." msgstr "" -msgid "Set a string list configuration option from an array of null-terminated UTF-8 encoded strings. The string list is copied." +#: ../../c-api/init_config.rst:214 +msgid "" +"Set a string list configuration option from an array of null-terminated " +"UTF-8 encoded strings. The string list is copied." msgstr "" +#: ../../c-api/init_config.rst:222 msgid "Module" msgstr "" +#: ../../c-api/init_config.rst:226 msgid "Add a built-in extension module to the table of built-in modules." msgstr "" -msgid "The new module can be imported by the name *name*, and uses the function *initfunc* as the initialization function called on the first attempted import." +#: ../../c-api/init_config.rst:228 +msgid "" +"The new module can be imported by the name *name*, and uses the function " +"*initfunc* as the initialization function called on the first attempted " +"import." msgstr "" -msgid "If Python is initialized multiple times, ``PyInitConfig_AddModule()`` must be called at each Python initialization." +#: ../../c-api/init_config.rst:235 +msgid "" +"If Python is initialized multiple times, ``PyInitConfig_AddModule()`` must " +"be called at each Python initialization." msgstr "" +#: ../../c-api/init_config.rst:238 msgid "Similar to the :c:func:`PyImport_AppendInittab` function." msgstr "" +#: ../../c-api/init_config.rst:242 msgid "Initialize Python" msgstr "" +#: ../../c-api/init_config.rst:246 msgid "Initialize Python from the initialization configuration." msgstr "" +#: ../../c-api/init_config.rst:250 msgid "Set an exit code in *config* and return ``-1`` if Python wants to exit." msgstr "" +#: ../../c-api/init_config.rst:253 msgid "See ``PyInitConfig_GetExitcode()`` for the exit code case." msgstr "" +#: ../../c-api/init_config.rst:259 msgid "Configuration Options" msgstr "" +#: ../../c-api/init_config.rst:264 msgid "Option" msgstr "" +#: ../../c-api/init_config.rst:265 msgid "PyConfig/PyPreConfig member" msgstr "" +#: ../../c-api/init_config.rst:266 msgid "Type" msgstr "" +#: ../../c-api/init_config.rst:267 msgid "Visibility" msgstr "" +#: ../../c-api/init_config.rst:268 msgid "``\"allocator\"``" msgstr "" +#: ../../c-api/init_config.rst:269 msgid ":c:member:`allocator `" msgstr "" +#: ../../c-api/init_config.rst:270 ../../c-api/init_config.rst:294 +#: ../../c-api/init_config.rst:322 ../../c-api/init_config.rst:358 +#: ../../c-api/init_config.rst:366 ../../c-api/init_config.rst:378 +#: ../../c-api/init_config.rst:406 ../../c-api/init_config.rst:494 +#: ../../c-api/init_config.rst:522 ../../c-api/init_config.rst:576 msgid "``int``" msgstr "" +#: ../../c-api/init_config.rst:271 ../../c-api/init_config.rst:291 +#: ../../c-api/init_config.rst:299 ../../c-api/init_config.rst:303 +#: ../../c-api/init_config.rst:307 ../../c-api/init_config.rst:311 +#: ../../c-api/init_config.rst:315 ../../c-api/init_config.rst:319 +#: ../../c-api/init_config.rst:327 ../../c-api/init_config.rst:331 +#: ../../c-api/init_config.rst:335 ../../c-api/init_config.rst:347 +#: ../../c-api/init_config.rst:351 ../../c-api/init_config.rst:355 +#: ../../c-api/init_config.rst:359 ../../c-api/init_config.rst:363 +#: ../../c-api/init_config.rst:367 ../../c-api/init_config.rst:375 +#: ../../c-api/init_config.rst:387 ../../c-api/init_config.rst:391 +#: ../../c-api/init_config.rst:395 ../../c-api/init_config.rst:399 +#: ../../c-api/init_config.rst:411 ../../c-api/init_config.rst:415 +#: ../../c-api/init_config.rst:423 ../../c-api/init_config.rst:427 +#: ../../c-api/init_config.rst:439 ../../c-api/init_config.rst:451 +#: ../../c-api/init_config.rst:455 ../../c-api/init_config.rst:459 +#: ../../c-api/init_config.rst:463 ../../c-api/init_config.rst:467 +#: ../../c-api/init_config.rst:471 ../../c-api/init_config.rst:475 +#: ../../c-api/init_config.rst:479 ../../c-api/init_config.rst:483 +#: ../../c-api/init_config.rst:487 ../../c-api/init_config.rst:495 +#: ../../c-api/init_config.rst:503 ../../c-api/init_config.rst:507 +#: ../../c-api/init_config.rst:511 ../../c-api/init_config.rst:515 +#: ../../c-api/init_config.rst:519 ../../c-api/init_config.rst:527 +#: ../../c-api/init_config.rst:543 msgid "Read-only" msgstr "" +#: ../../c-api/init_config.rst:272 msgid "``\"argv\"``" msgstr "" +#: ../../c-api/init_config.rst:273 msgid ":c:member:`argv `" msgstr "" +#: ../../c-api/init_config.rst:274 ../../c-api/init_config.rst:402 +#: ../../c-api/init_config.rst:410 ../../c-api/init_config.rst:530 +#: ../../c-api/init_config.rst:578 msgid "``list[str]``" msgstr "" +#: ../../c-api/init_config.rst:275 ../../c-api/init_config.rst:279 +#: ../../c-api/init_config.rst:283 ../../c-api/init_config.rst:287 +#: ../../c-api/init_config.rst:295 ../../c-api/init_config.rst:323 +#: ../../c-api/init_config.rst:339 ../../c-api/init_config.rst:343 +#: ../../c-api/init_config.rst:371 ../../c-api/init_config.rst:379 +#: ../../c-api/init_config.rst:383 ../../c-api/init_config.rst:403 +#: ../../c-api/init_config.rst:407 ../../c-api/init_config.rst:419 +#: ../../c-api/init_config.rst:431 ../../c-api/init_config.rst:435 +#: ../../c-api/init_config.rst:443 ../../c-api/init_config.rst:447 +#: ../../c-api/init_config.rst:491 ../../c-api/init_config.rst:499 +#: ../../c-api/init_config.rst:523 ../../c-api/init_config.rst:531 +#: ../../c-api/init_config.rst:535 ../../c-api/init_config.rst:539 msgid "Public" msgstr "" +#: ../../c-api/init_config.rst:276 msgid "``\"base_exec_prefix\"``" msgstr "" +#: ../../c-api/init_config.rst:277 msgid ":c:member:`base_exec_prefix `" msgstr "" +#: ../../c-api/init_config.rst:278 ../../c-api/init_config.rst:282 +#: ../../c-api/init_config.rst:286 ../../c-api/init_config.rst:298 +#: ../../c-api/init_config.rst:334 ../../c-api/init_config.rst:338 +#: ../../c-api/init_config.rst:342 ../../c-api/init_config.rst:350 +#: ../../c-api/init_config.rst:354 ../../c-api/init_config.rst:362 +#: ../../c-api/init_config.rst:430 ../../c-api/init_config.rst:434 +#: ../../c-api/init_config.rst:438 ../../c-api/init_config.rst:442 +#: ../../c-api/init_config.rst:450 ../../c-api/init_config.rst:454 +#: ../../c-api/init_config.rst:458 ../../c-api/init_config.rst:462 +#: ../../c-api/init_config.rst:482 ../../c-api/init_config.rst:486 +#: ../../c-api/init_config.rst:490 ../../c-api/init_config.rst:577 msgid "``str``" msgstr "" +#: ../../c-api/init_config.rst:280 msgid "``\"base_executable\"``" msgstr "" +#: ../../c-api/init_config.rst:281 msgid ":c:member:`base_executable `" msgstr "" +#: ../../c-api/init_config.rst:284 msgid "``\"base_prefix\"``" msgstr "" +#: ../../c-api/init_config.rst:285 msgid ":c:member:`base_prefix `" msgstr "" +#: ../../c-api/init_config.rst:288 msgid "``\"buffered_stdio\"``" msgstr "" +#: ../../c-api/init_config.rst:289 msgid ":c:member:`buffered_stdio `" msgstr "" +#: ../../c-api/init_config.rst:290 ../../c-api/init_config.rst:302 +#: ../../c-api/init_config.rst:306 ../../c-api/init_config.rst:310 +#: ../../c-api/init_config.rst:314 ../../c-api/init_config.rst:318 +#: ../../c-api/init_config.rst:326 ../../c-api/init_config.rst:330 +#: ../../c-api/init_config.rst:346 ../../c-api/init_config.rst:370 +#: ../../c-api/init_config.rst:374 ../../c-api/init_config.rst:382 +#: ../../c-api/init_config.rst:386 ../../c-api/init_config.rst:390 +#: ../../c-api/init_config.rst:394 ../../c-api/init_config.rst:398 +#: ../../c-api/init_config.rst:414 ../../c-api/init_config.rst:418 +#: ../../c-api/init_config.rst:422 ../../c-api/init_config.rst:426 +#: ../../c-api/init_config.rst:446 ../../c-api/init_config.rst:466 +#: ../../c-api/init_config.rst:470 ../../c-api/init_config.rst:474 +#: ../../c-api/init_config.rst:478 ../../c-api/init_config.rst:498 +#: ../../c-api/init_config.rst:502 ../../c-api/init_config.rst:506 +#: ../../c-api/init_config.rst:510 ../../c-api/init_config.rst:514 +#: ../../c-api/init_config.rst:518 ../../c-api/init_config.rst:526 +#: ../../c-api/init_config.rst:534 ../../c-api/init_config.rst:542 +#: ../../c-api/init_config.rst:575 msgid "``bool``" msgstr "" +#: ../../c-api/init_config.rst:292 msgid "``\"bytes_warning\"``" msgstr "" +#: ../../c-api/init_config.rst:293 msgid ":c:member:`bytes_warning `" msgstr "" +#: ../../c-api/init_config.rst:296 msgid "``\"check_hash_pycs_mode\"``" msgstr "" +#: ../../c-api/init_config.rst:297 msgid ":c:member:`check_hash_pycs_mode `" msgstr "" +#: ../../c-api/init_config.rst:300 msgid "``\"code_debug_ranges\"``" msgstr "" +#: ../../c-api/init_config.rst:301 msgid ":c:member:`code_debug_ranges `" msgstr "" +#: ../../c-api/init_config.rst:304 msgid "``\"coerce_c_locale\"``" msgstr "" +#: ../../c-api/init_config.rst:305 msgid ":c:member:`coerce_c_locale `" msgstr "" +#: ../../c-api/init_config.rst:308 msgid "``\"coerce_c_locale_warn\"``" msgstr "" +#: ../../c-api/init_config.rst:309 msgid ":c:member:`coerce_c_locale_warn `" msgstr "" +#: ../../c-api/init_config.rst:312 msgid "``\"configure_c_stdio\"``" msgstr "" +#: ../../c-api/init_config.rst:313 msgid ":c:member:`configure_c_stdio `" msgstr "" +#: ../../c-api/init_config.rst:316 msgid "``\"configure_locale\"``" msgstr "" +#: ../../c-api/init_config.rst:317 msgid ":c:member:`configure_locale `" msgstr "" +#: ../../c-api/init_config.rst:320 msgid "``\"cpu_count\"``" msgstr "" +#: ../../c-api/init_config.rst:321 msgid ":c:member:`cpu_count `" msgstr "" +#: ../../c-api/init_config.rst:324 msgid "``\"dev_mode\"``" msgstr "" +#: ../../c-api/init_config.rst:325 msgid ":c:member:`dev_mode `" msgstr "" +#: ../../c-api/init_config.rst:328 msgid "``\"dump_refs\"``" msgstr "" +#: ../../c-api/init_config.rst:329 msgid ":c:member:`dump_refs `" msgstr "" +#: ../../c-api/init_config.rst:332 msgid "``\"dump_refs_file\"``" msgstr "" +#: ../../c-api/init_config.rst:333 msgid ":c:member:`dump_refs_file `" msgstr "" +#: ../../c-api/init_config.rst:336 msgid "``\"exec_prefix\"``" msgstr "" +#: ../../c-api/init_config.rst:337 msgid ":c:member:`exec_prefix `" msgstr "" +#: ../../c-api/init_config.rst:340 msgid "``\"executable\"``" msgstr "" +#: ../../c-api/init_config.rst:341 msgid ":c:member:`executable `" msgstr "" +#: ../../c-api/init_config.rst:344 msgid "``\"faulthandler\"``" msgstr "" +#: ../../c-api/init_config.rst:345 msgid ":c:member:`faulthandler `" msgstr "" +#: ../../c-api/init_config.rst:348 msgid "``\"filesystem_encoding\"``" msgstr "" +#: ../../c-api/init_config.rst:349 msgid ":c:member:`filesystem_encoding `" msgstr "" +#: ../../c-api/init_config.rst:352 msgid "``\"filesystem_errors\"``" msgstr "" +#: ../../c-api/init_config.rst:353 msgid ":c:member:`filesystem_errors `" msgstr "" +#: ../../c-api/init_config.rst:356 msgid "``\"hash_seed\"``" msgstr "" +#: ../../c-api/init_config.rst:357 msgid ":c:member:`hash_seed `" msgstr "" +#: ../../c-api/init_config.rst:360 msgid "``\"home\"``" msgstr "" +#: ../../c-api/init_config.rst:361 msgid ":c:member:`home `" msgstr "" +#: ../../c-api/init_config.rst:364 msgid "``\"import_time\"``" msgstr "" +#: ../../c-api/init_config.rst:365 msgid ":c:member:`import_time `" msgstr "" +#: ../../c-api/init_config.rst:368 msgid "``\"inspect\"``" msgstr "" +#: ../../c-api/init_config.rst:369 msgid ":c:member:`inspect `" msgstr "" +#: ../../c-api/init_config.rst:372 msgid "``\"install_signal_handlers\"``" msgstr "" +#: ../../c-api/init_config.rst:373 msgid ":c:member:`install_signal_handlers `" msgstr "" +#: ../../c-api/init_config.rst:376 msgid "``\"int_max_str_digits\"``" msgstr "" +#: ../../c-api/init_config.rst:377 msgid ":c:member:`int_max_str_digits `" msgstr "" +#: ../../c-api/init_config.rst:380 msgid "``\"interactive\"``" msgstr "" +#: ../../c-api/init_config.rst:381 msgid ":c:member:`interactive `" msgstr "" +#: ../../c-api/init_config.rst:384 msgid "``\"isolated\"``" msgstr "" +#: ../../c-api/init_config.rst:385 msgid ":c:member:`isolated `" msgstr "" +#: ../../c-api/init_config.rst:388 msgid "``\"legacy_windows_fs_encoding\"``" msgstr "" -msgid ":c:member:`legacy_windows_fs_encoding `" +#: ../../c-api/init_config.rst:389 +msgid "" +":c:member:`legacy_windows_fs_encoding " +"`" msgstr "" +#: ../../c-api/init_config.rst:392 msgid "``\"legacy_windows_stdio\"``" msgstr "" +#: ../../c-api/init_config.rst:393 msgid ":c:member:`legacy_windows_stdio `" msgstr "" +#: ../../c-api/init_config.rst:396 msgid "``\"malloc_stats\"``" msgstr "" +#: ../../c-api/init_config.rst:397 msgid ":c:member:`malloc_stats `" msgstr "" +#: ../../c-api/init_config.rst:400 msgid "``\"module_search_paths\"``" msgstr "" +#: ../../c-api/init_config.rst:401 msgid ":c:member:`module_search_paths `" msgstr "" +#: ../../c-api/init_config.rst:404 msgid "``\"optimization_level\"``" msgstr "" +#: ../../c-api/init_config.rst:405 msgid ":c:member:`optimization_level `" msgstr "" +#: ../../c-api/init_config.rst:408 msgid "``\"orig_argv\"``" msgstr "" +#: ../../c-api/init_config.rst:409 msgid ":c:member:`orig_argv `" msgstr "" +#: ../../c-api/init_config.rst:412 msgid "``\"parse_argv\"``" msgstr "" +#: ../../c-api/init_config.rst:413 msgid ":c:member:`parse_argv `" msgstr "" +#: ../../c-api/init_config.rst:416 msgid "``\"parser_debug\"``" msgstr "" +#: ../../c-api/init_config.rst:417 msgid ":c:member:`parser_debug `" msgstr "" +#: ../../c-api/init_config.rst:420 msgid "``\"pathconfig_warnings\"``" msgstr "" +#: ../../c-api/init_config.rst:421 msgid ":c:member:`pathconfig_warnings `" msgstr "" +#: ../../c-api/init_config.rst:424 msgid "``\"perf_profiling\"``" msgstr "" +#: ../../c-api/init_config.rst:425 msgid ":c:member:`perf_profiling `" msgstr "" +#: ../../c-api/init_config.rst:428 msgid "``\"platlibdir\"``" msgstr "" +#: ../../c-api/init_config.rst:429 msgid ":c:member:`platlibdir `" msgstr "" +#: ../../c-api/init_config.rst:432 msgid "``\"prefix\"``" msgstr "" +#: ../../c-api/init_config.rst:433 msgid ":c:member:`prefix `" msgstr "" +#: ../../c-api/init_config.rst:436 msgid "``\"program_name\"``" msgstr "" +#: ../../c-api/init_config.rst:437 msgid ":c:member:`program_name `" msgstr "" +#: ../../c-api/init_config.rst:440 msgid "``\"pycache_prefix\"``" msgstr "" +#: ../../c-api/init_config.rst:441 msgid ":c:member:`pycache_prefix `" msgstr "" +#: ../../c-api/init_config.rst:444 msgid "``\"quiet\"``" msgstr "" +#: ../../c-api/init_config.rst:445 msgid ":c:member:`quiet `" msgstr "" +#: ../../c-api/init_config.rst:448 msgid "``\"run_command\"``" msgstr "" +#: ../../c-api/init_config.rst:449 msgid ":c:member:`run_command `" msgstr "" +#: ../../c-api/init_config.rst:452 msgid "``\"run_filename\"``" msgstr "" +#: ../../c-api/init_config.rst:453 msgid ":c:member:`run_filename `" msgstr "" +#: ../../c-api/init_config.rst:456 msgid "``\"run_module\"``" msgstr "" +#: ../../c-api/init_config.rst:457 msgid ":c:member:`run_module `" msgstr "" +#: ../../c-api/init_config.rst:460 msgid "``\"run_presite\"``" msgstr "" +#: ../../c-api/init_config.rst:461 msgid ":c:member:`run_presite `" msgstr "" +#: ../../c-api/init_config.rst:464 msgid "``\"safe_path\"``" msgstr "" +#: ../../c-api/init_config.rst:465 msgid ":c:member:`safe_path `" msgstr "" +#: ../../c-api/init_config.rst:468 msgid "``\"show_ref_count\"``" msgstr "" +#: ../../c-api/init_config.rst:469 msgid ":c:member:`show_ref_count `" msgstr "" +#: ../../c-api/init_config.rst:472 msgid "``\"site_import\"``" msgstr "" +#: ../../c-api/init_config.rst:473 msgid ":c:member:`site_import `" msgstr "" +#: ../../c-api/init_config.rst:476 msgid "``\"skip_source_first_line\"``" msgstr "" +#: ../../c-api/init_config.rst:477 msgid ":c:member:`skip_source_first_line `" msgstr "" +#: ../../c-api/init_config.rst:480 msgid "``\"stdio_encoding\"``" msgstr "" +#: ../../c-api/init_config.rst:481 msgid ":c:member:`stdio_encoding `" msgstr "" +#: ../../c-api/init_config.rst:484 msgid "``\"stdio_errors\"``" msgstr "" +#: ../../c-api/init_config.rst:485 msgid ":c:member:`stdio_errors `" msgstr "" +#: ../../c-api/init_config.rst:488 msgid "``\"stdlib_dir\"``" msgstr "" +#: ../../c-api/init_config.rst:489 msgid ":c:member:`stdlib_dir `" msgstr "" +#: ../../c-api/init_config.rst:492 msgid "``\"tracemalloc\"``" msgstr "" +#: ../../c-api/init_config.rst:493 msgid ":c:member:`tracemalloc `" msgstr "" +#: ../../c-api/init_config.rst:496 msgid "``\"use_environment\"``" msgstr "" +#: ../../c-api/init_config.rst:497 msgid ":c:member:`use_environment `" msgstr "" +#: ../../c-api/init_config.rst:500 msgid "``\"use_frozen_modules\"``" msgstr "" +#: ../../c-api/init_config.rst:501 msgid ":c:member:`use_frozen_modules `" msgstr "" +#: ../../c-api/init_config.rst:504 msgid "``\"use_hash_seed\"``" msgstr "" +#: ../../c-api/init_config.rst:505 msgid ":c:member:`use_hash_seed `" msgstr "" +#: ../../c-api/init_config.rst:508 msgid "``\"use_system_logger\"``" msgstr "" +#: ../../c-api/init_config.rst:509 msgid ":c:member:`use_system_logger `" msgstr "" +#: ../../c-api/init_config.rst:512 msgid "``\"user_site_directory\"``" msgstr "" +#: ../../c-api/init_config.rst:513 msgid ":c:member:`user_site_directory `" msgstr "" +#: ../../c-api/init_config.rst:516 msgid "``\"utf8_mode\"``" msgstr "" +#: ../../c-api/init_config.rst:517 msgid ":c:member:`utf8_mode `" msgstr "" +#: ../../c-api/init_config.rst:520 msgid "``\"verbose\"``" msgstr "" +#: ../../c-api/init_config.rst:521 msgid ":c:member:`verbose `" msgstr "" +#: ../../c-api/init_config.rst:524 msgid "``\"warn_default_encoding\"``" msgstr "" +#: ../../c-api/init_config.rst:525 msgid ":c:member:`warn_default_encoding `" msgstr "" +#: ../../c-api/init_config.rst:528 msgid "``\"warnoptions\"``" msgstr "" +#: ../../c-api/init_config.rst:529 msgid ":c:member:`warnoptions `" msgstr "" +#: ../../c-api/init_config.rst:532 msgid "``\"write_bytecode\"``" msgstr "" +#: ../../c-api/init_config.rst:533 msgid ":c:member:`write_bytecode `" msgstr "" +#: ../../c-api/init_config.rst:536 msgid "``\"xoptions\"``" msgstr "" +#: ../../c-api/init_config.rst:537 msgid ":c:member:`xoptions `" msgstr "" +#: ../../c-api/init_config.rst:538 ../../c-api/init_config.rst:579 msgid "``dict[str, str]``" msgstr "" +#: ../../c-api/init_config.rst:540 msgid "``\"_pystats\"``" msgstr "" +#: ../../c-api/init_config.rst:541 msgid ":c:member:`_pystats `" msgstr "" +#: ../../c-api/init_config.rst:545 msgid "Visibility:" msgstr "" -msgid "Public: Can be retrieved by :c:func:`PyConfig_Get` and set by :c:func:`PyConfig_Set`." +#: ../../c-api/init_config.rst:547 +msgid "" +"Public: Can be retrieved by :c:func:`PyConfig_Get` and set " +"by :c:func:`PyConfig_Set`." msgstr "" -msgid "Read-only: Can be retrieved by :c:func:`PyConfig_Get`, but cannot be set by :c:func:`PyConfig_Set`." +#: ../../c-api/init_config.rst:549 +msgid "" +"Read-only: Can be retrieved by :c:func:`PyConfig_Get`, but cannot be set " +"by :c:func:`PyConfig_Set`." msgstr "" +#: ../../c-api/init_config.rst:554 msgid "Runtime Python configuration API" msgstr "" -msgid "At runtime, it's possible to get and set configuration options using :c:func:`PyConfig_Get` and :c:func:`PyConfig_Set` functions." +#: ../../c-api/init_config.rst:556 +msgid "" +"At runtime, it's possible to get and set configuration options " +"using :c:func:`PyConfig_Get` and :c:func:`PyConfig_Set` functions." msgstr "" -msgid "Some options are read from the :mod:`sys` attributes. For example, the option ``\"argv\"`` is read from :data:`sys.argv`." +#: ../../c-api/init_config.rst:562 +msgid "" +"Some options are read from the :mod:`sys` attributes. For example, the " +"option ``\"argv\"`` is read from :data:`sys.argv`." msgstr "" -msgid "Get the current runtime value of a configuration option as a Python object." +#: ../../c-api/init_config.rst:568 +msgid "" +"Get the current runtime value of a configuration option as a Python object." msgstr "" +#: ../../c-api/init_config.rst:570 ../../c-api/init_config.rst:601 msgid "Return a new reference on success." msgstr "" +#: ../../c-api/init_config.rst:571 ../../c-api/init_config.rst:602 msgid "Set an exception and return ``NULL`` on error." msgstr "" +#: ../../c-api/init_config.rst:573 msgid "The object type depends on the configuration option. It can be:" msgstr "" -msgid "The caller must have an :term:`attached thread state`. The function cannot be called before Python initialization nor after Python finalization." +#: ../../c-api/init_config.rst:581 ../../c-api/init_config.rst:604 +#: ../../c-api/init_config.rst:619 +msgid "" +"The caller must have an :term:`attached thread state`. The function cannot " +"be called before Python initialization nor after Python finalization." msgstr "" +#: ../../c-api/init_config.rst:589 msgid "Similar to :c:func:`PyConfig_Get`, but get the value as a C int." msgstr "" +#: ../../c-api/init_config.rst:592 msgid "Set an exception and return ``-1`` on error." msgstr "" +#: ../../c-api/init_config.rst:599 msgid "Get all configuration option names as a ``frozenset``." msgstr "" +#: ../../c-api/init_config.rst:612 msgid "Set the current runtime value of a configuration option." msgstr "" +#: ../../c-api/init_config.rst:614 msgid "Raise a :exc:`ValueError` if there is no option *name*." msgstr "" +#: ../../c-api/init_config.rst:615 msgid "Raise a :exc:`ValueError` if *value* is an invalid value." msgstr "" +#: ../../c-api/init_config.rst:616 msgid "Raise a :exc:`ValueError` if the option is read-only (cannot be set)." msgstr "" +#: ../../c-api/init_config.rst:617 msgid "Raise a :exc:`TypeError` if *value* has not the proper type." msgstr "" -msgid "Raises an :ref:`auditing event ` ``cpython.PyConfig_Set`` with arguments ``name``, ``value``." +#: ../../c-api/init_config.rst:622 +msgid "" +"Raises an :ref:`auditing event ` ``cpython.PyConfig_Set`` with " +"arguments ``name``, ``value``." msgstr "" +#: ../../c-api/init_config.rst:626 +msgid "" +"The function now replaces :data:`sys.flags` (create a new object), instead " +"of modifying :data:`sys.flags` in-place." +msgstr "" + +#: ../../c-api/init_config.rst:634 msgid "PyConfig C API" msgstr "" -msgid "Python can be initialized with :c:func:`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure. It can be preinitialized with :c:func:`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." +#: ../../c-api/init_config.rst:638 +msgid "" +"Python can be initialized with :c:func:`Py_InitializeFromConfig` and " +"the :c:type:`PyConfig` structure. It can be preinitialized " +"with :c:func:`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." msgstr "" +#: ../../c-api/init_config.rst:642 msgid "There are two kinds of configuration:" msgstr "" -msgid "The :ref:`Python Configuration ` can be used to build a customized Python which behaves as the regular Python. For example, environment variables and command line arguments are used to configure Python." +#: ../../c-api/init_config.rst:644 +msgid "" +"The :ref:`Python Configuration ` can be used to build a " +"customized Python which behaves as the regular Python. For example, " +"environment variables and command line arguments are used to configure " +"Python." msgstr "" -msgid "The :ref:`Isolated Configuration ` can be used to embed Python into an application. It isolates Python from the system. For example, environment variables are ignored, the LC_CTYPE locale is left unchanged and no signal handler is registered." +#: ../../c-api/init_config.rst:649 +msgid "" +"The :ref:`Isolated Configuration ` can be used to embed " +"Python into an application. It isolates Python from the system. For example, " +"environment variables are ignored, the LC_CTYPE locale is left unchanged and " +"no signal handler is registered." msgstr "" +#: ../../c-api/init_config.rst:660 msgid ":pep:`587` \"Python Initialization Configuration\"." msgstr "" +#: ../../c-api/init_config.rst:666 msgid "Example of customized Python always running in isolated mode::" msgstr "" +#: ../../c-api/init_config.rst:668 msgid "" "int main(int argc, char **argv)\n" "{\n" @@ -794,99 +1172,144 @@ msgid "" "}" msgstr "" +#: ../../c-api/init_config.rst:703 msgid "PyWideStringList" msgstr "" +#: ../../c-api/init_config.rst:707 msgid "List of ``wchar_t*`` strings." msgstr "" -msgid "If *length* is non-zero, *items* must be non-``NULL`` and all strings must be non-``NULL``." +#: ../../c-api/init_config.rst:709 +msgid "" +"If *length* is non-zero, *items* must be non-``NULL`` and all strings must " +"be non-``NULL``." msgstr "" +#: ../../c-api/init_config.rst:714 msgid "Methods:" msgstr "" +#: ../../c-api/init_config.rst:718 msgid "Append *item* to *list*." msgstr "" +#: ../../c-api/init_config.rst:720 ../../c-api/init_config.rst:731 msgid "Python must be preinitialized to call this function." msgstr "" +#: ../../c-api/init_config.rst:724 msgid "Insert *item* into *list* at *index*." msgstr "" -msgid "If *index* is greater than or equal to *list* length, append *item* to *list*." +#: ../../c-api/init_config.rst:726 +msgid "" +"If *index* is greater than or equal to *list* length, append *item* to " +"*list*." msgstr "" +#: ../../c-api/init_config.rst:729 msgid "*index* must be greater than or equal to ``0``." msgstr "" +#: ../../c-api/init_config.rst:735 ../../c-api/init_config.rst:755 +#: ../../c-api/init_config.rst:862 ../../c-api/init_config.rst:1181 msgid "Structure fields:" msgstr "" +#: ../../c-api/init_config.rst:739 msgid "List length." msgstr "" +#: ../../c-api/init_config.rst:743 msgid "List items." msgstr "" +#: ../../c-api/init_config.rst:746 msgid "PyStatus" msgstr "" -msgid "Structure to store an initialization function status: success, error or exit." +#: ../../c-api/init_config.rst:750 +msgid "" +"Structure to store an initialization function status: success, error or exit." msgstr "" +#: ../../c-api/init_config.rst:753 msgid "For an error, it can store the C function name which created the error." msgstr "" +#: ../../c-api/init_config.rst:759 msgid "Exit code. Argument passed to ``exit()``." msgstr "" +#: ../../c-api/init_config.rst:763 msgid "Error message." msgstr "" +#: ../../c-api/init_config.rst:767 msgid "Name of the function which created an error, can be ``NULL``." msgstr "" +#: ../../c-api/init_config.rst:771 msgid "Functions to create a status:" msgstr "" +#: ../../c-api/init_config.rst:775 msgid "Success." msgstr "" +#: ../../c-api/init_config.rst:779 msgid "Initialization error with a message." msgstr "" +#: ../../c-api/init_config.rst:781 msgid "*err_msg* must not be ``NULL``." msgstr "" +#: ../../c-api/init_config.rst:785 msgid "Memory allocation failure (out of memory)." msgstr "" +#: ../../c-api/init_config.rst:789 msgid "Exit Python with the specified exit code." msgstr "" +#: ../../c-api/init_config.rst:791 msgid "Functions to handle a status:" msgstr "" -msgid "Is the status an error or an exit? If true, the exception must be handled; by calling :c:func:`Py_ExitStatusException` for example." +#: ../../c-api/init_config.rst:795 +msgid "" +"Is the status an error or an exit? If true, the exception must be handled; " +"by calling :c:func:`Py_ExitStatusException` for example." msgstr "" +#: ../../c-api/init_config.rst:800 msgid "Is the result an error?" msgstr "" +#: ../../c-api/init_config.rst:804 msgid "Is the result an exit?" msgstr "" -msgid "Call ``exit(exitcode)`` if *status* is an exit. Print the error message and exit with a non-zero exit code if *status* is an error. Must only be called if ``PyStatus_Exception(status)`` is non-zero." +#: ../../c-api/init_config.rst:808 +msgid "" +"Call ``exit(exitcode)`` if *status* is an exit. Print the error message and " +"exit with a non-zero exit code if *status* is an error. Must only be called " +"if ``PyStatus_Exception(status)`` is non-zero." msgstr "" -msgid "Internally, Python uses macros which set ``PyStatus.func``, whereas functions to create a status set ``func`` to ``NULL``." +#: ../../c-api/init_config.rst:813 +msgid "" +"Internally, Python uses macros which set ``PyStatus.func``, whereas " +"functions to create a status set ``func`` to ``NULL``." msgstr "" +#: ../../c-api/init_config.rst:816 msgid "Example::" msgstr "" +#: ../../c-api/init_config.rst:818 msgid "" "PyStatus alloc(void **ptr, size_t size)\n" "{\n" @@ -909,189 +1332,331 @@ msgid "" "}" msgstr "" +#: ../../c-api/init_config.rst:840 msgid "PyPreConfig" msgstr "" +#: ../../c-api/init_config.rst:844 msgid "Structure used to preinitialize Python." msgstr "" +#: ../../c-api/init_config.rst:848 msgid "Function to initialize a preconfiguration:" msgstr "" -msgid "Initialize the preconfiguration with :ref:`Python Configuration `." +#: ../../c-api/init_config.rst:852 +msgid "" +"Initialize the preconfiguration with :ref:`Python Configuration `." msgstr "" -msgid "Initialize the preconfiguration with :ref:`Isolated Configuration `." +#: ../../c-api/init_config.rst:857 +msgid "" +"Initialize the preconfiguration with :ref:`Isolated Configuration `." msgstr "" +#: ../../c-api/init_config.rst:866 msgid "Name of the Python memory allocators:" msgstr "" -msgid "``PYMEM_ALLOCATOR_NOT_SET`` (``0``): don't change memory allocators (use defaults)." +#: ../../c-api/init_config.rst:868 +msgid "" +"``PYMEM_ALLOCATOR_NOT_SET`` (``0``): don't change memory allocators (use " +"defaults)." msgstr "" -msgid "``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`default memory allocators `." +#: ../../c-api/init_config.rst:870 +msgid "" +"``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`default memory allocators " +"`." msgstr "" -msgid "``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`default memory allocators ` with :ref:`debug hooks `." +#: ../../c-api/init_config.rst:872 +msgid "" +"``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`default memory allocators ` with :ref:`debug hooks `." msgstr "" +#: ../../c-api/init_config.rst:875 msgid "``PYMEM_ALLOCATOR_MALLOC`` (``3``): use ``malloc()`` of the C library." msgstr "" -msgid "``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of ``malloc()`` with :ref:`debug hooks `." +#: ../../c-api/init_config.rst:876 +msgid "" +"``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of ``malloc()`` " +"with :ref:`debug hooks `." msgstr "" -msgid "``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python pymalloc memory allocator `." +#: ../../c-api/init_config.rst:878 +msgid "" +"``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python pymalloc memory allocator " +"`." msgstr "" -msgid "``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python pymalloc memory allocator ` with :ref:`debug hooks `." +#: ../../c-api/init_config.rst:880 +msgid "" +"``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python pymalloc memory " +"allocator ` with :ref:`debug hooks `." msgstr "" -msgid "``PYMEM_ALLOCATOR_MIMALLOC`` (``6``): use ``mimalloc``, a fast malloc replacement." +#: ../../c-api/init_config.rst:883 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` (``6``): use ``mimalloc``, a fast malloc " +"replacement." msgstr "" -msgid "``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` (``7``): use ``mimalloc``, a fast malloc replacement with :ref:`debug hooks `." +#: ../../c-api/init_config.rst:885 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` (``7``): use ``mimalloc``, a fast malloc " +"replacement with :ref:`debug hooks `." msgstr "" -msgid "``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not supported if Python is :option:`configured using --without-pymalloc <--without-pymalloc>`." +#: ../../c-api/init_config.rst:889 +msgid "" +"``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not " +"supported if Python is :option:`configured using --without-pymalloc <--" +"without-pymalloc>`." msgstr "" -msgid "``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not supported if Python is :option:`configured using --without-mimalloc <--without-mimalloc>` or if the underlying atomic support isn't available." +#: ../../c-api/init_config.rst:893 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not " +"supported if Python is :option:`configured using --without-mimalloc <--" +"without-mimalloc>` or if the underlying atomic support isn't available." msgstr "" +#: ../../c-api/init_config.rst:898 msgid "See :ref:`Memory Management `." msgstr "" +#: ../../c-api/init_config.rst:900 msgid "Default: ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" +#: ../../c-api/init_config.rst:904 msgid "Set the LC_CTYPE locale to the user preferred locale." msgstr "" -msgid "If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." +#: ../../c-api/init_config.rst:906 +msgid "" +"If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` " +"and :c:member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" +#: ../../c-api/init_config.rst:909 ../../c-api/init_config.rst:920 msgid "See the :term:`locale encoding`." msgstr "" +#: ../../c-api/init_config.rst:911 ../../c-api/init_config.rst:966 +#: ../../c-api/init_config.rst:1337 msgid "Default: ``1`` in Python config, ``0`` in isolated config." msgstr "" +#: ../../c-api/init_config.rst:915 msgid "If equals to ``2``, coerce the C locale." msgstr "" -msgid "If equals to ``1``, read the LC_CTYPE locale to decide if it should be coerced." +#: ../../c-api/init_config.rst:917 +msgid "" +"If equals to ``1``, read the LC_CTYPE locale to decide if it should be " +"coerced." msgstr "" +#: ../../c-api/init_config.rst:922 ../../c-api/init_config.rst:928 msgid "Default: ``-1`` in Python config, ``0`` in isolated config." msgstr "" +#: ../../c-api/init_config.rst:926 msgid "If non-zero, emit a warning if the C locale is coerced." msgstr "" -msgid ":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." +#: ../../c-api/init_config.rst:932 +msgid "" +":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" +#: ../../c-api/init_config.rst:935 ../../c-api/init_config.rst:1346 +#: ../../c-api/init_config.rst:1402 ../../c-api/init_config.rst:1896 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" +#: ../../c-api/init_config.rst:939 msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" +#: ../../c-api/init_config.rst:941 ../../c-api/init_config.rst:1573 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." msgstr "" +#: ../../c-api/init_config.rst:945 msgid "If non-zero:" msgstr "" +#: ../../c-api/init_config.rst:947 msgid "Set :c:member:`PyPreConfig.utf8_mode` to ``0``," msgstr "" +#: ../../c-api/init_config.rst:948 msgid "Set :c:member:`PyConfig.filesystem_encoding` to ``\"mbcs\"``," msgstr "" +#: ../../c-api/init_config.rst:949 msgid "Set :c:member:`PyConfig.filesystem_errors` to ``\"replace\"``." msgstr "" -msgid "Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable value." -msgstr "" - -msgid "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for Windows specific code." +#: ../../c-api/init_config.rst:951 +msgid "" +"Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " +"variable value." msgstr "" +#: ../../c-api/init_config.rst:954 ../../c-api/init_config.rst:1587 +msgid "" +"Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " +"Windows specific code." +msgstr "" + +#: ../../c-api/init_config.rst:957 ../../c-api/init_config.rst:1285 +#: ../../c-api/init_config.rst:1292 ../../c-api/init_config.rst:1359 +#: ../../c-api/init_config.rst:1491 ../../c-api/init_config.rst:1509 +#: ../../c-api/init_config.rst:1523 ../../c-api/init_config.rst:1590 +#: ../../c-api/init_config.rst:1604 ../../c-api/init_config.rst:1664 +#: ../../c-api/init_config.rst:1716 ../../c-api/init_config.rst:1778 +#: ../../c-api/init_config.rst:1832 ../../c-api/init_config.rst:1861 +#: ../../c-api/init_config.rst:1975 ../../c-api/init_config.rst:2021 msgid "Default: ``0``." msgstr "" -msgid "If non-zero, :c:func:`Py_PreInitializeFromArgs` and :c:func:`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument the same way the regular Python parses command line arguments: see :ref:`Command Line Arguments `." +#: ../../c-api/init_config.rst:961 +msgid "" +"If non-zero, :c:func:`Py_PreInitializeFromArgs` " +"and :c:func:`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument " +"the same way the regular Python parses command line arguments: " +"see :ref:`Command Line Arguments `." msgstr "" -msgid "Use :ref:`environment variables `? See :c:member:`PyConfig.use_environment`." +#: ../../c-api/init_config.rst:970 +msgid "" +"Use :ref:`environment variables `? " +"See :c:member:`PyConfig.use_environment`." msgstr "" +#: ../../c-api/init_config.rst:973 ../../c-api/init_config.rst:1937 msgid "Default: ``1`` in Python config and ``0`` in isolated config." msgstr "" +#: ../../c-api/init_config.rst:977 msgid "If non-zero, enable the :ref:`Python UTF-8 Mode `." msgstr "" -msgid "Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and the :envvar:`PYTHONUTF8` environment variable." +#: ../../c-api/init_config.rst:979 +msgid "" +"Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " +"the :envvar:`PYTHONUTF8` environment variable." msgstr "" +#: ../../c-api/init_config.rst:982 msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." msgstr "" +#: ../../c-api/init_config.rst:984 msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" +#: ../../c-api/init_config.rst:990 msgid "Preinitialize Python with PyPreConfig" msgstr "" +#: ../../c-api/init_config.rst:992 msgid "The preinitialization of Python:" msgstr "" +#: ../../c-api/init_config.rst:994 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" +#: ../../c-api/init_config.rst:995 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" -msgid "Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig.utf8_mode`)" +#: ../../c-api/init_config.rst:996 +msgid "" +"Set the :ref:`Python UTF-8 Mode ` " +"(:c:member:`PyPreConfig.utf8_mode`)" msgstr "" -msgid "The current preconfiguration (``PyPreConfig`` type) is stored in ``_PyRuntime.preconfig``." +#: ../../c-api/init_config.rst:999 +msgid "" +"The current preconfiguration (``PyPreConfig`` type) is stored in " +"``_PyRuntime.preconfig``." msgstr "" +#: ../../c-api/init_config.rst:1002 msgid "Functions to preinitialize Python:" msgstr "" +#: ../../c-api/init_config.rst:1006 ../../c-api/init_config.rst:1012 +#: ../../c-api/init_config.rst:1021 msgid "Preinitialize Python from *preconfig* preconfiguration." msgstr "" +#: ../../c-api/init_config.rst:1008 ../../c-api/init_config.rst:1017 +#: ../../c-api/init_config.rst:1026 msgid "*preconfig* must not be ``NULL``." msgstr "" -msgid "Parse *argv* command line arguments (bytes strings) if :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero." +#: ../../c-api/init_config.rst:1014 +msgid "" +"Parse *argv* command line arguments (bytes strings) " +"if :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -msgid "Parse *argv* command line arguments (wide strings) if :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero." +#: ../../c-api/init_config.rst:1023 +msgid "" +"Parse *argv* command line arguments (wide strings) " +"if :c:member:`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -msgid "The caller is responsible to handle exceptions (error or exit) using :c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." +#: ../../c-api/init_config.rst:1028 ../../c-api/init_config.rst:2044 +msgid "" +"The caller is responsible to handle exceptions (error or exit) " +"using :c:func:`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" -msgid "For :ref:`Python Configuration ` (:c:func:`PyPreConfig_InitPythonConfig`), if Python is initialized with command line arguments, the command line arguments must also be passed to preinitialize Python, since they have an effect on the pre-configuration like encodings. For example, the :option:`-X utf8 <-X>` command line option enables the :ref:`Python UTF-8 Mode `." +#: ../../c-api/init_config.rst:1031 +msgid "" +"For :ref:`Python Configuration ` " +"(:c:func:`PyPreConfig_InitPythonConfig`), if Python is initialized with " +"command line arguments, the command line arguments must also be passed to " +"preinitialize Python, since they have an effect on the pre-configuration " +"like encodings. For example, the :option:`-X utf8 <-X>` command line option " +"enables the :ref:`Python UTF-8 Mode `." msgstr "" -msgid "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and before :c:func:`Py_InitializeFromConfig` to install a custom memory allocator. It can be called before :c:func:`Py_PreInitialize` if :c:member:`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." +#: ../../c-api/init_config.rst:1038 +msgid "" +"``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " +"before :c:func:`Py_InitializeFromConfig` to install a custom memory " +"allocator. It can be called before :c:func:`Py_PreInitialize` " +"if :c:member:`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -msgid "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not be used before the Python preinitialization, whereas calling directly ``malloc()`` and ``free()`` is always safe. :c:func:`Py_DecodeLocale` must not be called before the Python preinitialization." +#: ../../c-api/init_config.rst:1043 +msgid "" +"Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " +"be used before the Python preinitialization, whereas calling directly " +"``malloc()`` and ``free()`` is always safe. :c:func:`Py_DecodeLocale` must " +"not be called before the Python preinitialization." msgstr "" -msgid "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode `::" +#: ../../c-api/init_config.rst:1048 +msgid "" +"Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " +"`::" msgstr "" +#: ../../c-api/init_config.rst:1051 msgid "" "PyStatus status;\n" "PyPreConfig preconfig;\n" @@ -1111,747 +1676,1320 @@ msgid "" "Py_Finalize();" msgstr "" +#: ../../c-api/init_config.rst:1070 msgid "PyConfig" msgstr "" +#: ../../c-api/init_config.rst:1074 msgid "Structure containing most parameters to configure Python." msgstr "" -msgid "When done, the :c:func:`PyConfig_Clear` function must be used to release the configuration memory." +#: ../../c-api/init_config.rst:1076 +msgid "" +"When done, the :c:func:`PyConfig_Clear` function must be used to release the " +"configuration memory." msgstr "" +#: ../../c-api/init_config.rst:1081 msgid "Structure methods:" msgstr "" -msgid "Initialize configuration with the :ref:`Python Configuration `." +#: ../../c-api/init_config.rst:1085 +msgid "" +"Initialize configuration with the :ref:`Python Configuration `." msgstr "" -msgid "Initialize configuration with the :ref:`Isolated Configuration `." +#: ../../c-api/init_config.rst:1090 +msgid "" +"Initialize configuration with the :ref:`Isolated Configuration `." msgstr "" +#: ../../c-api/init_config.rst:1095 msgid "Copy the wide character string *str* into ``*config_str``." msgstr "" +#: ../../c-api/init_config.rst:1097 ../../c-api/init_config.rst:1104 +#: ../../c-api/init_config.rst:1111 ../../c-api/init_config.rst:1119 +#: ../../c-api/init_config.rst:1125 ../../c-api/init_config.rst:1142 msgid ":ref:`Preinitialize Python ` if needed." msgstr "" -msgid "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into ``*config_str``." +#: ../../c-api/init_config.rst:1101 +msgid "" +"Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " +"``*config_str``." msgstr "" -msgid "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) from the *argv* list of wide character strings." +#: ../../c-api/init_config.rst:1108 +msgid "" +"Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " +"from the *argv* list of wide character strings." msgstr "" -msgid "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) from the *argv* list of bytes strings. Decode bytes using :c:func:`Py_DecodeLocale`." +#: ../../c-api/init_config.rst:1115 +msgid "" +"Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " +"from the *argv* list of bytes strings. Decode bytes " +"using :c:func:`Py_DecodeLocale`." msgstr "" +#: ../../c-api/init_config.rst:1123 msgid "Set the list of wide strings *list* to *length* and *items*." msgstr "" +#: ../../c-api/init_config.rst:1129 msgid "Read all Python configuration." msgstr "" +#: ../../c-api/init_config.rst:1131 msgid "Fields which are already initialized are left unchanged." msgstr "" -msgid "Fields for :ref:`path configuration ` are no longer calculated or modified when calling this function, as of Python 3.11." +#: ../../c-api/init_config.rst:1133 +msgid "" +"Fields for :ref:`path configuration ` are no longer " +"calculated or modified when calling this function, as of Python 3.11." msgstr "" -msgid "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are parsed. Since Python arguments are stripped from :c:member:`PyConfig.argv`, parsing arguments twice would parse the application options as Python options." +#: ../../c-api/init_config.rst:1136 ../../c-api/init_config.rst:1693 +msgid "" +"The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " +"arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " +"arguments are parsed. Since Python arguments are stripped " +"from :c:member:`PyConfig.argv`, parsing arguments twice would parse the " +"application options as Python options." msgstr "" -msgid "The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." +#: ../../c-api/init_config.rst:1144 +msgid "" +"The :c:member:`PyConfig.argv` arguments are now only parsed " +"once, :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are " +"parsed, and arguments are only parsed if :c:member:`PyConfig.parse_argv` " +"equals ``1``." msgstr "" -msgid ":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed under :ref:`Python Path Configuration ` may no longer be updated until :c:func:`Py_InitializeFromConfig` is called." +#: ../../c-api/init_config.rst:1150 +msgid "" +":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " +"under :ref:`Python Path Configuration ` may no longer be " +"updated until :c:func:`Py_InitializeFromConfig` is called." msgstr "" +#: ../../c-api/init_config.rst:1158 msgid "Release configuration memory." msgstr "" -msgid "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. In that case, the Python preinitialization configuration (:c:type:`PyPreConfig`) is based on the :c:type:`PyConfig`. If configuration fields which are in common with :c:type:`PyPreConfig` are tuned, they must be set before calling a :c:type:`PyConfig` method:" +#: ../../c-api/init_config.rst:1160 +msgid "" +"Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " +"In that case, the Python preinitialization configuration " +"(:c:type:`PyPreConfig`) is based on the :c:type:`PyConfig`. If configuration " +"fields which are in common with :c:type:`PyPreConfig` are tuned, they must " +"be set before calling a :c:type:`PyConfig` method:" msgstr "" +#: ../../c-api/init_config.rst:1166 msgid ":c:member:`PyConfig.dev_mode`" msgstr "" +#: ../../c-api/init_config.rst:1167 msgid ":c:member:`PyConfig.isolated`" msgstr "" +#: ../../c-api/init_config.rst:1168 msgid ":c:member:`PyConfig.parse_argv`" msgstr "" +#: ../../c-api/init_config.rst:1169 msgid ":c:member:`PyConfig.use_environment`" msgstr "" -msgid "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` is used, this method must be called before other methods, since the preinitialization configuration depends on command line arguments (if :c:member:`~PyConfig.parse_argv` is non-zero)." -msgstr "" - -msgid "The caller of these methods is responsible to handle exceptions (error or exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." +#: ../../c-api/init_config.rst:1171 +msgid "" +"Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " +"is used, this method must be called before other methods, since the " +"preinitialization configuration depends on command line arguments " +"(if :c:member:`~PyConfig.parse_argv` is non-zero)." msgstr "" -msgid "Set :data:`sys.argv` command line arguments based on :c:member:`~PyConfig.argv`. These parameters are similar to those passed to the program's :c:func:`main` function with the difference that the first entry should refer to the script file to be executed rather than the executable hosting the Python interpreter. If there isn't a script that will be run, the first entry in :c:member:`~PyConfig.argv` can be an empty string." +#: ../../c-api/init_config.rst:1176 +msgid "" +"The caller of these methods is responsible to handle exceptions (error or " +"exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" -msgid "Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig.argv` the same way the regular Python parses Python command line arguments and then to strip Python arguments from :c:member:`~PyConfig.argv`." +#: ../../c-api/init_config.rst:1189 +msgid "" +"Set :data:`sys.argv` command line arguments based " +"on :c:member:`~PyConfig.argv`. These parameters are similar to those passed " +"to the program's :c:func:`main` function with the difference that the first " +"entry should refer to the script file to be executed rather than the " +"executable hosting the Python interpreter. If there isn't a script that " +"will be run, the first entry in :c:member:`~PyConfig.argv` can be an empty " +"string." msgstr "" -msgid "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure that :data:`sys.argv` always exists and is never empty." +#: ../../c-api/init_config.rst:1197 +msgid "" +"Set :c:member:`~PyConfig.parse_argv` to ``1`` to " +"parse :c:member:`~PyConfig.argv` the same way the regular Python parses " +"Python command line arguments and then to strip Python arguments " +"from :c:member:`~PyConfig.argv`." msgstr "" +#: ../../c-api/init_config.rst:1202 +msgid "" +"If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " +"that :data:`sys.argv` always exists and is never empty." +msgstr "" + +#: ../../c-api/init_config.rst:1205 ../../c-api/init_config.rst:1232 +#: ../../c-api/init_config.rst:1246 ../../c-api/init_config.rst:1256 +#: ../../c-api/init_config.rst:1367 ../../c-api/init_config.rst:1376 +#: ../../c-api/init_config.rst:1387 ../../c-api/init_config.rst:1478 +#: ../../c-api/init_config.rst:1634 ../../c-api/init_config.rst:1735 +#: ../../c-api/init_config.rst:1754 ../../c-api/init_config.rst:1769 +#: ../../c-api/init_config.rst:1786 ../../c-api/init_config.rst:1799 +#: ../../c-api/init_config.rst:1807 ../../c-api/init_config.rst:1821 +#: ../../c-api/init_config.rst:1924 msgid "Default: ``NULL``." msgstr "" +#: ../../c-api/init_config.rst:1207 msgid "See also the :c:member:`~PyConfig.orig_argv` member." msgstr "" -msgid "If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :data:`sys.path` at startup:" +#: ../../c-api/init_config.rst:1211 +msgid "" +"If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path " +"to :data:`sys.path` at startup:" msgstr "" -msgid "If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m module``), prepend the current working directory." +#: ../../c-api/init_config.rst:1214 +msgid "" +"If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " +"module``), prepend the current working directory." msgstr "" -msgid "If running a script (``python script.py``), prepend the script's directory. If it's a symbolic link, resolve symbolic links." +#: ../../c-api/init_config.rst:1216 +msgid "" +"If running a script (``python script.py``), prepend the script's directory. " +"If it's a symbolic link, resolve symbolic links." msgstr "" -msgid "Otherwise (``python -c code`` and ``python``), prepend an empty string, which means the current working directory." +#: ../../c-api/init_config.rst:1218 +msgid "" +"Otherwise (``python -c code`` and ``python``), prepend an empty string, " +"which means the current working directory." msgstr "" -msgid "Set to ``1`` by the :option:`-P` command line option and the :envvar:`PYTHONSAFEPATH` environment variable." +#: ../../c-api/init_config.rst:1221 +msgid "" +"Set to ``1`` by the :option:`-P` command line option and " +"the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1224 msgid "Default: ``0`` in Python config, ``1`` in isolated config." msgstr "" +#: ../../c-api/init_config.rst:1230 msgid ":data:`sys.base_exec_prefix`." msgstr "" +#: ../../c-api/init_config.rst:1234 ../../c-api/init_config.rst:1248 +#: ../../c-api/init_config.rst:1258 ../../c-api/init_config.rst:1378 +#: ../../c-api/init_config.rst:1389 ../../c-api/init_config.rst:1651 +#: ../../c-api/init_config.rst:1737 msgid "Part of the :ref:`Python Path Configuration ` output." msgstr "" +#: ../../c-api/init_config.rst:1236 msgid "See also :c:member:`PyConfig.exec_prefix`." msgstr "" -msgid "Python base executable: :data:`sys._base_executable`." +#: ../../c-api/init_config.rst:1240 +msgid "Python base executable: ``sys._base_executable``." msgstr "" -msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." +#: ../../c-api/init_config.rst:1242 +msgid "Set by the ``__PYVENV_LAUNCHER__`` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1244 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." msgstr "" +#: ../../c-api/init_config.rst:1250 msgid "See also :c:member:`PyConfig.executable`." msgstr "" +#: ../../c-api/init_config.rst:1254 msgid ":data:`sys.base_prefix`." msgstr "" +#: ../../c-api/init_config.rst:1260 msgid "See also :c:member:`PyConfig.prefix`." msgstr "" -msgid "If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, disable buffering on the C streams stdout and stderr." +#: ../../c-api/init_config.rst:1264 +msgid "" +"If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " +"disable buffering on the C streams stdout and stderr." msgstr "" -msgid "Set to ``0`` by the :option:`-u` command line option and the :envvar:`PYTHONUNBUFFERED` environment variable." +#: ../../c-api/init_config.rst:1267 +msgid "" +"Set to ``0`` by the :option:`-u` command line option and " +"the :envvar:`PYTHONUNBUFFERED` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1270 msgid "stdin is always opened in buffered mode." msgstr "" +#: ../../c-api/init_config.rst:1272 ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1849 ../../c-api/init_config.rst:2006 msgid "Default: ``1``." msgstr "" -msgid "If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." +#: ../../c-api/init_config.rst:1276 +msgid "" +"If equals to ``1``, issue a warning when comparing :class:`bytes` " +"or :class:`bytearray` with :class:`str`, or comparing :class:`bytes` " +"with :class:`int`." msgstr "" -msgid "If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these cases." +#: ../../c-api/init_config.rst:1280 +msgid "" +"If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " +"cases." msgstr "" +#: ../../c-api/init_config.rst:1283 msgid "Incremented by the :option:`-b` command line option." msgstr "" -msgid "If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io.TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for details." +#: ../../c-api/init_config.rst:1289 +msgid "" +"If non-zero, emit a :exc:`EncodingWarning` warning " +"when :class:`io.TextIOWrapper` uses its default encoding. See :ref:`io-" +"encoding-warning` for details." msgstr "" -msgid "If equals to ``0``, disables the inclusion of the end line and column mappings in code objects. Also disables traceback printing carets to specific error locations." +#: ../../c-api/init_config.rst:1298 +msgid "" +"If equals to ``0``, disables the inclusion of the end line and column " +"mappings in code objects. Also disables traceback printing carets to " +"specific error locations." msgstr "" -msgid "Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and by the :option:`-X no_debug_ranges <-X>` command line option." +#: ../../c-api/init_config.rst:1302 +msgid "" +"Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " +"by the :option:`-X no_debug_ranges <-X>` command line option." msgstr "" -msgid "Control the validation behavior of hash-based ``.pyc`` files: value of the :option:`--check-hash-based-pycs` command line option." +#: ../../c-api/init_config.rst:1311 +msgid "" +"Control the validation behavior of hash-based ``.pyc`` files: value of " +"the :option:`--check-hash-based-pycs` command line option." msgstr "" +#: ../../c-api/init_config.rst:1314 msgid "Valid values:" msgstr "" -msgid "``L\"always\"``: Hash the source file for invalidation regardless of value of the 'check_source' flag." +#: ../../c-api/init_config.rst:1316 +msgid "" +"``L\"always\"``: Hash the source file for invalidation regardless of value " +"of the 'check_source' flag." msgstr "" +#: ../../c-api/init_config.rst:1318 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." msgstr "" -msgid "``L\"default\"``: The 'check_source' flag in hash-based pycs determines invalidation." +#: ../../c-api/init_config.rst:1319 +msgid "" +"``L\"default\"``: The 'check_source' flag in hash-based pycs determines " +"invalidation." msgstr "" +#: ../../c-api/init_config.rst:1322 msgid "Default: ``L\"default\"``." msgstr "" +#: ../../c-api/init_config.rst:1324 msgid "See also :pep:`552` \"Deterministic pycs\"." msgstr "" +#: ../../c-api/init_config.rst:1328 msgid "If non-zero, configure C standard streams:" msgstr "" -msgid "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." +#: ../../c-api/init_config.rst:1330 +msgid "" +"On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" -msgid "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of stdin, stdout and stderr streams." +#: ../../c-api/init_config.rst:1332 +msgid "" +"If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " +"stdin, stdout and stderr streams." msgstr "" -msgid "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on stdin and stdout (only stdout on Windows)." +#: ../../c-api/init_config.rst:1334 +msgid "" +"If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " +"stdin and stdout (only stdout on Windows)." msgstr "" +#: ../../c-api/init_config.rst:1341 msgid "If non-zero, enable the :ref:`Python Development Mode `." msgstr "" -msgid "Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:`PYTHONDEVMODE` environment variable." +#: ../../c-api/init_config.rst:1343 +msgid "" +"Set to ``1`` by the :option:`-X dev <-X>` option and " +"the :envvar:`PYTHONDEVMODE` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1350 msgid "Dump Python references?" msgstr "" +#: ../../c-api/init_config.rst:1352 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" +#: ../../c-api/init_config.rst:1354 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -msgid "Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: see the :option:`configure --with-trace-refs option <--with-trace-refs>`." +#: ../../c-api/init_config.rst:1356 +msgid "" +"Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: " +"see the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" +#: ../../c-api/init_config.rst:1363 msgid "Filename where to dump Python references." msgstr "" +#: ../../c-api/init_config.rst:1365 msgid "Set by the :envvar:`PYTHONDUMPREFSFILE` environment variable." msgstr "" -msgid "The site-specific directory prefix where the platform-dependent Python files are installed: :data:`sys.exec_prefix`." +#: ../../c-api/init_config.rst:1373 +msgid "" +"The site-specific directory prefix where the platform-dependent Python files " +"are installed: :data:`sys.exec_prefix`." msgstr "" +#: ../../c-api/init_config.rst:1380 msgid "See also :c:member:`PyConfig.base_exec_prefix`." msgstr "" -msgid "The absolute path of the executable binary for the Python interpreter: :data:`sys.executable`." +#: ../../c-api/init_config.rst:1384 +msgid "" +"The absolute path of the executable binary for the Python " +"interpreter: :data:`sys.executable`." msgstr "" +#: ../../c-api/init_config.rst:1391 msgid "See also :c:member:`PyConfig.base_executable`." msgstr "" +#: ../../c-api/init_config.rst:1395 msgid "Enable faulthandler?" msgstr "" +#: ../../c-api/init_config.rst:1397 msgid "If non-zero, call :func:`faulthandler.enable` at startup." msgstr "" -msgid "Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:`PYTHONFAULTHANDLER` environment variable." +#: ../../c-api/init_config.rst:1399 +msgid "" +"Set to ``1`` by :option:`-X faulthandler <-X>` and " +"the :envvar:`PYTHONFAULTHANDLER` environment variable." msgstr "" -msgid ":term:`Filesystem encoding `: :func:`sys.getfilesystemencoding`." +#: ../../c-api/init_config.rst:1406 +msgid "" +":term:`Filesystem encoding `: :func:`sys.getfilesystemencoding`." msgstr "" +#: ../../c-api/init_config.rst:1409 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." msgstr "" -msgid "On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-zero." +#: ../../c-api/init_config.rst:1411 +msgid "" +"On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` " +"if :c:member:`~PyPreConfig.legacy_windows_fs_encoding` " +"of :c:type:`PyPreConfig` is non-zero." msgstr "" +#: ../../c-api/init_config.rst:1415 msgid "Default encoding on other platforms:" msgstr "" +#: ../../c-api/init_config.rst:1417 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -msgid "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different encoding (usually Latin1)." +#: ../../c-api/init_config.rst:1418 +msgid "" +"``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " +"ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " +"encoding (usually Latin1)." msgstr "" +#: ../../c-api/init_config.rst:1421 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." msgstr "" -msgid "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." +#: ../../c-api/init_config.rst:1422 +msgid "" +"Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" -msgid "At Python startup, the encoding name is normalized to the Python codec name. For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." +#: ../../c-api/init_config.rst:1425 +msgid "" +"At Python startup, the encoding name is normalized to the Python codec name. " +"For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" +#: ../../c-api/init_config.rst:1428 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." msgstr "" -msgid ":term:`Filesystem error handler `: :func:`sys.getfilesystemencodeerrors`." +#: ../../c-api/init_config.rst:1432 +msgid "" +":term:`Filesystem error handler `: :func:`sys.getfilesystemencodeerrors`." msgstr "" -msgid "On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-zero." +#: ../../c-api/init_config.rst:1435 +msgid "" +"On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` " +"if :c:member:`~PyPreConfig.legacy_windows_fs_encoding` " +"of :c:type:`PyPreConfig` is non-zero." msgstr "" +#: ../../c-api/init_config.rst:1439 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" +#: ../../c-api/init_config.rst:1441 msgid "Supported error handlers:" msgstr "" +#: ../../c-api/init_config.rst:1443 msgid "``\"strict\"``" msgstr "" +#: ../../c-api/init_config.rst:1444 msgid "``\"surrogateescape\"``" msgstr "" +#: ../../c-api/init_config.rst:1445 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" msgstr "" +#: ../../c-api/init_config.rst:1447 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." msgstr "" +#: ../../c-api/init_config.rst:1451 msgid "If non-zero, use frozen modules." msgstr "" +#: ../../c-api/init_config.rst:1453 msgid "Set by the :envvar:`PYTHON_FROZEN_MODULES` environment variable." msgstr "" -msgid "Default: ``1`` in a release build, or ``0`` in a :ref:`debug build `." +#: ../../c-api/init_config.rst:1455 +msgid "" +"Default: ``1`` in a release build, or ``0`` in a :ref:`debug build `." msgstr "" +#: ../../c-api/init_config.rst:1461 msgid "Randomized hash function seed." msgstr "" -msgid "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." +#: ../../c-api/init_config.rst:1463 +msgid "" +"If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " +"Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" +#: ../../c-api/init_config.rst:1466 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." msgstr "" -msgid "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." +#: ../../c-api/init_config.rst:1468 +msgid "" +"Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -msgid "Set the default Python \"home\" directory, that is, the location of the standard Python libraries (see :envvar:`PYTHONHOME`)." +#: ../../c-api/init_config.rst:1473 +msgid "" +"Set the default Python \"home\" directory, that is, the location of the " +"standard Python libraries (see :envvar:`PYTHONHOME`)." msgstr "" +#: ../../c-api/init_config.rst:1476 msgid "Set by the :envvar:`PYTHONHOME` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1480 ../../c-api/init_config.rst:1616 +#: ../../c-api/init_config.rst:1636 ../../c-api/init_config.rst:1725 +#: ../../c-api/init_config.rst:1756 msgid "Part of the :ref:`Python Path Configuration ` input." msgstr "" -msgid "If ``1``, profile import time. If ``2``, include additional output that indicates when an imported module has already been loaded." +#: ../../c-api/init_config.rst:1484 +msgid "" +"If ``1``, profile import time. If ``2``, include additional output that " +"indicates when an imported module has already been loaded." msgstr "" -msgid "Set by the :option:`-X importtime <-X>` option and the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable." +#: ../../c-api/init_config.rst:1488 +msgid "" +"Set by the :option:`-X importtime <-X>` option and " +"the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1495 msgid "Added support for ``import_time = 2``" msgstr "" +#: ../../c-api/init_config.rst:1499 msgid "Enter interactive mode after executing a script or a command." msgstr "" -msgid "If greater than ``0``, enable inspect: when a script is passed as first argument or the -c option is used, enter interactive mode after executing the script or the command, even when :data:`sys.stdin` does not appear to be a terminal." +#: ../../c-api/init_config.rst:1501 +msgid "" +"If greater than ``0``, enable inspect: when a script is passed as first " +"argument or the -c option is used, enter interactive mode after executing " +"the script or the command, even when :data:`sys.stdin` does not appear to be " +"a terminal." msgstr "" -msgid "Incremented by the :option:`-i` command line option. Set to ``1`` if the :envvar:`PYTHONINSPECT` environment variable is non-empty." +#: ../../c-api/init_config.rst:1506 +msgid "" +"Incremented by the :option:`-i` command line option. Set to ``1`` if " +"the :envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" +#: ../../c-api/init_config.rst:1513 msgid "Install Python signal handlers?" msgstr "" +#: ../../c-api/init_config.rst:1515 ../../c-api/init_config.rst:1699 +#: ../../c-api/init_config.rst:1723 ../../c-api/init_config.rst:1959 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" +#: ../../c-api/init_config.rst:1519 msgid "If greater than ``0``, enable the interactive mode (REPL)." msgstr "" +#: ../../c-api/init_config.rst:1521 msgid "Incremented by the :option:`-i` command line option." msgstr "" -msgid "Configures the :ref:`integer string conversion length limitation `. An initial value of ``-1`` means the value will be taken from the command line or environment or otherwise default to 4300 (:data:`sys.int_info.default_max_str_digits`). A value of ``0`` disables the limitation. Values greater than zero but less than 640 (:data:`sys.int_info.str_digits_check_threshold`) are unsupported and will produce an error." +#: ../../c-api/init_config.rst:1527 +msgid "" +"Configures the :ref:`integer string conversion length limitation " +"`. An initial value of ``-1`` means the value will be " +"taken from the command line or environment or otherwise default to 4300 " +"(:data:`sys.int_info.default_max_str_digits`). A value of ``0`` disables " +"the limitation. Values greater than zero but less than 640 " +"(:data:`sys.int_info.str_digits_check_threshold`) are unsupported and will " +"produce an error." msgstr "" -msgid "Configured by the :option:`-X int_max_str_digits <-X>` command line flag or the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." +#: ../../c-api/init_config.rst:1535 +msgid "" +"Configured by the :option:`-X int_max_str_digits <-X>` command line flag or " +"the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." msgstr "" -msgid "Default: ``-1`` in Python mode. 4300 (:data:`sys.int_info.default_max_str_digits`) in isolated mode." +#: ../../c-api/init_config.rst:1538 +msgid "" +"Default: ``-1`` in Python mode. 4300 " +"(:data:`sys.int_info.default_max_str_digits`) in isolated mode." msgstr "" -msgid "If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will override the return values of :func:`os.cpu_count`, :func:`os.process_cpu_count`, and :func:`multiprocessing.cpu_count`." +#: ../../c-api/init_config.rst:1545 +msgid "" +"If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will " +"override the return values " +"of :func:`os.cpu_count`, :func:`os.process_cpu_count`, " +"and :func:`multiprocessing.cpu_count`." msgstr "" -msgid "Configured by the :samp:`-X cpu_count={n|default}` command line flag or the :envvar:`PYTHON_CPU_COUNT` environment variable." +#: ../../c-api/init_config.rst:1549 +msgid "" +"Configured by the :samp:`-X cpu_count={n|default}` command line flag or " +"the :envvar:`PYTHON_CPU_COUNT` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1552 ../../c-api/init_config.rst:1913 msgid "Default: ``-1``." msgstr "" +#: ../../c-api/init_config.rst:1558 msgid "If greater than ``0``, enable isolated mode:" msgstr "" -msgid "Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially unsafe path to :data:`sys.path` at Python startup, such as the current directory, the script's directory or an empty string." +#: ../../c-api/init_config.rst:1560 +msgid "" +"Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " +"unsafe path to :data:`sys.path` at Python startup, such as the current " +"directory, the script's directory or an empty string." msgstr "" -msgid "Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` environment variables." +#: ../../c-api/init_config.rst:1564 +msgid "" +"Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` " +"environment variables." msgstr "" -msgid "Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user site directory to :data:`sys.path`." +#: ../../c-api/init_config.rst:1566 +msgid "" +"Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " +"site directory to :data:`sys.path`." msgstr "" -msgid "Python REPL doesn't import :mod:`readline` nor enable default readline configuration on interactive prompts." +#: ../../c-api/init_config.rst:1568 +msgid "" +"Python REPL doesn't import :mod:`readline` nor enable default readline " +"configuration on interactive prompts." msgstr "" +#: ../../c-api/init_config.rst:1571 msgid "Set to ``1`` by the :option:`-I` command line option." msgstr "" -msgid "See also the :ref:`Isolated Configuration ` and :c:member:`PyPreConfig.isolated`." +#: ../../c-api/init_config.rst:1575 +msgid "" +"See also the :ref:`Isolated Configuration ` " +"and :c:member:`PyPreConfig.isolated`." msgstr "" -msgid "If non-zero, use :class:`io.FileIO` instead of :class:`!io._WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys.stderr`." +#: ../../c-api/init_config.rst:1580 +msgid "" +"If non-zero, use :class:`io.FileIO` instead of :class:`!" +"io._WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr`." msgstr "" -msgid "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable is set to a non-empty string." +#: ../../c-api/init_config.rst:1584 +msgid "" +"Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " +"is set to a non-empty string." msgstr "" +#: ../../c-api/init_config.rst:1592 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" -msgid "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator ` at exit." +#: ../../c-api/init_config.rst:1596 +msgid "" +"If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " +"` at exit." msgstr "" +#: ../../c-api/init_config.rst:1599 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." msgstr "" -msgid "The option is ignored if Python is :option:`configured using the --without-pymalloc option <--without-pymalloc>`." +#: ../../c-api/init_config.rst:1601 +msgid "" +"The option is ignored if Python is :option:`configured using the --without-" +"pymalloc option <--without-pymalloc>`." msgstr "" +#: ../../c-api/init_config.rst:1608 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" +#: ../../c-api/init_config.rst:1610 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." msgstr "" -msgid "Default: value of the ``PLATLIBDIR`` macro which is set by the :option:`configure --with-platlibdir option <--with-platlibdir>` (default: ``\"lib\"``, or ``\"DLLs\"`` on Windows)." +#: ../../c-api/init_config.rst:1612 +msgid "" +"Default: value of the ``PLATLIBDIR`` macro which is set by " +"the :option:`configure --with-platlibdir option <--with-platlibdir>` " +"(default: ``\"lib\"``, or ``\"DLLs\"`` on Windows)." msgstr "" -msgid "This macro is now used on Windows to locate the standard library extension modules, typically under ``DLLs``. However, for compatibility, note that this value is ignored for any non-standard layouts, including in-tree builds and virtual environments." +#: ../../c-api/init_config.rst:1620 +msgid "" +"This macro is now used on Windows to locate the standard library extension " +"modules, typically under ``DLLs``. However, for compatibility, note that " +"this value is ignored for any non-standard layouts, including in-tree builds " +"and virtual environments." msgstr "" -msgid "Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:data:`os.pathsep`)." +#: ../../c-api/init_config.rst:1629 +msgid "" +"Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` " +"(:data:`os.pathsep`)." msgstr "" +#: ../../c-api/init_config.rst:1632 msgid "Set by the :envvar:`PYTHONPATH` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1641 msgid "Module search paths: :data:`sys.path`." msgstr "" -msgid "If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:`Py_InitializeFromConfig` will replace :c:member:`~PyConfig.module_search_paths` and sets :c:member:`~PyConfig.module_search_paths_set` to ``1``." +#: ../../c-api/init_config.rst:1643 +msgid "" +"If :c:member:`~PyConfig.module_search_paths_set` is equal to " +"``0``, :c:func:`Py_InitializeFromConfig` will " +"replace :c:member:`~PyConfig.module_search_paths` and " +"sets :c:member:`~PyConfig.module_search_paths_set` to ``1``." msgstr "" -msgid "Default: empty list (``module_search_paths``) and ``0`` (``module_search_paths_set``)." +#: ../../c-api/init_config.rst:1648 +msgid "" +"Default: empty list (``module_search_paths``) and ``0`` " +"(``module_search_paths_set``)." msgstr "" +#: ../../c-api/init_config.rst:1655 msgid "Compilation optimization level:" msgstr "" +#: ../../c-api/init_config.rst:1657 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." msgstr "" +#: ../../c-api/init_config.rst:1658 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" +#: ../../c-api/init_config.rst:1659 msgid "``2``: Level 1, strip docstrings." msgstr "" -msgid "Incremented by the :option:`-O` command line option. Set to the :envvar:`PYTHONOPTIMIZE` environment variable value." +#: ../../c-api/init_config.rst:1661 +msgid "" +"Incremented by the :option:`-O` command line option. Set to " +"the :envvar:`PYTHONOPTIMIZE` environment variable value." msgstr "" -msgid "The list of the original command line arguments passed to the Python executable: :data:`sys.orig_argv`." +#: ../../c-api/init_config.rst:1668 +msgid "" +"The list of the original command line arguments passed to the Python " +"executable: :data:`sys.orig_argv`." msgstr "" -msgid "If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig.argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` copies :c:member:`~PyConfig.argv` into :c:member:`~PyConfig.orig_argv` before modifying :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig.parse_argv` is non-zero)." +#: ../../c-api/init_config.rst:1671 +msgid "" +"If :c:member:`~PyConfig.orig_argv` list is empty " +"and :c:member:`~PyConfig.argv` is not a list only containing an empty " +"string, :c:func:`PyConfig_Read` copies :c:member:`~PyConfig.argv` " +"into :c:member:`~PyConfig.orig_argv` before " +"modifying :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig.parse_argv` is " +"non-zero)." msgstr "" -msgid "See also the :c:member:`~PyConfig.argv` member and the :c:func:`Py_GetArgcArgv` function." +#: ../../c-api/init_config.rst:1678 +msgid "" +"See also the :c:member:`~PyConfig.argv` member and " +"the :c:func:`Py_GetArgcArgv` function." msgstr "" +#: ../../c-api/init_config.rst:1681 ../../c-api/init_config.rst:1993 +#: ../../c-api/init_config.rst:2012 msgid "Default: empty list." msgstr "" +#: ../../c-api/init_config.rst:1687 msgid "Parse command line arguments?" msgstr "" -msgid "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the regular Python parses :ref:`command line arguments `, and strip Python arguments from :c:member:`~PyConfig.argv`." +#: ../../c-api/init_config.rst:1689 +msgid "" +"If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " +"regular Python parses :ref:`command line arguments `, and " +"strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -msgid "The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:`PyConfig.parse_argv` equals to ``1``." +#: ../../c-api/init_config.rst:1701 +msgid "" +"The :c:member:`PyConfig.argv` arguments are now only parsed " +"if :c:member:`PyConfig.parse_argv` equals to ``1``." msgstr "" -msgid "Parser debug mode. If greater than ``0``, turn on parser debugging output (for expert only, depending on compilation options)." +#: ../../c-api/init_config.rst:1707 +msgid "" +"Parser debug mode. If greater than ``0``, turn on parser debugging output " +"(for expert only, depending on compilation options)." msgstr "" -msgid "Incremented by the :option:`-d` command line option. Set to the :envvar:`PYTHONDEBUG` environment variable value." +#: ../../c-api/init_config.rst:1710 +msgid "" +"Incremented by the :option:`-d` command line option. Set to " +"the :envvar:`PYTHONDEBUG` environment variable value." msgstr "" -msgid "Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro must be defined)." +#: ../../c-api/init_config.rst:1713 ../../c-api/init_config.rst:1818 +msgid "" +"Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " +"must be defined)." msgstr "" -msgid "If non-zero, calculation of path configuration is allowed to log warnings into ``stderr``. If equals to ``0``, suppress these warnings." +#: ../../c-api/init_config.rst:1720 +msgid "" +"If non-zero, calculation of path configuration is allowed to log warnings " +"into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" +#: ../../c-api/init_config.rst:1727 msgid "Now also applies on Windows." msgstr "" -msgid "The site-specific directory prefix where the platform independent Python files are installed: :data:`sys.prefix`." +#: ../../c-api/init_config.rst:1732 +msgid "" +"The site-specific directory prefix where the platform independent Python " +"files are installed: :data:`sys.prefix`." msgstr "" +#: ../../c-api/init_config.rst:1739 msgid "See also :c:member:`PyConfig.base_prefix`." msgstr "" -msgid "Program name used to initialize :c:member:`~PyConfig.executable` and in early error messages during Python initialization." +#: ../../c-api/init_config.rst:1743 +msgid "" +"Program name used to initialize :c:member:`~PyConfig.executable` and in " +"early error messages during Python initialization." msgstr "" +#: ../../c-api/init_config.rst:1746 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" -msgid "If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:`__PYVENV_LAUNCHER__` environment variable if set." +#: ../../c-api/init_config.rst:1747 +msgid "" +"If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use ``__PYVENV_LAUNCHER__`` " +"environment variable if set." msgstr "" -msgid "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." +#: ../../c-api/init_config.rst:1749 +msgid "" +"Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" -msgid "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other platforms." +#: ../../c-api/init_config.rst:1751 +msgid "" +"Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " +"platforms." msgstr "" -msgid "Directory where cached ``.pyc`` files are written: :data:`sys.pycache_prefix`." +#: ../../c-api/init_config.rst:1760 +msgid "" +"Directory where cached ``.pyc`` files are " +"written: :data:`sys.pycache_prefix`." msgstr "" -msgid "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line option takes precedence." +#: ../../c-api/init_config.rst:1763 +msgid "" +"Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " +"the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line " +"option takes precedence." msgstr "" +#: ../../c-api/init_config.rst:1767 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" -msgid "Quiet mode. If greater than ``0``, don't display the copyright and version at Python startup in interactive mode." +#: ../../c-api/init_config.rst:1773 +msgid "" +"Quiet mode. If greater than ``0``, don't display the copyright and version " +"at Python startup in interactive mode." msgstr "" +#: ../../c-api/init_config.rst:1776 msgid "Incremented by the :option:`-q` command line option." msgstr "" +#: ../../c-api/init_config.rst:1782 msgid "Value of the :option:`-c` command line option." msgstr "" +#: ../../c-api/init_config.rst:1784 ../../c-api/init_config.rst:1805 msgid "Used by :c:func:`Py_RunMain`." msgstr "" -msgid "Filename passed on the command line: trailing command line argument without :option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." +#: ../../c-api/init_config.rst:1790 +msgid "" +"Filename passed on the command line: trailing command line argument " +"without :option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` " +"function." msgstr "" -msgid "For example, it is set to ``script.py`` by the ``python3 script.py arg`` command line." +#: ../../c-api/init_config.rst:1794 +msgid "" +"For example, it is set to ``script.py`` by the ``python3 script.py arg`` " +"command line." msgstr "" +#: ../../c-api/init_config.rst:1797 msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." msgstr "" +#: ../../c-api/init_config.rst:1803 msgid "Value of the :option:`-m` command line option." msgstr "" -msgid "``package.module`` path to module that should be imported before ``site.py`` is run." +#: ../../c-api/init_config.rst:1811 +msgid "" +"``package.module`` path to module that should be imported before ``site.py`` " +"is run." msgstr "" -msgid "Set by the :option:`-X presite=package.module <-X>` command-line option and the :envvar:`PYTHON_PRESITE` environment variable. The command-line option takes precedence." +#: ../../c-api/init_config.rst:1814 +msgid "" +"Set by the :option:`-X presite=package.module <-X>` command-line option and " +"the :envvar:`PYTHON_PRESITE` environment variable. The command-line option " +"takes precedence." msgstr "" -msgid "Show total reference count at exit (excluding :term:`immortal` objects)?" +#: ../../c-api/init_config.rst:1825 +msgid "" +"Show total reference count at exit (excluding :term:`immortal` objects)?" msgstr "" +#: ../../c-api/init_config.rst:1827 msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" -msgid "Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` macro must be defined)." +#: ../../c-api/init_config.rst:1829 +msgid "" +"Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " +"macro must be defined)." msgstr "" +#: ../../c-api/init_config.rst:1836 msgid "Import the :mod:`site` module at startup?" msgstr "" -msgid "If equal to zero, disable the import of the module site and the site-dependent manipulations of :data:`sys.path` that it entails." +#: ../../c-api/init_config.rst:1838 +msgid "" +"If equal to zero, disable the import of the module site and the site-" +"dependent manipulations of :data:`sys.path` that it entails." msgstr "" -msgid "Also disable these manipulations if the :mod:`site` module is explicitly imported later (call :func:`site.main` if you want them to be triggered)." +#: ../../c-api/init_config.rst:1841 +msgid "" +"Also disable these manipulations if the :mod:`site` module is explicitly " +"imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" +#: ../../c-api/init_config.rst:1844 msgid "Set to ``0`` by the :option:`-S` command line option." msgstr "" -msgid ":data:`sys.flags.no_site ` is set to the inverted value of :c:member:`~PyConfig.site_import`." +#: ../../c-api/init_config.rst:1846 +msgid "" +":data:`sys.flags.no_site ` is set to the inverted value " +"of :c:member:`~PyConfig.site_import`." msgstr "" -msgid "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` source." +#: ../../c-api/init_config.rst:1853 +msgid "" +"If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " +"source." msgstr "" -msgid "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a DOS specific hack only." +#: ../../c-api/init_config.rst:1856 +msgid "" +"It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " +"DOS specific hack only." msgstr "" +#: ../../c-api/init_config.rst:1859 msgid "Set to ``1`` by the :option:`-x` command line option." msgstr "" -msgid "Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys.stderr` (but :data:`sys.stderr` always uses ``\"backslashreplace\"`` error handler)." +#: ../../c-api/init_config.rst:1866 +msgid "" +"Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr` (but :data:`sys.stderr` always uses " +"``\"backslashreplace\"`` error handler)." msgstr "" -msgid "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." +#: ../../c-api/init_config.rst:1870 +msgid "" +"Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." msgstr "" +#: ../../c-api/init_config.rst:1873 msgid "Default encoding:" msgstr "" +#: ../../c-api/init_config.rst:1875 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" +#: ../../c-api/init_config.rst:1876 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" +#: ../../c-api/init_config.rst:1878 msgid "Default error handler:" msgstr "" +#: ../../c-api/init_config.rst:1880 msgid "On Windows: use ``\"surrogateescape\"``." msgstr "" -msgid "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or if the LC_CTYPE locale is \"C\" or \"POSIX\"." +#: ../../c-api/init_config.rst:1881 +msgid "" +"``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " +"if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" +#: ../../c-api/init_config.rst:1883 msgid "``\"strict\"`` otherwise." msgstr "" +#: ../../c-api/init_config.rst:1885 msgid "See also :c:member:`PyConfig.legacy_windows_stdio`." msgstr "" +#: ../../c-api/init_config.rst:1889 msgid "Enable tracemalloc?" msgstr "" +#: ../../c-api/init_config.rst:1891 msgid "If non-zero, call :func:`tracemalloc.start` at startup." msgstr "" -msgid "Set by :option:`-X tracemalloc=N <-X>` command line option and by the :envvar:`PYTHONTRACEMALLOC` environment variable." +#: ../../c-api/init_config.rst:1893 +msgid "" +"Set by :option:`-X tracemalloc=N <-X>` command line option and by " +"the :envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1900 msgid "Enable the Linux ``perf`` profiler support?" msgstr "" +#: ../../c-api/init_config.rst:1902 msgid "If equals to ``1``, enable support for the Linux ``perf`` profiler." msgstr "" -msgid "If equals to ``2``, enable support for the Linux ``perf`` profiler with DWARF JIT support." +#: ../../c-api/init_config.rst:1904 +msgid "" +"If equals to ``2``, enable support for the Linux ``perf`` profiler with " +"DWARF JIT support." msgstr "" -msgid "Set to ``1`` by :option:`-X perf <-X>` command-line option and the :envvar:`PYTHONPERFSUPPORT` environment variable." +#: ../../c-api/init_config.rst:1907 +msgid "" +"Set to ``1`` by :option:`-X perf <-X>` command-line option and " +"the :envvar:`PYTHONPERFSUPPORT` environment variable." msgstr "" -msgid "Set to ``2`` by the :option:`-X perf_jit <-X>` command-line option and the :envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable." +#: ../../c-api/init_config.rst:1910 +msgid "" +"Set to ``2`` by the :option:`-X perf_jit <-X>` command-line option and " +"the :envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable." msgstr "" +#: ../../c-api/init_config.rst:1916 msgid "See :ref:`perf_profiling` for more information." msgstr "" +#: ../../c-api/init_config.rst:1922 msgid "Directory of the Python standard library." msgstr "" +#: ../../c-api/init_config.rst:1930 msgid "Use :ref:`environment variables `?" msgstr "" -msgid "If equals to zero, ignore the :ref:`environment variables `." +#: ../../c-api/init_config.rst:1932 +msgid "" +"If equals to zero, ignore the :ref:`environment variables `." msgstr "" +#: ../../c-api/init_config.rst:1935 msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" -msgid "If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." +#: ../../c-api/init_config.rst:1941 +msgid "" +"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." msgstr "" +#: ../../c-api/init_config.rst:1944 msgid "Only available on macOS 10.12 and later, and on iOS." msgstr "" -msgid "Default: ``0`` (don't use the system log) on macOS; ``1`` on iOS (use the system log)." +#: ../../c-api/init_config.rst:1946 +msgid "" +"Default: ``0`` (don't use the system log) on macOS; ``1`` on iOS (use the " +"system log)." msgstr "" +#: ../../c-api/init_config.rst:1953 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" +#: ../../c-api/init_config.rst:1955 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" +#: ../../c-api/init_config.rst:1957 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -msgid "Verbose mode. If greater than ``0``, print a message each time a module is imported, showing the place (filename or built-in module) from which it is loaded." +#: ../../c-api/init_config.rst:1963 +msgid "" +"Verbose mode. If greater than ``0``, print a message each time a module is " +"imported, showing the place (filename or built-in module) from which it is " +"loaded." msgstr "" -msgid "If greater than or equal to ``2``, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit." +#: ../../c-api/init_config.rst:1967 +msgid "" +"If greater than or equal to ``2``, print a message for each file that is " +"checked for when searching for a module. Also provides information on module " +"cleanup at exit." msgstr "" +#: ../../c-api/init_config.rst:1971 msgid "Incremented by the :option:`-v` command line option." msgstr "" +#: ../../c-api/init_config.rst:1973 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -msgid "Options of the :mod:`warnings` module to build warnings filters, lowest to highest priority: :data:`sys.warnoptions`." +#: ../../c-api/init_config.rst:1979 +msgid "" +"Options of the :mod:`warnings` module to build warnings filters, lowest to " +"highest priority: :data:`sys.warnoptions`." msgstr "" -msgid "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse order: the last :c:member:`PyConfig.warnoptions` item becomes the first item of :data:`warnings.filters` which is checked first (highest priority)." +#: ../../c-api/init_config.rst:1982 +msgid "" +"The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " +"order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " +"of ``warnings.filters`` which is checked first (highest priority)." msgstr "" -msgid "The :option:`-W` command line options adds its value to :c:member:`~PyConfig.warnoptions`, it can be used multiple times." +#: ../../c-api/init_config.rst:1986 +msgid "" +"The :option:`-W` command line options adds its value " +"to :c:member:`~PyConfig.warnoptions`, it can be used multiple times." msgstr "" -msgid "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add warning options. Multiple options can be specified, separated by commas (``,``)." +#: ../../c-api/init_config.rst:1989 +msgid "" +"The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " +"warning options. Multiple options can be specified, separated by commas " +"(``,``)." msgstr "" -msgid "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of source modules." +#: ../../c-api/init_config.rst:1997 +msgid "" +"If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " +"source modules." msgstr "" -msgid "Set to ``0`` by the :option:`-B` command line option and the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable." +#: ../../c-api/init_config.rst:2000 +msgid "" +"Set to ``0`` by the :option:`-B` command line option and " +"the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -msgid ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:member:`~PyConfig.write_bytecode`." +#: ../../c-api/init_config.rst:2003 +msgid "" +":data:`sys.dont_write_bytecode` is initialized to the inverted value " +"of :c:member:`~PyConfig.write_bytecode`." msgstr "" +#: ../../c-api/init_config.rst:2010 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" +#: ../../c-api/init_config.rst:2016 msgid "If non-zero, write performance statistics at Python exit." msgstr "" -msgid "Need a special build with the ``Py_STATS`` macro: see :option:`--enable-pystats`." +#: ../../c-api/init_config.rst:2018 +msgid "" +"Need a special build with the ``Py_STATS`` macro: see :option:`--enable-" +"pystats`." msgstr "" -msgid "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` arguments are parsed the same way the regular Python parses :ref:`command line arguments `, and Python arguments are stripped from :c:member:`~PyConfig.argv`." +#: ../../c-api/init_config.rst:2023 +msgid "" +"If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " +"arguments are parsed the same way the regular Python parses :ref:`command " +"line arguments `, and Python arguments are stripped " +"from :c:member:`~PyConfig.argv`." msgstr "" -msgid "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: see the :option:`-X` command line option." +#: ../../c-api/init_config.rst:2028 +msgid "" +"The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " +"see the :option:`-X` command line option." msgstr "" +#: ../../c-api/init_config.rst:2033 msgid "The ``show_alloc_count`` field has been removed." msgstr "" +#: ../../c-api/init_config.rst:2039 msgid "Initialization with PyConfig" msgstr "" -msgid "Initializing the interpreter from a populated configuration struct is handled by calling :c:func:`Py_InitializeFromConfig`." +#: ../../c-api/init_config.rst:2041 +msgid "" +"Initializing the interpreter from a populated configuration struct is " +"handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -msgid "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:func:`PyImport_ExtendInittab` are used, they must be set or called after Python preinitialization and before the Python initialization. If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` or :c:func:`PyImport_ExtendInittab` must be called before each Python initialization." +#: ../../c-api/init_config.rst:2047 +msgid "" +"If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` " +"or :c:func:`PyImport_ExtendInittab` are used, they must be set or called " +"after Python preinitialization and before the Python initialization. If " +"Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " +"or :c:func:`PyImport_ExtendInittab` must be called before each Python " +"initialization." msgstr "" -msgid "The current configuration (``PyConfig`` type) is stored in ``PyInterpreterState.config``." +#: ../../c-api/init_config.rst:2054 +msgid "" +"The current configuration (``PyConfig`` type) is stored in " +"``PyInterpreterState.config``." msgstr "" +#: ../../c-api/init_config.rst:2057 msgid "Example setting the program name::" msgstr "" +#: ../../c-api/init_config.rst:2059 msgid "" "void init_python(void)\n" "{\n" @@ -1880,9 +3018,16 @@ msgid "" "}" msgstr "" -msgid "More complete example modifying the default configuration, read the configuration, and then override some parameters. Note that since 3.11, many parameters are not calculated until initialization, and so values cannot be read from the configuration structure. Any values set before initialize is called will be left unchanged by initialization::" +#: ../../c-api/init_config.rst:2085 +msgid "" +"More complete example modifying the default configuration, read the " +"configuration, and then override some parameters. Note that since 3.11, many " +"parameters are not calculated until initialization, and so values cannot be " +"read from the configuration structure. Any values set before initialize is " +"called will be left unchanged by initialization::" msgstr "" +#: ../../c-api/init_config.rst:2092 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1937,179 +3082,311 @@ msgid "" "}" msgstr "" +#: ../../c-api/init_config.rst:2148 msgid "Isolated Configuration" msgstr "" -msgid ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:`PyConfig_InitIsolatedConfig` functions create a configuration to isolate Python from the system. For example, to embed Python into an application." +#: ../../c-api/init_config.rst:2150 +msgid "" +":c:func:`PyPreConfig_InitIsolatedConfig` " +"and :c:func:`PyConfig_InitIsolatedConfig` functions create a configuration " +"to isolate Python from the system. For example, to embed Python into an " +"application." msgstr "" -msgid "This configuration ignores global configuration variables, environment variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) and user site directory. The C standard streams (ex: ``stdout``) and the LC_CTYPE locale are left unchanged. Signal handlers are not installed." +#: ../../c-api/init_config.rst:2155 +msgid "" +"This configuration ignores global configuration variables, environment " +"variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " +"and user site directory. The C standard streams (ex: ``stdout``) and the " +"LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -msgid "Configuration files are still used with this configuration to determine paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to avoid computing the default path configuration." +#: ../../c-api/init_config.rst:2160 +msgid "" +"Configuration files are still used with this configuration to determine " +"paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " +"avoid computing the default path configuration." msgstr "" +#: ../../c-api/init_config.rst:2168 msgid "Python Configuration" msgstr "" -msgid ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:`PyConfig_InitPythonConfig` functions create a configuration to build a customized Python which behaves as the regular Python." +#: ../../c-api/init_config.rst:2170 +msgid "" +":c:func:`PyPreConfig_InitPythonConfig` " +"and :c:func:`PyConfig_InitPythonConfig` functions create a configuration to " +"build a customized Python which behaves as the regular Python." msgstr "" -msgid "Environments variables and command line arguments are used to configure Python, whereas global configuration variables are ignored." +#: ../../c-api/init_config.rst:2174 +msgid "" +"Environments variables and command line arguments are used to configure " +"Python, whereas global configuration variables are ignored." msgstr "" -msgid "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." +#: ../../c-api/init_config.rst:2177 +msgid "" +"This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " +"Mode ` (:pep:`540`) depending on the LC_CTYPE " +"locale, :envvar:`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment " +"variables." msgstr "" +#: ../../c-api/init_config.rst:2186 msgid "Python Path Configuration" msgstr "" +#: ../../c-api/init_config.rst:2188 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" +#: ../../c-api/init_config.rst:2190 msgid "Path configuration inputs:" msgstr "" +#: ../../c-api/init_config.rst:2192 msgid ":c:member:`PyConfig.home`" msgstr "" +#: ../../c-api/init_config.rst:2193 msgid ":c:member:`PyConfig.platlibdir`" msgstr "" +#: ../../c-api/init_config.rst:2194 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr "" +#: ../../c-api/init_config.rst:2195 msgid ":c:member:`PyConfig.program_name`" msgstr "" +#: ../../c-api/init_config.rst:2196 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr "" +#: ../../c-api/init_config.rst:2197 msgid "current working directory: to get absolute paths" msgstr "" -msgid "``PATH`` environment variable to get the program full path (from :c:member:`PyConfig.program_name`)" +#: ../../c-api/init_config.rst:2198 +msgid "" +"``PATH`` environment variable to get the program full path " +"(from :c:member:`PyConfig.program_name`)" msgstr "" +#: ../../c-api/init_config.rst:2200 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "" -msgid "(Windows only) Application paths in the registry under \"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE (where X.Y is the Python version)." +#: ../../c-api/init_config.rst:2201 +msgid "" +"(Windows only) Application paths in the registry under " +"\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " +"HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" +#: ../../c-api/init_config.rst:2205 msgid "Path configuration output fields:" msgstr "" +#: ../../c-api/init_config.rst:2207 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr "" +#: ../../c-api/init_config.rst:2208 msgid ":c:member:`PyConfig.base_executable`" msgstr "" +#: ../../c-api/init_config.rst:2209 msgid ":c:member:`PyConfig.base_prefix`" msgstr "" +#: ../../c-api/init_config.rst:2210 msgid ":c:member:`PyConfig.exec_prefix`" msgstr "" +#: ../../c-api/init_config.rst:2211 msgid ":c:member:`PyConfig.executable`" msgstr "" +#: ../../c-api/init_config.rst:2212 msgid ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig.module_search_paths`" msgstr "" +#: ../../c-api/init_config.rst:2214 msgid ":c:member:`PyConfig.prefix`" msgstr "" -msgid "If at least one \"output field\" is not set, Python calculates the path configuration to fill unset fields. If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:member:`~PyConfig.module_search_paths` is overridden and :c:member:`~PyConfig.module_search_paths_set` is set to ``1``." +#: ../../c-api/init_config.rst:2216 +msgid "" +"If at least one \"output field\" is not set, Python calculates the path " +"configuration to fill unset fields. " +"If :c:member:`~PyConfig.module_search_paths_set` is equal to " +"``0``, :c:member:`~PyConfig.module_search_paths` is overridden " +"and :c:member:`~PyConfig.module_search_paths_set` is set to ``1``." msgstr "" -msgid "It is possible to completely ignore the function calculating the default path configuration by setting explicitly all path configuration output fields listed above. A string is considered as set even if it is non-empty. ``module_search_paths`` is considered as set if ``module_search_paths_set`` is set to ``1``. In this case, ``module_search_paths`` will be used without modification." +#: ../../c-api/init_config.rst:2222 +msgid "" +"It is possible to completely ignore the function calculating the default " +"path configuration by setting explicitly all path configuration output " +"fields listed above. A string is considered as set even if it is non-empty. " +"``module_search_paths`` is considered as set if ``module_search_paths_set`` " +"is set to ``1``. In this case, ``module_search_paths`` will be used without " +"modification." msgstr "" -msgid "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings when calculating the path configuration (Unix only, Windows does not log any warning)." +#: ../../c-api/init_config.rst:2229 +msgid "" +"Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " +"when calculating the path configuration (Unix only, Windows does not log any " +"warning)." msgstr "" -msgid "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig.base_exec_prefix` fields are not set, they inherit their value from :c:member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." +#: ../../c-api/init_config.rst:2232 +msgid "" +"If :c:member:`~PyConfig.base_prefix` " +"or :c:member:`~PyConfig.base_exec_prefix` fields are not set, they inherit " +"their value from :c:member:`~PyConfig.prefix` " +"and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" +#: ../../c-api/init_config.rst:2236 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -msgid "If :c:member:`~PyConfig.run_filename` is set and is a directory which contains a ``__main__.py`` script, prepend :c:member:`~PyConfig.run_filename` to :data:`sys.path`." +#: ../../c-api/init_config.rst:2238 +msgid "" +"If :c:member:`~PyConfig.run_filename` is set and is a directory which " +"contains a ``__main__.py`` script, " +"prepend :c:member:`~PyConfig.run_filename` to :data:`sys.path`." msgstr "" +#: ../../c-api/init_config.rst:2241 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -msgid "If :c:member:`~PyConfig.run_module` is set, prepend the current directory to :data:`sys.path`. Do nothing if the current directory cannot be read." +#: ../../c-api/init_config.rst:2243 +msgid "" +"If :c:member:`~PyConfig.run_module` is set, prepend the current directory " +"to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -msgid "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the filename to :data:`sys.path`." +#: ../../c-api/init_config.rst:2245 +msgid "" +"If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " +"filename to :data:`sys.path`." msgstr "" +#: ../../c-api/init_config.rst:2247 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -msgid "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be modified by the :mod:`site` module. If :c:member:`~PyConfig.user_site_directory` is non-zero and the user's site-package directory exists, the :mod:`site` module appends the user's site-package directory to :data:`sys.path`." +#: ../../c-api/init_config.rst:2249 +msgid "" +"If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " +"modified by the :mod:`site` module. " +"If :c:member:`~PyConfig.user_site_directory` is non-zero and the user's site-" +"package directory exists, the :mod:`site` module appends the user's site-" +"package directory to :data:`sys.path`." msgstr "" +#: ../../c-api/init_config.rst:2255 msgid "The following configuration files are used by the path configuration:" msgstr "" +#: ../../c-api/init_config.rst:2257 msgid "``pyvenv.cfg``" msgstr "" +#: ../../c-api/init_config.rst:2258 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" +#: ../../c-api/init_config.rst:2259 msgid "``pybuilddir.txt`` (Unix only)" msgstr "" +#: ../../c-api/init_config.rst:2261 msgid "If a ``._pth`` file is present:" msgstr "" +#: ../../c-api/init_config.rst:2263 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "" +#: ../../c-api/init_config.rst:2264 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "" +#: ../../c-api/init_config.rst:2265 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "" +#: ../../c-api/init_config.rst:2266 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "" -msgid "If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is present in the same directory as :c:member:`~PyConfig.executable`, or its parent, :c:member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` are set that location. When this happens, :c:member:`~PyConfig.base_prefix` and :c:member:`~PyConfig.base_exec_prefix` still keep their value, pointing to the base installation. See :ref:`sys-path-init-virtual-environments` for more information." +#: ../../c-api/init_config.rst:2268 +msgid "" +"If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is " +"present in the same directory as :c:member:`~PyConfig.executable`, or its " +"parent, :c:member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` " +"are set that location. When this happens, :c:member:`~PyConfig.base_prefix` " +"and :c:member:`~PyConfig.base_exec_prefix` still keep their value, pointing " +"to the base installation. See :ref:`sys-path-init-virtual-environments` for " +"more information." msgstr "" -msgid "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:`PyConfig.base_executable`." +#: ../../c-api/init_config.rst:2276 +msgid "" +"The ``__PYVENV_LAUNCHER__`` environment variable is used to " +"set :c:member:`PyConfig.base_executable`." msgstr "" -msgid ":c:member:`~PyConfig.prefix`, and :c:member:`~PyConfig.exec_prefix`, are now set to the ``pyvenv.cfg`` directory. This was previously done by :mod:`site`, therefore affected by :option:`-S`." +#: ../../c-api/init_config.rst:2281 +msgid "" +":c:member:`~PyConfig.prefix`, and :c:member:`~PyConfig.exec_prefix`, are now " +"set to the ``pyvenv.cfg`` directory. This was previously done " +"by :mod:`site`, therefore affected by :option:`-S`." msgstr "" +#: ../../c-api/init_config.rst:2287 msgid "Py_GetArgcArgv()" msgstr "" +#: ../../c-api/init_config.rst:2291 msgid "Get the original command line arguments, before Python modified them." msgstr "" +#: ../../c-api/init_config.rst:2293 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "" +#: ../../c-api/init_config.rst:2296 msgid "Delaying main module execution" msgstr "" -msgid "In some embedding use cases, it may be desirable to separate interpreter initialization from the execution of the main module." +#: ../../c-api/init_config.rst:2298 +msgid "" +"In some embedding use cases, it may be desirable to separate interpreter " +"initialization from the execution of the main module." msgstr "" -msgid "This separation can be achieved by setting ``PyConfig.run_command`` to the empty string during initialization (to prevent the interpreter from dropping into the interactive prompt), and then subsequently executing the desired main module code using ``__main__.__dict__`` as the global namespace." +#: ../../c-api/init_config.rst:2301 +msgid "" +"This separation can be achieved by setting ``PyConfig.run_command`` to the " +"empty string during initialization (to prevent the interpreter from dropping " +"into the interactive prompt), and then subsequently executing the desired " +"main module code using ``__main__.__dict__`` as the global namespace." msgstr "" +#: ../../c-api/init_config.rst:1185 msgid "main()" msgstr "" +#: ../../c-api/init_config.rst:1185 msgid "argv (in module sys)" msgstr "" diff --git a/c-api/interp-lifecycle.po b/c-api/interp-lifecycle.po index 99c32ff3b..dcc5878fb 100644 --- a/c-api/interp-lifecycle.po +++ b/c-api/interp-lifecycle.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,369 +19,709 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/interp-lifecycle.rst:6 msgid "Interpreter initialization and finalization" msgstr "" -msgid "See :ref:`Python Initialization Configuration ` for details on how to configure the interpreter prior to initialization." +#: ../../c-api/interp-lifecycle.rst:8 +msgid "" +"See :ref:`Python Initialization Configuration ` for details on " +"how to configure the interpreter prior to initialization." msgstr "" +#: ../../c-api/interp-lifecycle.rst:14 msgid "Before Python initialization" msgstr "" -msgid "In an application embedding Python, the :c:func:`Py_Initialize` function must be called before using any other Python/C API functions; with the exception of a few functions and the :ref:`global configuration variables `." +#: ../../c-api/interp-lifecycle.rst:16 +msgid "" +"In an application embedding Python, the :c:func:`Py_Initialize` function " +"must be called before using any other Python/C API functions; with the " +"exception of a few functions and the :ref:`global configuration variables " +"`." msgstr "" -msgid "The following functions can be safely called before Python is initialized:" +#: ../../c-api/interp-lifecycle.rst:21 +msgid "" +"The following functions can be safely called before Python is initialized:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:23 msgid "Functions that initialize the interpreter:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:25 msgid ":c:func:`Py_Initialize`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:26 msgid ":c:func:`Py_InitializeEx`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:27 msgid ":c:func:`Py_InitializeFromConfig`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:28 msgid ":c:func:`Py_BytesMain`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:29 msgid ":c:func:`Py_Main`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:30 msgid "the runtime pre-initialization functions covered in :ref:`init-config`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:32 msgid "Configuration functions:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:34 msgid ":c:func:`PyImport_AppendInittab`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:35 msgid ":c:func:`PyImport_ExtendInittab`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:36 msgid ":c:func:`!PyInitFrozenExtensions`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:37 msgid ":c:func:`PyMem_SetAllocator`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:38 msgid ":c:func:`PyMem_SetupDebugHooks`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:39 msgid ":c:func:`PyObject_SetArenaAllocator`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:40 msgid ":c:func:`Py_SetProgramName`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:41 msgid ":c:func:`Py_SetPythonHome`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:42 msgid "the configuration functions covered in :ref:`init-config`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:44 msgid "Informative functions:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:46 ../../c-api/interp-lifecycle.rst:54 msgid ":c:func:`Py_IsInitialized`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:47 msgid ":c:func:`PyMem_GetAllocator`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:48 msgid ":c:func:`PyObject_GetArenaAllocator`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:49 msgid ":c:func:`Py_GetBuildInfo`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:50 msgid ":c:func:`Py_GetCompiler`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:51 msgid ":c:func:`Py_GetCopyright`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:52 msgid ":c:func:`Py_GetPlatform`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:53 msgid ":c:func:`Py_GetVersion`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:56 msgid "Utilities:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:58 msgid ":c:func:`Py_DecodeLocale`" msgstr "" -msgid "the status reporting and utility functions covered in :ref:`init-config`" +#: ../../c-api/interp-lifecycle.rst:59 +msgid "" +"the status reporting and utility functions covered in :ref:`init-config`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:61 msgid "Memory allocators:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:63 msgid ":c:func:`PyMem_RawMalloc`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:64 msgid ":c:func:`PyMem_RawRealloc`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:65 msgid ":c:func:`PyMem_RawCalloc`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:66 msgid ":c:func:`PyMem_RawFree`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:68 msgid "Synchronization:" msgstr "" +#: ../../c-api/interp-lifecycle.rst:70 msgid ":c:func:`PyMutex_Lock`" msgstr "" +#: ../../c-api/interp-lifecycle.rst:71 msgid ":c:func:`PyMutex_Unlock`" msgstr "" -msgid "Despite their apparent similarity to some of the functions listed above, the following functions **should not be called** before the interpreter has been initialized: :c:func:`Py_EncodeLocale`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." +#: ../../c-api/interp-lifecycle.rst:75 +msgid "" +"Despite their apparent similarity to some of the functions listed above, the " +"following functions **should not be called** before the interpreter has been " +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`PyEval_InitThreads`, " +"and :c:func:`Py_RunMain`." msgstr "" +#: ../../c-api/interp-lifecycle.rst:84 msgid "Global configuration variables" msgstr "" -msgid "Python has variables for the global configuration to control different features and options. By default, these flags are controlled by :ref:`command line options `." +#: ../../c-api/interp-lifecycle.rst:86 +msgid "" +"Python has variables for the global configuration to control different " +"features and options. By default, these flags are controlled " +"by :ref:`command line options `." msgstr "" -msgid "When a flag is set by an option, the value of the flag is the number of times that the option was set. For example, ``-b`` sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2." +#: ../../c-api/interp-lifecycle.rst:90 +msgid "" +"When a flag is set by an option, the value of the flag is the number of " +"times that the option was set. For example, ``-b`` " +"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " +"sets :c:data:`Py_BytesWarningFlag` to 2." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.bytes_warning` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:97 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.bytes_warning` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater or equal to ``2``." +#: ../../c-api/interp-lifecycle.rst:101 +msgid "" +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " +"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " +"greater or equal to ``2``." msgstr "" +#: ../../c-api/interp-lifecycle.rst:105 msgid "Set by the :option:`-b` option." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.parser_debug` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:112 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.parser_debug` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Turn on parser debugging output (for expert only, depending on compilation options)." +#: ../../c-api/interp-lifecycle.rst:116 +msgid "" +"Turn on parser debugging output (for expert only, depending on compilation " +"options)." msgstr "" -msgid "Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment variable." +#: ../../c-api/interp-lifecycle.rst:119 +msgid "" +"Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment " +"variable." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.write_bytecode` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:127 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.write_bytecode` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "If set to non-zero, Python won't try to write ``.pyc`` files on the import of source modules." +#: ../../c-api/interp-lifecycle.rst:131 +msgid "" +"If set to non-zero, Python won't try to write ``.pyc`` files on the import " +"of source modules." msgstr "" -msgid "Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable." +#: ../../c-api/interp-lifecycle.rst:134 +msgid "" +"Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` " +"environment variable." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:142 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" +#: ../../c-api/interp-lifecycle.rst:146 msgid "Private flag used by ``_freeze_module`` and ``frozenmain`` programs." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:153 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.hash_seed` " +"and :c:member:`PyConfig.use_hash_seed` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to a non-empty string." +#: ../../c-api/interp-lifecycle.rst:158 +msgid "" +"Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to " +"a non-empty string." msgstr "" -msgid "If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment variable to initialize the secret hash seed." +#: ../../c-api/interp-lifecycle.rst:161 +msgid "" +"If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment " +"variable to initialize the secret hash seed." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.use_environment` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:169 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.use_environment` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." +#: ../../c-api/interp-lifecycle.rst:173 +msgid "" +"Ignore all :envvar:`!PYTHON*` environment variables, " +"e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" +#: ../../c-api/interp-lifecycle.rst:176 msgid "Set by the :option:`-E` and :option:`-I` options." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.inspect` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:183 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.inspect` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "When a script is passed as first argument or the :option:`-c` option is used, enter interactive mode after executing the script or the command, even when :data:`sys.stdin` does not appear to be a terminal." +#: ../../c-api/interp-lifecycle.rst:187 +msgid "" +"When a script is passed as first argument or the :option:`-c` option is " +"used, enter interactive mode after executing the script or the command, even " +"when :data:`sys.stdin` does not appear to be a terminal." msgstr "" -msgid "Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment variable." +#: ../../c-api/interp-lifecycle.rst:191 +msgid "" +"Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment " +"variable." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.interactive` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:199 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.interactive` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" +#: ../../c-api/interp-lifecycle.rst:203 msgid "Set by the :option:`-i` option." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.isolated` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:210 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.isolated` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Run Python in isolated mode. In isolated mode :data:`sys.path` contains neither the script's directory nor the user's site-packages directory." +#: ../../c-api/interp-lifecycle.rst:214 +msgid "" +"Run Python in isolated mode. In isolated mode :data:`sys.path` contains " +"neither the script's directory nor the user's site-packages directory." msgstr "" +#: ../../c-api/interp-lifecycle.rst:217 msgid "Set by the :option:`-I` option." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:226 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used " +"instead, see :ref:`Python Initialization Configuration `." msgstr "" -msgid "If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, for the :term:`filesystem encoding and error handler`." +#: ../../c-api/interp-lifecycle.rst:230 +msgid "" +"If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error " +"handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, " +"for the :term:`filesystem encoding and error handler`." msgstr "" -msgid "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable is set to a non-empty string." +#: ../../c-api/interp-lifecycle.rst:234 +msgid "" +"Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " +"variable is set to a non-empty string." msgstr "" +#: ../../c-api/interp-lifecycle.rst:237 msgid "See :pep:`529` for more details." msgstr "" +#: ../../c-api/interp-lifecycle.rst:239 ../../c-api/interp-lifecycle.rst:258 msgid "Availability" msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:246 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io._WindowsConsoleIO` for :mod:`sys` standard streams." +#: ../../c-api/interp-lifecycle.rst:250 +msgid "" +"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!" +"io._WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" -msgid "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable is set to a non-empty string." +#: ../../c-api/interp-lifecycle.rst:253 +msgid "" +"Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " +"is set to a non-empty string." msgstr "" +#: ../../c-api/interp-lifecycle.rst:256 msgid "See :pep:`528` for more details." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.site_import` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:265 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.site_import` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Disable the import of the module :mod:`site` and the site-dependent manipulations of :data:`sys.path` that it entails. Also disable these manipulations if :mod:`site` is explicitly imported later (call :func:`site.main` if you want them to be triggered)." +#: ../../c-api/interp-lifecycle.rst:269 +msgid "" +"Disable the import of the module :mod:`site` and the site-dependent " +"manipulations of :data:`sys.path` that it entails. Also disable these " +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" +#: ../../c-api/interp-lifecycle.rst:274 msgid "Set by the :option:`-S` option." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.user_site_directory` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:281 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.user_site_directory` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Don't add the :data:`user site-packages directory ` to :data:`sys.path`." +#: ../../c-api/interp-lifecycle.rst:285 +msgid "" +"Don't add the :data:`user site-packages directory ` " +"to :data:`sys.path`." msgstr "" -msgid "Set by the :option:`-s` and :option:`-I` options, and the :envvar:`PYTHONNOUSERSITE` environment variable." +#: ../../c-api/interp-lifecycle.rst:288 +msgid "" +"Set by the :option:`-s` and :option:`-I` options, and " +"the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.optimization_level` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:296 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.optimization_level` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment variable." +#: ../../c-api/interp-lifecycle.rst:300 +msgid "" +"Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment " +"variable." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:308 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -msgid "Don't display the copyright and version messages even in interactive mode." +#: ../../c-api/interp-lifecycle.rst:312 +msgid "" +"Don't display the copyright and version messages even in interactive mode." msgstr "" +#: ../../c-api/interp-lifecycle.rst:314 msgid "Set by the :option:`-q` option." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.buffered_stdio` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:323 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.buffered_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" +#: ../../c-api/interp-lifecycle.rst:327 msgid "Force the stdout and stderr streams to be unbuffered." msgstr "" -msgid "Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` environment variable." +#: ../../c-api/interp-lifecycle.rst:329 +msgid "" +"Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` " +"environment variable." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.verbose` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:337 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.verbose` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Print a message each time a module is initialized, showing the place (filename or built-in module) from which it is loaded. If greater or equal to ``2``, print a message for each file that is checked for when searching for a module. Also provides information on module cleanup at exit." +#: ../../c-api/interp-lifecycle.rst:341 +msgid "" +"Print a message each time a module is initialized, showing the place " +"(filename or built-in module) from which it is loaded. If greater or equal " +"to ``2``, print a message for each file that is checked for when searching " +"for a module. Also provides information on module cleanup at exit." msgstr "" -msgid "Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment variable." +#: ../../c-api/interp-lifecycle.rst:346 +msgid "" +"Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment " +"variable." msgstr "" +#: ../../c-api/interp-lifecycle.rst:353 msgid "Initializing and finalizing the interpreter" msgstr "" -msgid "Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; see :ref:`Before Python Initialization ` for the few exceptions." -msgstr "" - -msgid "This initializes the table of loaded modules (``sys.modules``), and creates the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes the module search path (``sys.path``). It does not set ``sys.argv``; use the :ref:`Python Initialization Configuration ` API for that. This is a no-op when called for a second time (without calling :c:func:`Py_FinalizeEx` first). There is no return value; it is a fatal error if the initialization fails." +#: ../../c-api/interp-lifecycle.rst:367 +msgid "" +"Initialize the Python interpreter. In an application embedding Python, this " +"should be called before using any other Python/C API functions; " +"see :ref:`Before Python Initialization ` for the few " +"exceptions." msgstr "" -msgid "Use :c:func:`Py_InitializeFromConfig` to customize the :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:371 +msgid "" +"This initializes the table of loaded modules (``sys.modules``), and creates " +"the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " +"also initializes the module search path (``sys.path``). It does not set " +"``sys.argv``; use the :ref:`Python Initialization Configuration ` API for that. This is a no-op when called for a second time " +"(without calling :c:func:`Py_FinalizeEx` first). There is no return value; " +"it is a fatal error if the initialization fails." msgstr "" -msgid "On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, which will also affect non-Python uses of the console using the C Runtime." +#: ../../c-api/interp-lifecycle.rst:379 ../../c-api/interp-lifecycle.rst:393 +msgid "" +"Use :c:func:`Py_InitializeFromConfig` to customize the :ref:`Python " +"Initialization Configuration `." msgstr "" -msgid "This function works like :c:func:`Py_Initialize` if *initsigs* is ``1``. If *initsigs* is ``0``, it skips initialization registration of signal handlers, which may be useful when CPython is embedded as part of a larger application." +#: ../../c-api/interp-lifecycle.rst:383 +msgid "" +"On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, which " +"will also affect non-Python uses of the console using the C Runtime." msgstr "" -msgid "Initialize Python from *config* configuration, as described in :ref:`init-from-config`." +#: ../../c-api/interp-lifecycle.rst:389 +msgid "" +"This function works like :c:func:`Py_Initialize` if *initsigs* is ``1``. If " +"*initsigs* is ``0``, it skips initialization registration of signal " +"handlers, which may be useful when CPython is embedded as part of a larger " +"application." msgstr "" -msgid "See the :ref:`init-config` section for details on pre-initializing the interpreter, populating the runtime configuration structure, and querying the returned status structure." +#: ../../c-api/interp-lifecycle.rst:399 +msgid "" +"Initialize Python from *config* configuration, as described in :ref:`init-" +"from-config`." msgstr "" -msgid "Return true (nonzero) when the Python interpreter has been initialized, false (zero) if not. After :c:func:`Py_FinalizeEx` is called, this returns false until :c:func:`Py_Initialize` is called again." +#: ../../c-api/interp-lifecycle.rst:402 +msgid "" +"See the :ref:`init-config` section for details on pre-initializing the " +"interpreter, populating the runtime configuration structure, and querying " +"the returned status structure." msgstr "" -msgid "Return true (non-zero) if the main Python interpreter is :term:`shutting down `. Return false (zero) otherwise." +#: ../../c-api/interp-lifecycle.rst:409 +msgid "" +"Return true (nonzero) when the Python interpreter has been initialized, " +"false (zero) if not. After :c:func:`Py_FinalizeEx` is called, this returns " +"false until :c:func:`Py_Initialize` is called again." msgstr "" -msgid "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use of Python/C API functions, and destroy all sub-interpreters (see :c:func:`Py_NewInterpreter` below) that were created and not yet destroyed since the last call to :c:func:`Py_Initialize`. This is a no-op when called for a second time (without calling :c:func:`Py_Initialize` again first)." +#: ../../c-api/interp-lifecycle.rst:416 +msgid "" +"Return true (non-zero) if the main Python interpreter is :term:`shutting " +"down `. Return false (zero) otherwise." msgstr "" -msgid "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in the same thread with the same interpreter active. That means the main thread and the main interpreter. This should never be called while :c:func:`Py_RunMain` is running." +#: ../../c-api/interp-lifecycle.rst:424 +msgid "" +"Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " +"of Python/C API functions, and destroy all sub-interpreters " +"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " +"destroyed since the last call to :c:func:`Py_Initialize`. This is a no-op " +"when called for a second time (without calling :c:func:`Py_Initialize` again " +"first)." msgstr "" -msgid "Normally the return value is ``0``. If there were errors during finalization (flushing buffered data), ``-1`` is returned." +#: ../../c-api/interp-lifecycle.rst:430 +msgid "" +"Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " +"the same thread with the same interpreter active. That means the main " +"thread and the main interpreter. This should never be called " +"while :c:func:`Py_RunMain` is running." msgstr "" -msgid "Note that Python will do a best effort at freeing all memory allocated by the Python interpreter. Therefore, any C-Extension should make sure to correctly clean up all of the previously allocated PyObjects before using them in subsequent calls to :c:func:`Py_Initialize`. Otherwise it could introduce vulnerabilities and incorrect behavior." +#: ../../c-api/interp-lifecycle.rst:435 +msgid "" +"Normally the return value is ``0``. If there were errors during finalization " +"(flushing buffered data), ``-1`` is returned." msgstr "" -msgid "This function is provided for a number of reasons. An embedding application might want to restart Python without having to restart the application itself. An application that has loaded the Python interpreter from a dynamically loadable library (or DLL) might want to free all memory allocated by Python before unloading the DLL. During a hunt for memory leaks in an application a developer might want to free all memory allocated by Python before exiting from the application." +#: ../../c-api/interp-lifecycle.rst:439 +msgid "" +"Note that Python will do a best effort at freeing all memory allocated by " +"the Python interpreter. Therefore, any C-Extension should make sure to " +"correctly clean up all of the previously allocated PyObjects before using " +"them in subsequent calls to :c:func:`Py_Initialize`. Otherwise it could " +"introduce vulnerabilities and incorrect behavior." msgstr "" -msgid "**Bugs and caveats:** The destruction of modules and objects in modules is done in random order; this may cause destructors (:meth:`~object.__del__` methods) to fail when they depend on other objects (even functions) or modules. Dynamically loaded extension modules loaded by Python are not unloaded. Small amounts of memory allocated by the Python interpreter may not be freed (if you find a leak, please report it). Memory tied up in circular references between objects is not freed. Interned strings will all be deallocated regardless of their reference count. Some memory allocated by extension modules may not be freed. Some extensions may not work properly if their initialization routine is called more than once; this can happen if an application calls :c:func:`Py_Initialize` and :c:func:`Py_FinalizeEx` more than once. :c:func:`Py_FinalizeEx` must not be called recursively from within itself. Therefore, it must not be called by any code that may be run as part of the interpreter shutdown process, such as :py:mod:`atexit` handlers, object finalizers, or any code that may be run while flushing the stdout and stderr files." +#: ../../c-api/interp-lifecycle.rst:445 +msgid "" +"This function is provided for a number of reasons. An embedding application " +"might want to restart Python without having to restart the application " +"itself. An application that has loaded the Python interpreter from a " +"dynamically loadable library (or DLL) might want to free all memory " +"allocated by Python before unloading the DLL. During a hunt for memory leaks " +"in an application a developer might want to free all memory allocated by " +"Python before exiting from the application." msgstr "" -msgid "Raises an :ref:`auditing event ` ``cpython._PySys_ClearAuditHooks`` with no arguments." +#: ../../c-api/interp-lifecycle.rst:453 +msgid "" +"**Bugs and caveats:** The destruction of modules and objects in modules is " +"done in random order; this may cause destructors (:meth:`~object.__del__` " +"methods) to fail when they depend on other objects (even functions) or " +"modules. Dynamically loaded extension modules loaded by Python are not " +"unloaded. Small amounts of memory allocated by the Python interpreter may " +"not be freed (if you find a leak, please report it). Memory tied up in " +"circular references between objects is not freed. Interned strings will all " +"be deallocated regardless of their reference count. Some memory allocated by " +"extension modules may not be freed. Some extensions may not work properly " +"if their initialization routine is called more than once; this can happen if " +"an application calls :c:func:`Py_Initialize` and :c:func:`Py_FinalizeEx` " +"more than once. :c:func:`Py_FinalizeEx` must not be called recursively from " +"within itself. Therefore, it must not be called by any code that may be run " +"as part of the interpreter shutdown process, such as :py:mod:`atexit` " +"handlers, object finalizers, or any code that may be run while flushing the " +"stdout and stderr files." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:469 +msgid "" +"Raises an :ref:`auditing event ` " +"``cpython._PySys_ClearAuditHooks`` with no arguments." msgstr "" -msgid "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that disregards the return value." +#: ../../c-api/interp-lifecycle.rst:476 +msgid "" +"This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " +"disregards the return value." msgstr "" -msgid "Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, allowing the calling application to delegate the text decoding step to the CPython runtime." +#: ../../c-api/interp-lifecycle.rst:482 +msgid "" +"Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, " +"allowing the calling application to delegate the text decoding step to the " +"CPython runtime." msgstr "" -msgid "The main program for the standard interpreter, encapsulating a full initialization/finalization cycle, as well as additional behaviour to implement reading configurations settings from the environment and command line, and then executing ``__main__`` in accordance with :ref:`using-on-cmdline`." +#: ../../c-api/interp-lifecycle.rst:491 +msgid "" +"The main program for the standard interpreter, encapsulating a full " +"initialization/finalization cycle, as well as additional behaviour to " +"implement reading configurations settings from the environment and command " +"line, and then executing ``__main__`` in accordance with :ref:`using-on-" +"cmdline`." msgstr "" -msgid "This is made available for programs which wish to support the full CPython command line interface, rather than just embedding a Python runtime in a larger application." +#: ../../c-api/interp-lifecycle.rst:497 +msgid "" +"This is made available for programs which wish to support the full CPython " +"command line interface, rather than just embedding a Python runtime in a " +"larger application." msgstr "" -msgid "The *argc* and *argv* parameters are similar to those which are passed to a C program's :c:func:`main` function, except that the *argv* entries are first converted to ``wchar_t`` using :c:func:`Py_DecodeLocale`. It is also important to note that the argument list entries may be modified to point to strings other than those passed in (however, the contents of the strings pointed to by the argument list are not modified)." +#: ../../c-api/interp-lifecycle.rst:501 +msgid "" +"The *argc* and *argv* parameters are similar to those which are passed to a " +"C program's :c:func:`main` function, except that the *argv* entries are " +"first converted to ``wchar_t`` using :c:func:`Py_DecodeLocale`. It is also " +"important to note that the argument list entries may be modified to point to " +"strings other than those passed in (however, the contents of the strings " +"pointed to by the argument list are not modified)." msgstr "" -msgid "The return value is ``2`` if the argument list does not represent a valid Python command line, and otherwise the same as :c:func:`Py_RunMain`." +#: ../../c-api/interp-lifecycle.rst:508 +msgid "" +"The return value is ``2`` if the argument list does not represent a valid " +"Python command line, and otherwise the same as :c:func:`Py_RunMain`." msgstr "" -msgid "In terms of the CPython runtime configuration APIs documented in the :ref:`runtime configuration ` section (and without accounting for error handling), ``Py_Main`` is approximately equivalent to::" +#: ../../c-api/interp-lifecycle.rst:511 +msgid "" +"In terms of the CPython runtime configuration APIs documented in " +"the :ref:`runtime configuration ` section (and without " +"accounting for error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" +#: ../../c-api/interp-lifecycle.rst:515 msgid "" "PyConfig config;\n" "PyConfig_InitPythonConfig(&config);\n" @@ -392,242 +732,542 @@ msgid "" "Py_RunMain();" msgstr "" -msgid "In normal usage, an embedding application will call this function *instead* of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:`Py_InitializeFromConfig` directly, and all settings will be applied as described elsewhere in this documentation. If this function is instead called *after* a preceding runtime initialization API call, then exactly which environmental and command line configuration settings will be updated is version dependent (as it depends on which settings correctly support being modified after they have already been set once when the runtime was first initialized)." -msgstr "" - +#: ../../c-api/interp-lifecycle.rst:523 +msgid "" +"In normal usage, an embedding application will call this function *instead* " +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " +"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " +"applied as described elsewhere in this documentation. If this function is " +"instead called *after* a preceding runtime initialization API call, then " +"exactly which environmental and command line configuration settings will be " +"updated is version dependent (as it depends on which settings correctly " +"support being modified after they have already been set once when the " +"runtime was first initialized)." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:536 msgid "Executes the main module in a fully configured CPython runtime." msgstr "" -msgid "Executes the command (:c:member:`PyConfig.run_command`), the script (:c:member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig.run_module`) specified on the command line or in the configuration. If none of these values are set, runs the interactive Python prompt (REPL) using the ``__main__`` module's global namespace." +#: ../../c-api/interp-lifecycle.rst:538 +msgid "" +"Executes the command (:c:member:`PyConfig.run_command`), the script " +"(:c:member:`PyConfig.run_filename`) or the module " +"(:c:member:`PyConfig.run_module`) specified on the command line or in the " +"configuration. If none of these values are set, runs the interactive Python " +"prompt (REPL) using the ``__main__`` module's global namespace." msgstr "" -msgid "If :c:member:`PyConfig.inspect` is not set (the default), the return value will be ``0`` if the interpreter exits normally (that is, without raising an exception), the exit status of an unhandled :exc:`SystemExit`, or ``1`` for any other unhandled exception." +#: ../../c-api/interp-lifecycle.rst:544 +msgid "" +"If :c:member:`PyConfig.inspect` is not set (the default), the return value " +"will be ``0`` if the interpreter exits normally (that is, without raising an " +"exception), the exit status of an unhandled :exc:`SystemExit`, or ``1`` for " +"any other unhandled exception." msgstr "" -msgid "If :c:member:`PyConfig.inspect` is set (such as when the :option:`-i` option is used), rather than returning when the interpreter exits, execution will instead resume in an interactive Python prompt (REPL) using the ``__main__`` module's global namespace. If the interpreter exited with an exception, it is immediately raised in the REPL session. The function return value is then determined by the way the *REPL session* terminates: ``0``, ``1``, or the status of a :exc:`SystemExit`, as specified above." +#: ../../c-api/interp-lifecycle.rst:549 +msgid "" +"If :c:member:`PyConfig.inspect` is set (such as when the :option:`-i` option " +"is used), rather than returning when the interpreter exits, execution will " +"instead resume in an interactive Python prompt (REPL) using the ``__main__`` " +"module's global namespace. If the interpreter exited with an exception, it " +"is immediately raised in the REPL session. The function return value is then " +"determined by the way the *REPL session* terminates: ``0``, ``1``, or the " +"status of a :exc:`SystemExit`, as specified above." msgstr "" -msgid "This function always finalizes the Python interpreter before it returns." +#: ../../c-api/interp-lifecycle.rst:557 +msgid "" +"This function always finalizes the Python interpreter before it returns." msgstr "" -msgid "See :ref:`Python Configuration ` for an example of a customized Python that always runs in isolated mode using :c:func:`Py_RunMain`." +#: ../../c-api/interp-lifecycle.rst:559 +msgid "" +"See :ref:`Python Configuration ` for an example of a " +"customized Python that always runs in isolated mode " +"using :c:func:`Py_RunMain`." msgstr "" -msgid "Register an :mod:`atexit` callback for the target interpreter *interp*. This is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and data pointer for the callback." +#: ../../c-api/interp-lifecycle.rst:565 +msgid "" +"Register an :mod:`atexit` callback for the target interpreter *interp*. This " +"is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " +"data pointer for the callback." msgstr "" +#: ../../c-api/interp-lifecycle.rst:569 msgid "There must be an :term:`attached thread state` for *interp*." msgstr "" +#: ../../c-api/interp-lifecycle.rst:577 msgid "Cautions regarding runtime finalization" msgstr "" -msgid "In the late stage of :term:`interpreter shutdown`, after attempting to wait for non-daemon threads to exit (though this can be interrupted by :class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime is marked as *finalizing*: :c:func:`Py_IsFinalizing` and :func:`sys.is_finalizing` return true. At this point, only the *finalization thread* that initiated finalization (typically the main thread) is allowed to acquire the :term:`GIL`." +#: ../../c-api/interp-lifecycle.rst:579 +msgid "" +"In the late stage of :term:`interpreter shutdown`, after attempting to wait " +"for non-daemon threads to exit (though this can be interrupted " +"by :class:`KeyboardInterrupt`) and running the :mod:`atexit` functions, the " +"runtime is marked as *finalizing*: :c:func:`Py_IsFinalizing` " +"and :func:`sys.is_finalizing` return true. At this point, only the " +"*finalization thread* that initiated finalization (typically the main " +"thread) is allowed to acquire the :term:`GIL`." msgstr "" -msgid "If any thread, other than the finalization thread, attempts to attach a :term:`thread state` during finalization, either explicitly or implicitly, the thread enters **a permanently blocked state** where it remains until the program exits. In most cases this is harmless, but this can result in deadlock if a later stage of finalization attempts to acquire a lock owned by the blocked thread, or otherwise waits on the blocked thread." +#: ../../c-api/interp-lifecycle.rst:587 +msgid "" +"If any thread, other than the finalization thread, attempts to attach " +"a :term:`thread state` during finalization, either explicitly or implicitly, " +"the thread enters **a permanently blocked state** where it remains until the " +"program exits. In most cases this is harmless, but this can result in " +"deadlock if a later stage of finalization attempts to acquire a lock owned " +"by the blocked thread, or otherwise waits on the blocked thread." msgstr "" -msgid "Gross? Yes. This prevents random crashes and/or unexpectedly skipped C++ finalizations further up the call stack when such threads were forcibly exited here in CPython 3.13 and earlier. The CPython runtime :term:`thread state` C APIs have never had any error reporting or handling expectations at :term:`thread state` attachment time that would've allowed for graceful exit from this situation. Changing that would require new stable C APIs and rewriting the majority of C code in the CPython ecosystem to use those with error handling." +#: ../../c-api/interp-lifecycle.rst:594 +msgid "" +"Gross? Yes. This prevents random crashes and/or unexpectedly skipped C++ " +"finalizations further up the call stack when such threads were forcibly " +"exited here in CPython 3.13 and earlier. The CPython runtime :term:`thread " +"state` C APIs have never had any error reporting or handling expectations " +"at :term:`thread state` attachment time that would've allowed for graceful " +"exit from this situation. Changing that would require new stable C APIs and " +"rewriting the majority of C code in the CPython ecosystem to use those with " +"error handling." msgstr "" +#: ../../c-api/interp-lifecycle.rst:604 msgid "Process-wide parameters" msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.program_name` should be used instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -msgid "This function should be called before :c:func:`Py_Initialize` is called for the first time, if it is called at all. It tells the interpreter the value of the ``argv[0]`` argument to the :c:func:`main` function of the program (converted to wide characters). This is used by :c:func:`Py_GetPath` and some other functions below to find the Python run-time libraries relative to the interpreter executable. The default value is ``'python'``. The argument should point to a zero-terminated wide character string in static storage whose contents will not change for the duration of the program's execution. No code in the Python interpreter will change the contents of this storage." +#: ../../c-api/interp-lifecycle.rst:613 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.program_name` should be used instead, " +"see :ref:`Python Initialization Configuration `." msgstr "" -msgid "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:`wchar_t*` string." +#: ../../c-api/interp-lifecycle.rst:617 +msgid "" +"This function should be called before :c:func:`Py_Initialize` is called for " +"the first time, if it is called at all. It tells the interpreter the value " +"of the ``argv[0]`` argument to the :c:func:`main` function of the program " +"(converted to wide characters). This is used by :c:func:`Py_GetPath` and " +"some other functions below to find the Python run-time libraries relative to " +"the interpreter executable. The default value is ``'python'``. The " +"argument should point to a zero-terminated wide character string in static " +"storage whose contents will not change for the duration of the program's " +"execution. No code in the Python interpreter will change the contents of " +"this storage." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:628 ../../c-api/interp-lifecycle.rst:877 +#: ../../c-api/interp-lifecycle.rst:910 ../../c-api/interp-lifecycle.rst:936 +msgid "" +"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " +"a :c:expr:`wchar_t*` string." msgstr "" -msgid "Return the program name set with :c:member:`PyConfig.program_name`, or the default. The returned string points into static storage; the caller should not modify its value." +#: ../../c-api/interp-lifecycle.rst:636 +msgid "" +"Return the program name set with :c:member:`PyConfig.program_name`, or the " +"default. The returned string points into static storage; the caller should " +"not modify its value." msgstr "" -msgid "This function should not be called before :c:func:`Py_Initialize`, otherwise it returns ``NULL``." +#: ../../c-api/interp-lifecycle.rst:640 ../../c-api/interp-lifecycle.rst:663 +#: ../../c-api/interp-lifecycle.rst:711 ../../c-api/interp-lifecycle.rst:736 +#: ../../c-api/interp-lifecycle.rst:763 ../../c-api/interp-lifecycle.rst:948 +msgid "" +"This function should not be called before :c:func:`Py_Initialize`, otherwise " +"it returns ``NULL``." msgstr "" +#: ../../c-api/interp-lifecycle.rst:643 ../../c-api/interp-lifecycle.rst:666 +#: ../../c-api/interp-lifecycle.rst:714 ../../c-api/interp-lifecycle.rst:739 +#: ../../c-api/interp-lifecycle.rst:768 ../../c-api/interp-lifecycle.rst:951 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "" -msgid "Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys.executable`) instead." -msgstr "" - -msgid "Return the *prefix* for installed platform-independent files. This is derived through a number of complicated rules from the program name set with :c:member:`PyConfig.program_name` and some environment variables; for example, if the program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The returned string points into static storage; the caller should not modify its value. This corresponds to the :makevar:`prefix` variable in the top-level :file:`Makefile` and the :option:`--prefix` argument to the :program:`configure` script at build time. The value is available to Python code as ``sys.base_prefix``. It is only useful on Unix. See also the next function." -msgstr "" - -msgid "Use :c:func:`PyConfig_Get(\"base_prefix\") ` (:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." -msgstr "" - -msgid "Return the *exec-prefix* for installed platform-*dependent* files. This is derived through a number of complicated rules from the program name set with :c:member:`PyConfig.program_name` and some environment variables; for example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix is ``'/usr/local'``. The returned string points into static storage; the caller should not modify its value. This corresponds to the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-prefix`` argument to the :program:`configure` script at build time. The value is available to Python code as ``sys.base_exec_prefix``. It is only useful on Unix." -msgstr "" - -msgid "Background: The exec-prefix differs from the prefix when platform dependent files (such as executables and shared libraries) are installed in a different directory tree. In a typical installation, platform dependent files may be installed in the :file:`/usr/local/plat` subtree while platform independent may be installed in :file:`/usr/local`." +#: ../../c-api/interp-lifecycle.rst:646 ../../c-api/interp-lifecycle.rst:742 +msgid "" +"Use :c:func:`PyConfig_Get(\"executable\") ` " +"(:data:`sys.executable`) instead." msgstr "" -msgid "Generally speaking, a platform is a combination of hardware and software families, e.g. Sparc machines running the Solaris 2.x operating system are considered the same platform, but Intel machines running Solaris 2.x are another platform, and Intel machines running Linux are yet another platform. Different major revisions of the same operating system generally also form different platforms. Non-Unix operating systems are a different story; the installation strategies on those systems are so different that the prefix and exec-prefix are meaningless, and set to the empty string. Note that compiled Python bytecode files are platform independent (but not independent from the Python version by which they were compiled!)." +#: ../../c-api/interp-lifecycle.rst:653 +msgid "" +"Return the *prefix* for installed platform-independent files. This is " +"derived through a number of complicated rules from the program name set " +"with :c:member:`PyConfig.program_name` and some environment variables; for " +"example, if the program name is ``'/usr/local/bin/python'``, the prefix is " +"``'/usr/local'``. The returned string points into static storage; the caller " +"should not modify its value. This corresponds to the :makevar:`prefix` " +"variable in the top-level :file:`Makefile` and the :option:`--prefix` " +"argument to the :program:`configure` script at build time. The value is " +"available to Python code as ``sys.base_prefix``. It is only useful on Unix. " +"See also the next function." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:669 +msgid "" +"Use :c:func:`PyConfig_Get(\"base_prefix\") ` " +"(:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") " +"` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." msgstr "" -msgid "System administrators will know how to configure the :program:`mount` or :program:`automount` programs to share :file:`/usr/local` between platforms while having :file:`/usr/local/plat` be a different filesystem for each platform." +#: ../../c-api/interp-lifecycle.rst:678 +msgid "" +"Return the *exec-prefix* for installed platform-*dependent* files. This is " +"derived through a number of complicated rules from the program name set " +"with :c:member:`PyConfig.program_name` and some environment variables; for " +"example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " +"is ``'/usr/local'``. The returned string points into static storage; the " +"caller should not modify its value. This corresponds to " +"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " +"the ``--exec-prefix`` argument to the :program:`configure` script at build " +"time. The value is available to Python code as ``sys.base_exec_prefix``. " +"It is only useful on Unix." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:689 +msgid "" +"Background: The exec-prefix differs from the prefix when platform dependent " +"files (such as executables and shared libraries) are installed in a " +"different directory tree. In a typical installation, platform dependent " +"files may be installed in the :file:`/usr/local/plat` subtree while platform " +"independent may be installed in :file:`/usr/local`." msgstr "" -msgid "Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys.base_exec_prefix`) instead. Use :c:func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to be handled." +#: ../../c-api/interp-lifecycle.rst:695 +msgid "" +"Generally speaking, a platform is a combination of hardware and software " +"families, e.g. Sparc machines running the Solaris 2.x operating system are " +"considered the same platform, but Intel machines running Solaris 2.x are " +"another platform, and Intel machines running Linux are yet another " +"platform. Different major revisions of the same operating system generally " +"also form different platforms. Non-Unix operating systems are a different " +"story; the installation strategies on those systems are so different that " +"the prefix and exec-prefix are meaningless, and set to the empty string. " +"Note that compiled Python bytecode files are platform independent (but not " +"independent from the Python version by which they were compiled!)." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:706 +msgid "" +"System administrators will know how to configure the :program:`mount` " +"or :program:`automount` programs to share :file:`/usr/local` between " +"platforms while having :file:`/usr/local/plat` be a different filesystem for " +"each platform." msgstr "" -msgid "Return the full program name of the Python executable; this is computed as a side-effect of deriving the default module search path from the program name (set by :c:member:`PyConfig.program_name`). The returned string points into static storage; the caller should not modify its value. The value is available to Python code as ``sys.executable``." +#: ../../c-api/interp-lifecycle.rst:717 +msgid "" +"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` " +"(:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." msgstr "" -msgid "Return the default module search path; this is computed from the program name (set by :c:member:`PyConfig.program_name`) and some environment variables. The returned string consists of a series of directory names separated by a platform dependent delimiter character. The delimiter character is ``':'`` on Unix and macOS, ``';'`` on Windows. The returned string points into static storage; the caller should not modify its value. The list :data:`sys.path` is initialized with this value on interpreter startup; it can be (and usually is) modified later to change the search path for loading modules." +#: ../../c-api/interp-lifecycle.rst:730 +msgid "" +"Return the full program name of the Python executable; this is computed as " +"a side-effect of deriving the default module search path from the program " +"name (set by :c:member:`PyConfig.program_name`). The returned string points " +"into static storage; the caller should not modify its value. The value is " +"available to Python code as ``sys.executable``." msgstr "" -msgid "Use :c:func:`PyConfig_Get(\"module_search_paths\") ` (:data:`sys.path`) instead." +#: ../../c-api/interp-lifecycle.rst:753 +msgid "" +"Return the default module search path; this is computed from the program " +"name (set by :c:member:`PyConfig.program_name`) and some environment " +"variables. The returned string consists of a series of directory names " +"separated by a platform dependent delimiter character. The delimiter " +"character is ``':'`` on Unix and macOS, ``';'`` on Windows. The returned " +"string points into static storage; the caller should not modify its value. " +"The list :data:`sys.path` is initialized with this value on interpreter " +"startup; it can be (and usually is) modified later to change the search path " +"for loading modules." +msgstr "" + +#: ../../c-api/interp-lifecycle.rst:771 +msgid "" +"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` " +"(:data:`sys.path`) instead." msgstr "" -msgid "Return the version of this Python interpreter. This is a string that looks something like ::" +#: ../../c-api/interp-lifecycle.rst:777 +msgid "" +"Return the version of this Python interpreter. This is a string that looks " +"something like ::" msgstr "" +#: ../../c-api/interp-lifecycle.rst:780 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "" -msgid "The first word (up to the first space character) is the current Python version; the first characters are the major and minor version separated by a period. The returned string points into static storage; the caller should not modify its value. The value is available to Python code as :data:`sys.version`." +#: ../../c-api/interp-lifecycle.rst:784 +msgid "" +"The first word (up to the first space character) is the current Python " +"version; the first characters are the major and minor version separated by a " +"period. The returned string points into static storage; the caller should " +"not modify its value. The value is available to Python code " +"as :data:`sys.version`." msgstr "" +#: ../../c-api/interp-lifecycle.rst:789 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -msgid "Return the platform identifier for the current platform. On Unix, this is formed from the \"official\" name of the operating system, converted to lower case, followed by the major revision number; e.g., for Solaris 2.x, which is also known as SunOS 5.x, the value is ``'sunos5'``. On macOS, it is ``'darwin'``. On Windows, it is ``'win'``. The returned string points into static storage; the caller should not modify its value. The value is available to Python code as ``sys.platform``." +#: ../../c-api/interp-lifecycle.rst:796 +msgid "" +"Return the platform identifier for the current platform. On Unix, this is " +"formed from the \"official\" name of the operating system, converted to " +"lower case, followed by the major revision number; e.g., for Solaris 2.x, " +"which is also known as SunOS 5.x, the value is ``'sunos5'``. On macOS, it " +"is ``'darwin'``. On Windows, it is ``'win'``. The returned string points " +"into static storage; the caller should not modify its value. The value is " +"available to Python code as ``sys.platform``." msgstr "" -msgid "Return the official copyright string for the current Python version, for example" +#: ../../c-api/interp-lifecycle.rst:807 +msgid "" +"Return the official copyright string for the current Python version, for " +"example" msgstr "" +#: ../../c-api/interp-lifecycle.rst:809 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "" -msgid "The returned string points into static storage; the caller should not modify its value. The value is available to Python code as ``sys.copyright``." +#: ../../c-api/interp-lifecycle.rst:813 +msgid "" +"The returned string points into static storage; the caller should not modify " +"its value. The value is available to Python code as ``sys.copyright``." msgstr "" -msgid "Return an indication of the compiler used to build the current Python version, in square brackets, for example::" +#: ../../c-api/interp-lifecycle.rst:819 +msgid "" +"Return an indication of the compiler used to build the current Python " +"version, in square brackets, for example::" msgstr "" +#: ../../c-api/interp-lifecycle.rst:822 msgid "\"[GCC 2.7.2.2]\"" msgstr "" -msgid "The returned string points into static storage; the caller should not modify its value. The value is available to Python code as part of the variable ``sys.version``." +#: ../../c-api/interp-lifecycle.rst:826 ../../c-api/interp-lifecycle.rst:840 +msgid "" +"The returned string points into static storage; the caller should not modify " +"its value. The value is available to Python code as part of the variable " +"``sys.version``." msgstr "" -msgid "Return information about the sequence number and build date and time of the current Python interpreter instance, for example ::" +#: ../../c-api/interp-lifecycle.rst:833 +msgid "" +"Return information about the sequence number and build date and time of the " +"current Python interpreter instance, for example ::" msgstr "" +#: ../../c-api/interp-lifecycle.rst:836 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:852 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` " +"and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -msgid "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are similar to those passed to the program's :c:func:`main` function with the difference that the first entry should refer to the script file to be executed rather than the executable hosting the Python interpreter. If there isn't a script that will be run, the first entry in *argv* can be an empty string. If this function fails to initialize :data:`sys.argv`, a fatal condition is signalled using :c:func:`Py_FatalError`." +#: ../../c-api/interp-lifecycle.rst:857 +msgid "" +"Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " +"similar to those passed to the program's :c:func:`main` function with the " +"difference that the first entry should refer to the script file to be " +"executed rather than the executable hosting the Python interpreter. If " +"there isn't a script that will be run, the first entry in *argv* can be an " +"empty string. If this function fails to initialize :data:`sys.argv`, a " +"fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -msgid "If *updatepath* is zero, this is all the function does. If *updatepath* is non-zero, the function also modifies :data:`sys.path` according to the following algorithm:" +#: ../../c-api/interp-lifecycle.rst:865 +msgid "" +"If *updatepath* is zero, this is all the function does. If *updatepath* is " +"non-zero, the function also modifies :data:`sys.path` according to the " +"following algorithm:" msgstr "" -msgid "If the name of an existing script is passed in ``argv[0]``, the absolute path of the directory where the script is located is prepended to :data:`sys.path`." +#: ../../c-api/interp-lifecycle.rst:869 +msgid "" +"If the name of an existing script is passed in ``argv[0]``, the absolute " +"path of the directory where the script is located is prepended " +"to :data:`sys.path`." msgstr "" -msgid "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an existing file name), an empty string is prepended to :data:`sys.path`, which is the same as prepending the current working directory (``\".\"``)." +#: ../../c-api/interp-lifecycle.rst:872 +msgid "" +"Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " +"existing file name), an empty string is prepended to :data:`sys.path`, which " +"is the same as prepending the current working directory (``\".\"``)." msgstr "" -msgid "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` members of the :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:880 ../../c-api/interp-lifecycle.rst:913 +msgid "" +"See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " +"members of the :ref:`Python Initialization Configuration `." msgstr "" -msgid "It is recommended that applications embedding the Python interpreter for purposes other than executing a single script pass ``0`` as *updatepath*, and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." +#: ../../c-api/interp-lifecycle.rst:884 +msgid "" +"It is recommended that applications embedding the Python interpreter for " +"purposes other than executing a single script pass ``0`` as *updatepath*, " +"and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -msgid "On versions before 3.1.3, you can achieve the same effect by manually popping the first :data:`sys.path` element after having called :c:func:`PySys_SetArgv`, for example using::" +#: ../../c-api/interp-lifecycle.rst:889 +msgid "" +"On versions before 3.1.3, you can achieve the same effect by manually " +"popping the first :data:`sys.path` element after having " +"called :c:func:`PySys_SetArgv`, for example using::" msgstr "" +#: ../../c-api/interp-lifecycle.rst:893 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:902 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should " +"be used instead, see :ref:`Python Initialization Configuration `." msgstr "" -msgid "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to ``1`` unless the :program:`python` interpreter was started with the :option:`-I`." +#: ../../c-api/interp-lifecycle.rst:906 +msgid "" +"This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " +"``1`` unless the :program:`python` interpreter was started with " +"the :option:`-I`." msgstr "" +#: ../../c-api/interp-lifecycle.rst:916 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -msgid "This API is kept for backward compatibility: setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python Initialization Configuration `." +#: ../../c-api/interp-lifecycle.rst:923 +msgid "" +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python " +"Initialization Configuration `." msgstr "" -msgid "Set the default \"home\" directory, that is, the location of the standard Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument string." +#: ../../c-api/interp-lifecycle.rst:927 +msgid "" +"Set the default \"home\" directory, that is, the location of the standard " +"Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " +"string." msgstr "" -msgid "The argument should point to a zero-terminated character string in static storage whose contents will not change for the duration of the program's execution. No code in the Python interpreter will change the contents of this storage." +#: ../../c-api/interp-lifecycle.rst:931 +msgid "" +"The argument should point to a zero-terminated character string in static " +"storage whose contents will not change for the duration of the program's " +"execution. No code in the Python interpreter will change the contents of " +"this storage." msgstr "" -msgid "Return the default \"home\", that is, the value set by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` environment variable if it is set." +#: ../../c-api/interp-lifecycle.rst:944 +msgid "" +"Return the default \"home\", that is, the value set " +"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " +"environment variable if it is set." msgstr "" -msgid "Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:`PYTHONHOME` environment variable instead." +#: ../../c-api/interp-lifecycle.rst:954 +msgid "" +"Use :c:func:`PyConfig_Get(\"home\") ` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 msgid "PyEval_InitThreads()" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 msgid "modules (in module sys)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 ../../c-api/interp-lifecycle.rst:749 msgid "path (in module sys)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 ../../c-api/interp-lifecycle.rst:749 msgid "module" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 msgid "builtins" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 msgid "__main__" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 msgid "sys" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 ../../c-api/interp-lifecycle.rst:749 msgid "search" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 ../../c-api/interp-lifecycle.rst:749 msgid "path" msgstr "" +#: ../../c-api/interp-lifecycle.rst:357 msgid "Py_FinalizeEx (C function)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:608 msgid "Py_Initialize()" msgstr "" +#: ../../c-api/interp-lifecycle.rst:608 ../../c-api/interp-lifecycle.rst:847 msgid "main()" msgstr "" +#: ../../c-api/interp-lifecycle.rst:608 msgid "Py_GetPath()" msgstr "" +#: ../../c-api/interp-lifecycle.rst:727 msgid "executable (in module sys)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:782 ../../c-api/interp-lifecycle.rst:824 +#: ../../c-api/interp-lifecycle.rst:838 msgid "version (in module sys)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:794 msgid "platform (in module sys)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:811 msgid "copyright (in module sys)" msgstr "" +#: ../../c-api/interp-lifecycle.rst:847 msgid "Py_FatalError()" msgstr "" +#: ../../c-api/interp-lifecycle.rst:847 msgid "argv (in module sys)" msgstr "" diff --git a/c-api/intro.po b/c-api/intro.po index 7a4412379..00d9e5d2b 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,92 +24,197 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/intro.rst:8 msgid "Introduction" msgstr "" -msgid "The Application Programmer's Interface to Python gives C and C++ programmers access to the Python interpreter at a variety of levels. The API is equally usable from C++, but for brevity it is generally referred to as the Python/C API. There are two fundamentally different reasons for using the Python/C API. The first reason is to write *extension modules* for specific purposes; these are C modules that extend the Python interpreter. This is probably the most common use. The second reason is to use Python as a component in a larger application; this technique is generally referred to as :dfn:`embedding` Python in an application." -msgstr "" - -msgid "Writing an extension module is a relatively well-understood process, where a \"cookbook\" approach works well. There are several tools that automate the process to some extent. While people have embedded Python in other applications since its early existence, the process of embedding Python is less straightforward than writing an extension." +#: ../../c-api/intro.rst:10 +msgid "" +"The Application Programmer's Interface to Python gives C and C++ programmers " +"access to the Python interpreter at a variety of levels. The API is equally " +"usable from C++, but for brevity it is generally referred to as the Python/C " +"API. There are two fundamentally different reasons for using the Python/C " +"API. The first reason is to write *extension modules* for specific purposes; " +"these are C modules that extend the Python interpreter. This is probably " +"the most common use. The second reason is to use Python as a component in a " +"larger application; this technique is generally referred to " +"as :dfn:`embedding` Python in an application." +msgstr "" + +#: ../../c-api/intro.rst:20 +msgid "" +"Writing an extension module is a relatively well-understood process, where a " +"\"cookbook\" approach works well. There are several tools that automate the " +"process to some extent. While people have embedded Python in other " +"applications since its early existence, the process of embedding Python is " +"less straightforward than writing an extension." msgstr "" -msgid "Many API functions are useful independent of whether you're embedding or extending Python; moreover, most applications that embed Python will need to provide a custom extension as well, so it's probably a good idea to become familiar with writing an extension before attempting to embed Python in a real application." +#: ../../c-api/intro.rst:26 +msgid "" +"Many API functions are useful independent of whether you're embedding or " +"extending Python; moreover, most applications that embed Python will need " +"to provide a custom extension as well, so it's probably a good idea to " +"become familiar with writing an extension before attempting to embed Python " +"in a real application." msgstr "" +#: ../../c-api/intro.rst:34 msgid "Language version compatibility" msgstr "" +#: ../../c-api/intro.rst:36 msgid "Python's C API is compatible with C11 and C++11 versions of C and C++." msgstr "" -msgid "This is a lower limit: the C API does not require features from later C/C++ versions. You do *not* need to enable your compiler's \"c11 mode\"." +#: ../../c-api/intro.rst:38 +msgid "" +"This is a lower limit: the C API does not require features from later C/C++ " +"versions. You do *not* need to enable your compiler's \"c11 mode\"." msgstr "" +#: ../../c-api/intro.rst:44 msgid "Coding standards" msgstr "" -msgid "If you're writing C code for inclusion in CPython, you **must** follow the guidelines and standards defined in :PEP:`7`. These guidelines apply regardless of the version of Python you are contributing to. Following these conventions is not necessary for your own third party extension modules, unless you eventually expect to contribute them to Python." +#: ../../c-api/intro.rst:46 +msgid "" +"If you're writing C code for inclusion in CPython, you **must** follow the " +"guidelines and standards defined in :PEP:`7`. These guidelines apply " +"regardless of the version of Python you are contributing to. Following " +"these conventions is not necessary for your own third party extension " +"modules, unless you eventually expect to contribute them to Python." msgstr "" +#: ../../c-api/intro.rst:56 msgid "Include Files" msgstr "" -msgid "All function, type and macro definitions needed to use the Python/C API are included in your code by the following line::" +#: ../../c-api/intro.rst:58 +msgid "" +"All function, type and macro definitions needed to use the Python/C API are " +"included in your code by the following line::" msgstr "" +#: ../../c-api/intro.rst:61 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " msgstr "" -msgid "This implies inclusion of the following standard headers: ````, ````, ````, ````, ```` and ```` (if available)." +#: ../../c-api/intro.rst:64 +msgid "" +"This implies inclusion of the following standard headers: ````, " +"````, ````, ````, ```` and " +"```` (if available)." msgstr "" -msgid "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you *must* include :file:`Python.h` before any standard headers are included." +#: ../../c-api/intro.rst:70 +msgid "" +"Since Python may define some pre-processor definitions which affect the " +"standard headers on some systems, you *must* include :file:`Python.h` before " +"any standard headers are included." msgstr "" -msgid "It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including ``Python.h``. See :ref:`arg-parsing` for a description of this macro." +#: ../../c-api/intro.rst:74 +msgid "" +"It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including " +"``Python.h``. See :ref:`arg-parsing` for a description of this macro." msgstr "" -msgid "All user visible names defined by Python.h (except those defined by the included standard headers) have one of the prefixes ``Py`` or ``_Py``. Names beginning with ``_Py`` are for internal use by the Python implementation and should not be used by extension writers. Structure member names do not have a reserved prefix." +#: ../../c-api/intro.rst:77 +msgid "" +"All user visible names defined by Python.h (except those defined by the " +"included standard headers) have one of the prefixes ``Py`` or ``_Py``. " +"Names beginning with ``_Py`` are for internal use by the Python " +"implementation and should not be used by extension writers. Structure member " +"names do not have a reserved prefix." msgstr "" -msgid "User code should never define names that begin with ``Py`` or ``_Py``. This confuses the reader, and jeopardizes the portability of the user code to future Python versions, which may define additional names beginning with one of these prefixes." +#: ../../c-api/intro.rst:84 +msgid "" +"User code should never define names that begin with ``Py`` or ``_Py``. This " +"confuses the reader, and jeopardizes the portability of the user code to " +"future Python versions, which may define additional names beginning with one " +"of these prefixes." msgstr "" -msgid "The header files are typically installed with Python. On Unix, these are located in the directories :file:`{prefix}/include/pythonversion/` and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding parameters to Python's :program:`configure` script and *version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers are installed in :file:`{prefix}/include`, where ``prefix`` is the installation directory specified to the installer." +#: ../../c-api/intro.rst:89 +msgid "" +"The header files are typically installed with Python. On Unix, these are " +"located in the directories :file:`{prefix}/include/pythonversion/` " +"and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--" +"prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the " +"corresponding parameters to Python's :program:`configure` script and " +"*version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers " +"are installed in :file:`{prefix}/include`, where ``prefix`` is the " +"installation directory specified to the installer." msgstr "" -msgid "To include the headers, place both directories (if different) on your compiler's search path for includes. Do *not* place the parent directories on the search path and then use ``#include ``; this will break on multi-platform builds since the platform independent headers under :option:`prefix <--prefix>` include the platform specific headers from :option:`exec_prefix <--exec-prefix>`." +#: ../../c-api/intro.rst:98 +msgid "" +"To include the headers, place both directories (if different) on your " +"compiler's search path for includes. Do *not* place the parent directories " +"on the search path and then use ``#include ``; this will " +"break on multi-platform builds since the platform independent headers " +"under :option:`prefix <--prefix>` include the platform specific headers " +"from :option:`exec_prefix <--exec-prefix>`." msgstr "" -msgid "C++ users should note that although the API is defined entirely using C, the header files properly declare the entry points to be ``extern \"C\"``. As a result, there is no need to do anything special to use the API from C++." +#: ../../c-api/intro.rst:105 +msgid "" +"C++ users should note that although the API is defined entirely using C, the " +"header files properly declare the entry points to be ``extern \"C\"``. As a " +"result, there is no need to do anything special to use the API from C++." msgstr "" +#: ../../c-api/intro.rst:111 msgid "Useful macros" msgstr "" -msgid "Several useful macros are defined in the Python header files. Many are defined closer to where they are useful (for example, :c:macro:`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a more general utility are defined here. This is not necessarily a complete listing." +#: ../../c-api/intro.rst:113 +msgid "" +"Several useful macros are defined in the Python header files. Many are " +"defined closer to where they are useful (for " +"example, :c:macro:`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a " +"more general utility are defined here. This is not necessarily a complete " +"listing." msgstr "" -msgid "If this macro is defined, then the current system is able to start threads." +#: ../../c-api/intro.rst:121 +msgid "" +"If this macro is defined, then the current system is able to start threads." msgstr "" -msgid "Currently, all systems supported by CPython (per :pep:`11`), with the exception of some WebAssembly platforms, support starting threads." +#: ../../c-api/intro.rst:123 +msgid "" +"Currently, all systems supported by CPython (per :pep:`11`), with the " +"exception of some WebAssembly platforms, support starting threads." msgstr "" -msgid "Like :samp:`getenv({s})`, but returns ``NULL`` if :option:`-E` was passed on the command line (see :c:member:`PyConfig.use_environment`)." +#: ../../c-api/intro.rst:130 +msgid "" +"Like :samp:`getenv({s})`, but returns ``NULL`` if :option:`-E` was passed on " +"the command line (see :c:member:`PyConfig.use_environment`)." msgstr "" +#: ../../c-api/intro.rst:135 msgid "Docstring macros" msgstr "" -msgid "Creates a variable with name *name* that can be used in docstrings. If Python is built without docstrings (:option:`--without-doc-strings`), the value will be an empty string." +#: ../../c-api/intro.rst:139 +msgid "" +"Creates a variable with name *name* that can be used in docstrings. If " +"Python is built without docstrings (:option:`--without-doc-strings`), the " +"value will be an empty string." msgstr "" +#: ../../c-api/intro.rst:143 ../../c-api/intro.rst:160 +#: ../../c-api/intro.rst:428 msgid "Example::" msgstr "" +#: ../../c-api/intro.rst:145 msgid "" "PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n" "\n" @@ -120,12 +225,17 @@ msgid "" "}" msgstr "" +#: ../../c-api/intro.rst:153 msgid "Expands to :samp:`PyDoc_VAR({name}) = PyDoc_STR({str})`." msgstr "" -msgid "Expands to the given input string, or an empty string if docstrings are disabled (:option:`--without-doc-strings`)." +#: ../../c-api/intro.rst:157 +msgid "" +"Expands to the given input string, or an empty string if docstrings are " +"disabled (:option:`--without-doc-strings`)." msgstr "" +#: ../../c-api/intro.rst:162 msgid "" "static PyMethodDef pysqlite_row_methods[] = {\n" " {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n" @@ -134,299 +244,626 @@ msgid "" "};" msgstr "" -msgid "Declares a static character array variable with the given *name*. Expands to :samp:`static const char {name}[]`" +#: ../../c-api/intro.rst:170 +msgid "" +"Declares a static character array variable with the given *name*. Expands " +"to :samp:`static const char {name}[]`" msgstr "" +#: ../../c-api/intro.rst:173 ../../c-api/intro.rst:314 +#: ../../c-api/intro.rst:325 msgid "For example::" msgstr "" +#: ../../c-api/intro.rst:175 msgid "" "PyDoc_VAR(python_doc) = PyDoc_STR(\n" " \"A genus of constricting snakes in the Pythonidae family native \"\n" " \"to the tropics and subtropics of the Eastern Hemisphere.\");" msgstr "" +#: ../../c-api/intro.rst:181 msgid "General utility macros" msgstr "" +#: ../../c-api/intro.rst:183 msgid "The following macros are for common tasks not specific to Python." msgstr "" -msgid "Use this for unused arguments in a function definition to silence compiler warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." +#: ../../c-api/intro.rst:187 +msgid "" +"Use this for unused arguments in a function definition to silence compiler " +"warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." msgstr "" -msgid "Use a GCC attribute *name*, hiding it from compilers that don't support GCC attributes (such as MSVC)." +#: ../../c-api/intro.rst:194 +msgid "" +"Use a GCC attribute *name*, hiding it from compilers that don't support GCC " +"attributes (such as MSVC)." msgstr "" -msgid "This expands to :samp:`__attribute__(({name)})` on a GCC compiler, and expands to nothing on compilers that don't support GCC attributes." +#: ../../c-api/intro.rst:197 +msgid "" +"This expands to :samp:`__attribute__(({name)})` on a GCC compiler, and " +"expands to nothing on compilers that don't support GCC attributes." msgstr "" +#: ../../c-api/intro.rst:202 msgid "Numeric utilities" msgstr "" +#: ../../c-api/intro.rst:206 msgid "Return the absolute value of ``x``." msgstr "" -msgid "The argument may be evaluated more than once. Consequently, do not pass an expression with side-effects directly to this macro." +#: ../../c-api/intro.rst:208 +msgid "" +"The argument may be evaluated more than once. Consequently, do not pass an " +"expression with side-effects directly to this macro." msgstr "" -msgid "If the result cannot be represented (for example, if ``x`` has :c:macro:`!INT_MIN` value for :c:expr:`int` type), the behavior is undefined." +#: ../../c-api/intro.rst:212 +msgid "" +"If the result cannot be represented (for example, if ``x`` has :c:macro:`!" +"INT_MIN` value for :c:expr:`int` type), the behavior is undefined." msgstr "" +#: ../../c-api/intro.rst:216 msgid "Corresponds roughly to :samp:`(({x}) < 0 ? -({x}) : ({x}))`" msgstr "" +#: ../../c-api/intro.rst:223 msgid "Return the larger or smaller of the arguments, respectively." msgstr "" -msgid "Any arguments may be evaluated more than once. Consequently, do not pass an expression with side-effects directly to this macro." +#: ../../c-api/intro.rst:225 +msgid "" +"Any arguments may be evaluated more than once. Consequently, do not pass an " +"expression with side-effects directly to this macro." msgstr "" -msgid ":c:macro:`!Py_MAX` corresponds roughly to :samp:`((({x}) > ({y})) ? ({x}) : ({y}))`." +#: ../../c-api/intro.rst:229 +msgid "" +":c:macro:`!Py_MAX` corresponds roughly to :samp:`((({x}) > ({y})) ? ({x}) : " +"({y}))`." msgstr "" -msgid "Similar to :samp:`{integer} >> {positions}`, but forces sign extension, as the C standard does not define whether a right-shift of a signed integer will perform sign extension or a zero-fill." +#: ../../c-api/intro.rst:236 +msgid "" +"Similar to :samp:`{integer} >> {positions}`, but forces sign extension, as " +"the C standard does not define whether a right-shift of a signed integer " +"will perform sign extension or a zero-fill." msgstr "" -msgid "*integer* should be any signed integer type. *positions* is the number of positions to shift to the right." +#: ../../c-api/intro.rst:240 +msgid "" +"*integer* should be any signed integer type. *positions* is the number of " +"positions to shift to the right." msgstr "" -msgid "Both *integer* and *positions* can be evaluated more than once; consequently, avoid directly passing a function call or some other operation with side-effects to this macro. Instead, store the result as a variable and then pass it." +#: ../../c-api/intro.rst:243 +msgid "" +"Both *integer* and *positions* can be evaluated more than once; " +"consequently, avoid directly passing a function call or some other operation " +"with side-effects to this macro. Instead, store the result as a variable and " +"then pass it." msgstr "" -msgid "*type* is unused and only kept for backwards compatibility. Historically, *type* was used to cast *integer*." +#: ../../c-api/intro.rst:248 +msgid "" +"*type* is unused and only kept for backwards compatibility. Historically, " +"*type* was used to cast *integer*." msgstr "" -msgid "This macro is now valid for all signed integer types, not just those for which ``unsigned type`` is legal. As a result, *type* is no longer used." +#: ../../c-api/intro.rst:253 +msgid "" +"This macro is now valid for all signed integer types, not just those for " +"which ``unsigned type`` is legal. As a result, *type* is no longer used." msgstr "" -msgid "Argument must be a character or an integer in the range [-128, 127] or [0, 255]. This macro returns ``c`` cast to an ``unsigned char``." +#: ../../c-api/intro.rst:259 +msgid "" +"Argument must be a character or an integer in the range [-128, 127] or [0, " +"255]. This macro returns ``c`` cast to an ``unsigned char``." msgstr "" +#: ../../c-api/intro.rst:264 msgid "Assertion utilities" msgstr "" -msgid "Use this when you have a code path that cannot be reached by design. For example, in the ``default:`` clause in a ``switch`` statement for which all possible values are covered in ``case`` statements. Use this in places where you might be tempted to put an ``assert(0)`` or ``abort()`` call." +#: ../../c-api/intro.rst:268 +msgid "" +"Use this when you have a code path that cannot be reached by design. For " +"example, in the ``default:`` clause in a ``switch`` statement for which all " +"possible values are covered in ``case`` statements. Use this in places " +"where you might be tempted to put an ``assert(0)`` or ``abort()`` call." msgstr "" -msgid "In release mode, the macro helps the compiler to optimize the code, and avoids a warning about unreachable code. For example, the macro is implemented with ``__builtin_unreachable()`` on GCC in release mode." +#: ../../c-api/intro.rst:273 +msgid "" +"In release mode, the macro helps the compiler to optimize the code, and " +"avoids a warning about unreachable code. For example, the macro is " +"implemented with ``__builtin_unreachable()`` on GCC in release mode." msgstr "" -msgid "In debug mode, and on unsupported compilers, the macro expands to a call to :c:func:`Py_FatalError`." +#: ../../c-api/intro.rst:277 +msgid "" +"In debug mode, and on unsupported compilers, the macro expands to a call " +"to :c:func:`Py_FatalError`." msgstr "" -msgid "A use for ``Py_UNREACHABLE()`` is following a call to a function that never returns but that is not declared ``_Noreturn``." +#: ../../c-api/intro.rst:280 +msgid "" +"A use for ``Py_UNREACHABLE()`` is following a call to a function that never " +"returns but that is not declared ``_Noreturn``." msgstr "" -msgid "If a code path is very unlikely code but can be reached under exceptional case, this macro must not be used. For example, under low memory condition or if a system call returns a value out of the expected range. In this case, it's better to report the error to the caller. If the error cannot be reported to caller, :c:func:`Py_FatalError` can be used." +#: ../../c-api/intro.rst:283 +msgid "" +"If a code path is very unlikely code but can be reached under exceptional " +"case, this macro must not be used. For example, under low memory condition " +"or if a system call returns a value out of the expected range. In this " +"case, it's better to report the error to the caller. If the error cannot be " +"reported to caller, :c:func:`Py_FatalError` can be used." msgstr "" -msgid "Cast *value* to type *smaller* from type *larger*, validating that no information was lost." +#: ../../c-api/intro.rst:293 +msgid "" +"Cast *value* to type *smaller* from type *larger*, validating that no " +"information was lost." msgstr "" -msgid "On release builds of Python, this is roughly equivalent to :samp:`(({smaller}) {value})` (in C++, :samp:`static_cast<{smaller}>({value})` will be used instead)." +#: ../../c-api/intro.rst:296 +msgid "" +"On release builds of Python, this is roughly equivalent " +"to :samp:`(({smaller}) {value})` (in C++, :samp:`static_cast<{smaller}" +">({value})` will be used instead)." msgstr "" -msgid "On debug builds (implying that :c:macro:`Py_DEBUG` is defined), this asserts that no information was lost with the cast from *larger* to *smaller*." +#: ../../c-api/intro.rst:300 +msgid "" +"On debug builds (implying that :c:macro:`Py_DEBUG` is defined), this asserts " +"that no information was lost with the cast from *larger* to *smaller*." msgstr "" -msgid "*value*, *larger*, and *smaller* may all be evaluated more than once in the expression; consequently, do not pass an expression with side-effects directly to this macro." +#: ../../c-api/intro.rst:303 +msgid "" +"*value*, *larger*, and *smaller* may all be evaluated more than once in the " +"expression; consequently, do not pass an expression with side-effects " +"directly to this macro." msgstr "" -msgid "Asserts a compile-time condition *cond*, as a statement. The build will fail if the condition is false or cannot be evaluated at compile time." +#: ../../c-api/intro.rst:309 +msgid "" +"Asserts a compile-time condition *cond*, as a statement. The build will fail " +"if the condition is false or cannot be evaluated at compile time." msgstr "" +#: ../../c-api/intro.rst:312 msgid "Corresponds roughly to :samp:`static_assert({cond})` on C23 and above." msgstr "" +#: ../../c-api/intro.rst:316 msgid "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));" msgstr "" -msgid "Asserts a compile-time condition *cond*, as an expression that evaluates to ``0``. The build will fail if the condition is false or cannot be evaluated at compile time." +#: ../../c-api/intro.rst:322 +msgid "" +"Asserts a compile-time condition *cond*, as an expression that evaluates to " +"``0``. The build will fail if the condition is false or cannot be evaluated " +"at compile time." msgstr "" +#: ../../c-api/intro.rst:327 msgid "" "#define foo_to_char(foo) \\\n" " ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))" msgstr "" +#: ../../c-api/intro.rst:334 msgid "Type size utilities" msgstr "" +#: ../../c-api/intro.rst:338 msgid "Compute the length of a statically allocated C array at compile time." msgstr "" -msgid "The *array* argument must be a C array with a size known at compile time. Passing an array with an unknown size, such as a heap-allocated array, will result in a compilation error on some compilers, or otherwise produce incorrect results." +#: ../../c-api/intro.rst:340 +msgid "" +"The *array* argument must be a C array with a size known at compile time. " +"Passing an array with an unknown size, such as a heap-allocated array, will " +"result in a compilation error on some compilers, or otherwise produce " +"incorrect results." msgstr "" +#: ../../c-api/intro.rst:345 msgid "This is roughly equivalent to::" msgstr "" +#: ../../c-api/intro.rst:347 msgid "sizeof(array) / sizeof((array)[0])" msgstr "" +#: ../../c-api/intro.rst:351 msgid "Return the size of a structure (*type*) *member* in bytes." msgstr "" +#: ../../c-api/intro.rst:353 msgid "Corresponds roughly to :samp:`sizeof((({type} *)NULL)->{member})`." msgstr "" +#: ../../c-api/intro.rst:359 msgid "Macro definition utilities" msgstr "" -msgid "This is equivalent to :samp:`{X}`, which is useful for token-pasting in macros, as macro expansions in *X* are forcefully evaluated by the preprocessor." +#: ../../c-api/intro.rst:363 +msgid "" +"This is equivalent to :samp:`{X}`, which is useful for token-pasting in " +"macros, as macro expansions in *X* are forcefully evaluated by the " +"preprocessor." msgstr "" -msgid "Convert ``x`` to a C string. For example, ``Py_STRINGIFY(123)`` returns ``\"123\"``." +#: ../../c-api/intro.rst:369 +msgid "" +"Convert ``x`` to a C string. For example, ``Py_STRINGIFY(123)`` returns " +"``\"123\"``." msgstr "" +#: ../../c-api/intro.rst:376 msgid "Declaration utilities" msgstr "" -msgid "The following macros can be used in declarations. They are most useful for defining the C API itself, and have limited use for extension authors. Most of them expand to compiler-specific spellings of common extensions to the C language." +#: ../../c-api/intro.rst:378 +msgid "" +"The following macros can be used in declarations. They are most useful for " +"defining the C API itself, and have limited use for extension authors. Most " +"of them expand to compiler-specific spellings of common extensions to the C " +"language." msgstr "" -msgid "Ask the compiler to always inline a static inline function. The compiler can ignore it and decide to not inline the function." +#: ../../c-api/intro.rst:386 +msgid "" +"Ask the compiler to always inline a static inline function. The compiler can " +"ignore it and decide to not inline the function." msgstr "" -msgid "Corresponds to ``always_inline`` attribute in GCC and ``__forceinline`` in MSVC." +#: ../../c-api/intro.rst:389 +msgid "" +"Corresponds to ``always_inline`` attribute in GCC and ``__forceinline`` in " +"MSVC." msgstr "" -msgid "It can be used to inline performance critical static inline functions when building Python in debug mode with function inlining disabled. For example, MSC disables function inlining when building in debug mode." +#: ../../c-api/intro.rst:392 +msgid "" +"It can be used to inline performance critical static inline functions when " +"building Python in debug mode with function inlining disabled. For example, " +"MSC disables function inlining when building in debug mode." msgstr "" -msgid "Marking blindly a static inline function with Py_ALWAYS_INLINE can result in worse performances (due to increased code size for example). The compiler is usually smarter than the developer for the cost/benefit analysis." +#: ../../c-api/intro.rst:396 +msgid "" +"Marking blindly a static inline function with Py_ALWAYS_INLINE can result in " +"worse performances (due to increased code size for example). The compiler is " +"usually smarter than the developer for the cost/benefit analysis." msgstr "" -msgid "If Python is :ref:`built in debug mode ` (if the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does nothing." +#: ../../c-api/intro.rst:400 +msgid "" +"If Python is :ref:`built in debug mode ` (if " +"the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` " +"macro does nothing." msgstr "" +#: ../../c-api/intro.rst:403 msgid "It must be specified before the function return type. Usage::" msgstr "" +#: ../../c-api/intro.rst:405 msgid "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" msgstr "" -msgid "Disable inlining on a function. For example, it reduces the C stack consumption: useful on LTO+PGO builds which heavily inline code (see :issue:`33720`)." +#: ../../c-api/intro.rst:411 +msgid "" +"Disable inlining on a function. For example, it reduces the C stack " +"consumption: useful on LTO+PGO builds which heavily inline code " +"(see :issue:`33720`)." msgstr "" -msgid "Corresponds to the ``noinline`` attribute/specification on GCC and MSVC." +#: ../../c-api/intro.rst:415 +msgid "" +"Corresponds to the ``noinline`` attribute/specification on GCC and MSVC." msgstr "" +#: ../../c-api/intro.rst:417 msgid "Usage::" msgstr "" +#: ../../c-api/intro.rst:419 msgid "Py_NO_INLINE static int random(void) { return 4; }" msgstr "" -msgid "Use this to declare APIs that were deprecated in a specific CPython version. The macro must be placed before the symbol name." +#: ../../c-api/intro.rst:425 +msgid "" +"Use this to declare APIs that were deprecated in a specific CPython version. " +"The macro must be placed before the symbol name." msgstr "" +#: ../../c-api/intro.rst:430 msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" msgstr "" +#: ../../c-api/intro.rst:432 msgid "MSVC support was added." msgstr "" -msgid "Declare a function returning the specified *type* using a fast-calling qualifier for functions that are local to the current file. Semantically, this is equivalent to :samp:`static {type}`." +#: ../../c-api/intro.rst:437 +msgid "" +"Declare a function returning the specified *type* using a fast-calling " +"qualifier for functions that are local to the current file. Semantically, " +"this is equivalent to :samp:`static {type}`." msgstr "" -msgid "Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function be inlined." +#: ../../c-api/intro.rst:443 +msgid "" +"Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function be " +"inlined." msgstr "" -msgid "Macro used to declare a symbol as local to the shared library (hidden). On supported platforms, it ensures the symbol is not exported." +#: ../../c-api/intro.rst:448 +msgid "" +"Macro used to declare a symbol as local to the shared library (hidden). On " +"supported platforms, it ensures the symbol is not exported." msgstr "" -msgid "On compatible versions of GCC/Clang, it expands to ``__attribute__((visibility(\"hidden\")))``." +#: ../../c-api/intro.rst:451 +msgid "" +"On compatible versions of GCC/Clang, it expands to " +"``__attribute__((visibility(\"hidden\")))``." msgstr "" -msgid "Macro used to declare a symbol (function or data) as exported. On Windows, this expands to ``__declspec(dllexport)``. On compatible versions of GCC/Clang, it expands to ``__attribute__((visibility(\"default\")))``. This macro is for defining the C API itself; extension modules should not use it." +#: ../../c-api/intro.rst:456 +msgid "" +"Macro used to declare a symbol (function or data) as exported. On Windows, " +"this expands to ``__declspec(dllexport)``. On compatible versions of GCC/" +"Clang, it expands to ``__attribute__((visibility(\"default\")))``. This " +"macro is for defining the C API itself; extension modules should not use it." msgstr "" -msgid "Macro used to declare a symbol as imported. On Windows, this expands to ``__declspec(dllimport)``. This macro is for defining the C API itself; extension modules should not use it." +#: ../../c-api/intro.rst:465 +msgid "" +"Macro used to declare a symbol as imported. On Windows, this expands to " +"``__declspec(dllimport)``. This macro is for defining the C API itself; " +"extension modules should not use it." msgstr "" -msgid "Macro used by CPython to declare a function as part of the C API. Its expansion depends on the platform and build configuration. This macro is intended for defining CPython's C API itself; extension modules should not use it for their own symbols." +#: ../../c-api/intro.rst:472 +msgid "" +"Macro used by CPython to declare a function as part of the C API. Its " +"expansion depends on the platform and build configuration. This macro is " +"intended for defining CPython's C API itself; extension modules should not " +"use it for their own symbols." msgstr "" -msgid "Macro used by CPython to declare a public global variable as part of the C API. Its expansion depends on the platform and build configuration. This macro is intended for defining CPython's C API itself; extension modules should not use it for their own symbols." +#: ../../c-api/intro.rst:480 +msgid "" +"Macro used by CPython to declare a public global variable as part of the C " +"API. Its expansion depends on the platform and build configuration. This " +"macro is intended for defining CPython's C API itself; extension modules " +"should not use it for their own symbols." msgstr "" +#: ../../c-api/intro.rst:487 msgid "Outdated macros" msgstr "" -msgid "The following macros have been used to features that have been standardized in C11." +#: ../../c-api/intro.rst:489 +msgid "" +"The following macros have been used to features that have been standardized " +"in C11." msgstr "" +#: ../../c-api/intro.rst:494 msgid "Specify alignment to *num* bytes on compilers that support it." msgstr "" +#: ../../c-api/intro.rst:496 msgid "Consider using the C11 standard ``_Alignas`` specifier over this macro." msgstr "" -msgid "Use *number* as a ``long long`` or ``unsigned long long`` integer literal, respectively." +#: ../../c-api/intro.rst:501 +msgid "" +"Use *number* as a ``long long`` or ``unsigned long long`` integer literal, " +"respectively." msgstr "" -msgid "Expands to *number* followed by ``LL`` or ``LLU``, respectively, but will expand to some compiler-specific suffixes on some older compilers." +#: ../../c-api/intro.rst:504 +msgid "" +"Expands to *number* followed by ``LL`` or ``LLU``, respectively, but will " +"expand to some compiler-specific suffixes on some older compilers." msgstr "" +#: ../../c-api/intro.rst:507 msgid "Consider using the C99 standard suffixes ``LL`` and ``LLU`` directly." msgstr "" -msgid "This is a :term:`soft deprecated` alias to :c:func:`!memcpy`. Use :c:func:`!memcpy` directly instead." +#: ../../c-api/intro.rst:511 +msgid "This is an alias to :c:func:`!memcpy`." msgstr "" -msgid "The macro is :term:`soft deprecated`." +#: ../../c-api/intro.rst:513 +msgid "Use :c:func:`!memcpy` directly instead." msgstr "" -msgid "This is a :term:`soft deprecated` alias to the C99-standard ``va_copy`` function." +#: ../../c-api/intro.rst:518 +msgid "This is an alias to the C99-standard ``va_copy`` function." msgstr "" -msgid "Historically, this would use a compiler-specific method to copy a ``va_list``." +#: ../../c-api/intro.rst:520 +msgid "" +"Historically, this would use a compiler-specific method to copy a " +"``va_list``." msgstr "" +#: ../../c-api/intro.rst:522 msgid "This is now an alias to ``va_copy``." msgstr "" +#: ../../c-api/intro.rst:531 msgid "Objects, Types and Reference Counts" msgstr "" -msgid "Most Python/C API functions have one or more arguments as well as a return value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data type representing an arbitrary Python object. Since all Python object types are treated the same way by the Python language in most situations (e.g., assignments, scope rules, and argument passing), it is only fitting that they should be represented by a single C type. Almost all Python objects live on the heap: you never declare an automatic or static variable of type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can be declared. The sole exception are the type objects; since these must never be deallocated, they are typically static :c:type:`PyTypeObject` objects." -msgstr "" - -msgid "All Python objects (even Python integers) have a :dfn:`type` and a :dfn:`reference count`. An object's type determines what kind of object it is (e.g., an integer, a list, or a user-defined function; there are many more as explained in :ref:`types`). For each of the well-known types there is a macro to check whether an object is of that type; for instance, ``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is a Python list." +#: ../../c-api/intro.rst:535 +msgid "" +"Most Python/C API functions have one or more arguments as well as a return " +"value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " +"type representing an arbitrary Python object. Since all Python object types " +"are treated the same way by the Python language in most situations (e.g., " +"assignments, scope rules, and argument passing), it is only fitting that " +"they should be represented by a single C type. Almost all Python objects " +"live on the heap: you never declare an automatic or static variable of " +"type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` " +"can be declared. The sole exception are the type objects; since these must " +"never be deallocated, they are typically static :c:type:`PyTypeObject` " +"objects." +msgstr "" + +#: ../../c-api/intro.rst:546 +msgid "" +"All Python objects (even Python integers) have a :dfn:`type` and " +"a :dfn:`reference count`. An object's type determines what kind of object " +"it is (e.g., an integer, a list, or a user-defined function; there are many " +"more as explained in :ref:`types`). For each of the well-known types there " +"is a macro to check whether an object is of that type; for instance, " +"``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is " +"a Python list." msgstr "" +#: ../../c-api/intro.rst:557 msgid "Reference Counts" msgstr "" -msgid "The reference count is important because today's computers have a finite (and often severely limited) memory size; it counts how many different places there are that have a :term:`strong reference` to an object. Such a place could be another object, or a global (or static) C variable, or a local variable in some C function. When the last :term:`strong reference` to an object is released (i.e. its reference count becomes zero), the object is deallocated. If it contains references to other objects, those references are released. Those other objects may be deallocated in turn, if there are no more references to them, and so on. (There's an obvious problem with objects that reference each other here; for now, the solution is \"don't do that.\")" -msgstr "" - -msgid "Reference counts are always manipulated explicitly. The normal way is to use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. increment its reference count by one), and :c:func:`Py_DECREF` to release that reference (i.e. decrement the reference count by one). The :c:func:`Py_DECREF` macro is considerably more complex than the incref one, since it must check whether the reference count becomes zero and then cause the object's deallocator to be called. The deallocator is a function pointer contained in the object's type structure. The type-specific deallocator takes care of releasing references for other objects contained in the object if this is a compound object type, such as a list, as well as performing any additional finalization that's needed. There's no chance that the reference count can overflow; at least as many bits are used to hold the reference count as there are distinct memory locations in virtual memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count increment is a simple operation." -msgstr "" - -msgid "It is not necessary to hold a :term:`strong reference` (i.e. increment the reference count) for every local variable that contains a pointer to an object. In theory, the object's reference count goes up by one when the variable is made to point to it and it goes down by one when the variable goes out of scope. However, these two cancel each other out, so at the end the reference count hasn't changed. The only real reason to use the reference count is to prevent the object from being deallocated as long as our variable is pointing to it. If we know that there is at least one other reference to the object that lives at least as long as our variable, there is no need to take a new :term:`strong reference` (i.e. increment the reference count) temporarily. An important situation where this arises is in objects that are passed as arguments to C functions in an extension module that are called from Python; the call mechanism guarantees to hold a reference to every argument for the duration of the call." -msgstr "" - -msgid "However, a common pitfall is to extract an object from a list and hold on to it for a while without taking a new reference. Some other operation might conceivably remove the object from the list, releasing that reference, and possibly deallocating it. The real danger is that innocent-looking operations may invoke arbitrary Python code which could do this; there is a code path which allows control to flow back to the user from a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." +#: ../../c-api/intro.rst:559 +msgid "" +"The reference count is important because today's computers have a finite " +"(and often severely limited) memory size; it counts how many different " +"places there are that have a :term:`strong reference` to an object. Such a " +"place could be another object, or a global (or static) C variable, or a " +"local variable in some C function. When the last :term:`strong reference` to " +"an object is released (i.e. its reference count becomes zero), the object is " +"deallocated. If it contains references to other objects, those references " +"are released. Those other objects may be deallocated in turn, if there are " +"no more references to them, and so on. (There's an obvious problem with " +"objects that reference each other here; for now, the solution is \"don't do " +"that.\")" +msgstr "" + +#: ../../c-api/intro.rst:576 +msgid "" +"Reference counts are always manipulated explicitly. The normal way is to " +"use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " +"increment its reference count by one), and :c:func:`Py_DECREF` to release " +"that reference (i.e. decrement the reference count by one). " +"The :c:func:`Py_DECREF` macro is considerably more complex than the incref " +"one, since it must check whether the reference count becomes zero and then " +"cause the object's deallocator to be called. The deallocator is a function " +"pointer contained in the object's type structure. The type-specific " +"deallocator takes care of releasing references for other objects contained " +"in the object if this is a compound object type, such as a list, as well as " +"performing any additional finalization that's needed. There's no chance " +"that the reference count can overflow; at least as many bits are used to " +"hold the reference count as there are distinct memory locations in virtual " +"memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the " +"reference count increment is a simple operation." +msgstr "" + +#: ../../c-api/intro.rst:592 +msgid "" +"It is not necessary to hold a :term:`strong reference` (i.e. increment the " +"reference count) for every local variable that contains a pointer to an " +"object. In theory, the object's reference count goes up by one when the " +"variable is made to point to it and it goes down by one when the variable " +"goes out of scope. However, these two cancel each other out, so at the end " +"the reference count hasn't changed. The only real reason to use the " +"reference count is to prevent the object from being deallocated as long as " +"our variable is pointing to it. If we know that there is at least one " +"other reference to the object that lives at least as long as our variable, " +"there is no need to take a new :term:`strong reference` (i.e. increment the " +"reference count) temporarily. An important situation where this arises is in " +"objects that are passed as arguments to C functions in an extension module " +"that are called from Python; the call mechanism guarantees to hold a " +"reference to every argument for the duration of the call." +msgstr "" + +#: ../../c-api/intro.rst:608 +msgid "" +"However, a common pitfall is to extract an object from a list and hold on to " +"it for a while without taking a new reference. Some other operation might " +"conceivably remove the object from the list, releasing that reference, and " +"possibly deallocating it. The real danger is that innocent-looking " +"operations may invoke arbitrary Python code which could do this; there is a " +"code path which allows control to flow back to the user from " +"a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" -msgid "A safe approach is to always use the generic operations (functions whose name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or ``PyMapping_``). These operations always create a new :term:`strong reference` (i.e. increment the reference count) of the object they return. This leaves the caller with the responsibility to call :c:func:`Py_DECREF` when they are done with the result; this soon becomes second nature." +#: ../../c-api/intro.rst:616 +msgid "" +"A safe approach is to always use the generic operations (functions whose " +"name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " +"``PyMapping_``). These operations always create a new :term:`strong " +"reference` (i.e. increment the reference count) of the object they return. " +"This leaves the caller with the responsibility to call :c:func:`Py_DECREF` " +"when they are done with the result; this soon becomes second nature." msgstr "" +#: ../../c-api/intro.rst:627 msgid "Reference Count Details" msgstr "" -msgid "The reference count behavior of functions in the Python/C API is best explained in terms of *ownership of references*. Ownership pertains to references, never to objects (objects are not owned: they are always shared). \"Owning a reference\" means being responsible for calling Py_DECREF on it when the reference is no longer needed. Ownership can also be transferred, meaning that the code that receives ownership of the reference then becomes responsible for eventually releasing it by calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or passing on this responsibility (usually to its caller). When a function passes ownership of a reference on to its caller, the caller is said to receive a *new* reference. When no ownership is transferred, the caller is said to *borrow* the reference. Nothing needs to be done for a :term:`borrowed reference`." +#: ../../c-api/intro.rst:629 +msgid "" +"The reference count behavior of functions in the Python/C API is best " +"explained in terms of *ownership of references*. Ownership pertains to " +"references, never to objects (objects are not owned: they are always " +"shared). \"Owning a reference\" means being responsible for calling " +"Py_DECREF on it when the reference is no longer needed. Ownership can also " +"be transferred, meaning that the code that receives ownership of the " +"reference then becomes responsible for eventually releasing it by " +"calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer " +"needed---or passing on this responsibility (usually to its caller). When a " +"function passes ownership of a reference on to its caller, the caller is " +"said to receive a *new* reference. When no ownership is transferred, the " +"caller is said to *borrow* the reference. Nothing needs to be done for " +"a :term:`borrowed reference`." +msgstr "" + +#: ../../c-api/intro.rst:642 +msgid "" +"Conversely, when a calling function passes in a reference to an object, " +"there are two possibilities: the function *steals* a reference to the " +"object, or it does not." msgstr "" -msgid "Conversely, when a calling function passes in a reference to an object, there are two possibilities: the function *steals* a reference to the object, or it does not. *Stealing a reference* means that when you pass a reference to a function, that function assumes that it now owns that reference, and you are not responsible for it any longer." +#: ../../c-api/intro.rst:646 +msgid "" +"*Stealing a reference* means that when you pass a reference to a function, " +"that function assumes that it now owns that reference. Since the new owner " +"can use :c:func:`!Py_DECREF` at its discretion, you (the caller) must not " +"use that reference after the call." msgstr "" -msgid "Few functions steal references; the two notable exceptions are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to the item (but not to the tuple or list into which the item is put!). These functions were designed to steal a reference because of a common idiom for populating a tuple or list with newly created objects; for example, the code to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting about error handling for the moment; a better way to code this is shown below)::" +#: ../../c-api/intro.rst:655 +msgid "" +"Few functions steal references; the two notable exceptions " +"are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a " +"reference to the item (but not to the tuple or list into which the item is " +"put!). These functions were designed to steal a reference because of a " +"common idiom for populating a tuple or list with newly created objects; for " +"example, the code to create the tuple ``(1, 2, \"three\")`` could look like " +"this (forgetting about error handling for the moment; a better way to code " +"this is shown below)::" msgstr "" +#: ../../c-api/intro.rst:663 msgid "" "PyObject *t;\n" "\n" @@ -436,18 +873,39 @@ msgid "" "PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" msgstr "" -msgid "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab another reference before calling the reference-stealing function." +#: ../../c-api/intro.rst:670 +msgid "" +"Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately " +"stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object " +"although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab " +"another reference before calling the reference-stealing function." msgstr "" -msgid "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to do this since tuples are an immutable data type. You should only use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself." +#: ../../c-api/intro.rst:675 +msgid "" +"Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " +"items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " +"do this since tuples are an immutable data type. You should only " +"use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -msgid "Equivalent code for populating a list can be written using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." +#: ../../c-api/intro.rst:680 +msgid "" +"Equivalent code for populating a list can be written " +"using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" -msgid "However, in practice, you will rarely use these ways of creating and populating a tuple or list. There's a generic function, :c:func:`Py_BuildValue`, that can create most common objects from C values, directed by a :dfn:`format string`. For example, the above two blocks of code could be replaced by the following (which also takes care of the error checking)::" +#: ../../c-api/intro.rst:683 +msgid "" +"However, in practice, you will rarely use these ways of creating and " +"populating a tuple or list. There's a generic " +"function, :c:func:`Py_BuildValue`, that can create most common objects from " +"C values, directed by a :dfn:`format string`. For example, the above two " +"blocks of code could be replaced by the following (which also takes care of " +"the error checking)::" msgstr "" +#: ../../c-api/intro.rst:689 msgid "" "PyObject *tuple, *list;\n" "\n" @@ -455,9 +913,18 @@ msgid "" "list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" msgstr "" -msgid "It is much more common to use :c:func:`PyObject_SetItem` and friends with items whose references you are only borrowing, like arguments that were passed in to the function you are writing. In that case, their behaviour regarding references is much saner, since you don't have to take a new reference just so you can give that reference away (\"have it be stolen\"). For example, this function sets all items of a list (actually, any mutable sequence) to a given item::" +#: ../../c-api/intro.rst:694 +msgid "" +"It is much more common to use :c:func:`PyObject_SetItem` and friends with " +"items whose references you are only borrowing, like arguments that were " +"passed in to the function you are writing. In that case, their behaviour " +"regarding references is much saner, since you don't have to take a new " +"reference just so you can give that reference away (\"have it be stolen\"). " +"For example, this function sets all items of a list (actually, any mutable " +"sequence) to a given item::" msgstr "" +#: ../../c-api/intro.rst:701 msgid "" "int\n" "set_all(PyObject *target, PyObject *item)\n" @@ -481,15 +948,38 @@ msgid "" "}" msgstr "" -msgid "The situation is slightly different for function return values. While passing a reference to most functions does not change your ownership responsibilities for that reference, many functions that return a reference to an object give you ownership of the reference. The reason is simple: in many cases, the returned object is created on the fly, and the reference you get is the only reference to the object. Therefore, the generic functions that return object references, like :c:func:`PyObject_GetItem` and :c:func:`PySequence_GetItem`, always return a new reference (the caller becomes the owner of the reference)." -msgstr "" - -msgid "It is important to realize that whether you own a reference returned by a function depends on which function you call only --- *the plumage* (the type of the object passed as an argument to the function) *doesn't enter into it!* Thus, if you extract an item from a list using :c:func:`PyList_GetItem`, you don't own the reference --- but if you obtain the same item from the same list using :c:func:`PySequence_GetItem` (which happens to take exactly the same arguments), you do own a reference to the returned object." +#: ../../c-api/intro.rst:724 +msgid "" +"The situation is slightly different for function return values. While " +"passing a reference to most functions does not change your ownership " +"responsibilities for that reference, many functions that return a reference " +"to an object give you ownership of the reference. The reason is simple: in " +"many cases, the returned object is created on the fly, and the reference " +"you get is the only reference to the object. Therefore, the generic " +"functions that return object references, like :c:func:`PyObject_GetItem` " +"and :c:func:`PySequence_GetItem`, always return a new reference (the caller " +"becomes the owner of the reference)." +msgstr "" + +#: ../../c-api/intro.rst:733 +msgid "" +"It is important to realize that whether you own a reference returned by a " +"function depends on which function you call only --- *the plumage* (the type " +"of the object passed as an argument to the function) *doesn't enter into it!" +"* Thus, if you extract an item from a list using :c:func:`PyList_GetItem`, " +"you don't own the reference --- but if you obtain the same item from the " +"same list using :c:func:`PySequence_GetItem` (which happens to take exactly " +"the same arguments), you do own a reference to the returned object." msgstr "" -msgid "Here is an example of how you could write a function that computes the sum of the items in a list of integers; once using :c:func:`PyList_GetItem`, and once using :c:func:`PySequence_GetItem`. ::" +#: ../../c-api/intro.rst:745 +msgid "" +"Here is an example of how you could write a function that computes the sum " +"of the items in a list of integers; once using :c:func:`PyList_GetItem`, " +"and once using :c:func:`PySequence_GetItem`. ::" msgstr "" +#: ../../c-api/intro.rst:749 msgid "" "long\n" "sum_list(PyObject *list)\n" @@ -514,6 +1004,7 @@ msgid "" "}" msgstr "" +#: ../../c-api/intro.rst:775 msgid "" "long\n" "sum_sequence(PyObject *sequence)\n" @@ -544,39 +1035,118 @@ msgid "" "}" msgstr "" +#: ../../c-api/intro.rst:809 msgid "Types" msgstr "" -msgid "There are few other data types that play a significant role in the Python/C API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A few structure types are used to describe static tables used to list the functions exported by a module or the data attributes of a new object type, and another is used to describe the value of a complex number. These will be discussed together with the functions that use them." +#: ../../c-api/intro.rst:811 +msgid "" +"There are few other data types that play a significant role in the Python/C " +"API; most are simple C types such " +"as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A " +"few structure types are used to describe static tables used to list the " +"functions exported by a module or the data attributes of a new object type, " +"and another is used to describe the value of a complex number. These will " +"be discussed together with the functions that use them." msgstr "" -msgid "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. C99 doesn't define such a thing directly (size_t is an unsigned integral type). See :pep:`353` for details. ``PY_SSIZE_T_MAX`` is the largest positive value of type :c:type:`Py_ssize_t`." +#: ../../c-api/intro.rst:821 +msgid "" +"A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. " +"C99 doesn't define such a thing directly (size_t is an unsigned integral " +"type). See :pep:`353` for details. ``PY_SSIZE_T_MAX`` is the largest " +"positive value of type :c:type:`Py_ssize_t`." msgstr "" +#: ../../c-api/intro.rst:830 msgid "Exceptions" msgstr "" -msgid "The Python programmer only needs to deal with exceptions if specific error handling is required; unhandled exceptions are automatically propagated to the caller, then to the caller's caller, and so on, until they reach the top-level interpreter, where they are reported to the user accompanied by a stack traceback." -msgstr "" - -msgid "For C programmers, however, error checking always has to be explicit. All functions in the Python/C API can raise exceptions, unless an explicit claim is made otherwise in a function's documentation. In general, when a function encounters an error, it sets an exception, discards any object references that it owns, and returns an error indicator. If not documented otherwise, this indicator is either ``NULL`` or ``-1``, depending on the function's return type. A few functions return a Boolean true/false result, with false indicating an error. Very few functions return no explicit error indicator or have an ambiguous return value, and require explicit testing for errors with :c:func:`PyErr_Occurred`. These exceptions are always explicitly documented." -msgstr "" - -msgid "Exception state is maintained in per-thread storage (this is equivalent to using global storage in an unthreaded application). A thread can be in one of two states: an exception has occurred, or not. The function :c:func:`PyErr_Occurred` can be used to check for this: it returns a borrowed reference to the exception type object when an exception has occurred, and ``NULL`` otherwise. There are a number of functions to set the exception state: :c:func:`PyErr_SetString` is the most common (though not the most general) function to set the exception state, and :c:func:`PyErr_Clear` clears the exception state." -msgstr "" - -msgid "The full exception state consists of three objects (all of which can be ``NULL``): the exception type, the corresponding exception value, and the traceback. These have the same meanings as the Python result of ``sys.exc_info()``; however, they are not the same: the Python objects represent the last exception being handled by a Python :keyword:`try` ... :keyword:`except` statement, while the C level exception state only exists while an exception is being passed on between C functions until it reaches the Python bytecode interpreter's main loop, which takes care of transferring it to ``sys.exc_info()`` and friends." -msgstr "" - -msgid "Note that starting with Python 1.5, the preferred, thread-safe way to access the exception state from Python code is to call the function :func:`sys.exc_info`, which returns the per-thread exception state for Python code. Also, the semantics of both ways to access the exception state have changed so that a function which catches an exception will save and restore its thread's exception state so as to preserve the exception state of its caller. This prevents common bugs in exception handling code caused by an innocent-looking function overwriting the exception being handled; it also reduces the often unwanted lifetime extension for objects that are referenced by the stack frames in the traceback." +#: ../../c-api/intro.rst:832 +msgid "" +"The Python programmer only needs to deal with exceptions if specific error " +"handling is required; unhandled exceptions are automatically propagated to " +"the caller, then to the caller's caller, and so on, until they reach the top-" +"level interpreter, where they are reported to the user accompanied by a " +"stack traceback." msgstr "" -msgid "As a general principle, a function that calls another function to perform some task should check whether the called function raised an exception, and if so, pass the exception state on to its caller. It should discard any object references that it owns, and return an error indicator, but it should *not* set another exception --- that would overwrite the exception that was just raised, and lose important information about the exact cause of the error." +#: ../../c-api/intro.rst:840 +msgid "" +"For C programmers, however, error checking always has to be explicit. All " +"functions in the Python/C API can raise exceptions, unless an explicit claim " +"is made otherwise in a function's documentation. In general, when a " +"function encounters an error, it sets an exception, discards any object " +"references that it owns, and returns an error indicator. If not documented " +"otherwise, this indicator is either ``NULL`` or ``-1``, depending on the " +"function's return type. A few functions return a Boolean true/false result, " +"with false indicating an error. Very few functions return no explicit error " +"indicator or have an ambiguous return value, and require explicit testing " +"for errors with :c:func:`PyErr_Occurred`. These exceptions are always " +"explicitly documented." +msgstr "" + +#: ../../c-api/intro.rst:855 +msgid "" +"Exception state is maintained in per-thread storage (this is equivalent to " +"using global storage in an unthreaded application). A thread can be in one " +"of two states: an exception has occurred, or not. The " +"function :c:func:`PyErr_Occurred` can be used to check for this: it returns " +"a borrowed reference to the exception type object when an exception has " +"occurred, and ``NULL`` otherwise. There are a number of functions to set " +"the exception state: :c:func:`PyErr_SetString` is the most common (though " +"not the most general) function to set the exception state, " +"and :c:func:`PyErr_Clear` clears the exception state." +msgstr "" + +#: ../../c-api/intro.rst:865 +msgid "" +"The full exception state consists of three objects (all of which can be " +"``NULL``): the exception type, the corresponding exception value, and the " +"traceback. These have the same meanings as the Python result of " +"``sys.exc_info()``; however, they are not the same: the Python objects " +"represent the last exception being handled by a " +"Python :keyword:`try` ... :keyword:`except` statement, while the C level " +"exception state only exists while an exception is being passed on between C " +"functions until it reaches the Python bytecode interpreter's main loop, " +"which takes care of transferring it to ``sys.exc_info()`` and friends." +msgstr "" + +#: ../../c-api/intro.rst:877 +msgid "" +"Note that starting with Python 1.5, the preferred, thread-safe way to access " +"the exception state from Python code is to call the " +"function :func:`sys.exc_info`, which returns the per-thread exception state " +"for Python code. Also, the semantics of both ways to access the exception " +"state have changed so that a function which catches an exception will save " +"and restore its thread's exception state so as to preserve the exception " +"state of its caller. This prevents common bugs in exception handling code " +"caused by an innocent-looking function overwriting the exception being " +"handled; it also reduces the often unwanted lifetime extension for objects " +"that are referenced by the stack frames in the traceback." +msgstr "" + +#: ../../c-api/intro.rst:888 +msgid "" +"As a general principle, a function that calls another function to perform " +"some task should check whether the called function raised an exception, and " +"if so, pass the exception state on to its caller. It should discard any " +"object references that it owns, and return an error indicator, but it " +"should *not* set another exception --- that would overwrite the exception " +"that was just raised, and lose important information about the exact cause " +"of the error." msgstr "" -msgid "A simple example of detecting exceptions and passing them on is shown in the :c:func:`!sum_sequence` example above. It so happens that this example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code::" +#: ../../c-api/intro.rst:897 +msgid "" +"A simple example of detecting exceptions and passing them on is shown in " +"the :c:func:`!sum_sequence` example above. It so happens that this example " +"doesn't need to clean up any owned references when it detects an error. The " +"following example function shows some error cleanup. First, to remind you " +"why you like Python, we show the equivalent Python code::" msgstr "" +#: ../../c-api/intro.rst:903 msgid "" "def incr_item(dict, key):\n" " try:\n" @@ -586,9 +1156,11 @@ msgid "" " dict[key] = item + 1" msgstr "" +#: ../../c-api/intro.rst:912 msgid "Here is the corresponding C code, in all its glory::" msgstr "" +#: ../../c-api/intro.rst:914 msgid "" "int\n" "incr_item(PyObject *dict, PyObject *key)\n" @@ -634,185 +1206,346 @@ msgid "" "}" msgstr "" -msgid "This example represents an endorsed use of the ``goto`` statement in C! It illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:`PyErr_Clear` to handle specific exceptions, and the use of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a ``NULL`` reference). It is important that the variables used to hold owned references are initialized to ``NULL`` for this to work; likewise, the proposed return value is initialized to ``-1`` (failure) and only set to success after the final call made is successful." -msgstr "" - +#: ../../c-api/intro.rst:964 +msgid "" +"This example represents an endorsed use of the ``goto`` statement in C! It " +"illustrates the use of :c:func:`PyErr_ExceptionMatches` " +"and :c:func:`PyErr_Clear` to handle specific exceptions, and the use " +"of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` " +"(note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when " +"confronted with a ``NULL`` reference). It is important that the variables " +"used to hold owned references are initialized to ``NULL`` for this to work; " +"likewise, the proposed return value is initialized to ``-1`` (failure) and " +"only set to success after the final call made is successful." +msgstr "" + +#: ../../c-api/intro.rst:978 msgid "Embedding Python" msgstr "" -msgid "The one important task that only embedders (as opposed to extension writers) of the Python interpreter have to worry about is the initialization, and possibly the finalization, of the Python interpreter. Most functionality of the interpreter can only be used after the interpreter has been initialized." -msgstr "" - -msgid "The basic initialization function is :c:func:`Py_Initialize`. This initializes the table of loaded modules, and creates the fundamental modules :mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also initializes the module search path (``sys.path``)." -msgstr "" - -msgid ":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys.argv``). If this variable is needed by Python code that will be executed later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python Initialization Configuration `." +#: ../../c-api/intro.rst:980 +msgid "" +"The one important task that only embedders (as opposed to extension writers) " +"of the Python interpreter have to worry about is the initialization, and " +"possibly the finalization, of the Python interpreter. Most functionality of " +"the interpreter can only be used after the interpreter has been initialized." msgstr "" -msgid "On most systems (in particular, on Unix and Windows, although the details are slightly different), :c:func:`Py_Initialize` calculates the module search path based upon its best guess for the location of the standard Python interpreter executable, assuming that the Python library is found in a fixed location relative to the Python interpreter executable. In particular, it looks for a directory named :file:`lib/python{X.Y}` relative to the parent directory where the executable named :file:`python` is found on the shell command search path (the environment variable :envvar:`PATH`)." +#: ../../c-api/intro.rst:993 +msgid "" +"The basic initialization function is :c:func:`Py_Initialize`. This " +"initializes the table of loaded modules, and creates the fundamental " +"modules :mod:`builtins`, :mod:`__main__`, and :mod:`sys`. It also " +"initializes the module search path (``sys.path``)." msgstr "" -msgid "For instance, if the Python executable is found in :file:`/usr/local/bin/python`, it will assume that the libraries are in :file:`/usr/local/lib/python{X.Y}`. (In fact, this particular path is also the \"fallback\" location, used when no executable file named :file:`python` is found along :envvar:`PATH`.) The user can override this behavior by setting the environment variable :envvar:`PYTHONHOME`, or insert additional directories in front of the standard path by setting :envvar:`PYTHONPATH`." +#: ../../c-api/intro.rst:998 +msgid "" +":c:func:`Py_Initialize` does not set the \"script argument list\" " +"(``sys.argv``). If this variable is needed by Python code that will be " +"executed later, setting :c:member:`PyConfig.argv` " +"and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python " +"Initialization Configuration `." msgstr "" -msgid "The embedding application can steer the search by setting :c:member:`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is still inserted in front of the standard path. An application that requires total control has to provide its own implementation of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." +#: ../../c-api/intro.rst:1003 +msgid "" +"On most systems (in particular, on Unix and Windows, although the details " +"are slightly different), :c:func:`Py_Initialize` calculates the module " +"search path based upon its best guess for the location of the standard " +"Python interpreter executable, assuming that the Python library is found in " +"a fixed location relative to the Python interpreter executable. In " +"particular, it looks for a directory named :file:`lib/python{X.Y}` relative " +"to the parent directory where the executable named :file:`python` is found " +"on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -msgid "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the application may want to start over (make another call to :c:func:`Py_Initialize`) or the application is simply done with its use of Python and wants to free memory allocated by Python. This can be accomplished by calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` returns true if Python is currently in the initialized state. More information about these functions is given in a later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python interpreter, e.g. memory allocated by extension modules currently cannot be released." +#: ../../c-api/intro.rst:1012 +msgid "" +"For instance, if the Python executable is found in :file:`/usr/local/bin/" +"python`, it will assume that the libraries are in :file:`/usr/local/lib/" +"python{X.Y}`. (In fact, this particular path is also the \"fallback\" " +"location, used when no executable file named :file:`python` is found " +"along :envvar:`PATH`.) The user can override this behavior by setting the " +"environment variable :envvar:`PYTHONHOME`, or insert additional directories " +"in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" +#: ../../c-api/intro.rst:1026 +msgid "" +"The embedding application can steer the search by " +"setting :c:member:`PyConfig.program_name` *before* " +"calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` " +"still overrides this and :envvar:`PYTHONPATH` is still inserted in front of " +"the standard path. An application that requires total control has to " +"provide its own implementation " +"of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, " +"and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/" +"getpath.c`)." +msgstr "" + +#: ../../c-api/intro.rst:1037 +msgid "" +"Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " +"application may want to start over (make another call " +"to :c:func:`Py_Initialize`) or the application is simply done with its use " +"of Python and wants to free memory allocated by Python. This can be " +"accomplished by calling :c:func:`Py_FinalizeEx`. The " +"function :c:func:`Py_IsInitialized` returns true if Python is currently in " +"the initialized state. More information about these functions is given in a " +"later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all " +"memory allocated by the Python interpreter, e.g. memory allocated by " +"extension modules currently cannot be released." +msgstr "" + +#: ../../c-api/intro.rst:1051 msgid "Debugging Builds" msgstr "" -msgid "Python can be built with several macros to enable extra checks of the interpreter and extension modules. These checks tend to add a large amount of overhead to the runtime so they are not enabled by default." +#: ../../c-api/intro.rst:1053 +msgid "" +"Python can be built with several macros to enable extra checks of the " +"interpreter and extension modules. These checks tend to add a large amount " +"of overhead to the runtime so they are not enabled by default." msgstr "" -msgid "A full list of the various types of debugging builds is in the file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are available that support tracing of reference counts, debugging the memory allocator, or low-level profiling of the main interpreter loop. Only the most frequently used builds will be described in the remainder of this section." +#: ../../c-api/intro.rst:1057 +msgid "" +"A full list of the various types of debugging builds is in the " +"file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. " +"Builds are available that support tracing of reference counts, debugging the " +"memory allocator, or low-level profiling of the main interpreter loop. Only " +"the most frequently used builds will be described in the remainder of this " +"section." msgstr "" -msgid "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined produces what is generally meant by :ref:`a debug build of Python `. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:`--with-pydebug` to the :file:`./configure` command. It is also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is disabled." +#: ../../c-api/intro.rst:1065 +msgid "" +"Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " +"produces what is generally meant by :ref:`a debug build of Python `. :c:macro:`!Py_DEBUG` is enabled in the Unix build by " +"adding :option:`--with-pydebug` to the :file:`./configure` command. It is " +"also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` " +"macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler " +"optimization is disabled." msgstr "" -msgid "In addition to the reference count debugging described below, extra checks are performed, see :ref:`Python Debug Build `." +#: ../../c-api/intro.rst:1073 +msgid "" +"In addition to the reference count debugging described below, extra checks " +"are performed, see :ref:`Python Debug Build `." msgstr "" -msgid "Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:`configure --with-trace-refs option <--with-trace-refs>`). When defined, a circular doubly linked list of active objects is maintained by adding two extra fields to every :c:type:`PyObject`. Total allocations are tracked as well. Upon exit, all existing references are printed. (In interactive mode this happens after every statement run by the interpreter.)" +#: ../../c-api/intro.rst:1076 +msgid "" +"Defining ``Py_TRACE_REFS`` enables reference tracing (see " +"the :option:`configure --with-trace-refs option <--with-trace-refs>`). When " +"defined, a circular doubly linked list of active objects is maintained by " +"adding two extra fields to every :c:type:`PyObject`. Total allocations are " +"tracked as well. Upon exit, all existing references are printed. (In " +"interactive mode this happens after every statement run by the interpreter.)" msgstr "" -msgid "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source distribution for more detailed information." +#: ../../c-api/intro.rst:1083 +msgid "" +"Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " +"distribution for more detailed information." msgstr "" +#: ../../c-api/intro.rst:1090 msgid "Recommended third party tools" msgstr "" -msgid "The following third party tools offer both simpler and more sophisticated approaches to creating C, C++ and Rust extensions for Python:" +#: ../../c-api/intro.rst:1092 +msgid "" +"The following third party tools offer both simpler and more sophisticated " +"approaches to creating C, C++ and Rust extensions for Python:" msgstr "" +#: ../../c-api/intro.rst:1095 msgid "`Cython `_" msgstr "" +#: ../../c-api/intro.rst:1096 msgid "`cffi `_" msgstr "" +#: ../../c-api/intro.rst:1097 msgid "`HPy `_" msgstr "" +#: ../../c-api/intro.rst:1098 msgid "`nanobind `_ (C++)" msgstr "" +#: ../../c-api/intro.rst:1099 msgid "`Numba `_" msgstr "" +#: ../../c-api/intro.rst:1100 msgid "`pybind11 `_ (C++)" msgstr "" +#: ../../c-api/intro.rst:1101 msgid "`PyO3 `_ (Rust)" msgstr "" +#: ../../c-api/intro.rst:1102 msgid "`SWIG `_" msgstr "" -msgid "Using tools such as these can help avoid writing code that is tightly bound to a particular version of CPython, avoid reference counting errors, and focus more on your own code than on using the CPython API. In general, new versions of Python can be supported by updating the tool, and your code will often use newer and more efficient APIs automatically. Some tools also support compiling for other implementations of Python from a single set of sources." +#: ../../c-api/intro.rst:1104 +msgid "" +"Using tools such as these can help avoid writing code that is tightly bound " +"to a particular version of CPython, avoid reference counting errors, and " +"focus more on your own code than on using the CPython API. In general, new " +"versions of Python can be supported by updating the tool, and your code will " +"often use newer and more efficient APIs automatically. Some tools also " +"support compiling for other implementations of Python from a single set of " +"sources." msgstr "" -msgid "These projects are not supported by the same people who maintain Python, and issues need to be raised with the projects directly. Remember to check that the project is still maintained and supported, as the list above may become outdated." +#: ../../c-api/intro.rst:1111 +msgid "" +"These projects are not supported by the same people who maintain Python, and " +"issues need to be raised with the projects directly. Remember to check that " +"the project is still maintained and supported, as the list above may become " +"outdated." msgstr "" -msgid "`Python Packaging User Guide: Binary Extensions `_" +#: ../../c-api/intro.rst:1118 +msgid "" +"`Python Packaging User Guide: Binary Extensions `_" msgstr "" -msgid "The Python Packaging User Guide not only covers several available tools that simplify the creation of binary extensions, but also discusses the various reasons why creating an extension module may be desirable in the first place." +#: ../../c-api/intro.rst:1119 +msgid "" +"The Python Packaging User Guide not only covers several available tools that " +"simplify the creation of binary extensions, but also discusses the various " +"reasons why creating an extension module may be desirable in the first place." msgstr "" +#: ../../c-api/intro.rst:533 msgid "object" msgstr "" +#: ../../c-api/intro.rst:533 msgid "type" msgstr "" +#: ../../c-api/intro.rst:572 msgid "Py_INCREF (C function)" msgstr "" +#: ../../c-api/intro.rst:572 msgid "Py_DECREF (C function)" msgstr "" +#: ../../c-api/intro.rst:651 msgid "PyList_SetItem (C function)" msgstr "" +#: ../../c-api/intro.rst:651 msgid "PyTuple_SetItem (C function)" msgstr "" +#: ../../c-api/intro.rst:722 msgid "set_all()" msgstr "" +#: ../../c-api/intro.rst:741 msgid "PyList_GetItem (C function)" msgstr "" +#: ../../c-api/intro.rst:741 msgid "PySequence_GetItem (C function)" msgstr "" +#: ../../c-api/intro.rst:771 msgid "sum_list()" msgstr "" +#: ../../c-api/intro.rst:803 ../../c-api/intro.rst:895 msgid "sum_sequence()" msgstr "" +#: ../../c-api/intro.rst:838 msgid "PyErr_Occurred (C function)" msgstr "" +#: ../../c-api/intro.rst:851 msgid "PyErr_SetString (C function)" msgstr "" +#: ../../c-api/intro.rst:851 ../../c-api/intro.rst:959 msgid "PyErr_Clear (C function)" msgstr "" +#: ../../c-api/intro.rst:875 msgid "exc_info (in module sys)" msgstr "" +#: ../../c-api/intro.rst:910 ../../c-api/intro.rst:957 msgid "incr_item()" msgstr "" +#: ../../c-api/intro.rst:959 msgid "PyErr_ExceptionMatches (C function)" msgstr "" +#: ../../c-api/intro.rst:959 msgid "Py_XDECREF (C function)" msgstr "" +#: ../../c-api/intro.rst:985 msgid "Py_Initialize (C function)" msgstr "" +#: ../../c-api/intro.rst:985 msgid "module" msgstr "" +#: ../../c-api/intro.rst:985 msgid "builtins" msgstr "" +#: ../../c-api/intro.rst:985 msgid "__main__" msgstr "" +#: ../../c-api/intro.rst:985 msgid "sys" msgstr "" +#: ../../c-api/intro.rst:985 msgid "search" msgstr "" +#: ../../c-api/intro.rst:985 msgid "path" msgstr "" +#: ../../c-api/intro.rst:985 msgid "path (in module sys)" msgstr "" +#: ../../c-api/intro.rst:1020 msgid "Py_GetPath (C function)" msgstr "" +#: ../../c-api/intro.rst:1020 msgid "Py_GetPrefix (C function)" msgstr "" +#: ../../c-api/intro.rst:1020 msgid "Py_GetExecPrefix (C function)" msgstr "" +#: ../../c-api/intro.rst:1020 msgid "Py_GetProgramFullPath (C function)" msgstr "" +#: ../../c-api/intro.rst:1035 msgid "Py_IsInitialized (C function)" msgstr "" diff --git a/c-api/iter.po b/c-api/iter.po index 185615c00..1620604f9 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,38 +21,71 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/iter.rst:6 msgid "Iterator Protocol" msgstr "" +#: ../../c-api/iter.rst:8 msgid "There are two functions specifically for working with iterators." msgstr "" -msgid "Return non-zero if the object *o* can be safely passed to :c:func:`PyIter_NextItem` and ``0`` otherwise. This function always succeeds." +#: ../../c-api/iter.rst:12 +msgid "" +"Return non-zero if the object *o* can be safely passed " +"to :c:func:`PyIter_NextItem` and ``0`` otherwise. This function always " +"succeeds." msgstr "" -msgid "Return non-zero if the object *o* provides the :class:`AsyncIterator` protocol, and ``0`` otherwise. This function always succeeds." +#: ../../c-api/iter.rst:18 +msgid "" +"Return non-zero if the object *o* provides the :class:`AsyncIterator` " +"protocol, and ``0`` otherwise. This function always succeeds." msgstr "" -msgid "Return ``1`` and set *item* to a :term:`strong reference` of the next value of the iterator *iter* on success. Return ``0`` and set *item* to ``NULL`` if there are no remaining values. Return ``-1``, set *item* to ``NULL`` and set an exception on error." +#: ../../c-api/iter.rst:25 +msgid "" +"Return ``1`` and set *item* to a :term:`strong reference` of the next value " +"of the iterator *iter* on success. Return ``0`` and set *item* to ``NULL`` " +"if there are no remaining values. Return ``-1``, set *item* to ``NULL`` and " +"set an exception on error." msgstr "" -msgid "This is an older version of :c:func:`!PyIter_NextItem`, which is retained for backwards compatibility. Prefer :c:func:`PyIter_NextItem`." +#: ../../c-api/iter.rst:34 +msgid "" +"This is an older version of :c:func:`!PyIter_NextItem`, which is retained " +"for backwards compatibility. Prefer :c:func:`PyIter_NextItem`." msgstr "" -msgid "Return the next value from the iterator *o*. The object must be an iterator according to :c:func:`PyIter_Check` (it is up to the caller to check this). If there are no remaining values, returns ``NULL`` with no exception set. If an error occurs while retrieving the item, returns ``NULL`` and passes along the exception." +#: ../../c-api/iter.rst:38 +msgid "" +"Return the next value from the iterator *o*. The object must be an iterator " +"according to :c:func:`PyIter_Check` (it is up to the caller to check this). " +"If there are no remaining values, returns ``NULL`` with no exception set. If " +"an error occurs while retrieving the item, returns ``NULL`` and passes along " +"the exception." msgstr "" -msgid "The enum value used to represent different results of :c:func:`PyIter_Send`." +#: ../../c-api/iter.rst:46 +msgid "" +"The enum value used to represent different results of :c:func:`PyIter_Send`." msgstr "" +#: ../../c-api/iter.rst:53 msgid "Sends the *arg* value into the iterator *iter*. Returns:" msgstr "" -msgid "``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*." +#: ../../c-api/iter.rst:55 +msgid "" +"``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*." msgstr "" -msgid "``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*." +#: ../../c-api/iter.rst:56 +msgid "" +"``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*." msgstr "" -msgid "``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``." +#: ../../c-api/iter.rst:57 +msgid "" +"``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to " +"``NULL``." msgstr "" diff --git a/c-api/iterator.po b/c-api/iterator.po index a53dc29a8..b6925859e 100644 --- a/c-api/iterator.po +++ b/c-api/iterator.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,74 +21,129 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/iterator.rst:6 msgid "Iterator Objects" msgstr "" -msgid "Python provides two general-purpose iterator objects. The first, a sequence iterator, works with an arbitrary sequence supporting the :meth:`~object.__getitem__` method. The second works with a callable object and a sentinel value, calling the callable for each item in the sequence, and ending the iteration when the sentinel value is returned." +#: ../../c-api/iterator.rst:8 +msgid "" +"Python provides two general-purpose iterator objects. The first, a sequence " +"iterator, works with an arbitrary sequence supporting " +"the :meth:`~object.__getitem__` method. The second works with a callable " +"object and a sentinel value, calling the callable for each item in the " +"sequence, and ending the iteration when the sentinel value is returned." msgstr "" -msgid "Type object for iterator objects returned by :c:func:`PySeqIter_New` and the one-argument form of the :func:`iter` built-in function for built-in sequence types." +#: ../../c-api/iterator.rst:17 +msgid "" +"Type object for iterator objects returned by :c:func:`PySeqIter_New` and the " +"one-argument form of the :func:`iter` built-in function for built-in " +"sequence types." msgstr "" -msgid "Return true if the type of *op* is :c:data:`PySeqIter_Type`. This function always succeeds." +#: ../../c-api/iterator.rst:24 +msgid "" +"Return true if the type of *op* is :c:data:`PySeqIter_Type`. This function " +"always succeeds." msgstr "" -msgid "Return an iterator that works with a general sequence object, *seq*. The iteration ends when the sequence raises :exc:`IndexError` for the subscripting operation." +#: ../../c-api/iterator.rst:30 +msgid "" +"Return an iterator that works with a general sequence object, *seq*. The " +"iteration ends when the sequence raises :exc:`IndexError` for the " +"subscripting operation." msgstr "" -msgid "Type object for iterator objects returned by :c:func:`PyCallIter_New` and the two-argument form of the :func:`iter` built-in function." +#: ../../c-api/iterator.rst:37 +msgid "" +"Type object for iterator objects returned by :c:func:`PyCallIter_New` and " +"the two-argument form of the :func:`iter` built-in function." msgstr "" -msgid "Return true if the type of *op* is :c:data:`PyCallIter_Type`. This function always succeeds." +#: ../../c-api/iterator.rst:43 +msgid "" +"Return true if the type of *op* is :c:data:`PyCallIter_Type`. This function " +"always succeeds." msgstr "" -msgid "Return a new iterator. The first parameter, *callable*, can be any Python callable object that can be called with no parameters; each call to it should return the next item in the iteration. When *callable* returns a value equal to *sentinel*, the iteration will be terminated." +#: ../../c-api/iterator.rst:49 +msgid "" +"Return a new iterator. The first parameter, *callable*, can be any Python " +"callable object that can be called with no parameters; each call to it " +"should return the next item in the iteration. When *callable* returns a " +"value equal to *sentinel*, the iteration will be terminated." msgstr "" +#: ../../c-api/iterator.rst:56 msgid "Range Objects" msgstr "" +#: ../../c-api/iterator.rst:60 msgid "The type object for :class:`range` objects." msgstr "" -msgid "Return true if the object *o* is an instance of a :class:`range` object. This function always succeeds." +#: ../../c-api/iterator.rst:65 +msgid "" +"Return true if the object *o* is an instance of a :class:`range` object. " +"This function always succeeds." msgstr "" +#: ../../c-api/iterator.rst:70 msgid "Builtin Iterator Types" msgstr "" -msgid "These are built-in iteration types that are included in Python's C API, but provide no additional functions. They are here for completeness." +#: ../../c-api/iterator.rst:72 +msgid "" +"These are built-in iteration types that are included in Python's C API, but " +"provide no additional functions. They are here for completeness." msgstr "" +#: ../../c-api/iterator.rst:80 msgid "C type" msgstr "" +#: ../../c-api/iterator.rst:81 msgid "Python type" msgstr "" +#: ../../c-api/iterator.rst:83 msgid ":py:class:`enumerate`" msgstr "" +#: ../../c-api/iterator.rst:85 msgid ":py:class:`filter`" msgstr "" +#: ../../c-api/iterator.rst:87 msgid ":py:class:`map`" msgstr "" +#: ../../c-api/iterator.rst:89 msgid ":py:class:`reversed`" msgstr "" +#: ../../c-api/iterator.rst:91 msgid ":py:class:`zip`" msgstr "" +#: ../../c-api/iterator.rst:95 msgid "Other Iterator Objects" msgstr "" +#: ../../c-api/iterator.rst:113 msgid "Type objects for iterators of various built-in objects." msgstr "" -msgid "Do not create instances of these directly; prefer calling :c:func:`PyObject_GetIter` instead." +#: ../../c-api/iterator.rst:115 +msgid "" +"Do not create instances of these directly; prefer " +"calling :c:func:`PyObject_GetIter` instead." msgstr "" -msgid "Note that there is no guarantee that a given built-in type uses a given iterator type. For example, iterating over :class:`range` will use one of two iterator types depending on the size of the range. Other types may start using a similar scheme in the future, without warning." +#: ../../c-api/iterator.rst:118 +msgid "" +"Note that there is no guarantee that a given built-in type uses a given " +"iterator type. For example, iterating over :class:`range` will use one of " +"two iterator types depending on the size of the range. Other types may start " +"using a similar scheme in the future, without warning." msgstr "" diff --git a/c-api/lifecycle.po b/c-api/lifecycle.po index 434538d56..a651b021b 100644 --- a/c-api/lifecycle.po +++ b/c-api/lifecycle.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,137 +19,349 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/lifecycle.rst:6 msgid "Object Life Cycle" msgstr "" -msgid "This section explains how a type's slots relate to each other throughout the life of an object. It is not intended to be a complete canonical reference for the slots; instead, refer to the slot-specific documentation in :ref:`type-structs` for details about a particular slot." +#: ../../c-api/lifecycle.rst:8 +msgid "" +"This section explains how a type's slots relate to each other throughout the " +"life of an object. It is not intended to be a complete canonical reference " +"for the slots; instead, refer to the slot-specific documentation " +"in :ref:`type-structs` for details about a particular slot." msgstr "" +#: ../../c-api/lifecycle.rst:15 msgid "Life Events" msgstr "" -msgid "The figure below illustrates the order of events that can occur throughout an object's life. An arrow from *A* to *B* indicates that event *B* can occur after event *A* has occurred, with the arrow's label indicating the condition that must be true for *B* to occur after *A*." +#: ../../c-api/lifecycle.rst:17 +msgid "" +"The figure below illustrates the order of events that can occur throughout " +"an object's life. An arrow from *A* to *B* indicates that event *B* can " +"occur after event *A* has occurred, with the arrow's label indicating the " +"condition that must be true for *B* to occur after *A*." msgstr "" +#: ../../c-api/lifecycle.rst:55 msgid "Diagram showing events in an object's life. Explained in detail below." msgstr "" +#: ../../c-api/lifecycle.rst:63 msgid "Explanation:" msgstr "" +#: ../../c-api/lifecycle.rst:65 msgid "When a new object is constructed by calling its type:" msgstr "" +#: ../../c-api/lifecycle.rst:67 msgid ":c:member:`~PyTypeObject.tp_new` is called to create a new object." msgstr "" -msgid ":c:member:`~PyTypeObject.tp_alloc` is directly called by :c:member:`~PyTypeObject.tp_new` to allocate the memory for the new object." +#: ../../c-api/lifecycle.rst:68 +msgid "" +":c:member:`~PyTypeObject.tp_alloc` is directly called " +"by :c:member:`~PyTypeObject.tp_new` to allocate the memory for the new " +"object." msgstr "" -msgid ":c:member:`~PyTypeObject.tp_init` initializes the newly created object. :c:member:`!tp_init` can be called again to re-initialize an object, if desired. The :c:member:`!tp_init` call can also be skipped entirely, for example by Python code calling :py:meth:`~object.__new__`." +#: ../../c-api/lifecycle.rst:71 +msgid "" +":c:member:`~PyTypeObject.tp_init` initializes the newly created " +"object. :c:member:`!tp_init` can be called again to re-initialize an object, " +"if desired. The :c:member:`!tp_init` call can also be skipped entirely, for " +"example by Python code calling :py:meth:`~object.__new__`." msgstr "" +#: ../../c-api/lifecycle.rst:76 msgid "After :c:member:`!tp_init` completes, the object is ready to use." msgstr "" +#: ../../c-api/lifecycle.rst:77 msgid "Some time after the last reference to an object is removed:" msgstr "" -msgid "If an object is not marked as *finalized*, it might be finalized by marking it as *finalized* and calling its :c:member:`~PyTypeObject.tp_finalize` function. Python does *not* finalize an object when the last reference to it is deleted; use :c:func:`PyObject_CallFinalizerFromDealloc` to ensure that :c:member:`~PyTypeObject.tp_finalize` is always called." -msgstr "" - -msgid "If the object is marked as finalized, :c:member:`~PyTypeObject.tp_clear` might be called by the garbage collector to clear references held by the object. It is *not* called when the object's reference count reaches zero." +#: ../../c-api/lifecycle.rst:79 +msgid "" +"If an object is not marked as *finalized*, it might be finalized by marking " +"it as *finalized* and calling its :c:member:`~PyTypeObject.tp_finalize` " +"function. Python does *not* finalize an object when the last reference to " +"it is deleted; use :c:func:`PyObject_CallFinalizerFromDealloc` to ensure " +"that :c:member:`~PyTypeObject.tp_finalize` is always called." msgstr "" -msgid ":c:member:`~PyTypeObject.tp_dealloc` is called to destroy the object. To avoid code duplication, :c:member:`~PyTypeObject.tp_dealloc` typically calls into :c:member:`~PyTypeObject.tp_clear` to free up the object's references." +#: ../../c-api/lifecycle.rst:85 +msgid "" +"If the object is marked as finalized, :c:member:`~PyTypeObject.tp_clear` " +"might be called by the garbage collector to clear references held by the " +"object. It is *not* called when the object's reference count reaches zero." msgstr "" -msgid "When :c:member:`~PyTypeObject.tp_dealloc` finishes object destruction, it directly calls :c:member:`~PyTypeObject.tp_free` (usually set to :c:func:`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as appropriate for the type) to deallocate the memory." +#: ../../c-api/lifecycle.rst:89 +msgid "" +":c:member:`~PyTypeObject.tp_dealloc` is called to destroy the object. To " +"avoid code duplication, :c:member:`~PyTypeObject.tp_dealloc` typically calls " +"into :c:member:`~PyTypeObject.tp_clear` to free up the object's references." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_finalize` function is permitted to add a reference to the object if desired. If it does, the object is *resurrected*, preventing its pending destruction. (Only :c:member:`!tp_finalize` is allowed to resurrect an object; :c:member:`~PyTypeObject.tp_clear` and :c:member:`~PyTypeObject.tp_dealloc` cannot without calling into :c:member:`!tp_finalize`.) Resurrecting an object may or may not cause the object's *finalized* mark to be removed. Currently, Python does not remove the *finalized* mark from a resurrected object if it supports garbage collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set) but does remove the mark if the object does not support garbage collection; either or both of these behaviors may change in the future." +#: ../../c-api/lifecycle.rst:93 +msgid "" +"When :c:member:`~PyTypeObject.tp_dealloc` finishes object destruction, it " +"directly calls :c:member:`~PyTypeObject.tp_free` (usually set " +"to :c:func:`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as " +"appropriate for the type) to deallocate the memory." msgstr "" -msgid ":c:member:`~PyTypeObject.tp_dealloc` can optionally call :c:member:`~PyTypeObject.tp_finalize` via :c:func:`PyObject_CallFinalizerFromDealloc` if it wishes to reuse that code to help with object destruction. This is recommended because it guarantees that :c:member:`!tp_finalize` is always called before destruction. See the :c:member:`~PyTypeObject.tp_dealloc` documentation for example code." +#: ../../c-api/lifecycle.rst:98 +msgid "" +"The :c:member:`~PyTypeObject.tp_finalize` function is permitted to add a " +"reference to the object if desired. If it does, the object is " +"*resurrected*, preventing its pending destruction. (Only :c:member:`!" +"tp_finalize` is allowed to resurrect an " +"object; :c:member:`~PyTypeObject.tp_clear` " +"and :c:member:`~PyTypeObject.tp_dealloc` cannot without calling " +"into :c:member:`!tp_finalize`.) Resurrecting an object may or may not cause " +"the object's *finalized* mark to be removed. Currently, Python does not " +"remove the *finalized* mark from a resurrected object if it supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set) but does " +"remove the mark if the object does not support garbage collection; either or " +"both of these behaviors may change in the future." +msgstr "" + +#: ../../c-api/lifecycle.rst:111 +msgid "" +":c:member:`~PyTypeObject.tp_dealloc` can optionally " +"call :c:member:`~PyTypeObject.tp_finalize` " +"via :c:func:`PyObject_CallFinalizerFromDealloc` if it wishes to reuse that " +"code to help with object destruction. This is recommended because it " +"guarantees that :c:member:`!tp_finalize` is always called before " +"destruction. See the :c:member:`~PyTypeObject.tp_dealloc` documentation for " +"example code." msgstr "" -msgid "If the object is a member of a :term:`cyclic isolate` and either :c:member:`~PyTypeObject.tp_clear` fails to break the reference cycle or the cyclic isolate is not detected (perhaps :func:`gc.disable` was called, or the :c:macro:`Py_TPFLAGS_HAVE_GC` flag was erroneously omitted in one of the involved types), the objects remain indefinitely uncollectable (they \"leak\"). See :data:`gc.garbage`." +#: ../../c-api/lifecycle.rst:118 +msgid "" +"If the object is a member of a :term:`cyclic isolate` and " +"either :c:member:`~PyTypeObject.tp_clear` fails to break the reference cycle " +"or the cyclic isolate is not detected (perhaps :func:`gc.disable` was " +"called, or the :c:macro:`Py_TPFLAGS_HAVE_GC` flag was erroneously omitted in " +"one of the involved types), the objects remain indefinitely uncollectable " +"(they \"leak\"). See :data:`gc.garbage`." msgstr "" -msgid "If the object is marked as supporting garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`), the following events are also possible:" +#: ../../c-api/lifecycle.rst:125 +msgid "" +"If the object is marked as supporting garbage collection " +"(the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`), the following events are also " +"possible:" msgstr "" -msgid "The garbage collector occasionally calls :c:member:`~PyTypeObject.tp_traverse` to identify :term:`cyclic isolates `." +#: ../../c-api/lifecycle.rst:129 +msgid "" +"The garbage collector occasionally " +"calls :c:member:`~PyTypeObject.tp_traverse` to identify :term:`cyclic " +"isolates `." msgstr "" -msgid "When the garbage collector discovers a :term:`cyclic isolate`, it finalizes one of the objects in the group by marking it as *finalized* and calling its :c:member:`~PyTypeObject.tp_finalize` function, if it has one. This repeats until the cyclic isolate doesn't exist or all of the objects have been finalized." +#: ../../c-api/lifecycle.rst:132 +msgid "" +"When the garbage collector discovers a :term:`cyclic isolate`, it finalizes " +"one of the objects in the group by marking it as *finalized* and calling " +"its :c:member:`~PyTypeObject.tp_finalize` function, if it has one. This " +"repeats until the cyclic isolate doesn't exist or all of the objects have " +"been finalized." msgstr "" -msgid ":c:member:`~PyTypeObject.tp_finalize` is permitted to resurrect the object by adding a reference from outside the :term:`cyclic isolate`. The new reference causes the group of objects to no longer form a cyclic isolate (the reference cycle may still exist, but if it does the objects are no longer isolated)." +#: ../../c-api/lifecycle.rst:137 +msgid "" +":c:member:`~PyTypeObject.tp_finalize` is permitted to resurrect the object " +"by adding a reference from outside the :term:`cyclic isolate`. The new " +"reference causes the group of objects to no longer form a cyclic isolate " +"(the reference cycle may still exist, but if it does the objects are no " +"longer isolated)." msgstr "" -msgid "When the garbage collector discovers a :term:`cyclic isolate` and all of the objects in the group have already been marked as *finalized*, the garbage collector clears one or more of the uncleared objects in the group (possibly concurrently) by calling each's :c:member:`~PyTypeObject.tp_clear` function. This repeats as long as the cyclic isolate still exists and not all of the objects have been cleared." +#: ../../c-api/lifecycle.rst:142 +msgid "" +"When the garbage collector discovers a :term:`cyclic isolate` and all of the " +"objects in the group have already been marked as *finalized*, the garbage " +"collector clears one or more of the uncleared objects in the group (possibly " +"concurrently) by calling each's :c:member:`~PyTypeObject.tp_clear` " +"function. This repeats as long as the cyclic isolate still exists and not " +"all of the objects have been cleared." msgstr "" +#: ../../c-api/lifecycle.rst:151 msgid "Cyclic Isolate Destruction" msgstr "" -msgid "Listed below are the stages of life of a hypothetical :term:`cyclic isolate` that continues to exist after each member object is finalized or cleared. It is a memory leak if a cyclic isolate progresses through all of these stages; it should vanish once all objects are cleared, if not sooner. A cyclic isolate can vanish either because the reference cycle is broken or because the objects are no longer isolated due to finalizer resurrection (see :c:member:`~PyTypeObject.tp_finalize`)." -msgstr "" - -msgid "**Reachable** (not yet a cyclic isolate): All objects are in their normal, reachable state. A reference cycle could exist, but an external reference means the objects are not yet isolated." +#: ../../c-api/lifecycle.rst:153 +msgid "" +"Listed below are the stages of life of a hypothetical :term:`cyclic isolate` " +"that continues to exist after each member object is finalized or cleared. " +"It is a memory leak if a cyclic isolate progresses through all of these " +"stages; it should vanish once all objects are cleared, if not sooner. A " +"cyclic isolate can vanish either because the reference cycle is broken or " +"because the objects are no longer isolated due to finalizer resurrection " +"(see :c:member:`~PyTypeObject.tp_finalize`)." msgstr "" -msgid "**Unreachable but consistent:** The final reference from outside the cyclic group of objects has been removed, causing the objects to become isolated (thus a cyclic isolate is born). None of the group's objects have been finalized or cleared yet. The cyclic isolate remains at this stage until some future run of the garbage collector (not necessarily the next run because the next run might not scan every object)." +#: ../../c-api/lifecycle.rst:161 +msgid "" +"**Reachable** (not yet a cyclic isolate): All objects are in their normal, " +"reachable state. A reference cycle could exist, but an external reference " +"means the objects are not yet isolated." msgstr "" -msgid "**Mix of finalized and not finalized:** Objects in a cyclic isolate are finalized one at a time, which means that there is a period of time when the cyclic isolate is composed of a mix of finalized and non-finalized objects. Finalization order is unspecified, so it can appear random. A finalized object must behave in a sane manner when non-finalized objects interact with it, and a non-finalized object must be able to tolerate the finalization of an arbitrary subset of its referents." +#: ../../c-api/lifecycle.rst:164 +msgid "" +"**Unreachable but consistent:** The final reference from outside the cyclic " +"group of objects has been removed, causing the objects to become isolated " +"(thus a cyclic isolate is born). None of the group's objects have been " +"finalized or cleared yet. The cyclic isolate remains at this stage until " +"some future run of the garbage collector (not necessarily the next run " +"because the next run might not scan every object)." msgstr "" -msgid "**All finalized:** All objects in a cyclic isolate are finalized before any of them are cleared." +#: ../../c-api/lifecycle.rst:170 +msgid "" +"**Mix of finalized and not finalized:** Objects in a cyclic isolate are " +"finalized one at a time, which means that there is a period of time when the " +"cyclic isolate is composed of a mix of finalized and non-finalized objects. " +"Finalization order is unspecified, so it can appear random. A finalized " +"object must behave in a sane manner when non-finalized objects interact with " +"it, and a non-finalized object must be able to tolerate the finalization of " +"an arbitrary subset of its referents." msgstr "" -msgid "**Mix of finalized and cleared:** The objects can be cleared serially or concurrently (but with the :term:`GIL` held); either way, some will finish before others. A finalized object must be able to tolerate the clearing of a subset of its referents. :pep:`442` calls this stage \"cyclic trash\"." +#: ../../c-api/lifecycle.rst:177 +msgid "" +"**All finalized:** All objects in a cyclic isolate are finalized before any " +"of them are cleared." msgstr "" -msgid "**Leaked:** If a cyclic isolate still exists after all objects in the group have been finalized and cleared, then the objects remain indefinitely uncollectable (see :data:`gc.garbage`). It is a bug if a cyclic isolate reaches this stage---it means the :c:member:`~PyTypeObject.tp_clear` methods of the participating objects have failed to break the reference cycle as required." +#: ../../c-api/lifecycle.rst:179 +msgid "" +"**Mix of finalized and cleared:** The objects can be cleared serially or " +"concurrently (but with the :term:`GIL` held); either way, some will finish " +"before others. A finalized object must be able to tolerate the clearing of " +"a subset of its referents. :pep:`442` calls this stage \"cyclic trash\"." msgstr "" -msgid "If :c:member:`~PyTypeObject.tp_clear` did not exist, then Python would have no way to safely break a reference cycle. Simply destroying an object in a cyclic isolate would result in a dangling pointer, triggering undefined behavior when an object referencing the destroyed object is itself destroyed. The clearing step makes object destruction a two-phase process: first :c:member:`~PyTypeObject.tp_clear` is called to partially destroy the objects enough to detangle them from each other, then :c:member:`~PyTypeObject.tp_dealloc` is called to complete the destruction." +#: ../../c-api/lifecycle.rst:183 +msgid "" +"**Leaked:** If a cyclic isolate still exists after all objects in the group " +"have been finalized and cleared, then the objects remain indefinitely " +"uncollectable (see :data:`gc.garbage`). It is a bug if a cyclic isolate " +"reaches this stage---it means the :c:member:`~PyTypeObject.tp_clear` methods " +"of the participating objects have failed to break the reference cycle as " +"required." msgstr "" -msgid "Unlike clearing, finalization is not a phase of destruction. A finalized object must still behave properly by continuing to fulfill its design contracts. An object's finalizer is allowed to execute arbitrary Python code, and is even allowed to prevent the impending destruction by adding a reference. The finalizer is only related to destruction by call order---if it runs, it runs before destruction, which starts with :c:member:`~PyTypeObject.tp_clear` (if called) and concludes with :c:member:`~PyTypeObject.tp_dealloc`." +#: ../../c-api/lifecycle.rst:190 +msgid "" +"If :c:member:`~PyTypeObject.tp_clear` did not exist, then Python would have " +"no way to safely break a reference cycle. Simply destroying an object in a " +"cyclic isolate would result in a dangling pointer, triggering undefined " +"behavior when an object referencing the destroyed object is itself " +"destroyed. The clearing step makes object destruction a two-phase process: " +"first :c:member:`~PyTypeObject.tp_clear` is called to partially destroy the " +"objects enough to detangle them from each other, " +"then :c:member:`~PyTypeObject.tp_dealloc` is called to complete the " +"destruction." +msgstr "" + +#: ../../c-api/lifecycle.rst:199 +msgid "" +"Unlike clearing, finalization is not a phase of destruction. A finalized " +"object must still behave properly by continuing to fulfill its design " +"contracts. An object's finalizer is allowed to execute arbitrary Python " +"code, and is even allowed to prevent the impending destruction by adding a " +"reference. The finalizer is only related to destruction by call order---if " +"it runs, it runs before destruction, which starts " +"with :c:member:`~PyTypeObject.tp_clear` (if called) and concludes " +"with :c:member:`~PyTypeObject.tp_dealloc`." msgstr "" -msgid "The finalization step is not necessary to safely reclaim the objects in a cyclic isolate, but its existence makes it easier to design types that behave in a sane manner when objects are cleared. Clearing an object might necessarily leave it in a broken, partially destroyed state---it might be unsafe to call any of the cleared object's methods or access any of its attributes. With finalization, only finalized objects can possibly interact with cleared objects; non-finalized objects are guaranteed to interact with only non-cleared (but potentially finalized) objects." +#: ../../c-api/lifecycle.rst:207 +msgid "" +"The finalization step is not necessary to safely reclaim the objects in a " +"cyclic isolate, but its existence makes it easier to design types that " +"behave in a sane manner when objects are cleared. Clearing an object might " +"necessarily leave it in a broken, partially destroyed state---it might be " +"unsafe to call any of the cleared object's methods or access any of its " +"attributes. With finalization, only finalized objects can possibly interact " +"with cleared objects; non-finalized objects are guaranteed to interact with " +"only non-cleared (but potentially finalized) objects." msgstr "" +#: ../../c-api/lifecycle.rst:216 msgid "To summarize the possible interactions:" msgstr "" -msgid "A non-finalized object might have references to or from non-finalized and finalized objects, but not to or from cleared objects." -msgstr "" - -msgid "A finalized object might have references to or from non-finalized, finalized, and cleared objects." +#: ../../c-api/lifecycle.rst:218 +msgid "" +"A non-finalized object might have references to or from non-finalized and " +"finalized objects, but not to or from cleared objects." msgstr "" -msgid "A cleared object might have references to or from finalized and cleared objects, but not to or from non-finalized objects." +#: ../../c-api/lifecycle.rst:220 +msgid "" +"A finalized object might have references to or from non-finalized, " +"finalized, and cleared objects." msgstr "" -msgid "Without any reference cycles, an object can be simply destroyed once its last reference is deleted; the finalization and clearing steps are not necessary to safely reclaim unused objects. However, it can be useful to automatically call :c:member:`~PyTypeObject.tp_finalize` and :c:member:`~PyTypeObject.tp_clear` before destruction anyway because type design is simplified when all objects always experience the same series of events regardless of whether they participated in a cyclic isolate. Python currently only calls :c:member:`~PyTypeObject.tp_finalize` and :c:member:`~PyTypeObject.tp_clear` as needed to destroy a cyclic isolate; this may change in a future version." +#: ../../c-api/lifecycle.rst:222 +msgid "" +"A cleared object might have references to or from finalized and cleared " +"objects, but not to or from non-finalized objects." msgstr "" +#: ../../c-api/lifecycle.rst:225 +msgid "" +"Without any reference cycles, an object can be simply destroyed once its " +"last reference is deleted; the finalization and clearing steps are not " +"necessary to safely reclaim unused objects. However, it can be useful to " +"automatically call :c:member:`~PyTypeObject.tp_finalize` " +"and :c:member:`~PyTypeObject.tp_clear` before destruction anyway because " +"type design is simplified when all objects always experience the same series " +"of events regardless of whether they participated in a cyclic isolate. " +"Python currently only calls :c:member:`~PyTypeObject.tp_finalize` " +"and :c:member:`~PyTypeObject.tp_clear` as needed to destroy a cyclic " +"isolate; this may change in a future version." +msgstr "" + +#: ../../c-api/lifecycle.rst:237 msgid "Functions" msgstr "" +#: ../../c-api/lifecycle.rst:239 msgid "To allocate and free memory, see :ref:`allocating-objects`." msgstr "" -msgid "Finalizes the object as described in :c:member:`~PyTypeObject.tp_finalize`. Call this function (or :c:func:`PyObject_CallFinalizerFromDealloc`) instead of calling :c:member:`~PyTypeObject.tp_finalize` directly because this function may deduplicate multiple calls to :c:member:`!tp_finalize`. Currently, calls are only deduplicated if the type supports garbage collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set); this may change in the future." +#: ../../c-api/lifecycle.rst:244 +msgid "" +"Finalizes the object as described in :c:member:`~PyTypeObject.tp_finalize`. " +"Call this function (or :c:func:`PyObject_CallFinalizerFromDealloc`) instead " +"of calling :c:member:`~PyTypeObject.tp_finalize` directly because this " +"function may deduplicate multiple calls to :c:member:`!tp_finalize`. " +"Currently, calls are only deduplicated if the type supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set); this may " +"change in the future." msgstr "" -msgid "Same as :c:func:`PyObject_CallFinalizer` but meant to be called at the beginning of the object's destructor (:c:member:`~PyTypeObject.tp_dealloc`). There must not be any references to the object. If the object's finalizer resurrects the object, this function returns -1; no further destruction should happen. Otherwise, this function returns 0 and destruction can continue normally." +#: ../../c-api/lifecycle.rst:257 +msgid "" +"Same as :c:func:`PyObject_CallFinalizer` but meant to be called at the " +"beginning of the object's destructor (:c:member:`~PyTypeObject.tp_dealloc`). " +"There must not be any references to the object. If the object's finalizer " +"resurrects the object, this function returns -1; no further destruction " +"should happen. Otherwise, this function returns 0 and destruction can " +"continue normally." msgstr "" +#: ../../c-api/lifecycle.rst:268 msgid ":c:member:`~PyTypeObject.tp_dealloc` for example code." msgstr "" diff --git a/c-api/list.po b/c-api/list.po index 6f4a3fea5..f7173595e 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,116 +22,241 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/list.rst:6 msgid "List Objects" msgstr "" +#: ../../c-api/list.rst:13 msgid "This subtype of :c:type:`PyObject` represents a Python list object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python list type. This is the same object as :class:`list` in the Python layer." +#: ../../c-api/list.rst:18 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python list type. " +"This is the same object as :class:`list` in the Python layer." msgstr "" -msgid "Return true if *p* is a list object or an instance of a subtype of the list type. This function always succeeds." +#: ../../c-api/list.rst:24 +msgid "" +"Return true if *p* is a list object or an instance of a subtype of the list " +"type. This function always succeeds." msgstr "" -msgid "Return true if *p* is a list object, but not an instance of a subtype of the list type. This function always succeeds." +#: ../../c-api/list.rst:30 +msgid "" +"Return true if *p* is a list object, but not an instance of a subtype of the " +"list type. This function always succeeds." msgstr "" +#: ../../c-api/list.rst:36 msgid "Return a new list of length *len* on success, or ``NULL`` on failure." msgstr "" -msgid "If *len* is greater than zero, the returned list object's items are set to ``NULL``. Thus you cannot use abstract API functions such as :c:func:`PySequence_SetItem` or expose the object to Python code before setting all items to a real object with :c:func:`PyList_SetItem` or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`." +#: ../../c-api/list.rst:40 +msgid "" +"If *len* is greater than zero, the returned list object's items are set to " +"``NULL``. Thus you cannot use abstract API functions such " +"as :c:func:`PySequence_SetItem` or expose the object to Python code before " +"setting all items to a real object with :c:func:`PyList_SetItem` " +"or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the " +"list is fully initialized: :c:func:`PyList_SetItem()` " +"and :c:func:`PyList_SET_ITEM()`." msgstr "" -msgid "Return the length of the list object in *list*; this is equivalent to ``len(list)`` on a list object." +#: ../../c-api/list.rst:53 +msgid "" +"Return the length of the list object in *list*; this is equivalent to " +"``len(list)`` on a list object." msgstr "" +#: ../../c-api/list.rst:59 msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "" -msgid "Return the object at position *index* in the list pointed to by *list*. The position must be non-negative; indexing from the end of the list is not supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return ``NULL`` and set an :exc:`IndexError` exception." +#: ../../c-api/list.rst:64 +msgid "" +"Return the object at position *index* in the list pointed to by *list*. The " +"position must be non-negative; indexing from the end of the list is not " +"supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return " +"``NULL`` and set an :exc:`IndexError` exception." msgstr "" -msgid "Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` instead of a :term:`strong reference`." +#: ../../c-api/list.rst:74 +msgid "" +"Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` " +"instead of a :term:`strong reference`." msgstr "" -msgid "In the :term:`free-threaded build`, the returned :term:`borrowed reference` may become invalid if another thread modifies the list concurrently. Prefer :c:func:`PyList_GetItemRef`, which returns a :term:`strong reference`." +#: ../../c-api/list.rst:79 ../../c-api/list.rst:91 +msgid "" +"In the :term:`free-threaded build`, the returned :term:`borrowed reference` " +"may become invalid if another thread modifies the list concurrently. " +"Prefer :c:func:`PyList_GetItemRef`, which returns a :term:`strong reference`." msgstr "" +#: ../../c-api/list.rst:87 msgid "Similar to :c:func:`PyList_GetItem`, but without error checking." msgstr "" -msgid "Set the item at index *index* in list to *item*. Return ``0`` on success. If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` exception." +#: ../../c-api/list.rst:99 +msgid "" +"Set the item at index *index* in list to *item*. Return ``0`` on success. " +"If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` " +"exception." msgstr "" -msgid "This function \"steals\" a reference to *item* and discards a reference to an item already in the list at the affected position." +#: ../../c-api/list.rst:105 +msgid "" +"This function \":term:`steals `\" a reference to *item*, even on " +"error. On success, it discards a reference to an item already in the list at " +"the affected position (unless it was ``NULL``)." msgstr "" -msgid "Macro form of :c:func:`PyList_SetItem` without error checking. This is normally only used to fill in new lists where there is no previous content." +#: ../../c-api/list.rst:113 +msgid "" +"Macro form of :c:func:`PyList_SetItem` without error checking. This is " +"normally only used to fill in new lists where there is no previous content." msgstr "" -msgid "Bounds checking is performed as an assertion if Python is built in :ref:`debug mode ` or :option:`with assertions <--with-assertions>`." +#: ../../c-api/list.rst:116 +msgid "" +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode ` or :option:`with assertions <--with-" +"assertions>`." msgstr "" -msgid "This macro \"steals\" a reference to *item*, and, unlike :c:func:`PyList_SetItem`, does *not* discard a reference to any item that is being replaced; any reference in *list* at position *i* will be leaked." +#: ../../c-api/list.rst:122 +msgid "" +"This macro \":term:`steals `\" a reference to *item*, and, " +"unlike :c:func:`PyList_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in *list* at position *i* will be " +"leaked." msgstr "" -msgid "In the :term:`free-threaded build`, this macro has no internal synchronization. It is normally only used to fill in new lists where no other thread has a reference to the list. If the list may be shared, use :c:func:`PyList_SetItem` instead, which uses a :term:`per-object lock`." +#: ../../c-api/list.rst:129 +msgid "" +"In the :term:`free-threaded build`, this macro has no internal " +"synchronization. It is normally only used to fill in new lists where no " +"other thread has a reference to the list. If the list may be shared, " +"use :c:func:`PyList_SetItem` instead, which uses a :term:`per-object lock`." msgstr "" -msgid "Insert the item *item* into list *list* in front of index *index*. Return ``0`` if successful; return ``-1`` and set an exception if unsuccessful. Analogous to ``list.insert(index, item)``." +#: ../../c-api/list.rst:138 +msgid "" +"Insert the item *item* into list *list* in front of index *index*. Return " +"``0`` if successful; return ``-1`` and set an exception if unsuccessful. " +"Analogous to ``list.insert(index, item)``." msgstr "" -msgid "Append the object *item* at the end of list *list*. Return ``0`` if successful; return ``-1`` and set an exception if unsuccessful. Analogous to ``list.append(item)``." +#: ../../c-api/list.rst:145 +msgid "" +"Append the object *item* at the end of list *list*. Return ``0`` if " +"successful; return ``-1`` and set an exception if unsuccessful. Analogous " +"to ``list.append(item)``." msgstr "" -msgid "Return a list of the objects in *list* containing the objects *between* *low* and *high*. Return ``NULL`` and set an exception if unsuccessful. Analogous to ``list[low:high]``. Indexing from the end of the list is not supported." +#: ../../c-api/list.rst:152 +msgid "" +"Return a list of the objects in *list* containing the objects *between* " +"*low* and *high*. Return ``NULL`` and set an exception if unsuccessful. " +"Analogous to ``list[low:high]``. Indexing from the end of the list is not " +"supported." msgstr "" -msgid "Set the slice of *list* between *low* and *high* to the contents of *itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may be ``NULL``, indicating the assignment of an empty list (slice deletion). Return ``0`` on success, ``-1`` on failure. Indexing from the end of the list is not supported." +#: ../../c-api/list.rst:159 +msgid "" +"Set the slice of *list* between *low* and *high* to the contents of " +"*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may " +"be ``NULL``, indicating the assignment of an empty list (slice deletion). " +"Return ``0`` on success, ``-1`` on failure. Indexing from the end of the " +"list is not supported." msgstr "" -msgid "In the :term:`free-threaded build`, when *itemlist* is a :class:`list`, both *list* and *itemlist* are locked for the duration of the operation. For other iterables (or ``NULL``), only *list* is locked." +#: ../../c-api/list.rst:167 +msgid "" +"In the :term:`free-threaded build`, when *itemlist* is a :class:`list`, both " +"*list* and *itemlist* are locked for the duration of the operation. For " +"other iterables (or ``NULL``), only *list* is locked." msgstr "" -msgid "Extend *list* with the contents of *iterable*. This is the same as ``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and analogous to ``list.extend(iterable)`` or ``list += iterable``." +#: ../../c-api/list.rst:174 +msgid "" +"Extend *list* with the contents of *iterable*. This is the same as " +"``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and " +"analogous to ``list.extend(iterable)`` or ``list += iterable``." msgstr "" -msgid "Raise an exception and return ``-1`` if *list* is not a :class:`list` object. Return 0 on success." +#: ../../c-api/list.rst:178 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." msgstr "" -msgid "In the :term:`free-threaded build`, when *iterable* is a :class:`list`, :class:`set`, :class:`dict`, or dict view, both *list* and *iterable* (or its underlying dict) are locked for the duration of the operation. For other iterables, only *list* is locked; *iterable* may be concurrently modified by another thread." +#: ../../c-api/list.rst:185 +msgid "" +"In the :term:`free-threaded build`, when *iterable* is " +"a :class:`list`, :class:`set`, :class:`dict`, or dict view, both *list* and " +"*iterable* (or its underlying dict) are locked for the duration of the " +"operation. For other iterables, only *list* is locked; *iterable* may be " +"concurrently modified by another thread." msgstr "" -msgid "Remove all items from *list*. This is the same as ``PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del list[:]``." +#: ../../c-api/list.rst:194 +msgid "" +"Remove all items from *list*. This is the same as ``PyList_SetSlice(list, " +"0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del " +"list[:]``." msgstr "" -msgid "Raise an exception and return ``-1`` if *list* is not a :class:`list` object. Return 0 on success." +#: ../../c-api/list.rst:198 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." msgstr "" -msgid "Sort the items of *list* in place. Return ``0`` on success, ``-1`` on failure. This is equivalent to ``list.sort()``." +#: ../../c-api/list.rst:206 +msgid "" +"Sort the items of *list* in place. Return ``0`` on success, ``-1`` on " +"failure. This is equivalent to ``list.sort()``." msgstr "" -msgid "In the :term:`free-threaded build`, element comparison via :meth:`~object.__lt__` can execute arbitrary Python code, during which the :term:`per-object lock` may be temporarily released. For built-in types (:class:`str`, :class:`int`, :class:`float`), the lock is not released during comparison." +#: ../../c-api/list.rst:211 +msgid "" +"In the :term:`free-threaded build`, element comparison " +"via :meth:`~object.__lt__` can execute arbitrary Python code, during which " +"the :term:`per-object lock` may be temporarily released. For built-in types " +"(:class:`str`, :class:`int`, :class:`float`), the lock is not released " +"during comparison." msgstr "" -msgid "Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on failure. This is the equivalent of ``list.reverse()``." +#: ../../c-api/list.rst:220 +msgid "" +"Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on " +"failure. This is the equivalent of ``list.reverse()``." msgstr "" -msgid "Return a new tuple object containing the contents of *list*; equivalent to ``tuple(list)``." +#: ../../c-api/list.rst:228 +msgid "" +"Return a new tuple object containing the contents of *list*; equivalent to " +"``tuple(list)``." msgstr "" +#: ../../c-api/list.rst:8 msgid "object" msgstr "" +#: ../../c-api/list.rst:8 msgid "list" msgstr "" +#: ../../c-api/list.rst:51 ../../c-api/list.rst:226 msgid "built-in function" msgstr "" +#: ../../c-api/list.rst:51 msgid "len" msgstr "" +#: ../../c-api/list.rst:226 msgid "tuple" msgstr "" diff --git a/c-api/long.po b/c-api/long.po index 38582836a..2613bb4b5 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,234 +24,476 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/long.rst:6 msgid "Integer Objects" msgstr "" -msgid "All integers are implemented as \"long\" integer objects of arbitrary size." +#: ../../c-api/long.rst:11 +msgid "" +"All integers are implemented as \"long\" integer objects of arbitrary size." msgstr "" -msgid "On error, most ``PyLong_As*`` APIs return ``(return type)-1`` which cannot be distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:13 +msgid "" +"On error, most ``PyLong_As*`` APIs return ``(return type)-1`` which cannot " +"be distinguished from a number. Use :c:func:`PyErr_Occurred` to " +"disambiguate." msgstr "" +#: ../../c-api/long.rst:18 msgid "This subtype of :c:type:`PyObject` represents a Python integer object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python integer type. This is the same object as :class:`int` in the Python layer." -msgstr "" - -msgid "Return true if its argument is a :c:type:`PyLongObject` or a subtype of :c:type:`PyLongObject`. This function always succeeds." +#: ../../c-api/long.rst:23 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python integer type. " +"This is the same object as :class:`int` in the Python layer." msgstr "" -msgid "Return true if its argument is a :c:type:`PyLongObject`, but not a subtype of :c:type:`PyLongObject`. This function always succeeds." +#: ../../c-api/long.rst:29 +msgid "" +"Return true if its argument is a :c:type:`PyLongObject` or a subtype " +"of :c:type:`PyLongObject`. This function always succeeds." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from *v*, or ``NULL`` on failure." +#: ../../c-api/long.rst:35 +msgid "" +"Return true if its argument is a :c:type:`PyLongObject`, but not a subtype " +"of :c:type:`PyLongObject`. This function always succeeds." msgstr "" -msgid "CPython keeps an array of integer objects for all integers between ``-5`` and ``256``. When you create an int in that range you actually just get back a reference to the existing object." +#: ../../c-api/long.rst:41 +msgid "" +"Return a new :c:type:`PyLongObject` object from *v*, or ``NULL`` on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long`, or ``NULL`` on failure." +#: ../../c-api/long.rst:45 +msgid "" +"CPython keeps an array of integer objects for all integers between ``-5`` " +"and ``256``. When you create an int in that range you actually just get " +"back a reference to the existing object." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or ``NULL`` on failure." +#: ../../c-api/long.rst:52 +msgid "" +"Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long`, " +"or ``NULL`` on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or ``NULL`` on failure." +#: ../../c-api/long.rst:58 +msgid "" +"Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or " +"``NULL`` on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from a C :c:expr:`long long`, or ``NULL`` on failure." +#: ../../c-api/long.rst:64 +msgid "" +"Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or " +"``NULL`` on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long long`, or ``NULL`` on failure." +#: ../../c-api/long.rst:70 +msgid "" +"Return a new :c:type:`PyLongObject` object from a C :c:expr:`long long`, or " +"``NULL`` on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." +#: ../../c-api/long.rst:76 +msgid "" +"Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long " +"long`, or ``NULL`` on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception set on failure." +#: ../../c-api/long.rst:83 +msgid "" +"Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " +"or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` object from the integer part of *v*, or ``NULL`` on failure." +#: ../../c-api/long.rst:93 +msgid "" +"Return a new :c:type:`PyLongObject` object from an unsigned " +"C :c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception " +"set on failure." msgstr "" -msgid "Return a new :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*, or ``NULL`` on failure. If *pend* is non-``NULL``, *\\*pend* will point to the end of *str* on success or to the first character that could not be processed on error. If *base* is ``0``, *str* is interpreted using the :ref:`integers` definition; in this case, leading zeros in a non-zero decimal number raises a :exc:`ValueError`. If *base* is not ``0``, it must be between ``2`` and ``36``, inclusive. Leading and trailing whitespace and single underscores after a base specifier and between digits are ignored. If there are no digits or *str* is not NULL-terminated following the digits and trailing whitespace, :exc:`ValueError` will be raised." +#: ../../c-api/long.rst:102 +msgid "" +"Return a new :c:type:`PyLongObject` object from the integer part of *v*, or " +"``NULL`` on failure." msgstr "" -msgid ":c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` functions can be used to convert a :c:type:`PyLongObject` to/from an array of bytes in base ``256``." +#: ../../c-api/long.rst:108 +msgid "" +"Return a new :c:type:`PyLongObject` based on the string value in *str*, " +"which is interpreted according to the radix in *base*, or ``NULL`` on " +"failure. If *pend* is non-``NULL``, *\\*pend* will point to the end of " +"*str* on success or to the first character that could not be processed on " +"error. If *base* is ``0``, *str* is interpreted using the :ref:`integers` " +"definition; in this case, leading zeros in a non-zero decimal number raises " +"a :exc:`ValueError`. If *base* is not ``0``, it must be between ``2`` and " +"``36``, inclusive. Leading and trailing whitespace and single underscores " +"after a base specifier and between digits are ignored. If there are no " +"digits or *str* is not NULL-terminated following the digits and trailing " +"whitespace, :exc:`ValueError` will be raised." +msgstr "" + +#: ../../c-api/long.rst:119 +msgid "" +":c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` " +"functions can be used to convert a :c:type:`PyLongObject` to/from an array " +"of bytes in base ``256``." msgstr "" -msgid "Convert a sequence of Unicode digits in the string *u* to a Python integer value." +#: ../../c-api/long.rst:126 +msgid "" +"Convert a sequence of Unicode digits in the string *u* to a Python integer " +"value." msgstr "" -msgid "Create a Python integer from the pointer *p*. The pointer value can be retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." +#: ../../c-api/long.rst:134 +msgid "" +"Create a Python integer from the pointer *p*. The pointer value can be " +"retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -msgid "Create a Python integer from the value contained in the first *n_bytes* of *buffer*, interpreted as a two's-complement signed number." +#: ../../c-api/long.rst:140 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as a two's-complement signed number." msgstr "" -msgid "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will select the native endian that CPython was compiled with and assume that the most-significant bit is a sign bit. Passing ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` will produce the same result as calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." +#: ../../c-api/long.rst:143 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is a sign bit. Passing " +"``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` will produce the same result as " +"calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." msgstr "" -msgid "Create a Python integer from the value contained in the first *n_bytes* of *buffer*, interpreted as an unsigned number." +#: ../../c-api/long.rst:154 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as an unsigned number." msgstr "" -msgid "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will select the native endian that CPython was compiled with and assume that the most-significant bit is not a sign bit. Flags other than endian are ignored." +#: ../../c-api/long.rst:157 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is not a sign bit. Flags other than endian are ignored." msgstr "" +#: ../../c-api/long.rst:166 msgid "Macro for creating a Python integer from a process identifier." msgstr "" -msgid "This can be defined as an alias to :c:func:`PyLong_FromLong` or :c:func:`PyLong_FromLongLong`, depending on the size of the system's PID type." +#: ../../c-api/long.rst:168 +msgid "" +"This can be defined as an alias to :c:func:`PyLong_FromLong` " +"or :c:func:`PyLong_FromLongLong`, depending on the size of the system's PID " +"type." msgstr "" -msgid "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +#: ../../c-api/long.rst:181 ../../c-api/long.rst:215 +msgid "" +"Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " +"instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " +"method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:expr:`long`." +#: ../../c-api/long.rst:185 +msgid "" +"Raise :exc:`OverflowError` if the value of *obj* is out of range for " +"a :c:expr:`long`." msgstr "" +#: ../../c-api/long.rst:188 ../../c-api/long.rst:224 ../../c-api/long.rst:245 +#: ../../c-api/long.rst:265 ../../c-api/long.rst:288 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" +#: ../../c-api/long.rst:190 ../../c-api/long.rst:226 ../../c-api/long.rst:247 +#: ../../c-api/long.rst:269 ../../c-api/long.rst:353 ../../c-api/long.rst:373 msgid "Use :meth:`~object.__index__` if available." msgstr "" +#: ../../c-api/long.rst:193 ../../c-api/long.rst:229 ../../c-api/long.rst:250 +#: ../../c-api/long.rst:272 ../../c-api/long.rst:356 ../../c-api/long.rst:376 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" -msgid "Exactly equivalent to the preferred ``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or another exception." +#: ../../c-api/long.rst:200 +msgid "" +"Exactly equivalent to the preferred ``PyLong_AsLong``. In particular, it can " +"fail with :exc:`OverflowError` or another exception." msgstr "" -msgid "Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:`int` instead of a C :c:expr:`long`." +#: ../../c-api/long.rst:207 +msgid "" +"Similar to :c:func:`PyLong_AsLong`, but store the result in a " +"C :c:expr:`int` instead of a C :c:expr:`long`." msgstr "" -msgid "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." +#: ../../c-api/long.rst:219 +msgid "" +"If the value of *obj* is greater than :c:macro:`LONG_MAX` or less " +"than :c:macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, " +"respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If " +"any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as " +"usual." msgstr "" -msgid "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +#: ../../c-api/long.rst:238 ../../c-api/long.rst:256 +msgid "" +"Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " +"instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " +"method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:expr:`long long`." +#: ../../c-api/long.rst:242 +msgid "" +"Raise :exc:`OverflowError` if the value of *obj* is out of range for " +"a :c:expr:`long long`." msgstr "" -msgid "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." +#: ../../c-api/long.rst:260 +msgid "" +"If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less " +"than :c:macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, " +"respectively, and return ``-1``; otherwise, set *\\*overflow* to ``0``. If " +"any other exception occurs set *\\*overflow* to ``0`` and return ``-1`` as " +"usual." msgstr "" -msgid "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`." +#: ../../c-api/long.rst:282 +msgid "" +"Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " +"be an instance of :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:type:`Py_ssize_t`." +#: ../../c-api/long.rst:285 +msgid "" +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:type:`Py_ssize_t`." msgstr "" -msgid "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`." +#: ../../c-api/long.rst:297 +msgid "" +"Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " +"must be an instance of :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:expr:`unsigned long`." +#: ../../c-api/long.rst:300 +msgid "" +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:expr:`unsigned long`." msgstr "" -msgid "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:303 +msgid "" +"Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " +"disambiguate." msgstr "" -msgid "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`." +#: ../../c-api/long.rst:313 +msgid "" +"Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " +"instance of :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:type:`size_t`." +#: ../../c-api/long.rst:316 +msgid "" +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:type:`size_t`." msgstr "" -msgid "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:319 +msgid "" +"Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " +"disambiguate." msgstr "" -msgid "Return a C :c:expr:`unsigned long long` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`." +#: ../../c-api/long.rst:328 +msgid "" +"Return a C :c:expr:`unsigned long long` representation of *pylong*. " +"*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :c:expr:`unsigned long long`." +#: ../../c-api/long.rst:331 +msgid "" +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"an :c:expr:`unsigned long long`." msgstr "" -msgid "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:334 +msgid "" +"Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " +"disambiguate." msgstr "" -msgid "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." +#: ../../c-api/long.rst:337 +msgid "" +"A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -msgid "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +#: ../../c-api/long.rst:343 +msgid "" +"Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " +"an instance of :c:type:`PyLongObject`, first call " +"its :meth:`~object.__index__` method (if present) to convert it to " +"a :c:type:`PyLongObject`." msgstr "" -msgid "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return the reduction of that value modulo ``ULONG_MAX + 1``." +#: ../../c-api/long.rst:347 +msgid "" +"If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " +"the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -msgid "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:350 +msgid "" +"Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " +"disambiguate." msgstr "" -msgid "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +#: ../../c-api/long.rst:362 +msgid "" +"Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " +"is not an instance of :c:type:`PyLongObject`, first call " +"its :meth:`~object.__index__` method (if present) to convert it to " +"a :c:type:`PyLongObject`." msgstr "" -msgid "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, return the reduction of that value modulo ``ULLONG_MAX + 1``." +#: ../../c-api/long.rst:367 +msgid "" +"If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " +"return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -msgid "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:370 +msgid "" +"Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " +"to disambiguate." msgstr "" -msgid "Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` representation of *obj*." +#: ../../c-api/long.rst:383 +msgid "" +"Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " +"representation of *obj*." msgstr "" -msgid "If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` method (if present) to convert it to a :c:type:`PyLongObject`." +#: ../../c-api/long.rst:386 ../../c-api/long.rst:406 +msgid "" +"If *obj* is not an instance of :c:type:`PyLongObject`, first call " +"its :meth:`~object.__index__` method (if present) to convert it to " +"a :c:type:`PyLongObject`." msgstr "" +#: ../../c-api/long.rst:390 ../../c-api/long.rst:411 msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." msgstr "" -msgid "Set *\\*value* and return ``0`` on success. Set an exception and return ``-1`` on error." +#: ../../c-api/long.rst:392 ../../c-api/long.rst:413 +msgid "" +"Set *\\*value* and return ``0`` on success. Set an exception and return " +"``-1`` on error." msgstr "" +#: ../../c-api/long.rst:395 ../../c-api/long.rst:416 msgid "*value* must not be ``NULL``." msgstr "" -msgid "Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` representation of *obj*." +#: ../../c-api/long.rst:403 +msgid "" +"Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " +"representation of *obj*." msgstr "" +#: ../../c-api/long.rst:410 msgid "If *obj* is negative, raise a :exc:`ValueError`." msgstr "" -msgid "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an instance of :c:type:`PyLongObject`." +#: ../../c-api/long.rst:423 +msgid "" +"Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " +"instance of :c:type:`PyLongObject`." msgstr "" -msgid "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:expr:`double`." +#: ../../c-api/long.rst:426 +msgid "" +"Raise :exc:`OverflowError` if the value of *pylong* is out of range for " +"a :c:expr:`double`." msgstr "" -msgid "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:429 +msgid "" +"Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -msgid "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* cannot be converted, an :exc:`OverflowError` will be raised. This is only assured to produce a usable :c:expr:`void` pointer for values created with :c:func:`PyLong_FromVoidPtr`." +#: ../../c-api/long.rst:434 +msgid "" +"Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " +"cannot be converted, an :exc:`OverflowError` will be raised. This is only " +"assured to produce a usable :c:expr:`void` pointer for values created " +"with :c:func:`PyLong_FromVoidPtr`." msgstr "" -msgid "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." +#: ../../c-api/long.rst:439 +msgid "" +"Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -msgid "Copy the Python integer value *pylong* to a native *buffer* of size *n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, or to values documented below to control the behavior." +#: ../../c-api/long.rst:444 +msgid "" +"Copy the Python integer value *pylong* to a native *buffer* of size " +"*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " +"or to values documented below to control the behavior." msgstr "" -msgid "Returns ``-1`` with an exception raised on error. This may happen if *pylong* cannot be interpreted as an integer, or if *pylong* was negative and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." +#: ../../c-api/long.rst:448 +msgid "" +"Returns ``-1`` with an exception raised on error. This may happen if " +"*pylong* cannot be interpreted as an integer, or if *pylong* was negative " +"and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" -msgid "Otherwise, returns the number of bytes required to store the value. If this is equal to or less than *n_bytes*, the entire value was copied. All *n_bytes* of the buffer are written: remaining bytes filled by copies of the sign bit." +#: ../../c-api/long.rst:452 +msgid "" +"Otherwise, returns the number of bytes required to store the value. If this " +"is equal to or less than *n_bytes*, the entire value was copied. All " +"*n_bytes* of the buffer are written: remaining bytes filled by copies of the " +"sign bit." msgstr "" -msgid "If the returned value is greater than *n_bytes*, the value was truncated: as many of the lowest bits of the value as could fit are written, and the higher bits are ignored. This matches the typical behavior of a C-style downcast." +#: ../../c-api/long.rst:457 +msgid "" +"If the returned value is greater than *n_bytes*, the value was truncated: as " +"many of the lowest bits of the value as could fit are written, and the " +"higher bits are ignored. This matches the typical behavior of a C-style " +"downcast." msgstr "" -msgid "Overflow is not considered an error. If the returned value is larger than *n_bytes*, most significant bits were discarded." +#: ../../c-api/long.rst:464 +msgid "" +"Overflow is not considered an error. If the returned value is larger than " +"*n_bytes*, most significant bits were discarded." msgstr "" +#: ../../c-api/long.rst:467 msgid "``0`` will never be returned." msgstr "" +#: ../../c-api/long.rst:469 msgid "Values are always copied as two's-complement." msgstr "" +#: ../../c-api/long.rst:471 msgid "Usage example::" msgstr "" +#: ../../c-api/long.rst:473 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -268,15 +510,26 @@ msgid "" "}" msgstr "" -msgid "Passing zero to *n_bytes* will return the size of a buffer that would be large enough to hold the value. This may be larger than technically necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." +#: ../../c-api/long.rst:487 +msgid "" +"Passing zero to *n_bytes* will return the size of a buffer that would be " +"large enough to hold the value. This may be larger than technically " +"necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" -msgid "Passing *n_bytes=0* to this function is not an accurate way to determine the bit length of the value." +#: ../../c-api/long.rst:494 +msgid "" +"Passing *n_bytes=0* to this function is not an accurate way to determine the " +"bit length of the value." msgstr "" -msgid "To get at the entire Python value of an unknown size, the function can be called twice: first to determine the buffer size, then to fill it::" +#: ../../c-api/long.rst:497 +msgid "" +"To get at the entire Python value of an unknown size, the function can be " +"called twice: first to determine the buffer size, then to fill it::" msgstr "" +#: ../../c-api/long.rst:500 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -307,296 +560,516 @@ msgid "" "free(bignum);" msgstr "" -msgid "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults that behave most like a C cast, or a combination of the other flags in the table below. Note that ``-1`` cannot be combined with other flags." +#: ../../c-api/long.rst:528 +msgid "" +"*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " +"that behave most like a C cast, or a combination of the other flags in the " +"table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -msgid "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." +#: ../../c-api/long.rst:533 +msgid "" +"Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " +"Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" +#: ../../c-api/long.rst:539 msgid "Flag" msgstr "" +#: ../../c-api/long.rst:539 msgid "Value" msgstr "" +#: ../../c-api/long.rst:541 msgid "``-1``" msgstr "" +#: ../../c-api/long.rst:542 msgid "``0``" msgstr "" +#: ../../c-api/long.rst:543 msgid "``1``" msgstr "" +#: ../../c-api/long.rst:544 msgid "``3``" msgstr "" +#: ../../c-api/long.rst:545 msgid "``4``" msgstr "" +#: ../../c-api/long.rst:546 msgid "``8``" msgstr "" +#: ../../c-api/long.rst:547 msgid "``16``" msgstr "" -msgid "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian flags. Passing ``2`` is reserved." +#: ../../c-api/long.rst:550 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " +"flags. Passing ``2`` is reserved." msgstr "" -msgid "By default, sufficient buffer will be requested to include a sign bit. For example, when converting 128 with *n_bytes=1*, the function will return 2 (or more) in order to store a zero sign bit." +#: ../../c-api/long.rst:553 +msgid "" +"By default, sufficient buffer will be requested to include a sign bit. For " +"example, when converting 128 with *n_bytes=1*, the function will return 2 " +"(or more) in order to store a zero sign bit." msgstr "" -msgid "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will be omitted from size calculations. This allows, for example, 128 to fit in a single-byte buffer. If the destination buffer is later treated as signed, a positive input value may become negative. Note that the flag does not affect handling of negative values: for those, space for a sign bit is always requested." +#: ../../c-api/long.rst:557 +msgid "" +"If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " +"be omitted from size calculations. This allows, for example, 128 to fit in a " +"single-byte buffer. If the destination buffer is later treated as signed, a " +"positive input value may become negative. Note that the flag does not affect " +"handling of negative values: for those, space for a sign bit is always " +"requested." msgstr "" -msgid "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be set if *pylong* is negative. Without this flag, negative values will be copied provided there is enough space for at least one sign bit, regardless of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." +#: ../../c-api/long.rst:564 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " +"set if *pylong* is negative. Without this flag, negative values will be " +"copied provided there is enough space for at least one sign bit, regardless " +"of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -msgid "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is passed, its :meth:`~object.__index__` method will be called first. This may result in Python code executing and other threads being allowed to run, which could cause changes to other objects or values in use. When *flags* is ``-1``, this option is not set, and non-integer values will raise :exc:`TypeError`." +#: ../../c-api/long.rst:569 +msgid "" +"If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " +"passed, its :meth:`~object.__index__` method will be called first. This may " +"result in Python code executing and other threads being allowed to run, " +"which could cause changes to other objects or values in use. When *flags* is " +"``-1``, this option is not set, and non-integer values will " +"raise :exc:`TypeError`." msgstr "" -msgid "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without *REJECT_NEGATIVE*), multiple Python integers can map to a single value without overflow. For example, both ``255`` and ``-1`` fit a single-byte buffer and set all its bits. This matches typical C cast behavior." +#: ../../c-api/long.rst:578 +msgid "" +"With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " +"*REJECT_NEGATIVE*), multiple Python integers can map to a single value " +"without overflow. For example, both ``255`` and ``-1`` fit a single-byte " +"buffer and set all its bits. This matches typical C cast behavior." msgstr "" +#: ../../c-api/long.rst:589 msgid "Macro for converting a Python integer into a process identifier." msgstr "" -msgid "This can be defined as an alias to :c:func:`PyLong_AsLong`, :c:func:`PyLong_FromLongLong`, or :c:func:`PyLong_AsInt`, depending on the size of the system's PID type." +#: ../../c-api/long.rst:591 +msgid "" +"This can be defined as an alias " +"to :c:func:`PyLong_AsLong`, :c:func:`PyLong_FromLongLong`, " +"or :c:func:`PyLong_AsInt`, depending on the size of the system's PID type." msgstr "" +#: ../../c-api/long.rst:600 msgid "Get the sign of the integer object *obj*." msgstr "" -msgid "On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, negative or positive integer, respectively) and return 0." +#: ../../c-api/long.rst:602 +msgid "" +"On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " +"negative or positive integer, respectively) and return 0." msgstr "" -msgid "On failure, return -1 with an exception set. This function always succeeds if *obj* is a :c:type:`PyLongObject` or its subtype." +#: ../../c-api/long.rst:605 +msgid "" +"On failure, return -1 with an exception set. This function always succeeds " +"if *obj* is a :c:type:`PyLongObject` or its subtype." msgstr "" +#: ../../c-api/long.rst:613 msgid "Check if the integer object *obj* is positive (``obj > 0``)." msgstr "" -msgid "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return ``1`` when it's positive and ``0`` otherwise. Else set an exception and return ``-1``." +#: ../../c-api/long.rst:615 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's positive and ``0`` otherwise. Else set an exception and " +"return ``-1``." msgstr "" +#: ../../c-api/long.rst:624 msgid "Check if the integer object *obj* is negative (``obj < 0``)." msgstr "" -msgid "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return ``1`` when it's negative and ``0`` otherwise. Else set an exception and return ``-1``." +#: ../../c-api/long.rst:626 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's negative and ``0`` otherwise. Else set an exception and " +"return ``-1``." msgstr "" +#: ../../c-api/long.rst:635 msgid "Check if the integer object *obj* is zero." msgstr "" -msgid "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return ``1`` when it's zero and ``0`` otherwise. Else set an exception and return ``-1``." +#: ../../c-api/long.rst:637 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's zero and ``0`` otherwise. Else set an exception and return " +"``-1``." msgstr "" -msgid "On success, return a read only :term:`named tuple`, that holds information about Python's internal representation of integers. See :data:`sys.int_info` for description of individual fields." +#: ../../c-api/long.rst:646 +msgid "" +"On success, return a read only :term:`named tuple`, that holds information " +"about Python's internal representation of integers. See :data:`sys.int_info` " +"for description of individual fields." msgstr "" +#: ../../c-api/long.rst:650 msgid "On failure, return ``NULL`` with an exception set." msgstr "" +#: ../../c-api/long.rst:657 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -msgid "This function makes it possible for performance-critical code to implement a “fast path” for small integers. For compact values use :c:func:`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." +#: ../../c-api/long.rst:659 +msgid "" +"This function makes it possible for performance-critical code to implement a " +"“fast path” for small integers. For compact values " +"use :c:func:`PyUnstable_Long_CompactValue`; for others fall back to " +"a :c:func:`PyLong_As* ` function " +"or :c:func:`PyLong_AsNativeBytes`." msgstr "" +#: ../../c-api/long.rst:665 msgid "The speedup is expected to be negligible for most users." msgstr "" -msgid "Exactly what values are considered compact is an implementation detail and is subject to change." +#: ../../c-api/long.rst:667 +msgid "" +"Exactly what values are considered compact is an implementation detail and " +"is subject to change." msgstr "" -msgid "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, return its value." +#: ../../c-api/long.rst:675 +msgid "" +"If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " +"return its value." msgstr "" +#: ../../c-api/long.rst:678 msgid "Otherwise, the return value is undefined." msgstr "" +#: ../../c-api/long.rst:684 msgid "Export API" msgstr "" -msgid "Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to represent absolute value for arbitrary precision integers." +#: ../../c-api/long.rst:690 +msgid "" +"Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " +"represent absolute value for arbitrary precision integers." msgstr "" -msgid "Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :class:`int` objects, used internally for integers with \"big enough\" absolute value." +#: ../../c-api/long.rst:693 +msgid "" +"Use :c:func:`PyLong_GetNativeLayout` to get the native layout of " +"Python :class:`int` objects, used internally for integers with \"big " +"enough\" absolute value." msgstr "" -msgid "See also :data:`sys.int_info` which exposes similar information in Python." +#: ../../c-api/long.rst:697 +msgid "" +"See also :data:`sys.int_info` which exposes similar information in Python." msgstr "" -msgid "Bits per digit. For example, a 15 bit digit means that bits 0-14 contain meaningful information." +#: ../../c-api/long.rst:701 +msgid "" +"Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " +"meaningful information." msgstr "" -msgid "Digit size in bytes. For example, a 15 bit digit will require at least 2 bytes." +#: ../../c-api/long.rst:706 +msgid "" +"Digit size in bytes. For example, a 15 bit digit will require at least 2 " +"bytes." msgstr "" +#: ../../c-api/long.rst:711 msgid "Digits order:" msgstr "" +#: ../../c-api/long.rst:713 msgid "``1`` for most significant digit first" msgstr "" +#: ../../c-api/long.rst:714 msgid "``-1`` for least significant digit first" msgstr "" +#: ../../c-api/long.rst:718 msgid "Digit endianness:" msgstr "" +#: ../../c-api/long.rst:720 msgid "``1`` for most significant byte first (big endian)" msgstr "" +#: ../../c-api/long.rst:721 msgid "``-1`` for least significant byte first (little endian)" msgstr "" +#: ../../c-api/long.rst:726 msgid "Get the native layout of Python :class:`int` objects." msgstr "" +#: ../../c-api/long.rst:728 msgid "See the :c:struct:`PyLongLayout` structure." msgstr "" -msgid "The function must not be called before Python initialization nor after Python finalization. The returned layout is valid until Python is finalized. The layout is the same for all Python sub-interpreters in a process, and so it can be cached." +#: ../../c-api/long.rst:730 +msgid "" +"The function must not be called before Python initialization nor after " +"Python finalization. The returned layout is valid until Python is finalized. " +"The layout is the same for all Python sub-interpreters in a process, and so " +"it can be cached." msgstr "" +#: ../../c-api/long.rst:738 msgid "Export of a Python :class:`int` object." msgstr "" +#: ../../c-api/long.rst:740 msgid "There are two cases:" msgstr "" -msgid "If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." +#: ../../c-api/long.rst:742 +msgid "" +"If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." msgstr "" -msgid "If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, :c:member:`ndigits` and :c:member:`digits` members." +#: ../../c-api/long.rst:743 +msgid "" +"If :c:member:`digits` is not ``NULL``, " +"use :c:member:`negative`, :c:member:`ndigits` and :c:member:`digits` members." msgstr "" -msgid "The native integer value of the exported :class:`int` object. Only valid if :c:member:`digits` is ``NULL``." +#: ../../c-api/long.rst:748 +msgid "" +"The native integer value of the exported :class:`int` object. Only valid " +"if :c:member:`digits` is ``NULL``." msgstr "" -msgid "``1`` if the number is negative, ``0`` otherwise. Only valid if :c:member:`digits` is not ``NULL``." +#: ../../c-api/long.rst:753 +msgid "" +"``1`` if the number is negative, ``0`` otherwise. Only valid " +"if :c:member:`digits` is not ``NULL``." msgstr "" -msgid "Number of digits in :c:member:`digits` array. Only valid if :c:member:`digits` is not ``NULL``." +#: ../../c-api/long.rst:758 +msgid "" +"Number of digits in :c:member:`digits` array. Only valid " +"if :c:member:`digits` is not ``NULL``." msgstr "" +#: ../../c-api/long.rst:763 msgid "Read-only array of unsigned digits. Can be ``NULL``." msgstr "" +#: ../../c-api/long.rst:768 msgid "Export a Python :class:`int` object." msgstr "" -msgid "*export_long* must point to a :c:struct:`PyLongExport` structure allocated by the caller. It must not be ``NULL``." +#: ../../c-api/long.rst:770 +msgid "" +"*export_long* must point to a :c:struct:`PyLongExport` structure allocated " +"by the caller. It must not be ``NULL``." msgstr "" -msgid "On success, fill in *\\*export_long* and return ``0``. On error, set an exception and return ``-1``." +#: ../../c-api/long.rst:773 +msgid "" +"On success, fill in *\\*export_long* and return ``0``. On error, set an " +"exception and return ``-1``." msgstr "" -msgid ":c:func:`PyLong_FreeExport` must be called when the export is no longer needed." +#: ../../c-api/long.rst:776 +msgid "" +":c:func:`PyLong_FreeExport` must be called when the export is no longer " +"needed." msgstr "" -msgid "This function always succeeds if *obj* is a Python :class:`int` object or a subclass." +#: ../../c-api/long.rst:780 +msgid "" +"This function always succeeds if *obj* is a Python :class:`int` object or a " +"subclass." msgstr "" +#: ../../c-api/long.rst:786 msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." msgstr "" -msgid "Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is ``NULL``." +#: ../../c-api/long.rst:789 +msgid "" +"Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " +"``NULL``." msgstr "" +#: ../../c-api/long.rst:794 msgid "PyLongWriter API" msgstr "" +#: ../../c-api/long.rst:796 msgid "The :c:type:`PyLongWriter` API can be used to import an integer." msgstr "" +#: ../../c-api/long.rst:802 msgid "A Python :class:`int` writer instance." msgstr "" -msgid "The instance must be destroyed by :c:func:`PyLongWriter_Finish` or :c:func:`PyLongWriter_Discard`." +#: ../../c-api/long.rst:804 +msgid "" +"The instance must be destroyed by :c:func:`PyLongWriter_Finish` " +"or :c:func:`PyLongWriter_Discard`." msgstr "" +#: ../../c-api/long.rst:810 msgid "Create a :c:type:`PyLongWriter`." msgstr "" -msgid "On success, allocate *\\*digits* and return a writer. On error, set an exception and return ``NULL``." +#: ../../c-api/long.rst:812 +msgid "" +"On success, allocate *\\*digits* and return a writer. On error, set an " +"exception and return ``NULL``." msgstr "" +#: ../../c-api/long.rst:815 msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." msgstr "" -msgid "*ndigits* is the number of digits in the *digits* array. It must be greater than 0." +#: ../../c-api/long.rst:817 +msgid "" +"*ndigits* is the number of digits in the *digits* array. It must be greater " +"than 0." msgstr "" +#: ../../c-api/long.rst:820 msgid "*digits* must not be NULL." msgstr "" -msgid "After a successful call to this function, the caller should fill in the array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get a Python :class:`int`. The layout of *digits* is described by :c:func:`PyLong_GetNativeLayout`." +#: ../../c-api/long.rst:822 +msgid "" +"After a successful call to this function, the caller should fill in the " +"array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " +"a Python :class:`int`. The layout of *digits* is described " +"by :c:func:`PyLong_GetNativeLayout`." msgstr "" -msgid "Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per digit). Any unused most significant digits must be set to ``0``." +#: ../../c-api/long.rst:827 +msgid "" +"Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where " +"the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per " +"digit). Any unused most significant digits must be set to ``0``." msgstr "" -msgid "Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer instance without creating an :class:`~int` object." +#: ../../c-api/long.rst:832 +msgid "" +"Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " +"instance without creating an :class:`~int` object." msgstr "" -msgid "Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." +#: ../../c-api/long.rst:838 +msgid "" +"Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" -msgid "On success, return a Python :class:`int` object. On error, set an exception and return ``NULL``." +#: ../../c-api/long.rst:840 +msgid "" +"On success, return a Python :class:`int` object. On error, set an exception " +"and return ``NULL``." msgstr "" -msgid "The function takes care of normalizing the digits and converts the object to a compact integer if needed." +#: ../../c-api/long.rst:843 +msgid "" +"The function takes care of normalizing the digits and converts the object to " +"a compact integer if needed." msgstr "" +#: ../../c-api/long.rst:846 ../../c-api/long.rst:855 msgid "The writer instance and the *digits* array are invalid after the call." msgstr "" -msgid "Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." +#: ../../c-api/long.rst:851 +msgid "" +"Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" +#: ../../c-api/long.rst:853 msgid "If *writer* is ``NULL``, no operation is performed." msgstr "" +#: ../../c-api/long.rst:859 msgid "Deprecated API" msgstr "" -msgid "These macros are :term:`soft deprecated`. They describe parameters of the internal representation of :c:type:`PyLongObject` instances." +#: ../../c-api/long.rst:861 +msgid "" +"These macros are :term:`soft deprecated`. They describe parameters of the " +"internal representation of :c:type:`PyLongObject` instances." msgstr "" -msgid "Use :c:func:`PyLong_GetNativeLayout` instead, along with :c:func:`PyLong_Export` to read integer data or :c:type:`PyLongWriter` to write it. These currently use the same layout, but are designed to continue working correctly even if CPython's internal integer representation changes." +#: ../../c-api/long.rst:864 +msgid "" +"Use :c:func:`PyLong_GetNativeLayout` instead, along " +"with :c:func:`PyLong_Export` to read integer data or :c:type:`PyLongWriter` " +"to write it. These currently use the same layout, but are designed to " +"continue working correctly even if CPython's internal integer representation " +"changes." msgstr "" -msgid "This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in the output of :c:func:`PyLong_GetNativeLayout`." +#: ../../c-api/long.rst:872 +msgid "" +"This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in the output " +"of :c:func:`PyLong_GetNativeLayout`." msgstr "" +#: ../../c-api/long.rst:878 msgid "This is currently equivalent to :c:expr:`1 << PyLong_SHIFT`." msgstr "" +#: ../../c-api/long.rst:883 msgid "This is currently equivalent to :c:expr:`(1 << PyLong_SHIFT) - 1`" msgstr "" +#: ../../c-api/long.rst:8 msgid "object" msgstr "" +#: ../../c-api/long.rst:8 msgid "long integer" msgstr "" +#: ../../c-api/long.rst:8 msgid "integer" msgstr "" +#: ../../c-api/long.rst:177 msgid "LONG_MAX (C macro)" msgstr "" +#: ../../c-api/long.rst:177 ../../c-api/long.rst:235 ../../c-api/long.rst:278 +#: ../../c-api/long.rst:293 ../../c-api/long.rst:309 ../../c-api/long.rst:325 msgid "OverflowError (built-in exception)" msgstr "" +#: ../../c-api/long.rst:278 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "" +#: ../../c-api/long.rst:293 msgid "ULONG_MAX (C macro)" msgstr "" +#: ../../c-api/long.rst:309 msgid "SIZE_MAX (C macro)" msgstr "" diff --git a/c-api/mapping.po b/c-api/mapping.po index 5c6d2352c..85719eb6b 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,71 +22,150 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/mapping.rst:6 msgid "Mapping Protocol" msgstr "" -msgid "See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` and :c:func:`PyObject_DelItem`." +#: ../../c-api/mapping.rst:8 +msgid "" +"See also :c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`." msgstr "" -msgid "Return ``1`` if the object provides the mapping protocol or supports slicing, and ``0`` otherwise. Note that it returns ``1`` for Python classes with a :meth:`~object.__getitem__` method, since in general it is impossible to determine what type of keys the class supports. This function always succeeds." +#: ../../c-api/mapping.rst:14 +msgid "" +"Return ``1`` if the object provides the mapping protocol or supports " +"slicing, and ``0`` otherwise. Note that it returns ``1`` for Python classes " +"with a :meth:`~object.__getitem__` method, since in general it is impossible " +"to determine what type of keys the class supports. This function always " +"succeeds." msgstr "" -msgid "Returns the number of keys in object *o* on success, and ``-1`` on failure. This is equivalent to the Python expression ``len(o)``." +#: ../../c-api/mapping.rst:25 +msgid "" +"Returns the number of keys in object *o* on success, and ``-1`` on failure. " +"This is equivalent to the Python expression ``len(o)``." msgstr "" -msgid "This is the same as :c:func:`PyObject_GetItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/mapping.rst:31 +msgid "" +"This is the same as :c:func:`PyObject_GetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Variant of :c:func:`PyObject_GetItem` which doesn't raise :exc:`KeyError` if the key is not found." +#: ../../c-api/mapping.rst:38 +msgid "" +"Variant of :c:func:`PyObject_GetItem` which doesn't raise :exc:`KeyError` if " +"the key is not found." msgstr "" -msgid "If the key is found, return ``1`` and set *\\*result* to a new :term:`strong reference` to the corresponding value. If the key is not found, return ``0`` and set *\\*result* to ``NULL``; the :exc:`KeyError` is silenced. If an error other than :exc:`KeyError` is raised, return ``-1`` and set *\\*result* to ``NULL``." +#: ../../c-api/mapping.rst:41 +msgid "" +"If the key is found, return ``1`` and set *\\*result* to a new :term:`strong " +"reference` to the corresponding value. If the key is not found, return ``0`` " +"and set *\\*result* to ``NULL``; the :exc:`KeyError` is silenced. If an " +"error other than :exc:`KeyError` is raised, return ``-1`` and set " +"*\\*result* to ``NULL``." msgstr "" -msgid "This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/mapping.rst:53 +msgid "" +"This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "This is the same as :c:func:`PyObject_SetItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/mapping.rst:62 +msgid "" +"This is the same as :c:func:`PyObject_SetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" +#: ../../c-api/mapping.rst:69 msgid "This is an alias of :c:func:`PyObject_DelItem`." msgstr "" -msgid "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/mapping.rst:74 +msgid "" +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. This is equivalent to the Python expression ``key in o``. On failure, return ``-1``." +#: ../../c-api/mapping.rst:81 +msgid "" +"Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " +"This is equivalent to the Python expression ``key in o``. On failure, return " +"``-1``." msgstr "" -msgid "This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/mapping.rst:90 +msgid "" +"This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. This is equivalent to the Python expression ``key in o``. This function always succeeds." +#: ../../c-api/mapping.rst:99 +msgid "" +"Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " +"This is equivalent to the Python expression ``key in o``. This function " +"always succeeds." msgstr "" -msgid "Exceptions which occur when this calls the :meth:`~object.__getitem__` method are silently ignored. For proper error handling, use :c:func:`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` or :c:func:`PyObject_GetItem()` instead." +#: ../../c-api/mapping.rst:105 +msgid "" +"Exceptions which occur when this calls the :meth:`~object.__getitem__` " +"method are silently ignored. For proper error handling, " +"use :c:func:`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` " +"or :c:func:`PyObject_GetItem()` instead." msgstr "" -msgid "This is the same as :c:func:`PyMapping_HasKey`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/mapping.rst:113 +msgid "" +"This is the same as :c:func:`PyMapping_HasKey`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Exceptions that occur when this calls the :meth:`~object.__getitem__` method or while creating the temporary :class:`str` object are silently ignored. For proper error handling, use :c:func:`PyMapping_HasKeyStringWithError`, :c:func:`PyMapping_GetOptionalItemString` or :c:func:`PyMapping_GetItemString` instead." +#: ../../c-api/mapping.rst:119 +msgid "" +"Exceptions that occur when this calls the :meth:`~object.__getitem__` method " +"or while creating the temporary :class:`str` object are silently ignored. " +"For proper error handling, " +"use :c:func:`PyMapping_HasKeyStringWithError`, :c:func:`PyMapping_GetOptionalItemString` " +"or :c:func:`PyMapping_GetItemString` instead." msgstr "" -msgid "On success, return a list of the keys in object *o*. On failure, return ``NULL``." +#: ../../c-api/mapping.rst:129 +msgid "" +"On success, return a list of the keys in object *o*. On failure, return " +"``NULL``." msgstr "" +#: ../../c-api/mapping.rst:132 ../../c-api/mapping.rst:141 +#: ../../c-api/mapping.rst:150 msgid "Previously, the function returned a list or a tuple." msgstr "" -msgid "On success, return a list of the values in object *o*. On failure, return ``NULL``." +#: ../../c-api/mapping.rst:138 +msgid "" +"On success, return a list of the values in object *o*. On failure, return " +"``NULL``." msgstr "" -msgid "On success, return a list of the items in object *o*, where each item is a tuple containing a key-value pair. On failure, return ``NULL``." +#: ../../c-api/mapping.rst:147 +msgid "" +"On success, return a list of the items in object *o*, where each item is a " +"tuple containing a key-value pair. On failure, return ``NULL``." msgstr "" +#: ../../c-api/mapping.rst:23 msgid "built-in function" msgstr "" +#: ../../c-api/mapping.rst:23 msgid "len" msgstr "" diff --git a/c-api/marshal.po b/c-api/marshal.po index 7d419c898..72cd2c299 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,53 +21,108 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/marshal.rst:6 msgid "Data marshalling support" msgstr "" -msgid "These routines allow C code to work with serialized objects using the same data format as the :mod:`marshal` module. There are functions to write data into the serialization format, and additional functions that can be used to read the data back. Files used to store marshalled data must be opened in binary mode." +#: ../../c-api/marshal.rst:8 +msgid "" +"These routines allow C code to work with serialized objects using the same " +"data format as the :mod:`marshal` module. There are functions to write data " +"into the serialization format, and additional functions that can be used to " +"read the data back. Files used to store marshalled data must be opened in " +"binary mode." msgstr "" +#: ../../c-api/marshal.rst:14 msgid "Numeric values are stored with the least significant byte first." msgstr "" -msgid "The module supports several versions of the data format; see the :py:mod:`Python module documentation ` for details." +#: ../../c-api/marshal.rst:16 +msgid "" +"The module supports several versions of the data format; see " +"the :py:mod:`Python module documentation ` for details." msgstr "" +#: ../../c-api/marshal.rst:21 msgid "The current format version. See :py:data:`marshal.version`." msgstr "" -msgid "Marshal a :c:expr:`long` integer, *value*, to *file*. This will only write the least-significant 32 bits of *value*; regardless of the size of the native :c:expr:`long` type. *version* indicates the file format." +#: ../../c-api/marshal.rst:25 +msgid "" +"Marshal a :c:expr:`long` integer, *value*, to *file*. This will only write " +"the least-significant 32 bits of *value*; regardless of the size of the " +"native :c:expr:`long` type. *version* indicates the file format." msgstr "" -msgid "This function can fail, in which case it sets the error indicator. Use :c:func:`PyErr_Occurred` to check for that." +#: ../../c-api/marshal.rst:29 ../../c-api/marshal.rst:37 +msgid "" +"This function can fail, in which case it sets the error indicator. " +"Use :c:func:`PyErr_Occurred` to check for that." msgstr "" -msgid "Marshal a Python object, *value*, to *file*. *version* indicates the file format." +#: ../../c-api/marshal.rst:34 +msgid "" +"Marshal a Python object, *value*, to *file*. *version* indicates the file " +"format." msgstr "" -msgid "Return a bytes object containing the marshalled representation of *value*. *version* indicates the file format." +#: ../../c-api/marshal.rst:42 +msgid "" +"Return a bytes object containing the marshalled representation of *value*. " +"*version* indicates the file format." msgstr "" +#: ../../c-api/marshal.rst:46 msgid "The following functions allow marshalled values to be read back in." msgstr "" -msgid "Return a C :c:expr:`long` from the data stream in a :c:expr:`FILE*` opened for reading. Only a 32-bit value can be read in using this function, regardless of the native size of :c:expr:`long`." +#: ../../c-api/marshal.rst:51 +msgid "" +"Return a C :c:expr:`long` from the data stream in a :c:expr:`FILE*` opened " +"for reading. Only a 32-bit value can be read in using this function, " +"regardless of the native size of :c:expr:`long`." msgstr "" -msgid "On error, sets the appropriate exception (:exc:`EOFError`) and returns ``-1``." +#: ../../c-api/marshal.rst:55 ../../c-api/marshal.rst:65 +msgid "" +"On error, sets the appropriate exception (:exc:`EOFError`) and returns " +"``-1``." msgstr "" -msgid "Return a C :c:expr:`short` from the data stream in a :c:expr:`FILE*` opened for reading. Only a 16-bit value can be read in using this function, regardless of the native size of :c:expr:`short`." +#: ../../c-api/marshal.rst:61 +msgid "" +"Return a C :c:expr:`short` from the data stream in a :c:expr:`FILE*` opened " +"for reading. Only a 16-bit value can be read in using this function, " +"regardless of the native size of :c:expr:`short`." msgstr "" -msgid "Return a Python object from the data stream in a :c:expr:`FILE*` opened for reading." +#: ../../c-api/marshal.rst:71 +msgid "" +"Return a Python object from the data stream in a :c:expr:`FILE*` opened for " +"reading." msgstr "" -msgid "On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`) and returns ``NULL``." +#: ../../c-api/marshal.rst:74 ../../c-api/marshal.rst:88 +#: ../../c-api/marshal.rst:97 +msgid "" +"On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`) and returns ``NULL``." msgstr "" -msgid "Return a Python object from the data stream in a :c:expr:`FILE*` opened for reading. Unlike :c:func:`PyMarshal_ReadObjectFromFile`, this function assumes that no further objects will be read from the file, allowing it to aggressively load file data into memory so that the de-serialization can operate from data in memory rather than reading a byte at a time from the file. Only use this variant if you are certain that you won't be reading anything else from the file." +#: ../../c-api/marshal.rst:80 +msgid "" +"Return a Python object from the data stream in a :c:expr:`FILE*` opened for " +"reading. Unlike :c:func:`PyMarshal_ReadObjectFromFile`, this function " +"assumes that no further objects will be read from the file, allowing it to " +"aggressively load file data into memory so that the de-serialization can " +"operate from data in memory rather than reading a byte at a time from the " +"file. Only use this variant if you are certain that you won't be reading " +"anything else from the file." msgstr "" -msgid "Return a Python object from the data stream in a byte buffer containing *len* bytes pointed to by *data*." +#: ../../c-api/marshal.rst:94 +msgid "" +"Return a Python object from the data stream in a byte buffer containing " +"*len* bytes pointed to by *data*." msgstr "" diff --git a/c-api/memory.po b/c-api/memory.po index 61901419e..49f2a314e 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,24 +24,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/memory.rst:8 msgid "Memory Management" msgstr "" +#: ../../c-api/memory.rst:17 msgid "Overview" msgstr "" -msgid "Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the *Python memory manager*. The Python memory manager has different components which deal with various dynamic storage management aspects, like sharing, segmentation, preallocation or caching." -msgstr "" - -msgid "At the lowest level, a raw memory allocator ensures that there is enough room in the private heap for storing all Python-related data by interacting with the memory manager of the operating system. On top of the raw memory allocator, several object-specific allocators operate on the same heap and implement distinct memory management policies adapted to the peculiarities of every object type. For example, integer objects are managed differently within the heap than strings, tuples or dictionaries because integers imply different storage requirements and speed/space tradeoffs. The Python memory manager thus delegates some of the work to the object-specific allocators, but ensures that the latter operate within the bounds of the private heap." -msgstr "" - -msgid "It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no control over it, even if they regularly manipulate object pointers to memory blocks inside that heap. The allocation of heap space for Python objects and other internal buffers is performed on demand by the Python memory manager through the Python/C API functions listed in this document." +#: ../../c-api/memory.rst:19 +msgid "" +"Memory management in Python involves a private heap containing all Python " +"objects and data structures. The management of this private heap is ensured " +"internally by the *Python memory manager*. The Python memory manager has " +"different components which deal with various dynamic storage management " +"aspects, like sharing, segmentation, preallocation or caching." msgstr "" -msgid "To avoid memory corruption, extension writers should never try to operate on Python objects with the functions exported by the C library: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`. This will result in mixed calls between the C allocator and the Python memory manager with fatal consequences, because they implement different algorithms and operate on different heaps. However, one may safely allocate and release memory blocks with the C library allocator for individual purposes, as shown in the following example::" +#: ../../c-api/memory.rst:25 +msgid "" +"At the lowest level, a raw memory allocator ensures that there is enough " +"room in the private heap for storing all Python-related data by interacting " +"with the memory manager of the operating system. On top of the raw memory " +"allocator, several object-specific allocators operate on the same heap and " +"implement distinct memory management policies adapted to the peculiarities " +"of every object type. For example, integer objects are managed differently " +"within the heap than strings, tuples or dictionaries because integers imply " +"different storage requirements and speed/space tradeoffs. The Python memory " +"manager thus delegates some of the work to the object-specific allocators, " +"but ensures that the latter operate within the bounds of the private heap." +msgstr "" + +#: ../../c-api/memory.rst:36 +msgid "" +"It is important to understand that the management of the Python heap is " +"performed by the interpreter itself and that the user has no control over " +"it, even if they regularly manipulate object pointers to memory blocks " +"inside that heap. The allocation of heap space for Python objects and other " +"internal buffers is performed on demand by the Python memory manager through " +"the Python/C API functions listed in this document." msgstr "" +#: ../../c-api/memory.rst:49 +msgid "" +"To avoid memory corruption, extension writers should never try to operate on " +"Python objects with the functions exported by the C " +"library: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " +"and :c:func:`free`. This will result in mixed calls between the C " +"allocator and the Python memory manager with fatal consequences, because " +"they implement different algorithms and operate on different heaps. " +"However, one may safely allocate and release memory blocks with the C " +"library allocator for individual purposes, as shown in the following " +"example::" +msgstr "" + +#: ../../c-api/memory.rst:58 msgid "" "PyObject *res;\n" "char *buf = (char *) malloc(BUFSIZ); /* for I/O */\n" @@ -54,609 +91,1119 @@ msgid "" "return res;" msgstr "" -msgid "In this example, the memory request for the I/O buffer is handled by the C library allocator. The Python memory manager is involved only in the allocation of the bytes object returned as a result." -msgstr "" - -msgid "In most situations, however, it is recommended to allocate memory from the Python heap specifically because the latter is under control of the Python memory manager. For example, this is required when the interpreter is extended with new object types written in C. Another reason for using the Python heap is the desire to *inform* the Python memory manager about the memory needs of the extension module. Even when the requested memory is used exclusively for internal, highly specific purposes, delegating all memory requests to the Python memory manager causes the interpreter to have a more accurate image of its memory footprint as a whole. Consequently, under certain circumstances, the Python memory manager may or may not trigger appropriate actions, like garbage collection, memory compaction or other preventive procedures. Note that by using the C library allocator as shown in the previous example, the allocated memory for the I/O buffer escapes completely the Python memory manager." +#: ../../c-api/memory.rst:68 +msgid "" +"In this example, the memory request for the I/O buffer is handled by the C " +"library allocator. The Python memory manager is involved only in the " +"allocation of the bytes object returned as a result." msgstr "" -msgid "The :envvar:`PYTHONMALLOC` environment variable can be used to configure the memory allocators used by Python." +#: ../../c-api/memory.rst:72 +msgid "" +"In most situations, however, it is recommended to allocate memory from the " +"Python heap specifically because the latter is under control of the Python " +"memory manager. For example, this is required when the interpreter is " +"extended with new object types written in C. Another reason for using the " +"Python heap is the desire to *inform* the Python memory manager about the " +"memory needs of the extension module. Even when the requested memory is used " +"exclusively for internal, highly specific purposes, delegating all memory " +"requests to the Python memory manager causes the interpreter to have a more " +"accurate image of its memory footprint as a whole. Consequently, under " +"certain circumstances, the Python memory manager may or may not trigger " +"appropriate actions, like garbage collection, memory compaction or other " +"preventive procedures. Note that by using the C library allocator as shown " +"in the previous example, the allocated memory for the I/O buffer completely " +"escapes the Python memory manager." +msgstr "" + +#: ../../c-api/memory.rst:88 +msgid "" +"The :envvar:`PYTHONMALLOC` environment variable can be used to configure the " +"memory allocators used by Python." msgstr "" -msgid "The :envvar:`PYTHONMALLOCSTATS` environment variable can be used to print statistics of the :ref:`pymalloc memory allocator ` every time a new pymalloc object arena is created, and on shutdown." +#: ../../c-api/memory.rst:91 +msgid "" +"The :envvar:`PYTHONMALLOCSTATS` environment variable can be used to print " +"statistics of the :ref:`pymalloc memory allocator ` every time a " +"new pymalloc object arena is created, and on shutdown." msgstr "" +#: ../../c-api/memory.rst:96 msgid "Allocator Domains" msgstr "" -msgid "All allocating functions belong to one of three different \"domains\" (see also :c:type:`PyMemAllocatorDomain`). These domains represent different allocation strategies and are optimized for different purposes. The specific details on how every domain allocates memory or what internal functions each domain calls is considered an implementation detail, but for debugging purposes a simplified table can be found at :ref:`default-memory-allocators`. The APIs used to allocate and free a block of memory must be from the same domain. For example, :c:func:`PyMem_Free` must be used to free memory allocated using :c:func:`PyMem_Malloc`." -msgstr "" - +#: ../../c-api/memory.rst:100 +msgid "" +"All allocating functions belong to one of three different \"domains\" (see " +"also :c:type:`PyMemAllocatorDomain`). These domains represent different " +"allocation strategies and are optimized for different purposes. The specific " +"details on how every domain allocates memory or what internal functions each " +"domain calls is considered an implementation detail, but for debugging " +"purposes a simplified table can be found at :ref:`default-memory-" +"allocators`. The APIs used to allocate and free a block of memory must be " +"from the same domain. For example, :c:func:`PyMem_Free` must be used to free " +"memory allocated using :c:func:`PyMem_Malloc`." +msgstr "" + +#: ../../c-api/memory.rst:109 msgid "The three allocation domains are:" msgstr "" -msgid "Raw domain: intended for allocating memory for general-purpose memory buffers where the allocation *must* go to the system allocator or where the allocator can operate without an :term:`attached thread state`. The memory is requested directly from the system. See :ref:`Raw Memory Interface `." +#: ../../c-api/memory.rst:111 +msgid "" +"Raw domain: intended for allocating memory for general-purpose memory " +"buffers where the allocation *must* go to the system allocator or where the " +"allocator can operate without an :term:`attached thread state`. The memory " +"is requested directly from the system. See :ref:`Raw Memory Interface `." msgstr "" -msgid "\"Mem\" domain: intended for allocating memory for Python buffers and general-purpose memory buffers where the allocation must be performed with an :term:`attached thread state`. The memory is taken from the Python private heap. See :ref:`Memory Interface `." +#: ../../c-api/memory.rst:116 +msgid "" +"\"Mem\" domain: intended for allocating memory for Python buffers and " +"general-purpose memory buffers where the allocation must be performed with " +"an :term:`attached thread state`. The memory is taken from the Python " +"private heap. See :ref:`Memory Interface `." msgstr "" -msgid "Object domain: intended for allocating memory for Python objects. The memory is taken from the Python private heap. See :ref:`Object allocators `." +#: ../../c-api/memory.rst:121 +msgid "" +"Object domain: intended for allocating memory for Python objects. The memory " +"is taken from the Python private heap. See :ref:`Object allocators " +"`." msgstr "" -msgid "The :term:`free-threaded ` build requires that only Python objects are allocated using the \"object\" domain and that all Python objects are allocated using that domain. This differs from the prior Python versions, where this was only a best practice and not a hard requirement." +#: ../../c-api/memory.rst:126 +msgid "" +"The :term:`free-threaded ` build requires that only Python " +"objects are allocated using the \"object\" domain and that all Python " +"objects are allocated using that domain. This differs from the prior Python " +"versions, where this was only a best practice and not a hard requirement." msgstr "" -msgid "For example, buffers (non-Python objects) should be allocated using :c:func:`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:func:`PyObject_Malloc`." +#: ../../c-api/memory.rst:130 +msgid "" +"For example, buffers (non-Python objects) should be allocated " +"using :c:func:`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, " +"or :c:func:`malloc`, but not :c:func:`PyObject_Malloc`." msgstr "" +#: ../../c-api/memory.rst:133 msgid "See :ref:`Memory Allocation APIs `." msgstr "" +#: ../../c-api/memory.rst:139 msgid "Raw Memory Interface" msgstr "" -msgid "The following function sets are wrappers to the system allocator. These functions are thread-safe, so a :term:`thread state` does not need to be :term:`attached `." +#: ../../c-api/memory.rst:141 +msgid "" +"The following function sets are wrappers to the system allocator. These " +"functions are thread-safe, so a :term:`thread state` does not need to " +"be :term:`attached `." msgstr "" -msgid "The :ref:`default raw memory allocator ` uses the following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`!free`; call ``malloc(1)`` (or ``calloc(1, 1)``) when requesting zero bytes." +#: ../../c-api/memory.rst:145 +msgid "" +"The :ref:`default raw memory allocator ` uses the " +"following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " +"and :c:func:`!free`; call ``malloc(1)`` (or ``calloc(1, 1)``) when " +"requesting zero bytes." msgstr "" -msgid "Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the request fails." +#: ../../c-api/memory.rst:154 ../../c-api/memory.rst:232 +#: ../../c-api/memory.rst:365 +msgid "" +"Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the " +"allocated memory, or ``NULL`` if the request fails." msgstr "" -msgid "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not have been initialized in any way." +#: ../../c-api/memory.rst:157 +msgid "" +"Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " +"as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not " +"have been initialized in any way." msgstr "" -msgid "Allocates *nelem* elements each whose size in bytes is *elsize* and returns a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the request fails. The memory is initialized to zeros." +#: ../../c-api/memory.rst:164 ../../c-api/memory.rst:242 +#: ../../c-api/memory.rst:375 +msgid "" +"Allocates *nelem* elements each of size *elsize* bytes and returns a pointer " +"of type :c:expr:`void*` to the allocated memory, or ``NULL`` if the request " +"fails. The memory is initialized to zeros." msgstr "" -msgid "Requesting zero elements or elements of size zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been called instead." +#: ../../c-api/memory.rst:168 +msgid "" +"Requesting zero elements or elements of size zero bytes returns a distinct " +"non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been " +"called instead." msgstr "" -msgid "Resizes the memory block pointed to by *p* to *n* bytes. The contents will be unchanged to the minimum of the old and the new sizes." +#: ../../c-api/memory.rst:177 ../../c-api/memory.rst:255 +#: ../../c-api/memory.rst:388 +msgid "" +"Resizes the memory block pointed to by *p* to *n* bytes. The contents will " +"be unchanged to the minimum of the old and the new sizes." msgstr "" -msgid "If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-``NULL``." +#: ../../c-api/memory.rst:180 +msgid "" +"If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else " +"if *n* is equal to zero, the memory block is resized but is not freed, and " +"the returned pointer is non-``NULL``." msgstr "" -msgid "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:`PyMem_RawCalloc`." +#: ../../c-api/memory.rst:184 +msgid "" +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` " +"or :c:func:`PyMem_RawCalloc`." msgstr "" -msgid "If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* remains a valid pointer to the previous memory area." +#: ../../c-api/memory.rst:188 +msgid "" +"If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* " +"remains a valid pointer to the previous memory area." msgstr "" -msgid "Frees the memory block pointed to by *p*, which must have been returned by a previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has been called before, undefined behavior occurs." +#: ../../c-api/memory.rst:194 +msgid "" +"Frees the memory block pointed to by *p*, which must have been returned by a " +"previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` " +"or :c:func:`PyMem_RawCalloc`. Otherwise, or if ``PyMem_RawFree(p)`` has " +"been called before, undefined behavior occurs." msgstr "" +#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:276 +#: ../../c-api/memory.rst:409 msgid "If *p* is ``NULL``, no operation is performed." msgstr "" +#: ../../c-api/memory.rst:205 msgid "Memory Interface" msgstr "" -msgid "The following function sets, modeled after the ANSI C standard, but specifying behavior when requesting zero bytes, are available for allocating and releasing memory from the Python heap." +#: ../../c-api/memory.rst:207 ../../c-api/memory.rst:344 +msgid "" +"The following function sets, modeled after the ANSI C standard, but " +"specifying behavior when requesting zero bytes, are available for allocating " +"and releasing memory from the Python heap." msgstr "" -msgid "In the GIL-enabled build (default build) the :ref:`default memory allocator ` uses the :ref:`pymalloc memory allocator `, whereas in the :term:`free-threaded build`, the default is the :ref:`mimalloc memory allocator ` instead." +#: ../../c-api/memory.rst:211 +msgid "" +"In the GIL-enabled build (default build) the :ref:`default memory allocator " +"` uses the :ref:`pymalloc memory allocator " +"`, whereas in the :term:`free-threaded build`, the default is " +"the :ref:`mimalloc memory allocator ` instead." msgstr "" -msgid "There must be an :term:`attached thread state` when using these functions." +#: ../../c-api/memory.rst:219 ../../c-api/memory.rst:361 +msgid "" +"There must be an :term:`attached thread state` when using these functions." msgstr "" -msgid "The default allocator is now pymalloc instead of system :c:func:`malloc`." +#: ../../c-api/memory.rst:223 +msgid "" +"The default allocator is now pymalloc instead of system :c:func:`malloc`." msgstr "" -msgid "In the :term:`free-threaded ` build, the default allocator is now :ref:`mimalloc `." +#: ../../c-api/memory.rst:227 +msgid "" +"In the :term:`free-threaded ` build, the default allocator " +"is now :ref:`mimalloc `." msgstr "" -msgid "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have been initialized in any way." +#: ../../c-api/memory.rst:235 +msgid "" +"Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " +"as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have " +"been initialized in any way." msgstr "" -msgid "Requesting zero elements or elements of size zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been called instead." +#: ../../c-api/memory.rst:246 +msgid "" +"Requesting zero elements or elements of size zero bytes returns a distinct " +"non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been " +"called instead." msgstr "" -msgid "If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-``NULL``." +#: ../../c-api/memory.rst:258 +msgid "" +"If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if " +"*n* is equal to zero, the memory block is resized but is not freed, and the " +"returned pointer is non-``NULL``." msgstr "" -msgid "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." +#: ../../c-api/memory.rst:262 +msgid "" +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "" -msgid "If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* remains a valid pointer to the previous memory area." +#: ../../c-api/memory.rst:265 +msgid "" +"If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* " +"remains a valid pointer to the previous memory area." msgstr "" -msgid "Frees the memory block pointed to by *p*, which must have been returned by a previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been called before, undefined behavior occurs." +#: ../../c-api/memory.rst:271 +msgid "" +"Frees the memory block pointed to by *p*, which must have been returned by a " +"previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` " +"or :c:func:`PyMem_Calloc`. Otherwise, or if ``PyMem_Free(p)`` has been " +"called before, undefined behavior occurs." msgstr "" -msgid "The following type-oriented macros are provided for convenience. Note that *TYPE* refers to any C type." +#: ../../c-api/memory.rst:278 +msgid "" +"The following type-oriented macros are provided for convenience. Note that " +"*TYPE* refers to any C type." msgstr "" -msgid "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes of memory. Returns a pointer cast to ``TYPE*``. The memory will not have been initialized in any way." +#: ../../c-api/memory.rst:284 +msgid "" +"Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes " +"of memory. Returns a pointer cast to ``TYPE*``. The memory will not have " +"been initialized in any way." msgstr "" -msgid "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* will be a pointer to the new memory area, or ``NULL`` in the event of failure." +#: ../../c-api/memory.rst:291 +msgid "" +"Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * " +"sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* " +"will be a pointer to the new memory area, or ``NULL`` in the event of " +"failure." msgstr "" -msgid "This is a C preprocessor macro; *p* is always reassigned. Save the original value of *p* to avoid losing memory when handling errors." +#: ../../c-api/memory.rst:296 +msgid "" +"This is a C preprocessor macro; *p* is always reassigned. Save the original " +"value of *p* to avoid losing memory when handling errors." msgstr "" +#: ../../c-api/memory.rst:302 msgid "Same as :c:func:`PyMem_Free`." msgstr "" +#: ../../c-api/memory.rst:306 msgid "Deprecated aliases" msgstr "" -msgid "These are :term:`soft deprecated` aliases to existing functions and macros. They exist solely for backwards compatibility." +#: ../../c-api/memory.rst:308 +msgid "" +"These are :term:`soft deprecated` aliases to existing functions and macros. " +"They exist solely for backwards compatibility." msgstr "" +#: ../../c-api/memory.rst:315 msgid "Deprecated alias" msgstr "" +#: ../../c-api/memory.rst:316 msgid "Corresponding function or macro" msgstr "" +#: ../../c-api/memory.rst:318 msgid ":c:func:`PyMem_Malloc`" msgstr "" +#: ../../c-api/memory.rst:320 msgid ":c:macro:`PyMem_New`" msgstr "" +#: ../../c-api/memory.rst:322 ../../c-api/memory.rst:511 msgid ":c:func:`PyMem_Realloc`" msgstr "" +#: ../../c-api/memory.rst:324 msgid ":c:macro:`PyMem_Resize`" msgstr "" +#: ../../c-api/memory.rst:326 ../../c-api/memory.rst:328 +#: ../../c-api/memory.rst:513 msgid ":c:func:`PyMem_Free`" msgstr "" -msgid "The macros are now aliases of the corresponding functions and macros. Previously, their behavior was the same, but their use did not necessarily preserve binary compatibility across Python versions." +#: ../../c-api/memory.rst:332 +msgid "" +"The macros are now aliases of the corresponding functions and macros. " +"Previously, their behavior was the same, but their use did not necessarily " +"preserve binary compatibility across Python versions." msgstr "" +#: ../../c-api/memory.rst:342 msgid "Object allocators" msgstr "" -msgid "There is no guarantee that the memory returned by these allocators can be successfully cast to a Python object when intercepting the allocating functions in this domain by the methods described in the :ref:`Customize Memory Allocators ` section." +#: ../../c-api/memory.rst:349 +msgid "" +"There is no guarantee that the memory returned by these allocators can be " +"successfully cast to a Python object when intercepting the allocating " +"functions in this domain by the methods described in the :ref:`Customize " +"Memory Allocators ` section." msgstr "" -msgid "The :ref:`default object allocator ` uses the :ref:`pymalloc memory allocator `. In the :term:`free-threaded ` build, the default is the :ref:`mimalloc memory allocator ` instead." +#: ../../c-api/memory.rst:354 +msgid "" +"The :ref:`default object allocator ` uses " +"the :ref:`pymalloc memory allocator `. In the :term:`free-" +"threaded ` build, the default is the :ref:`mimalloc memory " +"allocator ` instead." msgstr "" -msgid "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyObject_Malloc(1)`` had been called instead. The memory will not have been initialized in any way." +#: ../../c-api/memory.rst:368 +msgid "" +"Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " +"as if ``PyObject_Malloc(1)`` had been called instead. The memory will not " +"have been initialized in any way." msgstr "" -msgid "Requesting zero elements or elements of size zero bytes returns a distinct non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been called instead." +#: ../../c-api/memory.rst:379 +msgid "" +"Requesting zero elements or elements of size zero bytes returns a distinct " +"non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been " +"called instead." msgstr "" -msgid "If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-``NULL``." +#: ../../c-api/memory.rst:391 +msgid "" +"If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else " +"if *n* is equal to zero, the memory block is resized but is not freed, and " +"the returned pointer is non-``NULL``." msgstr "" -msgid "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:`PyObject_Calloc`." +#: ../../c-api/memory.rst:395 +msgid "" +"Unless *p* is ``NULL``, it must have been returned by a previous call " +"to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` " +"or :c:func:`PyObject_Calloc`." msgstr "" -msgid "If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* remains a valid pointer to the previous memory area." +#: ../../c-api/memory.rst:398 +msgid "" +"If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* " +"remains a valid pointer to the previous memory area." msgstr "" -msgid "Frees the memory block pointed to by *p*, which must have been returned by a previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has been called before, undefined behavior occurs." +#: ../../c-api/memory.rst:404 +msgid "" +"Frees the memory block pointed to by *p*, which must have been returned by a " +"previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` " +"or :c:func:`PyObject_Calloc`. Otherwise, or if ``PyObject_Free(p)`` has " +"been called before, undefined behavior occurs." msgstr "" -msgid "Do not call this directly to free an object's memory; call the type's :c:member:`~PyTypeObject.tp_free` slot instead." +#: ../../c-api/memory.rst:411 +msgid "" +"Do not call this directly to free an object's memory; call the " +"type's :c:member:`~PyTypeObject.tp_free` slot instead." msgstr "" -msgid "Do not use this for memory allocated by :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`; use :c:func:`PyObject_GC_Del` instead." +#: ../../c-api/memory.rst:414 +msgid "" +"Do not use this for memory allocated by :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`; use :c:func:`PyObject_GC_Del` instead." msgstr "" -msgid ":c:func:`PyObject_GC_Del` is the equivalent of this function for memory allocated by types that support garbage collection." +#: ../../c-api/memory.rst:419 +msgid "" +":c:func:`PyObject_GC_Del` is the equivalent of this function for memory " +"allocated by types that support garbage collection." msgstr "" +#: ../../c-api/memory.rst:421 ../../c-api/memory.rst:519 msgid ":c:func:`PyObject_Malloc`" msgstr "" +#: ../../c-api/memory.rst:422 ../../c-api/memory.rst:520 msgid ":c:func:`PyObject_Realloc`" msgstr "" +#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:521 msgid ":c:func:`PyObject_Calloc`" msgstr "" +#: ../../c-api/memory.rst:424 msgid ":c:macro:`PyObject_New`" msgstr "" +#: ../../c-api/memory.rst:425 msgid ":c:macro:`PyObject_NewVar`" msgstr "" +#: ../../c-api/memory.rst:426 msgid ":c:func:`PyType_GenericAlloc`" msgstr "" +#: ../../c-api/memory.rst:427 msgid ":c:member:`~PyTypeObject.tp_free`" msgstr "" +#: ../../c-api/memory.rst:433 msgid "Default Memory Allocators" msgstr "" +#: ../../c-api/memory.rst:435 msgid "Default memory allocators:" msgstr "" +#: ../../c-api/memory.rst:438 msgid "Configuration" msgstr "" +#: ../../c-api/memory.rst:438 msgid "Name" msgstr "" +#: ../../c-api/memory.rst:438 msgid "PyMem_RawMalloc" msgstr "" +#: ../../c-api/memory.rst:438 msgid "PyMem_Malloc" msgstr "" +#: ../../c-api/memory.rst:438 msgid "PyObject_Malloc" msgstr "" +#: ../../c-api/memory.rst:440 msgid "Release build" msgstr "" +#: ../../c-api/memory.rst:440 msgid "``\"pymalloc\"``" msgstr "" +#: ../../c-api/memory.rst:440 ../../c-api/memory.rst:442 msgid "``malloc``" msgstr "" +#: ../../c-api/memory.rst:440 msgid "``pymalloc``" msgstr "" +#: ../../c-api/memory.rst:441 msgid "Debug build" msgstr "" +#: ../../c-api/memory.rst:441 msgid "``\"pymalloc_debug\"``" msgstr "" +#: ../../c-api/memory.rst:441 ../../c-api/memory.rst:443 msgid "``malloc`` + debug" msgstr "" +#: ../../c-api/memory.rst:441 msgid "``pymalloc`` + debug" msgstr "" +#: ../../c-api/memory.rst:442 msgid "Release build, without pymalloc" msgstr "" +#: ../../c-api/memory.rst:442 msgid "``\"malloc\"``" msgstr "" +#: ../../c-api/memory.rst:443 msgid "Debug build, without pymalloc" msgstr "" +#: ../../c-api/memory.rst:443 msgid "``\"malloc_debug\"``" msgstr "" +#: ../../c-api/memory.rst:444 msgid "Free-threaded build" msgstr "" +#: ../../c-api/memory.rst:444 msgid "``\"mimalloc\"``" msgstr "" +#: ../../c-api/memory.rst:444 msgid "``mimalloc``" msgstr "" +#: ../../c-api/memory.rst:445 msgid "Free-threaded debug build" msgstr "" +#: ../../c-api/memory.rst:445 msgid "``\"mimalloc_debug\"``" msgstr "" +#: ../../c-api/memory.rst:445 msgid "``mimalloc`` + debug" msgstr "" +#: ../../c-api/memory.rst:448 msgid "Legend:" msgstr "" +#: ../../c-api/memory.rst:450 msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." msgstr "" -msgid "``malloc``: system allocators from the standard C library, C functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." +#: ../../c-api/memory.rst:451 +msgid "" +"``malloc``: system allocators from the standard C library, C " +"functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " +"and :c:func:`free`." msgstr "" +#: ../../c-api/memory.rst:453 msgid "``pymalloc``: :ref:`pymalloc memory allocator `." msgstr "" +#: ../../c-api/memory.rst:454 msgid "``mimalloc``: :ref:`mimalloc memory allocator `." msgstr "" -msgid "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." +#: ../../c-api/memory.rst:455 +msgid "" +"\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "" +#: ../../c-api/memory.rst:457 msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "" +#: ../../c-api/memory.rst:462 msgid "Customize Memory Allocators" msgstr "" -msgid "Structure used to describe a memory block allocator. The structure has the following fields:" +#: ../../c-api/memory.rst:468 +msgid "" +"Structure used to describe a memory block allocator. The structure has the " +"following fields:" msgstr "" +#: ../../c-api/memory.rst:472 ../../c-api/memory.rst:723 msgid "Field" msgstr "" +#: ../../c-api/memory.rst:472 ../../c-api/memory.rst:723 msgid "Meaning" msgstr "" +#: ../../c-api/memory.rst:474 ../../c-api/memory.rst:725 msgid "``void *ctx``" msgstr "" +#: ../../c-api/memory.rst:474 ../../c-api/memory.rst:725 msgid "user context passed as first argument" msgstr "" +#: ../../c-api/memory.rst:476 msgid "``void* malloc(void *ctx, size_t size)``" msgstr "" +#: ../../c-api/memory.rst:476 msgid "allocate a memory block" msgstr "" +#: ../../c-api/memory.rst:478 msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "" +#: ../../c-api/memory.rst:478 msgid "allocate a memory block initialized with zeros" msgstr "" +#: ../../c-api/memory.rst:481 msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "" +#: ../../c-api/memory.rst:481 msgid "allocate or resize a memory block" msgstr "" +#: ../../c-api/memory.rst:483 msgid "``void free(void *ctx, void *ptr)``" msgstr "" +#: ../../c-api/memory.rst:483 msgid "free a memory block" msgstr "" -msgid "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." +#: ../../c-api/memory.rst:486 +msgid "" +"The :c:type:`!PyMemAllocator` structure was renamed " +"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" +#: ../../c-api/memory.rst:493 msgid "Enum used to identify an allocator domain. Domains:" msgstr "" +#: ../../c-api/memory.rst:499 ../../c-api/memory.rst:508 +#: ../../c-api/memory.rst:517 msgid "Functions:" msgstr "" +#: ../../c-api/memory.rst:501 msgid ":c:func:`PyMem_RawMalloc`" msgstr "" +#: ../../c-api/memory.rst:502 msgid ":c:func:`PyMem_RawRealloc`" msgstr "" +#: ../../c-api/memory.rst:503 msgid ":c:func:`PyMem_RawCalloc`" msgstr "" +#: ../../c-api/memory.rst:504 msgid ":c:func:`PyMem_RawFree`" msgstr "" +#: ../../c-api/memory.rst:510 msgid ":c:func:`PyMem_Malloc`," msgstr "" +#: ../../c-api/memory.rst:512 msgid ":c:func:`PyMem_Calloc`" msgstr "" +#: ../../c-api/memory.rst:522 msgid ":c:func:`PyObject_Free`" msgstr "" +#: ../../c-api/memory.rst:526 msgid "Get the memory block allocator of the specified domain." msgstr "" +#: ../../c-api/memory.rst:531 msgid "Set the memory block allocator of the specified domain." msgstr "" -msgid "The new allocator must return a distinct non-``NULL`` pointer when requesting zero bytes." +#: ../../c-api/memory.rst:533 +msgid "" +"The new allocator must return a distinct non-``NULL`` pointer when " +"requesting zero bytes." msgstr "" -msgid "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-safe: a :term:`thread state` is not :term:`attached ` when the allocator is called." +#: ../../c-api/memory.rst:536 +msgid "" +"For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" +"safe: a :term:`thread state` is not :term:`attached ` " +"when the allocator is called." msgstr "" -msgid "For the remaining domains, the allocator must also be thread-safe: the allocator may be called in different interpreters that do not share a :term:`GIL`." +#: ../../c-api/memory.rst:540 +msgid "" +"For the remaining domains, the allocator must also be thread-safe: the " +"allocator may be called in different interpreters that do not share " +"a :term:`GIL`." msgstr "" -msgid "If the new allocator is not a hook (does not call the previous allocator), the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the debug hooks on top on the new allocator." +#: ../../c-api/memory.rst:544 +msgid "" +"If the new allocator is not a hook (does not call the previous allocator), " +"the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " +"debug hooks on top on the new allocator." msgstr "" -msgid "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python with PyPreConfig `." +#: ../../c-api/memory.rst:548 +msgid "" +"See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " +"with PyPreConfig `." msgstr "" +#: ../../c-api/memory.rst:553 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr "" -msgid "It can be called after :c:func:`Py_PreInitialize` and before :c:func:`Py_InitializeFromConfig` to install a custom memory allocator. There are no restrictions over the installed allocator other than the ones imposed by the domain (for instance, the Raw Domain allows the allocator to be called without an :term:`attached thread state`). See :ref:`the section on allocator domains ` for more information." +#: ../../c-api/memory.rst:555 +msgid "" +"It can be called after :c:func:`Py_PreInitialize` and " +"before :c:func:`Py_InitializeFromConfig` to install a custom memory " +"allocator. There are no restrictions over the installed allocator other than " +"the ones imposed by the domain (for instance, the Raw Domain allows the " +"allocator to be called without an :term:`attached thread state`). " +"See :ref:`the section on allocator domains ` for more " +"information." msgstr "" -msgid "If called after Python has finish initializing (after :c:func:`Py_InitializeFromConfig` has been called) the allocator **must** wrap the existing allocator. Substituting the current allocator for some other arbitrary one is **not supported**." +#: ../../c-api/memory.rst:563 +msgid "" +"If called after Python has finish initializing " +"(after :c:func:`Py_InitializeFromConfig` has been called) the allocator " +"**must** wrap the existing allocator. Substituting the current allocator for " +"some other arbitrary one is **not supported**." msgstr "" +#: ../../c-api/memory.rst:568 msgid "All allocators must be thread-safe." msgstr "" -msgid "Setup :ref:`debug hooks in the Python memory allocators ` to detect memory errors." +#: ../../c-api/memory.rst:574 +msgid "" +"Setup :ref:`debug hooks in the Python memory allocators ` " +"to detect memory errors." msgstr "" +#: ../../c-api/memory.rst:581 msgid "Debug hooks on the Python memory allocators" msgstr "" -msgid "When :ref:`Python is built in debug mode `, the :c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python preinitialization ` to setup debug hooks on Python memory allocators to detect memory errors." +#: ../../c-api/memory.rst:583 +msgid "" +"When :ref:`Python is built in debug mode `, " +"the :c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python " +"preinitialization ` to setup debug hooks on Python memory " +"allocators to detect memory errors." msgstr "" -msgid "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." +#: ../../c-api/memory.rst:588 +msgid "" +"The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " +"hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -msgid "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks after calling :c:func:`PyMem_SetAllocator`." +#: ../../c-api/memory.rst:591 +msgid "" +"The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " +"after calling :c:func:`PyMem_SetAllocator`." msgstr "" -msgid "These debug hooks fill dynamically allocated memory blocks with special, recognizable bit patterns. Newly allocated memory is filled with the byte ``0xCD`` (``PYMEM_CLEANBYTE``), freed memory is filled with the byte ``0xDD`` (``PYMEM_DEADBYTE``). Memory blocks are surrounded by \"forbidden bytes\" filled with the byte ``0xFD`` (``PYMEM_FORBIDDENBYTE``). Strings of these bytes are unlikely to be valid addresses, floats, or ASCII strings." +#: ../../c-api/memory.rst:594 +msgid "" +"These debug hooks fill dynamically allocated memory blocks with special, " +"recognizable bit patterns. Newly allocated memory is filled with the byte " +"``0xCD`` (``PYMEM_CLEANBYTE``), freed memory is filled with the byte " +"``0xDD`` (``PYMEM_DEADBYTE``). Memory blocks are surrounded by \"forbidden " +"bytes\" filled with the byte ``0xFD`` (``PYMEM_FORBIDDENBYTE``). Strings of " +"these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" +#: ../../c-api/memory.rst:601 msgid "Runtime checks:" msgstr "" -msgid "Detect API violations. For example, detect if :c:func:`PyObject_Free` is called on a memory block allocated by :c:func:`PyMem_Malloc`." +#: ../../c-api/memory.rst:603 +msgid "" +"Detect API violations. For example, detect if :c:func:`PyObject_Free` is " +"called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" +#: ../../c-api/memory.rst:605 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" +#: ../../c-api/memory.rst:606 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -msgid "Check that there is an :term:`attached thread state` when allocator functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called." +#: ../../c-api/memory.rst:607 +msgid "" +"Check that there is an :term:`attached thread state` when allocator " +"functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " +"and :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are " +"called." msgstr "" -msgid "On error, the debug hooks use the :mod:`tracemalloc` module to get the traceback where a memory block was allocated. The traceback is only displayed if :mod:`tracemalloc` is tracing Python memory allocations and the memory block was traced." +#: ../../c-api/memory.rst:612 +msgid "" +"On error, the debug hooks use the :mod:`tracemalloc` module to get the " +"traceback where a memory block was allocated. The traceback is only " +"displayed if :mod:`tracemalloc` is tracing Python memory allocations and the " +"memory block was traced." msgstr "" -msgid "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each block of *N* bytes requested. The memory layout is like so, where p represents the address returned by a malloc-like or realloc-like function (``p[i:j]`` means the slice of bytes from ``*(p+i)`` inclusive up to ``*(p+j)`` exclusive; note that the treatment of negative indices differs from a Python slice):" +#: ../../c-api/memory.rst:617 +msgid "" +"Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " +"block of *N* bytes requested. The memory layout is like so, where p " +"represents the address returned by a malloc-like or realloc-like function " +"(``p[i:j]`` means the slice of bytes from ``*(p+i)`` inclusive up to " +"``*(p+j)`` exclusive; note that the treatment of negative indices differs " +"from a Python slice):" msgstr "" +#: ../../c-api/memory.rst:623 msgid "``p[-2*S:-S]``" msgstr "" -msgid "Number of bytes originally asked for. This is a size_t, big-endian (easier to read in a memory dump)." +#: ../../c-api/memory.rst:624 +msgid "" +"Number of bytes originally asked for. This is a size_t, big-endian (easier " +"to read in a memory dump)." msgstr "" +#: ../../c-api/memory.rst:626 msgid "``p[-S]``" msgstr "" +#: ../../c-api/memory.rst:627 msgid "API identifier (ASCII character):" msgstr "" +#: ../../c-api/memory.rst:629 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "" +#: ../../c-api/memory.rst:630 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "" +#: ../../c-api/memory.rst:631 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "" +#: ../../c-api/memory.rst:633 msgid "``p[-S+1:0]``" msgstr "" +#: ../../c-api/memory.rst:634 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" +#: ../../c-api/memory.rst:636 msgid "``p[0:N]``" msgstr "" -msgid "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch reference to uninitialized memory. When a realloc-like function is called requesting a larger memory block, the new excess bytes are also filled with PYMEM_CLEANBYTE. When a free-like function is called, these are overwritten with PYMEM_DEADBYTE, to catch reference to freed memory. When a realloc- like function is called requesting a smaller memory block, the excess old bytes are also filled with PYMEM_DEADBYTE." +#: ../../c-api/memory.rst:637 +msgid "" +"The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " +"reference to uninitialized memory. When a realloc-like function is called " +"requesting a larger memory block, the new excess bytes are also filled with " +"PYMEM_CLEANBYTE. When a free-like function is called, these are overwritten " +"with PYMEM_DEADBYTE, to catch reference to freed memory. When a realloc- " +"like function is called requesting a smaller memory block, the excess old " +"bytes are also filled with PYMEM_DEADBYTE." msgstr "" +#: ../../c-api/memory.rst:645 msgid "``p[N:N+S]``" msgstr "" +#: ../../c-api/memory.rst:646 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" +#: ../../c-api/memory.rst:648 msgid "``p[N+S:N+2*S]``" msgstr "" -msgid "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by default)." -msgstr "" - -msgid "A serial number, incremented by 1 on each call to a malloc-like or realloc-like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected later, the serial number gives an excellent way to set a breakpoint on the next run, to capture the instant at which this block was passed out. The static function bumpserialno() in obmalloc.c is the only place the serial number is incremented, and exists so you can set such a breakpoint easily." +#: ../../c-api/memory.rst:649 +msgid "" +"Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " +"default)." msgstr "" -msgid "A realloc-like or free-like function first checks that the PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, diagnostic output is written to stderr, and the program is aborted via Py_FatalError(). The other main failure mode is provoking a memory error when a program reads up one of the special bit patterns and tries to use it as an address. If you get in a debugger then and look at the object, you're likely to see that it's entirely filled with PYMEM_DEADBYTE (meaning freed memory is getting used) or PYMEM_CLEANBYTE (meaning uninitialized memory is getting used)." +#: ../../c-api/memory.rst:652 +msgid "" +"A serial number, incremented by 1 on each call to a malloc-like or realloc-" +"like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " +"later, the serial number gives an excellent way to set a breakpoint on the " +"next run, to capture the instant at which this block was passed out. The " +"static function bumpserialno() in obmalloc.c is the only place the serial " +"number is incremented, and exists so you can set such a breakpoint easily." msgstr "" -msgid "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python compiled in release mode. On error, the debug hooks now use :mod:`tracemalloc` to get the traceback where a memory block was allocated. The debug hooks now also check if there is an :term:`attached thread state` when functions of :c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." +#: ../../c-api/memory.rst:659 +msgid "" +"A realloc-like or free-like function first checks that the " +"PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " +"diagnostic output is written to stderr, and the program is aborted via " +"Py_FatalError(). The other main failure mode is provoking a memory error " +"when a program reads up one of the special bit patterns and tries to use it " +"as an address. If you get in a debugger then and look at the object, you're " +"likely to see that it's entirely filled with PYMEM_DEADBYTE (meaning freed " +"memory is getting used) or PYMEM_CLEANBYTE (meaning uninitialized memory is " +"getting used)." +msgstr "" + +#: ../../c-api/memory.rst:668 +msgid "" +"The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " +"compiled in release mode. On error, the debug hooks now " +"use :mod:`tracemalloc` to get the traceback where a memory block was " +"allocated. The debug hooks now also check if there is an :term:`attached " +"thread state` when functions of :c:macro:`PYMEM_DOMAIN_OBJ` " +"and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." msgstr "" -msgid "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, ``0xDD`` and ``0xFD`` to use the same values than Windows CRT debug ``malloc()`` and ``free()``." +#: ../../c-api/memory.rst:676 +msgid "" +"Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " +"and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " +"``0xDD`` and ``0xFD`` to use the same values than Windows CRT debug " +"``malloc()`` and ``free()``." msgstr "" +#: ../../c-api/memory.rst:686 msgid "The pymalloc allocator" msgstr "" -msgid "Python has a *pymalloc* allocator optimized for small objects (smaller or equal to 512 bytes) with a short lifetime. It uses memory mappings called \"arenas\" with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` and :c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes." +#: ../../c-api/memory.rst:688 +msgid "" +"Python has a *pymalloc* allocator optimized for small objects (smaller or " +"equal to 512 bytes) with a short lifetime. It uses memory mappings called " +"\"arenas\" with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB " +"on 64-bit platforms. It falls back to :c:func:`PyMem_RawMalloc` " +"and :c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" -msgid "*pymalloc* is the :ref:`default allocator ` of the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." +#: ../../c-api/memory.rst:694 +msgid "" +"*pymalloc* is the :ref:`default allocator ` of " +"the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) " +"and :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" +#: ../../c-api/memory.rst:698 msgid "The arena allocator uses the following functions:" msgstr "" +#: ../../c-api/memory.rst:700 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr "" +#: ../../c-api/memory.rst:701 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr "" +#: ../../c-api/memory.rst:702 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -msgid "This allocator is disabled if Python is configured with the :option:`--without-pymalloc` option. It can also be disabled at runtime using the :envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." +#: ../../c-api/memory.rst:704 +msgid "" +"This allocator is disabled if Python is configured with the :option:`--" +"without-pymalloc` option. It can also be disabled at runtime using " +"the :envvar:`PYTHONMALLOC` environment variable (ex: " +"``PYTHONMALLOC=malloc``)." msgstr "" -msgid "Typically, it makes sense to disable the pymalloc allocator when building Python with AddressSanitizer (:option:`--with-address-sanitizer`) which helps uncover low level bugs within the C code." +#: ../../c-api/memory.rst:708 +msgid "" +"Typically, it makes sense to disable the pymalloc allocator when building " +"Python with AddressSanitizer (:option:`--with-address-sanitizer`) which " +"helps uncover low level bugs within the C code." msgstr "" +#: ../../c-api/memory.rst:713 msgid "Customize pymalloc Arena Allocator" msgstr "" -msgid "Structure used to describe an arena allocator. The structure has three fields:" +#: ../../c-api/memory.rst:719 +msgid "" +"Structure used to describe an arena allocator. The structure has three " +"fields:" msgstr "" +#: ../../c-api/memory.rst:727 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "" +#: ../../c-api/memory.rst:727 msgid "allocate an arena of size bytes" msgstr "" +#: ../../c-api/memory.rst:729 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "" +#: ../../c-api/memory.rst:729 msgid "free an arena" msgstr "" +#: ../../c-api/memory.rst:734 msgid "Get the arena allocator." msgstr "" +#: ../../c-api/memory.rst:738 msgid "Set the arena allocator." msgstr "" +#: ../../c-api/memory.rst:743 msgid "The mimalloc allocator" msgstr "" -msgid "Python supports the `mimalloc `__ allocator when the underlying platform support is available. mimalloc is a general purpose allocator with excellent performance characteristics, initially developed by Daan Leijen for the runtime systems of the Koka and Lean languages." +#: ../../c-api/memory.rst:747 +msgid "" +"Python supports the `mimalloc `__ " +"allocator when the underlying platform support is available. mimalloc is a " +"general purpose allocator with excellent performance characteristics, " +"initially developed by Daan Leijen for the runtime systems of the Koka and " +"Lean languages." msgstr "" -msgid "Unlike :ref:`pymalloc `, which is optimized for small objects (512 bytes or fewer), mimalloc handles allocations of any size." +#: ../../c-api/memory.rst:753 +msgid "" +"Unlike :ref:`pymalloc `, which is optimized for small objects (512 " +"bytes or fewer), mimalloc handles allocations of any size." msgstr "" -msgid "In the :term:`free-threaded ` build, mimalloc is the default and **required** allocator for the :c:macro:`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains. It cannot be disabled in free-threaded builds. The free-threaded build uses per-thread mimalloc heaps, which allows allocation and deallocation to proceed without locking in most cases." +#: ../../c-api/memory.rst:756 +msgid "" +"In the :term:`free-threaded ` build, mimalloc is the default " +"and **required** allocator for the :c:macro:`PYMEM_DOMAIN_MEM` " +"and :c:macro:`PYMEM_DOMAIN_OBJ` domains. It cannot be disabled in free-" +"threaded builds. The free-threaded build uses per-thread mimalloc heaps, " +"which allows allocation and deallocation to proceed without locking in most " +"cases." msgstr "" -msgid "In the default (non-free-threaded) build, mimalloc is available but not the default allocator. It can be selected at runtime using :envvar:`PYTHONMALLOC`\\ ``=mimalloc`` (or ``mimalloc_debug`` to include :ref:`debug hooks `). It can be disabled at build time using the :option:`--without-mimalloc` configure option, but this option cannot be combined with :option:`--disable-gil`." +#: ../../c-api/memory.rst:762 +msgid "" +"In the default (non-free-threaded) build, mimalloc is available but not the " +"default allocator. It can be selected at runtime " +"using :envvar:`PYTHONMALLOC`\\ ``=mimalloc`` (or ``mimalloc_debug`` to " +"include :ref:`debug hooks `). It can be disabled at " +"build time using the :option:`--without-mimalloc` configure option, but this " +"option cannot be combined with :option:`--disable-gil`." msgstr "" +#: ../../c-api/memory.rst:770 msgid "tracemalloc C API" msgstr "" +#: ../../c-api/memory.rst:776 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -msgid "Return ``0`` on success, return ``-1`` on error (failed to allocate memory to store the trace). Return ``-2`` if tracemalloc is disabled." +#: ../../c-api/memory.rst:778 +msgid "" +"Return ``0`` on success, return ``-1`` on error (failed to allocate memory " +"to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" +#: ../../c-api/memory.rst:781 msgid "If memory block is already tracked, update the existing trace." msgstr "" -msgid "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do nothing if the block was not tracked." +#: ../../c-api/memory.rst:785 +msgid "" +"Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " +"nothing if the block was not tracked." msgstr "" +#: ../../c-api/memory.rst:788 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" +#: ../../c-api/memory.rst:794 msgid "Examples" msgstr "" -msgid "Here is the example from section :ref:`memoryoverview`, rewritten so that the I/O buffer is allocated from the Python heap by using the first function set::" +#: ../../c-api/memory.rst:796 +msgid "" +"Here is the example from section :ref:`memoryoverview`, rewritten so that " +"the I/O buffer is allocated from the Python heap by using the first function " +"set::" msgstr "" +#: ../../c-api/memory.rst:799 msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" @@ -669,9 +1216,11 @@ msgid "" "return res;" msgstr "" +#: ../../c-api/memory.rst:809 msgid "The same code using the type-oriented function set::" msgstr "" +#: ../../c-api/memory.rst:811 msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" @@ -684,9 +1233,17 @@ msgid "" "return res;" msgstr "" -msgid "Note that in the two examples above, the buffer is always manipulated via functions belonging to the same set. Indeed, it is required to use the same memory API family for a given memory block, so that the risk of mixing different allocators is reduced to a minimum. The following code sequence contains two errors, one of which is labeled as *fatal* because it mixes two different allocators operating on different heaps. ::" +#: ../../c-api/memory.rst:821 +msgid "" +"Note that in the two examples above, the buffer is always manipulated via " +"functions belonging to the same set. Indeed, it is required to use the same " +"memory API family for a given memory block, so that the risk of mixing " +"different allocators is reduced to a minimum. The following code sequence " +"contains two errors, one of which is labeled as *fatal* because it mixes two " +"different allocators operating on different heaps. ::" msgstr "" +#: ../../c-api/memory.rst:828 msgid "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" @@ -697,20 +1254,32 @@ msgid "" "free(buf1); /* Fatal -- should be PyMem_Free() */" msgstr "" -msgid "In addition to the functions aimed at handling raw memory blocks from the Python heap, objects in Python are allocated and released with :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Free`." +#: ../../c-api/memory.rst:836 +msgid "" +"In addition to the functions aimed at handling raw memory blocks from the " +"Python heap, objects in Python are allocated and released " +"with :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar` " +"and :c:func:`PyObject_Free`." msgstr "" -msgid "These will be explained in the next chapter on defining and implementing new object types in C." +#: ../../c-api/memory.rst:840 +msgid "" +"These will be explained in the next chapter on defining and implementing new " +"object types in C." msgstr "" +#: ../../c-api/memory.rst:43 msgid "malloc (C function)" msgstr "" +#: ../../c-api/memory.rst:43 msgid "calloc (C function)" msgstr "" +#: ../../c-api/memory.rst:43 msgid "realloc (C function)" msgstr "" +#: ../../c-api/memory.rst:43 msgid "free (C function)" msgstr "" diff --git a/c-api/memoryview.po b/c-api/memoryview.po index 7d59cd517..521c250ea 100644 --- a/c-api/memoryview.po +++ b/c-api/memoryview.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,47 +22,93 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/memoryview.rst:9 msgid "MemoryView objects" msgstr "" -msgid "A :class:`memoryview` object exposes the C level :ref:`buffer interface ` as a Python object which can then be passed around like any other object." +#: ../../c-api/memoryview.rst:11 +msgid "" +"A :class:`memoryview` object exposes the C level :ref:`buffer interface " +"` as a Python object which can then be passed around like any " +"other object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python memoryview type. This is the same object as :class:`memoryview` in the Python layer." +#: ../../c-api/memoryview.rst:18 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python memoryview " +"type. This is the same object as :class:`memoryview` in the Python layer." msgstr "" -msgid "Create a memoryview object from an object that provides the buffer interface. If *obj* supports writable buffer exports, the memoryview object will be read/write, otherwise it may be either read-only or read/write at the discretion of the exporter." +#: ../../c-api/memoryview.rst:24 +msgid "" +"Create a memoryview object from an object that provides the buffer " +"interface. If *obj* supports writable buffer exports, the memoryview object " +"will be read/write, otherwise it may be either read-only or read/write at " +"the discretion of the exporter." msgstr "" +#: ../../c-api/memoryview.rst:32 msgid "Flag to request a readonly buffer." msgstr "" +#: ../../c-api/memoryview.rst:37 msgid "Flag to request a writable buffer." msgstr "" -msgid "Create a memoryview object using *mem* as the underlying buffer. *flags* can be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." +#: ../../c-api/memoryview.rst:42 +msgid "" +"Create a memoryview object using *mem* as the underlying buffer. *flags* can " +"be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." msgstr "" -msgid "Create a memoryview object wrapping the given buffer structure *view*. For simple byte buffers, :c:func:`PyMemoryView_FromMemory` is the preferred function." +#: ../../c-api/memoryview.rst:49 +msgid "" +"Create a memoryview object wrapping the given buffer structure *view*. For " +"simple byte buffers, :c:func:`PyMemoryView_FromMemory` is the preferred " +"function." msgstr "" -msgid "Create a memoryview object to a :term:`contiguous` chunk of memory (in either 'C' or 'F'ortran *order*) from an object that defines the buffer interface. If memory is contiguous, the memoryview object points to the original memory. Otherwise, a copy is made and the memoryview points to a new bytes object." +#: ../../c-api/memoryview.rst:55 +msgid "" +"Create a memoryview object to a :term:`contiguous` chunk of memory (in " +"either 'C' or 'F'ortran *order*) from an object that defines the buffer " +"interface. If memory is contiguous, the memoryview object points to the " +"original memory. Otherwise, a copy is made and the memoryview points to a " +"new bytes object." msgstr "" -msgid "*buffertype* can be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." +#: ../../c-api/memoryview.rst:61 +msgid "" +"*buffertype* can be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." msgstr "" -msgid "Return true if the object *obj* is a memoryview object. It is not currently allowed to create subclasses of :class:`memoryview`. This function always succeeds." +#: ../../c-api/memoryview.rst:66 +msgid "" +"Return true if the object *obj* is a memoryview object. It is not currently " +"allowed to create subclasses of :class:`memoryview`. This function always " +"succeeds." msgstr "" -msgid "Return a pointer to the memoryview's private copy of the exporter's buffer. *mview* **must** be a memoryview instance; this macro doesn't check its type, you must do it yourself or you will risk crashes." +#: ../../c-api/memoryview.rst:73 +msgid "" +"Return a pointer to the memoryview's private copy of the exporter's buffer. " +"*mview* **must** be a memoryview instance; this macro doesn't check its " +"type, you must do it yourself or you will risk crashes." msgstr "" -msgid "Return either a pointer to the exporting object that the memoryview is based on or ``NULL`` if the memoryview has been created by one of the functions :c:func:`PyMemoryView_FromMemory` or :c:func:`PyMemoryView_FromBuffer`. *mview* **must** be a memoryview instance." +#: ../../c-api/memoryview.rst:79 +msgid "" +"Return either a pointer to the exporting object that the memoryview is based " +"on or ``NULL`` if the memoryview has been created by one of the " +"functions :c:func:`PyMemoryView_FromMemory` " +"or :c:func:`PyMemoryView_FromBuffer`. *mview* **must** be a memoryview " +"instance." msgstr "" +#: ../../c-api/memoryview.rst:5 msgid "object" msgstr "" +#: ../../c-api/memoryview.rst:5 msgid "memoryview" msgstr "" diff --git a/c-api/method.po b/c-api/method.po index 470a639da..ba4e504c1 100644 --- a/c-api/method.po +++ b/c-api/method.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,62 +23,106 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/method.rst:6 msgid "Instance Method Objects" msgstr "" -msgid "An instance method is a wrapper for a :c:type:`PyCFunction` and the new way to bind a :c:type:`PyCFunction` to a class object. It replaces the former call ``PyMethod_New(func, NULL, class)``." +#: ../../c-api/method.rst:10 +msgid "" +"An instance method is a wrapper for a :c:type:`PyCFunction` and the new way " +"to bind a :c:type:`PyCFunction` to a class object. It replaces the former " +"call ``PyMethod_New(func, NULL, class)``." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python instance method type. It is not exposed to Python programs." +#: ../../c-api/method.rst:17 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python instance " +"method type. It is not exposed to Python programs." msgstr "" -msgid "Return true if *o* is an instance method object (has type :c:data:`PyInstanceMethod_Type`). The parameter must not be ``NULL``. This function always succeeds." +#: ../../c-api/method.rst:23 +msgid "" +"Return true if *o* is an instance method object (has " +"type :c:data:`PyInstanceMethod_Type`). The parameter must not be ``NULL``. " +"This function always succeeds." msgstr "" -msgid "Return a new instance method object, with *func* being any callable object. *func* is the function that will be called when the instance method is called." +#: ../../c-api/method.rst:30 +msgid "" +"Return a new instance method object, with *func* being any callable object. " +"*func* is the function that will be called when the instance method is " +"called." msgstr "" +#: ../../c-api/method.rst:37 msgid "Return the function object associated with the instance method *im*." msgstr "" -msgid "Macro version of :c:func:`PyInstanceMethod_Function` which avoids error checking." +#: ../../c-api/method.rst:42 +msgid "" +"Macro version of :c:func:`PyInstanceMethod_Function` which avoids error " +"checking." msgstr "" +#: ../../c-api/method.rst:48 msgid "Method Objects" msgstr "" -msgid "Methods are bound function objects. Methods are always bound to an instance of a user-defined class. Unbound methods (methods bound to a class object) are no longer available." +#: ../../c-api/method.rst:52 +msgid "" +"Methods are bound function objects. Methods are always bound to an instance " +"of a user-defined class. Unbound methods (methods bound to a class object) " +"are no longer available." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python method type. This is exposed to Python programs as ``types.MethodType``." +#: ../../c-api/method.rst:61 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python method type. " +"This is exposed to Python programs as ``types.MethodType``." msgstr "" -msgid "Return true if *o* is a method object (has type :c:data:`PyMethod_Type`). The parameter must not be ``NULL``. This function always succeeds." +#: ../../c-api/method.rst:67 +msgid "" +"Return true if *o* is a method object (has type :c:data:`PyMethod_Type`). " +"The parameter must not be ``NULL``. This function always succeeds." msgstr "" -msgid "Return a new method object, with *func* being any callable object and *self* the instance the method should be bound. *func* is the function that will be called when the method is called. *self* must not be ``NULL``." +#: ../../c-api/method.rst:73 +msgid "" +"Return a new method object, with *func* being any callable object and *self* " +"the instance the method should be bound. *func* is the function that will be " +"called when the method is called. *self* must not be ``NULL``." msgstr "" +#: ../../c-api/method.rst:80 msgid "Return the function object associated with the method *meth*." msgstr "" -msgid "Macro version of :c:func:`PyMethod_Function` which avoids error checking." +#: ../../c-api/method.rst:85 +msgid "" +"Macro version of :c:func:`PyMethod_Function` which avoids error checking." msgstr "" +#: ../../c-api/method.rst:90 msgid "Return the instance associated with the method *meth*." msgstr "" +#: ../../c-api/method.rst:95 msgid "Macro version of :c:func:`PyMethod_Self` which avoids error checking." msgstr "" +#: ../../c-api/method.rst:8 ../../c-api/method.rst:50 msgid "object" msgstr "" +#: ../../c-api/method.rst:8 msgid "instancemethod" msgstr "" +#: ../../c-api/method.rst:50 msgid "method" msgstr "" +#: ../../c-api/method.rst:59 msgid "MethodType (in module types)" msgstr "" diff --git a/c-api/module.po b/c-api/module.po index 135c0b41d..64fbb6246 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,270 +23,555 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/module.rst:6 msgid "Module Objects" msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python module type. This is exposed to Python programs as :py:class:`types.ModuleType`." +#: ../../c-api/module.rst:15 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python module type. " +"This is exposed to Python programs as :py:class:`types.ModuleType`." msgstr "" -msgid "Return true if *p* is a module object, or a subtype of a module object. This function always succeeds." +#: ../../c-api/module.rst:21 +msgid "" +"Return true if *p* is a module object, or a subtype of a module object. This " +"function always succeeds." msgstr "" -msgid "Return true if *p* is a module object, but not a subtype of :c:data:`PyModule_Type`. This function always succeeds." +#: ../../c-api/module.rst:27 +msgid "" +"Return true if *p* is a module object, but not a subtype " +"of :c:data:`PyModule_Type`. This function always succeeds." msgstr "" -msgid "Return a new module object with :attr:`module.__name__` set to *name*. The module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!__name__` are set to ``None``). The caller is responsible for setting a :attr:`~module.__file__` attribute." +#: ../../c-api/module.rst:40 +msgid "" +"Return a new module object with :attr:`module.__name__` set to *name*. The " +"module's :attr:`!" +"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!" +"__name__` are set to ``None``). The caller is responsible for setting " +"a :attr:`~module.__file__` attribute." msgstr "" +#: ../../c-api/module.rst:46 ../../c-api/module.rst:439 +#: ../../c-api/module.rst:466 msgid "Return ``NULL`` with an exception set on error." msgstr "" -msgid ":attr:`~module.__package__` and :attr:`~module.__loader__` are now set to ``None``." +#: ../../c-api/module.rst:50 +msgid "" +":attr:`~module.__package__` and :attr:`~module.__loader__` are now set to " +"``None``." msgstr "" -msgid "Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded string instead of a Unicode object." +#: ../../c-api/module.rst:57 +msgid "" +"Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded " +"string instead of a Unicode object." msgstr "" -msgid "Return the dictionary object that implements *module*'s namespace; this object is the same as the :attr:`~object.__dict__` attribute of the module object. If *module* is not a module object (or a subtype of a module object), :exc:`SystemError` is raised and ``NULL`` is returned." +#: ../../c-api/module.rst:65 +msgid "" +"Return the dictionary object that implements *module*'s namespace; this " +"object is the same as the :attr:`~object.__dict__` attribute of the module " +"object. If *module* is not a module object (or a subtype of a module " +"object), :exc:`SystemError` is raised and ``NULL`` is returned." msgstr "" -msgid "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` functions rather than directly manipulate a module's :attr:`~object.__dict__`." +#: ../../c-api/module.rst:70 +msgid "" +"It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " +"functions rather than directly manipulate a " +"module's :attr:`~object.__dict__`." msgstr "" -msgid "The returned reference is borrowed from the module; it is valid until the module is destroyed." +#: ../../c-api/module.rst:74 +msgid "" +"The returned reference is borrowed from the module; it is valid until the " +"module is destroyed." msgstr "" -msgid "Return *module*'s :attr:`~module.__name__` value. If the module does not provide one, or if it is not a string, :exc:`SystemError` is raised and ``NULL`` is returned." +#: ../../c-api/module.rst:84 +msgid "" +"Return *module*'s :attr:`~module.__name__` value. If the module does not " +"provide one, or if it is not a string, :exc:`SystemError` is raised and " +"``NULL`` is returned." msgstr "" -msgid "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to ``'utf-8'``." +#: ../../c-api/module.rst:93 +msgid "" +"Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " +"``'utf-8'``." msgstr "" -msgid "The returned buffer is only valid until the module is renamed or destroyed. Note that Python code may rename a module by setting its :py:attr:`~module.__name__` attribute." +#: ../../c-api/module.rst:96 +msgid "" +"The returned buffer is only valid until the module is renamed or destroyed. " +"Note that Python code may rename a module by setting " +"its :py:attr:`~module.__name__` attribute." msgstr "" -msgid "Return the \"state\" of the module, that is, a pointer to the block of memory allocated at module creation time, or ``NULL``. See :c:member:`PyModuleDef.m_size`." +#: ../../c-api/module.rst:102 +msgid "" +"Return the \"state\" of the module, that is, a pointer to the block of " +"memory allocated at module creation time, or ``NULL``. " +"See :c:member:`PyModuleDef.m_size`." msgstr "" -msgid "Return a pointer to the :c:type:`PyModuleDef` struct from which the module was created, or ``NULL`` if the module wasn't created from a definition." +#: ../../c-api/module.rst:109 +msgid "" +"Return a pointer to the :c:type:`PyModuleDef` struct from which the module " +"was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -msgid "On error, return ``NULL`` with an exception set. Use :c:func:`PyErr_Occurred` to tell this case apart from a missing :c:type:`!PyModuleDef`." +#: ../../c-api/module.rst:112 +msgid "" +"On error, return ``NULL`` with an exception set. " +"Use :c:func:`PyErr_Occurred` to tell this case apart from a " +"missing :c:type:`!PyModuleDef`." msgstr "" -msgid "Return the name of the file from which *module* was loaded using *module*'s :attr:`~module.__file__` attribute. If this is not defined, or if it is not a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a reference to a Unicode object." +#: ../../c-api/module.rst:123 +msgid "" +"Return the name of the file from which *module* was loaded using " +"*module*'s :attr:`~module.__file__` attribute. If this is not defined, or " +"if it is not a string, raise :exc:`SystemError` and return ``NULL``; " +"otherwise return a reference to a Unicode object." msgstr "" -msgid "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename encoded to 'utf-8'." +#: ../../c-api/module.rst:133 +msgid "" +"Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " +"encoded to 'utf-8'." msgstr "" -msgid "The returned buffer is only valid until the module's :py:attr:`~module.__file__` attribute is reassigned or the module is destroyed." +#: ../../c-api/module.rst:136 +msgid "" +"The returned buffer is only valid until the " +"module's :py:attr:`~module.__file__` attribute is reassigned or the module " +"is destroyed." msgstr "" -msgid ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." +#: ../../c-api/module.rst:139 +msgid "" +":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " +"unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" +#: ../../c-api/module.rst:147 msgid "Module definitions" msgstr "" -msgid "The functions in the previous section work on any module object, including modules imported from Python code." +#: ../../c-api/module.rst:149 +msgid "" +"The functions in the previous section work on any module object, including " +"modules imported from Python code." msgstr "" -msgid "Modules defined using the C API typically use a *module definition*, :c:type:`PyModuleDef` -- a statically allocated, constant “description\" of how a module should be created." +#: ../../c-api/module.rst:152 +msgid "" +"Modules defined using the C API typically use a *module " +"definition*, :c:type:`PyModuleDef` -- a statically allocated, constant " +"“description\" of how a module should be created." msgstr "" -msgid "The definition is usually used to define an extension's “main” module object (see :ref:`extension-modules` for details). It is also used to :ref:`create extension modules dynamically `." +#: ../../c-api/module.rst:156 +msgid "" +"The definition is usually used to define an extension's “main” module object " +"(see :ref:`extension-modules` for details). It is also used to :ref:`create " +"extension modules dynamically `." msgstr "" -msgid "Unlike :c:func:`PyModule_New`, the definition allows management of *module state* -- a piece of memory that is allocated and cleared together with the module object. Unlike the module's Python attributes, Python code cannot replace or delete data stored in module state." +#: ../../c-api/module.rst:161 +msgid "" +"Unlike :c:func:`PyModule_New`, the definition allows management of *module " +"state* -- a piece of memory that is allocated and cleared together with the " +"module object. Unlike the module's Python attributes, Python code cannot " +"replace or delete data stored in module state." msgstr "" -msgid "The module definition struct, which holds all information needed to create a module object. This structure must be statically allocated (or be otherwise guaranteed to be valid while any modules created from it exist). Usually, there is only one variable of this type for each extension module." +#: ../../c-api/module.rst:169 +msgid "" +"The module definition struct, which holds all information needed to create a " +"module object. This structure must be statically allocated (or be otherwise " +"guaranteed to be valid while any modules created from it exist). Usually, " +"there is only one variable of this type for each extension module." msgstr "" +#: ../../c-api/module.rst:177 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" +#: ../../c-api/module.rst:181 msgid "Name for the new module." msgstr "" -msgid "Docstring for the module; usually a docstring variable created with :c:macro:`PyDoc_STRVAR` is used." +#: ../../c-api/module.rst:185 +msgid "" +"Docstring for the module; usually a docstring variable created " +"with :c:macro:`PyDoc_STRVAR` is used." msgstr "" -msgid "Module state may be kept in a per-module memory area that can be retrieved with :c:func:`PyModule_GetState`, rather than in static globals. This makes modules safe for use in multiple sub-interpreters." +#: ../../c-api/module.rst:190 +msgid "" +"Module state may be kept in a per-module memory area that can be retrieved " +"with :c:func:`PyModule_GetState`, rather than in static globals. This makes " +"modules safe for use in multiple sub-interpreters." msgstr "" -msgid "This memory area is allocated based on *m_size* on module creation, and freed when the module object is deallocated, after the :c:member:`~PyModuleDef.m_free` function has been called, if present." +#: ../../c-api/module.rst:194 +msgid "" +"This memory area is allocated based on *m_size* on module creation, and " +"freed when the module object is deallocated, after " +"the :c:member:`~PyModuleDef.m_free` function has been called, if present." msgstr "" -msgid "Setting it to a non-negative value means that the module can be re-initialized and specifies the additional amount of memory it requires for its state." +#: ../../c-api/module.rst:198 +msgid "" +"Setting it to a non-negative value means that the module can be re-" +"initialized and specifies the additional amount of memory it requires for " +"its state." msgstr "" -msgid "Setting ``m_size`` to ``-1`` means that the module does not support sub-interpreters, because it has global state. Negative ``m_size`` is only allowed when using :ref:`legacy single-phase initialization ` or when :ref:`creating modules dynamically `." +#: ../../c-api/module.rst:202 +msgid "" +"Setting ``m_size`` to ``-1`` means that the module does not support sub-" +"interpreters, because it has global state. Negative ``m_size`` is only " +"allowed when using :ref:`legacy single-phase initialization ` or when :ref:`creating modules dynamically `." msgstr "" +#: ../../c-api/module.rst:208 msgid "See :PEP:`3121` for more details." msgstr "" -msgid "A pointer to a table of module-level functions, described by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are present." +#: ../../c-api/module.rst:212 +msgid "" +"A pointer to a table of module-level functions, described " +"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " +"present." msgstr "" -msgid "An array of slot definitions for multi-phase initialization, terminated by a ``{0, NULL}`` entry. When using legacy single-phase initialization, *m_slots* must be ``NULL``." +#: ../../c-api/module.rst:217 +msgid "" +"An array of slot definitions for multi-phase initialization, terminated by a " +"``{0, NULL}`` entry. When using legacy single-phase initialization, " +"*m_slots* must be ``NULL``." msgstr "" -msgid "Prior to version 3.5, this member was always set to ``NULL``, and was defined as:" +#: ../../c-api/module.rst:223 +msgid "" +"Prior to version 3.5, this member was always set to ``NULL``, and was " +"defined as:" msgstr "" -msgid "A traversal function to call during GC traversal of the module object, or ``NULL`` if not needed." +#: ../../c-api/module.rst:230 +msgid "" +"A traversal function to call during GC traversal of the module object, or " +"``NULL`` if not needed." msgstr "" -msgid "This function is not called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (:c:data:`Py_mod_exec` function). More precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is greater than 0 and the module state (as returned by :c:func:`PyModule_GetState`) is ``NULL``." +#: ../../c-api/module.rst:233 ../../c-api/module.rst:248 +#: ../../c-api/module.rst:269 +msgid "" +"This function is not called if the module state was requested but is not " +"allocated yet. This is the case immediately after the module is created and " +"before the module is executed (:c:data:`Py_mod_exec` function). More " +"precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " +"greater than 0 and the module state (as returned " +"by :c:func:`PyModule_GetState`) is ``NULL``." msgstr "" +#: ../../c-api/module.rst:240 ../../c-api/module.rst:261 +#: ../../c-api/module.rst:276 msgid "No longer called before the module state is allocated." msgstr "" -msgid "A clear function to call during GC clearing of the module object, or ``NULL`` if not needed." +#: ../../c-api/module.rst:245 +msgid "" +"A clear function to call during GC clearing of the module object, or " +"``NULL`` if not needed." msgstr "" -msgid "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called before a module is deallocated. For example, when reference counting is enough to determine that an object is no longer used, the cyclic garbage collector is not involved and :c:member:`~PyModuleDef.m_free` is called directly." +#: ../../c-api/module.rst:255 +msgid "" +"Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " +"before a module is deallocated. For example, when reference counting is " +"enough to determine that an object is no longer used, the cyclic garbage " +"collector is not involved and :c:member:`~PyModuleDef.m_free` is called " +"directly." msgstr "" -msgid "A function to call during deallocation of the module object, or ``NULL`` if not needed." +#: ../../c-api/module.rst:266 +msgid "" +"A function to call during deallocation of the module object, or ``NULL`` if " +"not needed." msgstr "" +#: ../../c-api/module.rst:282 msgid "The type of ``PyModuleDef`` objects." msgstr "" +#: ../../c-api/module.rst:286 msgid "Module slots" msgstr "" +#: ../../c-api/module.rst:292 msgid "A slot ID, chosen from the available values explained below." msgstr "" +#: ../../c-api/module.rst:296 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" +#: ../../c-api/module.rst:300 msgid "The available slot types are:" msgstr "" -msgid "Specifies a function that is called to create the module object itself. The *value* pointer of this slot must point to a function of the signature:" +#: ../../c-api/module.rst:304 +msgid "" +"Specifies a function that is called to create the module object itself. The " +"*value* pointer of this slot must point to a function of the signature:" msgstr "" -msgid "The function receives a :py:class:`~importlib.machinery.ModuleSpec` instance, as defined in :PEP:`451`, and the module definition. It should return a new module object, or set an error and return ``NULL``." +#: ../../c-api/module.rst:311 +msgid "" +"The function receives a :py:class:`~importlib.machinery.ModuleSpec` " +"instance, as defined in :PEP:`451`, and the module definition. It should " +"return a new module object, or set an error and return ``NULL``." msgstr "" -msgid "This function should be kept minimal. In particular, it should not call arbitrary Python code, as trying to import the same module again may result in an infinite loop." +#: ../../c-api/module.rst:316 +msgid "" +"This function should be kept minimal. In particular, it should not call " +"arbitrary Python code, as trying to import the same module again may result " +"in an infinite loop." msgstr "" -msgid "Multiple ``Py_mod_create`` slots may not be specified in one module definition." +#: ../../c-api/module.rst:320 +msgid "" +"Multiple ``Py_mod_create`` slots may not be specified in one module " +"definition." msgstr "" -msgid "If ``Py_mod_create`` is not specified, the import machinery will create a normal module object using :c:func:`PyModule_New`. The name is taken from *spec*, not the definition, to allow extension modules to dynamically adjust to their place in the module hierarchy and be imported under different names through symlinks, all while sharing a single module definition." +#: ../../c-api/module.rst:323 +msgid "" +"If ``Py_mod_create`` is not specified, the import machinery will create a " +"normal module object using :c:func:`PyModule_New`. The name is taken from " +"*spec*, not the definition, to allow extension modules to dynamically adjust " +"to their place in the module hierarchy and be imported under different names " +"through symlinks, all while sharing a single module definition." msgstr "" -msgid "There is no requirement for the returned object to be an instance of :c:type:`PyModule_Type`. Any type can be used, as long as it supports setting and getting import-related attributes. However, only ``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than ``Py_mod_create``." +#: ../../c-api/module.rst:329 +msgid "" +"There is no requirement for the returned object to be an instance " +"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " +"setting and getting import-related attributes. However, only " +"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" +"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " +"slots other than ``Py_mod_create``." msgstr "" -msgid "Specifies a function that is called to *execute* the module. This is equivalent to executing the code of a Python module: typically, this function adds classes and constants to the module. The signature of the function is:" +#: ../../c-api/module.rst:340 +msgid "" +"Specifies a function that is called to *execute* the module. This is " +"equivalent to executing the code of a Python module: typically, this " +"function adds classes and constants to the module. The signature of the " +"function is:" msgstr "" -msgid "If multiple ``Py_mod_exec`` slots are specified, they are processed in the order they appear in the *m_slots* array." +#: ../../c-api/module.rst:349 +msgid "" +"If multiple ``Py_mod_exec`` slots are specified, they are processed in the " +"order they appear in the *m_slots* array." msgstr "" +#: ../../c-api/module.rst:356 ../../c-api/module.rst:389 msgid "Specifies one of the following values:" msgstr "" +#: ../../c-api/module.rst:362 msgid "The module does not support being imported in subinterpreters." msgstr "" -msgid "The module supports being imported in subinterpreters, but only when they share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" +#: ../../c-api/module.rst:366 +msgid "" +"The module supports being imported in subinterpreters, but only when they " +"share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -msgid "The module supports being imported in subinterpreters, even when they have their own GIL. (See :ref:`isolating-extensions-howto`.)" +#: ../../c-api/module.rst:372 +msgid "" +"The module supports being imported in subinterpreters, even when they have " +"their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -msgid "This slot determines whether or not importing this module in a subinterpreter will fail." +#: ../../c-api/module.rst:376 +msgid "" +"This slot determines whether or not importing this module in a " +"subinterpreter will fail." msgstr "" -msgid "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one module definition." +#: ../../c-api/module.rst:379 +msgid "" +"Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " +"module definition." msgstr "" -msgid "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." +#: ../../c-api/module.rst:382 +msgid "" +"If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " +"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" -msgid "The module depends on the presence of the global interpreter lock (GIL), and may access global state without synchronization." +#: ../../c-api/module.rst:395 +msgid "" +"The module depends on the presence of the global interpreter lock (GIL), and " +"may access global state without synchronization." msgstr "" +#: ../../c-api/module.rst:400 msgid "The module is safe to run without an active GIL." msgstr "" -msgid "This slot is ignored by Python builds not configured with :option:`--disable-gil`. Otherwise, it determines whether or not importing this module will cause the GIL to be automatically enabled. See :ref:`whatsnew313-free-threaded-cpython` for more detail." +#: ../../c-api/module.rst:402 +msgid "" +"This slot is ignored by Python builds not configured with :option:`--disable-" +"gil`. Otherwise, it determines whether or not importing this module will " +"cause the GIL to be automatically enabled. See :ref:`whatsnew313-free-" +"threaded-cpython` for more detail." msgstr "" -msgid "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." +#: ../../c-api/module.rst:407 +msgid "" +"Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -msgid "If ``Py_mod_gil`` is not specified, the import machinery defaults to ``Py_MOD_GIL_USED``." +#: ../../c-api/module.rst:409 +msgid "" +"If ``Py_mod_gil`` is not specified, the import machinery defaults to " +"``Py_MOD_GIL_USED``." msgstr "" +#: ../../c-api/module.rst:418 msgid "Creating extension modules dynamically" msgstr "" -msgid "The following functions may be used to create a module outside of an extension's :ref:`initialization function `. They are also used in :ref:`single-phase initialization `." +#: ../../c-api/module.rst:420 +msgid "" +"The following functions may be used to create a module outside of an " +"extension's :ref:`initialization function `. They are " +"also used in :ref:`single-phase initialization `." msgstr "" -msgid "Create a new module object, given the definition in *def*. This is a macro that calls :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if using the :ref:`limited API `." +#: ../../c-api/module.rst:427 +msgid "" +"Create a new module object, given the definition in *def*. This is a macro " +"that calls :c:func:`PyModule_Create2` with *module_api_version* set " +"to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if " +"using the :ref:`limited API `." msgstr "" -msgid "Create a new module object, given the definition in *def*, assuming the API version *module_api_version*. If that version does not match the version of the running interpreter, a :exc:`RuntimeWarning` is emitted." +#: ../../c-api/module.rst:435 +msgid "" +"Create a new module object, given the definition in *def*, assuming the API " +"version *module_api_version*. If that version does not match the version of " +"the running interpreter, a :exc:`RuntimeWarning` is emitted." msgstr "" -msgid "This function does not support slots. The :c:member:`~PyModuleDef.m_slots` member of *def* must be ``NULL``." +#: ../../c-api/module.rst:441 +msgid "" +"This function does not support slots. The :c:member:`~PyModuleDef.m_slots` " +"member of *def* must be ``NULL``." msgstr "" -msgid "Most uses of this function should be using :c:func:`PyModule_Create` instead; only use this if you are sure you need it." +#: ../../c-api/module.rst:447 +msgid "" +"Most uses of this function should be using :c:func:`PyModule_Create` " +"instead; only use this if you are sure you need it." msgstr "" -msgid "This macro calls :c:func:`PyModule_FromDefAndSpec2` with *module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if using the :ref:`limited API `." +#: ../../c-api/module.rst:452 +msgid "" +"This macro calls :c:func:`PyModule_FromDefAndSpec2` with " +"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or " +"to :c:macro:`PYTHON_ABI_VERSION` if using the :ref:`limited API `." msgstr "" -msgid "Create a new module object, given the definition in *def* and the ModuleSpec *spec*, assuming the API version *module_api_version*. If that version does not match the version of the running interpreter, a :exc:`RuntimeWarning` is emitted." +#: ../../c-api/module.rst:461 +msgid "" +"Create a new module object, given the definition in *def* and the ModuleSpec " +"*spec*, assuming the API version *module_api_version*. If that version does " +"not match the version of the running interpreter, a :exc:`RuntimeWarning` is " +"emitted." msgstr "" -msgid "Note that this does not process execution slots (:c:data:`Py_mod_exec`). Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to fully initialize a module." +#: ../../c-api/module.rst:468 +msgid "" +"Note that this does not process execution slots (:c:data:`Py_mod_exec`). " +"Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to " +"fully initialize a module." msgstr "" -msgid "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` instead; only use this if you are sure you need it." +#: ../../c-api/module.rst:474 +msgid "" +"Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " +"instead; only use this if you are sure you need it." msgstr "" +#: ../../c-api/module.rst:481 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" +#: ../../c-api/module.rst:487 msgid "The C API version. Defined for backwards compatibility." msgstr "" -msgid "Currently, this constant is not updated in new Python versions, and is not useful for versioning. This may change in the future." +#: ../../c-api/module.rst:489 ../../c-api/module.rst:496 +msgid "" +"Currently, this constant is not updated in new Python versions, and is not " +"useful for versioning. This may change in the future." msgstr "" +#: ../../c-api/module.rst:494 msgid "Defined as ``3`` for backwards compatibility." msgstr "" +#: ../../c-api/module.rst:501 msgid "Support functions" msgstr "" -msgid "The following functions are provided to help initialize a module state. They are intended for a module's execution slots (:c:data:`Py_mod_exec`), the initialization function for legacy :ref:`single-phase initialization `, or code that creates modules dynamically." +#: ../../c-api/module.rst:503 +msgid "" +"The following functions are provided to help initialize a module state. They " +"are intended for a module's execution slots (:c:data:`Py_mod_exec`), the " +"initialization function for legacy :ref:`single-phase initialization `, or code that creates modules dynamically." msgstr "" -msgid "Add an object to *module* as *name*. This is a convenience function which can be used from the module's initialization function." +#: ../../c-api/module.rst:511 +msgid "" +"Add an object to *module* as *name*. This is a convenience function which " +"can be used from the module's initialization function." msgstr "" -msgid "On success, return ``0``. On error, raise an exception and return ``-1``." +#: ../../c-api/module.rst:514 +msgid "" +"On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" +#: ../../c-api/module.rst:516 ../../c-api/module.rst:567 +#: ../../c-api/module.rst:594 msgid "Example usage::" msgstr "" +#: ../../c-api/module.rst:518 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -301,12 +586,20 @@ msgid "" " }" msgstr "" -msgid "To be convenient, the function accepts ``NULL`` *value* with an exception set. In this case, return ``-1`` and just leave the raised exception unchanged." +#: ../../c-api/module.rst:530 +msgid "" +"To be convenient, the function accepts ``NULL`` *value* with an exception " +"set. In this case, return ``-1`` and just leave the raised exception " +"unchanged." msgstr "" -msgid "The example can also be written without checking explicitly if *obj* is ``NULL``::" +#: ../../c-api/module.rst:534 +msgid "" +"The example can also be written without checking explicitly if *obj* is " +"``NULL``::" msgstr "" +#: ../../c-api/module.rst:537 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -318,33 +611,63 @@ msgid "" " }" msgstr "" -msgid "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this case, since *obj* can be ``NULL``." +#: ../../c-api/module.rst:546 +msgid "" +"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " +"case, since *obj* can be ``NULL``." msgstr "" -msgid "The number of different *name* strings passed to this function should be kept small, usually by only using statically allocated strings as *name*. For names that aren't known at compile time, prefer calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more details, see :c:func:`PyUnicode_InternFromString`, which may be used internally to create a key object." +#: ../../c-api/module.rst:549 +msgid "" +"The number of different *name* strings passed to this function should be " +"kept small, usually by only using statically allocated strings as *name*. " +"For names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" -msgid "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to *value*. It can be called with a result of function that returns a new reference without bothering to check its result or even saving it to a variable." +#: ../../c-api/module.rst:562 +msgid "" +"Similar to :c:func:`PyModule_AddObjectRef`, but \":term:`steals `\" a " +"reference to *value* (even on error). It can be called with a result of " +"function that returns a new reference without bothering to check its result " +"or even saving it to a variable." msgstr "" +#: ../../c-api/module.rst:569 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" -msgid "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to *value* on success (if it returns ``0``)." +#: ../../c-api/module.rst:578 +msgid "" +"Similar to :c:func:`PyModule_AddObjectRef`, but :term:`steals ` a " +"reference to *value* on success (if it returns ``0``)." msgstr "" -msgid "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions are recommended, since it is easy to introduce reference leaks by misusing the :c:func:`PyModule_AddObject` function." +#: ../../c-api/module.rst:581 +msgid "" +"The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " +"are recommended, since it is easy to introduce reference leaks by misusing " +"the :c:func:`PyModule_AddObject` function." msgstr "" -msgid "Unlike other functions that steal references, ``PyModule_AddObject()`` only releases the reference to *value* **on success**." +#: ../../c-api/module.rst:588 +msgid "" +"Unlike other functions that steal references, ``PyModule_AddObject()`` only " +"releases the reference to *value* **on success**." msgstr "" -msgid "This means that its return value must be checked, and calling code must :c:func:`Py_XDECREF` *value* manually on error." +#: ../../c-api/module.rst:591 +msgid "" +"This means that its return value must be checked, and calling code " +"must :c:func:`Py_XDECREF` *value* manually on error." msgstr "" +#: ../../c-api/module.rst:596 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -358,104 +681,209 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -msgid "Add an integer constant to *module* as *name*. This convenience function can be used from the module's initialization function. Return ``-1`` with an exception set on error, ``0`` on success." +#: ../../c-api/module.rst:612 +msgid "" +"Add an integer constant to *module* as *name*. This convenience function " +"can be used from the module's initialization function. Return ``-1`` with an " +"exception set on error, ``0`` on success." msgstr "" -msgid "This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:func:`PyModule_AddObjectRef`; see their documentation for details." +#: ../../c-api/module.rst:616 +msgid "" +"This is a convenience function that calls :c:func:`PyLong_FromLong` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -msgid "Add a string constant to *module* as *name*. This convenience function can be used from the module's initialization function. The string *value* must be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` on success." +#: ../../c-api/module.rst:622 +msgid "" +"Add a string constant to *module* as *name*. This convenience function can " +"be used from the module's initialization function. The string *value* must " +"be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` " +"on success." msgstr "" -msgid "This is a convenience function that calls :c:func:`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their documentation for details." +#: ../../c-api/module.rst:627 +msgid "" +"This is a convenience function that " +"calls :c:func:`PyUnicode_InternFromString` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -msgid "Add an int constant to *module*. The name and the value are taken from *macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` with an exception set on error, ``0`` on success." +#: ../../c-api/module.rst:634 +msgid "" +"Add an int constant to *module*. The name and the value are taken from " +"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " +"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` " +"with an exception set on error, ``0`` on success." msgstr "" +#: ../../c-api/module.rst:642 msgid "Add a string constant to *module*." msgstr "" -msgid "Add a type object to *module*. The type object is finalized by calling internally :c:func:`PyType_Ready`. The name of the type object is taken from the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return ``-1`` with an exception set on error, ``0`` on success." +#: ../../c-api/module.rst:646 +msgid "" +"Add a type object to *module*. The type object is finalized by calling " +"internally :c:func:`PyType_Ready`. The name of the type object is taken from " +"the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return " +"``-1`` with an exception set on error, ``0`` on success." msgstr "" -msgid "Add the functions from the ``NULL`` terminated *functions* array to *module*. Refer to the :c:type:`PyMethodDef` documentation for details on individual entries (due to the lack of a shared module namespace, module level \"functions\" implemented in C typically receive the module as their first parameter, making them similar to instance methods on Python classes)." +#: ../../c-api/module.rst:656 +msgid "" +"Add the functions from the ``NULL`` terminated *functions* array to " +"*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " +"individual entries (due to the lack of a shared module namespace, module " +"level \"functions\" implemented in C typically receive the module as their " +"first parameter, making them similar to instance methods on Python classes)." msgstr "" -msgid "This function is called automatically when creating a module from ``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, ``PyModule_Create``, or ``PyModule_FromDefAndSpec``). Some module authors may prefer defining functions in multiple :c:type:`PyMethodDef` arrays; in that case they should call this function directly." +#: ../../c-api/module.rst:662 +msgid "" +"This function is called automatically when creating a module from " +"``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " +"``PyModule_Create``, or ``PyModule_FromDefAndSpec``). Some module authors " +"may prefer defining functions in multiple :c:type:`PyMethodDef` arrays; in " +"that case they should call this function directly." msgstr "" -msgid "The *functions* array must be statically allocated (or otherwise guaranteed to outlive the module object)." +#: ../../c-api/module.rst:669 +msgid "" +"The *functions* array must be statically allocated (or otherwise guaranteed " +"to outlive the module object)." msgstr "" -msgid "Set the docstring for *module* to *docstring*. This function is called automatically when creating a module from ``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, ``PyModule_Create``, or ``PyModule_FromDefAndSpec``)." +#: ../../c-api/module.rst:676 +msgid "" +"Set the docstring for *module* to *docstring*. This function is called " +"automatically when creating a module from ``PyModuleDef`` (such as when " +"using :ref:`multi-phase-initialization`, ``PyModule_Create``, or " +"``PyModule_FromDefAndSpec``)." msgstr "" +#: ../../c-api/module.rst:681 msgid "Return ``0`` on success. Return ``-1`` with an exception set on error." msgstr "" -msgid "Indicate that *module* does or does not support running without the global interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. It must be called during *module*'s initialization function when using :ref:`single-phase-initialization`. If this function is not called during module initialization, the import machinery assumes the module does not support running without the GIL. This function is only available in Python builds configured with :option:`--disable-gil`. Return ``-1`` with an exception set on error, ``0`` on success." +#: ../../c-api/module.rst:688 +msgid "" +"Indicate that *module* does or does not support running without the global " +"interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " +"It must be called during *module*'s initialization function when " +"using :ref:`single-phase-initialization`. If this function is not called " +"during module initialization, the import machinery assumes the module does " +"not support running without the GIL. This function is only available in " +"Python builds configured with :option:`--disable-gil`. Return ``-1`` with an " +"exception set on error, ``0`` on success." msgstr "" +#: ../../c-api/module.rst:702 msgid "Module lookup (single-phase initialization)" msgstr "" -msgid "The legacy :ref:`single-phase initialization ` initialization scheme creates singleton modules that can be looked up in the context of the current interpreter. This allows the module object to be retrieved later with only a reference to the module definition." +#: ../../c-api/module.rst:704 +msgid "" +"The legacy :ref:`single-phase initialization ` " +"initialization scheme creates singleton modules that can be looked up in the " +"context of the current interpreter. This allows the module object to be " +"retrieved later with only a reference to the module definition." msgstr "" -msgid "These functions will not work on modules created using multi-phase initialization, since multiple such modules can be created from a single definition." +#: ../../c-api/module.rst:709 +msgid "" +"These functions will not work on modules created using multi-phase " +"initialization, since multiple such modules can be created from a single " +"definition." msgstr "" -msgid "Returns the module object that was created from *def* for the current interpreter. This method requires that the module object has been attached to the interpreter state with :c:func:`PyState_AddModule` beforehand. In case the corresponding module object is not found or has not been attached to the interpreter state yet, it returns ``NULL``." +#: ../../c-api/module.rst:714 +msgid "" +"Returns the module object that was created from *def* for the current " +"interpreter. This method requires that the module object has been attached " +"to the interpreter state with :c:func:`PyState_AddModule` beforehand. In " +"case the corresponding module object is not found or has not been attached " +"to the interpreter state yet, it returns ``NULL``." msgstr "" -msgid "Attaches the module object passed to the function to the interpreter state. This allows the module object to be accessible via :c:func:`PyState_FindModule`." +#: ../../c-api/module.rst:721 +msgid "" +"Attaches the module object passed to the function to the interpreter state. " +"This allows the module object to be accessible " +"via :c:func:`PyState_FindModule`." msgstr "" +#: ../../c-api/module.rst:724 msgid "Only effective on modules created using single-phase initialization." msgstr "" -msgid "Python calls ``PyState_AddModule`` automatically after importing a module that uses :ref:`single-phase initialization `, so it is unnecessary (but harmless) to call it from module initialization code. An explicit call is needed only if the module's own init code subsequently calls ``PyState_FindModule``. The function is mainly intended for implementing alternative import mechanisms (either by calling it directly, or by referring to its implementation for details of the required state updates)." +#: ../../c-api/module.rst:726 +msgid "" +"Python calls ``PyState_AddModule`` automatically after importing a module " +"that uses :ref:`single-phase initialization `, " +"so it is unnecessary (but harmless) to call it from module initialization " +"code. An explicit call is needed only if the module's own init code " +"subsequently calls ``PyState_FindModule``. The function is mainly intended " +"for implementing alternative import mechanisms (either by calling it " +"directly, or by referring to its implementation for details of the required " +"state updates)." msgstr "" -msgid "If a module was attached previously using the same *def*, it is replaced by the new *module*." +#: ../../c-api/module.rst:735 +msgid "" +"If a module was attached previously using the same *def*, it is replaced by " +"the new *module*." msgstr "" +#: ../../c-api/module.rst:738 ../../c-api/module.rst:749 msgid "The caller must have an :term:`attached thread state`." msgstr "" +#: ../../c-api/module.rst:740 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -msgid "Removes the module object created from *def* from the interpreter state. Return ``-1`` with an exception set on error, ``0`` on success." +#: ../../c-api/module.rst:746 +msgid "" +"Removes the module object created from *def* from the interpreter state. " +"Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" +#: ../../c-api/module.rst:8 msgid "object" msgstr "" +#: ../../c-api/module.rst:8 msgid "module" msgstr "" +#: ../../c-api/module.rst:13 msgid "ModuleType (in module types)" msgstr "" +#: ../../c-api/module.rst:33 ../../c-api/module.rst:80 msgid "__name__ (module attribute)" msgstr "" +#: ../../c-api/module.rst:33 msgid "__doc__ (module attribute)" msgstr "" +#: ../../c-api/module.rst:33 ../../c-api/module.rst:119 msgid "__file__ (module attribute)" msgstr "" +#: ../../c-api/module.rst:33 msgid "__package__ (module attribute)" msgstr "" +#: ../../c-api/module.rst:33 msgid "__loader__ (module attribute)" msgstr "" +#: ../../c-api/module.rst:63 msgid "__dict__ (module attribute)" msgstr "" +#: ../../c-api/module.rst:80 ../../c-api/module.rst:119 msgid "SystemError (built-in exception)" msgstr "" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index 01f211f6f..dee013f8a 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-05-11 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,167 +23,283 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/monitoring.rst:6 msgid "Monitoring C API" msgstr "" +#: ../../c-api/monitoring.rst:8 msgid "Added in version 3.13." msgstr "" -msgid "An extension may need to interact with the event monitoring system. Subscribing to events and registering callbacks can be done via the Python API exposed in :mod:`sys.monitoring`." +#: ../../c-api/monitoring.rst:10 +msgid "" +"An extension may need to interact with the event monitoring system. " +"Subscribing to events and registering callbacks can be done via the Python " +"API exposed in :mod:`sys.monitoring`." msgstr "" +#: ../../c-api/monitoring.rst:15 msgid "Generating Execution Events" msgstr "" -msgid "The functions below make it possible for an extension to fire monitoring events as it emulates the execution of Python code. Each of these functions accepts a ``PyMonitoringState`` struct which contains concise information about the activation state of events, as well as the event arguments, which include a ``PyObject*`` representing the code object, the instruction offset and sometimes additional, event-specific arguments (see :mod:`sys.monitoring` for details about the signatures of the different event callbacks). The ``codelike`` argument should be an instance of :class:`types.CodeType` or of a type that emulates it." -msgstr "" - -msgid "The VM disables tracing when firing an event, so there is no need for user code to do that." +#: ../../c-api/monitoring.rst:17 +msgid "" +"The functions below make it possible for an extension to fire monitoring " +"events as it emulates the execution of Python code. Each of these functions " +"accepts a ``PyMonitoringState`` struct which contains concise information " +"about the activation state of events, as well as the event arguments, which " +"include a ``PyObject*`` representing the code object, the instruction offset " +"and sometimes additional, event-specific arguments " +"(see :mod:`sys.monitoring` for details about the signatures of the different " +"event callbacks). The ``codelike`` argument should be an instance " +"of :class:`types.CodeType` or of a type that emulates it." +msgstr "" + +#: ../../c-api/monitoring.rst:27 +msgid "" +"The VM disables tracing when firing an event, so there is no need for user " +"code to do that." msgstr "" -msgid "Monitoring functions should not be called with an exception set, except those listed below as working with the current exception." +#: ../../c-api/monitoring.rst:30 +msgid "" +"Monitoring functions should not be called with an exception set, except " +"those listed below as working with the current exception." msgstr "" -msgid "Representation of the state of an event type. It is allocated by the user while its contents are maintained by the monitoring API functions described below." +#: ../../c-api/monitoring.rst:35 +msgid "" +"Representation of the state of an event type. It is allocated by the user " +"while its contents are maintained by the monitoring API functions described " +"below." msgstr "" -msgid "All of the functions below return 0 on success and -1 (with an exception set) on error." +#: ../../c-api/monitoring.rst:39 +msgid "" +"All of the functions below return 0 on success and -1 (with an exception " +"set) on error." msgstr "" +#: ../../c-api/monitoring.rst:41 msgid "See :mod:`sys.monitoring` for descriptions of the events." msgstr "" +#: ../../c-api/monitoring.rst:45 msgid "Fire a ``PY_START`` event." msgstr "" +#: ../../c-api/monitoring.rst:50 msgid "Fire a ``PY_RESUME`` event." msgstr "" +#: ../../c-api/monitoring.rst:55 msgid "Fire a ``PY_RETURN`` event." msgstr "" +#: ../../c-api/monitoring.rst:60 msgid "Fire a ``PY_YIELD`` event." msgstr "" +#: ../../c-api/monitoring.rst:65 msgid "Fire a ``CALL`` event." msgstr "" +#: ../../c-api/monitoring.rst:70 msgid "Fire a ``LINE`` event." msgstr "" +#: ../../c-api/monitoring.rst:75 msgid "Fire a ``JUMP`` event." msgstr "" +#: ../../c-api/monitoring.rst:80 msgid "Fire a ``BRANCH_LEFT`` event." msgstr "" +#: ../../c-api/monitoring.rst:85 msgid "Fire a ``BRANCH_RIGHT`` event." msgstr "" +#: ../../c-api/monitoring.rst:90 msgid "Fire a ``C_RETURN`` event." msgstr "" -msgid "Fire a ``PY_THROW`` event with the current exception (as returned by :c:func:`PyErr_GetRaisedException`)." +#: ../../c-api/monitoring.rst:95 +msgid "" +"Fire a ``PY_THROW`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -msgid "Fire a ``RAISE`` event with the current exception (as returned by :c:func:`PyErr_GetRaisedException`)." +#: ../../c-api/monitoring.rst:101 +msgid "" +"Fire a ``RAISE`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -msgid "Fire a ``C_RAISE`` event with the current exception (as returned by :c:func:`PyErr_GetRaisedException`)." +#: ../../c-api/monitoring.rst:107 +msgid "" +"Fire a ``C_RAISE`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -msgid "Fire a ``RERAISE`` event with the current exception (as returned by :c:func:`PyErr_GetRaisedException`)." +#: ../../c-api/monitoring.rst:113 +msgid "" +"Fire a ``RERAISE`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -msgid "Fire an ``EXCEPTION_HANDLED`` event with the current exception (as returned by :c:func:`PyErr_GetRaisedException`)." +#: ../../c-api/monitoring.rst:119 +msgid "" +"Fire an ``EXCEPTION_HANDLED`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -msgid "Fire a ``PY_UNWIND`` event with the current exception (as returned by :c:func:`PyErr_GetRaisedException`)." +#: ../../c-api/monitoring.rst:125 +msgid "" +"Fire a ``PY_UNWIND`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." msgstr "" -msgid "Fire a ``STOP_ITERATION`` event. If ``value`` is an instance of :exc:`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` instance is created with ``value`` as its argument." +#: ../../c-api/monitoring.rst:131 +msgid "" +"Fire a ``STOP_ITERATION`` event. If ``value`` is an instance " +"of :exc:`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` " +"instance is created with ``value`` as its argument." msgstr "" +#: ../../c-api/monitoring.rst:136 msgid "Managing the Monitoring State" msgstr "" -msgid "Monitoring states can be managed with the help of monitoring scopes. A scope would typically correspond to a Python function." -msgstr "" - -msgid "Enter a monitored scope. ``event_types`` is an array of the event IDs for events that may be fired from the scope. For example, the ID of a ``PY_START`` event is the value ``PY_MONITORING_EVENT_PY_START``, which is numerically equal to the base-2 logarithm of ``sys.monitoring.events.PY_START``. ``state_array`` is an array with a monitoring state entry for each event in ``event_types``, it is allocated by the user but populated by :c:func:`!PyMonitoring_EnterScope` with information about the activation state of the event. The size of ``event_types`` (and hence also of ``state_array``) is given in ``length``." +#: ../../c-api/monitoring.rst:138 +msgid "" +"Monitoring states can be managed with the help of monitoring scopes. A scope " +"would typically correspond to a Python function." msgstr "" -msgid "The ``version`` argument is a pointer to a value which should be allocated by the user together with ``state_array`` and initialized to 0, and then set only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this function to determine whether event states have changed since the previous call, and to return quickly if they have not." +#: ../../c-api/monitoring.rst:143 +msgid "" +"Enter a monitored scope. ``event_types`` is an array of the event IDs for " +"events that may be fired from the scope. For example, the ID of a " +"``PY_START`` event is the value ``PY_MONITORING_EVENT_PY_START``, which is " +"numerically equal to the base-2 logarithm of " +"``sys.monitoring.events.PY_START``. ``state_array`` is an array with a " +"monitoring state entry for each event in ``event_types``, it is allocated by " +"the user but populated by :c:func:`!PyMonitoring_EnterScope` with " +"information about the activation state of the event. The size of " +"``event_types`` (and hence also of ``state_array``) is given in ``length``." +msgstr "" + +#: ../../c-api/monitoring.rst:153 +msgid "" +"The ``version`` argument is a pointer to a value which should be allocated " +"by the user together with ``state_array`` and initialized to 0, and then set " +"only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this function " +"to determine whether event states have changed since the previous call, and " +"to return quickly if they have not." msgstr "" -msgid "The scopes referred to here are lexical scopes: a function, class or method. :c:func:`!PyMonitoring_EnterScope` should be called whenever the lexical scope is entered. Scopes can be reentered, reusing the same *state_array* and *version*, in situations like when emulating a recursive Python function. When a code-like's execution is paused, such as when emulating a generator, the scope needs to be exited and re-entered." +#: ../../c-api/monitoring.rst:159 +msgid "" +"The scopes referred to here are lexical scopes: a function, class or " +"method. :c:func:`!PyMonitoring_EnterScope` should be called whenever the " +"lexical scope is entered. Scopes can be reentered, reusing the same " +"*state_array* and *version*, in situations like when emulating a recursive " +"Python function. When a code-like's execution is paused, such as when " +"emulating a generator, the scope needs to be exited and re-entered." msgstr "" +#: ../../c-api/monitoring.rst:166 msgid "The macros for *event_types* are:" msgstr "" +#: ../../c-api/monitoring.rst:174 msgid "Macro" msgstr "" +#: ../../c-api/monitoring.rst:174 msgid "Event" msgstr "" +#: ../../c-api/monitoring.rst:176 msgid ":monitoring-event:`BRANCH_LEFT`" msgstr "" +#: ../../c-api/monitoring.rst:177 msgid ":monitoring-event:`BRANCH_RIGHT`" msgstr "" +#: ../../c-api/monitoring.rst:178 msgid ":monitoring-event:`CALL`" msgstr "" +#: ../../c-api/monitoring.rst:179 msgid ":monitoring-event:`C_RAISE`" msgstr "" +#: ../../c-api/monitoring.rst:180 msgid ":monitoring-event:`C_RETURN`" msgstr "" +#: ../../c-api/monitoring.rst:181 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr "" +#: ../../c-api/monitoring.rst:182 msgid ":monitoring-event:`INSTRUCTION`" msgstr "" +#: ../../c-api/monitoring.rst:183 msgid ":monitoring-event:`JUMP`" msgstr "" +#: ../../c-api/monitoring.rst:184 msgid ":monitoring-event:`LINE`" msgstr "" +#: ../../c-api/monitoring.rst:185 msgid ":monitoring-event:`PY_RESUME`" msgstr "" +#: ../../c-api/monitoring.rst:186 msgid ":monitoring-event:`PY_RETURN`" msgstr "" +#: ../../c-api/monitoring.rst:187 msgid ":monitoring-event:`PY_START`" msgstr "" +#: ../../c-api/monitoring.rst:188 msgid ":monitoring-event:`PY_THROW`" msgstr "" +#: ../../c-api/monitoring.rst:189 msgid ":monitoring-event:`PY_UNWIND`" msgstr "" +#: ../../c-api/monitoring.rst:190 msgid ":monitoring-event:`PY_YIELD`" msgstr "" +#: ../../c-api/monitoring.rst:191 msgid ":monitoring-event:`RAISE`" msgstr "" +#: ../../c-api/monitoring.rst:192 msgid ":monitoring-event:`RERAISE`" msgstr "" +#: ../../c-api/monitoring.rst:193 msgid ":monitoring-event:`STOP_ITERATION`" msgstr "" -msgid "Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." +#: ../../c-api/monitoring.rst:198 +msgid "" +"Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." msgstr "" -msgid "Return true if the event corresponding to the event ID *ev* is a :ref:`local event `." +#: ../../c-api/monitoring.rst:203 +msgid "" +"Return true if the event corresponding to the event ID *ev* is a :ref:`local " +"event `." msgstr "" diff --git a/c-api/none.po b/c-api/none.po index da8bdc197..7f810b787 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,23 +23,36 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/none.rst:6 msgid "The ``None`` Object" msgstr "" -msgid "Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the Python/C API. Since ``None`` is a singleton, testing for object identity (using ``==`` in C) is sufficient. There is no :c:func:`!PyNone_Check` function for the same reason." +#: ../../c-api/none.rst:10 +msgid "" +"Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in " +"the Python/C API. Since ``None`` is a singleton, testing for object " +"identity (using ``==`` in C) is sufficient. There is no :c:func:`!" +"PyNone_Check` function for the same reason." msgstr "" -msgid "The Python ``None`` object, denoting lack of value. This object has no methods and is :term:`immortal`." +#: ../../c-api/none.rst:18 +msgid "" +"The Python ``None`` object, denoting lack of value. This object has no " +"methods and is :term:`immortal`." msgstr "" +#: ../../c-api/none.rst:21 msgid ":c:data:`Py_None` is :term:`immortal`." msgstr "" +#: ../../c-api/none.rst:26 msgid "Return :c:data:`Py_None` from a function." msgstr "" +#: ../../c-api/none.rst:8 msgid "object" msgstr "" +#: ../../c-api/none.rst:8 msgid "None" msgstr "" diff --git a/c-api/number.po b/c-api/number.po index 7c99a8d34..37fd3befc 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,146 +22,311 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/number.rst:6 msgid "Number Protocol" msgstr "" -msgid "Returns ``1`` if the object *o* provides numeric protocols, and false otherwise. This function always succeeds." +#: ../../c-api/number.rst:11 +msgid "" +"Returns ``1`` if the object *o* provides numeric protocols, and false " +"otherwise. This function always succeeds." msgstr "" +#: ../../c-api/number.rst:14 msgid "Returns ``1`` if *o* is an index integer." msgstr "" -msgid "Returns the result of adding *o1* and *o2*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 + o2``." +#: ../../c-api/number.rst:20 +msgid "" +"Returns the result of adding *o1* and *o2*, or ``NULL`` on failure. This is " +"the equivalent of the Python expression ``o1 + o2``." msgstr "" -msgid "Returns the result of subtracting *o2* from *o1*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 - o2``." +#: ../../c-api/number.rst:26 +msgid "" +"Returns the result of subtracting *o2* from *o1*, or ``NULL`` on failure. " +"This is the equivalent of the Python expression ``o1 - o2``." msgstr "" -msgid "Returns the result of multiplying *o1* and *o2*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 * o2``." +#: ../../c-api/number.rst:32 +msgid "" +"Returns the result of multiplying *o1* and *o2*, or ``NULL`` on failure. " +"This is the equivalent of the Python expression ``o1 * o2``." msgstr "" -msgid "Returns the result of matrix multiplication on *o1* and *o2*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 @ o2``." +#: ../../c-api/number.rst:38 +msgid "" +"Returns the result of matrix multiplication on *o1* and *o2*, or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o1 @ o2``." msgstr "" -msgid "Return the floor of *o1* divided by *o2*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 // o2``." +#: ../../c-api/number.rst:46 +msgid "" +"Return the floor of *o1* divided by *o2*, or ``NULL`` on failure. This is " +"the equivalent of the Python expression ``o1 // o2``." msgstr "" -msgid "Return a reasonable approximation for the mathematical value of *o1* divided by *o2*, or ``NULL`` on failure. The return value is \"approximate\" because binary floating-point numbers are approximate; it is not possible to represent all real numbers in base two. This function can return a floating-point value when passed two integers. This is the equivalent of the Python expression ``o1 / o2``." +#: ../../c-api/number.rst:52 +msgid "" +"Return a reasonable approximation for the mathematical value of *o1* divided " +"by *o2*, or ``NULL`` on failure. The return value is \"approximate\" " +"because binary floating-point numbers are approximate; it is not possible to " +"represent all real numbers in base two. This function can return a floating-" +"point value when passed two integers. This is the equivalent of the Python " +"expression ``o1 / o2``." msgstr "" -msgid "Returns the remainder of dividing *o1* by *o2*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 % o2``." +#: ../../c-api/number.rst:61 +msgid "" +"Returns the remainder of dividing *o1* by *o2*, or ``NULL`` on failure. " +"This is the equivalent of the Python expression ``o1 % o2``." msgstr "" -msgid "See the built-in function :func:`divmod`. Returns ``NULL`` on failure. This is the equivalent of the Python expression ``divmod(o1, o2)``." +#: ../../c-api/number.rst:69 +msgid "" +"See the built-in function :func:`divmod`. Returns ``NULL`` on failure. This " +"is the equivalent of the Python expression ``divmod(o1, o2)``." msgstr "" -msgid "See the built-in function :func:`pow`. Returns ``NULL`` on failure. This is the equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is optional. If *o3* is to be ignored, pass :c:data:`Py_None` in its place (passing ``NULL`` for *o3* would cause an illegal memory access)." +#: ../../c-api/number.rst:77 +msgid "" +"See the built-in function :func:`pow`. Returns ``NULL`` on failure. This is " +"the equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is " +"optional. If *o3* is to be ignored, pass :c:data:`Py_None` in its place " +"(passing ``NULL`` for *o3* would cause an illegal memory access)." msgstr "" -msgid "Returns the negation of *o* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``-o``." +#: ../../c-api/number.rst:85 +msgid "" +"Returns the negation of *o* on success, or ``NULL`` on failure. This is the " +"equivalent of the Python expression ``-o``." msgstr "" -msgid "Returns *o* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``+o``." +#: ../../c-api/number.rst:91 +msgid "" +"Returns *o* on success, or ``NULL`` on failure. This is the equivalent of " +"the Python expression ``+o``." msgstr "" -msgid "Returns the absolute value of *o*, or ``NULL`` on failure. This is the equivalent of the Python expression ``abs(o)``." +#: ../../c-api/number.rst:99 +msgid "" +"Returns the absolute value of *o*, or ``NULL`` on failure. This is the " +"equivalent of the Python expression ``abs(o)``." msgstr "" -msgid "Returns the bitwise negation of *o* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``~o``." +#: ../../c-api/number.rst:105 +msgid "" +"Returns the bitwise negation of *o* on success, or ``NULL`` on failure. " +"This is the equivalent of the Python expression ``~o``." msgstr "" -msgid "Returns the result of left shifting *o1* by *o2* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 << o2``." +#: ../../c-api/number.rst:111 +msgid "" +"Returns the result of left shifting *o1* by *o2* on success, or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o1 << o2``." msgstr "" -msgid "Returns the result of right shifting *o1* by *o2* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 >> o2``." +#: ../../c-api/number.rst:117 +msgid "" +"Returns the result of right shifting *o1* by *o2* on success, or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o1 >> o2``." msgstr "" -msgid "Returns the \"bitwise and\" of *o1* and *o2* on success and ``NULL`` on failure. This is the equivalent of the Python expression ``o1 & o2``." +#: ../../c-api/number.rst:123 +msgid "" +"Returns the \"bitwise and\" of *o1* and *o2* on success and ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o1 & o2``." msgstr "" -msgid "Returns the \"bitwise exclusive or\" of *o1* by *o2* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 ^ o2``." +#: ../../c-api/number.rst:129 +msgid "" +"Returns the \"bitwise exclusive or\" of *o1* by *o2* on success, or ``NULL`` " +"on failure. This is the equivalent of the Python expression ``o1 ^ o2``." msgstr "" -msgid "Returns the \"bitwise or\" of *o1* and *o2* on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o1 | o2``." +#: ../../c-api/number.rst:135 +msgid "" +"Returns the \"bitwise or\" of *o1* and *o2* on success, or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o1 | o2``." msgstr "" -msgid "Returns the result of adding *o1* and *o2*, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 += o2``." +#: ../../c-api/number.rst:141 +msgid "" +"Returns the result of adding *o1* and *o2*, or ``NULL`` on failure. The " +"operation is done *in-place* when *o1* supports it. This is the equivalent " +"of the Python statement ``o1 += o2``." msgstr "" -msgid "Returns the result of subtracting *o2* from *o1*, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 -= o2``." +#: ../../c-api/number.rst:148 +msgid "" +"Returns the result of subtracting *o2* from *o1*, or ``NULL`` on failure. " +"The operation is done *in-place* when *o1* supports it. This is the " +"equivalent of the Python statement ``o1 -= o2``." msgstr "" -msgid "Returns the result of multiplying *o1* and *o2*, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 *= o2``." +#: ../../c-api/number.rst:155 +msgid "" +"Returns the result of multiplying *o1* and *o2*, or ``NULL`` on failure. " +"The operation is done *in-place* when *o1* supports it. This is the " +"equivalent of the Python statement ``o1 *= o2``." msgstr "" -msgid "Returns the result of matrix multiplication on *o1* and *o2*, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 @= o2``." +#: ../../c-api/number.rst:162 +msgid "" +"Returns the result of matrix multiplication on *o1* and *o2*, or ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python statement ``o1 @= o2``." msgstr "" -msgid "Returns the mathematical floor of dividing *o1* by *o2*, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 //= o2``." +#: ../../c-api/number.rst:171 +msgid "" +"Returns the mathematical floor of dividing *o1* by *o2*, or ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python statement ``o1 //= o2``." msgstr "" -msgid "Return a reasonable approximation for the mathematical value of *o1* divided by *o2*, or ``NULL`` on failure. The return value is \"approximate\" because binary floating-point numbers are approximate; it is not possible to represent all real numbers in base two. This function can return a floating-point value when passed two integers. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 /= o2``." +#: ../../c-api/number.rst:178 +msgid "" +"Return a reasonable approximation for the mathematical value of *o1* divided " +"by *o2*, or ``NULL`` on failure. The return value is \"approximate\" " +"because binary floating-point numbers are approximate; it is not possible to " +"represent all real numbers in base two. This function can return a floating-" +"point value when passed two integers. The operation is done *in-place* when " +"*o1* supports it. This is the equivalent of the Python statement ``o1 /= " +"o2``." msgstr "" -msgid "Returns the remainder of dividing *o1* by *o2*, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 %= o2``." +#: ../../c-api/number.rst:188 +msgid "" +"Returns the remainder of dividing *o1* by *o2*, or ``NULL`` on failure. The " +"operation is done *in-place* when *o1* supports it. This is the equivalent " +"of the Python statement ``o1 %= o2``." msgstr "" -msgid "See the built-in function :func:`pow`. Returns ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 **= o2`` when o3 is :c:data:`Py_None`, or an in-place variant of ``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, pass :c:data:`Py_None` in its place (passing ``NULL`` for *o3* would cause an illegal memory access)." +#: ../../c-api/number.rst:197 +msgid "" +"See the built-in function :func:`pow`. Returns ``NULL`` on failure. The " +"operation is done *in-place* when *o1* supports it. This is the equivalent " +"of the Python statement ``o1 **= o2`` when o3 is :c:data:`Py_None`, or an in-" +"place variant of ``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, " +"pass :c:data:`Py_None` in its place (passing ``NULL`` for *o3* would cause " +"an illegal memory access)." msgstr "" -msgid "Returns the result of left shifting *o1* by *o2* on success, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 <<= o2``." +#: ../../c-api/number.rst:206 +msgid "" +"Returns the result of left shifting *o1* by *o2* on success, or ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python statement ``o1 <<= o2``." msgstr "" -msgid "Returns the result of right shifting *o1* by *o2* on success, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 >>= o2``." +#: ../../c-api/number.rst:213 +msgid "" +"Returns the result of right shifting *o1* by *o2* on success, or ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python statement ``o1 >>= o2``." msgstr "" -msgid "Returns the \"bitwise and\" of *o1* and *o2* on success and ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 &= o2``." +#: ../../c-api/number.rst:220 +msgid "" +"Returns the \"bitwise and\" of *o1* and *o2* on success and ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python statement ``o1 &= o2``." msgstr "" -msgid "Returns the \"bitwise exclusive or\" of *o1* by *o2* on success, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 ^= o2``." +#: ../../c-api/number.rst:227 +msgid "" +"Returns the \"bitwise exclusive or\" of *o1* by *o2* on success, or ``NULL`` " +"on failure. The operation is done *in-place* when *o1* supports it. This " +"is the equivalent of the Python statement ``o1 ^= o2``." msgstr "" -msgid "Returns the \"bitwise or\" of *o1* and *o2* on success, or ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 |= o2``." +#: ../../c-api/number.rst:234 +msgid "" +"Returns the \"bitwise or\" of *o1* and *o2* on success, or ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python statement ``o1 |= o2``." msgstr "" -msgid "Returns the *o* converted to an integer object on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``int(o)``." +#: ../../c-api/number.rst:243 +msgid "" +"Returns the *o* converted to an integer object on success, or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``int(o)``." msgstr "" -msgid "Returns the *o* converted to a float object on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``float(o)``." +#: ../../c-api/number.rst:251 +msgid "" +"Returns the *o* converted to a float object on success, or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``float(o)``." msgstr "" -msgid "Returns the *o* converted to a Python int on success or ``NULL`` with a :exc:`TypeError` exception raised on failure." +#: ../../c-api/number.rst:257 +msgid "" +"Returns the *o* converted to a Python int on success or ``NULL`` with " +"a :exc:`TypeError` exception raised on failure." msgstr "" -msgid "The result always has exact type :class:`int`. Previously, the result could have been an instance of a subclass of ``int``." +#: ../../c-api/number.rst:260 +msgid "" +"The result always has exact type :class:`int`. Previously, the result could " +"have been an instance of a subclass of ``int``." msgstr "" -msgid "Returns the integer *n* converted to base *base* as a string. The *base* argument must be one of 2, 8, 10, or 16. For base 2, 8, or 16, the returned string is prefixed with a base marker of ``'0b'``, ``'0o'``, or ``'0x'``, respectively. If *n* is not a Python int, it is converted with :c:func:`PyNumber_Index` first." +#: ../../c-api/number.rst:267 +msgid "" +"Returns the integer *n* converted to base *base* as a string. The *base* " +"argument must be one of 2, 8, 10, or 16. For base 2, 8, or 16, the returned " +"string is prefixed with a base marker of ``'0b'``, ``'0o'``, or ``'0x'``, " +"respectively. If *n* is not a Python int, it is converted " +"with :c:func:`PyNumber_Index` first." msgstr "" -msgid "Returns *o* converted to a :c:type:`Py_ssize_t` value if *o* can be interpreted as an integer. If the call fails, an exception is raised and ``-1`` is returned." +#: ../../c-api/number.rst:276 +msgid "" +"Returns *o* converted to a :c:type:`Py_ssize_t` value if *o* can be " +"interpreted as an integer. If the call fails, an exception is raised and " +"``-1`` is returned." msgstr "" -msgid "If *o* can be converted to a Python int but the attempt to convert to a :c:type:`Py_ssize_t` value would raise an :exc:`OverflowError`, then the *exc* argument is the type of exception that will be raised (usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is ``NULL``, then the exception is cleared and the value is clipped to ``PY_SSIZE_T_MIN`` for a negative integer or ``PY_SSIZE_T_MAX`` for a positive integer." +#: ../../c-api/number.rst:279 +msgid "" +"If *o* can be converted to a Python int but the attempt to convert to " +"a :c:type:`Py_ssize_t` value would raise an :exc:`OverflowError`, then the " +"*exc* argument is the type of exception that will be raised " +"(usually :exc:`IndexError` or :exc:`OverflowError`). If *exc* is ``NULL``, " +"then the exception is cleared and the value is clipped to ``PY_SSIZE_T_MIN`` " +"for a negative integer or ``PY_SSIZE_T_MAX`` for a positive integer." msgstr "" -msgid "Returns ``1`` if *o* is an index integer (has the ``nb_index`` slot of the ``tp_as_number`` structure filled in), and ``0`` otherwise. This function always succeeds." +#: ../../c-api/number.rst:289 +msgid "" +"Returns ``1`` if *o* is an index integer (has the ``nb_index`` slot of the " +"``tp_as_number`` structure filled in), and ``0`` otherwise. This function " +"always succeeds." msgstr "" +#: ../../c-api/number.rst:67 ../../c-api/number.rst:75 +#: ../../c-api/number.rst:97 ../../c-api/number.rst:195 +#: ../../c-api/number.rst:241 ../../c-api/number.rst:249 msgid "built-in function" msgstr "" +#: ../../c-api/number.rst:67 msgid "divmod" msgstr "" +#: ../../c-api/number.rst:75 ../../c-api/number.rst:195 msgid "pow" msgstr "" +#: ../../c-api/number.rst:97 msgid "abs" msgstr "" +#: ../../c-api/number.rst:241 msgid "int" msgstr "" +#: ../../c-api/number.rst:249 msgid "float" msgstr "" diff --git a/c-api/object.po b/c-api/object.po index 12c9f1926..8e43dfe91 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,395 +24,831 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/object.rst:6 msgid "Object Protocol" msgstr "" +#: ../../c-api/object.rst:11 msgid "Get a :term:`strong reference` to a constant." msgstr "" +#: ../../c-api/object.rst:13 msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." msgstr "" +#: ../../c-api/object.rst:15 msgid "*constant_id* must be one of these constant identifiers:" msgstr "" +#: ../../c-api/object.rst:20 msgid "Constant Identifier" msgstr "" +#: ../../c-api/object.rst:20 msgid "Value" msgstr "" +#: ../../c-api/object.rst:20 msgid "Returned object" msgstr "" +#: ../../c-api/object.rst:22 ../../c-api/object.rst:27 msgid "``0``" msgstr "" +#: ../../c-api/object.rst:22 msgid ":py:data:`None`" msgstr "" +#: ../../c-api/object.rst:23 ../../c-api/object.rst:28 msgid "``1``" msgstr "" +#: ../../c-api/object.rst:23 msgid ":py:data:`False`" msgstr "" +#: ../../c-api/object.rst:24 msgid "``2``" msgstr "" +#: ../../c-api/object.rst:24 msgid ":py:data:`True`" msgstr "" +#: ../../c-api/object.rst:25 msgid "``3``" msgstr "" +#: ../../c-api/object.rst:25 msgid ":py:data:`Ellipsis`" msgstr "" +#: ../../c-api/object.rst:26 msgid "``4``" msgstr "" +#: ../../c-api/object.rst:26 msgid ":py:data:`NotImplemented`" msgstr "" +#: ../../c-api/object.rst:27 msgid "``5``" msgstr "" +#: ../../c-api/object.rst:28 msgid "``6``" msgstr "" +#: ../../c-api/object.rst:29 msgid "``7``" msgstr "" +#: ../../c-api/object.rst:29 msgid "``''``" msgstr "" +#: ../../c-api/object.rst:30 msgid "``8``" msgstr "" +#: ../../c-api/object.rst:30 msgid "``b''``" msgstr "" +#: ../../c-api/object.rst:31 msgid "``9``" msgstr "" +#: ../../c-api/object.rst:31 msgid "``()``" msgstr "" -msgid "Numeric values are only given for projects which cannot use the constant identifiers." +#: ../../c-api/object.rst:34 +msgid "" +"Numeric values are only given for projects which cannot use the constant " +"identifiers." msgstr "" +#: ../../c-api/object.rst:42 msgid "In CPython, all of these constants are :term:`immortal`." msgstr "" -msgid "Similar to :c:func:`Py_GetConstant`, but return a :term:`borrowed reference`." +#: ../../c-api/object.rst:47 +msgid "" +"Similar to :c:func:`Py_GetConstant`, but return a :term:`borrowed reference`." msgstr "" -msgid "This function is primarily intended for backwards compatibility: using :c:func:`Py_GetConstant` is recommended for new code." +#: ../../c-api/object.rst:50 +msgid "" +"This function is primarily intended for backwards compatibility: " +"using :c:func:`Py_GetConstant` is recommended for new code." msgstr "" -msgid "The reference is borrowed from the interpreter, and is valid until the interpreter finalization." +#: ../../c-api/object.rst:53 +msgid "" +"The reference is borrowed from the interpreter, and is valid until the " +"interpreter finalization." msgstr "" -msgid "The ``NotImplemented`` singleton, used to signal that an operation is not implemented for the given type combination." +#: ../../c-api/object.rst:61 +msgid "" +"The ``NotImplemented`` singleton, used to signal that an operation is not " +"implemented for the given type combination." msgstr "" -msgid "Properly handle returning :c:data:`Py_NotImplemented` from within a C function (that is, create a new :term:`strong reference` to :const:`NotImplemented` and return it)." +#: ../../c-api/object.rst:67 +msgid "" +"Properly handle returning :c:data:`Py_NotImplemented` from within a C " +"function (that is, create a new :term:`strong reference` " +"to :const:`NotImplemented` and return it)." msgstr "" -msgid "Flag to be used with multiple functions that print the object (like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these functions use the :func:`str` of the object instead of the :func:`repr`." +#: ../../c-api/object.rst:74 +msgid "" +"Flag to be used with multiple functions that print the object " +"(like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, " +"these functions use the :func:`str` of the object instead of " +"the :func:`repr`." msgstr "" -msgid "Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags argument is used to enable certain printing options. The only option currently supported is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is written instead of the :func:`repr`." +#: ../../c-api/object.rst:82 +msgid "" +"Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags " +"argument is used to enable certain printing options. The only option " +"currently supported is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of " +"the object is written instead of the :func:`repr`." msgstr "" -msgid "Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This is equivalent to the Python expression ``hasattr(o, attr_name)``. On failure, return ``-1``." +#: ../../c-api/object.rst:90 +msgid "" +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This is equivalent to the Python expression ``hasattr(o, attr_name)``. On " +"failure, return ``-1``." msgstr "" -msgid "This is the same as :c:func:`PyObject_HasAttrWithError`, but *attr_name* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:99 +msgid "" +"This is the same as :c:func:`PyObject_HasAttrWithError`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This function always succeeds." +#: ../../c-api/object.rst:108 +msgid "" +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This function always succeeds." msgstr "" -msgid "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:`~object.__getattribute__` methods aren't propagated, but instead given to :func:`sys.unraisablehook`. For proper error handling, use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:`PyObject_GetAttr` instead." +#: ../../c-api/object.rst:113 +msgid "" +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods aren't propagated, but instead " +"given to :func:`sys.unraisablehook`. For proper error handling, " +"use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` " +"or :c:func:`PyObject_GetAttr` instead." msgstr "" -msgid "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:122 +msgid "" +"This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:`~object.__getattribute__` methods or while creating the temporary :class:`str` object are silently ignored. For proper error handling, use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` or :c:func:`PyObject_GetAttrString` instead." +#: ../../c-api/object.rst:128 +msgid "" +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods or while creating the " +"temporary :class:`str` object are silently ignored. For proper error " +"handling, " +"use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"or :c:func:`PyObject_GetAttrString` instead." msgstr "" -msgid "Retrieve an attribute named *attr_name* from object *o*. Returns the attribute value on success, or ``NULL`` on failure. This is the equivalent of the Python expression ``o.attr_name``." +#: ../../c-api/object.rst:138 +msgid "" +"Retrieve an attribute named *attr_name* from object *o*. Returns the " +"attribute value on success, or ``NULL`` on failure. This is the equivalent " +"of the Python expression ``o.attr_name``." msgstr "" -msgid "If the missing attribute should not be treated as a failure, you can use :c:func:`PyObject_GetOptionalAttr` instead." +#: ../../c-api/object.rst:142 +msgid "" +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttr` instead." msgstr "" -msgid "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:148 +msgid "" +"This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "If the missing attribute should not be treated as a failure, you can use :c:func:`PyObject_GetOptionalAttrString` instead." +#: ../../c-api/object.rst:152 +msgid "" +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttrString` instead." msgstr "" -msgid "Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:`AttributeError` if the attribute is not found." +#: ../../c-api/object.rst:158 +msgid "" +"Variant of :c:func:`PyObject_GetAttr` which doesn't " +"raise :exc:`AttributeError` if the attribute is not found." msgstr "" -msgid "If the attribute is found, return ``1`` and set *\\*result* to a new :term:`strong reference` to the attribute. If the attribute is not found, return ``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is silenced. If an error other than :exc:`AttributeError` is raised, return ``-1`` and set *\\*result* to ``NULL``." +#: ../../c-api/object.rst:161 +msgid "" +"If the attribute is found, return ``1`` and set *\\*result* to a " +"new :term:`strong reference` to the attribute. If the attribute is not " +"found, return ``0`` and set *\\*result* to ``NULL``; " +"the :exc:`AttributeError` is silenced. If an error other " +"than :exc:`AttributeError` is raised, return ``-1`` and set *\\*result* to " +"``NULL``." msgstr "" -msgid "This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:173 +msgid "" +"This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "Generic attribute getter function that is meant to be put into a type object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary of classes in the object's MRO as well as an attribute in the object's :attr:`~object.__dict__` (if present). As outlined in :ref:`descriptors`, data descriptors take preference over instance attributes, while non-data descriptors don't. Otherwise, an :exc:`AttributeError` is raised." +#: ../../c-api/object.rst:181 +msgid "" +"Generic attribute getter function that is meant to be put into a type " +"object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " +"of classes in the object's MRO as well as an attribute in the " +"object's :attr:`~object.__dict__` (if present). As outlined " +"in :ref:`descriptors`, data descriptors take preference over instance " +"attributes, while non-data descriptors don't. Otherwise, " +"an :exc:`AttributeError` is raised." msgstr "" -msgid "Set the value of the attribute named *attr_name*, for object *o*, to the value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on success. This is the equivalent of the Python statement ``o.attr_name = v``." +#: ../../c-api/object.rst:191 +msgid "" +"Set the value of the attribute named *attr_name*, for object *o*, to the " +"value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " +"success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -msgid "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated in favour of using :c:func:`PyObject_DelAttr`, but there are currently no plans to remove it." +#: ../../c-api/object.rst:196 +msgid "" +"If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " +"in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " +"plans to remove it." msgstr "" -msgid "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:203 +msgid "" +"This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated in favour of using :c:func:`PyObject_DelAttrString`." +#: ../../c-api/object.rst:207 +msgid "" +"If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " +"in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -msgid "The number of different attribute names passed to this function should be kept small, usually by using a statically allocated string as *attr_name*. For attribute names that aren't known at compile time, prefer calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more details, see :c:func:`PyUnicode_InternFromString`, which may be used internally to create a key object." +#: ../../c-api/object.rst:210 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" -msgid "Generic attribute setter and deleter function that is meant to be put into a type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a data descriptor in the dictionary of classes in the object's MRO, and if found it takes preference over setting or deleting the attribute in the instance dictionary. Otherwise, the attribute is set or deleted in the object's :attr:`~object.__dict__` (if present). On success, ``0`` is returned, otherwise an :exc:`AttributeError` is raised and ``-1`` is returned." +#: ../../c-api/object.rst:220 +msgid "" +"Generic attribute setter and deleter function that is meant to be put into a " +"type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " +"data descriptor in the dictionary of classes in the object's MRO, and if " +"found it takes preference over setting or deleting the attribute in the " +"instance dictionary. Otherwise, the attribute is set or deleted in the " +"object's :attr:`~object.__dict__` (if present). On success, ``0`` is " +"returned, otherwise an :exc:`AttributeError` is raised and ``-1`` is " +"returned." msgstr "" -msgid "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o.attr_name``." +#: ../../c-api/object.rst:232 +msgid "" +"Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " +"failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -msgid "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:238 +msgid "" +"This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "The number of different attribute names passed to this function should be kept small, usually by using a statically allocated string as *attr_name*. For attribute names that aren't known at compile time, prefer calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For more details, see :c:func:`PyUnicode_InternFromString`, which may be used internally to create a key object for lookup." +#: ../../c-api/object.rst:242 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object for lookup." msgstr "" -msgid "A generic implementation for the getter of a ``__dict__`` descriptor. It creates the dictionary if necessary." +#: ../../c-api/object.rst:253 +msgid "" +"A generic implementation for the getter of a ``__dict__`` descriptor. It " +"creates the dictionary if necessary." msgstr "" -msgid "This function may also be called to get the :py:attr:`~object.__dict__` of the object *o*. Pass ``NULL`` for *context* when calling it. Since this function may need to allocate memory for the dictionary, it may be more efficient to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +#: ../../c-api/object.rst:256 +msgid "" +"This function may also be called to get the :py:attr:`~object.__dict__` of " +"the object *o*. Pass ``NULL`` for *context* when calling it. Since this " +"function may need to allocate memory for the dictionary, it may be more " +"efficient to call :c:func:`PyObject_GetAttr` when accessing an attribute on " +"the object." msgstr "" +#: ../../c-api/object.rst:262 msgid "On failure, returns ``NULL`` with an exception set." msgstr "" -msgid "A generic implementation for the setter of a ``__dict__`` descriptor. This implementation does not allow the dictionary to be deleted." +#: ../../c-api/object.rst:269 +msgid "" +"A generic implementation for the setter of a ``__dict__`` descriptor. This " +"implementation does not allow the dictionary to be deleted." msgstr "" -msgid "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If there is no ``__dict__``, return ``NULL`` without setting an exception." +#: ../../c-api/object.rst:277 +msgid "" +"Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " +"there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -msgid "This function may need to allocate memory for the dictionary, so it may be more efficient to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +#: ../../c-api/object.rst:280 +msgid "" +"This function may need to allocate memory for the dictionary, so it may be " +"more efficient to call :c:func:`PyObject_GetAttr` when accessing an " +"attribute on the object." msgstr "" -msgid "Compare the values of *o1* and *o2* using the operation specified by *opid*, which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the equivalent of the Python expression ``o1 op o2``, where ``op`` is the operator corresponding to *opid*. Returns the value of the comparison on success, or ``NULL`` on failure." +#: ../../c-api/object.rst:287 +msgid "" +"Compare the values of *o1* and *o2* using the operation specified by *opid*, " +"which must be one " +"of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, " +"or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, " +"or ``>=`` respectively. This is the equivalent of the Python expression ``o1 " +"op o2``, where ``op`` is the operator corresponding to *opid*. Returns the " +"value of the comparison on success, or ``NULL`` on failure." msgstr "" -msgid "Compare the values of *o1* and *o2* using the operation specified by *opid*, like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if the result is false, ``1`` otherwise." +#: ../../c-api/object.rst:297 +msgid "" +"Compare the values of *o1* and *o2* using the operation specified by *opid*, " +"like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " +"the result is false, ``1`` otherwise." msgstr "" -msgid "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." +#: ../../c-api/object.rst:302 +msgid "" +"If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " +"will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" -msgid "Format *obj* using *format_spec*. This is equivalent to the Python expression ``format(obj, format_spec)``." +#: ../../c-api/object.rst:307 +msgid "" +"Format *obj* using *format_spec*. This is equivalent to the Python " +"expression ``format(obj, format_spec)``." msgstr "" -msgid "*format_spec* may be ``NULL``. In this case the call is equivalent to ``format(obj)``. Returns the formatted string on success, ``NULL`` on failure." +#: ../../c-api/object.rst:310 +msgid "" +"*format_spec* may be ``NULL``. In this case the call is equivalent to " +"``format(obj)``. Returns the formatted string on success, ``NULL`` on " +"failure." msgstr "" -msgid "Compute a string representation of object *o*. Returns the string representation on success, ``NULL`` on failure. This is the equivalent of the Python expression ``repr(o)``. Called by the :func:`repr` built-in function." +#: ../../c-api/object.rst:318 +msgid "" +"Compute a string representation of object *o*. Returns the string " +"representation on success, ``NULL`` on failure. This is the equivalent of " +"the Python expression ``repr(o)``. Called by the :func:`repr` built-in " +"function." msgstr "" +#: ../../c-api/object.rst:322 ../../c-api/object.rst:338 +#: ../../c-api/object.rst:350 msgid "If argument is ``NULL``, return the string ``''``." msgstr "" -msgid "This function now includes a debug assertion to help ensure that it does not silently discard an active exception." +#: ../../c-api/object.rst:324 ../../c-api/object.rst:352 +msgid "" +"This function now includes a debug assertion to help ensure that it does not " +"silently discard an active exception." msgstr "" -msgid "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, but escape the non-ASCII characters in the string returned by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This generates a string similar to that returned by :c:func:`PyObject_Repr` in Python 2. Called by the :func:`ascii` built-in function." +#: ../../c-api/object.rst:332 +msgid "" +"As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " +"but escape the non-ASCII characters in the string returned " +"by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This " +"generates a string similar to that returned by :c:func:`PyObject_Repr` in " +"Python 2. Called by the :func:`ascii` built-in function." msgstr "" -msgid "Compute a string representation of object *o*. Returns the string representation on success, ``NULL`` on failure. This is the equivalent of the Python expression ``str(o)``. Called by the :func:`str` built-in function and, therefore, by the :func:`print` function." +#: ../../c-api/object.rst:345 +msgid "" +"Compute a string representation of object *o*. Returns the string " +"representation on success, ``NULL`` on failure. This is the equivalent of " +"the Python expression ``str(o)``. Called by the :func:`str` built-in " +"function and, therefore, by the :func:`print` function." msgstr "" -msgid "Compute a bytes representation of object *o*. ``NULL`` is returned on failure and a bytes object on success. This is equivalent to the Python expression ``bytes(o)``, when *o* is not an integer. Unlike ``bytes(o)``, a TypeError is raised when *o* is an integer instead of a zero-initialized bytes object." +#: ../../c-api/object.rst:361 +msgid "" +"Compute a bytes representation of object *o*. ``NULL`` is returned on " +"failure and a bytes object on success. This is equivalent to the Python " +"expression ``bytes(o)``, when *o* is not an integer. Unlike ``bytes(o)``, a " +"TypeError is raised when *o* is an integer instead of a zero-initialized " +"bytes object." msgstr "" -msgid "If argument is ``NULL``, return the :class:`bytes` object ``b''``." +#: ../../c-api/object.rst:367 +msgid "" +"If argument is ``NULL``, return the :class:`bytes` object ``b''``." msgstr "" -msgid "Return ``1`` if the class *derived* is identical to or derived from the class *cls*, otherwise return ``0``. In case of an error, return ``-1``." +#: ../../c-api/object.rst:372 +msgid "" +"Return ``1`` if the class *derived* is identical to or derived from the " +"class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -msgid "If *cls* is a tuple, the check will be done against every entry in *cls*. The result will be ``1`` when at least one of the checks returns ``1``, otherwise it will be ``0``." +#: ../../c-api/object.rst:375 ../../c-api/object.rst:394 +msgid "" +"If *cls* is a tuple, the check will be done against every entry in *cls*. " +"The result will be ``1`` when at least one of the checks returns ``1``, " +"otherwise it will be ``0``." msgstr "" -msgid "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to determine the subclass status as described in :pep:`3119`. Otherwise, *derived* is a subclass of *cls* if it is a direct or indirect subclass, i.e. contained in :attr:`cls.__mro__ `." +#: ../../c-api/object.rst:379 +msgid "" +"If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " +"determine the subclass status as described in :pep:`3119`. Otherwise, " +"*derived* is a subclass of *cls* if it is a direct or indirect subclass, " +"i.e. contained in :attr:`cls.__mro__ `." msgstr "" -msgid "Normally only class objects, i.e. instances of :class:`type` or a derived class, are considered classes. However, objects can override this by having a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." +#: ../../c-api/object.rst:384 +msgid "" +"Normally only class objects, i.e. instances of :class:`type` or a derived " +"class, are considered classes. However, objects can override this by having " +"a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" -msgid "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of *cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." +#: ../../c-api/object.rst:391 +msgid "" +"Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " +"*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -msgid "If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to determine the subclass status as described in :pep:`3119`. Otherwise, *inst* is an instance of *cls* if its class is a subclass of *cls*." +#: ../../c-api/object.rst:398 +msgid "" +"If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " +"determine the subclass status as described in :pep:`3119`. Otherwise, " +"*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -msgid "An instance *inst* can override what is considered its class by having a :attr:`~object.__class__` attribute." +#: ../../c-api/object.rst:402 +msgid "" +"An instance *inst* can override what is considered its class by having " +"a :attr:`~object.__class__` attribute." msgstr "" -msgid "An object *cls* can override if it is considered a class, and what its base classes are, by having a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." +#: ../../c-api/object.rst:405 +msgid "" +"An object *cls* can override if it is considered a class, and what its base " +"classes are, by having a :attr:`~type.__bases__` attribute (which must be a " +"tuple of base classes)." msgstr "" -msgid "Compute and return the hash value of an object *o*. On failure, return ``-1``. This is the equivalent of the Python expression ``hash(o)``." +#: ../../c-api/object.rst:414 +msgid "" +"Compute and return the hash value of an object *o*. On failure, return " +"``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -msgid "The return type is now Py_hash_t. This is a signed integer the same size as :c:type:`Py_ssize_t`." +#: ../../c-api/object.rst:417 +msgid "" +"The return type is now Py_hash_t. This is a signed integer the same size " +"as :c:type:`Py_ssize_t`." msgstr "" -msgid "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` and return ``-1``. This function receives special treatment when stored in a ``tp_hash`` slot, allowing a type to explicitly indicate to the interpreter that it is not hashable." +#: ../../c-api/object.rst:424 +msgid "" +"Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " +"and return ``-1``. This function receives special treatment when stored in a " +"``tp_hash`` slot, allowing a type to explicitly indicate to the interpreter " +"that it is not hashable." msgstr "" -msgid "Returns ``1`` if the object *o* is considered to be true, and ``0`` otherwise. This is equivalent to the Python expression ``not not o``. On failure, return ``-1``." +#: ../../c-api/object.rst:432 +msgid "" +"Returns ``1`` if the object *o* is considered to be true, and ``0`` " +"otherwise. This is equivalent to the Python expression ``not not o``. On " +"failure, return ``-1``." msgstr "" -msgid "Returns ``0`` if the object *o* is considered to be true, and ``1`` otherwise. This is equivalent to the Python expression ``not o``. On failure, return ``-1``." +#: ../../c-api/object.rst:439 +msgid "" +"Returns ``0`` if the object *o* is considered to be true, and ``1`` " +"otherwise. This is equivalent to the Python expression ``not o``. On " +"failure, return ``-1``." msgstr "" -msgid "When *o* is non-``NULL``, returns a type object corresponding to the object type of object *o*. On failure, raises :exc:`SystemError` and returns ``NULL``. This is equivalent to the Python expression ``type(o)``. This function creates a new :term:`strong reference` to the return value. There's really no reason to use this function instead of the :c:func:`Py_TYPE()` function, which returns a pointer of type :c:expr:`PyTypeObject*`, except when a new :term:`strong reference` is needed." +#: ../../c-api/object.rst:448 +msgid "" +"When *o* is non-``NULL``, returns a type object corresponding to the object " +"type of object *o*. On failure, raises :exc:`SystemError` and returns " +"``NULL``. This is equivalent to the Python expression ``type(o)``. This " +"function creates a new :term:`strong reference` to the return value. There's " +"really no reason to use this function instead of the :c:func:`Py_TYPE()` " +"function, which returns a pointer of type :c:expr:`PyTypeObject*`, except " +"when a new :term:`strong reference` is needed." msgstr "" -msgid "Return non-zero if the object *o* is of type *type* or a subtype of *type*, and ``0`` otherwise. Both parameters must be non-``NULL``." +#: ../../c-api/object.rst:460 +msgid "" +"Return non-zero if the object *o* is of type *type* or a subtype of *type*, " +"and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -msgid "Return the length of object *o*. If the object *o* provides either the sequence and mapping protocols, the sequence length is returned. On error, ``-1`` is returned. This is the equivalent to the Python expression ``len(o)``." +#: ../../c-api/object.rst:469 +msgid "" +"Return the length of object *o*. If the object *o* provides either the " +"sequence and mapping protocols, the sequence length is returned. On error, " +"``-1`` is returned. This is the equivalent to the Python expression " +"``len(o)``." msgstr "" -msgid "Return an estimated length for the object *o*. First try to return its actual length, then an estimate using :meth:`~object.__length_hint__`, and finally return the default value. On error return ``-1``. This is the equivalent to the Python expression ``operator.length_hint(o, defaultvalue)``." +#: ../../c-api/object.rst:476 +msgid "" +"Return an estimated length for the object *o*. First try to return its " +"actual length, then an estimate using :meth:`~object.__length_hint__`, and " +"finally return the default value. On error return ``-1``. This is the " +"equivalent to the Python expression ``operator.length_hint(o, " +"defaultvalue)``." msgstr "" -msgid "Return element of *o* corresponding to the object *key* or ``NULL`` on failure. This is the equivalent of the Python expression ``o[key]``." +#: ../../c-api/object.rst:486 +msgid "" +"Return element of *o* corresponding to the object *key* or ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -msgid "Map the object *key* to the value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on success. This is the equivalent of the Python statement ``o[key] = v``. This function *does not* steal a reference to *v*." +#: ../../c-api/object.rst:492 +msgid "" +"Map the object *key* to the value *v*. Raise an exception and return ``-1`` " +"on failure; return ``0`` on success. This is the equivalent of the Python " +"statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -msgid "Remove the mapping for the object *key* from the object *o*. Return ``-1`` on failure. This is equivalent to the Python statement ``del o[key]``." +#: ../../c-api/object.rst:500 +msgid "" +"Remove the mapping for the object *key* from the object *o*. Return ``-1`` " +"on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -msgid "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +#: ../../c-api/object.rst:506 +msgid "" +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -msgid "This is equivalent to the Python expression ``dir(o)``, returning a (possibly empty) list of strings appropriate for the object argument, or ``NULL`` if there was an error. If the argument is ``NULL``, this is like the Python ``dir()``, returning the names of the current locals; in this case, if no execution frame is active then ``NULL`` is returned but :c:func:`PyErr_Occurred` will return false." +#: ../../c-api/object.rst:513 +msgid "" +"This is equivalent to the Python expression ``dir(o)``, returning a " +"(possibly empty) list of strings appropriate for the object argument, or " +"``NULL`` if there was an error. If the argument is ``NULL``, this is like " +"the Python ``dir()``, returning the names of the current locals; in this " +"case, if no execution frame is active then ``NULL`` is returned " +"but :c:func:`PyErr_Occurred` will return false." msgstr "" -msgid "This is equivalent to the Python expression ``iter(o)``. It returns a new iterator for the object argument, or the object itself if the object is already an iterator. Raises :exc:`TypeError` and returns ``NULL`` if the object cannot be iterated." +#: ../../c-api/object.rst:522 +msgid "" +"This is equivalent to the Python expression ``iter(o)``. It returns a new " +"iterator for the object argument, or the object itself if the object is " +"already an iterator. Raises :exc:`TypeError` and returns ``NULL`` if the " +"object cannot be iterated." msgstr "" -msgid "This is equivalent to the Python ``__iter__(self): return self`` method. It is intended for :term:`iterator` types, to be used in the :c:member:`PyTypeObject.tp_iter` slot." +#: ../../c-api/object.rst:530 +msgid "" +"This is equivalent to the Python ``__iter__(self): return self`` method. It " +"is intended for :term:`iterator` types, to be used in " +"the :c:member:`PyTypeObject.tp_iter` slot." msgstr "" -msgid "This is the equivalent to the Python expression ``aiter(o)``. Takes an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. This is typically a new iterator but if the argument is an :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns ``NULL`` if the object cannot be iterated." +#: ../../c-api/object.rst:536 +msgid "" +"This is the equivalent to the Python expression ``aiter(o)``. Takes " +"an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for " +"it. This is typically a new iterator but if the argument is " +"an :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and " +"returns ``NULL`` if the object cannot be iterated." msgstr "" +#: ../../c-api/object.rst:546 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -msgid "The object *o* must be an instance of *cls*, and *cls* must have been created using negative :c:member:`PyType_Spec.basicsize`. Python does not check this." +#: ../../c-api/object.rst:548 +msgid "" +"The object *o* must be an instance of *cls*, and *cls* must have been " +"created using negative :c:member:`PyType_Spec.basicsize`. Python does not " +"check this." msgstr "" +#: ../../c-api/object.rst:552 msgid "On error, set an exception and return ``NULL``." msgstr "" -msgid "Return the size of the instance memory space reserved for *cls*, i.e. the size of the memory :c:func:`PyObject_GetTypeData` returns." +#: ../../c-api/object.rst:558 +msgid "" +"Return the size of the instance memory space reserved for *cls*, i.e. the " +"size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -msgid "This may be larger than requested using :c:member:`-PyType_Spec.basicsize `; it is safe to use this larger size (e.g. with :c:func:`!memset`)." +#: ../../c-api/object.rst:561 +msgid "" +"This may be larger than requested using :c:member:`-PyType_Spec.basicsize " +"`; it is safe to use this larger size (e.g. " +"with :c:func:`!memset`)." msgstr "" -msgid "The type *cls* **must** have been created using negative :c:member:`PyType_Spec.basicsize`. Python does not check this." +#: ../../c-api/object.rst:564 +msgid "" +"The type *cls* **must** have been created using " +"negative :c:member:`PyType_Spec.basicsize`. Python does not check this." msgstr "" +#: ../../c-api/object.rst:568 msgid "On error, set an exception and return a negative value." msgstr "" -msgid "Get a pointer to per-item data for a class with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`." +#: ../../c-api/object.rst:574 +msgid "" +"Get a pointer to per-item data for a class " +"with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -msgid "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." +#: ../../c-api/object.rst:577 +msgid "" +"On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " +"raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" +#: ../../c-api/object.rst:585 msgid "Visit the managed dictionary of *obj*." msgstr "" -msgid "This function must only be called in a traverse function of the type which has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +#: ../../c-api/object.rst:587 +msgid "" +"This function must only be called in a traverse function of the type which " +"has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" +#: ../../c-api/object.rst:594 msgid "Clear the managed dictionary of *obj*." msgstr "" -msgid "This function must only be called in a clear function of the type which has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +#: ../../c-api/object.rst:596 +msgid "" +"This function must only be called in a clear function of the type which has " +"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" -msgid "Enable `deferred reference counting `_ on *obj*, if supported by the runtime. In the :term:`free-threaded ` build, this allows the interpreter to avoid reference count adjustments to *obj*, which may improve multi-threaded performance. The tradeoff is that *obj* will only be deallocated by the tracing garbage collector, and not when the interpreter no longer has any references to it." +#: ../../c-api/object.rst:603 +msgid "" +"Enable `deferred reference counting `_ on *obj*, if supported by the runtime. In " +"the :term:`free-threaded ` build, this allows the " +"interpreter to avoid reference count adjustments to *obj*, which may improve " +"multi-threaded performance. The tradeoff is that *obj* will only be " +"deallocated by the tracing garbage collector, and not when the interpreter " +"no longer has any references to it." msgstr "" -msgid "This function returns ``1`` if deferred reference counting is enabled on *obj*, and ``0`` if deferred reference counting is not supported or if the hint was ignored by the interpreter, such as when deferred reference counting is already enabled on *obj*. This function is thread-safe, and cannot fail." +#: ../../c-api/object.rst:610 +msgid "" +"This function returns ``1`` if deferred reference counting is enabled on " +"*obj*, and ``0`` if deferred reference counting is not supported or if the " +"hint was ignored by the interpreter, such as when deferred reference " +"counting is already enabled on *obj*. This function is thread-safe, and " +"cannot fail." msgstr "" -msgid "This function does nothing on builds with the :term:`GIL` enabled, which do not support deferred reference counting. This also does nothing if *obj* is not an object tracked by the garbage collector (see :func:`gc.is_tracked` and :c:func:`PyObject_GC_IsTracked`)." +#: ../../c-api/object.rst:615 +msgid "" +"This function does nothing on builds with the :term:`GIL` enabled, which do " +"not support deferred reference counting. This also does nothing if *obj* is " +"not an object tracked by the garbage collector (see :func:`gc.is_tracked` " +"and :c:func:`PyObject_GC_IsTracked`)." msgstr "" -msgid "This function is intended to be used soon after *obj* is created, by the code that creates it, such as in the object's :c:member:`~PyTypeObject.tp_new` slot." +#: ../../c-api/object.rst:620 +msgid "" +"This function is intended to be used soon after *obj* is created, by the " +"code that creates it, such as in the " +"object's :c:member:`~PyTypeObject.tp_new` slot." msgstr "" -msgid "Check if *obj* is a unique temporary object. Returns ``1`` if *obj* is known to be a unique temporary object, and ``0`` otherwise. This function cannot fail, but the check is conservative, and may return ``0`` in some cases even if *obj* is a unique temporary object." +#: ../../c-api/object.rst:628 +msgid "" +"Check if *obj* is a unique temporary object. Returns ``1`` if *obj* is known " +"to be a unique temporary object, and ``0`` otherwise. This function cannot " +"fail, but the check is conservative, and may return ``0`` in some cases even " +"if *obj* is a unique temporary object." msgstr "" -msgid "If an object is a unique temporary, it is guaranteed that the current code has the only reference to the object. For arguments to C functions, this should be used instead of checking if the reference count is ``1``. Starting with Python 3.14, the interpreter internally avoids some reference count modifications when loading objects onto the operands stack by :term:`borrowing ` references when possible, which means that a reference count of ``1`` by itself does not guarantee that a function argument uniquely referenced." +#: ../../c-api/object.rst:634 +msgid "" +"If an object is a unique temporary, it is guaranteed that the current code " +"has the only reference to the object. For arguments to C functions, this " +"should be used instead of checking if the reference count is ``1``. Starting " +"with Python 3.14, the interpreter internally avoids some reference count " +"modifications when loading objects onto the operands stack " +"by :term:`borrowing ` references when possible, which " +"means that a reference count of ``1`` by itself does not guarantee that a " +"function argument uniquely referenced." msgstr "" -msgid "In the example below, ``my_func`` is called with a unique temporary object as its argument::" +#: ../../c-api/object.rst:643 +msgid "" +"In the example below, ``my_func`` is called with a unique temporary object " +"as its argument::" msgstr "" +#: ../../c-api/object.rst:646 msgid "my_func([1, 2, 3])" msgstr "" -msgid "In the example below, ``my_func`` is **not** called with a unique temporary object as its argument, even if its refcount is ``1``::" +#: ../../c-api/object.rst:648 +msgid "" +"In the example below, ``my_func`` is **not** called with a unique temporary " +"object as its argument, even if its refcount is ``1``::" msgstr "" +#: ../../c-api/object.rst:651 msgid "" "my_list = [1, 2, 3]\n" "my_func(my_list)" msgstr "" +#: ../../c-api/object.rst:654 msgid "See also the function :c:func:`Py_REFCNT`." msgstr "" -msgid "This function returns non-zero if *obj* is :term:`immortal`, and zero otherwise. This function cannot fail." +#: ../../c-api/object.rst:660 +msgid "" +"This function returns non-zero if *obj* is :term:`immortal`, and zero " +"otherwise. This function cannot fail." msgstr "" -msgid "Objects that are immortal in one CPython version are not guaranteed to be immortal in another." +#: ../../c-api/object.rst:665 +msgid "" +"Objects that are immortal in one CPython version are not guaranteed to be " +"immortal in another." msgstr "" -msgid "Increments the reference count of *obj* if it is not zero. Returns ``1`` if the object's reference count was successfully incremented. Otherwise, this function returns ``0``." +#: ../../c-api/object.rst:672 +msgid "" +"Increments the reference count of *obj* if it is not zero. Returns ``1`` if " +"the object's reference count was successfully incremented. Otherwise, this " +"function returns ``0``." msgstr "" -msgid ":c:func:`PyUnstable_EnableTryIncRef` must have been called earlier on *obj* or this function may spuriously return ``0`` in the :term:`free-threaded build`." +#: ../../c-api/object.rst:676 +msgid "" +":c:func:`PyUnstable_EnableTryIncRef` must have been called earlier on *obj* " +"or this function may spuriously return ``0`` in the :term:`free-threaded " +"build`." msgstr "" -msgid "This function is logically equivalent to the following C code, except that it behaves atomically in the :term:`free-threaded build`::" +#: ../../c-api/object.rst:680 +msgid "" +"This function is logically equivalent to the following C code, except that " +"it behaves atomically in the :term:`free-threaded build`::" msgstr "" +#: ../../c-api/object.rst:683 msgid "" "if (Py_REFCNT(op) > 0) {\n" " Py_INCREF(op);\n" @@ -421,12 +857,21 @@ msgid "" "return 0;" msgstr "" -msgid "This is intended as a building block for managing weak references without the overhead of a Python :ref:`weak reference object `." +#: ../../c-api/object.rst:689 +msgid "" +"This is intended as a building block for managing weak references without " +"the overhead of a Python :ref:`weak reference object `." msgstr "" -msgid "Typically, correct use of this function requires support from *obj*'s deallocator (:c:member:`~PyTypeObject.tp_dealloc`). For example, the following sketch could be adapted to implement a \"weakmap\" that works like a :py:class:`~weakref.WeakValueDictionary` for a specific type:" +#: ../../c-api/object.rst:692 +msgid "" +"Typically, correct use of this function requires support from *obj*'s " +"deallocator (:c:member:`~PyTypeObject.tp_dealloc`). For example, the " +"following sketch could be adapted to implement a \"weakmap\" that works like " +"a :py:class:`~weakref.WeakValueDictionary` for a specific type:" msgstr "" +#: ../../c-api/object.rst:698 msgid "" "PyMutex mutex;\n" "\n" @@ -471,44 +916,71 @@ msgid "" "}" msgstr "" -msgid "Enables subsequent uses of :c:func:`PyUnstable_TryIncRef` on *obj*. The caller must hold a :term:`strong reference` to *obj* when calling this." +#: ../../c-api/object.rst:746 +msgid "" +"Enables subsequent uses of :c:func:`PyUnstable_TryIncRef` on *obj*. The " +"caller must hold a :term:`strong reference` to *obj* when calling this." msgstr "" +#: ../../c-api/object.rst:753 msgid "Determine if *op* only has one reference." msgstr "" -msgid "On GIL-enabled builds, this function is equivalent to :c:expr:`Py_REFCNT(op) == 1`." +#: ../../c-api/object.rst:755 +msgid "" +"On GIL-enabled builds, this function is equivalent to :c:expr:`Py_REFCNT(op) " +"== 1`." msgstr "" -msgid "On a :term:`free-threaded build`, this checks if *op*'s :term:`reference count` is equal to one and additionally checks if *op* is only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-safe on free-threaded builds; prefer this function." +#: ../../c-api/object.rst:758 +msgid "" +"On a :term:`free-threaded build`, this checks if *op*'s :term:`reference " +"count` is equal to one and additionally checks if *op* is only used by this " +"thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-safe on free-threaded " +"builds; prefer this function." msgstr "" -msgid "The caller must hold an :term:`attached thread state`, despite the fact that this function doesn't call into the Python interpreter. This function cannot fail." +#: ../../c-api/object.rst:763 +msgid "" +"The caller must hold an :term:`attached thread state`, despite the fact that " +"this function doesn't call into the Python interpreter. This function cannot " +"fail." msgstr "" +#: ../../c-api/object.rst:316 ../../c-api/object.rst:330 +#: ../../c-api/object.rst:359 ../../c-api/object.rst:412 +#: ../../c-api/object.rst:446 ../../c-api/object.rst:467 msgid "built-in function" msgstr "" +#: ../../c-api/object.rst:316 msgid "repr" msgstr "" +#: ../../c-api/object.rst:330 msgid "ascii" msgstr "" +#: ../../c-api/object.rst:340 msgid "string" msgstr "" +#: ../../c-api/object.rst:340 msgid "PyObject_Str (C function)" msgstr "" +#: ../../c-api/object.rst:359 msgid "bytes" msgstr "" +#: ../../c-api/object.rst:412 msgid "hash" msgstr "" +#: ../../c-api/object.rst:446 msgid "type" msgstr "" +#: ../../c-api/object.rst:467 msgid "len" msgstr "" diff --git a/c-api/objimpl.po b/c-api/objimpl.po index 1dfc781a1..6dbd1a685 100644 --- a/c-api/objimpl.po +++ b/c-api/objimpl.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:49+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,8 +21,12 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/objimpl.rst:7 msgid "Object Implementation Support" msgstr "" -msgid "This chapter describes the functions, types, and macros used when defining new object types." +#: ../../c-api/objimpl.rst:9 +msgid "" +"This chapter describes the functions, types, and macros used when defining " +"new object types." msgstr "" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index 84fe36f65..ff9fe32c0 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2023-05-24 13:07+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,34 +21,143 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/perfmaps.rst:6 msgid "Support for Perf Maps" msgstr "" -msgid "On supported platforms (as of this writing, only Linux), the runtime can take advantage of *perf map files* to make Python functions visible to an external profiling tool (such as `perf `_). A running process may create a file in the ``/tmp`` directory, which contains entries that can map a section of executable code to a name. This interface is described in the `documentation of the Linux Perf tool `_." +#: ../../c-api/perfmaps.rst:8 +msgid "" +"On supported platforms (as of this writing, only Linux), the runtime can " +"take advantage of *perf map files* to make Python functions visible to an " +"external profiling tool (such as `perf `_). A running process may create a file in the ``/tmp`` " +"directory, which contains entries that can map a section of executable code " +"to a name. This interface is described in the `documentation of the Linux " +"Perf tool `_." msgstr "" -msgid "In Python, these helper APIs can be used by libraries and features that rely on generating machine code on the fly." +#: ../../c-api/perfmaps.rst:16 +msgid "" +"In Python, these helper APIs can be used by libraries and features that rely " +"on generating machine code on the fly." msgstr "" -msgid "Note that holding an :term:`attached thread state` is not required for these APIs." +#: ../../c-api/perfmaps.rst:19 +msgid "" +"Note that holding an :term:`attached thread state` is not required for these " +"APIs." msgstr "" -msgid "Open the ``/tmp/perf-$pid.map`` file, unless it's already opened, and create a lock to ensure thread-safe writes to the file (provided the writes are done through :c:func:`PyUnstable_WritePerfMapEntry`). Normally, there's no need to call this explicitly; just use :c:func:`PyUnstable_WritePerfMapEntry` and it will initialize the state on first call." +#: ../../c-api/perfmaps.rst:23 +msgid "" +"Open the ``/tmp/perf-$pid.map`` file, unless it's already opened, and create " +"a lock to ensure thread-safe writes to the file (provided the writes are " +"done through :c:func:`PyUnstable_WritePerfMapEntry`). Normally, there's no " +"need to call this explicitly; just " +"use :c:func:`PyUnstable_WritePerfMapEntry` and it will initialize the state " +"on first call." msgstr "" -msgid "Returns ``0`` on success, ``-1`` on failure to create/open the perf map file, or ``-2`` on failure to create a lock. Check ``errno`` for more information about the cause of a failure." +#: ../../c-api/perfmaps.rst:29 +msgid "" +"Returns ``0`` on success, ``-1`` on failure to create/open the perf map " +"file, or ``-2`` on failure to create a lock. Check ``errno`` for more " +"information about the cause of a failure." msgstr "" -msgid "Write one single entry to the ``/tmp/perf-$pid.map`` file. This function is thread safe. Here is what an example entry looks like::" +#: ../../c-api/perfmaps.rst:35 +msgid "" +"Write one single entry to the ``/tmp/perf-$pid.map`` file. This function is " +"thread safe. Here is what an example entry looks like::" msgstr "" +#: ../../c-api/perfmaps.rst:38 msgid "" "# address size name\n" "7f3529fcf759 b py::bar:/run/t.py" msgstr "" -msgid "Will call :c:func:`PyUnstable_PerfMapState_Init` before writing the entry, if the perf map file is not already opened. Returns ``0`` on success, or the same error codes as :c:func:`PyUnstable_PerfMapState_Init` on failure." +#: ../../c-api/perfmaps.rst:41 +msgid "" +"Will call :c:func:`PyUnstable_PerfMapState_Init` before writing the entry, " +"if the perf map file is not already opened. Returns ``0`` on success, or the " +"same error codes as :c:func:`PyUnstable_PerfMapState_Init` on failure." +msgstr "" + +#: ../../c-api/perfmaps.rst:47 +msgid "" +"Close the perf map file opened by :c:func:`PyUnstable_PerfMapState_Init`. " +"This is called by the runtime itself during interpreter shut-down. In " +"general, there shouldn't be a reason to explicitly call this, except to " +"handle specific scenarios such as forking." +msgstr "" + +#: ../../c-api/perfmaps.rst:54 +msgid "" +"Open the ``/tmp/perf-$pid.map`` file and append the content of " +"*parent_filename* to it." +msgstr "" + +#: ../../c-api/perfmaps.rst:57 +msgid "" +"This function is available on all platforms but only generates output on " +"platforms that support perf maps (currently only Linux). On other platforms, " +"it does nothing." +msgstr "" + +#: ../../c-api/perfmaps.rst:64 +msgid "Compile the given code object using the current perf trampoline." +msgstr "" + +#: ../../c-api/perfmaps.rst:66 +msgid "" +"The \"current\" trampoline is the one set by the runtime or the most " +"recent :c:func:`PyUnstable_PerfTrampoline_SetPersistAfterFork` call." +msgstr "" + +#: ../../c-api/perfmaps.rst:69 +msgid "" +"If no trampoline is set, falls back to normal compilation (no perf map " +"entry)." +msgstr "" + +#: ../../c-api/perfmaps.rst:0 +msgid "Parameters" +msgstr "" + +#: ../../c-api/perfmaps.rst:71 +msgid "The code object to compile." +msgstr "" + +#: ../../c-api/perfmaps.rst:0 +msgid "Returns" +msgstr "" + +#: ../../c-api/perfmaps.rst:72 ../../c-api/perfmaps.rst:88 +msgid "0 on success, -1 on failure." +msgstr "" + +#: ../../c-api/perfmaps.rst:78 +msgid "Set whether the perf trampoline should persist after a fork." +msgstr "" + +#: ../../c-api/perfmaps.rst:80 +msgid "" +"If ``enable`` is true (non-zero): perf map file remains open/valid post-" +"fork. Child process inherits all existing perf map entries." +msgstr "" + +#: ../../c-api/perfmaps.rst:82 +msgid "" +"If ``enable`` is false (zero): perf map closes post-fork. Child process gets " +"empty perf map." +msgstr "" + +#: ../../c-api/perfmaps.rst:85 +msgid "Default: false (clears on fork)." msgstr "" -msgid "Close the perf map file opened by :c:func:`PyUnstable_PerfMapState_Init`. This is called by the runtime itself during interpreter shut-down. In general, there shouldn't be a reason to explicitly call this, except to handle specific scenarios such as forking." +#: ../../c-api/perfmaps.rst:87 +msgid "1 to enable, 0 to disable." msgstr "" diff --git a/c-api/picklebuffer.po b/c-api/picklebuffer.po index 297631506..36cd78e70 100644 --- a/c-api/picklebuffer.po +++ b/c-api/picklebuffer.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,50 +19,86 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/picklebuffer.rst:9 msgid "Pickle buffer objects" msgstr "" -msgid "A :class:`pickle.PickleBuffer` object wraps a :ref:`buffer-providing object ` for out-of-band data transfer with the :mod:`pickle` module." +#: ../../c-api/picklebuffer.rst:13 +msgid "" +"A :class:`pickle.PickleBuffer` object wraps a :ref:`buffer-providing object " +"` for out-of-band data transfer with the :mod:`pickle` module." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python pickle buffer type. This is the same object as :class:`pickle.PickleBuffer` in the Python layer." +#: ../../c-api/picklebuffer.rst:19 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python pickle buffer " +"type. This is the same object as :class:`pickle.PickleBuffer` in the Python " +"layer." msgstr "" -msgid "Return true if *op* is a pickle buffer instance. This function always succeeds." +#: ../../c-api/picklebuffer.rst:25 +msgid "" +"Return true if *op* is a pickle buffer instance. This function always " +"succeeds." msgstr "" +#: ../../c-api/picklebuffer.rst:31 msgid "Create a pickle buffer from the object *obj*." msgstr "" -msgid "This function will fail if *obj* doesn't support the :ref:`buffer protocol `." +#: ../../c-api/picklebuffer.rst:33 +msgid "" +"This function will fail if *obj* doesn't support the :ref:`buffer protocol " +"`." msgstr "" -msgid "On success, return a new pickle buffer instance. On failure, set an exception and return ``NULL``." +#: ../../c-api/picklebuffer.rst:35 +msgid "" +"On success, return a new pickle buffer instance. On failure, set an " +"exception and return ``NULL``." msgstr "" +#: ../../c-api/picklebuffer.rst:38 msgid "Analogous to calling :class:`pickle.PickleBuffer` with *obj* in Python." msgstr "" -msgid "Get a pointer to the underlying :c:type:`Py_buffer` that the pickle buffer wraps." +#: ../../c-api/picklebuffer.rst:43 +msgid "" +"Get a pointer to the underlying :c:type:`Py_buffer` that the pickle buffer " +"wraps." msgstr "" -msgid "The returned pointer is valid as long as *picklebuf* is alive and has not been released. The caller must not modify or free the returned :c:type:`Py_buffer`. If the pickle buffer has been released, raise :exc:`ValueError`." +#: ../../c-api/picklebuffer.rst:45 +msgid "" +"The returned pointer is valid as long as *picklebuf* is alive and has not " +"been released. The caller must not modify or free the " +"returned :c:type:`Py_buffer`. If the pickle buffer has been released, " +"raise :exc:`ValueError`." msgstr "" -msgid "On success, return a pointer to the buffer view. On failure, set an exception and return ``NULL``." +#: ../../c-api/picklebuffer.rst:49 +msgid "" +"On success, return a pointer to the buffer view. On failure, set an " +"exception and return ``NULL``." msgstr "" +#: ../../c-api/picklebuffer.rst:55 msgid "Release the underlying buffer held by the pickle buffer." msgstr "" -msgid "Return ``0`` on success. On failure, set an exception and return ``-1``." +#: ../../c-api/picklebuffer.rst:57 +msgid "" +"Return ``0`` on success. On failure, set an exception and return ``-1``." msgstr "" +#: ../../c-api/picklebuffer.rst:59 msgid "Analogous to calling :meth:`pickle.PickleBuffer.release` in Python." msgstr "" +#: ../../c-api/picklebuffer.rst:5 msgid "object" msgstr "" +#: ../../c-api/picklebuffer.rst:5 msgid "PickleBuffer" msgstr "" diff --git a/c-api/profiling.po b/c-api/profiling.po index 73b2dda14..4ff27be31 100644 --- a/c-api/profiling.po +++ b/c-api/profiling.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,140 +19,291 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/profiling.rst:6 msgid "Profiling and tracing" msgstr "" -msgid "The Python interpreter provides some low-level support for attaching profiling and execution tracing facilities. These are used for profiling, debugging, and coverage analysis tools." +#: ../../c-api/profiling.rst:8 +msgid "" +"The Python interpreter provides some low-level support for attaching " +"profiling and execution tracing facilities. These are used for profiling, " +"debugging, and coverage analysis tools." msgstr "" -msgid "This C interface allows the profiling or tracing code to avoid the overhead of calling through Python-level callable objects, making a direct C function call instead. The essential attributes of the facility have not changed; the interface allows trace functions to be installed per-thread, and the basic events reported to the trace function are the same as had been reported to the Python-level trace functions in previous versions." +#: ../../c-api/profiling.rst:12 +msgid "" +"This C interface allows the profiling or tracing code to avoid the overhead " +"of calling through Python-level callable objects, making a direct C function " +"call instead. The essential attributes of the facility have not changed; " +"the interface allows trace functions to be installed per-thread, and the " +"basic events reported to the trace function are the same as had been " +"reported to the Python-level trace functions in previous versions." msgstr "" -msgid "The type of the trace function registered using :c:func:`PyEval_SetProfile` and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to the registration function as *obj*, *frame* is the frame object to which the event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" +#: ../../c-api/profiling.rst:22 +msgid "" +"The type of the trace function registered using :c:func:`PyEval_SetProfile` " +"and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " +"the registration function as *obj*, *frame* is the frame object to which the " +"event pertains, *what* is one of the " +"constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, " +"or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" msgstr "" +#: ../../c-api/profiling.rst:31 msgid "Value of *what*" msgstr "" +#: ../../c-api/profiling.rst:31 msgid "Meaning of *arg*" msgstr "" +#: ../../c-api/profiling.rst:33 msgid ":c:data:`PyTrace_CALL`" msgstr "" +#: ../../c-api/profiling.rst:33 ../../c-api/profiling.rst:38 +#: ../../c-api/profiling.rst:49 msgid "Always :c:data:`Py_None`." msgstr "" +#: ../../c-api/profiling.rst:35 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr "" +#: ../../c-api/profiling.rst:35 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" +#: ../../c-api/profiling.rst:38 msgid ":c:data:`PyTrace_LINE`" msgstr "" +#: ../../c-api/profiling.rst:40 msgid ":c:data:`PyTrace_RETURN`" msgstr "" -msgid "Value being returned to the caller, or ``NULL`` if caused by an exception." +#: ../../c-api/profiling.rst:40 +msgid "" +"Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" +#: ../../c-api/profiling.rst:43 msgid ":c:data:`PyTrace_C_CALL`" msgstr "" +#: ../../c-api/profiling.rst:43 ../../c-api/profiling.rst:45 +#: ../../c-api/profiling.rst:47 msgid "Function object being called." msgstr "" +#: ../../c-api/profiling.rst:45 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr "" +#: ../../c-api/profiling.rst:47 msgid ":c:data:`PyTrace_C_RETURN`" msgstr "" +#: ../../c-api/profiling.rst:49 msgid ":c:data:`PyTrace_OPCODE`" msgstr "" -msgid "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when a new call to a function or method is being reported, or a new entry into a generator. Note that the creation of the iterator for a generator function is not reported as there is no control transfer to the Python bytecode in the corresponding frame." +#: ../../c-api/profiling.rst:54 +msgid "" +"The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " +"a new call to a function or method is being reported, or a new entry into a " +"generator. Note that the creation of the iterator for a generator function " +"is not reported as there is no control transfer to the Python bytecode in " +"the corresponding frame." msgstr "" -msgid "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when an exception has been raised. The callback function is called with this value for *what* when after any bytecode is processed after which the exception becomes set within the frame being executed. The effect of this is that as exception propagation causes the Python stack to unwind, the callback is called upon return to each frame as the exception propagates. Only trace functions receive these events; they are not needed by the profiler." +#: ../../c-api/profiling.rst:63 +msgid "" +"The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " +"an exception has been raised. The callback function is called with this " +"value for *what* when after any bytecode is processed after which the " +"exception becomes set within the frame being executed. The effect of this " +"is that as exception propagation causes the Python stack to unwind, the " +"callback is called upon return to each frame as the exception propagates. " +"Only trace functions receive these events; they are not needed by the " +"profiler." msgstr "" -msgid "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` function (but not a profiling function) when a line-number event is being reported. It may be disabled for a frame by setting :attr:`~frame.f_trace_lines` to *0* on that frame." +#: ../../c-api/profiling.rst:74 +msgid "" +"The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " +"function (but not a profiling function) when a line-number event is being " +"reported. It may be disabled for a frame by " +"setting :attr:`~frame.f_trace_lines` to *0* on that frame." msgstr "" -msgid "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a call is about to return." +#: ../../c-api/profiling.rst:82 +msgid "" +"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " +"a call is about to return." msgstr "" -msgid "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a C function is about to be called." +#: ../../c-api/profiling.rst:88 +msgid "" +"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " +"a C function is about to be called." msgstr "" -msgid "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a C function has raised an exception." +#: ../../c-api/profiling.rst:94 +msgid "" +"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " +"a C function has raised an exception." msgstr "" -msgid "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a C function has returned." +#: ../../c-api/profiling.rst:100 +msgid "" +"The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " +"a C function has returned." msgstr "" -msgid "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but not profiling functions) when a new opcode is about to be executed. This event is not emitted by default: it must be explicitly requested by setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." +#: ../../c-api/profiling.rst:106 +msgid "" +"The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " +"not profiling functions) when a new opcode is about to be executed. This " +"event is not emitted by default: it must be explicitly requested by " +"setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -msgid "Set the profiler function to *func*. The *obj* parameter is passed to the function as its first parameter, and may be any Python object, or ``NULL``. If the profile function needs to maintain state, using a different value for *obj* for each thread provides a convenient and thread-safe place to store it. The profile function is called for all monitored events except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." +#: ../../c-api/profiling.rst:114 +msgid "" +"Set the profiler function to *func*. The *obj* parameter is passed to the " +"function as its first parameter, and may be any Python object, or ``NULL``. " +"If the profile function needs to maintain state, using a different value for " +"*obj* for each thread provides a convenient and thread-safe place to store " +"it. The profile function is called for all monitored events " +"except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` " +"and :c:data:`PyTrace_EXCEPTION`." msgstr "" +#: ../../c-api/profiling.rst:121 msgid "See also the :func:`sys.setprofile` function." msgstr "" +#: ../../c-api/profiling.rst:123 ../../c-api/profiling.rst:131 +#: ../../c-api/profiling.rst:150 ../../c-api/profiling.rst:158 msgid "The caller must have an :term:`attached thread state`." msgstr "" -msgid "Like :c:func:`PyEval_SetProfile` but sets the profile function in all running threads belonging to the current interpreter instead of the setting it only on the current thread." +#: ../../c-api/profiling.rst:128 +msgid "" +"Like :c:func:`PyEval_SetProfile` but sets the profile function in all " +"running threads belonging to the current interpreter instead of the setting " +"it only on the current thread." msgstr "" -msgid "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised while setting the profile functions in all threads." +#: ../../c-api/profiling.rst:133 +msgid "" +"As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " +"while setting the profile functions in all threads." msgstr "" -msgid "Set the tracing function to *func*. This is similar to :c:func:`PyEval_SetProfile`, except the tracing function does receive line-number events and per-opcode events, but does not receive any event related to C function objects being called. Any trace function registered using :c:func:`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." +#: ../../c-api/profiling.rst:141 +msgid "" +"Set the tracing function to *func*. This is similar " +"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " +"line-number events and per-opcode events, but does not receive any event " +"related to C function objects being called. Any trace function registered " +"using :c:func:`PyEval_SetTrace` will not " +"receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` " +"or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." msgstr "" +#: ../../c-api/profiling.rst:148 msgid "See also the :func:`sys.settrace` function." msgstr "" -msgid "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running threads belonging to the current interpreter instead of the setting it only on the current thread." +#: ../../c-api/profiling.rst:155 +msgid "" +"Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " +"threads belonging to the current interpreter instead of the setting it only " +"on the current thread." msgstr "" -msgid "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised while setting the trace functions in all threads." +#: ../../c-api/profiling.rst:160 +msgid "" +"As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " +"while setting the trace functions in all threads." msgstr "" +#: ../../c-api/profiling.rst:167 msgid "Reference tracing" msgstr "" -msgid "The type of the trace function registered using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python object that has been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." +#: ../../c-api/profiling.rst:174 +msgid "" +"The type of the trace function registered " +"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " +"object that has been just created (when **event** is set " +"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " +"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque " +"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -msgid "If a new tracing function is registered replacing the current one, a call to the trace function will be made with the object set to **NULL** and **event** set to :c:data:`PyRefTracer_TRACKER_REMOVED`. This will happen just before the new function is registered." +#: ../../c-api/profiling.rst:180 +msgid "" +"If a new tracing function is registered replacing the current one, a call to " +"the trace function will be made with the object set to **NULL** and " +"**event** set to :c:data:`PyRefTracer_TRACKER_REMOVED`. This will happen " +"just before the new function is registered." msgstr "" -msgid "The value for the *event* parameter to :c:type:`PyRefTracer` functions when a Python object has been created." +#: ../../c-api/profiling.rst:190 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been created." msgstr "" -msgid "The value for the *event* parameter to :c:type:`PyRefTracer` functions when a Python object has been destroyed." +#: ../../c-api/profiling.rst:196 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been destroyed." msgstr "" -msgid "The value for the *event* parameter to :c:type:`PyRefTracer` functions when the current tracer is about to be replaced by a new one." +#: ../../c-api/profiling.rst:202 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"the current tracer is about to be replaced by a new one." msgstr "" -msgid "Register a reference tracer function. The function will be called when a new Python object has been created or when an object is going to be destroyed. If **data** is provided it must be an opaque pointer that will be provided when the tracer function is called. Return ``0`` on success. Set an exception and return ``-1`` on error." +#: ../../c-api/profiling.rst:210 +msgid "" +"Register a reference tracer function. The function will be called when a new " +"Python object has been created or when an object is going to be destroyed. " +"If **data** is provided it must be an opaque pointer that will be provided " +"when the tracer function is called. Return ``0`` on success. Set an " +"exception and return ``-1`` on error." msgstr "" -msgid "Note that tracer functions **must not** create Python objects inside or otherwise the call will be re-entrant. The tracer also **must not** clear any existing exception or set an exception. A :term:`thread state` will be active every time the tracer function is called." +#: ../../c-api/profiling.rst:216 +msgid "" +"Note that tracer functions **must not** create Python objects inside or " +"otherwise the call will be re-entrant. The tracer also **must not** clear " +"any existing exception or set an exception. A :term:`thread state` will be " +"active every time the tracer function is called." msgstr "" -msgid "There must be an :term:`attached thread state` when calling this function." +#: ../../c-api/profiling.rst:221 ../../c-api/profiling.rst:237 +msgid "" +"There must be an :term:`attached thread state` when calling this function." msgstr "" -msgid "If another tracer function was already registered, the old function will be called with **event** set to :c:data:`PyRefTracer_TRACKER_REMOVED` just before the new function is registered." +#: ../../c-api/profiling.rst:223 +msgid "" +"If another tracer function was already registered, the old function will be " +"called with **event** set to :c:data:`PyRefTracer_TRACKER_REMOVED` just " +"before the new function is registered." msgstr "" -msgid "Get the registered reference tracer function and the value of the opaque data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was called. If no tracer was registered this function will return NULL and will set the **data** pointer to NULL." +#: ../../c-api/profiling.rst:232 +msgid "" +"Get the registered reference tracer function and the value of the opaque " +"data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " +"called. If no tracer was registered this function will return NULL and will " +"set the **data** pointer to NULL." msgstr "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 93162db37..a5b0a0487 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,156 +23,289 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/refcounting.rst:8 msgid "Reference Counting" msgstr "" -msgid "The functions and macros in this section are used for managing reference counts of Python objects." +#: ../../c-api/refcounting.rst:10 +msgid "" +"The functions and macros in this section are used for managing reference " +"counts of Python objects." msgstr "" +#: ../../c-api/refcounting.rst:16 msgid "Get the reference count of the Python object *o*." msgstr "" -msgid "Note that the returned value may not actually reflect how many references to the object are actually held. For example, some objects are :term:`immortal` and have a very high refcount that does not reflect the actual number of references. Consequently, do not rely on the returned value to be accurate, other than a value of 0 or 1." +#: ../../c-api/refcounting.rst:18 +msgid "" +"Note that the returned value may not actually reflect how many references to " +"the object are actually held. For example, some objects " +"are :term:`immortal` and have a very high refcount that does not reflect the " +"actual number of references. Consequently, do not rely on the returned " +"value to be accurate, other than a value of 0 or 1." msgstr "" -msgid "Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count." +#: ../../c-api/refcounting.rst:24 +msgid "" +"Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count." msgstr "" -msgid "On :term:`free-threaded builds ` of Python, returning 1 isn't sufficient to determine if it's safe to treat *o* as having no access by other threads. Use :c:func:`PyUnstable_Object_IsUniquelyReferenced` for that instead." +#: ../../c-api/refcounting.rst:28 +msgid "" +"On :term:`free-threaded builds ` of Python, returning 1 " +"isn't sufficient to determine if it's safe to treat *o* as having no access " +"by other threads. Use :c:func:`PyUnstable_Object_IsUniquelyReferenced` for " +"that instead." msgstr "" -msgid "See also the function :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary()`." +#: ../../c-api/refcounting.rst:33 +msgid "" +"See also the " +"function :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary()`." msgstr "" +#: ../../c-api/refcounting.rst:35 msgid ":c:func:`Py_REFCNT()` is changed to the inline static function." msgstr "" +#: ../../c-api/refcounting.rst:38 msgid "The parameter type is no longer :c:expr:`const PyObject*`." msgstr "" +#: ../../c-api/refcounting.rst:44 msgid "Set the object *o* reference counter to *refcnt*." msgstr "" -msgid "On :ref:`Python build with Free Threading `, if *refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`." +#: ../../c-api/refcounting.rst:46 +msgid "" +"On :ref:`Python build with Free Threading `, if " +"*refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`." msgstr "" +#: ../../c-api/refcounting.rst:49 ../../c-api/refcounting.rst:62 +#: ../../c-api/refcounting.rst:128 msgid "This function has no effect on :term:`immortal` objects." msgstr "" +#: ../../c-api/refcounting.rst:53 ../../c-api/refcounting.rst:77 +#: ../../c-api/refcounting.rst:156 msgid "Immortal objects are not modified." msgstr "" -msgid "Indicate taking a new :term:`strong reference` to object *o*, indicating it is in use and should not be destroyed." +#: ../../c-api/refcounting.rst:59 +msgid "" +"Indicate taking a new :term:`strong reference` to object *o*, indicating it " +"is in use and should not be destroyed." msgstr "" -msgid "This function is usually used to convert a :term:`borrowed reference` to a :term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be used to create a new :term:`strong reference`." +#: ../../c-api/refcounting.rst:64 +msgid "" +"This function is usually used to convert a :term:`borrowed reference` to " +"a :term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " +"used to create a new :term:`strong reference`." msgstr "" +#: ../../c-api/refcounting.rst:68 msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "" -msgid "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, use :c:func:`Py_XINCREF`." +#: ../../c-api/refcounting.rst:70 +msgid "" +"The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " +"use :c:func:`Py_XINCREF`." msgstr "" -msgid "Do not expect this function to actually modify *o* in any way. For at least :pep:`some objects <0683>`, this function has no effect." +#: ../../c-api/refcounting.rst:73 +msgid "" +"Do not expect this function to actually modify *o* in any way. For at " +"least :pep:`some objects <0683>`, this function has no effect." msgstr "" -msgid "Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which case this has no effect." +#: ../../c-api/refcounting.rst:83 +msgid "" +"Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which " +"case this has no effect." msgstr "" +#: ../../c-api/refcounting.rst:86 msgid "See also :c:func:`Py_XNewRef`." msgstr "" -msgid "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` on *o* and return the object *o*." +#: ../../c-api/refcounting.rst:91 +msgid "" +"Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " +"on *o* and return the object *o*." msgstr "" -msgid "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` should be called on it to release the reference." +#: ../../c-api/refcounting.rst:94 +msgid "" +"When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " +"should be called on it to release the reference." msgstr "" -msgid "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be ``NULL``." +#: ../../c-api/refcounting.rst:97 +msgid "" +"The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " +"``NULL``." msgstr "" +#: ../../c-api/refcounting.rst:100 msgid "For example::" msgstr "" +#: ../../c-api/refcounting.rst:102 msgid "" "Py_INCREF(obj);\n" "self->attr = obj;" msgstr "" +#: ../../c-api/refcounting.rst:105 msgid "can be written as::" msgstr "" +#: ../../c-api/refcounting.rst:107 msgid "self->attr = Py_NewRef(obj);" msgstr "" +#: ../../c-api/refcounting.rst:109 msgid "See also :c:func:`Py_INCREF`." msgstr "" +#: ../../c-api/refcounting.rst:116 msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL." msgstr "" +#: ../../c-api/refcounting.rst:118 msgid "If the object *o* is ``NULL``, the function just returns ``NULL``." msgstr "" -msgid "Release a :term:`strong reference` to object *o*, indicating the reference is no longer used." -msgstr "" - -msgid "Once the last :term:`strong reference` is released (i.e. the object's reference count reaches 0), the object's type's deallocation function (which must not be ``NULL``) is invoked." +#: ../../c-api/refcounting.rst:125 +msgid "" +"Release a :term:`strong reference` to object *o*, indicating the reference " +"is no longer used." msgstr "" -msgid "This function is usually used to delete a :term:`strong reference` before exiting its scope." +#: ../../c-api/refcounting.rst:130 +msgid "" +"Once the last :term:`strong reference` is released (i.e. the object's " +"reference count reaches 0), the object's type's deallocation function (which " +"must not be ``NULL``) is invoked." msgstr "" -msgid "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, use :c:func:`Py_XDECREF`." +#: ../../c-api/refcounting.rst:135 +msgid "" +"This function is usually used to delete a :term:`strong reference` before " +"exiting its scope." msgstr "" -msgid "Do not expect this function to actually modify *o* in any way. For at least :pep:`some objects <683>`, this function has no effect." +#: ../../c-api/refcounting.rst:138 +msgid "" +"The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " +"use :c:func:`Py_XDECREF`." msgstr "" -msgid "The deallocation function can cause arbitrary Python code to be invoked (e.g. when a class instance with a :meth:`~object.__del__` method is deallocated). While exceptions in such code are not propagated, the executed code has free access to all Python global variables. This means that any object that is reachable from a global variable should be in a consistent state before :c:func:`Py_DECREF` is invoked. For example, code to delete an object from a list should copy a reference to the deleted object in a temporary variable, update the list data structure, and then call :c:func:`Py_DECREF` for the temporary variable." +#: ../../c-api/refcounting.rst:141 +msgid "" +"Do not expect this function to actually modify *o* in any way. For at " +"least :pep:`some objects <683>`, this function has no effect." msgstr "" -msgid "Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which case this has no effect. The same warning from :c:func:`Py_DECREF` applies here as well." +#: ../../c-api/refcounting.rst:147 +msgid "" +"The deallocation function can cause arbitrary Python code to be invoked " +"(e.g. when a class instance with a :meth:`~object.__del__` method is " +"deallocated). While exceptions in such code are not propagated, the " +"executed code has free access to all Python global variables. This means " +"that any object that is reachable from a global variable should be in a " +"consistent state before :c:func:`Py_DECREF` is invoked. For example, code " +"to delete an object from a list should copy a reference to the deleted " +"object in a temporary variable, update the list data structure, and then " +"call :c:func:`Py_DECREF` for the temporary variable." +msgstr "" + +#: ../../c-api/refcounting.rst:162 +msgid "" +"Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which " +"case this has no effect. The same warning from :c:func:`Py_DECREF` applies " +"here as well." msgstr "" -msgid "Release a :term:`strong reference` for object *o*. The object may be ``NULL``, in which case the macro has no effect; otherwise the effect is the same as for :c:func:`Py_DECREF`, except that the argument is also set to ``NULL``. The warning for :c:func:`Py_DECREF` does not apply with respect to the object passed because the macro carefully uses a temporary variable and sets the argument to ``NULL`` before releasing the reference." +#: ../../c-api/refcounting.rst:169 +msgid "" +"Release a :term:`strong reference` for object *o*. The object may be " +"``NULL``, in which case the macro has no effect; otherwise the effect is the " +"same as for :c:func:`Py_DECREF`, except that the argument is also set to " +"``NULL``. The warning for :c:func:`Py_DECREF` does not apply with respect " +"to the object passed because the macro carefully uses a temporary variable " +"and sets the argument to ``NULL`` before releasing the reference." msgstr "" -msgid "It is a good idea to use this macro whenever releasing a reference to an object that might be traversed during garbage collection." +#: ../../c-api/refcounting.rst:177 +msgid "" +"It is a good idea to use this macro whenever releasing a reference to an " +"object that might be traversed during garbage collection." msgstr "" -msgid "The macro argument is now only evaluated once. If the argument has side effects, these are no longer duplicated." +#: ../../c-api/refcounting.rst:180 +msgid "" +"The macro argument is now only evaluated once. If the argument has side " +"effects, these are no longer duplicated." msgstr "" -msgid "Indicate taking a new :term:`strong reference` to object *o*. A function version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic embedding of Python." +#: ../../c-api/refcounting.rst:187 +msgid "" +"Indicate taking a new :term:`strong reference` to object *o*. A function " +"version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " +"embedding of Python." msgstr "" -msgid "Release a :term:`strong reference` to object *o*. A function version of :c:func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." +#: ../../c-api/refcounting.rst:194 +msgid "" +"Release a :term:`strong reference` to object *o*. A function version " +"of :c:func:`Py_XDECREF`. It can be used for runtime dynamic embedding of " +"Python." msgstr "" -msgid "Macro safely releasing a :term:`strong reference` to object *dst* and setting *dst* to *src*." +#: ../../c-api/refcounting.rst:201 +msgid "" +"Macro safely releasing a :term:`strong reference` to object *dst* and " +"setting *dst* to *src*." msgstr "" +#: ../../c-api/refcounting.rst:204 msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::" msgstr "" +#: ../../c-api/refcounting.rst:206 msgid "" "Py_DECREF(dst);\n" "dst = src;" msgstr "" +#: ../../c-api/refcounting.rst:209 msgid "The safe way is::" msgstr "" +#: ../../c-api/refcounting.rst:211 msgid "Py_SETREF(dst, src);" msgstr "" -msgid "That arranges to set *dst* to *src* *before* releasing the reference to the old value of *dst*, so that any code triggered as a side-effect of *dst* getting torn down no longer believes *dst* points to a valid object." +#: ../../c-api/refcounting.rst:213 +msgid "" +"That arranges to set *dst* to *src* *before* releasing the reference to the " +"old value of *dst*, so that any code triggered as a side-effect of *dst* " +"getting torn down no longer believes *dst* points to a valid object." msgstr "" -msgid "The macro arguments are now only evaluated once. If an argument has side effects, these are no longer duplicated." +#: ../../c-api/refcounting.rst:220 ../../c-api/refcounting.rst:232 +msgid "" +"The macro arguments are now only evaluated once. If an argument has side " +"effects, these are no longer duplicated." msgstr "" -msgid "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead of :c:func:`Py_DECREF`." +#: ../../c-api/refcounting.rst:227 +msgid "" +"Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " +"of :c:func:`Py_DECREF`." msgstr "" diff --git a/c-api/reflection.po b/c-api/reflection.po index a6e3a0c5d..375995ffa 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,53 +24,111 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/reflection.rst:6 msgid "Reflection" msgstr "" +#: ../../c-api/reflection.rst:12 msgid "Use :c:func:`PyEval_GetFrameBuiltins` instead." msgstr "" -msgid "Return a dictionary of the builtins in the current execution frame, or the interpreter of the thread state if no frame is currently executing." +#: ../../c-api/reflection.rst:14 ../../c-api/reflection.rst:66 +msgid "" +"Return a dictionary of the builtins in the current execution frame, or the " +"interpreter of the thread state if no frame is currently executing." msgstr "" -msgid "Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as calling :func:`locals` in Python code, or else call :c:func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` to access the :attr:`~frame.f_locals` attribute of the currently executing frame." +#: ../../c-api/reflection.rst:22 +msgid "" +"Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as " +"calling :func:`locals` in Python code, or else " +"call :c:func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` " +"to access the :attr:`~frame.f_locals` attribute of the currently executing " +"frame." msgstr "" -msgid "Return a mapping providing access to the local variables in the current execution frame, or ``NULL`` if no frame is currently executing." +#: ../../c-api/reflection.rst:27 +msgid "" +"Return a mapping providing access to the local variables in the current " +"execution frame, or ``NULL`` if no frame is currently executing." msgstr "" -msgid "Refer to :func:`locals` for details of the mapping returned at different scopes." +#: ../../c-api/reflection.rst:30 +msgid "" +"Refer to :func:`locals` for details of the mapping returned at different " +"scopes." msgstr "" -msgid "As this function returns a :term:`borrowed reference`, the dictionary returned for :term:`optimized scopes ` is cached on the frame object and will remain alive as long as the frame object does. Unlike :c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls to this function in the same frame will update the contents of the cached dictionary to reflect changes in the state of the local variables rather than returning a new snapshot." +#: ../../c-api/reflection.rst:32 +msgid "" +"As this function returns a :term:`borrowed reference`, the dictionary " +"returned for :term:`optimized scopes ` is cached on the " +"frame object and will remain alive as long as the frame object does. " +"Unlike :c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls " +"to this function in the same frame will update the contents of the cached " +"dictionary to reflect changes in the state of the local variables rather " +"than returning a new snapshot." msgstr "" -msgid "As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and :attr:`FrameType.f_locals ` no longer make use of the shared cache dictionary. Refer to the :ref:`What's New entry ` for additional details." +#: ../../c-api/reflection.rst:39 +msgid "" +"As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, " +"and :attr:`FrameType.f_locals ` no longer make use of the " +"shared cache dictionary. Refer to the :ref:`What's New entry ` for additional details." msgstr "" +#: ../../c-api/reflection.rst:50 msgid "Use :c:func:`PyEval_GetFrameGlobals` instead." msgstr "" -msgid "Return a dictionary of the global variables in the current execution frame, or ``NULL`` if no frame is currently executing." +#: ../../c-api/reflection.rst:52 +msgid "" +"Return a dictionary of the global variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing." msgstr "" -msgid "Return the :term:`attached thread state`'s frame, which is ``NULL`` if no frame is currently executing." +#: ../../c-api/reflection.rst:58 +msgid "" +"Return the :term:`attached thread state`'s frame, which is ``NULL`` if no " +"frame is currently executing." msgstr "" +#: ../../c-api/reflection.rst:61 msgid "See also :c:func:`PyThreadState_GetFrame`." msgstr "" -msgid "Return a dictionary of the local variables in the current execution frame, or ``NULL`` if no frame is currently executing. Equivalent to calling :func:`locals` in Python code." +#: ../../c-api/reflection.rst:74 +msgid "" +"Return a dictionary of the local variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to " +"calling :func:`locals` in Python code." msgstr "" -msgid "To access :attr:`~frame.f_locals` on the current frame without making an independent snapshot in :term:`optimized scopes `, call :c:func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." +#: ../../c-api/reflection.rst:78 +msgid "" +"To access :attr:`~frame.f_locals` on the current frame without making an " +"independent snapshot in :term:`optimized scopes `, " +"call :c:func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." msgstr "" -msgid "Return a dictionary of the global variables in the current execution frame, or ``NULL`` if no frame is currently executing. Equivalent to calling :func:`globals` in Python code." +#: ../../c-api/reflection.rst:87 +msgid "" +"Return a dictionary of the global variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to " +"calling :func:`globals` in Python code." msgstr "" -msgid "Return the name of *func* if it is a function, class or instance object, else the name of *func*\\s type." +#: ../../c-api/reflection.rst:96 +msgid "" +"Return the name of *func* if it is a function, class or instance object, " +"else the name of *func*\\s type." msgstr "" -msgid "Return a description string, depending on the type of *func*. Return values include \"()\" for functions and methods, \" constructor\", \" instance\", and \" object\". Concatenated with the result of :c:func:`PyEval_GetFuncName`, the result will be a description of *func*." +#: ../../c-api/reflection.rst:102 +msgid "" +"Return a description string, depending on the type of *func*. Return values " +"include \"()\" for functions and methods, \" constructor\", \" instance\", " +"and \" object\". Concatenated with the result " +"of :c:func:`PyEval_GetFuncName`, the result will be a description of *func*." msgstr "" diff --git a/c-api/sequence.po b/c-api/sequence.po index 9ffef5b00..621702bb7 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,98 +22,205 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/sequence.rst:6 msgid "Sequence Protocol" msgstr "" -msgid "Return ``1`` if the object provides the sequence protocol, and ``0`` otherwise. Note that it returns ``1`` for Python classes with a :meth:`~object.__getitem__` method, unless they are :class:`dict` subclasses, since in general it is impossible to determine what type of keys the class supports. This function always succeeds." +#: ../../c-api/sequence.rst:11 +msgid "" +"Return ``1`` if the object provides the sequence protocol, and ``0`` " +"otherwise. Note that it returns ``1`` for Python classes with " +"a :meth:`~object.__getitem__` method, unless they are :class:`dict` " +"subclasses, since in general it is impossible to determine what type of keys " +"the class supports. This function always succeeds." msgstr "" -msgid "Returns the number of objects in sequence *o* on success, and ``-1`` on failure. This is equivalent to the Python expression ``len(o)``." +#: ../../c-api/sequence.rst:23 +msgid "" +"Returns the number of objects in sequence *o* on success, and ``-1`` on " +"failure. This is equivalent to the Python expression ``len(o)``." msgstr "" -msgid "Return the concatenation of *o1* and *o2* on success, and ``NULL`` on failure. This is the equivalent of the Python expression ``o1 + o2``." +#: ../../c-api/sequence.rst:29 +msgid "" +"Return the concatenation of *o1* and *o2* on success, and ``NULL`` on " +"failure. This is the equivalent of the Python expression ``o1 + o2``." msgstr "" -msgid "Return the result of repeating sequence object *o* *count* times, or ``NULL`` on failure. This is the equivalent of the Python expression ``o * count``." +#: ../../c-api/sequence.rst:35 +msgid "" +"Return the result of repeating sequence object *o* *count* times, or " +"``NULL`` on failure. This is the equivalent of the Python expression ``o * " +"count``." msgstr "" -msgid "Return the concatenation of *o1* and *o2* on success, and ``NULL`` on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python expression ``o1 += o2``." +#: ../../c-api/sequence.rst:41 +msgid "" +"Return the concatenation of *o1* and *o2* on success, and ``NULL`` on " +"failure. The operation is done *in-place* when *o1* supports it. This is " +"the equivalent of the Python expression ``o1 += o2``." msgstr "" -msgid "Return the result of repeating sequence object *o* *count* times, or ``NULL`` on failure. The operation is done *in-place* when *o* supports it. This is the equivalent of the Python expression ``o *= count``." +#: ../../c-api/sequence.rst:48 +msgid "" +"Return the result of repeating sequence object *o* *count* times, or " +"``NULL`` on failure. The operation is done *in-place* when *o* supports " +"it. This is the equivalent of the Python expression ``o *= count``." msgstr "" -msgid "Return the *i*\\ th element of *o*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o[i]``." +#: ../../c-api/sequence.rst:55 +msgid "" +"Return the *i*\\ th element of *o*, or ``NULL`` on failure. This is the " +"equivalent of the Python expression ``o[i]``." msgstr "" -msgid "Return the slice of sequence object *o* between *i1* and *i2*, or ``NULL`` on failure. This is the equivalent of the Python expression ``o[i1:i2]``." +#: ../../c-api/sequence.rst:61 +msgid "" +"Return the slice of sequence object *o* between *i1* and *i2*, or ``NULL`` " +"on failure. This is the equivalent of the Python expression ``o[i1:i2]``." msgstr "" -msgid "Assign object *v* to the *i*\\ th element of *o*. Raise an exception and return ``-1`` on failure; return ``0`` on success. This is the equivalent of the Python statement ``o[i] = v``. This function *does not* steal a reference to *v*." +#: ../../c-api/sequence.rst:67 +msgid "" +"Assign object *v* to the *i*\\ th element of *o*. Raise an exception and " +"return ``-1`` on failure; return ``0`` on success. This is the equivalent " +"of the Python statement ``o[i] = v``. This function *does not* " +"\":term:`steal`\" a reference to *v*." msgstr "" -msgid "If *v* is ``NULL``, the element is deleted, but this feature is deprecated in favour of using :c:func:`PySequence_DelItem`." +#: ../../c-api/sequence.rst:72 +msgid "" +"If *v* is ``NULL``, the element is deleted, but this feature is deprecated " +"in favour of using :c:func:`PySequence_DelItem`." msgstr "" -msgid "Delete the *i*\\ th element of object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[i]``." +#: ../../c-api/sequence.rst:78 +msgid "" +"Delete the *i*\\ th element of object *o*. Returns ``-1`` on failure. This " +"is the equivalent of the Python statement ``del o[i]``." msgstr "" -msgid "Assign the sequence object *v* to the slice in sequence object *o* from *i1* to *i2*. This is the equivalent of the Python statement ``o[i1:i2] = v``." +#: ../../c-api/sequence.rst:84 +msgid "" +"Assign the sequence object *v* to the slice in sequence object *o* from *i1* " +"to *i2*. This is the equivalent of the Python statement ``o[i1:i2] = v``." msgstr "" -msgid "Delete the slice in sequence object *o* from *i1* to *i2*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[i1:i2]``." +#: ../../c-api/sequence.rst:90 +msgid "" +"Delete the slice in sequence object *o* from *i1* to *i2*. Returns ``-1`` " +"on failure. This is the equivalent of the Python statement ``del o[i1:i2]``." msgstr "" -msgid "Return the number of occurrences of *value* in *o*, that is, return the number of keys for which ``o[key] == value``. On failure, return ``-1``. This is equivalent to the Python expression ``o.count(value)``." +#: ../../c-api/sequence.rst:96 +msgid "" +"Return the number of occurrences of *value* in *o*, that is, return the " +"number of keys for which ``o[key] == value``. On failure, return ``-1``. " +"This is equivalent to the Python expression ``o.count(value)``." msgstr "" -msgid "Determine if *o* contains *value*. If an item in *o* is equal to *value*, return ``1``, otherwise return ``0``. On error, return ``-1``. This is equivalent to the Python expression ``value in o``." +#: ../../c-api/sequence.rst:103 +msgid "" +"Determine if *o* contains *value*. If an item in *o* is equal to *value*, " +"return ``1``, otherwise return ``0``. On error, return ``-1``. This is " +"equivalent to the Python expression ``value in o``." msgstr "" +#: ../../c-api/sequence.rst:110 msgid "Alias for :c:func:`PySequence_Contains`." msgstr "" +#: ../../c-api/sequence.rst:112 msgid "The function should no longer be used to write new code." msgstr "" -msgid "Return the first index *i* for which ``o[i] == value``. On error, return ``-1``. This is equivalent to the Python expression ``o.index(value)``." +#: ../../c-api/sequence.rst:118 +msgid "" +"Return the first index *i* for which ``o[i] == value``. On error, return " +"``-1``. This is equivalent to the Python expression ``o.index(value)``." msgstr "" -msgid "Return a list object with the same contents as the sequence or iterable *o*, or ``NULL`` on failure. The returned list is guaranteed to be new. This is equivalent to the Python expression ``list(o)``." +#: ../../c-api/sequence.rst:124 +msgid "" +"Return a list object with the same contents as the sequence or iterable *o*, " +"or ``NULL`` on failure. The returned list is guaranteed to be new. This is " +"equivalent to the Python expression ``list(o)``." msgstr "" -msgid "Return a tuple object with the same contents as the sequence or iterable *o*, or ``NULL`` on failure. If *o* is a tuple, a new reference will be returned, otherwise a tuple will be constructed with the appropriate contents. This is equivalent to the Python expression ``tuple(o)``." +#: ../../c-api/sequence.rst:133 +msgid "" +"Return a tuple object with the same contents as the sequence or iterable " +"*o*, or ``NULL`` on failure. If *o* is a tuple, a new reference will be " +"returned, otherwise a tuple will be constructed with the appropriate " +"contents. This is equivalent to the Python expression ``tuple(o)``." msgstr "" -msgid "Return the sequence or iterable *o* as an object usable by the other ``PySequence_Fast*`` family of functions. If the object is not a sequence or iterable, raises :exc:`TypeError` with *m* as the message text. Returns ``NULL`` on failure." +#: ../../c-api/sequence.rst:141 +msgid "" +"Return the sequence or iterable *o* as an object usable by the other " +"``PySequence_Fast*`` family of functions. If the object is not a sequence or " +"iterable, raises :exc:`TypeError` with *m* as the message text. Returns " +"``NULL`` on failure." msgstr "" -msgid "The ``PySequence_Fast*`` functions are thus named because they assume *o* is a :c:type:`PyTupleObject` or a :c:type:`PyListObject` and access the data fields of *o* directly." +#: ../../c-api/sequence.rst:146 +msgid "" +"The ``PySequence_Fast*`` functions are thus named because they assume *o* is " +"a :c:type:`PyTupleObject` or a :c:type:`PyListObject` and access the data " +"fields of *o* directly." msgstr "" -msgid "As a CPython implementation detail, if *o* is already a sequence or list, it will be returned." +#: ../../c-api/sequence.rst:150 +msgid "" +"As a CPython implementation detail, if *o* is already a sequence or list, it " +"will be returned." msgstr "" -msgid "Returns the length of *o*, assuming that *o* was returned by :c:func:`PySequence_Fast` and that *o* is not ``NULL``. The size can also be retrieved by calling :c:func:`PySequence_Size` on *o*, but :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list or tuple." +#: ../../c-api/sequence.rst:156 +msgid "" +"Returns the length of *o*, assuming that *o* was returned " +"by :c:func:`PySequence_Fast` and that *o* is not ``NULL``. The size can " +"also be retrieved by calling :c:func:`PySequence_Size` on *o*, " +"but :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* " +"is a list or tuple." msgstr "" -msgid "Return the *i*\\ th element of *o*, assuming that *o* was returned by :c:func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within bounds." +#: ../../c-api/sequence.rst:165 +msgid "" +"Return the *i*\\ th element of *o*, assuming that *o* was returned " +"by :c:func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within " +"bounds." msgstr "" -msgid "Return the underlying array of PyObject pointers. Assumes that *o* was returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." +#: ../../c-api/sequence.rst:171 +msgid "" +"Return the underlying array of PyObject pointers. Assumes that *o* was " +"returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." msgstr "" -msgid "Note, if a list gets resized, the reallocation may relocate the items array. So, only use the underlying array pointer in contexts where the sequence cannot change." +#: ../../c-api/sequence.rst:174 +msgid "" +"Note, if a list gets resized, the reallocation may relocate the items array. " +"So, only use the underlying array pointer in contexts where the sequence " +"cannot change." msgstr "" -msgid "Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form of :c:func:`PySequence_GetItem` but without checking that :c:func:`PySequence_Check` on *o* is true and without adjustment for negative indices." +#: ../../c-api/sequence.rst:181 +msgid "" +"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form " +"of :c:func:`PySequence_GetItem` but without checking " +"that :c:func:`PySequence_Check` on *o* is true and without adjustment for " +"negative indices." msgstr "" +#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:131 msgid "built-in function" msgstr "" +#: ../../c-api/sequence.rst:21 msgid "len" msgstr "" +#: ../../c-api/sequence.rst:131 msgid "tuple" msgstr "" diff --git a/c-api/set.po b/c-api/set.po index bff21cd14..77a1ddb51 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,107 +24,231 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/set.rst:6 msgid "Set Objects" msgstr "" -msgid "This section details the public API for :class:`set` and :class:`frozenset` objects. Any functionality not listed below is best accessed using either the abstract object protocol (including :c:func:`PyObject_CallMethod`, :c:func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, :c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, and :c:func:`PyObject_GetIter`) or the abstract number protocol (including :c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, :c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, :c:func:`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, and :c:func:`PyNumber_InPlaceXor`)." +#: ../../c-api/set.rst:15 +msgid "" +"This section details the public API for :class:`set` and :class:`frozenset` " +"objects. Any functionality not listed below is best accessed using either " +"the abstract object protocol " +"(including :c:func:`PyObject_CallMethod`, :c:func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, :c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, " +"and :c:func:`PyObject_GetIter`) or the abstract number protocol " +"(including :c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, :c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, :c:func:`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, " +"and :c:func:`PyNumber_InPlaceXor`)." msgstr "" -msgid "This subtype of :c:type:`PyObject` is used to hold the internal data for both :class:`set` and :class:`frozenset` objects. It is like a :c:type:`PyDictObject` in that it is a fixed size for small sets (much like tuple storage) and will point to a separate, variable sized block of memory for medium and large sized sets (much like list storage). None of the fields of this structure should be considered public and all are subject to change. All access should be done through the documented API rather than by manipulating the values in the structure." +#: ../../c-api/set.rst:29 +msgid "" +"This subtype of :c:type:`PyObject` is used to hold the internal data for " +"both :class:`set` and :class:`frozenset` objects. It is like " +"a :c:type:`PyDictObject` in that it is a fixed size for small sets (much " +"like tuple storage) and will point to a separate, variable sized block of " +"memory for medium and large sized sets (much like list storage). None of the " +"fields of this structure should be considered public and all are subject to " +"change. All access should be done through the documented API rather than by " +"manipulating the values in the structure." msgstr "" -msgid "This is an instance of :c:type:`PyTypeObject` representing the Python :class:`set` type." +#: ../../c-api/set.rst:40 +msgid "" +"This is an instance of :c:type:`PyTypeObject` representing the " +"Python :class:`set` type." msgstr "" -msgid "This is an instance of :c:type:`PyTypeObject` representing the Python :class:`frozenset` type." +#: ../../c-api/set.rst:46 +msgid "" +"This is an instance of :c:type:`PyTypeObject` representing the " +"Python :class:`frozenset` type." msgstr "" -msgid "The following type check macros work on pointers to any Python object. Likewise, the constructor functions work with any iterable Python object." +#: ../../c-api/set.rst:49 +msgid "" +"The following type check macros work on pointers to any Python object. " +"Likewise, the constructor functions work with any iterable Python object." msgstr "" -msgid "Return true if *p* is a :class:`set` object or an instance of a subtype. This function always succeeds." +#: ../../c-api/set.rst:55 +msgid "" +"Return true if *p* is a :class:`set` object or an instance of a subtype. " +"This function always succeeds." msgstr "" -msgid "Return true if *p* is a :class:`frozenset` object or an instance of a subtype. This function always succeeds." +#: ../../c-api/set.rst:60 +msgid "" +"Return true if *p* is a :class:`frozenset` object or an instance of a " +"subtype. This function always succeeds." msgstr "" -msgid "Return true if *p* is a :class:`set` object, a :class:`frozenset` object, or an instance of a subtype. This function always succeeds." +#: ../../c-api/set.rst:65 +msgid "" +"Return true if *p* is a :class:`set` object, a :class:`frozenset` object, or " +"an instance of a subtype. This function always succeeds." msgstr "" -msgid "Return true if *p* is a :class:`set` object but not an instance of a subtype. This function always succeeds." +#: ../../c-api/set.rst:70 +msgid "" +"Return true if *p* is a :class:`set` object but not an instance of a " +"subtype. This function always succeeds." msgstr "" -msgid "Return true if *p* is a :class:`set` object or a :class:`frozenset` object but not an instance of a subtype. This function always succeeds." +#: ../../c-api/set.rst:77 +msgid "" +"Return true if *p* is a :class:`set` object or a :class:`frozenset` object " +"but not an instance of a subtype. This function always succeeds." msgstr "" -msgid "Return true if *p* is a :class:`frozenset` object but not an instance of a subtype. This function always succeeds." +#: ../../c-api/set.rst:83 +msgid "" +"Return true if *p* is a :class:`frozenset` object but not an instance of a " +"subtype. This function always succeeds." msgstr "" -msgid "Return a new :class:`set` containing objects returned by the *iterable*. The *iterable* may be ``NULL`` to create a new empty set. Return the new set on success or ``NULL`` on failure. Raise :exc:`TypeError` if *iterable* is not actually iterable. The constructor is also useful for copying a set (``c=set(s)``)." +#: ../../c-api/set.rst:89 +msgid "" +"Return a new :class:`set` containing objects returned by the *iterable*. " +"The *iterable* may be ``NULL`` to create a new empty set. Return the new " +"set on success or ``NULL`` on failure. Raise :exc:`TypeError` if *iterable* " +"is not actually iterable. The constructor is also useful for copying a set " +"(``c=set(s)``)." msgstr "" -msgid "The operation is atomic on :term:`free threading ` when *iterable* is a :class:`set`, :class:`frozenset` or :class:`dict`." +#: ../../c-api/set.rst:97 ../../c-api/set.rst:110 +msgid "" +"The operation is atomic on :term:`free threading ` when " +"*iterable* is a :class:`set`, :class:`frozenset` or :class:`dict`." msgstr "" -msgid "Return a new :class:`frozenset` containing objects returned by the *iterable*. The *iterable* may be ``NULL`` to create a new empty frozenset. Return the new set on success or ``NULL`` on failure. Raise :exc:`TypeError` if *iterable* is not actually iterable." +#: ../../c-api/set.rst:103 +msgid "" +"Return a new :class:`frozenset` containing objects returned by the " +"*iterable*. The *iterable* may be ``NULL`` to create a new empty frozenset. " +"Return the new set on success or ``NULL`` on failure. " +"Raise :exc:`TypeError` if *iterable* is not actually iterable." msgstr "" -msgid "The following functions and macros are available for instances of :class:`set` or :class:`frozenset` or instances of their subtypes." +#: ../../c-api/set.rst:114 +msgid "" +"The following functions and macros are available for instances " +"of :class:`set` or :class:`frozenset` or instances of their subtypes." msgstr "" -msgid "Return the length of a :class:`set` or :class:`frozenset` object. Equivalent to ``len(anyset)``. Raises a :exc:`SystemError` if *anyset* is not a :class:`set`, :class:`frozenset`, or an instance of a subtype." +#: ../../c-api/set.rst:122 +msgid "" +"Return the length of a :class:`set` or :class:`frozenset` object. Equivalent " +"to ``len(anyset)``. Raises a :exc:`SystemError` if *anyset* is not " +"a :class:`set`, :class:`frozenset`, or an instance of a subtype." msgstr "" +#: ../../c-api/set.rst:129 msgid "Macro form of :c:func:`PySet_Size` without error checking." msgstr "" -msgid "Return ``1`` if found, ``0`` if not found, and ``-1`` if an error is encountered. Unlike the Python :meth:`~object.__contains__` method, this function does not automatically convert unhashable sets into temporary frozensets. Raise a :exc:`TypeError` if the *key* is unhashable. Raise :exc:`SystemError` if *anyset* is not a :class:`set`, :class:`frozenset`, or an instance of a subtype." +#: ../../c-api/set.rst:134 +msgid "" +"Return ``1`` if found, ``0`` if not found, and ``-1`` if an error is " +"encountered. Unlike the Python :meth:`~object.__contains__` method, this " +"function does not automatically convert unhashable sets into temporary " +"frozensets. Raise a :exc:`TypeError` if the *key* is unhashable. " +"Raise :exc:`SystemError` if *anyset* is not " +"a :class:`set`, :class:`frozenset`, or an instance of a subtype." msgstr "" -msgid "The operation is atomic on :term:`free threading ` when *key* is :class:`str`, :class:`int`, :class:`float`, :class:`bool` or :class:`bytes`." +#: ../../c-api/set.rst:142 ../../c-api/set.rst:157 ../../c-api/set.rst:177 +msgid "" +"The operation is atomic on :term:`free threading ` when " +"*key* is :class:`str`, :class:`int`, :class:`float`, :class:`bool` " +"or :class:`bytes`." msgstr "" -msgid "Add *key* to a :class:`set` instance. Also works with :class:`frozenset` instances (like :c:func:`PyTuple_SetItem` it can be used to fill in the values of brand new frozensets before they are exposed to other code). Return ``0`` on success or ``-1`` on failure. Raise a :exc:`TypeError` if the *key* is unhashable. Raise a :exc:`MemoryError` if there is no room to grow. Raise a :exc:`SystemError` if *set* is not an instance of :class:`set` or its subtype." +#: ../../c-api/set.rst:147 +msgid "" +"Add *key* to a :class:`set` instance. Also works with :class:`frozenset` " +"instances (like :c:func:`PyTuple_SetItem` it can be used to fill in the " +"values of brand new frozensets before they are exposed to other code). " +"Return ``0`` on success or ``-1`` on failure. Raise a :exc:`TypeError` if " +"the *key* is unhashable. Raise a :exc:`MemoryError` if there is no room to " +"grow. Raise a :exc:`SystemError` if *set* is not an instance " +"of :class:`set` or its subtype." msgstr "" -msgid "The following functions are available for instances of :class:`set` or its subtypes but not for instances of :class:`frozenset` or its subtypes." +#: ../../c-api/set.rst:162 +msgid "" +"The following functions are available for instances of :class:`set` or its " +"subtypes but not for instances of :class:`frozenset` or its subtypes." msgstr "" -msgid "Return ``1`` if found and removed, ``0`` if not found (no action taken), and ``-1`` if an error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a :exc:`TypeError` if the *key* is unhashable. Unlike the Python :meth:`~set.discard` method, this function does not automatically convert unhashable sets into temporary frozensets. Raise :exc:`SystemError` if *set* is not an instance of :class:`set` or its subtype." +#: ../../c-api/set.rst:168 +msgid "" +"Return ``1`` if found and removed, ``0`` if not found (no action taken), and " +"``-1`` if an error is encountered. Does not raise :exc:`KeyError` for " +"missing keys. Raise a :exc:`TypeError` if the *key* is unhashable. Unlike " +"the Python :meth:`~set.discard` method, this function does not automatically " +"convert unhashable sets into temporary frozensets. Raise :exc:`SystemError` " +"if *set* is not an instance of :class:`set` or its subtype." msgstr "" -msgid "Return a new reference to an arbitrary object in the *set*, and removes the object from the *set*. Return ``NULL`` on failure. Raise :exc:`KeyError` if the set is empty. Raise a :exc:`SystemError` if *set* is not an instance of :class:`set` or its subtype." +#: ../../c-api/set.rst:183 +msgid "" +"Return a new reference to an arbitrary object in the *set*, and removes the " +"object from the *set*. Return ``NULL`` on failure. Raise :exc:`KeyError` " +"if the set is empty. Raise a :exc:`SystemError` if *set* is not an instance " +"of :class:`set` or its subtype." msgstr "" -msgid "Empty an existing set of all elements. Return ``0`` on success. Return ``-1`` and raise :exc:`SystemError` if *set* is not an instance of :class:`set` or its subtype." +#: ../../c-api/set.rst:191 +msgid "" +"Empty an existing set of all elements. Return ``0`` on success. Return " +"``-1`` and raise :exc:`SystemError` if *set* is not an instance " +"of :class:`set` or its subtype." msgstr "" -msgid "In the :term:`free-threaded build`, the set is emptied before its entries are cleared, so other threads will observe an empty set rather than intermediate states." +#: ../../c-api/set.rst:197 +msgid "" +"In the :term:`free-threaded build`, the set is emptied before its entries " +"are cleared, so other threads will observe an empty set rather than " +"intermediate states." msgstr "" +#: ../../c-api/set.rst:203 msgid "Deprecated API" msgstr "" -msgid "A :term:`soft deprecated` constant representing the size of an internal preallocated table inside :c:type:`PySetObject` instances." +#: ../../c-api/set.rst:207 +msgid "" +"A constant representing the size of an internal preallocated table " +"inside :c:type:`PySetObject` instances." msgstr "" -msgid "This is documented solely for completeness, as there are no guarantees that a given version of CPython uses preallocated tables with a fixed size. In code that does not deal with unstable set internals, :c:macro:`!PySet_MINSIZE` can be replaced with a small constant like ``8``." +#: ../../c-api/set.rst:210 +msgid "" +"This is documented solely for completeness, as there are no guarantees that " +"a given version of CPython uses preallocated tables with a fixed size. In " +"code that does not deal with unstable set internals, :c:macro:`!" +"PySet_MINSIZE` can be replaced with a small constant like ``8``." msgstr "" +#: ../../c-api/set.rst:216 msgid "If looking for the size of a set, use :c:func:`PySet_Size` instead." msgstr "" +#: ../../c-api/set.rst:11 msgid "object" msgstr "" +#: ../../c-api/set.rst:11 msgid "set" msgstr "" +#: ../../c-api/set.rst:11 msgid "frozenset" msgstr "" +#: ../../c-api/set.rst:120 msgid "built-in function" msgstr "" +#: ../../c-api/set.rst:120 msgid "len" msgstr "" diff --git a/c-api/slice.po b/c-api/slice.po index f23f596b8..a56b64eda 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,51 +21,92 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/slice.rst:6 msgid "Slice Objects" msgstr "" -msgid "The type object for slice objects. This is the same as :class:`slice` in the Python layer." +#: ../../c-api/slice.rst:11 +msgid "" +"The type object for slice objects. This is the same as :class:`slice` in " +"the Python layer." msgstr "" -msgid "Return true if *ob* is a slice object; *ob* must not be ``NULL``. This function always succeeds." +#: ../../c-api/slice.rst:17 +msgid "" +"Return true if *ob* is a slice object; *ob* must not be ``NULL``. This " +"function always succeeds." msgstr "" -msgid "Return a new slice object with the given values. The *start*, *stop*, and *step* parameters are used as the values of the slice object attributes of the same names. Any of the values may be ``NULL``, in which case the ``None`` will be used for the corresponding attribute." +#: ../../c-api/slice.rst:23 +msgid "" +"Return a new slice object with the given values. The *start*, *stop*, and " +"*step* parameters are used as the values of the slice object attributes of " +"the same names. Any of the values may be ``NULL``, in which case the " +"``None`` will be used for the corresponding attribute." msgstr "" -msgid "Return ``NULL`` with an exception set if the new object could not be allocated." +#: ../../c-api/slice.rst:28 +msgid "" +"Return ``NULL`` with an exception set if the new object could not be " +"allocated." msgstr "" -msgid "Retrieve the start, stop and step indices from the slice object *slice*, assuming a sequence of length *length*. Treats indices greater than *length* as errors." +#: ../../c-api/slice.rst:34 +msgid "" +"Retrieve the start, stop and step indices from the slice object *slice*, " +"assuming a sequence of length *length*. Treats indices greater than *length* " +"as errors." msgstr "" -msgid "Returns ``0`` on success and ``-1`` on error with no exception set (unless one of the indices was not ``None`` and failed to be converted to an integer, in which case ``-1`` is returned with an exception set)." +#: ../../c-api/slice.rst:38 +msgid "" +"Returns ``0`` on success and ``-1`` on error with no exception set (unless " +"one of the indices was not ``None`` and failed to be converted to an " +"integer, in which case ``-1`` is returned with an exception set)." msgstr "" +#: ../../c-api/slice.rst:42 msgid "You probably do not want to use this function." msgstr "" -msgid "The parameter type for the *slice* parameter was ``PySliceObject*`` before." +#: ../../c-api/slice.rst:44 ../../c-api/slice.rst:75 +msgid "" +"The parameter type for the *slice* parameter was ``PySliceObject*`` before." msgstr "" -msgid "Usable replacement for :c:func:`PySlice_GetIndices`. Retrieve the start, stop, and step indices from the slice object *slice* assuming a sequence of length *length*, and store the length of the slice in *slicelength*. Out of bounds indices are clipped in a manner consistent with the handling of normal slices." +#: ../../c-api/slice.rst:51 +msgid "" +"Usable replacement for :c:func:`PySlice_GetIndices`. Retrieve the start, " +"stop, and step indices from the slice object *slice* assuming a sequence of " +"length *length*, and store the length of the slice in *slicelength*. Out of " +"bounds indices are clipped in a manner consistent with the handling of " +"normal slices." msgstr "" +#: ../../c-api/slice.rst:57 msgid "Return ``0`` on success and ``-1`` on error with an exception set." msgstr "" -msgid "This function is considered not safe for resizable sequences. Its invocation should be replaced by a combination of :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices` where ::" +#: ../../c-api/slice.rst:60 +msgid "" +"This function is considered not safe for resizable sequences. Its invocation " +"should be replaced by a combination of :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` where ::" msgstr "" +#: ../../c-api/slice.rst:64 msgid "" -"if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) < 0) {\n" +"if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) " +"< 0) {\n" " // return error\n" "}" msgstr "" +#: ../../c-api/slice.rst:68 msgid "is replaced by ::" msgstr "" +#: ../../c-api/slice.rst:70 msgid "" "if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {\n" " // return error\n" @@ -73,32 +114,64 @@ msgid "" "slicelength = PySlice_AdjustIndices(length, &start, &stop, step);" msgstr "" -msgid "If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400`` and ``0x03060000`` (not including) or ``0x03060100`` or higher :c:func:`!PySlice_GetIndicesEx` is implemented as a macro using :c:func:`!PySlice_Unpack` and :c:func:`!PySlice_AdjustIndices`. Arguments *start*, *stop* and *step* are evaluated more than once." +#: ../../c-api/slice.rst:79 +msgid "" +"If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400`` " +"and ``0x03060000`` (not including) or ``0x03060100`` or higher :c:func:`!" +"PySlice_GetIndicesEx` is implemented as a macro using :c:func:`!" +"PySlice_Unpack` and :c:func:`!PySlice_AdjustIndices`. Arguments *start*, " +"*stop* and *step* are evaluated more than once." msgstr "" -msgid "If ``Py_LIMITED_API`` is set to the value less than ``0x03050400`` or between ``0x03060000`` and ``0x03060100`` (not including) :c:func:`!PySlice_GetIndicesEx` is a deprecated function." +#: ../../c-api/slice.rst:86 +msgid "" +"If ``Py_LIMITED_API`` is set to the value less than ``0x03050400`` or " +"between ``0x03060000`` and ``0x03060100`` (not including) :c:func:`!" +"PySlice_GetIndicesEx` is a deprecated function." msgstr "" -msgid "Extract the start, stop and step data members from a slice object as C integers. Silently reduce values larger than ``PY_SSIZE_T_MAX`` to ``PY_SSIZE_T_MAX``, silently boost the start and stop values less than ``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step values less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``." +#: ../../c-api/slice.rst:94 +msgid "" +"Extract the start, stop and step data members from a slice object as C " +"integers. Silently reduce values larger than ``PY_SSIZE_T_MAX`` to " +"``PY_SSIZE_T_MAX``, silently boost the start and stop values less than " +"``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step values " +"less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``." msgstr "" +#: ../../c-api/slice.rst:100 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -msgid "Adjust start/end slice indices assuming a sequence of the specified length. Out of bounds indices are clipped in a manner consistent with the handling of normal slices." +#: ../../c-api/slice.rst:107 +msgid "" +"Adjust start/end slice indices assuming a sequence of the specified length. " +"Out of bounds indices are clipped in a manner consistent with the handling " +"of normal slices." msgstr "" -msgid "Return the length of the slice. Always successful. Doesn't call Python code." +#: ../../c-api/slice.rst:111 +msgid "" +"Return the length of the slice. Always successful. Doesn't call Python " +"code." msgstr "" +#: ../../c-api/slice.rst:118 msgid "Ellipsis Object" msgstr "" -msgid "The type of Python :const:`Ellipsis` object. Same as :class:`types.EllipsisType` in the Python layer." +#: ../../c-api/slice.rst:123 +msgid "" +"The type of Python :const:`Ellipsis` object. Same " +"as :class:`types.EllipsisType` in the Python layer." msgstr "" -msgid "The Python ``Ellipsis`` object. This object has no methods. Like :c:data:`Py_None`, it is an :term:`immortal` singleton object." +#: ../../c-api/slice.rst:129 +msgid "" +"The Python ``Ellipsis`` object. This object has no methods. " +"Like :c:data:`Py_None`, it is an :term:`immortal` singleton object." msgstr "" +#: ../../c-api/slice.rst:132 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr "" diff --git a/c-api/stable.po b/c-api/stable.po index 3e0198572..064893da4 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,137 +21,296 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/stable.rst:7 msgid "C API Stability" msgstr "" -msgid "Unless documented otherwise, Python's C API is covered by the Backwards Compatibility Policy, :pep:`387`. Most changes to it are source-compatible (typically by only adding new API). Changing existing API or removing API is only done after a deprecation period or to fix serious issues." +#: ../../c-api/stable.rst:9 +msgid "" +"Unless documented otherwise, Python's C API is covered by the Backwards " +"Compatibility Policy, :pep:`387`. Most changes to it are source-compatible " +"(typically by only adding new API). Changing existing API or removing API is " +"only done after a deprecation period or to fix serious issues." msgstr "" -msgid "CPython's Application Binary Interface (ABI) is forward- and backwards-compatible across a minor release (if these are compiled the same way; see :ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 will work on 3.10.8 and vice versa, but will need to be compiled separately for 3.9.x and 3.11.x." +#: ../../c-api/stable.rst:15 +msgid "" +"CPython's Application Binary Interface (ABI) is forward- and backwards-" +"compatible across a minor release (if these are compiled the same way; " +"see :ref:`stable-abi-platform` below). So, code compiled for Python 3.10.0 " +"will work on 3.10.8 and vice versa, but will need to be compiled separately " +"for 3.9.x and 3.11.x." msgstr "" +#: ../../c-api/stable.rst:21 msgid "There are two tiers of C API with different stability expectations:" msgstr "" -msgid ":ref:`Unstable API `, may change in minor versions without a deprecation period. It is marked by the ``PyUnstable`` prefix in names." +#: ../../c-api/stable.rst:23 +msgid "" +":ref:`Unstable API `, may change in minor versions without a " +"deprecation period. It is marked by the ``PyUnstable`` prefix in names." msgstr "" -msgid ":ref:`Limited API `, is compatible across several minor releases. When :c:macro:`Py_LIMITED_API` is defined, only this subset is exposed from ``Python.h``." +#: ../../c-api/stable.rst:25 +msgid "" +":ref:`Limited API `, is compatible across several minor " +"releases. When :c:macro:`Py_LIMITED_API` is defined, only this subset is " +"exposed from ``Python.h``." msgstr "" +#: ../../c-api/stable.rst:29 msgid "These are discussed in more detail below." msgstr "" -msgid "Names prefixed by an underscore, such as ``_Py_InternalState``, are private API that can change without notice even in patch releases. If you need to use this API, consider reaching out to `CPython developers `_ to discuss adding public API for your use case." +#: ../../c-api/stable.rst:31 +msgid "" +"Names prefixed by an underscore, such as ``_Py_InternalState``, are private " +"API that can change without notice even in patch releases. If you need to " +"use this API, consider reaching out to `CPython developers `_ to discuss adding public API for " +"your use case." msgstr "" +#: ../../c-api/stable.rst:40 msgid "Unstable C API" msgstr "" -msgid "Any API named with the ``PyUnstable`` prefix exposes CPython implementation details, and may change in every minor release (e.g. from 3.9 to 3.10) without any deprecation warnings. However, it will not change in a bugfix release (e.g. from 3.10.0 to 3.10.1)." +#: ../../c-api/stable.rst:44 +msgid "" +"Any API named with the ``PyUnstable`` prefix exposes CPython implementation " +"details, and may change in every minor release (e.g. from 3.9 to 3.10) " +"without any deprecation warnings. However, it will not change in a bugfix " +"release (e.g. from 3.10.0 to 3.10.1)." msgstr "" -msgid "It is generally intended for specialized, low-level tools like debuggers." +#: ../../c-api/stable.rst:49 +msgid "" +"It is generally intended for specialized, low-level tools like debuggers." msgstr "" -msgid "Projects that use this API are expected to follow CPython development and spend extra effort adjusting to changes." +#: ../../c-api/stable.rst:51 +msgid "" +"Projects that use this API are expected to follow CPython development and " +"spend extra effort adjusting to changes." msgstr "" +#: ../../c-api/stable.rst:57 msgid "Stable Application Binary Interface" msgstr "" -msgid "For simplicity, this document talks about *extensions*, but the Limited API and Stable ABI work the same way for all uses of the API – for example, embedding Python." +#: ../../c-api/stable.rst:59 +msgid "" +"For simplicity, this document talks about *extensions*, but the Limited API " +"and Stable ABI work the same way for all uses of the API – for example, " +"embedding Python." msgstr "" +#: ../../c-api/stable.rst:66 msgid "Limited C API" msgstr "" -msgid "Python 3.2 introduced the *Limited API*, a subset of Python's C API. Extensions that only use the Limited API can be compiled once and be loaded on multiple versions of Python. Contents of the Limited API are :ref:`listed below `." +#: ../../c-api/stable.rst:68 +msgid "" +"Python 3.2 introduced the *Limited API*, a subset of Python's C API. " +"Extensions that only use the Limited API can be compiled once and be loaded " +"on multiple versions of Python. Contents of the Limited API are :ref:`listed " +"below `." msgstr "" -msgid "Define this macro before including ``Python.h`` to opt in to only use the Limited API, and to select the Limited API version." +#: ../../c-api/stable.rst:75 +msgid "" +"Define this macro before including ``Python.h`` to opt in to only use the " +"Limited API, and to select the Limited API version." msgstr "" -msgid "Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` corresponding to the lowest Python version your extension supports. The extension will be ABI-compatible with all Python 3 releases from the specified one onward, and can use Limited API introduced up to that version." +#: ../../c-api/stable.rst:78 +msgid "" +"Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` " +"corresponding to the lowest Python version your extension supports. The " +"extension will be ABI-compatible with all Python 3 releases from the " +"specified one onward, and can use Limited API introduced up to that version." msgstr "" -msgid "Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when compiling with future Python versions." +#: ../../c-api/stable.rst:84 +msgid "" +"Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum " +"minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when " +"compiling with future Python versions." msgstr "" -msgid "You can also define ``Py_LIMITED_API`` to ``3``. This works the same as ``0x03020000`` (Python 3.2, the version that introduced Limited API)." +#: ../../c-api/stable.rst:88 +msgid "" +"You can also define ``Py_LIMITED_API`` to ``3``. This works the same as " +"``0x03020000`` (Python 3.2, the version that introduced Limited API)." msgstr "" +#: ../../c-api/stable.rst:95 msgid "Stable ABI" msgstr "" -msgid "To enable this, Python provides a *Stable ABI*: a set of symbols that will remain ABI-compatible across Python 3.x versions." +#: ../../c-api/stable.rst:97 +msgid "" +"To enable this, Python provides a *Stable ABI*: a set of symbols that will " +"remain ABI-compatible across Python 3.x versions." msgstr "" -msgid "The Stable ABI prevents ABI issues, like linker errors due to missing symbols or data corruption due to changes in structure layouts or function signatures. However, other changes in Python can change the *behavior* of extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for details." +#: ../../c-api/stable.rst:102 +msgid "" +"The Stable ABI prevents ABI issues, like linker errors due to missing " +"symbols or data corruption due to changes in structure layouts or function " +"signatures. However, other changes in Python can change the *behavior* of " +"extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " +"details." msgstr "" -msgid "The Stable ABI contains symbols exposed in the :ref:`Limited API `, but also other ones – for example, functions necessary to support older versions of the Limited API." +#: ../../c-api/stable.rst:108 +msgid "" +"The Stable ABI contains symbols exposed in the :ref:`Limited API `, but also other ones – for example, functions necessary to support " +"older versions of the Limited API." msgstr "" -msgid "On Windows, extensions that use the Stable ABI should be linked against ``python3.dll`` rather than a version-specific library such as ``python39.dll``." +#: ../../c-api/stable.rst:112 +msgid "" +"On Windows, extensions that use the Stable ABI should be linked against " +"``python3.dll`` rather than a version-specific library such as " +"``python39.dll``." msgstr "" -msgid "On some platforms, Python will look for and load shared library files named with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such extensions conform to a Stable ABI. The user (or their packaging tools) need to ensure that, for example, extensions built with the 3.10+ Limited API are not installed for lower versions of Python." +#: ../../c-api/stable.rst:116 +msgid "" +"On some platforms, Python will look for and load shared library files named " +"with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such " +"extensions conform to a Stable ABI. The user (or their packaging tools) need " +"to ensure that, for example, extensions built with the 3.10+ Limited API are " +"not installed for lower versions of Python." msgstr "" -msgid "All functions in the Stable ABI are present as functions in Python's shared library, not solely as macros. This makes them usable from languages that don't use the C preprocessor." +#: ../../c-api/stable.rst:123 +msgid "" +"All functions in the Stable ABI are present as functions in Python's shared " +"library, not solely as macros. This makes them usable from languages that " +"don't use the C preprocessor." msgstr "" +#: ../../c-api/stable.rst:129 msgid "Limited API Scope and Performance" msgstr "" -msgid "The goal for the Limited API is to allow everything that is possible with the full C API, but possibly with a performance penalty." +#: ../../c-api/stable.rst:131 +msgid "" +"The goal for the Limited API is to allow everything that is possible with " +"the full C API, but possibly with a performance penalty." msgstr "" -msgid "For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it can rely on version-specific implementation details of the list object." +#: ../../c-api/stable.rst:134 +msgid "" +"For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro " +"variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " +"can rely on version-specific implementation details of the list object." msgstr "" -msgid "Without ``Py_LIMITED_API`` defined, some C API functions are inlined or replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, allowing stability as Python's data structures are improved, but possibly reducing performance." +#: ../../c-api/stable.rst:139 +msgid "" +"Without ``Py_LIMITED_API`` defined, some C API functions are inlined or " +"replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, " +"allowing stability as Python's data structures are improved, but possibly " +"reducing performance." msgstr "" -msgid "By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile a Limited API extension with a version-specific ABI. This can improve performance for that Python version, but will limit compatibility. Compiling with ``Py_LIMITED_API`` will then yield an extension that can be distributed where a version-specific one is not available – for example, for prereleases of an upcoming Python version." +#: ../../c-api/stable.rst:144 +msgid "" +"By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile " +"a Limited API extension with a version-specific ABI. This can improve " +"performance for that Python version, but will limit compatibility. Compiling " +"with ``Py_LIMITED_API`` will then yield an extension that can be distributed " +"where a version-specific one is not available – for example, for prereleases " +"of an upcoming Python version." msgstr "" +#: ../../c-api/stable.rst:153 msgid "Limited API Caveats" msgstr "" -msgid "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee that code conforms to the :ref:`Limited API ` or the :ref:`Stable ABI `. ``Py_LIMITED_API`` only covers definitions, but an API also includes other issues, such as expected semantics." +#: ../../c-api/stable.rst:155 +msgid "" +"Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " +"that code conforms to the :ref:`Limited API ` or " +"the :ref:`Stable ABI `. ``Py_LIMITED_API`` only covers " +"definitions, but an API also includes other issues, such as expected " +"semantics." msgstr "" -msgid "One issue that ``Py_LIMITED_API`` does not guard against is calling a function with arguments that are invalid in a lower Python version. For example, consider a function that starts accepting ``NULL`` for an argument. In Python 3.9, ``NULL`` now selects a default behavior, but in Python 3.8, the argument will be used directly, causing a ``NULL`` dereference and crash. A similar argument works for fields of structs." +#: ../../c-api/stable.rst:160 +msgid "" +"One issue that ``Py_LIMITED_API`` does not guard against is calling a " +"function with arguments that are invalid in a lower Python version. For " +"example, consider a function that starts accepting ``NULL`` for an argument. " +"In Python 3.9, ``NULL`` now selects a default behavior, but in Python 3.8, " +"the argument will be used directly, causing a ``NULL`` dereference and " +"crash. A similar argument works for fields of structs." msgstr "" -msgid "Another issue is that some struct fields are currently not hidden when ``Py_LIMITED_API`` is defined, even though they're part of the Limited API." +#: ../../c-api/stable.rst:167 +msgid "" +"Another issue is that some struct fields are currently not hidden when " +"``Py_LIMITED_API`` is defined, even though they're part of the Limited API." msgstr "" -msgid "For these reasons, we recommend testing an extension with *all* minor Python versions it supports, and preferably to build with the *lowest* such version." +#: ../../c-api/stable.rst:170 +msgid "" +"For these reasons, we recommend testing an extension with *all* minor Python " +"versions it supports, and preferably to build with the *lowest* such version." msgstr "" -msgid "We also recommend reviewing documentation of all used API to check if it is explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a few private declarations are exposed for technical reasons (or even unintentionally, as bugs)." +#: ../../c-api/stable.rst:173 +msgid "" +"We also recommend reviewing documentation of all used API to check if it is " +"explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a " +"few private declarations are exposed for technical reasons (or even " +"unintentionally, as bugs)." msgstr "" -msgid "Also note that the Limited API is not necessarily stable: compiling with ``Py_LIMITED_API`` with Python 3.8 means that the extension will run with Python 3.12, but it will not necessarily *compile* with Python 3.12. In particular, parts of the Limited API may be deprecated and removed, provided that the Stable ABI stays stable." +#: ../../c-api/stable.rst:178 +msgid "" +"Also note that the Limited API is not necessarily stable: compiling with " +"``Py_LIMITED_API`` with Python 3.8 means that the extension will run with " +"Python 3.12, but it will not necessarily *compile* with Python 3.12. In " +"particular, parts of the Limited API may be deprecated and removed, provided " +"that the Stable ABI stays stable." msgstr "" +#: ../../c-api/stable.rst:188 msgid "Platform Considerations" msgstr "" -msgid "ABI stability depends not only on Python, but also on the compiler used, lower-level libraries and compiler options. For the purposes of the :ref:`Stable ABI `, these details define a “platform”. They usually depend on the OS type and processor architecture" +#: ../../c-api/stable.rst:190 +msgid "" +"ABI stability depends not only on Python, but also on the compiler used, " +"lower-level libraries and compiler options. For the purposes of " +"the :ref:`Stable ABI `, these details define a “platform”. They " +"usually depend on the OS type and processor architecture" msgstr "" -msgid "It is the responsibility of each particular distributor of Python to ensure that all Python versions on a particular platform are built in a way that does not break the Stable ABI. This is the case with Windows and macOS releases from ``python.org`` and many third-party distributors." +#: ../../c-api/stable.rst:195 +msgid "" +"It is the responsibility of each particular distributor of Python to ensure " +"that all Python versions on a particular platform are built in a way that " +"does not break the Stable ABI. This is the case with Windows and macOS " +"releases from ``python.org`` and many third-party distributors." msgstr "" +#: ../../c-api/stable.rst:205 msgid "Contents of Limited API" msgstr "" -msgid "Currently, the :ref:`Limited API ` includes the following items:" +#: ../../c-api/stable.rst:208 +msgid "" +"Currently, the :ref:`Limited API ` includes the following " +"items:" msgstr "" +#: ../../c-api/stable.rst:42 msgid "PyUnstable" msgstr "" diff --git a/c-api/structures.po b/c-api/structures.po index c55efc86d..3309bd95e 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,168 +24,307 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/structures.rst:6 msgid "Common Object Structures" msgstr "" -msgid "There are a large number of structures which are used in the definition of object types for Python. This section describes these structures and how they are used." +#: ../../c-api/structures.rst:8 +msgid "" +"There are a large number of structures which are used in the definition of " +"object types for Python. This section describes these structures and how " +"they are used." msgstr "" +#: ../../c-api/structures.rst:14 msgid "Base object types and macros" msgstr "" -msgid "All Python objects ultimately share a small number of fields at the beginning of the object's representation in memory. These are represented by the :c:type:`PyObject` and :c:type:`PyVarObject` types, which are defined, in turn, by the expansions of some macros also used, whether directly or indirectly, in the definition of all other Python objects. Additional macros can be found under :ref:`reference counting `." +#: ../../c-api/structures.rst:16 +msgid "" +"All Python objects ultimately share a small number of fields at the " +"beginning of the object's representation in memory. These are represented " +"by the :c:type:`PyObject` and :c:type:`PyVarObject` types, which are " +"defined, in turn, by the expansions of some macros also used, whether " +"directly or indirectly, in the definition of all other Python objects. " +"Additional macros can be found under :ref:`reference counting " +"`." msgstr "" -msgid "All object types are extensions of this type. This is a type which contains the information Python needs to treat a pointer to an object as an object. In a normal \"release\" build, it contains only the object's reference count and a pointer to the corresponding type object. Nothing is actually declared to be a :c:type:`PyObject`, but every pointer to a Python object can be cast to a :c:expr:`PyObject*`." +#: ../../c-api/structures.rst:26 +msgid "" +"All object types are extensions of this type. This is a type which contains " +"the information Python needs to treat a pointer to an object as an object. " +"In a normal \"release\" build, it contains only the object's reference count " +"and a pointer to the corresponding type object. Nothing is actually declared " +"to be a :c:type:`PyObject`, but every pointer to a Python object can be cast " +"to a :c:expr:`PyObject*`." msgstr "" -msgid "The members must not be accessed directly; instead use macros such as :c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." +#: ../../c-api/structures.rst:33 +msgid "" +"The members must not be accessed directly; instead use macros such " +"as :c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." msgstr "" -msgid "The object's reference count, as returned by :c:macro:`Py_REFCNT`. Do not use this field directly; instead use functions and macros such as :c:macro:`!Py_REFCNT`, :c:func:`Py_INCREF` and :c:func:`Py_DecRef`." +#: ../../c-api/structures.rst:38 +msgid "" +"The object's reference count, as returned by :c:macro:`Py_REFCNT`. Do not " +"use this field directly; instead use functions and macros such as :c:macro:`!" +"Py_REFCNT`, :c:func:`Py_INCREF` and :c:func:`Py_DecRef`." msgstr "" -msgid "The field type may be different from ``Py_ssize_t``, depending on build configuration and platform." +#: ../../c-api/structures.rst:42 +msgid "" +"The field type may be different from ``Py_ssize_t``, depending on build " +"configuration and platform." msgstr "" -msgid "The object's type. Do not use this field directly; use :c:macro:`Py_TYPE` and :c:func:`Py_SET_TYPE` instead." +#: ../../c-api/structures.rst:47 +msgid "" +"The object's type. Do not use this field directly; use :c:macro:`Py_TYPE` " +"and :c:func:`Py_SET_TYPE` instead." msgstr "" -msgid "An extension of :c:type:`PyObject` that adds the :c:member:`~PyVarObject.ob_size` field. This is intended for objects that have some notion of *length*." +#: ../../c-api/structures.rst:54 +msgid "" +"An extension of :c:type:`PyObject` that adds " +"the :c:member:`~PyVarObject.ob_size` field. This is intended for objects " +"that have some notion of *length*." msgstr "" -msgid "As with :c:type:`!PyObject`, the members must not be accessed directly; instead use macros such as :c:macro:`Py_SIZE`, :c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." +#: ../../c-api/structures.rst:58 +msgid "" +"As with :c:type:`!PyObject`, the members must not be accessed directly; " +"instead use macros such as :c:macro:`Py_SIZE`, :c:macro:`Py_REFCNT` " +"and :c:macro:`Py_TYPE`." msgstr "" -msgid "A size field, whose contents should be considered an object's internal implementation detail." +#: ../../c-api/structures.rst:64 +msgid "" +"A size field, whose contents should be considered an object's internal " +"implementation detail." msgstr "" +#: ../../c-api/structures.rst:67 msgid "Do not use this field directly; use :c:macro:`Py_SIZE` instead." msgstr "" -msgid "Object creation functions such as :c:func:`PyObject_NewVar` will generally set this field to the requested size (number of items). After creation, arbitrary values can be stored in :c:member:`!ob_size` using :c:macro:`Py_SET_SIZE`." +#: ../../c-api/structures.rst:69 +msgid "" +"Object creation functions such as :c:func:`PyObject_NewVar` will generally " +"set this field to the requested size (number of items). After creation, " +"arbitrary values can be stored in :c:member:`!ob_size` " +"using :c:macro:`Py_SET_SIZE`." msgstr "" -msgid "To get an object's publicly exposed length, as returned by the Python function :py:func:`len`, use :c:func:`PyObject_Length` instead." +#: ../../c-api/structures.rst:74 +msgid "" +"To get an object's publicly exposed length, as returned by the Python " +"function :py:func:`len`, use :c:func:`PyObject_Length` instead." msgstr "" -msgid "This is a macro used when declaring new types which represent objects without a varying length. The PyObject_HEAD macro expands to::" +#: ../../c-api/structures.rst:81 +msgid "" +"This is a macro used when declaring new types which represent objects " +"without a varying length. The PyObject_HEAD macro expands to::" msgstr "" +#: ../../c-api/structures.rst:84 msgid "PyObject ob_base;" msgstr "" +#: ../../c-api/structures.rst:86 msgid "See documentation of :c:type:`PyObject` above." msgstr "" -msgid "This is a macro used when declaring new types which represent objects with a length that varies from instance to instance. The PyObject_VAR_HEAD macro expands to::" +#: ../../c-api/structures.rst:91 +msgid "" +"This is a macro used when declaring new types which represent objects with a " +"length that varies from instance to instance. The PyObject_VAR_HEAD macro " +"expands to::" msgstr "" +#: ../../c-api/structures.rst:95 msgid "PyVarObject ob_base;" msgstr "" +#: ../../c-api/structures.rst:97 msgid "See documentation of :c:type:`PyVarObject` above." msgstr "" -msgid "The base class of all other objects, the same as :class:`object` in Python." +#: ../../c-api/structures.rst:102 +msgid "" +"The base class of all other objects, the same as :class:`object` in Python." msgstr "" -msgid "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." +#: ../../c-api/structures.rst:107 +msgid "" +"Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" -msgid "Test if an object is the ``None`` singleton, the same as ``x is None`` in Python." +#: ../../c-api/structures.rst:114 +msgid "" +"Test if an object is the ``None`` singleton, the same as ``x is None`` in " +"Python." msgstr "" -msgid "Test if an object is the ``True`` singleton, the same as ``x is True`` in Python." +#: ../../c-api/structures.rst:122 +msgid "" +"Test if an object is the ``True`` singleton, the same as ``x is True`` in " +"Python." msgstr "" -msgid "Test if an object is the ``False`` singleton, the same as ``x is False`` in Python." +#: ../../c-api/structures.rst:130 +msgid "" +"Test if an object is the ``False`` singleton, the same as ``x is False`` in " +"Python." msgstr "" +#: ../../c-api/structures.rst:138 msgid "Get the type of the Python object *o*." msgstr "" -msgid "The returned reference is :term:`borrowed ` from *o*. Do not release it with :c:func:`Py_DECREF` or similar." +#: ../../c-api/structures.rst:140 +msgid "" +"The returned reference is :term:`borrowed ` from *o*. Do " +"not release it with :c:func:`Py_DECREF` or similar." msgstr "" -msgid ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter type is no longer :c:expr:`const PyObject*`." +#: ../../c-api/structures.rst:143 +msgid "" +":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " +"type is no longer :c:expr:`const PyObject*`." msgstr "" -msgid "Return non-zero if the object *o* type is *type*. Return zero otherwise. Equivalent to: ``Py_TYPE(o) == type``." +#: ../../c-api/structures.rst:150 +msgid "" +"Return non-zero if the object *o* type is *type*. Return zero otherwise. " +"Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -msgid "Set the type of object *o* to *type*, without any checking or reference counting." +#: ../../c-api/structures.rst:158 +msgid "" +"Set the type of object *o* to *type*, without any checking or reference " +"counting." msgstr "" -msgid "This is a very low-level operation. Consider instead setting the Python attribute :attr:`~object.__class__` using :c:func:`PyObject_SetAttrString` or similar." +#: ../../c-api/structures.rst:161 +msgid "" +"This is a very low-level operation. Consider instead setting the Python " +"attribute :attr:`~object.__class__` using :c:func:`PyObject_SetAttrString` " +"or similar." msgstr "" -msgid "Note that assigning an incompatible type can lead to undefined behavior." +#: ../../c-api/structures.rst:165 +msgid "" +"Note that assigning an incompatible type can lead to undefined behavior." msgstr "" -msgid "If *type* is a :ref:`heap type `, the caller must create a new reference to it. Similarly, if the old type of *o* is a heap type, the caller must release a reference to that type." +#: ../../c-api/structures.rst:167 +msgid "" +"If *type* is a :ref:`heap type `, the caller must create a new " +"reference to it. Similarly, if the old type of *o* is a heap type, the " +"caller must release a reference to that type." msgstr "" +#: ../../c-api/structures.rst:177 msgid "Get the :c:member:`~PyVarObject.ob_size` field of *o*." msgstr "" -msgid ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter type is no longer :c:expr:`const PyVarObject*`." +#: ../../c-api/structures.rst:179 +msgid "" +":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " +"type is no longer :c:expr:`const PyVarObject*`." msgstr "" +#: ../../c-api/structures.rst:186 msgid "Set the :c:member:`~PyVarObject.ob_size` field of *o* to *size*." msgstr "" -msgid "This is a macro which expands to initialization values for a new :c:type:`PyObject` type. This macro expands to::" +#: ../../c-api/structures.rst:193 +msgid "" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyObject` type. This macro expands to::" msgstr "" +#: ../../c-api/structures.rst:196 msgid "" "_PyObject_EXTRA_INIT\n" "1, type," msgstr "" -msgid "This is a macro which expands to initialization values for a new :c:type:`PyVarObject` type, including the :c:member:`~PyVarObject.ob_size` field. This macro expands to::" +#: ../../c-api/structures.rst:202 +msgid "" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyVarObject` type, including " +"the :c:member:`~PyVarObject.ob_size` field. This macro expands to::" msgstr "" +#: ../../c-api/structures.rst:206 msgid "" "_PyObject_EXTRA_INIT\n" "1, type, size," msgstr "" +#: ../../c-api/structures.rst:211 msgid "Implementing functions and methods" msgstr "" -msgid "Type of the functions used to implement most Python callables in C. Functions of this type take two :c:expr:`PyObject*` parameters and return one such value. If the return value is ``NULL``, an exception shall have been set. If not ``NULL``, the return value is interpreted as the return value of the function as exposed in Python. The function must return a new reference." +#: ../../c-api/structures.rst:215 +msgid "" +"Type of the functions used to implement most Python callables in C. " +"Functions of this type take two :c:expr:`PyObject*` parameters and return " +"one such value. If the return value is ``NULL``, an exception shall have " +"been set. If not ``NULL``, the return value is interpreted as the return " +"value of the function as exposed in Python. The function must return a new " +"reference." msgstr "" +#: ../../c-api/structures.rst:222 msgid "The function signature is::" msgstr "" +#: ../../c-api/structures.rst:224 msgid "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" msgstr "" -msgid "Type of the functions used to implement Python callables in C with signature :ref:`METH_VARARGS | METH_KEYWORDS `. The function signature is::" +#: ../../c-api/structures.rst:229 +msgid "" +"Type of the functions used to implement Python callables in C with " +"signature :ref:`METH_VARARGS | METH_KEYWORDS `. " +"The function signature is::" msgstr "" +#: ../../c-api/structures.rst:233 msgid "" "PyObject *PyCFunctionWithKeywords(PyObject *self,\n" " PyObject *args,\n" " PyObject *kwargs);" msgstr "" -msgid "Type of the functions used to implement Python callables in C with signature :c:macro:`METH_FASTCALL`. The function signature is::" +#: ../../c-api/structures.rst:240 +msgid "" +"Type of the functions used to implement Python callables in C with " +"signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" +#: ../../c-api/structures.rst:244 msgid "" "PyObject *PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs);" msgstr "" -msgid "Type of the functions used to implement Python callables in C with signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" +#: ../../c-api/structures.rst:250 +msgid "" +"Type of the functions used to implement Python callables in C with " +"signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" +#: ../../c-api/structures.rst:254 msgid "" "PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" @@ -193,9 +332,14 @@ msgid "" " PyObject *kwnames);" msgstr "" -msgid "Type of the functions used to implement Python callables in C with signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" +#: ../../c-api/structures.rst:261 +msgid "" +"Type of the functions used to implement Python callables in C with " +"signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" +#: ../../c-api/structures.rst:265 msgid "" "PyObject *PyCMethod(PyObject *self,\n" " PyTypeObject *defining_class,\n" @@ -204,192 +348,405 @@ msgid "" " PyObject *kwnames)" msgstr "" -msgid "Structure used to describe a method of an extension type. This structure has four fields:" +#: ../../c-api/structures.rst:276 +msgid "" +"Structure used to describe a method of an extension type. This structure " +"has four fields:" msgstr "" +#: ../../c-api/structures.rst:281 msgid "Name of the method." msgstr "" +#: ../../c-api/structures.rst:285 msgid "Pointer to the C implementation." msgstr "" +#: ../../c-api/structures.rst:289 msgid "Flags bits indicating how the call should be constructed." msgstr "" +#: ../../c-api/structures.rst:293 msgid "Points to the contents of the docstring." msgstr "" -msgid "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions may be of different types, but they always return :c:expr:`PyObject*`. If the function is not of the :c:type:`PyCFunction`, the compiler will require a cast in the method table. Even though :c:type:`PyCFunction` defines the first parameter as :c:expr:`PyObject*`, it is common that the method implementation uses the specific C type of the *self* object." +#: ../../c-api/structures.rst:295 +msgid "" +"The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " +"may be of different types, but they always return :c:expr:`PyObject*`. If " +"the function is not of the :c:type:`PyCFunction`, the compiler will require " +"a cast in the method table. Even though :c:type:`PyCFunction` defines the " +"first parameter as :c:expr:`PyObject*`, it is common that the method " +"implementation uses the specific C type of the *self* object." msgstr "" -msgid "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include the following flags. The individual flags indicate either a calling convention or a binding convention." +#: ../../c-api/structures.rst:303 +msgid "" +"The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " +"the following flags. The individual flags indicate either a calling " +"convention or a binding convention." msgstr "" +#: ../../c-api/structures.rst:308 msgid "There are these calling conventions:" msgstr "" -msgid "This is the typical calling convention, where the methods have the type :c:type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The first one is the *self* object for methods; for module functions, it is the module object. The second parameter (often called *args*) is a tuple object representing all arguments. This parameter is typically processed using :c:func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." +#: ../../c-api/structures.rst:312 +msgid "" +"This is the typical calling convention, where the methods have the " +"type :c:type:`PyCFunction`. The function expects two :c:expr:`PyObject*` " +"values. The first one is the *self* object for methods; for module " +"functions, it is the module object. The second parameter (often called " +"*args*) is a tuple object representing all arguments. This parameter is " +"typically processed using :c:func:`PyArg_ParseTuple` " +"or :c:func:`PyArg_UnpackTuple`." msgstr "" -msgid "Can only be used in certain combinations with other flags: :ref:`METH_VARARGS | METH_KEYWORDS `, :ref:`METH_FASTCALL | METH_KEYWORDS ` and :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `." +#: ../../c-api/structures.rst:322 +msgid "" +"Can only be used in certain combinations with other " +"flags: :ref:`METH_VARARGS | METH_KEYWORDS `, :ref:`METH_FASTCALL | METH_KEYWORDS ` and :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS " +"`." msgstr "" +#: ../../c-api/structures.rst:330 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" msgstr "" -msgid "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. The function expects three parameters: *self*, *args*, *kwargs* where *kwargs* is a dictionary of all the keyword arguments or possibly ``NULL`` if there are no keyword arguments. The parameters are typically processed using :c:func:`PyArg_ParseTupleAndKeywords`." +#: ../../c-api/structures.rst:331 +msgid "" +"Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " +"The function expects three parameters: *self*, *args*, *kwargs* where " +"*kwargs* is a dictionary of all the keyword arguments or possibly ``NULL`` " +"if there are no keyword arguments. The parameters are typically processed " +"using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -msgid "Fast calling convention supporting only positional arguments. The methods have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the second parameter is a C array of :c:expr:`PyObject*` values indicating the arguments and the third parameter is the number of arguments (the length of the array)." +#: ../../c-api/structures.rst:340 +msgid "" +"Fast calling convention supporting only positional arguments. The methods " +"have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " +"second parameter is a C array of :c:expr:`PyObject*` values indicating the " +"arguments and the third parameter is the number of arguments (the length of " +"the array)." msgstr "" +#: ../../c-api/structures.rst:350 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI `." msgstr "" +#: ../../c-api/structures.rst:355 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" msgstr "" -msgid "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword arguments are passed the same way as in the :ref:`vectorcall protocol `: there is an additional fourth :c:expr:`PyObject*` parameter which is a tuple representing the names of the keyword arguments (which are guaranteed to be strings) or possibly ``NULL`` if there are no keywords. The values of the keyword arguments are stored in the *args* array, after the positional arguments." +#: ../../c-api/structures.rst:356 +msgid "" +"Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " +"with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " +"arguments are passed the same way as in the :ref:`vectorcall protocol " +"`: there is an additional fourth :c:expr:`PyObject*` parameter " +"which is a tuple representing the names of the keyword arguments (which are " +"guaranteed to be strings) or possibly ``NULL`` if there are no keywords. " +"The values of the keyword arguments are stored in the *args* array, after " +"the positional arguments." msgstr "" -msgid "Can only be used in the combination with other flags: :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `." +#: ../../c-api/structures.rst:371 +msgid "" +"Can only be used in the combination with other flags: :ref:`METH_METHOD | " +"METH_FASTCALL | METH_KEYWORDS `." msgstr "" +#: ../../c-api/structures.rst:377 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" msgstr "" -msgid "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that contains the method in question. The defining class might be a superclass of ``Py_TYPE(self)``." -msgstr "" - -msgid "The method needs to be of type :c:type:`PyCMethod`, the same as for ``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added after ``self``." +#: ../../c-api/structures.rst:378 +msgid "" +"Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that " +"contains the method in question. The defining class might be a superclass of " +"``Py_TYPE(self)``." msgstr "" -msgid "Methods without parameters don't need to check whether arguments are given if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of type :c:type:`PyCFunction`. The first parameter is typically named *self* and will hold a reference to the module or object instance. In all cases the second parameter will be ``NULL``." +#: ../../c-api/structures.rst:383 +msgid "" +"The method needs to be of type :c:type:`PyCMethod`, the same as for " +"``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " +"after ``self``." msgstr "" -msgid "The function must have 2 parameters. Since the second parameter is unused, :c:macro:`Py_UNUSED` can be used to prevent a compiler warning." +#: ../../c-api/structures.rst:392 +msgid "" +"Methods without parameters don't need to check whether arguments are given " +"if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " +"type :c:type:`PyCFunction`. The first parameter is typically named *self* " +"and will hold a reference to the module or object instance. In all cases " +"the second parameter will be ``NULL``." msgstr "" -msgid "Methods with a single object argument can be listed with the :c:macro:`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` with a ``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with the *self* parameter, and a :c:expr:`PyObject*` parameter representing the single argument." +#: ../../c-api/structures.rst:398 +msgid "" +"The function must have 2 parameters. Since the second parameter is " +"unused, :c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" -msgid "These two constants are not used to indicate the calling convention but the binding when used with methods of classes. These may not be used for functions defined for modules. At most one of these flags may be set for any given method." +#: ../../c-api/structures.rst:404 +msgid "" +"Methods with a single object argument can be listed with " +"the :c:macro:`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` " +"with a ``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with " +"the *self* parameter, and a :c:expr:`PyObject*` parameter representing the " +"single argument." msgstr "" -msgid "The method will be passed the type object as the first parameter rather than an instance of the type. This is used to create *class methods*, similar to what is created when using the :func:`classmethod` built-in function." +#: ../../c-api/structures.rst:410 +msgid "" +"These two constants are not used to indicate the calling convention but the " +"binding when used with methods of classes. These may not be used for " +"functions defined for modules. At most one of these flags may be set for " +"any given method." msgstr "" -msgid "The method will be passed ``NULL`` as the first parameter rather than an instance of the type. This is used to create *static methods*, similar to what is created when using the :func:`staticmethod` built-in function." +#: ../../c-api/structures.rst:420 +msgid "" +"The method will be passed the type object as the first parameter rather than " +"an instance of the type. This is used to create *class methods*, similar to " +"what is created when using the :deco:`classmethod` built-in decorator." msgstr "" -msgid "One other constant controls whether a method is loaded in place of another definition with the same method name." +#: ../../c-api/structures.rst:430 +msgid "" +"The method will be passed ``NULL`` as the first parameter rather than an " +"instance of the type. This is used to create *static methods*, similar to " +"what is created when using the :deco:`staticmethod` built-in decorator." msgstr "" -msgid "The method will be loaded in place of existing definitions. Without *METH_COEXIST*, the default is to skip repeated definitions. Since slot wrappers are loaded before the method table, the existence of a *sq_contains* slot, for example, would generate a wrapped method named :meth:`~object.__contains__` and preclude the loading of a corresponding PyCFunction with the same name. With the flag defined, the PyCFunction will be loaded in place of the wrapper object and will co-exist with the slot. This is helpful because calls to PyCFunctions are optimized more than wrapper object calls." +#: ../../c-api/structures.rst:434 +msgid "" +"One other constant controls whether a method is loaded in place of another " +"definition with the same method name." msgstr "" -msgid "The type object corresponding to Python C method objects. This is available as :class:`types.BuiltinMethodType` in the Python layer." +#: ../../c-api/structures.rst:440 +msgid "" +"The method will be loaded in place of existing definitions. Without " +"*METH_COEXIST*, the default is to skip repeated definitions. Since slot " +"wrappers are loaded before the method table, the existence of a " +"*sq_contains* slot, for example, would generate a wrapped method " +"named :meth:`~object.__contains__` and preclude the loading of a " +"corresponding PyCFunction with the same name. With the flag defined, the " +"PyCFunction will be loaded in place of the wrapper object and will co-exist " +"with the slot. This is helpful because calls to PyCFunctions are optimized " +"more than wrapper object calls." +msgstr "" + +#: ../../c-api/structures.rst:453 +msgid "" +"The type object corresponding to Python C method objects. This is available " +"as :class:`types.BuiltinMethodType` in the Python layer." msgstr "" -msgid "Return true if *op* is an instance of the :c:type:`PyCMethod_Type` type or a subtype of it. This function always succeeds." +#: ../../c-api/structures.rst:459 +msgid "" +"Return true if *op* is an instance of the :c:type:`PyCMethod_Type` type or a " +"subtype of it. This function always succeeds." msgstr "" -msgid "This is the same as :c:func:`PyCMethod_Check`, but does not account for subtypes." +#: ../../c-api/structures.rst:465 +msgid "" +"This is the same as :c:func:`PyCMethod_Check`, but does not account for " +"subtypes." msgstr "" -msgid "Turn *ml* into a Python :term:`callable` object. The caller must ensure that *ml* outlives the :term:`callable`. Typically, *ml* is defined as a static variable." +#: ../../c-api/structures.rst:471 +msgid "" +"Turn *ml* into a Python :term:`callable` object. The caller must ensure that " +"*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " +"variable." msgstr "" -msgid "The *self* parameter will be passed as the *self* argument to the C function in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." +#: ../../c-api/structures.rst:475 +msgid "" +"The *self* parameter will be passed as the *self* argument to the C function " +"in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" -msgid "The :term:`callable` object's ``__module__`` attribute can be set from the given *module* argument. *module* should be a Python string, which will be used as name of the module the function is defined in. If unavailable, it can be set to :const:`None` or ``NULL``." +#: ../../c-api/structures.rst:479 +msgid "" +"The :term:`callable` object's ``__module__`` attribute can be set from the " +"given *module* argument. *module* should be a Python string, which will be " +"used as name of the module the function is defined in. If unavailable, it " +"can be set to :const:`None` or ``NULL``." msgstr "" +#: ../../c-api/structures.rst:485 msgid ":attr:`function.__module__`" msgstr "" -msgid "The *cls* parameter will be passed as the *defining_class* argument to the C function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." +#: ../../c-api/structures.rst:487 +msgid "" +"The *cls* parameter will be passed as the *defining_class* argument to the C " +"function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" -msgid "The type object corresponding to Python C function objects. This is available as :class:`types.BuiltinFunctionType` in the Python layer." +#: ../../c-api/structures.rst:496 +msgid "" +"The type object corresponding to Python C function objects. This is " +"available as :class:`types.BuiltinFunctionType` in the Python layer." msgstr "" -msgid "Return true if *op* is an instance of the :c:type:`PyCFunction_Type` type or a subtype of it. This function always succeeds." +#: ../../c-api/structures.rst:502 +msgid "" +"Return true if *op* is an instance of the :c:type:`PyCFunction_Type` type or " +"a subtype of it. This function always succeeds." msgstr "" -msgid "This is the same as :c:func:`PyCFunction_Check`, but does not account for subtypes." +#: ../../c-api/structures.rst:508 +msgid "" +"This is the same as :c:func:`PyCFunction_Check`, but does not account for " +"subtypes." msgstr "" +#: ../../c-api/structures.rst:514 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." msgstr "" +#: ../../c-api/structures.rst:519 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." msgstr "" -msgid "Get the function's flags on *func* as they were passed to :c:member:`~PyMethodDef.ml_flags`." +#: ../../c-api/structures.rst:524 +msgid "" +"Get the function's flags on *func* as they were passed " +"to :c:member:`~PyMethodDef.ml_flags`." msgstr "" -msgid "If *func* is not a C function object, this fails with an exception. *func* must not be ``NULL``." +#: ../../c-api/structures.rst:527 ../../c-api/structures.rst:545 +#: ../../c-api/structures.rst:565 +msgid "" +"If *func* is not a C function object, this fails with an exception. *func* " +"must not be ``NULL``." msgstr "" -msgid "This function returns the function's flags on success, and ``-1`` with an exception set on failure." +#: ../../c-api/structures.rst:530 +msgid "" +"This function returns the function's flags on success, and ``-1`` with an " +"exception set on failure." msgstr "" -msgid "This is the same as :c:func:`PyCFunction_GetFlags`, but without error or type checking." +#: ../../c-api/structures.rst:536 +msgid "" +"This is the same as :c:func:`PyCFunction_GetFlags`, but without error or " +"type checking." msgstr "" -msgid "Get the function pointer on *func* as it was passed to :c:member:`~PyMethodDef.ml_meth`." +#: ../../c-api/structures.rst:542 +msgid "" +"Get the function pointer on *func* as it was passed " +"to :c:member:`~PyMethodDef.ml_meth`." msgstr "" -msgid "This function returns the function pointer on success, and ``NULL`` with an exception set on failure." +#: ../../c-api/structures.rst:548 +msgid "" +"This function returns the function pointer on success, and ``NULL`` with an " +"exception set on failure." msgstr "" -msgid "This is the same as :c:func:`PyCFunction_GetFunction`, but without error or type checking." +#: ../../c-api/structures.rst:554 +msgid "" +"This is the same as :c:func:`PyCFunction_GetFunction`, but without error or " +"type checking." msgstr "" -msgid "Get the \"self\" object on *func*. This is the object that would be passed to the first argument of a :c:type:`PyCFunction`. For C function objects created through a :c:type:`PyMethodDef` on a :c:type:`PyModuleDef`, this is the resulting module object." +#: ../../c-api/structures.rst:560 +msgid "" +"Get the \"self\" object on *func*. This is the object that would be passed " +"to the first argument of a :c:type:`PyCFunction`. For C function objects " +"created through a :c:type:`PyMethodDef` on a :c:type:`PyModuleDef`, this is " +"the resulting module object." msgstr "" -msgid "This function returns a :term:`borrowed reference` to the \"self\" object on success, and ``NULL`` with an exception set on failure." +#: ../../c-api/structures.rst:568 +msgid "" +"This function returns a :term:`borrowed reference` to the \"self\" object on " +"success, and ``NULL`` with an exception set on failure." msgstr "" -msgid "This is the same as :c:func:`PyCFunction_GetSelf`, but without error or type checking." +#: ../../c-api/structures.rst:574 +msgid "" +"This is the same as :c:func:`PyCFunction_GetSelf`, but without error or type " +"checking." msgstr "" +#: ../../c-api/structures.rst:579 msgid "Accessing attributes of extension types" msgstr "" -msgid "Structure which describes an attribute of a type which corresponds to a C struct member. When defining a class, put a NULL-terminated array of these structures in the :c:member:`~PyTypeObject.tp_members` slot." +#: ../../c-api/structures.rst:583 +msgid "" +"Structure which describes an attribute of a type which corresponds to a C " +"struct member. When defining a class, put a NULL-terminated array of these " +"structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" +#: ../../c-api/structures.rst:588 msgid "Its fields are, in order:" msgstr "" -msgid "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." +#: ../../c-api/structures.rst:592 +msgid "" +"Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" +#: ../../c-api/structures.rst:595 msgid "The string should be static, no copy is made of it." msgstr "" -msgid "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the possible values." +#: ../../c-api/structures.rst:599 +msgid "" +"The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " +"possible values." msgstr "" -msgid "The offset in bytes that the member is located on the type’s object struct." +#: ../../c-api/structures.rst:604 +msgid "" +"The offset in bytes that the member is located on the type’s object struct." msgstr "" -msgid "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." +#: ../../c-api/structures.rst:608 +msgid "" +"Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." msgstr "" -msgid "The docstring, or NULL. The string should be static, no copy is made of it. Typically, it is defined using :c:macro:`PyDoc_STR`." +#: ../../c-api/structures.rst:612 +msgid "" +"The docstring, or NULL. The string should be static, no copy is made of it. " +"Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" -msgid "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow both read and write access. Use the :c:macro:`Py_READONLY` flag for read-only access. Certain types, like :c:macro:`Py_T_STRING`, imply :c:macro:`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and legacy :c:macro:`T_OBJECT`) members can be deleted." +#: ../../c-api/structures.rst:616 +msgid "" +"By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " +"both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" +"only access. Certain types, like :c:macro:`Py_T_STRING`, " +"imply :c:macro:`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and " +"legacy :c:macro:`T_OBJECT`) members can be deleted." msgstr "" -msgid "For heap-allocated types (created using :c:func:`PyType_FromSpec` or similar), ``PyMemberDef`` may contain a definition for the special member ``\"__vectorcalloffset__\"``, corresponding to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. This member must be defined with ``Py_T_PYSSIZET``, and either ``Py_READONLY`` or ``Py_READONLY | Py_RELATIVE_OFFSET``. For example::" +#: ../../c-api/structures.rst:625 +msgid "" +"For heap-allocated types (created using :c:func:`PyType_FromSpec` or " +"similar), ``PyMemberDef`` may contain a definition for the special member " +"``\"__vectorcalloffset__\"``, corresponding " +"to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. This " +"member must be defined with ``Py_T_PYSSIZET``, and either ``Py_READONLY`` or " +"``Py_READONLY | Py_RELATIVE_OFFSET``. For example::" msgstr "" +#: ../../c-api/structures.rst:632 msgid "" "static PyMemberDef spam_type_members[] = {\n" " {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" @@ -398,272 +755,439 @@ msgid "" "};" msgstr "" +#: ../../c-api/structures.rst:638 msgid "(You may need to ``#include `` for :c:func:`!offsetof`.)" msgstr "" -msgid "The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:`~PyTypeObject.tp_weaklistoffset` can be defined similarly using ``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but extensions are strongly encouraged to use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." +#: ../../c-api/structures.rst:640 +msgid "" +"The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` " +"and :c:member:`~PyTypeObject.tp_weaklistoffset` can be defined similarly " +"using ``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " +"extensions are strongly encouraged to use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" -msgid "``PyMemberDef`` is always available. Previously, it required including ``\"structmember.h\"``." +#: ../../c-api/structures.rst:648 +msgid "" +"``PyMemberDef`` is always available. Previously, it required including " +"``\"structmember.h\"``." msgstr "" -msgid ":c:macro:`Py_RELATIVE_OFFSET` is now allowed for ``\"__vectorcalloffset__\"``, ``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"``." +#: ../../c-api/structures.rst:653 +msgid "" +":c:macro:`Py_RELATIVE_OFFSET` is now allowed for " +"``\"__vectorcalloffset__\"``, ``\"__dictoffset__\"`` and " +"``\"__weaklistoffset__\"``." msgstr "" -msgid "Get an attribute belonging to the object at address *obj_addr*. The attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." +#: ../../c-api/structures.rst:659 +msgid "" +"Get an attribute belonging to the object at address *obj_addr*. The " +"attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -msgid "``PyMember_GetOne`` is always available. Previously, it required including ``\"structmember.h\"``." +#: ../../c-api/structures.rst:665 +msgid "" +"``PyMember_GetOne`` is always available. Previously, it required including " +"``\"structmember.h\"``." msgstr "" -msgid "Set an attribute belonging to the object at address *obj_addr* to object *o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns ``0`` if successful and a negative value on failure." +#: ../../c-api/structures.rst:670 +msgid "" +"Set an attribute belonging to the object at address *obj_addr* to object " +"*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " +"``0`` if successful and a negative value on failure." msgstr "" -msgid "``PyMember_SetOne`` is always available. Previously, it required including ``\"structmember.h\"``." +#: ../../c-api/structures.rst:676 +msgid "" +"``PyMember_SetOne`` is always available. Previously, it required including " +"``\"structmember.h\"``." msgstr "" +#: ../../c-api/structures.rst:682 msgid "Member flags" msgstr "" +#: ../../c-api/structures.rst:684 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" msgstr "" +#: ../../c-api/structures.rst:688 msgid "Not writable." msgstr "" -msgid "Emit an ``object.__getattr__`` :ref:`audit event ` before reading." +#: ../../c-api/structures.rst:692 +msgid "" +"Emit an ``object.__getattr__`` :ref:`audit event ` before " +"reading." msgstr "" -msgid "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` entry indicates an offset from the subclass-specific data, rather than from ``PyObject``." +#: ../../c-api/structures.rst:697 +msgid "" +"Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " +"entry indicates an offset from the subclass-specific data, rather than from " +"``PyObject``." msgstr "" -msgid "Can only be used as part of the :c:data:`Py_tp_members` :c:type:`slot ` when creating a class using negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case. When setting :c:member:`~PyTypeObject.tp_members` from the slot during class creation, Python clears the flag and sets :c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." +#: ../../c-api/structures.rst:701 +msgid "" +"Can only be used as part of the :c:data:`Py_tp_members` :c:type:`slot " +"` when creating a class using " +"negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case. " +"When setting :c:member:`~PyTypeObject.tp_members` from the slot during class " +"creation, Python clears the flag and sets :c:member:`PyMemberDef.offset` to " +"the offset from the ``PyObject`` struct." msgstr "" -msgid "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are deprecated. :c:macro:`!READ_RESTRICTED` and :c:macro:`!RESTRICTED` are equivalent to :c:macro:`Py_AUDIT_READ`; :c:macro:`!WRITE_RESTRICTED` does nothing." +#: ../../c-api/structures.rst:716 +msgid "" +"The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" +"WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " +"deprecated. :c:macro:`!READ_RESTRICTED` and :c:macro:`!RESTRICTED` are " +"equivalent to :c:macro:`Py_AUDIT_READ`; :c:macro:`!WRITE_RESTRICTED` does " +"nothing." msgstr "" -msgid "The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. The :c:macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The new names are now always available. Previously, these required ``#include \"structmember.h\"``. The header is still available and it provides the old names." +#: ../../c-api/structures.rst:727 +msgid "" +"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. " +"The :c:macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The " +"new names are now always available. Previously, these required ``#include " +"\"structmember.h\"``. The header is still available and it provides the old " +"names." msgstr "" +#: ../../c-api/structures.rst:736 msgid "Member types" msgstr "" -msgid ":c:member:`PyMemberDef.type` can be one of the following macros corresponding to various C types. When the member is accessed in Python, it will be converted to the equivalent Python type. When it is set from Python, it will be converted back to the C type. If that is not possible, an exception such as :exc:`TypeError` or :exc:`ValueError` is raised." +#: ../../c-api/structures.rst:738 +msgid "" +":c:member:`PyMemberDef.type` can be one of the following macros " +"corresponding to various C types. When the member is accessed in Python, it " +"will be converted to the equivalent Python type. When it is set from Python, " +"it will be converted back to the C type. If that is not possible, an " +"exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" -msgid "Unless marked (D), attributes defined this way cannot be deleted using e.g. :keyword:`del` or :py:func:`delattr`." +#: ../../c-api/structures.rst:746 +msgid "" +"Unless marked (D), attributes defined this way cannot be deleted using " +"e.g. :keyword:`del` or :py:func:`delattr`." msgstr "" +#: ../../c-api/structures.rst:750 msgid "Macro name" msgstr "" +#: ../../c-api/structures.rst:750 msgid "C type" msgstr "" +#: ../../c-api/structures.rst:750 msgid "Python type" msgstr "" +#: ../../c-api/structures.rst:752 msgid ":c:expr:`char`" msgstr "" +#: ../../c-api/structures.rst:752 ../../c-api/structures.rst:753 +#: ../../c-api/structures.rst:754 ../../c-api/structures.rst:755 +#: ../../c-api/structures.rst:756 ../../c-api/structures.rst:757 +#: ../../c-api/structures.rst:758 ../../c-api/structures.rst:759 +#: ../../c-api/structures.rst:760 ../../c-api/structures.rst:761 +#: ../../c-api/structures.rst:762 msgid ":py:class:`int`" msgstr "" +#: ../../c-api/structures.rst:753 msgid ":c:expr:`short`" msgstr "" +#: ../../c-api/structures.rst:754 msgid ":c:expr:`int`" msgstr "" +#: ../../c-api/structures.rst:755 msgid ":c:expr:`long`" msgstr "" +#: ../../c-api/structures.rst:756 msgid ":c:expr:`long long`" msgstr "" +#: ../../c-api/structures.rst:757 msgid ":c:expr:`unsigned char`" msgstr "" +#: ../../c-api/structures.rst:758 msgid ":c:expr:`unsigned int`" msgstr "" +#: ../../c-api/structures.rst:759 msgid ":c:expr:`unsigned short`" msgstr "" +#: ../../c-api/structures.rst:760 msgid ":c:expr:`unsigned long`" msgstr "" +#: ../../c-api/structures.rst:761 msgid ":c:expr:`unsigned long long`" msgstr "" +#: ../../c-api/structures.rst:762 msgid ":c:expr:`Py_ssize_t`" msgstr "" +#: ../../c-api/structures.rst:763 msgid ":c:expr:`float`" msgstr "" +#: ../../c-api/structures.rst:763 ../../c-api/structures.rst:764 msgid ":py:class:`float`" msgstr "" +#: ../../c-api/structures.rst:764 msgid ":c:expr:`double`" msgstr "" +#: ../../c-api/structures.rst:765 msgid ":c:expr:`char` (written as 0 or 1)" msgstr "" +#: ../../c-api/structures.rst:765 msgid ":py:class:`bool`" msgstr "" +#: ../../c-api/structures.rst:767 msgid ":c:expr:`const char *` (*)" msgstr "" +#: ../../c-api/structures.rst:767 ../../c-api/structures.rst:768 msgid ":py:class:`str` (RO)" msgstr "" +#: ../../c-api/structures.rst:768 msgid ":c:expr:`const char[]` (*)" msgstr "" +#: ../../c-api/structures.rst:769 msgid ":c:expr:`char` (0-127)" msgstr "" +#: ../../c-api/structures.rst:769 msgid ":py:class:`str` (**)" msgstr "" +#: ../../c-api/structures.rst:770 msgid ":c:expr:`PyObject *`" msgstr "" +#: ../../c-api/structures.rst:770 msgid ":py:class:`object` (D)" msgstr "" -msgid "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the string is stored directly in the structure." +#: ../../c-api/structures.rst:773 +msgid "" +"(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " +"the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " +"string is stored directly in the structure." msgstr "" +#: ../../c-api/structures.rst:778 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" +#: ../../c-api/structures.rst:780 msgid "(RO): Implies :c:macro:`Py_READONLY`." msgstr "" -msgid "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a ``NULL`` pointer raises :py:exc:`AttributeError`." +#: ../../c-api/structures.rst:782 +msgid "" +"(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " +"``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" -msgid "In previous versions, the macros were only available with ``#include \"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as ``T_INT``). The header is still available and contains the old names, along with the following deprecated types:" +#: ../../c-api/structures.rst:808 +msgid "" +"In previous versions, the macros were only available with ``#include " +"\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " +"``T_INT``). The header is still available and contains the old names, along " +"with the following deprecated types:" msgstr "" -msgid "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results in surprising behavior in Python: deleting the attribute effectively sets it to ``None``." +#: ../../c-api/structures.rst:816 +msgid "" +"Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " +"in surprising behavior in Python: deleting the attribute effectively sets it " +"to ``None``." msgstr "" +#: ../../c-api/structures.rst:822 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" +#: ../../c-api/structures.rst:825 msgid "Defining Getters and Setters" msgstr "" -msgid "Structure to define property-like access for a type. See also description of the :c:member:`PyTypeObject.tp_getset` slot." +#: ../../c-api/structures.rst:829 +msgid "" +"Structure to define property-like access for a type. See also description of " +"the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" +#: ../../c-api/structures.rst:834 msgid "attribute name" msgstr "" +#: ../../c-api/structures.rst:838 msgid "C function to get the attribute." msgstr "" -msgid "Optional C function to set or delete the attribute. If ``NULL``, the attribute is read-only." +#: ../../c-api/structures.rst:842 +msgid "" +"Optional C function to set or delete the attribute. If ``NULL``, the " +"attribute is read-only." msgstr "" +#: ../../c-api/structures.rst:847 msgid "optional docstring" msgstr "" -msgid "Optional user data pointer, providing additional data for getter and setter." +#: ../../c-api/structures.rst:851 +msgid "" +"Optional user data pointer, providing additional data for getter and setter." msgstr "" -msgid "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) and a user data pointer (the associated ``closure``):" +#: ../../c-api/structures.rst:855 +msgid "" +"The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " +"and a user data pointer (the associated ``closure``):" msgstr "" -msgid "It should return a new reference on success or ``NULL`` with a set exception on failure." +#: ../../c-api/structures.rst:858 +msgid "" +"It should return a new reference on success or ``NULL`` with a set exception " +"on failure." msgstr "" -msgid "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and the value to be set) and a user data pointer (the associated ``closure``):" +#: ../../c-api/structures.rst:863 +msgid "" +"``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " +"the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" -msgid "In case the attribute should be deleted the second parameter is ``NULL``. Should return ``0`` on success or ``-1`` with a set exception on failure." +#: ../../c-api/structures.rst:866 +msgid "" +"In case the attribute should be deleted the second parameter is ``NULL``. " +"Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" +#: ../../c-api/structures.rst:418 ../../c-api/structures.rst:428 msgid "built-in function" msgstr "" +#: ../../c-api/structures.rst:418 msgid "classmethod" msgstr "" +#: ../../c-api/structures.rst:428 msgid "staticmethod" msgstr "" +#: ../../c-api/structures.rst:709 msgid "READ_RESTRICTED (C macro)" msgstr "" +#: ../../c-api/structures.rst:709 msgid "WRITE_RESTRICTED (C macro)" msgstr "" +#: ../../c-api/structures.rst:709 msgid "RESTRICTED (C macro)" msgstr "" +#: ../../c-api/structures.rst:722 msgid "READONLY (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_BYTE (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_SHORT (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_INT (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_LONG (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_LONGLONG (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_UBYTE (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_USHORT (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_UINT (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_ULONG (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_ULONGULONG (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_PYSSIZET (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_FLOAT (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_DOUBLE (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_BOOL (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_CHAR (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_STRING (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_STRING_INPLACE (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "T_OBJECT_EX (C macro)" msgstr "" +#: ../../c-api/structures.rst:785 msgid "structmember.h" msgstr "" diff --git a/c-api/subinterpreters.po b/c-api/subinterpreters.po index e0257aa01..5de3b9386 100644 --- a/c-api/subinterpreters.po +++ b/c-api/subinterpreters.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,84 +19,187 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/subinterpreters.rst:6 msgid "Multiple interpreters in a Python process" msgstr "" -msgid "While in most uses, you will only embed a single Python interpreter, there are cases where you need to create several independent interpreters in the same process and perhaps even in the same thread. Sub-interpreters allow you to do that." +#: ../../c-api/subinterpreters.rst:8 +msgid "" +"While in most uses, you will only embed a single Python interpreter, there " +"are cases where you need to create several independent interpreters in the " +"same process and perhaps even in the same thread. Sub-interpreters allow you " +"to do that." msgstr "" -msgid "The \"main\" interpreter is the first one created when the runtime initializes. It is usually the only Python interpreter in a process. Unlike sub-interpreters, the main interpreter has unique process-global responsibilities like signal handling. It is also responsible for execution during runtime initialization and is usually the active interpreter during runtime finalization. The :c:func:`PyInterpreterState_Main` function returns a pointer to its state." +#: ../../c-api/subinterpreters.rst:13 +msgid "" +"The \"main\" interpreter is the first one created when the runtime " +"initializes. It is usually the only Python interpreter in a process. Unlike " +"sub-interpreters, the main interpreter has unique process-global " +"responsibilities like signal handling. It is also responsible for execution " +"during runtime initialization and is usually the active interpreter during " +"runtime finalization. The :c:func:`PyInterpreterState_Main` function " +"returns a pointer to its state." msgstr "" -msgid "You can switch between sub-interpreters using the :c:func:`PyThreadState_Swap` function. You can create and destroy them using the following functions:" +#: ../../c-api/subinterpreters.rst:20 +msgid "" +"You can switch between sub-interpreters using " +"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " +"using the following functions:" msgstr "" -msgid "Structure containing most parameters to configure a sub-interpreter. Its values are used only in :c:func:`Py_NewInterpreterFromConfig` and never modified by the runtime." +#: ../../c-api/subinterpreters.rst:26 +msgid "" +"Structure containing most parameters to configure a sub-interpreter. Its " +"values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " +"modified by the runtime." msgstr "" +#: ../../c-api/subinterpreters.rst:32 msgid "Structure fields:" msgstr "" -msgid "If this is ``0`` then the sub-interpreter will use its own \"object\" allocator state. Otherwise it will use (share) the main interpreter's." +#: ../../c-api/subinterpreters.rst:36 +msgid "" +"If this is ``0`` then the sub-interpreter will use its own \"object\" " +"allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -msgid "If this is ``0`` then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." +#: ../../c-api/subinterpreters.rst:40 +msgid "" +"If this is ``0`` " +"then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be " +"``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` " +"must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." msgstr "" -msgid "If this is ``0`` then the runtime will not support forking the process in any thread where the sub-interpreter is currently active. Otherwise fork is unrestricted." +#: ../../c-api/subinterpreters.rst:48 +msgid "" +"If this is ``0`` then the runtime will not support forking the process in " +"any thread where the sub-interpreter is currently active. Otherwise fork is " +"unrestricted." msgstr "" -msgid "Note that the :mod:`subprocess` module still works when fork is disallowed." +#: ../../c-api/subinterpreters.rst:52 +msgid "" +"Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -msgid "If this is ``0`` then the runtime will not support replacing the current process via exec (e.g. :func:`os.execv`) in any thread where the sub-interpreter is currently active. Otherwise exec is unrestricted." +#: ../../c-api/subinterpreters.rst:57 +msgid "" +"If this is ``0`` then the runtime will not support replacing the current " +"process via exec (e.g. :func:`os.execv`) in any thread where the sub-" +"interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -msgid "Note that the :mod:`subprocess` module still works when exec is disallowed." +#: ../../c-api/subinterpreters.rst:62 +msgid "" +"Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -msgid "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't create threads. Otherwise threads are allowed." +#: ../../c-api/subinterpreters.rst:67 +msgid "" +"If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " +"create threads. Otherwise threads are allowed." msgstr "" -msgid "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't create daemon threads. Otherwise daemon threads are allowed (as long as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." +#: ../../c-api/subinterpreters.rst:73 +msgid "" +"If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " +"create daemon threads. Otherwise daemon threads are allowed (as long " +"as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -msgid "If this is ``0`` then all extension modules may be imported, including legacy (single-phase init) modules, in any thread where the sub-interpreter is currently active. Otherwise only multi-phase init extension modules (see :pep:`489`) may be imported. (Also see :c:macro:`Py_mod_multiple_interpreters`.)" +#: ../../c-api/subinterpreters.rst:80 +msgid "" +"If this is ``0`` then all extension modules may be imported, including " +"legacy (single-phase init) modules, in any thread where the sub-interpreter " +"is currently active. Otherwise only multi-phase init extension modules " +"(see :pep:`489`) may be imported. (Also " +"see :c:macro:`Py_mod_multiple_interpreters`.)" msgstr "" -msgid "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." +#: ../../c-api/subinterpreters.rst:87 +msgid "" +"This must be ``1`` (non-zero) " +"if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." msgstr "" -msgid "This determines the operation of the GIL for the sub-interpreter. It may be one of the following:" +#: ../../c-api/subinterpreters.rst:92 +msgid "" +"This determines the operation of the GIL for the sub-interpreter. It may be " +"one of the following:" msgstr "" +#: ../../c-api/subinterpreters.rst:99 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" +#: ../../c-api/subinterpreters.rst:103 msgid "Use (share) the main interpreter's GIL." msgstr "" +#: ../../c-api/subinterpreters.rst:107 msgid "Use the sub-interpreter's own GIL." msgstr "" -msgid "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." -msgstr "" - -msgid "Create a new sub-interpreter. This is an (almost) totally separate environment for the execution of Python code. In particular, the new interpreter has separate, independent versions of all imported modules, including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. The table of loaded modules (``sys.modules``) and the module search path (``sys.path``) are also separate. The new environment has no ``sys.argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the same underlying file descriptors)." -msgstr "" - -msgid "The given *config* controls the options with which the interpreter is initialized." +#: ../../c-api/subinterpreters.rst:109 +msgid "" +"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` " +"then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -msgid "Upon success, *tstate_p* will be set to the first :term:`thread state` created in the new sub-interpreter. This thread state is :term:`attached `. Note that no actual thread is created; see the discussion of thread states below. If creation of the new interpreter is unsuccessful, *tstate_p* is set to ``NULL``; no exception is set since the exception state is stored in the :term:`attached thread state`, which might not exist." +#: ../../c-api/subinterpreters.rst:123 +msgid "" +"Create a new sub-interpreter. This is an (almost) totally separate " +"environment for the execution of Python code. In particular, the new " +"interpreter has separate, independent versions of all imported modules, " +"including the fundamental modules :mod:`builtins`, :mod:`__main__` " +"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " +"module search path (``sys.path``) are also separate. The new environment " +"has no ``sys.argv`` variable. It has new standard I/O stream file objects " +"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " +"same underlying file descriptors)." +msgstr "" + +#: ../../c-api/subinterpreters.rst:133 +msgid "" +"The given *config* controls the options with which the interpreter is " +"initialized." msgstr "" -msgid "Like all other Python/C API functions, an :term:`attached thread state` must be present before calling this function, but it might be detached upon returning. On success, the returned thread state will be :term:`attached `. If the sub-interpreter is created with its own :term:`GIL` then the :term:`attached thread state` of the calling interpreter will be detached. When the function returns, the new interpreter's :term:`thread state` will be :term:`attached ` to the current thread and the previous interpreter's :term:`attached thread state` will remain detached." +#: ../../c-api/subinterpreters.rst:136 +msgid "" +"Upon success, *tstate_p* will be set to the first :term:`thread state` " +"created in the new sub-interpreter. This thread state is :term:`attached " +"`. Note that no actual thread is created; see the " +"discussion of thread states below. If creation of the new interpreter is " +"unsuccessful, *tstate_p* is set to ``NULL``; no exception is set since the " +"exception state is stored in the :term:`attached thread state`, which might " +"not exist." msgstr "" -msgid "Sub-interpreters are most effective when isolated from each other, with certain functionality restricted::" +#: ../../c-api/subinterpreters.rst:145 +msgid "" +"Like all other Python/C API functions, an :term:`attached thread state` must " +"be present before calling this function, but it might be detached upon " +"returning. On success, the returned thread state will be :term:`attached " +"`. If the sub-interpreter is created with its " +"own :term:`GIL` then the :term:`attached thread state` of the calling " +"interpreter will be detached. When the function returns, the new " +"interpreter's :term:`thread state` will be :term:`attached ` to the current thread and the previous interpreter's :term:`attached " +"thread state` will remain detached." +msgstr "" + +#: ../../c-api/subinterpreters.rst:156 +msgid "" +"Sub-interpreters are most effective when isolated from each other, with " +"certain functionality restricted::" msgstr "" +#: ../../c-api/subinterpreters.rst:159 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -114,182 +217,376 @@ msgid "" "}" msgstr "" -msgid "Note that the config is used only briefly and does not get modified. During initialization the config's values are converted into various :c:type:`PyInterpreterState` values. A read-only copy of the config may be stored internally on the :c:type:`PyInterpreterState`." +#: ../../c-api/subinterpreters.rst:174 +msgid "" +"Note that the config is used only briefly and does not get modified. During " +"initialization the config's values are converted into " +"various :c:type:`PyInterpreterState` values. A read-only copy of the config " +"may be stored internally on the :c:type:`PyInterpreterState`." msgstr "" +#: ../../c-api/subinterpreters.rst:183 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -msgid "For modules using multi-phase initialization, e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created and initialized for each interpreter. Only C-level static and global variables are shared between these module objects." -msgstr "" - -msgid "For modules using legacy :ref:`single-phase initialization `, e.g. :c:func:`PyModule_Create`, the first time a particular extension is imported, it is initialized normally, and a (shallow) copy of its module's dictionary is squirreled away. When the same extension is imported by another (sub-)interpreter, a new module is initialized and filled with the contents of this copy; the extension's ``init`` function is not called. Objects in the module's dictionary thus end up shared across (sub-)interpreters, which might cause unwanted behavior (see `Bugs and caveats`_ below)." +#: ../../c-api/subinterpreters.rst:185 +msgid "" +"For modules using multi-phase initialization, " +"e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created " +"and initialized for each interpreter. Only C-level static and global " +"variables are shared between these module objects." msgstr "" -msgid "Note that this is different from what happens when an extension is imported after the interpreter has been completely re-initialized by calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's ``initmodule`` function *is* called again. As with multi-phase initialization, this means that only C-level static and global variables are shared between these modules." +#: ../../c-api/subinterpreters.rst:191 +msgid "" +"For modules using legacy :ref:`single-phase initialization `, e.g. :c:func:`PyModule_Create`, the first time a " +"particular extension is imported, it is initialized normally, and a " +"(shallow) copy of its module's dictionary is squirreled away. When the same " +"extension is imported by another (sub-)interpreter, a new module is " +"initialized and filled with the contents of this copy; the extension's " +"``init`` function is not called. Objects in the module's dictionary thus end " +"up shared across (sub-)interpreters, which might cause unwanted behavior " +"(see `Bugs and caveats`_ below)." +msgstr "" + +#: ../../c-api/subinterpreters.rst:203 +msgid "" +"Note that this is different from what happens when an extension is imported " +"after the interpreter has been completely re-initialized by " +"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " +"the extension's ``initmodule`` function *is* called again. As with multi-" +"phase initialization, this means that only C-level static and global " +"variables are shared between these modules." msgstr "" -msgid "Create a new sub-interpreter. This is essentially just a wrapper around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves the existing behavior. The result is an unisolated sub-interpreter that shares the main interpreter's GIL, allows fork/exec, allows daemon threads, and allows single-phase init modules." +#: ../../c-api/subinterpreters.rst:223 +msgid "" +"Create a new sub-interpreter. This is essentially just a wrapper " +"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " +"the existing behavior. The result is an unisolated sub-interpreter that " +"shares the main interpreter's GIL, allows fork/exec, allows daemon threads, " +"and allows single-phase init modules." msgstr "" -msgid "Destroy the (sub-)interpreter represented by the given :term:`thread state`. The given thread state must be :term:`attached `. When the call returns, there will be no :term:`attached thread state`. All thread states associated with this interpreter are destroyed." +#: ../../c-api/subinterpreters.rst:235 +msgid "" +"Destroy the (sub-)interpreter represented by the given :term:`thread state`. " +"The given thread state must be :term:`attached `. " +"When the call returns, there will be no :term:`attached thread state`. All " +"thread states associated with this interpreter are destroyed." msgstr "" -msgid ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been explicitly destroyed at that point." +#: ../../c-api/subinterpreters.rst:240 +msgid "" +":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " +"explicitly destroyed at that point." msgstr "" +#: ../../c-api/subinterpreters.rst:247 msgid "A per-interpreter GIL" msgstr "" -msgid "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter that is completely isolated from other interpreters, including having its own GIL. The most important benefit of this isolation is that such an interpreter can execute Python code without being blocked by other interpreters or blocking any others. Thus a single Python process can truly take advantage of multiple CPU cores when running Python code. The isolation also encourages a different approach to concurrency than that of just using threads. (See :pep:`554` and :pep:`684`.)" -msgstr "" - -msgid "Using an isolated interpreter requires vigilance in preserving that isolation. That especially means not sharing any objects or mutable state without guarantees about thread-safety. Even objects that are otherwise immutable (e.g. ``None``, ``(1, 5)``) can't normally be shared because of the refcount. One simple but less-efficient approach around this is to use a global lock around all use of some state (or object). Alternately, effectively immutable objects (like integers or strings) can be made safe in spite of their refcounts by making them :term:`immortal`. In fact, this has been done for the builtin singletons, small integers, and a number of other builtin objects." +#: ../../c-api/subinterpreters.rst:251 +msgid "" +"Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " +"that is completely isolated from other interpreters, including having its " +"own GIL. The most important benefit of this isolation is that such an " +"interpreter can execute Python code without being blocked by other " +"interpreters or blocking any others. Thus a single Python process can truly " +"take advantage of multiple CPU cores when running Python code. The " +"isolation also encourages a different approach to concurrency than that of " +"just using threads. (See :pep:`554` and :pep:`684`.)" msgstr "" -msgid "If you preserve isolation then you will have access to proper multi-core computing without the complications that come with free-threading. Failure to preserve isolation will expose you to the full consequences of free-threading, including races and hard-to-debug crashes." +#: ../../c-api/subinterpreters.rst:261 +msgid "" +"Using an isolated interpreter requires vigilance in preserving that " +"isolation. That especially means not sharing any objects or mutable state " +"without guarantees about thread-safety. Even objects that are otherwise " +"immutable (e.g. ``None``, ``(1, 5)``) can't normally be shared because of " +"the refcount. One simple but less-efficient approach around this is to use " +"a global lock around all use of some state (or object). Alternately, " +"effectively immutable objects (like integers or strings) can be made safe in " +"spite of their refcounts by making them :term:`immortal`. In fact, this has " +"been done for the builtin singletons, small integers, and a number of other " +"builtin objects." +msgstr "" + +#: ../../c-api/subinterpreters.rst:272 +msgid "" +"If you preserve isolation then you will have access to proper multi-core " +"computing without the complications that come with free-threading. Failure " +"to preserve isolation will expose you to the full consequences of free-" +"threading, including races and hard-to-debug crashes." msgstr "" -msgid "Aside from that, one of the main challenges of using multiple isolated interpreters is how to communicate between them safely (not break isolation) and efficiently. The runtime and stdlib do not provide any standard approach to this yet. A future stdlib module would help mitigate the effort of preserving isolation and expose effective tools for communicating (and sharing) data between interpreters." +#: ../../c-api/subinterpreters.rst:277 +msgid "" +"Aside from that, one of the main challenges of using multiple isolated " +"interpreters is how to communicate between them safely (not break isolation) " +"and efficiently. The runtime and stdlib do not provide any standard " +"approach to this yet. A future stdlib module would help mitigate the effort " +"of preserving isolation and expose effective tools for communicating (and " +"sharing) data between interpreters." msgstr "" +#: ../../c-api/subinterpreters.rst:286 msgid "Bugs and caveats" msgstr "" -msgid "Because sub-interpreters (and the main interpreter) are part of the same process, the insulation between them isn't perfect --- for example, using low-level file operations like :func:`os.close` they can (accidentally or maliciously) affect each other's open files. Because of the way extensions are shared between (sub-)interpreters, some extensions may not work properly; this is especially likely when using single-phase initialization or (static) global variables. It is possible to insert objects created in one sub-interpreter into a namespace of another (sub-)interpreter; this should be avoided if possible." -msgstr "" - -msgid "Special care should be taken to avoid sharing user-defined functions, methods, instances or classes between sub-interpreters, since import operations executed by such objects may affect the wrong (sub-)interpreter's dictionary of loaded modules. It is equally important to avoid sharing objects from which the above are reachable." +#: ../../c-api/subinterpreters.rst:288 +msgid "" +"Because sub-interpreters (and the main interpreter) are part of the same " +"process, the insulation between them isn't perfect --- for example, using " +"low-level file operations like :func:`os.close` they can (accidentally or " +"maliciously) affect each other's open files. Because of the way extensions " +"are shared between (sub-)interpreters, some extensions may not work " +"properly; this is especially likely when using single-phase initialization " +"or (static) global variables. It is possible to insert objects created in " +"one sub-interpreter into a namespace of another (sub-)interpreter; this " +"should be avoided if possible." +msgstr "" + +#: ../../c-api/subinterpreters.rst:298 +msgid "" +"Special care should be taken to avoid sharing user-defined functions, " +"methods, instances or classes between sub-interpreters, since import " +"operations executed by such objects may affect the wrong (sub-)interpreter's " +"dictionary of loaded modules. It is equally important to avoid sharing " +"objects from which the above are reachable." msgstr "" -msgid "Also note that combining this functionality with ``PyGILState_*`` APIs is delicate, because these APIs assume a bijection between Python thread states and OS-level threads, an assumption broken by the presence of sub-interpreters. It is highly recommended that you don't switch sub-interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:`ctypes`) using these APIs to allow calling of Python code from non-Python created threads will probably be broken when using sub-interpreters." +#: ../../c-api/subinterpreters.rst:304 +msgid "" +"Also note that combining this functionality with ``PyGILState_*`` APIs is " +"delicate, because these APIs assume a bijection between Python thread states " +"and OS-level threads, an assumption broken by the presence of sub-" +"interpreters. It is highly recommended that you don't switch sub-" +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " +"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" +"Python created threads will probably be broken when using sub-interpreters." msgstr "" +#: ../../c-api/subinterpreters.rst:315 msgid "High-level APIs" msgstr "" -msgid "This data structure represents the state shared by a number of cooperating threads. Threads belonging to the same interpreter share their module administration and a few other internal items. There are no public members in this structure." +#: ../../c-api/subinterpreters.rst:319 +msgid "" +"This data structure represents the state shared by a number of cooperating " +"threads. Threads belonging to the same interpreter share their module " +"administration and a few other internal items. There are no public members " +"in this structure." msgstr "" -msgid "Threads belonging to different interpreters initially share nothing, except process state like available memory, open file descriptors and such. The global interpreter lock is also shared by all threads, regardless of to which interpreter they belong." +#: ../../c-api/subinterpreters.rst:324 +msgid "" +"Threads belonging to different interpreters initially share nothing, except " +"process state like available memory, open file descriptors and such. The " +"global interpreter lock is also shared by all threads, regardless of to " +"which interpreter they belong." msgstr "" -msgid ":pep:`684` introduced the possibility of a :ref:`per-interpreter GIL `. See :c:func:`Py_NewInterpreterFromConfig`." +#: ../../c-api/subinterpreters.rst:331 +msgid "" +":pep:`684` introduced the possibility of a :ref:`per-interpreter GIL `. See :c:func:`Py_NewInterpreterFromConfig`." msgstr "" +#: ../../c-api/subinterpreters.rst:338 msgid "Get the current interpreter." msgstr "" -msgid "Issue a fatal error if there is no :term:`attached thread state`. It cannot return NULL." +#: ../../c-api/subinterpreters.rst:340 +msgid "" +"Issue a fatal error if there is no :term:`attached thread state`. It cannot " +"return NULL." msgstr "" -msgid "Return the interpreter's unique ID. If there was any error in doing so then ``-1`` is returned and an error is set." +#: ../../c-api/subinterpreters.rst:348 +msgid "" +"Return the interpreter's unique ID. If there was any error in doing so then " +"``-1`` is returned and an error is set." msgstr "" +#: ../../c-api/subinterpreters.rst:351 msgid "The caller must have an :term:`attached thread state`." msgstr "" -msgid "Return a dictionary in which interpreter-specific data may be stored. If this function returns ``NULL`` then no exception has been raised and the caller should assume no interpreter-specific dict is available." +#: ../../c-api/subinterpreters.rst:358 +msgid "" +"Return a dictionary in which interpreter-specific data may be stored. If " +"this function returns ``NULL`` then no exception has been raised and the " +"caller should assume no interpreter-specific dict is available." msgstr "" -msgid "This is not a replacement for :c:func:`PyModule_GetState()`, which extensions should use to store interpreter-specific state information." +#: ../../c-api/subinterpreters.rst:362 +msgid "" +"This is not a replacement for :c:func:`PyModule_GetState()`, which " +"extensions should use to store interpreter-specific state information." msgstr "" -msgid "The returned dictionary is borrowed from the interpreter and is valid until interpreter shutdown." +#: ../../c-api/subinterpreters.rst:365 +msgid "" +"The returned dictionary is borrowed from the interpreter and is valid until " +"interpreter shutdown." msgstr "" +#: ../../c-api/subinterpreters.rst:373 msgid "Type of a frame evaluation function." msgstr "" -msgid "The *throwflag* parameter is used by the ``throw()`` method of generators: if non-zero, handle the current exception." +#: ../../c-api/subinterpreters.rst:375 +msgid "" +"The *throwflag* parameter is used by the ``throw()`` method of generators: " +"if non-zero, handle the current exception." msgstr "" +#: ../../c-api/subinterpreters.rst:378 msgid "The function now takes a *tstate* parameter." msgstr "" -msgid "The *frame* parameter changed from ``PyFrameObject*`` to ``_PyInterpreterFrame*``." +#: ../../c-api/subinterpreters.rst:381 +msgid "" +"The *frame* parameter changed from ``PyFrameObject*`` to " +"``_PyInterpreterFrame*``." msgstr "" +#: ../../c-api/subinterpreters.rst:387 msgid "Get the frame evaluation function." msgstr "" +#: ../../c-api/subinterpreters.rst:389 ../../c-api/subinterpreters.rst:398 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" +#: ../../c-api/subinterpreters.rst:396 msgid "Set the frame evaluation function." msgstr "" +#: ../../c-api/subinterpreters.rst:404 msgid "Low-level APIs" msgstr "" -msgid "All of the following functions must be called after :c:func:`Py_Initialize`." +#: ../../c-api/subinterpreters.rst:406 +msgid "" +"All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets an :term:`attached thread state`." +#: ../../c-api/subinterpreters.rst:408 +msgid "" +":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets " +"an :term:`attached thread state`." msgstr "" -msgid "Create a new interpreter state object. An :term:`attached thread state` is not needed, but may optionally exist if it is necessary to serialize calls to this function." +#: ../../c-api/subinterpreters.rst:415 +msgid "" +"Create a new interpreter state object. An :term:`attached thread state` is " +"not needed, but may optionally exist if it is necessary to serialize calls " +"to this function." msgstr "" -msgid "Raises an :ref:`auditing event ` ``cpython.PyInterpreterState_New`` with no arguments." +#: ../../c-api/subinterpreters.rst:419 +msgid "" +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_New`` with no arguments." msgstr "" -msgid "Reset all information in an interpreter state object. There must be an :term:`attached thread state` for the interpreter." +#: ../../c-api/subinterpreters.rst:424 +msgid "" +"Reset all information in an interpreter state object. There must be " +"an :term:`attached thread state` for the interpreter." msgstr "" -msgid "Raises an :ref:`auditing event ` ``cpython.PyInterpreterState_Clear`` with no arguments." +#: ../../c-api/subinterpreters.rst:427 +msgid "" +"Raises an :ref:`auditing event ` " +"``cpython.PyInterpreterState_Clear`` with no arguments." msgstr "" -msgid "Destroy an interpreter state object. There **should not** be an :term:`attached thread state` for the target interpreter. The interpreter state must have been reset with a previous call to :c:func:`PyInterpreterState_Clear`." +#: ../../c-api/subinterpreters.rst:432 +msgid "" +"Destroy an interpreter state object. There **should not** be " +"an :term:`attached thread state` for the target interpreter. The interpreter " +"state must have been reset with a previous call " +"to :c:func:`PyInterpreterState_Clear`." msgstr "" +#: ../../c-api/subinterpreters.rst:440 msgid "Advanced debugger support" msgstr "" -msgid "These functions are only intended to be used by advanced debugging tools." +#: ../../c-api/subinterpreters.rst:442 +msgid "" +"These functions are only intended to be used by advanced debugging tools." msgstr "" -msgid "Return the interpreter state object at the head of the list of all such objects." +#: ../../c-api/subinterpreters.rst:447 +msgid "" +"Return the interpreter state object at the head of the list of all such " +"objects." msgstr "" +#: ../../c-api/subinterpreters.rst:452 msgid "Return the main interpreter state object." msgstr "" -msgid "Return the next interpreter state object after *interp* from the list of all such objects." +#: ../../c-api/subinterpreters.rst:457 +msgid "" +"Return the next interpreter state object after *interp* from the list of all " +"such objects." msgstr "" -msgid "Return the pointer to the first :c:type:`PyThreadState` object in the list of threads associated with the interpreter *interp*." +#: ../../c-api/subinterpreters.rst:463 +msgid "" +"Return the pointer to the first :c:type:`PyThreadState` object in the list " +"of threads associated with the interpreter *interp*." msgstr "" -msgid "Return the next thread state object after *tstate* from the list of all such objects belonging to the same :c:type:`PyInterpreterState` object." +#: ../../c-api/subinterpreters.rst:469 +msgid "" +"Return the next thread state object after *tstate* from the list of all such " +"objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "module" msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "builtins" msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "__main__" msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "sys" msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "stdout (in module sys)" msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "stderr (in module sys)" msgstr "" +#: ../../c-api/subinterpreters.rst:115 ../../c-api/subinterpreters.rst:215 msgid "stdin (in module sys)" msgstr "" +#: ../../c-api/subinterpreters.rst:179 ../../c-api/subinterpreters.rst:233 msgid "Py_FinalizeEx (C function)" msgstr "" +#: ../../c-api/subinterpreters.rst:179 msgid "Py_Initialize (C function)" msgstr "" +#: ../../c-api/subinterpreters.rst:210 msgid "close (in module os)" msgstr "" diff --git a/c-api/synchronization.po b/c-api/synchronization.po index d693708c3..850256485 100644 --- a/c-api/synchronization.po +++ b/c-api/synchronization.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,60 +19,127 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/synchronization.rst:6 msgid "Synchronization primitives" msgstr "" +#: ../../c-api/synchronization.rst:8 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -msgid "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to zero to represent the unlocked state. For example::" +#: ../../c-api/synchronization.rst:12 +msgid "" +"A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " +"zero to represent the unlocked state. For example::" msgstr "" +#: ../../c-api/synchronization.rst:15 msgid "PyMutex mutex = {0};" msgstr "" -msgid "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the contents and address of a :c:type:`!PyMutex` are meaningful, and it must remain at a fixed, writable location in memory." +#: ../../c-api/synchronization.rst:17 +msgid "" +"Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " +"contents and address of a :c:type:`!PyMutex` are meaningful, and it must " +"remain at a fixed, writable location in memory." msgstr "" -msgid "A :c:type:`!PyMutex` currently occupies one byte, but the size should be considered unstable. The size may change in future Python releases without a deprecation period." +#: ../../c-api/synchronization.rst:23 +msgid "" +"A :c:type:`!PyMutex` currently occupies one byte, but the size should be " +"considered unstable. The size may change in future Python releases without " +"a deprecation period." msgstr "" -msgid "Lock mutex *m*. If another thread has already locked it, the calling thread will block until the mutex is unlocked. While blocked, the thread will temporarily detach the :term:`thread state ` if one exists." +#: ../../c-api/synchronization.rst:31 +msgid "" +"Lock mutex *m*. If another thread has already locked it, the calling thread " +"will block until the mutex is unlocked. While blocked, the thread will " +"temporarily detach the :term:`thread state ` if one " +"exists." msgstr "" -msgid "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will issue a fatal error." +#: ../../c-api/synchronization.rst:39 +msgid "" +"Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " +"issue a fatal error." msgstr "" +#: ../../c-api/synchronization.rst:46 msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise." msgstr "" -msgid "This function is intended for use in assertions and debugging only and should not be used to make concurrency control decisions, as the lock state may change immediately after the check." +#: ../../c-api/synchronization.rst:50 +msgid "" +"This function is intended for use in assertions and debugging only and " +"should not be used to make concurrency control decisions, as the lock state " +"may change immediately after the check." msgstr "" +#: ../../c-api/synchronization.rst:59 msgid "Python critical section API" msgstr "" -msgid "The critical section API provides a deadlock avoidance layer on top of per-object locks for :term:`free-threaded ` CPython. They are intended to replace reliance on the :term:`global interpreter lock`, and are no-ops in versions of Python with the global interpreter lock." +#: ../../c-api/synchronization.rst:61 +msgid "" +"The critical section API provides a deadlock avoidance layer on top of per-" +"object locks for :term:`free-threaded ` CPython. They are " +"intended to replace reliance on the :term:`global interpreter lock`, and are " +"no-ops in versions of Python with the global interpreter lock." msgstr "" -msgid "Critical sections are intended to be used for custom types implemented in C-API extensions. They should generally not be used with built-in types like :class:`list` and :class:`dict` because their public C-APIs already use critical sections internally, with the notable exception of :c:func:`PyDict_Next`, which requires critical section to be acquired externally." +#: ../../c-api/synchronization.rst:66 +msgid "" +"Critical sections are intended to be used for custom types implemented in C-" +"API extensions. They should generally not be used with built-in types " +"like :class:`list` and :class:`dict` because their public C-APIs already use " +"critical sections internally, with the notable exception " +"of :c:func:`PyDict_Next`, which requires critical section to be acquired " +"externally." msgstr "" -msgid "Critical sections avoid deadlocks by implicitly suspending active critical sections, hence, they do not provide exclusive access such as provided by traditional locks like :c:type:`PyMutex`. When a critical section is started, the per-object lock for the object is acquired. If the code executed inside the critical section calls C-API functions then it can suspend the critical section thereby releasing the per-object lock, so other threads can acquire the per-object lock for the same object." +#: ../../c-api/synchronization.rst:73 +msgid "" +"Critical sections avoid deadlocks by implicitly suspending active critical " +"sections, hence, they do not provide exclusive access such as provided by " +"traditional locks like :c:type:`PyMutex`. When a critical section is " +"started, the per-object lock for the object is acquired. If the code " +"executed inside the critical section calls C-API functions then it can " +"suspend the critical section thereby releasing the per-object lock, so other " +"threads can acquire the per-object lock for the same object." msgstr "" -msgid "Variants that accept :c:type:`PyMutex` pointers rather than Python objects are also available. Use these variants to start a critical section in a situation where there is no :c:type:`PyObject` -- for example, when working with a C type that does not extend or wrap :c:type:`PyObject` but still needs to call into the C API in a manner that might lead to deadlocks." +#: ../../c-api/synchronization.rst:81 +msgid "" +"Variants that accept :c:type:`PyMutex` pointers rather than Python objects " +"are also available. Use these variants to start a critical section in a " +"situation where there is no :c:type:`PyObject` -- for example, when working " +"with a C type that does not extend or wrap :c:type:`PyObject` but still " +"needs to call into the C API in a manner that might lead to deadlocks." msgstr "" -msgid "The functions and structs used by the macros are exposed for cases where C macros are not available. They should only be used as in the given macro expansions. Note that the sizes and contents of the structures may change in future Python versions." +#: ../../c-api/synchronization.rst:87 +msgid "" +"The functions and structs used by the macros are exposed for cases where C " +"macros are not available. They should only be used as in the given macro " +"expansions. Note that the sizes and contents of the structures may change in " +"future Python versions." msgstr "" -msgid "Operations that need to lock two objects at once must use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to lock more than one object at once, because the inner critical section may suspend the outer critical sections. This API does not provide a way to lock more than two objects at once." +#: ../../c-api/synchronization.rst:94 +msgid "" +"Operations that need to lock two objects at once must " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " +"sections to lock more than one object at once, because the inner critical " +"section may suspend the outer critical sections. This API does not provide " +"a way to lock more than two objects at once." msgstr "" +#: ../../c-api/synchronization.rst:100 msgid "Example usage::" msgstr "" +#: ../../c-api/synchronization.rst:102 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -84,135 +151,218 @@ msgid "" "}" msgstr "" -msgid "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which can call arbitrary code through an object's deallocation function. The critical section API avoids potential deadlocks due to reentrancy and lock ordering by allowing the runtime to temporarily suspend the critical section if the code triggered by the finalizer blocks and calls :c:func:`PyEval_SaveThread`." +#: ../../c-api/synchronization.rst:111 +msgid "" +"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " +"can call arbitrary code through an object's deallocation function. The " +"critical section API avoids potential deadlocks due to reentrancy and lock " +"ordering by allowing the runtime to temporarily suspend the critical section " +"if the code triggered by the finalizer blocks and " +"calls :c:func:`PyEval_SaveThread`." msgstr "" -msgid "Acquires the per-object lock for the object *op* and begins a critical section." +#: ../../c-api/synchronization.rst:119 +msgid "" +"Acquires the per-object lock for the object *op* and begins a critical " +"section." msgstr "" +#: ../../c-api/synchronization.rst:122 ../../c-api/synchronization.rst:136 +#: ../../c-api/synchronization.rst:153 ../../c-api/synchronization.rst:168 +#: ../../c-api/synchronization.rst:182 ../../c-api/synchronization.rst:199 msgid "In the free-threaded build, this macro expands to::" msgstr "" +#: ../../c-api/synchronization.rst:124 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" +#: ../../c-api/synchronization.rst:128 ../../c-api/synchronization.rst:174 msgid "In the default build, this macro expands to ``{``." msgstr "" +#: ../../c-api/synchronization.rst:134 msgid "Locks the mutex *m* and begins a critical section." msgstr "" +#: ../../c-api/synchronization.rst:138 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_BeginMutex(&_py_cs, m)" msgstr "" -msgid "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for the argument of the macro - it must be a :c:type:`PyMutex` pointer." +#: ../../c-api/synchronization.rst:142 +msgid "" +"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for " +"the argument of the macro - it must be a :c:type:`PyMutex` pointer." msgstr "" +#: ../../c-api/synchronization.rst:145 ../../c-api/synchronization.rst:191 msgid "On the default build, this macro expands to ``{``." msgstr "" +#: ../../c-api/synchronization.rst:151 msgid "Ends the critical section and releases the per-object lock." msgstr "" +#: ../../c-api/synchronization.rst:155 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" +#: ../../c-api/synchronization.rst:158 ../../c-api/synchronization.rst:204 msgid "In the default build, this macro expands to ``}``." msgstr "" -msgid "Acquires the per-object locks for the objects *a* and *b* and begins a critical section. The locks are acquired in a consistent order (lowest address first) to avoid lock ordering deadlocks." +#: ../../c-api/synchronization.rst:164 +msgid "" +"Acquires the per-object locks for the objects *a* and *b* and begins a " +"critical section. The locks are acquired in a consistent order (lowest " +"address first) to avoid lock ordering deadlocks." msgstr "" +#: ../../c-api/synchronization.rst:170 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" +#: ../../c-api/synchronization.rst:180 msgid "Locks the mutexes *m1* and *m2* and begins a critical section." msgstr "" +#: ../../c-api/synchronization.rst:184 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" msgstr "" -msgid "Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for the arguments of the macro - they must be :c:type:`PyMutex` pointers." +#: ../../c-api/synchronization.rst:188 +msgid "" +"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for " +"the arguments of the macro - they must be :c:type:`PyMutex` pointers." msgstr "" +#: ../../c-api/synchronization.rst:197 msgid "Ends the critical section and releases the per-object locks." msgstr "" +#: ../../c-api/synchronization.rst:201 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" msgstr "" +#: ../../c-api/synchronization.rst:210 msgid "Legacy locking APIs" msgstr "" -msgid "These APIs are obsolete since Python 3.13 with the introduction of :c:type:`PyMutex`." +#: ../../c-api/synchronization.rst:212 +msgid "" +"These APIs are obsolete since Python 3.13 with the introduction " +"of :c:type:`PyMutex`." msgstr "" +#: ../../c-api/synchronization.rst:218 msgid "A pointer to a mutual exclusion lock." msgstr "" +#: ../../c-api/synchronization.rst:223 msgid "The result of acquiring a lock with a timeout." msgstr "" +#: ../../c-api/synchronization.rst:229 msgid "Failed to acquire the lock." msgstr "" +#: ../../c-api/synchronization.rst:233 msgid "The lock was successfully acquired." msgstr "" +#: ../../c-api/synchronization.rst:237 msgid "The lock was interrupted by a signal." msgstr "" +#: ../../c-api/synchronization.rst:242 msgid "Allocate a new lock." msgstr "" -msgid "On success, this function returns a lock; on failure, this function returns ``0`` without an exception set." +#: ../../c-api/synchronization.rst:244 +msgid "" +"On success, this function returns a lock; on failure, this function returns " +"``0`` without an exception set." msgstr "" +#: ../../c-api/synchronization.rst:247 ../../c-api/synchronization.rst:255 +#: ../../c-api/synchronization.rst:275 ../../c-api/synchronization.rst:293 +#: ../../c-api/synchronization.rst:301 msgid "The caller does not need to hold an :term:`attached thread state`." msgstr "" -msgid "Destroy *lock*. The lock should not be held by any thread when calling this." +#: ../../c-api/synchronization.rst:252 +msgid "" +"Destroy *lock*. The lock should not be held by any thread when calling this." msgstr "" +#: ../../c-api/synchronization.rst:260 msgid "Acquire *lock* with a timeout." msgstr "" -msgid "This will wait for *microseconds* microseconds to acquire the lock. If the timeout expires, this function returns :c:enumerator:`PY_LOCK_FAILURE`. If *microseconds* is ``-1``, this will wait indefinitely until the lock has been released." +#: ../../c-api/synchronization.rst:262 +msgid "" +"This will wait for *microseconds* microseconds to acquire the lock. If the " +"timeout expires, this function returns :c:enumerator:`PY_LOCK_FAILURE`. If " +"*microseconds* is ``-1``, this will wait indefinitely until the lock has " +"been released." msgstr "" -msgid "If *intr_flag* is ``1``, acquiring the lock may be interrupted by a signal, in which case this function returns :c:enumerator:`PY_LOCK_INTR`. Upon interruption, it's generally expected that the caller makes a call to :c:func:`Py_MakePendingCalls` to propagate an exception to Python code." +#: ../../c-api/synchronization.rst:267 +msgid "" +"If *intr_flag* is ``1``, acquiring the lock may be interrupted by a signal, " +"in which case this function returns :c:enumerator:`PY_LOCK_INTR`. Upon " +"interruption, it's generally expected that the caller makes a call " +"to :c:func:`Py_MakePendingCalls` to propagate an exception to Python code." msgstr "" -msgid "If the lock is successfully acquired, this function returns :c:enumerator:`PY_LOCK_ACQUIRED`." +#: ../../c-api/synchronization.rst:272 +msgid "" +"If the lock is successfully acquired, this function " +"returns :c:enumerator:`PY_LOCK_ACQUIRED`." msgstr "" +#: ../../c-api/synchronization.rst:280 msgid "Acquire *lock*." msgstr "" -msgid "If *waitflag* is ``1`` and another thread currently holds the lock, this function will wait until the lock can be acquired and will always return ``1``." +#: ../../c-api/synchronization.rst:282 +msgid "" +"If *waitflag* is ``1`` and another thread currently holds the lock, this " +"function will wait until the lock can be acquired and will always return " +"``1``." msgstr "" -msgid "If *waitflag* is ``0`` and another thread holds the lock, this function will not wait and instead return ``0``. If the lock is not held by any other thread, then this function will acquire it and return ``1``." +#: ../../c-api/synchronization.rst:286 +msgid "" +"If *waitflag* is ``0`` and another thread holds the lock, this function will " +"not wait and instead return ``0``. If the lock is not held by any other " +"thread, then this function will acquire it and return ``1``." msgstr "" -msgid "Unlike :c:func:`PyThread_acquire_lock_timed`, acquiring the lock cannot be interrupted by a signal." +#: ../../c-api/synchronization.rst:290 +msgid "" +"Unlike :c:func:`PyThread_acquire_lock_timed`, acquiring the lock cannot be " +"interrupted by a signal." msgstr "" -msgid "Release *lock*. If *lock* is not held, then this function issues a fatal error." +#: ../../c-api/synchronization.rst:298 +msgid "" +"Release *lock*. If *lock* is not held, then this function issues a fatal " +"error." msgstr "" diff --git a/c-api/sys.po b/c-api/sys.po index 06ca1bcf4..041e7ae94 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,263 +21,562 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/sys.rst:6 msgid "Operating System Utilities" msgstr "" -msgid "Return the file system representation for *path*. If the object is a :class:`str` or :class:`bytes` object, then a new :term:`strong reference` is returned. If the object implements the :class:`os.PathLike` interface, then :meth:`~os.PathLike.__fspath__` is returned as long as it is a :class:`str` or :class:`bytes` object. Otherwise :exc:`TypeError` is raised and ``NULL`` is returned." +#: ../../c-api/sys.rst:11 +msgid "" +"Return the file system representation for *path*. If the object is " +"a :class:`str` or :class:`bytes` object, then a new :term:`strong reference` " +"is returned. If the object implements the :class:`os.PathLike` interface, " +"then :meth:`~os.PathLike.__fspath__` is returned as long as it is " +"a :class:`str` or :class:`bytes` object. Otherwise :exc:`TypeError` is " +"raised and ``NULL`` is returned." msgstr "" -msgid "Return true (nonzero) if the standard I/O file *fp* with name *filename* is deemed interactive. This is the case for files for which ``isatty(fileno(fp))`` is true. If the :c:member:`PyConfig.interactive` is non-zero, this function also returns true if the *filename* pointer is ``NULL`` or if the name is equal to one of the strings ``''`` or ``'???'``." +#: ../../c-api/sys.rst:24 +msgid "" +"Return true (nonzero) if the standard I/O file *fp* with name *filename* is " +"deemed interactive. This is the case for files for which " +"``isatty(fileno(fp))`` is true. If the :c:member:`PyConfig.interactive` is " +"non-zero, this function also returns true if the *filename* pointer is " +"``NULL`` or if the name is equal to one of the strings ``''`` or " +"``'???'``." msgstr "" +#: ../../c-api/sys.rst:30 msgid "This function must not be called before Python is initialized." msgstr "" -msgid "Function to prepare some internal state before a process fork. This should be called before calling :c:func:`fork` or any similar function that clones the current process. Only available on systems where :c:func:`fork` is defined." +#: ../../c-api/sys.rst:35 +msgid "" +"Function to prepare some internal state before a process fork. This should " +"be called before calling :c:func:`fork` or any similar function that clones " +"the current process. Only available on systems where :c:func:`fork` is " +"defined." msgstr "" -msgid "The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread ` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_BeforeFork()``." +#: ../../c-api/sys.rst:41 +msgid "" +"The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread " +"` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_BeforeFork()``." msgstr "" -msgid "Function to update some internal state after a process fork. This should be called from the parent process after calling :c:func:`fork` or any similar function that clones the current process, regardless of whether process cloning was successful. Only available on systems where :c:func:`fork` is defined." +#: ../../c-api/sys.rst:51 +msgid "" +"Function to update some internal state after a process fork. This should be " +"called from the parent process after calling :c:func:`fork` or any similar " +"function that clones the current process, regardless of whether process " +"cloning was successful. Only available on systems where :c:func:`fork` is " +"defined." msgstr "" -msgid "The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread ` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_AfterFork_Parent()``." +#: ../../c-api/sys.rst:58 +msgid "" +"The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread " +"` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_AfterFork_Parent()``." msgstr "" -msgid "Function to update internal interpreter state after a process fork. This must be called from the child process after calling :c:func:`fork`, or any similar function that clones the current process, if there is any chance the process will call back into the Python interpreter. Only available on systems where :c:func:`fork` is defined." +#: ../../c-api/sys.rst:68 +msgid "" +"Function to update internal interpreter state after a process fork. This " +"must be called from the child process after calling :c:func:`fork`, or any " +"similar function that clones the current process, if there is any chance the " +"process will call back into the Python interpreter. Only available on " +"systems where :c:func:`fork` is defined." msgstr "" -msgid "The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread ` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_AfterFork_Child()``." +#: ../../c-api/sys.rst:75 +msgid "" +"The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread " +"` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_AfterFork_Child()``." msgstr "" -msgid ":func:`os.register_at_fork` allows registering custom Python functions to be called by :c:func:`PyOS_BeforeFork()`, :c:func:`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." +#: ../../c-api/sys.rst:83 +msgid "" +":func:`os.register_at_fork` allows registering custom Python functions to be " +"called by :c:func:`PyOS_BeforeFork()`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`." msgstr "" -msgid "Function to update some internal state after a process fork; this should be called in the new process if the Python interpreter will continue to be used. If a new executable is loaded into the new process, this function does not need to be called." +#: ../../c-api/sys.rst:90 +msgid "" +"Function to update some internal state after a process fork; this should be " +"called in the new process if the Python interpreter will continue to be " +"used. If a new executable is loaded into the new process, this function does " +"not need to be called." msgstr "" +#: ../../c-api/sys.rst:95 msgid "This function is superseded by :c:func:`PyOS_AfterFork_Child()`." msgstr "" -msgid "Return true when the interpreter runs out of stack space. This is a reliable check, but is only available when :c:macro:`!USE_STACKCHECK` is defined (currently on certain versions of Windows using the Microsoft Visual C++ compiler). :c:macro:`!USE_STACKCHECK` will be defined automatically; you should never change the definition in your own code." +#: ../../c-api/sys.rst:103 +msgid "" +"Return true when the interpreter runs out of stack space. This is a " +"reliable check, but is only available when :c:macro:`!USE_STACKCHECK` is " +"defined (currently on certain versions of Windows using the Microsoft Visual " +"C++ compiler). :c:macro:`!USE_STACKCHECK` will be defined automatically; you " +"should never change the definition in your own code." msgstr "" -msgid "Return the current signal handler for signal *i*. This is a thin wrapper around either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those functions directly!" +#: ../../c-api/sys.rst:115 +msgid "" +"Return the current signal handler for signal *i*. This is a thin wrapper " +"around either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those " +"functions directly!" msgstr "" -msgid "Set the signal handler for signal *i* to be *h*; return the old signal handler. This is a thin wrapper around either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those functions directly!" +#: ../../c-api/sys.rst:122 +msgid "" +"Set the signal handler for signal *i* to be *h*; return the old signal " +"handler. This is a thin wrapper around either :c:func:`!sigaction` " +"or :c:func:`!signal`. Do not call those functions directly!" msgstr "" +#: ../../c-api/sys.rst:129 msgid "Check if a :c:macro:`!SIGINT` signal has been received." msgstr "" -msgid "Returns ``1`` if a :c:macro:`!SIGINT` has occurred and clears the signal flag, or ``0`` otherwise." +#: ../../c-api/sys.rst:131 +msgid "" +"Returns ``1`` if a :c:macro:`!SIGINT` has occurred and clears the signal " +"flag, or ``0`` otherwise." msgstr "" -msgid "In most cases, you should prefer :c:func:`PyErr_CheckSignals` over this function. :c:func:`!PyErr_CheckSignals` invokes the appropriate signal handlers for all pending signals, allowing Python code to handle the signal properly. This function only detects :c:macro:`!SIGINT` and does not invoke any Python signal handlers." +#: ../../c-api/sys.rst:134 +msgid "" +"In most cases, you should prefer :c:func:`PyErr_CheckSignals` over this " +"function. :c:func:`!PyErr_CheckSignals` invokes the appropriate signal " +"handlers for all pending signals, allowing Python code to handle the signal " +"properly. This function only detects :c:macro:`!SIGINT` and does not invoke " +"any Python signal handlers." msgstr "" -msgid "This function is async-signal-safe and this function cannot fail. The caller must hold an :term:`attached thread state`." +#: ../../c-api/sys.rst:140 +msgid "" +"This function is async-signal-safe and this function cannot fail. The caller " +"must hold an :term:`attached thread state`." msgstr "" -msgid "This function should not be called directly: use the :c:type:`PyConfig` API with the :c:func:`PyConfig_SetBytesString` function which ensures that :ref:`Python is preinitialized `." +#: ../../c-api/sys.rst:147 +msgid "" +"This function should not be called directly: use the :c:type:`PyConfig` API " +"with the :c:func:`PyConfig_SetBytesString` function which ensures " +"that :ref:`Python is preinitialized `." msgstr "" -msgid "This function must not be called before :ref:`Python is preinitialized ` and so that the LC_CTYPE locale is properly configured: see the :c:func:`Py_PreInitialize` function." +#: ../../c-api/sys.rst:151 ../../c-api/sys.rst:218 +msgid "" +"This function must not be called before :ref:`Python is preinitialized ` and so that the LC_CTYPE locale is properly configured: see " +"the :c:func:`Py_PreInitialize` function." msgstr "" -msgid "Decode a byte string from the :term:`filesystem encoding and error handler`. If the error handler is :ref:`surrogateescape error handler `, undecodable bytes are decoded as characters in range U+DC80..U+DCFF; and if a byte sequence can be decoded as a surrogate character, the bytes are escaped using the surrogateescape error handler instead of decoding them." +#: ../../c-api/sys.rst:155 +msgid "" +"Decode a byte string from the :term:`filesystem encoding and error handler`. " +"If the error handler is :ref:`surrogateescape error handler " +"`, undecodable bytes are decoded as characters in range " +"U+DC80..U+DCFF; and if a byte sequence can be decoded as a surrogate " +"character, the bytes are escaped using the surrogateescape error handler " +"instead of decoding them." msgstr "" -msgid "Return a pointer to a newly allocated wide character string, use :c:func:`PyMem_RawFree` to free the memory. If size is not ``NULL``, write the number of wide characters excluding the null character into ``*size``" +#: ../../c-api/sys.rst:162 +msgid "" +"Return a pointer to a newly allocated wide character string, " +"use :c:func:`PyMem_RawFree` to free the memory. If size is not ``NULL``, " +"write the number of wide characters excluding the null character into " +"``*size``" msgstr "" -msgid "Return ``NULL`` on decoding error or memory allocation error. If *size* is not ``NULL``, ``*size`` is set to ``(size_t)-1`` on memory error or set to ``(size_t)-2`` on decoding error." +#: ../../c-api/sys.rst:166 +msgid "" +"Return ``NULL`` on decoding error or memory allocation error. If *size* is " +"not ``NULL``, ``*size`` is set to ``(size_t)-1`` on memory error or set to " +"``(size_t)-2`` on decoding error." msgstr "" -msgid "The :term:`filesystem encoding and error handler` are selected by :c:func:`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +#: ../../c-api/sys.rst:170 ../../c-api/sys.rst:210 +msgid "" +"The :term:`filesystem encoding and error handler` are selected " +"by :c:func:`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" -msgid "Decoding errors should never happen, unless there is a bug in the C library." +#: ../../c-api/sys.rst:174 +msgid "" +"Decoding errors should never happen, unless there is a bug in the C library." msgstr "" -msgid "Use the :c:func:`Py_EncodeLocale` function to encode the character string back to a byte string." +#: ../../c-api/sys.rst:177 +msgid "" +"Use the :c:func:`Py_EncodeLocale` function to encode the character string " +"back to a byte string." msgstr "" -msgid "The :c:func:`PyUnicode_DecodeFSDefaultAndSize` and :c:func:`PyUnicode_DecodeLocaleAndSize` functions." +#: ../../c-api/sys.rst:182 +msgid "" +"The :c:func:`PyUnicode_DecodeFSDefaultAndSize` " +"and :c:func:`PyUnicode_DecodeLocaleAndSize` functions." msgstr "" -msgid "The function now uses the UTF-8 encoding in the :ref:`Python UTF-8 Mode `." +#: ../../c-api/sys.rst:187 ../../c-api/sys.rst:229 +msgid "" +"The function now uses the UTF-8 encoding in the :ref:`Python UTF-8 Mode " +"`." msgstr "" -msgid "The function now uses the UTF-8 encoding on Windows if :c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero;" +#: ../../c-api/sys.rst:191 +msgid "" +"The function now uses the UTF-8 encoding on Windows " +"if :c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero;" msgstr "" -msgid "Encode a wide character string to the :term:`filesystem encoding and error handler`. If the error handler is :ref:`surrogateescape error handler `, surrogate characters in the range U+DC80..U+DCFF are converted to bytes 0x80..0xFF." +#: ../../c-api/sys.rst:198 +msgid "" +"Encode a wide character string to the :term:`filesystem encoding and error " +"handler`. If the error handler is :ref:`surrogateescape error handler " +"`, surrogate characters in the range U+DC80..U+DCFF are " +"converted to bytes 0x80..0xFF." msgstr "" -msgid "Return a pointer to a newly allocated byte string, use :c:func:`PyMem_Free` to free the memory. Return ``NULL`` on encoding error or memory allocation error." +#: ../../c-api/sys.rst:203 +msgid "" +"Return a pointer to a newly allocated byte string, use :c:func:`PyMem_Free` " +"to free the memory. Return ``NULL`` on encoding error or memory allocation " +"error." msgstr "" -msgid "If error_pos is not ``NULL``, ``*error_pos`` is set to ``(size_t)-1`` on success, or set to the index of the invalid character on encoding error." +#: ../../c-api/sys.rst:207 +msgid "" +"If error_pos is not ``NULL``, ``*error_pos`` is set to ``(size_t)-1`` on " +"success, or set to the index of the invalid character on encoding error." msgstr "" -msgid "Use the :c:func:`Py_DecodeLocale` function to decode the bytes string back to a wide character string." +#: ../../c-api/sys.rst:214 +msgid "" +"Use the :c:func:`Py_DecodeLocale` function to decode the bytes string back " +"to a wide character string." msgstr "" -msgid "The :c:func:`PyUnicode_EncodeFSDefault` and :c:func:`PyUnicode_EncodeLocale` functions." +#: ../../c-api/sys.rst:224 +msgid "" +"The :c:func:`PyUnicode_EncodeFSDefault` and :c:func:`PyUnicode_EncodeLocale` " +"functions." msgstr "" -msgid "The function now uses the UTF-8 encoding on Windows if :c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero." +#: ../../c-api/sys.rst:233 +msgid "" +"The function now uses the UTF-8 encoding on Windows " +"if :c:member:`PyPreConfig.legacy_windows_fs_encoding` is zero." msgstr "" -msgid "Similar to :c:func:`!fopen`, but *path* is a Python object and an exception is set on error." +#: ../../c-api/sys.rst:239 +msgid "" +"Similar to :c:func:`!fopen`, but *path* is a Python object and an exception " +"is set on error." msgstr "" -msgid "*path* must be a :class:`str` object, a :class:`bytes` object, or a :term:`path-like object`." +#: ../../c-api/sys.rst:242 +msgid "" +"*path* must be a :class:`str` object, a :class:`bytes` object, or " +"a :term:`path-like object`." msgstr "" -msgid "On success, return the new file pointer. On error, set an exception and return ``NULL``." +#: ../../c-api/sys.rst:245 +msgid "" +"On success, return the new file pointer. On error, set an exception and " +"return ``NULL``." msgstr "" -msgid "The file must be closed by :c:func:`Py_fclose` rather than calling directly :c:func:`!fclose`." +#: ../../c-api/sys.rst:248 +msgid "" +"The file must be closed by :c:func:`Py_fclose` rather than calling " +"directly :c:func:`!fclose`." msgstr "" +#: ../../c-api/sys.rst:251 msgid "The file descriptor is created non-inheritable (:pep:`446`)." msgstr "" +#: ../../c-api/sys.rst:253 msgid "The caller must have an :term:`attached thread state`." msgstr "" +#: ../../c-api/sys.rst:260 msgid "Close a file that was opened by :c:func:`Py_fopen`." msgstr "" -msgid "On success, return ``0``. On error, return ``EOF`` and ``errno`` is set to indicate the error. In either case, any further access (including another call to :c:func:`Py_fclose`) to the stream results in undefined behavior." +#: ../../c-api/sys.rst:262 +msgid "" +"On success, return ``0``. On error, return ``EOF`` and ``errno`` is set to " +"indicate the error. In either case, any further access (including another " +"call to :c:func:`Py_fclose`) to the stream results in undefined behavior." msgstr "" +#: ../../c-api/sys.rst:273 msgid "System Functions" msgstr "" -msgid "These are utility functions that make functionality from the :mod:`sys` module accessible to C code. They all work with the current interpreter thread's :mod:`sys` module's dict, which is contained in the internal thread state structure." +#: ../../c-api/sys.rst:275 +msgid "" +"These are utility functions that make functionality from the :mod:`sys` " +"module accessible to C code. They all work with the current interpreter " +"thread's :mod:`sys` module's dict, which is contained in the internal thread " +"state structure." msgstr "" -msgid "Return the object *name* from the :mod:`sys` module or ``NULL`` if it does not exist, without setting an exception." +#: ../../c-api/sys.rst:281 +msgid "" +"Return the object *name* from the :mod:`sys` module or ``NULL`` if it does " +"not exist, without setting an exception." msgstr "" -msgid "Set *name* in the :mod:`sys` module to *v* unless *v* is ``NULL``, in which case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` on error." +#: ../../c-api/sys.rst:286 +msgid "" +"Set *name* in the :mod:`sys` module to *v* unless *v* is ``NULL``, in which " +"case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` " +"on error." msgstr "" -msgid "Reset :data:`sys.warnoptions` to an empty list. This function may be called prior to :c:func:`Py_Initialize`." +#: ../../c-api/sys.rst:292 +msgid "" +"Reset :data:`sys.warnoptions` to an empty list. This function may be called " +"prior to :c:func:`Py_Initialize`." msgstr "" +#: ../../c-api/sys.rst:295 msgid "Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." msgstr "" -msgid "Write the output string described by *format* to :data:`sys.stdout`. No exceptions are raised, even if truncation occurs (see below)." +#: ../../c-api/sys.rst:300 +msgid "" +"Write the output string described by *format* to :data:`sys.stdout`. No " +"exceptions are raised, even if truncation occurs (see below)." msgstr "" -msgid "*format* should limit the total size of the formatted output string to 1000 bytes or less -- after 1000 bytes, the output string is truncated. In particular, this means that no unrestricted \"%s\" formats should occur; these should be limited using \"%.s\" where is a decimal number calculated so that plus the maximum size of other formatted text does not exceed 1000 bytes. Also watch out for \"%f\", which can print hundreds of digits for very large numbers." +#: ../../c-api/sys.rst:303 +msgid "" +"*format* should limit the total size of the formatted output string to 1000 " +"bytes or less -- after 1000 bytes, the output string is truncated. In " +"particular, this means that no unrestricted \"%s\" formats should occur; " +"these should be limited using \"%.s\" where is a decimal number " +"calculated so that plus the maximum size of other formatted text does " +"not exceed 1000 bytes. Also watch out for \"%f\", which can print hundreds " +"of digits for very large numbers." msgstr "" -msgid "If a problem occurs, or :data:`sys.stdout` is unset, the formatted message is written to the real (C level) *stdout*." +#: ../../c-api/sys.rst:311 +msgid "" +"If a problem occurs, or :data:`sys.stdout` is unset, the formatted message " +"is written to the real (C level) *stdout*." msgstr "" -msgid "As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* instead." +#: ../../c-api/sys.rst:316 +msgid "" +"As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* " +"instead." msgstr "" -msgid "Function similar to PySys_WriteStdout() but format the message using :c:func:`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary length." +#: ../../c-api/sys.rst:321 +msgid "" +"Function similar to PySys_WriteStdout() but format the message " +"using :c:func:`PyUnicode_FromFormatV` and don't truncate the message to an " +"arbitrary length." msgstr "" -msgid "As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* instead." +#: ../../c-api/sys.rst:329 +msgid "" +"As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* " +"instead." msgstr "" -msgid "Return the current dictionary of :option:`-X` options, similarly to :data:`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." +#: ../../c-api/sys.rst:336 +msgid "" +"Return the current dictionary of :option:`-X` options, similarly " +"to :data:`sys._xoptions`. On error, ``NULL`` is returned and an exception " +"is set." msgstr "" -msgid "Raise an auditing event with any active hooks. Return zero for success and non-zero with an exception set on failure." +#: ../../c-api/sys.rst:345 +msgid "" +"Raise an auditing event with any active hooks. Return zero for success and " +"non-zero with an exception set on failure." msgstr "" +#: ../../c-api/sys.rst:348 msgid "The *event* string argument must not be *NULL*." msgstr "" -msgid "If any hooks have been added, *format* and other arguments will be used to construct a tuple to pass. Apart from ``N``, the same format characters as used in :c:func:`Py_BuildValue` are available. If the built value is not a tuple, it will be added into a single-element tuple." +#: ../../c-api/sys.rst:350 +msgid "" +"If any hooks have been added, *format* and other arguments will be used to " +"construct a tuple to pass. Apart from ``N``, the same format characters as " +"used in :c:func:`Py_BuildValue` are available. If the built value is not a " +"tuple, it will be added into a single-element tuple." msgstr "" -msgid "The ``N`` format option must not be used. It consumes a reference, but since there is no way to know whether arguments to this function will be consumed, using it may cause reference leaks." +#: ../../c-api/sys.rst:355 +msgid "" +"The ``N`` format option must not be used. It consumes a reference, but since " +"there is no way to know whether arguments to this function will be consumed, " +"using it may cause reference leaks." msgstr "" -msgid "Note that ``#`` format characters should always be treated as :c:type:`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." +#: ../../c-api/sys.rst:359 +msgid "" +"Note that ``#`` format characters should always be treated " +"as :c:type:`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was " +"defined." msgstr "" +#: ../../c-api/sys.rst:362 msgid ":func:`sys.audit` performs the same function from Python code." msgstr "" +#: ../../c-api/sys.rst:364 msgid "See also :c:func:`PySys_AuditTuple`." msgstr "" -msgid "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an unavoidable deprecation warning was raised." +#: ../../c-api/sys.rst:370 +msgid "" +"Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " +"unavoidable deprecation warning was raised." msgstr "" -msgid "Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. *args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." +#: ../../c-api/sys.rst:376 +msgid "" +"Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. " +"*args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." msgstr "" -msgid "Append the callable *hook* to the list of active auditing hooks. Return zero on success and non-zero on failure. If the runtime has been initialized, also set an error on failure. Hooks added through this API are called for all interpreters created by the runtime." +#: ../../c-api/sys.rst:384 +msgid "" +"Append the callable *hook* to the list of active auditing hooks. Return zero " +"on success and non-zero on failure. If the runtime has been initialized, " +"also set an error on failure. Hooks added through this API are called for " +"all interpreters created by the runtime." msgstr "" -msgid "The *userData* pointer is passed into the hook function. Since hook functions may be called from different runtimes, this pointer should not refer directly to Python state." +#: ../../c-api/sys.rst:390 +msgid "" +"The *userData* pointer is passed into the hook function. Since hook " +"functions may be called from different runtimes, this pointer should not " +"refer directly to Python state." msgstr "" -msgid "This function is safe to call before :c:func:`Py_Initialize`. When called after runtime initialization, existing audit hooks are notified and may silently abort the operation by raising an error subclassed from :class:`Exception` (other errors will not be silenced)." +#: ../../c-api/sys.rst:394 +msgid "" +"This function is safe to call before :c:func:`Py_Initialize`. When called " +"after runtime initialization, existing audit hooks are notified and may " +"silently abort the operation by raising an error subclassed " +"from :class:`Exception` (other errors will not be silenced)." msgstr "" -msgid "The hook function is always called with an :term:`attached thread state` by the Python interpreter that raised the event." +#: ../../c-api/sys.rst:399 +msgid "" +"The hook function is always called with an :term:`attached thread state` by " +"the Python interpreter that raised the event." msgstr "" -msgid "See :pep:`578` for a detailed description of auditing. Functions in the runtime and standard library that raise events are listed in the :ref:`audit events table `. Details are in each function's documentation." +#: ../../c-api/sys.rst:402 +msgid "" +"See :pep:`578` for a detailed description of auditing. Functions in the " +"runtime and standard library that raise events are listed in the :ref:`audit " +"events table `. Details are in each function's documentation." msgstr "" -msgid "If the interpreter is initialized, this function raises an auditing event ``sys.addaudithook`` with no arguments. If any existing hooks raise an exception derived from :class:`Exception`, the new hook will not be added and the exception is cleared. As a result, callers cannot assume that their hook has been added unless they control all existing hooks." +#: ../../c-api/sys.rst:407 ../../c-api/sys.rst:409 +msgid "" +"If the interpreter is initialized, this function raises an auditing event " +"``sys.addaudithook`` with no arguments. If any existing hooks raise an " +"exception derived from :class:`Exception`, the new hook will not be added " +"and the exception is cleared. As a result, callers cannot assume that their " +"hook has been added unless they control all existing hooks." msgstr "" -msgid "The type of the hook function. *event* is the C string event argument passed to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed to be a :c:type:`PyTupleObject`. *userData* is the argument passed to PySys_AddAuditHook()." +#: ../../c-api/sys.rst:418 +msgid "" +"The type of the hook function. *event* is the C string event argument passed " +"to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed " +"to be a :c:type:`PyTupleObject`. *userData* is the argument passed to " +"PySys_AddAuditHook()." msgstr "" +#: ../../c-api/sys.rst:430 msgid "Process Control" msgstr "" -msgid "Print a fatal error message and kill the process. No cleanup is performed. This function should only be invoked when a condition is detected that would make it dangerous to continue using the Python interpreter; e.g., when the object administration appears to be corrupted. On Unix, the standard C library function :c:func:`!abort` is called which will attempt to produce a :file:`core` file." +#: ../../c-api/sys.rst:437 +msgid "" +"Print a fatal error message and kill the process. No cleanup is performed. " +"This function should only be invoked when a condition is detected that would " +"make it dangerous to continue using the Python interpreter; e.g., when the " +"object administration appears to be corrupted. On Unix, the standard C " +"library function :c:func:`!abort` is called which will attempt to produce " +"a :file:`core` file." msgstr "" -msgid "The ``Py_FatalError()`` function is replaced with a macro which logs automatically the name of the current function, unless the ``Py_LIMITED_API`` macro is defined." +#: ../../c-api/sys.rst:444 +msgid "" +"The ``Py_FatalError()`` function is replaced with a macro which logs " +"automatically the name of the current function, unless the " +"``Py_LIMITED_API`` macro is defined." msgstr "" +#: ../../c-api/sys.rst:448 msgid "Log the function name automatically." msgstr "" -msgid "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls the standard C library function ``exit(status)``. If :c:func:`Py_FinalizeEx` indicates an error, the exit status is set to 120." +#: ../../c-api/sys.rst:458 +msgid "" +"Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " +"the standard C library function ``exit(status)``. " +"If :c:func:`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" +#: ../../c-api/sys.rst:462 msgid "Errors from finalization no longer ignored." msgstr "" -msgid "Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The cleanup function will be called with no arguments and should return no value. At most 32 cleanup functions can be registered. When the registration is successful, :c:func:`Py_AtExit` returns ``0``; on failure, it returns ``-1``. The cleanup function registered last is called first. Each cleanup function will be called at most once. Since Python's internal finalization will have completed before the cleanup function, no Python APIs should be called by *func*." +#: ../../c-api/sys.rst:472 +msgid "" +"Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The " +"cleanup function will be called with no arguments and should return no " +"value. At most 32 cleanup functions can be registered. When the " +"registration is successful, :c:func:`Py_AtExit` returns ``0``; on failure, " +"it returns ``-1``. The cleanup function registered last is called first. " +"Each cleanup function will be called at most once. Since Python's internal " +"finalization will have completed before the cleanup function, no Python APIs " +"should be called by *func*." msgstr "" +#: ../../c-api/sys.rst:482 msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." msgstr "" +#: ../../c-api/sys.rst:101 msgid "USE_STACKCHECK (C macro)" msgstr "" +#: ../../c-api/sys.rst:435 msgid "abort (C function)" msgstr "" +#: ../../c-api/sys.rst:454 ../../c-api/sys.rst:468 msgid "Py_FinalizeEx (C function)" msgstr "" +#: ../../c-api/sys.rst:454 msgid "exit (C function)" msgstr "" +#: ../../c-api/sys.rst:468 msgid "cleanup functions" msgstr "" diff --git a/c-api/threads.po b/c-api/threads.po index b2fa14bf6..ef891cdc4 100644 --- a/c-api/threads.po +++ b/c-api/threads.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,63 +19,126 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/threads.rst:6 msgid "Thread states and the global interpreter lock" msgstr "" -msgid "Unless on a :term:`free-threaded build` of :term:`CPython`, the Python interpreter is generally not thread-safe. In order to support multi-threaded Python programs, there's a global lock, called the :term:`global interpreter lock` or :term:`GIL`, that must be held by a thread before accessing Python objects. Without the lock, even the simplest operations could cause problems in a multi-threaded program: for example, when two threads simultaneously increment the reference count of the same object, the reference count could end up being incremented only once instead of twice." +#: ../../c-api/threads.rst:13 +msgid "" +"Unless on a :term:`free-threaded build` of :term:`CPython`, the Python " +"interpreter is generally not thread-safe. In order to support multi-" +"threaded Python programs, there's a global lock, called the :term:`global " +"interpreter lock` or :term:`GIL`, that must be held by a thread before " +"accessing Python objects. Without the lock, even the simplest operations " +"could cause problems in a multi-threaded program: for example, when two " +"threads simultaneously increment the reference count of the same object, the " +"reference count could end up being incremented only once instead of twice." msgstr "" -msgid "As such, only a thread that holds the GIL may operate on Python objects or invoke Python's C API." +#: ../../c-api/threads.rst:22 +msgid "" +"As such, only a thread that holds the GIL may operate on Python objects or " +"invoke Python's C API." msgstr "" -msgid "In order to emulate concurrency, the interpreter regularly tries to switch threads between bytecode instructions (see :func:`sys.setswitchinterval`). This is why locks are also necessary for thread-safety in pure-Python code." +#: ../../c-api/threads.rst:27 +msgid "" +"In order to emulate concurrency, the interpreter regularly tries to switch " +"threads between bytecode instructions (see :func:`sys.setswitchinterval`). " +"This is why locks are also necessary for thread-safety in pure-Python code." msgstr "" -msgid "Additionally, the global interpreter lock is released around blocking I/O operations, such as reading or writing to a file. From the C API, this is done by :ref:`detaching the thread state `." +#: ../../c-api/threads.rst:31 +msgid "" +"Additionally, the global interpreter lock is released around blocking I/O " +"operations, such as reading or writing to a file. From the C API, this is " +"done by :ref:`detaching the thread state `." msgstr "" -msgid "The Python interpreter keeps some thread-local information inside a data structure called :c:type:`PyThreadState`, known as a :term:`thread state`. Each thread has a thread-local pointer to a :c:type:`PyThreadState`; a thread state referenced by this pointer is considered to be :term:`attached `." +#: ../../c-api/threads.rst:39 +msgid "" +"The Python interpreter keeps some thread-local information inside a data " +"structure called :c:type:`PyThreadState`, known as a :term:`thread state`. " +"Each thread has a thread-local pointer to a :c:type:`PyThreadState`; a " +"thread state referenced by this pointer is considered to be :term:`attached " +"`." msgstr "" -msgid "A thread can only have one :term:`attached thread state` at a time. An attached thread state is typically analogous with holding the GIL, except on free-threaded builds. On builds with the GIL enabled, attaching a thread state will block until the GIL can be acquired. However, even on builds with the GIL disabled, it is still required to have an attached thread state, as the interpreter needs to keep track of which threads may access Python objects." +#: ../../c-api/threads.rst:44 +msgid "" +"A thread can only have one :term:`attached thread state` at a time. An " +"attached thread state is typically analogous with holding the GIL, except on " +"free-threaded builds. On builds with the GIL enabled, attaching a thread " +"state will block until the GIL can be acquired. However, even on builds with " +"the GIL disabled, it is still required to have an attached thread state, as " +"the interpreter needs to keep track of which threads may access Python " +"objects." msgstr "" -msgid "Even on the free-threaded build, attaching a thread state may block, as the GIL can be re-enabled or threads might be temporarily suspended (such as during a garbage collection)." +#: ../../c-api/threads.rst:53 +msgid "" +"Even on the free-threaded build, attaching a thread state may block, as the " +"GIL can be re-enabled or threads might be temporarily suspended (such as " +"during a garbage collection)." msgstr "" -msgid "Generally, there will always be an attached thread state when using Python's C API, including during embedding and when implementing methods, so it's uncommon to need to set up a thread state on your own. Only in some specific cases, such as in a :c:macro:`Py_BEGIN_ALLOW_THREADS` block or in a fresh thread, will the thread not have an attached thread state. If uncertain, check if :c:func:`PyThreadState_GetUnchecked` returns ``NULL``." +#: ../../c-api/threads.rst:57 +msgid "" +"Generally, there will always be an attached thread state when using Python's " +"C API, including during embedding and when implementing methods, so it's " +"uncommon to need to set up a thread state on your own. Only in some specific " +"cases, such as in a :c:macro:`Py_BEGIN_ALLOW_THREADS` block or in a fresh " +"thread, will the thread not have an attached thread state. If uncertain, " +"check if :c:func:`PyThreadState_GetUnchecked` returns ``NULL``." msgstr "" -msgid "If it turns out that you do need to create a thread state, call :c:func:`PyThreadState_New` followed by :c:func:`PyThreadState_Swap`, or use the dangerous :c:func:`PyGILState_Ensure` function." +#: ../../c-api/threads.rst:64 +msgid "" +"If it turns out that you do need to create a thread state, " +"call :c:func:`PyThreadState_New` followed by :c:func:`PyThreadState_Swap`, " +"or use the dangerous :c:func:`PyGILState_Ensure` function." msgstr "" +#: ../../c-api/threads.rst:72 msgid "Detaching the thread state from extension code" msgstr "" -msgid "Most extension code manipulating the :term:`thread state` has the following simple structure::" +#: ../../c-api/threads.rst:74 +msgid "" +"Most extension code manipulating the :term:`thread state` has the following " +"simple structure::" msgstr "" +#: ../../c-api/threads.rst:77 msgid "" "Save the thread state in a local variable.\n" "... Do some blocking I/O operation ...\n" "Restore the thread state from the local variable." msgstr "" +#: ../../c-api/threads.rst:81 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" +#: ../../c-api/threads.rst:83 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -msgid "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the block." +#: ../../c-api/threads.rst:91 +msgid "" +"The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " +"hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " +"block." msgstr "" +#: ../../c-api/threads.rst:95 msgid "The block above expands to the following code::" msgstr "" +#: ../../c-api/threads.rst:97 msgid "" "PyThreadState *_save;\n" "\n" @@ -84,63 +147,137 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" +#: ../../c-api/threads.rst:107 msgid "Here is how these functions work:" msgstr "" -msgid "The attached thread state implies that the GIL is held for the interpreter. To detach it, :c:func:`PyEval_SaveThread` is called and the result is stored in a local variable." +#: ../../c-api/threads.rst:109 +msgid "" +"The attached thread state implies that the GIL is held for the interpreter. " +"To detach it, :c:func:`PyEval_SaveThread` is called and the result is stored " +"in a local variable." msgstr "" -msgid "By detaching the thread state, the GIL is released, which allows other threads to attach to the interpreter and execute while the current thread performs blocking I/O. When the I/O operation is complete, the old thread state is reattached by calling :c:func:`PyEval_RestoreThread`, which will wait until the GIL can be acquired." +#: ../../c-api/threads.rst:113 +msgid "" +"By detaching the thread state, the GIL is released, which allows other " +"threads to attach to the interpreter and execute while the current thread " +"performs blocking I/O. When the I/O operation is complete, the old thread " +"state is reattached by calling :c:func:`PyEval_RestoreThread`, which will " +"wait until the GIL can be acquired." msgstr "" -msgid "Performing blocking I/O is the most common use case for detaching the thread state, but it is also useful to call it over long-running native code that doesn't need access to Python objects or Python's C API. For example, the standard :mod:`zlib` and :mod:`hashlib` modules detach the :term:`thread state ` when compressing or hashing data." +#: ../../c-api/threads.rst:120 +msgid "" +"Performing blocking I/O is the most common use case for detaching the thread " +"state, but it is also useful to call it over long-running native code that " +"doesn't need access to Python objects or Python's C API. For example, the " +"standard :mod:`zlib` and :mod:`hashlib` modules detach the :term:`thread " +"state ` when compressing or hashing data." msgstr "" -msgid "On a :term:`free-threaded build`, the :term:`GIL` is usually out of the question, but **detaching the thread state is still required**, because the interpreter periodically needs to block all threads to get a consistent view of Python objects without the risk of race conditions. For example, CPython currently suspends all threads for a short period of time while running the garbage collector." +#: ../../c-api/threads.rst:127 +msgid "" +"On a :term:`free-threaded build`, the :term:`GIL` is usually out of the " +"question, but **detaching the thread state is still required**, because the " +"interpreter periodically needs to block all threads to get a consistent view " +"of Python objects without the risk of race conditions. For example, CPython " +"currently suspends all threads for a short period of time while running the " +"garbage collector." msgstr "" -msgid "Detaching the thread state can lead to unexpected behavior during interpreter finalization. See :ref:`cautions-regarding-runtime-finalization` for more details." +#: ../../c-api/threads.rst:136 +msgid "" +"Detaching the thread state can lead to unexpected behavior during " +"interpreter finalization. See :ref:`cautions-regarding-runtime-finalization` " +"for more details." msgstr "" +#: ../../c-api/threads.rst:142 msgid "APIs" msgstr "" -msgid "The following macros are normally used without a trailing semicolon; look for example usage in the Python source distribution." +#: ../../c-api/threads.rst:144 +msgid "" +"The following macros are normally used without a trailing semicolon; look " +"for example usage in the Python source distribution." msgstr "" -msgid "These macros are still necessary on the :term:`free-threaded build` to prevent deadlocks." +#: ../../c-api/threads.rst:149 +msgid "" +"These macros are still necessary on the :term:`free-threaded build` to " +"prevent deadlocks." msgstr "" -msgid "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();``. Note that it contains an opening brace; it must be matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further discussion of this macro." +#: ../../c-api/threads.rst:154 +msgid "" +"This macro expands to ``{ PyThreadState *_save; _save = " +"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " +"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " +"for further discussion of this macro." msgstr "" -msgid "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it contains a closing brace; it must be matched with an earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this macro." +#: ../../c-api/threads.rst:162 +msgid "" +"This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " +"contains a closing brace; it must be matched with an " +"earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further " +"discussion of this macro." msgstr "" -msgid "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +#: ../../c-api/threads.rst:170 +msgid "" +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " +"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -msgid "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable declaration." +#: ../../c-api/threads.rst:176 +msgid "" +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " +"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"declaration." msgstr "" +#: ../../c-api/threads.rst:182 msgid "Non-Python created threads" msgstr "" -msgid "When threads are created using the dedicated Python APIs (such as the :mod:`threading` module), a thread state is automatically associated with them, However, when a thread is created from native code (for example, by a third-party library with its own thread management), it doesn't hold an attached thread state." +#: ../../c-api/threads.rst:184 +msgid "" +"When threads are created using the dedicated Python APIs (such as " +"the :mod:`threading` module), a thread state is automatically associated " +"with them, However, when a thread is created from native code (for example, " +"by a third-party library with its own thread management), it doesn't hold an " +"attached thread state." msgstr "" -msgid "If you need to call Python code from these threads (often this will be part of a callback API provided by the aforementioned third-party library), you must first register these threads with the interpreter by creating a new thread state and attaching it." +#: ../../c-api/threads.rst:190 +msgid "" +"If you need to call Python code from these threads (often this will be part " +"of a callback API provided by the aforementioned third-party library), you " +"must first register these threads with the interpreter by creating a new " +"thread state and attaching it." msgstr "" -msgid "The most robust way to do this is through :c:func:`PyThreadState_New` followed by :c:func:`PyThreadState_Swap`." +#: ../../c-api/threads.rst:195 +msgid "" +"The most robust way to do this is through :c:func:`PyThreadState_New` " +"followed by :c:func:`PyThreadState_Swap`." msgstr "" -msgid "``PyThreadState_New`` requires an argument pointing to the desired interpreter; such a pointer can be acquired via a call to :c:func:`PyInterpreterState_Get` from the code where the thread was created." +#: ../../c-api/threads.rst:199 +msgid "" +"``PyThreadState_New`` requires an argument pointing to the desired " +"interpreter; such a pointer can be acquired via a call " +"to :c:func:`PyInterpreterState_Get` from the code where the thread was " +"created." msgstr "" +#: ../../c-api/threads.rst:204 msgid "For example::" msgstr "" +#: ../../c-api/threads.rst:206 msgid "" "/* The return value of PyInterpreterState_Get() from the\n" " function that created this thread. */\n" @@ -162,24 +299,44 @@ msgid "" "PyThreadState_DeleteCurrent();" msgstr "" -msgid "If the interpreter finalized before ``PyThreadState_Swap`` was called, then ``interp`` will be a dangling pointer!" +#: ../../c-api/threads.rst:227 +msgid "" +"If the interpreter finalized before ``PyThreadState_Swap`` was called, then " +"``interp`` will be a dangling pointer!" msgstr "" +#: ../../c-api/threads.rst:233 msgid "Legacy API" msgstr "" -msgid "Another common pattern to call Python code from a non-Python thread is to use :c:func:`PyGILState_Ensure` followed by a call to :c:func:`PyGILState_Release`." +#: ../../c-api/threads.rst:235 +msgid "" +"Another common pattern to call Python code from a non-Python thread is to " +"use :c:func:`PyGILState_Ensure` followed by a call " +"to :c:func:`PyGILState_Release`." msgstr "" -msgid "These functions do not work well when multiple interpreters exist in the Python process. If no Python interpreter has ever been used in the current thread (which is common for threads created outside Python), ``PyGILState_Ensure`` will create and attach a thread state for the \"main\" interpreter (the first interpreter in the Python process)." +#: ../../c-api/threads.rst:238 +msgid "" +"These functions do not work well when multiple interpreters exist in the " +"Python process. If no Python interpreter has ever been used in the current " +"thread (which is common for threads created outside Python), " +"``PyGILState_Ensure`` will create and attach a thread state for the \"main\" " +"interpreter (the first interpreter in the Python process)." msgstr "" -msgid "Additionally, these functions have thread-safety issues during interpreter finalization. Using ``PyGILState_Ensure`` during finalization will likely crash the process." +#: ../../c-api/threads.rst:244 +msgid "" +"Additionally, these functions have thread-safety issues during interpreter " +"finalization. Using ``PyGILState_Ensure`` during finalization will likely " +"crash the process." msgstr "" +#: ../../c-api/threads.rst:248 msgid "Usage of these functions look like such::" msgstr "" +#: ../../c-api/threads.rst:250 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -192,395 +349,783 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" +#: ../../c-api/threads.rst:264 msgid "Cautions about fork()" msgstr "" -msgid "Another important thing to note about threads is their behaviour in the face of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a process forks only the thread that issued the fork will exist. This has a concrete impact both on how locks must be handled and on all stored state in CPython's runtime." -msgstr "" - -msgid "The fact that only the \"current\" thread remains means any locks held by other threads will never be released. Python solves this for :func:`os.fork` by acquiring the locks it uses internally before the fork, and releasing them afterwards. In addition, it resets any :ref:`lock-objects` in the child. When extending or embedding Python, there is no way to inform Python of additional (non-Python) locks that need to be acquired before or reset after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to be used to accomplish the same thing. Additionally, when extending or embedding Python, calling :c:func:`fork` directly rather than through :func:`os.fork` (and returning to or calling into Python) may result in a deadlock by one of Python's internal locks being held by a thread that is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary locks, but is not always able to." -msgstr "" - -msgid "The fact that all other threads go away also means that CPython's runtime state there must be cleaned up properly, which :func:`os.fork` does. This means finalizing all other :c:type:`PyThreadState` objects belonging to the current interpreter and all other :c:type:`PyInterpreterState` objects. Due to this and the special nature of the :ref:`\"main\" interpreter `, :c:func:`fork` should only be called in that interpreter's \"main\" thread, where the CPython global runtime was originally initialized. The only exception is if :c:func:`exec` will be called immediately after." +#: ../../c-api/threads.rst:266 +msgid "" +"Another important thing to note about threads is their behaviour in the face " +"of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " +"process forks only the thread that issued the fork will exist. This has a " +"concrete impact both on how locks must be handled and on all stored state in " +"CPython's runtime." msgstr "" +#: ../../c-api/threads.rst:272 +msgid "" +"The fact that only the \"current\" thread remains means any locks held by " +"other threads will never be released. Python solves this for :func:`os.fork` " +"by acquiring the locks it uses internally before the fork, and releasing " +"them afterwards. In addition, it resets any :ref:`lock-objects` in the " +"child. When extending or embedding Python, there is no way to inform Python " +"of additional (non-Python) locks that need to be acquired before or reset " +"after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " +"be used to accomplish the same thing. Additionally, when extending or " +"embedding Python, calling :c:func:`fork` directly rather than " +"through :func:`os.fork` (and returning to or calling into Python) may result " +"in a deadlock by one of Python's internal locks being held by a thread that " +"is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the " +"necessary locks, but is not always able to." +msgstr "" + +#: ../../c-api/threads.rst:287 +msgid "" +"The fact that all other threads go away also means that CPython's runtime " +"state there must be cleaned up properly, which :func:`os.fork` does. This " +"means finalizing all other :c:type:`PyThreadState` objects belonging to the " +"current interpreter and all other :c:type:`PyInterpreterState` objects. Due " +"to this and the special nature of the :ref:`\"main\" interpreter `, :c:func:`fork` should only be called in that " +"interpreter's \"main\" thread, where the CPython global runtime was " +"originally initialized. The only exception is if :c:func:`exec` will be " +"called immediately after." +msgstr "" + +#: ../../c-api/threads.rst:300 msgid "High-level APIs" msgstr "" -msgid "These are the most commonly used types and functions when writing multi-threaded C extensions." +#: ../../c-api/threads.rst:302 +msgid "" +"These are the most commonly used types and functions when writing multi-" +"threaded C extensions." msgstr "" -msgid "This data structure represents the state of a single thread. The only public data member is:" +#: ../../c-api/threads.rst:308 +msgid "" +"This data structure represents the state of a single thread. The only " +"public data member is:" msgstr "" +#: ../../c-api/threads.rst:313 msgid "This thread's interpreter state." msgstr "" +#: ../../c-api/threads.rst:324 msgid "Deprecated function which does nothing." msgstr "" -msgid "In Python 3.6 and older, this function created the GIL if it didn't exist." +#: ../../c-api/threads.rst:326 +msgid "" +"In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" +#: ../../c-api/threads.rst:328 msgid "The function now does nothing." msgstr "" -msgid "This function is now called by :c:func:`Py_Initialize()`, so you don't have to call it yourself anymore." +#: ../../c-api/threads.rst:331 +msgid "" +"This function is now called by :c:func:`Py_Initialize()`, so you don't have " +"to call it yourself anymore." msgstr "" -msgid "This function cannot be called before :c:func:`Py_Initialize()` anymore." +#: ../../c-api/threads.rst:335 +msgid "" +"This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -msgid "Detach the :term:`attached thread state` and return it. The thread will have no :term:`thread state` upon returning." +#: ../../c-api/threads.rst:345 +msgid "" +"Detach the :term:`attached thread state` and return it. The thread will have " +"no :term:`thread state` upon returning." msgstr "" -msgid "Set the :term:`attached thread state` to *tstate*. The passed :term:`thread state` **should not** be :term:`attached `, otherwise deadlock ensues. *tstate* will be attached upon returning." +#: ../../c-api/threads.rst:351 +msgid "" +"Set the :term:`attached thread state` to *tstate*. The passed :term:`thread " +"state` **should not** be :term:`attached `, otherwise " +"deadlock ensues. *tstate* will be attached upon returning." msgstr "" -msgid "Calling this function from a thread when the runtime is finalizing will hang the thread until the program exits, even if the thread was not created by Python. Refer to :ref:`cautions-regarding-runtime-finalization` for more details." +#: ../../c-api/threads.rst:356 ../../c-api/threads.rst:640 +msgid "" +"Calling this function from a thread when the runtime is finalizing will hang " +"the thread until the program exits, even if the thread was not created by " +"Python. Refer to :ref:`cautions-regarding-runtime-finalization` for more " +"details." msgstr "" -msgid "Hangs the current thread, rather than terminating it, if called while the interpreter is finalizing." +#: ../../c-api/threads.rst:361 ../../c-api/threads.rst:448 +#: ../../c-api/threads.rst:650 +msgid "" +"Hangs the current thread, rather than terminating it, if called while the " +"interpreter is finalizing." msgstr "" -msgid "Return the :term:`attached thread state`. If the thread has no attached thread state, (such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` block), then this issues a fatal error (so that the caller needn't check for ``NULL``)." +#: ../../c-api/threads.rst:367 +msgid "" +"Return the :term:`attached thread state`. If the thread has no attached " +"thread state, (such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"block), then this issues a fatal error (so that the caller needn't check for " +"``NULL``)." msgstr "" +#: ../../c-api/threads.rst:372 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "" -msgid "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a fatal error if it is NULL. The caller is responsible to check if the result is NULL." +#: ../../c-api/threads.rst:376 +msgid "" +"Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " +"fatal error if it is NULL. The caller is responsible to check if the result " +"is NULL." msgstr "" -msgid "In Python 3.5 to 3.12, the function was private and known as ``_PyThreadState_UncheckedGet()``." +#: ../../c-api/threads.rst:380 +msgid "" +"In Python 3.5 to 3.12, the function was private and known as " +"``_PyThreadState_UncheckedGet()``." msgstr "" -msgid "Set the :term:`attached thread state` to *tstate*, and return the :term:`thread state` that was attached prior to calling." +#: ../../c-api/threads.rst:387 +msgid "" +"Set the :term:`attached thread state` to *tstate*, and return " +"the :term:`thread state` that was attached prior to calling." msgstr "" -msgid "This function is safe to call without an :term:`attached thread state`; it will simply return ``NULL`` indicating that there was no prior thread state." +#: ../../c-api/threads.rst:390 +msgid "" +"This function is safe to call without an :term:`attached thread state`; it " +"will simply return ``NULL`` indicating that there was no prior thread state." msgstr "" +#: ../../c-api/threads.rst:394 msgid ":c:func:`PyEval_ReleaseThread`" msgstr "" -msgid "Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread if the runtime is finalizing." +#: ../../c-api/threads.rst:397 +msgid "" +"Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " +"if the runtime is finalizing." msgstr "" +#: ../../c-api/threads.rst:402 msgid "GIL-state APIs" msgstr "" -msgid "The following functions use thread-local storage, and are not compatible with sub-interpreters:" +#: ../../c-api/threads.rst:404 +msgid "" +"The following functions use thread-local storage, and are not compatible " +"with sub-interpreters:" msgstr "" -msgid "The type of the value returned by :c:func:`PyGILState_Ensure` and passed to :c:func:`PyGILState_Release`." +#: ../../c-api/threads.rst:409 +msgid "" +"The type of the value returned by :c:func:`PyGILState_Ensure` and passed " +"to :c:func:`PyGILState_Release`." msgstr "" +#: ../../c-api/threads.rst:414 msgid "The GIL was already held when :c:func:`PyGILState_Ensure` was called." msgstr "" +#: ../../c-api/threads.rst:418 msgid "The GIL was not held when :c:func:`PyGILState_Ensure` was called." msgstr "" -msgid "Ensure that the current thread is ready to call the Python C API regardless of the current state of Python, or of the :term:`attached thread state`. This may be called as many times as desired by a thread as long as each call is matched with a call to :c:func:`PyGILState_Release`. In general, other thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls as long as the thread state is restored to its previous state before the Release(). For example, normal usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." -msgstr "" - -msgid "The return value is an opaque \"handle\" to the :term:`attached thread state` when :c:func:`PyGILState_Ensure` was called, and must be passed to :c:func:`PyGILState_Release` to ensure Python is left in the same state. Even though recursive calls are allowed, these handles *cannot* be shared - each unique call to :c:func:`PyGILState_Ensure` must save the handle for its call to :c:func:`PyGILState_Release`." +#: ../../c-api/threads.rst:422 +msgid "" +"Ensure that the current thread is ready to call the Python C API regardless " +"of the current state of Python, or of the :term:`attached thread state`. " +"This may be called as many times as desired by a thread as long as each call " +"is matched with a call to :c:func:`PyGILState_Release`. In general, other " +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls as long as the thread state is " +"restored to its previous state before the Release(). For example, normal " +"usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." +msgstr "" + +#: ../../c-api/threads.rst:432 +msgid "" +"The return value is an opaque \"handle\" to the :term:`attached thread " +"state` when :c:func:`PyGILState_Ensure` was called, and must be passed " +"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " +"Even though recursive calls are allowed, these handles *cannot* be shared - " +"each unique call to :c:func:`PyGILState_Ensure` must save the handle for its " +"call to :c:func:`PyGILState_Release`." msgstr "" -msgid "When the function returns, there will be an :term:`attached thread state` and the thread will be able to call arbitrary Python code. Failure is a fatal error." +#: ../../c-api/threads.rst:439 +msgid "" +"When the function returns, there will be an :term:`attached thread state` " +"and the thread will be able to call arbitrary Python code. Failure is a " +"fatal error." msgstr "" -msgid "Calling this function when the runtime is finalizing is unsafe. Doing so will either hang the thread until the program ends, or fully crash the interpreter in rare cases. Refer to :ref:`cautions-regarding-runtime-finalization` for more details." +#: ../../c-api/threads.rst:443 +msgid "" +"Calling this function when the runtime is finalizing is unsafe. Doing so " +"will either hang the thread until the program ends, or fully crash the " +"interpreter in rare cases. Refer to :ref:`cautions-regarding-runtime-" +"finalization` for more details." msgstr "" -msgid "Release any resources previously acquired. After this call, Python's state will be the same as it was prior to the corresponding :c:func:`PyGILState_Ensure` call (but generally this state will be unknown to the caller, hence the use of the GILState API)." +#: ../../c-api/threads.rst:454 +msgid "" +"Release any resources previously acquired. After this call, Python's state " +"will be the same as it was prior to the " +"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " +"will be unknown to the caller, hence the use of the GILState API)." msgstr "" -msgid "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:func:`PyGILState_Release` on the same thread." +#: ../../c-api/threads.rst:459 +msgid "" +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " +"to :c:func:`PyGILState_Release` on the same thread." msgstr "" -msgid "Get the :term:`attached thread state` for this thread. May return ``NULL`` if no GILState API has been used on the current thread. Note that the main thread always has such a thread-state, even if no auto-thread-state call has been made on the main thread. This is mainly a helper/diagnostic function." +#: ../../c-api/threads.rst:464 +msgid "" +"Get the :term:`attached thread state` for this thread. May return ``NULL`` " +"if no GILState API has been used on the current thread. Note that the main " +"thread always has such a thread-state, even if no auto-thread-state call has " +"been made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -msgid "This function may return non-``NULL`` even when the :term:`thread state` is detached. Prefer :c:func:`PyThreadState_Get` or :c:func:`PyThreadState_GetUnchecked` for most cases." +#: ../../c-api/threads.rst:470 +msgid "" +"This function may return non-``NULL`` even when the :term:`thread state` is " +"detached. Prefer :c:func:`PyThreadState_Get` " +"or :c:func:`PyThreadState_GetUnchecked` for most cases." msgstr "" +#: ../../c-api/threads.rst:475 msgid ":c:func:`PyThreadState_Get`" msgstr "" -msgid "Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` otherwise. This function can be called from any thread at any time. Only if it has had its :term:`thread state ` initialized via :c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a helper/diagnostic function. It can be useful for example in callback contexts or memory allocation functions when knowing that the :term:`GIL` is locked can allow the caller to perform sensitive actions or otherwise behave differently." +#: ../../c-api/threads.rst:479 +msgid "" +"Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " +"otherwise. This function can be called from any thread at any time. Only if " +"it has had its :term:`thread state ` initialized " +"via :c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a " +"helper/diagnostic function. It can be useful for example in callback " +"contexts or memory allocation functions when knowing that the :term:`GIL` is " +"locked can allow the caller to perform sensitive actions or otherwise behave " +"differently." msgstr "" -msgid "If the current Python process has ever created a subinterpreter, this function will *always* return ``1``. Prefer :c:func:`PyThreadState_GetUnchecked` for most cases." +#: ../../c-api/threads.rst:489 +msgid "" +"If the current Python process has ever created a subinterpreter, this " +"function will *always* return ``1``. " +"Prefer :c:func:`PyThreadState_GetUnchecked` for most cases." msgstr "" +#: ../../c-api/threads.rst:497 msgid "Low-level APIs" msgstr "" -msgid "Create a new thread state object belonging to the given interpreter object. An :term:`attached thread state` is not needed." +#: ../../c-api/threads.rst:501 +msgid "" +"Create a new thread state object belonging to the given interpreter object. " +"An :term:`attached thread state` is not needed." msgstr "" -msgid "Reset all information in a :term:`thread state` object. *tstate* must be :term:`attached `" +#: ../../c-api/threads.rst:506 +msgid "" +"Reset all information in a :term:`thread state` object. *tstate* must " +"be :term:`attached `" msgstr "" -msgid "This function now calls the :c:member:`!PyThreadState.on_delete` callback. Previously, that happened in :c:func:`PyThreadState_Delete`." +#: ../../c-api/threads.rst:509 +msgid "" +"This function now calls the :c:member:`!PyThreadState.on_delete` callback. " +"Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" +#: ../../c-api/threads.rst:513 msgid "The :c:member:`!PyThreadState.on_delete` callback was removed." msgstr "" -msgid "Destroy a :term:`thread state` object. *tstate* should not be :term:`attached ` to any thread. *tstate* must have been reset with a previous call to :c:func:`PyThreadState_Clear`." +#: ../../c-api/threads.rst:519 +msgid "" +"Destroy a :term:`thread state` object. *tstate* should not " +"be :term:`attached ` to any thread. *tstate* must " +"have been reset with a previous call to :c:func:`PyThreadState_Clear`." msgstr "" -msgid "Detach the :term:`attached thread state` (which must have been reset with a previous call to :c:func:`PyThreadState_Clear`) and then destroy it." +#: ../../c-api/threads.rst:527 +msgid "" +"Detach the :term:`attached thread state` (which must have been reset with a " +"previous call to :c:func:`PyThreadState_Clear`) and then destroy it." msgstr "" -msgid "No :term:`thread state` will be :term:`attached ` upon returning." +#: ../../c-api/threads.rst:530 +msgid "" +"No :term:`thread state` will be :term:`attached ` " +"upon returning." msgstr "" +#: ../../c-api/threads.rst:535 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -msgid "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently executing." +#: ../../c-api/threads.rst:537 +msgid "" +"Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " +"executing." msgstr "" +#: ../../c-api/threads.rst:540 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "" -msgid "*tstate* must not be ``NULL``, and must be :term:`attached `." +#: ../../c-api/threads.rst:542 ../../c-api/threads.rst:551 +#: ../../c-api/threads.rst:560 +msgid "" +"*tstate* must not be ``NULL``, and must be :term:`attached `." msgstr "" -msgid "Get the unique :term:`thread state` identifier of the Python thread state *tstate*." +#: ../../c-api/threads.rst:549 +msgid "" +"Get the unique :term:`thread state` identifier of the Python thread state " +"*tstate*." msgstr "" +#: ../../c-api/threads.rst:558 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" +#: ../../c-api/threads.rst:567 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" +#: ../../c-api/threads.rst:569 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -msgid "Resume tracing and profiling in the Python thread state *tstate* suspended by the :c:func:`PyThreadState_EnterTracing` function." -msgstr "" - -msgid "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." +#: ../../c-api/threads.rst:576 +msgid "" +"Resume tracing and profiling in the Python thread state *tstate* suspended " +"by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -msgid "Set the stack protection start address and stack protection size of a Python thread state." +#: ../../c-api/threads.rst:579 +msgid "" +"See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -msgid "On success, return ``0``. On failure, set an exception and return ``-1``." +#: ../../c-api/threads.rst:587 +msgid "" +"Set the stack protection start address and stack protection size of a Python " +"thread state." msgstr "" -msgid "CPython implements :ref:`recursion control ` for C code by raising :py:exc:`RecursionError` when it notices that the machine execution stack is close to overflow. See for example the :c:func:`Py_EnterRecursiveCall` function. For this, it needs to know the location of the current thread's stack, which it normally gets from the operating system. When the stack is changed, for example using context switching techniques like the Boost library's ``boost::context``, you must call :c:func:`~PyUnstable_ThreadState_SetStackProtection` to inform CPython of the change." +#: ../../c-api/threads.rst:590 +msgid "" +"On success, return ``0``. On failure, set an exception and return ``-1``." msgstr "" -msgid "Call :c:func:`~PyUnstable_ThreadState_SetStackProtection` either before or after changing the stack. Do not call any other Python C API between the call and the stack change." +#: ../../c-api/threads.rst:593 +msgid "" +"CPython implements :ref:`recursion control ` for C code by " +"raising :py:exc:`RecursionError` when it notices that the machine execution " +"stack is close to overflow. See for example " +"the :c:func:`Py_EnterRecursiveCall` function. For this, it needs to know the " +"location of the current thread's stack, which it normally gets from the " +"operating system. When the stack is changed, for example using context " +"switching techniques like the Boost library's ``boost::context``, you must " +"call :c:func:`~PyUnstable_ThreadState_SetStackProtection` to inform CPython " +"of the change." +msgstr "" + +#: ../../c-api/threads.rst:602 +msgid "" +"Call :c:func:`~PyUnstable_ThreadState_SetStackProtection` either before or " +"after changing the stack. Do not call any other Python C API between the " +"call and the stack change." msgstr "" -msgid "See :c:func:`PyUnstable_ThreadState_ResetStackProtection` for undoing this operation." +#: ../../c-api/threads.rst:607 +msgid "" +"See :c:func:`PyUnstable_ThreadState_ResetStackProtection` for undoing this " +"operation." msgstr "" -msgid "Reset the stack protection start address and stack protection size of a Python thread state to the operating system defaults." +#: ../../c-api/threads.rst:614 +msgid "" +"Reset the stack protection start address and stack protection size of a " +"Python thread state to the operating system defaults." msgstr "" -msgid "See :c:func:`PyUnstable_ThreadState_SetStackProtection` for an explanation." +#: ../../c-api/threads.rst:617 +msgid "" +"See :c:func:`PyUnstable_ThreadState_SetStackProtection` for an explanation." msgstr "" -msgid "Return a dictionary in which extensions can store thread-specific state information. Each extension should use a unique key to use to store state in the dictionary. It is okay to call this function when no :term:`thread state` is :term:`attached `. If this function returns ``NULL``, no exception has been raised and the caller should assume no thread state is attached." +#: ../../c-api/threads.rst:624 +msgid "" +"Return a dictionary in which extensions can store thread-specific state " +"information. Each extension should use a unique key to use to store state " +"in the dictionary. It is okay to call this function when no :term:`thread " +"state` is :term:`attached `. If this function returns " +"``NULL``, no exception has been raised and the caller should assume no " +"thread state is attached." msgstr "" -msgid ":term:`Attach ` *tstate* to the current thread, which must not be ``NULL`` or already :term:`attached `." +#: ../../c-api/threads.rst:634 +msgid "" +":term:`Attach ` *tstate* to the current thread, which " +"must not be ``NULL`` or already :term:`attached `." msgstr "" -msgid "The calling thread must not already have an :term:`attached thread state`." +#: ../../c-api/threads.rst:637 +msgid "" +"The calling thread must not already have an :term:`attached thread state`." msgstr "" -msgid "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the current thread if called while the interpreter is finalizing." +#: ../../c-api/threads.rst:645 +msgid "" +"Updated to be consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`, and terminate the current thread if called " +"while the interpreter is finalizing." msgstr "" -msgid ":c:func:`PyEval_RestoreThread` is a higher-level function which is always available (even when threads have not been initialized)." +#: ../../c-api/threads.rst:654 +msgid "" +":c:func:`PyEval_RestoreThread` is a higher-level function which is always " +"available (even when threads have not been initialized)." msgstr "" -msgid "Detach the :term:`attached thread state`. The *tstate* argument, which must not be ``NULL``, is only used to check that it represents the :term:`attached thread state` --- if it isn't, a fatal error is reported." +#: ../../c-api/threads.rst:660 +msgid "" +"Detach the :term:`attached thread state`. The *tstate* argument, which must " +"not be ``NULL``, is only used to check that it represents " +"the :term:`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" -msgid ":c:func:`PyEval_SaveThread` is a higher-level function which is always available (even when threads have not been initialized)." +#: ../../c-api/threads.rst:665 +msgid "" +":c:func:`PyEval_SaveThread` is a higher-level function which is always " +"available (even when threads have not been initialized)." msgstr "" +#: ../../c-api/threads.rst:670 msgid "Asynchronous notifications" msgstr "" -msgid "A mechanism is provided to make asynchronous notifications to the main interpreter thread. These notifications take the form of a function pointer and a void pointer argument." +#: ../../c-api/threads.rst:672 +msgid "" +"A mechanism is provided to make asynchronous notifications to the main " +"interpreter thread. These notifications take the form of a function pointer " +"and a void pointer argument." msgstr "" -msgid "Schedule a function to be called from the main interpreter thread. On success, ``0`` is returned and *func* is queued for being called in the main thread. On failure, ``-1`` is returned without setting any exception." +#: ../../c-api/threads.rst:679 +msgid "" +"Schedule a function to be called from the main interpreter thread. On " +"success, ``0`` is returned and *func* is queued for being called in the main " +"thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -msgid "When successfully queued, *func* will be *eventually* called from the main interpreter thread with the argument *arg*. It will be called asynchronously with respect to normally running Python code, but with both these conditions met:" +#: ../../c-api/threads.rst:683 +msgid "" +"When successfully queued, *func* will be *eventually* called from the main " +"interpreter thread with the argument *arg*. It will be called " +"asynchronously with respect to normally running Python code, but with both " +"these conditions met:" msgstr "" +#: ../../c-api/threads.rst:688 msgid "on a :term:`bytecode` boundary;" msgstr "" -msgid "with the main thread holding an :term:`attached thread state` (*func* can therefore use the full C API)." +#: ../../c-api/threads.rst:689 +msgid "" +"with the main thread holding an :term:`attached thread state` (*func* can " +"therefore use the full C API)." msgstr "" -msgid "*func* must return ``0`` on success, or ``-1`` on failure with an exception set. *func* won't be interrupted to perform another asynchronous notification recursively, but it can still be interrupted to switch threads if the :term:`thread state ` is detached." +#: ../../c-api/threads.rst:692 +msgid "" +"*func* must return ``0`` on success, or ``-1`` on failure with an exception " +"set. *func* won't be interrupted to perform another asynchronous " +"notification recursively, but it can still be interrupted to switch threads " +"if the :term:`thread state ` is detached." msgstr "" -msgid "This function doesn't need an :term:`attached thread state`. However, to call this function in a subinterpreter, the caller must have an :term:`attached thread state`. Otherwise, the function *func* can be scheduled to be called from the wrong interpreter." +#: ../../c-api/threads.rst:697 +msgid "" +"This function doesn't need an :term:`attached thread state`. However, to " +"call this function in a subinterpreter, the caller must have " +"an :term:`attached thread state`. Otherwise, the function *func* can be " +"scheduled to be called from the wrong interpreter." msgstr "" -msgid "This is a low-level function, only useful for very special cases. There is no guarantee that *func* will be called as quick as possible. If the main thread is busy executing a system call, *func* won't be called before the system call returns. This function is generally **not** suitable for calling Python code from arbitrary C threads. Instead, use the :ref:`PyGILState API`." +#: ../../c-api/threads.rst:702 +msgid "" +"This is a low-level function, only useful for very special cases. There is " +"no guarantee that *func* will be called as quick as possible. If the main " +"thread is busy executing a system call, *func* won't be called before the " +"system call returns. This function is generally **not** suitable for " +"calling Python code from arbitrary C threads. Instead, use " +"the :ref:`PyGILState API`." msgstr "" -msgid "If this function is called in a subinterpreter, the function *func* is now scheduled to be called from the subinterpreter, rather than being called from the main interpreter. Each subinterpreter now has its own list of scheduled calls." +#: ../../c-api/threads.rst:711 +msgid "" +"If this function is called in a subinterpreter, the function *func* is now " +"scheduled to be called from the subinterpreter, rather than being called " +"from the main interpreter. Each subinterpreter now has its own list of " +"scheduled calls." msgstr "" -msgid "This function now always schedules *func* to be run in the main interpreter." +#: ../../c-api/threads.rst:717 +msgid "" +"This function now always schedules *func* to be run in the main interpreter." msgstr "" -msgid "Execute all pending calls. This is usually executed automatically by the interpreter." +#: ../../c-api/threads.rst:724 +msgid "" +"Execute all pending calls. This is usually executed automatically by the " +"interpreter." msgstr "" -msgid "This function returns ``0`` on success, and returns ``-1`` with an exception set on failure." +#: ../../c-api/threads.rst:727 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." msgstr "" -msgid "If this is not called in the main thread of the main interpreter, this function does nothing and returns ``0``. The caller must hold an :term:`attached thread state`." +#: ../../c-api/threads.rst:730 +msgid "" +"If this is not called in the main thread of the main interpreter, this " +"function does nothing and returns ``0``. The caller must hold " +"an :term:`attached thread state`." msgstr "" +#: ../../c-api/threads.rst:736 msgid "This function only runs pending calls in the main interpreter." msgstr "" -msgid "Asynchronously raise an exception in a thread. The *id* argument is the thread id of the target thread; *exc* is the exception object to be raised. This function does not steal any references to *exc*. To prevent naive misuse, you must write your own C extension to call this. Must be called with an :term:`attached thread state`. Returns the number of thread states modified; this is normally one, but will be zero if the thread id isn't found. If *exc* is ``NULL``, the pending exception (if any) for the thread is cleared. This raises no exceptions." +#: ../../c-api/threads.rst:742 +msgid "" +"Asynchronously raise an exception in a thread. The *id* argument is the " +"thread id of the target thread; *exc* is the exception object to be raised. " +"This function does not :term:`steal` any references to *exc*. To prevent " +"naive misuse, you must write your own C extension to call this. Must be " +"called with an :term:`attached thread state`. Returns the number of thread " +"states modified; this is normally one, but will be zero if the thread id " +"isn't found. If *exc* is ``NULL``, the pending exception (if any) for the " +"thread is cleared. This raises no exceptions." msgstr "" -msgid "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:`unsigned long`." +#: ../../c-api/threads.rst:750 +msgid "" +"The type of the *id* parameter changed from :c:expr:`long` " +"to :c:expr:`unsigned long`." msgstr "" +#: ../../c-api/threads.rst:756 msgid "Operating system thread APIs" msgstr "" +#: ../../c-api/threads.rst:760 msgid "Sentinel value for an invalid thread ID." msgstr "" +#: ../../c-api/threads.rst:762 msgid "This is currently equivalent to ``(unsigned long)-1``." msgstr "" -msgid "Start function *func* in a new thread with argument *arg*. The resulting thread is not intended to be joined." +#: ../../c-api/threads.rst:767 +msgid "" +"Start function *func* in a new thread with argument *arg*. The resulting " +"thread is not intended to be joined." msgstr "" +#: ../../c-api/threads.rst:770 msgid "*func* must not be ``NULL``, but *arg* may be ``NULL``." msgstr "" -msgid "On success, this function returns the identifier of the new thread; on failure, this returns :c:macro:`PYTHREAD_INVALID_THREAD_ID`." +#: ../../c-api/threads.rst:772 +msgid "" +"On success, this function returns the identifier of the new thread; on " +"failure, this returns :c:macro:`PYTHREAD_INVALID_THREAD_ID`." msgstr "" +#: ../../c-api/threads.rst:775 ../../c-api/threads.rst:859 +#: ../../c-api/threads.rst:867 msgid "The caller does not need to hold an :term:`attached thread state`." msgstr "" +#: ../../c-api/threads.rst:780 msgid "Return the identifier of the current thread, which will never be zero." msgstr "" -msgid "This function cannot fail, and the caller does not need to hold an :term:`attached thread state`." +#: ../../c-api/threads.rst:782 ../../c-api/threads.rst:814 +msgid "" +"This function cannot fail, and the caller does not need to hold " +"an :term:`attached thread state`." msgstr "" +#: ../../c-api/threads.rst:786 msgid ":py:func:`threading.get_ident`" msgstr "" -msgid "Get general information about the current thread in the form of a :ref:`struct sequence ` object. This information is accessible as :py:attr:`sys.thread_info` in Python." +#: ../../c-api/threads.rst:791 +msgid "" +"Get general information about the current thread in the form of " +"a :ref:`struct sequence ` object. This information " +"is accessible as :py:attr:`sys.thread_info` in Python." msgstr "" -msgid "On success, this returns a new :term:`strong reference` to the thread information; on failure, this returns ``NULL`` with an exception set." +#: ../../c-api/threads.rst:795 +msgid "" +"On success, this returns a new :term:`strong reference` to the thread " +"information; on failure, this returns ``NULL`` with an exception set." msgstr "" +#: ../../c-api/threads.rst:798 msgid "The caller must hold an :term:`attached thread state`." msgstr "" +#: ../../c-api/threads.rst:803 msgid "This macro is defined when the system supports native thread IDs." msgstr "" -msgid "Get the native identifier of the current thread as it was assigned by the operating system's kernel, which will never be less than zero." +#: ../../c-api/threads.rst:808 +msgid "" +"Get the native identifier of the current thread as it was assigned by the " +"operating system's kernel, which will never be less than zero." msgstr "" -msgid "This function is only available when :c:macro:`PY_HAVE_THREAD_NATIVE_ID` is defined." +#: ../../c-api/threads.rst:811 +msgid "" +"This function is only available when :c:macro:`PY_HAVE_THREAD_NATIVE_ID` is " +"defined." msgstr "" +#: ../../c-api/threads.rst:818 msgid ":py:func:`threading.get_native_id`" msgstr "" -msgid "Terminate the current thread. This function is generally considered unsafe and should be avoided. It is kept solely for backwards compatibility." +#: ../../c-api/threads.rst:823 +msgid "" +"Terminate the current thread. This function is generally considered unsafe " +"and should be avoided. It is kept solely for backwards compatibility." msgstr "" -msgid "This function is only safe to call if all functions in the full call stack are written to safely allow it." +#: ../../c-api/threads.rst:826 +msgid "" +"This function is only safe to call if all functions in the full call stack " +"are written to safely allow it." msgstr "" -msgid "If the current system uses POSIX threads (also known as \"pthreads\"), this calls :manpage:`pthread_exit(3)`, which attempts to unwind the stack and call C++ destructors on some libc implementations. However, if a ``noexcept`` function is reached, it may terminate the process. Other systems, such as macOS, do unwinding." +#: ../../c-api/threads.rst:831 +msgid "" +"If the current system uses POSIX threads (also known as \"pthreads\"), this " +"calls :manpage:`pthread_exit(3)`, which attempts to unwind the stack and " +"call C++ destructors on some libc implementations. However, if a " +"``noexcept`` function is reached, it may terminate the process. Other " +"systems, such as macOS, do unwinding." msgstr "" -msgid "On Windows, this function calls ``_endthreadex()``, which kills the thread without calling C++ destructors." +#: ../../c-api/threads.rst:837 +msgid "" +"On Windows, this function calls ``_endthreadex()``, which kills the thread " +"without calling C++ destructors." msgstr "" +#: ../../c-api/threads.rst:840 msgid "In any case, there is a risk of corruption on the thread's stack." msgstr "" -msgid "Initialize ``PyThread*`` APIs. Python executes this function automatically, so there's little need to call it from an extension module." +#: ../../c-api/threads.rst:847 +msgid "" +"Initialize ``PyThread*`` APIs. Python executes this function automatically, " +"so there's little need to call it from an extension module." msgstr "" +#: ../../c-api/threads.rst:853 msgid "Set the stack size of the current thread to *size* bytes." msgstr "" -msgid "This function returns ``0`` on success, ``-1`` if *size* is invalid, or ``-2`` if the system does not support changing the stack size. This function does not set exceptions." +#: ../../c-api/threads.rst:855 +msgid "" +"This function returns ``0`` on success, ``-1`` if *size* is invalid, or " +"``-2`` if the system does not support changing the stack size. This function " +"does not set exceptions." msgstr "" -msgid "Return the stack size of the current thread in bytes, or ``0`` if the system's default stack size is in use." +#: ../../c-api/threads.rst:864 +msgid "" +"Return the stack size of the current thread in bytes, or ``0`` if the " +"system's default stack size is in use." msgstr "" +#: ../../c-api/threads.rst:8 msgid "global interpreter lock" msgstr "" +#: ../../c-api/threads.rst:8 msgid "interpreter lock" msgstr "" +#: ../../c-api/threads.rst:8 msgid "lock, interpreter" msgstr "" +#: ../../c-api/threads.rst:25 msgid "setswitchinterval (in module sys)" msgstr "" +#: ../../c-api/threads.rst:36 msgid "PyThreadState (C type)" msgstr "" +#: ../../c-api/threads.rst:87 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "" +#: ../../c-api/threads.rst:87 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "" +#: ../../c-api/threads.rst:103 msgid "PyEval_RestoreThread (C function)" msgstr "" +#: ../../c-api/threads.rst:103 msgid "PyEval_SaveThread (C function)" msgstr "" +#: ../../c-api/threads.rst:318 msgid "PyEval_AcquireThread()" msgstr "" +#: ../../c-api/threads.rst:318 msgid "PyEval_ReleaseThread()" msgstr "" +#: ../../c-api/threads.rst:318 msgid "PyEval_SaveThread()" msgstr "" +#: ../../c-api/threads.rst:318 msgid "PyEval_RestoreThread()" msgstr "" +#: ../../c-api/threads.rst:340 msgid "module" msgstr "" +#: ../../c-api/threads.rst:340 msgid "_thread" msgstr "" diff --git a/c-api/time.po b/c-api/time.po index e9ffddc69..489c8a6a2 100644 --- a/c-api/time.po +++ b/c-api/time.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-05-11 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,83 +23,152 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/time.rst:6 msgid "PyTime C API" msgstr "" -msgid "The clock C API provides access to system clocks. It is similar to the Python :mod:`time` module." +#: ../../c-api/time.rst:10 +msgid "" +"The clock C API provides access to system clocks. It is similar to the " +"Python :mod:`time` module." msgstr "" -msgid "For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." +#: ../../c-api/time.rst:13 +msgid "" +"For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." msgstr "" +#: ../../c-api/time.rst:17 msgid "Types" msgstr "" -msgid "A timestamp or duration in nanoseconds, represented as a signed 64-bit integer." +#: ../../c-api/time.rst:21 +msgid "" +"A timestamp or duration in nanoseconds, represented as a signed 64-bit " +"integer." msgstr "" -msgid "The reference point for timestamps depends on the clock used. For example, :c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." +#: ../../c-api/time.rst:24 +msgid "" +"The reference point for timestamps depends on the clock used. For " +"example, :c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." msgstr "" -msgid "The supported range is around [-292.3 years; +292.3 years]. Using the Unix epoch (January 1st, 1970) as reference, the supported date range is around [1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" +#: ../../c-api/time.rst:27 +msgid "" +"The supported range is around [-292.3 years; +292.3 years]. Using the Unix " +"epoch (January 1st, 1970) as reference, the supported date range is around " +"[1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" msgstr "" +#: ../../c-api/time.rst:34 msgid "Minimum value of :c:type:`PyTime_t`." msgstr "" +#: ../../c-api/time.rst:38 msgid "Maximum value of :c:type:`PyTime_t`." msgstr "" +#: ../../c-api/time.rst:42 msgid "Clock Functions" msgstr "" -msgid "The following functions take a pointer to a :c:expr:`PyTime_t` that they set to the value of a particular clock. Details of each clock are given in the documentation of the corresponding Python function." +#: ../../c-api/time.rst:44 +msgid "" +"The following functions take a pointer to a :c:expr:`PyTime_t` that they set " +"to the value of a particular clock. Details of each clock are given in the " +"documentation of the corresponding Python function." msgstr "" -msgid "The functions return ``0`` on success, or ``-1`` (with an exception set) on failure." +#: ../../c-api/time.rst:49 +msgid "" +"The functions return ``0`` on success, or ``-1`` (with an exception set) on " +"failure." msgstr "" -msgid "On integer overflow, they set the :c:data:`PyExc_OverflowError` exception and set ``*result`` to the value clamped to the ``[PyTime_MIN; PyTime_MAX]`` range. (On current systems, integer overflows are likely caused by misconfigured system time.)" +#: ../../c-api/time.rst:52 +msgid "" +"On integer overflow, they set the :c:data:`PyExc_OverflowError` exception " +"and set ``*result`` to the value clamped to the ``[PyTime_MIN; PyTime_MAX]`` " +"range. (On current systems, integer overflows are likely caused by " +"misconfigured system time.)" msgstr "" -msgid "As any other C API (unless otherwise specified), the functions must be called with an :term:`attached thread state`." +#: ../../c-api/time.rst:58 +msgid "" +"As any other C API (unless otherwise specified), the functions must be " +"called with an :term:`attached thread state`." msgstr "" -msgid "Read the monotonic clock. See :func:`time.monotonic` for important details on this clock." +#: ../../c-api/time.rst:63 +msgid "" +"Read the monotonic clock. See :func:`time.monotonic` for important details " +"on this clock." msgstr "" -msgid "Read the performance counter. See :func:`time.perf_counter` for important details on this clock." +#: ../../c-api/time.rst:68 +msgid "" +"Read the performance counter. See :func:`time.perf_counter` for important " +"details on this clock." msgstr "" -msgid "Read the “wall clock” time. See :func:`time.time` for details important on this clock." +#: ../../c-api/time.rst:73 +msgid "" +"Read the “wall clock” time. See :func:`time.time` for details important on " +"this clock." msgstr "" +#: ../../c-api/time.rst:78 msgid "Raw Clock Functions" msgstr "" -msgid "Similar to clock functions, but don't set an exception on error and don't require the caller to have an :term:`attached thread state`." +#: ../../c-api/time.rst:80 +msgid "" +"Similar to clock functions, but don't set an exception on error and don't " +"require the caller to have an :term:`attached thread state`." msgstr "" +#: ../../c-api/time.rst:83 msgid "On success, the functions return ``0``." msgstr "" -msgid "On failure, they set ``*result`` to ``0`` and return ``-1``, *without* setting an exception. To get the cause of the error, :term:`attach ` a :term:`thread state`, and call the regular (non-``Raw``) function. Note that the regular function may succeed after the ``Raw`` one failed." +#: ../../c-api/time.rst:85 +msgid "" +"On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " +"setting an exception. To get the cause of the error, :term:`attach ` a :term:`thread state`, and call the regular (non-``Raw``) " +"function. Note that the regular function may succeed after the ``Raw`` one " +"failed." msgstr "" -msgid "Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error and don't require an :term:`attached thread state`." +#: ../../c-api/time.rst:92 +msgid "" +"Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " +"and don't require an :term:`attached thread state`." msgstr "" -msgid "Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error and don't require an :term:`attached thread state`." +#: ../../c-api/time.rst:97 +msgid "" +"Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " +"and don't require an :term:`attached thread state`." msgstr "" -msgid "Similar to :c:func:`PyTime_Time`, but don't set an exception on error and don't require an :term:`attached thread state`." +#: ../../c-api/time.rst:102 +msgid "" +"Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " +"don't require an :term:`attached thread state`." msgstr "" +#: ../../c-api/time.rst:107 msgid "Conversion functions" msgstr "" +#: ../../c-api/time.rst:111 msgid "Convert a timestamp to a number of seconds as a C :c:expr:`double`." msgstr "" -msgid "The function cannot fail, but note that :c:expr:`double` has limited accuracy for large values." +#: ../../c-api/time.rst:113 +msgid "" +"The function cannot fail, but note that :c:expr:`double` has limited " +"accuracy for large values." msgstr "" diff --git a/c-api/tls.po b/c-api/tls.po index a704278c5..0b0811d6a 100644 --- a/c-api/tls.po +++ b/c-api/tls.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,83 +19,176 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../c-api/tls.rst:6 msgid "Thread-local storage support" msgstr "" -msgid "The Python interpreter provides low-level support for thread-local storage (TLS) which wraps the underlying native TLS implementation to support the Python-level thread-local storage API (:class:`threading.local`). The CPython C level APIs are similar to those offered by pthreads and Windows: use a thread key and functions to associate a :c:expr:`void*` value per thread." +#: ../../c-api/tls.rst:8 +msgid "" +"The Python interpreter provides low-level support for thread-local storage " +"(TLS) which wraps the underlying native TLS implementation to support the " +"Python-level thread-local storage API (:class:`threading.local`). The " +"CPython C level APIs are similar to those offered by pthreads and Windows: " +"use a thread key and functions to associate a :c:expr:`void*` value per " +"thread." msgstr "" -msgid "A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they supply their own locking." +#: ../../c-api/tls.rst:15 +msgid "" +"A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they supply their own locking." msgstr "" -msgid "Note that :file:`Python.h` does not include the declaration of the TLS APIs, you need to include :file:`pythread.h` to use thread-local storage." +#: ../../c-api/tls.rst:18 +msgid "" +"Note that :file:`Python.h` does not include the declaration of the TLS APIs, " +"you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -msgid "None of these API functions handle memory management on behalf of the :c:expr:`void*` values. You need to allocate and deallocate them yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions don't do refcount operations on them either." +#: ../../c-api/tls.rst:22 +msgid "" +"None of these API functions handle memory management on behalf of " +"the :c:expr:`void*` values. You need to allocate and deallocate them " +"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " +"these functions don't do refcount operations on them either." msgstr "" +#: ../../c-api/tls.rst:30 msgid "Thread-specific storage API" msgstr "" -msgid "The thread-specific storage (TSS) API was introduced to supersede the use of the existing TLS API within the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` instead of :c:expr:`int` to represent thread keys." +#: ../../c-api/tls.rst:32 +msgid "" +"The thread-specific storage (TSS) API was introduced to supersede the use of " +"the existing TLS API within the CPython interpreter. This API uses a new " +"type :c:type:`Py_tss_t` instead of :c:expr:`int` to represent thread keys." msgstr "" +#: ../../c-api/tls.rst:38 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -msgid "This data structure represents the state of a thread key, the definition of which may depend on the underlying TLS implementation, and it has an internal field representing the key's initialization state. There are no public members in this structure." +#: ../../c-api/tls.rst:43 +msgid "" +"This data structure represents the state of a thread key, the definition of " +"which may depend on the underlying TLS implementation, and it has an " +"internal field representing the key's initialization state. There are no " +"public members in this structure." msgstr "" -msgid "When :ref:`Py_LIMITED_API ` is not defined, static allocation of this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." +#: ../../c-api/tls.rst:48 +msgid "" +"When :ref:`Py_LIMITED_API ` is not defined, static allocation of " +"this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -msgid "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note that this macro won't be defined with :ref:`Py_LIMITED_API `." +#: ../../c-api/tls.rst:54 +msgid "" +"This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " +"that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" +#: ../../c-api/tls.rst:59 msgid "Dynamic allocation" msgstr "" -msgid "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules built with :ref:`Py_LIMITED_API `, where static allocation of this type is not possible due to its implementation being opaque at build time." +#: ../../c-api/tls.rst:61 +msgid "" +"Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " +"built with :ref:`Py_LIMITED_API `, where static allocation of this " +"type is not possible due to its implementation being opaque at build time." msgstr "" -msgid "Return a value which is the same state as a value initialized with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." +#: ../../c-api/tls.rst:68 +msgid "" +"Return a value which is the same state as a value initialized " +"with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic " +"allocation failure." msgstr "" -msgid "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals have been unassigned. This is a no-op if the *key* argument is ``NULL``." +#: ../../c-api/tls.rst:75 +msgid "" +"Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " +"calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " +"have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -msgid "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." +#: ../../c-api/tls.rst:81 +msgid "" +"A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" +#: ../../c-api/tls.rst:86 msgid "Methods" msgstr "" -msgid "The parameter *key* of these functions must not be ``NULL``. Moreover, the behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:func:`PyThread_tss_create`." +#: ../../c-api/tls.rst:88 +msgid "" +"The parameter *key* of these functions must not be ``NULL``. Moreover, the " +"behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " +"undefined if the given :c:type:`Py_tss_t` has not been initialized " +"by :c:func:`PyThread_tss_create`." msgstr "" -msgid "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized by :c:func:`PyThread_tss_create`." +#: ../../c-api/tls.rst:96 +msgid "" +"Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " +"by :c:func:`PyThread_tss_create`." msgstr "" -msgid "Return a zero value on successful initialization of a TSS key. The behavior is undefined if the value pointed to by the *key* argument is not initialized by :c:macro:`Py_tss_NEEDS_INIT`. This function can be called repeatedly on the same key -- calling it on an already initialized key is a no-op and immediately returns success." +#: ../../c-api/tls.rst:102 +msgid "" +"Return a zero value on successful initialization of a TSS key. The behavior " +"is undefined if the value pointed to by the *key* argument is not " +"initialized by :c:macro:`Py_tss_NEEDS_INIT`. This function can be called " +"repeatedly on the same key -- calling it on an already initialized key is a " +"no-op and immediately returns success." msgstr "" -msgid "Destroy a TSS key to forget the values associated with the key across all threads, and change the key's initialization state to uninitialized. A destroyed key is able to be initialized again by :c:func:`PyThread_tss_create`. This function can be called repeatedly on the same key -- calling it on an already destroyed key is a no-op." +#: ../../c-api/tls.rst:111 +msgid "" +"Destroy a TSS key to forget the values associated with the key across all " +"threads, and change the key's initialization state to uninitialized. A " +"destroyed key is able to be initialized again " +"by :c:func:`PyThread_tss_create`. This function can be called repeatedly on " +"the same key -- calling it on an already destroyed key is a no-op." msgstr "" -msgid "Return a zero value to indicate successfully associating a :c:expr:`void*` value with a TSS key in the current thread. Each thread has a distinct mapping of the key to a :c:expr:`void*` value." +#: ../../c-api/tls.rst:120 +msgid "" +"Return a zero value to indicate successfully associating a :c:expr:`void*` " +"value with a TSS key in the current thread. Each thread has a distinct " +"mapping of the key to a :c:expr:`void*` value." msgstr "" -msgid "Return the :c:expr:`void*` value associated with a TSS key in the current thread. This returns ``NULL`` if no value is associated with the key in the current thread." +#: ../../c-api/tls.rst:127 +msgid "" +"Return the :c:expr:`void*` value associated with a TSS key in the current " +"thread. This returns ``NULL`` if no value is associated with the key in the " +"current thread." msgstr "" +#: ../../c-api/tls.rst:135 msgid "Legacy APIs" msgstr "" -msgid "This API is superseded by the :ref:`thread-specific storage (TSS) API `." +#: ../../c-api/tls.rst:137 +msgid "" +"This API is superseded by the :ref:`thread-specific storage (TSS) API " +"`." msgstr "" -msgid "This version of the API does not support platforms where the native TLS key is defined in a way that cannot be safely cast to ``int``. On such platforms, :c:func:`PyThread_create_key` will return immediately with a failure status, and the other TLS functions will all be no-ops on such platforms." +#: ../../c-api/tls.rst:142 +msgid "" +"This version of the API does not support platforms where the native TLS key " +"is defined in a way that cannot be safely cast to ``int``. On such " +"platforms, :c:func:`PyThread_create_key` will return immediately with a " +"failure status, and the other TLS functions will all be no-ops on such " +"platforms." msgstr "" -msgid "Due to the compatibility problem noted above, this version of the API should not be used in new code." +#: ../../c-api/tls.rst:147 +msgid "" +"Due to the compatibility problem noted above, this version of the API should " +"not be used in new code." msgstr "" diff --git a/c-api/tuple.po b/c-api/tuple.po index b64c462cf..651d25157 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,143 +23,269 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/tuple.rst:6 msgid "Tuple Objects" msgstr "" +#: ../../c-api/tuple.rst:13 msgid "This subtype of :c:type:`PyObject` represents a Python tuple object." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python tuple type; it is the same object as :class:`tuple` in the Python layer." +#: ../../c-api/tuple.rst:18 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python tuple type; it " +"is the same object as :class:`tuple` in the Python layer." msgstr "" -msgid "Return true if *p* is a tuple object or an instance of a subtype of the tuple type. This function always succeeds." +#: ../../c-api/tuple.rst:24 +msgid "" +"Return true if *p* is a tuple object or an instance of a subtype of the " +"tuple type. This function always succeeds." msgstr "" -msgid "Return true if *p* is a tuple object, but not an instance of a subtype of the tuple type. This function always succeeds." +#: ../../c-api/tuple.rst:30 +msgid "" +"Return true if *p* is a tuple object, but not an instance of a subtype of " +"the tuple type. This function always succeeds." msgstr "" -msgid "Return a new tuple object of size *len*, or ``NULL`` with an exception set on failure." +#: ../../c-api/tuple.rst:36 +msgid "" +"Return a new tuple object of size *len*, or ``NULL`` with an exception set " +"on failure." msgstr "" -msgid "Return a new tuple object of size *n*, or ``NULL`` with an exception set on failure. The tuple values are initialized to the subsequent *n* C arguments pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to ``Py_BuildValue(\"(OO)\", a, b)``." +#: ../../c-api/tuple.rst:42 +msgid "" +"Return a new tuple object of size *n*, or ``NULL`` with an exception set on " +"failure. The tuple values are initialized to the subsequent *n* C arguments " +"pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to " +"``Py_BuildValue(\"(OO)\", a, b)``." msgstr "" -msgid "Take a pointer to a tuple object, and return the size of that tuple. On error, return ``-1`` with an exception set." +#: ../../c-api/tuple.rst:50 +msgid "" +"Take a pointer to a tuple object, and return the size of that tuple. On " +"error, return ``-1`` with an exception set." msgstr "" +#: ../../c-api/tuple.rst:56 msgid "Like :c:func:`PyTuple_Size`, but without error checking." msgstr "" -msgid "Return the object at position *pos* in the tuple pointed to by *p*. If *pos* is negative or out of bounds, return ``NULL`` and set an :exc:`IndexError` exception." +#: ../../c-api/tuple.rst:61 +msgid "" +"Return the object at position *pos* in the tuple pointed to by *p*. If " +"*pos* is negative or out of bounds, return ``NULL`` and set " +"an :exc:`IndexError` exception." msgstr "" -msgid "The returned reference is borrowed from the tuple *p* (that is: it is only valid as long as you hold a reference to *p*). To get a :term:`strong reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` or :c:func:`PySequence_GetItem`." +#: ../../c-api/tuple.rst:64 +msgid "" +"The returned reference is borrowed from the tuple *p* (that is: it is only " +"valid as long as you hold a reference to *p*). To get a :term:`strong " +"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` " +"or :c:func:`PySequence_GetItem`." msgstr "" +#: ../../c-api/tuple.rst:73 msgid "Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments." msgstr "" -msgid "Return the slice of the tuple pointed to by *p* between *low* and *high*, or ``NULL`` with an exception set on failure." -msgstr "" - -msgid "This is the equivalent of the Python expression ``p[low:high]``. Indexing from the end of the tuple is not supported." +#: ../../c-api/tuple.rst:78 +msgid "" +"Return the slice of the tuple pointed to by *p* between *low* and *high*, or " +"``NULL`` with an exception set on failure." msgstr "" -msgid "Insert a reference to object *o* at position *pos* of the tuple pointed to by *p*. Return ``0`` on success. If *pos* is out of bounds, return ``-1`` and set an :exc:`IndexError` exception." +#: ../../c-api/tuple.rst:81 +msgid "" +"This is the equivalent of the Python expression ``p[low:high]``. Indexing " +"from the end of the tuple is not supported." msgstr "" -msgid "This function \"steals\" a reference to *o* and discards a reference to an item already in the tuple at the affected position." +#: ../../c-api/tuple.rst:87 +msgid "" +"Insert a reference to object *o* at position *pos* of the tuple pointed to " +"by *p*. Return ``0`` on success. If *pos* is out of bounds, return ``-1`` " +"and set an :exc:`IndexError` exception." msgstr "" -msgid "Like :c:func:`PyTuple_SetItem`, but does no error checking, and should *only* be used to fill in brand new tuples." +#: ../../c-api/tuple.rst:93 +msgid "" +"This function \":term:`steals `\" a reference to *o* and discards a " +"reference to an item already in the tuple at the affected position (unless " +"it was NULL)." msgstr "" -msgid "Bounds checking is performed as an assertion if Python is built in :ref:`debug mode ` or :option:`with assertions <--with-assertions>`." +#: ../../c-api/tuple.rst:100 +msgid "" +"Like :c:func:`PyTuple_SetItem`, but does no error checking, and should " +"*only* be used to fill in brand new tuples." msgstr "" -msgid "This function \"steals\" a reference to *o*, and, unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item that is being replaced; any reference in the tuple at position *pos* will be leaked." +#: ../../c-api/tuple.rst:103 ../../c-api/tuple.rst:225 +#: ../../c-api/tuple.rst:243 +msgid "" +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode ` or :option:`with assertions <--with-" +"assertions>`." msgstr "" -msgid "This macro should *only* be used on tuples that are newly created. Using this macro on a tuple that is already in use (or in other words, has a refcount > 1) could lead to undefined behavior." +#: ../../c-api/tuple.rst:108 +msgid "" +"This function \":term:`steals `\" a reference to *o*, and, " +"unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in the tuple at position *pos* will be " +"leaked." msgstr "" -msgid "Can be used to resize a tuple. *newsize* will be the new length of the tuple. Because tuples are *supposed* to be immutable, this should only be used if there is only one reference to the object. Do *not* use this if the tuple may already be known to some other part of the code. The tuple will always grow or shrink at the end. Think of this as destroying the old tuple and creating a new one, only more efficiently. Returns ``0`` on success. Client code should never assume that the resulting value of ``*p`` will be the same as before calling this function. If the object referenced by ``*p`` is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:`SystemError`." +#: ../../c-api/tuple.rst:115 +msgid "" +"This macro should *only* be used on tuples that are newly created. Using " +"this macro on a tuple that is already in use (or in other words, has a " +"refcount > 1) could lead to undefined behavior." msgstr "" +#: ../../c-api/tuple.rst:122 +msgid "" +"Can be used to resize a tuple. *newsize* will be the new length of the " +"tuple. Because tuples are *supposed* to be immutable, this should only be " +"used if there is only one reference to the object. Do *not* use this if the " +"tuple may already be known to some other part of the code. The tuple will " +"always grow or shrink at the end. Think of this as destroying the old tuple " +"and creating a new one, only more efficiently. Returns ``0`` on success. " +"Client code should never assume that the resulting value of ``*p`` will be " +"the same as before calling this function. If the object referenced by ``*p`` " +"is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` " +"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` " +"or :exc:`SystemError`." +msgstr "" + +#: ../../c-api/tuple.rst:137 msgid "Struct Sequence Objects" msgstr "" -msgid "Struct sequence objects are the C equivalent of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can also be accessed through attributes. To create a struct sequence, you first have to create a specific struct sequence type." +#: ../../c-api/tuple.rst:139 +msgid "" +"Struct sequence objects are the C equivalent " +"of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can " +"also be accessed through attributes. To create a struct sequence, you first " +"have to create a specific struct sequence type." msgstr "" -msgid "Create a new struct sequence type from the data in *desc*, described below. Instances of the resulting type can be created with :c:func:`PyStructSequence_New`." +#: ../../c-api/tuple.rst:146 +msgid "" +"Create a new struct sequence type from the data in *desc*, described below. " +"Instances of the resulting type can be created " +"with :c:func:`PyStructSequence_New`." msgstr "" +#: ../../c-api/tuple.rst:149 ../../c-api/tuple.rst:218 msgid "Return ``NULL`` with an exception set on failure." msgstr "" +#: ../../c-api/tuple.rst:154 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "" -msgid "Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and ``-1`` with an exception set on failure." +#: ../../c-api/tuple.rst:159 +msgid "" +"Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and " +"``-1`` with an exception set on failure." msgstr "" +#: ../../c-api/tuple.rst:167 msgid "Contains the meta information of a struct sequence type to create." msgstr "" -msgid "Fully qualified name of the type; null-terminated UTF-8 encoded. The name must contain the module name." +#: ../../c-api/tuple.rst:171 +msgid "" +"Fully qualified name of the type; null-terminated UTF-8 encoded. The name " +"must contain the module name." msgstr "" +#: ../../c-api/tuple.rst:176 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" +#: ../../c-api/tuple.rst:180 msgid "Pointer to ``NULL``-terminated array with field names of the new type." msgstr "" +#: ../../c-api/tuple.rst:184 msgid "Number of fields visible to the Python side (if used as tuple)." msgstr "" -msgid "Describes a field of a struct sequence. As a struct sequence is modeled as a tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:member:`~PyStructSequence_Desc.fields` array of the :c:type:`PyStructSequence_Desc` determines which field of the struct sequence is described." +#: ../../c-api/tuple.rst:189 +msgid "" +"Describes a field of a struct sequence. As a struct sequence is modeled as a " +"tuple, all fields are typed as :c:expr:`PyObject*`. The index in " +"the :c:member:`~PyStructSequence_Desc.fields` array of " +"the :c:type:`PyStructSequence_Desc` determines which field of the struct " +"sequence is described." msgstr "" -msgid "Name for the field or ``NULL`` to end the list of named fields, set to :c:data:`PyStructSequence_UnnamedField` to leave unnamed." +#: ../../c-api/tuple.rst:197 +msgid "" +"Name for the field or ``NULL`` to end the list of named fields, set " +"to :c:data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" +#: ../../c-api/tuple.rst:202 msgid "Field docstring or ``NULL`` to omit." msgstr "" +#: ../../c-api/tuple.rst:207 msgid "Special value for a field name to leave it unnamed." msgstr "" +#: ../../c-api/tuple.rst:209 msgid "The type was changed from ``char *``." msgstr "" -msgid "Creates an instance of *type*, which must have been created with :c:func:`PyStructSequence_NewType`." +#: ../../c-api/tuple.rst:215 +msgid "" +"Creates an instance of *type*, which must have been created " +"with :c:func:`PyStructSequence_NewType`." msgstr "" -msgid "Return the object at position *pos* in the struct sequence pointed to by *p*." +#: ../../c-api/tuple.rst:223 +msgid "" +"Return the object at position *pos* in the struct sequence pointed to by *p*." msgstr "" +#: ../../c-api/tuple.rst:231 msgid "Alias to :c:func:`PyStructSequence_GetItem`." msgstr "" +#: ../../c-api/tuple.rst:233 msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -msgid "Sets the field at index *pos* of the struct sequence *p* to value *o*. Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand new instances." +#: ../../c-api/tuple.rst:239 +msgid "" +"Sets the field at index *pos* of the struct sequence *p* to value *o*. " +"Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " +"new instances." msgstr "" -msgid "This function \"steals\" a reference to *o*." +#: ../../c-api/tuple.rst:248 +msgid "This function \":term:`steals `\" a reference to *o*." msgstr "" +#: ../../c-api/tuple.rst:253 msgid "Alias to :c:func:`PyStructSequence_SetItem`." msgstr "" +#: ../../c-api/tuple.rst:255 msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" +#: ../../c-api/tuple.rst:8 msgid "object" msgstr "" +#: ../../c-api/tuple.rst:8 msgid "tuple" msgstr "" diff --git a/c-api/type.po b/c-api/type.po index 79336411b..6b228dd5d 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,415 +23,822 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/type.rst:6 msgid "Type Objects" msgstr "" +#: ../../c-api/type.rst:13 msgid "The C structure of the objects used to describe built-in types." msgstr "" -msgid "This is the type object for type objects; it is the same object as :class:`type` in the Python layer." +#: ../../c-api/type.rst:18 +msgid "" +"This is the type object for type objects; it is the same object " +"as :class:`type` in the Python layer." msgstr "" -msgid "Return non-zero if the object *o* is a type object, including instances of types derived from the standard type object. Return 0 in all other cases. This function always succeeds." +#: ../../c-api/type.rst:24 +msgid "" +"Return non-zero if the object *o* is a type object, including instances of " +"types derived from the standard type object. Return 0 in all other cases. " +"This function always succeeds." msgstr "" -msgid "Return non-zero if the object *o* is a type object, but not a subtype of the standard type object. Return 0 in all other cases. This function always succeeds." +#: ../../c-api/type.rst:31 +msgid "" +"Return non-zero if the object *o* is a type object, but not a subtype of the " +"standard type object. Return 0 in all other cases. This function always " +"succeeds." msgstr "" +#: ../../c-api/type.rst:38 msgid "Clear the internal lookup cache. Return the current version tag." msgstr "" -msgid "Return the :c:member:`~PyTypeObject.tp_flags` member of *type*. This function is primarily meant for use with ``Py_LIMITED_API``; the individual flag bits are guaranteed to be stable across Python releases, but access to :c:member:`~PyTypeObject.tp_flags` itself is not part of the :ref:`limited API `." +#: ../../c-api/type.rst:42 +msgid "" +"Return the :c:member:`~PyTypeObject.tp_flags` member of *type*. This " +"function is primarily meant for use with ``Py_LIMITED_API``; the individual " +"flag bits are guaranteed to be stable across Python releases, but access " +"to :c:member:`~PyTypeObject.tp_flags` itself is not part of " +"the :ref:`limited API `." msgstr "" +#: ../../c-api/type.rst:49 msgid "The return type is now ``unsigned long`` rather than ``long``." msgstr "" -msgid "Return the type object's internal namespace, which is otherwise only exposed via a read-only proxy (:attr:`cls.__dict__ `). This is a replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The returned dictionary must be treated as read-only." +#: ../../c-api/type.rst:55 +msgid "" +"Return the type object's internal namespace, which is otherwise only exposed " +"via a read-only proxy (:attr:`cls.__dict__ `). This is a " +"replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The " +"returned dictionary must be treated as read-only." msgstr "" -msgid "This function is meant for specific embedding and language-binding cases, where direct access to the dict is necessary and indirect access (e.g. via the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." +#: ../../c-api/type.rst:61 +msgid "" +"This function is meant for specific embedding and language-binding cases, " +"where direct access to the dict is necessary and indirect access (e.g. via " +"the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." msgstr "" -msgid "Extension modules should continue to use ``tp_dict``, directly or indirectly, when setting up their own types." +#: ../../c-api/type.rst:65 +msgid "" +"Extension modules should continue to use ``tp_dict``, directly or " +"indirectly, when setting up their own types." msgstr "" -msgid "Invalidate the internal lookup cache for the type and all of its subtypes. This function must be called after any manual modification of the attributes or base classes of the type." +#: ../../c-api/type.rst:73 +msgid "" +"Invalidate the internal lookup cache for the type and all of its subtypes. " +"This function must be called after any manual modification of the attributes " +"or base classes of the type." msgstr "" -msgid "Register *callback* as a type watcher. Return a non-negative integer ID which must be passed to future calls to :c:func:`PyType_Watch`. In case of error (e.g. no more watcher IDs available), return ``-1`` and set an exception." +#: ../../c-api/type.rst:80 +msgid "" +"Register *callback* as a type watcher. Return a non-negative integer ID " +"which must be passed to future calls to :c:func:`PyType_Watch`. In case of " +"error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." msgstr "" -msgid "In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so it must be called at start up (before spawning the first thread)." +#: ../../c-api/type.rst:85 +msgid "" +"In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so " +"it must be called at start up (before spawning the first thread)." msgstr "" -msgid "Clear watcher identified by *watcher_id* (previously returned from :c:func:`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if *watcher_id* was never registered.)" +#: ../../c-api/type.rst:93 +msgid "" +"Clear watcher identified by *watcher_id* (previously returned " +"from :c:func:`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error " +"(e.g. if *watcher_id* was never registered.)" msgstr "" -msgid "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* that was not returned to it by a previous call to :c:func:`PyType_AddWatcher`." +#: ../../c-api/type.rst:97 +msgid "" +"An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " +"that was not returned to it by a previous call " +"to :c:func:`PyType_AddWatcher`." msgstr "" -msgid "Mark *type* as watched. The callback granted *watcher_id* by :c:func:`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` reports a change to *type*. (The callback may be called only once for a series of consecutive modifications to *type*, if :c:func:`!_PyType_Lookup` is not called on *type* between the modifications; this is an implementation detail and subject to change.)" +#: ../../c-api/type.rst:106 +msgid "" +"Mark *type* as watched. The callback granted *watcher_id* " +"by :c:func:`PyType_AddWatcher` will be called " +"whenever :c:func:`PyType_Modified` reports a change to *type*. (The callback " +"may be called only once for a series of consecutive modifications to *type*, " +"if :c:func:`!_PyType_Lookup` is not called on *type* between the " +"modifications; this is an implementation detail and subject to change.)" msgstr "" -msgid "An extension should never call ``PyType_Watch`` with a *watcher_id* that was not returned to it by a previous call to :c:func:`PyType_AddWatcher`." +#: ../../c-api/type.rst:113 +msgid "" +"An extension should never call ``PyType_Watch`` with a *watcher_id* that was " +"not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -msgid "Mark *type* as not watched. This undoes a previous call to :c:func:`PyType_Watch`. *type* must not be ``NULL``." +#: ../../c-api/type.rst:121 +msgid "" +"Mark *type* as not watched. This undoes a previous call " +"to :c:func:`PyType_Watch`. *type* must not be ``NULL``." msgstr "" -msgid "An extension should never call this function with a *watcher_id* that was not returned to it by a previous call to :c:func:`PyType_AddWatcher`." +#: ../../c-api/type.rst:124 +msgid "" +"An extension should never call this function with a *watcher_id* that was " +"not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -msgid "On success, this function returns ``0``. On failure, this function returns ``-1`` with an exception set." +#: ../../c-api/type.rst:127 +msgid "" +"On success, this function returns ``0``. On failure, this function returns " +"``-1`` with an exception set." msgstr "" +#: ../../c-api/type.rst:135 msgid "Type of a type-watcher callback function." msgstr "" -msgid "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be called on *type* or any type in its MRO; violating this rule could cause infinite recursion." +#: ../../c-api/type.rst:137 +msgid "" +"The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " +"called on *type* or any type in its MRO; violating this rule could cause " +"infinite recursion." msgstr "" -msgid "Return non-zero if the type object *o* sets the feature *feature*. Type features are denoted by single bit flags." +#: ../../c-api/type.rst:146 +msgid "" +"Return non-zero if the type object *o* sets the feature *feature*. Type " +"features are denoted by single bit flags." msgstr "" -msgid "Return non-zero if the type object *type* sets the subclass flag *flag*. Subclass flags are denoted by :c:macro:`Py_TPFLAGS_*_SUBCLASS `. This function is used by many ``_Check`` functions for common types." +#: ../../c-api/type.rst:152 +msgid "" +"Return non-zero if the type object *type* sets the subclass flag *flag*. " +"Subclass flags are denoted by :c:macro:`Py_TPFLAGS_*_SUBCLASS " +"`. This function is used by many ``_Check`` " +"functions for common types." msgstr "" -msgid ":c:func:`PyObject_TypeCheck`, which is used as a slower alternative in ``_Check`` functions for types that don't come with subclass flags." +#: ../../c-api/type.rst:158 +msgid "" +":c:func:`PyObject_TypeCheck`, which is used as a slower alternative in " +"``_Check`` functions for types that don't come with subclass flags." msgstr "" -msgid "Return true if the type object includes support for the cycle detector; this tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." +#: ../../c-api/type.rst:164 +msgid "" +"Return true if the type object includes support for the cycle detector; this " +"tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" +#: ../../c-api/type.rst:170 msgid "Return true if *a* is a subtype of *b*." msgstr "" -msgid "This function only checks for actual subtypes, which means that :meth:`~type.__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` to do the same check that :func:`issubclass` would do." -msgstr "" - -msgid "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type object. Uses Python's default memory allocation mechanism to allocate memory for a new instance, zeros the memory, then initializes the memory as if by calling :c:func:`PyObject_Init` or :c:func:`PyObject_InitVar`." +#: ../../c-api/type.rst:172 +msgid "" +"This function only checks for actual subtypes, which means " +"that :meth:`~type.__subclasscheck__` is not called on *b*. " +"Call :c:func:`PyObject_IsSubclass` to do the same check " +"that :func:`issubclass` would do." msgstr "" -msgid "Do not call this directly to allocate memory for an object; call the type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +#: ../../c-api/type.rst:180 +msgid "" +"Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " +"object. Uses Python's default memory allocation mechanism to allocate " +"memory for a new instance, zeros the memory, then initializes the memory as " +"if by calling :c:func:`PyObject_Init` or :c:func:`PyObject_InitVar`." msgstr "" -msgid "For types that support garbage collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set), this function behaves like :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar` (except the memory is guaranteed to be zeroed before initialization), and should be paired with :c:func:`PyObject_GC_Del` in :c:member:`~PyTypeObject.tp_free`. Otherwise, it behaves like :c:macro:`PyObject_New` or :c:macro:`PyObject_NewVar` (except the memory is guaranteed to be zeroed before initialization) and should be paired with :c:func:`PyObject_Free` in :c:member:`~PyTypeObject.tp_free`." +#: ../../c-api/type.rst:185 +msgid "" +"Do not call this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" -msgid "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type object. Creates a new instance using the type's :c:member:`~PyTypeObject.tp_alloc` slot and returns the resulting object." +#: ../../c-api/type.rst:188 +msgid "" +"For types that support garbage collection (i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set), this function behaves " +"like :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar` (except the " +"memory is guaranteed to be zeroed before initialization), and should be " +"paired with :c:func:`PyObject_GC_Del` in :c:member:`~PyTypeObject.tp_free`. " +"Otherwise, it behaves like :c:macro:`PyObject_New` " +"or :c:macro:`PyObject_NewVar` (except the memory is guaranteed to be zeroed " +"before initialization) and should be paired with :c:func:`PyObject_Free` " +"in :c:member:`~PyTypeObject.tp_free`." +msgstr "" + +#: ../../c-api/type.rst:201 +msgid "" +"Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " +"object. Creates a new instance using the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot and returns the resulting " +"object." msgstr "" -msgid "Finalize a type object. This should be called on all type objects to finish their initialization. This function is responsible for adding inherited slots from a type's base class. Return ``0`` on success, or return ``-1`` and sets an exception on error." +#: ../../c-api/type.rst:208 +msgid "" +"Finalize a type object. This should be called on all type objects to finish " +"their initialization. This function is responsible for adding inherited " +"slots from a type's base class. Return ``0`` on success, or return ``-1`` " +"and sets an exception on error." msgstr "" -msgid "If some of the base classes implements the GC protocol and the provided type does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC protocol will be automatically implemented from its parents. On the contrary, if the type being created does include :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags then it **must** implement the GC protocol itself by at least implementing the :c:member:`~PyTypeObject.tp_traverse` handle." +#: ../../c-api/type.rst:214 +msgid "" +"If some of the base classes implements the GC protocol and the provided type " +"does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " +"protocol will be automatically implemented from its parents. On the " +"contrary, if the type being created does " +"include :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags then it **must** " +"implement the GC protocol itself by at least implementing " +"the :c:member:`~PyTypeObject.tp_traverse` handle." msgstr "" -msgid "Return the type's name. Equivalent to getting the type's :attr:`~type.__name__` attribute." +#: ../../c-api/type.rst:225 +msgid "" +"Return the type's name. Equivalent to getting the " +"type's :attr:`~type.__name__` attribute." msgstr "" -msgid "Return the type's qualified name. Equivalent to getting the type's :attr:`~type.__qualname__` attribute." +#: ../../c-api/type.rst:233 +msgid "" +"Return the type's qualified name. Equivalent to getting the " +"type's :attr:`~type.__qualname__` attribute." msgstr "" -msgid "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}.{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type.__module__` is not a string or is equal to ``\"builtins\"``." +#: ../../c-api/type.rst:240 +msgid "" +"Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." +"{type.__qualname__}\"``, or :attr:`type.__qualname__` " +"if :attr:`type.__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -msgid "Return the type's module name. Equivalent to getting the :attr:`type.__module__` attribute." +#: ../../c-api/type.rst:249 +msgid "" +"Return the type's module name. Equivalent to getting " +"the :attr:`type.__module__` attribute." msgstr "" -msgid "Return the function pointer stored in the given slot. If the result is ``NULL``, this indicates that either the slot is ``NULL``, or that the function was called with invalid parameters. Callers will typically cast the result pointer into the appropriate function type." +#: ../../c-api/type.rst:257 +msgid "" +"Return the function pointer stored in the given slot. If the result is " +"``NULL``, this indicates that either the slot is ``NULL``, or that the " +"function was called with invalid parameters. Callers will typically cast the " +"result pointer into the appropriate function type." msgstr "" -msgid "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." +#: ../../c-api/type.rst:263 +msgid "" +"See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -msgid ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was limited to :ref:`heap types `." +#: ../../c-api/type.rst:267 +msgid "" +":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " +"limited to :ref:`heap types `." msgstr "" -msgid "Return the module object associated with the given type when the type was created using :c:func:`PyType_FromModuleAndSpec`." +#: ../../c-api/type.rst:274 +msgid "" +"Return the module object associated with the given type when the type was " +"created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -msgid "The returned reference is :term:`borrowed ` from *type*, and will be valid as long as you hold a reference to *type*. Do not release it with :c:func:`Py_DECREF` or similar." +#: ../../c-api/type.rst:277 ../../c-api/type.rst:324 +msgid "" +"The returned reference is :term:`borrowed ` from *type*, " +"and will be valid as long as you hold a reference to *type*. Do not release " +"it with :c:func:`Py_DECREF` or similar." msgstr "" -msgid "If no module is associated with the given type, sets :py:class:`TypeError` and returns ``NULL``." +#: ../../c-api/type.rst:281 ../../c-api/type.rst:302 +msgid "" +"If no module is associated with the given type, sets :py:class:`TypeError` " +"and returns ``NULL``." msgstr "" -msgid "This function is usually used to get the module in which a method is defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may not return the intended result. ``Py_TYPE(self)`` may be a *subclass* of the intended class, and subclasses are not necessarily defined in the same module as their superclass. See :c:type:`PyCMethod` to get the class that defines the method. See :c:func:`PyType_GetModuleByDef` for cases when :c:type:`!PyCMethod` cannot be used." +#: ../../c-api/type.rst:284 +msgid "" +"This function is usually used to get the module in which a method is " +"defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " +"not return the intended result. ``Py_TYPE(self)`` may be a *subclass* of the " +"intended class, and subclasses are not necessarily defined in the same " +"module as their superclass. See :c:type:`PyCMethod` to get the class that " +"defines the method. See :c:func:`PyType_GetModuleByDef` for cases " +"when :c:type:`!PyCMethod` cannot be used." msgstr "" -msgid "Return the state of the module object associated with the given type. This is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:func:`PyType_GetModule`." +#: ../../c-api/type.rst:298 +msgid "" +"Return the state of the module object associated with the given type. This " +"is a shortcut for calling :c:func:`PyModule_GetState()` on the result " +"of :c:func:`PyType_GetModule`." msgstr "" -msgid "If the *type* has an associated module but its state is ``NULL``, returns ``NULL`` without setting an exception." +#: ../../c-api/type.rst:305 +msgid "" +"If the *type* has an associated module but its state is ``NULL``, returns " +"``NULL`` without setting an exception." msgstr "" -msgid "Find the first superclass whose module was created from the given :c:type:`PyModuleDef` *def*, and return that module." +#: ../../c-api/type.rst:313 +msgid "" +"Find the first superclass whose module was created from the " +"given :c:type:`PyModuleDef` *def*, and return that module." msgstr "" -msgid "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." +#: ../../c-api/type.rst:316 +msgid "" +"If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -msgid "This function is intended to be used together with :c:func:`PyModule_GetState()` to get module state from slot methods (such as :c:member:`~PyTypeObject.tp_init` or :c:member:`~PyNumberMethods.nb_add`) and other places where a method's defining class cannot be passed using the :c:type:`PyCMethod` calling convention." +#: ../../c-api/type.rst:318 +msgid "" +"This function is intended to be used together " +"with :c:func:`PyModule_GetState()` to get module state from slot methods " +"(such as :c:member:`~PyTypeObject.tp_init` " +"or :c:member:`~PyNumberMethods.nb_add`) and other places where a method's " +"defining class cannot be passed using the :c:type:`PyCMethod` calling " +"convention." msgstr "" -msgid "Find the first superclass in *type*'s :term:`method resolution order` whose :c:macro:`Py_tp_token` token is equal to the given one." +#: ../../c-api/type.rst:333 +msgid "" +"Find the first superclass in *type*'s :term:`method resolution order` " +"whose :c:macro:`Py_tp_token` token is equal to the given one." msgstr "" -msgid "If found, set *\\*result* to a new :term:`strong reference` to it and return ``1``." +#: ../../c-api/type.rst:336 +msgid "" +"If found, set *\\*result* to a new :term:`strong reference` to it and return " +"``1``." msgstr "" +#: ../../c-api/type.rst:338 msgid "If not found, set *\\*result* to ``NULL`` and return ``0``." msgstr "" -msgid "On error, set *\\*result* to ``NULL`` and return ``-1`` with an exception set." +#: ../../c-api/type.rst:339 +msgid "" +"On error, set *\\*result* to ``NULL`` and return ``-1`` with an exception " +"set." msgstr "" -msgid "The *result* argument may be ``NULL``, in which case *\\*result* is not set. Use this if you need only the return value." +#: ../../c-api/type.rst:342 +msgid "" +"The *result* argument may be ``NULL``, in which case *\\*result* is not set. " +"Use this if you need only the return value." msgstr "" +#: ../../c-api/type.rst:345 msgid "The *token* argument may not be ``NULL``." msgstr "" +#: ../../c-api/type.rst:352 msgid "Attempt to assign a version tag to the given type." msgstr "" -msgid "Returns 1 if the type already had a valid version tag or a new one was assigned, or 0 if a new tag could not be assigned." +#: ../../c-api/type.rst:354 +msgid "" +"Returns 1 if the type already had a valid version tag or a new one was " +"assigned, or 0 if a new tag could not be assigned." msgstr "" -msgid "Return true if instances of *type* support creating weak references, false otherwise. This function always succeeds. *type* must not be ``NULL``." +#: ../../c-api/type.rst:362 +msgid "" +"Return true if instances of *type* support creating weak references, false " +"otherwise. This function always succeeds. *type* must not be ``NULL``." msgstr "" +#: ../../c-api/type.rst:366 msgid ":ref:`weakrefobjects`" msgstr "" +#: ../../c-api/type.rst:367 msgid ":py:mod:`weakref`" msgstr "" +#: ../../c-api/type.rst:371 msgid "Creating Heap-Allocated Types" msgstr "" -msgid "The following functions and structs are used to create :ref:`heap types `." +#: ../../c-api/type.rst:373 +msgid "" +"The following functions and structs are used to create :ref:`heap types " +"`." msgstr "" -msgid "Create and return a :ref:`heap type ` from the *spec* (see :c:macro:`Py_TPFLAGS_HEAPTYPE`)." +#: ../../c-api/type.rst:378 +msgid "" +"Create and return a :ref:`heap type ` from the *spec* " +"(see :c:macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -msgid "The metaclass *metaclass* is used to construct the resulting type object. When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or *Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." +#: ../../c-api/type.rst:381 +msgid "" +"The metaclass *metaclass* is used to construct the resulting type object. " +"When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " +"*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -msgid "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not supported, except if ``tp_new`` is ``NULL``." +#: ../../c-api/type.rst:385 +msgid "" +"Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " +"supported, except if ``tp_new`` is ``NULL``." msgstr "" -msgid "The *bases* argument can be used to specify base classes; it can either be only one class or a tuple of classes. If *bases* is ``NULL``, the :c:data:`Py_tp_bases` slot is used instead. If that also is ``NULL``, the :c:data:`Py_tp_base` slot is used instead. If that also is ``NULL``, the new type derives from :class:`object`." +#: ../../c-api/type.rst:388 +msgid "" +"The *bases* argument can be used to specify base classes; it can either be " +"only one class or a tuple of classes. If *bases* is ``NULL``, " +"the :c:data:`Py_tp_bases` slot is used instead. If that also is ``NULL``, " +"the :c:data:`Py_tp_base` slot is used instead. If that also is ``NULL``, the " +"new type derives from :class:`object`." msgstr "" -msgid "The *module* argument can be used to record the module in which the new class is defined. It must be a module object or ``NULL``. If not ``NULL``, the module is associated with the new type and can later be retrieved with :c:func:`PyType_GetModule`. The associated module is not inherited by subclasses; it must be specified for each class individually." +#: ../../c-api/type.rst:394 +msgid "" +"The *module* argument can be used to record the module in which the new " +"class is defined. It must be a module object or ``NULL``. If not ``NULL``, " +"the module is associated with the new type and can later be retrieved " +"with :c:func:`PyType_GetModule`. The associated module is not inherited by " +"subclasses; it must be specified for each class individually." msgstr "" +#: ../../c-api/type.rst:401 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -msgid "Note that this function does *not* fully match the behavior of calling :py:class:`type() ` or using the :keyword:`class` statement. With user-provided base types or metaclasses, prefer :ref:`calling ` :py:class:`type` (or the metaclass) over ``PyType_From*`` functions. Specifically:" +#: ../../c-api/type.rst:403 +msgid "" +"Note that this function does *not* fully match the behavior of " +"calling :py:class:`type() ` or using the :keyword:`class` statement. " +"With user-provided base types or metaclasses, prefer :ref:`calling ` :py:class:`type` (or the metaclass) over ``PyType_From*`` functions. " +"Specifically:" msgstr "" -msgid ":py:meth:`~object.__new__` is not called on the new class (and it must be set to ``type.__new__``)." +#: ../../c-api/type.rst:410 +msgid "" +":py:meth:`~object.__new__` is not called on the new class (and it must be " +"set to ``type.__new__``)." msgstr "" +#: ../../c-api/type.rst:412 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" +#: ../../c-api/type.rst:413 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" +#: ../../c-api/type.rst:414 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" +#: ../../c-api/type.rst:421 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "" -msgid "The function now accepts a single class as the *bases* argument and ``NULL`` as the ``tp_doc`` slot." +#: ../../c-api/type.rst:427 +msgid "" +"The function now accepts a single class as the *bases* argument and ``NULL`` " +"as the ``tp_doc`` slot." msgstr "" -msgid "The function now finds and uses a metaclass corresponding to the provided base classes. Previously, only :class:`type` instances were returned." +#: ../../c-api/type.rst:432 ../../c-api/type.rst:454 +msgid "" +"The function now finds and uses a metaclass corresponding to the provided " +"base classes. Previously, only :class:`type` instances were returned." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which may result in incomplete initialization. Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` is deprecated." +#: ../../c-api/type.rst:435 ../../c-api/type.rst:457 ../../c-api/type.rst:478 +msgid "" +"The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " +"may result in incomplete initialization. Creating classes whose metaclass " +"overrides :c:member:`~PyTypeObject.tp_new` is deprecated." msgstr "" -msgid "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` is no longer allowed." +#: ../../c-api/type.rst:442 ../../c-api/type.rst:464 ../../c-api/type.rst:485 +msgid "" +"Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " +"is no longer allowed." msgstr "" +#: ../../c-api/type.rst:448 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "" +#: ../../c-api/type.rst:470 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "" -msgid "The function now finds and uses a metaclass corresponding to the base classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` instances were returned." +#: ../../c-api/type.rst:474 +msgid "" +"The function now finds and uses a metaclass corresponding to the base " +"classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " +"instances were returned." msgstr "" -msgid "Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag." +#: ../../c-api/type.rst:491 +msgid "" +"Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag." msgstr "" +#: ../../c-api/type.rst:493 msgid "All base classes of *type* must be immutable." msgstr "" +#: ../../c-api/type.rst:495 msgid "On success, return ``0``. On error, set an exception and return ``-1``." msgstr "" -msgid "The type must not be used before it's made immutable. For example, type instances must not be created before the type is made immutable." +#: ../../c-api/type.rst:498 +msgid "" +"The type must not be used before it's made immutable. For example, type " +"instances must not be created before the type is made immutable." msgstr "" +#: ../../c-api/type.rst:514 msgid "Structure defining a type's behavior." msgstr "" +#: ../../c-api/type.rst:518 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -msgid "If positive, specifies the size of the instance in bytes. It is used to set :c:member:`PyTypeObject.tp_basicsize`." +#: ../../c-api/type.rst:522 +msgid "" +"If positive, specifies the size of the instance in bytes. It is used to " +"set :c:member:`PyTypeObject.tp_basicsize`." msgstr "" -msgid "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be inherited." +#: ../../c-api/type.rst:525 +msgid "" +"If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " +"inherited." msgstr "" -msgid "If negative, the absolute value specifies how much space instances of the class need *in addition* to the superclass. Use :c:func:`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved this way. For negative :c:member:`!basicsize`, Python will insert padding when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment requirements." +#: ../../c-api/type.rst:528 +msgid "" +"If negative, the absolute value specifies how much space instances of the " +"class need *in addition* to the superclass. " +"Use :c:func:`PyObject_GetTypeData` to get a pointer to subclass-specific " +"memory reserved this way. For negative :c:member:`!basicsize`, Python will " +"insert padding when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s " +"alignment requirements." msgstr "" +#: ../../c-api/type.rst:538 msgid "Previously, this field could not be negative." msgstr "" -msgid "Size of one element of a variable-size type, in bytes. Used to set :c:member:`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." +#: ../../c-api/type.rst:542 +msgid "" +"Size of one element of a variable-size type, in bytes. Used to " +"set :c:member:`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation " +"for caveats." msgstr "" -msgid "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending arbitrary variable-sized classes is dangerous, since some types use a fixed offset for variable-sized memory, which can then overlap fixed-sized memory used by a subclass. To help prevent mistakes, inheriting ``itemsize`` is only possible in the following situations:" +#: ../../c-api/type.rst:546 +msgid "" +"If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " +"arbitrary variable-sized classes is dangerous, since some types use a fixed " +"offset for variable-sized memory, which can then overlap fixed-sized memory " +"used by a subclass. To help prevent mistakes, inheriting ``itemsize`` is " +"only possible in the following situations:" msgstr "" -msgid "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." +#: ../../c-api/type.rst:553 +msgid "" +"The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize` is " +"zero)." msgstr "" -msgid "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that the memory layout of the base class is known." +#: ../../c-api/type.rst:555 +msgid "" +"The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " +"the memory layout of the base class is known." msgstr "" -msgid "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the subclass does not access the instance's memory directly." +#: ../../c-api/type.rst:557 +msgid "" +"The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " +"subclass does not access the instance's memory directly." msgstr "" +#: ../../c-api/type.rst:560 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" +#: ../../c-api/type.rst:564 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -msgid "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:`PyType_FromSpecWithBases` sets it automatically." +#: ../../c-api/type.rst:566 +msgid "" +"If the ``Py_TPFLAGS_HEAPTYPE`` flag is not " +"set, :c:func:`PyType_FromSpecWithBases` sets it automatically." msgstr "" -msgid "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot value ``{0, NULL}``." +#: ../../c-api/type.rst:571 +msgid "" +"Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " +"value ``{0, NULL}``." msgstr "" +#: ../../c-api/type.rst:574 msgid "Each slot ID should be specified at most once." msgstr "" -msgid "Structure defining optional functionality of a type, containing a slot ID and a value pointer." +#: ../../c-api/type.rst:584 +msgid "" +"Structure defining optional functionality of a type, containing a slot ID " +"and a value pointer." msgstr "" +#: ../../c-api/type.rst:589 msgid "A slot ID." msgstr "" -msgid "Slot IDs are named like the field names of the structures :c:type:`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:type:`PyMappingMethods` and :c:type:`PyAsyncMethods` with an added ``Py_`` prefix. For example, use:" +#: ../../c-api/type.rst:591 +msgid "" +"Slot IDs are named like the field names of the " +"structures :c:type:`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:type:`PyMappingMethods` " +"and :c:type:`PyAsyncMethods` with an added ``Py_`` prefix. For example, use:" msgstr "" +#: ../../c-api/type.rst:597 msgid ":c:data:`Py_tp_dealloc` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" +#: ../../c-api/type.rst:598 msgid ":c:data:`Py_nb_add` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" +#: ../../c-api/type.rst:599 msgid ":c:data:`Py_sq_length` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -msgid "An additional slot is supported that does not correspond to a :c:type:`!PyTypeObject` struct field:" +#: ../../c-api/type.rst:601 +msgid "" +"An additional slot is supported that does not correspond to a :c:type:`!" +"PyTypeObject` struct field:" msgstr "" +#: ../../c-api/type.rst:604 msgid ":c:data:`Py_tp_token`" msgstr "" -msgid "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" +#: ../../c-api/type.rst:606 +msgid "" +"The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -msgid ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" +#: ../../c-api/type.rst:608 +msgid "" +":c:member:`~PyTypeObject.tp_weaklistoffset` " +"(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -msgid ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead if possible)" +#: ../../c-api/type.rst:610 +msgid "" +":c:member:`~PyTypeObject.tp_dictoffset` " +"(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead if possible)" msgstr "" -msgid ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use ``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" +#: ../../c-api/type.rst:612 +msgid "" +":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " +"``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" msgstr "" -msgid "If it is not possible to switch to a ``MANAGED`` flag (for example, for vectorcall or to support Python older than 3.12), specify the offset in :c:data:`Py_tp_members`. See :ref:`PyMemberDef documentation ` for details." +#: ../../c-api/type.rst:616 +msgid "" +"If it is not possible to switch to a ``MANAGED`` flag (for example, for " +"vectorcall or to support Python older than 3.12), specify the offset " +"in :c:data:`Py_tp_members`. See :ref:`PyMemberDef documentation ` for details." msgstr "" -msgid "The following internal fields cannot be set at all when creating a heap type:" +#: ../../c-api/type.rst:622 +msgid "" +"The following internal fields cannot be set at all when creating a heap type:" msgstr "" -msgid ":c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject.tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject.tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." +#: ../../c-api/type.rst:625 +msgid "" +":c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject.tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject.tp_subclasses`, " +"and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -msgid "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on some platforms. To avoid issues, use the *bases* argument of :c:func:`PyType_FromSpecWithBases` instead." +#: ../../c-api/type.rst:631 +msgid "" +"Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " +"some platforms. To avoid issues, use the *bases* argument " +"of :c:func:`PyType_FromSpecWithBases` instead." msgstr "" +#: ../../c-api/type.rst:636 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -msgid ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs.bf_releasebuffer` are now available under the :ref:`limited API `." +#: ../../c-api/type.rst:639 +msgid "" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"and :c:member:`~PyBufferProcs.bf_releasebuffer` are now available under " +"the :ref:`limited API `." msgstr "" -msgid "The field :c:member:`~PyTypeObject.tp_vectorcall` can now be set using :c:data:`Py_tp_vectorcall`. See the field's documentation for details." +#: ../../c-api/type.rst:644 +msgid "" +"The field :c:member:`~PyTypeObject.tp_vectorcall` can now be set " +"using :c:data:`Py_tp_vectorcall`. See the field's documentation for details." msgstr "" -msgid "The desired value of the slot. In most cases, this is a pointer to a function." +#: ../../c-api/type.rst:651 +msgid "" +"The desired value of the slot. In most cases, this is a pointer to a " +"function." msgstr "" +#: ../../c-api/type.rst:654 msgid "*pfunc* values may not be ``NULL``, except for the following slots:" msgstr "" +#: ../../c-api/type.rst:656 msgid ":c:data:`Py_tp_doc`" msgstr "" -msgid ":c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC` rather than ``NULL``)" +#: ../../c-api/type.rst:657 +msgid "" +":c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC` rather " +"than ``NULL``)" msgstr "" -msgid "A :c:member:`~PyType_Slot.slot` that records a static memory layout ID for a class." +#: ../../c-api/type.rst:663 +msgid "" +"A :c:member:`~PyType_Slot.slot` that records a static memory layout ID for a " +"class." msgstr "" -msgid "If the :c:type:`PyType_Spec` of the class is statically allocated, the token can be set to the spec using the special value :c:data:`Py_TP_USE_SPEC`:" +#: ../../c-api/type.rst:666 +msgid "" +"If the :c:type:`PyType_Spec` of the class is statically allocated, the token " +"can be set to the spec using the special value :c:data:`Py_TP_USE_SPEC`:" msgstr "" +#: ../../c-api/type.rst:670 msgid "" "static PyType_Slot foo_slots[] = {\n" " {Py_tp_token, Py_TP_USE_SPEC}," msgstr "" +#: ../../c-api/type.rst:675 msgid "It can also be set to an arbitrary pointer, but you must ensure that:" msgstr "" -msgid "The pointer outlives the class, so it's not reused for something else while the class exists." +#: ../../c-api/type.rst:677 +msgid "" +"The pointer outlives the class, so it's not reused for something else while " +"the class exists." msgstr "" -msgid "It \"belongs\" to the extension module where the class lives, so it will not clash with other extensions." +#: ../../c-api/type.rst:679 +msgid "" +"It \"belongs\" to the extension module where the class lives, so it will not " +"clash with other extensions." msgstr "" -msgid "Use :c:func:`PyType_GetBaseByToken` to check if a class's superclass has a given token -- that is, check whether the memory layout is compatible." +#: ../../c-api/type.rst:682 +msgid "" +"Use :c:func:`PyType_GetBaseByToken` to check if a class's superclass has a " +"given token -- that is, check whether the memory layout is compatible." msgstr "" -msgid "To get the token for a given class (without considering superclasses), use :c:func:`PyType_GetSlot` with ``Py_tp_token``." +#: ../../c-api/type.rst:685 +msgid "" +"To get the token for a given class (without considering superclasses), " +"use :c:func:`PyType_GetSlot` with ``Py_tp_token``." msgstr "" -msgid "Used as a value with :c:data:`Py_tp_token` to set the token to the class's :c:type:`PyType_Spec`. Expands to ``NULL``." +#: ../../c-api/type.rst:694 +msgid "" +"Used as a value with :c:data:`Py_tp_token` to set the token to the " +"class's :c:type:`PyType_Spec`. Expands to ``NULL``." msgstr "" +#: ../../c-api/type.rst:8 msgid "object" msgstr "" +#: ../../c-api/type.rst:8 msgid "type" msgstr "" diff --git a/c-api/typehints.po b/c-api/typehints.po index ca7beff8d..79add324c 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,30 +21,54 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/typehints.rst:6 msgid "Objects for Type Hinting" msgstr "" -msgid "Various built-in types for type hinting are provided. Currently, two types exist -- :ref:`GenericAlias ` and :ref:`Union `. Only ``GenericAlias`` is exposed to C." +#: ../../c-api/typehints.rst:8 +msgid "" +"Various built-in types for type hinting are provided. Currently, two types " +"exist -- :ref:`GenericAlias ` and :ref:`Union `. Only ``GenericAlias`` is exposed to C." msgstr "" -msgid "Create a :ref:`GenericAlias ` object. Equivalent to calling the Python class :class:`types.GenericAlias`. The *origin* and *args* arguments set the ``GenericAlias``\\ 's ``__origin__`` and ``__args__`` attributes respectively. *origin* should be a :c:expr:`PyTypeObject*`, and *args* can be a :c:expr:`PyTupleObject*` or any ``PyObject*``. If *args* passed is not a tuple, a 1-tuple is automatically constructed and ``__args__`` is set to ``(args,)``. Minimal checking is done for the arguments, so the function will succeed even if *origin* is not a type. The ``GenericAlias``\\ 's ``__parameters__`` attribute is constructed lazily from ``__args__``. On failure, an exception is raised and ``NULL`` is returned." +#: ../../c-api/typehints.rst:14 +msgid "" +"Create a :ref:`GenericAlias ` object. Equivalent to " +"calling the Python class :class:`types.GenericAlias`. The *origin* and " +"*args* arguments set the ``GenericAlias``\\ 's ``__origin__`` and " +"``__args__`` attributes respectively. *origin* should be " +"a :c:expr:`PyTypeObject*`, and *args* can be a :c:expr:`PyTupleObject*` or " +"any ``PyObject*``. If *args* passed is not a tuple, a 1-tuple is " +"automatically constructed and ``__args__`` is set to ``(args,)``. Minimal " +"checking is done for the arguments, so the function will succeed even if " +"*origin* is not a type. The ``GenericAlias``\\ 's ``__parameters__`` " +"attribute is constructed lazily from ``__args__``. On failure, an exception " +"is raised and ``NULL`` is returned." msgstr "" +#: ../../c-api/typehints.rst:28 msgid "Here's an example of how to make an extension type generic::" msgstr "" +#: ../../c-api/typehints.rst:30 msgid "" "...\n" "static PyMethodDef my_obj_methods[] = {\n" " // Other methods.\n" " ...\n" -" {\"__class_getitem__\", Py_GenericAlias, METH_O|METH_CLASS, \"my_obj is generic over its contained type\"}\n" +" {\"__class_getitem__\", Py_GenericAlias, METH_O|METH_CLASS, \"my_obj is " +"generic over its contained type\"}\n" " ...\n" "}" msgstr "" +#: ../../c-api/typehints.rst:38 msgid "The data model method :meth:`~object.__class_getitem__`." msgstr "" -msgid "The C type of the object returned by :c:func:`Py_GenericAlias`. Equivalent to :class:`types.GenericAlias` in Python." +#: ../../c-api/typehints.rst:44 +msgid "" +"The C type of the object returned by :c:func:`Py_GenericAlias`. Equivalent " +"to :class:`types.GenericAlias` in Python." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index a1efe89ab..6373b81be 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,408 +24,608 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/typeobj.rst:6 msgid "Type Object Structures" msgstr "" -msgid "Perhaps one of the most important structures of the Python object system is the structure that defines a new type: the :c:type:`PyTypeObject` structure. Type objects can be handled using any of the ``PyObject_*`` or ``PyType_*`` functions, but do not offer much that's interesting to most Python applications. These objects are fundamental to how objects behave, so they are very important to the interpreter itself and to any extension module that implements new types." +#: ../../c-api/typeobj.rst:8 +msgid "" +"Perhaps one of the most important structures of the Python object system is " +"the structure that defines a new type: the :c:type:`PyTypeObject` " +"structure. Type objects can be handled using any of the ``PyObject_*`` or " +"``PyType_*`` functions, but do not offer much that's interesting to most " +"Python applications. These objects are fundamental to how objects behave, so " +"they are very important to the interpreter itself and to any extension " +"module that implements new types." msgstr "" -msgid "Type objects are fairly large compared to most of the standard types. The reason for the size is that each type object stores a large number of values, mostly C function pointers, each of which implements a small part of the type's functionality. The fields of the type object are examined in detail in this section. The fields will be described in the order in which they occur in the structure." +#: ../../c-api/typeobj.rst:16 +msgid "" +"Type objects are fairly large compared to most of the standard types. The " +"reason for the size is that each type object stores a large number of " +"values, mostly C function pointers, each of which implements a small part of " +"the type's functionality. The fields of the type object are examined in " +"detail in this section. The fields will be described in the order in which " +"they occur in the structure." msgstr "" -msgid "In addition to the following quick reference, the :ref:`typedef-examples` section provides at-a-glance insight into the meaning and use of :c:type:`PyTypeObject`." +#: ../../c-api/typeobj.rst:23 +msgid "" +"In addition to the following quick reference, the :ref:`typedef-examples` " +"section provides at-a-glance insight into the meaning and use " +"of :c:type:`PyTypeObject`." msgstr "" +#: ../../c-api/typeobj.rst:29 msgid "Quick Reference" msgstr "" +#: ../../c-api/typeobj.rst:34 msgid "\"tp slots\"" msgstr "" +#: ../../c-api/typeobj.rst:40 msgid "PyTypeObject Slot [#slots]_" msgstr "" +#: ../../c-api/typeobj.rst:40 ../../c-api/typeobj.rst:201 msgid ":ref:`Type `" msgstr "" +#: ../../c-api/typeobj.rst:40 msgid "special methods/attrs" msgstr "" +#: ../../c-api/typeobj.rst:40 msgid "Info [#cols]_" msgstr "" +#: ../../c-api/typeobj.rst:42 msgid "O" msgstr "" +#: ../../c-api/typeobj.rst:42 msgid "T" msgstr "" +#: ../../c-api/typeobj.rst:42 msgid "D" msgstr "" +#: ../../c-api/typeobj.rst:42 msgid "I" msgstr "" +#: ../../c-api/typeobj.rst:44 msgid " :c:member:`~PyTypeObject.tp_name`" msgstr "" +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:44 +#: ../../c-api/typeobj.rst:86 msgid "const char *" msgstr "" +#: ../../c-api/typeobj.rst:44 msgid "__name__" msgstr "" +#: ../../c-api/typeobj.rst:44 ../../c-api/typeobj.rst:46 +#: ../../c-api/typeobj.rst:48 ../../c-api/typeobj.rst:50 +#: ../../c-api/typeobj.rst:52 ../../c-api/typeobj.rst:62 +#: ../../c-api/typeobj.rst:70 ../../c-api/typeobj.rst:72 +#: ../../c-api/typeobj.rst:74 ../../c-api/typeobj.rst:76 +#: ../../c-api/typeobj.rst:79 ../../c-api/typeobj.rst:84 +#: ../../c-api/typeobj.rst:86 ../../c-api/typeobj.rst:88 +#: ../../c-api/typeobj.rst:90 ../../c-api/typeobj.rst:92 +#: ../../c-api/typeobj.rst:99 ../../c-api/typeobj.rst:101 +#: ../../c-api/typeobj.rst:103 ../../c-api/typeobj.rst:105 +#: ../../c-api/typeobj.rst:107 ../../c-api/typeobj.rst:109 +#: ../../c-api/typeobj.rst:111 ../../c-api/typeobj.rst:115 +#: ../../c-api/typeobj.rst:117 ../../c-api/typeobj.rst:120 +#: ../../c-api/typeobj.rst:122 ../../c-api/typeobj.rst:124 +#: ../../c-api/typeobj.rst:126 ../../c-api/typeobj.rst:128 +#: ../../c-api/typeobj.rst:130 ../../c-api/typeobj.rst:146 msgid "X" msgstr "" +#: ../../c-api/typeobj.rst:46 msgid ":c:member:`~PyTypeObject.tp_basicsize`" msgstr "" +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:46 +#: ../../c-api/typeobj.rst:48 ../../c-api/typeobj.rst:52 +#: ../../c-api/typeobj.rst:99 ../../c-api/typeobj.rst:120 +#: ../../c-api/typeobj.rst:417 msgid ":c:type:`Py_ssize_t`" msgstr "" +#: ../../c-api/typeobj.rst:48 msgid ":c:member:`~PyTypeObject.tp_itemsize`" msgstr "" +#: ../../c-api/typeobj.rst:50 msgid ":c:member:`~PyTypeObject.tp_dealloc`" msgstr "" +#: ../../c-api/typeobj.rst:50 ../../c-api/typeobj.rst:142 +#: ../../c-api/typeobj.rst:146 ../../c-api/typeobj.rst:347 msgid ":c:type:`destructor`" msgstr "" +#: ../../c-api/typeobj.rst:52 msgid ":c:member:`~PyTypeObject.tp_vectorcall_offset`" msgstr "" +#: ../../c-api/typeobj.rst:54 msgid "(:c:member:`~PyTypeObject.tp_getattr`)" msgstr "" +#: ../../c-api/typeobj.rst:54 ../../c-api/typeobj.rst:371 msgid ":c:type:`getattrfunc`" msgstr "" +#: ../../c-api/typeobj.rst:54 ../../c-api/typeobj.rst:76 msgid "__getattribute__, __getattr__" msgstr "" +#: ../../c-api/typeobj.rst:54 ../../c-api/typeobj.rst:57 +#: ../../c-api/typeobj.rst:70 ../../c-api/typeobj.rst:76 +#: ../../c-api/typeobj.rst:79 ../../c-api/typeobj.rst:88 +#: ../../c-api/typeobj.rst:90 ../../c-api/typeobj.rst:92 msgid "G" msgstr "" +#: ../../c-api/typeobj.rst:57 msgid "(:c:member:`~PyTypeObject.tp_setattr`)" msgstr "" +#: ../../c-api/typeobj.rst:57 ../../c-api/typeobj.rst:376 msgid ":c:type:`setattrfunc`" msgstr "" +#: ../../c-api/typeobj.rst:57 ../../c-api/typeobj.rst:79 msgid "__setattr__, __delattr__" msgstr "" +#: ../../c-api/typeobj.rst:60 msgid ":c:member:`~PyTypeObject.tp_as_async`" msgstr "" +#: ../../c-api/typeobj.rst:60 msgid ":c:type:`PyAsyncMethods` *" msgstr "" +#: ../../c-api/typeobj.rst:60 ../../c-api/typeobj.rst:64 +#: ../../c-api/typeobj.rst:66 ../../c-api/typeobj.rst:68 +#: ../../c-api/typeobj.rst:82 msgid ":ref:`sub-slots`" msgstr "" +#: ../../c-api/typeobj.rst:60 ../../c-api/typeobj.rst:64 +#: ../../c-api/typeobj.rst:66 ../../c-api/typeobj.rst:68 +#: ../../c-api/typeobj.rst:82 msgid "%" msgstr "" +#: ../../c-api/typeobj.rst:62 msgid ":c:member:`~PyTypeObject.tp_repr`" msgstr "" +#: ../../c-api/typeobj.rst:62 ../../c-api/typeobj.rst:74 +#: ../../c-api/typeobj.rst:369 msgid ":c:type:`reprfunc`" msgstr "" +#: ../../c-api/typeobj.rst:62 msgid "__repr__" msgstr "" +#: ../../c-api/typeobj.rst:64 msgid ":c:member:`~PyTypeObject.tp_as_number`" msgstr "" +#: ../../c-api/typeobj.rst:64 msgid ":c:type:`PyNumberMethods` *" msgstr "" +#: ../../c-api/typeobj.rst:66 msgid ":c:member:`~PyTypeObject.tp_as_sequence`" msgstr "" +#: ../../c-api/typeobj.rst:66 msgid ":c:type:`PySequenceMethods` *" msgstr "" +#: ../../c-api/typeobj.rst:68 msgid ":c:member:`~PyTypeObject.tp_as_mapping`" msgstr "" +#: ../../c-api/typeobj.rst:68 msgid ":c:type:`PyMappingMethods` *" msgstr "" +#: ../../c-api/typeobj.rst:70 msgid ":c:member:`~PyTypeObject.tp_hash`" msgstr "" +#: ../../c-api/typeobj.rst:70 ../../c-api/typeobj.rst:405 msgid ":c:type:`hashfunc`" msgstr "" +#: ../../c-api/typeobj.rst:70 msgid "__hash__" msgstr "" +#: ../../c-api/typeobj.rst:72 msgid ":c:member:`~PyTypeObject.tp_call`" msgstr "" +#: ../../c-api/typeobj.rst:72 ../../c-api/typeobj.rst:237 +#: ../../c-api/typeobj.rst:240 ../../c-api/typeobj.rst:441 msgid ":c:type:`ternaryfunc`" msgstr "" +#: ../../c-api/typeobj.rst:72 msgid "__call__" msgstr "" +#: ../../c-api/typeobj.rst:74 msgid ":c:member:`~PyTypeObject.tp_str`" msgstr "" +#: ../../c-api/typeobj.rst:74 msgid "__str__" msgstr "" +#: ../../c-api/typeobj.rst:76 msgid ":c:member:`~PyTypeObject.tp_getattro`" msgstr "" +#: ../../c-api/typeobj.rst:76 ../../c-api/typeobj.rst:382 msgid ":c:type:`getattrofunc`" msgstr "" +#: ../../c-api/typeobj.rst:79 msgid ":c:member:`~PyTypeObject.tp_setattro`" msgstr "" +#: ../../c-api/typeobj.rst:79 ../../c-api/typeobj.rst:387 msgid ":c:type:`setattrofunc`" msgstr "" +#: ../../c-api/typeobj.rst:82 msgid ":c:member:`~PyTypeObject.tp_as_buffer`" msgstr "" +#: ../../c-api/typeobj.rst:82 msgid ":c:type:`PyBufferProcs` *" msgstr "" +#: ../../c-api/typeobj.rst:84 msgid ":c:member:`~PyTypeObject.tp_flags`" msgstr "" +#: ../../c-api/typeobj.rst:84 msgid "unsigned long" msgstr "" +#: ../../c-api/typeobj.rst:84 ../../c-api/typeobj.rst:99 +#: ../../c-api/typeobj.rst:113 ../../c-api/typeobj.rst:120 +#: ../../c-api/typeobj.rst:124 ../../c-api/typeobj.rst:126 +#: ../../c-api/typeobj.rst:128 msgid "?" msgstr "" +#: ../../c-api/typeobj.rst:86 msgid ":c:member:`~PyTypeObject.tp_doc`" msgstr "" +#: ../../c-api/typeobj.rst:86 msgid "__doc__" msgstr "" +#: ../../c-api/typeobj.rst:88 msgid ":c:member:`~PyTypeObject.tp_traverse`" msgstr "" +#: ../../c-api/typeobj.rst:88 ../../c-api/typeobj.rst:351 msgid ":c:type:`traverseproc`" msgstr "" +#: ../../c-api/typeobj.rst:90 msgid ":c:member:`~PyTypeObject.tp_clear`" msgstr "" +#: ../../c-api/typeobj.rst:90 ../../c-api/typeobj.rst:130 +#: ../../c-api/typeobj.rst:248 ../../c-api/typeobj.rst:430 msgid ":c:type:`inquiry`" msgstr "" +#: ../../c-api/typeobj.rst:92 msgid ":c:member:`~PyTypeObject.tp_richcompare`" msgstr "" +#: ../../c-api/typeobj.rst:92 ../../c-api/typeobj.rst:407 msgid ":c:type:`richcmpfunc`" msgstr "" +#: ../../c-api/typeobj.rst:92 msgid "__lt__, __le__, __eq__, __ne__, __gt__, __ge__" msgstr "" +#: ../../c-api/typeobj.rst:99 msgid "(:c:member:`~PyTypeObject.tp_weaklistoffset`)" msgstr "" +#: ../../c-api/typeobj.rst:101 msgid ":c:member:`~PyTypeObject.tp_iter`" msgstr "" +#: ../../c-api/typeobj.rst:101 ../../c-api/typeobj.rst:413 msgid ":c:type:`getiterfunc`" msgstr "" +#: ../../c-api/typeobj.rst:101 msgid "__iter__" msgstr "" +#: ../../c-api/typeobj.rst:103 msgid ":c:member:`~PyTypeObject.tp_iternext`" msgstr "" +#: ../../c-api/typeobj.rst:103 ../../c-api/typeobj.rst:415 msgid ":c:type:`iternextfunc`" msgstr "" +#: ../../c-api/typeobj.rst:103 msgid "__next__" msgstr "" +#: ../../c-api/typeobj.rst:105 msgid ":c:member:`~PyTypeObject.tp_methods`" msgstr "" +#: ../../c-api/typeobj.rst:105 msgid ":c:type:`PyMethodDef` []" msgstr "" +#: ../../c-api/typeobj.rst:107 msgid ":c:member:`~PyTypeObject.tp_members`" msgstr "" +#: ../../c-api/typeobj.rst:107 msgid ":c:type:`PyMemberDef` []" msgstr "" +#: ../../c-api/typeobj.rst:109 msgid ":c:member:`~PyTypeObject.tp_getset`" msgstr "" +#: ../../c-api/typeobj.rst:109 msgid ":c:type:`PyGetSetDef` []" msgstr "" +#: ../../c-api/typeobj.rst:111 msgid ":c:member:`~PyTypeObject.tp_base`" msgstr "" +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:111 msgid ":c:type:`PyTypeObject` *" msgstr "" +#: ../../c-api/typeobj.rst:111 msgid "__base__" msgstr "" +#: ../../c-api/typeobj.rst:113 msgid ":c:member:`~PyTypeObject.tp_dict`" msgstr "" +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:113 +#: ../../c-api/typeobj.rst:132 ../../c-api/typeobj.rst:134 +#: ../../c-api/typeobj.rst:136 ../../c-api/typeobj.rst:140 +#: ../../c-api/typeobj.rst:342 ../../c-api/typeobj.rst:347 +#: ../../c-api/typeobj.rst:357 ../../c-api/typeobj.rst:369 +#: ../../c-api/typeobj.rst:371 ../../c-api/typeobj.rst:382 +#: ../../c-api/typeobj.rst:393 ../../c-api/typeobj.rst:405 +#: ../../c-api/typeobj.rst:407 ../../c-api/typeobj.rst:413 +#: ../../c-api/typeobj.rst:415 ../../c-api/typeobj.rst:417 +#: ../../c-api/typeobj.rst:430 ../../c-api/typeobj.rst:432 +#: ../../c-api/typeobj.rst:436 ../../c-api/typeobj.rst:441 +#: ../../c-api/typeobj.rst:447 msgid ":c:type:`PyObject` *" msgstr "" +#: ../../c-api/typeobj.rst:113 msgid "__dict__" msgstr "" +#: ../../c-api/typeobj.rst:115 msgid ":c:member:`~PyTypeObject.tp_descr_get`" msgstr "" +#: ../../c-api/typeobj.rst:115 ../../c-api/typeobj.rst:393 msgid ":c:type:`descrgetfunc`" msgstr "" +#: ../../c-api/typeobj.rst:115 msgid "__get__" msgstr "" +#: ../../c-api/typeobj.rst:117 msgid ":c:member:`~PyTypeObject.tp_descr_set`" msgstr "" +#: ../../c-api/typeobj.rst:117 ../../c-api/typeobj.rst:399 msgid ":c:type:`descrsetfunc`" msgstr "" +#: ../../c-api/typeobj.rst:117 msgid "__set__, __delete__" msgstr "" +#: ../../c-api/typeobj.rst:120 msgid "(:c:member:`~PyTypeObject.tp_dictoffset`)" msgstr "" +#: ../../c-api/typeobj.rst:122 msgid ":c:member:`~PyTypeObject.tp_init`" msgstr "" +#: ../../c-api/typeobj.rst:122 ../../c-api/typeobj.rst:363 msgid ":c:type:`initproc`" msgstr "" +#: ../../c-api/typeobj.rst:122 msgid "__init__" msgstr "" +#: ../../c-api/typeobj.rst:124 msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr "" +#: ../../c-api/typeobj.rst:124 ../../c-api/typeobj.rst:342 msgid ":c:type:`allocfunc`" msgstr "" +#: ../../c-api/typeobj.rst:126 msgid ":c:member:`~PyTypeObject.tp_new`" msgstr "" +#: ../../c-api/typeobj.rst:126 ../../c-api/typeobj.rst:357 msgid ":c:type:`newfunc`" msgstr "" +#: ../../c-api/typeobj.rst:126 msgid "__new__" msgstr "" +#: ../../c-api/typeobj.rst:128 msgid ":c:member:`~PyTypeObject.tp_free`" msgstr "" +#: ../../c-api/typeobj.rst:128 ../../c-api/typeobj.rst:349 msgid ":c:type:`freefunc`" msgstr "" +#: ../../c-api/typeobj.rst:130 msgid ":c:member:`~PyTypeObject.tp_is_gc`" msgstr "" +#: ../../c-api/typeobj.rst:132 msgid "<:c:member:`~PyTypeObject.tp_bases`>" msgstr "" +#: ../../c-api/typeobj.rst:132 msgid "__bases__" msgstr "" +#: ../../c-api/typeobj.rst:132 ../../c-api/typeobj.rst:134 msgid "~" msgstr "" +#: ../../c-api/typeobj.rst:134 msgid "<:c:member:`~PyTypeObject.tp_mro`>" msgstr "" +#: ../../c-api/typeobj.rst:134 msgid "__mro__" msgstr "" +#: ../../c-api/typeobj.rst:136 msgid "[:c:member:`~PyTypeObject.tp_cache`]" msgstr "" +#: ../../c-api/typeobj.rst:138 msgid "[:c:member:`~PyTypeObject.tp_subclasses`]" msgstr "" +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:138 +#: ../../c-api/typeobj.rst:279 ../../c-api/typeobj.rst:349 msgid "void *" msgstr "" +#: ../../c-api/typeobj.rst:138 msgid "__subclasses__" msgstr "" +#: ../../c-api/typeobj.rst:140 msgid "[:c:member:`~PyTypeObject.tp_weaklist`]" msgstr "" +#: ../../c-api/typeobj.rst:142 msgid "(:c:member:`~PyTypeObject.tp_del`)" msgstr "" +#: ../../c-api/typeobj.rst:144 msgid "[:c:member:`~PyTypeObject.tp_version_tag`]" msgstr "" +#: ../../c-api/typeobj.rst:144 msgid "unsigned int" msgstr "" +#: ../../c-api/typeobj.rst:146 msgid ":c:member:`~PyTypeObject.tp_finalize`" msgstr "" +#: ../../c-api/typeobj.rst:146 msgid "__del__" msgstr "" +#: ../../c-api/typeobj.rst:148 msgid ":c:member:`~PyTypeObject.tp_vectorcall`" msgstr "" +#: ../../c-api/typeobj.rst:148 msgid ":c:type:`vectorcallfunc`" msgstr "" +#: ../../c-api/typeobj.rst:150 msgid "[:c:member:`~PyTypeObject.tp_watched`]" msgstr "" +#: ../../c-api/typeobj.rst:150 msgid "unsigned char" msgstr "" -msgid "**()**: A slot name in parentheses indicates it is (effectively) deprecated." +#: ../../c-api/typeobj.rst:155 +msgid "" +"**()**: A slot name in parentheses indicates it is (effectively) deprecated." msgstr "" -msgid "**<>**: Names in angle brackets should be initially set to ``NULL`` and treated as read-only." +#: ../../c-api/typeobj.rst:157 +msgid "" +"**<>**: Names in angle brackets should be initially set to ``NULL`` and " +"treated as read-only." msgstr "" +#: ../../c-api/typeobj.rst:160 msgid "**[]**: Names in square brackets are for internal use only." msgstr "" -msgid "**** (as a prefix) means the field is required (must be non-``NULL``)." +#: ../../c-api/typeobj.rst:162 +msgid "" +"**** (as a prefix) means the field is required (must be non-``NULL``)." msgstr "" +#: ../../c-api/typeobj.rst:164 msgid "Columns:" msgstr "" +#: ../../c-api/typeobj.rst:166 msgid "**\"O\"**: set on :c:data:`PyBaseObject_Type`" msgstr "" +#: ../../c-api/typeobj.rst:168 msgid "**\"T\"**: set on :c:data:`PyType_Type`" msgstr "" +#: ../../c-api/typeobj.rst:170 msgid "**\"D\"**: default (if slot is set to ``NULL``)" msgstr "" +#: ../../c-api/typeobj.rst:172 msgid "" "X - PyType_Ready sets this value if it is NULL\n" "~ - PyType_Ready always sets this value (it should be NULL)\n" @@ -434,400 +634,565 @@ msgid "" "Also see the inheritance column (\"I\")." msgstr "" +#: ../../c-api/typeobj.rst:180 msgid "**\"I\"**: inheritance" msgstr "" +#: ../../c-api/typeobj.rst:182 msgid "" -"X - type slot is inherited via *PyType_Ready* if defined with a *NULL* value\n" +"X - type slot is inherited via *PyType_Ready* if defined with a *NULL* " +"value\n" "% - the slots of the sub-struct are inherited individually\n" -"G - inherited, but only in combination with other slots; see the slot's description\n" +"G - inherited, but only in combination with other slots; see the slot's " +"description\n" "? - it's complicated; see the slot's description" msgstr "" -msgid "Note that some slots are effectively inherited through the normal attribute lookup chain." +#: ../../c-api/typeobj.rst:189 +msgid "" +"Note that some slots are effectively inherited through the normal attribute " +"lookup chain." msgstr "" +#: ../../c-api/typeobj.rst:195 msgid "sub-slots" msgstr "" +#: ../../c-api/typeobj.rst:201 msgid "Slot" msgstr "" +#: ../../c-api/typeobj.rst:201 msgid "special methods" msgstr "" +#: ../../c-api/typeobj.rst:204 msgid ":c:member:`~PyAsyncMethods.am_await`" msgstr "" +#: ../../c-api/typeobj.rst:204 ../../c-api/typeobj.rst:206 +#: ../../c-api/typeobj.rst:208 ../../c-api/typeobj.rst:242 +#: ../../c-api/typeobj.rst:244 ../../c-api/typeobj.rst:246 +#: ../../c-api/typeobj.rst:250 ../../c-api/typeobj.rst:277 +#: ../../c-api/typeobj.rst:281 ../../c-api/typeobj.rst:291 +#: ../../c-api/typeobj.rst:432 msgid ":c:type:`unaryfunc`" msgstr "" +#: ../../c-api/typeobj.rst:204 msgid "__await__" msgstr "" +#: ../../c-api/typeobj.rst:206 msgid ":c:member:`~PyAsyncMethods.am_aiter`" msgstr "" +#: ../../c-api/typeobj.rst:206 msgid "__aiter__" msgstr "" +#: ../../c-api/typeobj.rst:208 msgid ":c:member:`~PyAsyncMethods.am_anext`" msgstr "" +#: ../../c-api/typeobj.rst:208 msgid "__anext__" msgstr "" +#: ../../c-api/typeobj.rst:210 msgid ":c:member:`~PyAsyncMethods.am_send`" msgstr "" +#: ../../c-api/typeobj.rst:210 msgid ":c:type:`sendfunc`" msgstr "" +#: ../../c-api/typeobj.rst:214 msgid ":c:member:`~PyNumberMethods.nb_add`" msgstr "" +#: ../../c-api/typeobj.rst:214 ../../c-api/typeobj.rst:217 +#: ../../c-api/typeobj.rst:219 ../../c-api/typeobj.rst:222 +#: ../../c-api/typeobj.rst:224 ../../c-api/typeobj.rst:227 +#: ../../c-api/typeobj.rst:229 ../../c-api/typeobj.rst:232 +#: ../../c-api/typeobj.rst:234 ../../c-api/typeobj.rst:252 +#: ../../c-api/typeobj.rst:255 ../../c-api/typeobj.rst:257 +#: ../../c-api/typeobj.rst:260 ../../c-api/typeobj.rst:262 +#: ../../c-api/typeobj.rst:265 ../../c-api/typeobj.rst:267 +#: ../../c-api/typeobj.rst:270 ../../c-api/typeobj.rst:272 +#: ../../c-api/typeobj.rst:275 ../../c-api/typeobj.rst:283 +#: ../../c-api/typeobj.rst:285 ../../c-api/typeobj.rst:287 +#: ../../c-api/typeobj.rst:289 ../../c-api/typeobj.rst:293 +#: ../../c-api/typeobj.rst:296 ../../c-api/typeobj.rst:302 +#: ../../c-api/typeobj.rst:311 ../../c-api/typeobj.rst:322 +#: ../../c-api/typeobj.rst:436 msgid ":c:type:`binaryfunc`" msgstr "" +#: ../../c-api/typeobj.rst:214 msgid "__add__ __radd__" msgstr "" +#: ../../c-api/typeobj.rst:217 msgid ":c:member:`~PyNumberMethods.nb_inplace_add`" msgstr "" +#: ../../c-api/typeobj.rst:217 ../../c-api/typeobj.rst:322 msgid "__iadd__" msgstr "" +#: ../../c-api/typeobj.rst:219 msgid ":c:member:`~PyNumberMethods.nb_subtract`" msgstr "" +#: ../../c-api/typeobj.rst:219 msgid "__sub__ __rsub__" msgstr "" +#: ../../c-api/typeobj.rst:222 msgid ":c:member:`~PyNumberMethods.nb_inplace_subtract`" msgstr "" +#: ../../c-api/typeobj.rst:222 msgid "__isub__" msgstr "" +#: ../../c-api/typeobj.rst:224 msgid ":c:member:`~PyNumberMethods.nb_multiply`" msgstr "" +#: ../../c-api/typeobj.rst:224 msgid "__mul__ __rmul__" msgstr "" +#: ../../c-api/typeobj.rst:227 msgid ":c:member:`~PyNumberMethods.nb_inplace_multiply`" msgstr "" +#: ../../c-api/typeobj.rst:227 ../../c-api/typeobj.rst:324 msgid "__imul__" msgstr "" +#: ../../c-api/typeobj.rst:229 msgid ":c:member:`~PyNumberMethods.nb_remainder`" msgstr "" +#: ../../c-api/typeobj.rst:229 msgid "__mod__ __rmod__" msgstr "" +#: ../../c-api/typeobj.rst:232 msgid ":c:member:`~PyNumberMethods.nb_inplace_remainder`" msgstr "" +#: ../../c-api/typeobj.rst:232 msgid "__imod__" msgstr "" +#: ../../c-api/typeobj.rst:234 msgid ":c:member:`~PyNumberMethods.nb_divmod`" msgstr "" +#: ../../c-api/typeobj.rst:234 msgid "__divmod__ __rdivmod__" msgstr "" +#: ../../c-api/typeobj.rst:237 msgid ":c:member:`~PyNumberMethods.nb_power`" msgstr "" +#: ../../c-api/typeobj.rst:237 msgid "__pow__ __rpow__" msgstr "" +#: ../../c-api/typeobj.rst:240 msgid ":c:member:`~PyNumberMethods.nb_inplace_power`" msgstr "" +#: ../../c-api/typeobj.rst:240 msgid "__ipow__" msgstr "" +#: ../../c-api/typeobj.rst:242 msgid ":c:member:`~PyNumberMethods.nb_negative`" msgstr "" +#: ../../c-api/typeobj.rst:242 msgid "__neg__" msgstr "" +#: ../../c-api/typeobj.rst:244 msgid ":c:member:`~PyNumberMethods.nb_positive`" msgstr "" +#: ../../c-api/typeobj.rst:244 msgid "__pos__" msgstr "" +#: ../../c-api/typeobj.rst:246 msgid ":c:member:`~PyNumberMethods.nb_absolute`" msgstr "" +#: ../../c-api/typeobj.rst:246 msgid "__abs__" msgstr "" +#: ../../c-api/typeobj.rst:248 msgid ":c:member:`~PyNumberMethods.nb_bool`" msgstr "" +#: ../../c-api/typeobj.rst:248 msgid "__bool__" msgstr "" +#: ../../c-api/typeobj.rst:250 msgid ":c:member:`~PyNumberMethods.nb_invert`" msgstr "" +#: ../../c-api/typeobj.rst:250 msgid "__invert__" msgstr "" +#: ../../c-api/typeobj.rst:252 msgid ":c:member:`~PyNumberMethods.nb_lshift`" msgstr "" +#: ../../c-api/typeobj.rst:252 msgid "__lshift__ __rlshift__" msgstr "" +#: ../../c-api/typeobj.rst:255 msgid ":c:member:`~PyNumberMethods.nb_inplace_lshift`" msgstr "" +#: ../../c-api/typeobj.rst:255 msgid "__ilshift__" msgstr "" +#: ../../c-api/typeobj.rst:257 msgid ":c:member:`~PyNumberMethods.nb_rshift`" msgstr "" +#: ../../c-api/typeobj.rst:257 msgid "__rshift__ __rrshift__" msgstr "" +#: ../../c-api/typeobj.rst:260 msgid ":c:member:`~PyNumberMethods.nb_inplace_rshift`" msgstr "" +#: ../../c-api/typeobj.rst:260 msgid "__irshift__" msgstr "" +#: ../../c-api/typeobj.rst:262 msgid ":c:member:`~PyNumberMethods.nb_and`" msgstr "" +#: ../../c-api/typeobj.rst:262 msgid "__and__ __rand__" msgstr "" +#: ../../c-api/typeobj.rst:265 msgid ":c:member:`~PyNumberMethods.nb_inplace_and`" msgstr "" +#: ../../c-api/typeobj.rst:265 msgid "__iand__" msgstr "" +#: ../../c-api/typeobj.rst:267 msgid ":c:member:`~PyNumberMethods.nb_xor`" msgstr "" +#: ../../c-api/typeobj.rst:267 msgid "__xor__ __rxor__" msgstr "" +#: ../../c-api/typeobj.rst:270 msgid ":c:member:`~PyNumberMethods.nb_inplace_xor`" msgstr "" +#: ../../c-api/typeobj.rst:270 msgid "__ixor__" msgstr "" +#: ../../c-api/typeobj.rst:272 msgid ":c:member:`~PyNumberMethods.nb_or`" msgstr "" +#: ../../c-api/typeobj.rst:272 msgid "__or__ __ror__" msgstr "" +#: ../../c-api/typeobj.rst:275 msgid ":c:member:`~PyNumberMethods.nb_inplace_or`" msgstr "" +#: ../../c-api/typeobj.rst:275 msgid "__ior__" msgstr "" +#: ../../c-api/typeobj.rst:277 msgid ":c:member:`~PyNumberMethods.nb_int`" msgstr "" +#: ../../c-api/typeobj.rst:277 msgid "__int__" msgstr "" +#: ../../c-api/typeobj.rst:279 msgid ":c:member:`~PyNumberMethods.nb_reserved`" msgstr "" +#: ../../c-api/typeobj.rst:281 msgid ":c:member:`~PyNumberMethods.nb_float`" msgstr "" +#: ../../c-api/typeobj.rst:281 msgid "__float__" msgstr "" +#: ../../c-api/typeobj.rst:283 msgid ":c:member:`~PyNumberMethods.nb_floor_divide`" msgstr "" +#: ../../c-api/typeobj.rst:283 msgid "__floordiv__" msgstr "" +#: ../../c-api/typeobj.rst:285 msgid ":c:member:`~PyNumberMethods.nb_inplace_floor_divide`" msgstr "" +#: ../../c-api/typeobj.rst:285 msgid "__ifloordiv__" msgstr "" +#: ../../c-api/typeobj.rst:287 msgid ":c:member:`~PyNumberMethods.nb_true_divide`" msgstr "" +#: ../../c-api/typeobj.rst:287 msgid "__truediv__" msgstr "" +#: ../../c-api/typeobj.rst:289 msgid ":c:member:`~PyNumberMethods.nb_inplace_true_divide`" msgstr "" +#: ../../c-api/typeobj.rst:289 msgid "__itruediv__" msgstr "" +#: ../../c-api/typeobj.rst:291 msgid ":c:member:`~PyNumberMethods.nb_index`" msgstr "" +#: ../../c-api/typeobj.rst:291 msgid "__index__" msgstr "" +#: ../../c-api/typeobj.rst:293 msgid ":c:member:`~PyNumberMethods.nb_matrix_multiply`" msgstr "" +#: ../../c-api/typeobj.rst:293 msgid "__matmul__ __rmatmul__" msgstr "" +#: ../../c-api/typeobj.rst:296 msgid ":c:member:`~PyNumberMethods.nb_inplace_matrix_multiply`" msgstr "" +#: ../../c-api/typeobj.rst:296 msgid "__imatmul__" msgstr "" +#: ../../c-api/typeobj.rst:300 msgid ":c:member:`~PyMappingMethods.mp_length`" msgstr "" +#: ../../c-api/typeobj.rst:300 ../../c-api/typeobj.rst:309 +#: ../../c-api/typeobj.rst:417 msgid ":c:type:`lenfunc`" msgstr "" +#: ../../c-api/typeobj.rst:300 ../../c-api/typeobj.rst:309 msgid "__len__" msgstr "" +#: ../../c-api/typeobj.rst:302 msgid ":c:member:`~PyMappingMethods.mp_subscript`" msgstr "" +#: ../../c-api/typeobj.rst:302 ../../c-api/typeobj.rst:315 msgid "__getitem__" msgstr "" +#: ../../c-api/typeobj.rst:304 msgid ":c:member:`~PyMappingMethods.mp_ass_subscript`" msgstr "" +#: ../../c-api/typeobj.rst:304 ../../c-api/typeobj.rst:463 msgid ":c:type:`objobjargproc`" msgstr "" +#: ../../c-api/typeobj.rst:304 msgid "__setitem__, __delitem__" msgstr "" +#: ../../c-api/typeobj.rst:309 msgid ":c:member:`~PySequenceMethods.sq_length`" msgstr "" +#: ../../c-api/typeobj.rst:311 msgid ":c:member:`~PySequenceMethods.sq_concat`" msgstr "" +#: ../../c-api/typeobj.rst:311 msgid "__add__" msgstr "" +#: ../../c-api/typeobj.rst:313 msgid ":c:member:`~PySequenceMethods.sq_repeat`" msgstr "" +#: ../../c-api/typeobj.rst:313 ../../c-api/typeobj.rst:315 +#: ../../c-api/typeobj.rst:324 ../../c-api/typeobj.rst:447 msgid ":c:type:`ssizeargfunc`" msgstr "" +#: ../../c-api/typeobj.rst:313 msgid "__mul__" msgstr "" +#: ../../c-api/typeobj.rst:315 msgid ":c:member:`~PySequenceMethods.sq_item`" msgstr "" +#: ../../c-api/typeobj.rst:317 msgid ":c:member:`~PySequenceMethods.sq_ass_item`" msgstr "" +#: ../../c-api/typeobj.rst:317 ../../c-api/typeobj.rst:452 msgid ":c:type:`ssizeobjargproc`" msgstr "" +#: ../../c-api/typeobj.rst:317 msgid "__setitem__ __delitem__" msgstr "" +#: ../../c-api/typeobj.rst:320 msgid ":c:member:`~PySequenceMethods.sq_contains`" msgstr "" +#: ../../c-api/typeobj.rst:320 ../../c-api/typeobj.rst:458 msgid ":c:type:`objobjproc`" msgstr "" +#: ../../c-api/typeobj.rst:320 msgid "__contains__" msgstr "" +#: ../../c-api/typeobj.rst:322 msgid ":c:member:`~PySequenceMethods.sq_inplace_concat`" msgstr "" +#: ../../c-api/typeobj.rst:324 msgid ":c:member:`~PySequenceMethods.sq_inplace_repeat`" msgstr "" +#: ../../c-api/typeobj.rst:328 msgid ":c:member:`~PyBufferProcs.bf_getbuffer`" msgstr "" +#: ../../c-api/typeobj.rst:328 msgid ":c:func:`getbufferproc`" msgstr "" +#: ../../c-api/typeobj.rst:328 msgid "__buffer__" msgstr "" +#: ../../c-api/typeobj.rst:330 msgid ":c:member:`~PyBufferProcs.bf_releasebuffer`" msgstr "" +#: ../../c-api/typeobj.rst:330 msgid ":c:func:`releasebufferproc`" msgstr "" +#: ../../c-api/typeobj.rst:330 msgid "__release_\\ buffer\\__" msgstr "" +#: ../../c-api/typeobj.rst:337 msgid "slot typedefs" msgstr "" +#: ../../c-api/typeobj.rst:340 msgid "typedef" msgstr "" +#: ../../c-api/typeobj.rst:340 msgid "Parameter Types" msgstr "" +#: ../../c-api/typeobj.rst:340 msgid "Return Type" msgstr "" +#: ../../c-api/typeobj.rst:347 ../../c-api/typeobj.rst:349 +#: ../../c-api/typeobj.rst:425 msgid "void" msgstr "" +#: ../../c-api/typeobj.rst:0 msgid ":c:type:`visitproc`" msgstr "" +#: ../../c-api/typeobj.rst:0 ../../c-api/typeobj.rst:351 +#: ../../c-api/typeobj.rst:363 ../../c-api/typeobj.rst:376 +#: ../../c-api/typeobj.rst:387 ../../c-api/typeobj.rst:399 +#: ../../c-api/typeobj.rst:419 ../../c-api/typeobj.rst:430 +#: ../../c-api/typeobj.rst:452 ../../c-api/typeobj.rst:458 +#: ../../c-api/typeobj.rst:463 msgid "int" msgstr "" +#: ../../c-api/typeobj.rst:405 msgid "Py_hash_t" msgstr "" +#: ../../c-api/typeobj.rst:419 msgid ":c:type:`getbufferproc`" msgstr "" +#: ../../c-api/typeobj.rst:0 msgid ":c:type:`Py_buffer` *" msgstr "" +#: ../../c-api/typeobj.rst:425 msgid ":c:type:`releasebufferproc`" msgstr "" +#: ../../c-api/typeobj.rst:470 msgid "See :ref:`slot-typedefs` below for more detail." msgstr "" +#: ../../c-api/typeobj.rst:474 msgid "PyTypeObject Definition" msgstr "" -msgid "The structure definition for :c:type:`PyTypeObject` can be found in :file:`Include/cpython/object.h`. For convenience of reference, this repeats the definition found there:" +#: ../../c-api/typeobj.rst:476 +msgid "" +"The structure definition for :c:type:`PyTypeObject` can be found " +"in :file:`Include/cpython/object.h`. For convenience of reference, this " +"repeats the definition found there:" msgstr "" +#: ../../c-api/typeobj.rst:482 msgid "" "typedef struct _typeobject {\n" " PyObject_VAR_HEAD\n" @@ -926,132 +1291,340 @@ msgid "" "} PyTypeObject;\n" msgstr "" +#: ../../c-api/typeobj.rst:486 msgid "PyObject Slots" msgstr "" -msgid "The type object structure extends the :c:type:`PyVarObject` structure. The :c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :c:func:`!type_new`, usually called from a class statement). Note that :c:data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its instances (i.e. type objects) *must* have the :c:member:`~PyVarObject.ob_size` field." +#: ../../c-api/typeobj.rst:488 +msgid "" +"The type object structure extends the :c:type:`PyVarObject` structure. " +"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " +"(created by :c:func:`!type_new`, usually called from a class statement). " +"Note that :c:data:`PyType_Type` (the metatype) " +"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " +"instances (i.e. type objects) *must* have " +"the :c:member:`~PyVarObject.ob_size` field." msgstr "" +#: ../../c-api/typeobj.rst:495 msgid ":c:member:`PyObject.ob_refcnt`" msgstr "" -msgid "The type object's reference count is initialized to ``1`` by the ``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type objects `, the type's instances (objects whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." -msgstr "" - +#: ../../c-api/typeobj.rst:497 +msgid "" +"The type object's reference count is initialized to ``1`` by the " +"``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " +"objects `, the type's instances (objects " +"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " +"as references. But for :ref:`dynamically allocated type objects `, the instances *do* count as references." +msgstr "" + +#: ../../c-api/typeobj.rst:504 ../../c-api/typeobj.rst:527 +#: ../../c-api/typeobj.rst:543 ../../c-api/typeobj.rst:587 +#: ../../c-api/typeobj.rst:665 ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:854 ../../c-api/typeobj.rst:873 +#: ../../c-api/typeobj.rst:892 ../../c-api/typeobj.rst:910 +#: ../../c-api/typeobj.rst:936 ../../c-api/typeobj.rst:953 +#: ../../c-api/typeobj.rst:965 ../../c-api/typeobj.rst:977 +#: ../../c-api/typeobj.rst:1012 ../../c-api/typeobj.rst:1036 +#: ../../c-api/typeobj.rst:1058 ../../c-api/typeobj.rst:1081 +#: ../../c-api/typeobj.rst:1109 ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1184 +#: ../../c-api/typeobj.rst:1195 ../../c-api/typeobj.rst:1205 +#: ../../c-api/typeobj.rst:1215 ../../c-api/typeobj.rst:1229 +#: ../../c-api/typeobj.rst:1247 ../../c-api/typeobj.rst:1270 +#: ../../c-api/typeobj.rst:1288 ../../c-api/typeobj.rst:1301 +#: ../../c-api/typeobj.rst:1323 ../../c-api/typeobj.rst:1370 +#: ../../c-api/typeobj.rst:1396 ../../c-api/typeobj.rst:1415 +#: ../../c-api/typeobj.rst:1445 ../../c-api/typeobj.rst:1467 +#: ../../c-api/typeobj.rst:1505 ../../c-api/typeobj.rst:1517 +#: ../../c-api/typeobj.rst:1543 ../../c-api/typeobj.rst:1641 +#: ../../c-api/typeobj.rst:1787 ../../c-api/typeobj.rst:1854 +#: ../../c-api/typeobj.rst:1890 ../../c-api/typeobj.rst:1917 +#: ../../c-api/typeobj.rst:1942 ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:1974 ../../c-api/typeobj.rst:1990 +#: ../../c-api/typeobj.rst:2022 ../../c-api/typeobj.rst:2054 +#: ../../c-api/typeobj.rst:2082 ../../c-api/typeobj.rst:2102 +#: ../../c-api/typeobj.rst:2131 ../../c-api/typeobj.rst:2177 +#: ../../c-api/typeobj.rst:2196 ../../c-api/typeobj.rst:2238 +#: ../../c-api/typeobj.rst:2263 ../../c-api/typeobj.rst:2303 +#: ../../c-api/typeobj.rst:2333 ../../c-api/typeobj.rst:2346 +#: ../../c-api/typeobj.rst:2356 ../../c-api/typeobj.rst:2373 +#: ../../c-api/typeobj.rst:2390 ../../c-api/typeobj.rst:2406 +#: ../../c-api/typeobj.rst:2550 ../../c-api/typeobj.rst:2610 msgid "**Inheritance:**" msgstr "" +#: ../../c-api/typeobj.rst:506 ../../c-api/typeobj.rst:545 +#: ../../c-api/typeobj.rst:589 msgid "This field is not inherited by subtypes." msgstr "" +#: ../../c-api/typeobj.rst:509 msgid ":c:member:`PyObject.ob_type`" msgstr "" -msgid "This is the type's type, in other words its metatype. It is initialized by the argument to the ``PyObject_HEAD_INIT`` macro, and its value should normally be ``&PyType_Type``. However, for dynamically loadable extension modules that must be usable on Windows (at least), the compiler complains that this is not a valid initializer. Therefore, the convention is to pass ``NULL`` to the ``PyObject_HEAD_INIT`` macro and to initialize this field explicitly at the start of the module's initialization function, before doing anything else. This is typically done like this::" +#: ../../c-api/typeobj.rst:511 +msgid "" +"This is the type's type, in other words its metatype. It is initialized by " +"the argument to the ``PyObject_HEAD_INIT`` macro, and its value should " +"normally be ``&PyType_Type``. However, for dynamically loadable extension " +"modules that must be usable on Windows (at least), the compiler complains " +"that this is not a valid initializer. Therefore, the convention is to pass " +"``NULL`` to the ``PyObject_HEAD_INIT`` macro and to initialize this field " +"explicitly at the start of the module's initialization function, before " +"doing anything else. This is typically done like this::" msgstr "" +#: ../../c-api/typeobj.rst:520 msgid "Foo_Type.ob_type = &PyType_Type;" msgstr "" -msgid "This should be done before any instances of the type are created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` field of the base class. :c:func:`PyType_Ready` will not change this field if it is non-zero." -msgstr "" - +#: ../../c-api/typeobj.rst:522 +msgid "" +"This should be done before any instances of the type are " +"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " +"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " +"field of the base class. :c:func:`PyType_Ready` will not change this field " +"if it is non-zero." +msgstr "" + +#: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:811 +#: ../../c-api/typeobj.rst:938 ../../c-api/typeobj.rst:1038 +#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1919 +#: ../../c-api/typeobj.rst:1944 ../../c-api/typeobj.rst:2084 +#: ../../c-api/typeobj.rst:2104 ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2305 ../../c-api/typeobj.rst:2552 msgid "This field is inherited by subtypes." msgstr "" +#: ../../c-api/typeobj.rst:533 msgid "PyVarObject Slots" msgstr "" +#: ../../c-api/typeobj.rst:535 msgid ":c:member:`PyVarObject.ob_size`" msgstr "" -msgid "For :ref:`statically allocated type objects `, this should be initialized to zero. For :ref:`dynamically allocated type objects `, this field has a special internal meaning." +#: ../../c-api/typeobj.rst:537 +msgid "" +"For :ref:`statically allocated type objects `, this should be " +"initialized to zero. For :ref:`dynamically allocated type objects `, this field has a special internal meaning." msgstr "" +#: ../../c-api/typeobj.rst:541 msgid "This field should be accessed using the :c:func:`Py_SIZE()` macro." msgstr "" +#: ../../c-api/typeobj.rst:549 msgid "PyTypeObject Slots" msgstr "" -msgid "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` may set a value when the field is set to ``NULL`` then there will also be a \"Default\" section. (Note that many fields set on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" +#: ../../c-api/typeobj.rst:551 +msgid "" +"Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " +"may set a value when the field is set to ``NULL`` then there will also be a " +"\"Default\" section. (Note that many fields set " +"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " +"defaults.)" msgstr "" -msgid "Pointer to a NUL-terminated string containing the name of the type. For types that are accessible as module globals, the string should be the full module name, followed by a dot, followed by the type name; for built-in types, it should be just the type name. If the module is a submodule of a package, the full package name is part of the full module name. For example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." +#: ../../c-api/typeobj.rst:558 +msgid "" +"Pointer to a NUL-terminated string containing the name of the type. For " +"types that are accessible as module globals, the string should be the full " +"module name, followed by a dot, followed by the type name; for built-in " +"types, it should be just the type name. If the module is a submodule of a " +"package, the full package name is part of the full module name. For " +"example, a type named :class:`!T` defined in module :mod:`!M` in " +"subpackage :mod:`!Q` in package :mod:`!P` should have " +"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -msgid "For :ref:`dynamically allocated type objects `, this should just be the type name, and the module name explicitly stored in the type dict as the value for key ``'__module__'``." +#: ../../c-api/typeobj.rst:566 +msgid "" +"For :ref:`dynamically allocated type objects `, this should just " +"be the type name, and the module name explicitly stored in the type dict as " +"the value for key ``'__module__'``." msgstr "" -msgid "For :ref:`statically allocated type objects `, the *tp_name* field should contain a dot. Everything before the last dot is made accessible as the :attr:`~type.__module__` attribute, and everything after the last dot is made accessible as the :attr:`~type.__name__` attribute." +#: ../../c-api/typeobj.rst:571 +msgid "" +"For :ref:`statically allocated type objects `, the *tp_name* " +"field should contain a dot. Everything before the last dot is made " +"accessible as the :attr:`~type.__module__` attribute, and everything after " +"the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -msgid "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is made accessible as the :attr:`~type.__name__` attribute, and the :attr:`~type.__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your type will be impossible to pickle. Additionally, it will not be listed in module documentations created with pydoc." +#: ../../c-api/typeobj.rst:577 +msgid "" +"If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " +"made accessible as the :attr:`~type.__name__` attribute, and " +"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " +"in the dictionary, as explained above). This means your type will be " +"impossible to pickle. Additionally, it will not be listed in module " +"documentations created with pydoc." msgstr "" -msgid "This field must not be ``NULL``. It is the only required field in :c:func:`PyTypeObject` (other than potentially :c:member:`~PyTypeObject.tp_itemsize`)." +#: ../../c-api/typeobj.rst:583 +msgid "" +"This field must not be ``NULL``. It is the only required field " +"in :c:func:`PyTypeObject` (other than " +"potentially :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -msgid "These fields allow calculating the size in bytes of instances of the type." +#: ../../c-api/typeobj.rst:595 +msgid "" +"These fields allow calculating the size in bytes of instances of the type." msgstr "" -msgid "There are two kinds of types: types with fixed-length instances have a zero :c:member:`!tp_itemsize` field, types with variable-length instances have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length instances, all instances have the same size, given in :c:member:`!tp_basicsize`. (Exceptions to this rule can be made using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" +#: ../../c-api/typeobj.rst:597 +msgid "" +"There are two kinds of types: types with fixed-length instances have a " +"zero :c:member:`!tp_itemsize` field, types with variable-length instances " +"have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" +"length instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made " +"using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -msgid "For a type with variable-length instances, the instances must have an :c:member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the \"length\" of the object." +#: ../../c-api/typeobj.rst:604 +msgid "" +"For a type with variable-length instances, the instances must have " +"an :c:member:`~PyVarObject.ob_size` field, and the instance size " +"is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " +"is the \"length\" of the object." msgstr "" -msgid "Functions like :c:func:`PyObject_NewVar` will take the value of N as an argument, and store in the instance's :c:member:`~PyVarObject.ob_size` field. Note that the :c:member:`~PyVarObject.ob_size` field may later be used for other purposes. For example, :py:type:`int` instances use the bits of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the underlying storage and its size should be accessed using :c:func:`PyLong_Export`." +#: ../../c-api/typeobj.rst:609 +msgid "" +"Functions like :c:func:`PyObject_NewVar` will take the value of N as an " +"argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " +"field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " +"used for other purposes. For example, :py:type:`int` instances use the bits " +"of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " +"underlying storage and its size should be accessed " +"using :c:func:`PyLong_Export`." msgstr "" -msgid "The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." +#: ../../c-api/typeobj.rst:619 +msgid "" +"The :c:member:`~PyVarObject.ob_size` field should be accessed using " +"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" -msgid "Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the instance layout doesn't mean that the instance structure is variable-length. For example, the :py:type:`list` type has fixed-length instances, yet those instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:`PyList_Size` instead.)" +#: ../../c-api/typeobj.rst:622 +msgid "" +"Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " +"instance layout doesn't mean that the instance structure is variable-length. " +"For example, the :py:type:`list` type has fixed-length instances, yet those " +"instances have a :c:member:`~PyVarObject.ob_size` field. (As " +"with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. " +"Call :c:func:`PyList_Size` instead.)" msgstr "" -msgid "The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." +#: ../../c-api/typeobj.rst:629 +msgid "" +"The :c:member:`!tp_basicsize` includes size needed for data of the " +"type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each " +"instance." msgstr "" -msgid "The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` operator on the struct used to declare the instance layout. This struct must include the struct used to declare the base type. In other words, :c:member:`!tp_basicsize` must be greater than or equal to the base's :c:member:`!tp_basicsize`." +#: ../../c-api/typeobj.rst:633 +msgid "" +"The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " +"operator on the struct used to declare the instance layout. This struct must " +"include the struct used to declare the base type. In other " +"words, :c:member:`!tp_basicsize` must be greater than or equal to the " +"base's :c:member:`!tp_basicsize`." msgstr "" -msgid "Since every type is a subtype of :py:type:`object`, this struct must include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:member:`~PyVarObject.ob_size` should be included). These are usually defined by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, respectively." +#: ../../c-api/typeobj.rst:639 +msgid "" +"Since every type is a subtype of :py:type:`object`, this struct must " +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " +"whether :c:member:`~PyVarObject.ob_size` should be included). These are " +"usually defined by the macro :c:macro:`PyObject_HEAD` " +"or :c:macro:`PyObject_VAR_HEAD`, respectively." msgstr "" -msgid "The basic size does not include the GC header size, as that header is not part of :c:macro:`PyObject_HEAD`." +#: ../../c-api/typeobj.rst:645 +msgid "" +"The basic size does not include the GC header size, as that header is not " +"part of :c:macro:`PyObject_HEAD`." msgstr "" -msgid "For cases where struct used to declare the base type is unknown, see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +#: ../../c-api/typeobj.rst:648 +msgid "" +"For cases where struct used to declare the base type is unknown, " +"see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." msgstr "" +#: ../../c-api/typeobj.rst:651 msgid "Notes about alignment:" msgstr "" -msgid ":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as recommended, the compiler ensures this. When not using a C ``struct``, or when using compiler extensions like ``__attribute__((packed))``, it is up to you." +#: ../../c-api/typeobj.rst:653 +msgid "" +":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " +"using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " +"recommended, the compiler ensures this. When not using a C ``struct``, or " +"when using compiler extensions like ``__attribute__((packed))``, it is up to " +"you." msgstr "" -msgid "If the variable items require a particular alignment, :c:member:`!tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that alignment. For example, if a type's variable part stores a ``double``, it is your responsibility that both fields are a multiple of ``_Alignof(double)``." +#: ../../c-api/typeobj.rst:658 +msgid "" +"If the variable items require a particular alignment, :c:member:`!" +"tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " +"alignment. For example, if a type's variable part stores a ``double``, it is " +"your responsibility that both fields are a multiple of ``_Alignof(double)``." msgstr "" -msgid "These fields are inherited separately by subtypes. (That is, if the field is set to zero, :c:func:`PyType_Ready` will copy the value from the base type, indicating that the instances do not need additional storage.)" +#: ../../c-api/typeobj.rst:667 +msgid "" +"These fields are inherited separately by subtypes. (That is, if the field is " +"set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " +"indicating that the instances do not need additional storage.)" msgstr "" -msgid "If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a different non-zero value in a subtype (though this depends on the implementation of the base type)." +#: ../../c-api/typeobj.rst:672 +msgid "" +"If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " +"generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " +"different non-zero value in a subtype (though this depends on the " +"implementation of the base type)." msgstr "" -msgid "A pointer to the instance destructor function. The function signature is::" +#: ../../c-api/typeobj.rst:681 +msgid "" +"A pointer to the instance destructor function. The function signature is::" msgstr "" +#: ../../c-api/typeobj.rst:683 msgid "void tp_dealloc(PyObject *self);" msgstr "" -msgid "The destructor function should remove all references which the instance owns (e.g., call :c:func:`Py_CLEAR`), free all memory buffers owned by the instance, and call the type's :c:member:`~PyTypeObject.tp_free` function to free the object itself." +#: ../../c-api/typeobj.rst:685 +msgid "" +"The destructor function should remove all references which the instance owns " +"(e.g., call :c:func:`Py_CLEAR`), free all memory buffers owned by the " +"instance, and call the type's :c:member:`~PyTypeObject.tp_free` function to " +"free the object itself." msgstr "" -msgid "If you may call functions that may set the error indicator, you must use :c:func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` to ensure you don't clobber a preexisting error indicator (the deallocation could have occurred while processing a different error):" +#: ../../c-api/typeobj.rst:690 +msgid "" +"If you may call functions that may set the error indicator, you must " +"use :c:func:`PyErr_GetRaisedException` " +"and :c:func:`PyErr_SetRaisedException` to ensure you don't clobber a " +"preexisting error indicator (the deallocation could have occurred while " +"processing a different error):" msgstr "" +#: ../../c-api/typeobj.rst:695 msgid "" "static void\n" "foo_dealloc(foo_object *self)\n" @@ -1063,33 +1636,69 @@ msgid "" "}" msgstr "" -msgid "The dealloc handler itself must not raise an exception; if it hits an error case it should call :c:func:`PyErr_FormatUnraisable` to log (and clear) an unraisable exception." +#: ../../c-api/typeobj.rst:706 +msgid "" +"The dealloc handler itself must not raise an exception; if it hits an error " +"case it should call :c:func:`PyErr_FormatUnraisable` to log (and clear) an " +"unraisable exception." msgstr "" +#: ../../c-api/typeobj.rst:710 msgid "No guarantees are made about when an object is destroyed, except:" msgstr "" -msgid "Python will destroy an object immediately or some time after the final reference to the object is deleted, unless its finalizer (:c:member:`~PyTypeObject.tp_finalize`) subsequently resurrects the object." +#: ../../c-api/typeobj.rst:712 +msgid "" +"Python will destroy an object immediately or some time after the final " +"reference to the object is deleted, unless its finalizer " +"(:c:member:`~PyTypeObject.tp_finalize`) subsequently resurrects the object." msgstr "" -msgid "An object will not be destroyed while it is being automatically finalized (:c:member:`~PyTypeObject.tp_finalize`) or automatically cleared (:c:member:`~PyTypeObject.tp_clear`)." +#: ../../c-api/typeobj.rst:716 +msgid "" +"An object will not be destroyed while it is being automatically finalized " +"(:c:member:`~PyTypeObject.tp_finalize`) or automatically cleared " +"(:c:member:`~PyTypeObject.tp_clear`)." msgstr "" -msgid "CPython currently destroys an object immediately from :c:func:`Py_DECREF` when the new reference count is zero, but this may change in a future version." +#: ../../c-api/typeobj.rst:720 +msgid "" +"CPython currently destroys an object immediately from :c:func:`Py_DECREF` " +"when the new reference count is zero, but this may change in a future " +"version." msgstr "" -msgid "It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the beginning of :c:member:`!tp_dealloc` to guarantee that the object is always finalized before destruction." +#: ../../c-api/typeobj.rst:724 +msgid "" +"It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " +"beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " +"finalized before destruction." msgstr "" -msgid "If the type supports garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set), the destructor should call :c:func:`PyObject_GC_UnTrack` before clearing any member fields." +#: ../../c-api/typeobj.rst:728 +msgid "" +"If the type supports garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` " +"flag is set), the destructor should call :c:func:`PyObject_GC_UnTrack` " +"before clearing any member fields." msgstr "" -msgid "It is permissible to call :c:member:`~PyTypeObject.tp_clear` from :c:member:`!tp_dealloc` to reduce code duplication and to guarantee that the object is always cleared before destruction. Beware that :c:member:`!tp_clear` might have already been called." +#: ../../c-api/typeobj.rst:732 +msgid "" +"It is permissible to call :c:member:`~PyTypeObject.tp_clear` " +"from :c:member:`!tp_dealloc` to reduce code duplication and to guarantee " +"that the object is always cleared before destruction. Beware " +"that :c:member:`!tp_clear` might have already been called." msgstr "" -msgid "If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the deallocator should release the owned reference to its type object (via :c:func:`Py_DECREF`) after calling the type deallocator. See the example code below.::" +#: ../../c-api/typeobj.rst:737 +msgid "" +"If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " +"deallocator should release the owned reference to its type object " +"(via :c:func:`Py_DECREF`) after calling the type deallocator. See the " +"example code below.::" msgstr "" +#: ../../c-api/typeobj.rst:742 msgid "" "static void\n" "foo_dealloc(PyObject *op)\n" @@ -1101,12 +1710,19 @@ msgid "" "}" msgstr "" -msgid ":c:member:`!tp_dealloc` must leave the exception status unchanged. If it needs to call something that might raise an exception, the exception state must be backed up first and restored later (after logging any exceptions with :c:func:`PyErr_WriteUnraisable`)." +#: ../../c-api/typeobj.rst:751 +msgid "" +":c:member:`!tp_dealloc` must leave the exception status unchanged. If it " +"needs to call something that might raise an exception, the exception state " +"must be backed up first and restored later (after logging any exceptions " +"with :c:func:`PyErr_WriteUnraisable`)." msgstr "" +#: ../../c-api/typeobj.rst:756 msgid "Example::" msgstr "" +#: ../../c-api/typeobj.rst:758 msgid "" "static void\n" "foo_dealloc(PyObject *self)\n" @@ -1148,393 +1764,851 @@ msgid "" "}" msgstr "" -msgid ":c:member:`!tp_dealloc` may be called from any Python thread, not just the thread which created the object (if the object becomes part of a refcount cycle, that cycle might be collected by a garbage collection on any thread). This is not a problem for Python API calls, since the thread on which :c:member:`!tp_dealloc` is called with an :term:`attached thread state`. However, if the object being destroyed in turn destroys objects from some other C library, care should be taken to ensure that destroying those objects on the thread which called :c:member:`!tp_dealloc` will not violate any assumptions of the library." -msgstr "" - -msgid ":ref:`life-cycle` for details about how this slot relates to other slots." +#: ../../c-api/typeobj.rst:797 +msgid "" +":c:member:`!tp_dealloc` may be called from any Python thread, not just the " +"thread which created the object (if the object becomes part of a refcount " +"cycle, that cycle might be collected by a garbage collection on any " +"thread). This is not a problem for Python API calls, since the thread on " +"which :c:member:`!tp_dealloc` is called with an :term:`attached thread " +"state`. However, if the object being destroyed in turn destroys objects " +"from some other C library, care should be taken to ensure that destroying " +"those objects on the thread which called :c:member:`!tp_dealloc` will not " +"violate any assumptions of the library." +msgstr "" + +#: ../../c-api/typeobj.rst:815 ../../c-api/typeobj.rst:1798 +#: ../../c-api/typeobj.rst:2565 +msgid "" +":ref:`life-cycle` for details about how this slot relates to other slots." msgstr "" -msgid "An optional offset to a per-instance function that implements calling the object using the :ref:`vectorcall protocol `, a more efficient alternative of the simpler :c:member:`~PyTypeObject.tp_call`." +#: ../../c-api/typeobj.rst:820 +msgid "" +"An optional offset to a per-instance function that implements calling the " +"object using the :ref:`vectorcall protocol `, a more efficient " +"alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -msgid "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is set. If so, this must be a positive integer containing the offset in the instance of a :c:type:`vectorcallfunc` pointer." +#: ../../c-api/typeobj.rst:825 +msgid "" +"This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " +"set. If so, this must be a positive integer containing the offset in the " +"instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -msgid "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the instance falls back to :c:member:`~PyTypeObject.tp_call`." +#: ../../c-api/typeobj.rst:829 +msgid "" +"The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " +"behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " +"instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -msgid "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the *vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:`PyVectorcall_Call`." +#: ../../c-api/typeobj.rst:833 +msgid "" +"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also " +"set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is " +"consistent with the *vectorcallfunc* function. This can be done by setting " +"*tp_call* to :c:func:`PyVectorcall_Call`." msgstr "" -msgid "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was used for printing to a file. In Python 3.0 to 3.7, it was unused." +#: ../../c-api/typeobj.rst:840 +msgid "" +"Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " +"used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -msgid "Before version 3.12, it was not recommended for :ref:`mutable heap types ` to implement the vectorcall protocol. When a user sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, likely making it inconsistent with the vectorcall function. Since 3.12, setting ``__call__`` will disable vectorcall optimization by clearing the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." +#: ../../c-api/typeobj.rst:846 +msgid "" +"Before version 3.12, it was not recommended for :ref:`mutable heap types " +"` to implement the vectorcall protocol. When a user " +"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " +"likely making it inconsistent with the vectorcall function. Since 3.12, " +"setting ``__call__`` will disable vectorcall optimization by clearing " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -msgid "This field is always inherited. However, the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, then the subclass won't use :ref:`vectorcall `, except when :c:func:`PyVectorcall_Call` is explicitly called." +#: ../../c-api/typeobj.rst:856 +msgid "" +"This field is always inherited. However, " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " +"it's not set, then the subclass won't use :ref:`vectorcall `, " +"except when :c:func:`PyVectorcall_Call` is explicitly called." msgstr "" +#: ../../c-api/typeobj.rst:867 msgid "An optional pointer to the get-attribute-string function." msgstr "" -msgid "This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, but taking a C string instead of a Python string object to give the attribute name." +#: ../../c-api/typeobj.rst:869 +msgid "" +"This field is deprecated. When it is defined, it should point to a function " +"that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " +"but taking a C string instead of a Python string object to give the " +"attribute name." msgstr "" +#: ../../c-api/typeobj.rst:875 ../../c-api/typeobj.rst:1083 msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +#: ../../c-api/typeobj.rst:877 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -msgid "An optional pointer to the function for setting and deleting attributes." +#: ../../c-api/typeobj.rst:886 ../../c-api/typeobj.rst:1098 +msgid "" +"An optional pointer to the function for setting and deleting attributes." msgstr "" -msgid "This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string instead of a Python string object to give the attribute name." +#: ../../c-api/typeobj.rst:888 +msgid "" +"This field is deprecated. When it is defined, it should point to a function " +"that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " +"but taking a C string instead of a Python string object to give the " +"attribute name." msgstr "" +#: ../../c-api/typeobj.rst:894 ../../c-api/typeobj.rst:1111 msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +#: ../../c-api/typeobj.rst:896 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -msgid "Pointer to an additional structure that contains fields relevant only to objects which implement :term:`awaitable` and :term:`asynchronous iterator` protocols at the C-level. See :ref:`async-structs` for details." +#: ../../c-api/typeobj.rst:903 +msgid "" +"Pointer to an additional structure that contains fields relevant only to " +"objects which implement :term:`awaitable` and :term:`asynchronous iterator` " +"protocols at the C-level. See :ref:`async-structs` for details." msgstr "" +#: ../../c-api/typeobj.rst:907 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the contained fields are inherited individually." +#: ../../c-api/typeobj.rst:912 +msgid "" +"The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " +"contained fields are inherited individually." msgstr "" -msgid "An optional pointer to a function that implements the built-in function :func:`repr`." +#: ../../c-api/typeobj.rst:922 +msgid "" +"An optional pointer to a function that implements the built-in " +"function :func:`repr`." msgstr "" +#: ../../c-api/typeobj.rst:925 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" +#: ../../c-api/typeobj.rst:927 msgid "PyObject *tp_repr(PyObject *self);" msgstr "" -msgid "The function must return a string or a Unicode object. Ideally, this function should return a string that, when passed to :func:`eval`, given a suitable environment, returns an object with the same value. If this is not feasible, it should return a string starting with ``'<'`` and ending with ``'>'`` from which both the type and the value of the object can be deduced." -msgstr "" - +#: ../../c-api/typeobj.rst:929 +msgid "" +"The function must return a string or a Unicode object. Ideally, this " +"function should return a string that, when passed to :func:`eval`, given a " +"suitable environment, returns an object with the same value. If this is not " +"feasible, it should return a string starting with ``'<'`` and ending with " +"``'>'`` from which both the type and the value of the object can be deduced." +msgstr "" + +#: ../../c-api/typeobj.rst:940 ../../c-api/typeobj.rst:1021 +#: ../../c-api/typeobj.rst:1062 ../../c-api/typeobj.rst:1089 +#: ../../c-api/typeobj.rst:1117 ../../c-api/typeobj.rst:1159 +#: ../../c-api/typeobj.rst:1863 ../../c-api/typeobj.rst:1897 +#: ../../c-api/typeobj.rst:2026 ../../c-api/typeobj.rst:2059 +#: ../../c-api/typeobj.rst:2138 ../../c-api/typeobj.rst:2181 +#: ../../c-api/typeobj.rst:2203 ../../c-api/typeobj.rst:2244 +#: ../../c-api/typeobj.rst:2274 ../../c-api/typeobj.rst:2307 msgid "**Default:**" msgstr "" -msgid "When this field is not set, a string of the form ``<%s object at %p>`` is returned, where ``%s`` is replaced by the type name, and ``%p`` by the object's memory address." +#: ../../c-api/typeobj.rst:942 +msgid "" +"When this field is not set, a string of the form ``<%s object at %p>`` is " +"returned, where ``%s`` is replaced by the type name, and ``%p`` by the " +"object's memory address." msgstr "" -msgid "Pointer to an additional structure that contains fields relevant only to objects which implement the number protocol. These fields are documented in :ref:`number-structs`." +#: ../../c-api/typeobj.rst:949 +msgid "" +"Pointer to an additional structure that contains fields relevant only to " +"objects which implement the number protocol. These fields are documented " +"in :ref:`number-structs`." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the contained fields are inherited individually." +#: ../../c-api/typeobj.rst:955 +msgid "" +"The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " +"contained fields are inherited individually." msgstr "" -msgid "Pointer to an additional structure that contains fields relevant only to objects which implement the sequence protocol. These fields are documented in :ref:`sequence-structs`." +#: ../../c-api/typeobj.rst:961 +msgid "" +"Pointer to an additional structure that contains fields relevant only to " +"objects which implement the sequence protocol. These fields are documented " +"in :ref:`sequence-structs`." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the contained fields are inherited individually." +#: ../../c-api/typeobj.rst:967 +msgid "" +"The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " +"contained fields are inherited individually." msgstr "" -msgid "Pointer to an additional structure that contains fields relevant only to objects which implement the mapping protocol. These fields are documented in :ref:`mapping-structs`." +#: ../../c-api/typeobj.rst:973 +msgid "" +"Pointer to an additional structure that contains fields relevant only to " +"objects which implement the mapping protocol. These fields are documented " +"in :ref:`mapping-structs`." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the contained fields are inherited individually." +#: ../../c-api/typeobj.rst:979 +msgid "" +"The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " +"contained fields are inherited individually." msgstr "" -msgid "An optional pointer to a function that implements the built-in function :func:`hash`." +#: ../../c-api/typeobj.rst:989 +msgid "" +"An optional pointer to a function that implements the built-in " +"function :func:`hash`." msgstr "" +#: ../../c-api/typeobj.rst:992 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" +#: ../../c-api/typeobj.rst:994 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "" -msgid "The value ``-1`` should not be returned as a normal return value; when an error occurs during the computation of the hash value, the function should set an exception and return ``-1``." +#: ../../c-api/typeobj.rst:996 +msgid "" +"The value ``-1`` should not be returned as a normal return value; when an " +"error occurs during the computation of the hash value, the function should " +"set an exception and return ``-1``." msgstr "" -msgid "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` is not set), an attempt to take the hash of the object raises :exc:`TypeError`. This is the same as setting it to :c:func:`PyObject_HashNotImplemented`." +#: ../../c-api/typeobj.rst:1000 +msgid "" +"When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " +"is not set), an attempt to take the hash of the object " +"raises :exc:`TypeError`. This is the same as setting it " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -msgid "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to block inheritance of the hash method from a parent type. This is interpreted as the equivalent of ``__hash__ = None`` at the Python level, causing ``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note that the converse is also true - setting ``__hash__ = None`` on a class at the Python level will result in the ``tp_hash`` slot being set to :c:func:`PyObject_HashNotImplemented`." +#: ../../c-api/typeobj.rst:1004 +msgid "" +"This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " +"block inheritance of the hash method from a parent type. This is interpreted " +"as the equivalent of ``__hash__ = None`` at the Python level, causing " +"``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " +"that the converse is also true - setting ``__hash__ = None`` on a class at " +"the Python level will result in the ``tp_hash`` slot being set " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" +#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1856 msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +#: ../../c-api/typeobj.rst:1016 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " +"of :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash`, when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" +#: ../../c-api/typeobj.rst:1023 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -msgid "An optional pointer to a function that implements calling the object. This should be ``NULL`` if the object is not callable. The signature is the same as for :c:func:`PyObject_Call`::" +#: ../../c-api/typeobj.rst:1030 +msgid "" +"An optional pointer to a function that implements calling the object. This " +"should be ``NULL`` if the object is not callable. The signature is the same " +"as for :c:func:`PyObject_Call`::" msgstr "" +#: ../../c-api/typeobj.rst:1034 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "" -msgid "An optional pointer to a function that implements the built-in operation :func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls the constructor for that type. This constructor calls :c:func:`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call this handler.)" +#: ../../c-api/typeobj.rst:1045 +msgid "" +"An optional pointer to a function that implements the built-in " +"operation :func:`str`. (Note that :class:`str` is a type now, " +"and :func:`str` calls the constructor for that type. This constructor " +"calls :c:func:`PyObject_Str` to do the actual work, " +"and :c:func:`PyObject_Str` will call this handler.)" msgstr "" +#: ../../c-api/typeobj.rst:1050 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" +#: ../../c-api/typeobj.rst:1052 msgid "PyObject *tp_str(PyObject *self);" msgstr "" -msgid "The function must return a string or a Unicode object. It should be a \"friendly\" string representation of the object, as this is the representation that will be used, among other things, by the :func:`print` function." +#: ../../c-api/typeobj.rst:1054 +msgid "" +"The function must return a string or a Unicode object. It should be a " +"\"friendly\" string representation of the object, as this is the " +"representation that will be used, among other things, by the :func:`print` " +"function." msgstr "" -msgid "When this field is not set, :c:func:`PyObject_Repr` is called to return a string representation." +#: ../../c-api/typeobj.rst:1064 +msgid "" +"When this field is not set, :c:func:`PyObject_Repr` is called to return a " +"string representation." msgstr "" +#: ../../c-api/typeobj.rst:1072 msgid "An optional pointer to the get-attribute function." msgstr "" +#: ../../c-api/typeobj.rst:1074 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" +#: ../../c-api/typeobj.rst:1076 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "" -msgid "It is usually convenient to set this field to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of looking for object attributes." +#: ../../c-api/typeobj.rst:1078 +msgid "" +"It is usually convenient to set this field " +"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " +"looking for object attributes." msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." +#: ../../c-api/typeobj.rst:1085 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" +#: ../../c-api/typeobj.rst:1091 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" +#: ../../c-api/typeobj.rst:1100 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" +#: ../../c-api/typeobj.rst:1102 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "" -msgid "In addition, setting *value* to ``NULL`` to delete an attribute must be supported. It is usually convenient to set this field to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of setting object attributes." +#: ../../c-api/typeobj.rst:1104 +msgid "" +"In addition, setting *value* to ``NULL`` to delete an attribute must be " +"supported. It is usually convenient to set this field " +"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " +"setting object attributes." msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." +#: ../../c-api/typeobj.rst:1113 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" +#: ../../c-api/typeobj.rst:1119 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -msgid "Pointer to an additional structure that contains fields relevant only to objects which implement the buffer interface. These fields are documented in :ref:`buffer-structs`." -msgstr "" - -msgid "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the contained fields are inherited individually." +#: ../../c-api/typeobj.rst:1124 +msgid "" +"Pointer to an additional structure that contains fields relevant only to " +"objects which implement the buffer interface. These fields are documented " +"in :ref:`buffer-structs`." msgstr "" -msgid "This field is a bit mask of various flags. Some flags indicate variant semantics for certain situations; others are used to indicate that certain fields in the type object (or in the extension structures referenced via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not always present are valid; if such a flag bit is clear, the type fields it guards must not be accessed and must be considered to have a zero or ``NULL`` value instead." +#: ../../c-api/typeobj.rst:1130 +msgid "" +"The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " +"contained fields are inherited individually." msgstr "" -msgid "Inheritance of this field is complicated. Most flag bits are inherited individually, i.e. if the base type has a flag bit set, the subtype inherits this flag bit. The flag bits that pertain to extension structures are strictly inherited if the extension structure is inherited, i.e. the base type's value of the flag bit is copied into the subtype together with a pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` values." +#: ../../c-api/typeobj.rst:1136 +msgid "" +"This field is a bit mask of various flags. Some flags indicate variant " +"semantics for certain situations; others are used to indicate that certain " +"fields in the type object (or in the extension structures referenced " +"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " +"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " +"always present are valid; if such a flag bit is clear, the type fields it " +"guards must not be accessed and must be considered to have a zero or " +"``NULL`` value instead." msgstr "" -msgid ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE``." +#: ../../c-api/typeobj.rst:1146 +msgid "" +"Inheritance of this field is complicated. Most flag bits are inherited " +"individually, i.e. if the base type has a flag bit set, the subtype inherits " +"this flag bit. The flag bits that pertain to extension structures are " +"strictly inherited if the extension structure is inherited, i.e. the base " +"type's value of the flag bit is copied into the subtype together with a " +"pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag " +"bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values." +msgstr "" + +#: ../../c-api/typeobj.rst:1161 +msgid "" +":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " +"Py_TPFLAGS_BASETYPE``." msgstr "" +#: ../../c-api/typeobj.rst:1164 msgid "**Bit Masks:**" msgstr "" -msgid "The following bit masks are currently defined; these can be ORed together using the ``|`` operator to form the value of the :c:member:`~PyTypeObject.tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-zero." -msgstr "" - -msgid "This bit is set when the type object itself is allocated on the heap, for example, types created dynamically using :c:func:`PyType_FromSpec`. In this case, the :c:member:`~PyObject.ob_type` field of its instances is considered a reference to the type, and the type object is INCREF'ed when a new instance is created, and DECREF'ed when an instance is destroyed (this does not apply to instances of subtypes; only the type referenced by the instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:`support garbage collection ` as they can form a reference cycle with their own module object." +#: ../../c-api/typeobj.rst:1168 +msgid "" +"The following bit masks are currently defined; these can be ORed together " +"using the ``|`` operator to form the value of " +"the :c:member:`~PyTypeObject.tp_flags` field. The " +"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " +"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." msgstr "" +#: ../../c-api/typeobj.rst:1175 +msgid "" +"This bit is set when the type object itself is allocated on the heap, for " +"example, types created dynamically using :c:func:`PyType_FromSpec`. In this " +"case, the :c:member:`~PyObject.ob_type` field of its instances is considered " +"a reference to the type, and the type object is INCREF'ed when a new " +"instance is created, and DECREF'ed when an instance is destroyed (this does " +"not apply to instances of subtypes; only the type referenced by the " +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " +"also :ref:`support garbage collection ` as they " +"can form a reference cycle with their own module object." +msgstr "" + +#: ../../c-api/typeobj.rst:1186 ../../c-api/typeobj.rst:1197 +#: ../../c-api/typeobj.rst:1207 ../../c-api/typeobj.rst:1217 +#: ../../c-api/typeobj.rst:1249 msgid "???" msgstr "" -msgid "This bit is set when the type can be used as the base type of another type. If this bit is clear, the type cannot be subtyped (similar to a \"final\" class in Java)." +#: ../../c-api/typeobj.rst:1191 +msgid "" +"This bit is set when the type can be used as the base type of another type. " +"If this bit is clear, the type cannot be subtyped (similar to a \"final\" " +"class in Java)." msgstr "" -msgid "This bit is set when the type object has been fully initialized by :c:func:`PyType_Ready`." +#: ../../c-api/typeobj.rst:1202 +msgid "" +"This bit is set when the type object has been fully initialized " +"by :c:func:`PyType_Ready`." msgstr "" -msgid "This bit is set while :c:func:`PyType_Ready` is in the process of initializing the type object." +#: ../../c-api/typeobj.rst:1212 +msgid "" +"This bit is set while :c:func:`PyType_Ready` is in the process of " +"initializing the type object." msgstr "" -msgid "This bit is set when the object supports garbage collection. If this bit is set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must be allocated using :c:macro:`PyObject_GC_New` or :c:func:`PyType_GenericAlloc` and deallocated (see :c:member:`~PyTypeObject.tp_free`) using :c:func:`PyObject_GC_Del`. More information in section :ref:`supporting-cycle-detection`." +#: ../../c-api/typeobj.rst:1222 +msgid "" +"This bit is set when the object supports garbage collection. If this bit is " +"set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must " +"be allocated using :c:macro:`PyObject_GC_New` " +"or :c:func:`PyType_GenericAlloc` and deallocated " +"(see :c:member:`~PyTypeObject.tp_free`) using :c:func:`PyObject_GC_Del`. " +"More information in section :ref:`supporting-cycle-detection`." msgstr "" +#: ../../c-api/typeobj.rst:1231 ../../c-api/typeobj.rst:1643 +#: ../../c-api/typeobj.rst:1789 msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -msgid "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` values." +#: ../../c-api/typeobj.rst:1233 +msgid "" +"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values." msgstr "" -msgid "This is a bitmask of all the bits that pertain to the existence of certain fields in the type object and its extension structures. Currently, it includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." +#: ../../c-api/typeobj.rst:1243 +msgid "" +"This is a bitmask of all the bits that pertain to the existence of certain " +"fields in the type object and its extension structures. Currently, it " +"includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" +#: ../../c-api/typeobj.rst:1254 msgid "This bit indicates that objects behave like unbound methods." msgstr "" +#: ../../c-api/typeobj.rst:1256 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -msgid "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be equivalent to ``meth(obj, *args, **kwds)``." +#: ../../c-api/typeobj.rst:1258 +msgid "" +"``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " +"equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -msgid "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to ``meth(*args, **kwds)``." +#: ../../c-api/typeobj.rst:1261 +msgid "" +"``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " +"``meth(*args, **kwds)``." msgstr "" -msgid "This flag enables an optimization for typical method calls like ``obj.meth()``: it avoids creating a temporary \"bound method\" object for ``obj.meth``." +#: ../../c-api/typeobj.rst:1264 +msgid "" +"This flag enables an optimization for typical method calls like " +"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " +"``obj.meth``." msgstr "" -msgid "This flag is never inherited by types without the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." +#: ../../c-api/typeobj.rst:1272 +msgid "" +"This flag is never inherited by types without " +"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it " +"is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -msgid "This bit indicates that instances of the class have a :attr:`~object.__dict__` attribute, and that the space for the dictionary is managed by the VM." +#: ../../c-api/typeobj.rst:1278 +msgid "" +"This bit indicates that instances of the class have " +"a :attr:`~object.__dict__` attribute, and that the space for the dictionary " +"is managed by the VM." msgstr "" +#: ../../c-api/typeobj.rst:1281 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -msgid "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and its clear function must call :c:func:`PyObject_ClearManagedDict`." +#: ../../c-api/typeobj.rst:1283 +msgid "" +"The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " +"its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -msgid "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` field is set in a superclass." +#: ../../c-api/typeobj.rst:1290 +msgid "" +"This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " +"field is set in a superclass." msgstr "" -msgid "This bit indicates that instances of the class should be weakly referenceable." +#: ../../c-api/typeobj.rst:1296 +msgid "" +"This bit indicates that instances of the class should be weakly " +"referenceable." msgstr "" -msgid "This flag is inherited unless the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." +#: ../../c-api/typeobj.rst:1303 +msgid "" +"This flag is inherited unless " +"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." msgstr "" -msgid "Only usable with variable-size types, i.e. ones with non-zero :c:member:`~PyTypeObject.tp_itemsize`." +#: ../../c-api/typeobj.rst:1309 +msgid "" +"Only usable with variable-size types, i.e. ones with non-" +"zero :c:member:`~PyTypeObject.tp_itemsize`." msgstr "" -msgid "Indicates that the variable-sized portion of an instance of this type is at the end of the instance's memory area, at an offset of ``Py_TYPE(obj)->tp_basicsize`` (which may be different in each subclass)." +#: ../../c-api/typeobj.rst:1312 +msgid "" +"Indicates that the variable-sized portion of an instance of this type is at " +"the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" +">tp_basicsize`` (which may be different in each subclass)." msgstr "" -msgid "When setting this flag, be sure that all superclasses either use this memory layout, or are not variable-sized. Python does not check this." +#: ../../c-api/typeobj.rst:1317 +msgid "" +"When setting this flag, be sure that all superclasses either use this memory " +"layout, or are not variable-sized. Python does not check this." msgstr "" +#: ../../c-api/typeobj.rst:1325 msgid "This flag is inherited." msgstr "" -msgid "Functions such as :c:func:`PyLong_Check` will call :c:func:`PyType_FastSubclass` with one of these flags to quickly determine if a type is a subclass of a built-in type; such specific checks are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom types that inherit from built-ins should have their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that interacts with such types will behave differently depending on what kind of check is used." +#: ../../c-api/typeobj.rst:1339 +msgid "" +"Functions such as :c:func:`PyLong_Check` will " +"call :c:func:`PyType_FastSubclass` with one of these flags to quickly " +"determine if a type is a subclass of a built-in type; such specific checks " +"are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " +"types that inherit from built-ins should have " +"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " +"interacts with such types will behave differently depending on what kind of " +"check is used." msgstr "" -msgid "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is present in the type structure." +#: ../../c-api/typeobj.rst:1350 +msgid "" +"This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " +"present in the type structure." msgstr "" -msgid "This flag isn't necessary anymore, as the interpreter assumes the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type structure." +#: ../../c-api/typeobj.rst:1355 +msgid "" +"This flag isn't necessary anymore, as the interpreter assumes " +"the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type " +"structure." msgstr "" -msgid "This bit is set when the class implements the :ref:`vectorcall protocol `. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for details." +#: ../../c-api/typeobj.rst:1366 +msgid "" +"This bit is set when the class implements the :ref:`vectorcall protocol " +"`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " +"details." msgstr "" -msgid "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." +#: ../../c-api/typeobj.rst:1372 +msgid "" +"This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" +#: ../../c-api/typeobj.rst:1375 msgid "as ``_Py_TPFLAGS_HAVE_VECTORCALL``" msgstr "" -msgid "Renamed to the current name, without the leading underscore. The old provisional name is :term:`soft deprecated`." +#: ../../c-api/typeobj.rst:1379 +msgid "" +"Renamed to the current name, without the leading underscore. The old " +"provisional name is :term:`soft deprecated`." msgstr "" -msgid "This flag is now removed from a class when the class's :py:meth:`~object.__call__` method is reassigned." +#: ../../c-api/typeobj.rst:1384 +msgid "" +"This flag is now removed from a class when the " +"class's :py:meth:`~object.__call__` method is reassigned." msgstr "" +#: ../../c-api/typeobj.rst:1387 msgid "This flag can now be inherited by mutable classes." msgstr "" -msgid "This bit is set for type objects that are immutable: type attributes cannot be set nor deleted." +#: ../../c-api/typeobj.rst:1391 +msgid "" +"This bit is set for type objects that are immutable: type attributes cannot " +"be set nor deleted." msgstr "" -msgid ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types `." +#: ../../c-api/typeobj.rst:1393 +msgid "" +":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " +"`." msgstr "" +#: ../../c-api/typeobj.rst:1398 ../../c-api/typeobj.rst:1507 +#: ../../c-api/typeobj.rst:1519 msgid "This flag is not inherited." msgstr "" -msgid "Disallow creating instances of the type: set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." +#: ../../c-api/typeobj.rst:1404 +msgid "" +"Disallow creating instances of the type: " +"set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the " +"``__new__`` key in the type dictionary." msgstr "" -msgid "The flag must be set before creating the type, not after. For example, it must be set before :c:func:`PyType_Ready` is called on the type." +#: ../../c-api/typeobj.rst:1408 +msgid "" +"The flag must be set before creating the type, not after. For example, it " +"must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -msgid "The flag is set automatically on :ref:`static types ` if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:member:`~PyTypeObject.tp_new` is NULL." +#: ../../c-api/typeobj.rst:1411 +msgid "" +"The flag is set automatically on :ref:`static types ` " +"if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` " +"and :c:member:`~PyTypeObject.tp_new` is NULL." msgstr "" -msgid "This flag is not inherited. However, subclasses will not be instantiable unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is only possible via the C API)." +#: ../../c-api/typeobj.rst:1417 +msgid "" +"This flag is not inherited. However, subclasses will not be instantiable " +"unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " +"only possible via the C API)." msgstr "" -msgid "To disallow instantiating a class directly but allow instantiating its subclasses (e.g. for an :term:`abstract base class`), do not use this flag. Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." +#: ../../c-api/typeobj.rst:1424 +msgid "" +"To disallow instantiating a class directly but allow instantiating its " +"subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " +"Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -msgid "This bit indicates that instances of the class may match mapping patterns when used as the subject of a :keyword:`match` block. It is automatically set when registering or subclassing :class:`collections.abc.Mapping`, and unset when registering :class:`collections.abc.Sequence`." +#: ../../c-api/typeobj.rst:1435 +msgid "" +"This bit indicates that instances of the class may match mapping patterns " +"when used as the subject of a :keyword:`match` block. It is automatically " +"set when registering or subclassing :class:`collections.abc.Mapping`, and " +"unset when registering :class:`collections.abc.Sequence`." msgstr "" -msgid ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are mutually exclusive; it is an error to enable both flags simultaneously." +#: ../../c-api/typeobj.rst:1442 ../../c-api/typeobj.rst:1464 +msgid "" +":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " +"mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -msgid "This flag is inherited by types that do not already set :c:macro:`Py_TPFLAGS_SEQUENCE`." +#: ../../c-api/typeobj.rst:1447 +msgid "" +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_SEQUENCE`." msgstr "" +#: ../../c-api/typeobj.rst:1450 ../../c-api/typeobj.rst:1472 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -msgid "This bit indicates that instances of the class may match sequence patterns when used as the subject of a :keyword:`match` block. It is automatically set when registering or subclassing :class:`collections.abc.Sequence`, and unset when registering :class:`collections.abc.Mapping`." +#: ../../c-api/typeobj.rst:1457 +msgid "" +"This bit indicates that instances of the class may match sequence patterns " +"when used as the subject of a :keyword:`match` block. It is automatically " +"set when registering or subclassing :class:`collections.abc.Sequence`, and " +"unset when registering :class:`collections.abc.Mapping`." msgstr "" -msgid "This flag is inherited by types that do not already set :c:macro:`Py_TPFLAGS_MAPPING`." +#: ../../c-api/typeobj.rst:1469 +msgid "" +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_MAPPING`." msgstr "" -msgid "Internal. Do not set or unset this flag. To indicate that a class has changed call :c:func:`PyType_Modified`" +#: ../../c-api/typeobj.rst:1479 +msgid "" +"Internal. Do not set or unset this flag. To indicate that a class has " +"changed call :c:func:`PyType_Modified`" msgstr "" -msgid "This flag is present in header files, but is not be used. It will be removed in a future version of CPython" +#: ../../c-api/typeobj.rst:1483 +msgid "" +"This flag is present in header files, but is not be used. It will be removed " +"in a future version of CPython" msgstr "" -msgid "This is a :term:`soft deprecated` macro that does nothing. Historically, this would indicate that the :c:member:`~PyTypeObject.tp_version_tag` field was available and initialized." +#: ../../c-api/typeobj.rst:1489 +msgid "" +"This macro does nothing. Historically, this would indicate that " +"the :c:member:`~PyTypeObject.tp_version_tag` field was available and " +"initialized." msgstr "" -msgid "This bit indicates that instances of this type will have an \"inline values\" array (containing the object's attributes) placed directly after the end of the object." +#: ../../c-api/typeobj.rst:1499 +msgid "" +"This bit indicates that instances of this type will have an \"inline " +"values\" array (containing the object's attributes) placed directly after " +"the end of the object." msgstr "" +#: ../../c-api/typeobj.rst:1503 msgid "This requires that :c:macro:`Py_TPFLAGS_HAVE_GC` is set." msgstr "" -msgid "This bit indicates that this is an abstract type and therefore cannot be instantiated." +#: ../../c-api/typeobj.rst:1514 +msgid "" +"This bit indicates that this is an abstract type and therefore cannot be " +"instantiated." msgstr "" +#: ../../c-api/typeobj.rst:1522 msgid ":mod:`abc`" msgstr "" -msgid "Internal. Do not set or unset this flag. Historically, this was a reserved flag for use in Stackless Python." +#: ../../c-api/typeobj.rst:1527 +msgid "" +"Internal. Do not set or unset this flag. Historically, this was a reserved " +"flag for use in Stackless Python." msgstr "" -msgid "This flag is present in header files, but is not be used. This may be removed in a future version of CPython." +#: ../../c-api/typeobj.rst:1531 +msgid "" +"This flag is present in header files, but is not be used. This may be " +"removed in a future version of CPython." msgstr "" -msgid "An optional pointer to a NUL-terminated C string giving the docstring for this type object. This is exposed as the :attr:`~type.__doc__` attribute on the type and instances of the type." +#: ../../c-api/typeobj.rst:1539 +msgid "" +"An optional pointer to a NUL-terminated C string giving the docstring for " +"this type object. This is exposed as the :attr:`~type.__doc__` attribute on " +"the type and instances of the type." msgstr "" +#: ../../c-api/typeobj.rst:1545 msgid "This field is *not* inherited by subtypes." msgstr "" -msgid "An optional pointer to a traversal function for the garbage collector. This is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The signature is::" +#: ../../c-api/typeobj.rst:1552 +msgid "" +"An optional pointer to a traversal function for the garbage collector. This " +"is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " +"signature is::" msgstr "" +#: ../../c-api/typeobj.rst:1555 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "" -msgid "More information about Python's garbage collection scheme can be found in section :ref:`supporting-cycle-detection`." +#: ../../c-api/typeobj.rst:1557 ../../c-api/typeobj.rst:1784 +msgid "" +"More information about Python's garbage collection scheme can be found in " +"section :ref:`supporting-cycle-detection`." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage collector to detect reference cycles. A typical implementation of a :c:member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` on each of the instance's members that are Python objects that the instance owns. For example, this is function :c:func:`!local_traverse` from the :mod:`!_thread` extension module::" +#: ../../c-api/typeobj.rst:1560 +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " +"collector to detect reference cycles. A typical implementation of " +"a :c:member:`~PyTypeObject.tp_traverse` function simply " +"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " +"objects that the instance owns. For example, this is function :c:func:`!" +"local_traverse` from the :mod:`!_thread` extension module::" msgstr "" +#: ../../c-api/typeobj.rst:1566 msgid "" "static int\n" "local_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1547,120 +2621,278 @@ msgid "" "}" msgstr "" -msgid "Note that :c:func:`Py_VISIT` is called only on those members that can participate in reference cycles. Although there is also a ``self->key`` member, it can only be ``NULL`` or a Python string and therefore cannot be part of a reference cycle." +#: ../../c-api/typeobj.rst:1576 +msgid "" +"Note that :c:func:`Py_VISIT` is called only on those members that can " +"participate in reference cycles. Although there is also a ``self->key`` " +"member, it can only be ``NULL`` or a Python string and therefore cannot be " +"part of a reference cycle." msgstr "" -msgid "On the other hand, even if you know a member can never be part of a cycle, as a debugging aid you may want to visit it anyway just so the :mod:`gc` module's :func:`~gc.get_referents` function will include it." +#: ../../c-api/typeobj.rst:1580 +msgid "" +"On the other hand, even if you know a member can never be part of a cycle, " +"as a debugging aid you may want to visit it anyway just so the :mod:`gc` " +"module's :func:`~gc.get_referents` function will include it." msgstr "" -msgid "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" +#: ../../c-api/typeobj.rst:1584 +msgid "" +"Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" +#: ../../c-api/typeobj.rst:1586 msgid "Py_VISIT(Py_TYPE(self));" msgstr "" -msgid "It is only needed since Python 3.9. To support Python 3.8 and older, this line must be conditional::" +#: ../../c-api/typeobj.rst:1588 +msgid "" +"It is only needed since Python 3.9. To support Python 3.8 and older, this " +"line must be conditional::" msgstr "" +#: ../../c-api/typeobj.rst:1591 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" "#endif" msgstr "" -msgid "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:`PyObject_VisitManagedDict` like this::" +#: ../../c-api/typeobj.rst:1595 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_VisitManagedDict` like this::" msgstr "" +#: ../../c-api/typeobj.rst:1599 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "" -msgid "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members that the instance *owns* (by having :term:`strong references ` to them) must be visited. For instance, if an object supports weak references via the :c:member:`~PyTypeObject.tp_weaklist` slot, the pointer supporting the linked list (what *tp_weaklist* points to) must **not** be visited as the instance does not directly own the weak references to itself (the weakreference list is there to support the weak reference machinery, but the instance has no strong reference to the elements inside it, as they are allowed to be removed even if the instance is still alive)." -msgstr "" - -msgid "The traversal function must not have any side effects. It must not modify the reference counts of any Python objects nor create or destroy any Python objects." +#: ../../c-api/typeobj.rst:1602 +msgid "" +"When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " +"that the instance *owns* (by having :term:`strong references ` to them) must be visited. For instance, if an object supports " +"weak references via the :c:member:`~PyTypeObject.tp_weaklist` slot, the " +"pointer supporting the linked list (what *tp_weaklist* points to) must " +"**not** be visited as the instance does not directly own the weak references " +"to itself (the weakreference list is there to support the weak reference " +"machinery, but the instance has no strong reference to the elements inside " +"it, as they are allowed to be removed even if the instance is still alive)." +msgstr "" + +#: ../../c-api/typeobj.rst:1614 +msgid "" +"The traversal function must not have any side effects. It must not modify " +"the reference counts of any Python objects nor create or destroy any Python " +"objects." msgstr "" -msgid "Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:func:`!local_traverse` to have these specific names; don't name them just anything." +#: ../../c-api/typeobj.rst:1618 +msgid "" +"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters " +"to :c:func:`!local_traverse` to have these specific names; don't name them " +"just anything." msgstr "" -msgid "Instances of :ref:`heap-allocated types ` hold a reference to their type. Their traversal function must therefore either visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by calling ``tp_traverse`` of another heap-allocated type (such as a heap-allocated superclass). If they do not, the type object may not be garbage-collected." +#: ../../c-api/typeobj.rst:1622 +msgid "" +"Instances of :ref:`heap-allocated types ` hold a reference to " +"their type. Their traversal function must therefore either " +"visit :c:func:`Py_TYPE(self) `, or delegate this responsibility by " +"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" +"allocated superclass). If they do not, the type object may not be garbage-" +"collected." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_traverse` function can be called from any thread." +#: ../../c-api/typeobj.rst:1631 +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " +"thread." msgstr "" -msgid "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in ``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." +#: ../../c-api/typeobj.rst:1636 +msgid "" +"Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " +"``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type if they are all zero in the subtype." +#: ../../c-api/typeobj.rst:1645 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_clear` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" +#: ../../c-api/typeobj.rst:1655 msgid "An optional pointer to a clear function. The signature is::" msgstr "" +#: ../../c-api/typeobj.rst:1657 msgid "int tp_clear(PyObject *);" msgstr "" -msgid "The purpose of this function is to break reference cycles that are causing a :term:`cyclic isolate` so that the objects can be safely destroyed. A cleared object is a partially destroyed object; the object is not obligated to satisfy design invariants held during normal use." -msgstr "" - -msgid ":c:member:`!tp_clear` does not need to delete references to objects that can't participate in reference cycles, such as Python strings or Python integers. However, it may be convenient to clear all references, and write the type's :c:member:`~PyTypeObject.tp_dealloc` function to invoke :c:member:`!tp_clear` to avoid code duplication. (Beware that :c:member:`!tp_clear` might have already been called. Prefer calling idempotent functions like :c:func:`Py_CLEAR`.)" +#: ../../c-api/typeobj.rst:1659 +msgid "" +"The purpose of this function is to break reference cycles that are causing " +"a :term:`cyclic isolate` so that the objects can be safely destroyed. A " +"cleared object is a partially destroyed object; the object is not obligated " +"to satisfy design invariants held during normal use." msgstr "" -msgid "Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject.tp_finalize` instead of :c:member:`!tp_clear`." +#: ../../c-api/typeobj.rst:1664 +msgid "" +":c:member:`!tp_clear` does not need to delete references to objects that " +"can't participate in reference cycles, such as Python strings or Python " +"integers. However, it may be convenient to clear all references, and write " +"the type's :c:member:`~PyTypeObject.tp_dealloc` function to " +"invoke :c:member:`!tp_clear` to avoid code duplication. (Beware " +"that :c:member:`!tp_clear` might have already been called. Prefer calling " +"idempotent functions like :c:func:`Py_CLEAR`.)" msgstr "" -msgid "If :c:member:`!tp_clear` fails to break a reference cycle then the objects in the :term:`cyclic isolate` may remain indefinitely uncollectable (\"leak\"). See :data:`gc.garbage`." +#: ../../c-api/typeobj.rst:1672 +msgid "" +"Any non-trivial cleanup should be performed " +"in :c:member:`~PyTypeObject.tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" -msgid "Referents (direct and indirect) might have already been cleared; they are not guaranteed to be in a consistent state." +#: ../../c-api/typeobj.rst:1677 +msgid "" +"If :c:member:`!tp_clear` fails to break a reference cycle then the objects " +"in the :term:`cyclic isolate` may remain indefinitely uncollectable " +"(\"leak\"). See :data:`gc.garbage`." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_clear` function can be called from any thread." +#: ../../c-api/typeobj.rst:1683 +msgid "" +"Referents (direct and indirect) might have already been cleared; they are " +"not guaranteed to be in a consistent state." msgstr "" -msgid "An object is not guaranteed to be automatically cleared before its destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." +#: ../../c-api/typeobj.rst:1688 +msgid "" +"The :c:member:`~PyTypeObject.tp_clear` function can be called from any " +"thread." msgstr "" -msgid "This function differs from the destructor (:c:member:`~PyTypeObject.tp_dealloc`) in the following ways:" +#: ../../c-api/typeobj.rst:1693 +msgid "" +"An object is not guaranteed to be automatically cleared before its " +"destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." msgstr "" -msgid "The purpose of clearing an object is to remove references to other objects that might participate in a reference cycle. The purpose of the destructor, on the other hand, is a superset: it must release *all* resources it owns, including references to objects that cannot participate in a reference cycle (e.g., integers) as well as the object's own memory (by calling :c:member:`~PyTypeObject.tp_free`)." +#: ../../c-api/typeobj.rst:1696 +msgid "" +"This function differs from the destructor " +"(:c:member:`~PyTypeObject.tp_dealloc`) in the following ways:" msgstr "" -msgid "When :c:member:`!tp_clear` is called, other objects might still hold references to the object being cleared. Because of this, :c:member:`!tp_clear` must not deallocate the object's own memory (:c:member:`~PyTypeObject.tp_free`). The destructor, on the other hand, is only called when no (strong) references exist, and as such, must safely destroy the object itself by deallocating it." +#: ../../c-api/typeobj.rst:1699 +msgid "" +"The purpose of clearing an object is to remove references to other objects " +"that might participate in a reference cycle. The purpose of the destructor, " +"on the other hand, is a superset: it must release *all* resources it owns, " +"including references to objects that cannot participate in a reference cycle " +"(e.g., integers) as well as the object's own memory (by " +"calling :c:member:`~PyTypeObject.tp_free`)." msgstr "" -msgid ":c:member:`!tp_clear` might never be automatically called. An object's destructor, on the other hand, will be automatically called some time after the object becomes unreachable (i.e., either there are no references to the object or the object is a member of a :term:`cyclic isolate`)." +#: ../../c-api/typeobj.rst:1705 +msgid "" +"When :c:member:`!tp_clear` is called, other objects might still hold " +"references to the object being cleared. Because of this, :c:member:`!" +"tp_clear` must not deallocate the object's own memory " +"(:c:member:`~PyTypeObject.tp_free`). The destructor, on the other hand, is " +"only called when no (strong) references exist, and as such, must safely " +"destroy the object itself by deallocating it." msgstr "" -msgid "No guarantees are made about when, if, or how often Python automatically clears an object, except:" +#: ../../c-api/typeobj.rst:1711 +msgid "" +":c:member:`!tp_clear` might never be automatically called. An object's " +"destructor, on the other hand, will be automatically called some time after " +"the object becomes unreachable (i.e., either there are no references to the " +"object or the object is a member of a :term:`cyclic isolate`)." msgstr "" -msgid "Python will not automatically clear an object if it is reachable, i.e., there is a reference to it and it is not a member of a :term:`cyclic isolate`." +#: ../../c-api/typeobj.rst:1716 +msgid "" +"No guarantees are made about when, if, or how often Python automatically " +"clears an object, except:" msgstr "" -msgid "Python will not automatically clear an object if it has not been automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If the finalizer resurrected the object, the object may or may not be automatically finalized again before it is cleared.)" +#: ../../c-api/typeobj.rst:1719 +msgid "" +"Python will not automatically clear an object if it is reachable, i.e., " +"there is a reference to it and it is not a member of a :term:`cyclic " +"isolate`." msgstr "" -msgid "If an object is a member of a :term:`cyclic isolate`, Python will not automatically clear it if any member of the cyclic isolate has not yet been automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." +#: ../../c-api/typeobj.rst:1722 +msgid "" +"Python will not automatically clear an object if it has not been " +"automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " +"the finalizer resurrected the object, the object may or may not be " +"automatically finalized again before it is cleared.)" msgstr "" -msgid "Python will not destroy an object until after any automatic calls to its :c:member:`!tp_clear` function have returned. This ensures that the act of breaking a reference cycle does not invalidate the ``self`` pointer while :c:member:`!tp_clear` is still executing." +#: ../../c-api/typeobj.rst:1726 +msgid "" +"If an object is a member of a :term:`cyclic isolate`, Python will not " +"automatically clear it if any member of the cyclic isolate has not yet been " +"automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." msgstr "" -msgid "Python will not automatically call :c:member:`!tp_clear` multiple times concurrently." +#: ../../c-api/typeobj.rst:1729 +msgid "" +"Python will not destroy an object until after any automatic calls to " +"its :c:member:`!tp_clear` function have returned. This ensures that the act " +"of breaking a reference cycle does not invalidate the ``self`` pointer " +"while :c:member:`!tp_clear` is still executing." msgstr "" -msgid "CPython currently only automatically clears objects as needed to break reference cycles in a :term:`cyclic isolate`, but future versions might clear objects regularly before their destruction." +#: ../../c-api/typeobj.rst:1733 +msgid "" +"Python will not automatically call :c:member:`!tp_clear` multiple times " +"concurrently." msgstr "" -msgid "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the system must combine to break all reference cycles. This is subtle, and if in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to prove that no reference cycle can be composed entirely of tuples. Therefore the :c:member:`~PyTypeObject.tp_clear` functions of other types are responsible for breaking any cycle containing a tuple. This isn't immediately obvious, and there's rarely a good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." +#: ../../c-api/typeobj.rst:1736 +msgid "" +"CPython currently only automatically clears objects as needed to break " +"reference cycles in a :term:`cyclic isolate`, but future versions might " +"clear objects regularly before their destruction." msgstr "" -msgid "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the instance's references to those of its members that may be Python objects, and set its pointers to those members to ``NULL``, as in the following example::" +#: ../../c-api/typeobj.rst:1740 +msgid "" +"Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " +"system must combine to break all reference cycles. This is subtle, and if " +"in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For " +"example, the tuple type does not implement " +"a :c:member:`~PyTypeObject.tp_clear` function, because it's possible to " +"prove that no reference cycle can be composed entirely of tuples. Therefore " +"the :c:member:`~PyTypeObject.tp_clear` functions of other types are " +"responsible for breaking any cycle containing a tuple. This isn't " +"immediately obvious, and there's rarely a good reason to avoid " +"implementing :c:member:`~PyTypeObject.tp_clear`." +msgstr "" + +#: ../../c-api/typeobj.rst:1751 +msgid "" +"Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " +"instance's references to those of its members that may be Python objects, " +"and set its pointers to those members to ``NULL``, as in the following " +"example::" msgstr "" +#: ../../c-api/typeobj.rst:1755 msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -1674,438 +2906,932 @@ msgid "" "}" msgstr "" -msgid "The :c:func:`Py_CLEAR` macro should be used, because clearing references is delicate: the reference to the contained object must not be released (via :c:func:`Py_DECREF`) until after the pointer to the contained object is set to ``NULL``. This is because releasing the reference may cause the contained object to become trash, triggering a chain of reclamation activity that may include invoking arbitrary Python code (due to finalizers, or weakref callbacks, associated with the contained object). If it's possible for such code to reference *self* again, it's important that the pointer to the contained object be ``NULL`` at that time, so that *self* knows the contained object can no longer be used. The :c:func:`Py_CLEAR` macro performs the operations in a safe order." -msgstr "" - -msgid "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:`~PyTypeObject.tp_flags` field, the clear function must call :c:func:`PyObject_ClearManagedDict` like this::" +#: ../../c-api/typeobj.rst:1766 +msgid "" +"The :c:func:`Py_CLEAR` macro should be used, because clearing references is " +"delicate: the reference to the contained object must not be released " +"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " +"set to ``NULL``. This is because releasing the reference may cause the " +"contained object to become trash, triggering a chain of reclamation activity " +"that may include invoking arbitrary Python code (due to finalizers, or " +"weakref callbacks, associated with the contained object). If it's possible " +"for such code to reference *self* again, it's important that the pointer to " +"the contained object be ``NULL`` at that time, so that *self* knows the " +"contained object can no longer be used. The :c:func:`Py_CLEAR` macro " +"performs the operations in a safe order." +msgstr "" + +#: ../../c-api/typeobj.rst:1778 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the clear function must " +"call :c:func:`PyObject_ClearManagedDict` like this::" msgstr "" +#: ../../c-api/typeobj.rst:1782 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type if they are all zero in the subtype." +#: ../../c-api/typeobj.rst:1791 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_traverse` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -msgid "An optional pointer to the rich comparison function, whose signature is::" +#: ../../c-api/typeobj.rst:1805 +msgid "" +"An optional pointer to the rich comparison function, whose signature is::" msgstr "" +#: ../../c-api/typeobj.rst:1807 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "" -msgid "The first parameter is guaranteed to be an instance of the type that is defined by :c:type:`PyTypeObject`." +#: ../../c-api/typeobj.rst:1809 +msgid "" +"The first parameter is guaranteed to be an instance of the type that is " +"defined by :c:type:`PyTypeObject`." msgstr "" -msgid "The function should return the result of the comparison (usually ``Py_True`` or ``Py_False``). If the comparison is undefined, it must return ``Py_NotImplemented``, if another error occurred it must return ``NULL`` and set an exception condition." +#: ../../c-api/typeobj.rst:1812 +msgid "" +"The function should return the result of the comparison (usually ``Py_True`` " +"or ``Py_False``). If the comparison is undefined, it must return " +"``Py_NotImplemented``, if another error occurred it must return ``NULL`` and " +"set an exception condition." msgstr "" -msgid "The following constants are defined to be used as the third argument for :c:member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" +#: ../../c-api/typeobj.rst:1817 +msgid "" +"The following constants are defined to be used as the third argument " +"for :c:member:`~PyTypeObject.tp_richcompare` and " +"for :c:func:`PyObject_RichCompare`:" msgstr "" +#: ../../c-api/typeobj.rst:1823 msgid "Constant" msgstr "" +#: ../../c-api/typeobj.rst:1823 msgid "Comparison" msgstr "" +#: ../../c-api/typeobj.rst:1825 msgid "``<``" msgstr "" +#: ../../c-api/typeobj.rst:1827 msgid "``<=``" msgstr "" +#: ../../c-api/typeobj.rst:1829 msgid "``==``" msgstr "" +#: ../../c-api/typeobj.rst:1831 msgid "``!=``" msgstr "" +#: ../../c-api/typeobj.rst:1833 msgid "``>``" msgstr "" +#: ../../c-api/typeobj.rst:1835 msgid "``>=``" msgstr "" -msgid "The following macro is defined to ease writing rich comparison functions:" +#: ../../c-api/typeobj.rst:1838 +msgid "" +"The following macro is defined to ease writing rich comparison functions:" msgstr "" -msgid "Return ``Py_True`` or ``Py_False`` from the function, depending on the result of a comparison. VAL_A and VAL_B must be orderable by C comparison operators (for example, they may be C ints or floats). The third argument specifies the requested operation, as for :c:func:`PyObject_RichCompare`." +#: ../../c-api/typeobj.rst:1842 +msgid "" +"Return ``Py_True`` or ``Py_False`` from the function, depending on the " +"result of a comparison. VAL_A and VAL_B must be orderable by C comparison " +"operators (for example, they may be C ints or floats). The third argument " +"specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" +#: ../../c-api/typeobj.rst:1848 msgid "The returned value is a new :term:`strong reference`." msgstr "" +#: ../../c-api/typeobj.rst:1850 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -msgid "This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +#: ../../c-api/typeobj.rst:1858 +msgid "" +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_hash`: a subtype " +"inherits :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -msgid ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, not even the inherited function is used and instances of the type will not be able to participate in any comparisons." +#: ../../c-api/typeobj.rst:1865 +msgid "" +":c:data:`PyBaseObject_Type` provides " +"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " +"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " +"not even the inherited function is used and instances of the type will not " +"be able to participate in any comparisons." msgstr "" -msgid "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` should be used instead, if at all possible." +#: ../../c-api/typeobj.rst:1874 +msgid "" +"While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " +"should be used instead, if at all possible." msgstr "" -msgid "If the instances of this type are weakly referenceable, this field is greater than zero and contains the offset in the instance structure of the weak reference list head (ignoring the GC header, if present); this offset is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` functions. The instance structure needs to include a field of type :c:expr:`PyObject*` which is initialized to ``NULL``." +#: ../../c-api/typeobj.rst:1877 +msgid "" +"If the instances of this type are weakly referenceable, this field is " +"greater than zero and contains the offset in the instance structure of the " +"weak reference list head (ignoring the GC header, if present); this offset " +"is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " +"functions. The instance structure needs to include a field of " +"type :c:expr:`PyObject*` which is initialized to ``NULL``." msgstr "" -msgid "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that is the list head for weak references to the type object itself." +#: ../../c-api/typeobj.rst:1884 +msgid "" +"Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " +"is the list head for weak references to the type object itself." msgstr "" -msgid "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit and :c:member:`~PyTypeObject.tp_weaklistoffset`." +#: ../../c-api/typeobj.rst:1887 +msgid "" +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " +"and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -msgid "This field is inherited by subtypes, but see the rules listed below. A subtype may override this offset; this means that the subtype uses a different weak reference list head than the base type. Since the list head is always found via :c:member:`~PyTypeObject.tp_weaklistoffset`, this should not be a problem." +#: ../../c-api/typeobj.rst:1892 +msgid "" +"This field is inherited by subtypes, but see the rules listed below. A " +"subtype may override this offset; this means that the subtype uses a " +"different weak reference list head than the base type. Since the list head " +"is always found via :c:member:`~PyTypeObject.tp_weaklistoffset`, this should " +"not be a problem." msgstr "" -msgid "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative value, to indicate that it is unsafe to use this field." +#: ../../c-api/typeobj.rst:1899 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " +"value, to indicate that it is unsafe to use this field." msgstr "" -msgid "An optional pointer to a function that returns an :term:`iterator` for the object. Its presence normally signals that the instances of this type are :term:`iterable` (although sequences may be iterable without this function)." +#: ../../c-api/typeobj.rst:1909 +msgid "" +"An optional pointer to a function that returns an :term:`iterator` for the " +"object. Its presence normally signals that the instances of this type " +"are :term:`iterable` (although sequences may be iterable without this " +"function)." msgstr "" +#: ../../c-api/typeobj.rst:1913 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" +#: ../../c-api/typeobj.rst:1915 msgid "PyObject *tp_iter(PyObject *self);" msgstr "" -msgid "An optional pointer to a function that returns the next item in an :term:`iterator`. The signature is::" +#: ../../c-api/typeobj.rst:1926 +msgid "" +"An optional pointer to a function that returns the next item in " +"an :term:`iterator`. The signature is::" msgstr "" +#: ../../c-api/typeobj.rst:1929 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "" -msgid "When the iterator is exhausted, it must return ``NULL``; a :exc:`StopIteration` exception may or may not be set. When another error occurs, it must return ``NULL`` too. Its presence signals that the instances of this type are iterators." +#: ../../c-api/typeobj.rst:1931 +msgid "" +"When the iterator is exhausted, it must return ``NULL``; " +"a :exc:`StopIteration` exception may or may not be set. When another error " +"occurs, it must return ``NULL`` too. Its presence signals that the " +"instances of this type are iterators." msgstr "" -msgid "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` function, and that function should return the iterator instance itself (not a new iterator instance)." +#: ../../c-api/typeobj.rst:1936 +msgid "" +"Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " +"function, and that function should return the iterator instance itself (not " +"a new iterator instance)." msgstr "" +#: ../../c-api/typeobj.rst:1940 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -msgid "An optional pointer to a static ``NULL``-terminated array of :c:type:`PyMethodDef` structures, declaring regular methods of this type." +#: ../../c-api/typeobj.rst:1951 +msgid "" +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -msgid "For each entry in the array, an entry is added to the type's dictionary (see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." +#: ../../c-api/typeobj.rst:1954 +msgid "" +"For each entry in the array, an entry is added to the type's dictionary " +"(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -msgid "This field is not inherited by subtypes (methods are inherited through a different mechanism)." +#: ../../c-api/typeobj.rst:1959 +msgid "" +"This field is not inherited by subtypes (methods are inherited through a " +"different mechanism)." msgstr "" -msgid "An optional pointer to a static ``NULL``-terminated array of :c:type:`PyMemberDef` structures, declaring regular data members (fields or slots) of instances of this type." +#: ../../c-api/typeobj.rst:1967 +msgid "" +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " +"or slots) of instances of this type." msgstr "" -msgid "For each entry in the array, an entry is added to the type's dictionary (see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." +#: ../../c-api/typeobj.rst:1971 +msgid "" +"For each entry in the array, an entry is added to the type's dictionary " +"(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -msgid "This field is not inherited by subtypes (members are inherited through a different mechanism)." +#: ../../c-api/typeobj.rst:1976 +msgid "" +"This field is not inherited by subtypes (members are inherited through a " +"different mechanism)." msgstr "" -msgid "An optional pointer to a static ``NULL``-terminated array of :c:type:`PyGetSetDef` structures, declaring computed attributes of instances of this type." +#: ../../c-api/typeobj.rst:1984 +msgid "" +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " +"instances of this type." msgstr "" -msgid "For each entry in the array, an entry is added to the type's dictionary (see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." +#: ../../c-api/typeobj.rst:1987 +msgid "" +"For each entry in the array, an entry is added to the type's dictionary " +"(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -msgid "This field is not inherited by subtypes (computed attributes are inherited through a different mechanism)." +#: ../../c-api/typeobj.rst:1992 +msgid "" +"This field is not inherited by subtypes (computed attributes are inherited " +"through a different mechanism)." msgstr "" -msgid "An optional pointer to a base type from which type properties are inherited. At this level, only single inheritance is supported; multiple inheritance require dynamically creating a type object by calling the metatype." +#: ../../c-api/typeobj.rst:2000 +msgid "" +"An optional pointer to a base type from which type properties are " +"inherited. At this level, only single inheritance is supported; multiple " +"inheritance require dynamically creating a type object by calling the " +"metatype." msgstr "" -msgid "Slot initialization is subject to the rules of initializing globals. C99 requires the initializers to be \"address constants\". Function designators like :c:func:`PyType_GenericNew`, with implicit conversion to a pointer, are valid C99 address constants." +#: ../../c-api/typeobj.rst:2008 +msgid "" +"Slot initialization is subject to the rules of initializing globals. C99 " +"requires the initializers to be \"address constants\". Function designators " +"like :c:func:`PyType_GenericNew`, with implicit conversion to a pointer, are " +"valid C99 address constants." msgstr "" -msgid "However, the unary '&' operator applied to a non-static variable like :c:data:`PyBaseObject_Type` is not required to produce an address constant. Compilers may support this (gcc does), MSVC does not. Both compilers are strictly standard conforming in this particular behavior." +#: ../../c-api/typeobj.rst:2013 +msgid "" +"However, the unary '&' operator applied to a non-static variable " +"like :c:data:`PyBaseObject_Type` is not required to produce an address " +"constant. Compilers may support this (gcc does), MSVC does not. Both " +"compilers are strictly standard conforming in this particular behavior." msgstr "" -msgid "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the extension module's init function." +#: ../../c-api/typeobj.rst:2019 +msgid "" +"Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " +"extension module's init function." msgstr "" +#: ../../c-api/typeobj.rst:2024 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -msgid "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers is known as the type :class:`object`)." +#: ../../c-api/typeobj.rst:2028 +msgid "" +"This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " +"is known as the type :class:`object`)." msgstr "" +#: ../../c-api/typeobj.rst:2034 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -msgid "This field should normally be initialized to ``NULL`` before PyType_Ready is called; it may also be initialized to a dictionary containing initial attributes for the type. Once :c:func:`PyType_Ready` has initialized the type, extra attributes for the type may be added to this dictionary only if they don't correspond to overloaded operations (like :meth:`~object.__add__`). Once initialization for the type has finished, this field should be treated as read-only." +#: ../../c-api/typeobj.rst:2036 +msgid "" +"This field should normally be initialized to ``NULL`` before PyType_Ready is " +"called; it may also be initialized to a dictionary containing initial " +"attributes for the type. Once :c:func:`PyType_Ready` has initialized the " +"type, extra attributes for the type may be added to this dictionary only if " +"they don't correspond to overloaded operations " +"(like :meth:`~object.__add__`). Once initialization for the type has " +"finished, this field should be treated as read-only." msgstr "" -msgid "Some types may not store their dictionary in this slot. Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary type." +#: ../../c-api/typeobj.rst:2044 +msgid "" +"Some types may not store their dictionary in this slot. " +"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " +"type." msgstr "" -msgid "Internals detail: For static builtin types, this is always ``NULL``. Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." +#: ../../c-api/typeobj.rst:2050 +msgid "" +"Internals detail: For static builtin types, this is always ``NULL``. " +"Instead, the dict for such types is stored on ``PyInterpreterState``. " +"Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -msgid "This field is not inherited by subtypes (though the attributes defined in here are inherited through a different mechanism)." +#: ../../c-api/typeobj.rst:2056 +msgid "" +"This field is not inherited by subtypes (though the attributes defined in " +"here are inherited through a different mechanism)." msgstr "" -msgid "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new dictionary to it." +#: ../../c-api/typeobj.rst:2061 +msgid "" +"If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " +"dictionary to it." msgstr "" -msgid "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." +#: ../../c-api/typeobj.rst:2066 +msgid "" +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " +"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" +#: ../../c-api/typeobj.rst:2074 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" +#: ../../c-api/typeobj.rst:2076 ../../c-api/typeobj.rst:2094 +#: ../../c-api/typeobj.rst:2160 ../../c-api/typeobj.rst:2192 +#: ../../c-api/typeobj.rst:2217 msgid "The function signature is::" msgstr "" +#: ../../c-api/typeobj.rst:2078 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" -msgid "An optional pointer to a function for setting and deleting a descriptor's value." +#: ../../c-api/typeobj.rst:2091 +msgid "" +"An optional pointer to a function for setting and deleting a descriptor's " +"value." msgstr "" +#: ../../c-api/typeobj.rst:2096 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "" +#: ../../c-api/typeobj.rst:2098 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -msgid "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` should be used instead, if at all possible." +#: ../../c-api/typeobj.rst:2109 +msgid "" +"While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"should be used instead, if at all possible." msgstr "" -msgid "If the instances of this type have a dictionary containing instance variables, this field is non-zero and contains the offset in the instances of the type of the instance variable dictionary; this offset is used by :c:func:`PyObject_GenericGetAttr`." +#: ../../c-api/typeobj.rst:2112 +msgid "" +"If the instances of this type have a dictionary containing instance " +"variables, this field is non-zero and contains the offset in the instances " +"of the type of the instance variable dictionary; this offset is used " +"by :c:func:`PyObject_GenericGetAttr`." msgstr "" -msgid "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is the dictionary for attributes of the type object itself." +#: ../../c-api/typeobj.rst:2117 +msgid "" +"Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " +"the dictionary for attributes of the type object itself." msgstr "" -msgid "The value specifies the offset of the dictionary from the start of the instance structure." +#: ../../c-api/typeobj.rst:2120 +msgid "" +"The value specifies the offset of the dictionary from the start of the " +"instance structure." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-only. To get the pointer to the dictionary call :c:func:`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for the dictionary, so it is may be more efficient to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +#: ../../c-api/typeobj.rst:2122 +msgid "" +"The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" +"only. To get the pointer to the dictionary " +"call :c:func:`PyObject_GenericGetDict`. " +"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " +"the dictionary, so it is may be more efficient to " +"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -msgid "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:member:`~PyTypeObject.tp_dictoffset`." +#: ../../c-api/typeobj.rst:2128 +msgid "" +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit " +"and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -msgid "This field is inherited by subtypes. A subtype should not override this offset; doing so could be unsafe, if C code tries to access the dictionary at the previous offset. To properly support inheritance, use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." +#: ../../c-api/typeobj.rst:2133 +msgid "" +"This field is inherited by subtypes. A subtype should not override this " +"offset; doing so could be unsafe, if C code tries to access the dictionary " +"at the previous offset. To properly support inheritance, " +"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -msgid "This slot has no default. For :ref:`static types `, if the field is ``NULL`` then no :attr:`~object.__dict__` gets created for instances." +#: ../../c-api/typeobj.rst:2140 +msgid "" +"This slot has no default. For :ref:`static types `, if the " +"field is ``NULL`` then no :attr:`~object.__dict__` gets created for " +"instances." msgstr "" -msgid "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to indicate that it is unsafe to use this field." +#: ../../c-api/typeobj.rst:2143 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to " +"indicate that it is unsafe to use this field." msgstr "" +#: ../../c-api/typeobj.rst:2153 msgid "An optional pointer to an instance initialization function." msgstr "" -msgid "This function corresponds to the :meth:`~object.__init__` method of classes. Like :meth:`!__init__`, it is possible to create an instance without calling :meth:`!__init__`, and it is possible to reinitialize an instance by calling its :meth:`!__init__` method again." +#: ../../c-api/typeobj.rst:2155 +msgid "" +"This function corresponds to the :meth:`~object.__init__` method of " +"classes. Like :meth:`!__init__`, it is possible to create an instance " +"without calling :meth:`!__init__`, and it is possible to reinitialize an " +"instance by calling its :meth:`!__init__` method again." msgstr "" +#: ../../c-api/typeobj.rst:2162 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "" -msgid "The self argument is the instance to be initialized; the *args* and *kwds* arguments represent positional and keyword arguments of the call to :meth:`~object.__init__`." +#: ../../c-api/typeobj.rst:2164 +msgid "" +"The self argument is the instance to be initialized; the *args* and *kwds* " +"arguments represent positional and keyword arguments of the call " +"to :meth:`~object.__init__`." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called when an instance is created normally by calling its type, after the type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of the type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance of some other type that is not a subtype of the original type, no :c:member:`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." +#: ../../c-api/typeobj.rst:2168 +msgid "" +"The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " +"when an instance is created normally by calling its type, after the " +"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " +"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " +"instance of some other type that is not a subtype of the original type, " +"no :c:member:`~PyTypeObject.tp_init` function is called; " +"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " +"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" +#: ../../c-api/typeobj.rst:2175 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -msgid "For :ref:`static types ` this field does not have a default." +#: ../../c-api/typeobj.rst:2183 +msgid "" +"For :ref:`static types ` this field does not have a default." msgstr "" +#: ../../c-api/typeobj.rst:2190 msgid "An optional pointer to an instance allocation function." msgstr "" +#: ../../c-api/typeobj.rst:2194 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "" -msgid "Static subtypes inherit this slot, which will be :c:func:`PyType_GenericAlloc` if inherited from :class:`object`." +#: ../../c-api/typeobj.rst:2198 +msgid "" +"Static subtypes inherit this slot, which will " +"be :c:func:`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" +#: ../../c-api/typeobj.rst:2201 ../../c-api/typeobj.rst:2272 msgid ":ref:`Heap subtypes ` do not inherit this slot." msgstr "" -msgid "For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." +#: ../../c-api/typeobj.rst:2205 +msgid "" +"For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." msgstr "" +#: ../../c-api/typeobj.rst:2208 ../../c-api/typeobj.rst:2280 msgid "For static subtypes, this slot is inherited (see above)." msgstr "" +#: ../../c-api/typeobj.rst:2215 msgid "An optional pointer to an instance creation function." msgstr "" -msgid "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" +#: ../../c-api/typeobj.rst:2219 +msgid "" +"PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" -msgid "The *subtype* argument is the type of the object being created; the *args* and *kwds* arguments represent positional and keyword arguments of the call to the type. Note that *subtype* doesn't have to equal the type whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a subtype of that type (but not an unrelated type)." +#: ../../c-api/typeobj.rst:2221 +msgid "" +"The *subtype* argument is the type of the object being created; the *args* " +"and *kwds* arguments represent positional and keyword arguments of the call " +"to the type. Note that *subtype* doesn't have to equal the type " +"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " +"subtype of that type (but not an unrelated type)." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype->tp_alloc(subtype, nitems)`` to allocate space for the object, and then do only as much further initialization as is absolutely necessary. Initialization that can safely be ignored or repeated should be placed in the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that for immutable types, all initialization should take place in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." +#: ../../c-api/typeobj.rst:2227 +msgid "" +"The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" +">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " +"only as much further initialization as is absolutely necessary. " +"Initialization that can safely be ignored or repeated should be placed in " +"the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " +"for immutable types, all initialization should take place " +"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " +"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -msgid "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow creating instances of the type in Python." +#: ../../c-api/typeobj.rst:2235 +msgid "" +"Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " +"creating instances of the type in Python." msgstr "" -msgid "This field is inherited by subtypes, except it is not inherited by :ref:`static types ` whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or ``&PyBaseObject_Type``." +#: ../../c-api/typeobj.rst:2240 +msgid "" +"This field is inherited by subtypes, except it is not inherited " +"by :ref:`static types ` " +"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " +"``&PyBaseObject_Type``." msgstr "" -msgid "For :ref:`static types ` this field has no default. This means if the slot is defined as ``NULL``, the type cannot be called to create new instances; presumably there is some other way to create instances, like a factory function." +#: ../../c-api/typeobj.rst:2246 +msgid "" +"For :ref:`static types ` this field has no default. This means " +"if the slot is defined as ``NULL``, the type cannot be called to create new " +"instances; presumably there is some other way to create instances, like a " +"factory function." msgstr "" -msgid "An optional pointer to an instance deallocation function. Its signature is::" +#: ../../c-api/typeobj.rst:2256 +msgid "" +"An optional pointer to an instance deallocation function. Its signature is::" msgstr "" +#: ../../c-api/typeobj.rst:2258 msgid "void tp_free(void *self);" msgstr "" -msgid "This function must free the memory allocated by :c:member:`~PyTypeObject.tp_alloc`." +#: ../../c-api/typeobj.rst:2260 +msgid "" +"This function must free the memory allocated " +"by :c:member:`~PyTypeObject.tp_alloc`." msgstr "" -msgid "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if inherited from :class:`object`. Exception: If the type supports garbage collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`) and it would inherit :c:func:`PyObject_Free`, then this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." +#: ../../c-api/typeobj.rst:2265 +msgid "" +"Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " +"inherited from :class:`object`. Exception: If the type supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`) and it would " +"inherit :c:func:`PyObject_Free`, then this slot is not inherited but instead " +"defaults to :c:func:`PyObject_GC_Del`." msgstr "" -msgid "For :ref:`heap subtypes `, this slot defaults to a deallocator suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." +#: ../../c-api/typeobj.rst:2276 +msgid "" +"For :ref:`heap subtypes `, this slot defaults to a deallocator " +"suitable to match :c:func:`PyType_GenericAlloc` and the value of " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" +#: ../../c-api/typeobj.rst:2287 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -msgid "The garbage collector needs to know whether a particular object is collectible or not. Normally, it is sufficient to look at the object's type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically and dynamically allocated instances, and the statically allocated instances are not collectible. Such types should define this function; it should return ``1`` for a collectible instance, and ``0`` for a non-collectible instance. The signature is::" +#: ../../c-api/typeobj.rst:2289 +msgid "" +"The garbage collector needs to know whether a particular object is " +"collectible or not. Normally, it is sufficient to look at the object's " +"type's :c:member:`~PyTypeObject.tp_flags` field, and check " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " +"of statically and dynamically allocated instances, and the statically " +"allocated instances are not collectible. Such types should define this " +"function; it should return ``1`` for a collectible instance, and ``0`` for a " +"non-collectible instance. The signature is::" msgstr "" +#: ../../c-api/typeobj.rst:2297 msgid "int tp_is_gc(PyObject *self);" msgstr "" -msgid "(The only example of this are types themselves. The metatype, :c:data:`PyType_Type`, defines this function to distinguish between statically and :ref:`dynamically allocated types `.)" +#: ../../c-api/typeobj.rst:2299 +msgid "" +"(The only example of this are types themselves. The " +"metatype, :c:data:`PyType_Type`, defines this function to distinguish " +"between statically and :ref:`dynamically allocated types `.)" msgstr "" -msgid "This slot has no default. If this field is ``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +#: ../../c-api/typeobj.rst:2309 +msgid "" +"This slot has no default. If this field is " +"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" +#: ../../c-api/typeobj.rst:2317 msgid "Tuple of base types." msgstr "" -msgid "This field should be set to ``NULL`` and treated as read-only. Python will fill it in when the type is :c:func:`initialized `." +#: ../../c-api/typeobj.rst:2319 ../../c-api/typeobj.rst:2343 +msgid "" +"This field should be set to ``NULL`` and treated as read-only. Python will " +"fill it in when the type is :c:func:`initialized `." msgstr "" -msgid "For dynamically created classes, the :c:data:`Py_tp_bases` :c:type:`slot ` can be used instead of the *bases* argument of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." +#: ../../c-api/typeobj.rst:2322 +msgid "" +"For dynamically created classes, the :c:data:`Py_tp_bases` :c:type:`slot " +"` can be used instead of the *bases* argument " +"of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -msgid "Multiple inheritance does not work well for statically defined types. If you set ``tp_bases`` to a tuple, Python will not raise an error, but some slots will only be inherited from the first base." +#: ../../c-api/typeobj.rst:2329 +msgid "" +"Multiple inheritance does not work well for statically defined types. If you " +"set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " +"will only be inherited from the first base." msgstr "" +#: ../../c-api/typeobj.rst:2335 ../../c-api/typeobj.rst:2358 +#: ../../c-api/typeobj.rst:2375 ../../c-api/typeobj.rst:2392 +#: ../../c-api/typeobj.rst:2408 msgid "This field is not inherited." msgstr "" -msgid "Tuple containing the expanded set of base types, starting with the type itself and ending with :class:`object`, in Method Resolution Order." +#: ../../c-api/typeobj.rst:2340 +msgid "" +"Tuple containing the expanded set of base types, starting with the type " +"itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -msgid "This field is not inherited; it is calculated fresh by :c:func:`PyType_Ready`." +#: ../../c-api/typeobj.rst:2348 +msgid "" +"This field is not inherited; it is calculated fresh " +"by :c:func:`PyType_Ready`." msgstr "" +#: ../../c-api/typeobj.rst:2354 msgid "Unused. Internal use only." msgstr "" -msgid "A collection of subclasses. Internal use only. May be an invalid pointer." +#: ../../c-api/typeobj.rst:2363 +msgid "" +"A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -msgid "To get a list of subclasses, call the Python method :py:meth:`~type.__subclasses__`." +#: ../../c-api/typeobj.rst:2365 +msgid "" +"To get a list of subclasses, call the Python " +"method :py:meth:`~type.__subclasses__`." msgstr "" -msgid "For some types, this field does not hold a valid :c:expr:`PyObject*`. The type was changed to :c:expr:`void*` to indicate this." +#: ../../c-api/typeobj.rst:2370 +msgid "" +"For some types, this field does not hold a valid :c:expr:`PyObject*`. The " +"type was changed to :c:expr:`void*` to indicate this." msgstr "" -msgid "Weak reference list head, for weak references to this type object. Not inherited. Internal use only." +#: ../../c-api/typeobj.rst:2380 +msgid "" +"Weak reference list head, for weak references to this type object. Not " +"inherited. Internal use only." msgstr "" -msgid "Internals detail: For the static builtin types this is always ``NULL``, even if weakrefs are added. Instead, the weakrefs for each are stored on ``PyInterpreterState``. Use the public C-API or the internal ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." +#: ../../c-api/typeobj.rst:2385 +msgid "" +"Internals detail: For the static builtin types this is always ``NULL``, even " +"if weakrefs are added. Instead, the weakrefs for each are stored on " +"``PyInterpreterState``. Use the public C-API or the internal " +"``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -msgid "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." +#: ../../c-api/typeobj.rst:2399 +msgid "" +"This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" +#: ../../c-api/typeobj.rst:2404 msgid "Used to index into the method cache. Internal use only." msgstr "" -msgid "An optional pointer to an instance finalization function. This is the C implementation of the :meth:`~object.__del__` special method. Its signature is::" +#: ../../c-api/typeobj.rst:2415 +msgid "" +"An optional pointer to an instance finalization function. This is the C " +"implementation of the :meth:`~object.__del__` special method. Its signature " +"is::" msgstr "" +#: ../../c-api/typeobj.rst:2419 msgid "void tp_finalize(PyObject *self);" msgstr "" -msgid "The primary purpose of finalization is to perform any non-trivial cleanup that must be performed before the object is destroyed, while the object and any other objects it directly or indirectly references are still in a consistent state. The finalizer is allowed to execute arbitrary Python code." +#: ../../c-api/typeobj.rst:2421 +msgid "" +"The primary purpose of finalization is to perform any non-trivial cleanup " +"that must be performed before the object is destroyed, while the object and " +"any other objects it directly or indirectly references are still in a " +"consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" -msgid "Before Python automatically finalizes an object, some of the object's direct or indirect referents might have themselves been automatically finalized. However, none of the referents will have been automatically cleared (:c:member:`~PyTypeObject.tp_clear`) yet." +#: ../../c-api/typeobj.rst:2427 +msgid "" +"Before Python automatically finalizes an object, some of the object's direct " +"or indirect referents might have themselves been automatically finalized. " +"However, none of the referents will have been automatically cleared " +"(:c:member:`~PyTypeObject.tp_clear`) yet." msgstr "" -msgid "Other non-finalized objects might still be using a finalized object, so the finalizer must leave the object in a sane state (e.g., invariants are still met)." +#: ../../c-api/typeobj.rst:2432 +msgid "" +"Other non-finalized objects might still be using a finalized object, so the " +"finalizer must leave the object in a sane state (e.g., invariants are still " +"met)." msgstr "" -msgid "After Python automatically finalizes an object, Python might start automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and its referents (direct and indirect). Cleared objects are not guaranteed to be in a consistent state; a finalized object must be able to tolerate cleared referents." +#: ../../c-api/typeobj.rst:2438 +msgid "" +"After Python automatically finalizes an object, Python might start " +"automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " +"its referents (direct and indirect). Cleared objects are not guaranteed to " +"be in a consistent state; a finalized object must be able to tolerate " +"cleared referents." msgstr "" -msgid "An object is not guaranteed to be automatically finalized before its destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the beginning of :c:member:`!tp_dealloc` to guarantee that the object is always finalized before destruction." +#: ../../c-api/typeobj.rst:2446 +msgid "" +"An object is not guaranteed to be automatically finalized before its " +"destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " +"recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " +"beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " +"finalized before destruction." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_finalize` function can be called from any thread, although the :term:`GIL` will be held." +#: ../../c-api/typeobj.rst:2454 +msgid "" +"The :c:member:`~PyTypeObject.tp_finalize` function can be called from any " +"thread, although the :term:`GIL` will be held." msgstr "" -msgid "The :c:member:`!tp_finalize` function can be called during shutdown, after some global variables have been deleted. See the documentation of the :meth:`~object.__del__` method for details." +#: ../../c-api/typeobj.rst:2459 +msgid "" +"The :c:member:`!tp_finalize` function can be called during shutdown, after " +"some global variables have been deleted. See the documentation of " +"the :meth:`~object.__del__` method for details." msgstr "" -msgid "When Python finalizes an object, it behaves like the following algorithm:" +#: ../../c-api/typeobj.rst:2463 +msgid "" +"When Python finalizes an object, it behaves like the following algorithm:" msgstr "" -msgid "Python might mark the object as *finalized*. Currently, Python always marks objects whose type supports garbage collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`) and never marks other types of objects; this might change in a future version." +#: ../../c-api/typeobj.rst:2465 +msgid "" +"Python might mark the object as *finalized*. Currently, Python always marks " +"objects whose type supports garbage collection (i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set " +"in :c:member:`~PyTypeObject.tp_flags`) and never marks other types of " +"objects; this might change in a future version." msgstr "" -msgid "If the object is not marked as *finalized* and its :c:member:`!tp_finalize` finalizer function is non-``NULL``, the finalizer function is called." +#: ../../c-api/typeobj.rst:2470 +msgid "" +"If the object is not marked as *finalized* and its :c:member:`!tp_finalize` " +"finalizer function is non-``NULL``, the finalizer function is called." msgstr "" -msgid "If the finalizer function was called and the finalizer made the object reachable (i.e., there is a reference to the object and it is not a member of a :term:`cyclic isolate`), then the finalizer is said to have *resurrected* the object. It is unspecified whether the finalizer can also resurrect the object by adding a new reference to the object that does not make it reachable, i.e., the object is (still) a member of a cyclic isolate." +#: ../../c-api/typeobj.rst:2473 +msgid "" +"If the finalizer function was called and the finalizer made the object " +"reachable (i.e., there is a reference to the object and it is not a member " +"of a :term:`cyclic isolate`), then the finalizer is said to have " +"*resurrected* the object. It is unspecified whether the finalizer can also " +"resurrect the object by adding a new reference to the object that does not " +"make it reachable, i.e., the object is (still) a member of a cyclic isolate." msgstr "" -msgid "If the finalizer resurrected the object, the object's pending destruction is canceled and the object's *finalized* mark might be removed if present. Currently, Python never removes the *finalized* mark; this might change in a future version." +#: ../../c-api/typeobj.rst:2480 +msgid "" +"If the finalizer resurrected the object, the object's pending destruction is " +"canceled and the object's *finalized* mark might be removed if present. " +"Currently, Python never removes the *finalized* mark; this might change in a " +"future version." msgstr "" -msgid "*Automatic finalization* refers to any finalization performed by Python except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc`. No guarantees are made about when, if, or how often an object is automatically finalized, except:" +#: ../../c-api/typeobj.rst:2485 +msgid "" +"*Automatic finalization* refers to any finalization performed by Python " +"except via calls to :c:func:`PyObject_CallFinalizer` " +"or :c:func:`PyObject_CallFinalizerFromDealloc`. No guarantees are made " +"about when, if, or how often an object is automatically finalized, except:" msgstr "" -msgid "Python will not automatically finalize an object if it is reachable, i.e., there is a reference to it and it is not a member of a :term:`cyclic isolate`." +#: ../../c-api/typeobj.rst:2490 +msgid "" +"Python will not automatically finalize an object if it is reachable, i.e., " +"there is a reference to it and it is not a member of a :term:`cyclic " +"isolate`." msgstr "" -msgid "Python will not automatically finalize an object if finalizing it would not mark the object as *finalized*. Currently, this applies to objects whose type does not support garbage collection, i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still be manually finalized by calling :c:func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc`." +#: ../../c-api/typeobj.rst:2493 +msgid "" +"Python will not automatically finalize an object if finalizing it would not " +"mark the object as *finalized*. Currently, this applies to objects whose " +"type does not support garbage collection, i.e., " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still " +"be manually finalized by calling :c:func:`PyObject_CallFinalizer` " +"or :c:func:`PyObject_CallFinalizerFromDealloc`." msgstr "" -msgid "Python will not automatically finalize any two members of a :term:`cyclic isolate` concurrently." +#: ../../c-api/typeobj.rst:2499 +msgid "" +"Python will not automatically finalize any two members of a :term:`cyclic " +"isolate` concurrently." msgstr "" -msgid "Python will not automatically finalize an object after it has automatically cleared (:c:member:`~PyTypeObject.tp_clear`) the object." +#: ../../c-api/typeobj.rst:2501 +msgid "" +"Python will not automatically finalize an object after it has automatically " +"cleared (:c:member:`~PyTypeObject.tp_clear`) the object." msgstr "" -msgid "If an object is a member of a :term:`cyclic isolate`, Python will not automatically finalize it after automatically clearing (see :c:member:`~PyTypeObject.tp_clear`) any other member." +#: ../../c-api/typeobj.rst:2503 +msgid "" +"If an object is a member of a :term:`cyclic isolate`, Python will not " +"automatically finalize it after automatically clearing " +"(see :c:member:`~PyTypeObject.tp_clear`) any other member." msgstr "" -msgid "Python will automatically finalize every member of a :term:`cyclic isolate` before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any of them." +#: ../../c-api/typeobj.rst:2506 +msgid "" +"Python will automatically finalize every member of a :term:`cyclic isolate` " +"before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " +"of them." msgstr "" -msgid "If Python is going to automatically clear an object (:c:member:`~PyTypeObject.tp_clear`), it will automatically finalize the object first." +#: ../../c-api/typeobj.rst:2509 +msgid "" +"If Python is going to automatically clear an object " +"(:c:member:`~PyTypeObject.tp_clear`), it will automatically finalize the " +"object first." msgstr "" -msgid "Python currently only automatically finalizes objects that are members of a :term:`cyclic isolate`, but future versions might finalize objects regularly before their destruction." +#: ../../c-api/typeobj.rst:2513 +msgid "" +"Python currently only automatically finalizes objects that are members of " +"a :term:`cyclic isolate`, but future versions might finalize objects " +"regularly before their destruction." msgstr "" -msgid "To manually finalize an object, do not call this function directly; call :c:func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` instead." +#: ../../c-api/typeobj.rst:2517 +msgid "" +"To manually finalize an object, do not call this function directly; " +"call :c:func:`PyObject_CallFinalizer` " +"or :c:func:`PyObject_CallFinalizerFromDealloc` instead." msgstr "" -msgid ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception status unchanged. The recommended way to write a non-trivial finalizer is to back up the exception at the beginning by calling :c:func:`PyErr_GetRaisedException` and restore the exception at the end by calling :c:func:`PyErr_SetRaisedException`. If an exception is encountered in the middle of the finalizer, log and clear it with :c:func:`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" +#: ../../c-api/typeobj.rst:2521 +msgid "" +":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " +"status unchanged. The recommended way to write a non-trivial finalizer is " +"to back up the exception at the beginning by " +"calling :c:func:`PyErr_GetRaisedException` and restore the exception at the " +"end by calling :c:func:`PyErr_SetRaisedException`. If an exception is " +"encountered in the middle of the finalizer, log and clear it " +"with :c:func:`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. " +"For example::" msgstr "" +#: ../../c-api/typeobj.rst:2530 msgid "" "static void\n" "foo_finalize(PyObject *self)\n" @@ -2128,90 +3854,165 @@ msgid "" "}" msgstr "" -msgid "Before version 3.8 it was necessary to set the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. This is no longer required." +#: ../../c-api/typeobj.rst:2558 +msgid "" +"Before version 3.8 it was necessary to set " +"the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to " +"be used. This is no longer required." msgstr "" +#: ../../c-api/typeobj.rst:2564 msgid ":pep:`442`: \"Safe object finalization\"" msgstr "" +#: ../../c-api/typeobj.rst:2567 msgid ":c:func:`PyObject_CallFinalizer`" msgstr "" +#: ../../c-api/typeobj.rst:2568 msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" msgstr "" -msgid "A :ref:`vectorcall function ` to use for calls of this type object (rather than instances). In other words, ``tp_vectorcall`` can be used to optimize ``type.__call__``, which typically returns a new instance of *type*." +#: ../../c-api/typeobj.rst:2575 +msgid "" +"A :ref:`vectorcall function ` to use for calls of this type " +"object (rather than instances). In other words, ``tp_vectorcall`` can be " +"used to optimize ``type.__call__``, which typically returns a new instance " +"of *type*." msgstr "" -msgid "As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the *tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." +#: ../../c-api/typeobj.rst:2580 +msgid "" +"As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " +"*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." msgstr "" -msgid "The :ref:`vectorcall protocol ` requires that the vectorcall function has the same behavior as the corresponding ``tp_call``. This means that ``type->tp_vectorcall`` must match the behavior of ``Py_TYPE(type)->tp_call``." +#: ../../c-api/typeobj.rst:2585 +msgid "" +"The :ref:`vectorcall protocol ` requires that the vectorcall " +"function has the same behavior as the corresponding ``tp_call``. This means " +"that ``type->tp_vectorcall`` must match the behavior of ``Py_TYPE(type)-" +">tp_call``." msgstr "" -msgid "Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` must behave the same as :c:expr:`PyType_Type->tp_call`, which:" +#: ../../c-api/typeobj.rst:2590 +msgid "" +"Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` " +"must behave the same as :c:expr:`PyType_Type->tp_call`, which:" msgstr "" +#: ../../c-api/typeobj.rst:2594 msgid "calls ``type->tp_new``," msgstr "" -msgid "if the result is a subclass of *type*, calls ``type->tp_init`` on the result of ``tp_new``, and" +#: ../../c-api/typeobj.rst:2596 +msgid "" +"if the result is a subclass of *type*, calls ``type->tp_init`` on the result " +"of ``tp_new``, and" msgstr "" +#: ../../c-api/typeobj.rst:2599 msgid "returns the result of ``tp_new``." msgstr "" -msgid "Typically, ``tp_vectorcall`` is overridden to optimize this process for specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_init`. When doing this for user-subclassable types, note that both can be overridden (using :py:func:`~object.__new__` and :py:func:`~object.__init__`, respectively)." +#: ../../c-api/typeobj.rst:2601 +msgid "" +"Typically, ``tp_vectorcall`` is overridden to optimize this process for " +"specific :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_init`. When doing this for user-subclassable " +"types, note that both can be overridden (using :py:func:`~object.__new__` " +"and :py:func:`~object.__init__`, respectively)." msgstr "" +#: ../../c-api/typeobj.rst:2612 msgid "This field is never inherited." msgstr "" +#: ../../c-api/typeobj.rst:2614 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" +#: ../../c-api/typeobj.rst:2619 msgid "Internal. Do not use." msgstr "" +#: ../../c-api/typeobj.rst:2627 msgid "Static Types" msgstr "" -msgid "Traditionally, types defined in C code are *static*, that is, a static :c:type:`PyTypeObject` structure is defined directly in code and initialized using :c:func:`PyType_Ready`." +#: ../../c-api/typeobj.rst:2629 +msgid "" +"Traditionally, types defined in C code are *static*, that is, a " +"static :c:type:`PyTypeObject` structure is defined directly in code and " +"initialized using :c:func:`PyType_Ready`." msgstr "" -msgid "This results in types that are limited relative to types defined in Python:" +#: ../../c-api/typeobj.rst:2633 +msgid "" +"This results in types that are limited relative to types defined in Python:" msgstr "" -msgid "Static types are limited to one base, i.e. they cannot use multiple inheritance." +#: ../../c-api/typeobj.rst:2635 +msgid "" +"Static types are limited to one base, i.e. they cannot use multiple " +"inheritance." msgstr "" -msgid "Static type objects (but not necessarily their instances) are immutable. It is not possible to add or modify the type object's attributes from Python." +#: ../../c-api/typeobj.rst:2637 +msgid "" +"Static type objects (but not necessarily their instances) are immutable. It " +"is not possible to add or modify the type object's attributes from Python." msgstr "" -msgid "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-specific state." +#: ../../c-api/typeobj.rst:2639 +msgid "" +"Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" +"specific state." msgstr "" -msgid "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API ` as an opaque struct, any extension modules using static types must be compiled for a specific Python minor version." +#: ../../c-api/typeobj.rst:2643 +msgid "" +"Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " +"` as an opaque struct, any extension modules using static " +"types must be compiled for a specific Python minor version." msgstr "" +#: ../../c-api/typeobj.rst:2651 msgid "Heap Types" msgstr "" -msgid "An alternative to :ref:`static types ` is *heap-allocated types*, or *heap types* for short, which correspond closely to classes created by Python's ``class`` statement. Heap types have the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." +#: ../../c-api/typeobj.rst:2653 +msgid "" +"An alternative to :ref:`static types ` is *heap-allocated " +"types*, or *heap types* for short, which correspond closely to classes " +"created by Python's ``class`` statement. Heap types have " +"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -msgid "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." +#: ../../c-api/typeobj.rst:2658 +msgid "" +"This is done by filling a :c:type:`PyType_Spec` structure and " +"calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, " +"or :c:func:`PyType_FromMetaclass`." msgstr "" +#: ../../c-api/typeobj.rst:2666 msgid "Number Object Structures" msgstr "" -msgid "This structure holds pointers to the functions which an object uses to implement the number protocol. Each function is used by the function of similar name documented in the :ref:`number` section." +#: ../../c-api/typeobj.rst:2673 +msgid "" +"This structure holds pointers to the functions which an object uses to " +"implement the number protocol. Each function is used by the function of " +"similar name documented in the :ref:`number` section." msgstr "" +#: ../../c-api/typeobj.rst:2679 ../../c-api/typeobj.rst:3163 msgid "Here is the structure definition::" msgstr "" +#: ../../c-api/typeobj.rst:2681 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -2257,168 +4058,344 @@ msgid "" "} PyNumberMethods;" msgstr "" -msgid "Binary and ternary functions must check the type of all their operands, and implement the necessary conversions (at least one of the operands is an instance of the defined type). If the operation is not defined for the given operands, binary and ternary functions must return ``Py_NotImplemented``, if another error occurred they must return ``NULL`` and set an exception." +#: ../../c-api/typeobj.rst:2726 +msgid "" +"Binary and ternary functions must check the type of all their operands, and " +"implement the necessary conversions (at least one of the operands is an " +"instance of the defined type). If the operation is not defined for the " +"given operands, binary and ternary functions must return " +"``Py_NotImplemented``, if another error occurred they must return ``NULL`` " +"and set an exception." msgstr "" -msgid "The :c:member:`~PyNumberMethods.nb_reserved` field should always be ``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in Python 3.0.1." +#: ../../c-api/typeobj.rst:2735 +msgid "" +"The :c:member:`~PyNumberMethods.nb_reserved` field should always be " +"``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " +"Python 3.0.1." msgstr "" +#: ../../c-api/typeobj.rst:2886 msgid "Mapping Object Structures" msgstr "" -msgid "This structure holds pointers to the functions which an object uses to implement the mapping protocol. It has three members:" +#: ../../c-api/typeobj.rst:2893 +msgid "" +"This structure holds pointers to the functions which an object uses to " +"implement the mapping protocol. It has three members:" msgstr "" -msgid "This function is used by :c:func:`PyMapping_Size` and :c:func:`PyObject_Size`, and has the same signature. This slot may be set to ``NULL`` if the object has no defined length." +#: ../../c-api/typeobj.rst:2900 +msgid "" +"This function is used by :c:func:`PyMapping_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " +"set to ``NULL`` if the object has no defined length." msgstr "" -msgid "This function is used by :c:func:`PyObject_GetItem` and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!PyObject_GetItem`. This slot must be filled for the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." +#: ../../c-api/typeobj.rst:2908 +msgid "" +"This function is used by :c:func:`PyObject_GetItem` " +"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for " +"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " +"otherwise." msgstr "" -msgid "This function is used by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. If this slot is ``NULL``, the object does not support item assignment and deletion." +#: ../../c-api/typeobj.rst:2918 +msgid "" +"This function is used " +"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " +"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " +"If this slot is ``NULL``, the object does not support item assignment and " +"deletion." msgstr "" +#: ../../c-api/typeobj.rst:2929 msgid "Sequence Object Structures" msgstr "" -msgid "This structure holds pointers to the functions which an object uses to implement the sequence protocol." +#: ../../c-api/typeobj.rst:2936 +msgid "" +"This structure holds pointers to the functions which an object uses to " +"implement the sequence protocol." msgstr "" -msgid "This function is used by :c:func:`PySequence_Size` and :c:func:`PyObject_Size`, and has the same signature. It is also used for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:member:`~PySequenceMethods.sq_ass_item` slots." +#: ../../c-api/typeobj.rst:2943 +msgid "" +"This function is used by :c:func:`PySequence_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. It is also used " +"for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` " +"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -msgid "This function is used by :c:func:`PySequence_Concat` and has the same signature. It is also used by the ``+`` operator, after trying the numeric addition via the :c:member:`~PyNumberMethods.nb_add` slot." +#: ../../c-api/typeobj.rst:2952 +msgid "" +"This function is used by :c:func:`PySequence_Concat` and has the same " +"signature. It is also used by the ``+`` operator, after trying the numeric " +"addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -msgid "This function is used by :c:func:`PySequence_Repeat` and has the same signature. It is also used by the ``*`` operator, after trying numeric multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." +#: ../../c-api/typeobj.rst:2960 +msgid "" +"This function is used by :c:func:`PySequence_Repeat` and has the same " +"signature. It is also used by the ``*`` operator, after trying numeric " +"multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -msgid "This function is used by :c:func:`PySequence_GetItem` and has the same signature. It is also used by :c:func:`PyObject_GetItem`, after trying the subscription via the :c:member:`~PyMappingMethods.mp_subscript` slot. This slot must be filled for the :c:func:`PySequence_Check` function to return ``1``, it can be ``NULL`` otherwise." +#: ../../c-api/typeobj.rst:2968 +msgid "" +"This function is used by :c:func:`PySequence_GetItem` and has the same " +"signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " +"subscription via the :c:member:`~PyMappingMethods.mp_subscript` slot. This " +"slot must be filled for the :c:func:`PySequence_Check` function to return " +"``1``, it can be ``NULL`` otherwise." msgstr "" -msgid "Negative indexes are handled as follows: if the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence length is used to compute a positive index which is passed to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the index is passed as is to the function." +#: ../../c-api/typeobj.rst:2974 +msgid "" +"Negative indexes are handled as follows: if " +"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " +"and the sequence length is used to compute a positive index which is passed " +"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " +"``NULL``, the index is passed as is to the function." msgstr "" -msgid "This function is used by :c:func:`PySequence_SetItem` and has the same signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:`PyObject_DelItem`, after trying the item assignment and deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to ``NULL`` if the object does not support item assignment and deletion." +#: ../../c-api/typeobj.rst:2983 +msgid "" +"This function is used by :c:func:`PySequence_SetItem` and has the same " +"signature. It is also used by :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`, after trying the item assignment and " +"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " +"slot may be left to ``NULL`` if the object does not support item assignment " +"and deletion." msgstr "" -msgid "This function may be used by :c:func:`PySequence_Contains` and has the same signature. This slot may be left to ``NULL``, in this case :c:func:`!PySequence_Contains` simply traverses the sequence until it finds a match." +#: ../../c-api/typeobj.rst:2994 +msgid "" +"This function may be used by :c:func:`PySequence_Contains` and has the same " +"signature. This slot may be left to ``NULL``, in this case :c:func:`!" +"PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -msgid "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same signature. It should modify its first operand, and return it. This slot may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` will fall back to :c:func:`PySequence_Concat`. It is also used by the augmented assignment ``+=``, after trying numeric in-place addition via the :c:member:`~PyNumberMethods.nb_inplace_add` slot." +#: ../../c-api/typeobj.rst:3003 +msgid "" +"This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " +"signature. It should modify its first operand, and return it. This slot " +"may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " +"will fall back to :c:func:`PySequence_Concat`. It is also used by the " +"augmented assignment ``+=``, after trying numeric in-place addition via " +"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -msgid "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same signature. It should modify its first operand, and return it. This slot may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceRepeat` will fall back to :c:func:`PySequence_Repeat`. It is also used by the augmented assignment ``*=``, after trying numeric in-place multiplication via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." +#: ../../c-api/typeobj.rst:3014 +msgid "" +"This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " +"signature. It should modify its first operand, and return it. This slot " +"may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceRepeat` " +"will fall back to :c:func:`PySequence_Repeat`. It is also used by the " +"augmented assignment ``*=``, after trying numeric in-place multiplication " +"via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" +#: ../../c-api/typeobj.rst:3025 msgid "Buffer Object Structures" msgstr "" -msgid "This structure holds pointers to the functions required by the :ref:`Buffer protocol `. The protocol defines how an exporter object can expose its internal data to consumer objects." +#: ../../c-api/typeobj.rst:3033 +msgid "" +"This structure holds pointers to the functions required by the :ref:`Buffer " +"protocol `. The protocol defines how an exporter object can " +"expose its internal data to consumer objects." msgstr "" +#: ../../c-api/typeobj.rst:3041 ../../c-api/typeobj.rst:3110 +#: ../../c-api/typeobj.rst:3176 ../../c-api/typeobj.rst:3189 +#: ../../c-api/typeobj.rst:3203 ../../c-api/typeobj.rst:3215 msgid "The signature of this function is::" msgstr "" +#: ../../c-api/typeobj.rst:3043 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "" -msgid "Handle a request to *exporter* to fill in *view* as specified by *flags*. Except for point (3), an implementation of this function MUST take these steps:" +#: ../../c-api/typeobj.rst:3045 +msgid "" +"Handle a request to *exporter* to fill in *view* as specified by *flags*. " +"Except for point (3), an implementation of this function MUST take these " +"steps:" msgstr "" -msgid "Check if the request can be met. If not, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." +#: ../../c-api/typeobj.rst:3049 +msgid "" +"Check if the request can be met. If not, raise :exc:`BufferError`, set " +"``view->obj`` to ``NULL`` and return ``-1``." msgstr "" +#: ../../c-api/typeobj.rst:3052 msgid "Fill in the requested fields." msgstr "" +#: ../../c-api/typeobj.rst:3054 msgid "Increment an internal counter for the number of exports." msgstr "" +#: ../../c-api/typeobj.rst:3056 msgid "Set ``view->obj`` to *exporter* and increment ``view->obj``." msgstr "" +#: ../../c-api/typeobj.rst:3058 msgid "Return ``0``." msgstr "" +#: ../../c-api/typeobj.rst:3060 ../../c-api/typeobj.rst:3123 msgid "**Thread safety:**" msgstr "" +#: ../../c-api/typeobj.rst:3062 msgid "In the :term:`free-threaded build`, implementations must ensure:" msgstr "" +#: ../../c-api/typeobj.rst:3064 msgid "The export counter increment in step (3) is atomic." msgstr "" -msgid "The underlying buffer data remains valid and at a stable memory location for the lifetime of all exports." +#: ../../c-api/typeobj.rst:3066 +msgid "" +"The underlying buffer data remains valid and at a stable memory location for " +"the lifetime of all exports." msgstr "" -msgid "For objects that support resizing or reallocation (such as :class:`bytearray`), the export counter is checked atomically before such operations, and :exc:`BufferError` is raised if exports exist." +#: ../../c-api/typeobj.rst:3069 +msgid "" +"For objects that support resizing or reallocation (such " +"as :class:`bytearray`), the export counter is checked atomically before such " +"operations, and :exc:`BufferError` is raised if exports exist." msgstr "" +#: ../../c-api/typeobj.rst:3073 msgid "The function is safe to call concurrently from multiple threads." msgstr "" -msgid "See also :ref:`thread-safety-memoryview` for the Python-level thread safety guarantees of :class:`memoryview` objects." +#: ../../c-api/typeobj.rst:3075 +msgid "" +"See also :ref:`thread-safety-memoryview` for the Python-level thread safety " +"guarantees of :class:`memoryview` objects." msgstr "" -msgid "If *exporter* is part of a chain or tree of buffer providers, two main schemes can be used:" +#: ../../c-api/typeobj.rst:3078 +msgid "" +"If *exporter* is part of a chain or tree of buffer providers, two main " +"schemes can be used:" msgstr "" -msgid "Re-export: Each member of the tree acts as the exporting object and sets ``view->obj`` to a new reference to itself." +#: ../../c-api/typeobj.rst:3081 +msgid "" +"Re-export: Each member of the tree acts as the exporting object and sets " +"``view->obj`` to a new reference to itself." msgstr "" -msgid "Redirect: The buffer request is redirected to the root object of the tree. Here, ``view->obj`` will be a new reference to the root object." +#: ../../c-api/typeobj.rst:3084 +msgid "" +"Redirect: The buffer request is redirected to the root object of the tree. " +"Here, ``view->obj`` will be a new reference to the root object." msgstr "" -msgid "The individual fields of *view* are described in section :ref:`Buffer structure `, the rules how an exporter must react to specific requests are in section :ref:`Buffer request types `." +#: ../../c-api/typeobj.rst:3088 +msgid "" +"The individual fields of *view* are described in section :ref:`Buffer " +"structure `, the rules how an exporter must react to " +"specific requests are in section :ref:`Buffer request types `." msgstr "" -msgid "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the exporter and must remain valid until there are no consumers left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer.internal` are read-only for the consumer." +#: ../../c-api/typeobj.rst:3093 +msgid "" +"All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " +"exporter and must remain valid until there are no consumers " +"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " +"and :c:member:`~Py_buffer.internal` are read-only for the consumer." msgstr "" -msgid ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes buffer while dealing correctly with all request types." +#: ../../c-api/typeobj.rst:3100 +msgid "" +":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " +"buffer while dealing correctly with all request types." msgstr "" -msgid ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps this function." +#: ../../c-api/typeobj.rst:3103 +msgid "" +":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " +"this function." msgstr "" +#: ../../c-api/typeobj.rst:3112 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "" -msgid "Handle a request to release the resources of the buffer. If no resources need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be ``NULL``. Otherwise, a standard implementation of this function will take these optional steps:" +#: ../../c-api/typeobj.rst:3114 +msgid "" +"Handle a request to release the resources of the buffer. If no resources " +"need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " +"``NULL``. Otherwise, a standard implementation of this function will take " +"these optional steps:" msgstr "" +#: ../../c-api/typeobj.rst:3119 msgid "Decrement an internal counter for the number of exports." msgstr "" +#: ../../c-api/typeobj.rst:3121 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" +#: ../../c-api/typeobj.rst:3125 msgid "In the :term:`free-threaded build`:" msgstr "" +#: ../../c-api/typeobj.rst:3127 msgid "The export counter decrement in step (1) must be atomic." msgstr "" -msgid "Resource cleanup when the counter reaches zero must be done atomically, as the final release may race with concurrent releases from other threads and dellocation must only happen once." +#: ../../c-api/typeobj.rst:3129 +msgid "" +"Resource cleanup when the counter reaches zero must be done atomically, as " +"the final release may race with concurrent releases from other threads and " +"deallocation must only happen once." msgstr "" -msgid "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep track of buffer-specific resources. This field is guaranteed to remain constant, while a consumer MAY pass a copy of the original buffer as the *view* argument." +#: ../../c-api/typeobj.rst:3133 +msgid "" +"The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " +"track of buffer-specific resources. This field is guaranteed to remain " +"constant, while a consumer MAY pass a copy of the original buffer as the " +"*view* argument." msgstr "" -msgid "This function MUST NOT decrement ``view->obj``, since that is done automatically in :c:func:`PyBuffer_Release` (this scheme is useful for breaking reference cycles)." +#: ../../c-api/typeobj.rst:3139 +msgid "" +"This function MUST NOT decrement ``view->obj``, since that is done " +"automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " +"breaking reference cycles)." msgstr "" -msgid ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this function." +#: ../../c-api/typeobj.rst:3144 +msgid "" +":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " +"function." msgstr "" +#: ../../c-api/typeobj.rst:3152 msgid "Async Object Structures" msgstr "" -msgid "This structure holds pointers to the functions required to implement :term:`awaitable` and :term:`asynchronous iterator` objects." +#: ../../c-api/typeobj.rst:3160 +msgid "" +"This structure holds pointers to the functions required to " +"implement :term:`awaitable` and :term:`asynchronous iterator` objects." msgstr "" +#: ../../c-api/typeobj.rst:3165 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -2428,99 +4405,161 @@ msgid "" "} PyAsyncMethods;" msgstr "" +#: ../../c-api/typeobj.rst:3178 msgid "PyObject *am_await(PyObject *self);" msgstr "" -msgid "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` must return ``1`` for it." +#: ../../c-api/typeobj.rst:3180 +msgid "" +"The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " +"must return ``1`` for it." msgstr "" -msgid "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." +#: ../../c-api/typeobj.rst:3183 +msgid "" +"This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" +#: ../../c-api/typeobj.rst:3191 msgid "PyObject *am_aiter(PyObject *self);" msgstr "" -msgid "Must return an :term:`asynchronous iterator` object. See :meth:`~object.__anext__` for details." +#: ../../c-api/typeobj.rst:3193 +msgid "" +"Must return an :term:`asynchronous iterator` object. " +"See :meth:`~object.__anext__` for details." msgstr "" -msgid "This slot may be set to ``NULL`` if an object does not implement asynchronous iteration protocol." +#: ../../c-api/typeobj.rst:3196 +msgid "" +"This slot may be set to ``NULL`` if an object does not implement " +"asynchronous iteration protocol." msgstr "" +#: ../../c-api/typeobj.rst:3205 msgid "PyObject *am_anext(PyObject *self);" msgstr "" -msgid "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for details. This slot may be set to ``NULL``." +#: ../../c-api/typeobj.rst:3207 +msgid "" +"Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " +"details. This slot may be set to ``NULL``." msgstr "" +#: ../../c-api/typeobj.rst:3217 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" -msgid "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." +#: ../../c-api/typeobj.rst:3219 +msgid "" +"See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" +#: ../../c-api/typeobj.rst:3228 msgid "Slot Type typedefs" msgstr "" -msgid "The purpose of this function is to separate memory allocation from memory initialization. It should return a pointer to a block of memory of adequate length for the instance, suitably aligned, and initialized to zeros, but with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject.ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` field should be initialized to *nitems* and the length of the allocated memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." -msgstr "" - -msgid "This function should not do any other instance initialization, not even to allocate additional memory; that should be done by :c:member:`~PyTypeObject.tp_new`." +#: ../../c-api/typeobj.rst:3232 +msgid "" +"The purpose of this function is to separate memory allocation from memory " +"initialization. It should return a pointer to a block of memory of adequate " +"length for the instance, suitably aligned, and initialized to zeros, but " +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " +"and :c:member:`~PyObject.ob_type` set to the type argument. If the " +"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " +"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " +"*nitems* and the length of the allocated memory block should be " +"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " +"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " +"block should be :c:member:`~PyTypeObject.tp_basicsize`." +msgstr "" + +#: ../../c-api/typeobj.rst:3242 +msgid "" +"This function should not do any other instance initialization, not even to " +"allocate additional memory; that should be done " +"by :c:member:`~PyTypeObject.tp_new`." msgstr "" +#: ../../c-api/typeobj.rst:3249 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "" +#: ../../c-api/typeobj.rst:3253 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "" +#: ../../c-api/typeobj.rst:3257 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "" +#: ../../c-api/typeobj.rst:3261 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "" +#: ../../c-api/typeobj.rst:3265 ../../c-api/typeobj.rst:3274 msgid "Return the value of the named attribute for the object." msgstr "" -msgid "Set the value of the named attribute for the object. The value argument is set to ``NULL`` to delete the attribute." +#: ../../c-api/typeobj.rst:3269 ../../c-api/typeobj.rst:3280 +msgid "" +"Set the value of the named attribute for the object. The value argument is " +"set to ``NULL`` to delete the attribute." msgstr "" +#: ../../c-api/typeobj.rst:3276 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "" +#: ../../c-api/typeobj.rst:3283 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "" +#: ../../c-api/typeobj.rst:3287 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "" +#: ../../c-api/typeobj.rst:3291 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "" +#: ../../c-api/typeobj.rst:3295 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "" +#: ../../c-api/typeobj.rst:3299 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "" +#: ../../c-api/typeobj.rst:3303 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "" +#: ../../c-api/typeobj.rst:3307 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "" +#: ../../c-api/typeobj.rst:3321 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "" +#: ../../c-api/typeobj.rst:3337 msgid "Examples" msgstr "" -msgid "The following are simple examples of Python type definitions. They include common usage you may encounter. Some demonstrate tricky corner cases. For more examples, practical info, and a tutorial, see :ref:`defining-new-types` and :ref:`new-types-topics`." +#: ../../c-api/typeobj.rst:3339 +msgid "" +"The following are simple examples of Python type definitions. They include " +"common usage you may encounter. Some demonstrate tricky corner cases. For " +"more examples, practical info, and a tutorial, see :ref:`defining-new-types` " +"and :ref:`new-types-topics`." msgstr "" +#: ../../c-api/typeobj.rst:3344 msgid "A basic :ref:`static type `::" msgstr "" +#: ../../c-api/typeobj.rst:3346 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -2538,9 +4577,13 @@ msgid "" "};" msgstr "" -msgid "You may also find older code (especially in the CPython code base) with a more verbose initializer::" +#: ../../c-api/typeobj.rst:3361 +msgid "" +"You may also find older code (especially in the CPython code base) with a " +"more verbose initializer::" msgstr "" +#: ../../c-api/typeobj.rst:3364 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -2584,9 +4627,11 @@ msgid "" "};" msgstr "" +#: ../../c-api/typeobj.rst:3405 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" +#: ../../c-api/typeobj.rst:3407 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -2612,9 +4657,14 @@ msgid "" "};" msgstr "" -msgid "A str subclass that cannot be subclassed and cannot be called to create instances (e.g. uses a separate factory func) using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" +#: ../../c-api/typeobj.rst:3430 +msgid "" +"A str subclass that cannot be subclassed and cannot be called to create " +"instances (e.g. uses a separate factory func) " +"using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" +#: ../../c-api/typeobj.rst:3434 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -2632,9 +4682,12 @@ msgid "" "};" msgstr "" -msgid "The simplest :ref:`static type ` with fixed-length instances::" +#: ../../c-api/typeobj.rst:3449 +msgid "" +"The simplest :ref:`static type ` with fixed-length instances::" msgstr "" +#: ../../c-api/typeobj.rst:3451 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -2646,9 +4699,13 @@ msgid "" "};" msgstr "" -msgid "The simplest :ref:`static type ` with variable-length instances::" +#: ../../c-api/typeobj.rst:3460 +msgid "" +"The simplest :ref:`static type ` with variable-length " +"instances::" msgstr "" +#: ../../c-api/typeobj.rst:3462 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -2663,11 +4720,14 @@ msgid "" "};" msgstr "" +#: ../../c-api/typeobj.rst:920 ../../c-api/typeobj.rst:987 msgid "built-in function" msgstr "" +#: ../../c-api/typeobj.rst:920 msgid "repr" msgstr "" +#: ../../c-api/typeobj.rst:987 msgid "hash" msgstr "" diff --git a/c-api/unicode.po b/c-api/unicode.po index a0826fb39..af53c4377 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,1247 +24,2353 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/unicode.rst:6 msgid "Unicode Objects and Codecs" msgstr "" +#: ../../c-api/unicode.rst:12 msgid "Unicode Objects" msgstr "" -msgid "Since the implementation of :pep:`393` in Python 3.3, Unicode objects internally use a variety of representations, in order to allow handling the complete range of Unicode characters while staying memory efficient. There are special cases for strings where all code points are below 128, 256, or 65536; otherwise, code points must be below 1114112 (which is the full Unicode range)." +#: ../../c-api/unicode.rst:14 +msgid "" +"Since the implementation of :pep:`393` in Python 3.3, Unicode objects " +"internally use a variety of representations, in order to allow handling the " +"complete range of Unicode characters while staying memory efficient. There " +"are special cases for strings where all code points are below 128, 256, or " +"65536; otherwise, code points must be below 1114112 (which is the full " +"Unicode range)." msgstr "" -msgid "UTF-8 representation is created on demand and cached in the Unicode object." +#: ../../c-api/unicode.rst:20 +msgid "" +"UTF-8 representation is created on demand and cached in the Unicode object." msgstr "" -msgid "The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 with deprecated APIs. See :pep:`623` for more information." +#: ../../c-api/unicode.rst:23 +msgid "" +"The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 " +"with deprecated APIs. See :pep:`623` for more information." msgstr "" +#: ../../c-api/unicode.rst:29 msgid "Unicode Type" msgstr "" -msgid "These are the basic Unicode object types used for the Unicode implementation in Python:" +#: ../../c-api/unicode.rst:31 +msgid "" +"These are the basic Unicode object types used for the Unicode implementation " +"in Python:" msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python Unicode type. It is exposed to Python code as :py:class:`str`." +#: ../../c-api/unicode.rst:36 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " +"It is exposed to Python code as :py:class:`str`." msgstr "" -msgid "This instance of :c:type:`PyTypeObject` represents the Python Unicode iterator type. It is used to iterate over Unicode string objects." +#: ../../c-api/unicode.rst:42 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python Unicode " +"iterator type. It is used to iterate over Unicode string objects." msgstr "" -msgid "These types are typedefs for unsigned integer types wide enough to contain characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with single Unicode characters, use :c:type:`Py_UCS4`." +#: ../../c-api/unicode.rst:50 +msgid "" +"These types are typedefs for unsigned integer types wide enough to contain " +"characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with " +"single Unicode characters, use :c:type:`Py_UCS4`." msgstr "" -msgid "These subtypes of :c:type:`PyObject` represent a Python Unicode object. In almost all cases, they shouldn't be used directly, since all API functions that deal with Unicode objects take and return :c:type:`PyObject` pointers." +#: ../../c-api/unicode.rst:61 +msgid "" +"These subtypes of :c:type:`PyObject` represent a Python Unicode object. In " +"almost all cases, they shouldn't be used directly, since all API functions " +"that deal with Unicode objects take and return :c:type:`PyObject` pointers." msgstr "" -msgid "The structure of a particular object can be determined using the following macros. The macros cannot fail; their behavior is undefined if their argument is not a Python Unicode object." +#: ../../c-api/unicode.rst:68 +msgid "" +"The structure of a particular object can be determined using the following " +"macros. The macros cannot fail; their behavior is undefined if their " +"argument is not a Python Unicode object." msgstr "" +#: ../../c-api/unicode.rst:77 msgid "True if *o* uses the :c:struct:`PyCompactUnicodeObject` structure." msgstr "" +#: ../../c-api/unicode.rst:84 msgid "True if *o* uses the :c:struct:`PyASCIIObject` structure." msgstr "" -msgid "The following APIs are C macros and static inlined functions for fast checks and access to internal read-only data of Unicode objects:" +#: ../../c-api/unicode.rst:89 +msgid "" +"The following APIs are C macros and static inlined functions for fast checks " +"and access to internal read-only data of Unicode objects:" msgstr "" -msgid "Return true if the object *obj* is a Unicode object or an instance of a Unicode subtype. This function always succeeds." +#: ../../c-api/unicode.rst:94 +msgid "" +"Return true if the object *obj* is a Unicode object or an instance of a " +"Unicode subtype. This function always succeeds." msgstr "" -msgid "Return true if the object *obj* is a Unicode object, but not an instance of a subtype. This function always succeeds." +#: ../../c-api/unicode.rst:100 +msgid "" +"Return true if the object *obj* is a Unicode object, but not an instance of " +"a subtype. This function always succeeds." msgstr "" -msgid "Return the length of the Unicode string, in code points. *unicode* has to be a Unicode object in the \"canonical\" representation (not checked)." +#: ../../c-api/unicode.rst:106 +msgid "" +"Return the length of the Unicode string, in code points. *unicode* has to " +"be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -msgid "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 integer types for direct character access. No checks are performed if the canonical representation has the correct character size; use :c:func:`PyUnicode_KIND` to select the right function." +#: ../../c-api/unicode.rst:116 +msgid "" +"Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " +"integer types for direct character access. No checks are performed if the " +"canonical representation has the correct character size; " +"use :c:func:`PyUnicode_KIND` to select the right function." msgstr "" +#: ../../c-api/unicode.rst:128 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" +#: ../../c-api/unicode.rst:132 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "" -msgid "Return one of the PyUnicode kind constants (see above) that indicate how many bytes per character this Unicode object uses to store its data. *unicode* has to be a Unicode object in the \"canonical\" representation (not checked)." +#: ../../c-api/unicode.rst:138 +msgid "" +"Return one of the PyUnicode kind constants (see above) that indicate how " +"many bytes per character this Unicode object uses to store its data. " +"*unicode* has to be a Unicode object in the \"canonical\" representation " +"(not checked)." msgstr "" -msgid "Return a void pointer to the raw Unicode buffer. *unicode* has to be a Unicode object in the \"canonical\" representation (not checked)." +#: ../../c-api/unicode.rst:147 +msgid "" +"Return a void pointer to the raw Unicode buffer. *unicode* has to be a " +"Unicode object in the \"canonical\" representation (not checked)." msgstr "" -msgid "Write the code point *value* to the given zero-based *index* in a string." +#: ../../c-api/unicode.rst:156 +msgid "" +"Write the code point *value* to the given zero-based *index* in a string." msgstr "" -msgid "The *kind* value and *data* pointer must have been obtained from a string using :c:func:`PyUnicode_KIND` and :c:func:`PyUnicode_DATA` respectively. You must hold a reference to that string while calling :c:func:`!PyUnicode_WRITE`. All requirements of :c:func:`PyUnicode_WriteChar` also apply." +#: ../../c-api/unicode.rst:158 +msgid "" +"The *kind* value and *data* pointer must have been obtained from a string " +"using :c:func:`PyUnicode_KIND` and :c:func:`PyUnicode_DATA` respectively. " +"You must hold a reference to that string while calling :c:func:`!" +"PyUnicode_WRITE`. All requirements of :c:func:`PyUnicode_WriteChar` also " +"apply." msgstr "" -msgid "The function performs no checks for any of its requirements, and is intended for usage in loops." +#: ../../c-api/unicode.rst:164 +msgid "" +"The function performs no checks for any of its requirements, and is intended " +"for usage in loops." msgstr "" -msgid "Read a code point from a canonical representation *data* (as obtained with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +#: ../../c-api/unicode.rst:173 +msgid "" +"Read a code point from a canonical representation *data* (as obtained " +"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -msgid "Read a character from a Unicode object *unicode*, which must be in the \"canonical\" representation. This is less efficient than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." +#: ../../c-api/unicode.rst:181 +msgid "" +"Read a character from a Unicode object *unicode*, which must be in the " +"\"canonical\" representation. This is less efficient " +"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -msgid "Return the maximum code point that is suitable for creating another string based on *unicode*, which must be in the \"canonical\" representation. This is always an approximation but more efficient than iterating over the string." +#: ../../c-api/unicode.rst:190 +msgid "" +"Return the maximum code point that is suitable for creating another string " +"based on *unicode*, which must be in the \"canonical\" representation. This " +"is always an approximation but more efficient than iterating over the string." msgstr "" -msgid "Return ``1`` if the string is a valid identifier according to the language definition, section :ref:`identifiers`. Return ``0`` otherwise." +#: ../../c-api/unicode.rst:199 +msgid "" +"Return ``1`` if the string is a valid identifier according to the language " +"definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -msgid "The function does not call :c:func:`Py_FatalError` anymore if the string is not ready." +#: ../../c-api/unicode.rst:202 +msgid "" +"The function does not call :c:func:`Py_FatalError` anymore if the string is " +"not ready." msgstr "" -msgid "Return true if the string only contains ASCII characters. Equivalent to :py:meth:`str.isascii`." +#: ../../c-api/unicode.rst:209 +msgid "" +"Return true if the string only contains ASCII characters. Equivalent " +"to :py:meth:`str.isascii`." msgstr "" +#: ../../c-api/unicode.rst:216 msgid "Unicode Character Properties" msgstr "" -msgid "Unicode provides many different character properties. The most often needed ones are available through these macros which are mapped to C functions depending on the Python configuration." +#: ../../c-api/unicode.rst:218 +msgid "" +"Unicode provides many different character properties. The most often needed " +"ones are available through these macros which are mapped to C functions " +"depending on the Python configuration." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." +#: ../../c-api/unicode.rst:225 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." +#: ../../c-api/unicode.rst:230 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." +#: ../../c-api/unicode.rst:235 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." +#: ../../c-api/unicode.rst:240 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." +#: ../../c-api/unicode.rst:245 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "" +#: ../../c-api/unicode.rst:250 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "" +#: ../../c-api/unicode.rst:255 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "" +#: ../../c-api/unicode.rst:260 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." +#: ../../c-api/unicode.rst:265 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." +#: ../../c-api/unicode.rst:270 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "" -msgid "Return ``1`` or ``0`` depending on whether *ch* is a printable character, in the sense of :meth:`str.isprintable`." +#: ../../c-api/unicode.rst:275 +msgid "" +"Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " +"the sense of :meth:`str.isprintable`." msgstr "" +#: ../../c-api/unicode.rst:279 msgid "These APIs can be used for fast direct character conversions:" msgstr "" +#: ../../c-api/unicode.rst:284 msgid "Return the character *ch* converted to lower case." msgstr "" +#: ../../c-api/unicode.rst:289 msgid "Return the character *ch* converted to upper case." msgstr "" +#: ../../c-api/unicode.rst:294 msgid "Return the character *ch* converted to title case." msgstr "" -msgid "Return the character *ch* converted to a decimal positive integer. Return ``-1`` if this is not possible. This function does not raise exceptions." +#: ../../c-api/unicode.rst:299 +msgid "" +"Return the character *ch* converted to a decimal positive integer. Return " +"``-1`` if this is not possible. This function does not raise exceptions." msgstr "" -msgid "Return the character *ch* converted to a single digit integer. Return ``-1`` if this is not possible. This function does not raise exceptions." +#: ../../c-api/unicode.rst:305 +msgid "" +"Return the character *ch* converted to a single digit integer. Return ``-1`` " +"if this is not possible. This function does not raise exceptions." msgstr "" -msgid "Return the character *ch* converted to a double. Return ``-1.0`` if this is not possible. This function does not raise exceptions." +#: ../../c-api/unicode.rst:311 +msgid "" +"Return the character *ch* converted to a double. Return ``-1.0`` if this is " +"not possible. This function does not raise exceptions." msgstr "" +#: ../../c-api/unicode.rst:315 msgid "These APIs can be used to work with surrogates:" msgstr "" +#: ../../c-api/unicode.rst:319 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "" +#: ../../c-api/unicode.rst:323 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" +#: ../../c-api/unicode.rst:327 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" -msgid "Return the high UTF-16 surrogate (``0xD800`` to ``0xDBFF``) for a Unicode code point in the range ``[0x10000; 0x10FFFF]``." +#: ../../c-api/unicode.rst:331 +msgid "" +"Return the high UTF-16 surrogate (``0xD800`` to ``0xDBFF``) for a Unicode " +"code point in the range ``[0x10000; 0x10FFFF]``." msgstr "" -msgid "Return the low UTF-16 surrogate (``0xDC00`` to ``0xDFFF``) for a Unicode code point in the range ``[0x10000; 0x10FFFF]``." +#: ../../c-api/unicode.rst:336 +msgid "" +"Return the low UTF-16 surrogate (``0xDC00`` to ``0xDFFF``) for a Unicode " +"code point in the range ``[0x10000; 0x10FFFF]``." msgstr "" -msgid "Join two surrogate code points and return a single :c:type:`Py_UCS4` value. *high* and *low* are respectively the leading and trailing surrogates in a surrogate pair. *high* must be in the range ``[0xD800; 0xDBFF]`` and *low* must be in the range ``[0xDC00; 0xDFFF]``." +#: ../../c-api/unicode.rst:341 +msgid "" +"Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " +"*high* and *low* are respectively the leading and trailing surrogates in a " +"surrogate pair. *high* must be in the range ``[0xD800; 0xDBFF]`` and *low* " +"must be in the range ``[0xDC00; 0xDFFF]``." msgstr "" +#: ../../c-api/unicode.rst:348 msgid "Creating and accessing Unicode strings" msgstr "" -msgid "To create Unicode objects and access their basic sequence properties, use these APIs:" +#: ../../c-api/unicode.rst:350 +msgid "" +"To create Unicode objects and access their basic sequence properties, use " +"these APIs:" msgstr "" -msgid "Create a new Unicode object. *maxchar* should be the true maximum code point to be placed in the string. As an approximation, it can be rounded up to the nearest value in the sequence 127, 255, 65535, 1114111." +#: ../../c-api/unicode.rst:355 +msgid "" +"Create a new Unicode object. *maxchar* should be the true maximum code " +"point to be placed in the string. As an approximation, it can be rounded up " +"to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" +#: ../../c-api/unicode.rst:359 msgid "On error, set an exception and return ``NULL``." msgstr "" -msgid "After creation, the string can be filled by :c:func:`PyUnicode_WriteChar`, :c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:`PyUnicode_WRITE` or similar. Since strings are supposed to be immutable, take care to not “use” the result while it is being modified. In particular, before it's filled with its final contents, a string:" +#: ../../c-api/unicode.rst:361 +msgid "" +"After creation, the string can be filled " +"by :c:func:`PyUnicode_WriteChar`, :c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:`PyUnicode_WRITE` " +"or similar. Since strings are supposed to be immutable, take care to not " +"“use” the result while it is being modified. In particular, before it's " +"filled with its final contents, a string:" msgstr "" +#: ../../c-api/unicode.rst:368 msgid "must not be hashed," msgstr "" -msgid "must not be :c:func:`converted to UTF-8 `, or another non-\"canonical\" representation," +#: ../../c-api/unicode.rst:369 +msgid "" +"must not be :c:func:`converted to UTF-8 `, or " +"another non-\"canonical\" representation," msgstr "" +#: ../../c-api/unicode.rst:371 msgid "must not have its reference count changed," msgstr "" +#: ../../c-api/unicode.rst:372 msgid "must not be shared with code that might do one of the above." msgstr "" -msgid "This list is not exhaustive. Avoiding these uses is your responsibility; Python does not always check these requirements." +#: ../../c-api/unicode.rst:374 +msgid "" +"This list is not exhaustive. Avoiding these uses is your responsibility; " +"Python does not always check these requirements." msgstr "" -msgid "To avoid accidentally exposing a partially-written string object, prefer using the :c:type:`PyUnicodeWriter` API, or one of the ``PyUnicode_From*`` functions below." +#: ../../c-api/unicode.rst:377 +msgid "" +"To avoid accidentally exposing a partially-written string object, prefer " +"using the :c:type:`PyUnicodeWriter` API, or one of the ``PyUnicode_From*`` " +"functions below." msgstr "" -msgid "Create a new Unicode object with the given *kind* (possible values are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of 1, 2 or 4 bytes per character, as given by the kind." +#: ../../c-api/unicode.rst:388 +msgid "" +"Create a new Unicode object with the given *kind* (possible values " +"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " +"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " +"units of 1, 2 or 4 bytes per character, as given by the kind." msgstr "" -msgid "If necessary, the input *buffer* is copied and transformed into the canonical representation. For example, if the *buffer* is a UCS4 string (:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." +#: ../../c-api/unicode.rst:393 +msgid "" +"If necessary, the input *buffer* is copied and transformed into the " +"canonical representation. For example, if the *buffer* is a UCS4 string " +"(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the " +"UCS1 range, it will be transformed into UCS1 " +"(:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -msgid "Create a Unicode object from the char buffer *str*. The bytes will be interpreted as being UTF-8 encoded. The buffer is copied into the new object. The return value might be a shared object, i.e. modification of the data is not allowed." +#: ../../c-api/unicode.rst:404 +msgid "" +"Create a Unicode object from the char buffer *str*. The bytes will be " +"interpreted as being UTF-8 encoded. The buffer is copied into the new " +"object. The return value might be a shared object, i.e. modification of the " +"data is not allowed." msgstr "" +#: ../../c-api/unicode.rst:410 msgid "This function raises :exc:`SystemError` when:" msgstr "" +#: ../../c-api/unicode.rst:412 msgid "*size* < 0," msgstr "" +#: ../../c-api/unicode.rst:413 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" +#: ../../c-api/unicode.rst:415 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" -msgid "Create a Unicode object from a UTF-8 encoded null-terminated char buffer *str*." +#: ../../c-api/unicode.rst:421 +msgid "" +"Create a Unicode object from a UTF-8 encoded null-terminated char buffer " +"*str*." msgstr "" -msgid "Take a C :c:func:`printf`\\ -style *format* string and a variable number of arguments, calculate the size of the resulting Python Unicode string and return a string with the values formatted into it. The variable arguments must be C types and must correspond exactly to the format characters in the *format* ASCII-encoded string." +#: ../../c-api/unicode.rst:427 +msgid "" +"Take a C :c:func:`printf`\\ -style *format* string and a variable number of " +"arguments, calculate the size of the resulting Python Unicode string and " +"return a string with the values formatted into it. The variable arguments " +"must be C types and must correspond exactly to the format characters in the " +"*format* ASCII-encoded string." msgstr "" -msgid "A conversion specifier contains two or more characters and has the following components, which must occur in this order:" +#: ../../c-api/unicode.rst:433 +msgid "" +"A conversion specifier contains two or more characters and has the following " +"components, which must occur in this order:" msgstr "" +#: ../../c-api/unicode.rst:436 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -msgid "Conversion flags (optional), which affect the result of some conversion types." +#: ../../c-api/unicode.rst:438 +msgid "" +"Conversion flags (optional), which affect the result of some conversion " +"types." msgstr "" -msgid "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the actual width is given in the next argument, which must be of type :c:expr:`int`, and the object to convert comes after the minimum field width and optional precision." +#: ../../c-api/unicode.rst:441 +msgid "" +"Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " +"actual width is given in the next argument, which must be of " +"type :c:expr:`int`, and the object to convert comes after the minimum field " +"width and optional precision." msgstr "" -msgid "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If specified as ``'*'`` (an asterisk), the actual precision is given in the next argument, which must be of type :c:expr:`int`, and the value to convert comes after the precision." +#: ../../c-api/unicode.rst:446 +msgid "" +"Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " +"specified as ``'*'`` (an asterisk), the actual precision is given in the " +"next argument, which must be of type :c:expr:`int`, and the value to convert " +"comes after the precision." msgstr "" +#: ../../c-api/unicode.rst:451 msgid "Length modifier (optional)." msgstr "" +#: ../../c-api/unicode.rst:453 msgid "Conversion type." msgstr "" +#: ../../c-api/unicode.rst:455 msgid "The conversion flag characters are:" msgstr "" +#: ../../c-api/unicode.rst:460 msgid "Flag" msgstr "" +#: ../../c-api/unicode.rst:460 msgid "Meaning" msgstr "" +#: ../../c-api/unicode.rst:462 msgid "``0``" msgstr "" +#: ../../c-api/unicode.rst:462 msgid "The conversion will be zero padded for numeric values." msgstr "" +#: ../../c-api/unicode.rst:464 msgid "``-``" msgstr "" -msgid "The converted value is left adjusted (overrides the ``0`` flag if both are given)." +#: ../../c-api/unicode.rst:464 +msgid "" +"The converted value is left adjusted (overrides the ``0`` flag if both are " +"given)." msgstr "" -msgid "The length modifiers for following integer conversions (``d``, ``i``, ``o``, ``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by default):" +#: ../../c-api/unicode.rst:468 +msgid "" +"The length modifiers for following integer conversions (``d``, ``i``, ``o``, " +"``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " +"default):" msgstr "" +#: ../../c-api/unicode.rst:475 msgid "Modifier" msgstr "" +#: ../../c-api/unicode.rst:475 msgid "Types" msgstr "" +#: ../../c-api/unicode.rst:477 msgid "``l``" msgstr "" +#: ../../c-api/unicode.rst:477 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr "" +#: ../../c-api/unicode.rst:479 msgid "``ll``" msgstr "" +#: ../../c-api/unicode.rst:479 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr "" +#: ../../c-api/unicode.rst:481 msgid "``j``" msgstr "" +#: ../../c-api/unicode.rst:481 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr "" +#: ../../c-api/unicode.rst:483 msgid "``z``" msgstr "" +#: ../../c-api/unicode.rst:483 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr "" +#: ../../c-api/unicode.rst:485 msgid "``t``" msgstr "" +#: ../../c-api/unicode.rst:485 msgid ":c:type:`ptrdiff_t`" msgstr "" -msgid "The length modifier ``l`` for following conversions ``s`` or ``V`` specify that the type of the argument is :c:expr:`const wchar_t*`." +#: ../../c-api/unicode.rst:488 +msgid "" +"The length modifier ``l`` for following conversions ``s`` or ``V`` specify " +"that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" +#: ../../c-api/unicode.rst:491 msgid "The conversion specifiers are:" msgstr "" +#: ../../c-api/unicode.rst:497 msgid "Conversion Specifier" msgstr "" +#: ../../c-api/unicode.rst:498 msgid "Type" msgstr "" +#: ../../c-api/unicode.rst:499 msgid "Comment" msgstr "" +#: ../../c-api/unicode.rst:501 msgid "``%``" msgstr "" +#: ../../c-api/unicode.rst:502 msgid "*n/a*" msgstr "" +#: ../../c-api/unicode.rst:503 msgid "The literal ``%`` character." msgstr "" +#: ../../c-api/unicode.rst:505 msgid "``d``, ``i``" msgstr "" +#: ../../c-api/unicode.rst:506 ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:514 ../../c-api/unicode.rst:518 +#: ../../c-api/unicode.rst:522 msgid "Specified by the length modifier" msgstr "" +#: ../../c-api/unicode.rst:507 msgid "The decimal representation of a signed C integer." msgstr "" +#: ../../c-api/unicode.rst:509 msgid "``u``" msgstr "" +#: ../../c-api/unicode.rst:511 msgid "The decimal representation of an unsigned C integer." msgstr "" +#: ../../c-api/unicode.rst:513 msgid "``o``" msgstr "" +#: ../../c-api/unicode.rst:515 msgid "The octal representation of an unsigned C integer." msgstr "" +#: ../../c-api/unicode.rst:517 msgid "``x``" msgstr "" +#: ../../c-api/unicode.rst:519 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" +#: ../../c-api/unicode.rst:521 msgid "``X``" msgstr "" +#: ../../c-api/unicode.rst:523 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" +#: ../../c-api/unicode.rst:525 msgid "``c``" msgstr "" +#: ../../c-api/unicode.rst:526 msgid ":c:expr:`int`" msgstr "" +#: ../../c-api/unicode.rst:527 msgid "A single character." msgstr "" +#: ../../c-api/unicode.rst:529 msgid "``s``" msgstr "" +#: ../../c-api/unicode.rst:530 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr "" +#: ../../c-api/unicode.rst:531 msgid "A null-terminated C character array." msgstr "" +#: ../../c-api/unicode.rst:533 msgid "``p``" msgstr "" +#: ../../c-api/unicode.rst:534 msgid ":c:expr:`const void*`" msgstr "" -msgid "The hex representation of a C pointer. Mostly equivalent to ``printf(\"%p\")`` except that it is guaranteed to start with the literal ``0x`` regardless of what the platform's ``printf`` yields." +#: ../../c-api/unicode.rst:535 +msgid "" +"The hex representation of a C pointer. Mostly equivalent to " +"``printf(\"%p\")`` except that it is guaranteed to start with the literal " +"``0x`` regardless of what the platform's ``printf`` yields." msgstr "" +#: ../../c-api/unicode.rst:540 msgid "``A``" msgstr "" +#: ../../c-api/unicode.rst:541 ../../c-api/unicode.rst:545 +#: ../../c-api/unicode.rst:555 ../../c-api/unicode.rst:559 +#: ../../c-api/unicode.rst:563 ../../c-api/unicode.rst:568 msgid ":c:expr:`PyObject*`" msgstr "" +#: ../../c-api/unicode.rst:542 msgid "The result of calling :func:`ascii`." msgstr "" +#: ../../c-api/unicode.rst:544 msgid "``U``" msgstr "" +#: ../../c-api/unicode.rst:546 msgid "A Unicode object." msgstr "" +#: ../../c-api/unicode.rst:548 msgid "``V``" msgstr "" +#: ../../c-api/unicode.rst:549 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr "" -msgid "A Unicode object (which may be ``NULL``) and a null-terminated C character array as a second parameter (which will be used, if the first parameter is ``NULL``)." +#: ../../c-api/unicode.rst:550 +msgid "" +"A Unicode object (which may be ``NULL``) and a null-terminated C character " +"array as a second parameter (which will be used, if the first parameter is " +"``NULL``)." msgstr "" +#: ../../c-api/unicode.rst:554 msgid "``S``" msgstr "" +#: ../../c-api/unicode.rst:556 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" +#: ../../c-api/unicode.rst:558 msgid "``R``" msgstr "" +#: ../../c-api/unicode.rst:560 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" +#: ../../c-api/unicode.rst:562 msgid "``T``" msgstr "" -msgid "Get the fully qualified name of an object type; call :c:func:`PyType_GetFullyQualifiedName`." +#: ../../c-api/unicode.rst:564 +msgid "" +"Get the fully qualified name of an object type; " +"call :c:func:`PyType_GetFullyQualifiedName`." msgstr "" +#: ../../c-api/unicode.rst:567 msgid "``#T``" msgstr "" -msgid "Similar to ``T`` format, but use a colon (``:``) as separator between the module name and the qualified name." +#: ../../c-api/unicode.rst:569 +msgid "" +"Similar to ``T`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." msgstr "" +#: ../../c-api/unicode.rst:572 msgid "``N``" msgstr "" +#: ../../c-api/unicode.rst:573 ../../c-api/unicode.rst:578 msgid ":c:expr:`PyTypeObject*`" msgstr "" -msgid "Get the fully qualified name of a type; call :c:func:`PyType_GetFullyQualifiedName`." +#: ../../c-api/unicode.rst:574 +msgid "" +"Get the fully qualified name of a type; " +"call :c:func:`PyType_GetFullyQualifiedName`." msgstr "" +#: ../../c-api/unicode.rst:577 msgid "``#N``" msgstr "" -msgid "Similar to ``N`` format, but use a colon (``:``) as separator between the module name and the qualified name." +#: ../../c-api/unicode.rst:579 +msgid "" +"Similar to ``N`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." msgstr "" -msgid "The width formatter unit is number of characters rather than bytes. The precision formatter unit is number of bytes or :c:type:`wchar_t` items (if the length modifier ``l`` is used) for ``\"%s\"`` and ``\"%V\"`` (if the ``PyObject*`` argument is ``NULL``), and a number of characters for ``\"%A\"``, ``\"%U\"``, ``\"%S\"``, ``\"%R\"`` and ``\"%V\"`` (if the ``PyObject*`` argument is not ``NULL``)." +#: ../../c-api/unicode.rst:583 +msgid "" +"The width formatter unit is number of characters rather than bytes. The " +"precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " +"the length modifier ``l`` is used) for ``\"%s\"`` and ``\"%V\"`` (if the " +"``PyObject*`` argument is ``NULL``), and a number of characters for " +"``\"%A\"``, ``\"%U\"``, ``\"%S\"``, ``\"%R\"`` and ``\"%V\"`` (if the " +"``PyObject*`` argument is not ``NULL``)." msgstr "" -msgid "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or ``X``)." +#: ../../c-api/unicode.rst:591 +msgid "" +"Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " +"is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " +"``X``)." msgstr "" +#: ../../c-api/unicode.rst:595 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" +#: ../../c-api/unicode.rst:598 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -msgid "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, ``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." +#: ../../c-api/unicode.rst:601 +msgid "" +"Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " +"``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -msgid "Support for conversion specifiers ``o`` and ``X``. Support for length modifiers ``j`` and ``t``. Length modifiers are now applied to all integer conversions. Length modifier ``l`` is now applied to conversion specifiers ``s`` and ``V``. Support for variable width and precision ``*``. Support for flag ``-``." +#: ../../c-api/unicode.rst:605 +msgid "" +"Support for conversion specifiers ``o`` and ``X``. Support for length " +"modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " +"conversions. Length modifier ``l`` is now applied to conversion specifiers " +"``s`` and ``V``. Support for variable width and precision ``*``. Support for " +"flag ``-``." msgstr "" -msgid "An unrecognized format character now sets a :exc:`SystemError`. In previous versions it caused all the rest of the format string to be copied as-is to the result string, and any extra arguments discarded." +#: ../../c-api/unicode.rst:613 +msgid "" +"An unrecognized format character now sets a :exc:`SystemError`. In previous " +"versions it caused all the rest of the format string to be copied as-is to " +"the result string, and any extra arguments discarded." msgstr "" +#: ../../c-api/unicode.rst:617 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "" -msgid "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two arguments." +#: ../../c-api/unicode.rst:623 +msgid "" +"Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " +"arguments." msgstr "" -msgid "Copy an instance of a Unicode subtype to a new true Unicode object if necessary. If *obj* is already a true Unicode object (not a subtype), return a new :term:`strong reference` to the object." +#: ../../c-api/unicode.rst:629 +msgid "" +"Copy an instance of a Unicode subtype to a new true Unicode object if " +"necessary. If *obj* is already a true Unicode object (not a subtype), return " +"a new :term:`strong reference` to the object." msgstr "" -msgid "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." +#: ../../c-api/unicode.rst:633 +msgid "" +"Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" +#: ../../c-api/unicode.rst:638 msgid "Create a Unicode Object from the given Unicode code point *ordinal*." msgstr "" -msgid "The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in the case it is not." +#: ../../c-api/unicode.rst:640 +msgid "" +"The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " +"the case it is not." msgstr "" +#: ../../c-api/unicode.rst:647 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -msgid ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects ` are decoded according to the given *encoding* and using the error handling defined by *errors*. Both can be ``NULL`` to have the interface use the default values (see :ref:`builtincodecs` for details)." +#: ../../c-api/unicode.rst:649 +msgid "" +":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " +"` are decoded according to the given *encoding* and using " +"the error handling defined by *errors*. Both can be ``NULL`` to have the " +"interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -msgid "All other objects, including Unicode objects, cause a :exc:`TypeError` to be set." +#: ../../c-api/unicode.rst:655 +msgid "" +"All other objects, including Unicode objects, cause a :exc:`TypeError` to be " +"set." msgstr "" -msgid "The API returns ``NULL`` if there was an error. The caller is responsible for decref'ing the returned objects." +#: ../../c-api/unicode.rst:658 +msgid "" +"The API returns ``NULL`` if there was an error. The caller is responsible " +"for decref'ing the returned objects." msgstr "" -msgid "Append the string *right* to the end of *p_left*. *p_left* must point to a :term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` releases (\"steals\") this reference." +#: ../../c-api/unicode.rst:664 +msgid "" +"Append the string *right* to the end of *p_left*. *p_left* must point to " +"a :term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " +"releases (\":term:`steals `\") this reference." msgstr "" +#: ../../c-api/unicode.rst:669 msgid "On error, set *\\*p_left* to ``NULL`` and set an exception." msgstr "" +#: ../../c-api/unicode.rst:671 msgid "On success, set *\\*p_left* to a new strong reference to the result." msgstr "" -msgid "The function is similar to :c:func:`PyUnicode_Append`, with the only difference being that it decrements the reference count of *right* by one." +#: ../../c-api/unicode.rst:676 +msgid "" +"The function is similar to :c:func:`PyUnicode_Append`, with the only " +"difference being that it decrements the reference count of *right* by one." msgstr "" -msgid "Return a mapping suitable for decoding a custom single-byte encoding. Given a Unicode string *string* of up to 256 characters representing an encoding table, returns either a compact internal mapping object or a dictionary mapping character ordinals to byte values. Raises a :exc:`TypeError` and return ``NULL`` on invalid input." +#: ../../c-api/unicode.rst:682 +msgid "" +"Return a mapping suitable for decoding a custom single-byte encoding. Given " +"a Unicode string *string* of up to 256 characters representing an encoding " +"table, returns either a compact internal mapping object or a dictionary " +"mapping character ordinals to byte values. Raises a :exc:`TypeError` and " +"return ``NULL`` on invalid input." msgstr "" -msgid "Return the name of the default string encoding, ``\"utf-8\"``. See :func:`sys.getdefaultencoding`." +#: ../../c-api/unicode.rst:693 +msgid "" +"Return the name of the default string encoding, ``\"utf-8\"``. " +"See :func:`sys.getdefaultencoding`." msgstr "" -msgid "The returned string does not need to be freed, and is valid until interpreter shutdown." +#: ../../c-api/unicode.rst:696 +msgid "" +"The returned string does not need to be freed, and is valid until " +"interpreter shutdown." msgstr "" +#: ../../c-api/unicode.rst:702 msgid "Return the length of the Unicode object, in code points." msgstr "" +#: ../../c-api/unicode.rst:704 msgid "On error, set an exception and return ``-1``." msgstr "" -msgid "Copy characters from one Unicode object into another. This function performs character conversion when necessary and falls back to :c:func:`!memcpy` if possible. Returns ``-1`` and sets an exception on error, otherwise returns the number of copied characters." +#: ../../c-api/unicode.rst:715 +msgid "" +"Copy characters from one Unicode object into another. This function " +"performs character conversion when necessary and falls back to :c:func:`!" +"memcpy` if possible. Returns ``-1`` and sets an exception on error, " +"otherwise returns the number of copied characters." msgstr "" -msgid "The string must not have been “used” yet. See :c:func:`PyUnicode_New` for details." +#: ../../c-api/unicode.rst:720 ../../c-api/unicode.rst:750 +#: ../../c-api/unicode.rst:770 +msgid "" +"The string must not have been “used” yet. See :c:func:`PyUnicode_New` for " +"details." msgstr "" -msgid "Resize a Unicode object *\\*unicode* to the new *length* in code points." +#: ../../c-api/unicode.rst:728 +msgid "" +"Resize a Unicode object *\\*unicode* to the new *length* in code points." msgstr "" -msgid "Try to resize the string in place (which is usually faster than allocating a new string and copying characters), or create a new string." +#: ../../c-api/unicode.rst:730 +msgid "" +"Try to resize the string in place (which is usually faster than allocating a " +"new string and copying characters), or create a new string." msgstr "" -msgid "*\\*unicode* is modified to point to the new (resized) object and ``0`` is returned on success. Otherwise, ``-1`` is returned and an exception is set, and *\\*unicode* is left untouched." +#: ../../c-api/unicode.rst:733 +msgid "" +"*\\*unicode* is modified to point to the new (resized) object and ``0`` is " +"returned on success. Otherwise, ``-1`` is returned and an exception is set, " +"and *\\*unicode* is left untouched." msgstr "" -msgid "The function doesn't check string content, the result may not be a string in canonical representation." +#: ../../c-api/unicode.rst:737 +msgid "" +"The function doesn't check string content, the result may not be a string in " +"canonical representation." msgstr "" -msgid "Fill a string with a character: write *fill_char* into ``unicode[start:start+length]``." +#: ../../c-api/unicode.rst:744 +msgid "" +"Fill a string with a character: write *fill_char* into " +"``unicode[start:start+length]``." msgstr "" -msgid "Fail if *fill_char* is bigger than the string maximum character, or if the string has more than 1 reference." +#: ../../c-api/unicode.rst:747 +msgid "" +"Fail if *fill_char* is bigger than the string maximum character, or if the " +"string has more than 1 reference." msgstr "" -msgid "Return the number of written characters, or return ``-1`` and raise an exception on error." +#: ../../c-api/unicode.rst:753 +msgid "" +"Return the number of written characters, or return ``-1`` and raise an " +"exception on error." msgstr "" -msgid "Write a *character* to the string *unicode* at the zero-based *index*. Return ``0`` on success, ``-1`` on error with an exception set." +#: ../../c-api/unicode.rst:762 +msgid "" +"Write a *character* to the string *unicode* at the zero-based *index*. " +"Return ``0`` on success, ``-1`` on error with an exception set." msgstr "" -msgid "This function checks that *unicode* is a Unicode object, that the index is not out of bounds, and that the object's reference count is one. See :c:func:`PyUnicode_WRITE` for a version that skips these checks, making them your responsibility." +#: ../../c-api/unicode.rst:765 +msgid "" +"This function checks that *unicode* is a Unicode object, that the index is " +"not out of bounds, and that the object's reference count is one. " +"See :c:func:`PyUnicode_WRITE` for a version that skips these checks, making " +"them your responsibility." msgstr "" -msgid "Read a character from a string. This function checks that *unicode* is a Unicode object and the index is not out of bounds, in contrast to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." +#: ../../c-api/unicode.rst:778 +msgid "" +"Read a character from a string. This function checks that *unicode* is a " +"Unicode object and the index is not out of bounds, in contrast " +"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" +#: ../../c-api/unicode.rst:782 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "" -msgid "Return a substring of *unicode*, from character index *start* (included) to character index *end* (excluded). Negative indices are not supported. On error, set an exception and return ``NULL``." +#: ../../c-api/unicode.rst:790 +msgid "" +"Return a substring of *unicode*, from character index *start* (included) to " +"character index *end* (excluded). Negative indices are not supported. On " +"error, set an exception and return ``NULL``." msgstr "" -msgid "Copy the string *unicode* into a UCS4 buffer, including a null character, if *copy_null* is set. Returns ``NULL`` and sets an exception on error (in particular, a :exc:`SystemError` if *buflen* is smaller than the length of *unicode*). *buffer* is returned on success." +#: ../../c-api/unicode.rst:800 +msgid "" +"Copy the string *unicode* into a UCS4 buffer, including a null character, if " +"*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " +"particular, a :exc:`SystemError` if *buflen* is smaller than the length of " +"*unicode*). *buffer* is returned on success." msgstr "" -msgid "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:`MemoryError` set. The returned buffer always has an extra null code point appended." +#: ../../c-api/unicode.rst:810 +msgid "" +"Copy the string *unicode* into a new UCS4 buffer that is allocated " +"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " +"a :exc:`MemoryError` set. The returned buffer always has an extra null code " +"point appended." msgstr "" +#: ../../c-api/unicode.rst:819 msgid "Locale Encoding" msgstr "" -msgid "The current locale encoding can be used to decode text from the operating system." +#: ../../c-api/unicode.rst:821 +msgid "" +"The current locale encoding can be used to decode text from the operating " +"system." msgstr "" -msgid "Decode a string from UTF-8 on Android and VxWorks, or from the current locale encoding on other platforms. The supported error handlers are ``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The decoder uses ``\"strict\"`` error handler if *errors* is ``NULL``. *str* must end with a null character but cannot contain embedded null characters." +#: ../../c-api/unicode.rst:828 +msgid "" +"Decode a string from UTF-8 on Android and VxWorks, or from the current " +"locale encoding on other platforms. The supported error handlers are " +"``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The decoder uses " +"``\"strict\"`` error handler if *errors* is ``NULL``. *str* must end with a " +"null character but cannot contain embedded null characters." msgstr "" -msgid "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :term:`filesystem encoding and error handler`." +#: ../../c-api/unicode.rst:835 +msgid "" +"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from " +"the :term:`filesystem encoding and error handler`." msgstr "" +#: ../../c-api/unicode.rst:838 ../../c-api/unicode.rst:873 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" +#: ../../c-api/unicode.rst:842 ../../c-api/unicode.rst:958 msgid "The :c:func:`Py_DecodeLocale` function." msgstr "" -msgid "The function now also uses the current locale encoding for the ``surrogateescape`` error handler, except on Android. Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, and the current locale encoding was used for ``strict``." +#: ../../c-api/unicode.rst:846 +msgid "" +"The function now also uses the current locale encoding for the " +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" -msgid "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string length using :c:func:`!strlen`." +#: ../../c-api/unicode.rst:855 +msgid "" +"Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " +"length using :c:func:`!strlen`." msgstr "" -msgid "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current locale encoding on other platforms. The supported error handlers are ``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses ``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:`bytes` object. *unicode* cannot contain embedded null characters." +#: ../../c-api/unicode.rst:863 +msgid "" +"Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " +"locale encoding on other platforms. The supported error handlers are " +"``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " +"``\"strict\"`` error handler if *errors* is ``NULL``. Return " +"a :class:`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -msgid "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:`filesystem encoding and error handler`." +#: ../../c-api/unicode.rst:870 +msgid "" +"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to " +"the :term:`filesystem encoding and error handler`." msgstr "" +#: ../../c-api/unicode.rst:877 ../../c-api/unicode.rst:989 msgid "The :c:func:`Py_EncodeLocale` function." msgstr "" -msgid "The function now also uses the current locale encoding for the ``surrogateescape`` error handler, except on Android. Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, and the current locale encoding was used for ``strict``." +#: ../../c-api/unicode.rst:881 +msgid "" +"The function now also uses the current locale encoding for the " +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" +#: ../../c-api/unicode.rst:890 msgid "File System Encoding" msgstr "" -msgid "Functions encoding to and decoding from the :term:`filesystem encoding and error handler` (:pep:`383` and :pep:`529`)." -msgstr "" - -msgid "To encode file names to :class:`bytes` during argument parsing, the ``\"O&\"`` converter should be used, passing :c:func:`!PyUnicode_FSConverter` as the conversion function:" +#: ../../c-api/unicode.rst:892 +msgid "" +"Functions encoding to and decoding from the :term:`filesystem encoding and " +"error handler` (:pep:`383` and :pep:`529`)." msgstr "" -msgid ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects -- obtained directly or through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is. *result* must be an address of a C variable of type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the variable to a new :term:`strong reference` to a :ref:`bytes object ` which must be released when it is no longer used and return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are not allowed in the result. On failure, return ``0`` with an exception set." +#: ../../c-api/unicode.rst:895 +msgid "" +"To encode file names to :class:`bytes` during argument parsing, the " +"``\"O&\"`` converter should be used, passing :c:func:`!" +"PyUnicode_FSConverter` as the conversion function:" msgstr "" -msgid "If *obj* is ``NULL``, the function releases a strong reference stored in the variable referred by *result* and returns ``1``." +#: ../../c-api/unicode.rst:901 +msgid "" +":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " +"-- obtained directly or through the :class:`os.PathLike` interface -- " +"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"objects are output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " +"variable to a new :term:`strong reference` to a :ref:`bytes object " +"` which must be released when it is no longer used and return " +"a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are " +"not allowed in the result. On failure, return ``0`` with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:913 +msgid "" +"If *obj* is ``NULL``, the function releases a strong reference stored in the " +"variable referred by *result* and returns ``1``." msgstr "" +#: ../../c-api/unicode.rst:918 ../../c-api/unicode.rst:945 msgid "Accepts a :term:`path-like object`." msgstr "" -msgid "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the conversion function:" -msgstr "" - -msgid ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects -- obtained either directly or indirectly through the :class:`os.PathLike` interface -- to :class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. *result* must be an address of a C variable of type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:`strong reference` to a :ref:`Unicode object ` which must be released when it is no longer used and return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the result. On failure, return ``0`` with an exception set." +#: ../../c-api/unicode.rst:921 +msgid "" +"To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " +"converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " +"conversion function:" msgstr "" -msgid "If *obj* is ``NULL``, release the strong reference to the object referred to by *result* and return ``1``." +#: ../../c-api/unicode.rst:927 +msgid "" +":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " +"-- obtained either directly or indirectly through the :class:`os.PathLike` " +"interface -- to :class:`str` " +"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " +"output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " +"the variable to a new :term:`strong reference` to a :ref:`Unicode object " +"` which must be released when it is no longer used and " +"return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null " +"characters are not allowed in the result. On failure, return ``0`` with an " +"exception set." +msgstr "" + +#: ../../c-api/unicode.rst:940 +msgid "" +"If *obj* is ``NULL``, release the strong reference to the object referred to " +"by *result* and return ``1``." msgstr "" +#: ../../c-api/unicode.rst:951 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -msgid "If you need to decode a string from the current locale encoding, use :c:func:`PyUnicode_DecodeLocaleAndSize`." +#: ../../c-api/unicode.rst:953 +msgid "" +"If you need to decode a string from the current locale encoding, " +"use :c:func:`PyUnicode_DecodeLocaleAndSize`." msgstr "" -msgid "The :term:`filesystem error handler ` is now used." +#: ../../c-api/unicode.rst:960 ../../c-api/unicode.rst:973 +#: ../../c-api/unicode.rst:993 +msgid "" +"The :term:`filesystem error handler ` " +"is now used." msgstr "" -msgid "Decode a null-terminated string from the :term:`filesystem encoding and error handler`." +#: ../../c-api/unicode.rst:967 +msgid "" +"Decode a null-terminated string from the :term:`filesystem encoding and " +"error handler`." msgstr "" -msgid "If the string length is known, use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." +#: ../../c-api/unicode.rst:970 +msgid "" +"If the string length is known, " +"use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" -msgid "Encode a Unicode object to the :term:`filesystem encoding and error handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` object can contain null bytes." +#: ../../c-api/unicode.rst:980 +msgid "" +"Encode a Unicode object to the :term:`filesystem encoding and error " +"handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " +"object can contain null bytes." msgstr "" -msgid "If you need to encode a string to the current locale encoding, use :c:func:`PyUnicode_EncodeLocale`." +#: ../../c-api/unicode.rst:984 +msgid "" +"If you need to encode a string to the current locale encoding, " +"use :c:func:`PyUnicode_EncodeLocale`." msgstr "" +#: ../../c-api/unicode.rst:998 msgid "wchar_t Support" msgstr "" +#: ../../c-api/unicode.rst:1000 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "" -msgid "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the given *size*. Passing ``-1`` as the *size* indicates that the function must itself compute the length, using :c:func:`!wcslen`. Return ``NULL`` on failure." +#: ../../c-api/unicode.rst:1004 +msgid "" +"Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " +"given *size*. Passing ``-1`` as the *size* indicates that the function must " +"itself compute the length, using :c:func:`!wcslen`. Return ``NULL`` on " +"failure." msgstr "" -msgid "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing null termination character). Return the number of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." +#: ../../c-api/unicode.rst:1012 +msgid "" +"Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " +"At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " +"trailing null termination character). Return the number " +"of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -msgid "When *wstr* is ``NULL``, instead return the *size* that would be required to store all of *unicode* including a terminating null." +#: ../../c-api/unicode.rst:1017 +msgid "" +"When *wstr* is ``NULL``, instead return the *size* that would be required to " +"store all of *unicode* including a terminating null." msgstr "" -msgid "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-terminated. It is the responsibility of the caller to make sure that the :c:expr:`wchar_t*` string is null-terminated in case this is required by the application. Also, note that the :c:expr:`wchar_t*` string might contain null characters, which would cause the string to be truncated when used with most C functions." +#: ../../c-api/unicode.rst:1020 +msgid "" +"Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" +"terminated. It is the responsibility of the caller to make sure that " +"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " +"the application. Also, note that the :c:expr:`wchar_t*` string might contain " +"null characters, which would cause the string to be truncated when used with " +"most C functions." msgstr "" -msgid "Convert the Unicode object to a wide character string. The output string always ends with a null character. If *size* is not ``NULL``, write the number of wide characters (excluding the trailing null termination character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string might contain null characters, which would cause the string to be truncated when used with most C functions. If *size* is ``NULL`` and the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` is raised." +#: ../../c-api/unicode.rst:1030 +msgid "" +"Convert the Unicode object to a wide character string. The output string " +"always ends with a null character. If *size* is not ``NULL``, write the " +"number of wide characters (excluding the trailing null termination " +"character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " +"might contain null characters, which would cause the string to be truncated " +"when used with most C functions. If *size* is ``NULL`` and " +"the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` " +"is raised." msgstr "" -msgid "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` to free it) on success. On error, returns ``NULL`` and *\\*size* is undefined. Raises a :exc:`MemoryError` if memory allocation is failed." +#: ../../c-api/unicode.rst:1038 +msgid "" +"Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " +"to free it) on success. On error, returns ``NULL`` and *\\*size* is " +"undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -msgid "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` string contains null characters." +#: ../../c-api/unicode.rst:1045 +msgid "" +"Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " +"string contains null characters." msgstr "" +#: ../../c-api/unicode.rst:1053 msgid "Built-in Codecs" msgstr "" -msgid "Python provides a set of built-in codecs which are written in C for speed. All of these codecs are directly usable via the following functions." +#: ../../c-api/unicode.rst:1055 +msgid "" +"Python provides a set of built-in codecs which are written in C for speed. " +"All of these codecs are directly usable via the following functions." msgstr "" -msgid "Many of the following APIs take two arguments encoding and errors, and they have the same semantics as the ones of the built-in :func:`str` string object constructor." +#: ../../c-api/unicode.rst:1058 +msgid "" +"Many of the following APIs take two arguments encoding and errors, and they " +"have the same semantics as the ones of the built-in :func:`str` string " +"object constructor." msgstr "" -msgid "Setting encoding to ``NULL`` causes the default encoding to be used which is UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for encoding file names. This uses the :term:`filesystem encoding and error handler` internally." +#: ../../c-api/unicode.rst:1062 +msgid "" +"Setting encoding to ``NULL`` causes the default encoding to be used which is " +"UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " +"encoding file names. This uses the :term:`filesystem encoding and error " +"handler` internally." msgstr "" -msgid "Error handling is set by errors which may also be set to ``NULL`` meaning to use the default handling defined for the codec. Default error handling for all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." +#: ../../c-api/unicode.rst:1067 +msgid "" +"Error handling is set by errors which may also be set to ``NULL`` meaning to " +"use the default handling defined for the codec. Default error handling for " +"all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -msgid "The codecs all use a similar interface. Only deviations from the following generic ones are documented for simplicity." +#: ../../c-api/unicode.rst:1071 +msgid "" +"The codecs all use a similar interface. Only deviations from the following " +"generic ones are documented for simplicity." msgstr "" +#: ../../c-api/unicode.rst:1076 msgid "Generic Codecs" msgstr "" +#: ../../c-api/unicode.rst:1078 msgid "The following macro is provided:" msgstr "" +#: ../../c-api/unicode.rst:1083 msgid "The Unicode code point ``U+FFFD`` (replacement character)." msgstr "" -msgid "This Unicode character is used as the replacement character during decoding if the *errors* argument is set to \"replace\"." +#: ../../c-api/unicode.rst:1085 +msgid "" +"This Unicode character is used as the replacement character during decoding " +"if the *errors* argument is set to \"replace\"." msgstr "" +#: ../../c-api/unicode.rst:1089 msgid "These are the generic codec APIs:" msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the encoded string *str*. *encoding* and *errors* have the same meaning as the parameters of the same name in the :func:`str` built-in function. The codec to be used is looked up using the Python codec registry. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1095 +msgid "" +"Create a Unicode object by decoding *size* bytes of the encoded string " +"*str*. *encoding* and *errors* have the same meaning as the parameters of " +"the same name in the :func:`str` built-in function. The codec to be used is " +"looked up using the Python codec registry. Return ``NULL`` if an exception " +"was raised by the codec." msgstr "" -msgid "Encode a Unicode object and return the result as Python bytes object. *encoding* and *errors* have the same meaning as the parameters of the same name in the Unicode :meth:`~str.encode` method. The codec to be used is looked up using the Python codec registry. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1105 +msgid "" +"Encode a Unicode object and return the result as Python bytes object. " +"*encoding* and *errors* have the same meaning as the parameters of the same " +"name in the Unicode :meth:`~str.encode` method. The codec to be used is " +"looked up using the Python codec registry. Return ``NULL`` if an exception " +"was raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1113 msgid "UTF-8 Codecs" msgstr "" +#: ../../c-api/unicode.rst:1115 msgid "These are the UTF-8 codec APIs:" msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1120 +msgid "" +"Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " +"*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -msgid "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If *consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will not be treated as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*." +#: ../../c-api/unicode.rst:1127 +msgid "" +"If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " +"*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " +"not be treated as an error. Those bytes will not be decoded and the number " +"of bytes that have been decoded will be stored in *consumed*." msgstr "" -msgid "Encode a Unicode object using UTF-8 and return the result as Python bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1135 +msgid "" +"Encode a Unicode object using UTF-8 and return the result as Python bytes " +"object. Error handling is \"strict\". Return ``NULL`` if an exception was " +"raised by the codec." msgstr "" -msgid "The function fails if the string contains surrogate code points (``U+D800`` - ``U+DFFF``)." +#: ../../c-api/unicode.rst:1139 ../../c-api/unicode.rst:1154 +msgid "" +"The function fails if the string contains surrogate code points (``U+D800`` " +"- ``U+DFFF``)." msgstr "" -msgid "Return a pointer to the UTF-8 encoding of the Unicode object, and store the size of the encoded representation (in bytes) in *size*. The *size* argument can be ``NULL``; in this case no size will be stored. The returned buffer always has an extra null byte appended (not included in *size*), regardless of whether there are any other null code points." +#: ../../c-api/unicode.rst:1145 +msgid "" +"Return a pointer to the UTF-8 encoding of the Unicode object, and store the " +"size of the encoded representation (in bytes) in *size*. The *size* " +"argument can be ``NULL``; in this case no size will be stored. The returned " +"buffer always has an extra null byte appended (not included in *size*), " +"regardless of whether there are any other null code points." msgstr "" -msgid "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and return ``NULL``." +#: ../../c-api/unicode.rst:1151 +msgid "" +"On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " +"return ``NULL``." msgstr "" -msgid "This caches the UTF-8 representation of the string in the Unicode object, and subsequent calls will return a pointer to the same buffer. The caller is not responsible for deallocating the buffer. The buffer is deallocated and pointers to it become invalid when the Unicode object is garbage collected." +#: ../../c-api/unicode.rst:1157 +msgid "" +"This caches the UTF-8 representation of the string in the Unicode object, " +"and subsequent calls will return a pointer to the same buffer. The caller " +"is not responsible for deallocating the buffer. The buffer is deallocated " +"and pointers to it become invalid when the Unicode object is garbage " +"collected." msgstr "" +#: ../../c-api/unicode.rst:1164 ../../c-api/unicode.rst:1186 msgid "The return type is now ``const char *`` rather than ``char *``." msgstr "" +#: ../../c-api/unicode.rst:1167 msgid "This function is a part of the :ref:`limited API `." msgstr "" +#: ../../c-api/unicode.rst:1173 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -msgid "This function does not have any special behavior for `null characters `_ embedded within *unicode*. As a result, strings containing null characters will remain in the returned string, which some C functions might interpret as the end of the string, leading to truncation. If truncation is an issue, it is recommended to use :c:func:`PyUnicode_AsUTF8AndSize` instead." +#: ../../c-api/unicode.rst:1177 +msgid "" +"This function does not have any special behavior for `null characters " +"`_ embedded within *unicode*. " +"As a result, strings containing null characters will remain in the returned " +"string, which some C functions might interpret as the end of the string, " +"leading to truncation. If truncation is an issue, it is recommended to " +"use :c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" +#: ../../c-api/unicode.rst:1191 msgid "UTF-32 Codecs" msgstr "" +#: ../../c-api/unicode.rst:1193 msgid "These are the UTF-32 codec APIs:" msgstr "" -msgid "Decode *size* bytes from a UTF-32 encoded buffer string and return the corresponding Unicode object. *errors* (if non-``NULL``) defines the error handling. It defaults to \"strict\"." +#: ../../c-api/unicode.rst:1199 +msgid "" +"Decode *size* bytes from a UTF-32 encoded buffer string and return the " +"corresponding Unicode object. *errors* (if non-``NULL``) defines the error " +"handling. It defaults to \"strict\"." msgstr "" -msgid "If *byteorder* is non-``NULL``, the decoder starts decoding using the given byte order::" +#: ../../c-api/unicode.rst:1203 ../../c-api/unicode.rst:1253 +msgid "" +"If *byteorder* is non-``NULL``, the decoder starts decoding using the given " +"byte order::" msgstr "" +#: ../../c-api/unicode.rst:1206 ../../c-api/unicode.rst:1256 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -msgid "If ``*byteorder`` is zero, and the first four bytes of the input data are a byte order mark (BOM), the decoder switches to this byte order and the BOM is not copied into the resulting Unicode string. If ``*byteorder`` is ``-1`` or ``1``, any byte order mark is copied to the output." +#: ../../c-api/unicode.rst:1210 +msgid "" +"If ``*byteorder`` is zero, and the first four bytes of the input data are a " +"byte order mark (BOM), the decoder switches to this byte order and the BOM " +"is not copied into the resulting Unicode string. If ``*byteorder`` is " +"``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -msgid "After completion, *\\*byteorder* is set to the current byte order at the end of input data." +#: ../../c-api/unicode.rst:1215 +msgid "" +"After completion, *\\*byteorder* is set to the current byte order at the end " +"of input data." msgstr "" +#: ../../c-api/unicode.rst:1218 ../../c-api/unicode.rst:1269 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" +#: ../../c-api/unicode.rst:1220 ../../c-api/unicode.rst:1271 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -msgid "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If *consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not treat trailing incomplete UTF-32 byte sequences (such as a number of bytes not divisible by four) as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*." +#: ../../c-api/unicode.rst:1226 +msgid "" +"If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " +"*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " +"treat trailing incomplete UTF-32 byte sequences (such as a number of bytes " +"not divisible by four) as an error. Those bytes will not be decoded and the " +"number of bytes that have been decoded will be stored in *consumed*." msgstr "" -msgid "Return a Python byte string using the UTF-32 encoding in native byte order. The string always starts with a BOM mark. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1235 +msgid "" +"Return a Python byte string using the UTF-32 encoding in native byte order. " +"The string always starts with a BOM mark. Error handling is \"strict\". " +"Return ``NULL`` if an exception was raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1241 msgid "UTF-16 Codecs" msgstr "" +#: ../../c-api/unicode.rst:1243 msgid "These are the UTF-16 codec APIs:" msgstr "" -msgid "Decode *size* bytes from a UTF-16 encoded buffer string and return the corresponding Unicode object. *errors* (if non-``NULL``) defines the error handling. It defaults to \"strict\"." +#: ../../c-api/unicode.rst:1249 +msgid "" +"Decode *size* bytes from a UTF-16 encoded buffer string and return the " +"corresponding Unicode object. *errors* (if non-``NULL``) defines the error " +"handling. It defaults to \"strict\"." msgstr "" -msgid "If ``*byteorder`` is zero, and the first two bytes of the input data are a byte order mark (BOM), the decoder switches to this byte order and the BOM is not copied into the resulting Unicode string. If ``*byteorder`` is ``-1`` or ``1``, any byte order mark is copied to the output (where it will result in either a ``\\ufeff`` or a ``\\ufffe`` character)." +#: ../../c-api/unicode.rst:1260 +msgid "" +"If ``*byteorder`` is zero, and the first two bytes of the input data are a " +"byte order mark (BOM), the decoder switches to this byte order and the BOM " +"is not copied into the resulting Unicode string. If ``*byteorder`` is " +"``-1`` or ``1``, any byte order mark is copied to the output (where it will " +"result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -msgid "After completion, ``*byteorder`` is set to the current byte order at the end of input data." +#: ../../c-api/unicode.rst:1266 +msgid "" +"After completion, ``*byteorder`` is set to the current byte order at the end " +"of input data." msgstr "" -msgid "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If *consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not treat trailing incomplete UTF-16 byte sequences (such as an odd number of bytes or a split surrogate pair) as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*." +#: ../../c-api/unicode.rst:1277 +msgid "" +"If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " +"*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " +"treat trailing incomplete UTF-16 byte sequences (such as an odd number of " +"bytes or a split surrogate pair) as an error. Those bytes will not be " +"decoded and the number of bytes that have been decoded will be stored in " +"*consumed*." msgstr "" -msgid "Return a Python byte string using the UTF-16 encoding in native byte order. The string always starts with a BOM mark. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1286 +msgid "" +"Return a Python byte string using the UTF-16 encoding in native byte order. " +"The string always starts with a BOM mark. Error handling is \"strict\". " +"Return ``NULL`` if an exception was raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1292 msgid "UTF-7 Codecs" msgstr "" +#: ../../c-api/unicode.rst:1294 msgid "These are the UTF-7 codec APIs:" msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1299 +msgid "" +"Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " +"*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -msgid "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If *consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will not be treated as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*." +#: ../../c-api/unicode.rst:1306 +msgid "" +"If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " +"*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " +"not be treated as an error. Those bytes will not be decoded and the number " +"of bytes that have been decoded will be stored in *consumed*." msgstr "" +#: ../../c-api/unicode.rst:1313 msgid "Unicode-Escape Codecs" msgstr "" +#: ../../c-api/unicode.rst:1315 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the Unicode-Escape encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1321 +msgid "" +"Create a Unicode object by decoding *size* bytes of the Unicode-Escape " +"encoded string *str*. Return ``NULL`` if an exception was raised by the " +"codec." msgstr "" -msgid "Encode a Unicode object using Unicode-Escape and return the result as a bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1327 +msgid "" +"Encode a Unicode object using Unicode-Escape and return the result as a " +"bytes object. Error handling is \"strict\". Return ``NULL`` if an " +"exception was raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1333 msgid "Raw-Unicode-Escape Codecs" msgstr "" +#: ../../c-api/unicode.rst:1335 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1341 +msgid "" +"Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " +"encoded string *str*. Return ``NULL`` if an exception was raised by the " +"codec." msgstr "" -msgid "Encode a Unicode object using Raw-Unicode-Escape and return the result as a bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1347 +msgid "" +"Encode a Unicode object using Raw-Unicode-Escape and return the result as a " +"bytes object. Error handling is \"strict\". Return ``NULL`` if an " +"exception was raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1353 msgid "Latin-1 Codecs" msgstr "" -msgid "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 Unicode ordinals and only these are accepted by the codecs during encoding." +#: ../../c-api/unicode.rst:1355 +msgid "" +"These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " +"Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1361 +msgid "" +"Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " +"string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -msgid "Encode a Unicode object using Latin-1 and return the result as Python bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1367 +msgid "" +"Encode a Unicode object using Latin-1 and return the result as Python bytes " +"object. Error handling is \"strict\". Return ``NULL`` if an exception was " +"raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1373 msgid "ASCII Codecs" msgstr "" -msgid "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All other codes generate errors." +#: ../../c-api/unicode.rst:1375 +msgid "" +"These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " +"other codes generate errors." msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the ASCII encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1381 +msgid "" +"Create a Unicode object by decoding *size* bytes of the ASCII encoded string " +"*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -msgid "Encode a Unicode object using ASCII and return the result as Python bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1387 +msgid "" +"Encode a Unicode object using ASCII and return the result as Python bytes " +"object. Error handling is \"strict\". Return ``NULL`` if an exception was " +"raised by the codec." msgstr "" +#: ../../c-api/unicode.rst:1393 msgid "Character Map Codecs" msgstr "" -msgid "This codec is special in that it can be used to implement many different codecs (and this is in fact what was done to obtain most of the standard codecs included in the :mod:`!encodings` package). The codec uses mappings to encode and decode characters. The mapping objects provided must support the :meth:`~object.__getitem__` mapping interface; dictionaries and sequences work well." +#: ../../c-api/unicode.rst:1395 +msgid "" +"This codec is special in that it can be used to implement many different " +"codecs (and this is in fact what was done to obtain most of the standard " +"codecs included in the :mod:`!encodings` package). The codec uses mappings " +"to encode and decode characters. The mapping objects provided must support " +"the :meth:`~object.__getitem__` mapping interface; dictionaries and " +"sequences work well." msgstr "" +#: ../../c-api/unicode.rst:1401 msgid "These are the mapping codec APIs:" msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the encoded string *str* using the given *mapping* object. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1406 +msgid "" +"Create a Unicode object by decoding *size* bytes of the encoded string *str* " +"using the given *mapping* object. Return ``NULL`` if an exception was " +"raised by the codec." msgstr "" -msgid "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* must map bytes ordinals (integers in the range from 0 to 255) to Unicode strings, integers (which are then interpreted as Unicode ordinals) or ``None``. Unmapped data bytes -- ones which cause a :exc:`LookupError`, as well as ones which get mapped to ``None``, ``0xFFFE`` or ``'\\ufffe'``, are treated as undefined mappings and cause an error." +#: ../../c-api/unicode.rst:1410 +msgid "" +"If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " +"must map bytes ordinals (integers in the range from 0 to 255) to Unicode " +"strings, integers (which are then interpreted as Unicode ordinals) or " +"``None``. Unmapped data bytes -- ones which cause a :exc:`LookupError`, as " +"well as ones which get mapped to ``None``, ``0xFFFE`` or ``'\\ufffe'``, are " +"treated as undefined mappings and cause an error." msgstr "" -msgid "Encode a Unicode object using the given *mapping* object and return the result as a bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1421 +msgid "" +"Encode a Unicode object using the given *mapping* object and return the " +"result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " +"an exception was raised by the codec." msgstr "" -msgid "The *mapping* object must map Unicode ordinal integers to bytes objects, integers in the range from 0 to 255 or ``None``. Unmapped character ordinals (ones which cause a :exc:`LookupError`) as well as mapped to ``None`` are treated as \"undefined mapping\" and cause an error." +#: ../../c-api/unicode.rst:1425 +msgid "" +"The *mapping* object must map Unicode ordinal integers to bytes objects, " +"integers in the range from 0 to 255 or ``None``. Unmapped character " +"ordinals (ones which cause a :exc:`LookupError`) as well as mapped to " +"``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" +#: ../../c-api/unicode.rst:1431 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -msgid "Translate a string by applying a character mapping table to it and return the resulting Unicode object. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1435 +msgid "" +"Translate a string by applying a character mapping table to it and return " +"the resulting Unicode object. Return ``NULL`` if an exception was raised by " +"the codec." msgstr "" -msgid "The mapping table must map Unicode ordinal integers to Unicode ordinal integers or ``None`` (causing deletion of the character)." +#: ../../c-api/unicode.rst:1439 +msgid "" +"The mapping table must map Unicode ordinal integers to Unicode ordinal " +"integers or ``None`` (causing deletion of the character)." msgstr "" -msgid "Mapping tables need only provide the :meth:`~object.__getitem__` interface; dictionaries and sequences work well. Unmapped character ordinals (ones which cause a :exc:`LookupError`) are left untouched and are copied as-is." +#: ../../c-api/unicode.rst:1442 +msgid "" +"Mapping tables need only provide the :meth:`~object.__getitem__` interface; " +"dictionaries and sequences work well. Unmapped character ordinals (ones " +"which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -msgid "*errors* has the usual meaning for codecs. It may be ``NULL`` which indicates to use the default error handling." +#: ../../c-api/unicode.rst:1446 +msgid "" +"*errors* has the usual meaning for codecs. It may be ``NULL`` which " +"indicates to use the default error handling." msgstr "" +#: ../../c-api/unicode.rst:1451 msgid "MBCS codecs for Windows" msgstr "" -msgid "These are the MBCS codec APIs. They are currently only available on Windows and use the Win32 MBCS converters to implement the conversions. Note that MBCS (or DBCS) is a class of encodings, not just one. The target encoding is defined by the user settings on the machine running the codec." +#: ../../c-api/unicode.rst:1453 +msgid "" +"These are the MBCS codec APIs. They are currently only available on Windows " +"and use the Win32 MBCS converters to implement the conversions. Note that " +"MBCS (or DBCS) is a class of encodings, not just one. The target encoding " +"is defined by the user settings on the machine running the codec." msgstr "" -msgid "Create a Unicode object by decoding *size* bytes of the MBCS encoded string *str*. Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1460 +msgid "" +"Create a Unicode object by decoding *size* bytes of the MBCS encoded string " +"*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -msgid "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If *consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not decode trailing lead byte and the number of bytes that have been decoded will be stored in *consumed*." +#: ../../c-api/unicode.rst:1467 +msgid "" +"If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " +"*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " +"decode trailing lead byte and the number of bytes that have been decoded " +"will be stored in *consumed*." msgstr "" -msgid "Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page specified by *code_page*." +#: ../../c-api/unicode.rst:1476 +msgid "" +"Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " +"specified by *code_page*." msgstr "" -msgid "Encode a Unicode object using MBCS and return the result as Python bytes object. Error handling is \"strict\". Return ``NULL`` if an exception was raised by the codec." +#: ../../c-api/unicode.rst:1482 +msgid "" +"Encode a Unicode object using MBCS and return the result as Python bytes " +"object. Error handling is \"strict\". Return ``NULL`` if an exception was " +"raised by the codec." msgstr "" -msgid "Encode the Unicode object using the specified code page and return a Python bytes object. Return ``NULL`` if an exception was raised by the codec. Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." +#: ../../c-api/unicode.rst:1489 +msgid "" +"Encode the Unicode object using the specified code page and return a Python " +"bytes object. Return ``NULL`` if an exception was raised by the codec. " +"Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" +#: ../../c-api/unicode.rst:1499 msgid "Methods and Slot Functions" msgstr "" -msgid "The following APIs are capable of handling Unicode objects and strings on input (we refer to them as strings in the descriptions) and return Unicode objects or integers as appropriate." +#: ../../c-api/unicode.rst:1501 +msgid "" +"The following APIs are capable of handling Unicode objects and strings on " +"input (we refer to them as strings in the descriptions) and return Unicode " +"objects or integers as appropriate." msgstr "" +#: ../../c-api/unicode.rst:1505 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" +#: ../../c-api/unicode.rst:1510 msgid "Concat two strings giving a new Unicode string." msgstr "" -msgid "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most *maxsplit* splits will be done. If negative, no limit is set. Separators are not included in the resulting list." +#: ../../c-api/unicode.rst:1515 +msgid "" +"Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " +"splitting will be done at all whitespace substrings. Otherwise, splits " +"occur at the given separator. At most *maxsplit* splits will be done. If " +"negative, no limit is set. Separators are not included in the resulting " +"list." msgstr "" +#: ../../c-api/unicode.rst:1520 ../../c-api/unicode.rst:1530 +#: ../../c-api/unicode.rst:1551 ../../c-api/unicode.rst:1564 msgid "On error, return ``NULL`` with an exception set." msgstr "" +#: ../../c-api/unicode.rst:1522 msgid "Equivalent to :py:meth:`str.split`." msgstr "" -msgid "Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning at the end of the string." +#: ../../c-api/unicode.rst:1527 +msgid "" +"Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " +"at the end of the string." msgstr "" +#: ../../c-api/unicode.rst:1532 msgid "Equivalent to :py:meth:`str.rsplit`." msgstr "" -msgid "Split a Unicode string at line breaks, returning a list of Unicode strings. CRLF is considered to be one line break. If *keepends* is ``0``, the Line break characters are not included in the resulting strings." +#: ../../c-api/unicode.rst:1537 +msgid "" +"Split a Unicode string at line breaks, returning a list of Unicode strings. " +"CRLF is considered to be one line break. If *keepends* is ``0``, the Line " +"break characters are not included in the resulting strings." msgstr "" -msgid "Split a Unicode string at the first occurrence of *sep*, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings." +#: ../../c-api/unicode.rst:1544 +msgid "" +"Split a Unicode string at the first occurrence of *sep*, and return a 3-" +"tuple containing the part before the separator, the separator itself, and " +"the part after the separator. If the separator is not found, return a 3-" +"tuple containing the string itself, followed by two empty strings." msgstr "" +#: ../../c-api/unicode.rst:1549 ../../c-api/unicode.rst:1562 msgid "*sep* must not be empty." msgstr "" +#: ../../c-api/unicode.rst:1553 msgid "Equivalent to :py:meth:`str.partition`." msgstr "" -msgid "Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the last occurrence of *sep*. If the separator is not found, return a 3-tuple containing two empty strings, followed by the string itself." +#: ../../c-api/unicode.rst:1558 +msgid "" +"Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " +"last occurrence of *sep*. If the separator is not found, return a 3-tuple " +"containing two empty strings, followed by the string itself." msgstr "" +#: ../../c-api/unicode.rst:1566 msgid "Equivalent to :py:meth:`str.rpartition`." msgstr "" -msgid "Join a sequence of strings using the given *separator* and return the resulting Unicode string." +#: ../../c-api/unicode.rst:1571 +msgid "" +"Join a sequence of strings using the given *separator* and return the " +"resulting Unicode string." msgstr "" -msgid "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." +#: ../../c-api/unicode.rst:1578 +msgid "" +"Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " +"end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " +"a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -msgid "Return the first position of *substr* in ``unicode[start:end]`` using the given *direction* (*direction* == ``1`` means to do a forward search, *direction* == ``-1`` a backward search). The return value is the index of the first match; a value of ``-1`` indicates that no match was found, and ``-2`` indicates that an error occurred and an exception has been set." +#: ../../c-api/unicode.rst:1586 +msgid "" +"Return the first position of *substr* in ``unicode[start:end]`` using the " +"given *direction* (*direction* == ``1`` means to do a forward search, " +"*direction* == ``-1`` a backward search). The return value is the index of " +"the first match; a value of ``-1`` indicates that no match was found, and " +"``-2`` indicates that an error occurred and an exception has been set." msgstr "" -msgid "Return the first position of the character *ch* in ``unicode[start:end]`` using the given *direction* (*direction* == ``1`` means to do a forward search, *direction* == ``-1`` a backward search). The return value is the index of the first match; a value of ``-1`` indicates that no match was found, and ``-2`` indicates that an error occurred and an exception has been set." +#: ../../c-api/unicode.rst:1596 +msgid "" +"Return the first position of the character *ch* in ``unicode[start:end]`` " +"using the given *direction* (*direction* == ``1`` means to do a forward " +"search, *direction* == ``-1`` a backward search). The return value is the " +"index of the first match; a value of ``-1`` indicates that no match was " +"found, and ``-2`` indicates that an error occurred and an exception has been " +"set." msgstr "" -msgid "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." +#: ../../c-api/unicode.rst:1604 +msgid "" +"*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -msgid "Return the number of non-overlapping occurrences of *substr* in ``unicode[start:end]``. Return ``-1`` if an error occurred." +#: ../../c-api/unicode.rst:1611 +msgid "" +"Return the number of non-overlapping occurrences of *substr* in " +"``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -msgid "Replace at most *maxcount* occurrences of *substr* in *unicode* with *replstr* and return the resulting Unicode object. *maxcount* == ``-1`` means replace all occurrences." +#: ../../c-api/unicode.rst:1618 +msgid "" +"Replace at most *maxcount* occurrences of *substr* in *unicode* with " +"*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " +"means replace all occurrences." msgstr "" -msgid "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, and greater than, respectively." +#: ../../c-api/unicode.rst:1625 +msgid "" +"Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " +"and greater than, respectively." msgstr "" -msgid "This function returns ``-1`` upon failure, so one should call :c:func:`PyErr_Occurred` to check for errors." +#: ../../c-api/unicode.rst:1628 +msgid "" +"This function returns ``-1`` upon failure, so one should " +"call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +#: ../../c-api/unicode.rst:1633 msgid "The :c:func:`PyUnicode_Equal` function." msgstr "" +#: ../../c-api/unicode.rst:1638 msgid "Test if two strings are equal:" msgstr "" +#: ../../c-api/unicode.rst:1640 msgid "Return ``1`` if *a* is equal to *b*." msgstr "" +#: ../../c-api/unicode.rst:1641 msgid "Return ``0`` if *a* is not equal to *b*." msgstr "" -msgid "Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a :class:`str` object." +#: ../../c-api/unicode.rst:1642 +msgid "" +"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not " +"a :class:`str` object." msgstr "" +#: ../../c-api/unicode.rst:1645 msgid "The function always succeeds if *a* and *b* are :class:`str` objects." msgstr "" -msgid "The function works for :class:`str` subclasses, but does not honor custom ``__eq__()`` method." +#: ../../c-api/unicode.rst:1647 +msgid "" +"The function works for :class:`str` subclasses, but does not honor custom " +"``__eq__()`` method." msgstr "" +#: ../../c-api/unicode.rst:1652 msgid "The :c:func:`PyUnicode_Compare` function." msgstr "" -msgid "Compare a Unicode object with a char buffer which is interpreted as being UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false (``0``) otherwise. If the Unicode object contains surrogate code points (``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) is returned." +#: ../../c-api/unicode.rst:1659 +msgid "" +"Compare a Unicode object with a char buffer which is interpreted as being " +"UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " +"(``0``) otherwise. If the Unicode object contains surrogate code points " +"(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " +"is returned." msgstr "" +#: ../../c-api/unicode.rst:1666 ../../c-api/unicode.rst:1687 msgid "This function does not raise exceptions." msgstr "" -msgid "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* length using :c:func:`!strlen`. If the Unicode object contains null characters, false (``0``) is returned." +#: ../../c-api/unicode.rst:1673 +msgid "" +"Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " +"length using :c:func:`!strlen`. If the Unicode object contains null " +"characters, false (``0``) is returned." msgstr "" -msgid "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, ``1`` for less than, equal, and greater than, respectively. It is best to pass only ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters." +#: ../../c-api/unicode.rst:1682 +msgid "" +"Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " +"``1`` for less than, equal, and greater than, respectively. It is best to " +"pass only ASCII-encoded strings, but the function interprets the input " +"string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" +#: ../../c-api/unicode.rst:1692 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" +#: ../../c-api/unicode.rst:1694 msgid "``NULL`` in case an exception was raised" msgstr "" +#: ../../c-api/unicode.rst:1695 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" +#: ../../c-api/unicode.rst:1696 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -msgid "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." +#: ../../c-api/unicode.rst:1698 +msgid "" +"Possible values for *op* " +"are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, " +"and :c:macro:`Py_LE`." msgstr "" -msgid "Return a new string object from *format* and *args*; this is analogous to ``format % args``." +#: ../../c-api/unicode.rst:1704 +msgid "" +"Return a new string object from *format* and *args*; this is analogous to " +"``format % args``." msgstr "" -msgid "Check whether *substr* is contained in *unicode* and return true or false accordingly." +#: ../../c-api/unicode.rst:1710 +msgid "" +"Check whether *substr* is contained in *unicode* and return true or false " +"accordingly." msgstr "" -msgid "*substr* has to coerce to a one element Unicode string. ``-1`` is returned if there was an error." +#: ../../c-api/unicode.rst:1713 +msgid "" +"*substr* has to coerce to a one element Unicode string. ``-1`` is returned " +"if there was an error." msgstr "" -msgid "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the address of a pointer variable pointing to a Python Unicode string object. If there is an existing interned string that is the same as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to the old string object and creating a new :term:`strong reference` to the interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and interns it." +#: ../../c-api/unicode.rst:1719 +msgid "" +"Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " +"address of a pointer variable pointing to a Python Unicode string object. " +"If there is an existing interned string that is the same " +"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " +"reference to the old string object and creating a new :term:`strong " +"reference` to the interned string object), otherwise it " +"leaves :c:expr:`*p_unicode` alone and interns it." msgstr "" -msgid "(Clarification: even though there is a lot of talk about references, think of this function as reference-neutral. You must own the object you pass in; after the call you no longer own the passed-in reference, but you newly own the result.)" +#: ../../c-api/unicode.rst:1726 +msgid "" +"(Clarification: even though there is a lot of talk about references, think " +"of this function as reference-neutral. You must own the object you pass in; " +"after the call you no longer own the passed-in reference, but you newly own " +"the result.)" msgstr "" -msgid "This function never raises an exception. On error, it leaves its argument unchanged without interning it." +#: ../../c-api/unicode.rst:1731 +msgid "" +"This function never raises an exception. On error, it leaves its argument " +"unchanged without interning it." msgstr "" -msgid "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- as with any other error -- the argument is left unchanged." +#: ../../c-api/unicode.rst:1734 +msgid "" +"Instances of subclasses of :py:class:`str` may not be interned, that " +"is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, " +"then -- as with any other error -- the argument is left unchanged." msgstr "" -msgid "Note that interned strings are not “immortal”. You must keep a reference to the result to benefit from interning." +#: ../../c-api/unicode.rst:1738 +msgid "" +"Note that interned strings are not “immortal”. You must keep a reference to " +"the result to benefit from interning." msgstr "" -msgid "A combination of :c:func:`PyUnicode_FromString` and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated strings." +#: ../../c-api/unicode.rst:1744 +msgid "" +"A combination of :c:func:`PyUnicode_FromString` " +"and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated " +"strings." msgstr "" -msgid "Return a new (\"owned\") reference to either a new Unicode string object that has been interned, or an earlier interned string object with the same value." +#: ../../c-api/unicode.rst:1747 +msgid "" +"Return a new (\"owned\") reference to either a new Unicode string object " +"that has been interned, or an earlier interned string object with the same " +"value." msgstr "" -msgid "Python may keep a reference to the result, or make it :term:`immortal`, preventing it from being garbage-collected promptly. For interning an unbounded number of different strings, such as ones coming from user input, prefer calling :c:func:`PyUnicode_FromString` and :c:func:`PyUnicode_InternInPlace` directly." +#: ../../c-api/unicode.rst:1751 +msgid "" +"Python may keep a reference to the result, or make it :term:`immortal`, " +"preventing it from being garbage-collected promptly. For interning an " +"unbounded number of different strings, such as ones coming from user input, " +"prefer calling :c:func:`PyUnicode_FromString` " +"and :c:func:`PyUnicode_InternInPlace` directly." msgstr "" -msgid "Return a non-zero value if *str* is interned, zero if not. The *str* argument must be a string; this is not checked. This function always succeeds." +#: ../../c-api/unicode.rst:1760 +msgid "" +"Return a non-zero value if *str* is interned, zero if not. The *str* " +"argument must be a string; this is not checked. This function always " +"succeeds." msgstr "" -msgid "A non-zero return value may carry additional information about *how* the string is interned. The meaning of such non-zero values, as well as each specific string's intern-related details, may change between CPython versions." +#: ../../c-api/unicode.rst:1766 +msgid "" +"A non-zero return value may carry additional information about *how* the " +"string is interned. The meaning of such non-zero values, as well as each " +"specific string's intern-related details, may change between CPython " +"versions." msgstr "" +#: ../../c-api/unicode.rst:1773 msgid "PyUnicodeWriter" msgstr "" -msgid "The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:`str` object." +#: ../../c-api/unicode.rst:1775 +msgid "" +"The :c:type:`PyUnicodeWriter` API can be used to create a " +"Python :class:`str` object." msgstr "" +#: ../../c-api/unicode.rst:1782 msgid "A Unicode writer instance." msgstr "" -msgid "The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on success, or :c:func:`PyUnicodeWriter_Discard` on error." +#: ../../c-api/unicode.rst:1784 +msgid "" +"The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on " +"success, or :c:func:`PyUnicodeWriter_Discard` on error." msgstr "" +#: ../../c-api/unicode.rst:1789 msgid "Create a Unicode writer instance." msgstr "" +#: ../../c-api/unicode.rst:1791 msgid "*length* must be greater than or equal to ``0``." msgstr "" -msgid "If *length* is greater than ``0``, preallocate an internal buffer of *length* characters." +#: ../../c-api/unicode.rst:1793 +msgid "" +"If *length* is greater than ``0``, preallocate an internal buffer of " +"*length* characters." msgstr "" +#: ../../c-api/unicode.rst:1796 ../../c-api/unicode.rst:1802 msgid "Set an exception and return ``NULL`` on error." msgstr "" -msgid "Return the final Python :class:`str` object and destroy the writer instance." +#: ../../c-api/unicode.rst:1800 +msgid "" +"Return the final Python :class:`str` object and destroy the writer instance." msgstr "" +#: ../../c-api/unicode.rst:1804 ../../c-api/unicode.rst:1812 msgid "The writer instance is invalid after this call." msgstr "" +#: ../../c-api/unicode.rst:1808 msgid "Discard the internal Unicode buffer and destroy the writer instance." msgstr "" +#: ../../c-api/unicode.rst:1810 msgid "If *writer* is ``NULL``, no operation is performed." msgstr "" +#: ../../c-api/unicode.rst:1816 msgid "Write the single Unicode character *ch* into *writer*." msgstr "" -msgid "On success, return ``0``. On error, set an exception, leave the writer unchanged, and return ``-1``." +#: ../../c-api/unicode.rst:1818 ../../c-api/unicode.rst:1828 +#: ../../c-api/unicode.rst:1843 ../../c-api/unicode.rst:1853 +#: ../../c-api/unicode.rst:1862 ../../c-api/unicode.rst:1869 +#: ../../c-api/unicode.rst:1882 ../../c-api/unicode.rst:1897 +#: ../../c-api/unicode.rst:1904 ../../c-api/unicode.rst:1923 +msgid "" +"On success, return ``0``. On error, set an exception, leave the writer " +"unchanged, and return ``-1``." msgstr "" -msgid "Decode the string *str* from UTF-8 in strict mode and write the output into *writer*." +#: ../../c-api/unicode.rst:1823 +msgid "" +"Decode the string *str* from UTF-8 in strict mode and write the output into " +"*writer*." msgstr "" -msgid "*size* is the string length in bytes. If *size* is equal to ``-1``, call ``strlen(str)`` to get the string length." +#: ../../c-api/unicode.rst:1825 ../../c-api/unicode.rst:1837 +#: ../../c-api/unicode.rst:1912 +msgid "" +"*size* is the string length in bytes. If *size* is equal to ``-1``, call " +"``strlen(str)`` to get the string length." msgstr "" +#: ../../c-api/unicode.rst:1831 msgid "See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`." msgstr "" +#: ../../c-api/unicode.rst:1835 msgid "Write the ASCII string *str* into *writer*." msgstr "" -msgid "*str* must only contain ASCII characters. The behavior is undefined if *str* contains non-ASCII characters." +#: ../../c-api/unicode.rst:1840 +msgid "" +"*str* must only contain ASCII characters. The behavior is undefined if *str* " +"contains non-ASCII characters." msgstr "" +#: ../../c-api/unicode.rst:1848 msgid "Write the wide string *str* into *writer*." msgstr "" -msgid "*size* is a number of wide characters. If *size* is equal to ``-1``, call ``wcslen(str)`` to get the string length." +#: ../../c-api/unicode.rst:1850 +msgid "" +"*size* is a number of wide characters. If *size* is equal to ``-1``, call " +"``wcslen(str)`` to get the string length." msgstr "" +#: ../../c-api/unicode.rst:1858 msgid "Writer the UCS4 string *str* into *writer*." msgstr "" +#: ../../c-api/unicode.rst:1860 msgid "*size* is a number of UCS4 characters." msgstr "" -msgid "Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*." +#: ../../c-api/unicode.rst:1867 +msgid "" +"Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*." msgstr "" -msgid "To write a :class:`str` subclass which overrides the :meth:`~object.__str__` method, :c:func:`PyUnicode_FromObject` can be used to get the original string." +#: ../../c-api/unicode.rst:1872 +msgid "" +"To write a :class:`str` subclass which overrides the :meth:`~object.__str__` " +"method, :c:func:`PyUnicode_FromObject` can be used to get the original " +"string." msgstr "" -msgid "Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*." +#: ../../c-api/unicode.rst:1878 +msgid "" +"Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*." msgstr "" +#: ../../c-api/unicode.rst:1880 msgid "If *obj* is ``NULL``, write the string ``\"\"`` into *writer*." msgstr "" +#: ../../c-api/unicode.rst:1887 msgid "Added support for ``NULL``." msgstr "" +#: ../../c-api/unicode.rst:1891 msgid "Write the substring ``str[start:end]`` into *writer*." msgstr "" -msgid "*str* must be Python :class:`str` object. *start* must be greater than or equal to 0, and less than or equal to *end*. *end* must be less than or equal to *str* length." +#: ../../c-api/unicode.rst:1893 +msgid "" +"*str* must be Python :class:`str` object. *start* must be greater than or " +"equal to 0, and less than or equal to *end*. *end* must be less than or " +"equal to *str* length." msgstr "" -msgid "Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly into *writer*." +#: ../../c-api/unicode.rst:1902 +msgid "" +"Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " +"into *writer*." msgstr "" -msgid "Decode the string *str* from UTF-8 with *errors* error handler and write the output into *writer*." +#: ../../c-api/unicode.rst:1909 +msgid "" +"Decode the string *str* from UTF-8 with *errors* error handler and write the " +"output into *writer*." msgstr "" -msgid "*errors* is an :ref:`error handler ` name, such as ``\"replace\"``. If *errors* is ``NULL``, use the strict error handler." +#: ../../c-api/unicode.rst:1915 +msgid "" +"*errors* is an :ref:`error handler ` name, such as " +"``\"replace\"``. If *errors* is ``NULL``, use the strict error handler." msgstr "" -msgid "If *consumed* is not ``NULL``, set *\\*consumed* to the number of decoded bytes on success. If *consumed* is ``NULL``, treat trailing incomplete UTF-8 byte sequences as an error." +#: ../../c-api/unicode.rst:1918 +msgid "" +"If *consumed* is not ``NULL``, set *\\*consumed* to the number of decoded " +"bytes on success. If *consumed* is ``NULL``, treat trailing incomplete UTF-8 " +"byte sequences as an error." msgstr "" +#: ../../c-api/unicode.rst:1926 msgid "See also :c:func:`PyUnicodeWriter_WriteUTF8`." msgstr "" +#: ../../c-api/unicode.rst:1929 msgid "Deprecated API" msgstr "" +#: ../../c-api/unicode.rst:1931 msgid "The following API is deprecated." msgstr "" -msgid "This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit type depending on the platform. Please use :c:type:`wchar_t` directly instead." +#: ../../c-api/unicode.rst:1935 +msgid "" +"This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " +"type depending on the platform. Please use :c:type:`wchar_t` directly " +"instead." msgstr "" -msgid "In previous versions, this was a 16-bit type or a 32-bit type depending on whether you selected a \"narrow\" or \"wide\" Unicode version of Python at build time." +#: ../../c-api/unicode.rst:1939 +msgid "" +"In previous versions, this was a 16-bit type or a 32-bit type depending on " +"whether you selected a \"narrow\" or \"wide\" Unicode version of Python at " +"build time." msgstr "" -msgid "Do nothing and return ``0``. This API is kept only for backward compatibility, but there are no plans to remove it." +#: ../../c-api/unicode.rst:1949 +msgid "" +"Do nothing and return ``0``. This API is kept only for backward " +"compatibility, but there are no plans to remove it." msgstr "" -msgid "This API does nothing since Python 3.12. Previously, this needed to be called for each string created using the old API (:c:func:`!PyUnicode_FromUnicode` or similar)." +#: ../../c-api/unicode.rst:1955 +msgid "" +"This API does nothing since Python 3.12. Previously, this needed to be " +"called for each string created using the old API (:c:func:`!" +"PyUnicode_FromUnicode` or similar)." msgstr "" -msgid "Do nothing and return ``1``. This API is kept only for backward compatibility, but there are no plans to remove it." +#: ../../c-api/unicode.rst:1963 +msgid "" +"Do nothing and return ``1``. This API is kept only for backward " +"compatibility, but there are no plans to remove it." msgstr "" -msgid "This API does nothing since Python 3.12. Previously, this could be called to check if :c:func:`PyUnicode_READY` is necessary." +#: ../../c-api/unicode.rst:1969 +msgid "" +"This API does nothing since Python 3.12. Previously, this could be called to " +"check if :c:func:`PyUnicode_READY` is necessary." msgstr "" diff --git a/c-api/utilities.po b/c-api/utilities.po index eb3b64e10..6996cb319 100644 --- a/c-api/utilities.po +++ b/c-api/utilities.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,8 +24,14 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/utilities.rst:7 msgid "Utilities" msgstr "" -msgid "The functions in this chapter perform various utility tasks, ranging from helping C code be more portable across platforms, using Python modules from C, and parsing function arguments and constructing Python values from C values." +#: ../../c-api/utilities.rst:9 +msgid "" +"The functions in this chapter perform various utility tasks, ranging from " +"helping C code be more portable across platforms, using Python modules from " +"C, and parsing function arguments and constructing Python values from C " +"values." msgstr "" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index f13f554fe..bc950cab6 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,212 +21,602 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/veryhigh.rst:8 msgid "The Very High Level Layer" msgstr "" -msgid "The functions in this chapter will let you execute Python source code given in a file or a buffer, but they will not let you interact in a more detailed way with the interpreter." +#: ../../c-api/veryhigh.rst:10 +msgid "" +"The functions in this chapter will let you execute Python source code given " +"in a file or a buffer, but they will not let you interact in a more detailed " +"way with the interpreter." msgstr "" -msgid "Several of these functions accept a start symbol from the grammar as a parameter. The available start symbols are :c:data:`Py_eval_input`, :c:data:`Py_file_input`, :c:data:`Py_single_input`, and :c:data:`Py_func_type_input`. These are described following the functions which accept them as parameters." +#: ../../c-api/veryhigh.rst:14 +msgid "" +"Several of these functions accept a start symbol from the grammar as a " +"parameter. The available start symbols " +"are :c:data:`Py_eval_input`, :c:data:`Py_file_input`, :c:data:`Py_single_input`, " +"and :c:data:`Py_func_type_input`. These are described following the " +"functions which accept them as parameters." msgstr "" -msgid "Note also that several of these functions take :c:expr:`FILE*` parameters. One particular issue which needs to be handled carefully is that the :c:type:`FILE` structure for different C libraries can be different and incompatible. Under Windows (at least), it is possible for dynamically linked extensions to actually use different libraries, so care should be taken that :c:expr:`FILE*` parameters are only passed to these functions if it is certain that they were created by the same library that the Python runtime is using." +#: ../../c-api/veryhigh.rst:20 +msgid "" +"Note also that several of these functions take :c:expr:`FILE*` parameters. " +"One particular issue which needs to be handled carefully is that " +"the :c:type:`FILE` structure for different C libraries can be different and " +"incompatible. Under Windows (at least), it is possible for dynamically " +"linked extensions to actually use different libraries, so care should be " +"taken that :c:expr:`FILE*` parameters are only passed to these functions if " +"it is certain that they were created by the same library that the Python " +"runtime is using." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving *closeit* set to ``0`` and *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:31 +msgid "" +"This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " +"leaving *closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving the *closeit* argument set to ``0``." +#: ../../c-api/veryhigh.rst:37 +msgid "" +"This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " +"leaving the *closeit* argument set to ``0``." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving the *flags* argument set to ``NULL``." +#: ../../c-api/veryhigh.rst:43 +msgid "" +"This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " +"leaving the *flags* argument set to ``NULL``." msgstr "" -msgid "If *fp* refers to a file associated with an interactive device (console or terminal input or Unix pseudo-terminal), return the value of :c:func:`PyRun_InteractiveLoop`, otherwise return the result of :c:func:`PyRun_SimpleFile`. *filename* is decoded from the filesystem encoding (:func:`sys.getfilesystemencoding`). If *filename* is ``NULL``, this function uses ``\"???\"`` as the filename. If *closeit* is true, the file is closed before ``PyRun_SimpleFileExFlags()`` returns." +#: ../../c-api/veryhigh.rst:49 +msgid "" +"If *fp* refers to a file associated with an interactive device (console or " +"terminal input or Unix pseudo-terminal), return the value " +"of :c:func:`PyRun_InteractiveLoop`, otherwise return the result " +"of :c:func:`PyRun_SimpleFile`. *filename* is decoded from the filesystem " +"encoding (:func:`sys.getfilesystemencoding`). If *filename* is ``NULL``, " +"this function uses ``\"???\"`` as the filename. If *closeit* is true, the " +"file is closed before ``PyRun_SimpleFileExFlags()`` returns." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_SimpleStringFlags` below, leaving the :c:struct:`PyCompilerFlags`\\* argument set to ``NULL``." +#: ../../c-api/veryhigh.rst:61 +msgid "" +"This is a simplified interface to :c:func:`PyRun_SimpleStringFlags` below, " +"leaving the :c:struct:`PyCompilerFlags`\\* argument set to ``NULL``." msgstr "" -msgid "Executes the Python source code from *command* in the :mod:`__main__` module according to the *flags* argument. If :mod:`__main__` does not already exist, it is created. Returns ``0`` on success or ``-1`` if an exception was raised. If there was an error, there is no way to get the exception information. For the meaning of *flags*, see below." +#: ../../c-api/veryhigh.rst:67 +msgid "" +"Executes the Python source code from *command* in the :mod:`__main__` module " +"according to the *flags* argument. If :mod:`__main__` does not already " +"exist, it is created. Returns ``0`` on success or ``-1`` if an exception " +"was raised. If there was an error, there is no way to get the exception " +"information. For the meaning of *flags*, see below." msgstr "" -msgid "Note that if an otherwise unhandled :exc:`SystemExit` is raised, this function will not return ``-1``, but exit the process, as long as :c:member:`PyConfig.inspect` is zero." +#: ../../c-api/veryhigh.rst:73 +msgid "" +"Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " +"function will not return ``-1``, but exit the process, as long " +"as :c:member:`PyConfig.inspect` is zero." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, leaving *closeit* set to ``0`` and *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:80 +msgid "" +"This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, " +"leaving *closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, leaving *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:86 +msgid "" +"This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, " +"leaving *flags* set to ``NULL``." msgstr "" -msgid "Similar to :c:func:`PyRun_SimpleStringFlags`, but the Python source code is read from *fp* instead of an in-memory string. *filename* should be the name of the file, it is decoded from :term:`filesystem encoding and error handler`. If *closeit* is true, the file is closed before ``PyRun_SimpleFileExFlags()`` returns." +#: ../../c-api/veryhigh.rst:92 +msgid "" +"Similar to :c:func:`PyRun_SimpleStringFlags`, but the Python source code is " +"read from *fp* instead of an in-memory string. *filename* should be the name " +"of the file, it is decoded from :term:`filesystem encoding and error " +"handler`. If *closeit* is true, the file is closed before " +"``PyRun_SimpleFileExFlags()`` returns." msgstr "" -msgid "On Windows, *fp* should be opened as binary mode (e.g. ``fopen(filename, \"rb\")``). Otherwise, Python may not handle script file with LF line ending correctly." +#: ../../c-api/veryhigh.rst:99 +msgid "" +"On Windows, *fp* should be opened as binary mode (e.g. ``fopen(filename, " +"\"rb\")``). Otherwise, Python may not handle script file with LF line ending " +"correctly." msgstr "" -msgid "Read and execute a single statement from a file associated with an interactive device according to the *flags* argument. The user will be prompted using ``sys.ps1`` and ``sys.ps2``. *filename* must be a Python :class:`str` object." +#: ../../c-api/veryhigh.rst:105 +msgid "" +"Read and execute a single statement from a file associated with an " +"interactive device according to the *flags* argument. The user will be " +"prompted using ``sys.ps1`` and ``sys.ps2``. *filename* must be a " +"Python :class:`str` object." msgstr "" -msgid "Returns ``0`` when the input was executed successfully, ``-1`` if there was an exception, or an error code from the :file:`errcode.h` include file distributed as part of Python if there was a parse error. (Note that :file:`errcode.h` is not included by :file:`Python.h`, so must be included specifically if needed.)" +#: ../../c-api/veryhigh.rst:110 +msgid "" +"Returns ``0`` when the input was executed successfully, ``-1`` if there was " +"an exception, or an error code from the :file:`errcode.h` include file " +"distributed as part of Python if there was a parse error. (Note " +"that :file:`errcode.h` is not included by :file:`Python.h`, so must be " +"included specifically if needed.)" msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below, leaving *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:119 +msgid "" +"This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below, " +"leaving *flags* set to ``NULL``." msgstr "" -msgid "Similar to :c:func:`PyRun_InteractiveOneObject`, but *filename* is a :c:expr:`const char*`, which is decoded from the :term:`filesystem encoding and error handler`." +#: ../../c-api/veryhigh.rst:125 +msgid "" +"Similar to :c:func:`PyRun_InteractiveOneObject`, but *filename* is " +"a :c:expr:`const char*`, which is decoded from the :term:`filesystem " +"encoding and error handler`." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_InteractiveLoopFlags` below, leaving *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:132 +msgid "" +"This is a simplified interface to :c:func:`PyRun_InteractiveLoopFlags` " +"below, leaving *flags* set to ``NULL``." msgstr "" -msgid "Read and execute statements from a file associated with an interactive device until EOF is reached. The user will be prompted using ``sys.ps1`` and ``sys.ps2``. *filename* is decoded from the :term:`filesystem encoding and error handler`. Returns ``0`` at EOF or a negative number upon failure." +#: ../../c-api/veryhigh.rst:138 +msgid "" +"Read and execute statements from a file associated with an interactive " +"device until EOF is reached. The user will be prompted using ``sys.ps1`` " +"and ``sys.ps2``. *filename* is decoded from the :term:`filesystem encoding " +"and error handler`. Returns ``0`` at EOF or a negative number upon failure." msgstr "" -msgid "Can be set to point to a function with the prototype ``int func(void)``. The function will be called when Python's interpreter prompt is about to become idle and wait for user input from the terminal. The return value is ignored. Overriding this hook can be used to integrate the interpreter's prompt with other event loops, as done in :file:`Modules/_tkinter.c` in the Python source code." +#: ../../c-api/veryhigh.rst:146 +msgid "" +"Can be set to point to a function with the prototype ``int func(void)``. " +"The function will be called when Python's interpreter prompt is about to " +"become idle and wait for user input from the terminal. The return value is " +"ignored. Overriding this hook can be used to integrate the interpreter's " +"prompt with other event loops, as done in :file:`Modules/_tkinter.c` in the " +"Python source code." msgstr "" -msgid "This function is only called from the :ref:`main interpreter `." +#: ../../c-api/veryhigh.rst:154 ../../c-api/veryhigh.rst:178 +msgid "" +"This function is only called from the :ref:`main interpreter `." msgstr "" -msgid "Can be set to point to a function with the prototype ``char *func(FILE *stdin, FILE *stdout, char *prompt)``, overriding the default function used to read a single line of input at the interpreter's prompt. The function is expected to output the string *prompt* if it's not ``NULL``, and then read a line of input from the provided standard input file, returning the resulting string. For example, The :mod:`readline` module sets this hook to provide line-editing and tab-completion features." +#: ../../c-api/veryhigh.rst:161 +msgid "" +"Can be set to point to a function with the prototype ``char *func(FILE " +"*stdin, FILE *stdout, char *prompt)``, overriding the default function used " +"to read a single line of input at the interpreter's prompt. The function is " +"expected to output the string *prompt* if it's not ``NULL``, and then read a " +"line of input from the provided standard input file, returning the resulting " +"string. For example, The :mod:`readline` module sets this hook to provide " +"line-editing and tab-completion features." msgstr "" -msgid "The result must be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred." +#: ../../c-api/veryhigh.rst:170 +msgid "" +"The result must be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred." msgstr "" -msgid "The result must be allocated by :c:func:`PyMem_RawMalloc` or :c:func:`PyMem_RawRealloc`, instead of being allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`." +#: ../../c-api/veryhigh.rst:173 +msgid "" +"The result must be allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, instead of being allocated " +"by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_StringFlags` below, leaving *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:184 +msgid "" +"This is a simplified interface to :c:func:`PyRun_StringFlags` below, leaving " +"*flags* set to ``NULL``." msgstr "" -msgid "Execute Python source code from *str* in the context specified by the objects *globals* and *locals* with the compiler flags specified by *flags*. *globals* must be a dictionary; *locals* can be any object that implements the mapping protocol. The parameter *start* specifies the start symbol and must be one of the :ref:`available start symbols `." +#: ../../c-api/veryhigh.rst:190 +msgid "" +"Execute Python source code from *str* in the context specified by the " +"objects *globals* and *locals* with the compiler flags specified by " +"*flags*. *globals* must be a dictionary; *locals* can be any object that " +"implements the mapping protocol. The parameter *start* specifies the start " +"symbol and must be one of the :ref:`available start symbols `." msgstr "" -msgid "Returns the result of executing the code as a Python object, or ``NULL`` if an exception was raised." +#: ../../c-api/veryhigh.rst:196 +msgid "" +"Returns the result of executing the code as a Python object, or ``NULL`` if " +"an exception was raised." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving *closeit* set to ``0`` and *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:202 +msgid "" +"This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " +"*closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:208 +msgid "" +"This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " +"*flags* set to ``NULL``." msgstr "" -msgid "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving *closeit* set to ``0``." +#: ../../c-api/veryhigh.rst:214 +msgid "" +"This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " +"*closeit* set to ``0``." msgstr "" -msgid "Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read from *fp* instead of an in-memory string. *filename* should be the name of the file, it is decoded from the :term:`filesystem encoding and error handler`. If *closeit* is true, the file is closed before :c:func:`PyRun_FileExFlags` returns." +#: ../../c-api/veryhigh.rst:220 +msgid "" +"Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read " +"from *fp* instead of an in-memory string. *filename* should be the name of " +"the file, it is decoded from the :term:`filesystem encoding and error " +"handler`. If *closeit* is true, the file is closed " +"before :c:func:`PyRun_FileExFlags` returns." msgstr "" -msgid "This is a simplified interface to :c:func:`Py_CompileStringFlags` below, leaving *flags* set to ``NULL``." +#: ../../c-api/veryhigh.rst:229 +msgid "" +"This is a simplified interface to :c:func:`Py_CompileStringFlags` below, " +"leaving *flags* set to ``NULL``." msgstr "" -msgid "This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, with *optimize* set to ``-1``." +#: ../../c-api/veryhigh.rst:235 +msgid "" +"This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, " +"with *optimize* set to ``-1``." msgstr "" -msgid "Parse and compile the Python source code in *str*, returning the resulting code object. The start symbol is given by *start*; this can be used to constrain the code which can be compiled and should be :ref:`available start symbols `. The filename specified by *filename* is used to construct the code object and may appear in tracebacks or :exc:`SyntaxError` exception messages. This returns ``NULL`` if the code cannot be parsed or compiled." +#: ../../c-api/veryhigh.rst:241 +msgid "" +"Parse and compile the Python source code in *str*, returning the resulting " +"code object. The start symbol is given by *start*; this can be used to " +"constrain the code which can be compiled and should be :ref:`available start " +"symbols `. The filename specified by *filename* is used to " +"construct the code object and may appear in tracebacks or :exc:`SyntaxError` " +"exception messages. This returns ``NULL`` if the code cannot be parsed or " +"compiled." msgstr "" -msgid "The integer *optimize* specifies the optimization level of the compiler; a 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)." +#: ../../c-api/veryhigh.rst:249 +msgid "" +"The integer *optimize* specifies the optimization level of the compiler; a " +"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 "" -msgid "Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string decoded from the :term:`filesystem encoding and error handler`." +#: ../../c-api/veryhigh.rst:260 +msgid "" +"Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string " +"decoded from the :term:`filesystem encoding and error handler`." msgstr "" -msgid "This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the code object, and global and local variables. The other arguments are set to ``NULL``." +#: ../../c-api/veryhigh.rst:267 +msgid "" +"This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the " +"code object, and global and local variables. The other arguments are set to " +"``NULL``." msgstr "" -msgid "Evaluate a precompiled code object, given a particular environment for its evaluation. This environment consists of a dictionary of global variables, a mapping object of local variables, arrays of arguments, keywords and defaults, a dictionary of default values for :ref:`keyword-only ` arguments and a closure tuple of cells." +#: ../../c-api/veryhigh.rst:274 +msgid "" +"Evaluate a precompiled code object, given a particular environment for its " +"evaluation. This environment consists of a dictionary of global variables, " +"a mapping object of local variables, arrays of arguments, keywords and " +"defaults, a dictionary of default values for :ref:`keyword-only ` arguments and a closure tuple of cells." msgstr "" -msgid "Evaluate an execution frame. This is a simplified interface to :c:func:`PyEval_EvalFrameEx`, for backward compatibility." +#: ../../c-api/veryhigh.rst:283 +msgid "" +"Evaluate an execution frame. This is a simplified interface " +"to :c:func:`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" -msgid "This is the main, unvarnished function of Python interpretation. The code object associated with the execution frame *f* is executed, interpreting bytecode and executing calls as needed. The additional *throwflag* parameter can mostly be ignored - if true, then it causes an exception to immediately be thrown; this is used for the :meth:`~generator.throw` methods of generator objects." +#: ../../c-api/veryhigh.rst:289 +msgid "" +"This is the main, unvarnished function of Python interpretation. The code " +"object associated with the execution frame *f* is executed, interpreting " +"bytecode and executing calls as needed. The additional *throwflag* " +"parameter can mostly be ignored - if true, then it causes an exception to " +"immediately be thrown; this is used for the :meth:`~generator.throw` methods " +"of generator objects." msgstr "" -msgid "This function now includes a debug assertion to help ensure that it does not silently discard an active exception." +#: ../../c-api/veryhigh.rst:296 +msgid "" +"This function now includes a debug assertion to help ensure that it does not " +"silently discard an active exception." msgstr "" -msgid "This function changes the flags of the current evaluation frame, and returns true on success, false on failure." +#: ../../c-api/veryhigh.rst:303 +msgid "" +"This function changes the flags of the current evaluation frame, and returns " +"true on success, false on failure." msgstr "" -msgid "This is the structure used to hold compiler flags. In cases where code is only being compiled, it is passed as ``int flags``, and in cases where code is being executed, it is passed as ``PyCompilerFlags *flags``. In this case, ``from __future__ import`` can modify *flags*." +#: ../../c-api/veryhigh.rst:309 +msgid "" +"This is the structure used to hold compiler flags. In cases where code is " +"only being compiled, it is passed as ``int flags``, and in cases where code " +"is being executed, it is passed as ``PyCompilerFlags *flags``. In this " +"case, ``from __future__ import`` can modify *flags*." msgstr "" -msgid "Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags.cf_flags` is treated as equal to ``0``, and any modification due to ``from __future__ import`` is discarded." +#: ../../c-api/veryhigh.rst:314 +msgid "" +"Whenever ``PyCompilerFlags *flags`` is " +"``NULL``, :c:member:`~PyCompilerFlags.cf_flags` is treated as equal to " +"``0``, and any modification due to ``from __future__ import`` is discarded." msgstr "" +#: ../../c-api/veryhigh.rst:320 msgid "Compiler flags." msgstr "" -msgid "*cf_feature_version* is the minor Python version. It should be initialized to ``PY_MINOR_VERSION``." +#: ../../c-api/veryhigh.rst:324 +msgid "" +"*cf_feature_version* is the minor Python version. It should be initialized " +"to ``PY_MINOR_VERSION``." msgstr "" -msgid "The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` flag is set in :c:member:`~PyCompilerFlags.cf_flags`." +#: ../../c-api/veryhigh.rst:327 +msgid "" +"The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " +"flag is set in :c:member:`~PyCompilerFlags.cf_flags`." msgstr "" +#: ../../c-api/veryhigh.rst:330 msgid "Added *cf_feature_version* field." msgstr "" +#: ../../c-api/veryhigh.rst:333 msgid "The available compiler flags are accessible as macros:" msgstr "" -msgid "See :ref:`compiler flags ` in documentation of the :py:mod:`!ast` Python module, which exports these constants under the same names." +#: ../../c-api/veryhigh.rst:342 +msgid "" +"See :ref:`compiler flags ` in documentation of " +"the :py:mod:`!ast` Python module, which exports these constants under the " +"same names." +msgstr "" + +#: ../../c-api/veryhigh.rst:347 +msgid "Low-level flags" +msgstr "" + +#: ../../c-api/veryhigh.rst:348 +msgid "" +"The following flags and masks serve narrow needs of the standard library and " +"interactive interpreters. Code outside the standard library rarely has a " +"reason to use them. They are considered implementation details and may " +"change at any time." +msgstr "" + +#: ../../c-api/veryhigh.rst:355 +msgid "" +"This flag is a private interface between the compiler and the :mod:`codeop` " +"module. Do not use it; its behavior is unsupported and may change without " +"warning." +msgstr "" + +#: ../../c-api/veryhigh.rst:359 +msgid "" +"With this flag set, when compilation fails because the source text ends " +"where more input is expected, for example in the middle of an indented block " +"or an unterminated string literal, the error raised is the undocumented " +"``_IncompleteInputError``, a subclass of :exc:`SyntaxError`. " +"The :mod:`codeop` module sets this flag, together " +"with :c:macro:`PyCF_DONT_IMPLY_DEDENT`, to tell input that is incomplete " +"apart from input with a real syntax error, so that interactive interpreters " +"know when to prompt for another line instead of reporting an error." +msgstr "" + +#: ../../c-api/veryhigh.rst:373 +msgid "" +"By default, when compiling with the :c:var:`Py_single_input` start symbol, " +"reaching the end of the source text implicitly closes any open indented " +"blocks. With this flag set, open blocks are only closed if the last line of " +"the source ends with a newline; otherwise, compilation fails with " +"a :exc:`SyntaxError`:" msgstr "" -msgid "The \"``PyCF``\" flags above can be combined with \"``CO_FUTURE``\" flags such as :c:macro:`CO_FUTURE_ANNOTATIONS` to enable features normally selectable using :ref:`future statements `. See :ref:`c_codeobject_flags` for a complete list." +#: ../../c-api/veryhigh.rst:379 +msgid "" +"PyCompilerFlags flags = {\n" +" .cf_flags = 0,\n" +" .cf_feature_version = PY_MINOR_VERSION,\n" +"};\n" +"const char *source = \"if a:\\n pass\";\n" +"\n" +"/* The \"if\" block is closed implicitly;\n" +" this returns a code object: */\n" +"Py_CompileStringFlags(source, \"\", Py_single_input, &flags);\n" +"\n" +"/* With the flag, this fails with a SyntaxError,\n" +" because the last line does not end with a newline: */\n" +"flags.cf_flags = PyCF_DONT_IMPLY_DEDENT;\n" +"Py_CompileStringFlags(source, \"\", Py_single_input, &flags);" +msgstr "" + +#: ../../c-api/veryhigh.rst:396 +msgid "" +"The :mod:`codeop` module uses this flag to detect incomplete interactive " +"input. While the user is still typing inside an indented block, the source " +"does not yet end with a newline, so it fails to compile and the user is " +"prompted for another line." +msgstr "" + +#: ../../c-api/veryhigh.rst:403 +msgid "" +"Read the source text as UTF-8, ignoring its :pep:`263` encoding declaration " +"(\"coding cookie\"), if any:" +msgstr "" + +#: ../../c-api/veryhigh.rst:406 +msgid "" +"PyCompilerFlags flags = {\n" +" .cf_flags = 0,\n" +" .cf_feature_version = PY_MINOR_VERSION,\n" +"};\n" +"const char *source = \"# coding: latin-1\\ns = '\\xe9'\\n\";\n" +"\n" +"/* The coding cookie is honored: byte 0xE9 is decoded as\n" +" Latin-1, and this returns a code object that sets s to \"é\": */\n" +"Py_CompileStringFlags(source, \"\", Py_file_input, &flags);\n" +"\n" +"/* With the flag, the cookie is ignored and compilation fails\n" +" with a SyntaxError, because 0xE9 is not valid UTF-8: */\n" +"flags.cf_flags = PyCF_IGNORE_COOKIE;\n" +"Py_CompileStringFlags(source, \"\", Py_file_input, &flags);" +msgstr "" + +#: ../../c-api/veryhigh.rst:423 +msgid "" +"The :func:`compile`, :func:`eval` and :func:`exec` built-in functions set " +"this flag when the source is a :class:`str` object, because they pass the " +"text to the parser encoded as UTF-8." +msgstr "" + +#: ../../c-api/veryhigh.rst:429 +msgid "" +"Mark the source text as known to be UTF-8 encoded. " +"The :func:`compile`, :func:`eval` and :func:`exec` built-in functions set " +"this flag, but it currently has no effect." msgstr "" +#: ../../c-api/veryhigh.rst:433 +msgid "" +"The \"``PyCF``\" flags above can be combined with \"``CO_FUTURE``\" flags " +"such as :c:macro:`CO_FUTURE_ANNOTATIONS` to enable features normally " +"selectable using :ref:`future statements `. " +"See :ref:`c_codeobject_flags` for a complete list." +msgstr "" + +#: ../../c-api/veryhigh.rst:438 +msgid "The following masks combine several flags:" +msgstr "" + +#: ../../c-api/veryhigh.rst:442 +msgid "" +"Bitmask of all ``CO_FUTURE`` flags (see :ref:`c_codeobject_flags`), which " +"select features normally enabled by :ref:`future statements `. When " +"code compiled with a ``PyCompilerFlags *flags`` argument contains a ``from " +"__future__ import`` statement, the flag for the imported feature is added to " +"*flags*, so that code executed later in the same context inherits it." +msgstr "" + +#: ../../c-api/veryhigh.rst:452 +msgid "" +"Do not use this mask in new code. It is kept only so that old code passing " +"its flags to :func:`compile` keeps working." +msgstr "" + +#: ../../c-api/veryhigh.rst:455 +msgid "" +"Bitmask of flags for obsolete future features that no longer have any effect." +msgstr "" + +#: ../../c-api/veryhigh.rst:460 +msgid "" +"Bitmask of all ``PyCF`` flags that change how the source is compiled, such " +"as :c:macro:`PyCF_ONLY_AST`. The :func:`compile` built-in function uses this " +"mask to validate its *flags* argument." +msgstr "" + +#: ../../c-api/veryhigh.rst:469 msgid "Available start symbols" msgstr "" -msgid "The start symbol from the Python grammar for isolated expressions; for use with :c:func:`Py_CompileString`." +#: ../../c-api/veryhigh.rst:476 +msgid "" +"The start symbol from the Python grammar for isolated expressions; for use " +"with :c:func:`Py_CompileString`." msgstr "" -msgid "The start symbol from the Python grammar for sequences of statements as read from a file or other source; for use with :c:func:`Py_CompileString`. This is the symbol to use when compiling arbitrarily long Python source code." +#: ../../c-api/veryhigh.rst:484 +msgid "" +"The start symbol from the Python grammar for sequences of statements as read " +"from a file or other source; for use with :c:func:`Py_CompileString`. This " +"is the symbol to use when compiling arbitrarily long Python source code." msgstr "" -msgid "The start symbol from the Python grammar for a single statement; for use with :c:func:`Py_CompileString`. This is the symbol used for the interactive interpreter loop." +#: ../../c-api/veryhigh.rst:493 +msgid "" +"The start symbol from the Python grammar for a single statement; for use " +"with :c:func:`Py_CompileString`. This is the symbol used for the interactive " +"interpreter loop." msgstr "" -msgid "The start symbol from the Python grammar for a function type; for use with :c:func:`Py_CompileString`. This is used to parse \"signature type comments\" from :pep:`484`." +#: ../../c-api/veryhigh.rst:502 +msgid "" +"The start symbol from the Python grammar for a function type; for use " +"with :c:func:`Py_CompileString`. This is used to parse \"signature type " +"comments\" from :pep:`484`." msgstr "" +#: ../../c-api/veryhigh.rst:506 msgid "This requires the :c:macro:`PyCF_ONLY_AST` flag to be set." msgstr "" +#: ../../c-api/veryhigh.rst:509 msgid ":py:class:`ast.FunctionType`" msgstr "" +#: ../../c-api/veryhigh.rst:510 msgid ":pep:`484`" msgstr "" +#: ../../c-api/veryhigh.rst:516 msgid "Stack Effects" msgstr "" +#: ../../c-api/veryhigh.rst:519 msgid ":py:func:`dis.stack_effect`" msgstr "" +#: ../../c-api/veryhigh.rst:524 msgid "Sentinel value representing an invalid stack effect." msgstr "" +#: ../../c-api/veryhigh.rst:526 msgid "This is currently equivalent to ``INT_MAX``." msgstr "" +#: ../../c-api/veryhigh.rst:533 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -msgid "On success, this function returns the stack effect; on failure, this returns :c:macro:`PY_INVALID_STACK_EFFECT`." +#: ../../c-api/veryhigh.rst:535 ../../c-api/veryhigh.rst:549 +msgid "" +"On success, this function returns the stack effect; on failure, this " +"returns :c:macro:`PY_INVALID_STACK_EFFECT`." msgstr "" -msgid "Similar to :c:func:`PyCompile_OpcodeStackEffect`, but don't include the stack effect of jumping if *jump* is zero." +#: ../../c-api/veryhigh.rst:543 +msgid "" +"Similar to :c:func:`PyCompile_OpcodeStackEffect`, but don't include the " +"stack effect of jumping if *jump* is zero." msgstr "" -msgid "If *jump* is ``0``, this will not include the stack effect of jumping, but if *jump* is ``1`` or ``-1``, this will include it." +#: ../../c-api/veryhigh.rst:546 +msgid "" +"If *jump* is ``0``, this will not include the stack effect of jumping, but " +"if *jump* is ``1`` or ``-1``, this will include it." msgstr "" +#: ../../c-api/veryhigh.rst:474 ../../c-api/veryhigh.rst:482 +#: ../../c-api/veryhigh.rst:491 ../../c-api/veryhigh.rst:500 msgid "Py_CompileString (C function)" msgstr "" diff --git a/c-api/weakref.po b/c-api/weakref.po index 5fb003089..9c8651815 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,71 +23,149 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../c-api/weakref.rst:6 msgid "Weak Reference Objects" msgstr "" -msgid "Python supports *weak references* as first-class objects. There are two specific object types which directly implement weak references. The first is a simple reference object, and the second acts as a proxy for the original object as much as it can." +#: ../../c-api/weakref.rst:8 +msgid "" +"Python supports *weak references* as first-class objects. There are two " +"specific object types which directly implement weak references. The first " +"is a simple reference object, and the second acts as a proxy for the " +"original object as much as it can." msgstr "" -msgid "Return non-zero if *ob* is either a reference or proxy object. This function always succeeds." +#: ../../c-api/weakref.rst:16 +msgid "" +"Return non-zero if *ob* is either a reference or proxy object. This " +"function always succeeds." msgstr "" -msgid "Return non-zero if *ob* is a reference object or a subclass of the reference type. This function always succeeds." +#: ../../c-api/weakref.rst:22 +msgid "" +"Return non-zero if *ob* is a reference object or a subclass of the reference " +"type. This function always succeeds." msgstr "" -msgid "Return non-zero if *ob* is a reference object, but not a subclass of the reference type. This function always succeeds." +#: ../../c-api/weakref.rst:28 +msgid "" +"Return non-zero if *ob* is a reference object, but not a subclass of the " +"reference type. This function always succeeds." msgstr "" -msgid "Return non-zero if *ob* is a proxy object. This function always succeeds." +#: ../../c-api/weakref.rst:34 +msgid "" +"Return non-zero if *ob* is a proxy object. This function always succeeds." msgstr "" -msgid "Return a weak reference object for the object *ob*. This will always return a new reference, but is not guaranteed to create a new object; an existing reference object may be returned. The second parameter, *callback*, can be a callable object that receives notification when *ob* is garbage collected; it should accept a single parameter, which will be the weak reference object itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a weakly referenceable object, or if *callback* is not callable, ``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`." +#: ../../c-api/weakref.rst:39 +msgid "" +"Return a weak reference object for the object *ob*. This will always return " +"a new reference, but is not guaranteed to create a new object; an existing " +"reference object may be returned. The second parameter, *callback*, can be " +"a callable object that receives notification when *ob* is garbage collected; " +"it should accept a single parameter, which will be the weak reference object " +"itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a " +"weakly referenceable object, this will raise :exc:`TypeError` and return " +"``NULL``." msgstr "" -msgid ":c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly referenceable." +#: ../../c-api/weakref.rst:49 ../../c-api/weakref.rst:65 +msgid "" +":c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly " +"referenceable." msgstr "" -msgid "Return a weak reference proxy object for the object *ob*. This will always return a new reference, but is not guaranteed to create a new object; an existing proxy object may be returned. The second parameter, *callback*, can be a callable object that receives notification when *ob* is garbage collected; it should accept a single parameter, which will be the weak reference object itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a weakly referenceable object, or if *callback* is not callable, ``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`." +#: ../../c-api/weakref.rst:55 +msgid "" +"Return a weak reference proxy object for the object *ob*. This will always " +"return a new reference, but is not guaranteed to create a new object; an " +"existing proxy object may be returned. The second parameter, *callback*, " +"can be a callable object that receives notification when *ob* is garbage " +"collected; it should accept a single parameter, which will be the weak " +"reference object itself. *callback* may also be ``None`` or ``NULL``. If " +"*ob* weakly referenceable object, this will raise :exc:`TypeError` and " +"return ``NULL``." msgstr "" -msgid "Get a :term:`strong reference` to the referenced object from a weak reference, *ref*, into *\\*pobj*." +#: ../../c-api/weakref.rst:71 +msgid "" +"Get a :term:`strong reference` to the referenced object from a weak " +"reference, *ref*, into *\\*pobj*." msgstr "" -msgid "On success, set *\\*pobj* to a new :term:`strong reference` to the referenced object and return 1." +#: ../../c-api/weakref.rst:74 +msgid "" +"On success, set *\\*pobj* to a new :term:`strong reference` to the " +"referenced object and return 1." msgstr "" +#: ../../c-api/weakref.rst:76 msgid "If the reference is dead, set *\\*pobj* to ``NULL`` and return 0." msgstr "" +#: ../../c-api/weakref.rst:77 msgid "On error, raise an exception and return -1." msgstr "" -msgid "Return a :term:`borrowed reference` to the referenced object from a weak reference, *ref*. If the referent is no longer live, returns ``Py_None``." +#: ../../c-api/weakref.rst:84 +msgid "" +"Return a :term:`borrowed reference` to the referenced object from a weak " +"reference, *ref*. If the referent is no longer live, returns ``Py_None``." msgstr "" -msgid "This function returns a :term:`borrowed reference` to the referenced object. This means that you should always call :c:func:`Py_INCREF` on the object except when it cannot be destroyed before the last usage of the borrowed reference." +#: ../../c-api/weakref.rst:89 +msgid "" +"This function returns a :term:`borrowed reference` to the referenced object. " +"This means that you should always call :c:func:`Py_INCREF` on the object " +"except when it cannot be destroyed before the last usage of the borrowed " +"reference." msgstr "" +#: ../../c-api/weakref.rst:94 ../../c-api/weakref.rst:102 msgid "Use :c:func:`PyWeakref_GetRef` instead." msgstr "" +#: ../../c-api/weakref.rst:100 msgid "Similar to :c:func:`PyWeakref_GetObject`, but does no error checking." msgstr "" -msgid "Test if the weak reference *ref* is dead. Returns 1 if the reference is dead, 0 if it is alive, and -1 with an error set if *ref* is not a weak reference object." +#: ../../c-api/weakref.rst:108 +msgid "" +"Test if the weak reference *ref* is dead. Returns 1 if the reference is " +"dead, 0 if it is alive, and -1 with an error set if *ref* is not a weak " +"reference object." msgstr "" -msgid "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler to clear weak references." +#: ../../c-api/weakref.rst:117 +msgid "" +"This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " +"to clear weak references." msgstr "" -msgid "This iterates through the weak references for *object* and calls callbacks for those references which have one. It returns when all callbacks have been attempted." +#: ../../c-api/weakref.rst:120 +msgid "" +"This iterates through the weak references for *object* and calls callbacks " +"for those references which have one. It returns when all callbacks have been " +"attempted." msgstr "" +#: ../../c-api/weakref.rst:127 msgid "Clears the weakrefs for *object* without calling the callbacks." msgstr "" -msgid "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler for types with finalizers (i.e., :meth:`~object.__del__`). The handler for those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs and call their callbacks, then the finalizer, and finally this function to clear any weakrefs that may have been created by the finalizer." +#: ../../c-api/weakref.rst:129 +msgid "" +"This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " +"for types with finalizers (i.e., :meth:`~object.__del__`). The handler for " +"those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs " +"and call their callbacks, then the finalizer, and finally this function to " +"clear any weakrefs that may have been created by the finalizer." msgstr "" -msgid "In most circumstances, it's more appropriate to use :c:func:`PyObject_ClearWeakRefs` to clear weakrefs instead of this function." +#: ../../c-api/weakref.rst:135 +msgid "" +"In most circumstances, it's more appropriate to " +"use :c:func:`PyObject_ClearWeakRefs` to clear weakrefs instead of this " +"function." msgstr "" diff --git a/contents.po b/contents.po index b6427159e..1823d26e8 100644 --- a/contents.po +++ b/contents.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-17 04:35+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,5 +24,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../contents.rst:3 msgid "Python Documentation contents" msgstr "محتویات اسناد پایتون" diff --git a/copyright.po b/copyright.po index 8381c9346..51e1a7f03 100644 --- a/copyright.po +++ b/copyright.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:47+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,23 +25,40 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../copyright.rst:3 msgid "Copyright" msgstr "حق نشر" +#: ../../copyright.rst:5 msgid "Python and this documentation is:" msgstr "پایتون و این مستندات:" +#: ../../copyright.rst:7 msgid "Copyright © 2001 Python Software Foundation. All rights reserved." msgstr "حق نشر © 2001 بنیاد نرم‌افزار پایتون. تمامی حقوق محفوظ است." +#: ../../copyright.rst:9 msgid "Copyright © 2000 BeOpen.com. All rights reserved." msgstr "حق نشر © 2000 BeOpen.com. تمامی حقوق محفوظ است." -msgid "Copyright © 1995-2000 Corporation for National Research Initiatives. All rights reserved." -msgstr "حق نشر © 1995-2000 متعلق به Corporation for National Research Initiatives. تمامی حقوق محفوظ است." +#: ../../copyright.rst:11 +msgid "" +"Copyright © 1995-2000 Corporation for National Research Initiatives. All " +"rights reserved." +msgstr "" +"حق نشر © 1995-2000 متعلق به Corporation for National Research Initiatives. " +"تمامی حقوق محفوظ است." -msgid "Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved." -msgstr "حق نشر © 1991-1995 Stichting Mathematisch Centrum. تمامی حقوق محفوظ است." +#: ../../copyright.rst:14 +msgid "" +"Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved." +msgstr "" +"حق نشر © 1991-1995 Stichting Mathematisch Centrum. تمامی حقوق محفوظ است." -msgid "See :ref:`history-and-license` for complete license and permissions information." -msgstr "مراجعه کنید به :ref:`history-and-license` برای اطلاعات کامل مجوز و مجوز‌های استفاده." +#: ../../copyright.rst:18 +msgid "" +"See :ref:`history-and-license` for complete license and permissions " +"information." +msgstr "" +"مراجعه کنید به :ref:`history-and-license` برای اطلاعات کامل مجوز و مجوز‌های " +"استفاده." diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index 85a203521..5f9b32928 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-08-02 14:17+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,18 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 msgid "Pending removal in Python 3.14" msgstr "" -msgid "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules (:pep:`699`; :gh:`101193`)." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 +msgid "" +"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " +"(:pep:`699`; :gh:`101193`)." msgstr "" -msgid "Creating :c:data:`immutable types ` with mutable bases (:gh:`95388`)." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 +msgid "" +"Creating :c:data:`immutable types ` with mutable " +"bases (:gh:`95388`)." msgstr "" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 23ccfde58..e7a2eca2b 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-08-02 14:17+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,137 +21,276 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 msgid "Pending removal in Python 3.15" msgstr "" -msgid "The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:`PyImport_ImportModule` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -msgid ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " +"`__ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -msgid ":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:type:`wchar_t` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -msgid ":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" -msgid ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; Note that some codecs (for example, \"base64\") may return a type other than :class:`str`, such as :class:`bytes`." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." msgstr "" -msgid ":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" -msgid ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; Note that some codecs (for example, \"base64\") may return a type other than :class:`bytes`, such as :class:`str`." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" msgstr "" -msgid ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") ` (:data:`sys.path`) instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." msgstr "" -msgid ":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") ` (:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " +"if :ref:`virtual environments ` need to be handled." msgstr "" -msgid ":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys.base_exec_prefix`) instead. Use :c:func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to be handled." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." msgstr "" -msgid ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys.executable`) instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." msgstr "" -msgid ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys.executable`) instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." msgstr "" -msgid ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:`PYTHONHOME` environment variable instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -msgid "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" -msgid "Functions to configure Python's initialization, deprecated in Python 3.11:" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." msgstr "" -msgid ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." msgstr "" -msgid ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." msgstr "" -msgid "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:`PyConfig` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" msgstr "" -msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " +"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" -msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:`PyConfig_Get(\"verbose\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " +"or :c:func:`PyConfig_Get(\"verbose\") ` instead." msgstr "" -msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:`PyConfig_Get(\"quiet\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " +"or :c:func:`PyConfig_Get(\"quiet\") ` instead." msgstr "" -msgid ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:`PyConfig_Get(\"interactive\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " +"or :c:func:`PyConfig_Get(\"interactive\") ` instead." msgstr "" -msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:`PyConfig_Get(\"inspect\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " +"or :c:func:`PyConfig_Get(\"inspect\") ` instead." msgstr "" -msgid ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " +"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:`PyConfig_Get(\"site_import\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " +"or :c:func:`PyConfig_Get(\"site_import\") ` instead." msgstr "" -msgid ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " +"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -msgid ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " +"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -msgid ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -msgid ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -msgid ":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig.user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` " +"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" -msgid ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " +"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" -msgid ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." msgstr "" -msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:`PyConfig_Get(\"isolated\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " +"or :c:func:`PyConfig_Get(\"isolated\") ` instead." msgstr "" -msgid ":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " +"instead." msgstr "" -msgid ":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig.legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` " +"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" -msgid ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig.filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` " +"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" -msgid ":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig.filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` " +"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" -msgid ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:`Py_PreInitialize`)" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " +"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -msgid "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to get these options at runtime." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " +"be used to get these options at runtime." msgstr "" diff --git a/deprecations/c-api-pending-removal-in-3.16.po b/deprecations/c-api-pending-removal-in-3.16.po index b686d7df8..0b0694ed4 100644 --- a/deprecations/c-api-pending-removal-in-3.16.po +++ b/deprecations/c-api-pending-removal-in-3.16.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-17 04:35+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,8 +19,10 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../deprecations/c-api-pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.16.rst:4 msgid "The bundled copy of ``libmpdec``." msgstr "" diff --git a/deprecations/c-api-pending-removal-in-3.18.po b/deprecations/c-api-pending-removal-in-3.18.po index f5e1f7aff..d09bca6f8 100644 --- a/deprecations/c-api-pending-removal-in-3.18.po +++ b/deprecations/c-api-pending-removal-in-3.18.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,68 +19,129 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 msgid "Pending removal in Python 3.18" msgstr "" -msgid "The following private functions are deprecated and planned for removal in Python 3.18:" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." msgstr "" -msgid ":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: " +"use :c:func:`PyDict_GetItemStringRef`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." msgstr "" -msgid ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:`PyLongWriter_Create`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " +"use :c:func:`PyLongWriter_Create`." msgstr "" -msgid ":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: " +"use :c:func:`PyThreadState_GetUnchecked`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` with :c:func:`writer = PyUnicodeWriter_Create(0) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_Finish`: replace ``_PyUnicodeWriter_Finish(&writer)`` with :c:func:`PyUnicodeWriter_Finish(writer) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` " +"with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_Dealloc`: replace ``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:`PyUnicodeWriter_Discard(writer) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` " +"with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteChar`: replace ``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " +"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteStr`: replace ``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:`PyUnicodeWriter_WriteStr(writer, str) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace ``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " +"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace ``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:`PyUnicodeWriter_WriteASCII(writer, str) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:33 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteASCII(writer, str) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace ``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:42 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." msgstr "" -msgid "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. (Contributed by Victor Stinner in :gh:`128863`.)" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:44 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index 3db8fd8ac..645c4df29 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-08-02 14:17+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,62 +21,100 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/c-api-pending-removal-in-future.rst:2 msgid "Pending removal in future versions" msgstr "" -msgid "The following APIs are deprecated and will be removed, although there is currently no date scheduled for their removal." +#: ../../deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:7 msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -msgid ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." msgstr "" -msgid ":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -msgid ":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr "" -msgid ":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr "" -msgid ":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" -msgid ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" msgstr "" -msgid ":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr "" -msgid ":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr "" -msgid ":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr "" -msgid ":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr "" diff --git a/deprecations/index.po b/deprecations/index.po index a98b0b009..cbbf60ef3 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-07-29 04:07+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,147 +21,257 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/index.rst:2 msgid "Deprecations" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 +#: ../../deprecations/pending-removal-in-3.15.rst:2 msgid "Pending removal in Python 3.15" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 msgid "The import system:" msgstr "" -msgid "Setting :attr:`~module.__cached__` on a module while failing to set :attr:`__spec__.cached ` is deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take into consideration by the import system or standard library. (:gh:`97879`)" +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" -msgid "Setting :attr:`~module.__package__` on a module while failing to set :attr:`__spec__.parent ` is deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or take into consideration by the import system or standard library. (:gh:`97879`)" +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" msgstr "" -msgid "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr "" -msgid "The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has been deprecated since Python 3.13. No direct replacement exists. *Anything* is better than CGI to interface a web server with a request handler." +#: ../../deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -msgid "The :option:`!--cgi` flag to the :program:`python -m http.server` command-line interface has been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`importlib`:" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "``load_module()`` method: use ``exec_module()`` instead." msgstr "" -msgid ":class:`locale`:" -msgstr "" - -msgid "The :func:`~locale.getdefaultlocale` function has been deprecated since Python 3.11. Its removal was originally planned for Python 3.13 (:gh:`90817`), but has been postponed to Python 3.15. Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" -msgstr "" - +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":mod:`pathlib`:" msgstr "" -msgid ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :func:`os.path.isreserved` to detect reserved paths on Windows." +#: ../../deprecations/pending-removal-in-3.15.rst:38 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`platform`:" msgstr "" -msgid ":func:`~platform.java_ver` has been deprecated since Python 3.13. This function is only useful for Jython support, has a confusing API, and is largely untested." +#: ../../deprecations/pending-removal-in-3.15.rst:44 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.16.rst:96 msgid ":mod:`sysconfig`:" msgstr "" -msgid "The *check_home* argument of :func:`sysconfig.is_python_build` has been deprecated since Python 3.12." +#: ../../deprecations/pending-removal-in-3.15.rst:50 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`threading`:" msgstr "" -msgid ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any arguments has been deprecated since Python 3.14, as the Python version does not permit any arguments, but the C version allows any number of positional or keyword arguments, ignoring every argument." +#: ../../deprecations/pending-removal-in-3.15.rst:55 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid ":mod:`types`:" msgstr "" -msgid ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +#: ../../deprecations/pending-removal-in-3.15.rst:63 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr "" -msgid "The undocumented keyword argument syntax for creating :class:`~typing.NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python 3.13. Use the class-based syntax or the functional syntax instead." +#: ../../deprecations/pending-removal-in-3.15.rst:72 +msgid "" +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" -msgid "When using the functional syntax of :class:`~typing.TypedDict`\\s, failing to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +#: ../../deprecations/pending-removal-in-3.15.rst:78 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." msgstr "" -msgid "The :func:`typing.no_type_check_decorator` decorator function has been deprecated since Python 3.13. After eight years in the :mod:`typing` module, it has yet to be supported by any major type checker." +#: ../../deprecations/pending-removal-in-3.15.rst:85 +msgid "" +"The :deco:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:90 msgid ":mod:`wave`:" msgstr "" -msgid "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.15.rst:92 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:97 msgid ":mod:`zipimport`:" msgstr "" -msgid ":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python 3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed by Jiahao Li in :gh:`125746`.)" +#: ../../deprecations/pending-removal-in-3.15.rst:99 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" msgstr "" -msgid "Setting :attr:`~module.__loader__` on a module while failing to set :attr:`__spec__.loader ` is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or taken into consideration by the import system or the standard library." +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader ` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr "" -msgid "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in documentation since Python 3.3 and at runtime since Python 3.13. Use the ``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr "" -msgid ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -msgid ":mod:`asyncio` policy system is deprecated and will be removed in Python 3.16. In particular, the following classes and functions are deprecated:" +#: ../../deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" msgstr "" -msgid "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with *loop_factory* to use the desired event loop implementation." +#: ../../deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" "import asyncio\n" "\n" @@ -171,554 +281,1035 @@ msgid "" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:50 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid ":mod:`builtins`:" msgstr "" -msgid "Bitwise inversion on boolean types, ``~True`` or ``~False`` has been deprecated since Python 3.12, as it produces surprising and unintuitive results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation of a Boolean. In the rare case that you need the bitwise inversion of the underlying integer, convert to ``int`` explicitly (``~int(x)``)." +#: ../../deprecations/pending-removal-in-3.16.rst:52 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:59 msgid ":mod:`functools`:" msgstr "" -msgid "Calling the Python implementation of :func:`functools.reduce` with *function* or *sequence* as keyword arguments has been deprecated since Python 3.14." +#: ../../deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" msgstr "" -msgid "Support for custom logging handlers with the *strm* argument is deprecated and scheduled for removal in Python 3.16. Define handlers with the *stream* argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +#: ../../deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:70 msgid ":mod:`mimetypes`:" msgstr "" -msgid "Valid extensions start with a '.' or are empty for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:`75223`.)" +#: ../../deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty " +"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " +"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " +"Kemenade in :gh:`75223`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" msgstr "" -msgid "The :class:`!ExecError` exception has been deprecated since Python 3.14. It has not been used by any function in :mod:`!shutil` since Python 3.4, and is now an alias of :exc:`RuntimeError`." +#: ../../deprecations/pending-removal-in-3.16.rst:80 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:85 msgid ":mod:`symtable`:" msgstr "" -msgid "The :meth:`Class.get_methods ` method has been deprecated since Python 3.14." +#: ../../deprecations/pending-removal-in-3.16.rst:87 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:90 msgid ":mod:`sys`:" msgstr "" -msgid "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable instead." +#: ../../deprecations/pending-removal-in-3.16.rst:92 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." msgstr "" -msgid "The :func:`!sysconfig.expand_makefile_vars` function has been deprecated since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` instead." +#: ../../deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" msgstr "" -msgid "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.17.rst:2 msgid "Pending removal in Python 3.17" msgstr "" +#: ../../deprecations/pending-removal-in-3.17.rst:4 msgid ":mod:`collections.abc`:" msgstr "" -msgid ":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +#: ../../deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." msgstr "" -msgid "Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` implements the :ref:`buffer protocol ` at runtime. For use in type annotations, either use :class:`~collections.abc.Buffer` or a union that explicitly specifies the types your code supports (e.g., ``bytes | bytearray | memoryview``)." +#: ../../deprecations/pending-removal-in-3.17.rst:8 +#: ../../deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." msgstr "" -msgid ":class:`!ByteString` was originally intended to be an abstract class that would serve as a supertype of both :class:`bytes` and :class:`bytearray`. However, since the ABC never had any methods, knowing that an object was an instance of :class:`!ByteString` never actually told you anything useful about the object. Other common buffer types such as :class:`memoryview` were also never understood as subtypes of :class:`!ByteString` (either at runtime or by static type checkers)." +#: ../../deprecations/pending-removal-in-3.17.rst:14 +#: ../../deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." msgstr "" -msgid "See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by Shantanu Jain in :gh:`91896`.)" +#: ../../deprecations/pending-removal-in-3.17.rst:22 +#: ../../deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" msgstr "" -msgid "Before Python 3.14, old-style unions were implemented using the private class ``typing._UnionGenericAlias``. This class is no longer needed for the implementation, but it has been retained for backward compatibility, with removal scheduled for Python 3.17. Users should use documented introspection helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead of relying on private implementation details." +#: ../../deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." msgstr "" -msgid ":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in Python 3.17." +#: ../../deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:2 +#: ../../deprecations/pending-removal-in-3.18.rst:2 msgid "Pending removal in Python 3.18" msgstr "" +#: ../../deprecations/pending-removal-in-3.18.rst:4 msgid ":mod:`decimal`:" msgstr "" -msgid "The non-standard and undocumented :class:`~decimal.Decimal` format specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C implementation, has been deprecated since Python 3.13. (Contributed by Serhiy Storchaka in :gh:`89902`.)" +#: ../../deprecations/pending-removal-in-3.18.rst:6 +msgid "" +"The non-standard and undocumented :class:`~decimal.Decimal` format specifier " +"``'N'``, which is only supported in the :mod:`!decimal` module's C " +"implementation, has been deprecated since Python 3.13. (Contributed by " +"Serhiy Storchaka in :gh:`89902`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" msgstr "" -msgid "Implicitly switching to the MSVC-compatible struct layout by setting :attr:`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." +#: ../../deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by " +"setting :attr:`~ctypes.Structure._pack_` but " +"not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:2 +#: ../../deprecations/pending-removal-in-future.rst:2 msgid "Pending removal in future versions" msgstr "" -msgid "The following APIs will be removed in the future, although there is currently no date scheduled for their removal." +#: ../../deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:7 msgid ":mod:`argparse`:" msgstr "" -msgid "Nesting argument groups and nesting mutually exclusive groups are deprecated." +#: ../../deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." msgstr "" -msgid "Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +#: ../../deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* " +"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." msgstr "" -msgid "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single argument signature." +#: ../../deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." msgstr "" -msgid "Currently Python accepts numeric literals immediately followed by keywords, for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised if the numeric literal is immediately followed by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it will be changed to a syntax error. (:gh:`87999`)" +#: ../../deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" -msgid "Support for ``__index__()`` and ``__int__()`` method returning non-int type: these methods will be required to return an instance of a strict subclass of :class:`int`." +#: ../../deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." msgstr "" -msgid "Support for ``__float__()`` method returning a strict subclass of :class:`float`: these methods will be required to return an instance of :class:`float`." +#: ../../deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" -msgid "Support for ``__complex__()`` method returning a strict subclass of :class:`complex`: these methods will be required to return an instance of :class:`complex`." +#: ../../deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" -msgid "Passing a complex number as the *real* or *imag* argument in the :func:`complex` constructor is now deprecated; it should only be passed as a single positional argument. (Contributed by Serhiy Storchaka in :gh:`109218`.)" +#: ../../deprecations/pending-removal-in-future.rst:38 +msgid "" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" -msgid ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +#: ../../deprecations/pending-removal-in-future.rst:43 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" -msgid ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:`133038`)" +#: ../../deprecations/pending-removal-in-future.rst:48 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " +"(:gh:`133038`)" msgstr "" -msgid ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method instead." +#: ../../deprecations/pending-removal-in-future.rst:50 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:53 msgid ":mod:`datetime`:" msgstr "" -msgid ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime.UTC)``." +#: ../../deprecations/pending-removal-in-future.rst:55 +msgid "" +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -msgid ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +#: ../../deprecations/pending-removal-in-future.rst:57 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:60 msgid ":mod:`gettext`: Plural value must be an integer." msgstr "" -msgid ":func:`~importlib.util.cache_from_source` *debug_override* parameter is deprecated: use the *optimization* parameter instead." +#: ../../deprecations/pending-removal-in-future.rst:64 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:67 msgid ":mod:`importlib.metadata`:" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "``EntryPoints`` tuple interface." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:70 msgid "Implicit ``None`` on return values." msgstr "" -msgid ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, use :meth:`~logging.warning` instead." +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." msgstr "" -msgid ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use BytesIO and binary mode instead." +#: ../../deprecations/pending-removal-in-future.rst:75 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." msgstr "" -msgid ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +#: ../../deprecations/pending-removal-in-future.rst:78 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr "" -msgid ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is deprecated, use an exception instance." +#: ../../deprecations/pending-removal-in-future.rst:80 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." msgstr "" -msgid ":mod:`re`: More strict rules are now applied for numerical group references and group names in regular expressions. Only sequence of ASCII digits is now accepted as a numerical reference. The group name in bytes patterns and replacement strings can now only contain ASCII letters and digits and underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +#: ../../deprecations/pending-removal-in-future.rst:83 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -msgid ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +#: ../../deprecations/pending-removal-in-future.rst:90 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr "" -msgid ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in Python 3.12; use the *onexc* parameter instead." +#: ../../deprecations/pending-removal-in-future.rst:92 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:95 msgid ":mod:`ssl` options and protocols:" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:97 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "" -msgid ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +#: ../../deprecations/pending-removal-in-future.rst:98 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.OP_NO_SSL*`` options" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.OP_NO_TLS*`` options" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLS``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.TLSVersion.SSLv3``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.TLSVersion.TLSv1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr "" -msgid ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`." +#: ../../deprecations/pending-removal-in-future.rst:114 +msgid "" +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr "" -msgid ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :attr:`threading.Thread.daemon` attribute." +#: ../../deprecations/pending-removal-in-future.rst:116 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" -msgid ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :attr:`threading.Thread.name` attribute." +#: ../../deprecations/pending-removal-in-future.rst:118 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr "" -msgid "The internal class ``typing._UnionGenericAlias`` is no longer used to implement :class:`typing.Union`. To preserve compatibility with users using this private class, a compatibility shim will be provided until at least Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +#: ../../deprecations/pending-removal-in-future.rst:125 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" -msgid ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value that is not ``None`` from a test case." +#: ../../deprecations/pending-removal-in-future.rst:130 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." msgstr "" -msgid ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead" +#: ../../deprecations/pending-removal-in-future.rst:133 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitattr()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splithost()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splitnport()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splitpasswd()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitport()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitquery()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splittag()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splittype()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splituser()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splitvalue()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``to_bytes()``" msgstr "" -msgid ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial writes." +#: ../../deprecations/pending-removal-in-future.rst:147 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." msgstr "" -msgid ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it will always return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests instead." +#: ../../deprecations/pending-removal-in-future.rst:150 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -msgid ":func:`sys._clear_type_cache` is deprecated: use :func:`sys._clear_internal_caches` instead." +#: ../../deprecations/pending-removal-in-future.rst:155 +msgid "" +":func:`sys._clear_type_cache` is deprecated: " +"use :func:`sys._clear_internal_caches` instead." msgstr "" +#: ../../deprecations/index.rst:17 msgid "C API deprecations" msgstr "" -msgid "The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:`PyImport_ImportModule` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -msgid ":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project " +"`__ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older." msgstr "" -msgid ":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:type:`wchar_t` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -msgid ":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" -msgid ":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; Note that some codecs (for example, \"base64\") may return a type other than :class:`str`, such as :class:`bytes`." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." msgstr "" -msgid ":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" -msgid ":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; Note that some codecs (for example, \"base64\") may return a type other than :class:`bytes`, such as :class:`str`." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:22 msgid "Python initialization functions, deprecated in Python 3.13:" msgstr "" -msgid ":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") ` (:data:`sys.path`) instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." msgstr "" -msgid ":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") ` (:data:`sys.base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:`virtual environments ` need to be handled." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) " +"if :ref:`virtual environments ` need to be handled." msgstr "" -msgid ":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys.base_exec_prefix`) instead. Use :c:func:`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to be handled." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. " +"Use :c:func:`PyConfig_Get(\"exec_prefix\") ` " +"(:data:`sys.exec_prefix`) if :ref:`virtual environments ` need to " +"be handled." msgstr "" -msgid ":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys.executable`) instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." msgstr "" -msgid ":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys.executable`) instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." msgstr "" -msgid ":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:`PYTHONHOME` environment variable instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -msgid "The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." msgstr "" -msgid "Functions to configure Python's initialization, deprecated in Python 3.11:" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:54 msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:56 msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." msgstr "" -msgid ":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:60 msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." msgstr "" -msgid ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." msgstr "" -msgid "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:`PyConfig` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:68 msgid "Global configuration variables:" msgstr "" -msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` " +"or :c:func:`PyConfig_Get(\"parser_debug\") ` instead." msgstr "" -msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:`PyConfig_Get(\"verbose\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` " +"or :c:func:`PyConfig_Get(\"verbose\") ` instead." msgstr "" -msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:`PyConfig_Get(\"quiet\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` " +"or :c:func:`PyConfig_Get(\"quiet\") ` instead." msgstr "" -msgid ":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:`PyConfig_Get(\"interactive\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` " +"or :c:func:`PyConfig_Get(\"interactive\") ` instead." msgstr "" -msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:`PyConfig_Get(\"inspect\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` " +"or :c:func:`PyConfig_Get(\"inspect\") ` instead." msgstr "" -msgid ":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " +"or :c:func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:`PyConfig_Get(\"site_import\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` " +"or :c:func:`PyConfig_Get(\"site_import\") ` instead." msgstr "" -msgid ":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` " +"or :c:func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -msgid ":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` " +"or :c:func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -msgid ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -msgid ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -msgid ":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig.user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` " +"or :c:func:`PyConfig_Get(\"user_site_directory\") ` instead." msgstr "" -msgid ":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " +"or :c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" -msgid ":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." msgstr "" -msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:`PyConfig_Get(\"isolated\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` " +"or :c:func:`PyConfig_Get(\"isolated\") ` instead." msgstr "" -msgid ":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` " +"or :c:func:`PyConfig_Get(\"legacy_windows_fs_encoding\") ` " +"instead." msgstr "" -msgid ":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig.legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` " +"or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") ` instead." msgstr "" -msgid ":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig.filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` " +"or :c:func:`PyConfig_Get(\"filesystem_encoding\") ` instead." msgstr "" -msgid ":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig.filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` " +"or :c:func:`PyConfig_Get(\"filesystem_errors\") ` instead." msgstr "" -msgid ":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:`Py_PreInitialize`)" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` " +"or :c:func:`PyConfig_Get(\"utf8_mode\") ` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -msgid "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to get these options at runtime." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can " +"be used to get these options at runtime." msgstr "" -msgid "The following private functions are deprecated and planned for removal in Python 3.18:" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:7 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." msgstr "" -msgid ":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: " +"use :c:func:`PyDict_GetItemStringRef`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:9 msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:10 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." msgstr "" -msgid ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:`PyLongWriter_Create`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: " +"use :c:func:`PyLongWriter_Create`." msgstr "" -msgid ":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: " +"use :c:func:`PyThreadState_GetUnchecked`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:14 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` with :c:func:`writer = PyUnicodeWriter_Create(0) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_Finish`: replace ``_PyUnicodeWriter_Finish(&writer)`` with :c:func:`PyUnicodeWriter_Finish(writer) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` " +"with :c:func:`PyUnicodeWriter_Finish(writer) `." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_Dealloc`: replace ``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:`PyUnicodeWriter_Discard(writer) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` " +"with :c:func:`PyUnicodeWriter_Discard(writer) `." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteChar`: replace ``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` " +"with :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteStr`: replace ``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:`PyUnicodeWriter_WriteStr(writer, str) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace ``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` " +"with :c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace ``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:`PyUnicodeWriter_WriteASCII(writer, str) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:33 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteASCII(writer, str) " +"`." msgstr "" -msgid ":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace ``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) `." +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` " +"with :c:func:`PyUnicodeWriter_WriteUTF8(writer, str) " +"`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:39 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:40 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:41 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:42 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." msgstr "" -msgid "The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. (Contributed by Victor Stinner in :gh:`128863`.)" +#: ../../deprecations/c-api-pending-removal-in-3.18.rst:44 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" msgstr "" -msgid "The following APIs are deprecated and will be removed, although there is currently no date scheduled for their removal." +#: ../../deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:7 msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -msgid ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." msgstr "" -msgid ":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -msgid ":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr "" -msgid ":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr "" -msgid ":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" -msgid ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" msgstr "" -msgid ":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr "" -msgid ":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr "" -msgid ":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr "" -msgid ":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:41 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr "" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index cc9cc8e16..9acb73b40 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-17 04:35+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-07-26 14:16+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,101 +21,134 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending removal in Python 3.13" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:4 msgid "Modules (see :pep:`594`):" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:6 msgid ":mod:`!aifc`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:7 msgid ":mod:`!audioop`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:8 msgid ":mod:`!cgi`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:9 msgid ":mod:`!cgitb`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:10 msgid ":mod:`!chunk`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:11 msgid ":mod:`!crypt`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:12 msgid ":mod:`!imghdr`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:13 msgid ":mod:`!mailcap`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:14 msgid ":mod:`!msilib`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:15 msgid ":mod:`!nis`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:16 msgid ":mod:`!nntplib`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:17 msgid ":mod:`!ossaudiodev`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:18 msgid ":mod:`!pipes`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:19 msgid ":mod:`!sndhdr`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:20 msgid ":mod:`!spwd`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:21 msgid ":mod:`!sunau`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:22 msgid ":mod:`!telnetlib`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:23 msgid ":mod:`!uu`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:24 msgid ":mod:`!xdrlib`" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:26 msgid "Other modules:" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:28 msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:30 msgid "APIs:" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:32 msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:33 msgid "``locale.resetlocale()`` (:gh:`90817`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:34 msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:35 msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:36 msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:37 msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:38 msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:39 msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.13.rst:40 msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" msgstr "" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index a46f5eb0a..69ea372a5 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-07-20 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,101 +21,181 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/pending-removal-in-3.14.rst:2 msgid "Pending removal in Python 3.14" msgstr "" -msgid ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. (Contributed by Nikita Sobolev in :gh:`92248`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:4 +msgid "" +":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" +"argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " +"(Contributed by Nikita Sobolev in :gh:`92248`.)" msgstr "" -msgid ":mod:`ast`: The following features have been deprecated in documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at runtime when they are accessed or used, and will be removed in Python 3.14:" +#: ../../deprecations/pending-removal-in-3.14.rst:9 +msgid "" +":mod:`ast`: The following features have been deprecated in documentation " +"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +"runtime when they are accessed or used, and will be removed in Python 3.14:" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr "" -msgid "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:`90953`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:19 +msgid "" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +"in :gh:`90953`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":mod:`asyncio`:" msgstr "" -msgid "The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:24 +msgid "" +"The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` " +"and :class:`!asyncio.SafeChildWatcher` are deprecated and will be removed in " +"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -msgid ":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:30 +msgid "" +":func:`!asyncio.set_child_watcher`, :func:`!" +"asyncio.get_child_watcher`, :meth:`!" +"asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " +"be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -msgid "The :meth:`~asyncio.get_event_loop` method of the default event loop policy now emits a :exc:`DeprecationWarning` if there is no current event loop set and it decides to create one. (Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:36 +msgid "" +"The :meth:`~asyncio.get_event_loop` method of the default event loop policy " +"now emits a :exc:`DeprecationWarning` if there is no current event loop set " +"and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " +"Rossum in :gh:`100160`.)" msgstr "" -msgid ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:41 +msgid "" +":mod:`email`: Deprecated the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:44 msgid ":mod:`importlib.abc` deprecated classes:" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:46 msgid ":class:`!importlib.abc.ResourceReader`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid ":class:`!importlib.abc.Traversable`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid ":class:`!importlib.abc.TraversableResources`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`importlib.resources.abc.Traversable`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:55 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "" -msgid ":mod:`itertools` had undocumented, inefficient, historically buggy, and inconsistent support for copy, deepcopy, and pickle operations. This will be removed in 3.14 for a significant reduction in code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:57 +msgid "" +":mod:`itertools` had undocumented, inefficient, historically buggy, and " +"inconsistent support for copy, deepcopy, and pickle operations. This will be " +"removed in 3.14 for a significant reduction in code volume and maintenance " +"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" msgstr "" -msgid ":mod:`multiprocessing`: The default start method will change to a safer one on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). Adding a runtime warning about this was deemed too disruptive as the majority of code is not expected to care. Use the :func:`~multiprocessing.get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +#: ../../deprecations/pending-removal-in-3.14.rst:63 +msgid "" +":mod:`multiprocessing`: The default start method will change to a safer one " +"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " +"currently the default (:gh:`84559`). Adding a runtime warning about this was " +"deemed too disruptive as the majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" -msgid ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is deprecated." +#: ../../deprecations/pending-removal-in-3.14.rst:71 +msgid "" +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " +"deprecated." msgstr "" -msgid ":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:75 +msgid "" +":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " +"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " +"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:80 msgid ":mod:`pty`:" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:82 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:83 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:85 msgid ":mod:`sqlite3`:" msgstr "" +#: ../../deprecations/pending-removal-in-3.14.rst:87 msgid ":data:`!version` and :data:`!version_info`." msgstr "" -msgid ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:`dict`." +#: ../../deprecations/pending-removal-in-3.14.rst:89 +msgid "" +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +"if :ref:`named placeholders ` are used and " +"*parameters* is a sequence instead of a :class:`dict`." msgstr "" -msgid ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not intended to be a public API. (Contributed by Gregory P. Smith in :gh:`88168`.)" +#: ../../deprecations/pending-removal-in-3.14.rst:93 +msgid "" +":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +"intended to be a public API. (Contributed by Gregory P. Smith " +"in :gh:`88168`.)" msgstr "" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 0030131e7..e9c0990f4 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-07-20 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,95 +21,168 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/pending-removal-in-3.15.rst:2 msgid "Pending removal in Python 3.15" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:4 msgid "The import system:" msgstr "" -msgid "Setting :attr:`~module.__cached__` on a module while failing to set :attr:`__spec__.cached ` is deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take into consideration by the import system or standard library. (:gh:`97879`)" +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached ` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" -msgid "Setting :attr:`~module.__package__` on a module while failing to set :attr:`__spec__.parent ` is deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or take into consideration by the import system or standard library. (:gh:`97879`)" +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent ` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr "" -msgid "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr "" -msgid "The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has been deprecated since Python 3.13. No direct replacement exists. *Anything* is better than CGI to interface a web server with a request handler." +#: ../../deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -msgid "The :option:`!--cgi` flag to the :program:`python -m http.server` command-line interface has been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid ":mod:`importlib`:" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "``load_module()`` method: use ``exec_module()`` instead." msgstr "" -msgid ":class:`locale`:" -msgstr "" - -msgid "The :func:`~locale.getdefaultlocale` function has been deprecated since Python 3.11. Its removal was originally planned for Python 3.13 (:gh:`90817`), but has been postponed to Python 3.15. Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" -msgstr "" - +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":mod:`pathlib`:" msgstr "" -msgid ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :func:`os.path.isreserved` to detect reserved paths on Windows." +#: ../../deprecations/pending-removal-in-3.15.rst:38 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`platform`:" msgstr "" -msgid ":func:`~platform.java_ver` has been deprecated since Python 3.13. This function is only useful for Jython support, has a confusing API, and is largely untested." +#: ../../deprecations/pending-removal-in-3.15.rst:44 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`sysconfig`:" msgstr "" -msgid "The *check_home* argument of :func:`sysconfig.is_python_build` has been deprecated since Python 3.12." +#: ../../deprecations/pending-removal-in-3.15.rst:50 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`threading`:" msgstr "" -msgid ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any arguments has been deprecated since Python 3.14, as the Python version does not permit any arguments, but the C version allows any number of positional or keyword arguments, ignoring every argument." +#: ../../deprecations/pending-removal-in-3.15.rst:55 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid ":mod:`types`:" msgstr "" -msgid ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +#: ../../deprecations/pending-removal-in-3.15.rst:63 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:70 msgid ":mod:`typing`:" msgstr "" -msgid "The undocumented keyword argument syntax for creating :class:`~typing.NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python 3.13. Use the class-based syntax or the functional syntax instead." +#: ../../deprecations/pending-removal-in-3.15.rst:72 +msgid "" +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (for example, ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" -msgid "When using the functional syntax of :class:`~typing.TypedDict`\\s, failing to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +#: ../../deprecations/pending-removal-in-3.15.rst:78 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." msgstr "" -msgid "The :func:`typing.no_type_check_decorator` decorator function has been deprecated since Python 3.13. After eight years in the :mod:`typing` module, it has yet to be supported by any major type checker." +#: ../../deprecations/pending-removal-in-3.15.rst:85 +msgid "" +"The :deco:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:90 msgid ":mod:`wave`:" msgstr "" -msgid "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.15.rst:92 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" +#: ../../deprecations/pending-removal-in-3.15.rst:97 msgid ":mod:`zipimport`:" msgstr "" -msgid ":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python 3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed by Jiahao Li in :gh:`125746`.)" +#: ../../deprecations/pending-removal-in-3.15.rst:99 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" msgstr "" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 02cf24ded..61671160b 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-07-20 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,54 +21,85 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:4 msgid "The import system:" msgstr "" -msgid "Setting :attr:`~module.__loader__` on a module while failing to set :attr:`__spec__.loader ` is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or taken into consideration by the import system or the standard library." +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader ` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr "" -msgid "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in documentation since Python 3.3 and at runtime since Python 3.13. Use the ``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr "" -msgid ":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -msgid ":mod:`asyncio` policy system is deprecated and will be removed in Python 3.16. In particular, the following classes and functions are deprecated:" +#: ../../deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" msgstr "" -msgid "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with *loop_factory* to use the desired event loop implementation." +#: ../../deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:39 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" "import asyncio\n" "\n" @@ -78,59 +109,106 @@ msgid "" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:50 msgid ":mod:`builtins`:" msgstr "" -msgid "Bitwise inversion on boolean types, ``~True`` or ``~False`` has been deprecated since Python 3.12, as it produces surprising and unintuitive results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation of a Boolean. In the rare case that you need the bitwise inversion of the underlying integer, convert to ``int`` explicitly (``~int(x)``)." +#: ../../deprecations/pending-removal-in-3.16.rst:52 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:59 msgid ":mod:`functools`:" msgstr "" -msgid "Calling the Python implementation of :func:`functools.reduce` with *function* or *sequence* as keyword arguments has been deprecated since Python 3.14." +#: ../../deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:64 msgid ":mod:`logging`:" msgstr "" -msgid "Support for custom logging handlers with the *strm* argument is deprecated and scheduled for removal in Python 3.16. Define handlers with the *stream* argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +#: ../../deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:70 msgid ":mod:`mimetypes`:" msgstr "" -msgid "Valid extensions start with a '.' or are empty for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:`75223`.)" +#: ../../deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty " +"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " +"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " +"Kemenade in :gh:`75223`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:78 msgid ":mod:`shutil`:" msgstr "" -msgid "The :class:`!ExecError` exception has been deprecated since Python 3.14. It has not been used by any function in :mod:`!shutil` since Python 3.4, and is now an alias of :exc:`RuntimeError`." +#: ../../deprecations/pending-removal-in-3.16.rst:80 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:85 msgid ":mod:`symtable`:" msgstr "" -msgid "The :meth:`Class.get_methods ` method has been deprecated since Python 3.14." +#: ../../deprecations/pending-removal-in-3.16.rst:87 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:90 msgid ":mod:`sys`:" msgstr "" -msgid "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable instead." +#: ../../deprecations/pending-removal-in-3.16.rst:92 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:96 msgid ":mod:`sysconfig`:" msgstr "" -msgid "The :func:`!sysconfig.expand_makefile_vars` function has been deprecated since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` instead." +#: ../../deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:102 msgid ":mod:`tarfile`:" msgstr "" -msgid "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been deprecated since Python 3.13." +#: ../../deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." msgstr "" diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po index 44dea1c82..0092deb98 100644 --- a/deprecations/pending-removal-in-3.17.po +++ b/deprecations/pending-removal-in-3.17.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,29 +19,64 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../deprecations/pending-removal-in-3.17.rst:2 msgid "Pending removal in Python 3.17" msgstr "" +#: ../../deprecations/pending-removal-in-3.17.rst:4 msgid ":mod:`collections.abc`:" msgstr "" -msgid ":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +#: ../../deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." msgstr "" -msgid "Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` implements the :ref:`buffer protocol ` at runtime. For use in type annotations, either use :class:`~collections.abc.Buffer` or a union that explicitly specifies the types your code supports (e.g., ``bytes | bytearray | memoryview``)." +#: ../../deprecations/pending-removal-in-3.17.rst:8 +#: ../../deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." msgstr "" -msgid ":class:`!ByteString` was originally intended to be an abstract class that would serve as a supertype of both :class:`bytes` and :class:`bytearray`. However, since the ABC never had any methods, knowing that an object was an instance of :class:`!ByteString` never actually told you anything useful about the object. Other common buffer types such as :class:`memoryview` were also never understood as subtypes of :class:`!ByteString` (either at runtime or by static type checkers)." +#: ../../deprecations/pending-removal-in-3.17.rst:14 +#: ../../deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." msgstr "" -msgid "See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by Shantanu Jain in :gh:`91896`.)" +#: ../../deprecations/pending-removal-in-3.17.rst:22 +#: ../../deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" msgstr "" +#: ../../deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr "" -msgid "Before Python 3.14, old-style unions were implemented using the private class ``typing._UnionGenericAlias``. This class is no longer needed for the implementation, but it has been retained for backward compatibility, with removal scheduled for Python 3.17. Users should use documented introspection helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead of relying on private implementation details." +#: ../../deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." msgstr "" -msgid ":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in Python 3.17." +#: ../../deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." msgstr "" diff --git a/deprecations/pending-removal-in-3.18.po b/deprecations/pending-removal-in-3.18.po index b7573783f..c6da9d7ff 100644 --- a/deprecations/pending-removal-in-3.18.po +++ b/deprecations/pending-removal-in-3.18.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,11 +19,18 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../deprecations/pending-removal-in-3.18.rst:2 msgid "Pending removal in Python 3.18" msgstr "" +#: ../../deprecations/pending-removal-in-3.18.rst:4 msgid ":mod:`decimal`:" msgstr "" -msgid "The non-standard and undocumented :class:`~decimal.Decimal` format specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C implementation, has been deprecated since Python 3.13. (Contributed by Serhiy Storchaka in :gh:`89902`.)" +#: ../../deprecations/pending-removal-in-3.18.rst:6 +msgid "" +"The non-standard and undocumented :class:`~decimal.Decimal` format specifier " +"``'N'``, which is only supported in the :mod:`!decimal` module's C " +"implementation, has been deprecated since Python 3.13. (Contributed by " +"Serhiy Storchaka in :gh:`89902`.)" msgstr "" diff --git a/deprecations/pending-removal-in-3.19.po b/deprecations/pending-removal-in-3.19.po index fca62156b..a1e88d617 100644 --- a/deprecations/pending-removal-in-3.19.po +++ b/deprecations/pending-removal-in-3.19.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,11 +19,17 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../deprecations/pending-removal-in-3.19.rst:2 msgid "Pending removal in Python 3.19" msgstr "" +#: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" msgstr "" -msgid "Implicitly switching to the MSVC-compatible struct layout by setting :attr:`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." +#: ../../deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by " +"setting :attr:`~ctypes.Structure._pack_` but " +"not :attr:`~ctypes.Structure._layout_` on non-Windows platforms." msgstr "" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index c2c940b70..914783548 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-07-20 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,212 +21,364 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../deprecations/pending-removal-in-future.rst:2 msgid "Pending removal in future versions" msgstr "" -msgid "The following APIs will be removed in the future, although there is currently no date scheduled for their removal." +#: ../../deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:7 msgid ":mod:`argparse`:" msgstr "" -msgid "Nesting argument groups and nesting mutually exclusive groups are deprecated." +#: ../../deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." msgstr "" -msgid "Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." +#: ../../deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* " +"to :meth:`~argparse.ArgumentParser.add_argument_group` is now deprecated." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:14 msgid "The :class:`argparse.FileType` type converter is deprecated." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:16 msgid ":mod:`builtins`:" msgstr "" -msgid "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single argument signature." +#: ../../deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." msgstr "" -msgid "Currently Python accepts numeric literals immediately followed by keywords, for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised if the numeric literal is immediately followed by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it will be changed to a syntax error. (:gh:`87999`)" +#: ../../deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" -msgid "Support for ``__index__()`` and ``__int__()`` method returning non-int type: these methods will be required to return an instance of a strict subclass of :class:`int`." +#: ../../deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." msgstr "" -msgid "Support for ``__float__()`` method returning a strict subclass of :class:`float`: these methods will be required to return an instance of :class:`float`." +#: ../../deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" -msgid "Support for ``__complex__()`` method returning a strict subclass of :class:`complex`: these methods will be required to return an instance of :class:`complex`." +#: ../../deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" -msgid "Passing a complex number as the *real* or *imag* argument in the :func:`complex` constructor is now deprecated; it should only be passed as a single positional argument. (Contributed by Serhiy Storchaka in :gh:`109218`.)" +#: ../../deprecations/pending-removal-in-future.rst:38 +msgid "" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" -msgid ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +#: ../../deprecations/pending-removal-in-future.rst:43 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" -msgid ":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:`133038`)" +#: ../../deprecations/pending-removal-in-future.rst:48 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. " +"(:gh:`133038`)" msgstr "" -msgid ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method instead." +#: ../../deprecations/pending-removal-in-future.rst:50 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:53 msgid ":mod:`datetime`:" msgstr "" -msgid ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime.UTC)``." +#: ../../deprecations/pending-removal-in-future.rst:55 +msgid "" +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -msgid ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +#: ../../deprecations/pending-removal-in-future.rst:57 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:60 msgid ":mod:`gettext`: Plural value must be an integer." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:62 msgid ":mod:`importlib`:" msgstr "" -msgid ":func:`~importlib.util.cache_from_source` *debug_override* parameter is deprecated: use the *optimization* parameter instead." +#: ../../deprecations/pending-removal-in-future.rst:64 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:67 msgid ":mod:`importlib.metadata`:" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "``EntryPoints`` tuple interface." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:70 msgid "Implicit ``None`` on return values." msgstr "" -msgid ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, use :meth:`~logging.warning` instead." +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." msgstr "" -msgid ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use BytesIO and binary mode instead." +#: ../../deprecations/pending-removal-in-future.rst:75 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." msgstr "" -msgid ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +#: ../../deprecations/pending-removal-in-future.rst:78 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr "" -msgid ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is deprecated, use an exception instance." +#: ../../deprecations/pending-removal-in-future.rst:80 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." msgstr "" -msgid ":mod:`re`: More strict rules are now applied for numerical group references and group names in regular expressions. Only sequence of ASCII digits is now accepted as a numerical reference. The group name in bytes patterns and replacement strings can now only contain ASCII letters and digits and underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +#: ../../deprecations/pending-removal-in-future.rst:83 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -msgid ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +#: ../../deprecations/pending-removal-in-future.rst:90 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr "" -msgid ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in Python 3.12; use the *onexc* parameter instead." +#: ../../deprecations/pending-removal-in-future.rst:92 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:95 msgid ":mod:`ssl` options and protocols:" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:97 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "" -msgid ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +#: ../../deprecations/pending-removal-in-future.rst:98 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.OP_NO_SSL*`` options" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.OP_NO_TLS*`` options" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLS``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "``ssl.TLSVersion.SSLv3``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "``ssl.TLSVersion.TLSv1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr "" -msgid ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`." +#: ../../deprecations/pending-removal-in-future.rst:114 +msgid "" +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr "" -msgid ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :attr:`threading.Thread.daemon` attribute." +#: ../../deprecations/pending-removal-in-future.rst:116 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" -msgid ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :attr:`threading.Thread.name` attribute." +#: ../../deprecations/pending-removal-in-future.rst:118 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr "" -msgid "The internal class ``typing._UnionGenericAlias`` is no longer used to implement :class:`typing.Union`. To preserve compatibility with users using this private class, a compatibility shim will be provided until at least Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +#: ../../deprecations/pending-removal-in-future.rst:125 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" -msgid ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value that is not ``None`` from a test case." +#: ../../deprecations/pending-removal-in-future.rst:130 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." msgstr "" -msgid ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead" +#: ../../deprecations/pending-removal-in-future.rst:133 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitattr()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splithost()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splitnport()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splitpasswd()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitport()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``splitquery()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:141 msgid "``splittag()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "``splittype()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "``splituser()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:144 msgid "``splitvalue()``" msgstr "" +#: ../../deprecations/pending-removal-in-future.rst:145 msgid "``to_bytes()``" msgstr "" -msgid ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial writes." +#: ../../deprecations/pending-removal-in-future.rst:147 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." msgstr "" -msgid ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it will always return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests instead." +#: ../../deprecations/pending-removal-in-future.rst:150 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -msgid ":func:`sys._clear_type_cache` is deprecated: use :func:`sys._clear_internal_caches` instead." +#: ../../deprecations/pending-removal-in-future.rst:155 +msgid "" +":func:`sys._clear_type_cache` is deprecated: " +"use :func:`sys._clear_internal_caches` instead." msgstr "" diff --git a/distributing/index.po b/distributing/index.po index 7e9318782..91a0ca0cd 100644 --- a/distributing/index.po +++ b/distributing/index.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:50+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,8 +23,13 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../distributing/index.rst:10 msgid "Distributing Python Modules" msgstr "" -msgid "Information and guidance on distributing Python modules and packages has been moved to the `Python Packaging User Guide`_, and the tutorial on `packaging Python projects`_." +#: ../../distributing/index.rst:14 +msgid "" +"Information and guidance on distributing Python modules and packages has " +"been moved to the `Python Packaging User Guide`_, and the tutorial on " +"`packaging Python projects`_." msgstr "" diff --git a/extending/building.po b/extending/building.po index 89cce51f9..732961735 100644 --- a/extending/building.po +++ b/extending/building.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:51+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,20 +21,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/building.rst:7 msgid "Building C and C++ Extensions" msgstr "" -msgid "A C extension for CPython is a shared library (for example, a ``.so`` file on Linux, ``.pyd`` on Windows), which exports an *initialization function*." +#: ../../extending/building.rst:9 +msgid "" +"A C extension for CPython is a shared library (for example, a ``.so`` file " +"on Linux, ``.pyd`` on Windows), which exports an *initialization function*." msgstr "" +#: ../../extending/building.rst:12 msgid "See :ref:`extension-modules` for details." msgstr "" +#: ../../extending/building.rst:21 msgid "Building C and C++ Extensions with setuptools" msgstr "" -msgid "Building, packaging and distributing extension modules is best done with third-party tools, and is out of scope of this document. One suitable tool is Setuptools, whose documentation can be found at https://setuptools.pypa.io/en/latest/setuptools.html." +#: ../../extending/building.rst:24 +msgid "" +"Building, packaging and distributing extension modules is best done with " +"third-party tools, and is out of scope of this document. One suitable tool " +"is Setuptools, whose documentation can be found at https://" +"setuptools.pypa.io/en/latest/setuptools.html." msgstr "" -msgid "The :mod:`distutils` module, which was included in the standard library until Python 3.12, is now maintained as part of Setuptools." +#: ../../extending/building.rst:29 +msgid "" +"The :mod:`distutils` module, which was included in the standard library " +"until Python 3.12, is now maintained as part of Setuptools." msgstr "" diff --git a/extending/embedding.po b/extending/embedding.po index 861826635..4f05420da 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:51+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,33 +24,75 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/embedding.rst:8 msgid "Embedding Python in Another Application" msgstr "" -msgid "The previous chapters discussed how to extend Python, that is, how to extend the functionality of Python by attaching a library of C functions to it. It is also possible to do it the other way around: enrich your C/C++ application by embedding Python in it. Embedding provides your application with the ability to implement some of the functionality of your application in Python rather than C or C++. This can be used for many purposes; one example would be to allow users to tailor the application to their needs by writing some scripts in Python. You can also use it yourself if some of the functionality can be written in Python more easily." -msgstr "" - -msgid "Embedding Python is similar to extending it, but not quite. The difference is that when you extend Python, the main program of the application is still the Python interpreter, while if you embed Python, the main program may have nothing to do with Python --- instead, some parts of the application occasionally call the Python interpreter to run some Python code." +#: ../../extending/embedding.rst:10 +msgid "" +"The previous chapters discussed how to extend Python, that is, how to extend " +"the functionality of Python by attaching a library of C functions to it. It " +"is also possible to do it the other way around: enrich your C/C++ " +"application by embedding Python in it. Embedding provides your application " +"with the ability to implement some of the functionality of your application " +"in Python rather than C or C++. This can be used for many purposes; one " +"example would be to allow users to tailor the application to their needs by " +"writing some scripts in Python. You can also use it yourself if some of the " +"functionality can be written in Python more easily." +msgstr "" + +#: ../../extending/embedding.rst:20 +msgid "" +"Embedding Python is similar to extending it, but not quite. The difference " +"is that when you extend Python, the main program of the application is still " +"the Python interpreter, while if you embed Python, the main program may have " +"nothing to do with Python --- instead, some parts of the application " +"occasionally call the Python interpreter to run some Python code." msgstr "" -msgid "So if you are embedding Python, you are providing your own main program. One of the things this main program has to do is initialize the Python interpreter. At the very least, you have to call the function :c:func:`Py_Initialize`. There are optional calls to pass command line arguments to Python. Then later you can call the interpreter from any part of the application." +#: ../../extending/embedding.rst:26 +msgid "" +"So if you are embedding Python, you are providing your own main program. " +"One of the things this main program has to do is initialize the Python " +"interpreter. At the very least, you have to call the " +"function :c:func:`Py_Initialize`. There are optional calls to pass command " +"line arguments to Python. Then later you can call the interpreter from any " +"part of the application." msgstr "" -msgid "There are several different ways to call the interpreter: you can pass a string containing Python statements to :c:func:`PyRun_SimpleString`, or you can pass a stdio file pointer and a file name (for identification in error messages only) to :c:func:`PyRun_SimpleFile`. You can also call the lower-level operations described in the previous chapters to construct and use Python objects." +#: ../../extending/embedding.rst:32 +msgid "" +"There are several different ways to call the interpreter: you can pass a " +"string containing Python statements to :c:func:`PyRun_SimpleString`, or you " +"can pass a stdio file pointer and a file name (for identification in error " +"messages only) to :c:func:`PyRun_SimpleFile`. You can also call the lower-" +"level operations described in the previous chapters to construct and use " +"Python objects." msgstr "" +#: ../../extending/embedding.rst:41 msgid ":ref:`c-api-index`" msgstr "" -msgid "The details of Python's C interface are given in this manual. A great deal of necessary information can be found here." +#: ../../extending/embedding.rst:42 +msgid "" +"The details of Python's C interface are given in this manual. A great deal " +"of necessary information can be found here." msgstr "" +#: ../../extending/embedding.rst:49 msgid "Very High Level Embedding" msgstr "" -msgid "The simplest form of embedding Python is the use of the very high level interface. This interface is intended to execute a Python script without needing to interact with the application directly. This can for example be used to perform some operation on a file. ::" +#: ../../extending/embedding.rst:51 +msgid "" +"The simplest form of embedding Python is the use of the very high level " +"interface. This interface is intended to execute a Python script without " +"needing to interact with the application directly. This can for example be " +"used to perform some operation on a file. ::" msgstr "" +#: ../../extending/embedding.rst:56 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -63,7 +105,8 @@ msgid "" " PyConfig_InitPythonConfig(&config);\n" "\n" " /* optional but recommended */\n" -" status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]);\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" " if (PyStatus_Exception(status)) {\n" " goto exception;\n" " }\n" @@ -87,57 +130,113 @@ msgid "" "}" msgstr "" -msgid "``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be used in some APIs instead of ``int``. It is not necessary since Python 3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-string-and-buffers` for a description of this macro." -msgstr "" - -msgid "Setting :c:member:`PyConfig.program_name` should be called before :c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time libraries. Next, the Python interpreter is initialized with :c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call shuts the interpreter down, followed by the end of the program. In a real program, you may want to get the Python script from another source, perhaps a text-editor routine, a file, or a database. Getting the Python code from a file can better be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the trouble of allocating memory space and loading the file contents." +#: ../../extending/embedding.rst:92 +msgid "" +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" +#: ../../extending/embedding.rst:97 +msgid "" +"Setting :c:member:`PyConfig.program_name` should be called " +"before :c:func:`Py_InitializeFromConfig` to inform the interpreter about " +"paths to Python run-time libraries. Next, the Python interpreter is " +"initialized with :c:func:`Py_Initialize`, followed by the execution of a " +"hard-coded Python script that prints the date and time. Afterwards, " +"the :c:func:`Py_FinalizeEx` call shuts the interpreter down, followed by the " +"end of the program. In a real program, you may want to get the Python " +"script from another source, perhaps a text-editor routine, a file, or a " +"database. Getting the Python code from a file can better be done by using " +"the :c:func:`PyRun_SimpleFile` function, which saves you the trouble of " +"allocating memory space and loading the file contents." +msgstr "" + +#: ../../extending/embedding.rst:112 msgid "Beyond Very High Level Embedding: An overview" msgstr "" -msgid "The high level interface gives you the ability to execute arbitrary pieces of Python code from your application, but exchanging data values is quite cumbersome to say the least. If you want that, you should use lower level calls. At the cost of having to write more C code, you can achieve almost anything." +#: ../../extending/embedding.rst:114 +msgid "" +"The high level interface gives you the ability to execute arbitrary pieces " +"of Python code from your application, but exchanging data values is quite " +"cumbersome to say the least. If you want that, you should use lower level " +"calls. At the cost of having to write more C code, you can achieve almost " +"anything." msgstr "" -msgid "It should be noted that extending Python and embedding Python is quite the same activity, despite the different intent. Most topics discussed in the previous chapters are still valid. To show this, consider what the extension code from Python to C really does:" +#: ../../extending/embedding.rst:119 +msgid "" +"It should be noted that extending Python and embedding Python is quite the " +"same activity, despite the different intent. Most topics discussed in the " +"previous chapters are still valid. To show this, consider what the extension " +"code from Python to C really does:" msgstr "" +#: ../../extending/embedding.rst:124 msgid "Convert data values from Python to C," msgstr "" +#: ../../extending/embedding.rst:126 msgid "Perform a function call to a C routine using the converted values, and" msgstr "" +#: ../../extending/embedding.rst:128 msgid "Convert the data values from the call from C to Python." msgstr "" +#: ../../extending/embedding.rst:130 msgid "When embedding Python, the interface code does:" msgstr "" +#: ../../extending/embedding.rst:132 msgid "Convert data values from C to Python," msgstr "" -msgid "Perform a function call to a Python interface routine using the converted values, and" +#: ../../extending/embedding.rst:134 +msgid "" +"Perform a function call to a Python interface routine using the converted " +"values, and" msgstr "" +#: ../../extending/embedding.rst:137 msgid "Convert the data values from the call from Python to C." msgstr "" -msgid "As you can see, the data conversion steps are simply swapped to accommodate the different direction of the cross-language transfer. The only difference is the routine that you call between both data conversions. When extending, you call a C routine, when embedding, you call a Python routine." +#: ../../extending/embedding.rst:139 +msgid "" +"As you can see, the data conversion steps are simply swapped to accommodate " +"the different direction of the cross-language transfer. The only difference " +"is the routine that you call between both data conversions. When extending, " +"you call a C routine, when embedding, you call a Python routine." msgstr "" -msgid "This chapter will not discuss how to convert data from Python to C and vice versa. Also, proper use of references and dealing with errors is assumed to be understood. Since these aspects do not differ from extending the interpreter, you can refer to earlier chapters for the required information." +#: ../../extending/embedding.rst:144 +msgid "" +"This chapter will not discuss how to convert data from Python to C and vice " +"versa. Also, proper use of references and dealing with errors is assumed to " +"be understood. Since these aspects do not differ from extending the " +"interpreter, you can refer to earlier chapters for the required information." msgstr "" +#: ../../extending/embedding.rst:153 msgid "Pure Embedding" msgstr "" -msgid "The first program aims to execute a function in a Python script. Like in the section about the very high level interface, the Python interpreter does not directly interact with the application (but that will change in the next section)." +#: ../../extending/embedding.rst:155 +msgid "" +"The first program aims to execute a function in a Python script. Like in the " +"section about the very high level interface, the Python interpreter does not " +"directly interact with the application (but that will change in the next " +"section)." msgstr "" +#: ../../extending/embedding.rst:160 msgid "The code to run a function defined in a Python script is:" msgstr "" +#: ../../extending/embedding.rst:162 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -195,7 +294,8 @@ msgid "" " else {\n" " if (PyErr_Occurred())\n" " PyErr_Print();\n" -" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", argv[2]);\n" +" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", " +"argv[2]);\n" " }\n" " Py_XDECREF(pFunc);\n" " Py_DECREF(pModule);\n" @@ -212,9 +312,16 @@ msgid "" "}\n" msgstr "" -msgid "This code loads a Python script using ``argv[1]``, and calls the function named in ``argv[2]``. Its integer arguments are the other values of the ``argv`` array. If you :ref:`compile and link ` this program (let's call the finished executable :program:`call`), and use it to execute a Python script, such as:" +#: ../../extending/embedding.rst:165 +msgid "" +"This code loads a Python script using ``argv[1]``, and calls the function " +"named in ``argv[2]``. Its integer arguments are the other values of the " +"``argv`` array. If you :ref:`compile and link ` this program " +"(let's call the finished executable :program:`call`), and use it to execute " +"a Python script, such as:" msgstr "" +#: ../../extending/embedding.rst:171 msgid "" "def multiply(a,b):\n" " print(\"Will compute\", a, \"times\", b)\n" @@ -224,18 +331,25 @@ msgid "" " return c" msgstr "" +#: ../../extending/embedding.rst:180 msgid "then the result should be:" msgstr "" +#: ../../extending/embedding.rst:182 msgid "" "$ call multiply multiply 3 2\n" "Will compute 3 times 2\n" "Result of call: 6" msgstr "" -msgid "Although the program is quite large for its functionality, most of the code is for data conversion between Python and C, and for error reporting. The interesting part with respect to embedding Python starts with ::" +#: ../../extending/embedding.rst:188 +msgid "" +"Although the program is quite large for its functionality, most of the code " +"is for data conversion between Python and C, and for error reporting. The " +"interesting part with respect to embedding Python starts with ::" msgstr "" +#: ../../extending/embedding.rst:192 msgid "" "Py_Initialize();\n" "pName = PyUnicode_DecodeFSDefault(argv[1]);\n" @@ -243,9 +357,15 @@ msgid "" "pModule = PyImport_Import(pName);" msgstr "" -msgid "After initializing the interpreter, the script is loaded using :c:func:`PyImport_Import`. This routine needs a Python string as its argument, which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data conversion routine. ::" +#: ../../extending/embedding.rst:197 +msgid "" +"After initializing the interpreter, the script is loaded " +"using :c:func:`PyImport_Import`. This routine needs a Python string as its " +"argument, which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` " +"data conversion routine. ::" msgstr "" +#: ../../extending/embedding.rst:202 msgid "" "pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" "/* pFunc is a new reference */\n" @@ -256,21 +376,43 @@ msgid "" "Py_XDECREF(pFunc);" msgstr "" -msgid "Once the script is loaded, the name we're looking for is retrieved using :c:func:`PyObject_GetAttrString`. If the name exists, and the object returned is callable, you can safely assume that it is a function. The program then proceeds by constructing a tuple of arguments as normal. The call to the Python function is then made with::" +#: ../../extending/embedding.rst:210 +msgid "" +"Once the script is loaded, the name we're looking for is retrieved " +"using :c:func:`PyObject_GetAttrString`. If the name exists, and the object " +"returned is callable, you can safely assume that it is a function. The " +"program then proceeds by constructing a tuple of arguments as normal. The " +"call to the Python function is then made with::" msgstr "" +#: ../../extending/embedding.rst:216 msgid "pValue = PyObject_CallObject(pFunc, pArgs);" msgstr "" -msgid "Upon return of the function, ``pValue`` is either ``NULL`` or it contains a reference to the return value of the function. Be sure to release the reference after examining the value." +#: ../../extending/embedding.rst:218 +msgid "" +"Upon return of the function, ``pValue`` is either ``NULL`` or it contains a " +"reference to the return value of the function. Be sure to release the " +"reference after examining the value." msgstr "" +#: ../../extending/embedding.rst:226 msgid "Extending Embedded Python" msgstr "" -msgid "Until now, the embedded Python interpreter had no access to functionality from the application itself. The Python API allows this by extending the embedded interpreter. That is, the embedded interpreter gets extended with routines provided by the application. While it sounds complex, it is not so bad. Simply forget for a while that the application starts the Python interpreter. Instead, consider the application to be a set of subroutines, and write some glue code that gives Python access to those routines, just like you would write a normal Python extension. For example::" +#: ../../extending/embedding.rst:228 +msgid "" +"Until now, the embedded Python interpreter had no access to functionality " +"from the application itself. The Python API allows this by extending the " +"embedded interpreter. That is, the embedded interpreter gets extended with " +"routines provided by the application. While it sounds complex, it is not so " +"bad. Simply forget for a while that the application starts the Python " +"interpreter. Instead, consider the application to be a set of subroutines, " +"and write some glue code that gives Python access to those routines, just " +"like you would write a normal Python extension. For example::" msgstr "" +#: ../../extending/embedding.rst:237 msgid "" "static int numargs=0;\n" "\n" @@ -303,62 +445,118 @@ msgid "" "}" msgstr "" -msgid "Insert the above code just above the :c:func:`main` function. Also, insert the following two statements before the call to :c:func:`Py_Initialize`::" +#: ../../extending/embedding.rst:267 +msgid "" +"Insert the above code just above the :c:func:`main` function. Also, insert " +"the following two statements before the call to :c:func:`Py_Initialize`::" msgstr "" +#: ../../extending/embedding.rst:270 msgid "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" msgstr "" -msgid "These two lines initialize the ``numargs`` variable, and make the :func:`!emb.numargs` function accessible to the embedded Python interpreter. With these extensions, the Python script can do things like" +#: ../../extending/embedding.rst:273 +msgid "" +"These two lines initialize the ``numargs`` variable, and make the :func:`!" +"emb.numargs` function accessible to the embedded Python interpreter. With " +"these extensions, the Python script can do things like" msgstr "" +#: ../../extending/embedding.rst:277 msgid "" "import emb\n" "print(\"Number of arguments\", emb.numargs())" msgstr "" -msgid "In a real application, the methods will expose an API of the application to Python." +#: ../../extending/embedding.rst:282 +msgid "" +"In a real application, the methods will expose an API of the application to " +"Python." msgstr "" +#: ../../extending/embedding.rst:292 msgid "Embedding Python in C++" msgstr "" -msgid "It is also possible to embed Python in a C++ program; precisely how this is done will depend on the details of the C++ system used; in general you will need to write the main program in C++, and use the C++ compiler to compile and link your program. There is no need to recompile Python itself using C++." +#: ../../extending/embedding.rst:294 +msgid "" +"It is also possible to embed Python in a C++ program; precisely how this is " +"done will depend on the details of the C++ system used; in general you will " +"need to write the main program in C++, and use the C++ compiler to compile " +"and link your program. There is no need to recompile Python itself using C+" +"+." msgstr "" +#: ../../extending/embedding.rst:303 msgid "Compiling and Linking under Unix-like systems" msgstr "" -msgid "It is not necessarily trivial to find the right flags to pass to your compiler (and linker) in order to embed the Python interpreter into your application, particularly because Python needs to load library modules implemented as C dynamic extensions (:file:`.so` files) linked against it." +#: ../../extending/embedding.rst:305 +msgid "" +"It is not necessarily trivial to find the right flags to pass to your " +"compiler (and linker) in order to embed the Python interpreter into your " +"application, particularly because Python needs to load library modules " +"implemented as C dynamic extensions (:file:`.so` files) linked against it." msgstr "" -msgid "To find out the required compiler and linker flags, you can execute the :file:`python{X.Y}-config` script which is generated as part of the installation process (a :file:`python3-config` script may also be available). This script has several options, of which the following will be directly useful to you:" +#: ../../extending/embedding.rst:311 +msgid "" +"To find out the required compiler and linker flags, you can execute " +"the :file:`python{X.Y}-config` script which is generated as part of the " +"installation process (a :file:`python3-config` script may also be " +"available). This script has several options, of which the following will be " +"directly useful to you:" msgstr "" -msgid "``pythonX.Y-config --cflags`` will give you the recommended flags when compiling:" +#: ../../extending/embedding.rst:317 +msgid "" +"``pythonX.Y-config --cflags`` will give you the recommended flags when " +"compiling:" msgstr "" +#: ../../extending/embedding.rst:320 msgid "" "$ /opt/bin/python3.11-config --cflags\n" -"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall" +"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " +"-g -fwrapv -O3 -Wall" msgstr "" -msgid "``pythonX.Y-config --ldflags --embed`` will give you the recommended flags when linking:" +#: ../../extending/embedding.rst:325 +msgid "" +"``pythonX.Y-config --ldflags --embed`` will give you the recommended flags " +"when linking:" msgstr "" +#: ../../extending/embedding.rst:328 msgid "" "$ /opt/bin/python3.11-config --ldflags --embed\n" -"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -lpthread -ldl -lutil -lm" +"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 " +"-lpthread -ldl -lutil -lm" msgstr "" -msgid "To avoid confusion between several Python installations (and especially between the system Python and your own compiled Python), it is recommended that you use the absolute path to :file:`python{X.Y}-config`, as in the above example." +#: ../../extending/embedding.rst:334 +msgid "" +"To avoid confusion between several Python installations (and especially " +"between the system Python and your own compiled Python), it is recommended " +"that you use the absolute path to :file:`python{X.Y}-config`, as in the " +"above example." msgstr "" -msgid "If this procedure doesn't work for you (it is not guaranteed to work for all Unix-like platforms; however, we welcome :ref:`bug reports `) you will have to read your system's documentation about dynamic linking and/or examine Python's :file:`Makefile` (use :func:`sysconfig.get_makefile_filename` to find its location) and compilation options. In this case, the :mod:`sysconfig` module is a useful tool to programmatically extract the configuration values that you will want to combine together. For example:" +#: ../../extending/embedding.rst:339 +msgid "" +"If this procedure doesn't work for you (it is not guaranteed to work for all " +"Unix-like platforms; however, we welcome :ref:`bug reports `) you will have to read your system's documentation about dynamic " +"linking and/or examine Python's :file:`Makefile` " +"(use :func:`sysconfig.get_makefile_filename` to find its location) and " +"compilation options. In this case, the :mod:`sysconfig` module is a useful " +"tool to programmatically extract the configuration values that you will want " +"to combine together. For example:" msgstr "" +#: ../../extending/embedding.rst:348 msgid "" ">>> import sysconfig\n" ">>> sysconfig.get_config_var('LIBS')\n" diff --git a/extending/extending.po b/extending/extending.po index 6933d9166..57ae20070 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:51+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,109 +23,193 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/extending.rst:8 msgid "Extending Python with C or C++" msgstr "" -msgid "It is quite easy to add new built-in modules to Python, if you know how to program in C. Such :dfn:`extension modules` can do two things that can't be done directly in Python: they can implement new built-in object types, and they can call C library functions and system calls." -msgstr "" - -msgid "To support extensions, the Python API (Application Programmers Interface) defines a set of functions, macros and variables that provide access to most aspects of the Python run-time system. The Python API is incorporated in a C source file by including the header ``\"Python.h\"``." +#: ../../extending/extending.rst:10 +msgid "" +"It is quite easy to add new built-in modules to Python, if you know how to " +"program in C. Such :dfn:`extension modules` can do two things that can't be " +"done directly in Python: they can implement new built-in object types, and " +"they can call C library functions and system calls." msgstr "" -msgid "The compilation of an extension module depends on its intended use as well as on your system setup; details are given in later chapters." +#: ../../extending/extending.rst:15 +msgid "" +"To support extensions, the Python API (Application Programmers Interface) " +"defines a set of functions, macros and variables that provide access to most " +"aspects of the Python run-time system. The Python API is incorporated in a " +"C source file by including the header ``\"Python.h\"``." msgstr "" -msgid "The C extension interface is specific to CPython, and extension modules do not work on other Python implementations. In many cases, it is possible to avoid writing C extensions and preserve portability to other implementations. For example, if your use case is calling C library functions or system calls, you should consider using the :mod:`ctypes` module or the `cffi `_ library rather than writing custom C code. These modules let you write Python code to interface with C code and are more portable between implementations of Python than writing and compiling a C extension module." +#: ../../extending/extending.rst:20 +msgid "" +"The compilation of an extension module depends on its intended use as well " +"as on your system setup; details are given in later chapters." msgstr "" +#: ../../extending/extending.rst:25 +msgid "" +"The C extension interface is specific to CPython, and extension modules do " +"not work on other Python implementations. In many cases, it is possible to " +"avoid writing C extensions and preserve portability to other " +"implementations. For example, if your use case is calling C library " +"functions or system calls, you should consider using the :mod:`ctypes` " +"module or the `cffi `_ library rather than " +"writing custom C code. These modules let you write Python code to interface " +"with C code and are more portable between implementations of Python than " +"writing and compiling a C extension module." +msgstr "" + +#: ../../extending/extending.rst:40 msgid "A Simple Example" msgstr "" -msgid "Let's create an extension module called ``spam`` (the favorite food of Monty Python fans...) and let's say we want to create a Python interface to the C library function :c:func:`system` [#]_. This function takes a null-terminated character string as argument and returns an integer. We want this function to be callable from Python as follows:" +#: ../../extending/extending.rst:42 +msgid "" +"Let's create an extension module called ``spam`` (the favorite food of Monty " +"Python fans...) and let's say we want to create a Python interface to the C " +"library function :c:func:`system` [#]_. This function takes a null-" +"terminated character string as argument and returns an integer. We want " +"this function to be callable from Python as follows:" msgstr "" +#: ../../extending/extending.rst:48 msgid "" ">>> import spam\n" ">>> status = spam.system(\"ls -l\")" msgstr "" -msgid "Begin by creating a file :file:`spammodule.c`. (Historically, if a module is called ``spam``, the C file containing its implementation is called :file:`spammodule.c`; if the module name is very long, like ``spammify``, the module name can be just :file:`spammify.c`.)" +#: ../../extending/extending.rst:53 +msgid "" +"Begin by creating a file :file:`spammodule.c`. (Historically, if a module " +"is called ``spam``, the C file containing its implementation is " +"called :file:`spammodule.c`; if the module name is very long, like " +"``spammify``, the module name can be just :file:`spammify.c`.)" msgstr "" +#: ../../extending/extending.rst:58 msgid "The first two lines of our file can be::" msgstr "" +#: ../../extending/extending.rst:60 ../../extending/extending.rst:704 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " msgstr "" -msgid "which pulls in the Python API (you can add a comment describing the purpose of the module and a copyright notice if you like)." +#: ../../extending/extending.rst:63 +msgid "" +"which pulls in the Python API (you can add a comment describing the purpose " +"of the module and a copyright notice if you like)." msgstr "" -msgid "Since Python may define some pre-processor definitions which affect the standard headers on some systems, you *must* include :file:`Python.h` before any standard headers are included." +#: ../../extending/extending.rst:68 +msgid "" +"Since Python may define some pre-processor definitions which affect the " +"standard headers on some systems, you *must* include :file:`Python.h` before " +"any standard headers are included." msgstr "" -msgid "``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should be used in some APIs instead of ``int``. It is not necessary since Python 3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-string-and-buffers` for a description of this macro." +#: ../../extending/extending.rst:72 +msgid "" +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -msgid "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or ``PY``, except those defined in standard header files." +#: ../../extending/extending.rst:77 +msgid "" +"All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " +"or ``PY``, except those defined in standard header files." msgstr "" -msgid "For backward compatibility, :file:`Python.h` includes several standard header files. C extensions should include the standard headers that they use, and should not rely on these implicit includes. If using the limited C API version 3.13 or newer, the implicit includes are:" +#: ../../extending/extending.rst:82 +msgid "" +"For backward compatibility, :file:`Python.h` includes several standard " +"header files. C extensions should include the standard headers that they " +"use, and should not rely on these implicit includes. If using the limited C " +"API version 3.13 or newer, the implicit includes are:" msgstr "" +#: ../../extending/extending.rst:87 msgid "````" msgstr "" +#: ../../extending/extending.rst:88 msgid "```` (on Windows)" msgstr "" +#: ../../extending/extending.rst:89 msgid "````" msgstr "" +#: ../../extending/extending.rst:90 msgid "````" msgstr "" +#: ../../extending/extending.rst:91 msgid "````" msgstr "" +#: ../../extending/extending.rst:92 msgid "````" msgstr "" +#: ../../extending/extending.rst:93 msgid "````" msgstr "" +#: ../../extending/extending.rst:94 msgid "```` (if present)" msgstr "" -msgid "If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or older, the headers below are also included:" +#: ../../extending/extending.rst:96 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or " +"older, the headers below are also included:" msgstr "" +#: ../../extending/extending.rst:99 msgid "````" msgstr "" +#: ../../extending/extending.rst:100 msgid "```` (on POSIX)" msgstr "" -msgid "If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or older, the headers below are also included:" +#: ../../extending/extending.rst:102 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or " +"older, the headers below are also included:" msgstr "" +#: ../../extending/extending.rst:105 msgid "````" msgstr "" +#: ../../extending/extending.rst:106 msgid "````" msgstr "" +#: ../../extending/extending.rst:107 msgid "````" msgstr "" +#: ../../extending/extending.rst:108 msgid "````" msgstr "" -msgid "The next thing we add to our module file is the C function that will be called when the Python expression ``spam.system(string)`` is evaluated (we'll see shortly how it ends up being called)::" +#: ../../extending/extending.rst:110 +msgid "" +"The next thing we add to our module file is the C function that will be " +"called when the Python expression ``spam.system(string)`` is evaluated " +"(we'll see shortly how it ends up being called)::" msgstr "" +#: ../../extending/extending.rst:114 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -140,75 +224,197 @@ msgid "" "}" msgstr "" -msgid "There is a straightforward translation from the argument list in Python (for example, the single expression ``\"ls -l\"``) to the arguments passed to the C function. The C function always has two arguments, conventionally named *self* and *args*." +#: ../../extending/extending.rst:126 +msgid "" +"There is a straightforward translation from the argument list in Python (for " +"example, the single expression ``\"ls -l\"``) to the arguments passed to the " +"C function. The C function always has two arguments, conventionally named " +"*self* and *args*." msgstr "" -msgid "The *self* argument points to the module object for module-level functions; for a method it would point to the object instance." +#: ../../extending/extending.rst:131 +msgid "" +"The *self* argument points to the module object for module-level functions; " +"for a method it would point to the object instance." msgstr "" -msgid "The *args* argument will be a pointer to a Python tuple object containing the arguments. Each item of the tuple corresponds to an argument in the call's argument list. The arguments are Python objects --- in order to do anything with them in our C function we have to convert them to C values. The function :c:func:`PyArg_ParseTuple` in the Python API checks the argument types and converts them to C values. It uses a template string to determine the required types of the arguments as well as the types of the C variables into which to store the converted values. More about this later." +#: ../../extending/extending.rst:134 +msgid "" +"The *args* argument will be a pointer to a Python tuple object containing " +"the arguments. Each item of the tuple corresponds to an argument in the " +"call's argument list. The arguments are Python objects --- in order to do " +"anything with them in our C function we have to convert them to C values. " +"The function :c:func:`PyArg_ParseTuple` in the Python API checks the " +"argument types and converts them to C values. It uses a template string to " +"determine the required types of the arguments as well as the types of the C " +"variables into which to store the converted values. More about this later." msgstr "" -msgid ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the right type and its components have been stored in the variables whose addresses are passed. It returns false (zero) if an invalid argument list was passed. In the latter case it also raises an appropriate exception so the calling function can return ``NULL`` immediately (as we saw in the example)." +#: ../../extending/extending.rst:143 +msgid "" +":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " +"right type and its components have been stored in the variables whose " +"addresses are passed. It returns false (zero) if an invalid argument list " +"was passed. In the latter case it also raises an appropriate exception so " +"the calling function can return ``NULL`` immediately (as we saw in the " +"example)." msgstr "" +#: ../../extending/extending.rst:153 msgid "Intermezzo: Errors and Exceptions" msgstr "" -msgid "An important convention throughout the Python interpreter is the following: when a function fails, it should set an exception condition and return an error value (usually ``-1`` or a ``NULL`` pointer). Exception information is stored in three members of the interpreter's thread state. These are ``NULL`` if there is no exception. Otherwise they are the C equivalents of the members of the Python tuple returned by :meth:`sys.exc_info`. These are the exception type, exception instance, and a traceback object. It is important to know about them to understand how errors are passed around." -msgstr "" - -msgid "The Python API defines a number of functions to set various types of exceptions." -msgstr "" - -msgid "The most common one is :c:func:`PyErr_SetString`. Its arguments are an exception object and a C string. The exception object is usually a predefined object like :c:data:`PyExc_ZeroDivisionError`. The C string indicates the cause of the error and is converted to a Python string object and stored as the \"associated value\" of the exception." +#: ../../extending/extending.rst:155 +msgid "" +"An important convention throughout the Python interpreter is the following: " +"when a function fails, it should set an exception condition and return an " +"error value (usually ``-1`` or a ``NULL`` pointer). Exception information " +"is stored in three members of the interpreter's thread state. These are " +"``NULL`` if there is no exception. Otherwise they are the C equivalents of " +"the members of the Python tuple returned by :meth:`sys.exc_info`. These are " +"the exception type, exception instance, and a traceback object. It is " +"important to know about them to understand how errors are passed around." msgstr "" -msgid "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an exception argument and constructs the associated value by inspection of the global variable :c:data:`errno`. The most general function is :c:func:`PyErr_SetObject`, which takes two object arguments, the exception and its associated value. You don't need to :c:func:`Py_INCREF` the objects passed to any of these functions." +#: ../../extending/extending.rst:164 +msgid "" +"The Python API defines a number of functions to set various types of " +"exceptions." msgstr "" -msgid "You can test non-destructively whether an exception has been set with :c:func:`PyErr_Occurred`. This returns the current exception object, or ``NULL`` if no exception has occurred. You normally don't need to call :c:func:`PyErr_Occurred` to see whether an error occurred in a function call, since you should be able to tell from the return value." +#: ../../extending/extending.rst:166 +msgid "" +"The most common one is :c:func:`PyErr_SetString`. Its arguments are an " +"exception object and a C string. The exception object is usually a " +"predefined object like :c:data:`PyExc_ZeroDivisionError`. The C string " +"indicates the cause of the error and is converted to a Python string object " +"and stored as the \"associated value\" of the exception." msgstr "" -msgid "When a function *f* that calls another function *g* detects that the latter fails, *f* should itself return an error value (usually ``NULL`` or ``-1``). It should *not* call one of the ``PyErr_*`` functions --- one has already been called by *g*. *f*'s caller is then supposed to also return an error indication to *its* caller, again *without* calling ``PyErr_*``, and so on --- the most detailed cause of the error was already reported by the function that first detected it. Once the error reaches the Python interpreter's main loop, this aborts the currently executing Python code and tries to find an exception handler specified by the Python programmer." +#: ../../extending/extending.rst:172 +msgid "" +"Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " +"exception argument and constructs the associated value by inspection of the " +"global variable :c:data:`errno`. The most general function " +"is :c:func:`PyErr_SetObject`, which takes two object arguments, the " +"exception and its associated value. You don't need to :c:func:`Py_INCREF` " +"the objects passed to any of these functions." msgstr "" -msgid "(There are situations where a module can actually give a more detailed error message by calling another ``PyErr_*`` function, and in such cases it is fine to do so. As a general rule, however, this is not necessary, and can cause information about the cause of the error to be lost: most operations can fail for a variety of reasons.)" +#: ../../extending/extending.rst:179 +msgid "" +"You can test non-destructively whether an exception has been set " +"with :c:func:`PyErr_Occurred`. This returns the current exception object, " +"or ``NULL`` if no exception has occurred. You normally don't need to " +"call :c:func:`PyErr_Occurred` to see whether an error occurred in a function " +"call, since you should be able to tell from the return value." msgstr "" -msgid "To ignore an exception set by a function call that failed, the exception condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The only time C code should call :c:func:`PyErr_Clear` is if it doesn't want to pass the error on to the interpreter but wants to handle it completely by itself (possibly by trying something else, or pretending nothing went wrong)." +#: ../../extending/extending.rst:185 +msgid "" +"When a function *f* that calls another function *g* detects that the latter " +"fails, *f* should itself return an error value (usually ``NULL`` or " +"``-1``). It should *not* call one of the ``PyErr_*`` functions --- one has " +"already been called by *g*. *f*'s caller is then supposed to also return an " +"error indication to *its* caller, again *without* calling ``PyErr_*``, and " +"so on --- the most detailed cause of the error was already reported by the " +"function that first detected it. Once the error reaches the Python " +"interpreter's main loop, this aborts the currently executing Python code and " +"tries to find an exception handler specified by the Python programmer." +msgstr "" + +#: ../../extending/extending.rst:195 +msgid "" +"(There are situations where a module can actually give a more detailed error " +"message by calling another ``PyErr_*`` function, and in such cases it is " +"fine to do so. As a general rule, however, this is not necessary, and can " +"cause information about the cause of the error to be lost: most operations " +"can fail for a variety of reasons.)" msgstr "" -msgid "Every failing :c:func:`malloc` call must be turned into an exception --- the direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All the object-creating functions (for example, :c:func:`PyLong_FromLong`) already do this, so this note is only relevant to those who call :c:func:`malloc` directly." +#: ../../extending/extending.rst:201 +msgid "" +"To ignore an exception set by a function call that failed, the exception " +"condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " +"only time C code should call :c:func:`PyErr_Clear` is if it doesn't want to " +"pass the error on to the interpreter but wants to handle it completely by " +"itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" -msgid "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` and friends, functions that return an integer status usually return a positive value or zero for success and ``-1`` for failure, like Unix system calls." +#: ../../extending/extending.rst:207 +msgid "" +"Every failing :c:func:`malloc` call must be turned into an exception --- the " +"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must " +"call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All " +"the object-creating functions (for example, :c:func:`PyLong_FromLong`) " +"already do this, so this note is only relevant to those who " +"call :c:func:`malloc` directly." msgstr "" -msgid "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :c:func:`Py_DECREF` calls for objects you have already created) when you return an error indicator!" +#: ../../extending/extending.rst:213 +msgid "" +"Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " +"and friends, functions that return an integer status usually return a " +"positive value or zero for success and ``-1`` for failure, like Unix system " +"calls." msgstr "" -msgid "The choice of which exception to raise is entirely yours. There are predeclared C objects corresponding to all built-in Python exceptions, such as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` to mean that a file couldn't be opened (that should probably be :c:data:`PyExc_OSError`). If something's wrong with the argument list, the :c:func:`PyArg_ParseTuple` function usually raises :c:data:`PyExc_TypeError`. If you have an argument whose value must be in a particular range or must satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." +#: ../../extending/extending.rst:217 +msgid "" +"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` " +"or :c:func:`Py_DECREF` calls for objects you have already created) when you " +"return an error indicator!" msgstr "" -msgid "You can also define a new exception that is unique to your module. The simplest way to do this is to declare a static global object variable at the beginning of the file::" +#: ../../extending/extending.rst:221 +msgid "" +"The choice of which exception to raise is entirely yours. There are " +"predeclared C objects corresponding to all built-in Python exceptions, such " +"as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, " +"you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` " +"to mean that a file couldn't be opened (that should probably " +"be :c:data:`PyExc_OSError`). If something's wrong with the argument list, " +"the :c:func:`PyArg_ParseTuple` function usually " +"raises :c:data:`PyExc_TypeError`. If you have an argument whose value must " +"be in a particular range or must satisfy other " +"conditions, :c:data:`PyExc_ValueError` is appropriate." +msgstr "" + +#: ../../extending/extending.rst:231 +msgid "" +"You can also define a new exception that is unique to your module. The " +"simplest way to do this is to declare a static global object variable at the " +"beginning of the file::" msgstr "" +#: ../../extending/extending.rst:235 msgid "static PyObject *SpamError = NULL;" msgstr "" -msgid "and initialize it by calling :c:func:`PyErr_NewException` in the module's :c:data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" +#: ../../extending/extending.rst:237 +msgid "" +"and initialize it by calling :c:func:`PyErr_NewException` in the " +"module's :c:data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" msgstr "" +#: ../../extending/extending.rst:240 msgid "SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);" msgstr "" -msgid "Since :c:data:`!SpamError` is a global variable, it will be overwritten every time the module is reinitialized, when the :c:data:`Py_mod_exec` function is called." +#: ../../extending/extending.rst:242 +msgid "" +"Since :c:data:`!SpamError` is a global variable, it will be overwritten " +"every time the module is reinitialized, when the :c:data:`Py_mod_exec` " +"function is called." msgstr "" -msgid "For now, let's avoid the issue: we will block repeated initialization by raising an :py:exc:`ImportError`::" +#: ../../extending/extending.rst:245 +msgid "" +"For now, let's avoid the issue: we will block repeated initialization by " +"raising an :py:exc:`ImportError`::" msgstr "" +#: ../../extending/extending.rst:248 msgid "" "static PyObject *SpamError = NULL;\n" "\n" @@ -247,21 +453,46 @@ msgid "" "}" msgstr "" -msgid "Note that the Python name for the exception object is :exc:`!spam.error`. The :c:func:`PyErr_NewException` function may create a class with the base class being :exc:`Exception` (unless another class is passed in instead of ``NULL``), described in :ref:`bltin-exceptions`." +#: ../../extending/extending.rst:284 +msgid "" +"Note that the Python name for the exception object is :exc:`!spam.error`. " +"The :c:func:`PyErr_NewException` function may create a class with the base " +"class being :exc:`Exception` (unless another class is passed in instead of " +"``NULL``), described in :ref:`bltin-exceptions`." msgstr "" -msgid "Note also that the :c:data:`!SpamError` variable retains a reference to the newly created exception class; this is intentional! Since the exception could be removed from the module by external code, an owned reference to the class is needed to ensure that it will not be discarded, causing :c:data:`!SpamError` to become a dangling pointer. Should it become a dangling pointer, C code which raises the exception could cause a core dump or other unintended side effects." +#: ../../extending/extending.rst:289 +msgid "" +"Note also that the :c:data:`!SpamError` variable retains a reference to the " +"newly created exception class; this is intentional! Since the exception " +"could be removed from the module by external code, an owned reference to the " +"class is needed to ensure that it will not be discarded, causing :c:data:`!" +"SpamError` to become a dangling pointer. Should it become a dangling " +"pointer, C code which raises the exception could cause a core dump or other " +"unintended side effects." msgstr "" -msgid "For now, the :c:func:`Py_DECREF` call to remove this reference is missing. Even when the Python interpreter shuts down, the global :c:data:`!SpamError` variable will not be garbage-collected. It will \"leak\". We did, however, ensure that this will happen at most once per process." +#: ../../extending/extending.rst:296 +msgid "" +"For now, the :c:func:`Py_DECREF` call to remove this reference is missing. " +"Even when the Python interpreter shuts down, the global :c:data:`!SpamError` " +"variable will not be garbage-collected. It will \"leak\". We did, however, " +"ensure that this will happen at most once per process." msgstr "" -msgid "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type later in this sample." +#: ../../extending/extending.rst:301 +msgid "" +"We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " +"later in this sample." msgstr "" -msgid "The :exc:`!spam.error` exception can be raised in your extension module using a call to :c:func:`PyErr_SetString` as shown below::" +#: ../../extending/extending.rst:304 +msgid "" +"The :exc:`!spam.error` exception can be raised in your extension module " +"using a call to :c:func:`PyErr_SetString` as shown below::" msgstr "" +#: ../../extending/extending.rst:307 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -280,52 +511,92 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:327 msgid "Back to the Example" msgstr "" -msgid "Going back to our example function, you should now be able to understand this statement::" +#: ../../extending/extending.rst:329 +msgid "" +"Going back to our example function, you should now be able to understand " +"this statement::" msgstr "" +#: ../../extending/extending.rst:332 msgid "" "if (!PyArg_ParseTuple(args, \"s\", &command))\n" " return NULL;" msgstr "" -msgid "It returns ``NULL`` (the error indicator for functions returning object pointers) if an error is detected in the argument list, relying on the exception set by :c:func:`PyArg_ParseTuple`. Otherwise the string value of the argument has been copied to the local variable :c:data:`!command`. This is a pointer assignment and you are not supposed to modify the string to which it points (so in Standard C, the variable :c:data:`!command` should properly be declared as ``const char *command``)." +#: ../../extending/extending.rst:335 +msgid "" +"It returns ``NULL`` (the error indicator for functions returning object " +"pointers) if an error is detected in the argument list, relying on the " +"exception set by :c:func:`PyArg_ParseTuple`. Otherwise the string value of " +"the argument has been copied to the local variable :c:data:`!command`. This " +"is a pointer assignment and you are not supposed to modify the string to " +"which it points (so in Standard C, the variable :c:data:`!command` should " +"properly be declared as ``const char *command``)." msgstr "" -msgid "The next statement is a call to the Unix function :c:func:`system`, passing it the string we just got from :c:func:`PyArg_ParseTuple`::" +#: ../../extending/extending.rst:343 +msgid "" +"The next statement is a call to the Unix function :c:func:`system`, passing " +"it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" +#: ../../extending/extending.rst:346 msgid "sts = system(command);" msgstr "" -msgid "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as a Python object. This is done using the function :c:func:`PyLong_FromLong`. ::" +#: ../../extending/extending.rst:348 +msgid "" +"Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " +"a Python object. This is done using the " +"function :c:func:`PyLong_FromLong`. ::" msgstr "" +#: ../../extending/extending.rst:351 msgid "return PyLong_FromLong(sts);" msgstr "" -msgid "In this case, it will return an integer object. (Yes, even integers are objects on the heap in Python!)" +#: ../../extending/extending.rst:353 +msgid "" +"In this case, it will return an integer object. (Yes, even integers are " +"objects on the heap in Python!)" msgstr "" -msgid "If you have a C function that returns no useful argument (a function returning :c:expr:`void`), the corresponding Python function must return ``None``. You need this idiom to do so (which is implemented by the :c:macro:`Py_RETURN_NONE` macro)::" +#: ../../extending/extending.rst:356 +msgid "" +"If you have a C function that returns no useful argument (a function " +"returning :c:expr:`void`), the corresponding Python function must return " +"``None``. You need this idiom to do so (which is implemented by " +"the :c:macro:`Py_RETURN_NONE` macro)::" msgstr "" +#: ../../extending/extending.rst:361 msgid "" "Py_INCREF(Py_None);\n" "return Py_None;" msgstr "" -msgid ":c:data:`Py_None` is the C name for the special Python object ``None``. It is a genuine Python object rather than a ``NULL`` pointer, which means \"error\" in most contexts, as we have seen." +#: ../../extending/extending.rst:364 +msgid "" +":c:data:`Py_None` is the C name for the special Python object ``None``. It " +"is a genuine Python object rather than a ``NULL`` pointer, which means " +"\"error\" in most contexts, as we have seen." msgstr "" +#: ../../extending/extending.rst:372 msgid "The Module's Method Table and Initialization Function" msgstr "" -msgid "I promised to show how :c:func:`!spam_system` is called from Python programs. First, we need to list its name and address in a \"method table\"::" +#: ../../extending/extending.rst:374 +msgid "" +"I promised to show how :c:func:`!spam_system` is called from Python " +"programs. First, we need to list its name and address in a \"method table\"::" msgstr "" +#: ../../extending/extending.rst:377 msgid "" "static PyMethodDef spam_methods[] = {\n" " ...\n" @@ -336,18 +607,38 @@ msgid "" "};" msgstr "" -msgid "Note the third entry (``METH_VARARGS``). This is a flag telling the interpreter the calling convention to be used for the C function. It should normally always be ``METH_VARARGS`` or ``METH_VARARGS | METH_KEYWORDS``; a value of ``0`` means that an obsolete variant of :c:func:`PyArg_ParseTuple` is used." +#: ../../extending/extending.rst:385 +msgid "" +"Note the third entry (``METH_VARARGS``). This is a flag telling the " +"interpreter the calling convention to be used for the C function. It should " +"normally always be ``METH_VARARGS`` or ``METH_VARARGS | METH_KEYWORDS``; a " +"value of ``0`` means that an obsolete variant of :c:func:`PyArg_ParseTuple` " +"is used." msgstr "" -msgid "When using only ``METH_VARARGS``, the function should expect the Python-level parameters to be passed in as a tuple acceptable for parsing via :c:func:`PyArg_ParseTuple`; more information on this function is provided below." +#: ../../extending/extending.rst:390 +msgid "" +"When using only ``METH_VARARGS``, the function should expect the Python-" +"level parameters to be passed in as a tuple acceptable for parsing " +"via :c:func:`PyArg_ParseTuple`; more information on this function is " +"provided below." msgstr "" -msgid "The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword arguments should be passed to the function. In this case, the C function should accept a third ``PyObject *`` parameter which will be a dictionary of keywords. Use :c:func:`PyArg_ParseTupleAndKeywords` to parse the arguments to such a function." +#: ../../extending/extending.rst:394 +msgid "" +"The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword " +"arguments should be passed to the function. In this case, the C function " +"should accept a third ``PyObject *`` parameter which will be a dictionary of " +"keywords. Use :c:func:`PyArg_ParseTupleAndKeywords` to parse the arguments " +"to such a function." msgstr "" -msgid "The method table must be referenced in the module definition structure::" +#: ../../extending/extending.rst:400 +msgid "" +"The method table must be referenced in the module definition structure::" msgstr "" +#: ../../extending/extending.rst:402 msgid "" "static struct PyModuleDef spam_module = {\n" " ...\n" @@ -356,9 +647,15 @@ msgid "" "};" msgstr "" -msgid "This structure, in turn, must be passed to the interpreter in the module's initialization function. The initialization function must be named :c:func:`!PyInit_name`, where *name* is the name of the module, and should be the only non-\\ ``static`` item defined in the module file::" +#: ../../extending/extending.rst:408 +msgid "" +"This structure, in turn, must be passed to the interpreter in the module's " +"initialization function. The initialization function must be " +"named :c:func:`!PyInit_name`, where *name* is the name of the module, and " +"should be the only non-\\ ``static`` item defined in the module file::" msgstr "" +#: ../../extending/extending.rst:413 msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -367,15 +664,32 @@ msgid "" "}" msgstr "" -msgid "Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` return type, declares any special linkage declarations required by the platform, and for C++ declares the function as ``extern \"C\"``." +#: ../../extending/extending.rst:419 +msgid "" +"Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` " +"return type, declares any special linkage declarations required by the " +"platform, and for C++ declares the function as ``extern \"C\"``." msgstr "" -msgid ":c:func:`!PyInit_spam` is called when each interpreter imports its module :mod:`!spam` for the first time. (See below for comments about embedding Python.) A pointer to the module definition must be returned via :c:func:`PyModuleDef_Init`, so that the import machinery can create the module and store it in ``sys.modules``." +#: ../../extending/extending.rst:423 +msgid "" +":c:func:`!PyInit_spam` is called when each interpreter imports its " +"module :mod:`!spam` for the first time. (See below for comments about " +"embedding Python.) A pointer to the module definition must be returned " +"via :c:func:`PyModuleDef_Init`, so that the import machinery can create the " +"module and store it in ``sys.modules``." msgstr "" -msgid "When embedding Python, the :c:func:`!PyInit_spam` function is not called automatically unless there's an entry in the :c:data:`PyImport_Inittab` table. To add the module to the initialization table, use :c:func:`PyImport_AppendInittab`, optionally followed by an import of the module::" +#: ../../extending/extending.rst:428 +msgid "" +"When embedding Python, the :c:func:`!PyInit_spam` function is not called " +"automatically unless there's an entry in the :c:data:`PyImport_Inittab` " +"table. To add the module to the initialization table, " +"use :c:func:`PyImport_AppendInittab`, optionally followed by an import of " +"the module::" msgstr "" +#: ../../extending/extending.rst:433 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -389,12 +703,14 @@ msgid "" "\n" " /* Add a built-in module, before Py_Initialize */\n" " if (PyImport_AppendInittab(\"spam\", PyInit_spam) == -1) {\n" -" fprintf(stderr, \"Error: could not extend in-built modules table\\n\");\n" +" fprintf(stderr, \"Error: could not extend in-built modules " +"table\\n\");\n" " exit(1);\n" " }\n" "\n" " /* Pass argv[0] to the Python interpreter */\n" -" status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]);\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" " if (PyStatus_Exception(status)) {\n" " goto exception;\n" " }\n" @@ -426,45 +742,107 @@ msgid "" "}" msgstr "" -msgid "If you declare a global variable or a local static one, the module may experience unintended side-effects on re-initialisation, for example when removing entries from ``sys.modules`` or importing compiled modules into multiple interpreters within a process (or following a :c:func:`fork` without an intervening :c:func:`exec`). If module state is not yet fully :ref:`isolated `, authors should consider marking the module as having no support for subinterpreters (via :c:macro:`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." +#: ../../extending/extending.rst:483 +msgid "" +"If you declare a global variable or a local static one, the module may " +"experience unintended side-effects on re-initialisation, for example when " +"removing entries from ``sys.modules`` or importing compiled modules into " +"multiple interpreters within a process (or following a :c:func:`fork` " +"without an intervening :c:func:`exec`). If module state is not yet " +"fully :ref:`isolated `, authors should consider " +"marking the module as having no support for subinterpreters " +"(via :c:macro:`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." msgstr "" -msgid "A more substantial example module is included in the Python source distribution as :file:`Modules/xxlimited.c`. This file may be used as a template or simply read as an example." +#: ../../extending/extending.rst:492 +msgid "" +"A more substantial example module is included in the Python source " +"distribution as :file:`Modules/xxlimited.c`. This file may be used as a " +"template or simply read as an example." msgstr "" +#: ../../extending/extending.rst:500 msgid "Compilation and Linkage" msgstr "" -msgid "There are two more things to do before you can use your new extension: compiling and linking it with the Python system. If you use dynamic loading, the details may depend on the style of dynamic loading your system uses; see the chapters about building extension modules (chapter :ref:`building`) and additional information that pertains only to building on Windows (chapter :ref:`building-on-windows`) for more information about this." +#: ../../extending/extending.rst:502 +msgid "" +"There are two more things to do before you can use your new extension: " +"compiling and linking it with the Python system. If you use dynamic " +"loading, the details may depend on the style of dynamic loading your system " +"uses; see the chapters about building extension modules " +"(chapter :ref:`building`) and additional information that pertains only to " +"building on Windows (chapter :ref:`building-on-windows`) for more " +"information about this." msgstr "" -msgid "If you can't use dynamic loading, or if you want to make your module a permanent part of the Python interpreter, you will have to change the configuration setup and rebuild the interpreter. Luckily, this is very simple on Unix: just place your file (:file:`spammodule.c` for example) in the :file:`Modules/` directory of an unpacked source distribution, add a line to the file :file:`Modules/Setup.local` describing your file:" +#: ../../extending/extending.rst:509 +msgid "" +"If you can't use dynamic loading, or if you want to make your module a " +"permanent part of the Python interpreter, you will have to change the " +"configuration setup and rebuild the interpreter. Luckily, this is very " +"simple on Unix: just place your file (:file:`spammodule.c` for example) in " +"the :file:`Modules/` directory of an unpacked source distribution, add a " +"line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" +#: ../../extending/extending.rst:516 msgid "spam spammodule.o" msgstr "" -msgid "and rebuild the interpreter by running :program:`make` in the toplevel directory. You can also run :program:`make` in the :file:`Modules/` subdirectory, but then you must first rebuild :file:`Makefile` there by running ':program:`make` Makefile'. (This is necessary each time you change the :file:`Setup` file.)" +#: ../../extending/extending.rst:520 +msgid "" +"and rebuild the interpreter by running :program:`make` in the toplevel " +"directory. You can also run :program:`make` in the :file:`Modules/` " +"subdirectory, but then you must first rebuild :file:`Makefile` there by " +"running ':program:`make` Makefile'. (This is necessary each time you change " +"the :file:`Setup` file.)" msgstr "" -msgid "If your module requires additional libraries to link with, these can be listed on the line in the configuration file as well, for instance:" +#: ../../extending/extending.rst:526 +msgid "" +"If your module requires additional libraries to link with, these can be " +"listed on the line in the configuration file as well, for instance:" msgstr "" +#: ../../extending/extending.rst:529 msgid "spam spammodule.o -lX11" msgstr "" +#: ../../extending/extending.rst:537 msgid "Calling Python Functions from C" msgstr "" -msgid "So far we have concentrated on making C functions callable from Python. The reverse is also useful: calling Python functions from C. This is especially the case for libraries that support so-called \"callback\" functions. If a C interface makes use of callbacks, the equivalent Python often needs to provide a callback mechanism to the Python programmer; the implementation will require calling the Python callback functions from a C callback. Other uses are also imaginable." +#: ../../extending/extending.rst:539 +msgid "" +"So far we have concentrated on making C functions callable from Python. The " +"reverse is also useful: calling Python functions from C. This is especially " +"the case for libraries that support so-called \"callback\" functions. If a " +"C interface makes use of callbacks, the equivalent Python often needs to " +"provide a callback mechanism to the Python programmer; the implementation " +"will require calling the Python callback functions from a C callback. Other " +"uses are also imaginable." msgstr "" -msgid "Fortunately, the Python interpreter is easily called recursively, and there is a standard interface to call a Python function. (I won't dwell on how to call the Python parser with a particular string as input --- if you're interested, have a look at the implementation of the :option:`-c` command line option in :file:`Modules/main.c` from the Python source code.)" +#: ../../extending/extending.rst:547 +msgid "" +"Fortunately, the Python interpreter is easily called recursively, and there " +"is a standard interface to call a Python function. (If you're interested in " +"how to call the Python parser with a particular string as input, " +"see :ref:`veryhigh`.)" msgstr "" -msgid "Calling a Python function is easy. First, the Python program must somehow pass you the Python function object. You should provide a function (or some other interface) to do this. When this function is called, save a pointer to the Python function object (be careful to :c:func:`Py_INCREF` it!) in a global variable --- or wherever you see fit. For example, the following function might be part of a module definition::" +#: ../../extending/extending.rst:551 +msgid "" +"Calling a Python function is easy. First, the Python program must somehow " +"pass you the Python function object. You should provide a function (or some " +"other interface) to do this. When this function is called, save a pointer " +"to the Python function object (be careful to :c:func:`Py_INCREF` it!) in a " +"global variable --- or wherever you see fit. For example, the following " +"function might be part of a module definition::" msgstr "" +#: ../../extending/extending.rst:558 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -476,7 +854,8 @@ msgid "" "\n" " if (PyArg_ParseTuple(args, \"O:set_callback\", &temp)) {\n" " if (!PyCallable_Check(temp)) {\n" -" PyErr_SetString(PyExc_TypeError, \"parameter must be callable\");\n" +" PyErr_SetString(PyExc_TypeError, \"parameter must be " +"callable\");\n" " return NULL;\n" " }\n" " Py_XINCREF(temp); /* Add a reference to new callback */\n" @@ -490,15 +869,36 @@ msgid "" "}" msgstr "" -msgid "This function must be registered with the interpreter using the :c:macro:`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its arguments are documented in section :ref:`parsetuple`." -msgstr "" - -msgid "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement the reference count of an object and are safe in the presence of ``NULL`` pointers (but note that *temp* will not be ``NULL`` in this context). More info on them in section :ref:`refcounts`." +#: ../../extending/extending.rst:581 +msgid "" +"This function must be registered with the interpreter using " +"the :c:macro:`METH_VARARGS` flag; this is described in " +"section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its " +"arguments are documented in section :ref:`parsetuple`." msgstr "" -msgid "Later, when it is time to call the function, you call the C function :c:func:`PyObject_CallObject`. This function has two arguments, both pointers to arbitrary Python objects: the Python function, and the argument list. The argument list must always be a tuple object, whose length is the number of arguments. To call the Python function with no arguments, pass in ``NULL``, or an empty tuple; to call it with one argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple when its format string consists of zero or more format codes between parentheses. For example::" +#: ../../extending/extending.rst:586 +msgid "" +"The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " +"the reference count of an object and are safe in the presence of ``NULL`` " +"pointers (but note that *temp* will not be ``NULL`` in this context). More " +"info on them in section :ref:`refcounts`." msgstr "" +#: ../../extending/extending.rst:593 +msgid "" +"Later, when it is time to call the function, you call the C " +"function :c:func:`PyObject_CallObject`. This function has two arguments, " +"both pointers to arbitrary Python objects: the Python function, and the " +"argument list. The argument list must always be a tuple object, whose " +"length is the number of arguments. To call the Python function with no " +"arguments, pass in ``NULL``, or an empty tuple; to call it with one " +"argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple " +"when its format string consists of zero or more format codes between " +"parentheses. For example::" +msgstr "" + +#: ../../extending/extending.rst:602 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -512,15 +912,37 @@ msgid "" "Py_DECREF(arglist);" msgstr "" -msgid ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the return value of the Python function. :c:func:`PyObject_CallObject` is \"reference-count-neutral\" with respect to its arguments. In the example a new tuple was created to serve as the argument list, which is :c:func:`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." +#: ../../extending/extending.rst:613 +msgid "" +":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " +"return value of the Python function. :c:func:`PyObject_CallObject` is " +"\"reference-count-neutral\" with respect to its arguments. In the example a " +"new tuple was created to serve as the argument list, which " +"is :c:func:`Py_DECREF`\\ -ed immediately after " +"the :c:func:`PyObject_CallObject` call." msgstr "" -msgid "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a brand new object, or it is an existing object whose reference count has been incremented. So, unless you want to save it in a global variable, you should somehow :c:func:`Py_DECREF` the result, even (especially!) if you are not interested in its value." +#: ../../extending/extending.rst:620 +msgid "" +"The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " +"brand new object, or it is an existing object whose reference count has been " +"incremented. So, unless you want to save it in a global variable, you " +"should somehow :c:func:`Py_DECREF` the result, even (especially!) if you are " +"not interested in its value." msgstr "" -msgid "Before you do this, however, it is important to check that the return value isn't ``NULL``. If it is, the Python function terminated by raising an exception. If the C code that called :c:func:`PyObject_CallObject` is called from Python, it should now return an error indication to its Python caller, so the interpreter can print a stack trace, or the calling Python code can handle the exception. If this is not possible or desirable, the exception should be cleared by calling :c:func:`PyErr_Clear`. For example::" +#: ../../extending/extending.rst:626 +msgid "" +"Before you do this, however, it is important to check that the return value " +"isn't ``NULL``. If it is, the Python function terminated by raising an " +"exception. If the C code that called :c:func:`PyObject_CallObject` is called " +"from Python, it should now return an error indication to its Python caller, " +"so the interpreter can print a stack trace, or the calling Python code can " +"handle the exception. If this is not possible or desirable, the exception " +"should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" +#: ../../extending/extending.rst:634 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" @@ -528,9 +950,19 @@ msgid "" "Py_DECREF(result);" msgstr "" -msgid "Depending on the desired interface to the Python callback function, you may also have to provide an argument list to :c:func:`PyObject_CallObject`. In some cases the argument list is also provided by the Python program, through the same interface that specified the callback function. It can then be saved and used in the same manner as the function object. In other cases, you may have to construct a new tuple to pass as the argument list. The simplest way to do this is to call :c:func:`Py_BuildValue`. For example, if you want to pass an integral event code, you might use the following code::" +#: ../../extending/extending.rst:639 +msgid "" +"Depending on the desired interface to the Python callback function, you may " +"also have to provide an argument list to :c:func:`PyObject_CallObject`. In " +"some cases the argument list is also provided by the Python program, through " +"the same interface that specified the callback function. It can then be " +"saved and used in the same manner as the function object. In other cases, " +"you may have to construct a new tuple to pass as the argument list. The " +"simplest way to do this is to call :c:func:`Py_BuildValue`. For example, if " +"you want to pass an integral event code, you might use the following code::" msgstr "" +#: ../../extending/extending.rst:648 msgid "" "PyObject *arglist;\n" "...\n" @@ -543,12 +975,23 @@ msgid "" "Py_DECREF(result);" msgstr "" -msgid "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, before the error check! Also note that strictly speaking this code is not complete: :c:func:`Py_BuildValue` may run out of memory, and this should be checked." +#: ../../extending/extending.rst:658 +msgid "" +"Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " +"before the error check! Also note that strictly speaking this code is not " +"complete: :c:func:`Py_BuildValue` may run out of memory, and this should be " +"checked." msgstr "" -msgid "You may also call a function with keyword arguments by using :c:func:`PyObject_Call`, which supports arguments and keyword arguments. As in the above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" +#: ../../extending/extending.rst:662 +msgid "" +"You may also call a function with keyword arguments by " +"using :c:func:`PyObject_Call`, which supports arguments and keyword " +"arguments. As in the above example, we use :c:func:`Py_BuildValue` to " +"construct the dictionary. ::" msgstr "" +#: ../../extending/extending.rst:666 msgid "" "PyObject *dict;\n" "...\n" @@ -561,27 +1004,46 @@ msgid "" "Py_DECREF(result);" msgstr "" +#: ../../extending/extending.rst:680 msgid "Extracting Parameters in Extension Functions" msgstr "" +#: ../../extending/extending.rst:684 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" +#: ../../extending/extending.rst:686 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" msgstr "" -msgid "The *arg* argument must be a tuple object containing an argument list passed from Python to a C function. The *format* argument must be a format string, whose syntax is explained in :ref:`arg-parsing` in the Python/C API Reference Manual. The remaining arguments must be addresses of variables whose type is determined by the format string." +#: ../../extending/extending.rst:688 +msgid "" +"The *arg* argument must be a tuple object containing an argument list passed " +"from Python to a C function. The *format* argument must be a format string, " +"whose syntax is explained in :ref:`arg-parsing` in the Python/C API " +"Reference Manual. The remaining arguments must be addresses of variables " +"whose type is determined by the format string." msgstr "" -msgid "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments have the required types, it cannot check the validity of the addresses of C variables passed to the call: if you make mistakes there, your code will probably crash or at least overwrite random bits in memory. So be careful!" +#: ../../extending/extending.rst:694 +msgid "" +"Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " +"have the required types, it cannot check the validity of the addresses of C " +"variables passed to the call: if you make mistakes there, your code will " +"probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -msgid "Note that any Python object references which are provided to the caller are *borrowed* references; do not decrement their reference count!" +#: ../../extending/extending.rst:699 +msgid "" +"Note that any Python object references which are provided to the caller are " +"*borrowed* references; do not decrement their reference count!" msgstr "" +#: ../../extending/extending.rst:702 msgid "Some example calls::" msgstr "" +#: ../../extending/extending.rst:709 msgid "" "int ok;\n" "int i, j;\n" @@ -593,22 +1055,27 @@ msgid "" " /* Python call: f() */" msgstr "" +#: ../../extending/extending.rst:720 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" +#: ../../extending/extending.rst:725 msgid "" -"ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string */\n" +"ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " +"*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" +#: ../../extending/extending.rst:730 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" +#: ../../extending/extending.rst:736 msgid "" "{\n" " const char *file;\n" @@ -623,6 +1090,7 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:750 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -634,6 +1102,7 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:761 msgid "" "{\n" " Py_complex c;\n" @@ -643,26 +1112,48 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:772 msgid "Keyword Parameters for Extension Functions" msgstr "" -msgid "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" +#: ../../extending/extending.rst:776 +msgid "" +"The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" +#: ../../extending/extending.rst:778 msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" -" const char *format, char * const *kwlist, ...);" +" const char *format, char * const " +"*kwlist, ...);" msgstr "" -msgid "The *arg* and *format* parameters are identical to those of the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of keywords received as the third parameter from the Python runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings which identify the parameters; the names are matched with the type information from *format* from left to right. On success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and raises an appropriate exception." +#: ../../extending/extending.rst:781 +msgid "" +"The *arg* and *format* parameters are identical to those of " +"the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the " +"dictionary of keywords received as the third parameter from the Python " +"runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings " +"which identify the parameters; the names are matched with the type " +"information from *format* from left to right. On " +"success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it " +"returns false and raises an appropriate exception." msgstr "" -msgid "Nested tuples cannot be parsed when using keyword arguments! Keyword parameters passed in which are not present in the *kwlist* will cause :exc:`TypeError` to be raised." +#: ../../extending/extending.rst:791 +msgid "" +"Nested tuples cannot be parsed when using keyword arguments! Keyword " +"parameters passed in which are not present in the *kwlist* will " +"cause :exc:`TypeError` to be raised." msgstr "" -msgid "Here is an example module which uses keywords, based on an example by Geoff Philbrick (philbrick@hks.com)::" +#: ../../extending/extending.rst:797 +msgid "" +"Here is an example module which uses keywords, based on an example by Geoff " +"Philbrick (philbrick@hks.com)::" msgstr "" +#: ../../extending/extending.rst:800 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -675,13 +1166,15 @@ msgid "" " const char *action = \"voom\";\n" " const char *type = \"Norwegian Blue\";\n" "\n" -" static char *kwlist[] = {\"voltage\", \"state\", \"action\", \"type\", NULL};\n" +" static char *kwlist[] = {\"voltage\", \"state\", \"action\", \"type\", " +"NULL};\n" "\n" " if (!PyArg_ParseTupleAndKeywords(args, keywds, \"i|sss\", kwlist,\n" " &voltage, &state, &action, &type))\n" " return NULL;\n" "\n" -" printf(\"-- This parrot wouldn't %s if you put %i Volts through it.\\n\",\n" +" printf(\"-- This parrot wouldn't %s if you put %i Volts through it." +"\\n\",\n" " action, voltage);\n" " printf(\"-- Lovely plumage, the %s -- It's %s!\\n\", type, state);\n" "\n" @@ -693,7 +1186,8 @@ msgid "" " * only take two PyObject* parameters, and keywdarg_parrot() takes\n" " * three.\n" " */\n" -" {\"parrot\", (PyCFunction)(void(*)(void))keywdarg_parrot, METH_VARARGS | METH_KEYWORDS,\n" +" {\"parrot\", (PyCFunction)(void(*)(void))keywdarg_parrot, METH_VARARGS | " +"METH_KEYWORDS,\n" " \"Print a lovely skit to standard output.\"},\n" " {NULL, NULL, 0, NULL} /* sentinel */\n" "};\n" @@ -712,24 +1206,46 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:851 msgid "Building Arbitrary Values" msgstr "" -msgid "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is declared as follows::" +#: ../../extending/extending.rst:853 +msgid "" +"This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " +"declared as follows::" msgstr "" +#: ../../extending/extending.rst:856 msgid "PyObject *Py_BuildValue(const char *format, ...);" msgstr "" -msgid "It recognizes a set of format units similar to the ones recognized by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the function, not output) must not be pointers, just values. It returns a new Python object, suitable for returning from a C function called from Python." +#: ../../extending/extending.rst:858 +msgid "" +"It recognizes a set of format units similar to the ones recognized " +"by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the " +"function, not output) must not be pointers, just values. It returns a new " +"Python object, suitable for returning from a C function called from Python." msgstr "" -msgid "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires its first argument to be a tuple (since Python argument lists are always represented as tuples internally), :c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple only if its format string contains two or more format units. If the format string is empty, it returns ``None``; if it contains exactly one format unit, it returns whatever object is described by that format unit. To force it to return a tuple of size 0 or one, parenthesize the format string." +#: ../../extending/extending.rst:863 +msgid "" +"One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " +"its first argument to be a tuple (since Python argument lists are always " +"represented as tuples internally), :c:func:`Py_BuildValue` does not always " +"build a tuple. It builds a tuple only if its format string contains two or " +"more format units. If the format string is empty, it returns ``None``; if it " +"contains exactly one format unit, it returns whatever object is described by " +"that format unit. To force it to return a tuple of size 0 or one, " +"parenthesize the format string." msgstr "" -msgid "Examples (to the left the call, to the right the resulting Python value):" +#: ../../extending/extending.rst:871 +msgid "" +"Examples (to the left the call, to the right the resulting Python value):" msgstr "" +#: ../../extending/extending.rst:873 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -750,81 +1266,245 @@ msgid "" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" msgstr "" +#: ../../extending/extending.rst:897 msgid "Reference Counts" msgstr "" -msgid "In languages like C or C++, the programmer is responsible for dynamic allocation and deallocation of memory on the heap. In C, this is done using the functions :c:func:`malloc` and :c:func:`free`. In C++, the operators ``new`` and ``delete`` are used with essentially the same meaning and we'll restrict the following discussion to the C case." -msgstr "" - -msgid "Every block of memory allocated with :c:func:`malloc` should eventually be returned to the pool of available memory by exactly one call to :c:func:`free`. It is important to call :c:func:`free` at the right time. If a block's address is forgotten but :c:func:`free` is not called for it, the memory it occupies cannot be reused until the program terminates. This is called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:`free` for a block and then continues to use the block, it creates a conflict with reuse of the block through another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It has the same bad consequences as referencing uninitialized data --- core dumps, wrong results, mysterious crashes." -msgstr "" - -msgid "Common causes of memory leaks are unusual paths through the code. For instance, a function may allocate a block of memory, do some calculation, and then free the block again. Now a change in the requirements for the function may add a test to the calculation that detects an error condition and can return prematurely from the function. It's easy to forget to free the allocated memory block when taking this premature exit, especially when it is added later to the code. Such leaks, once introduced, often go undetected for a long time: the error exit is taken only in a small fraction of all calls, and most modern machines have plenty of virtual memory, so the leak only becomes apparent in a long-running process that uses the leaking function frequently. Therefore, it's important to prevent leaks from happening by having a coding convention or strategy that minimizes this kind of errors." -msgstr "" - -msgid "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it needs a strategy to avoid memory leaks as well as the use of freed memory. The chosen method is called :dfn:`reference counting`. The principle is simple: every object contains a counter, which is incremented when a reference to the object is stored somewhere, and which is decremented when a reference to it is deleted. When the counter reaches zero, the last reference to the object has been deleted and the object is freed." -msgstr "" - -msgid "An alternative strategy is called :dfn:`automatic garbage collection`. (Sometimes, reference counting is also referred to as a garbage collection strategy, hence my use of \"automatic\" to distinguish the two.) The big advantage of automatic garbage collection is that the user doesn't need to call :c:func:`free` explicitly. (Another claimed advantage is an improvement in speed or memory usage --- this is no hard fact however.) The disadvantage is that for C, there is no truly portable automatic garbage collector, while reference counting can be implemented portably (as long as the functions :c:func:`malloc` and :c:func:`free` are available --- which the C Standard guarantees). Maybe some day a sufficiently portable automatic garbage collector will be available for C. Until then, we'll have to live with reference counts." +#: ../../extending/extending.rst:899 +msgid "" +"In languages like C or C++, the programmer is responsible for dynamic " +"allocation and deallocation of memory on the heap. In C, this is done using " +"the functions :c:func:`malloc` and :c:func:`free`. In C++, the operators " +"``new`` and ``delete`` are used with essentially the same meaning and we'll " +"restrict the following discussion to the C case." msgstr "" -msgid "While Python uses the traditional reference counting implementation, it also offers a cycle detector that works to detect reference cycles. This allows applications to not worry about creating direct or indirect circular references; these are the weakness of garbage collection implemented using only reference counting. Reference cycles consist of objects which contain (possibly indirect) references to themselves, so that each object in the cycle has a reference count which is non-zero. Typical reference counting implementations are not able to reclaim the memory belonging to any objects in a reference cycle, or referenced from the objects in the cycle, even though there are no further references to the cycle itself." +#: ../../extending/extending.rst:905 +msgid "" +"Every block of memory allocated with :c:func:`malloc` should eventually be " +"returned to the pool of available memory by exactly one call " +"to :c:func:`free`. It is important to call :c:func:`free` at the right " +"time. If a block's address is forgotten but :c:func:`free` is not called " +"for it, the memory it occupies cannot be reused until the program " +"terminates. This is called a :dfn:`memory leak`. On the other hand, if a " +"program calls :c:func:`free` for a block and then continues to use the " +"block, it creates a conflict with reuse of the block through " +"another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It " +"has the same bad consequences as referencing uninitialized data --- core " +"dumps, wrong results, mysterious crashes." +msgstr "" + +#: ../../extending/extending.rst:916 +msgid "" +"Common causes of memory leaks are unusual paths through the code. For " +"instance, a function may allocate a block of memory, do some calculation, " +"and then free the block again. Now a change in the requirements for the " +"function may add a test to the calculation that detects an error condition " +"and can return prematurely from the function. It's easy to forget to free " +"the allocated memory block when taking this premature exit, especially when " +"it is added later to the code. Such leaks, once introduced, often go " +"undetected for a long time: the error exit is taken only in a small fraction " +"of all calls, and most modern machines have plenty of virtual memory, so the " +"leak only becomes apparent in a long-running process that uses the leaking " +"function frequently. Therefore, it's important to prevent leaks from " +"happening by having a coding convention or strategy that minimizes this kind " +"of errors." +msgstr "" + +#: ../../extending/extending.rst:929 +msgid "" +"Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " +"needs a strategy to avoid memory leaks as well as the use of freed memory. " +"The chosen method is called :dfn:`reference counting`. The principle is " +"simple: every object contains a counter, which is incremented when a " +"reference to the object is stored somewhere, and which is decremented when a " +"reference to it is deleted. When the counter reaches zero, the last " +"reference to the object has been deleted and the object is freed." msgstr "" -msgid "The cycle detector is able to detect garbage cycles and can reclaim them. The :mod:`gc` module exposes a way to run the detector (the :func:`~gc.collect` function), as well as configuration interfaces and the ability to disable the detector at runtime." +#: ../../extending/extending.rst:937 +msgid "" +"An alternative strategy is called :dfn:`automatic garbage collection`. " +"(Sometimes, reference counting is also referred to as a garbage collection " +"strategy, hence the use of \"automatic\" to distinguish the two.) The big " +"advantage of automatic garbage collection is that the user doesn't need to " +"call :c:func:`free` explicitly. (Another claimed advantage is an " +"improvement in speed or memory usage --- this is no hard fact however.) The " +"disadvantage is that for C, there is no truly portable automatic garbage " +"collector, while reference counting can be implemented portably (as long as " +"the functions :c:func:`malloc` and :c:func:`free` are available --- which " +"the C Standard guarantees). Maybe some day a sufficiently portable automatic " +"garbage collector will be available for C. Until then, we'll have to live " +"with reference counts." +msgstr "" + +#: ../../extending/extending.rst:949 +msgid "" +"While Python uses the traditional reference counting implementation, it also " +"offers a cycle detector that works to detect reference cycles. This allows " +"applications to not worry about creating direct or indirect circular " +"references; these are the weakness of garbage collection implemented using " +"only reference counting. Reference cycles consist of objects which contain " +"(possibly indirect) references to themselves, so that each object in the " +"cycle has a reference count which is non-zero. Typical reference counting " +"implementations are not able to reclaim the memory belonging to any objects " +"in a reference cycle, or referenced from the objects in the cycle, even " +"though there are no further references to the cycle itself." +msgstr "" + +#: ../../extending/extending.rst:960 +msgid "" +"The cycle detector is able to detect garbage cycles and can reclaim them. " +"The :mod:`gc` module exposes a way to run the detector " +"(the :func:`~gc.collect` function), as well as configuration interfaces and " +"the ability to disable the detector at runtime." msgstr "" +#: ../../extending/extending.rst:969 msgid "Reference Counting in Python" msgstr "" -msgid "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle the incrementing and decrementing of the reference count. :c:func:`Py_DECREF` also frees the object when the count reaches zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, it makes a call through a function pointer in the object's :dfn:`type object`. For this purpose (and others), every object also contains a pointer to its type object." -msgstr "" - -msgid "The big question now remains: when to use ``Py_INCREF(x)`` and ``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an object; however, you can :dfn:`own a reference` to an object. An object's reference count is now defined as the number of owned references to it. The owner of a reference is responsible for calling :c:func:`Py_DECREF` when the reference is no longer needed. Ownership of a reference can be transferred. There are three ways to dispose of an owned reference: pass it on, store it, or call :c:func:`Py_DECREF`. Forgetting to dispose of an owned reference creates a memory leak." +#: ../../extending/extending.rst:971 +msgid "" +"There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " +"the incrementing and decrementing of the reference " +"count. :c:func:`Py_DECREF` also frees the object when the count reaches " +"zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, " +"it makes a call through a function pointer in the object's :dfn:`type " +"object`. For this purpose (and others), every object also contains a " +"pointer to its type object." msgstr "" -msgid "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The borrower of a reference should not call :c:func:`Py_DECREF`. The borrower must not hold on to the object longer than the owner from which it was borrowed. Using a borrowed reference after the owner has disposed of it risks using freed memory and should be avoided completely [#]_." +#: ../../extending/extending.rst:978 +msgid "" +"The big question now remains: when to use ``Py_INCREF(x)`` and " +"``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " +"object; however, you can :dfn:`own a reference` to an object. An object's " +"reference count is now defined as the number of owned references to it. The " +"owner of a reference is responsible for calling :c:func:`Py_DECREF` when the " +"reference is no longer needed. Ownership of a reference can be " +"transferred. There are three ways to dispose of an owned reference: pass it " +"on, store it, or call :c:func:`Py_DECREF`. Forgetting to dispose of an owned " +"reference creates a memory leak." +msgstr "" + +#: ../../extending/extending.rst:987 +msgid "" +"It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " +"borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " +"must not hold on to the object longer than the owner from which it was " +"borrowed. Using a borrowed reference after the owner has disposed of it " +"risks using freed memory and should be avoided completely [#]_." msgstr "" -msgid "The advantage of borrowing over owning a reference is that you don't need to take care of disposing of the reference on all possible paths through the code --- in other words, with a borrowed reference you don't run the risk of leaking when a premature exit is taken. The disadvantage of borrowing over owning is that there are some subtle situations where in seemingly correct code a borrowed reference can be used after the owner from which it was borrowed has in fact disposed of it." +#: ../../extending/extending.rst:993 +msgid "" +"The advantage of borrowing over owning a reference is that you don't need to " +"take care of disposing of the reference on all possible paths through the " +"code --- in other words, with a borrowed reference you don't run the risk of " +"leaking when a premature exit is taken. The disadvantage of borrowing over " +"owning is that there are some subtle situations where in seemingly correct " +"code a borrowed reference can be used after the owner from which it was " +"borrowed has in fact disposed of it." msgstr "" -msgid "A borrowed reference can be changed into an owned reference by calling :c:func:`Py_INCREF`. This does not affect the status of the owner from which the reference was borrowed --- it creates a new owned reference, and gives full owner responsibilities (the new owner must dispose of the reference properly, as well as the previous owner)." +#: ../../extending/extending.rst:1001 +msgid "" +"A borrowed reference can be changed into an owned reference by " +"calling :c:func:`Py_INCREF`. This does not affect the status of the owner " +"from which the reference was borrowed --- it creates a new owned reference, " +"and gives full owner responsibilities (the new owner must dispose of the " +"reference properly, as well as the previous owner)." msgstr "" +#: ../../extending/extending.rst:1011 msgid "Ownership Rules" msgstr "" -msgid "Whenever an object reference is passed into or out of a function, it is part of the function's interface specification whether ownership is transferred with the reference or not." +#: ../../extending/extending.rst:1013 +msgid "" +"Whenever an object reference is passed into or out of a function, it is part " +"of the function's interface specification whether ownership is transferred " +"with the reference or not." msgstr "" -msgid "Most functions that return a reference to an object pass on ownership with the reference. In particular, all functions whose function it is to create a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, pass ownership to the receiver. Even if the object is not actually new, you still receive ownership of a new reference to that object. For instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and can return a reference to a cached item." +#: ../../extending/extending.rst:1017 +msgid "" +"Most functions that return a reference to an object pass on ownership with " +"the reference. In particular, all functions whose function it is to create " +"a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, " +"pass ownership to the receiver. Even if the object is not actually new, you " +"still receive ownership of a new reference to that object. For " +"instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and " +"can return a reference to a cached item." msgstr "" -msgid "Many functions that extract objects from other objects also transfer ownership with the reference, for instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, however, since a few common routines are exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, and :c:func:`PyDict_GetItemString` all return references that you borrow from the tuple, list or dictionary." +#: ../../extending/extending.rst:1025 +msgid "" +"Many functions that extract objects from other objects also transfer " +"ownership with the reference, for " +"instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, " +"however, since a few common routines are " +"exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, " +"and :c:func:`PyDict_GetItemString` all return references that you borrow " +"from the tuple, list or dictionary." msgstr "" -msgid "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, even though it may actually create the object it returns: this is possible because an owned reference to the object is stored in ``sys.modules``." +#: ../../extending/extending.rst:1032 +msgid "" +"The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " +"even though it may actually create the object it returns: this is possible " +"because an owned reference to the object is stored in ``sys.modules``." msgstr "" -msgid "When you pass an object reference into another function, in general, the function borrows the reference from you --- if it needs to store it, it will use :c:func:`Py_INCREF` to become an independent owner. There are exactly two important exceptions to this rule: :c:func:`PyTuple_SetItem` and :c:func:`PyList_SetItem`. These functions take over ownership of the item passed to them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they are \"normal.\")" +#: ../../extending/extending.rst:1036 +msgid "" +"When you pass an object reference into another function, in general, the " +"function borrows the reference from you --- if it needs to store it, it will " +"use :c:func:`Py_INCREF` to become an independent owner. There are exactly " +"two important exceptions to this rule: :c:func:`PyTuple_SetItem` " +"and :c:func:`PyList_SetItem`. These functions take over ownership of the " +"item passed to them --- even if they fail! (Note " +"that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they " +"are \"normal.\")" msgstr "" -msgid "When a C function is called from Python, it borrows references to its arguments from the caller. The caller owns a reference to the object, so the borrowed reference's lifetime is guaranteed until the function returns. Only when such a borrowed reference must be stored or passed on, it must be turned into an owned reference by calling :c:func:`Py_INCREF`." +#: ../../extending/extending.rst:1044 +msgid "" +"When a C function is called from Python, it borrows references to its " +"arguments from the caller. The caller owns a reference to the object, so " +"the borrowed reference's lifetime is guaranteed until the function returns. " +"Only when such a borrowed reference must be stored or passed on, it must be " +"turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -msgid "The object reference returned from a C function that is called from Python must be an owned reference --- ownership is transferred from the function to its caller." +#: ../../extending/extending.rst:1050 +msgid "" +"The object reference returned from a C function that is called from Python " +"must be an owned reference --- ownership is transferred from the function to " +"its caller." msgstr "" +#: ../../extending/extending.rst:1058 msgid "Thin Ice" msgstr "" -msgid "There are a few situations where seemingly harmless use of a borrowed reference can lead to problems. These all have to do with implicit invocations of the interpreter, which can cause the owner of a reference to dispose of it." +#: ../../extending/extending.rst:1060 +msgid "" +"There are a few situations where seemingly harmless use of a borrowed " +"reference can lead to problems. These all have to do with implicit " +"invocations of the interpreter, which can cause the owner of a reference to " +"dispose of it." msgstr "" -msgid "The first and most important case to know about is using :c:func:`Py_DECREF` on an unrelated object while borrowing a reference to a list item. For instance::" +#: ../../extending/extending.rst:1064 +msgid "" +"The first and most important case to know about is using :c:func:`Py_DECREF` " +"on an unrelated object while borrowing a reference to a list item. For " +"instance::" msgstr "" +#: ../../extending/extending.rst:1067 msgid "" "void\n" "bug(PyObject *list)\n" @@ -836,18 +1516,48 @@ msgid "" "}" msgstr "" -msgid "This function first borrows a reference to ``list[0]``, then replaces ``list[1]`` with the value ``0``, and finally prints the borrowed reference. Looks harmless, right? But it's not!" -msgstr "" - -msgid "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns references to all its items, so when item 1 is replaced, it has to dispose of the original item 1. Now let's suppose the original item 1 was an instance of a user-defined class, and let's further suppose that the class defined a :meth:`!__del__` method. If this class instance has a reference count of 1, disposing of it will call its :meth:`!__del__` method. Internally, :c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the replaced item, which invokes replaced item's corresponding :c:member:`~PyTypeObject.tp_dealloc` function. During deallocation, :c:member:`~PyTypeObject.tp_dealloc` calls :c:member:`~PyTypeObject.tp_finalize`, which is mapped to the :meth:`!__del__` method for class instances (see :pep:`442`). This entire sequence happens synchronously within the :c:func:`PyList_SetItem` call." +#: ../../extending/extending.rst:1076 +msgid "" +"This function first borrows a reference to ``list[0]``, then replaces " +"``list[1]`` with the value ``0``, and finally prints the borrowed reference. " +"Looks harmless, right? But it's not!" msgstr "" -msgid "Since it is written in Python, the :meth:`!__del__` method can execute arbitrary Python code. Could it perhaps do something to invalidate the reference to ``item`` in :c:func:`!bug`? You bet! Assuming that the list passed into :c:func:`!bug` is accessible to the :meth:`!__del__` method, it could execute a statement to the effect of ``del list[0]``, and assuming this was the last reference to that object, it would free the memory associated with it, thereby invalidating ``item``." +#: ../../extending/extending.rst:1080 +msgid "" +"Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " +"references to all its items, so when item 1 is replaced, it has to dispose " +"of the original item 1. Now let's suppose the original item 1 was an " +"instance of a user-defined class, and let's further suppose that the class " +"defined a :meth:`!__del__` method. If this class instance has a reference " +"count of 1, disposing of it will call its :meth:`!__del__` method. " +"Internally, :c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the " +"replaced item, which invokes replaced item's " +"corresponding :c:member:`~PyTypeObject.tp_dealloc` function. During " +"deallocation, :c:member:`~PyTypeObject.tp_dealloc` " +"calls :c:member:`~PyTypeObject.tp_finalize`, which is mapped to the :meth:`!" +"__del__` method for class instances (see :pep:`442`). This entire sequence " +"happens synchronously within the :c:func:`PyList_SetItem` call." +msgstr "" + +#: ../../extending/extending.rst:1094 +msgid "" +"Since it is written in Python, the :meth:`!__del__` method can execute " +"arbitrary Python code. Could it perhaps do something to invalidate the " +"reference to ``item`` in :c:func:`!bug`? You bet! Assuming that the list " +"passed into :c:func:`!bug` is accessible to the :meth:`!__del__` method, it " +"could execute a statement to the effect of ``del list[0]``, and assuming " +"this was the last reference to that object, it would free the memory " +"associated with it, thereby invalidating ``item``." msgstr "" -msgid "The solution, once you know the source of the problem, is easy: temporarily increment the reference count. The correct version of the function reads::" +#: ../../extending/extending.rst:1102 +msgid "" +"The solution, once you know the source of the problem, is easy: temporarily " +"increment the reference count. The correct version of the function reads::" msgstr "" +#: ../../extending/extending.rst:1105 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -861,12 +1571,28 @@ msgid "" "}" msgstr "" -msgid "This is a true story. An older version of Python contained variants of this bug and someone spent a considerable amount of time in a C debugger to figure out why his :meth:`!__del__` methods would fail..." -msgstr "" - -msgid "The second case of problems with a borrowed reference is a variant involving threads. Normally, multiple threads in the Python interpreter can't get in each other's way, because there is a :term:`global lock ` protecting Python's entire object space. However, it is possible to temporarily release this lock using the macro :c:macro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it using :c:macro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O calls, to let other threads use the processor while waiting for the I/O to complete. Obviously, the following function has the same problem as the previous one::" +#: ../../extending/extending.rst:1116 +msgid "" +"This is a true story. An older version of Python contained variants of this " +"bug and someone spent a considerable amount of time in a C debugger to " +"figure out why his :meth:`!__del__` methods would fail..." msgstr "" +#: ../../extending/extending.rst:1120 +msgid "" +"The second case of problems with a borrowed reference is a variant involving " +"threads. Normally, multiple threads in the Python interpreter can't get in " +"each other's way, because there is a :term:`global lock ` protecting Python's entire object space. However, it is possible to " +"temporarily release this lock using the " +"macro :c:macro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it " +"using :c:macro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O " +"calls, to let other threads use the processor while waiting for the I/O to " +"complete. Obviously, the following function has the same problem as the " +"previous one::" +msgstr "" + +#: ../../extending/extending.rst:1130 msgid "" "void\n" "bug(PyObject *list)\n" @@ -879,72 +1605,195 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:1144 msgid "NULL Pointers" msgstr "" -msgid "In general, functions that take object references as arguments do not expect you to pass them ``NULL`` pointers, and will dump core (or cause later core dumps) if you do so. Functions that return object references generally return ``NULL`` only to indicate that an exception occurred. The reason for not testing for ``NULL`` arguments is that functions often pass the objects they receive on to other function --- if each function were to test for ``NULL``, there would be a lot of redundant tests and the code would run more slowly." +#: ../../extending/extending.rst:1146 +msgid "" +"In general, functions that take object references as arguments do not expect " +"you to pass them ``NULL`` pointers, and will dump core (or cause later core " +"dumps) if you do so. Functions that return object references generally " +"return ``NULL`` only to indicate that an exception occurred. The reason for " +"not testing for ``NULL`` arguments is that functions often pass the objects " +"they receive on to other function --- if each function were to test for " +"``NULL``, there would be a lot of redundant tests and the code would run " +"more slowly." msgstr "" -msgid "It is better to test for ``NULL`` only at the \"source:\" when a pointer that may be ``NULL`` is received, for example, from :c:func:`malloc` or from a function that may raise an exception." +#: ../../extending/extending.rst:1154 +msgid "" +"It is better to test for ``NULL`` only at the \"source:\" when a pointer " +"that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " +"a function that may raise an exception." msgstr "" -msgid "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for ``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` do." +#: ../../extending/extending.rst:1158 +msgid "" +"The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " +"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` " +"and :c:func:`Py_XDECREF` do." msgstr "" -msgid "The macros for checking for a particular object type (``Pytype_Check()``) don't check for ``NULL`` pointers --- again, there is much code that calls several of these in a row to test an object against various different expected types, and this would generate redundant tests. There are no variants with ``NULL`` checking." +#: ../../extending/extending.rst:1162 +msgid "" +"The macros for checking for a particular object type (``Pytype_Check()``) " +"don't check for ``NULL`` pointers --- again, there is much code that calls " +"several of these in a row to test an object against various different " +"expected types, and this would generate redundant tests. There are no " +"variants with ``NULL`` checking." msgstr "" -msgid "The C function calling mechanism guarantees that the argument list passed to C functions (``args`` in the examples) is never ``NULL`` --- in fact it guarantees that it is always a tuple [#]_." +#: ../../extending/extending.rst:1168 +msgid "" +"The C function calling mechanism guarantees that the argument list passed to " +"C functions (``args`` in the examples) is never ``NULL`` --- in fact it " +"guarantees that it is always a tuple [#]_." msgstr "" -msgid "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python user." +#: ../../extending/extending.rst:1172 +msgid "" +"It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " +"user." msgstr "" +#: ../../extending/extending.rst:1183 msgid "Writing Extensions in C++" msgstr "" -msgid "It is possible to write extension modules in C++. Some restrictions apply. If the main program (the Python interpreter) is compiled and linked by the C compiler, global or static objects with constructors cannot be used. This is not a problem if the main program is linked by the C++ compiler. Functions that will be called by the Python interpreter (in particular, module initialization functions) have to be declared using ``extern \"C\"``. It is unnecessary to enclose the Python header files in ``extern \"C\" {...}`` --- they use this form already if the symbol ``__cplusplus`` is defined (all recent C++ compilers define this symbol)." -msgstr "" - +#: ../../extending/extending.rst:1185 +msgid "" +"It is possible to write extension modules in C++. Some restrictions apply. " +"If the main program (the Python interpreter) is compiled and linked by the C " +"compiler, global or static objects with constructors cannot be used. This " +"is not a problem if the main program is linked by the C++ compiler. " +"Functions that will be called by the Python interpreter (in particular, " +"module initialization functions) have to be declared using ``extern \"C\"``. " +"It is unnecessary to enclose the Python header files in ``extern \"C\" {...}" +"`` --- they use this form already if the symbol ``__cplusplus`` is defined " +"(all recent C++ compilers define this symbol)." +msgstr "" + +#: ../../extending/extending.rst:1199 msgid "Providing a C API for an Extension Module" msgstr "" -msgid "Many extension modules just provide new functions and types to be used from Python, but sometimes the code in an extension module can be useful for other extension modules. For example, an extension module could implement a type \"collection\" which works like lists without order. Just like the standard Python list type has a C API which permits extension modules to create and manipulate lists, this new collection type should have a set of C functions for direct manipulation from other extension modules." -msgstr "" - -msgid "At first sight this seems easy: just write the functions (without declaring them ``static``, of course), provide an appropriate header file, and document the C API. And in fact this would work if all extension modules were always linked statically with the Python interpreter. When modules are used as shared libraries, however, the symbols defined in one module may not be visible to another module. The details of visibility depend on the operating system; some systems use one global namespace for the Python interpreter and all extension modules (Windows, for example), whereas others require an explicit list of imported symbols at module link time (AIX is one example), or offer a choice of different strategies (most Unices). And even if symbols are globally visible, the module whose functions one wishes to call might not have been loaded yet!" +#: ../../extending/extending.rst:1204 +msgid "" +"Many extension modules just provide new functions and types to be used from " +"Python, but sometimes the code in an extension module can be useful for " +"other extension modules. For example, an extension module could implement a " +"type \"collection\" which works like lists without order. Just like the " +"standard Python list type has a C API which permits extension modules to " +"create and manipulate lists, this new collection type should have a set of C " +"functions for direct manipulation from other extension modules." msgstr "" -msgid "Portability therefore requires not to make any assumptions about symbol visibility. This means that all symbols in extension modules should be declared ``static``, except for the module's initialization function, in order to avoid name clashes with other extension modules (as discussed in section :ref:`methodtable`). And it means that symbols that *should* be accessible from other extension modules must be exported in a different way." +#: ../../extending/extending.rst:1212 +msgid "" +"At first sight this seems easy: just write the functions (without declaring " +"them ``static``, of course), provide an appropriate header file, and " +"document the C API. And in fact this would work if all extension modules " +"were always linked statically with the Python interpreter. When modules are " +"used as shared libraries, however, the symbols defined in one module may not " +"be visible to another module. The details of visibility depend on the " +"operating system; some systems use one global namespace for the Python " +"interpreter and all extension modules (Windows, for example), whereas others " +"require an explicit list of imported symbols at module link time (AIX is one " +"example), or offer a choice of different strategies (most Unices). And even " +"if symbols are globally visible, the module whose functions one wishes to " +"call might not have been loaded yet!" +msgstr "" + +#: ../../extending/extending.rst:1224 +msgid "" +"Portability therefore requires not to make any assumptions about symbol " +"visibility. This means that all symbols in extension modules should be " +"declared ``static``, except for the module's initialization function, in " +"order to avoid name clashes with other extension modules (as discussed in " +"section :ref:`methodtable`). And it means that symbols that *should* be " +"accessible from other extension modules must be exported in a different way." msgstr "" -msgid "Python provides a special mechanism to pass C-level information (pointers) from one extension module to another one: Capsules. A Capsule is a Python data type which stores a pointer (:c:expr:`void \\*`). Capsules can only be created and accessed via their C API, but they can be passed around like any other Python object. In particular, they can be assigned to a name in an extension module's namespace. Other extension modules can then import this module, retrieve the value of this name, and then retrieve the pointer from the Capsule." +#: ../../extending/extending.rst:1231 +msgid "" +"Python provides a special mechanism to pass C-level information (pointers) " +"from one extension module to another one: Capsules. A Capsule is a Python " +"data type which stores a pointer (:c:expr:`void \\*`). Capsules can only be " +"created and accessed via their C API, but they can be passed around like any " +"other Python object. In particular, they can be assigned to a name in an " +"extension module's namespace. Other extension modules can then import this " +"module, retrieve the value of this name, and then retrieve the pointer from " +"the Capsule." msgstr "" -msgid "There are many ways in which Capsules can be used to export the C API of an extension module. Each function could get its own Capsule, or all C API pointers could be stored in an array whose address is published in a Capsule. And the various tasks of storing and retrieving the pointers can be distributed in different ways between the module providing the code and the client modules." +#: ../../extending/extending.rst:1239 +msgid "" +"There are many ways in which Capsules can be used to export the C API of an " +"extension module. Each function could get its own Capsule, or all C API " +"pointers could be stored in an array whose address is published in a " +"Capsule. And the various tasks of storing and retrieving the pointers can be " +"distributed in different ways between the module providing the code and the " +"client modules." msgstr "" -msgid "Whichever method you choose, it's important to name your Capsules properly. The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const char \\*`); you're permitted to pass in a ``NULL`` name, but we strongly encourage you to specify a name. Properly named Capsules provide a degree of runtime type-safety; there is no feasible way to tell one unnamed Capsule from another." +#: ../../extending/extending.rst:1245 +msgid "" +"Whichever method you choose, it's important to name your Capsules properly. " +"The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " +"char \\*`); you're permitted to pass in a ``NULL`` name, but we strongly " +"encourage you to specify a name. Properly named Capsules provide a degree " +"of runtime type-safety; there is no feasible way to tell one unnamed Capsule " +"from another." msgstr "" -msgid "In particular, Capsules used to expose C APIs should be given a name following this convention::" +#: ../../extending/extending.rst:1252 +msgid "" +"In particular, Capsules used to expose C APIs should be given a name " +"following this convention::" msgstr "" +#: ../../extending/extending.rst:1255 msgid "modulename.attributename" msgstr "" -msgid "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a C API provided via a Capsule, but only if the Capsule's name matches this convention. This behavior gives C API users a high degree of certainty that the Capsule they load contains the correct C API." +#: ../../extending/extending.rst:1257 +msgid "" +"The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " +"C API provided via a Capsule, but only if the Capsule's name matches this " +"convention. This behavior gives C API users a high degree of certainty that " +"the Capsule they load contains the correct C API." msgstr "" -msgid "The following example demonstrates an approach that puts most of the burden on the writer of the exporting module, which is appropriate for commonly used library modules. It stores all C API pointers (just one in the example!) in an array of :c:expr:`void` pointers which becomes the value of a Capsule. The header file corresponding to the module provides a macro that takes care of importing the module and retrieving its C API pointers; client modules only have to call this macro before accessing the C API." +#: ../../extending/extending.rst:1262 +msgid "" +"The following example demonstrates an approach that puts most of the burden " +"on the writer of the exporting module, which is appropriate for commonly " +"used library modules. It stores all C API pointers (just one in the " +"example!) in an array of :c:expr:`void` pointers which becomes the value of " +"a Capsule. The header file corresponding to the module provides a macro that " +"takes care of importing the module and retrieving its C API pointers; client " +"modules only have to call this macro before accessing the C API." msgstr "" -msgid "The exporting module is a modification of the :mod:`!spam` module from section :ref:`extending-simpleexample`. The function :func:`!spam.system` does not call the C library function :c:func:`system` directly, but a function :c:func:`!PySpam_System`, which would of course do something more complicated in reality (such as adding \"spam\" to every command). This function :c:func:`!PySpam_System` is also exported to other extension modules." +#: ../../extending/extending.rst:1270 +msgid "" +"The exporting module is a modification of the :mod:`!spam` module from " +"section :ref:`extending-simpleexample`. The function :func:`!spam.system` " +"does not call the C library function :c:func:`system` directly, but a " +"function :c:func:`!PySpam_System`, which would of course do something more " +"complicated in reality (such as adding \"spam\" to every command). This " +"function :c:func:`!PySpam_System` is also exported to other extension " +"modules." msgstr "" -msgid "The function :c:func:`!PySpam_System` is a plain C function, declared ``static`` like everything else::" +#: ../../extending/extending.rst:1277 +msgid "" +"The function :c:func:`!PySpam_System` is a plain C function, declared " +"``static`` like everything else::" msgstr "" +#: ../../extending/extending.rst:1280 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -953,9 +1802,11 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:1286 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" +#: ../../extending/extending.rst:1288 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -970,23 +1821,33 @@ msgid "" "}" msgstr "" +#: ../../extending/extending.rst:1300 msgid "In the beginning of the module, right after the line ::" msgstr "" +#: ../../extending/extending.rst:1302 msgid "#include " msgstr "" +#: ../../extending/extending.rst:1304 msgid "two more lines must be added::" msgstr "" +#: ../../extending/extending.rst:1306 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" msgstr "" -msgid "The ``#define`` is used to tell the header file that it is being included in the exporting module, not a client module. Finally, the module's :c:data:`mod_exec ` function must take care of initializing the C API pointer array::" +#: ../../extending/extending.rst:1309 +msgid "" +"The ``#define`` is used to tell the header file that it is being included in " +"the exporting module, not a client module. Finally, the " +"module's :c:data:`mod_exec ` function must take care of " +"initializing the C API pointer array::" msgstr "" +#: ../../extending/extending.rst:1313 msgid "" "static int\n" "spam_module_exec(PyObject *m)\n" @@ -998,7 +1859,8 @@ msgid "" " PySpam_API[PySpam_System_NUM] = (void *)PySpam_System;\n" "\n" " /* Create a Capsule containing the API pointer array's address */\n" -" c_api_object = PyCapsule_New((void *)PySpam_API, \"spam._C_API\", NULL);\n" +" c_api_object = PyCapsule_New((void *)PySpam_API, \"spam._C_API\", " +"NULL);\n" "\n" " if (PyModule_Add(m, \"_C_API\", c_api_object) < 0) {\n" " return -1;\n" @@ -1008,12 +1870,19 @@ msgid "" "}" msgstr "" -msgid "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array would disappear when :c:func:`!PyInit_spam` terminates!" +#: ../../extending/extending.rst:1332 +msgid "" +"Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " +"would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -msgid "The bulk of the work is in the header file :file:`spammodule.h`, which looks like this::" +#: ../../extending/extending.rst:1335 +msgid "" +"The bulk of the work is in the header file :file:`spammodule.h`, which looks " +"like this::" msgstr "" +#: ../../extending/extending.rst:1338 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -1043,7 +1912,8 @@ msgid "" "static void **PySpam_API;\n" "\n" "#define PySpam_System \\\n" -" (*(PySpam_System_RETURN (*)PySpam_System_PROTO) PySpam_API[PySpam_System_NUM])\n" +" (*(PySpam_System_RETURN (*)PySpam_System_PROTO) " +"PySpam_API[PySpam_System_NUM])\n" "\n" "/* Return -1 on error, 0 on success.\n" " * PyCapsule_Import will set an exception if there's an error.\n" @@ -1064,9 +1934,15 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -msgid "All that a client module must do in order to have access to the function :c:func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!import_spam` in its :c:data:`mod_exec ` function::" +#: ../../extending/extending.rst:1386 +msgid "" +"All that a client module must do in order to have access to the " +"function :c:func:`!PySpam_System` is to call the function (or rather " +"macro) :c:func:`!import_spam` in its :c:data:`mod_exec ` " +"function::" msgstr "" +#: ../../extending/extending.rst:1390 msgid "" "static int\n" "client_module_exec(PyObject *m)\n" @@ -1079,35 +1955,64 @@ msgid "" "}" msgstr "" -msgid "The main disadvantage of this approach is that the file :file:`spammodule.h` is rather complicated. However, the basic structure is the same for each function that is exported, so it has to be learned only once." +#: ../../extending/extending.rst:1400 +msgid "" +"The main disadvantage of this approach is that the file :file:`spammodule.h` " +"is rather complicated. However, the basic structure is the same for each " +"function that is exported, so it has to be learned only once." msgstr "" -msgid "Finally it should be mentioned that Capsules offer additional functionality, which is especially useful for memory allocation and deallocation of the pointer stored in a Capsule. The details are described in the Python/C API Reference Manual in the section :ref:`capsules` and in the implementation of Capsules (files :file:`Include/pycapsule.h` and :file:`Objects/pycapsule.c` in the Python source code distribution)." +#: ../../extending/extending.rst:1404 +msgid "" +"Finally it should be mentioned that Capsules offer additional functionality, " +"which is especially useful for memory allocation and deallocation of the " +"pointer stored in a Capsule. The details are described in the Python/C API " +"Reference Manual in the section :ref:`capsules` and in the implementation of " +"Capsules (files :file:`Include/pycapsule.h` and :file:`Objects/pycapsule.c` " +"in the Python source code distribution)." msgstr "" +#: ../../extending/extending.rst:1412 msgid "Footnotes" msgstr "" -msgid "An interface for this function already exists in the standard module :mod:`os` --- it was chosen as a simple and straightforward example." +#: ../../extending/extending.rst:1413 +msgid "" +"An interface for this function already exists in the standard " +"module :mod:`os` --- it was chosen as a simple and straightforward example." msgstr "" -msgid "The metaphor of \"borrowing\" a reference is not completely correct: the owner still has a copy of the reference." +#: ../../extending/extending.rst:1416 +msgid "" +"The metaphor of \"borrowing\" a reference is not completely correct: the " +"owner still has a copy of the reference." msgstr "" -msgid "Checking that the reference count is at least 1 **does not work** --- the reference count itself could be in freed memory and may thus be reused for another object!" +#: ../../extending/extending.rst:1419 +msgid "" +"Checking that the reference count is at least 1 **does not work** --- the " +"reference count itself could be in freed memory and may thus be reused for " +"another object!" msgstr "" -msgid "These guarantees don't hold when you use the \"old\" style calling convention --- this is still found in much existing code." +#: ../../extending/extending.rst:1423 +msgid "" +"These guarantees don't hold when you use the \"old\" style calling " +"convention --- this is still found in much existing code." msgstr "" +#: ../../extending/extending.rst:591 msgid "PyObject_CallObject (C function)" msgstr "" +#: ../../extending/extending.rst:682 msgid "PyArg_ParseTuple (C function)" msgstr "" +#: ../../extending/extending.rst:774 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "" +#: ../../extending/extending.rst:795 msgid "Philbrick, Geoff" msgstr "" diff --git a/extending/index.po b/extending/index.po index cb617ebef..2c7bce88e 100644 --- a/extending/index.po +++ b/extending/index.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,35 +21,72 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/index.rst:5 msgid "Extending and Embedding the Python Interpreter" msgstr "" -msgid "This document describes how to write modules in C or C++ to extend the Python interpreter with new modules. Those modules can not only define new functions but also new object types and their methods. The document also describes how to embed the Python interpreter in another application, for use as an extension language. Finally, it shows how to compile and link extension modules so that they can be loaded dynamically (at run time) into the interpreter, if the underlying operating system supports this feature." +#: ../../extending/index.rst:7 +msgid "" +"This document describes how to write modules in C or C++ to extend the " +"Python interpreter with new modules. Those modules can not only define new " +"functions but also new object types and their methods. The document also " +"describes how to embed the Python interpreter in another application, for " +"use as an extension language. Finally, it shows how to compile and link " +"extension modules so that they can be loaded dynamically (at run time) into " +"the interpreter, if the underlying operating system supports this feature." msgstr "" -msgid "This document assumes basic knowledge about Python. For an informal introduction to the language, see :ref:`tutorial-index`. :ref:`reference-index` gives a more formal definition of the language. :ref:`library-index` documents the existing object types, functions and modules (both built-in and written in Python) that give the language its wide application range." +#: ../../extending/index.rst:15 +msgid "" +"This document assumes basic knowledge about Python. For an informal " +"introduction to the language, see :ref:`tutorial-index`. :ref:`reference-" +"index` gives a more formal definition of the language. :ref:`library-index` " +"documents the existing object types, functions and modules (both built-in " +"and written in Python) that give the language its wide application range." msgstr "" -msgid "For a detailed description of the whole Python/C API, see the separate :ref:`c-api-index`." +#: ../../extending/index.rst:21 +msgid "" +"For a detailed description of the whole Python/C API, see the " +"separate :ref:`c-api-index`." msgstr "" +#: ../../extending/index.rst:26 msgid "Recommended third party tools" msgstr "" -msgid "This guide only covers the basic tools for creating extensions provided as part of this version of CPython. Some :ref:`third party tools ` offer both simpler and more sophisticated approaches to creating C and C++ extensions for Python." +#: ../../extending/index.rst:28 +msgid "" +"This guide only covers the basic tools for creating extensions provided as " +"part of this version of CPython. Some :ref:`third party tools ` " +"offer both simpler and more sophisticated approaches to creating C and C++ " +"extensions for Python." msgstr "" +#: ../../extending/index.rst:35 msgid "Creating extensions without third party tools" msgstr "" -msgid "This section of the guide covers creating C and C++ extensions without assistance from third party tools. It is intended primarily for creators of those tools, rather than being a recommended way to create your own C extensions." +#: ../../extending/index.rst:37 +msgid "" +"This section of the guide covers creating C and C++ extensions without " +"assistance from third party tools. It is intended primarily for creators of " +"those tools, rather than being a recommended way to create your own C " +"extensions." msgstr "" +#: ../../extending/index.rst:44 msgid ":pep:`489` -- Multi-phase extension module initialization" msgstr "" +#: ../../extending/index.rst:57 msgid "Embedding the CPython runtime in a larger application" msgstr "" -msgid "Sometimes, rather than creating an extension that runs inside the Python interpreter as the main application, it is desirable to instead embed the CPython runtime inside a larger application. This section covers some of the details involved in doing that successfully." +#: ../../extending/index.rst:59 +msgid "" +"Sometimes, rather than creating an extension that runs inside the Python " +"interpreter as the main application, it is desirable to instead embed the " +"CPython runtime inside a larger application. This section covers some of the " +"details involved in doing that successfully." msgstr "" diff --git a/extending/newtypes.po b/extending/newtypes.po index b680816e6..59af9c7a2 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,15 +24,23 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/newtypes.rst:7 msgid "Defining Extension Types: Assorted Topics" msgstr "" -msgid "This section aims to give a quick fly-by on the various type methods you can implement and what they do." +#: ../../extending/newtypes.rst:11 +msgid "" +"This section aims to give a quick fly-by on the various type methods you can " +"implement and what they do." msgstr "" -msgid "Here is the definition of :c:type:`PyTypeObject`, with some fields only used in :ref:`debug builds ` omitted:" +#: ../../extending/newtypes.rst:14 +msgid "" +"Here is the definition of :c:type:`PyTypeObject`, with some fields only used " +"in :ref:`debug builds ` omitted:" msgstr "" +#: ../../extending/newtypes.rst:17 msgid "" "typedef struct _typeobject {\n" " PyObject_VAR_HEAD\n" @@ -131,42 +139,81 @@ msgid "" "} PyTypeObject;\n" msgstr "" -msgid "Now that's a *lot* of methods. Don't worry too much though -- if you have a type you want to define, the chances are very good that you will only implement a handful of these." +#: ../../extending/newtypes.rst:20 +msgid "" +"Now that's a *lot* of methods. Don't worry too much though -- if you have a " +"type you want to define, the chances are very good that you will only " +"implement a handful of these." msgstr "" -msgid "As you probably expect by now, we're going to go over this and give more information about the various handlers. We won't go in the order they are defined in the structure, because there is a lot of historical baggage that impacts the ordering of the fields. It's often easiest to find an example that includes the fields you need and then change the values to suit your new type. ::" +#: ../../extending/newtypes.rst:24 +msgid "" +"As you probably expect by now, we're going to go over this and give more " +"information about the various handlers. We won't go in the order they are " +"defined in the structure, because there is a lot of historical baggage that " +"impacts the ordering of the fields. It's often easiest to find an example " +"that includes the fields you need and then change the values to suit your " +"new type. ::" msgstr "" +#: ../../extending/newtypes.rst:31 msgid "const char *tp_name; /* For printing */" msgstr "" -msgid "The name of the type -- as mentioned in the previous chapter, this will appear in various places, almost entirely for diagnostic purposes. Try to choose something that will be helpful in such a situation! ::" +#: ../../extending/newtypes.rst:33 +msgid "" +"The name of the type -- as mentioned in the previous chapter, this will " +"appear in various places, almost entirely for diagnostic purposes. Try to " +"choose something that will be helpful in such a situation! ::" msgstr "" +#: ../../extending/newtypes.rst:37 msgid "Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */" msgstr "" -msgid "These fields tell the runtime how much memory to allocate when new objects of this type are created. Python has some built-in support for variable length structures (think: strings, tuples) which is where the :c:member:`~PyTypeObject.tp_itemsize` field comes in. This will be dealt with later. ::" +#: ../../extending/newtypes.rst:39 +msgid "" +"These fields tell the runtime how much memory to allocate when new objects " +"of this type are created. Python has some built-in support for variable " +"length structures (think: strings, tuples) which is where " +"the :c:member:`~PyTypeObject.tp_itemsize` field comes in. This will be " +"dealt with later. ::" msgstr "" +#: ../../extending/newtypes.rst:44 msgid "const char *tp_doc;" msgstr "" -msgid "Here you can put a string (or its address) that you want returned when the Python script references ``obj.__doc__`` to retrieve the doc string." +#: ../../extending/newtypes.rst:46 +msgid "" +"Here you can put a string (or its address) that you want returned when the " +"Python script references ``obj.__doc__`` to retrieve the doc string." msgstr "" -msgid "Now we come to the basic type methods -- the ones most extension types will implement." +#: ../../extending/newtypes.rst:49 +msgid "" +"Now we come to the basic type methods -- the ones most extension types will " +"implement." msgstr "" +#: ../../extending/newtypes.rst:54 msgid "Finalization and De-allocation" msgstr "" +#: ../../extending/newtypes.rst:64 msgid "destructor tp_dealloc;" msgstr "" -msgid "This function is called when the reference count of the instance of your type is reduced to zero and the Python interpreter wants to reclaim it. If your type has memory to free or other clean-up to perform, you can put it here. The object itself needs to be freed here as well. Here is an example of this function::" +#: ../../extending/newtypes.rst:66 +msgid "" +"This function is called when the reference count of the instance of your " +"type is reduced to zero and the Python interpreter wants to reclaim it. If " +"your type has memory to free or other clean-up to perform, you can put it " +"here. The object itself needs to be freed here as well. Here is an example " +"of this function::" msgstr "" +#: ../../extending/newtypes.rst:72 msgid "" "static void\n" "newdatatype_dealloc(PyObject *op)\n" @@ -177,9 +224,13 @@ msgid "" "}" msgstr "" -msgid "If your type supports garbage collection, the destructor should call :c:func:`PyObject_GC_UnTrack` before clearing any member fields::" +#: ../../extending/newtypes.rst:80 +msgid "" +"If your type supports garbage collection, the destructor should " +"call :c:func:`PyObject_GC_UnTrack` before clearing any member fields::" msgstr "" +#: ../../extending/newtypes.rst:83 msgid "" "static void\n" "newdatatype_dealloc(PyObject *op)\n" @@ -192,9 +243,22 @@ msgid "" "}" msgstr "" -msgid "One important requirement of the deallocator function is that it leaves any pending exceptions alone. This is important since deallocators are frequently called as the interpreter unwinds the Python stack; when the stack is unwound due to an exception (rather than normal returns), nothing is done to protect the deallocators from seeing that an exception has already been set. Any actions which a deallocator performs which may cause additional Python code to be executed may detect that an exception has been set. This can lead to misleading errors from the interpreter. The proper way to protect against this is to save a pending exception before performing the unsafe action, and restoring it when done. This can be done using the :c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" -msgstr "" - +#: ../../extending/newtypes.rst:97 +msgid "" +"One important requirement of the deallocator function is that it leaves any " +"pending exceptions alone. This is important since deallocators are " +"frequently called as the interpreter unwinds the Python stack; when the " +"stack is unwound due to an exception (rather than normal returns), nothing " +"is done to protect the deallocators from seeing that an exception has " +"already been set. Any actions which a deallocator performs which may cause " +"additional Python code to be executed may detect that an exception has been " +"set. This can lead to misleading errors from the interpreter. The proper " +"way to protect against this is to save a pending exception before performing " +"the unsafe action, and restoring it when done. This can be done using " +"the :c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" +msgstr "" + +#: ../../extending/newtypes.rst:109 msgid "" "static void\n" "my_dealloc(PyObject *obj)\n" @@ -225,29 +289,58 @@ msgid "" "}" msgstr "" -msgid "There are limitations to what you can safely do in a deallocator function. First, if your type supports garbage collection (using :c:member:`~PyTypeObject.tp_traverse` and/or :c:member:`~PyTypeObject.tp_clear`), some of the object's members can have been cleared or finalized by the time :c:member:`~PyTypeObject.tp_dealloc` is called. Second, in :c:member:`~PyTypeObject.tp_dealloc`, your object is in an unstable state: its reference count is equal to zero. Any call to a non-trivial object or API (as in the example above) might end up calling :c:member:`~PyTypeObject.tp_dealloc` again, causing a double free and a crash." -msgstr "" - -msgid "Starting with Python 3.4, it is recommended not to put any complex finalization code in :c:member:`~PyTypeObject.tp_dealloc`, and instead use the new :c:member:`~PyTypeObject.tp_finalize` type method." +#: ../../extending/newtypes.rst:138 +msgid "" +"There are limitations to what you can safely do in a deallocator function. " +"First, if your type supports garbage collection " +"(using :c:member:`~PyTypeObject.tp_traverse` and/" +"or :c:member:`~PyTypeObject.tp_clear`), some of the object's members can " +"have been cleared or finalized by the " +"time :c:member:`~PyTypeObject.tp_dealloc` is called. Second, " +"in :c:member:`~PyTypeObject.tp_dealloc`, your object is in an unstable " +"state: its reference count is equal to zero. Any call to a non-trivial " +"object or API (as in the example above) might end up " +"calling :c:member:`~PyTypeObject.tp_dealloc` again, causing a double free " +"and a crash." +msgstr "" + +#: ../../extending/newtypes.rst:147 +msgid "" +"Starting with Python 3.4, it is recommended not to put any complex " +"finalization code in :c:member:`~PyTypeObject.tp_dealloc`, and instead use " +"the new :c:member:`~PyTypeObject.tp_finalize` type method." msgstr "" +#: ../../extending/newtypes.rst:152 msgid ":pep:`442` explains the new finalization scheme." msgstr "" +#: ../../extending/newtypes.rst:159 msgid "Object Presentation" msgstr "" -msgid "In Python, there are two ways to generate a textual representation of an object: the :func:`repr` function, and the :func:`str` function. (The :func:`print` function just calls :func:`str`.) These handlers are both optional." +#: ../../extending/newtypes.rst:161 +msgid "" +"In Python, there are two ways to generate a textual representation of an " +"object: the :func:`repr` function, and the :func:`str` function. " +"(The :func:`print` function just calls :func:`str`.) These handlers are " +"both optional." msgstr "" +#: ../../extending/newtypes.rst:167 msgid "" "reprfunc tp_repr;\n" "reprfunc tp_str;" msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_repr` handler should return a string object containing a representation of the instance for which it is called. Here is a simple example::" +#: ../../extending/newtypes.rst:170 +msgid "" +"The :c:member:`~PyTypeObject.tp_repr` handler should return a string object " +"containing a representation of the instance for which it is called. Here is " +"a simple example::" msgstr "" +#: ../../extending/newtypes.rst:174 msgid "" "static PyObject *\n" "newdatatype_repr(PyObject *op)\n" @@ -258,15 +351,30 @@ msgid "" "}" msgstr "" -msgid "If no :c:member:`~PyTypeObject.tp_repr` handler is specified, the interpreter will supply a representation that uses the type's :c:member:`~PyTypeObject.tp_name` and a uniquely identifying value for the object." +#: ../../extending/newtypes.rst:182 +msgid "" +"If no :c:member:`~PyTypeObject.tp_repr` handler is specified, the " +"interpreter will supply a representation that uses the " +"type's :c:member:`~PyTypeObject.tp_name` and a uniquely identifying value " +"for the object." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what the :c:member:`~PyTypeObject.tp_repr` handler described above is to :func:`repr`; that is, it is called when Python code calls :func:`str` on an instance of your object. Its implementation is very similar to the :c:member:`~PyTypeObject.tp_repr` function, but the resulting string is intended for human consumption. If :c:member:`~PyTypeObject.tp_str` is not specified, the :c:member:`~PyTypeObject.tp_repr` handler is used instead." +#: ../../extending/newtypes.rst:186 +msgid "" +"The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what " +"the :c:member:`~PyTypeObject.tp_repr` handler described above is " +"to :func:`repr`; that is, it is called when Python code calls :func:`str` on " +"an instance of your object. Its implementation is very similar to " +"the :c:member:`~PyTypeObject.tp_repr` function, but the resulting string is " +"intended for human consumption. If :c:member:`~PyTypeObject.tp_str` is not " +"specified, the :c:member:`~PyTypeObject.tp_repr` handler is used instead." msgstr "" +#: ../../extending/newtypes.rst:193 msgid "Here is a simple example::" msgstr "" +#: ../../extending/newtypes.rst:195 msgid "" "static PyObject *\n" "newdatatype_str(PyObject *op)\n" @@ -277,15 +385,31 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes.rst:206 msgid "Attribute Management" msgstr "" -msgid "For every object which can support attributes, the corresponding type must provide the functions that control how the attributes are resolved. There needs to be a function which can retrieve attributes (if any are defined), and another to set attributes (if setting attributes is allowed). Removing an attribute is a special case, for which the new value passed to the handler is ``NULL``." +#: ../../extending/newtypes.rst:208 +msgid "" +"For every object which can support attributes, the corresponding type must " +"provide the functions that control how the attributes are resolved. There " +"needs to be a function which can retrieve attributes (if any are defined), " +"and another to set attributes (if setting attributes is allowed). Removing " +"an attribute is a special case, for which the new value passed to the " +"handler is ``NULL``." msgstr "" -msgid "Python supports two pairs of attribute handlers; a type that supports attributes only needs to implement the functions for one pair. The difference is that one pair takes the name of the attribute as a :c:expr:`char\\*`, while the other accepts a :c:expr:`PyObject*`. Each type can use whichever pair makes more sense for the implementation's convenience. ::" +#: ../../extending/newtypes.rst:214 +msgid "" +"Python supports two pairs of attribute handlers; a type that supports " +"attributes only needs to implement the functions for one pair. The " +"difference is that one pair takes the name of the attribute as " +"a :c:expr:`char\\*`, while the other accepts a :c:expr:`PyObject*`. Each " +"type can use whichever pair makes more sense for the implementation's " +"convenience. ::" msgstr "" +#: ../../extending/newtypes.rst:220 msgid "" "getattrfunc tp_getattr; /* char * version */\n" "setattrfunc tp_setattr;\n" @@ -294,39 +418,77 @@ msgid "" "setattrofunc tp_setattro;" msgstr "" -msgid "If accessing attributes of an object is always a simple operation (this will be explained shortly), there are generic implementations which can be used to provide the :c:expr:`PyObject*` version of the attribute management functions. The actual need for type-specific attribute handlers almost completely disappeared starting with Python 2.2, though there are many examples which have not been updated to use some of the new generic mechanism that is available." +#: ../../extending/newtypes.rst:226 +msgid "" +"If accessing attributes of an object is always a simple operation (this will " +"be explained shortly), there are generic implementations which can be used " +"to provide the :c:expr:`PyObject*` version of the attribute management " +"functions. The actual need for type-specific attribute handlers almost " +"completely disappeared starting with Python 2.2, though there are many " +"examples which have not been updated to use some of the new generic " +"mechanism that is available." msgstr "" +#: ../../extending/newtypes.rst:237 msgid "Generic Attribute Management" msgstr "" -msgid "Most extension types only use *simple* attributes. So, what makes the attributes simple? There are only a couple of conditions that must be met:" -msgstr "" - -msgid "The name of the attributes must be known when :c:func:`PyType_Ready` is called." +#: ../../extending/newtypes.rst:239 +msgid "" +"Most extension types only use *simple* attributes. So, what makes the " +"attributes simple? There are only a couple of conditions that must be met:" msgstr "" -msgid "No special processing is needed to record that an attribute was looked up or set, nor do actions need to be taken based on the value." +#: ../../extending/newtypes.rst:242 +msgid "" +"The name of the attributes must be known when :c:func:`PyType_Ready` is " +"called." msgstr "" -msgid "Note that this list does not place any restrictions on the values of the attributes, when the values are computed, or how relevant data is stored." +#: ../../extending/newtypes.rst:245 +msgid "" +"No special processing is needed to record that an attribute was looked up or " +"set, nor do actions need to be taken based on the value." msgstr "" -msgid "When :c:func:`PyType_Ready` is called, it uses three tables referenced by the type object to create :term:`descriptor`\\s which are placed in the dictionary of the type object. Each descriptor controls access to one attribute of the instance object. Each of the tables is optional; if all three are ``NULL``, instances of the type will only have attributes that are inherited from their base type, and should leave the :c:member:`~PyTypeObject.tp_getattro` and :c:member:`~PyTypeObject.tp_setattro` fields ``NULL`` as well, allowing the base type to handle attributes." +#: ../../extending/newtypes.rst:248 +msgid "" +"Note that this list does not place any restrictions on the values of the " +"attributes, when the values are computed, or how relevant data is stored." msgstr "" +#: ../../extending/newtypes.rst:251 +msgid "" +"When :c:func:`PyType_Ready` is called, it uses three tables referenced by " +"the type object to create :term:`descriptor`\\s which are placed in the " +"dictionary of the type object. Each descriptor controls access to one " +"attribute of the instance object. Each of the tables is optional; if all " +"three are ``NULL``, instances of the type will only have attributes that are " +"inherited from their base type, and should leave " +"the :c:member:`~PyTypeObject.tp_getattro` " +"and :c:member:`~PyTypeObject.tp_setattro` fields ``NULL`` as well, allowing " +"the base type to handle attributes." +msgstr "" + +#: ../../extending/newtypes.rst:259 msgid "The tables are declared as three fields of the type object::" msgstr "" +#: ../../extending/newtypes.rst:261 msgid "" "struct PyMethodDef *tp_methods;\n" "struct PyMemberDef *tp_members;\n" "struct PyGetSetDef *tp_getset;" msgstr "" -msgid "If :c:member:`~PyTypeObject.tp_methods` is not ``NULL``, it must refer to an array of :c:type:`PyMethodDef` structures. Each entry in the table is an instance of this structure::" +#: ../../extending/newtypes.rst:265 +msgid "" +"If :c:member:`~PyTypeObject.tp_methods` is not ``NULL``, it must refer to an " +"array of :c:type:`PyMethodDef` structures. Each entry in the table is an " +"instance of this structure::" msgstr "" +#: ../../extending/newtypes.rst:269 msgid "" "typedef struct PyMethodDef {\n" " const char *ml_name; /* method name */\n" @@ -336,12 +498,23 @@ msgid "" "} PyMethodDef;" msgstr "" -msgid "One entry should be defined for each method provided by the type; no entries are needed for methods inherited from a base type. One additional entry is needed at the end; it is a sentinel that marks the end of the array. The :c:member:`~PyMethodDef.ml_name` field of the sentinel must be ``NULL``." +#: ../../extending/newtypes.rst:276 +msgid "" +"One entry should be defined for each method provided by the type; no entries " +"are needed for methods inherited from a base type. One additional entry is " +"needed at the end; it is a sentinel that marks the end of the array. " +"The :c:member:`~PyMethodDef.ml_name` field of the sentinel must be ``NULL``." msgstr "" -msgid "The second table is used to define attributes which map directly to data stored in the instance. A variety of primitive C types are supported, and access may be read-only or read-write. The structures in the table are defined as::" +#: ../../extending/newtypes.rst:281 +msgid "" +"The second table is used to define attributes which map directly to data " +"stored in the instance. A variety of primitive C types are supported, and " +"access may be read-only or read-write. The structures in the table are " +"defined as::" msgstr "" +#: ../../extending/newtypes.rst:285 msgid "" "typedef struct PyMemberDef {\n" " const char *name;\n" @@ -352,27 +525,61 @@ msgid "" "} PyMemberDef;" msgstr "" -msgid "For each entry in the table, a :term:`descriptor` will be constructed and added to the type which will be able to extract a value from the instance structure. The :c:member:`~PyMemberDef.type` field should contain a type code like :c:macro:`Py_T_INT` or :c:macro:`Py_T_DOUBLE`; the value will be used to determine how to convert Python values to and from C values. The :c:member:`~PyMemberDef.flags` field is used to store flags which control how the attribute can be accessed: you can set it to :c:macro:`Py_READONLY` to prevent Python code from setting it." +#: ../../extending/newtypes.rst:293 +msgid "" +"For each entry in the table, a :term:`descriptor` will be constructed and " +"added to the type which will be able to extract a value from the instance " +"structure. The :c:member:`~PyMemberDef.type` field should contain a type " +"code like :c:macro:`Py_T_INT` or :c:macro:`Py_T_DOUBLE`; the value will be " +"used to determine how to convert Python values to and from C values. " +"The :c:member:`~PyMemberDef.flags` field is used to store flags which " +"control how the attribute can be accessed: you can set it " +"to :c:macro:`Py_READONLY` to prevent Python code from setting it." msgstr "" -msgid "An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table to build descriptors that are used at runtime is that any attribute defined this way can have an associated doc string simply by providing the text in the table. An application can use the introspection API to retrieve the descriptor from the class object, and get the doc string using its :attr:`~type.__doc__` attribute." +#: ../../extending/newtypes.rst:301 +msgid "" +"An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` " +"table to build descriptors that are used at runtime is that any attribute " +"defined this way can have an associated doc string simply by providing the " +"text in the table. An application can use the introspection API to retrieve " +"the descriptor from the class object, and get the doc string using " +"its :attr:`~type.__doc__` attribute." msgstr "" -msgid "As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry with a :c:member:`~PyMethodDef.ml_name` value of ``NULL`` is required." +#: ../../extending/newtypes.rst:307 +msgid "" +"As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry " +"with a :c:member:`~PyMethodDef.ml_name` value of ``NULL`` is required." msgstr "" +#: ../../extending/newtypes.rst:321 msgid "Type-specific Attribute Management" msgstr "" -msgid "For simplicity, only the :c:expr:`char\\*` version will be demonstrated here; the type of the name parameter is the only difference between the :c:expr:`char\\*` and :c:expr:`PyObject*` flavors of the interface. This example effectively does the same thing as the generic example above, but does not use the generic support added in Python 2.2. It explains how the handler functions are called, so that if you do need to extend their functionality, you'll understand what needs to be done." +#: ../../extending/newtypes.rst:323 +msgid "" +"For simplicity, only the :c:expr:`char\\*` version will be demonstrated " +"here; the type of the name parameter is the only difference between " +"the :c:expr:`char\\*` and :c:expr:`PyObject*` flavors of the interface. This " +"example effectively does the same thing as the generic example above, but " +"does not use the generic support added in Python 2.2. It explains how the " +"handler functions are called, so that if you do need to extend their " +"functionality, you'll understand what needs to be done." msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_getattr` handler is called when the object requires an attribute look-up. It is called in the same situations where the :meth:`~object.__getattr__` method of a class would be called." +#: ../../extending/newtypes.rst:331 +msgid "" +"The :c:member:`~PyTypeObject.tp_getattr` handler is called when the object " +"requires an attribute look-up. It is called in the same situations where " +"the :meth:`~object.__getattr__` method of a class would be called." msgstr "" +#: ../../extending/newtypes.rst:335 msgid "Here is an example::" msgstr "" +#: ../../extending/newtypes.rst:337 msgid "" "static PyObject *\n" "newdatatype_getattr(PyObject *op, char *name)\n" @@ -389,9 +596,18 @@ msgid "" "}" msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_setattr` handler is called when the :meth:`~object.__setattr__` or :meth:`~object.__delattr__` method of a class instance would be called. When an attribute should be deleted, the third parameter will be ``NULL``. Here is an example that simply raises an exception; if this were really all you wanted, the :c:member:`~PyTypeObject.tp_setattr` handler should be set to ``NULL``. ::" +#: ../../extending/newtypes.rst:351 +msgid "" +"The :c:member:`~PyTypeObject.tp_setattr` handler is called when " +"the :meth:`~object.__setattr__` or :meth:`~object.__delattr__` method of a " +"class instance would be called. When an attribute should be deleted, the " +"third parameter will be ``NULL``. Here is an example that simply raises an " +"exception; if this were really all you wanted, " +"the :c:member:`~PyTypeObject.tp_setattr` handler should be set to " +"``NULL``. ::" msgstr "" +#: ../../extending/newtypes.rst:357 msgid "" "static int\n" "newdatatype_setattr(PyObject *op, char *name, PyObject *v)\n" @@ -401,21 +617,40 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes.rst:365 msgid "Object Comparison" msgstr "" +#: ../../extending/newtypes.rst:369 msgid "richcmpfunc tp_richcompare;" msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_richcompare` handler is called when comparisons are needed. It is analogous to the :ref:`rich comparison methods `, like :meth:`!__lt__`, and also called by :c:func:`PyObject_RichCompare` and :c:func:`PyObject_RichCompareBool`." +#: ../../extending/newtypes.rst:371 +msgid "" +"The :c:member:`~PyTypeObject.tp_richcompare` handler is called when " +"comparisons are needed. It is analogous to the :ref:`rich comparison " +"methods `, like :meth:`!__lt__`, and also called " +"by :c:func:`PyObject_RichCompare` and :c:func:`PyObject_RichCompareBool`." msgstr "" -msgid "This function is called with two Python objects and the operator as arguments, where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, ``Py_GE``, ``Py_LT`` or ``Py_GT``. It should compare the two objects with respect to the specified operator and return ``Py_True`` or ``Py_False`` if the comparison is successful, ``Py_NotImplemented`` to indicate that comparison is not implemented and the other object's comparison method should be tried, or ``NULL`` if an exception was set." +#: ../../extending/newtypes.rst:376 +msgid "" +"This function is called with two Python objects and the operator as " +"arguments, where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, " +"``Py_GE``, ``Py_LT`` or ``Py_GT``. It should compare the two objects with " +"respect to the specified operator and return ``Py_True`` or ``Py_False`` if " +"the comparison is successful, ``Py_NotImplemented`` to indicate that " +"comparison is not implemented and the other object's comparison method " +"should be tried, or ``NULL`` if an exception was set." msgstr "" -msgid "Here is a sample implementation, for a datatype that is considered equal if the size of an internal pointer is equal::" +#: ../../extending/newtypes.rst:384 +msgid "" +"Here is a sample implementation, for a datatype that is considered equal if " +"the size of an internal pointer is equal::" msgstr "" +#: ../../extending/newtypes.rst:387 msgid "" "static PyObject *\n" "newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)\n" @@ -444,30 +679,60 @@ msgid "" " }" msgstr "" +#: ../../extending/newtypes.rst:415 msgid "Abstract Protocol Support" msgstr "" -msgid "Python supports a variety of *abstract* 'protocols;' the specific interfaces provided to use these interfaces are documented in :ref:`abstract`." -msgstr "" - -msgid "A number of these abstract interfaces were defined early in the development of the Python implementation. In particular, the number, mapping, and sequence protocols have been part of Python since the beginning. Other protocols have been added over time. For protocols which depend on several handler routines from the type implementation, the older protocols have been defined as optional blocks of handlers referenced by the type object. For newer protocols there are additional slots in the main type object, with a flag bit being set to indicate that the slots are present and should be checked by the interpreter. (The flag bit does not indicate that the slot values are non-``NULL``. The flag may be set to indicate the presence of a slot, but a slot may still be unfilled.) ::" +#: ../../extending/newtypes.rst:417 +msgid "" +"Python supports a variety of *abstract* 'protocols;' the specific interfaces " +"provided to use these interfaces are documented in :ref:`abstract`." msgstr "" +#: ../../extending/newtypes.rst:421 +msgid "" +"A number of these abstract interfaces were defined early in the development " +"of the Python implementation. In particular, the number, mapping, and " +"sequence protocols have been part of Python since the beginning. Other " +"protocols have been added over time. For protocols which depend on several " +"handler routines from the type implementation, the older protocols have been " +"defined as optional blocks of handlers referenced by the type object. For " +"newer protocols there are additional slots in the main type object, with a " +"flag bit being set to indicate that the slots are present and should be " +"checked by the interpreter. (The flag bit does not indicate that the slot " +"values are non-``NULL``. The flag may be set to indicate the presence of a " +"slot, but a slot may still be unfilled.) ::" +msgstr "" + +#: ../../extending/newtypes.rst:432 msgid "" "PyNumberMethods *tp_as_number;\n" "PySequenceMethods *tp_as_sequence;\n" "PyMappingMethods *tp_as_mapping;" msgstr "" -msgid "If you wish your object to be able to act like a number, a sequence, or a mapping object, then you place the address of a structure that implements the C type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, or :c:type:`PyMappingMethods`, respectively. It is up to you to fill in this structure with appropriate values. You can find examples of the use of each of these in the :file:`Objects` directory of the Python source distribution. ::" +#: ../../extending/newtypes.rst:436 +msgid "" +"If you wish your object to be able to act like a number, a sequence, or a " +"mapping object, then you place the address of a structure that implements " +"the C type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, " +"or :c:type:`PyMappingMethods`, respectively. It is up to you to fill in this " +"structure with appropriate values. You can find examples of the use of each " +"of these in the :file:`Objects` directory of the Python source " +"distribution. ::" msgstr "" +#: ../../extending/newtypes.rst:443 msgid "hashfunc tp_hash;" msgstr "" -msgid "This function, if you choose to provide it, should return a hash number for an instance of your data type. Here is a simple example::" +#: ../../extending/newtypes.rst:445 +msgid "" +"This function, if you choose to provide it, should return a hash number for " +"an instance of your data type. Here is a simple example::" msgstr "" +#: ../../extending/newtypes.rst:448 msgid "" "static Py_hash_t\n" "newdatatype_hash(PyObject *op)\n" @@ -482,30 +747,57 @@ msgid "" "}" msgstr "" -msgid ":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, which is why you should be careful to avoid returning it when hash computation is successful, as seen above." +#: ../../extending/newtypes.rst:460 +msgid "" +":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. " +"Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, " +"which is why you should be careful to avoid returning it when hash " +"computation is successful, as seen above." msgstr "" +#: ../../extending/newtypes.rst:467 msgid "ternaryfunc tp_call;" msgstr "" -msgid "This function is called when an instance of your data type is \"called\", for example, if ``obj1`` is an instance of your data type and the Python script contains ``obj1('hello')``, the :c:member:`~PyTypeObject.tp_call` handler is invoked." +#: ../../extending/newtypes.rst:469 +msgid "" +"This function is called when an instance of your data type is \"called\", " +"for example, if ``obj1`` is an instance of your data type and the Python " +"script contains ``obj1('hello')``, the :c:member:`~PyTypeObject.tp_call` " +"handler is invoked." msgstr "" +#: ../../extending/newtypes.rst:473 msgid "This function takes three arguments:" msgstr "" -msgid "*self* is the instance of the data type which is the subject of the call. If the call is ``obj1('hello')``, then *self* is ``obj1``." +#: ../../extending/newtypes.rst:475 +msgid "" +"*self* is the instance of the data type which is the subject of the call. If " +"the call is ``obj1('hello')``, then *self* is ``obj1``." msgstr "" -msgid "*args* is a tuple containing the arguments to the call. You can use :c:func:`PyArg_ParseTuple` to extract the arguments." +#: ../../extending/newtypes.rst:478 +msgid "" +"*args* is a tuple containing the arguments to the call. You can " +"use :c:func:`PyArg_ParseTuple` to extract the arguments." msgstr "" -msgid "*kwds* is a dictionary of keyword arguments that were passed. If this is non-``NULL`` and you support keyword arguments, use :c:func:`PyArg_ParseTupleAndKeywords` to extract the arguments. If you do not want to support keyword arguments and this is non-``NULL``, raise a :exc:`TypeError` with a message saying that keyword arguments are not supported." +#: ../../extending/newtypes.rst:481 +msgid "" +"*kwds* is a dictionary of keyword arguments that were passed. If this is non-" +"``NULL`` and you support keyword arguments, " +"use :c:func:`PyArg_ParseTupleAndKeywords` to extract the arguments. If you " +"do not want to support keyword arguments and this is non-``NULL``, raise " +"a :exc:`TypeError` with a message saying that keyword arguments are not " +"supported." msgstr "" +#: ../../extending/newtypes.rst:487 msgid "Here is a toy ``tp_call`` implementation::" msgstr "" +#: ../../extending/newtypes.rst:489 msgid "" "static PyObject *\n" "newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -527,42 +819,94 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes.rst:510 msgid "" "/* Iterators */\n" "getiterfunc tp_iter;\n" "iternextfunc tp_iternext;" msgstr "" -msgid "These functions provide support for the iterator protocol. Both handlers take exactly one parameter, the instance for which they are being called, and return a new reference. In the case of an error, they should set an exception and return ``NULL``. :c:member:`~PyTypeObject.tp_iter` corresponds to the Python :meth:`~object.__iter__` method, while :c:member:`~PyTypeObject.tp_iternext` corresponds to the Python :meth:`~iterator.__next__` method." -msgstr "" - -msgid "Any :term:`iterable` object must implement the :c:member:`~PyTypeObject.tp_iter` handler, which must return an :term:`iterator` object. Here the same guidelines apply as for Python classes:" +#: ../../extending/newtypes.rst:514 +msgid "" +"These functions provide support for the iterator protocol. Both handlers " +"take exactly one parameter, the instance for which they are being called, " +"and return a new reference. In the case of an error, they should set an " +"exception and return ``NULL``. :c:member:`~PyTypeObject.tp_iter` " +"corresponds to the Python :meth:`~object.__iter__` method, " +"while :c:member:`~PyTypeObject.tp_iternext` corresponds to the " +"Python :meth:`~iterator.__next__` method." msgstr "" -msgid "For collections (such as lists and tuples) which can support multiple independent iterators, a new iterator should be created and returned by each call to :c:member:`~PyTypeObject.tp_iter`." +#: ../../extending/newtypes.rst:521 +msgid "" +"Any :term:`iterable` object must implement " +"the :c:member:`~PyTypeObject.tp_iter` handler, which must return " +"an :term:`iterator` object. Here the same guidelines apply as for Python " +"classes:" msgstr "" -msgid "Objects which can only be iterated over once (usually due to side effects of iteration, such as file objects) can implement :c:member:`~PyTypeObject.tp_iter` by returning a new reference to themselves -- and should also therefore implement the :c:member:`~PyTypeObject.tp_iternext` handler." +#: ../../extending/newtypes.rst:525 +msgid "" +"For collections (such as lists and tuples) which can support multiple " +"independent iterators, a new iterator should be created and returned by each " +"call to :c:member:`~PyTypeObject.tp_iter`." msgstr "" -msgid "Any :term:`iterator` object should implement both :c:member:`~PyTypeObject.tp_iter` and :c:member:`~PyTypeObject.tp_iternext`. An iterator's :c:member:`~PyTypeObject.tp_iter` handler should return a new reference to the iterator. Its :c:member:`~PyTypeObject.tp_iternext` handler should return a new reference to the next object in the iteration, if there is one. If the iteration has reached the end, :c:member:`~PyTypeObject.tp_iternext` may return ``NULL`` without setting an exception, or it may set :exc:`StopIteration` *in addition* to returning ``NULL``; avoiding the exception can yield slightly better performance. If an actual error occurs, :c:member:`~PyTypeObject.tp_iternext` should always set an exception and return ``NULL``." +#: ../../extending/newtypes.rst:528 +msgid "" +"Objects which can only be iterated over once (usually due to side effects of " +"iteration, such as file objects) can " +"implement :c:member:`~PyTypeObject.tp_iter` by returning a new reference to " +"themselves -- and should also therefore implement " +"the :c:member:`~PyTypeObject.tp_iternext` handler." msgstr "" +#: ../../extending/newtypes.rst:533 +msgid "" +"Any :term:`iterator` object should implement " +"both :c:member:`~PyTypeObject.tp_iter` " +"and :c:member:`~PyTypeObject.tp_iternext`. An " +"iterator's :c:member:`~PyTypeObject.tp_iter` handler should return a new " +"reference to the iterator. Its :c:member:`~PyTypeObject.tp_iternext` " +"handler should return a new reference to the next object in the iteration, " +"if there is one. If the iteration has reached the " +"end, :c:member:`~PyTypeObject.tp_iternext` may return ``NULL`` without " +"setting an exception, or it may set :exc:`StopIteration` *in addition* to " +"returning ``NULL``; avoiding the exception can yield slightly better " +"performance. If an actual error " +"occurs, :c:member:`~PyTypeObject.tp_iternext` should always set an exception " +"and return ``NULL``." +msgstr "" + +#: ../../extending/newtypes.rst:549 msgid "Weak Reference Support" msgstr "" -msgid "One of the goals of Python's weak reference implementation is to allow any type to participate in the weak reference mechanism without incurring the overhead on performance-critical objects (such as numbers)." +#: ../../extending/newtypes.rst:551 +msgid "" +"One of the goals of Python's weak reference implementation is to allow any " +"type to participate in the weak reference mechanism without incurring the " +"overhead on performance-critical objects (such as numbers)." msgstr "" +#: ../../extending/newtypes.rst:556 msgid "Documentation for the :mod:`weakref` module." msgstr "" -msgid "For an object to be weakly referenceable, the extension type must set the ``Py_TPFLAGS_MANAGED_WEAKREF`` bit of the :c:member:`~PyTypeObject.tp_flags` field. The legacy :c:member:`~PyTypeObject.tp_weaklistoffset` field should be left as zero." +#: ../../extending/newtypes.rst:558 +msgid "" +"For an object to be weakly referenceable, the extension type must set the " +"``Py_TPFLAGS_MANAGED_WEAKREF`` bit of the :c:member:`~PyTypeObject.tp_flags` " +"field. The legacy :c:member:`~PyTypeObject.tp_weaklistoffset` field should " +"be left as zero." msgstr "" -msgid "Concretely, here is how the statically declared type object would look::" +#: ../../extending/newtypes.rst:563 +msgid "" +"Concretely, here is how the statically declared type object would look::" msgstr "" +#: ../../extending/newtypes.rst:565 msgid "" "static PyTypeObject TrivialType = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -571,9 +915,13 @@ msgid "" "};" msgstr "" -msgid "The only further addition is that ``tp_dealloc`` needs to clear any weak references (by calling :c:func:`PyObject_ClearWeakRefs`)::" +#: ../../extending/newtypes.rst:572 +msgid "" +"The only further addition is that ``tp_dealloc`` needs to clear any weak " +"references (by calling :c:func:`PyObject_ClearWeakRefs`)::" msgstr "" +#: ../../extending/newtypes.rst:575 msgid "" "static void\n" "Trivial_dealloc(PyObject *op)\n" @@ -585,15 +933,27 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes.rst:586 msgid "More Suggestions" msgstr "" -msgid "In order to learn how to implement any specific method for your new data type, get the :term:`CPython` source code. Go to the :file:`Objects` directory, then search the C source files for ``tp_`` plus the function you want (for example, ``tp_richcompare``). You will find examples of the function you want to implement." +#: ../../extending/newtypes.rst:588 +msgid "" +"In order to learn how to implement any specific method for your new data " +"type, get the :term:`CPython` source code. Go to the :file:`Objects` " +"directory, then search the C source files for ``tp_`` plus the function you " +"want (for example, ``tp_richcompare``). You will find examples of the " +"function you want to implement." msgstr "" -msgid "When you need to verify that an object is a concrete instance of the type you are implementing, use the :c:func:`PyObject_TypeCheck` function. A sample of its use might be something like the following::" +#: ../../extending/newtypes.rst:594 +msgid "" +"When you need to verify that an object is a concrete instance of the type " +"you are implementing, use the :c:func:`PyObject_TypeCheck` function. A " +"sample of its use might be something like the following::" msgstr "" +#: ../../extending/newtypes.rst:598 msgid "" "if (!PyObject_TypeCheck(some_object, &MyType)) {\n" " PyErr_SetString(PyExc_TypeError, \"arg #1 not a mything\");\n" @@ -601,47 +961,63 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes.rst:604 msgid "Download CPython source releases." msgstr "" +#: ../../extending/newtypes.rst:605 msgid "https://www.python.org/downloads/source/" msgstr "" -msgid "The CPython project on GitHub, where the CPython source code is developed." +#: ../../extending/newtypes.rst:607 +msgid "" +"The CPython project on GitHub, where the CPython source code is developed." msgstr "" +#: ../../extending/newtypes.rst:608 msgid "https://github.com/python/cpython" msgstr "" +#: ../../extending/newtypes.rst:56 msgid "object" msgstr "" +#: ../../extending/newtypes.rst:56 msgid "deallocation" msgstr "" +#: ../../extending/newtypes.rst:56 msgid "deallocation, object" msgstr "" +#: ../../extending/newtypes.rst:56 msgid "finalization" msgstr "" +#: ../../extending/newtypes.rst:56 msgid "finalization, of objects" msgstr "" +#: ../../extending/newtypes.rst:93 msgid "PyErr_Fetch (C function)" msgstr "" +#: ../../extending/newtypes.rst:93 msgid "PyErr_Restore (C function)" msgstr "" +#: ../../extending/newtypes.rst:154 msgid "string" msgstr "" +#: ../../extending/newtypes.rst:154 msgid "object representation" msgstr "" +#: ../../extending/newtypes.rst:154 msgid "built-in function" msgstr "" +#: ../../extending/newtypes.rst:154 msgid "repr" msgstr "" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 415229571..ac4918d97 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,27 +24,57 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/newtypes_tutorial.rst:7 msgid "Defining Extension Types: Tutorial" msgstr "" -msgid "Python allows the writer of a C extension module to define new types that can be manipulated from Python code, much like the built-in :class:`str` and :class:`list` types. The code for all extension types follows a pattern, but there are some details that you need to understand before you can get started. This document is a gentle introduction to the topic." +#: ../../extending/newtypes_tutorial.rst:14 +msgid "" +"Python allows the writer of a C extension module to define new types that " +"can be manipulated from Python code, much like the built-in :class:`str` " +"and :class:`list` types. The code for all extension types follows a " +"pattern, but there are some details that you need to understand before you " +"can get started. This document is a gentle introduction to the topic." msgstr "" +#: ../../extending/newtypes_tutorial.rst:24 msgid "The Basics" msgstr "" -msgid "The :term:`CPython` runtime sees all Python objects as variables of type :c:expr:`PyObject*`, which serves as a \"base type\" for all Python objects. The :c:type:`PyObject` structure itself only contains the object's :term:`reference count` and a pointer to the object's \"type object\". This is where the action is; the type object determines which (C) functions get called by the interpreter when, for instance, an attribute gets looked up on an object, a method called, or it is multiplied by another object. These C functions are called \"type methods\"." +#: ../../extending/newtypes_tutorial.rst:26 +msgid "" +"The :term:`CPython` runtime sees all Python objects as variables of " +"type :c:expr:`PyObject*`, which serves as a \"base type\" for all Python " +"objects. The :c:type:`PyObject` structure itself only contains the " +"object's :term:`reference count` and a pointer to the object's \"type " +"object\". This is where the action is; the type object determines which (C) " +"functions get called by the interpreter when, for instance, an attribute " +"gets looked up on an object, a method called, or it is multiplied by another " +"object. These C functions are called \"type methods\"." msgstr "" -msgid "So, if you want to define a new extension type, you need to create a new type object." +#: ../../extending/newtypes_tutorial.rst:35 +msgid "" +"So, if you want to define a new extension type, you need to create a new " +"type object." msgstr "" -msgid "This sort of thing can only be explained by example, so here's a minimal, but complete, module that defines a new type named :class:`!Custom` inside a C extension module :mod:`!custom`:" +#: ../../extending/newtypes_tutorial.rst:38 +msgid "" +"This sort of thing can only be explained by example, so here's a minimal, " +"but complete, module that defines a new type named :class:`!Custom` inside a " +"C extension module :mod:`!custom`:" msgstr "" -msgid "What we're showing here is the traditional way of defining *static* extension types. It should be adequate for most uses. The C API also allows defining heap-allocated extension types using the :c:func:`PyType_FromSpec` function, which isn't covered in this tutorial." +#: ../../extending/newtypes_tutorial.rst:43 +msgid "" +"What we're showing here is the traditional way of defining *static* " +"extension types. It should be adequate for most uses. The C API also " +"allows defining heap-allocated extension types using " +"the :c:func:`PyType_FromSpec` function, which isn't covered in this tutorial." msgstr "" +#: ../../extending/newtypes_tutorial.rst:48 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -71,7 +101,8 @@ msgid "" " return -1;\n" " }\n" "\n" -" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" " return -1;\n" " }\n" "\n" @@ -81,7 +112,8 @@ msgid "" "static PyModuleDef_Slot custom_module_slots[] = {\n" " {Py_mod_exec, custom_module_exec},\n" " // Just use this while using static types\n" -" {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" " {0, NULL}\n" "};\n" "\n" @@ -100,36 +132,69 @@ msgid "" "}\n" msgstr "" -msgid "Now that's quite a bit to take in at once, but hopefully bits will seem familiar from the previous chapter. This file defines three things:" +#: ../../extending/newtypes_tutorial.rst:50 +msgid "" +"Now that's quite a bit to take in at once, but hopefully bits will seem " +"familiar from the previous chapter. This file defines three things:" msgstr "" -msgid "What a :class:`!Custom` **object** contains: this is the ``CustomObject`` struct, which is allocated once for each :class:`!Custom` instance." +#: ../../extending/newtypes_tutorial.rst:53 +msgid "" +"What a :class:`!Custom` **object** contains: this is the ``CustomObject`` " +"struct, which is allocated once for each :class:`!Custom` instance." msgstr "" -msgid "How the :class:`!Custom` **type** behaves: this is the ``CustomType`` struct, which defines a set of flags and function pointers that the interpreter inspects when specific operations are requested." +#: ../../extending/newtypes_tutorial.rst:55 +msgid "" +"How the :class:`!Custom` **type** behaves: this is the ``CustomType`` " +"struct, which defines a set of flags and function pointers that the " +"interpreter inspects when specific operations are requested." msgstr "" -msgid "How to define and execute the :mod:`!custom` module: this is the ``PyInit_custom`` function and the associated ``custom_module`` struct for defining the module, and the ``custom_module_exec`` function to set up a fresh module object." +#: ../../extending/newtypes_tutorial.rst:58 +msgid "" +"How to define and execute the :mod:`!custom` module: this is the " +"``PyInit_custom`` function and the associated ``custom_module`` struct for " +"defining the module, and the ``custom_module_exec`` function to set up a " +"fresh module object." msgstr "" +#: ../../extending/newtypes_tutorial.rst:63 msgid "The first bit is::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:65 msgid "" "typedef struct {\n" " PyObject_HEAD\n" "} CustomObject;" msgstr "" -msgid "This is what a Custom object will contain. ``PyObject_HEAD`` is mandatory at the start of each object struct and defines a field called ``ob_base`` of type :c:type:`PyObject`, containing a pointer to a type object and a reference count (these can be accessed using the macros :c:macro:`Py_TYPE` and :c:macro:`Py_REFCNT` respectively). The reason for the macro is to abstract away the layout and to enable additional fields in :ref:`debug builds `." +#: ../../extending/newtypes_tutorial.rst:69 +msgid "" +"This is what a Custom object will contain. ``PyObject_HEAD`` is mandatory " +"at the start of each object struct and defines a field called ``ob_base`` of " +"type :c:type:`PyObject`, containing a pointer to a type object and a " +"reference count (these can be accessed using the macros :c:macro:`Py_TYPE` " +"and :c:macro:`Py_REFCNT` respectively). The reason for the macro is to " +"abstract away the layout and to enable additional fields in :ref:`debug " +"builds `." msgstr "" -msgid "There is no semicolon above after the :c:macro:`PyObject_HEAD` macro. Be wary of adding one by accident: some compilers will complain." +#: ../../extending/newtypes_tutorial.rst:78 +msgid "" +"There is no semicolon above after the :c:macro:`PyObject_HEAD` macro. Be " +"wary of adding one by accident: some compilers will complain." msgstr "" -msgid "Of course, objects generally store additional data besides the standard ``PyObject_HEAD`` boilerplate; for example, here is the definition for standard Python floats::" +#: ../../extending/newtypes_tutorial.rst:81 +msgid "" +"Of course, objects generally store additional data besides the standard " +"``PyObject_HEAD`` boilerplate; for example, here is the definition for " +"standard Python floats::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:85 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -137,9 +202,11 @@ msgid "" "} PyFloatObject;" msgstr "" +#: ../../extending/newtypes_tutorial.rst:90 msgid "The second bit is the definition of the type object. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:92 msgid "" "static PyTypeObject CustomType = {\n" " .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -152,27 +219,46 @@ msgid "" "};" msgstr "" -msgid "We recommend using C99-style designated initializers as above, to avoid listing all the :c:type:`PyTypeObject` fields that you don't care about and also to avoid caring about the fields' declaration order." +#: ../../extending/newtypes_tutorial.rst:103 +msgid "" +"We recommend using C99-style designated initializers as above, to avoid " +"listing all the :c:type:`PyTypeObject` fields that you don't care about and " +"also to avoid caring about the fields' declaration order." msgstr "" -msgid "The actual definition of :c:type:`PyTypeObject` in :file:`object.h` has many more :ref:`fields ` than the definition above. The remaining fields will be filled with zeros by the C compiler, and it's common practice to not specify them explicitly unless you need them." +#: ../../extending/newtypes_tutorial.rst:107 +msgid "" +"The actual definition of :c:type:`PyTypeObject` in :file:`object.h` has many " +"more :ref:`fields ` than the definition above. The remaining " +"fields will be filled with zeros by the C compiler, and it's common practice " +"to not specify them explicitly unless you need them." msgstr "" +#: ../../extending/newtypes_tutorial.rst:112 msgid "We're going to pick it apart, one field at a time::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:114 msgid ".ob_base = PyVarObject_HEAD_INIT(NULL, 0)" msgstr "" -msgid "This line is mandatory boilerplate to initialize the ``ob_base`` field mentioned above. ::" +#: ../../extending/newtypes_tutorial.rst:116 +msgid "" +"This line is mandatory boilerplate to initialize the ``ob_base`` field " +"mentioned above. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:119 msgid ".tp_name = \"custom.Custom\"," msgstr "" -msgid "The name of our type. This will appear in the default textual representation of our objects and in some error messages, for example:" +#: ../../extending/newtypes_tutorial.rst:121 +msgid "" +"The name of our type. This will appear in the default textual " +"representation of our objects and in some error messages, for example:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:124 msgid "" ">>> \"\" + custom.Custom()\n" "Traceback (most recent call last):\n" @@ -180,70 +266,126 @@ msgid "" "TypeError: can only concatenate str (not \"custom.Custom\") to str" msgstr "" -msgid "Note that the name is a dotted name that includes both the module name and the name of the type within the module. The module in this case is :mod:`!custom` and the type is :class:`!Custom`, so we set the type name to :class:`!custom.Custom`. Using the real dotted import path is important to make your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" +#: ../../extending/newtypes_tutorial.rst:131 +msgid "" +"Note that the name is a dotted name that includes both the module name and " +"the name of the type within the module. The module in this case is :mod:`!" +"custom` and the type is :class:`!Custom`, so we set the type name " +"to :class:`!custom.Custom`. Using the real dotted import path is important " +"to make your type compatible with the :mod:`pydoc` and :mod:`pickle` " +"modules. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:137 msgid "" ".tp_basicsize = sizeof(CustomObject),\n" ".tp_itemsize = 0," msgstr "" -msgid "This is so that Python knows how much memory to allocate when creating new :class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only used for variable-sized objects and should otherwise be zero." -msgstr "" - -msgid "If you want your type to be subclassable from Python, and your type has the same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have problems with multiple inheritance. A Python subclass of your type will have to list your type first in its :attr:`~type.__bases__`, or else it will not be able to call your type's :meth:`~object.__new__` method without getting an error. You can avoid this problem by ensuring that your type has a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its base type does. Most of the time, this will be true anyway, because either your base type will be :class:`object`, or else you will be adding data members to your base type, and therefore increasing its size." +#: ../../extending/newtypes_tutorial.rst:140 +msgid "" +"This is so that Python knows how much memory to allocate when creating " +"new :class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is " +"only used for variable-sized objects and should otherwise be zero." msgstr "" +#: ../../extending/newtypes_tutorial.rst:146 +msgid "" +"If you want your type to be subclassable from Python, and your type has the " +"same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have " +"problems with multiple inheritance. A Python subclass of your type will " +"have to list your type first in its :attr:`~type.__bases__`, or else it will " +"not be able to call your type's :meth:`~object.__new__` method without " +"getting an error. You can avoid this problem by ensuring that your type has " +"a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its base type " +"does. Most of the time, this will be true anyway, because either your base " +"type will be :class:`object`, or else you will be adding data members to " +"your base type, and therefore increasing its size." +msgstr "" + +#: ../../extending/newtypes_tutorial.rst:156 msgid "We set the class flags to :c:macro:`Py_TPFLAGS_DEFAULT`. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:158 msgid ".tp_flags = Py_TPFLAGS_DEFAULT," msgstr "" -msgid "All types should include this constant in their flags. It enables all of the members defined until at least Python 3.3. If you need further members, you will need to OR the corresponding flags." +#: ../../extending/newtypes_tutorial.rst:160 +msgid "" +"All types should include this constant in their flags. It enables all of " +"the members defined until at least Python 3.3. If you need further members, " +"you will need to OR the corresponding flags." msgstr "" -msgid "We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::" +#: ../../extending/newtypes_tutorial.rst:164 +msgid "" +"We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:166 msgid ".tp_doc = PyDoc_STR(\"Custom objects\")," msgstr "" -msgid "To enable object creation, we have to provide a :c:member:`~PyTypeObject.tp_new` handler. This is the equivalent of the Python method :meth:`~object.__new__`, but has to be specified explicitly. In this case, we can just use the default implementation provided by the API function :c:func:`PyType_GenericNew`. ::" +#: ../../extending/newtypes_tutorial.rst:168 +msgid "" +"To enable object creation, we have to provide " +"a :c:member:`~PyTypeObject.tp_new` handler. This is the equivalent of the " +"Python method :meth:`~object.__new__`, but has to be specified explicitly. " +"In this case, we can just use the default implementation provided by the API " +"function :c:func:`PyType_GenericNew`. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:173 msgid ".tp_new = PyType_GenericNew," msgstr "" -msgid "Everything else in the file should be familiar, except for some code in :c:func:`!custom_module_exec`::" +#: ../../extending/newtypes_tutorial.rst:175 +msgid "" +"Everything else in the file should be familiar, except for some code " +"in :c:func:`!custom_module_exec`::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:178 msgid "" "if (PyType_Ready(&CustomType) < 0) {\n" " return -1;\n" "}" msgstr "" -msgid "This initializes the :class:`!Custom` type, filling in a number of members to the appropriate default values, including :c:member:`~PyObject.ob_type` that we initially set to ``NULL``. ::" +#: ../../extending/newtypes_tutorial.rst:182 +msgid "" +"This initializes the :class:`!Custom` type, filling in a number of members " +"to the appropriate default values, including :c:member:`~PyObject.ob_type` " +"that we initially set to ``NULL``. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:186 msgid "" "if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " return -1;\n" "}" msgstr "" -msgid "This adds the type to the module dictionary. This allows us to create :class:`!Custom` instances by calling the :class:`!Custom` class:" +#: ../../extending/newtypes_tutorial.rst:190 +msgid "" +"This adds the type to the module dictionary. This allows us to " +"create :class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:193 msgid "" ">>> import custom\n" ">>> mycustom = custom.Custom()" msgstr "" -msgid "That's it! All that remains is to build it; put the above code in a file called :file:`custom.c`," +#: ../../extending/newtypes_tutorial.rst:198 +msgid "" +"That's it! All that remains is to build it; put the above code in a file " +"called :file:`custom.c`," msgstr "" +#: ../../extending/newtypes_tutorial.rst:201 msgid "" "[build-system]\n" "requires = [\"setuptools\"]\n" @@ -254,35 +396,54 @@ msgid "" "version = \"1\"\n" msgstr "" +#: ../../extending/newtypes_tutorial.rst:203 msgid "in a file called :file:`pyproject.toml`, and" msgstr "" +#: ../../extending/newtypes_tutorial.rst:205 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" msgstr "" +#: ../../extending/newtypes_tutorial.rst:210 msgid "in a file called :file:`setup.py`; then typing" msgstr "" +#: ../../extending/newtypes_tutorial.rst:212 +#: ../../extending/newtypes_tutorial.rst:550 msgid "$ python -m pip install ." msgstr "" -msgid "in a shell should produce a file :file:`custom.so` in a subdirectory and install it; now fire up Python --- you should be able to ``import custom`` and play around with ``Custom`` objects." +#: ../../extending/newtypes_tutorial.rst:216 +msgid "" +"in a shell should produce a file :file:`custom.so` in a subdirectory and " +"install it; now fire up Python --- you should be able to ``import custom`` " +"and play around with ``Custom`` objects." msgstr "" +#: ../../extending/newtypes_tutorial.rst:220 msgid "That wasn't so hard, was it?" msgstr "" -msgid "Of course, the current Custom type is pretty uninteresting. It has no data and doesn't do anything. It can't even be subclassed." +#: ../../extending/newtypes_tutorial.rst:222 +msgid "" +"Of course, the current Custom type is pretty uninteresting. It has no data " +"and doesn't do anything. It can't even be subclassed." msgstr "" +#: ../../extending/newtypes_tutorial.rst:227 msgid "Adding data and methods to the Basic example" msgstr "" -msgid "Let's extend the basic example to add some data and methods. Let's also make the type usable as a base class. We'll create a new module, :mod:`!custom2` that adds these capabilities:" +#: ../../extending/newtypes_tutorial.rst:229 +msgid "" +"Let's extend the basic example to add some data and methods. Let's also " +"make the type usable as a base class. We'll create a new module, :mod:`!" +"custom2` that adds these capabilities:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:233 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -399,7 +560,8 @@ msgid "" " return -1;\n" " }\n" "\n" -" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" " return -1;\n" " }\n" "\n" @@ -408,7 +570,8 @@ msgid "" "\n" "static PyModuleDef_Slot custom_module_slots[] = {\n" " {Py_mod_exec, custom_module_exec},\n" -" {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" " {0, NULL}\n" "};\n" "\n" @@ -427,15 +590,23 @@ msgid "" "}\n" msgstr "" +#: ../../extending/newtypes_tutorial.rst:236 msgid "This version of the module has a number of changes." msgstr "" -msgid "The :class:`!Custom` type now has three data attributes in its C struct, *first*, *last*, and *number*. The *first* and *last* variables are Python strings containing first and last names. The *number* attribute is a C integer." +#: ../../extending/newtypes_tutorial.rst:238 +msgid "" +"The :class:`!Custom` type now has three data attributes in its C struct, " +"*first*, *last*, and *number*. The *first* and *last* variables are Python " +"strings containing first and last names. The *number* attribute is a C " +"integer." msgstr "" +#: ../../extending/newtypes_tutorial.rst:242 msgid "The object structure is updated accordingly::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:244 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -445,9 +616,13 @@ msgid "" "} CustomObject;" msgstr "" -msgid "Because we now have data to manage, we have to be more careful about object allocation and deallocation. At a minimum, we need a deallocation method::" +#: ../../extending/newtypes_tutorial.rst:251 +msgid "" +"Because we now have data to manage, we have to be more careful about object " +"allocation and deallocation. At a minimum, we need a deallocation method::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:254 msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -459,21 +634,43 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes_tutorial.rst:263 msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:265 msgid ".tp_dealloc = Custom_dealloc," msgstr "" -msgid "This method first clears the reference counts of the two Python attributes. :c:func:`Py_XDECREF` correctly handles the case where its argument is ``NULL`` (which might happen here if ``tp_new`` failed midway). It then calls the :c:member:`~PyTypeObject.tp_free` member of the object's type (computed by ``Py_TYPE(self)``) to free the object's memory. Note that the object's type might not be :class:`!CustomType`, because the object may be an instance of a subclass." +#: ../../extending/newtypes_tutorial.rst:267 +msgid "" +"This method first clears the reference counts of the two Python " +"attributes. :c:func:`Py_XDECREF` correctly handles the case where its " +"argument is ``NULL`` (which might happen here if ``tp_new`` failed midway). " +"It then calls the :c:member:`~PyTypeObject.tp_free` member of the object's " +"type (computed by ``Py_TYPE(self)``) to free the object's memory. Note that " +"the object's type might not be :class:`!CustomType`, because the object may " +"be an instance of a subclass." msgstr "" -msgid "The explicit cast to ``CustomObject *`` above is needed because we defined ``Custom_dealloc`` to take a ``PyObject *`` argument, as the ``tp_dealloc`` function pointer expects to receive a ``PyObject *`` argument. By assigning to the ``tp_dealloc`` slot of a type, we declare that it can only be called with instances of our ``CustomObject`` class, so the cast to ``(CustomObject *)`` is safe. This is object-oriented polymorphism, in C!" +#: ../../extending/newtypes_tutorial.rst:277 +msgid "" +"The explicit cast to ``CustomObject *`` above is needed because we defined " +"``Custom_dealloc`` to take a ``PyObject *`` argument, as the ``tp_dealloc`` " +"function pointer expects to receive a ``PyObject *`` argument. By assigning " +"to the ``tp_dealloc`` slot of a type, we declare that it can only be called " +"with instances of our ``CustomObject`` class, so the cast to ``(CustomObject " +"*)`` is safe. This is object-oriented polymorphism, in C!" msgstr "" -msgid "In existing code, or in previous versions of this tutorial, you might see similar functions take a pointer to the subtype object structure (``CustomObject*``) directly, like this::" +#: ../../extending/newtypes_tutorial.rst:285 +msgid "" +"In existing code, or in previous versions of this tutorial, you might see " +"similar functions take a pointer to the subtype object structure " +"(``CustomObject*``) directly, like this::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:289 msgid "" "Custom_dealloc(CustomObject *self)\n" "{\n" @@ -485,12 +682,19 @@ msgid "" ".tp_dealloc = (destructor) Custom_dealloc," msgstr "" -msgid "This does the same thing on all architectures that CPython supports, but according to the C standard, it invokes undefined behavior." +#: ../../extending/newtypes_tutorial.rst:298 +msgid "" +"This does the same thing on all architectures that CPython supports, but " +"according to the C standard, it invokes undefined behavior." msgstr "" -msgid "We want to make sure that the first and last names are initialized to empty strings, so we provide a ``tp_new`` implementation::" +#: ../../extending/newtypes_tutorial.rst:302 +msgid "" +"We want to make sure that the first and last names are initialized to empty " +"strings, so we provide a ``tp_new`` implementation::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:305 msgid "" "static PyObject *\n" "Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" @@ -514,39 +718,88 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes_tutorial.rst:326 msgid "and install it in the :c:member:`~PyTypeObject.tp_new` member::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:328 msgid ".tp_new = Custom_new," msgstr "" -msgid "The ``tp_new`` handler is responsible for creating (as opposed to initializing) objects of the type. It is exposed in Python as the :meth:`~object.__new__` method. It is not required to define a ``tp_new`` member, and indeed many extension types will simply reuse :c:func:`PyType_GenericNew` as done in the first version of the :class:`!Custom` type above. In this case, we use the ``tp_new`` handler to initialize the ``first`` and ``last`` attributes to non-``NULL`` default values." +#: ../../extending/newtypes_tutorial.rst:330 +msgid "" +"The ``tp_new`` handler is responsible for creating (as opposed to " +"initializing) objects of the type. It is exposed in Python as " +"the :meth:`~object.__new__` method. It is not required to define a " +"``tp_new`` member, and indeed many extension types will simply " +"reuse :c:func:`PyType_GenericNew` as done in the first version of " +"the :class:`!Custom` type above. In this case, we use the ``tp_new`` " +"handler to initialize the ``first`` and ``last`` attributes to non-``NULL`` " +"default values." msgstr "" -msgid "``tp_new`` is passed the type being instantiated (not necessarily ``CustomType``, if a subclass is instantiated) and any arguments passed when the type was called, and is expected to return the instance created. ``tp_new`` handlers always accept positional and keyword arguments, but they often ignore the arguments, leaving the argument handling to initializer (a.k.a. ``tp_init`` in C or ``__init__`` in Python) methods." +#: ../../extending/newtypes_tutorial.rst:338 +msgid "" +"``tp_new`` is passed the type being instantiated (not necessarily " +"``CustomType``, if a subclass is instantiated) and any arguments passed when " +"the type was called, and is expected to return the instance created. " +"``tp_new`` handlers always accept positional and keyword arguments, but they " +"often ignore the arguments, leaving the argument handling to initializer " +"(a.k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" -msgid "``tp_new`` shouldn't call ``tp_init`` explicitly, as the interpreter will do it itself." +#: ../../extending/newtypes_tutorial.rst:346 +msgid "" +"``tp_new`` shouldn't call ``tp_init`` explicitly, as the interpreter will do " +"it itself." msgstr "" -msgid "The ``tp_new`` implementation calls the :c:member:`~PyTypeObject.tp_alloc` slot to allocate memory::" +#: ../../extending/newtypes_tutorial.rst:349 +msgid "" +"The ``tp_new`` implementation calls the :c:member:`~PyTypeObject.tp_alloc` " +"slot to allocate memory::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:352 msgid "self = (CustomObject *) type->tp_alloc(type, 0);" msgstr "" -msgid "Since memory allocation may fail, we must check the :c:member:`~PyTypeObject.tp_alloc` result against ``NULL`` before proceeding." -msgstr "" - -msgid "We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base class, which is :class:`object` by default. Most types use the default allocation strategy." +#: ../../extending/newtypes_tutorial.rst:354 +msgid "" +"Since memory allocation may fail, we must check " +"the :c:member:`~PyTypeObject.tp_alloc` result against ``NULL`` before " +"proceeding." msgstr "" -msgid "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object.__new__`), you must *not* try to determine what method to call using method resolution order at runtime. Always statically determine what type you are going to call, and call its :c:member:`~PyTypeObject.tp_new` directly, or via ``type->tp_base->tp_new``. If you do not do this, Python subclasses of your type that also inherit from other Python-defined classes may not work correctly. (Specifically, you may not be able to create instances of such subclasses without getting a :exc:`TypeError`.)" +#: ../../extending/newtypes_tutorial.rst:358 +msgid "" +"We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. " +"Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base " +"class, which is :class:`object` by default. Most types use the default " +"allocation strategy." msgstr "" -msgid "We also define an initialization function which accepts arguments to provide initial values for our instance::" +#: ../../extending/newtypes_tutorial.rst:364 +msgid "" +"If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " +"that calls a base type's :c:member:`~PyTypeObject.tp_new` " +"or :meth:`~object.__new__`), you must *not* try to determine what method to " +"call using method resolution order at runtime. Always statically determine " +"what type you are going to call, and call " +"its :c:member:`~PyTypeObject.tp_new` directly, or via ``type->tp_base-" +">tp_new``. If you do not do this, Python subclasses of your type that also " +"inherit from other Python-defined classes may not work correctly. " +"(Specifically, you may not be able to create instances of such subclasses " +"without getting a :exc:`TypeError`.)" +msgstr "" + +#: ../../extending/newtypes_tutorial.rst:374 +msgid "" +"We also define an initialization function which accepts arguments to provide " +"initial values for our instance::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:377 msgid "" "static int\n" "Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -576,18 +829,34 @@ msgid "" "}" msgstr "" +#: ../../extending/newtypes_tutorial.rst:404 msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:406 msgid ".tp_init = Custom_init," msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:`~object.__init__` method. It is used to initialize an object after it's created. Initializers always accept positional and keyword arguments, and they should return either ``0`` on success or ``-1`` on error." +#: ../../extending/newtypes_tutorial.rst:408 +msgid "" +"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as " +"the :meth:`~object.__init__` method. It is used to initialize an object " +"after it's created. Initializers always accept positional and keyword " +"arguments, and they should return either ``0`` on success or ``-1`` on error." msgstr "" -msgid "Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is called at all (for example, the :mod:`pickle` module by default doesn't call :meth:`~object.__init__` on unpickled instances). It can also be called multiple times. Anyone can call the :meth:`!__init__` method on our objects. For this reason, we have to be extra careful when assigning the new attribute values. We might be tempted, for example to assign the ``first`` member like this::" +#: ../../extending/newtypes_tutorial.rst:413 +msgid "" +"Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is " +"called at all (for example, the :mod:`pickle` module by default doesn't " +"call :meth:`~object.__init__` on unpickled instances). It can also be " +"called multiple times. Anyone can call the :meth:`!__init__` method on our " +"objects. For this reason, we have to be extra careful when assigning the " +"new attribute values. We might be tempted, for example to assign the " +"``first`` member like this::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:421 msgid "" "if (first) {\n" " Py_XDECREF(self->first);\n" @@ -596,24 +865,48 @@ msgid "" "}" msgstr "" -msgid "But this would be risky. Our type doesn't restrict the type of the ``first`` member, so it could be any kind of object. It could have a destructor that causes code to be executed that tries to access the ``first`` member; or that destructor could detach the :term:`thread state ` and let arbitrary code run in other threads that accesses and modifies our object." +#: ../../extending/newtypes_tutorial.rst:427 +msgid "" +"But this would be risky. Our type doesn't restrict the type of the " +"``first`` member, so it could be any kind of object. It could have a " +"destructor that causes code to be executed that tries to access the " +"``first`` member; or that destructor could detach the :term:`thread state " +"` and let arbitrary code run in other threads that " +"accesses and modifies our object." msgstr "" -msgid "To be paranoid and protect ourselves against this possibility, we almost always reassign members before decrementing their reference counts. When don't we have to do this?" +#: ../../extending/newtypes_tutorial.rst:434 +msgid "" +"To be paranoid and protect ourselves against this possibility, we almost " +"always reassign members before decrementing their reference counts. When " +"don't we have to do this?" msgstr "" +#: ../../extending/newtypes_tutorial.rst:438 msgid "when we absolutely know that the reference count is greater than 1;" msgstr "" -msgid "when we know that deallocation of the object [#]_ will neither detach the :term:`thread state ` nor cause any calls back into our type's code;" +#: ../../extending/newtypes_tutorial.rst:440 +msgid "" +"when we know that deallocation of the object [#]_ will neither detach " +"the :term:`thread state ` nor cause any calls back " +"into our type's code;" msgstr "" -msgid "when decrementing a reference count in a :c:member:`~PyTypeObject.tp_dealloc` handler on a type which doesn't support cyclic garbage collection [#]_." +#: ../../extending/newtypes_tutorial.rst:443 +msgid "" +"when decrementing a reference count in " +"a :c:member:`~PyTypeObject.tp_dealloc` handler on a type which doesn't " +"support cyclic garbage collection [#]_." msgstr "" -msgid "We want to expose our instance variables as attributes. There are a number of ways to do that. The simplest way is to define member definitions::" +#: ../../extending/newtypes_tutorial.rst:446 +msgid "" +"We want to expose our instance variables as attributes. There are a number " +"of ways to do that. The simplest way is to define member definitions::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:449 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" @@ -626,21 +919,40 @@ msgid "" "};" msgstr "" -msgid "and put the definitions in the :c:member:`~PyTypeObject.tp_members` slot::" +#: ../../extending/newtypes_tutorial.rst:459 +msgid "" +"and put the definitions in the :c:member:`~PyTypeObject.tp_members` slot::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:461 msgid ".tp_members = Custom_members," msgstr "" -msgid "Each member definition has a member name, type, offset, access flags and documentation string. See the :ref:`Generic-Attribute-Management` section below for details." +#: ../../extending/newtypes_tutorial.rst:463 +msgid "" +"Each member definition has a member name, type, offset, access flags and " +"documentation string. See the :ref:`Generic-Attribute-Management` section " +"below for details." msgstr "" -msgid "A disadvantage of this approach is that it doesn't provide a way to restrict the types of objects that can be assigned to the Python attributes. We expect the first and last names to be strings, but any Python objects can be assigned. Further, the attributes can be deleted, setting the C pointers to ``NULL``. Even though we can make sure the members are initialized to non-``NULL`` values, the members can be set to ``NULL`` if the attributes are deleted." +#: ../../extending/newtypes_tutorial.rst:467 +msgid "" +"A disadvantage of this approach is that it doesn't provide a way to restrict " +"the types of objects that can be assigned to the Python attributes. We " +"expect the first and last names to be strings, but any Python objects can be " +"assigned. Further, the attributes can be deleted, setting the C pointers to " +"``NULL``. Even though we can make sure the members are initialized to non-" +"``NULL`` values, the members can be set to ``NULL`` if the attributes are " +"deleted." msgstr "" -msgid "We define a single method, :meth:`!Custom.name`, that outputs the objects name as the concatenation of the first and last names. ::" +#: ../../extending/newtypes_tutorial.rst:474 +msgid "" +"We define a single method, :meth:`!Custom.name`, that outputs the objects " +"name as the concatenation of the first and last names. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:477 msgid "" "static PyObject *\n" "Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" @@ -658,20 +970,38 @@ msgid "" "}" msgstr "" -msgid "The method is implemented as a C function that takes a :class:`!Custom` (or :class:`!Custom` subclass) instance as the first argument. Methods always take an instance as the first argument. Methods often take positional and keyword arguments as well, but in this case we don't take any and don't need to accept a positional argument tuple or keyword argument dictionary. This method is equivalent to the Python method:" +#: ../../extending/newtypes_tutorial.rst:492 +msgid "" +"The method is implemented as a C function that takes a :class:`!Custom` " +"(or :class:`!Custom` subclass) instance as the first argument. Methods " +"always take an instance as the first argument. Methods often take positional " +"and keyword arguments as well, but in this case we don't take any and don't " +"need to accept a positional argument tuple or keyword argument dictionary. " +"This method is equivalent to the Python method:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:499 msgid "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" msgstr "" -msgid "Note that we have to check for the possibility that our :attr:`!first` and :attr:`!last` members are ``NULL``. This is because they can be deleted, in which case they are set to ``NULL``. It would be better to prevent deletion of these attributes and to restrict the attribute values to be strings. We'll see how to do that in the next section." +#: ../../extending/newtypes_tutorial.rst:504 +msgid "" +"Note that we have to check for the possibility that our :attr:`!first` " +"and :attr:`!last` members are ``NULL``. This is because they can be " +"deleted, in which case they are set to ``NULL``. It would be better to " +"prevent deletion of these attributes and to restrict the attribute values to " +"be strings. We'll see how to do that in the next section." msgstr "" -msgid "Now that we've defined the method, we need to create an array of method definitions::" +#: ../../extending/newtypes_tutorial.rst:510 +msgid "" +"Now that we've defined the method, we need to create an array of method " +"definitions::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:513 msgid "" "static PyMethodDef Custom_methods[] = {\n" " {\"name\", Custom_name, METH_NOARGS,\n" @@ -681,27 +1011,44 @@ msgid "" "};" msgstr "" -msgid "(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the method is expecting no arguments other than *self*)" +#: ../../extending/newtypes_tutorial.rst:520 +msgid "" +"(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the " +"method is expecting no arguments other than *self*)" msgstr "" +#: ../../extending/newtypes_tutorial.rst:523 msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:525 msgid ".tp_methods = Custom_methods," msgstr "" -msgid "Finally, we'll make our type usable as a base class for subclassing. We've written our methods carefully so far so that they don't make any assumptions about the type of the object being created or used, so all we need to do is to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" +#: ../../extending/newtypes_tutorial.rst:527 +msgid "" +"Finally, we'll make our type usable as a base class for subclassing. We've " +"written our methods carefully so far so that they don't make any assumptions " +"about the type of the object being created or used, so all we need to do is " +"to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:532 msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," msgstr "" -msgid "We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the module name in the :c:type:`PyModuleDef` struct, and update the full class name in the :c:type:`PyTypeObject` struct." +#: ../../extending/newtypes_tutorial.rst:534 +msgid "" +"We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the " +"module name in the :c:type:`PyModuleDef` struct, and update the full class " +"name in the :c:type:`PyTypeObject` struct." msgstr "" +#: ../../extending/newtypes_tutorial.rst:538 msgid "Finally, we update our :file:`setup.py` file to include the new module," msgstr "" +#: ../../extending/newtypes_tutorial.rst:540 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[\n" @@ -710,15 +1057,24 @@ msgid "" "])" msgstr "" +#: ../../extending/newtypes_tutorial.rst:548 msgid "and then we re-install so that we can ``import custom2``:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:555 msgid "Providing finer control over data attributes" msgstr "" -msgid "In this section, we'll provide finer control over how the :attr:`!first` and :attr:`!last` attributes are set in the :class:`!Custom` example. In the previous version of our module, the instance variables :attr:`!first` and :attr:`!last` could be set to non-string values or even deleted. We want to make sure that these attributes always contain strings." +#: ../../extending/newtypes_tutorial.rst:557 +msgid "" +"In this section, we'll provide finer control over how the :attr:`!first` " +"and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " +"previous version of our module, the instance variables :attr:`!first` " +"and :attr:`!last` could be set to non-string values or even deleted. We want " +"to make sure that these attributes always contain strings." msgstr "" +#: ../../extending/newtypes_tutorial.rst:563 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -800,7 +1156,8 @@ msgid "" "{\n" " CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" -" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first attribute\");\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" " return -1;\n" " }\n" " if (!PyUnicode_Check(value)) {\n" @@ -824,7 +1181,8 @@ msgid "" "{\n" " CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" -" PyErr_SetString(PyExc_TypeError, \"Cannot delete the last attribute\");\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the last " +"attribute\");\n" " return -1;\n" " }\n" " if (!PyUnicode_Check(value)) {\n" @@ -880,7 +1238,8 @@ msgid "" " return -1;\n" " }\n" "\n" -" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" " return -1;\n" " }\n" "\n" @@ -889,7 +1248,8 @@ msgid "" "\n" "static PyModuleDef_Slot custom_module_slots[] = {\n" " {Py_mod_exec, custom_module_exec},\n" -" {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" " {0, NULL}\n" "};\n" "\n" @@ -908,9 +1268,14 @@ msgid "" "}\n" msgstr "" -msgid "To provide greater control, over the :attr:`!first` and :attr:`!last` attributes, we'll use custom getter and setter functions. Here are the functions for getting and setting the :attr:`!first` attribute::" +#: ../../extending/newtypes_tutorial.rst:566 +msgid "" +"To provide greater control, over the :attr:`!first` and :attr:`!last` " +"attributes, we'll use custom getter and setter functions. Here are the " +"functions for getting and setting the :attr:`!first` attribute::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:570 msgid "" "static PyObject *\n" "Custom_getfirst(PyObject *op, void *closure)\n" @@ -926,7 +1291,8 @@ msgid "" " CustomObject *self = (CustomObject *) op;\n" " PyObject *tmp;\n" " if (value == NULL) {\n" -" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first attribute\");\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" " return -1;\n" " }\n" " if (!PyUnicode_Check(value)) {\n" @@ -942,15 +1308,29 @@ msgid "" "}" msgstr "" -msgid "The getter function is passed a :class:`!Custom` object and a \"closure\", which is a void pointer. In this case, the closure is ignored. (The closure supports an advanced usage in which definition data is passed to the getter and setter. This could, for example, be used to allow a single set of getter and setter functions that decide the attribute to get or set based on data in the closure.)" +#: ../../extending/newtypes_tutorial.rst:599 +msgid "" +"The getter function is passed a :class:`!Custom` object and a \"closure\", " +"which is a void pointer. In this case, the closure is ignored. (The " +"closure supports an advanced usage in which definition data is passed to the " +"getter and setter. This could, for example, be used to allow a single set of " +"getter and setter functions that decide the attribute to get or set based on " +"data in the closure.)" msgstr "" -msgid "The setter function is passed the :class:`!Custom` object, the new value, and the closure. The new value may be ``NULL``, in which case the attribute is being deleted. In our setter, we raise an error if the attribute is deleted or if its new value is not a string." +#: ../../extending/newtypes_tutorial.rst:605 +msgid "" +"The setter function is passed the :class:`!Custom` object, the new value, " +"and the closure. The new value may be ``NULL``, in which case the attribute " +"is being deleted. In our setter, we raise an error if the attribute is " +"deleted or if its new value is not a string." msgstr "" +#: ../../extending/newtypes_tutorial.rst:610 msgid "We create an array of :c:type:`PyGetSetDef` structures::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:612 msgid "" "static PyGetSetDef Custom_getsetters[] = {\n" " {\"first\", Custom_getfirst, Custom_setfirst,\n" @@ -961,18 +1341,26 @@ msgid "" "};" msgstr "" +#: ../../extending/newtypes_tutorial.rst:620 msgid "and register it in the :c:member:`~PyTypeObject.tp_getset` slot::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:622 msgid ".tp_getset = Custom_getsetters," msgstr "" -msgid "The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" mentioned above. In this case, we aren't using a closure, so we just pass ``NULL``." +#: ../../extending/newtypes_tutorial.rst:624 +msgid "" +"The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" " +"mentioned above. In this case, we aren't using a closure, so we just pass " +"``NULL``." msgstr "" +#: ../../extending/newtypes_tutorial.rst:627 msgid "We also remove the member definitions for these attributes::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:629 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" @@ -981,9 +1369,13 @@ msgid "" "};" msgstr "" -msgid "We also need to update the :c:member:`~PyTypeObject.tp_init` handler to only allow strings [#]_ to be passed::" +#: ../../extending/newtypes_tutorial.rst:635 +msgid "" +"We also need to update the :c:member:`~PyTypeObject.tp_init` handler to only " +"allow strings [#]_ to be passed::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:638 msgid "" "static int\n" "Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -1013,30 +1405,60 @@ msgid "" "}" msgstr "" -msgid "With these changes, we can assure that the ``first`` and ``last`` members are never ``NULL`` so we can remove checks for ``NULL`` values in almost all cases. This means that most of the :c:func:`Py_XDECREF` calls can be converted to :c:func:`Py_DECREF` calls. The only place we can't change these calls is in the ``tp_dealloc`` implementation, where there is the possibility that the initialization of these members failed in ``tp_new``." +#: ../../extending/newtypes_tutorial.rst:665 +msgid "" +"With these changes, we can assure that the ``first`` and ``last`` members " +"are never ``NULL`` so we can remove checks for ``NULL`` values in almost all " +"cases. This means that most of the :c:func:`Py_XDECREF` calls can be " +"converted to :c:func:`Py_DECREF` calls. The only place we can't change " +"these calls is in the ``tp_dealloc`` implementation, where there is the " +"possibility that the initialization of these members failed in ``tp_new``." msgstr "" -msgid "We also rename the module initialization function and module name in the initialization function, as we did before, and we add an extra definition to the :file:`setup.py` file." +#: ../../extending/newtypes_tutorial.rst:672 +msgid "" +"We also rename the module initialization function and module name in the " +"initialization function, as we did before, and we add an extra definition to " +"the :file:`setup.py` file." msgstr "" +#: ../../extending/newtypes_tutorial.rst:678 msgid "Supporting cyclic garbage collection" msgstr "" -msgid "Python has a :term:`cyclic garbage collector (GC) ` that can identify unneeded objects even when their reference counts are not zero. This can happen when objects are involved in cycles. For example, consider:" +#: ../../extending/newtypes_tutorial.rst:680 +msgid "" +"Python has a :term:`cyclic garbage collector (GC) ` that " +"can identify unneeded objects even when their reference counts are not zero. " +"This can happen when objects are involved in cycles. For example, consider:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:684 msgid "" ">>> l = []\n" ">>> l.append(l)\n" ">>> del l" msgstr "" -msgid "In this example, we create a list that contains itself. When we delete it, it still has a reference from itself. Its reference count doesn't drop to zero. Fortunately, Python's cyclic garbage collector will eventually figure out that the list is garbage and free it." +#: ../../extending/newtypes_tutorial.rst:690 +msgid "" +"In this example, we create a list that contains itself. When we delete it, " +"it still has a reference from itself. Its reference count doesn't drop to " +"zero. Fortunately, Python's cyclic garbage collector will eventually figure " +"out that the list is garbage and free it." msgstr "" -msgid "In the second version of the :class:`!Custom` example, we allowed any kind of object to be stored in the :attr:`!first` or :attr:`!last` attributes [#]_. Besides, in the second and third versions, we allowed subclassing :class:`!Custom`, and subclasses may add arbitrary attributes. For any of those two reasons, :class:`!Custom` objects can participate in cycles:" +#: ../../extending/newtypes_tutorial.rst:695 +msgid "" +"In the second version of the :class:`!Custom` example, we allowed any kind " +"of object to be stored in the :attr:`!first` or :attr:`!last` attributes " +"[#]_. Besides, in the second and third versions, we allowed " +"subclassing :class:`!Custom`, and subclasses may add arbitrary attributes. " +"For any of those two reasons, :class:`!Custom` objects can participate in " +"cycles:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:701 msgid "" ">>> import custom3\n" ">>> class Derived(custom3.Custom): pass\n" @@ -1045,9 +1467,15 @@ msgid "" ">>> n.some_attribute = n" msgstr "" -msgid "To allow a :class:`!Custom` instance participating in a reference cycle to be properly detected and collected by the cyclic GC, our :class:`!Custom` type needs to fill two additional slots and to enable a flag that enables these slots:" +#: ../../extending/newtypes_tutorial.rst:709 +msgid "" +"To allow a :class:`!Custom` instance participating in a reference cycle to " +"be properly detected and collected by the cyclic GC, our :class:`!Custom` " +"type needs to fill two additional slots and to enable a flag that enables " +"these slots:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:713 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1146,7 +1574,8 @@ msgid "" "{\n" " CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" -" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first attribute\");\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" " return -1;\n" " }\n" " if (!PyUnicode_Check(value)) {\n" @@ -1170,7 +1599,8 @@ msgid "" "{\n" " CustomObject *self = (CustomObject *) op;\n" " if (value == NULL) {\n" -" PyErr_SetString(PyExc_TypeError, \"Cannot delete the last attribute\");\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the last " +"attribute\");\n" " return -1;\n" " }\n" " if (!PyUnicode_Check(value)) {\n" @@ -1210,7 +1640,8 @@ msgid "" " .tp_doc = PyDoc_STR(\"Custom objects\"),\n" " .tp_basicsize = sizeof(CustomObject),\n" " .tp_itemsize = 0,\n" -" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | " +"Py_TPFLAGS_HAVE_GC,\n" " .tp_new = Custom_new,\n" " .tp_init = Custom_init,\n" " .tp_dealloc = Custom_dealloc,\n" @@ -1228,7 +1659,8 @@ msgid "" " return -1;\n" " }\n" "\n" -" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" " return -1;\n" " }\n" "\n" @@ -1237,7 +1669,8 @@ msgid "" "\n" "static PyModuleDef_Slot custom_module_slots[] = {\n" " {Py_mod_exec, custom_module_exec},\n" -" {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" " {0, NULL}\n" "};\n" "\n" @@ -1256,9 +1689,13 @@ msgid "" "}\n" msgstr "" -msgid "First, the traversal method lets the cyclic GC know about subobjects that could participate in cycles::" +#: ../../extending/newtypes_tutorial.rst:716 +msgid "" +"First, the traversal method lets the cyclic GC know about subobjects that " +"could participate in cycles::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:719 msgid "" "static int\n" "Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1279,12 +1716,23 @@ msgid "" "}" msgstr "" -msgid "For each subobject that can participate in cycles, we need to call the :c:func:`!visit` function, which is passed to the traversal method. The :c:func:`!visit` function takes as arguments the subobject and the extra argument *arg* passed to the traversal method. It returns an integer value that must be returned if it is non-zero." +#: ../../extending/newtypes_tutorial.rst:737 +msgid "" +"For each subobject that can participate in cycles, we need to call " +"the :c:func:`!visit` function, which is passed to the traversal method. " +"The :c:func:`!visit` function takes as arguments the subobject and the extra " +"argument *arg* passed to the traversal method. It returns an integer value " +"that must be returned if it is non-zero." msgstr "" -msgid "Python provides a :c:func:`Py_VISIT` macro that automates calling visit functions. With :c:func:`Py_VISIT`, we can minimize the amount of boilerplate in ``Custom_traverse``::" +#: ../../extending/newtypes_tutorial.rst:743 +msgid "" +"Python provides a :c:func:`Py_VISIT` macro that automates calling visit " +"functions. With :c:func:`Py_VISIT`, we can minimize the amount of " +"boilerplate in ``Custom_traverse``::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:747 msgid "" "static int\n" "Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1296,12 +1744,19 @@ msgid "" "}" msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_traverse` implementation must name its arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." +#: ../../extending/newtypes_tutorial.rst:757 +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` implementation must name its " +"arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." msgstr "" -msgid "Second, we need to provide a method for clearing any subobjects that can participate in cycles::" +#: ../../extending/newtypes_tutorial.rst:760 +msgid "" +"Second, we need to provide a method for clearing any subobjects that can " +"participate in cycles::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:763 msgid "" "static int\n" "Custom_clear(PyObject *op)\n" @@ -1313,12 +1768,21 @@ msgid "" "}" msgstr "" -msgid "Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and safe way to clear data attributes of arbitrary types while decrementing their reference counts. If you were to call :c:func:`Py_XDECREF` instead on the attribute before setting it to ``NULL``, there is a possibility that the attribute's destructor would call back into code that reads the attribute again (*especially* if there is a reference cycle)." +#: ../../extending/newtypes_tutorial.rst:772 +msgid "" +"Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and " +"safe way to clear data attributes of arbitrary types while decrementing " +"their reference counts. If you were to call :c:func:`Py_XDECREF` instead on " +"the attribute before setting it to ``NULL``, there is a possibility that the " +"attribute's destructor would call back into code that reads the attribute " +"again (*especially* if there is a reference cycle)." msgstr "" +#: ../../extending/newtypes_tutorial.rst:780 msgid "You could emulate :c:func:`Py_CLEAR` by writing::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:782 msgid "" "PyObject *tmp;\n" "tmp = self->first;\n" @@ -1326,12 +1790,24 @@ msgid "" "Py_XDECREF(tmp);" msgstr "" -msgid "Nevertheless, it is much easier and less error-prone to always use :c:func:`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the expense of robustness!" +#: ../../extending/newtypes_tutorial.rst:787 +msgid "" +"Nevertheless, it is much easier and less error-prone to always " +"use :c:func:`Py_CLEAR` when deleting an attribute. Don't try to micro-" +"optimize at the expense of robustness!" msgstr "" -msgid "The deallocator ``Custom_dealloc`` may call arbitrary code when clearing attributes. It means the circular GC can be triggered inside the function. Since the GC assumes reference count is not zero, we need to untrack the object from the GC by calling :c:func:`PyObject_GC_UnTrack` before clearing members. Here is our reimplemented deallocator using :c:func:`PyObject_GC_UnTrack` and ``Custom_clear``::" +#: ../../extending/newtypes_tutorial.rst:791 +msgid "" +"The deallocator ``Custom_dealloc`` may call arbitrary code when clearing " +"attributes. It means the circular GC can be triggered inside the function. " +"Since the GC assumes reference count is not zero, we need to untrack the " +"object from the GC by calling :c:func:`PyObject_GC_UnTrack` before clearing " +"members. Here is our reimplemented deallocator " +"using :c:func:`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:798 msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -1342,24 +1818,46 @@ msgid "" "}" msgstr "" -msgid "Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" +#: ../../extending/newtypes_tutorial.rst:806 +msgid "" +"Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" msgstr "" -msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," +#: ../../extending/newtypes_tutorial.rst:808 +msgid "" +".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," msgstr "" -msgid "That's pretty much it. If we had written custom :c:member:`~PyTypeObject.tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify them for cyclic garbage collection. Most extensions will use the versions automatically provided." +#: ../../extending/newtypes_tutorial.rst:810 +msgid "" +"That's pretty much it. If we had written " +"custom :c:member:`~PyTypeObject.tp_alloc` " +"or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify them for " +"cyclic garbage collection. Most extensions will use the versions " +"automatically provided." msgstr "" +#: ../../extending/newtypes_tutorial.rst:816 msgid "Subclassing other types" msgstr "" -msgid "It is possible to create new extension types that are derived from existing types. It is easiest to inherit from the built in types, since an extension can easily use the :c:type:`PyTypeObject` it needs. It can be difficult to share these :c:type:`PyTypeObject` structures between extension modules." +#: ../../extending/newtypes_tutorial.rst:818 +msgid "" +"It is possible to create new extension types that are derived from existing " +"types. It is easiest to inherit from the built in types, since an extension " +"can easily use the :c:type:`PyTypeObject` it needs. It can be difficult to " +"share these :c:type:`PyTypeObject` structures between extension modules." msgstr "" -msgid "In this example we will create a :class:`!SubList` type that inherits from the built-in :class:`list` type. The new type will be completely compatible with regular lists, but will have an additional :meth:`!increment` method that increases an internal counter:" +#: ../../extending/newtypes_tutorial.rst:823 +msgid "" +"In this example we will create a :class:`!SubList` type that inherits from " +"the built-in :class:`list` type. The new type will be completely compatible " +"with regular lists, but will have an additional :meth:`!increment` method " +"that increases an internal counter:" msgstr "" +#: ../../extending/newtypes_tutorial.rst:828 msgid "" ">>> import sublist\n" ">>> s = sublist.SubList(range(3))\n" @@ -1372,6 +1870,7 @@ msgid "" "2" msgstr "" +#: ../../extending/newtypes_tutorial.rst:840 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1424,7 +1923,8 @@ msgid "" " return -1;\n" " }\n" "\n" -" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < 0) {\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " return -1;\n" " }\n" "\n" @@ -1433,7 +1933,8 @@ msgid "" "\n" "static PyModuleDef_Slot sublist_module_slots[] = {\n" " {Py_mod_exec, sublist_module_exec},\n" -" {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" " {0, NULL}\n" "};\n" "\n" @@ -1452,9 +1953,14 @@ msgid "" "}\n" msgstr "" -msgid "As you can see, the source code closely resembles the :class:`!Custom` examples in previous sections. We will break down the main differences between them. ::" +#: ../../extending/newtypes_tutorial.rst:843 +msgid "" +"As you can see, the source code closely resembles the :class:`!Custom` " +"examples in previous sections. We will break down the main differences " +"between them. ::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:846 msgid "" "typedef struct {\n" " PyListObject list;\n" @@ -1462,12 +1968,21 @@ msgid "" "} SubListObject;" msgstr "" -msgid "The primary difference for derived type objects is that the base type's object structure must be the first value. The base type will already include the :c:func:`PyObject_HEAD` at the beginning of its structure." +#: ../../extending/newtypes_tutorial.rst:851 +msgid "" +"The primary difference for derived type objects is that the base type's " +"object structure must be the first value. The base type will already " +"include the :c:func:`PyObject_HEAD` at the beginning of its structure." msgstr "" -msgid "When a Python object is a :class:`!SubList` instance, its ``PyObject *`` pointer can be safely cast to both ``PyListObject *`` and ``SubListObject *``::" +#: ../../extending/newtypes_tutorial.rst:855 +msgid "" +"When a Python object is a :class:`!SubList` instance, its ``PyObject *`` " +"pointer can be safely cast to both ``PyListObject *`` and ``SubListObject " +"*``::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:858 msgid "" "static int\n" "SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -1480,15 +1995,32 @@ msgid "" "}" msgstr "" -msgid "We see above how to call through to the :meth:`~object.__init__` method of the base type." +#: ../../extending/newtypes_tutorial.rst:868 +msgid "" +"We see above how to call through to the :meth:`~object.__init__` method of " +"the base type." msgstr "" -msgid "This pattern is important when writing a type with custom :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. The :c:member:`~PyTypeObject.tp_new` handler should not actually create the memory for the object with its :c:member:`~PyTypeObject.tp_alloc`, but let the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." +#: ../../extending/newtypes_tutorial.rst:871 +msgid "" +"This pattern is important when writing a type with " +"custom :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_dealloc` members. " +"The :c:member:`~PyTypeObject.tp_new` handler should not actually create the " +"memory for the object with its :c:member:`~PyTypeObject.tp_alloc`, but let " +"the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." msgstr "" -msgid "The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject.tp_base` specifying the type's concrete base class. Due to cross-platform compiler issues, you can't fill that field directly with a reference to :c:type:`PyList_Type`; it should be done in the :c:data:`Py_mod_exec` function::" +#: ../../extending/newtypes_tutorial.rst:877 +msgid "" +"The :c:type:`PyTypeObject` struct supports " +"a :c:member:`~PyTypeObject.tp_base` specifying the type's concrete base " +"class. Due to cross-platform compiler issues, you can't fill that field " +"directly with a reference to :c:type:`PyList_Type`; it should be done in " +"the :c:data:`Py_mod_exec` function::" msgstr "" +#: ../../extending/newtypes_tutorial.rst:883 msgid "" "static int\n" "sublist_module_exec(PyObject *m)\n" @@ -1498,7 +2030,8 @@ msgid "" " return -1;\n" " }\n" "\n" -" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < 0) {\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " return -1;\n" " }\n" "\n" @@ -1506,23 +2039,50 @@ msgid "" "}" msgstr "" -msgid "Before calling :c:func:`PyType_Ready`, the type structure must have the :c:member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an existing type, it is not necessary to fill out the :c:member:`~PyTypeObject.tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocation function from the base type will be inherited." +#: ../../extending/newtypes_tutorial.rst:898 +msgid "" +"Before calling :c:func:`PyType_Ready`, the type structure must have " +"the :c:member:`~PyTypeObject.tp_base` slot filled in. When we are deriving " +"an existing type, it is not necessary to fill out " +"the :c:member:`~PyTypeObject.tp_alloc` slot with :c:func:`PyType_GenericNew` " +"-- the allocation function from the base type will be inherited." msgstr "" -msgid "After that, calling :c:func:`PyType_Ready` and adding the type object to the module is the same as with the basic :class:`!Custom` examples." +#: ../../extending/newtypes_tutorial.rst:904 +msgid "" +"After that, calling :c:func:`PyType_Ready` and adding the type object to the " +"module is the same as with the basic :class:`!Custom` examples." msgstr "" +#: ../../extending/newtypes_tutorial.rst:909 msgid "Footnotes" msgstr "" -msgid "This is true when we know that the object is a basic type, like a string or a float." +#: ../../extending/newtypes_tutorial.rst:910 +msgid "" +"This is true when we know that the object is a basic type, like a string or " +"a float." msgstr "" -msgid "We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in this example, because our type doesn't support garbage collection." +#: ../../extending/newtypes_tutorial.rst:913 +msgid "" +"We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in " +"this example, because our type doesn't support garbage collection." msgstr "" -msgid "We now know that the first and last members are strings, so perhaps we could be less careful about decrementing their reference counts, however, we accept instances of string subclasses. Even though deallocating normal strings won't call back into our objects, we can't guarantee that deallocating an instance of a string subclass won't call back into our objects." +#: ../../extending/newtypes_tutorial.rst:916 +msgid "" +"We now know that the first and last members are strings, so perhaps we could " +"be less careful about decrementing their reference counts, however, we " +"accept instances of string subclasses. Even though deallocating normal " +"strings won't call back into our objects, we can't guarantee that " +"deallocating an instance of a string subclass won't call back into our " +"objects." msgstr "" -msgid "Also, even with our attributes restricted to strings instances, the user could pass arbitrary :class:`str` subclasses and therefore still create reference cycles." +#: ../../extending/newtypes_tutorial.rst:922 +msgid "" +"Also, even with our attributes restricted to strings instances, the user " +"could pass arbitrary :class:`str` subclasses and therefore still create " +"reference cycles." msgstr "" diff --git a/extending/windows.po b/extending/windows.po index abbb6b94c..3c3bcb025 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,90 +21,218 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../extending/windows.rst:8 msgid "Building C and C++ Extensions on Windows" msgstr "" -msgid "This chapter briefly explains how to create a Windows extension module for Python using Microsoft Visual C++, and follows with more detailed background information on how it works. The explanatory material is useful for both the Windows programmer learning to build Python extensions and the Unix programmer interested in producing software which can be successfully built on both Unix and Windows." +#: ../../extending/windows.rst:10 +msgid "" +"This chapter briefly explains how to create a Windows extension module for " +"Python using Microsoft Visual C++, and follows with more detailed background " +"information on how it works. The explanatory material is useful for both " +"the Windows programmer learning to build Python extensions and the Unix " +"programmer interested in producing software which can be successfully built " +"on both Unix and Windows." msgstr "" -msgid "Module authors are encouraged to use the distutils approach for building extension modules, instead of the one described in this section. You will still need the C compiler that was used to build Python; typically Microsoft Visual C++." +#: ../../extending/windows.rst:17 +msgid "" +"Module authors are encouraged to use the distutils approach for building " +"extension modules, instead of the one described in this section. You will " +"still need the C compiler that was used to build Python; typically Microsoft " +"Visual C++." msgstr "" -msgid "This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown as ``XY``; in practice, ``'X'`` will be the major version number and ``'Y'`` will be the minor version number of the Python release you're working with. For example, if you are using Python 2.2.1, ``XY`` will actually be ``22``." +#: ../../extending/windows.rst:24 +msgid "" +"This chapter mentions a number of filenames that include an encoded Python " +"version number. These filenames are represented with the version number " +"shown as ``XY``; in practice, ``'X'`` will be the major version number and " +"``'Y'`` will be the minor version number of the Python release you're " +"working with. For example, if you are using Python 2.2.1, ``XY`` will " +"actually be ``22``." msgstr "" +#: ../../extending/windows.rst:34 msgid "A Cookbook Approach" msgstr "" -msgid "There are two approaches to building extension modules on Windows, just as there are on Unix: use the ``setuptools`` package to control the build process, or do things manually. The setuptools approach works well for most extensions; documentation on using ``setuptools`` to build and package extension modules is available in :ref:`setuptools-index`. If you find you really need to do things manually, it may be instructive to study the project file for the :source:`winsound ` standard library module." +#: ../../extending/windows.rst:36 +msgid "" +"There are two approaches to building extension modules on Windows, just as " +"there are on Unix: use the ``setuptools`` package to control the build " +"process, or do things manually. The setuptools approach works well for most " +"extensions; documentation on using ``setuptools`` to build and package " +"extension modules is available in :ref:`setuptools-index`. If you find you " +"really need to do things manually, it may be instructive to study the " +"project file for the :source:`winsound ` standard " +"library module." msgstr "" +#: ../../extending/windows.rst:48 msgid "Differences Between Unix and Windows" msgstr "" -msgid "Unix and Windows use completely different paradigms for run-time loading of code. Before you try to build a module that can be dynamically loaded, be aware of how your system works." -msgstr "" - -msgid "In Unix, a shared object (:file:`.so`) file contains code to be used by the program, and also the names of functions and data that it expects to find in the program. When the file is joined to the program, all references to those functions and data in the file's code are changed to point to the actual locations in the program where the functions and data are placed in memory. This is basically a link operation." +#: ../../extending/windows.rst:53 +msgid "" +"Unix and Windows use completely different paradigms for run-time loading of " +"code. Before you try to build a module that can be dynamically loaded, be " +"aware of how your system works." msgstr "" -msgid "In Windows, a dynamic-link library (:file:`.dll`) file has no dangling references. Instead, an access to functions or data goes through a lookup table. So the DLL code does not have to be fixed up at runtime to refer to the program's memory; instead, the code already uses the DLL's lookup table, and the lookup table is modified at runtime to point to the functions and data." +#: ../../extending/windows.rst:57 +msgid "" +"In Unix, a shared object (:file:`.so`) file contains code to be used by the " +"program, and also the names of functions and data that it expects to find in " +"the program. When the file is joined to the program, all references to " +"those functions and data in the file's code are changed to point to the " +"actual locations in the program where the functions and data are placed in " +"memory. This is basically a link operation." msgstr "" -msgid "In Unix, there is only one type of library file (:file:`.a`) which contains code from several object files (:file:`.o`). During the link step to create a shared object file (:file:`.so`), the linker may find that it doesn't know where an identifier is defined. The linker will look for it in the object files in the libraries; if it finds it, it will include all the code from that object file." +#: ../../extending/windows.rst:64 +msgid "" +"In Windows, a dynamic-link library (:file:`.dll`) file has no dangling " +"references. Instead, an access to functions or data goes through a lookup " +"table. So the DLL code does not have to be fixed up at runtime to refer to " +"the program's memory; instead, the code already uses the DLL's lookup table, " +"and the lookup table is modified at runtime to point to the functions and " +"data." msgstr "" -msgid "In Windows, there are two types of library, a static library and an import library (both called :file:`.lib`). A static library is like a Unix :file:`.a` file; it contains code to be included as necessary. An import library is basically used only to reassure the linker that a certain identifier is legal, and will be present in the program when the DLL is loaded. So the linker uses the information from the import library to build the lookup table for using identifiers that are not included in the DLL. When an application or a DLL is linked, an import library may be generated, which will need to be used for all future DLLs that depend on the symbols in the application or DLL." +#: ../../extending/windows.rst:70 +msgid "" +"In Unix, there is only one type of library file (:file:`.a`) which contains " +"code from several object files (:file:`.o`). During the link step to create " +"a shared object file (:file:`.so`), the linker may find that it doesn't know " +"where an identifier is defined. The linker will look for it in the object " +"files in the libraries; if it finds it, it will include all the code from " +"that object file." msgstr "" -msgid "Suppose you are building two dynamic-load modules, B and C, which should share another block of code A. On Unix, you would *not* pass :file:`A.a` to the linker for :file:`B.so` and :file:`C.so`; that would cause it to be included twice, so that B and C would each have their own copy. In Windows, building :file:`A.dll` will also build :file:`A.lib`. You *do* pass :file:`A.lib` to the linker for B and C. :file:`A.lib` does not contain code; it just contains information which will be used at runtime to access A's code." +#: ../../extending/windows.rst:76 +msgid "" +"In Windows, there are two types of library, a static library and an import " +"library (both called :file:`.lib`). A static library is like a " +"Unix :file:`.a` file; it contains code to be included as necessary. An " +"import library is basically used only to reassure the linker that a certain " +"identifier is legal, and will be present in the program when the DLL is " +"loaded. So the linker uses the information from the import library to build " +"the lookup table for using identifiers that are not included in the DLL. " +"When an application or a DLL is linked, an import library may be generated, " +"which will need to be used for all future DLLs that depend on the symbols in " +"the application or DLL." +msgstr "" + +#: ../../extending/windows.rst:86 +msgid "" +"Suppose you are building two dynamic-load modules, B and C, which should " +"share another block of code A. On Unix, you would *not* pass :file:`A.a` to " +"the linker for :file:`B.so` and :file:`C.so`; that would cause it to be " +"included twice, so that B and C would each have their own copy. In Windows, " +"building :file:`A.dll` will also build :file:`A.lib`. You *do* " +"pass :file:`A.lib` to the linker for B and C. :file:`A.lib` does not " +"contain code; it just contains information which will be used at runtime to " +"access A's code." msgstr "" -msgid "In Windows, using an import library is sort of like using ``import spam``; it gives you access to spam's names, but does not create a separate copy. On Unix, linking with a library is more like ``from spam import *``; it does create a separate copy." +#: ../../extending/windows.rst:94 +msgid "" +"In Windows, using an import library is sort of like using ``import spam``; " +"it gives you access to spam's names, but does not create a separate copy. " +"On Unix, linking with a library is more like ``from spam import *``; it does " +"create a separate copy." msgstr "" -msgid "Turn off the implicit, ``#pragma``-based linkage with the Python library, performed inside CPython header files." +#: ../../extending/windows.rst:101 +msgid "" +"Turn off the implicit, ``#pragma``-based linkage with the Python library, " +"performed inside CPython header files." msgstr "" +#: ../../extending/windows.rst:110 msgid "Using DLLs in Practice" msgstr "" -msgid "Windows Python is built in Microsoft Visual C++; using other compilers may or may not work. The rest of this section is MSVC++ specific." +#: ../../extending/windows.rst:115 +msgid "" +"Windows Python is built in Microsoft Visual C++; using other compilers may " +"or may not work. The rest of this section is MSVC++ specific." msgstr "" -msgid "When creating DLLs in Windows, you can use the CPython library in two ways:" +#: ../../extending/windows.rst:118 +msgid "" +"When creating DLLs in Windows, you can use the CPython library in two ways:" msgstr "" -msgid "By default, inclusion of :file:`PC/pyconfig.h` directly or via :file:`Python.h` triggers an implicit, configure-aware link with the library. The header file chooses :file:`pythonXY_d.lib` for Debug, :file:`pythonXY.lib` for Release, and :file:`pythonX.lib` for Release with the :ref:`Limited API ` enabled." +#: ../../extending/windows.rst:120 +msgid "" +"By default, inclusion of :file:`PC/pyconfig.h` directly or " +"via :file:`Python.h` triggers an implicit, configure-aware link with the " +"library. The header file chooses :file:`pythonXY_d.lib` for " +"Debug, :file:`pythonXY.lib` for Release, and :file:`pythonX.lib` for Release " +"with the :ref:`Limited API ` enabled." msgstr "" -msgid "To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands::" +#: ../../extending/windows.rst:126 ../../extending/windows.rst:144 +msgid "" +"To build two DLLs, spam and ni (which uses C functions found in spam), you " +"could use these commands::" msgstr "" +#: ../../extending/windows.rst:129 msgid "" "cl /LD /I/python/include spam.c\n" "cl /LD /I/python/include ni.c spam.lib" msgstr "" -msgid "The first command created three files: :file:`spam.obj`, :file:`spam.dll` and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find the Python code thanks to the implicitly linked :file:`pythonXY.lib`." +#: ../../extending/windows.rst:132 +msgid "" +"The first command created three files: :file:`spam.obj`, :file:`spam.dll` " +"and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " +"functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " +"the Python code thanks to the implicitly linked :file:`pythonXY.lib`." msgstr "" -msgid "The second command created :file:`ni.dll` (and :file:`.obj` and :file:`.lib`), which knows how to find the necessary functions from spam, and also from the Python executable." +#: ../../extending/windows.rst:137 ../../extending/windows.rst:155 +msgid "" +"The second command created :file:`ni.dll` (and :file:`.obj` " +"and :file:`.lib`), which knows how to find the necessary functions from " +"spam, and also from the Python executable." msgstr "" -msgid "Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before including :file:`Python.h`. You must pass :file:`pythonXY.lib` to the linker." +#: ../../extending/windows.rst:141 +msgid "" +"Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before " +"including :file:`Python.h`. You must pass :file:`pythonXY.lib` to the linker." msgstr "" +#: ../../extending/windows.rst:147 msgid "" "cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" "cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" msgstr "" -msgid "The first command created three files: :file:`spam.obj`, :file:`spam.dll` and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find the Python code thanks to :file:`pythonXY.lib`." +#: ../../extending/windows.rst:150 +msgid "" +"The first command created three files: :file:`spam.obj`, :file:`spam.dll` " +"and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " +"functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " +"the Python code thanks to :file:`pythonXY.lib`." msgstr "" -msgid "Not every identifier is exported to the lookup table. If you want any other modules (including Python) to be able to see your identifiers, you have to say ``_declspec(dllexport)``, as in ``void _declspec(dllexport) initspam(void)`` or ``PyObject _declspec(dllexport) *NiGetSpamData(void)``." +#: ../../extending/windows.rst:159 +msgid "" +"Not every identifier is exported to the lookup table. If you want any other " +"modules (including Python) to be able to see your identifiers, you have to " +"say ``_declspec(dllexport)``, as in ``void _declspec(dllexport) " +"initspam(void)`` or ``PyObject _declspec(dllexport) *NiGetSpamData(void)``." msgstr "" -msgid "Developer Studio will throw in a lot of import libraries that you do not really need, adding about 100K to your executable. To get rid of them, use the Project Settings dialog, Link tab, to specify *ignore default libraries*. Add the correct :file:`msvcrt{xx}.lib` to the list of libraries." +#: ../../extending/windows.rst:164 +msgid "" +"Developer Studio will throw in a lot of import libraries that you do not " +"really need, adding about 100K to your executable. To get rid of them, use " +"the Project Settings dialog, Link tab, to specify *ignore default " +"libraries*. Add the correct :file:`msvcrt{xx}.lib` to the list of libraries." msgstr "" diff --git a/faq/design.po b/faq/design.po index 2aeadd428..965a368e7 100644 --- a/faq/design.po +++ b/faq/design.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,21 +24,33 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/design.rst:3 msgid "Design and History FAQ" msgstr "" +#: ../../faq/design.rst:6 msgid "Contents" msgstr "" +#: ../../faq/design.rst:11 msgid "Why does Python use indentation for grouping of statements?" msgstr "" -msgid "Guido van Rossum believes that using indentation for grouping is extremely elegant and contributes a lot to the clarity of the average Python program. Most people learn to love this feature after a while." +#: ../../faq/design.rst:13 +msgid "" +"Guido van Rossum believes that using indentation for grouping is extremely " +"elegant and contributes a lot to the clarity of the average Python program. " +"Most people learn to love this feature after a while." msgstr "" -msgid "Since there are no begin/end brackets there cannot be a disagreement between grouping perceived by the parser and the human reader. Occasionally C programmers will encounter a fragment of code like this::" +#: ../../faq/design.rst:17 +msgid "" +"Since there are no begin/end brackets there cannot be a disagreement between " +"grouping perceived by the parser and the human reader. Occasionally C " +"programmers will encounter a fragment of code like this::" msgstr "" +#: ../../faq/design.rst:21 msgid "" "if (x <= y)\n" " x++;\n" @@ -46,160 +58,329 @@ msgid "" "z++;" msgstr "" -msgid "Only the ``x++`` statement is executed if the condition is true, but the indentation leads many to believe otherwise. Even experienced C programmers will sometimes stare at it a long time wondering as to why ``y`` is being decremented even for ``x > y``." +#: ../../faq/design.rst:26 +msgid "" +"Only the ``x++`` statement is executed if the condition is true, but the " +"indentation leads many to believe otherwise. Even experienced C programmers " +"will sometimes stare at it a long time wondering as to why ``y`` is being " +"decremented even for ``x > y``." msgstr "" -msgid "Because there are no begin/end brackets, Python is much less prone to coding-style conflicts. In C there are many different ways to place the braces. After becoming used to reading and writing code using a particular style, it is normal to feel somewhat uneasy when reading (or being required to write) in a different one." +#: ../../faq/design.rst:31 +msgid "" +"Because there are no begin/end brackets, Python is much less prone to coding-" +"style conflicts. In C there are many different ways to place the braces. " +"After becoming used to reading and writing code using a particular style, it " +"is normal to feel somewhat uneasy when reading (or being required to write) " +"in a different one." msgstr "" -msgid "Many coding styles place begin/end brackets on a line by themselves. This makes programs considerably longer and wastes valuable screen space, making it harder to get a good overview of a program. Ideally, a function should fit on one screen (say, 20--30 lines). 20 lines of Python can do a lot more work than 20 lines of C. This is not solely due to the lack of begin/end brackets -- the lack of declarations and the high-level data types are also responsible -- but the indentation-based syntax certainly helps." +#: ../../faq/design.rst:38 +msgid "" +"Many coding styles place begin/end brackets on a line by themselves. This " +"makes programs considerably longer and wastes valuable screen space, making " +"it harder to get a good overview of a program. Ideally, a function should " +"fit on one screen (say, 20--30 lines). 20 lines of Python can do a lot more " +"work than 20 lines of C. This is not solely due to the lack of begin/end " +"brackets -- the lack of declarations and the high-level data types are also " +"responsible -- but the indentation-based syntax certainly helps." msgstr "" +#: ../../faq/design.rst:48 msgid "Why am I getting strange results with simple arithmetic operations?" msgstr "" +#: ../../faq/design.rst:50 msgid "See the next question." msgstr "" +#: ../../faq/design.rst:54 msgid "Why are floating-point calculations so inaccurate?" msgstr "" +#: ../../faq/design.rst:56 msgid "Users are often surprised by results like this::" msgstr "" +#: ../../faq/design.rst:58 msgid "" ">>> 1.2 - 1.0\n" "0.19999999999999996" msgstr "" -msgid "and think it is a bug in Python. It's not. This has little to do with Python, and much more to do with how the underlying platform handles floating-point numbers." +#: ../../faq/design.rst:61 +msgid "" +"and think it is a bug in Python. It's not. This has little to do with " +"Python, and much more to do with how the underlying platform handles " +"floating-point numbers." msgstr "" -msgid "The :class:`float` type in CPython uses a C ``double`` for storage. A :class:`float` object's value is stored in binary floating-point with a fixed precision (typically 53 bits) and Python uses C operations, which in turn rely on the hardware implementation in the processor, to perform floating-point operations. This means that as far as floating-point operations are concerned, Python behaves like many popular languages including C and Java." +#: ../../faq/design.rst:65 +msgid "" +"The :class:`float` type in CPython uses a C ``double`` for storage. " +"A :class:`float` object's value is stored in binary floating-point with a " +"fixed precision (typically 53 bits) and Python uses C operations, which in " +"turn rely on the hardware implementation in the processor, to perform " +"floating-point operations. This means that as far as floating-point " +"operations are concerned, Python behaves like many popular languages " +"including C and Java." msgstr "" -msgid "Many numbers that can be written easily in decimal notation cannot be expressed exactly in binary floating point. For example, after::" +#: ../../faq/design.rst:72 +msgid "" +"Many numbers that can be written easily in decimal notation cannot be " +"expressed exactly in binary floating point. For example, after::" msgstr "" +#: ../../faq/design.rst:75 msgid ">>> x = 1.2" msgstr "" -msgid "the value stored for ``x`` is a (very good) approximation to the decimal value ``1.2``, but is not exactly equal to it. On a typical machine, the actual stored value is::" +#: ../../faq/design.rst:77 +msgid "" +"the value stored for ``x`` is a (very good) approximation to the decimal " +"value ``1.2``, but is not exactly equal to it. On a typical machine, the " +"actual stored value is::" msgstr "" +#: ../../faq/design.rst:81 msgid "1.0011001100110011001100110011001100110011001100110011 (binary)" msgstr "" +#: ../../faq/design.rst:83 msgid "which is exactly::" msgstr "" +#: ../../faq/design.rst:85 msgid "1.1999999999999999555910790149937383830547332763671875 (decimal)" msgstr "" -msgid "The typical precision of 53 bits provides Python floats with 15--16 decimal digits of accuracy." +#: ../../faq/design.rst:87 +msgid "" +"The typical precision of 53 bits provides Python floats with 15--16 decimal " +"digits of accuracy." msgstr "" -msgid "For a fuller explanation, please see the :ref:`floating-point arithmetic ` chapter in the Python tutorial." +#: ../../faq/design.rst:90 +msgid "" +"For a fuller explanation, please see the :ref:`floating-point arithmetic " +"` chapter in the Python tutorial." msgstr "" +#: ../../faq/design.rst:95 msgid "Why are Python strings immutable?" msgstr "" +#: ../../faq/design.rst:97 msgid "There are several advantages." msgstr "" -msgid "One is performance: knowing that a string is immutable means we can allocate space for it at creation time, and the storage requirements are fixed and unchanging. This is also one of the reasons for the distinction between tuples and lists." +#: ../../faq/design.rst:99 +msgid "" +"One is performance: knowing that a string is immutable means we can allocate " +"space for it at creation time, and the storage requirements are fixed and " +"unchanging. This is also one of the reasons for the distinction between " +"tuples and lists." msgstr "" -msgid "Another advantage is that strings in Python are considered as \"elemental\" as numbers. No amount of activity will change the value 8 to anything else, and in Python, no amount of activity will change the string \"eight\" to anything else." +#: ../../faq/design.rst:104 +msgid "" +"Another advantage is that strings in Python are considered as \"elemental\" " +"as numbers. No amount of activity will change the value 8 to anything else, " +"and in Python, no amount of activity will change the string \"eight\" to " +"anything else." msgstr "" +#: ../../faq/design.rst:112 msgid "Why must 'self' be used explicitly in method definitions and calls?" msgstr "" -msgid "The idea was borrowed from Modula-3. It turns out to be very useful, for a variety of reasons." -msgstr "" - -msgid "First, it's more obvious that you are using a method or instance attribute instead of a local variable. Reading ``self.x`` or ``self.meth()`` makes it absolutely clear that an instance variable or method is used even if you don't know the class definition by heart. In C++, you can sort of tell by the lack of a local variable declaration (assuming globals are rare or easily recognizable) -- but in Python, there are no local variable declarations, so you'd have to look up the class definition to be sure. Some C++ and Java coding standards call for instance attributes to have an ``m_`` prefix, so this explicitness is still useful in those languages, too." -msgstr "" - -msgid "Second, it means that no special syntax is necessary if you want to explicitly reference or call the method from a particular class. In C++, if you want to use a method from a base class which is overridden in a derived class, you have to use the ``::`` operator -- in Python you can write ``baseclass.methodname(self, )``. This is particularly useful for :meth:`~object.__init__` methods, and in general in cases where a derived class method wants to extend the base class method of the same name and thus has to call the base class method somehow." +#: ../../faq/design.rst:114 +msgid "" +"The idea was borrowed from Modula-3. It turns out to be very useful, for a " +"variety of reasons." msgstr "" -msgid "Finally, for instance variables it solves a syntactic problem with assignment: since local variables in Python are (by definition!) those variables to which a value is assigned in a function body (and that aren't explicitly declared global), there has to be some way to tell the interpreter that an assignment was meant to assign to an instance variable instead of to a local variable, and it should preferably be syntactic (for efficiency reasons). C++ does this through declarations, but Python doesn't have declarations and it would be a pity having to introduce them just for this purpose. Using the explicit ``self.var`` solves this nicely. Similarly, for using instance variables, having to write ``self.var`` means that references to unqualified names inside a method don't have to search the instance's directories. To put it another way, local variables and instance variables live in two different namespaces, and you need to tell Python which namespace to use." +#: ../../faq/design.rst:117 +msgid "" +"First, it's more obvious that you are using a method or instance attribute " +"instead of a local variable. Reading ``self.x`` or ``self.meth()`` makes it " +"absolutely clear that an instance variable or method is used even if you " +"don't know the class definition by heart. In C++, you can sort of tell by " +"the lack of a local variable declaration (assuming globals are rare or " +"easily recognizable) -- but in Python, there are no local variable " +"declarations, so you'd have to look up the class definition to be sure. " +"Some C++ and Java coding standards call for instance attributes to have an " +"``m_`` prefix, so this explicitness is still useful in those languages, too." +msgstr "" + +#: ../../faq/design.rst:127 +msgid "" +"Second, it means that no special syntax is necessary if you want to " +"explicitly reference or call the method from a particular class. In C++, if " +"you want to use a method from a base class which is overridden in a derived " +"class, you have to use the ``::`` operator -- in Python you can write " +"``baseclass.methodname(self, )``. This is particularly " +"useful for :meth:`~object.__init__` methods, and in general in cases where a " +"derived class method wants to extend the base class method of the same name " +"and thus has to call the base class method somehow." msgstr "" +#: ../../faq/design.rst:136 +msgid "" +"Finally, for instance variables it solves a syntactic problem with " +"assignment: since local variables in Python are (by definition!) those " +"variables to which a value is assigned in a function body (and that aren't " +"explicitly declared global), there has to be some way to tell the " +"interpreter that an assignment was meant to assign to an instance variable " +"instead of to a local variable, and it should preferably be syntactic (for " +"efficiency reasons). C++ does this through declarations, but Python doesn't " +"have declarations and it would be a pity having to introduce them just for " +"this purpose. Using the explicit ``self.var`` solves this nicely. " +"Similarly, for using instance variables, having to write ``self.var`` means " +"that references to unqualified names inside a method don't have to search " +"the instance's directories. To put it another way, local variables and " +"instance variables live in two different namespaces, and you need to tell " +"Python which namespace to use." +msgstr "" + +#: ../../faq/design.rst:154 msgid "Why can't I use an assignment in an expression?" msgstr "" +#: ../../faq/design.rst:156 msgid "Starting in Python 3.8, you can!" msgstr "" -msgid "Assignment expressions using the walrus operator ``:=`` assign a variable in an expression::" +#: ../../faq/design.rst:158 +msgid "" +"Assignment expressions using the walrus operator ``:=`` assign a variable in " +"an expression::" msgstr "" +#: ../../faq/design.rst:161 msgid "" "while chunk := fp.read(200):\n" " print(chunk)" msgstr "" +#: ../../faq/design.rst:164 msgid "See :pep:`572` for more information." msgstr "" -msgid "Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?" +#: ../../faq/design.rst:169 +msgid "" +"Why does Python use methods for some functionality (e.g. list.index()) but " +"functions for other (e.g. len(list))?" msgstr "" +#: ../../faq/design.rst:171 msgid "As Guido said:" msgstr "" -msgid "(a) For some operations, prefix notation just reads better than postfix -- prefix (and infix!) operations have a long tradition in mathematics which likes notations where the visuals help the mathematician thinking about a problem. Compare the easy with which we rewrite a formula like x*(a+b) into x*a + x*b to the clumsiness of doing the same thing using a raw OO notation." +#: ../../faq/design.rst:173 +msgid "" +"(a) For some operations, prefix notation just reads better than postfix -- " +"prefix (and infix!) operations have a long tradition in mathematics which " +"likes notations where the visuals help the mathematician thinking about a " +"problem. Compare the easy with which we rewrite a formula like x*(a+b) into " +"x*a + x*b to the clumsiness of doing the same thing using a raw OO notation." msgstr "" -msgid "(b) When I read code that says len(x) I *know* that it is asking for the length of something. This tells me two things: the result is an integer, and the argument is some kind of container. To the contrary, when I read x.len(), I have to already know that x is some kind of container implementing an interface or inheriting from a class that has a standard len(). Witness the confusion we occasionally have when a class that is not implementing a mapping has a get() or keys() method, or something that isn't a file has a write() method." +#: ../../faq/design.rst:180 +msgid "" +"(b) When I read code that says len(x) I *know* that it is asking for the " +"length of something. This tells me two things: the result is an integer, and " +"the argument is some kind of container. To the contrary, when I read " +"x.len(), I have to already know that x is some kind of container " +"implementing an interface or inheriting from a class that has a standard " +"len(). Witness the confusion we occasionally have when a class that is not " +"implementing a mapping has a get() or keys() method, or something that isn't " +"a file has a write() method." msgstr "" +#: ../../faq/design.rst:189 msgid "https://mail.python.org/pipermail/python-3000/2006-November/004643.html" msgstr "" +#: ../../faq/design.rst:193 msgid "Why is join() a string method instead of a list or tuple method?" msgstr "" -msgid "Strings became much more like other standard types starting in Python 1.6, when methods were added which give the same functionality that has always been available using the functions of the string module. Most of these new methods have been widely accepted, but the one which appears to make some programmers feel uncomfortable is::" +#: ../../faq/design.rst:195 +msgid "" +"Strings became much more like other standard types starting in Python 1.6, " +"when methods were added which give the same functionality that has always " +"been available using the functions of the string module. Most of these new " +"methods have been widely accepted, but the one which appears to make some " +"programmers feel uncomfortable is::" msgstr "" +#: ../../faq/design.rst:201 msgid "\", \".join(['1', '2', '4', '8', '16'])" msgstr "" +#: ../../faq/design.rst:203 msgid "which gives the result::" msgstr "" +#: ../../faq/design.rst:205 msgid "\"1, 2, 4, 8, 16\"" msgstr "" +#: ../../faq/design.rst:207 msgid "There are two common arguments against this usage." msgstr "" -msgid "The first runs along the lines of: \"It looks really ugly using a method of a string literal (string constant)\", to which the answer is that it might, but a string literal is just a fixed value. If the methods are to be allowed on names bound to strings there is no logical reason to make them unavailable on literals." +#: ../../faq/design.rst:209 +msgid "" +"The first runs along the lines of: \"It looks really ugly using a method of " +"a string literal (string constant)\", to which the answer is that it might, " +"but a string literal is just a fixed value. If the methods are to be allowed " +"on names bound to strings there is no logical reason to make them " +"unavailable on literals." msgstr "" -msgid "The second objection is typically cast as: \"I am really telling a sequence to join its members together with a string constant\". Sadly, you aren't. For some reason there seems to be much less difficulty with having :meth:`~str.split` as a string method, since in that case it is easy to see that ::" +#: ../../faq/design.rst:215 +msgid "" +"The second objection is typically cast as: \"I am really telling a sequence " +"to join its members together with a string constant\". Sadly, you aren't. " +"For some reason there seems to be much less difficulty with " +"having :meth:`~str.split` as a string method, since in that case it is easy " +"to see that ::" msgstr "" +#: ../../faq/design.rst:220 msgid "\"1, 2, 4, 8, 16\".split(\", \")" msgstr "" -msgid "is an instruction to a string literal to return the substrings delimited by the given separator (or, by default, arbitrary runs of white space)." +#: ../../faq/design.rst:222 +msgid "" +"is an instruction to a string literal to return the substrings delimited by " +"the given separator (or, by default, arbitrary runs of white space)." msgstr "" -msgid ":meth:`~str.join` is a string method because in using it you are telling the separator string to iterate over a sequence of strings and insert itself between adjacent elements. This method can be used with any argument which obeys the rules for sequence objects, including any new classes you might define yourself. Similar methods exist for bytes and bytearray objects." +#: ../../faq/design.rst:225 +msgid "" +":meth:`~str.join` is a string method because in using it you are telling the " +"separator string to iterate over a sequence of strings and insert itself " +"between adjacent elements. This method can be used with any argument which " +"obeys the rules for sequence objects, including any new classes you might " +"define yourself. Similar methods exist for bytes and bytearray objects." msgstr "" +#: ../../faq/design.rst:233 msgid "How fast are exceptions?" msgstr "" -msgid "A :keyword:`try`/:keyword:`except` block is extremely efficient if no exceptions are raised. Actually catching an exception is expensive. In versions of Python prior to 2.0 it was common to use this idiom::" +#: ../../faq/design.rst:235 +msgid "" +"A :keyword:`try`/:keyword:`except` block is extremely efficient if no " +"exceptions are raised. Actually catching an exception is expensive. In " +"versions of Python prior to 2.0 it was common to use this idiom::" msgstr "" +#: ../../faq/design.rst:240 msgid "" "try:\n" " value = mydict[key]\n" @@ -208,9 +389,13 @@ msgid "" " value = mydict[key]" msgstr "" -msgid "This only made sense when you expected the dict to have the key almost all the time. If that wasn't the case, you coded it like this::" +#: ../../faq/design.rst:246 +msgid "" +"This only made sense when you expected the dict to have the key almost all " +"the time. If that wasn't the case, you coded it like this::" msgstr "" +#: ../../faq/design.rst:249 msgid "" "if key in mydict:\n" " value = mydict[key]\n" @@ -218,18 +403,36 @@ msgid "" " value = mydict[key] = getvalue(key)" msgstr "" -msgid "For this specific case, you could also use ``value = dict.setdefault(key, getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it is evaluated in all cases." +#: ../../faq/design.rst:254 +msgid "" +"For this specific case, you could also use ``value = dict.setdefault(key, " +"getvalue(key))``, but only if the ``getvalue()`` call is cheap enough " +"because it is evaluated in all cases." msgstr "" +#: ../../faq/design.rst:260 msgid "Why isn't there a switch or case statement in Python?" msgstr "" -msgid "In general, structured switch statements execute one block of code when an expression has a particular value or set of values. Since Python 3.10 one can easily match literal values, or constants within a namespace, with a ``match ... case`` statement. An older alternative is a sequence of ``if... elif... elif... else``." +#: ../../faq/design.rst:262 +msgid "" +"In general, structured switch statements execute one block of code when an " +"expression has a particular value or set of values. Since Python 3.10 one " +"can easily match literal values, or constants within a namespace, with a " +"``match ... case`` statement. See :ref:`the specification ` " +"and :ref:`the tutorial ` for more information " +"about :keyword:`match` statements. An older alternative is a sequence of " +"``if... elif... elif... else``." msgstr "" -msgid "For cases where you need to choose from a very large number of possibilities, you can create a dictionary mapping case values to functions to call. For example::" +#: ../../faq/design.rst:270 +msgid "" +"For cases where you need to choose from a very large number of " +"possibilities, you can create a dictionary mapping case values to functions " +"to call. For example::" msgstr "" +#: ../../faq/design.rst:274 msgid "" "functions = {'a': function_1,\n" " 'b': function_2,\n" @@ -239,9 +442,13 @@ msgid "" "func()" msgstr "" -msgid "For calling methods on objects, you can simplify yet further by using the :func:`getattr` built-in to retrieve methods with a particular name::" +#: ../../faq/design.rst:281 +msgid "" +"For calling methods on objects, you can simplify yet further by using " +"the :func:`getattr` built-in to retrieve methods with a particular name::" msgstr "" +#: ../../faq/design.rst:284 msgid "" "class MyVisitor:\n" " def visit_a(self):\n" @@ -253,152 +460,348 @@ msgid "" " method()" msgstr "" -msgid "It's suggested that you use a prefix for the method names, such as ``visit_`` in this example. Without such a prefix, if values are coming from an untrusted source, an attacker would be able to call any method on your object." +#: ../../faq/design.rst:293 +msgid "" +"It's suggested that you use a prefix for the method names, such as " +"``visit_`` in this example. Without such a prefix, if values are coming " +"from an untrusted source, an attacker would be able to call any method on " +"your object." msgstr "" -msgid "Imitating switch with fallthrough, as with C's switch-case-default, is possible, much harder, and less needed." +#: ../../faq/design.rst:297 +msgid "" +"Imitating switch with fallthrough, as with C's switch-case-default, is " +"possible, much harder, and less needed." msgstr "" -msgid "Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?" +#: ../../faq/design.rst:302 +msgid "" +"Can't you emulate threads in the interpreter instead of relying on an OS-" +"specific thread implementation?" msgstr "" -msgid "Answer 1: Unfortunately, the interpreter pushes at least one C stack frame for each Python stack frame. Also, extensions can call back into Python at almost random moments. Therefore, a complete threads implementation requires thread support for C." +#: ../../faq/design.rst:304 +msgid "" +"Answer 1: Unfortunately, the interpreter pushes at least one C stack frame " +"for each Python stack frame. Also, extensions can call back into Python at " +"almost random moments. Therefore, a complete threads implementation " +"requires thread support for C." msgstr "" -msgid "Answer 2: Fortunately, there is `Stackless Python `_, which has a completely redesigned interpreter loop that avoids the C stack." +#: ../../faq/design.rst:309 +msgid "" +"Answer 2: Fortunately, there is `Stackless Python `_, which has a completely redesigned " +"interpreter loop that avoids the C stack." msgstr "" +#: ../../faq/design.rst:314 msgid "Why can't lambda expressions contain statements?" msgstr "" -msgid "Python lambda expressions cannot contain statements because Python's syntactic framework can't handle statements nested inside expressions. However, in Python, this is not a serious problem. Unlike lambda forms in other languages, where they add functionality, Python lambdas are only a shorthand notation if you're too lazy to define a function." +#: ../../faq/design.rst:316 +msgid "" +"Python lambda expressions cannot contain statements because Python's " +"syntactic framework can't handle statements nested inside expressions. " +"However, in Python, this is not a serious problem. Unlike lambda forms in " +"other languages, where they add functionality, Python lambdas are only a " +"shorthand notation if you're too lazy to define a function." msgstr "" -msgid "Functions are already first class objects in Python, and can be declared in a local scope. Therefore the only advantage of using a lambda instead of a locally defined function is that you don't need to invent a name for the function -- but that's just a local variable to which the function object (which is exactly the same type of object that a lambda expression yields) is assigned!" +#: ../../faq/design.rst:322 +msgid "" +"Functions are already first class objects in Python, and can be declared in " +"a local scope. Therefore the only advantage of using a lambda instead of a " +"locally defined function is that you don't need to invent a name for the " +"function -- but that's just a local variable to which the function object " +"(which is exactly the same type of object that a lambda expression yields) " +"is assigned!" msgstr "" +#: ../../faq/design.rst:330 msgid "Can Python be compiled to machine code, C or some other language?" msgstr "" -msgid "`Cython `_ compiles a modified version of Python with optional annotations into C extensions. `Nuitka `_ is an up-and-coming compiler of Python into C++ code, aiming to support the full Python language." +#: ../../faq/design.rst:332 +msgid "" +"`Cython `_ compiles a modified version of Python with " +"optional annotations into C extensions. `Nuitka `_ is " +"an up-and-coming compiler of Python into C++ code, aiming to support the " +"full Python language." msgstr "" +#: ../../faq/design.rst:339 msgid "How does Python manage memory?" msgstr "" -msgid "The details of Python memory management depend on the implementation. The standard implementation of Python, :term:`CPython`, uses reference counting to detect inaccessible objects, and another mechanism to collect reference cycles, periodically executing a cycle detection algorithm which looks for inaccessible cycles and deletes the objects involved. The :mod:`gc` module provides functions to perform a garbage collection, obtain debugging statistics, and tune the collector's parameters." +#: ../../faq/design.rst:341 +msgid "" +"The details of Python memory management depend on the implementation. The " +"standard implementation of Python, :term:`CPython`, uses reference counting " +"to detect inaccessible objects, and another mechanism to collect reference " +"cycles, periodically executing a cycle detection algorithm which looks for " +"inaccessible cycles and deletes the objects involved. The :mod:`gc` module " +"provides functions to perform a garbage collection, obtain debugging " +"statistics, and tune the collector's parameters." msgstr "" -msgid "Other implementations (such as `Jython `_ or `PyPy `_), however, can rely on a different mechanism such as a full-blown garbage collector. This difference can cause some subtle porting problems if your Python code depends on the behavior of the reference counting implementation." +#: ../../faq/design.rst:349 +msgid "" +"Other implementations (such as `Jython `_ or `PyPy " +"`_), however, can rely on a different mechanism such as a " +"full-blown garbage collector. This difference can cause some subtle porting " +"problems if your Python code depends on the behavior of the reference " +"counting implementation." msgstr "" -msgid "In some Python implementations, the following code (which is fine in CPython) will probably run out of file descriptors::" +#: ../../faq/design.rst:355 +msgid "" +"In some Python implementations, the following code (which is fine in " +"CPython) will probably run out of file descriptors::" msgstr "" +#: ../../faq/design.rst:358 msgid "" "for file in very_long_list_of_files:\n" " f = open(file)\n" " c = f.read(1)" msgstr "" -msgid "Indeed, using CPython's reference counting and destructor scheme, each new assignment to ``f`` closes the previous file. With a traditional GC, however, those file objects will only get collected (and closed) at varying and possibly long intervals." +#: ../../faq/design.rst:362 +msgid "" +"Indeed, using CPython's reference counting and destructor scheme, each new " +"assignment to ``f`` closes the previous file. With a traditional GC, " +"however, those file objects will only get collected (and closed) at varying " +"and possibly long intervals." msgstr "" -msgid "If you want to write code that will work with any Python implementation, you should explicitly close the file or use the :keyword:`with` statement; this will work regardless of memory management scheme::" +#: ../../faq/design.rst:367 +msgid "" +"If you want to write code that will work with any Python implementation, you " +"should explicitly close the file or use the :keyword:`with` statement; this " +"will work regardless of memory management scheme::" msgstr "" +#: ../../faq/design.rst:371 msgid "" "for file in very_long_list_of_files:\n" " with open(file) as f:\n" " c = f.read(1)" msgstr "" +#: ../../faq/design.rst:377 msgid "Why doesn't CPython use a more traditional garbage collection scheme?" msgstr "" -msgid "For one thing, this is not a C standard feature and hence it's not portable. (Yes, we know about the Boehm GC library. It has bits of assembler code for *most* common platforms, not for all of them, and although it is mostly transparent, it isn't completely transparent; patches are required to get Python to work with it.)" +#: ../../faq/design.rst:379 +msgid "" +"For one thing, this is not a C standard feature and hence it's not portable. " +"(Yes, we know about the Boehm GC library. It has bits of assembler code for " +"*most* common platforms, not for all of them, and although it is mostly " +"transparent, it isn't completely transparent; patches are required to get " +"Python to work with it.)" msgstr "" -msgid "Traditional GC also becomes a problem when Python is embedded into other applications. While in a standalone Python it's fine to replace the standard ``malloc()`` and ``free()`` with versions provided by the GC library, an application embedding Python may want to have its *own* substitute for ``malloc()`` and ``free()``, and may not want Python's. Right now, CPython works with anything that implements ``malloc()`` and ``free()`` properly." +#: ../../faq/design.rst:385 +msgid "" +"Traditional GC also becomes a problem when Python is embedded into other " +"applications. While in a standalone Python it's fine to replace the " +"standard ``malloc()`` and ``free()`` with versions provided by the GC " +"library, an application embedding Python may want to have its *own* " +"substitute for ``malloc()`` and ``free()``, and may not want Python's. " +"Right now, CPython works with anything that implements ``malloc()`` and " +"``free()`` properly." msgstr "" +#: ../../faq/design.rst:394 msgid "Why isn't all memory freed when CPython exits?" msgstr "" -msgid "Objects referenced from the global namespaces of Python modules are not always deallocated when Python exits. This may happen if there are circular references. There are also certain bits of memory that are allocated by the C library that are impossible to free (e.g. a tool like Purify will complain about these). Python is, however, aggressive about cleaning up memory on exit and does try to destroy every single object." +#: ../../faq/design.rst:396 +msgid "" +"Objects referenced from the global namespaces of Python modules are not " +"always deallocated when Python exits. This may happen if there are circular " +"references. There are also certain bits of memory that are allocated by the " +"C library that are impossible to free (e.g. a tool like Purify will complain " +"about these). Python is, however, aggressive about cleaning up memory on " +"exit and does try to destroy every single object." msgstr "" -msgid "If you want to force Python to delete certain things on deallocation use the :mod:`atexit` module to run a function that will force those deletions." +#: ../../faq/design.rst:403 +msgid "" +"If you want to force Python to delete certain things on deallocation use " +"the :mod:`atexit` module to run a function that will force those deletions." msgstr "" +#: ../../faq/design.rst:408 msgid "Why are there separate tuple and list data types?" msgstr "" -msgid "Lists and tuples, while similar in many respects, are generally used in fundamentally different ways. Tuples can be thought of as being similar to Pascal ``records`` or C ``structs``; they're small collections of related data which may be of different types which are operated on as a group. For example, a Cartesian coordinate is appropriately represented as a tuple of two or three numbers." +#: ../../faq/design.rst:410 +msgid "" +"Lists and tuples, while similar in many respects, are generally used in " +"fundamentally different ways. Tuples can be thought of as being similar to " +"Pascal ``records`` or C ``structs``; they're small collections of related " +"data which may be of different types which are operated on as a group. For " +"example, a Cartesian coordinate is appropriately represented as a tuple of " +"two or three numbers." msgstr "" -msgid "Lists, on the other hand, are more like arrays in other languages. They tend to hold a varying number of objects all of which have the same type and which are operated on one-by-one. For example, :func:`os.listdir('.') ` returns a list of strings representing the files in the current directory. Functions which operate on this output would generally not break if you added another file or two to the directory." +#: ../../faq/design.rst:417 +msgid "" +"Lists, on the other hand, are more like arrays in other languages. They " +"tend to hold a varying number of objects all of which have the same type and " +"which are operated on one-by-one. For example, :func:`os.listdir('.') " +"` returns a list of strings representing the files in the " +"current directory. Functions which operate on this output would generally " +"not break if you added another file or two to the directory." msgstr "" -msgid "Tuples are immutable, meaning that once a tuple has been created, you can't replace any of its elements with a new value. Lists are mutable, meaning that you can always change a list's elements. Only immutable elements can be used as dictionary keys, and hence only tuples and not lists can be used as keys." +#: ../../faq/design.rst:425 +msgid "" +"Tuples are immutable, meaning that once a tuple has been created, you can't " +"replace any of its elements with a new value. Lists are mutable, meaning " +"that you can always change a list's elements. Only immutable elements can " +"be used as dictionary keys, and hence only tuples and not lists can be used " +"as keys." msgstr "" +#: ../../faq/design.rst:432 msgid "How are lists implemented in CPython?" msgstr "" -msgid "CPython's lists are really variable-length arrays, not Lisp-style linked lists. The implementation uses a contiguous array of references to other objects, and keeps a pointer to this array and the array's length in a list head structure." +#: ../../faq/design.rst:434 +msgid "" +"CPython's lists are really variable-length arrays, not Lisp-style linked " +"lists. The implementation uses a contiguous array of references to other " +"objects, and keeps a pointer to this array and the array's length in a list " +"head structure." msgstr "" -msgid "This makes indexing a list ``a[i]`` an operation whose cost is independent of the size of the list or the value of the index." +#: ../../faq/design.rst:438 +msgid "" +"This makes indexing a list ``a[i]`` an operation whose cost is independent " +"of the size of the list or the value of the index." msgstr "" -msgid "When items are appended or inserted, the array of references is resized. Some cleverness is applied to improve the performance of appending items repeatedly; when the array must be grown, some extra space is allocated so the next few times don't require an actual resize." +#: ../../faq/design.rst:441 +msgid "" +"When items are appended or inserted, the array of references is resized. " +"Some cleverness is applied to improve the performance of appending items " +"repeatedly; when the array must be grown, some extra space is allocated so " +"the next few times don't require an actual resize." msgstr "" +#: ../../faq/design.rst:448 msgid "How are dictionaries implemented in CPython?" msgstr "" -msgid "CPython's dictionaries are implemented as resizable hash tables. Compared to B-trees, this gives better performance for lookup (the most common operation by far) under most circumstances, and the implementation is simpler." -msgstr "" - -msgid "Dictionaries work by computing a hash code for each key stored in the dictionary using the :func:`hash` built-in function. The hash code varies widely depending on the key and a per-process seed; for example, ``'Python'`` could hash to ``-539294296`` while ``'python'``, a string that differs by a single bit, could hash to ``1142331976``. The hash code is then used to calculate a location in an internal array where the value will be stored. Assuming that you're storing keys that all have different hash values, this means that dictionaries take constant time -- *O*\\ (1), in Big-O notation -- to retrieve a key." +#: ../../faq/design.rst:450 +msgid "" +"CPython's dictionaries are implemented as resizable hash tables. Compared " +"to B-trees, this gives better performance for lookup (the most common " +"operation by far) under most circumstances, and the implementation is " +"simpler." msgstr "" +#: ../../faq/design.rst:454 +msgid "" +"Dictionaries work by computing a hash code for each key stored in the " +"dictionary using the :func:`hash` built-in function. The hash code varies " +"widely depending on the key and a per-process seed; for example, " +"``'Python'`` could hash to ``-539294296`` while ``'python'``, a string that " +"differs by a single bit, could hash to ``1142331976``. The hash code is " +"then used to calculate a location in an internal array where the value will " +"be stored. Assuming that you're storing keys that all have different hash " +"values, this means that dictionaries take constant time -- *O*\\ (1), in Big-" +"O notation -- to retrieve a key." +msgstr "" + +#: ../../faq/design.rst:465 msgid "Why must dictionary keys be immutable?" msgstr "" -msgid "The hash table implementation of dictionaries uses a hash value calculated from the key value to find the key. If the key were a mutable object, its value could change, and thus its hash could also change. But since whoever changes the key object can't tell that it was being used as a dictionary key, it can't move the entry around in the dictionary. Then, when you try to look up the same object in the dictionary it won't be found because its hash value is different. If you tried to look up the old value it wouldn't be found either, because the value of the object found in that hash bin would be different." -msgstr "" - -msgid "If you want a dictionary indexed with a list, simply convert the list to a tuple first; the function ``tuple(L)`` creates a tuple with the same entries as the list ``L``. Tuples are immutable and can therefore be used as dictionary keys." +#: ../../faq/design.rst:467 +msgid "" +"The hash table implementation of dictionaries uses a hash value calculated " +"from the key value to find the key. If the key were a mutable object, its " +"value could change, and thus its hash could also change. But since whoever " +"changes the key object can't tell that it was being used as a dictionary " +"key, it can't move the entry around in the dictionary. Then, when you try " +"to look up the same object in the dictionary it won't be found because its " +"hash value is different. If you tried to look up the old value it wouldn't " +"be found either, because the value of the object found in that hash bin " +"would be different." +msgstr "" + +#: ../../faq/design.rst:476 +msgid "" +"If you want a dictionary indexed with a list, simply convert the list to a " +"tuple first; the function ``tuple(L)`` creates a tuple with the same entries " +"as the list ``L``. Tuples are immutable and can therefore be used as " +"dictionary keys." msgstr "" +#: ../../faq/design.rst:480 msgid "Some unacceptable solutions that have been proposed:" msgstr "" -msgid "Hash lists by their address (object ID). This doesn't work because if you construct a new list with the same value it won't be found; e.g.::" +#: ../../faq/design.rst:482 +msgid "" +"Hash lists by their address (object ID). This doesn't work because if you " +"construct a new list with the same value it won't be found; e.g.::" msgstr "" +#: ../../faq/design.rst:485 msgid "" "mydict = {[1, 2]: '12'}\n" "print(mydict[[1, 2]])" msgstr "" -msgid "would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` used in the second line differs from that in the first line. In other words, dictionary keys should be compared using ``==``, not using :keyword:`is`." +#: ../../faq/design.rst:488 +msgid "" +"would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` " +"used in the second line differs from that in the first line. In other " +"words, dictionary keys should be compared using ``==``, not " +"using :keyword:`is`." msgstr "" -msgid "Make a copy when using a list as a key. This doesn't work because the list, being a mutable object, could contain a reference to itself, and then the copying code would run into an infinite loop." +#: ../../faq/design.rst:492 +msgid "" +"Make a copy when using a list as a key. This doesn't work because the list, " +"being a mutable object, could contain a reference to itself, and then the " +"copying code would run into an infinite loop." msgstr "" -msgid "Allow lists as keys but tell the user not to modify them. This would allow a class of hard-to-track bugs in programs when you forgot or modified a list by accident. It also invalidates an important invariant of dictionaries: every value in ``d.keys()`` is usable as a key of the dictionary." +#: ../../faq/design.rst:496 +msgid "" +"Allow lists as keys but tell the user not to modify them. This would allow " +"a class of hard-to-track bugs in programs when you forgot or modified a list " +"by accident. It also invalidates an important invariant of dictionaries: " +"every value in ``d.keys()`` is usable as a key of the dictionary." msgstr "" -msgid "Mark lists as read-only once they are used as a dictionary key. The problem is that it's not just the top-level object that could change its value; you could use a tuple containing a list as a key. Entering anything as a key into a dictionary would require marking all objects reachable from there as read-only -- and again, self-referential objects could cause an infinite loop." +#: ../../faq/design.rst:501 +msgid "" +"Mark lists as read-only once they are used as a dictionary key. The problem " +"is that it's not just the top-level object that could change its value; you " +"could use a tuple containing a list as a key. Entering anything as a key " +"into a dictionary would require marking all objects reachable from there as " +"read-only -- and again, self-referential objects could cause an infinite " +"loop." msgstr "" -msgid "There is a trick to get around this if you need to, but use it at your own risk: You can wrap a mutable structure inside a class instance which has both a :meth:`~object.__eq__` and a :meth:`~object.__hash__` method. You must then make sure that the hash value for all such wrapper objects that reside in a dictionary (or other hash based structure), remain fixed while the object is in the dictionary (or other structure). ::" +#: ../../faq/design.rst:507 +msgid "" +"There is a trick to get around this if you need to, but use it at your own " +"risk: You can wrap a mutable structure inside a class instance which has " +"both a :meth:`~object.__eq__` and a :meth:`~object.__hash__` method. You " +"must then make sure that the hash value for all such wrapper objects that " +"reside in a dictionary (or other hash based structure), remain fixed while " +"the object is in the dictionary (or other structure). ::" msgstr "" +#: ../../faq/design.rst:515 msgid "" "class ListWrapper:\n" " def __init__(self, the_list):\n" @@ -418,59 +821,143 @@ msgid "" " return result" msgstr "" -msgid "Note that the hash computation is complicated by the possibility that some members of the list may be unhashable and also by the possibility of arithmetic overflow." +#: ../../faq/design.rst:532 +msgid "" +"Note that the hash computation is complicated by the possibility that some " +"members of the list may be unhashable and also by the possibility of " +"arithmetic overflow." msgstr "" -msgid "Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in a dictionary or not. If you fail to meet these restrictions dictionaries and other hash based structures will misbehave." +#: ../../faq/design.rst:536 +msgid "" +"Furthermore it must always be the case that if ``o1 == o2`` (ie " +"``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, " +"``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in " +"a dictionary or not. If you fail to meet these restrictions dictionaries " +"and other hash based structures will misbehave." msgstr "" -msgid "In the case of :class:`!ListWrapper`, whenever the wrapper object is in a dictionary the wrapped list must not change to avoid anomalies. Don't do this unless you are prepared to think hard about the requirements and the consequences of not meeting them correctly. Consider yourself warned." +#: ../../faq/design.rst:541 +msgid "" +"In the case of :class:`!ListWrapper`, whenever the wrapper object is in a " +"dictionary the wrapped list must not change to avoid anomalies. Don't do " +"this unless you are prepared to think hard about the requirements and the " +"consequences of not meeting them correctly. Consider yourself warned." msgstr "" +#: ../../faq/design.rst:548 msgid "Why doesn't list.sort() return the sorted list?" msgstr "" -msgid "In situations where performance matters, making a copy of the list just to sort it would be wasteful. Therefore, :meth:`list.sort` sorts the list in place. In order to remind you of that fact, it does not return the sorted list. This way, you won't be fooled into accidentally overwriting a list when you need a sorted copy but also need to keep the unsorted version around." +#: ../../faq/design.rst:550 +msgid "" +"In situations where performance matters, making a copy of the list just to " +"sort it would be wasteful. Therefore, :meth:`list.sort` sorts the list in " +"place. In order to remind you of that fact, it does not return the sorted " +"list. This way, you won't be fooled into accidentally overwriting a list " +"when you need a sorted copy but also need to keep the unsorted version " +"around." msgstr "" -msgid "If you want to return a new list, use the built-in :func:`sorted` function instead. This function creates a new list from a provided iterable, sorts it and returns it. For example, here's how to iterate over the keys of a dictionary in sorted order::" +#: ../../faq/design.rst:556 +msgid "" +"If you want to return a new list, use the built-in :func:`sorted` function " +"instead. This function creates a new list from a provided iterable, sorts " +"it and returns it. For example, here's how to iterate over the keys of a " +"dictionary in sorted order::" msgstr "" +#: ../../faq/design.rst:561 msgid "" "for key in sorted(mydict):\n" " ... # do whatever with mydict[key]..." msgstr "" +#: ../../faq/design.rst:566 msgid "How do you specify and enforce an interface spec in Python?" msgstr "" -msgid "An interface specification for a module as provided by languages such as C++ and Java describes the prototypes for the methods and functions of the module. Many feel that compile-time enforcement of interface specifications helps in the construction of large programs." +#: ../../faq/design.rst:568 +msgid "" +"An interface specification for a module as provided by languages such as C++ " +"and Java describes the prototypes for the methods and functions of the " +"module. Many feel that compile-time enforcement of interface specifications " +"helps in the construction of large programs." msgstr "" -msgid "Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` to check whether an instance or a class implements a particular ABC. The :mod:`collections.abc` module defines a set of useful ABCs such as :class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and :class:`~collections.abc.MutableMapping`." +#: ../../faq/design.rst:573 +msgid "" +"Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base " +"Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` " +"to check whether an instance or a class implements a particular ABC. " +"The :mod:`collections.abc` module defines a set of useful ABCs such " +"as :class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, " +"and :class:`~collections.abc.MutableMapping`." msgstr "" -msgid "For Python, many of the advantages of interface specifications can be obtained by an appropriate test discipline for components." +#: ../../faq/design.rst:580 +msgid "" +"For Python, many of the advantages of interface specifications can be " +"obtained by an appropriate test discipline for components." msgstr "" -msgid "A good test suite for a module can both provide a regression test and serve as a module interface specification and a set of examples. Many Python modules can be run as a script to provide a simple \"self test.\" Even modules which use complex external interfaces can often be tested in isolation using trivial \"stub\" emulations of the external interface. The :mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can be used to construct exhaustive test suites that exercise every line of code in a module." +#: ../../faq/design.rst:583 +msgid "" +"A good test suite for a module can both provide a regression test and serve " +"as a module interface specification and a set of examples. Many Python " +"modules can be run as a script to provide a simple \"self test.\" Even " +"modules which use complex external interfaces can often be tested in " +"isolation using trivial \"stub\" emulations of the external interface. " +"The :mod:`doctest` and :mod:`unittest` modules or third-party test " +"frameworks can be used to construct exhaustive test suites that exercise " +"every line of code in a module." msgstr "" -msgid "An appropriate testing discipline can help build large complex applications in Python as well as having interface specifications would. In fact, it can be better because an interface specification cannot test certain properties of a program. For example, the :meth:`list.append` method is expected to add new elements to the end of some internal list; an interface specification cannot test that your :meth:`list.append` implementation will actually do this correctly, but it's trivial to check this property in a test suite." +#: ../../faq/design.rst:591 +msgid "" +"An appropriate testing discipline can help build large complex applications " +"in Python as well as having interface specifications would. In fact, it can " +"be better because an interface specification cannot test certain properties " +"of a program. For example, the :meth:`list.append` method is expected to " +"add new elements to the end of some internal list; an interface " +"specification cannot test that your :meth:`list.append` implementation will " +"actually do this correctly, but it's trivial to check this property in a " +"test suite." msgstr "" -msgid "Writing test suites is very helpful, and you might want to design your code to make it easily tested. One increasingly popular technique, test-driven development, calls for writing parts of the test suite first, before you write any of the actual code. Of course Python allows you to be sloppy and not write test cases at all." +#: ../../faq/design.rst:599 +msgid "" +"Writing test suites is very helpful, and you might want to design your code " +"to make it easily tested. One increasingly popular technique, test-driven " +"development, calls for writing parts of the test suite first, before you " +"write any of the actual code. Of course Python allows you to be sloppy and " +"not write test cases at all." msgstr "" +#: ../../faq/design.rst:607 msgid "Why is there no goto?" msgstr "" -msgid "In the 1970s people realized that unrestricted goto could lead to messy \"spaghetti\" code that was hard to understand and revise. In a high-level language, it is also unneeded as long as there are ways to branch (in Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:`while` and :keyword:`for` statements, possibly containing :keyword:`continue` and :keyword:`break`)." +#: ../../faq/design.rst:609 +msgid "" +"In the 1970s people realized that unrestricted goto could lead to messy " +"\"spaghetti\" code that was hard to understand and revise. In a high-level " +"language, it is also unneeded as long as there are ways to branch (in " +"Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, " +"and :keyword:`if`/:keyword:`else` expressions) and loop " +"(with :keyword:`while` and :keyword:`for` statements, possibly " +"containing :keyword:`continue` and :keyword:`break`)." msgstr "" -msgid "One can also use exceptions to provide a \"structured goto\" that works even across function calls. Many feel that exceptions can conveniently emulate all reasonable uses of the ``go`` or ``goto`` constructs of C, Fortran, and other languages. For example::" +#: ../../faq/design.rst:616 +msgid "" +"One can also use exceptions to provide a \"structured goto\" that works even " +"across function calls. Many feel that exceptions can conveniently emulate " +"all reasonable uses of the ``go`` or ``goto`` constructs of C, Fortran, and " +"other languages. For example::" msgstr "" +#: ../../faq/design.rst:622 msgid "" "class label(Exception): pass # declare a label\n" "\n" @@ -483,78 +970,133 @@ msgid "" "..." msgstr "" -msgid "This doesn't allow you to jump into the middle of a loop, but that's usually considered an abuse of ``goto`` anyway. Use sparingly." +#: ../../faq/design.rst:632 +msgid "" +"This doesn't allow you to jump into the middle of a loop, but that's usually " +"considered an abuse of ``goto`` anyway. Use sparingly." msgstr "" +#: ../../faq/design.rst:637 msgid "Why can't raw strings (r-strings) end with a backslash?" msgstr "" -msgid "More precisely, they can't end with an odd number of backslashes: the unpaired backslash at the end escapes the closing quote character, leaving an unterminated string." +#: ../../faq/design.rst:639 +msgid "" +"More precisely, they can't end with an odd number of backslashes: the " +"unpaired backslash at the end escapes the closing quote character, leaving " +"an unterminated string." msgstr "" -msgid "Raw strings were designed to ease creating input for processors (chiefly regular expression engines) that want to do their own backslash escape processing. Such processors consider an unmatched trailing backslash to be an error anyway, so raw strings disallow that. In return, they allow you to pass on the string quote character by escaping it with a backslash. These rules work well when r-strings are used for their intended purpose." +#: ../../faq/design.rst:643 +msgid "" +"Raw strings were designed to ease creating input for processors (chiefly " +"regular expression engines) that want to do their own backslash escape " +"processing. Such processors consider an unmatched trailing backslash to be " +"an error anyway, so raw strings disallow that. In return, they allow you to " +"pass on the string quote character by escaping it with a backslash. These " +"rules work well when r-strings are used for their intended purpose." msgstr "" -msgid "If you're trying to build Windows pathnames, note that all Windows system calls accept forward slashes too::" +#: ../../faq/design.rst:650 +msgid "" +"If you're trying to build Windows pathnames, note that all Windows system " +"calls accept forward slashes too::" msgstr "" +#: ../../faq/design.rst:653 msgid "f = open(\"/mydir/file.txt\") # works fine!" msgstr "" -msgid "If you're trying to build a pathname for a DOS command, try e.g. one of ::" +#: ../../faq/design.rst:655 +msgid "" +"If you're trying to build a pathname for a DOS command, try e.g. one of ::" msgstr "" +#: ../../faq/design.rst:657 msgid "" "dir = r\"\\this\\is\\my\\dos\\dir\" \"\\\\\"\n" "dir = r\"\\this\\is\\my\\dos\\dir\\ \"[:-1]\n" "dir = \"\\\\this\\\\is\\\\my\\\\dos\\\\dir\\\\\"" msgstr "" +#: ../../faq/design.rst:663 msgid "Why doesn't Python have a \"with\" statement for attribute assignments?" msgstr "" -msgid "Python has a :keyword:`with` statement that wraps the execution of a block, calling code on the entrance and exit from the block. Some languages have a construct that looks like this::" +#: ../../faq/design.rst:665 +msgid "" +"Python has a :keyword:`with` statement that wraps the execution of a block, " +"calling code on the entrance and exit from the block. Some languages have a " +"construct that looks like this::" msgstr "" +#: ../../faq/design.rst:669 msgid "" "with obj:\n" " a = 1 # equivalent to obj.a = 1\n" " total = total + 1 # obj.total = obj.total + 1" msgstr "" +#: ../../faq/design.rst:673 msgid "In Python, such a construct would be ambiguous." msgstr "" -msgid "Other languages, such as Object Pascal, Delphi, and C++, use static types, so it's possible to know, in an unambiguous way, what member is being assigned to. This is the main point of static typing -- the compiler *always* knows the scope of every variable at compile time." +#: ../../faq/design.rst:675 +msgid "" +"Other languages, such as Object Pascal, Delphi, and C++, use static types, " +"so it's possible to know, in an unambiguous way, what member is being " +"assigned to. This is the main point of static typing -- the compiler " +"*always* knows the scope of every variable at compile time." msgstr "" -msgid "Python uses dynamic types. It is impossible to know in advance which attribute will be referenced at runtime. Member attributes may be added or removed from objects on the fly. This makes it impossible to know, from a simple reading, what attribute is being referenced: a local one, a global one, or a member attribute?" +#: ../../faq/design.rst:680 +msgid "" +"Python uses dynamic types. It is impossible to know in advance which " +"attribute will be referenced at runtime. Member attributes may be added or " +"removed from objects on the fly. This makes it impossible to know, from a " +"simple reading, what attribute is being referenced: a local one, a global " +"one, or a member attribute?" msgstr "" +#: ../../faq/design.rst:686 msgid "For instance, take the following incomplete snippet::" msgstr "" +#: ../../faq/design.rst:688 msgid "" "def foo(a):\n" " with a:\n" " print(x)" msgstr "" -msgid "The snippet assumes that ``a`` must have a member attribute called ``x``. However, there is nothing in Python that tells the interpreter this. What should happen if ``a`` is, let us say, an integer? If there is a global variable named ``x``, will it be used inside the :keyword:`with` block? As you see, the dynamic nature of Python makes such choices much harder." +#: ../../faq/design.rst:692 +msgid "" +"The snippet assumes that ``a`` must have a member attribute called ``x``. " +"However, there is nothing in Python that tells the interpreter this. What " +"should happen if ``a`` is, let us say, an integer? If there is a global " +"variable named ``x``, will it be used inside the :keyword:`with` block? As " +"you see, the dynamic nature of Python makes such choices much harder." msgstr "" -msgid "The primary benefit of :keyword:`with` and similar language features (reduction of code volume) can, however, easily be achieved in Python by assignment. Instead of::" +#: ../../faq/design.rst:698 +msgid "" +"The primary benefit of :keyword:`with` and similar language features " +"(reduction of code volume) can, however, easily be achieved in Python by " +"assignment. Instead of::" msgstr "" +#: ../../faq/design.rst:701 msgid "" "function(args).mydict[index][index].a = 21\n" "function(args).mydict[index][index].b = 42\n" "function(args).mydict[index][index].c = 63" msgstr "" +#: ../../faq/design.rst:705 msgid "write this::" msgstr "" +#: ../../faq/design.rst:707 msgid "" "ref = function(args).mydict[index][index]\n" "ref.a = 21\n" @@ -562,49 +1104,85 @@ msgid "" "ref.c = 63" msgstr "" -msgid "This also has the side-effect of increasing execution speed because name bindings are resolved at run-time in Python, and the second version only needs to perform the resolution once." +#: ../../faq/design.rst:712 +msgid "" +"This also has the side-effect of increasing execution speed because name " +"bindings are resolved at run-time in Python, and the second version only " +"needs to perform the resolution once." msgstr "" -msgid "Similar proposals that would introduce syntax to further reduce code volume, such as using a 'leading dot', have been rejected in favour of explicitness (see https://mail.python.org/pipermail/python-ideas/2016-May/040070.html)." +#: ../../faq/design.rst:716 +msgid "" +"Similar proposals that would introduce syntax to further reduce code volume, " +"such as using a 'leading dot', have been rejected in favour of explicitness " +"(see https://mail.python.org/pipermail/python-ideas/2016-May/040070.html)." msgstr "" +#: ../../faq/design.rst:722 msgid "Why don't generators support the with statement?" msgstr "" -msgid "For technical reasons, a generator used directly as a context manager would not work correctly. When, as is most common, a generator is used as an iterator run to completion, no closing is needed. When it is, wrap it as :func:`contextlib.closing(generator) ` in the :keyword:`with` statement." +#: ../../faq/design.rst:724 +msgid "" +"For technical reasons, a generator used directly as a context manager would " +"not work correctly. When, as is most common, a generator is used as an " +"iterator run to completion, no closing is needed. When it is, wrap it " +"as :func:`contextlib.closing(generator) ` in " +"the :keyword:`with` statement." msgstr "" +#: ../../faq/design.rst:732 msgid "Why are colons required for the if/while/def/class statements?" msgstr "" -msgid "The colon is required primarily to enhance readability (one of the results of the experimental ABC language). Consider this::" +#: ../../faq/design.rst:734 +msgid "" +"The colon is required primarily to enhance readability (one of the results " +"of the experimental ABC language). Consider this::" msgstr "" +#: ../../faq/design.rst:737 msgid "" "if a == b\n" " print(a)" msgstr "" +#: ../../faq/design.rst:740 msgid "versus ::" msgstr "" +#: ../../faq/design.rst:742 msgid "" "if a == b:\n" " print(a)" msgstr "" -msgid "Notice how the second one is slightly easier to read. Notice further how a colon sets off the example in this FAQ answer; it's a standard usage in English." +#: ../../faq/design.rst:745 +msgid "" +"Notice how the second one is slightly easier to read. Notice further how a " +"colon sets off the example in this FAQ answer; it's a standard usage in " +"English." msgstr "" -msgid "Another minor reason is that the colon makes it easier for editors with syntax highlighting; they can look for colons to decide when indentation needs to be increased instead of having to do a more elaborate parsing of the program text." +#: ../../faq/design.rst:748 +msgid "" +"Another minor reason is that the colon makes it easier for editors with " +"syntax highlighting; they can look for colons to decide when indentation " +"needs to be increased instead of having to do a more elaborate parsing of " +"the program text." msgstr "" +#: ../../faq/design.rst:754 msgid "Why does Python allow commas at the end of lists and tuples?" msgstr "" -msgid "Python lets you add a trailing comma at the end of lists, tuples, and dictionaries::" +#: ../../faq/design.rst:756 +msgid "" +"Python lets you add a trailing comma at the end of lists, tuples, and " +"dictionaries::" msgstr "" +#: ../../faq/design.rst:759 msgid "" "[1, 2, 3,]\n" "('a', 'b', 'c',)\n" @@ -614,15 +1192,25 @@ msgid "" "}" msgstr "" +#: ../../faq/design.rst:767 msgid "There are several reasons to allow this." msgstr "" -msgid "When you have a literal value for a list, tuple, or dictionary spread across multiple lines, it's easier to add more elements because you don't have to remember to add a comma to the previous line. The lines can also be reordered without creating a syntax error." +#: ../../faq/design.rst:769 +msgid "" +"When you have a literal value for a list, tuple, or dictionary spread across " +"multiple lines, it's easier to add more elements because you don't have to " +"remember to add a comma to the previous line. The lines can also be " +"reordered without creating a syntax error." msgstr "" -msgid "Accidentally omitting the comma can lead to errors that are hard to diagnose. For example::" +#: ../../faq/design.rst:774 +msgid "" +"Accidentally omitting the comma can lead to errors that are hard to " +"diagnose. For example::" msgstr "" +#: ../../faq/design.rst:777 msgid "" "x = [\n" " \"fee\",\n" @@ -632,8 +1220,15 @@ msgid "" "]" msgstr "" -msgid "This list looks like it has four elements, but it actually contains three: \"fee\", \"fiefoo\" and \"fum\". Always adding the comma avoids this source of error." +#: ../../faq/design.rst:784 +msgid "" +"This list looks like it has four elements, but it actually contains three: " +"\"fee\", \"fiefoo\" and \"fum\". Always adding the comma avoids this source " +"of error." msgstr "" -msgid "Allowing the trailing comma may also make programmatic code generation easier." +#: ../../faq/design.rst:787 +msgid "" +"Allowing the trailing comma may also make programmatic code generation " +"easier." msgstr "" diff --git a/faq/extending.po b/faq/extending.po index df6dee6d7..8c6f9edc5 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,84 +24,156 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/extending.rst:3 msgid "Extending/Embedding FAQ" msgstr "" +#: ../../faq/extending.rst:6 msgid "Contents" msgstr "" +#: ../../faq/extending.rst:16 msgid "Can I create my own functions in C?" msgstr "" -msgid "Yes, you can create built-in modules containing functions, variables, exceptions and even new types in C. This is explained in the document :ref:`extending-index`." +#: ../../faq/extending.rst:18 +msgid "" +"Yes, you can create built-in modules containing functions, variables, " +"exceptions and even new types in C. This is explained in the " +"document :ref:`extending-index`." msgstr "" +#: ../../faq/extending.rst:22 msgid "Most intermediate or advanced Python books will also cover this topic." msgstr "" +#: ../../faq/extending.rst:26 msgid "Can I create my own functions in C++?" msgstr "" -msgid "Yes, using the C compatibility features found in C++. Place ``extern \"C\" { ... }`` around the Python include files and put ``extern \"C\"`` before each function that is going to be called by the Python interpreter. Global or static C++ objects with constructors are probably not a good idea." +#: ../../faq/extending.rst:28 +msgid "" +"Yes, using the C compatibility features found in C++. Place ``extern \"C\" " +"{ ... }`` around the Python include files and put ``extern \"C\"`` before " +"each function that is going to be called by the Python interpreter. Global " +"or static C++ objects with constructors are probably not a good idea." msgstr "" +#: ../../faq/extending.rst:37 msgid "Writing C is hard; are there any alternatives?" msgstr "" -msgid "There are a number of alternatives to writing your own C extensions, depending on what you're trying to do. :ref:`Recommended third party tools ` offer both simpler and more sophisticated approaches to creating C and C++ extensions for Python." +#: ../../faq/extending.rst:39 +msgid "" +"There are a number of alternatives to writing your own C extensions, " +"depending on what you're trying to do. :ref:`Recommended third party tools " +"` offer both simpler and more sophisticated approaches to " +"creating C and C++ extensions for Python." msgstr "" +#: ../../faq/extending.rst:46 msgid "How can I execute arbitrary Python statements from C?" msgstr "" -msgid "The highest-level function to do this is :c:func:`PyRun_SimpleString` which takes a single string argument to be executed in the context of the module ``__main__`` and returns ``0`` for success and ``-1`` when an exception occurred (including :exc:`SyntaxError`). If you want more control, use :c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in ``Python/pythonrun.c``." +#: ../../faq/extending.rst:48 +msgid "" +"The highest-level function to do this is :c:func:`PyRun_SimpleString` which " +"takes a single string argument to be executed in the context of the module " +"``__main__`` and returns ``0`` for success and ``-1`` when an exception " +"occurred (including :exc:`SyntaxError`). If you want more control, " +"use :c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` " +"in ``Python/pythonrun.c``." msgstr "" +#: ../../faq/extending.rst:57 msgid "How can I evaluate an arbitrary Python expression from C?" msgstr "" -msgid "Call the function :c:func:`PyRun_String` from the previous question with the start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it and returns its value." +#: ../../faq/extending.rst:59 +msgid "" +"Call the function :c:func:`PyRun_String` from the previous question with the " +"start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it " +"and returns its value." msgstr "" +#: ../../faq/extending.rst:65 msgid "How do I extract C values from a Python object?" msgstr "" -msgid "That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` returns its length and :c:func:`PyTuple_GetItem` returns the item at a specified index. Lists have similar functions, :c:func:`PyList_Size` and :c:func:`PyList_GetItem`." +#: ../../faq/extending.rst:67 +msgid "" +"That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` " +"returns its length and :c:func:`PyTuple_GetItem` returns the item at a " +"specified index. Lists have similar functions, :c:func:`PyList_Size` " +"and :c:func:`PyList_GetItem`." msgstr "" -msgid "For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and its length. Note that Python bytes objects may contain null bytes so C's :c:func:`!strlen` should not be used." +#: ../../faq/extending.rst:72 +msgid "" +"For bytes, :c:func:`PyBytes_Size` returns its length " +"and :c:func:`PyBytes_AsStringAndSize` provides a pointer to its value and " +"its length. Note that Python bytes objects may contain null bytes so " +"C's :c:func:`!strlen` should not be used." msgstr "" -msgid "To test the type of an object, first make sure it isn't ``NULL``, and then use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc." +#: ../../faq/extending.rst:77 +msgid "" +"To test the type of an object, first make sure it isn't ``NULL``, and then " +"use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, " +"etc." msgstr "" -msgid "There is also a high-level API to Python objects which is provided by the so-called 'abstract' interface -- read ``Include/abstract.h`` for further details. It allows interfacing with any kind of Python sequence using calls like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc. as well as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et al.) and mappings in the PyMapping APIs." +#: ../../faq/extending.rst:80 +msgid "" +"There is also a high-level API to Python objects which is provided by the so-" +"called 'abstract' interface -- read ``Include/abstract.h`` for further " +"details. It allows interfacing with any kind of Python sequence using calls " +"like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc. as well " +"as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et " +"al.) and mappings in the PyMapping APIs." msgstr "" +#: ../../faq/extending.rst:89 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" msgstr "" +#: ../../faq/extending.rst:91 msgid "You can't. Use :c:func:`PyTuple_Pack` instead." msgstr "" +#: ../../faq/extending.rst:95 msgid "How do I call an object's method from C?" msgstr "" -msgid "The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary method of an object. The parameters are the object, the name of the method to call, a format string like that used with :c:func:`Py_BuildValue`, and the argument values::" +#: ../../faq/extending.rst:97 +msgid "" +"The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary " +"method of an object. The parameters are the object, the name of the method " +"to call, a format string like that used with :c:func:`Py_BuildValue`, and " +"the argument values::" msgstr "" +#: ../../faq/extending.rst:102 msgid "" "PyObject *\n" "PyObject_CallMethod(PyObject *object, const char *method_name,\n" " const char *arg_format, ...);" msgstr "" -msgid "This works for any object that has methods -- whether built-in or user-defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the return value." +#: ../../faq/extending.rst:106 +msgid "" +"This works for any object that has methods -- whether built-in or user-" +"defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the " +"return value." msgstr "" -msgid "To call, e.g., a file object's \"seek\" method with arguments 10, 0 (assuming the file object pointer is \"f\")::" +#: ../../faq/extending.rst:109 +msgid "" +"To call, e.g., a file object's \"seek\" method with arguments 10, 0 " +"(assuming the file object pointer is \"f\")::" msgstr "" +#: ../../faq/extending.rst:112 msgid "" "res = PyObject_CallMethod(f, \"seek\", \"(ii)\", 10, 0);\n" "if (res == NULL) {\n" @@ -112,18 +184,33 @@ msgid "" "}" msgstr "" -msgid "Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the argument list, to call a function without arguments, pass \"()\" for the format, and to call a function with one argument, surround the argument in parentheses, e.g. \"(i)\"." +#: ../../faq/extending.rst:120 +msgid "" +"Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the " +"argument list, to call a function without arguments, pass \"()\" for the " +"format, and to call a function with one argument, surround the argument in " +"parentheses, e.g. \"(i)\"." msgstr "" -msgid "How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?" +#: ../../faq/extending.rst:127 +msgid "" +"How do I catch the output from PyErr_Print() (or anything that prints to " +"stdout/stderr)?" msgstr "" -msgid "In Python code, define an object that supports the ``write()`` method. Assign this object to :data:`sys.stdout` and :data:`sys.stderr`. Call print_error, or just allow the standard traceback mechanism to work. Then, the output will go wherever your ``write()`` method sends it." +#: ../../faq/extending.rst:129 +msgid "" +"In Python code, define an object that supports the ``write()`` method. " +"Assign this object to :data:`sys.stdout` and :data:`sys.stderr`. Call " +"print_error, or just allow the standard traceback mechanism to work. Then, " +"the output will go wherever your ``write()`` method sends it." msgstr "" +#: ../../faq/extending.rst:134 msgid "The easiest way to do this is to use the :class:`io.StringIO` class:" msgstr "" +#: ../../faq/extending.rst:136 msgid "" ">>> import io, sys\n" ">>> sys.stdout = io.StringIO()\n" @@ -134,9 +221,11 @@ msgid "" "hello world!" msgstr "" +#: ../../faq/extending.rst:146 msgid "A custom object to do the same would look like this:" msgstr "" +#: ../../faq/extending.rst:148 msgid "" ">>> import io, sys\n" ">>> class StdoutCatcher(io.TextIOBase):\n" @@ -154,57 +243,95 @@ msgid "" "hello world!" msgstr "" +#: ../../faq/extending.rst:167 msgid "How do I access a module written in Python from C?" msgstr "" +#: ../../faq/extending.rst:169 msgid "You can get a pointer to the module object as follows::" msgstr "" +#: ../../faq/extending.rst:171 msgid "module = PyImport_ImportModule(\"\");" msgstr "" -msgid "If the module hasn't been imported yet (i.e. it is not yet present in :data:`sys.modules`), this initializes the module; otherwise it simply returns the value of ``sys.modules[\"\"]``. Note that it doesn't enter the module into any namespace -- it only ensures it has been initialized and is stored in :data:`sys.modules`." +#: ../../faq/extending.rst:173 +msgid "" +"If the module hasn't been imported yet (i.e. it is not yet present " +"in :data:`sys.modules`), this initializes the module; otherwise it simply " +"returns the value of ``sys.modules[\"\"]``. Note that it " +"doesn't enter the module into any namespace -- it only ensures it has been " +"initialized and is stored in :data:`sys.modules`." msgstr "" -msgid "You can then access the module's attributes (i.e. any name defined in the module) as follows::" +#: ../../faq/extending.rst:179 +msgid "" +"You can then access the module's attributes (i.e. any name defined in the " +"module) as follows::" msgstr "" +#: ../../faq/extending.rst:182 msgid "attr = PyObject_GetAttrString(module, \"\");" msgstr "" -msgid "Calling :c:func:`PyObject_SetAttrString` to assign to variables in the module also works." +#: ../../faq/extending.rst:184 +msgid "" +"Calling :c:func:`PyObject_SetAttrString` to assign to variables in the " +"module also works." msgstr "" +#: ../../faq/extending.rst:189 msgid "How do I interface to C++ objects from Python?" msgstr "" -msgid "Depending on your requirements, there are many approaches. To do this manually, begin by reading :ref:`the \"Extending and Embedding\" document `. Realize that for the Python run-time system, there isn't a whole lot of difference between C and C++ -- so the strategy of building a new Python type around a C structure (pointer) type will also work for C++ objects." +#: ../../faq/extending.rst:191 +msgid "" +"Depending on your requirements, there are many approaches. To do this " +"manually, begin by reading :ref:`the \"Extending and Embedding\" document " +"`. Realize that for the Python run-time system, there " +"isn't a whole lot of difference between C and C++ -- so the strategy of " +"building a new Python type around a C structure (pointer) type will also " +"work for C++ objects." msgstr "" +#: ../../faq/extending.rst:197 msgid "For C++ libraries, see :ref:`c-wrapper-software`." msgstr "" +#: ../../faq/extending.rst:201 msgid "I added a module using the Setup file and the make fails; why?" msgstr "" -msgid "Setup must end in a newline, if there is no newline there, the build process fails. (Fixing this requires some ugly shell script hackery, and this bug is so minor that it doesn't seem worth the effort.)" +#: ../../faq/extending.rst:203 +msgid "" +"Setup must end in a newline, if there is no newline there, the build process " +"fails. (Fixing this requires some ugly shell script hackery, and this bug " +"is so minor that it doesn't seem worth the effort.)" msgstr "" +#: ../../faq/extending.rst:209 msgid "How do I debug an extension?" msgstr "" -msgid "When using GDB with dynamically loaded extensions, you can't set a breakpoint in your extension until your extension is loaded." +#: ../../faq/extending.rst:211 +msgid "" +"When using GDB with dynamically loaded extensions, you can't set a " +"breakpoint in your extension until your extension is loaded." msgstr "" +#: ../../faq/extending.rst:214 msgid "In your ``.gdbinit`` file (or interactively), add the command:" msgstr "" +#: ../../faq/extending.rst:216 msgid "br _PyImport_LoadDynamicModule" msgstr "" +#: ../../faq/extending.rst:220 msgid "Then, when you run GDB:" msgstr "" +#: ../../faq/extending.rst:222 msgid "" "$ gdb /local/bin/python\n" "gdb) run myscript.py\n" @@ -214,41 +341,80 @@ msgid "" "gdb) continue" msgstr "" -msgid "I want to compile a Python module on my Linux system, but some files are missing. Why?" +#: ../../faq/extending.rst:232 +msgid "" +"I want to compile a Python module on my Linux system, but some files are " +"missing. Why?" msgstr "" -msgid "Most packaged versions of Python omit some files required for compiling Python extensions." +#: ../../faq/extending.rst:234 +msgid "" +"Most packaged versions of Python omit some files required for compiling " +"Python extensions." msgstr "" +#: ../../faq/extending.rst:237 msgid "For Red Hat, install the python3-devel RPM to get the necessary files." msgstr "" +#: ../../faq/extending.rst:239 msgid "For Debian, run ``apt-get install python3-dev``." msgstr "" +#: ../../faq/extending.rst:242 msgid "How do I tell \"incomplete input\" from \"invalid input\"?" msgstr "" -msgid "Sometimes you want to emulate the Python interactive interpreter's behavior, where it gives you a continuation prompt when the input is incomplete (e.g. you typed the start of an \"if\" statement or you didn't close your parentheses or triple string quotes), but it gives you a syntax error message immediately when the input is invalid." +#: ../../faq/extending.rst:244 +msgid "" +"Sometimes you want to emulate the Python interactive interpreter's behavior, " +"where it gives you a continuation prompt when the input is incomplete (e.g. " +"you typed the start of an \"if\" statement or you didn't close your " +"parentheses or triple string quotes), but it gives you a syntax error " +"message immediately when the input is invalid." msgstr "" -msgid "In Python you can use the :mod:`codeop` module, which approximates the parser's behavior sufficiently. IDLE uses this, for example." +#: ../../faq/extending.rst:250 +msgid "" +"In Python you can use the :mod:`codeop` module, which approximates the " +"parser's behavior sufficiently. IDLE uses this, for example." msgstr "" -msgid "The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` (perhaps in a separate thread) and let the Python interpreter handle the input for you. You can also set the :c:func:`PyOS_ReadlineFunctionPointer` to point at your custom input function. See ``Modules/readline.c`` and ``Parser/myreadline.c`` for more hints." +#: ../../faq/extending.rst:253 +msgid "" +"The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` " +"(perhaps in a separate thread) and let the Python interpreter handle the " +"input for you. You can also set the :c:func:`PyOS_ReadlineFunctionPointer` " +"to point at your custom input function. See ``Modules/readline.c`` and " +"``Parser/myreadline.c`` for more hints." msgstr "" +#: ../../faq/extending.rst:260 msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" msgstr "" -msgid "To dynamically load g++ extension modules, you must recompile Python, relink it using g++ (change LINKCC in the Python Modules Makefile), and link your extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``)." +#: ../../faq/extending.rst:262 +msgid "" +"To dynamically load g++ extension modules, you must recompile Python, relink " +"it using g++ (change LINKCC in the Python Modules Makefile), and link your " +"extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``)." msgstr "" -msgid "Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?" +#: ../../faq/extending.rst:268 +msgid "" +"Can I create an object class with some methods implemented in C and others " +"in Python (e.g. through inheritance)?" msgstr "" -msgid "Yes, you can inherit from built-in classes such as :class:`int`, :class:`list`, :class:`dict`, etc." +#: ../../faq/extending.rst:270 +msgid "" +"Yes, you can inherit from built-in classes such " +"as :class:`int`, :class:`list`, :class:`dict`, etc." msgstr "" -msgid "The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index.html) provides a way of doing this from C++ (i.e. you can inherit from an extension class written in C++ using the BPL)." +#: ../../faq/extending.rst:273 +msgid "" +"The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/" +"index.html) provides a way of doing this from C++ (i.e. you can inherit from " +"an extension class written in C++ using the BPL)." msgstr "" diff --git a/faq/general.po b/faq/general.po index 9b7ac3983..515f109f8 100644 --- a/faq/general.po +++ b/faq/general.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,288 +24,622 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/general.rst:5 msgid "General Python FAQ" msgstr "" +#: ../../faq/general.rst:8 msgid "Contents" msgstr "" +#: ../../faq/general.rst:13 msgid "General Information" msgstr "" +#: ../../faq/general.rst:16 msgid "What is Python?" msgstr "" -msgid "Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. It supports multiple programming paradigms beyond object-oriented programming, such as procedural and functional programming. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants including Linux and macOS, and on Windows." -msgstr "" - -msgid "To find out more, start with :ref:`tutorial-index`. The `Beginner's Guide to Python `_ links to other introductory tutorials and resources for learning Python." +#: ../../faq/general.rst:18 +msgid "" +"Python is an interpreted, interactive, object-oriented programming " +"language. It incorporates modules, exceptions, dynamic typing, very high " +"level dynamic data types, and classes. It supports multiple programming " +"paradigms beyond object-oriented programming, such as procedural and " +"functional programming. Python combines remarkable power with very clear " +"syntax. It has interfaces to many system calls and libraries, as well as to " +"various window systems, and is extensible in C or C++. It is also usable as " +"an extension language for applications that need a programmable interface. " +"Finally, Python is portable: it runs on many Unix variants including Linux " +"and macOS, and on Windows." +msgstr "" + +#: ../../faq/general.rst:28 +msgid "" +"To find out more, start with :ref:`tutorial-index`. The `Beginner's Guide " +"to Python `_ links to other " +"introductory tutorials and resources for learning Python." msgstr "" +#: ../../faq/general.rst:34 msgid "What is the Python Software Foundation?" msgstr "" -msgid "The Python Software Foundation is an independent non-profit organization that holds the copyright on Python versions 2.1 and newer. The PSF's mission is to advance open source technology related to the Python programming language and to publicize the use of Python. The PSF's home page is at https://www.python.org/psf/." +#: ../../faq/general.rst:36 +msgid "" +"The Python Software Foundation is an independent non-profit organization " +"that holds the copyright on Python versions 2.1 and newer. The PSF's " +"mission is to advance open source technology related to the Python " +"programming language and to publicize the use of Python. The PSF's home " +"page is at https://www.python.org/psf/." msgstr "" -msgid "Donations to the PSF are tax-exempt in the US. If you use Python and find it helpful, please contribute via `the PSF donation page `_." +#: ../../faq/general.rst:42 +msgid "" +"Donations to the PSF are tax-exempt in the US. If you use Python and find " +"it helpful, please contribute via `the PSF donation page `_." msgstr "" +#: ../../faq/general.rst:48 msgid "Are there copyright restrictions on the use of Python?" msgstr "" -msgid "You can do anything you want with the source, as long as you leave the copyrights in and display those copyrights in any documentation about Python that you produce. If you honor the copyright rules, it's OK to use Python for commercial use, to sell copies of Python in source or binary form (modified or unmodified), or to sell products that incorporate Python in some form. We would still like to know about all commercial use of Python, of course." +#: ../../faq/general.rst:50 +msgid "" +"You can do anything you want with the source, as long as you leave the " +"copyrights in and display those copyrights in any documentation about Python " +"that you produce. If you honor the copyright rules, it's OK to use Python " +"for commercial use, to sell copies of Python in source or binary form " +"(modified or unmodified), or to sell products that incorporate Python in " +"some form. We would still like to know about all commercial use of Python, " +"of course." msgstr "" -msgid "See `the license page `_ to find further explanations and the full text of the PSF License." +#: ../../faq/general.rst:57 +msgid "" +"See `the license page `_ to find " +"further explanations and the full text of the PSF License." msgstr "" -msgid "The Python logo is trademarked, and in certain cases permission is required to use it. Consult `the Trademark Usage Policy `__ for more information." +#: ../../faq/general.rst:60 +msgid "" +"The Python logo is trademarked, and in certain cases permission is required " +"to use it. Consult `the Trademark Usage Policy `__ for more information." msgstr "" +#: ../../faq/general.rst:66 msgid "Why was Python created in the first place?" msgstr "" -msgid "Here's a *very* brief summary of what started it all, written by Guido van Rossum:" +#: ../../faq/general.rst:68 +msgid "" +"Here's a *very* brief summary of what started it all, written by Guido van " +"Rossum:" msgstr "" -msgid "I had extensive experience with implementing an interpreted language in the ABC group at CWI, and from working with this group I had learned a lot about language design. This is the origin of many Python features, including the use of indentation for statement grouping and the inclusion of very-high-level data types (although the details are all different in Python)." +#: ../../faq/general.rst:71 +msgid "" +"I had extensive experience with implementing an interpreted language in the " +"ABC group at CWI, and from working with this group I had learned a lot about " +"language design. This is the origin of many Python features, including the " +"use of indentation for statement grouping and the inclusion of very-high-" +"level data types (although the details are all different in Python)." msgstr "" -msgid "I had a number of gripes about the ABC language, but also liked many of its features. It was impossible to extend the ABC language (or its implementation) to remedy my complaints -- in fact its lack of extensibility was one of its biggest problems. I had some experience with using Modula-2+ and talked with the designers of Modula-3 and read the Modula-3 report. Modula-3 is the origin of the syntax and semantics used for exceptions, and some other Python features." +#: ../../faq/general.rst:78 +msgid "" +"I had a number of gripes about the ABC language, but also liked many of its " +"features. It was impossible to extend the ABC language (or its " +"implementation) to remedy my complaints -- in fact its lack of extensibility " +"was one of its biggest problems. I had some experience with using Modula-2+ " +"and talked with the designers of Modula-3 and read the Modula-3 report. " +"Modula-3 is the origin of the syntax and semantics used for exceptions, and " +"some other Python features." msgstr "" -msgid "I was working in the Amoeba distributed operating system group at CWI. We needed a better way to do system administration than by writing either C programs or Bourne shell scripts, since Amoeba had its own system call interface which wasn't easily accessible from the Bourne shell. My experience with error handling in Amoeba made me acutely aware of the importance of exceptions as a programming language feature." +#: ../../faq/general.rst:86 +msgid "" +"I was working in the Amoeba distributed operating system group at CWI. We " +"needed a better way to do system administration than by writing either C " +"programs or Bourne shell scripts, since Amoeba had its own system call " +"interface which wasn't easily accessible from the Bourne shell. My " +"experience with error handling in Amoeba made me acutely aware of the " +"importance of exceptions as a programming language feature." msgstr "" -msgid "It occurred to me that a scripting language with a syntax like ABC but with access to the Amoeba system calls would fill the need. I realized that it would be foolish to write an Amoeba-specific language, so I decided that I needed a language that was generally extensible." +#: ../../faq/general.rst:93 +msgid "" +"It occurred to me that a scripting language with a syntax like ABC but with " +"access to the Amoeba system calls would fill the need. I realized that it " +"would be foolish to write an Amoeba-specific language, so I decided that I " +"needed a language that was generally extensible." msgstr "" -msgid "During the 1989 Christmas holidays, I had a lot of time on my hand, so I decided to give it a try. During the next year, while still mostly working on it in my own time, Python was used in the Amoeba project with increasing success, and the feedback from colleagues made me add many early improvements." +#: ../../faq/general.rst:98 +msgid "" +"During the 1989 Christmas holidays, I had a lot of time on my hand, so I " +"decided to give it a try. During the next year, while still mostly working " +"on it in my own time, Python was used in the Amoeba project with increasing " +"success, and the feedback from colleagues made me add many early " +"improvements." msgstr "" -msgid "In February 1991, after just over a year of development, I decided to post to USENET. The rest is in the ``Misc/HISTORY`` file." +#: ../../faq/general.rst:104 +msgid "" +"In February 1991, after just over a year of development, I decided to post " +"to USENET. The rest is in the ``Misc/HISTORY`` file." msgstr "" +#: ../../faq/general.rst:109 msgid "What is Python good for?" msgstr "" -msgid "Python is a high-level general-purpose programming language that can be applied to many different classes of problems." -msgstr "" - -msgid "The language comes with a large standard library that covers areas such as string processing (regular expressions, Unicode, calculating differences between files), internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP), software engineering (unit testing, logging, profiling, parsing Python code), and operating system interfaces (system calls, filesystems, TCP/IP sockets). Look at the table of contents for :ref:`library-index` to get an idea of what's available. A wide variety of third-party extensions are also available. Consult `the Python Package Index `_ to find packages of interest to you." +#: ../../faq/general.rst:111 +msgid "" +"Python is a high-level general-purpose programming language that can be " +"applied to many different classes of problems." msgstr "" +#: ../../faq/general.rst:114 +msgid "" +"The language comes with a large standard library that covers areas such as " +"string processing (regular expressions, Unicode, calculating differences " +"between files), internet protocols (HTTP, FTP, SMTP, XML-RPC, POP, IMAP), " +"software engineering (unit testing, logging, profiling, parsing Python " +"code), and operating system interfaces (system calls, filesystems, TCP/IP " +"sockets). Look at the table of contents for :ref:`library-index` to get an " +"idea of what's available. A wide variety of third-party extensions are also " +"available. Consult `the Python Package Index `_ to find " +"packages of interest to you." +msgstr "" + +#: ../../faq/general.rst:128 msgid "How does the Python version numbering scheme work?" msgstr "" +#: ../../faq/general.rst:130 msgid "Python versions are numbered \"A.B.C\" or \"A.B\":" msgstr "" -msgid "*A* is the major version number -- it is only incremented for really major changes in the language." +#: ../../faq/general.rst:132 +msgid "" +"*A* is the major version number -- it is only incremented for really major " +"changes in the language." msgstr "" -msgid "*B* is the minor version number -- it is incremented for less earth-shattering changes." +#: ../../faq/general.rst:134 +msgid "" +"*B* is the minor version number -- it is incremented for less earth-" +"shattering changes." msgstr "" -msgid "*C* is the micro version number -- it is incremented for each bugfix release." +#: ../../faq/general.rst:136 +msgid "" +"*C* is the micro version number -- it is incremented for each bugfix release." msgstr "" -msgid "Not all releases are bugfix releases. In the run-up to a new feature release, a series of development releases are made, denoted as alpha, beta, or release candidate. Alphas are early releases in which interfaces aren't yet finalized; it's not unexpected to see an interface change between two alpha releases. Betas are more stable, preserving existing interfaces but possibly adding new modules, and release candidates are frozen, making no changes except as needed to fix critical bugs." +#: ../../faq/general.rst:138 +msgid "" +"Not all releases are bugfix releases. In the run-up to a new feature " +"release, a series of development releases are made, denoted as alpha, beta, " +"or release candidate. Alphas are early releases in which interfaces aren't " +"yet finalized; it's not unexpected to see an interface change between two " +"alpha releases. Betas are more stable, preserving existing interfaces but " +"possibly adding new modules, and release candidates are frozen, making no " +"changes except as needed to fix critical bugs." msgstr "" +#: ../../faq/general.rst:146 msgid "Alpha, beta and release candidate versions have an additional suffix:" msgstr "" +#: ../../faq/general.rst:148 msgid "The suffix for an alpha version is \"aN\" for some small number *N*." msgstr "" +#: ../../faq/general.rst:149 msgid "The suffix for a beta version is \"bN\" for some small number *N*." msgstr "" -msgid "The suffix for a release candidate version is \"rcN\" for some small number *N*." +#: ../../faq/general.rst:150 +msgid "" +"The suffix for a release candidate version is \"rcN\" for some small number " +"*N*." msgstr "" -msgid "In other words, all versions labeled *2.0aN* precede the versions labeled *2.0bN*, which precede versions labeled *2.0rcN*, and *those* precede 2.0." +#: ../../faq/general.rst:152 +msgid "" +"In other words, all versions labeled *2.0aN* precede the versions labeled " +"*2.0bN*, which precede versions labeled *2.0rcN*, and *those* precede 2.0." msgstr "" -msgid "You may also find version numbers with a \"+\" suffix, e.g. \"2.2+\". These are unreleased versions, built directly from the CPython development repository. In practice, after a final minor release is made, the version is incremented to the next minor version, which becomes the \"a0\" version, e.g. \"2.4a0\"." +#: ../../faq/general.rst:155 +msgid "" +"You may also find version numbers with a \"+\" suffix, e.g. \"2.2+\". These " +"are unreleased versions, built directly from the CPython development " +"repository. In practice, after a final minor release is made, the version " +"is incremented to the next minor version, which becomes the \"a0\" version, " +"e.g. \"2.4a0\"." msgstr "" -msgid "See the `Developer's Guide `__ for more information about the development cycle, and :pep:`387` to learn more about Python's backward compatibility policy. See also the documentation for :data:`sys.version`, :data:`sys.hexversion`, and :data:`sys.version_info`." +#: ../../faq/general.rst:160 +msgid "" +"See the `Developer's Guide `__ for more information about the development cycle, " +"and :pep:`387` to learn more about Python's backward compatibility policy. " +"See also the documentation for :data:`sys.version`, :data:`sys.hexversion`, " +"and :data:`sys.version_info`." msgstr "" +#: ../../faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" msgstr "" -msgid "The latest Python source distribution is always available from python.org, at https://www.python.org/downloads/. The latest development sources can be obtained at https://github.com/python/cpython/." +#: ../../faq/general.rst:171 +msgid "" +"The latest Python source distribution is always available from python.org, " +"at https://www.python.org/downloads/. The latest development sources can be " +"obtained at https://github.com/python/cpython/." msgstr "" -msgid "The source distribution is a gzipped tar file containing the complete C source, Sphinx-formatted documentation, Python library modules, example programs, and several useful pieces of freely distributable software. The source will compile and run out of the box on most UNIX platforms." +#: ../../faq/general.rst:175 +msgid "" +"The source distribution is a gzipped tar file containing the complete C " +"source, Sphinx-formatted documentation, Python library modules, example " +"programs, and several useful pieces of freely distributable software. The " +"source will compile and run out of the box on most UNIX platforms." msgstr "" -msgid "Consult the `Getting Started section of the Python Developer's Guide `__ for more information on getting the source code and compiling it." +#: ../../faq/general.rst:180 +msgid "" +"Consult the `Getting Started section of the Python Developer's Guide " +"`__ for more information on getting the " +"source code and compiling it." msgstr "" +#: ../../faq/general.rst:186 msgid "How do I get documentation on Python?" msgstr "" -msgid "The standard documentation for the current stable version of Python is available at https://docs.python.org/3/. EPUB, plain text, and downloadable HTML versions are also available at https://docs.python.org/3/download.html." +#: ../../faq/general.rst:188 +msgid "" +"The standard documentation for the current stable version of Python is " +"available at https://docs.python.org/3/. EPUB, plain text, and downloadable " +"HTML versions are also available at https://docs.python.org/3/download.html." msgstr "" -msgid "The documentation is written in reStructuredText and processed by `the Sphinx documentation tool `__. The reStructuredText source for the documentation is part of the Python source distribution." +#: ../../faq/general.rst:192 +msgid "" +"The documentation is written in reStructuredText and processed by `the " +"Sphinx documentation tool `__. The " +"reStructuredText source for the documentation is part of the Python source " +"distribution." msgstr "" +#: ../../faq/general.rst:198 msgid "I've never programmed before. Is there a Python tutorial?" msgstr "" -msgid "There are numerous tutorials and books available. The standard documentation includes :ref:`tutorial-index`." +#: ../../faq/general.rst:200 +msgid "" +"There are numerous tutorials and books available. The standard " +"documentation includes :ref:`tutorial-index`." msgstr "" -msgid "Consult `the Beginner's Guide `_ to find information for beginning Python programmers, including lists of tutorials." +#: ../../faq/general.rst:203 +msgid "" +"Consult `the Beginner's Guide `_ to find information for beginning Python programmers, " +"including lists of tutorials." msgstr "" +#: ../../faq/general.rst:208 msgid "Is there a newsgroup or mailing list devoted to Python?" msgstr "" -msgid "There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, `python-list `_. The newsgroup and mailing list are gatewayed into each other -- if you can read news it's unnecessary to subscribe to the mailing list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of postings every day, and Usenet readers are often more able to cope with this volume." +#: ../../faq/general.rst:210 +msgid "" +"There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, " +"`python-list `_. The " +"newsgroup and mailing list are gatewayed into each other -- if you can read " +"news it's unnecessary to subscribe to the mailing " +"list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of " +"postings every day, and Usenet readers are often more able to cope with this " +"volume." msgstr "" -msgid "Announcements of new software releases and events can be found in comp.lang.python.announce, a low-traffic moderated list that receives about five postings per day. It's available as `the python-announce mailing list `_." +#: ../../faq/general.rst:217 +msgid "" +"Announcements of new software releases and events can be found in " +"comp.lang.python.announce, a low-traffic moderated list that receives about " +"five postings per day. It's available as `the python-announce mailing list " +"`_." msgstr "" -msgid "More info about other mailing lists and newsgroups can be found at https://www.python.org/community/lists/." +#: ../../faq/general.rst:222 +msgid "" +"More info about other mailing lists and newsgroups can be found at https://" +"www.python.org/community/lists/." msgstr "" +#: ../../faq/general.rst:227 msgid "How do I get a beta test version of Python?" msgstr "" -msgid "Alpha and beta releases are available from https://www.python.org/downloads/. All releases are announced on the comp.lang.python and comp.lang.python.announce newsgroups and on the Python home page at https://www.python.org/; an RSS feed of news is available." +#: ../../faq/general.rst:229 +msgid "" +"Alpha and beta releases are available from https://www.python.org/" +"downloads/. All releases are announced on the comp.lang.python and " +"comp.lang.python.announce newsgroups and on the Python home page at https://" +"www.python.org/; an RSS feed of news is available." msgstr "" -msgid "You can also access the development version of Python through Git. See `The Python Developer's Guide `_ for details." +#: ../../faq/general.rst:234 +msgid "" +"You can also access the development version of Python through Git. See `The " +"Python Developer's Guide `_ for details." msgstr "" +#: ../../faq/general.rst:239 msgid "How do I submit bug reports and patches for Python?" msgstr "" -msgid "To report a bug or submit a patch, use the issue tracker at https://github.com/python/cpython/issues." +#: ../../faq/general.rst:241 +msgid "" +"To report a bug or submit a patch, use the issue tracker at https://" +"github.com/python/cpython/issues." msgstr "" -msgid "For more information on how Python is developed, consult `the Python Developer's Guide `_." +#: ../../faq/general.rst:244 +msgid "" +"For more information on how Python is developed, consult `the Python " +"Developer's Guide `_." msgstr "" +#: ../../faq/general.rst:249 msgid "Are there any published articles about Python that I can reference?" msgstr "" +#: ../../faq/general.rst:251 msgid "It's probably best to cite your favorite book about Python." msgstr "" -msgid "The `very first article `_ about Python was written in 1991 and is now quite outdated." +#: ../../faq/general.rst:253 +msgid "" +"The `very first article `_ about Python was " +"written in 1991 and is now quite outdated." msgstr "" -msgid "Guido van Rossum and Jelke de Boer, \"Interactively Testing Remote Servers Using the Python Programming Language\", CWI Quarterly, Volume 4, Issue 4 (December 1991), Amsterdam, pp 283--303." +#: ../../faq/general.rst:256 +msgid "" +"Guido van Rossum and Jelke de Boer, \"Interactively Testing Remote Servers " +"Using the Python Programming Language\", CWI Quarterly, Volume 4, Issue 4 " +"(December 1991), Amsterdam, pp 283--303." msgstr "" +#: ../../faq/general.rst:262 msgid "Are there any books on Python?" msgstr "" -msgid "Yes, there are many, and more are being published. See the python.org wiki at https://wiki.python.org/moin/PythonBooks for a list." +#: ../../faq/general.rst:264 +msgid "" +"Yes, there are many, and more are being published. See the python.org wiki " +"at https://wiki.python.org/moin/PythonBooks for a list." msgstr "" -msgid "You can also search online bookstores for \"Python\" and filter out the Monty Python references; or perhaps search for \"Python\" and \"language\"." +#: ../../faq/general.rst:267 +msgid "" +"You can also search online bookstores for \"Python\" and filter out the " +"Monty Python references; or perhaps search for \"Python\" and \"language\"." msgstr "" +#: ../../faq/general.rst:272 msgid "Where in the world is www.python.org located?" msgstr "" -msgid "The Python project's infrastructure is located all over the world and is managed by the Python Infrastructure Team. Details `here `__." +#: ../../faq/general.rst:274 +msgid "" +"The Python project's infrastructure is located all over the world and is " +"managed by the Python Infrastructure Team. Details `here `__." msgstr "" +#: ../../faq/general.rst:279 msgid "Why is it called Python?" msgstr "" -msgid "When he began implementing Python, Guido van Rossum was also reading the published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. Van Rossum thought he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python." +#: ../../faq/general.rst:281 +msgid "" +"When he began implementing Python, Guido van Rossum was also reading the " +"published scripts from `\"Monty Python's Flying Circus\" `__, a BBC comedy series from the 1970s. " +"Van Rossum thought he needed a name that was short, unique, and slightly " +"mysterious, so he decided to call the language Python." msgstr "" +#: ../../faq/general.rst:289 msgid "Do I have to like \"Monty Python's Flying Circus\"?" msgstr "" +#: ../../faq/general.rst:291 msgid "No, but it helps. :)" msgstr "" +#: ../../faq/general.rst:295 msgid "Python in the real world" msgstr "" +#: ../../faq/general.rst:298 msgid "How stable is Python?" msgstr "" -msgid "Very stable. New, stable releases have been coming out roughly every 6 to 18 months since 1991, and this seems likely to continue. As of version 3.9, Python will have a new feature release every 12 months (:pep:`602`)." +#: ../../faq/general.rst:300 +msgid "" +"Very stable. New, stable releases have been coming out roughly every 6 to " +"18 months since 1991, and this seems likely to continue. As of version 3.9, " +"Python will have a new feature release every 12 months (:pep:`602`)." msgstr "" -msgid "The developers issue bugfix releases of older versions, so the stability of existing releases gradually improves. Bugfix releases, indicated by a third component of the version number (e.g. 3.5.3, 3.6.2), are managed for stability; only fixes for known problems are included in a bugfix release, and it's guaranteed that interfaces will remain the same throughout a series of bugfix releases." +#: ../../faq/general.rst:304 +msgid "" +"The developers issue bugfix releases of older versions, so the stability of " +"existing releases gradually improves. Bugfix releases, indicated by a third " +"component of the version number (e.g. 3.5.3, 3.6.2), are managed for " +"stability; only fixes for known problems are included in a bugfix release, " +"and it's guaranteed that interfaces will remain the same throughout a series " +"of bugfix releases." msgstr "" -msgid "The latest stable releases can always be found on the `Python download page `_. Python 3.x is the recommended version and supported by most widely used libraries. Python 2.x :pep:`is not maintained anymore <373>`." +#: ../../faq/general.rst:311 +msgid "" +"The latest stable releases can always be found on the `Python download page " +"`_. Python 3.x is the recommended version " +"and supported by most widely used libraries. Python 2.x :pep:`is not " +"maintained anymore <373>`." msgstr "" +#: ../../faq/general.rst:317 msgid "How many people are using Python?" msgstr "" -msgid "There are probably millions of users, though it's difficult to obtain an exact count." +#: ../../faq/general.rst:319 +msgid "" +"There are probably millions of users, though it's difficult to obtain an " +"exact count." msgstr "" -msgid "Python is available for free download, so there are no sales figures, and it's available from many different sites and packaged with many Linux distributions, so download statistics don't tell the whole story either." +#: ../../faq/general.rst:322 +msgid "" +"Python is available for free download, so there are no sales figures, and " +"it's available from many different sites and packaged with many Linux " +"distributions, so download statistics don't tell the whole story either." msgstr "" -msgid "The comp.lang.python newsgroup is very active, but not all Python users post to the group or even read it." +#: ../../faq/general.rst:326 +msgid "" +"The comp.lang.python newsgroup is very active, but not all Python users post " +"to the group or even read it." msgstr "" +#: ../../faq/general.rst:331 msgid "Have any significant projects been done in Python?" msgstr "" -msgid "See https://www.python.org/about/success for a list of projects that use Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many different companies and organizations." +#: ../../faq/general.rst:333 +msgid "" +"See https://www.python.org/about/success for a list of projects that use " +"Python. Consulting the proceedings for `past Python conferences `_ will reveal contributions from many " +"different companies and organizations." msgstr "" -msgid "High-profile Python projects include `the Mailman mailing list manager `_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat `_, have written part or all of their installer and system administration software in Python. Companies that use Python internally include Google, Yahoo, and Lucasfilm Ltd." +#: ../../faq/general.rst:338 +msgid "" +"High-profile Python projects include `the Mailman mailing list manager " +"`_ and `the Zope application server `_. Several Linux distributions, most notably `Red Hat " +"`_, have written part or all of their installer and " +"system administration software in Python. Companies that use Python " +"internally include Google, Yahoo, and Lucasfilm Ltd." msgstr "" +#: ../../faq/general.rst:347 msgid "What new developments are expected for Python in the future?" msgstr "" -msgid "See https://peps.python.org/ for the Python Enhancement Proposals (PEPs). PEPs are design documents describing a suggested new feature for Python, providing a concise technical specification and a rationale. Look for a PEP titled \"Python X.Y Release Schedule\", where X.Y is a version that hasn't been publicly released yet." +#: ../../faq/general.rst:349 +msgid "" +"See https://peps.python.org/ for the Python Enhancement Proposals (PEPs). " +"PEPs are design documents describing a suggested new feature for Python, " +"providing a concise technical specification and a rationale. Look for a PEP " +"titled \"Python X.Y Release Schedule\", where X.Y is a version that hasn't " +"been publicly released yet." msgstr "" -msgid "New development is discussed on `the python-dev mailing list `_." +#: ../../faq/general.rst:355 +msgid "" +"New development is discussed on `the python-dev mailing list `_." msgstr "" +#: ../../faq/general.rst:360 msgid "Is it reasonable to propose incompatible changes to Python?" msgstr "" -msgid "In general, no. There are already millions of lines of Python code around the world, so any change in the language that invalidates more than a very small fraction of existing programs has to be frowned upon. Even if you can provide a conversion program, there's still the problem of updating all documentation; many books have been written about Python, and we don't want to invalidate them all at a single stroke." +#: ../../faq/general.rst:362 +msgid "" +"In general, no. There are already millions of lines of Python code around " +"the world, so any change in the language that invalidates more than a very " +"small fraction of existing programs has to be frowned upon. Even if you can " +"provide a conversion program, there's still the problem of updating all " +"documentation; many books have been written about Python, and we don't want " +"to invalidate them all at a single stroke." msgstr "" -msgid "Providing a gradual upgrade path is necessary if a feature has to be changed. :pep:`5` describes the procedure followed for introducing backward-incompatible changes while minimizing disruption for users." +#: ../../faq/general.rst:369 +msgid "" +"Providing a gradual upgrade path is necessary if a feature has to be " +"changed. :pep:`5` describes the procedure followed for introducing backward-" +"incompatible changes while minimizing disruption for users." msgstr "" +#: ../../faq/general.rst:375 msgid "Is Python a good language for beginning programmers?" msgstr "" +#: ../../faq/general.rst:377 msgid "Yes." msgstr "" -msgid "It is still common to start students with a procedural and statically typed language such as Pascal, C, or a subset of C++ or Java. Students may be better served by learning Python as their first language. Python has a very simple and consistent syntax and a large standard library and, most importantly, using Python in a beginning programming course lets students concentrate on important programming skills such as problem decomposition and data type design. With Python, students can be quickly introduced to basic concepts such as loops and procedures. They can probably even work with user-defined objects in their very first course." -msgstr "" - -msgid "For a student who has never programmed before, using a statically typed language seems unnatural. It presents additional complexity that the student must master and slows the pace of the course. The students are trying to learn to think like a computer, decompose problems, design consistent interfaces, and encapsulate data. While learning to use a statically typed language is important in the long term, it is not necessarily the best topic to address in the students' first programming course." -msgstr "" - -msgid "Many other aspects of Python make it a good first language. Like Java, Python has a large standard library so that students can be assigned programming projects very early in the course that *do* something. Assignments aren't restricted to the standard four-function calculator and check balancing programs. By using the standard library, students can gain the satisfaction of working on realistic applications as they learn the fundamentals of programming. Using the standard library also teaches students about code reuse. Third-party modules such as PyGame are also helpful in extending the students' reach." +#: ../../faq/general.rst:379 +msgid "" +"It is still common to start students with a procedural and statically typed " +"language such as Pascal, C, or a subset of C++ or Java. Students may be " +"better served by learning Python as their first language. Python has a very " +"simple and consistent syntax and a large standard library and, most " +"importantly, using Python in a beginning programming course lets students " +"concentrate on important programming skills such as problem decomposition " +"and data type design. With Python, students can be quickly introduced to " +"basic concepts such as loops and procedures. They can probably even work " +"with user-defined objects in their very first course." +msgstr "" + +#: ../../faq/general.rst:389 +msgid "" +"For a student who has never programmed before, using a statically typed " +"language seems unnatural. It presents additional complexity that the " +"student must master and slows the pace of the course. The students are " +"trying to learn to think like a computer, decompose problems, design " +"consistent interfaces, and encapsulate data. While learning to use a " +"statically typed language is important in the long term, it is not " +"necessarily the best topic to address in the students' first programming " +"course." msgstr "" -msgid "Python's interactive interpreter enables students to test language features while they're programming. They can keep a window with the interpreter running while they enter their program's source in another window. If they can't remember the methods for a list, they can do something like this::" +#: ../../faq/general.rst:397 +msgid "" +"Many other aspects of Python make it a good first language. Like Java, " +"Python has a large standard library so that students can be assigned " +"programming projects very early in the course that *do* something. " +"Assignments aren't restricted to the standard four-function calculator and " +"check balancing programs. By using the standard library, students can gain " +"the satisfaction of working on realistic applications as they learn the " +"fundamentals of programming. Using the standard library also teaches " +"students about code reuse. Third-party modules such as PyGame are also " +"helpful in extending the students' reach." +msgstr "" + +#: ../../faq/general.rst:406 +msgid "" +"Python's interactive interpreter enables students to test language features " +"while they're programming. They can keep a window with the interpreter " +"running while they enter their program's source in another window. If they " +"can't remember the methods for a list, they can do something like this::" msgstr "" +#: ../../faq/general.rst:411 msgid "" ">>> L = []\n" ">>> dir(L)\n" @@ -319,7 +653,8 @@ msgid "" "'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',\n" "'reverse', 'sort']\n" ">>> [d for d in dir(L) if '__' not in d]\n" -"['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']\n" +"['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', " +"'remove', 'reverse', 'sort']\n" "\n" ">>> help(L.append)\n" "Help on built-in function append:\n" @@ -332,11 +667,26 @@ msgid "" "[1]" msgstr "" -msgid "With the interpreter, documentation is never far from the student as they are programming." +#: ../../faq/general.rst:435 +msgid "" +"With the interpreter, documentation is never far from the student as they " +"are programming." msgstr "" -msgid "There are also good IDEs for Python. IDLE is a cross-platform IDE for Python that is written in Python using Tkinter. Emacs users will be happy to know that there is a very good Python mode for Emacs. All of these programming environments provide syntax highlighting, auto-indenting, and access to the interactive interpreter while coding. Consult `the Python wiki `_ for a full list of Python editing environments." +#: ../../faq/general.rst:438 +msgid "" +"There are also good IDEs for Python. IDLE is a cross-platform IDE for " +"Python that is written in Python using Tkinter. Emacs users will be happy to " +"know that there is a very good Python mode for Emacs. All of these " +"programming environments provide syntax highlighting, auto-indenting, and " +"access to the interactive interpreter while coding. Consult `the Python " +"wiki `_ for a full list of " +"Python editing environments." msgstr "" -msgid "If you want to discuss Python's use in education, you may be interested in joining `the edu-sig mailing list `_." +#: ../../faq/general.rst:446 +msgid "" +"If you want to discuss Python's use in education, you may be interested in " +"joining `the edu-sig mailing list `_." msgstr "" diff --git a/faq/gui.po b/faq/gui.po index 77f99862d..be62d7997 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,50 +24,98 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/gui.rst:5 msgid "Graphic User Interface FAQ" msgstr "" +#: ../../faq/gui.rst:8 msgid "Contents" msgstr "" +#: ../../faq/gui.rst:15 msgid "General GUI Questions" msgstr "" +#: ../../faq/gui.rst:18 msgid "What GUI toolkits exist for Python?" msgstr "" -msgid "Standard builds of Python include an object-oriented interface to the Tcl/Tk widget set, called :ref:`tkinter `. This is probably the easiest to install (since it comes included with most `binary distributions `_ of Python) and use. For more info about Tk, including pointers to the source, see the `Tcl/Tk home page `_. Tcl/Tk is fully portable to the macOS, Windows, and Unix platforms." +#: ../../faq/gui.rst:20 +msgid "" +"Standard builds of Python include an object-oriented interface to the Tcl/Tk " +"widget set, called :ref:`tkinter `. This is probably the easiest " +"to install (since it comes included with most `binary distributions `_ of Python) and use. For more info about Tk, " +"including pointers to the source, see the `Tcl/Tk home page `_. Tcl/Tk is fully portable to the macOS, Windows, and Unix " +"platforms." msgstr "" -msgid "Depending on what platform(s) you are aiming at, there are also several alternatives. A `list of cross-platform `_ and `platform-specific `_ GUI frameworks can be found on the python wiki." +#: ../../faq/gui.rst:28 +msgid "" +"Depending on what platform(s) you are aiming at, there are also several " +"alternatives. A `list of cross-platform `_ and `platform-specific `_ GUI " +"frameworks can be found on the python wiki." msgstr "" +#: ../../faq/gui.rst:36 msgid "Tkinter questions" msgstr "" +#: ../../faq/gui.rst:39 msgid "How do I freeze Tkinter applications?" msgstr "" -msgid "Freeze is a tool to create stand-alone applications. When freezing Tkinter applications, the applications will not be truly stand-alone, as the application will still need the Tcl and Tk libraries." +#: ../../faq/gui.rst:41 +msgid "" +"Freeze is a tool to create stand-alone applications. When freezing Tkinter " +"applications, the applications will not be truly stand-alone, as the " +"application will still need the Tcl and Tk libraries." msgstr "" -msgid "One solution is to ship the application with the Tcl and Tk libraries, and point to them at run-time using the :envvar:`!TCL_LIBRARY` and :envvar:`!TK_LIBRARY` environment variables." +#: ../../faq/gui.rst:45 +msgid "" +"One solution is to ship the application with the Tcl and Tk libraries, and " +"point to them at run-time using the :envvar:`!TCL_LIBRARY` and :envvar:`!" +"TK_LIBRARY` environment variables." msgstr "" -msgid "Various third-party freeze libraries such as py2exe and cx_Freeze have handling for Tkinter applications built-in." +#: ../../faq/gui.rst:49 +msgid "" +"Various third-party freeze libraries such as py2exe and cx_Freeze have " +"handling for Tkinter applications built-in." msgstr "" +#: ../../faq/gui.rst:54 msgid "Can I have Tk events handled while waiting for I/O?" msgstr "" -msgid "On platforms other than Windows, yes, and you don't even need threads! But you'll have to restructure your I/O code a bit. Tk has the equivalent of Xt's :c:func:`!XtAddInput` call, which allows you to register a callback function which will be called from the Tk mainloop when I/O is possible on a file descriptor. See :ref:`tkinter-file-handlers`." +#: ../../faq/gui.rst:56 +msgid "" +"On platforms other than Windows, yes, and you don't even need threads! But " +"you'll have to restructure your I/O code a bit. Tk has the equivalent of " +"Xt's :c:func:`!XtAddInput` call, which allows you to register a callback " +"function which will be called from the Tk mainloop when I/O is possible on a " +"file descriptor. See :ref:`tkinter-file-handlers`." msgstr "" +#: ../../faq/gui.rst:64 msgid "I can't get key bindings to work in Tkinter: why?" msgstr "" -msgid "An often-heard complaint is that event handlers :ref:`bound ` to events with the :meth:`!bind` method don't get handled even when the appropriate key is pressed." +#: ../../faq/gui.rst:66 +msgid "" +"An often-heard complaint is that event handlers :ref:`bound ` to events with the :meth:`!bind` method don't get handled even when " +"the appropriate key is pressed." msgstr "" -msgid "The most common cause is that the widget to which the binding applies doesn't have \"keyboard focus\". Check out the Tk documentation for the focus command. Usually a widget is given the keyboard focus by clicking in it (but not for labels; see the takefocus option)." +#: ../../faq/gui.rst:70 +msgid "" +"The most common cause is that the widget to which the binding applies " +"doesn't have \"keyboard focus\". Check out the Tk documentation for the " +"focus command. Usually a widget is given the keyboard focus by clicking in " +"it (but not for labels; see the takefocus option)." msgstr "" diff --git a/faq/index.po b/faq/index.po index ea9de2d61..c571ab2f4 100644 --- a/faq/index.po +++ b/faq/index.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-17 04:35+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,5 +21,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/index.rst:5 msgid "Python Frequently Asked Questions" msgstr "" diff --git a/faq/installed.po b/faq/installed.po index 30294b31b..b6d512ab7 100644 --- a/faq/installed.po +++ b/faq/installed.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,47 +23,93 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/installed.rst:3 msgid "\"Why is Python Installed on my Computer?\" FAQ" msgstr "" +#: ../../faq/installed.rst:6 msgid "What is Python?" msgstr "" -msgid "Python is a programming language. It's used for many different applications. It's used in some high schools and colleges as an introductory programming language because Python is easy to learn, but it's also used by professional software developers at places such as Google, NASA, and Lucasfilm Ltd." +#: ../../faq/installed.rst:8 +msgid "" +"Python is a programming language. It's used for many different " +"applications. It's used in some high schools and colleges as an introductory " +"programming language because Python is easy to learn, but it's also used by " +"professional software developers at places such as Google, NASA, and " +"Lucasfilm Ltd." msgstr "" -msgid "If you wish to learn more about Python, start with the `Beginner's Guide to Python `_." +#: ../../faq/installed.rst:13 +msgid "" +"If you wish to learn more about Python, start with the `Beginner's Guide to " +"Python `_." msgstr "" +#: ../../faq/installed.rst:18 msgid "Why is Python installed on my machine?" msgstr "" -msgid "If you find Python installed on your system but don't remember installing it, there are several possible ways it could have gotten there." +#: ../../faq/installed.rst:20 +msgid "" +"If you find Python installed on your system but don't remember installing " +"it, there are several possible ways it could have gotten there." msgstr "" -msgid "Perhaps another user on the computer wanted to learn programming and installed it; you'll have to figure out who's been using the machine and might have installed it." +#: ../../faq/installed.rst:23 +msgid "" +"Perhaps another user on the computer wanted to learn programming and " +"installed it; you'll have to figure out who's been using the machine and " +"might have installed it." msgstr "" -msgid "A third-party application installed on the machine might have been written in Python and included a Python installation. There are many such applications, from GUI programs to network servers and administrative scripts." +#: ../../faq/installed.rst:26 +msgid "" +"A third-party application installed on the machine might have been written " +"in Python and included a Python installation. There are many such " +"applications, from GUI programs to network servers and administrative " +"scripts." msgstr "" -msgid "Some Windows machines also have Python installed. At this writing we're aware of computers from Hewlett-Packard and Compaq that include Python. Apparently some of HP/Compaq's administrative tools are written in Python." +#: ../../faq/installed.rst:29 +msgid "" +"Some Windows machines also have Python installed. At this writing we're " +"aware of computers from Hewlett-Packard and Compaq that include Python. " +"Apparently some of HP/Compaq's administrative tools are written in Python." msgstr "" -msgid "Many Unix-compatible operating systems, such as macOS and some Linux distributions, have Python installed by default; it's included in the base installation." +#: ../../faq/installed.rst:32 +msgid "" +"Many Unix-compatible operating systems, such as macOS and some Linux " +"distributions, have Python installed by default; it's included in the base " +"installation." msgstr "" +#: ../../faq/installed.rst:38 msgid "Can I delete Python?" msgstr "" +#: ../../faq/installed.rst:40 msgid "That depends on where Python came from." msgstr "" -msgid "If someone installed it deliberately, you can remove it without hurting anything. On Windows, use the Add/Remove Programs icon in the Control Panel." +#: ../../faq/installed.rst:42 +msgid "" +"If someone installed it deliberately, you can remove it without hurting " +"anything. On Windows, use the Add/Remove Programs icon in the Control Panel." msgstr "" -msgid "If Python was installed by a third-party application, you can also remove it, but that application will no longer work. You should use that application's uninstaller rather than removing Python directly." +#: ../../faq/installed.rst:45 +msgid "" +"If Python was installed by a third-party application, you can also remove " +"it, but that application will no longer work. You should use that " +"application's uninstaller rather than removing Python directly." msgstr "" -msgid "If Python came with your operating system, removing it is not recommended. If you remove it, whatever tools were written in Python will no longer run, and some of them might be important to you. Reinstalling the whole system would then be required to fix things again." +#: ../../faq/installed.rst:49 +msgid "" +"If Python came with your operating system, removing it is not recommended. " +"If you remove it, whatever tools were written in Python will no longer run, " +"and some of them might be important to you. Reinstalling the whole system " +"would then be required to fix things again." msgstr "" diff --git a/faq/library.po b/faq/library.po index 5491709be..a90c483b3 100644 --- a/faq/library.po +++ b/faq/library.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,77 +24,135 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/library.rst:5 msgid "Library and Extension FAQ" msgstr "" +#: ../../faq/library.rst:8 msgid "Contents" msgstr "" +#: ../../faq/library.rst:12 msgid "General Library Questions" msgstr "" +#: ../../faq/library.rst:15 msgid "How do I find a module or application to perform task X?" msgstr "" -msgid "Check :ref:`the Library Reference ` to see if there's a relevant standard library module. (Eventually you'll learn what's in the standard library and will be able to skip this step.)" +#: ../../faq/library.rst:17 +msgid "" +"Check :ref:`the Library Reference ` to see if there's a " +"relevant standard library module. (Eventually you'll learn what's in the " +"standard library and will be able to skip this step.)" msgstr "" -msgid "For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search engine. Searching for \"Python\" plus a keyword or two for your topic of interest will usually find something helpful." +#: ../../faq/library.rst:21 +msgid "" +"For third-party packages, search the `Python Package Index `_ or try `Google `_ or another web search " +"engine. Searching for \"Python\" plus a keyword or two for your topic of " +"interest will usually find something helpful." msgstr "" +#: ../../faq/library.rst:28 msgid "Where is the math.py (socket.py, regex.py, etc.) source file?" msgstr "" -msgid "If you can't find a source file for a module it may be a built-in or dynamically loaded module implemented in C, C++ or other compiled language. In this case you may not have the source file or it may be something like :file:`mathmodule.c`, somewhere in a C source directory (not on the Python Path)." +#: ../../faq/library.rst:30 +msgid "" +"If you can't find a source file for a module it may be a built-in or " +"dynamically loaded module implemented in C, C++ or other compiled language. " +"In this case you may not have the source file or it may be something " +"like :file:`mathmodule.c`, somewhere in a C source directory (not on the " +"Python Path)." msgstr "" +#: ../../faq/library.rst:35 msgid "There are (at least) three kinds of modules in Python:" msgstr "" +#: ../../faq/library.rst:37 msgid "modules written in Python (.py);" msgstr "" -msgid "modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc);" +#: ../../faq/library.rst:38 +msgid "" +"modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc);" msgstr "" -msgid "modules written in C and linked with the interpreter; to get a list of these, type::" +#: ../../faq/library.rst:39 +msgid "" +"modules written in C and linked with the interpreter; to get a list of " +"these, type::" msgstr "" +#: ../../faq/library.rst:42 msgid "" "import sys\n" "print(sys.builtin_module_names)" msgstr "" +#: ../../faq/library.rst:47 msgid "How do I make a Python script executable on Unix?" msgstr "" -msgid "You need to do two things: the script file's mode must be executable and the first line must begin with ``#!`` followed by the path of the Python interpreter." +#: ../../faq/library.rst:49 +msgid "" +"You need to do two things: the script file's mode must be executable and the " +"first line must begin with ``#!`` followed by the path of the Python " +"interpreter." msgstr "" -msgid "The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod 755 scriptfile``." +#: ../../faq/library.rst:53 +msgid "" +"The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod " +"755 scriptfile``." msgstr "" -msgid "The second can be done in a number of ways. The most straightforward way is to write ::" +#: ../../faq/library.rst:56 +msgid "" +"The second can be done in a number of ways. The most straightforward way is " +"to write ::" msgstr "" +#: ../../faq/library.rst:59 msgid "#!/usr/local/bin/python" msgstr "" -msgid "as the very first line of your file, using the pathname for where the Python interpreter is installed on your platform." +#: ../../faq/library.rst:61 +msgid "" +"as the very first line of your file, using the pathname for where the Python " +"interpreter is installed on your platform." msgstr "" -msgid "If you would like the script to be independent of where the Python interpreter lives, you can use the :program:`env` program. Almost all Unix variants support the following, assuming the Python interpreter is in a directory on the user's :envvar:`PATH`::" +#: ../../faq/library.rst:64 +msgid "" +"If you would like the script to be independent of where the Python " +"interpreter lives, you can use the :program:`env` program. Almost all Unix " +"variants support the following, assuming the Python interpreter is in a " +"directory on the user's :envvar:`PATH`::" msgstr "" +#: ../../faq/library.rst:69 msgid "#!/usr/bin/env python" msgstr "" -msgid "*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI scripts is often very minimal, so you need to use the actual absolute pathname of the interpreter." +#: ../../faq/library.rst:71 +msgid "" +"*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI " +"scripts is often very minimal, so you need to use the actual absolute " +"pathname of the interpreter." msgstr "" -msgid "Occasionally, a user's environment is so full that the :program:`/usr/bin/env` program fails; or there's no env program at all. In that case, you can try the following hack (due to Alex Rezinsky):" +#: ../../faq/library.rst:75 +msgid "" +"Occasionally, a user's environment is so full that the :program:`/usr/bin/" +"env` program fails; or there's no env program at all. In that case, you can " +"try the following hack (due to Alex Rezinsky):" msgstr "" +#: ../../faq/library.rst:79 msgid "" "#! /bin/sh\n" "\"\"\":\"\n" @@ -102,114 +160,203 @@ msgid "" "\"\"\"" msgstr "" -msgid "The minor disadvantage is that this defines the script's __doc__ string. However, you can fix that by adding ::" +#: ../../faq/library.rst:86 +msgid "" +"The minor disadvantage is that this defines the script's __doc__ string. " +"However, you can fix that by adding ::" msgstr "" +#: ../../faq/library.rst:89 msgid "__doc__ = \"\"\"...Whatever...\"\"\"" msgstr "" +#: ../../faq/library.rst:94 msgid "Is there a curses/termcap package for Python?" msgstr "" -msgid "For Unix variants: The standard Python source distribution comes with a curses module in the :source:`Modules` subdirectory, though it's not compiled by default. (Note that this is not available in the Windows distribution -- there is no curses module for Windows.)" +#: ../../faq/library.rst:98 +msgid "" +"For Unix variants: The standard Python source distribution comes with a " +"curses module in the :source:`Modules` subdirectory, though it's not " +"compiled by default. (Note that this is not available in the Windows " +"distribution -- there is no curses module for Windows.)" msgstr "" -msgid "The :mod:`curses` module supports basic curses features as well as many additional functions from ncurses and SYSV curses such as colour, alternative character set support, pads, and mouse support. This means the module isn't compatible with operating systems that only have BSD curses, but there don't seem to be any currently maintained OSes that fall into this category." +#: ../../faq/library.rst:103 +msgid "" +"The :mod:`curses` module supports basic curses features as well as many " +"additional functions from ncurses and SYSV curses such as colour, " +"alternative character set support, pads, and mouse support. This means the " +"module isn't compatible with operating systems that only have BSD curses, " +"but there don't seem to be any currently maintained OSes that fall into this " +"category." msgstr "" +#: ../../faq/library.rst:111 msgid "Is there an equivalent to C's onexit() in Python?" msgstr "" -msgid "The :mod:`atexit` module provides a register function that is similar to C's :c:func:`!onexit`." +#: ../../faq/library.rst:113 +msgid "" +"The :mod:`atexit` module provides a register function that is similar to " +"C's :c:func:`!onexit`." msgstr "" +#: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" msgstr "" -msgid "The most common problem is that the signal handler is declared with the wrong argument list. It is called as ::" +#: ../../faq/library.rst:120 +msgid "" +"The most common problem is that the signal handler is declared with the " +"wrong argument list. It is called as ::" msgstr "" +#: ../../faq/library.rst:123 msgid "handler(signum, frame)" msgstr "" +#: ../../faq/library.rst:125 msgid "so it should be declared with two parameters::" msgstr "" +#: ../../faq/library.rst:127 msgid "" "def handler(signum, frame):\n" " ..." msgstr "" +#: ../../faq/library.rst:132 msgid "Common tasks" msgstr "" +#: ../../faq/library.rst:135 msgid "How do I test a Python program or component?" msgstr "" -msgid "Python comes with two testing frameworks. The :mod:`doctest` module finds examples in the docstrings for a module and runs them, comparing the output with the expected output given in the docstring." +#: ../../faq/library.rst:137 +msgid "" +"Python comes with two testing frameworks. The :mod:`doctest` module finds " +"examples in the docstrings for a module and runs them, comparing the output " +"with the expected output given in the docstring." msgstr "" -msgid "The :mod:`unittest` module is a fancier testing framework modelled on Java and Smalltalk testing frameworks." +#: ../../faq/library.rst:141 +msgid "" +"The :mod:`unittest` module is a fancier testing framework modelled on Java " +"and Smalltalk testing frameworks." msgstr "" -msgid "To make testing easier, you should use good modular design in your program. Your program should have almost all functionality encapsulated in either functions or class methods -- and this sometimes has the surprising and delightful effect of making the program run faster (because local variable accesses are faster than global accesses). Furthermore the program should avoid depending on mutating global variables, since this makes testing much more difficult to do." +#: ../../faq/library.rst:144 +msgid "" +"To make testing easier, you should use good modular design in your program. " +"Your program should have almost all functionality encapsulated in either " +"functions or class methods -- and this sometimes has the surprising and " +"delightful effect of making the program run faster (because local variable " +"accesses are faster than global accesses). Furthermore the program should " +"avoid depending on mutating global variables, since this makes testing much " +"more difficult to do." msgstr "" +#: ../../faq/library.rst:152 msgid "The \"global main logic\" of your program may be as simple as ::" msgstr "" +#: ../../faq/library.rst:154 msgid "" "if __name__ == \"__main__\":\n" " main_logic()" msgstr "" +#: ../../faq/library.rst:157 msgid "at the bottom of the main module of your program." msgstr "" -msgid "Once your program is organized as a tractable collection of function and class behaviours, you should write test functions that exercise the behaviours. A test suite that automates a sequence of tests can be associated with each module. This sounds like a lot of work, but since Python is so terse and flexible it's surprisingly easy. You can make coding much more pleasant and fun by writing your test functions in parallel with the \"production code\", since this makes it easy to find bugs and even design flaws earlier." +#: ../../faq/library.rst:159 +msgid "" +"Once your program is organized as a tractable collection of function and " +"class behaviours, you should write test functions that exercise the " +"behaviours. A test suite that automates a sequence of tests can be " +"associated with each module. This sounds like a lot of work, but since " +"Python is so terse and flexible it's surprisingly easy. You can make coding " +"much more pleasant and fun by writing your test functions in parallel with " +"the \"production code\", since this makes it easy to find bugs and even " +"design flaws earlier." msgstr "" -msgid "\"Support modules\" that are not intended to be the main module of a program may include a self-test of the module. ::" +#: ../../faq/library.rst:167 +msgid "" +"\"Support modules\" that are not intended to be the main module of a program " +"may include a self-test of the module. ::" msgstr "" +#: ../../faq/library.rst:170 msgid "" "if __name__ == \"__main__\":\n" " self_test()" msgstr "" -msgid "Even programs that interact with complex external interfaces may be tested when the external interfaces are unavailable by using \"fake\" interfaces implemented in Python." +#: ../../faq/library.rst:173 +msgid "" +"Even programs that interact with complex external interfaces may be tested " +"when the external interfaces are unavailable by using \"fake\" interfaces " +"implemented in Python." msgstr "" +#: ../../faq/library.rst:179 msgid "How do I create documentation from doc strings?" msgstr "" -msgid "The :mod:`pydoc` module can create HTML from the doc strings in your Python source code. An alternative for creating API documentation purely from docstrings is `epydoc `_. `Sphinx `_ can also include docstring content." +#: ../../faq/library.rst:181 +msgid "" +"The :mod:`pydoc` module can create HTML from the doc strings in your Python " +"source code. An alternative for creating API documentation purely from " +"docstrings is `epydoc `_. `Sphinx `_ can also include docstring content." msgstr "" +#: ../../faq/library.rst:188 msgid "How do I get a single keypress at a time?" msgstr "" -msgid "For Unix variants there are several solutions. It's straightforward to do this using curses, but curses is a fairly large module to learn." +#: ../../faq/library.rst:190 +msgid "" +"For Unix variants there are several solutions. It's straightforward to do " +"this using curses, but curses is a fairly large module to learn." msgstr "" +#: ../../faq/library.rst:234 msgid "Threads" msgstr "" +#: ../../faq/library.rst:237 msgid "How do I program using threads?" msgstr "" -msgid "Be sure to use the :mod:`threading` module and not the :mod:`_thread` module. The :mod:`threading` module builds convenient abstractions on top of the low-level primitives provided by the :mod:`_thread` module." +#: ../../faq/library.rst:239 +msgid "" +"Be sure to use the :mod:`threading` module and not the :mod:`_thread` " +"module. The :mod:`threading` module builds convenient abstractions on top of " +"the low-level primitives provided by the :mod:`_thread` module." msgstr "" +#: ../../faq/library.rst:245 msgid "None of my threads seem to run: why?" msgstr "" -msgid "As soon as the main thread exits, all threads are killed. Your main thread is running too quickly, giving the threads no time to do any work." +#: ../../faq/library.rst:247 +msgid "" +"As soon as the main thread exits, all threads are killed. Your main thread " +"is running too quickly, giving the threads no time to do any work." msgstr "" -msgid "A simple fix is to add a sleep to the end of the program that's long enough for all the threads to finish::" +#: ../../faq/library.rst:250 +msgid "" +"A simple fix is to add a sleep to the end of the program that's long enough " +"for all the threads to finish::" msgstr "" +#: ../../faq/library.rst:253 msgid "" "import threading, time\n" "\n" @@ -224,12 +371,18 @@ msgid "" "time.sleep(10) # <---------------------------!" msgstr "" -msgid "But now (on many platforms) the threads don't run in parallel, but appear to run sequentially, one at a time! The reason is that the OS thread scheduler doesn't start a new thread until the previous thread is blocked." +#: ../../faq/library.rst:265 +msgid "" +"But now (on many platforms) the threads don't run in parallel, but appear to " +"run sequentially, one at a time! The reason is that the OS thread scheduler " +"doesn't start a new thread until the previous thread is blocked." msgstr "" +#: ../../faq/library.rst:269 msgid "A simple fix is to add a tiny sleep to the start of the run function::" msgstr "" +#: ../../faq/library.rst:271 msgid "" "def thread_task(name, n):\n" " time.sleep(0.001) # <--------------------!\n" @@ -243,21 +396,40 @@ msgid "" "time.sleep(10)" msgstr "" -msgid "Instead of trying to guess a good delay value for :func:`time.sleep`, it's better to use some kind of semaphore mechanism. One idea is to use the :mod:`queue` module to create a queue object, let each thread append a token to the queue when it finishes, and let the main thread read as many tokens from the queue as there are threads." +#: ../../faq/library.rst:282 +msgid "" +"Instead of trying to guess a good delay value for :func:`time.sleep`, it's " +"better to use some kind of semaphore mechanism. One idea is to use " +"the :mod:`queue` module to create a queue object, let each thread append a " +"token to the queue when it finishes, and let the main thread read as many " +"tokens from the queue as there are threads." msgstr "" +#: ../../faq/library.rst:290 msgid "How do I parcel out work among a bunch of worker threads?" msgstr "" -msgid "The easiest way is to use the :mod:`concurrent.futures` module, especially the :mod:`~concurrent.futures.ThreadPoolExecutor` class." +#: ../../faq/library.rst:292 +msgid "" +"The easiest way is to use the :mod:`concurrent.futures` module, especially " +"the :mod:`~concurrent.futures.ThreadPoolExecutor` class." msgstr "" -msgid "Or, if you want fine control over the dispatching algorithm, you can write your own logic manually. Use the :mod:`queue` module to create a queue containing a list of jobs. The :class:`~queue.Queue` class maintains a list of objects and has a ``.put(obj)`` method that adds items to the queue and a ``.get()`` method to return them. The class will take care of the locking necessary to ensure that each job is handed out exactly once." +#: ../../faq/library.rst:295 +msgid "" +"Or, if you want fine control over the dispatching algorithm, you can write " +"your own logic manually. Use the :mod:`queue` module to create a queue " +"containing a list of jobs. The :class:`~queue.Queue` class maintains a list " +"of objects and has a ``.put(obj)`` method that adds items to the queue and a " +"``.get()`` method to return them. The class will take care of the locking " +"necessary to ensure that each job is handed out exactly once." msgstr "" +#: ../../faq/library.rst:302 msgid "Here's a trivial example::" msgstr "" +#: ../../faq/library.rst:304 msgid "" "import threading, queue, time\n" "\n" @@ -296,9 +468,11 @@ msgid "" "time.sleep(5)" msgstr "" +#: ../../faq/library.rst:340 msgid "When run, this will produce the following output:" msgstr "" +#: ../../faq/library.rst:342 msgid "" "Running worker\n" "Running worker\n" @@ -315,21 +489,41 @@ msgid "" "..." msgstr "" -msgid "Consult the module's documentation for more details; the :class:`~queue.Queue` class provides a featureful interface." +#: ../../faq/library.rst:358 +msgid "" +"Consult the module's documentation for more details; " +"the :class:`~queue.Queue` class provides a featureful interface." msgstr "" +#: ../../faq/library.rst:363 msgid "What kinds of global value mutation are thread-safe?" msgstr "" -msgid "A :term:`global interpreter lock` (GIL) is used internally to ensure that only one thread runs in the Python VM at a time. In general, Python offers to switch among threads only between bytecode instructions; how frequently it switches can be set via :func:`sys.setswitchinterval`. Each bytecode instruction and therefore all the C implementation code reached from each instruction is therefore atomic from the point of view of a Python program." +#: ../../faq/library.rst:365 +msgid "" +"A :term:`global interpreter lock` (GIL) is used internally to ensure that " +"only one thread runs in the Python VM at a time. In general, Python offers " +"to switch among threads only between bytecode instructions; how frequently " +"it switches can be set via :func:`sys.setswitchinterval`. Each bytecode " +"instruction and therefore all the C implementation code reached from each " +"instruction is therefore atomic from the point of view of a Python program." msgstr "" -msgid "In theory, this means an exact accounting requires an exact understanding of the PVM bytecode implementation. In practice, it means that operations on shared variables of built-in data types (ints, lists, dicts, etc) that \"look atomic\" really are." +#: ../../faq/library.rst:372 +msgid "" +"In theory, this means an exact accounting requires an exact understanding of " +"the PVM bytecode implementation. In practice, it means that operations on " +"shared variables of built-in data types (ints, lists, dicts, etc) that " +"\"look atomic\" really are." msgstr "" -msgid "For example, the following operations are all atomic (L, L1, L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints)::" +#: ../../faq/library.rst:377 +msgid "" +"For example, the following operations are all atomic (L, L1, L2 are lists, " +"D, D1, D2 are dicts, x, y are objects, i, j are ints)::" msgstr "" +#: ../../faq/library.rst:380 msgid "" "L.append(x)\n" "L1.extend(L2)\n" @@ -344,9 +538,11 @@ msgid "" "D.keys()" msgstr "" +#: ../../faq/library.rst:392 msgid "These aren't::" msgstr "" +#: ../../faq/library.rst:394 msgid "" "i = i+1\n" "L.append(L[-1])\n" @@ -354,66 +550,161 @@ msgid "" "D[x] = D[x] + 1" msgstr "" -msgid "Operations that replace other objects may invoke those other objects' :meth:`~object.__del__` method when their reference count reaches zero, and that can affect things. This is especially true for the mass updates to dictionaries and lists. When in doubt, use a mutex!" +#: ../../faq/library.rst:399 +msgid "" +"Operations that replace other objects may invoke those other " +"objects' :meth:`~object.__del__` method when their reference count reaches " +"zero, and that can affect things. This is especially true for the mass " +"updates to dictionaries and lists. When in doubt, use a mutex!" msgstr "" +#: ../../faq/library.rst:406 msgid "Can't we get rid of the Global Interpreter Lock?" msgstr "" -msgid "The :term:`global interpreter lock` (GIL) is often seen as a hindrance to Python's deployment on high-end multiprocessor server machines, because a multi-threaded Python program effectively only uses one CPU, due to the insistence that (almost) all Python code can only run while the GIL is held." -msgstr "" - -msgid "With the approval of :pep:`703` work is now underway to remove the GIL from the CPython implementation of Python. Initially it will be implemented as an optional compiler flag when building the interpreter, and so separate builds will be available with and without the GIL. Long-term, the hope is to settle on a single build, once the performance implications of removing the GIL are fully understood. Python 3.13 is likely to be the first release containing this work, although it may not be completely functional in this release." +#: ../../faq/library.rst:408 +msgid "" +"The :term:`global interpreter lock` (GIL) is often seen as a hindrance to " +"Python's deployment on high-end multiprocessor server machines, because a " +"multi-threaded Python program effectively only uses one CPU, due to the " +"insistence that (almost) all Python code can only run while the GIL is held." msgstr "" -msgid "The current work to remove the GIL is based on a `fork of Python 3.9 with the GIL removed `_ by Sam Gross. Prior to that, in the days of Python 1.5, Greg Stein actually implemented a comprehensive patch set (the \"free threading\" patches) that removed the GIL and replaced it with fine-grained locking. Adam Olsen did a similar experiment in his `python-safethread `_ project. Unfortunately, both of these earlier experiments exhibited a sharp drop in single-thread performance (at least 30% slower), due to the amount of fine-grained locking necessary to compensate for the removal of the GIL. The Python 3.9 fork is the first attempt at removing the GIL with an acceptable performance impact." +#: ../../faq/library.rst:413 +msgid "" +"With the approval of :pep:`703` work is now underway to remove the GIL from " +"the CPython implementation of Python. Initially it will be implemented as " +"an optional compiler flag when building the interpreter, and so separate " +"builds will be available with and without the GIL. Long-term, the hope is " +"to settle on a single build, once the performance implications of removing " +"the GIL are fully understood. Python 3.13 is likely to be the first release " +"containing this work, although it may not be completely functional in this " +"release." msgstr "" -msgid "The presence of the GIL in current Python releases doesn't mean that you can't make good use of Python on multi-CPU machines! You just have to be creative with dividing the work up between multiple *processes* rather than multiple *threads*. The :class:`~concurrent.futures.ProcessPoolExecutor` class in the new :mod:`concurrent.futures` module provides an easy way of doing so; the :mod:`multiprocessing` module provides a lower-level API in case you want more control over dispatching of tasks." +#: ../../faq/library.rst:422 +msgid "" +"The current work to remove the GIL is based on a `fork of Python 3.9 with " +"the GIL removed `_ by Sam Gross. Prior " +"to that, in the days of Python 1.5, Greg Stein actually implemented a " +"comprehensive patch set (the \"free threading\" patches) that removed the " +"GIL and replaced it with fine-grained locking. Adam Olsen did a similar " +"experiment in his `python-safethread `_ project. Unfortunately, both of these earlier " +"experiments exhibited a sharp drop in single-thread performance (at least " +"30% slower), due to the amount of fine-grained locking necessary to " +"compensate for the removal of the GIL. The Python 3.9 fork is the first " +"attempt at removing the GIL with an acceptable performance impact." +msgstr "" + +#: ../../faq/library.rst:437 +msgid "" +"The presence of the GIL in current Python releases doesn't mean that you " +"can't make good use of Python on multi-CPU machines! You just have to be " +"creative with dividing the work up between multiple *processes* rather than " +"multiple *threads*. The :class:`~concurrent.futures.ProcessPoolExecutor` " +"class in the new :mod:`concurrent.futures` module provides an easy way of " +"doing so; the :mod:`multiprocessing` module provides a lower-level API in " +"case you want more control over dispatching of tasks." msgstr "" -msgid "Judicious use of C extensions will also help; if you use a C extension to perform a time-consuming task, the extension can release the GIL while the thread of execution is in the C code and allow other threads to get some work done. Some standard library modules such as :mod:`zlib` and :mod:`hashlib` already do this." +#: ../../faq/library.rst:446 +msgid "" +"Judicious use of C extensions will also help; if you use a C extension to " +"perform a time-consuming task, the extension can release the GIL while the " +"thread of execution is in the C code and allow other threads to get some " +"work done. Some standard library modules such as :mod:`zlib` " +"and :mod:`hashlib` already do this." msgstr "" -msgid "An alternative approach to reducing the impact of the GIL is to make the GIL a per-interpreter-state lock rather than truly global. This was :ref:`first implemented in Python 3.12 ` and is available in the C API. A Python interface to it is expected in Python 3.13. The main limitation to it at the moment is likely to be 3rd party extension modules, since these must be written with multiple interpreters in mind in order to be usable, so many older extension modules will not be usable." +#: ../../faq/library.rst:452 +msgid "" +"An alternative approach to reducing the impact of the GIL is to make the GIL " +"a per-interpreter-state lock rather than truly global. This was :ref:`first " +"implemented in Python 3.12 ` and is available in the C " +"API. A Python interface to it is expected in Python 3.13. The main " +"limitation to it at the moment is likely to be 3rd party extension modules, " +"since these must be written with multiple interpreters in mind in order to " +"be usable, so many older extension modules will not be usable." msgstr "" +#: ../../faq/library.rst:462 msgid "Input and Output" msgstr "" +#: ../../faq/library.rst:465 msgid "How do I delete a file? (And other file questions...)" msgstr "" -msgid "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, see the :mod:`os` module. The two functions are identical; :func:`~os.unlink` is simply the name of the Unix system call for this function." +#: ../../faq/library.rst:467 +msgid "" +"Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " +"see the :mod:`os` module. The two functions are " +"identical; :func:`~os.unlink` is simply the name of the Unix system call for " +"this function." msgstr "" -msgid "To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create one. ``os.makedirs(path)`` will create any intermediate directories in ``path`` that don't exist. ``os.removedirs(path)`` will remove intermediate directories as long as they're empty; if you want to delete an entire directory tree and its contents, use :func:`shutil.rmtree`." +#: ../../faq/library.rst:471 +msgid "" +"To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create " +"one. ``os.makedirs(path)`` will create any intermediate directories in " +"``path`` that don't exist. ``os.removedirs(path)`` will remove intermediate " +"directories as long as they're empty; if you want to delete an entire " +"directory tree and its contents, use :func:`shutil.rmtree`." msgstr "" +#: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." msgstr "" -msgid "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use ``f.truncate(offset)``; offset defaults to the current seek position. There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os.open`, where *fd* is the file descriptor (a small integer)." +#: ../../faq/library.rst:479 +msgid "" +"To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " +"``f.truncate(offset)``; offset defaults to the current seek position. " +"There's also ``os.ftruncate(fd, offset)`` for files opened " +"with :func:`os.open`, where *fd* is the file descriptor (a small integer)." msgstr "" -msgid "The :mod:`shutil` module also contains a number of functions to work on files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and :func:`~shutil.rmtree`." +#: ../../faq/library.rst:484 +msgid "" +"The :mod:`shutil` module also contains a number of functions to work on " +"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, " +"and :func:`~shutil.rmtree`." msgstr "" +#: ../../faq/library.rst:490 msgid "How do I copy a file?" msgstr "" -msgid "The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note that on Windows NTFS volumes, it does not copy `alternate data streams `_ nor `resource forks `__ on macOS HFS+ volumes, though both are now rarely used. It also doesn't copy file permissions and metadata, though using :func:`shutil.copy2` instead will preserve most (though not all) of it." +#: ../../faq/library.rst:492 +msgid "" +"The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note " +"that on Windows NTFS volumes, it does not copy `alternate data streams " +"`_ nor " +"`resource forks `__ on macOS " +"HFS+ volumes, though both are now rarely used. It also doesn't copy file " +"permissions and metadata, though using :func:`shutil.copy2` instead will " +"preserve most (though not all) of it." msgstr "" +#: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" msgstr "" -msgid "To read or write complex binary data formats, it's best to use the :mod:`struct` module. It allows you to take a string containing binary data (usually numbers) and convert it to Python objects; and vice versa." +#: ../../faq/library.rst:505 +msgid "" +"To read or write complex binary data formats, it's best to use " +"the :mod:`struct` module. It allows you to take a string containing binary " +"data (usually numbers) and convert it to Python objects; and vice versa." msgstr "" -msgid "For example, the following code reads two 2-byte integers and one 4-byte integer in big-endian format from a file::" +#: ../../faq/library.rst:509 +msgid "" +"For example, the following code reads two 2-byte integers and one 4-byte " +"integer in big-endian format from a file::" msgstr "" +#: ../../faq/library.rst:512 msgid "" "import struct\n" "\n" @@ -422,87 +713,151 @@ msgid "" " x, y, z = struct.unpack(\">hhl\", s)" msgstr "" -msgid "The '>' in the format string forces big-endian data; the letter 'h' reads one \"short integer\" (2 bytes), and 'l' reads one \"long integer\" (4 bytes) from the string." +#: ../../faq/library.rst:518 +msgid "" +"The '>' in the format string forces big-endian data; the letter 'h' reads " +"one \"short integer\" (2 bytes), and 'l' reads one \"long integer\" (4 " +"bytes) from the string." msgstr "" -msgid "For data that is more regular (e.g. a homogeneous list of ints or floats), you can also use the :mod:`array` module." +#: ../../faq/library.rst:522 +msgid "" +"For data that is more regular (e.g. a homogeneous list of ints or floats), " +"you can also use the :mod:`array` module." msgstr "" -msgid "To read and write binary data, it is mandatory to open the file in binary mode (here, passing ``\"rb\"`` to :func:`open`). If you use ``\"r\"`` instead (the default), the file will be open in text mode and ``f.read()`` will return :class:`str` objects rather than :class:`bytes` objects." +#: ../../faq/library.rst:527 +msgid "" +"To read and write binary data, it is mandatory to open the file in binary " +"mode (here, passing ``\"rb\"`` to :func:`open`). If you use ``\"r\"`` " +"instead (the default), the file will be open in text mode and ``f.read()`` " +"will return :class:`str` objects rather than :class:`bytes` objects." msgstr "" +#: ../../faq/library.rst:535 msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" msgstr "" -msgid ":func:`os.read` is a low-level function which takes a file descriptor, a small integer representing the opened file. :func:`os.popen` creates a high-level file object, the same type returned by the built-in :func:`open` function. Thus, to read *n* bytes from a pipe *p* created with :func:`os.popen`, you need to use ``p.read(n)``." +#: ../../faq/library.rst:537 +msgid "" +":func:`os.read` is a low-level function which takes a file descriptor, a " +"small integer representing the opened file. :func:`os.popen` creates a high-" +"level file object, the same type returned by the built-in :func:`open` " +"function. Thus, to read *n* bytes from a pipe *p* created " +"with :func:`os.popen`, you need to use ``p.read(n)``." msgstr "" +#: ../../faq/library.rst:545 msgid "How do I access the serial (RS232) port?" msgstr "" +#: ../../faq/library.rst:547 msgid "For Win32, OSX, Linux, BSD, Jython, IronPython:" msgstr "" +#: ../../faq/library.rst:549 msgid ":pypi:`pyserial`" msgstr "" +#: ../../faq/library.rst:551 msgid "For Unix, see a Usenet post by Mitch Chapman:" msgstr "" +#: ../../faq/library.rst:553 msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" msgstr "" +#: ../../faq/library.rst:557 msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?" msgstr "" -msgid "Python :term:`file objects ` are a high-level layer of abstraction on low-level C file descriptors." +#: ../../faq/library.rst:559 +msgid "" +"Python :term:`file objects ` are a high-level layer of " +"abstraction on low-level C file descriptors." msgstr "" -msgid "For most file objects you create in Python via the built-in :func:`open` function, ``f.close()`` marks the Python file object as being closed from Python's point of view, and also arranges to close the underlying C file descriptor. This also happens automatically in ``f``'s destructor, when ``f`` becomes garbage." +#: ../../faq/library.rst:562 +msgid "" +"For most file objects you create in Python via the built-in :func:`open` " +"function, ``f.close()`` marks the Python file object as being closed from " +"Python's point of view, and also arranges to close the underlying C file " +"descriptor. This also happens automatically in ``f``'s destructor, when " +"``f`` becomes garbage." msgstr "" -msgid "But stdin, stdout and stderr are treated specially by Python, because of the special status also given to them by C. Running ``sys.stdout.close()`` marks the Python-level file object as being closed, but does *not* close the associated C file descriptor." +#: ../../faq/library.rst:568 +msgid "" +"But stdin, stdout and stderr are treated specially by Python, because of the " +"special status also given to them by C. Running ``sys.stdout.close()`` " +"marks the Python-level file object as being closed, but does *not* close the " +"associated C file descriptor." msgstr "" -msgid "To close the underlying C file descriptor for one of these three, you should first be sure that's what you really want to do (e.g., you may confuse extension modules trying to do I/O). If it is, use :func:`os.close`::" +#: ../../faq/library.rst:573 +msgid "" +"To close the underlying C file descriptor for one of these three, you should " +"first be sure that's what you really want to do (e.g., you may confuse " +"extension modules trying to do I/O). If it is, use :func:`os.close`::" msgstr "" +#: ../../faq/library.rst:577 msgid "" "os.close(stdin.fileno())\n" "os.close(stdout.fileno())\n" "os.close(stderr.fileno())" msgstr "" +#: ../../faq/library.rst:581 msgid "Or you can use the numeric constants 0, 1 and 2, respectively." msgstr "" +#: ../../faq/library.rst:585 msgid "Network/Internet Programming" msgstr "" +#: ../../faq/library.rst:588 msgid "What WWW tools are there for Python?" msgstr "" -msgid "See the chapters titled :ref:`internet` and :ref:`netdata` in the Library Reference Manual. Python has many modules that will help you build server-side and client-side web systems." +#: ../../faq/library.rst:590 +msgid "" +"See the chapters titled :ref:`internet` and :ref:`netdata` in the Library " +"Reference Manual. Python has many modules that will help you build server-" +"side and client-side web systems." msgstr "" -msgid "A summary of available frameworks is maintained by Paul Boddie at https://wiki.python.org/moin/WebProgramming\\ ." +#: ../../faq/library.rst:596 +msgid "" +"A summary of available frameworks is maintained by Paul Boddie at https://" +"wiki.python.org/moin/WebProgramming\\ ." msgstr "" +#: ../../faq/library.rst:601 msgid "What module should I use to help with generating HTML?" msgstr "" -msgid "You can find a collection of useful links on the `Web Programming wiki page `_." +#: ../../faq/library.rst:605 +msgid "" +"You can find a collection of useful links on the `Web Programming wiki page " +"`_." msgstr "" +#: ../../faq/library.rst:610 msgid "How do I send mail from a Python script?" msgstr "" +#: ../../faq/library.rst:612 msgid "Use the standard library module :mod:`smtplib`." msgstr "" -msgid "Here's a very simple interactive mail sender that uses it. This method will work on any host that supports an SMTP listener. ::" +#: ../../faq/library.rst:614 +msgid "" +"Here's a very simple interactive mail sender that uses it. This method will " +"work on any host that supports an SMTP listener. ::" msgstr "" +#: ../../faq/library.rst:617 msgid "" "import sys, smtplib\n" "\n" @@ -522,9 +877,15 @@ msgid "" "server.quit()" msgstr "" -msgid "A Unix-only alternative uses sendmail. The location of the sendmail program varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/usr/sbin/sendmail``. The sendmail manual page will help you out. Here's some sample code::" +#: ../../faq/library.rst:634 +msgid "" +"A Unix-only alternative uses sendmail. The location of the sendmail program " +"varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/" +"usr/sbin/sendmail``. The sendmail manual page will help you out. Here's " +"some sample code::" msgstr "" +#: ../../faq/library.rst:639 msgid "" "import os\n" "\n" @@ -540,79 +901,139 @@ msgid "" " print(\"Sendmail exit status\", sts)" msgstr "" +#: ../../faq/library.rst:654 msgid "How do I avoid blocking in the connect() method of a socket?" msgstr "" -msgid "The :mod:`select` module is commonly used to help with asynchronous I/O on sockets." +#: ../../faq/library.rst:656 +msgid "" +"The :mod:`select` module is commonly used to help with asynchronous I/O on " +"sockets." msgstr "" -msgid "To prevent the TCP connect from blocking, you can set the socket to non-blocking mode. Then when you do the :meth:`~socket.socket.connect`, you will either connect immediately (unlikely) or get an exception that contains the error number as ``.errno``. ``errno.EINPROGRESS`` indicates that the connection is in progress, but hasn't finished yet. Different OSes will return different values, so you're going to have to check what's returned on your system." +#: ../../faq/library.rst:659 +msgid "" +"To prevent the TCP connect from blocking, you can set the socket to non-" +"blocking mode. Then when you do the :meth:`~socket.socket.connect`, you " +"will either connect immediately (unlikely) or get an exception that contains " +"the error number as ``.errno``. ``errno.EINPROGRESS`` indicates that the " +"connection is in progress, but hasn't finished yet. Different OSes will " +"return different values, so you're going to have to check what's returned on " +"your system." msgstr "" -msgid "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating an exception. It will just return the errno value. To poll, you can call :meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` indicate that you're connected -- or you can pass this socket to :meth:`select.select` to check if it's writable." +#: ../../faq/library.rst:667 +msgid "" +"You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " +"an exception. It will just return the errno value. To poll, you can " +"call :meth:`~socket.socket.connect_ex` again later -- ``0`` or " +"``errno.EISCONN`` indicate that you're connected -- or you can pass this " +"socket to :meth:`select.select` to check if it's writable." msgstr "" -msgid "The :mod:`asyncio` module provides a general purpose single-threaded and concurrent asynchronous library, which can be used for writing non-blocking network code. The third-party `Twisted `_ library is a popular and feature-rich alternative." +#: ../../faq/library.rst:675 +msgid "" +"The :mod:`asyncio` module provides a general purpose single-threaded and " +"concurrent asynchronous library, which can be used for writing non-blocking " +"network code. The third-party `Twisted `_ library is a " +"popular and feature-rich alternative." msgstr "" +#: ../../faq/library.rst:683 msgid "Databases" msgstr "" +#: ../../faq/library.rst:686 msgid "Are there any interfaces to database packages in Python?" msgstr "" +#: ../../faq/library.rst:688 msgid "Yes." msgstr "" -msgid "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM ` are also included with standard Python. There is also the :mod:`sqlite3` module, which provides a lightweight disk-based relational database." +#: ../../faq/library.rst:690 +msgid "" +"Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " +"` are also included with standard Python. There is also " +"the :mod:`sqlite3` module, which provides a lightweight disk-based " +"relational database." msgstr "" -msgid "Support for most relational databases is available. See the `DatabaseProgramming wiki page `_ for details." +#: ../../faq/library.rst:695 +msgid "" +"Support for most relational databases is available. See the " +"`DatabaseProgramming wiki page `_ for details." msgstr "" +#: ../../faq/library.rst:701 msgid "How do you implement persistent objects in Python?" msgstr "" -msgid "The :mod:`pickle` library module solves this in a very general way (though you still can't store things like open files, sockets or windows), and the :mod:`shelve` library module uses pickle and (g)dbm to create persistent mappings containing arbitrary Python objects." +#: ../../faq/library.rst:703 +msgid "" +"The :mod:`pickle` library module solves this in a very general way (though " +"you still can't store things like open files, sockets or windows), and " +"the :mod:`shelve` library module uses pickle and (g)dbm to create persistent " +"mappings containing arbitrary Python objects." msgstr "" +#: ../../faq/library.rst:710 msgid "Mathematics and Numerics" msgstr "" +#: ../../faq/library.rst:713 msgid "How do I generate random numbers in Python?" msgstr "" -msgid "The standard module :mod:`random` implements a random number generator. Usage is simple::" +#: ../../faq/library.rst:715 +msgid "" +"The standard module :mod:`random` implements a random number generator. " +"Usage is simple::" msgstr "" +#: ../../faq/library.rst:718 msgid "" "import random\n" "random.random()" msgstr "" +#: ../../faq/library.rst:721 msgid "This returns a random floating-point number in the range [0, 1)." msgstr "" -msgid "There are also many other specialized generators in this module, such as:" +#: ../../faq/library.rst:723 +msgid "" +"There are also many other specialized generators in this module, such as:" msgstr "" +#: ../../faq/library.rst:725 msgid "``randrange(a, b)`` chooses an integer in the range [a, b)." msgstr "" +#: ../../faq/library.rst:726 msgid "``uniform(a, b)`` chooses a floating-point number in the range [a, b)." msgstr "" -msgid "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." +#: ../../faq/library.rst:727 +msgid "" +"``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." msgstr "" +#: ../../faq/library.rst:729 msgid "Some higher-level functions operate on sequences directly, such as:" msgstr "" +#: ../../faq/library.rst:731 msgid "``choice(S)`` chooses a random element from a given sequence." msgstr "" +#: ../../faq/library.rst:732 msgid "``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly." msgstr "" -msgid "There's also a ``Random`` class you can instantiate to create independent multiple random number generators." +#: ../../faq/library.rst:734 +msgid "" +"There's also a ``Random`` class you can instantiate to create independent " +"multiple random number generators." msgstr "" diff --git a/faq/programming.po b/faq/programming.po index 280d6b119..18c71bee3 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,153 +24,292 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/programming.rst:5 msgid "Programming FAQ" msgstr "" +#: ../../faq/programming.rst:8 msgid "Contents" msgstr "" +#: ../../faq/programming.rst:12 msgid "General questions" msgstr "" -msgid "Is there a source code-level debugger with breakpoints and single-stepping?" +#: ../../faq/programming.rst:15 +msgid "" +"Is there a source code-level debugger with breakpoints and single-stepping?" msgstr "" +#: ../../faq/programming.rst:17 ../../faq/programming.rst:56 msgid "Yes." msgstr "" -msgid "Several debuggers for Python are described below, and the built-in function :func:`breakpoint` allows you to drop into any of them." +#: ../../faq/programming.rst:19 +msgid "" +"Several debuggers for Python are described below, and the built-in " +"function :func:`breakpoint` allows you to drop into any of them." msgstr "" -msgid "The pdb module is a simple but adequate console-mode debugger for Python. It is part of the standard Python library, and is :mod:`documented in the Library Reference Manual `. You can also write your own debugger by using the code for pdb as an example." +#: ../../faq/programming.rst:22 +msgid "" +"The pdb module is a simple but adequate console-mode debugger for Python. It " +"is part of the standard Python library, and is :mod:`documented in the " +"Library Reference Manual `. You can also write your own debugger by " +"using the code for pdb as an example." msgstr "" -msgid "The IDLE interactive development environment, which is part of the standard Python distribution (normally available as :mod:`idlelib`), includes a graphical debugger." +#: ../../faq/programming.rst:27 +msgid "" +"The IDLE interactive development environment, which is part of the standard " +"Python distribution (normally available as :mod:`idlelib`), includes a " +"graphical debugger." msgstr "" -msgid "PythonWin is a Python IDE that includes a GUI debugger based on pdb. The PythonWin debugger colors breakpoints and has quite a few cool features such as debugging non-PythonWin programs. PythonWin is available as part of `pywin32 `_ project and as a part of the `ActivePython `_ distribution." +#: ../../faq/programming.rst:31 +msgid "" +"PythonWin is a Python IDE that includes a GUI debugger based on pdb. The " +"PythonWin debugger colors breakpoints and has quite a few cool features such " +"as debugging non-PythonWin programs. PythonWin is available as part of " +"`pywin32 `_ project and as a part of " +"the `ActivePython `_ " +"distribution." msgstr "" -msgid "`Eric `_ is an IDE built on PyQt and the Scintilla editing component." +#: ../../faq/programming.rst:38 +msgid "" +"`Eric `_ is an IDE built on PyQt and " +"the Scintilla editing component." msgstr "" -msgid "`trepan3k `_ is a gdb-like debugger." +#: ../../faq/programming.rst:41 +msgid "" +"`trepan3k `_ is a gdb-like " +"debugger." msgstr "" -msgid "`Visual Studio Code `_ is an IDE with debugging tools that integrates with version-control software." +#: ../../faq/programming.rst:43 +msgid "" +"`Visual Studio Code `_ is an IDE with " +"debugging tools that integrates with version-control software." msgstr "" -msgid "There are a number of commercial Python IDEs that include graphical debuggers. They include:" +#: ../../faq/programming.rst:46 +msgid "" +"There are a number of commercial Python IDEs that include graphical " +"debuggers. They include:" msgstr "" +#: ../../faq/programming.rst:49 msgid "`Wing IDE `_" msgstr "" +#: ../../faq/programming.rst:50 msgid "`PyCharm `_" msgstr "" +#: ../../faq/programming.rst:54 msgid "Are there tools to help find bugs or perform static analysis?" msgstr "" -msgid "`Ruff `__, `Pylint `__ and `Pyflakes `__ do basic checking that will help you catch bugs sooner." +#: ../../faq/programming.rst:58 +msgid "" +"`Ruff `__, `Pylint `__ and `Pyflakes `__ do basic checking that will help you catch bugs sooner." msgstr "" -msgid "Static type checkers such as `mypy `__, `ty `__, `Pyrefly `__, and `pytype `__ can check type hints in Python source code." +#: ../../faq/programming.rst:63 +msgid "" +"Static type checkers such as `mypy `__, `ty `__, `Pyrefly `__, and `pytype " +"`__ can check type hints in Python source " +"code." msgstr "" +#: ../../faq/programming.rst:73 msgid "How can I create a stand-alone binary from a Python script?" msgstr "" -msgid "You don't need the ability to compile Python to C code if all you want is a stand-alone program that users can download and run without having to install the Python distribution first. There are a number of tools that determine the set of modules required by a program and bind these modules together with a Python binary to produce a single executable." +#: ../../faq/programming.rst:75 +msgid "" +"You don't need the ability to compile Python to C code if all you want is a " +"stand-alone program that users can download and run without having to " +"install the Python distribution first. There are a number of tools that " +"determine the set of modules required by a program and bind these modules " +"together with a Python binary to produce a single executable." msgstr "" -msgid "One is to use the freeze tool, which is included in the Python source tree as :source:`Tools/freeze`. It converts Python byte code to C arrays; with a C compiler you can embed all your modules into a new program, which is then linked with the standard Python modules." +#: ../../faq/programming.rst:81 +msgid "" +"One is to use the freeze tool, which is included in the Python source tree " +"as :source:`Tools/freeze`. It converts Python byte code to C arrays; with a " +"C compiler you can embed all your modules into a new program, which is then " +"linked with the standard Python modules." msgstr "" -msgid "It works by scanning your source recursively for import statements (in both forms) and looking for the modules in the standard Python path as well as in the source directory (for built-in modules). It then turns the bytecode for modules written in Python into C code (array initializers that can be turned into code objects using the marshal module) and creates a custom-made config file that only contains those built-in modules which are actually used in the program. It then compiles the generated C code and links it with the rest of the Python interpreter to form a self-contained binary which acts exactly like your script." +#: ../../faq/programming.rst:87 +msgid "" +"It works by scanning your source recursively for import statements (in both " +"forms) and looking for the modules in the standard Python path as well as in " +"the source directory (for built-in modules). It then turns the bytecode for " +"modules written in Python into C code (array initializers that can be turned " +"into code objects using the marshal module) and creates a custom-made config " +"file that only contains those built-in modules which are actually used in " +"the program. It then compiles the generated C code and links it with the " +"rest of the Python interpreter to form a self-contained binary which acts " +"exactly like your script." msgstr "" -msgid "The following packages can help with the creation of console and GUI executables:" +#: ../../faq/programming.rst:96 +msgid "" +"The following packages can help with the creation of console and GUI " +"executables:" msgstr "" +#: ../../faq/programming.rst:99 msgid "`Nuitka `_ (Cross-platform)" msgstr "" +#: ../../faq/programming.rst:100 msgid "`PyInstaller `_ (Cross-platform)" msgstr "" -msgid "`PyOxidizer `_ (Cross-platform)" +#: ../../faq/programming.rst:101 +msgid "" +"`PyOxidizer `_ (Cross-platform)" msgstr "" -msgid "`cx_Freeze `_ (Cross-platform)" +#: ../../faq/programming.rst:102 +msgid "" +"`cx_Freeze `_ (Cross-platform)" msgstr "" +#: ../../faq/programming.rst:103 msgid "`py2app `_ (macOS only)" msgstr "" +#: ../../faq/programming.rst:104 msgid "`py2exe `_ (Windows only)" msgstr "" +#: ../../faq/programming.rst:108 msgid "Are there coding standards or a style guide for Python programs?" msgstr "" -msgid "Yes. The coding style required for standard library modules is documented as :pep:`8`." +#: ../../faq/programming.rst:110 +msgid "" +"Yes. The coding style required for standard library modules is documented " +"as :pep:`8`." msgstr "" +#: ../../faq/programming.rst:115 msgid "Core language" msgstr "" +#: ../../faq/programming.rst:120 msgid "Why am I getting an UnboundLocalError when the variable has a value?" msgstr "" -msgid "It can be a surprise to get the :exc:`UnboundLocalError` in previously working code when it is modified by adding an assignment statement somewhere in the body of a function." +#: ../../faq/programming.rst:122 +msgid "" +"It can be a surprise to get the :exc:`UnboundLocalError` in previously " +"working code when it is modified by adding an assignment statement somewhere " +"in the body of a function." msgstr "" +#: ../../faq/programming.rst:126 msgid "This code:" msgstr "" +#: ../../faq/programming.rst:135 msgid "works, but this code:" msgstr "" +#: ../../faq/programming.rst:142 msgid "results in an :exc:`!UnboundLocalError`:" msgstr "" -msgid "This is because when you make an assignment to a variable in a scope, that variable becomes local to that scope and shadows any similarly named variable in the outer scope. Since the last statement in foo assigns a new value to ``x``, the compiler recognizes it as a local variable. Consequently when the earlier ``print(x)`` attempts to print the uninitialized local variable and an error results." +#: ../../faq/programming.rst:149 +msgid "" +"This is because when you make an assignment to a variable in a scope, that " +"variable becomes local to that scope and shadows any similarly named " +"variable in the outer scope. Since the last statement in foo assigns a new " +"value to ``x``, the compiler recognizes it as a local variable. " +"Consequently when the earlier ``print(x)`` attempts to print the " +"uninitialized local variable and an error results." msgstr "" -msgid "In the example above you can access the outer scope variable by declaring it global:" +#: ../../faq/programming.rst:156 +msgid "" +"In the example above you can access the outer scope variable by declaring it " +"global:" msgstr "" -msgid "This explicit declaration is required in order to remind you that (unlike the superficially analogous situation with class and instance variables) you are actually modifying the value of the variable in the outer scope:" +#: ../../faq/programming.rst:168 +msgid "" +"This explicit declaration is required in order to remind you that (unlike " +"the superficially analogous situation with class and instance variables) you " +"are actually modifying the value of the variable in the outer scope:" msgstr "" -msgid "You can do a similar thing in a nested scope using the :keyword:`nonlocal` keyword:" +#: ../../faq/programming.rst:175 +msgid "" +"You can do a similar thing in a nested scope using the :keyword:`nonlocal` " +"keyword:" msgstr "" +#: ../../faq/programming.rst:193 msgid "What are the rules for local and global variables in Python?" msgstr "" -msgid "In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a value anywhere within the function's body, it's assumed to be a local unless explicitly declared as global." +#: ../../faq/programming.rst:195 +msgid "" +"In Python, variables that are only referenced inside a function are " +"implicitly global. If a variable is assigned a value anywhere within the " +"function's body, it's assumed to be a local unless explicitly declared as " +"global." msgstr "" -msgid "Though a bit surprising at first, a moment's consideration explains this. On one hand, requiring :keyword:`global` for assigned variables provides a bar against unintended side-effects. On the other hand, if ``global`` was required for all global references, you'd be using ``global`` all the time. You'd have to declare as global every reference to a built-in function or to a component of an imported module. This clutter would defeat the usefulness of the ``global`` declaration for identifying side-effects." +#: ../../faq/programming.rst:199 +msgid "" +"Though a bit surprising at first, a moment's consideration explains this. " +"On one hand, requiring :keyword:`global` for assigned variables provides a " +"bar against unintended side-effects. On the other hand, if ``global`` was " +"required for all global references, you'd be using ``global`` all the time. " +"You'd have to declare as global every reference to a built-in function or to " +"a component of an imported module. This clutter would defeat the usefulness " +"of the ``global`` declaration for identifying side-effects." msgstr "" -msgid "Why do lambdas defined in a loop with different values all return the same result?" +#: ../../faq/programming.rst:209 +msgid "" +"Why do lambdas defined in a loop with different values all return the same " +"result?" msgstr "" -msgid "Assume you use a for loop to define a few different lambdas (or even plain functions), for example::" +#: ../../faq/programming.rst:211 +msgid "" +"Assume you use a for loop to define a few different lambdas (or even plain " +"functions), for example::" msgstr "" +#: ../../faq/programming.rst:214 msgid "" ">>> squares = []\n" ">>> for x in range(5):\n" "... squares.append(lambda: x**2)" msgstr "" -msgid "This gives you a list that contains 5 lambdas that calculate ``x**2``. You might expect that, when called, they would return, respectively, ``0``, ``1``, ``4``, ``9``, and ``16``. However, when you actually try you will see that they all return ``16``::" +#: ../../faq/programming.rst:218 +msgid "" +"This gives you a list that contains 5 lambdas that calculate ``x**2``. You " +"might expect that, when called, they would return, respectively, ``0``, " +"``1``, ``4``, ``9``, and ``16``. However, when you actually try you will " +"see that they all return ``16``::" msgstr "" +#: ../../faq/programming.rst:223 msgid "" ">>> squares[2]()\n" "16\n" @@ -178,27 +317,46 @@ msgid "" "16" msgstr "" -msgid "This happens because ``x`` is not local to the lambdas, but is defined in the outer scope, and it is accessed when the lambda is called --- not when it is defined. At the end of the loop, the value of ``x`` is ``4``, so all the functions now return ``4**2``, that is ``16``. You can also verify this by changing the value of ``x`` and see how the results of the lambdas change::" +#: ../../faq/programming.rst:228 +msgid "" +"This happens because ``x`` is not local to the lambdas, but is defined in " +"the outer scope, and it is accessed when the lambda is called --- not when " +"it is defined. At the end of the loop, the value of ``x`` is ``4``, so all " +"the functions now return ``4**2``, that is ``16``. You can also verify this " +"by changing the value of ``x`` and see how the results of the lambdas " +"change::" msgstr "" +#: ../../faq/programming.rst:234 msgid "" ">>> x = 8\n" ">>> squares[2]()\n" "64" msgstr "" -msgid "In order to avoid this, you need to save the values in variables local to the lambdas, so that they don't rely on the value of the global ``x``::" +#: ../../faq/programming.rst:238 +msgid "" +"In order to avoid this, you need to save the values in variables local to " +"the lambdas, so that they don't rely on the value of the global ``x``::" msgstr "" +#: ../../faq/programming.rst:241 msgid "" ">>> squares = []\n" ">>> for x in range(5):\n" "... squares.append(lambda n=x: n**2)" msgstr "" -msgid "Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed when the lambda is defined so that it has the same value that ``x`` had at that point in the loop. This means that the value of ``n`` will be ``0`` in the first lambda, ``1`` in the second, ``2`` in the third, and so on. Therefore each lambda will now return the correct result::" +#: ../../faq/programming.rst:245 +msgid "" +"Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed " +"when the lambda is defined so that it has the same value that ``x`` had at " +"that point in the loop. This means that the value of ``n`` will be ``0`` in " +"the first lambda, ``1`` in the second, ``2`` in the third, and so on. " +"Therefore each lambda will now return the correct result::" msgstr "" +#: ../../faq/programming.rst:251 msgid "" ">>> squares[2]()\n" "4\n" @@ -206,83 +364,157 @@ msgid "" "16" msgstr "" -msgid "Note that this behaviour is not peculiar to lambdas, but applies to regular functions too." +#: ../../faq/programming.rst:256 +msgid "" +"Note that this behaviour is not peculiar to lambdas, but applies to regular " +"functions too." msgstr "" +#: ../../faq/programming.rst:261 msgid "How do I share global variables across modules?" msgstr "" -msgid "The canonical way to share information across modules within a single program is to create a special module (often called config or cfg). Just import the config module in all modules of your application; the module then becomes available as a global name. Because there is only one instance of each module, any changes made to the module object get reflected everywhere. For example:" +#: ../../faq/programming.rst:263 +msgid "" +"The canonical way to share information across modules within a single " +"program is to create a special module (often called config or cfg). Just " +"import the config module in all modules of your application; the module then " +"becomes available as a global name. Because there is only one instance of " +"each module, any changes made to the module object get reflected " +"everywhere. For example:" msgstr "" +#: ../../faq/programming.rst:269 msgid "config.py::" msgstr "" +#: ../../faq/programming.rst:271 msgid "x = 0 # Default value of the 'x' configuration setting" msgstr "" +#: ../../faq/programming.rst:273 msgid "mod.py::" msgstr "" +#: ../../faq/programming.rst:275 msgid "" "import config\n" "config.x = 1" msgstr "" +#: ../../faq/programming.rst:278 msgid "main.py::" msgstr "" +#: ../../faq/programming.rst:280 msgid "" "import config\n" "import mod\n" "print(config.x)" msgstr "" -msgid "Note that using a module is also the basis for implementing the singleton design pattern, for the same reason." +#: ../../faq/programming.rst:284 +msgid "" +"Note that using a module is also the basis for implementing the singleton " +"design pattern, for the same reason." msgstr "" +#: ../../faq/programming.rst:289 msgid "What are the \"best practices\" for using import in a module?" msgstr "" -msgid "In general, don't use ``from modulename import *``. Doing so clutters the importer's namespace, and makes it much harder for linters to detect undefined names." +#: ../../faq/programming.rst:291 +msgid "" +"In general, don't use ``from modulename import *``. Doing so clutters the " +"importer's namespace, and makes it much harder for linters to detect " +"undefined names." msgstr "" -msgid "Import modules at the top of a file. Doing so makes it clear what other modules your code requires and avoids questions of whether the module name is in scope. Using one import per line makes it easy to add and delete module imports, but using multiple imports per line uses less screen space." +#: ../../faq/programming.rst:295 +msgid "" +"Import modules at the top of a file. Doing so makes it clear what other " +"modules your code requires and avoids questions of whether the module name " +"is in scope. Using one import per line makes it easy to add and delete " +"module imports, but using multiple imports per line uses less screen space." msgstr "" +#: ../../faq/programming.rst:300 msgid "It's good practice if you import modules in the following order:" msgstr "" -msgid "standard library modules -- such as :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" +#: ../../faq/programming.rst:302 +msgid "" +"standard library modules -- such " +"as :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" msgstr "" -msgid "third-party library modules (anything installed in Python's site-packages directory) -- such as :pypi:`dateutil`, :pypi:`requests`, :pypi:`tzdata`" +#: ../../faq/programming.rst:303 +msgid "" +"third-party library modules (anything installed in Python's site-packages " +"directory) -- such as :pypi:`dateutil`, :pypi:`requests`, :pypi:`tzdata`" msgstr "" +#: ../../faq/programming.rst:305 msgid "locally developed modules" msgstr "" -msgid "It is sometimes necessary to move imports to a function or class to avoid problems with circular imports. Gordon McMillan says:" +#: ../../faq/programming.rst:307 +msgid "" +"It is sometimes necessary to move imports to a function or class to avoid " +"problems with circular imports. Gordon McMillan says:" msgstr "" -msgid "Circular imports are fine where both modules use the \"import \" form of import. They fail when the 2nd module wants to grab a name out of the first (\"from module import name\") and the import is at the top level. That's because names in the 1st are not yet available, because the first module is busy importing the 2nd." +#: ../../faq/programming.rst:310 +msgid "" +"Circular imports are fine where both modules use the \"import \" " +"form of import. They fail when the 2nd module wants to grab a name out of " +"the first (\"from module import name\") and the import is at the top level. " +"That's because names in the 1st are not yet available, because the first " +"module is busy importing the 2nd." msgstr "" -msgid "In this case, if the second module is only used in one function, then the import can easily be moved into that function. By the time the import is called, the first module will have finished initializing, and the second module can do its import." +#: ../../faq/programming.rst:316 +msgid "" +"In this case, if the second module is only used in one function, then the " +"import can easily be moved into that function. By the time the import is " +"called, the first module will have finished initializing, and the second " +"module can do its import." msgstr "" -msgid "It may also be necessary to move imports out of the top level of code if some of the modules are platform-specific. In that case, it may not even be possible to import all of the modules at the top of the file. In this case, importing the correct modules in the corresponding platform-specific code is a good option." +#: ../../faq/programming.rst:321 +msgid "" +"It may also be necessary to move imports out of the top level of code if " +"some of the modules are platform-specific. In that case, it may not even be " +"possible to import all of the modules at the top of the file. In this case, " +"importing the correct modules in the corresponding platform-specific code is " +"a good option." msgstr "" -msgid "Only move imports into a local scope, such as inside a function definition, if it's necessary to solve a problem such as avoiding a circular import or are trying to reduce the initialization time of a module. This technique is especially helpful if many of the imports are unnecessary depending on how the program executes. You may also want to move imports into a function if the modules are only ever used in that function. Note that loading a module the first time may be expensive because of the one time initialization of the module, but loading a module multiple times is virtually free, costing only a couple of dictionary lookups. Even if the module name has gone out of scope, the module is probably available in :data:`sys.modules`." +#: ../../faq/programming.rst:326 +msgid "" +"Only move imports into a local scope, such as inside a function definition, " +"if it's necessary to solve a problem such as avoiding a circular import or " +"are trying to reduce the initialization time of a module. This technique is " +"especially helpful if many of the imports are unnecessary depending on how " +"the program executes. You may also want to move imports into a function if " +"the modules are only ever used in that function. Note that loading a module " +"the first time may be expensive because of the one time initialization of " +"the module, but loading a module multiple times is virtually free, costing " +"only a couple of dictionary lookups. Even if the module name has gone out " +"of scope, the module is probably available in :data:`sys.modules`." msgstr "" +#: ../../faq/programming.rst:339 msgid "Why are default values shared between objects?" msgstr "" -msgid "This type of bug commonly bites neophyte programmers. Consider this function::" +#: ../../faq/programming.rst:341 +msgid "" +"This type of bug commonly bites neophyte programmers. Consider this " +"function::" msgstr "" +#: ../../faq/programming.rst:343 msgid "" "def foo(mydict={}): # Danger: shared reference to one dict for all calls\n" " ... compute something ...\n" @@ -290,37 +522,67 @@ msgid "" " return mydict" msgstr "" -msgid "The first time you call this function, ``mydict`` contains a single item. The second time, ``mydict`` contains two items because when ``foo()`` begins executing, ``mydict`` starts out with an item already in it." +#: ../../faq/programming.rst:348 +msgid "" +"The first time you call this function, ``mydict`` contains a single item. " +"The second time, ``mydict`` contains two items because when ``foo()`` begins " +"executing, ``mydict`` starts out with an item already in it." msgstr "" -msgid "It is often expected that a function call creates new objects for default values. This is not what happens. Default values are created exactly once, when the function is defined. If that object is changed, like the dictionary in this example, subsequent calls to the function will refer to this changed object." +#: ../../faq/programming.rst:352 +msgid "" +"It is often expected that a function call creates new objects for default " +"values. This is not what happens. Default values are created exactly once, " +"when the function is defined. If that object is changed, like the " +"dictionary in this example, subsequent calls to the function will refer to " +"this changed object." msgstr "" -msgid "By definition, immutable objects such as numbers, strings, tuples, and ``None``, are safe from change. Changes to mutable objects such as dictionaries, lists, and class instances can lead to confusion." +#: ../../faq/programming.rst:357 +msgid "" +"By definition, immutable objects such as numbers, strings, tuples, and " +"``None``, are safe from change. Changes to mutable objects such as " +"dictionaries, lists, and class instances can lead to confusion." msgstr "" -msgid "Because of this feature, it is good programming practice to not use mutable objects as default values. Instead, use ``None`` as the default value and inside the function, check if the parameter is ``None`` and create a new list/dictionary/whatever if it is. For example, don't write::" +#: ../../faq/programming.rst:361 +msgid "" +"Because of this feature, it is good programming practice to not use mutable " +"objects as default values. Instead, use ``None`` as the default value and " +"inside the function, check if the parameter is ``None`` and create a new " +"list/dictionary/whatever if it is. For example, don't write::" msgstr "" +#: ../../faq/programming.rst:366 msgid "" "def foo(mydict={}):\n" " ..." msgstr "" +#: ../../faq/programming.rst:369 msgid "but::" msgstr "" +#: ../../faq/programming.rst:371 msgid "" "def foo(mydict=None):\n" " if mydict is None:\n" " mydict = {} # create a new dict for local namespace" msgstr "" -msgid "This feature can be useful. When you have a function that's time-consuming to compute, a common technique is to cache the parameters and the resulting value of each call to the function, and return the cached value if the same value is requested again. This is called \"memoizing\", and can be implemented like this::" +#: ../../faq/programming.rst:375 +msgid "" +"This feature can be useful. When you have a function that's time-consuming " +"to compute, a common technique is to cache the parameters and the resulting " +"value of each call to the function, and return the cached value if the same " +"value is requested again. This is called \"memoizing\", and can be " +"implemented like this::" msgstr "" +#: ../../faq/programming.rst:380 msgid "" -"# Callers can only provide two parameters and optionally pass _cache by keyword\n" +"# Callers can only provide two parameters and optionally pass _cache by " +"keyword\n" "def expensive(arg1, arg2, *, _cache={}):\n" " if (arg1, arg2) in _cache:\n" " return _cache[(arg1, arg2)]\n" @@ -331,15 +593,26 @@ msgid "" " return result" msgstr "" -msgid "You could use a global variable containing a dictionary instead of the default value; it's a matter of taste." +#: ../../faq/programming.rst:390 +msgid "" +"You could use a global variable containing a dictionary instead of the " +"default value; it's a matter of taste." msgstr "" -msgid "How can I pass optional or keyword parameters from one function to another?" +#: ../../faq/programming.rst:395 +msgid "" +"How can I pass optional or keyword parameters from one function to another?" msgstr "" -msgid "Collect the arguments using the ``*`` and ``**`` specifiers in the function's parameter list; this gives you the positional arguments as a tuple and the keyword arguments as a dictionary. You can then pass these arguments when calling another function by using ``*`` and ``**``::" +#: ../../faq/programming.rst:397 +msgid "" +"Collect the arguments using the ``*`` and ``**`` specifiers in the " +"function's parameter list; this gives you the positional arguments as a " +"tuple and the keyword arguments as a dictionary. You can then pass these " +"arguments when calling another function by using ``*`` and ``**``::" msgstr "" +#: ../../faq/programming.rst:402 msgid "" "def f(x, *args, **kwargs):\n" " ...\n" @@ -348,32 +621,48 @@ msgid "" " g(x, *args, **kwargs)" msgstr "" +#: ../../faq/programming.rst:416 msgid "What is the difference between arguments and parameters?" msgstr "" -msgid ":term:`Parameters ` are defined by the names that appear in a function definition, whereas :term:`arguments ` are the values actually passed to a function when calling it. Parameters define what :term:`kind of arguments ` a function can accept. For example, given the function definition::" +#: ../../faq/programming.rst:418 +msgid "" +":term:`Parameters ` are defined by the names that appear in a " +"function definition, whereas :term:`arguments ` are the values " +"actually passed to a function when calling it. Parameters define " +"what :term:`kind of arguments ` a function can accept. For " +"example, given the function definition::" msgstr "" +#: ../../faq/programming.rst:424 msgid "" "def func(foo, bar=None, **kwargs):\n" " pass" msgstr "" -msgid "*foo*, *bar* and *kwargs* are parameters of ``func``. However, when calling ``func``, for example::" +#: ../../faq/programming.rst:427 +msgid "" +"*foo*, *bar* and *kwargs* are parameters of ``func``. However, when calling " +"``func``, for example::" msgstr "" +#: ../../faq/programming.rst:430 msgid "func(42, bar=314, extra=somevar)" msgstr "" +#: ../../faq/programming.rst:432 msgid "the values ``42``, ``314``, and ``somevar`` are arguments." msgstr "" +#: ../../faq/programming.rst:436 msgid "Why did changing list 'y' also change list 'x'?" msgstr "" +#: ../../faq/programming.rst:438 msgid "If you wrote code like::" msgstr "" +#: ../../faq/programming.rst:440 msgid "" ">>> x = []\n" ">>> y = x\n" @@ -384,24 +673,40 @@ msgid "" "[10]" msgstr "" -msgid "you might be wondering why appending an element to ``y`` changed ``x`` too." +#: ../../faq/programming.rst:448 +msgid "" +"you might be wondering why appending an element to ``y`` changed ``x`` too." msgstr "" +#: ../../faq/programming.rst:450 msgid "There are two factors that produce this result:" msgstr "" -msgid "Variables are simply names that refer to objects. Doing ``y = x`` doesn't create a copy of the list -- it creates a new variable ``y`` that refers to the same object ``x`` refers to. This means that there is only one object (the list), and both ``x`` and ``y`` refer to it." +#: ../../faq/programming.rst:452 +msgid "" +"Variables are simply names that refer to objects. Doing ``y = x`` doesn't " +"create a copy of the list -- it creates a new variable ``y`` that refers to " +"the same object ``x`` refers to. This means that there is only one object " +"(the list), and both ``x`` and ``y`` refer to it." msgstr "" -msgid "Lists are :term:`mutable`, which means that you can change their content." +#: ../../faq/programming.rst:456 +msgid "" +"Lists are :term:`mutable`, which means that you can change their content." msgstr "" -msgid "After the call to :meth:`~sequence.append`, the content of the mutable object has changed from ``[]`` to ``[10]``. Since both the variables refer to the same object, using either name accesses the modified value ``[10]``." +#: ../../faq/programming.rst:458 +msgid "" +"After the call to :meth:`~sequence.append`, the content of the mutable " +"object has changed from ``[]`` to ``[10]``. Since both the variables refer " +"to the same object, using either name accesses the modified value ``[10]``." msgstr "" +#: ../../faq/programming.rst:462 msgid "If we instead assign an immutable object to ``x``::" msgstr "" +#: ../../faq/programming.rst:464 msgid "" ">>> x = 5 # ints are immutable\n" ">>> y = x\n" @@ -412,36 +717,82 @@ msgid "" "5" msgstr "" -msgid "we can see that in this case ``x`` and ``y`` are not equal anymore. This is because integers are :term:`immutable`, and when we do ``x = x + 1`` we are not mutating the int ``5`` by incrementing its value; instead, we are creating a new object (the int ``6``) and assigning it to ``x`` (that is, changing which object ``x`` refers to). After this assignment we have two objects (the ints ``6`` and ``5``) and two variables that refer to them (``x`` now refers to ``6`` but ``y`` still refers to ``5``)." +#: ../../faq/programming.rst:472 +msgid "" +"we can see that in this case ``x`` and ``y`` are not equal anymore. This is " +"because integers are :term:`immutable`, and when we do ``x = x + 1`` we are " +"not mutating the int ``5`` by incrementing its value; instead, we are " +"creating a new object (the int ``6``) and assigning it to ``x`` (that is, " +"changing which object ``x`` refers to). After this assignment we have two " +"objects (the ints ``6`` and ``5``) and two variables that refer to them " +"(``x`` now refers to ``6`` but ``y`` still refers to ``5``)." msgstr "" -msgid "Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate the object, whereas superficially similar operations (for example ``y = y + [10]`` and :func:`sorted(y) `) create a new object. In general in Python (and in all cases in the standard library) a method that mutates an object will return ``None`` to help avoid getting the two types of operations confused. So if you mistakenly write ``y.sort()`` thinking it will give you a sorted copy of ``y``, you'll instead end up with ``None``, which will likely cause your program to generate an easily diagnosed error." +#: ../../faq/programming.rst:480 +msgid "" +"Some operations (for example ``y.append(10)`` and ``y.sort()``) mutate the " +"object, whereas superficially similar operations (for example ``y = y + " +"[10]`` and :func:`sorted(y) `) create a new object. In general in " +"Python (and in all cases in the standard library) a method that mutates an " +"object will return ``None`` to help avoid getting the two types of " +"operations confused. So if you mistakenly write ``y.sort()`` thinking it " +"will give you a sorted copy of ``y``, you'll instead end up with ``None``, " +"which will likely cause your program to generate an easily diagnosed error." msgstr "" -msgid "However, there is one class of operations where the same operation sometimes has different behaviors with different types: the augmented assignment operators. For example, ``+=`` mutates lists but not tuples or ints (``a_list += [1, 2, 3]`` is equivalent to ``a_list.extend([1, 2, 3])`` and mutates ``a_list``, whereas ``some_tuple += (1, 2, 3)`` and ``some_int += 1`` create new objects)." +#: ../../faq/programming.rst:489 +msgid "" +"However, there is one class of operations where the same operation sometimes " +"has different behaviors with different types: the augmented assignment " +"operators. For example, ``+=`` mutates lists but not tuples or ints " +"(``a_list += [1, 2, 3]`` is equivalent to ``a_list.extend([1, 2, 3])`` and " +"mutates ``a_list``, whereas ``some_tuple += (1, 2, 3)`` and ``some_int += " +"1`` create new objects)." msgstr "" +#: ../../faq/programming.rst:496 msgid "In other words:" msgstr "" -msgid "If we have a mutable object (such as :class:`list`, :class:`dict`, :class:`set`), we can use some specific operations to mutate it and all the variables that refer to it will see the change." +#: ../../faq/programming.rst:498 +msgid "" +"If we have a mutable object (such " +"as :class:`list`, :class:`dict`, :class:`set`), we can use some specific " +"operations to mutate it and all the variables that refer to it will see the " +"change." msgstr "" -msgid "If we have an immutable object (such as :class:`str`, :class:`int`, :class:`tuple`), all the variables that refer to it will always see the same value, but operations that transform that value into a new value always return a new object." +#: ../../faq/programming.rst:501 +msgid "" +"If we have an immutable object (such " +"as :class:`str`, :class:`int`, :class:`tuple`), all the variables that refer " +"to it will always see the same value, but operations that transform that " +"value into a new value always return a new object." msgstr "" -msgid "If you want to know if two variables refer to the same object or not, you can use the :keyword:`is` operator, or the built-in function :func:`id`." +#: ../../faq/programming.rst:506 +msgid "" +"If you want to know if two variables refer to the same object or not, you " +"can use the :keyword:`is` operator, or the built-in function :func:`id`." msgstr "" +#: ../../faq/programming.rst:511 msgid "How do I write a function with output parameters (call by reference)?" msgstr "" -msgid "Remember that arguments are passed by assignment in Python. Since assignment just creates references to objects, there's no alias between an argument name in the caller and callee, and consequently no call-by-reference. You can achieve the desired effect in a number of ways." +#: ../../faq/programming.rst:513 +msgid "" +"Remember that arguments are passed by assignment in Python. Since " +"assignment just creates references to objects, there's no alias between an " +"argument name in the caller and callee, and consequently no call-by-" +"reference. You can achieve the desired effect in a number of ways." msgstr "" +#: ../../faq/programming.rst:518 msgid "By returning a tuple of the results::" msgstr "" +#: ../../faq/programming.rst:520 msgid "" ">>> def func1(a, b):\n" "... a = 'new-value' # a and b are local names\n" @@ -453,15 +804,20 @@ msgid "" "('new-value', 100)" msgstr "" +#: ../../faq/programming.rst:529 msgid "This is almost always the clearest solution." msgstr "" -msgid "By using global variables. This isn't thread-safe, and is not recommended." +#: ../../faq/programming.rst:531 +msgid "" +"By using global variables. This isn't thread-safe, and is not recommended." msgstr "" +#: ../../faq/programming.rst:533 msgid "By passing a mutable (changeable in-place) object::" msgstr "" +#: ../../faq/programming.rst:535 msgid "" ">>> def func2(a):\n" "... a[0] = 'new-value' # 'a' references a mutable list\n" @@ -473,9 +829,11 @@ msgid "" "['new-value', 100]" msgstr "" +#: ../../faq/programming.rst:544 msgid "By passing in a dictionary that gets mutated::" msgstr "" +#: ../../faq/programming.rst:546 msgid "" ">>> def func3(args):\n" "... args['a'] = 'new-value' # args is a mutable dictionary\n" @@ -487,9 +845,11 @@ msgid "" "{'a': 'new-value', 'b': 100}" msgstr "" +#: ../../faq/programming.rst:555 msgid "Or bundle up values in a class instance::" msgstr "" +#: ../../faq/programming.rst:557 msgid "" ">>> class Namespace:\n" "... def __init__(self, /, **args):\n" @@ -506,18 +866,27 @@ msgid "" "{'a': 'new-value', 'b': 100}" msgstr "" +#: ../../faq/programming.rst:572 msgid "There's almost never a good reason to get this complicated." msgstr "" +#: ../../faq/programming.rst:574 msgid "Your best choice is to return a tuple containing the multiple results." msgstr "" +#: ../../faq/programming.rst:578 msgid "How do you make a higher order function in Python?" msgstr "" -msgid "You have two choices: you can use nested scopes or you can use callable objects. For example, suppose you wanted to define ``linear(a,b)`` which returns a function ``f(x)`` that computes the value ``a*x+b``. Using nested scopes::" +#: ../../faq/programming.rst:580 +msgid "" +"You have two choices: you can use nested scopes or you can use callable " +"objects. For example, suppose you wanted to define ``linear(a,b)`` which " +"returns a function ``f(x)`` that computes the value ``a*x+b``. Using nested " +"scopes::" msgstr "" +#: ../../faq/programming.rst:584 msgid "" "def linear(a, b):\n" " def result(x):\n" @@ -525,9 +894,11 @@ msgid "" " return result" msgstr "" +#: ../../faq/programming.rst:589 msgid "Or using a callable object::" msgstr "" +#: ../../faq/programming.rst:591 msgid "" "class linear:\n" "\n" @@ -538,18 +909,26 @@ msgid "" " return self.a * x + self.b" msgstr "" +#: ../../faq/programming.rst:599 msgid "In both cases, ::" msgstr "" +#: ../../faq/programming.rst:601 msgid "taxes = linear(0.3, 2)" msgstr "" +#: ../../faq/programming.rst:603 msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``." msgstr "" -msgid "The callable object approach has the disadvantage that it is a bit slower and results in slightly longer code. However, note that a collection of callables can share their signature via inheritance::" +#: ../../faq/programming.rst:605 +msgid "" +"The callable object approach has the disadvantage that it is a bit slower " +"and results in slightly longer code. However, note that a collection of " +"callables can share their signature via inheritance::" msgstr "" +#: ../../faq/programming.rst:609 msgid "" "class exponential(linear):\n" " # __init__ inherited\n" @@ -557,9 +936,11 @@ msgid "" " return self.a * (x ** self.b)" msgstr "" +#: ../../faq/programming.rst:614 msgid "Object can encapsulate state for several methods::" msgstr "" +#: ../../faq/programming.rst:616 msgid "" "class counter:\n" "\n" @@ -578,39 +959,64 @@ msgid "" "inc, dec, reset = count.up, count.down, count.set" msgstr "" -msgid "Here ``inc()``, ``dec()`` and ``reset()`` act like functions which share the same counting variable." +#: ../../faq/programming.rst:632 +msgid "" +"Here ``inc()``, ``dec()`` and ``reset()`` act like functions which share the " +"same counting variable." msgstr "" +#: ../../faq/programming.rst:637 msgid "How do I copy an object in Python?" msgstr "" -msgid "In general, try :func:`copy.copy` or :func:`copy.deepcopy` for the general case. Not all objects can be copied, but most can." +#: ../../faq/programming.rst:639 +msgid "" +"In general, try :func:`copy.copy` or :func:`copy.deepcopy` for the general " +"case. Not all objects can be copied, but most can." msgstr "" -msgid "Some objects can be copied more easily. Dictionaries have a :meth:`~dict.copy` method::" +#: ../../faq/programming.rst:642 +msgid "" +"Some objects can be copied more easily. Dictionaries have " +"a :meth:`~dict.copy` method::" msgstr "" +#: ../../faq/programming.rst:645 msgid "newdict = olddict.copy()" msgstr "" +#: ../../faq/programming.rst:647 msgid "Sequences can be copied by slicing::" msgstr "" +#: ../../faq/programming.rst:649 msgid "new_l = l[:]" msgstr "" +#: ../../faq/programming.rst:653 msgid "How can I find the methods or attributes of an object?" msgstr "" -msgid "For an instance ``x`` of a user-defined class, :func:`dir(x) ` returns an alphabetized list of the names containing the instance attributes and methods and attributes defined by its class." +#: ../../faq/programming.rst:655 +msgid "" +"For an instance ``x`` of a user-defined class, :func:`dir(x) ` returns " +"an alphabetized list of the names containing the instance attributes and " +"methods and attributes defined by its class." msgstr "" +#: ../../faq/programming.rst:661 msgid "How can my code discover the name of an object?" msgstr "" -msgid "Generally speaking, it can't, because objects don't really have names. Essentially, assignment always binds a name to a value; the same is true of ``def`` and ``class`` statements, but in that case the value is a callable. Consider the following code::" +#: ../../faq/programming.rst:663 +msgid "" +"Generally speaking, it can't, because objects don't really have names. " +"Essentially, assignment always binds a name to a value; the same is true of " +"``def`` and ``class`` statements, but in that case the value is a callable. " +"Consider the following code::" msgstr "" +#: ../../faq/programming.rst:668 msgid "" ">>> class A:\n" "... pass\n" @@ -624,53 +1030,91 @@ msgid "" "<__main__.A object at 0x16D07CC>" msgstr "" -msgid "Arguably the class has a name: even though it is bound to two names and invoked through the name ``B`` the created instance is still reported as an instance of class ``A``. However, it is impossible to say whether the instance's name is ``a`` or ``b``, since both names are bound to the same value." +#: ../../faq/programming.rst:679 +msgid "" +"Arguably the class has a name: even though it is bound to two names and " +"invoked through the name ``B`` the created instance is still reported as an " +"instance of class ``A``. However, it is impossible to say whether the " +"instance's name is ``a`` or ``b``, since both names are bound to the same " +"value." msgstr "" -msgid "Generally speaking it should not be necessary for your code to \"know the names\" of particular values. Unless you are deliberately writing introspective programs, this is usually an indication that a change of approach might be beneficial." +#: ../../faq/programming.rst:684 +msgid "" +"Generally speaking it should not be necessary for your code to \"know the " +"names\" of particular values. Unless you are deliberately writing " +"introspective programs, this is usually an indication that a change of " +"approach might be beneficial." msgstr "" -msgid "In comp.lang.python, Fredrik Lundh once gave an excellent analogy in answer to this question:" +#: ../../faq/programming.rst:689 +msgid "" +"In comp.lang.python, Fredrik Lundh once gave an excellent analogy in answer " +"to this question:" msgstr "" -msgid "The same way as you get the name of that cat you found on your porch: the cat (object) itself cannot tell you its name, and it doesn't really care -- so the only way to find out what it's called is to ask all your neighbours (namespaces) if it's their cat (object)..." +#: ../../faq/programming.rst:692 +msgid "" +"The same way as you get the name of that cat you found on your porch: the " +"cat (object) itself cannot tell you its name, and it doesn't really care -- " +"so the only way to find out what it's called is to ask all your neighbours " +"(namespaces) if it's their cat (object)..." msgstr "" -msgid "....and don't be surprised if you'll find that it's known by many names, or no name at all!" +#: ../../faq/programming.rst:697 +msgid "" +"....and don't be surprised if you'll find that it's known by many names, or " +"no name at all!" msgstr "" +#: ../../faq/programming.rst:702 msgid "What's up with the comma operator's precedence?" msgstr "" +#: ../../faq/programming.rst:704 msgid "Comma is not an operator in Python. Consider this session::" msgstr "" +#: ../../faq/programming.rst:706 msgid "" ">>> \"a\" in \"b\", \"a\"\n" "(False, 'a')" msgstr "" -msgid "Since the comma is not an operator, but a separator between expressions the above is evaluated as if you had entered::" +#: ../../faq/programming.rst:709 +msgid "" +"Since the comma is not an operator, but a separator between expressions the " +"above is evaluated as if you had entered::" msgstr "" +#: ../../faq/programming.rst:712 msgid "(\"a\" in \"b\"), \"a\"" msgstr "" +#: ../../faq/programming.rst:714 msgid "not::" msgstr "" +#: ../../faq/programming.rst:716 msgid "\"a\" in (\"b\", \"a\")" msgstr "" -msgid "The same is true of the various assignment operators (``=``, ``+=``, and so on). They are not truly operators but syntactic delimiters in assignment statements." +#: ../../faq/programming.rst:718 +msgid "" +"The same is true of the various assignment operators (``=``, ``+=``, and so " +"on). They are not truly operators but syntactic delimiters in assignment " +"statements." msgstr "" +#: ../../faq/programming.rst:723 msgid "Is there an equivalent of C's \"?:\" ternary operator?" msgstr "" +#: ../../faq/programming.rst:725 msgid "Yes, there is. The syntax is as follows::" msgstr "" +#: ../../faq/programming.rst:727 msgid "" "[on_true] if [expression] else [on_false]\n" "\n" @@ -678,21 +1122,35 @@ msgid "" "small = x if x < y else y" msgstr "" -msgid "Before this syntax was introduced in Python 2.5, a common idiom was to use logical operators::" +#: ../../faq/programming.rst:732 +msgid "" +"Before this syntax was introduced in Python 2.5, a common idiom was to use " +"logical operators::" msgstr "" +#: ../../faq/programming.rst:735 msgid "[expression] and [on_true] or [on_false]" msgstr "" -msgid "However, this idiom is unsafe, as it can give wrong results when *on_true* has a false boolean value. Therefore, it is always better to use the ``... if ... else ...`` form." +#: ../../faq/programming.rst:737 +msgid "" +"However, this idiom is unsafe, as it can give wrong results when *on_true* " +"has a false boolean value. Therefore, it is always better to use the ``... " +"if ... else ...`` form." msgstr "" +#: ../../faq/programming.rst:743 msgid "Is it possible to write obfuscated one-liners in Python?" msgstr "" -msgid "Yes. Usually this is done by nesting :keyword:`lambda` within :keyword:`!lambda`. See the following three examples, slightly adapted from Ulf Bartelt::" +#: ../../faq/programming.rst:745 +msgid "" +"Yes. Usually this is done by nesting :keyword:`lambda` within :keyword:`!" +"lambda`. See the following three examples, slightly adapted from Ulf " +"Bartelt::" msgstr "" +#: ../../faq/programming.rst:748 msgid "" "from functools import reduce\n" "\n" @@ -705,7 +1163,8 @@ msgid "" "f(x,f), range(10))))\n" "\n" "# Mandelbrot set\n" -"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\\n'+y,map(lambda y,\n" +"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\\n'+y,map(lambda " +"y,\n" "Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,\n" "Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,\n" "i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y\n" @@ -719,15 +1178,25 @@ msgid "" "# |____________________________ range on x axis" msgstr "" +#: ../../faq/programming.rst:772 msgid "Don't try this at home, kids!" msgstr "" +#: ../../faq/programming.rst:778 msgid "What does the slash(/) in the parameter list of a function mean?" msgstr "" -msgid "A slash in the argument list of a function denotes that the parameters prior to it are positional-only. Positional-only parameters are the ones without an externally usable name. Upon calling a function that accepts positional-only parameters, arguments are mapped to parameters based solely on their position. For example, :func:`divmod` is a function that accepts positional-only parameters. Its documentation looks like this::" +#: ../../faq/programming.rst:780 +msgid "" +"A slash in the argument list of a function denotes that the parameters prior " +"to it are positional-only. Positional-only parameters are the ones without " +"an externally usable name. Upon calling a function that accepts positional-" +"only parameters, arguments are mapped to parameters based solely on their " +"position. For example, :func:`divmod` is a function that accepts positional-" +"only parameters. Its documentation looks like this::" msgstr "" +#: ../../faq/programming.rst:787 msgid "" ">>> help(divmod)\n" "Help on built-in function divmod in module builtins:\n" @@ -736,9 +1205,14 @@ msgid "" " Return the tuple (x//y, x%y). Invariant: div*y + mod == x." msgstr "" -msgid "The slash at the end of the parameter list means that both parameters are positional-only. Thus, calling :func:`divmod` with keyword arguments would lead to an error::" +#: ../../faq/programming.rst:793 +msgid "" +"The slash at the end of the parameter list means that both parameters are " +"positional-only. Thus, calling :func:`divmod` with keyword arguments would " +"lead to an error::" msgstr "" +#: ../../faq/programming.rst:797 msgid "" ">>> divmod(x=3, y=4)\n" "Traceback (most recent call last):\n" @@ -746,24 +1220,36 @@ msgid "" "TypeError: divmod() takes no keyword arguments" msgstr "" +#: ../../faq/programming.rst:804 msgid "Numbers and strings" msgstr "" +#: ../../faq/programming.rst:807 msgid "How do I specify hexadecimal and octal integers?" msgstr "" -msgid "To specify an octal digit, precede the octal value with a zero, and then a lower or uppercase \"o\". For example, to set the variable \"a\" to the octal value \"10\" (8 in decimal), type::" +#: ../../faq/programming.rst:809 +msgid "" +"To specify an octal digit, precede the octal value with a zero, and then a " +"lower or uppercase \"o\". For example, to set the variable \"a\" to the " +"octal value \"10\" (8 in decimal), type::" msgstr "" +#: ../../faq/programming.rst:813 msgid "" ">>> a = 0o10\n" ">>> a\n" "8" msgstr "" -msgid "Hexadecimal is just as easy. Simply precede the hexadecimal number with a zero, and then a lower or uppercase \"x\". Hexadecimal digits can be specified in lower or uppercase. For example, in the Python interpreter::" +#: ../../faq/programming.rst:817 +msgid "" +"Hexadecimal is just as easy. Simply precede the hexadecimal number with a " +"zero, and then a lower or uppercase \"x\". Hexadecimal digits can be " +"specified in lower or uppercase. For example, in the Python interpreter::" msgstr "" +#: ../../faq/programming.rst:821 msgid "" ">>> a = 0xa5\n" ">>> a\n" @@ -773,27 +1259,47 @@ msgid "" "178" msgstr "" +#: ../../faq/programming.rst:830 msgid "Why does -22 // 10 return -3?" msgstr "" -msgid "It's primarily driven by the desire that ``i % j`` have the same sign as ``j``. If you want that, and also want::" +#: ../../faq/programming.rst:832 +msgid "" +"It's primarily driven by the desire that ``i % j`` have the same sign as " +"``j``. If you want that, and also want::" msgstr "" +#: ../../faq/programming.rst:835 msgid "i == (i // j) * j + (i % j)" msgstr "" -msgid "then integer division has to return the floor. C also requires that identity to hold, and then compilers that truncate ``i // j`` need to make ``i % j`` have the same sign as ``i``." +#: ../../faq/programming.rst:837 +msgid "" +"then integer division has to return the floor. C also requires that " +"identity to hold, and then compilers that truncate ``i // j`` need to make " +"``i % j`` have the same sign as ``i``." msgstr "" -msgid "There are few real use cases for ``i % j`` when ``j`` is negative. When ``j`` is positive, there are many, and in virtually all of them it's more useful for ``i % j`` to be ``>= 0``. If the clock says 10 now, what did it say 200 hours ago? ``-190 % 12 == 2`` is useful; ``-190 % 12 == -10`` is a bug waiting to bite." +#: ../../faq/programming.rst:841 +msgid "" +"There are few real use cases for ``i % j`` when ``j`` is negative. When " +"``j`` is positive, there are many, and in virtually all of them it's more " +"useful for ``i % j`` to be ``>= 0``. If the clock says 10 now, what did it " +"say 200 hours ago? ``-190 % 12 == 2`` is useful; ``-190 % 12 == -10`` is a " +"bug waiting to bite." msgstr "" +#: ../../faq/programming.rst:849 msgid "How do I get int literal attribute instead of SyntaxError?" msgstr "" -msgid "Trying to lookup an ``int`` literal attribute in the normal manner gives a :exc:`SyntaxError` because the period is seen as a decimal point::" +#: ../../faq/programming.rst:851 +msgid "" +"Trying to lookup an ``int`` literal attribute in the normal manner gives " +"a :exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" +#: ../../faq/programming.rst:854 msgid "" ">>> 1.__class__\n" " File \"\", line 1\n" @@ -802,36 +1308,78 @@ msgid "" "SyntaxError: invalid decimal literal" msgstr "" -msgid "The solution is to separate the literal from the period with either a space or parentheses." +#: ../../faq/programming.rst:860 +msgid "" +"The solution is to separate the literal from the period with either a space " +"or parentheses." msgstr "" +#: ../../faq/programming.rst:870 msgid "How do I convert a string to a number?" msgstr "" -msgid "For integers, use the built-in :func:`int` type constructor, for example, ``int('144') == 144``. Similarly, :func:`float` converts to a floating-point number, for example, ``float('144') == 144.0``." +#: ../../faq/programming.rst:872 +msgid "" +"For integers, use the built-in :func:`int` type constructor, for example, " +"``int('144') == 144``. Similarly, :func:`float` converts to a floating-" +"point number, for example, ``float('144') == 144.0``." msgstr "" -msgid "By default, these interpret the number as decimal, so that ``int('0144') == 144`` holds true, and ``int('0x144')`` raises :exc:`ValueError`. ``int(string, base)`` takes the base to convert from as a second optional argument, so ``int( '0x144', 16) == 324``. If the base is specified as 0, the number is interpreted using Python's rules: a leading '0o' indicates octal, and '0x' indicates a hex number." +#: ../../faq/programming.rst:876 +msgid "" +"By default, these interpret the number as decimal, so that ``int('0144') == " +"144`` holds true, and ``int('0x144')`` raises :exc:`ValueError`. " +"``int(string, base)`` takes the base to convert from as a second optional " +"argument, so ``int( '0x144', 16) == 324``. If the base is specified as 0, " +"the number is interpreted using Python's rules: a leading '0o' indicates " +"octal, and '0x' indicates a hex number." msgstr "" -msgid "Do not use the built-in function :func:`eval` if all you need is to convert strings to numbers. :func:`eval` will be significantly slower and it presents a security risk: someone could pass you a Python expression that might have unwanted side effects. For example, someone could pass ``__import__('os').system(\"rm -rf $HOME\")`` which would erase your home directory." +#: ../../faq/programming.rst:883 +msgid "" +"Do not use the built-in function :func:`eval` if all you need is to convert " +"strings to numbers. :func:`eval` will be significantly slower and it " +"presents a security risk: someone could pass you a Python expression that " +"might have unwanted side effects. For example, someone could pass " +"``__import__('os').system(\"rm -rf $HOME\")`` which would erase your home " +"directory." msgstr "" -msgid ":func:`eval` also has the effect of interpreting numbers as Python expressions, so that, for example, ``eval('09')`` gives a syntax error because Python does not allow leading '0' in a decimal number (except '0')." +#: ../../faq/programming.rst:890 +msgid "" +":func:`eval` also has the effect of interpreting numbers as Python " +"expressions, so that, for example, ``eval('09')`` gives a syntax error " +"because Python does not allow leading '0' in a decimal number (except '0')." msgstr "" +#: ../../faq/programming.rst:896 msgid "How do I convert a number to a string?" msgstr "" -msgid "For example, to convert the number ``144`` to the string ``'144'``, use the built-in type constructor :func:`str`. If you want a hexadecimal or octal representation, use the built-in functions :func:`hex` or :func:`oct`. For fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` sections. For example, ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\".format(1.0/3.0)`` yields ``'0.333'``." +#: ../../faq/programming.rst:898 +msgid "" +"For example, to convert the number ``144`` to the string ``'144'``, use the " +"built-in type constructor :func:`str`. If you want a hexadecimal or octal " +"representation, use the built-in functions :func:`hex` or :func:`oct`. For " +"fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " +"sections. For example, ``\"{:04d}\".format(144)`` yields ``'0144'`` and " +"``\"{:.3f}\".format(1.0/3.0)`` yields ``'0.333'``." msgstr "" +#: ../../faq/programming.rst:907 msgid "How do I modify a string in place?" msgstr "" -msgid "You can't, because strings are immutable. In most situations, you should simply construct a new string from the various parts you want to assemble it from. However, if you need an object with the ability to modify in-place Unicode data, try using an :class:`io.StringIO` object or the :mod:`array` module::" +#: ../../faq/programming.rst:909 +msgid "" +"You can't, because strings are immutable. In most situations, you should " +"simply construct a new string from the various parts you want to assemble it " +"from. However, if you need an object with the ability to modify in-place " +"Unicode data, try using an :class:`io.StringIO` object or the :mod:`array` " +"module::" msgstr "" +#: ../../faq/programming.rst:915 msgid "" ">>> import io\n" ">>> s = \"Hello, world\"\n" @@ -856,15 +1404,23 @@ msgid "" "'yello, world'" msgstr "" +#: ../../faq/programming.rst:939 msgid "How do I use strings to call functions/methods?" msgstr "" +#: ../../faq/programming.rst:941 msgid "There are various techniques." msgstr "" -msgid "The best is to use a dictionary that maps strings to functions. The primary advantage of this technique is that the strings do not need to match the names of the functions. This is also the primary technique used to emulate a case construct::" +#: ../../faq/programming.rst:943 +msgid "" +"The best is to use a dictionary that maps strings to functions. The primary " +"advantage of this technique is that the strings do not need to match the " +"names of the functions. This is also the primary technique used to emulate " +"a case construct::" msgstr "" +#: ../../faq/programming.rst:948 msgid "" "def a():\n" " pass\n" @@ -877,20 +1433,27 @@ msgid "" "dispatch[get_input()]() # Note trailing parens to call function" msgstr "" +#: ../../faq/programming.rst:958 msgid "Use the built-in function :func:`getattr`::" msgstr "" +#: ../../faq/programming.rst:960 msgid "" "import foo\n" "getattr(foo, 'bar')()" msgstr "" -msgid "Note that :func:`getattr` works on any object, including classes, class instances, modules, and so on." +#: ../../faq/programming.rst:963 +msgid "" +"Note that :func:`getattr` works on any object, including classes, class " +"instances, modules, and so on." msgstr "" +#: ../../faq/programming.rst:966 msgid "This is used in several places in the standard library, like this::" msgstr "" +#: ../../faq/programming.rst:968 msgid "" "class Foo:\n" " def do_foo(self):\n" @@ -903,9 +1466,11 @@ msgid "" "f()" msgstr "" +#: ../../faq/programming.rst:979 msgid "Use :func:`locals` to resolve the function name::" msgstr "" +#: ../../faq/programming.rst:981 msgid "" "def myFunc():\n" " print(\"hello\")\n" @@ -916,12 +1481,22 @@ msgid "" "f()" msgstr "" -msgid "Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines from strings?" +#: ../../faq/programming.rst:991 +msgid "" +"Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines " +"from strings?" msgstr "" -msgid "You can use ``S.rstrip(\"\\r\\n\")`` to remove all occurrences of any line terminator from the end of the string ``S`` without removing other trailing whitespace. If the string ``S`` represents more than one line, with several empty lines at the end, the line terminators for all the blank lines will be removed::" +#: ../../faq/programming.rst:993 +msgid "" +"You can use ``S.rstrip(\"\\r\\n\")`` to remove all occurrences of any line " +"terminator from the end of the string ``S`` without removing other trailing " +"whitespace. If the string ``S`` represents more than one line, with several " +"empty lines at the end, the line terminators for all the blank lines will be " +"removed::" msgstr "" +#: ../../faq/programming.rst:999 msgid "" ">>> lines = (\"line 1 \\r\\n\"\n" "... \"\\r\\n\"\n" @@ -930,33 +1505,55 @@ msgid "" "'line 1 '" msgstr "" -msgid "Since this is typically only desired when reading text one line at a time, using ``S.rstrip()`` this way works well." +#: ../../faq/programming.rst:1005 +msgid "" +"Since this is typically only desired when reading text one line at a time, " +"using ``S.rstrip()`` this way works well." msgstr "" +#: ../../faq/programming.rst:1010 msgid "Is there a ``scanf()`` or ``sscanf()`` equivalent?" msgstr "" +#: ../../faq/programming.rst:1012 msgid "Not as such." msgstr "" -msgid "For simple input parsing, the easiest approach is usually to split the line into whitespace-delimited words using the :meth:`~str.split` method of string objects and then convert decimal strings to numeric values using :func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" parameter which is useful if the line uses something other than whitespace as a separator." +#: ../../faq/programming.rst:1014 +msgid "" +"For simple input parsing, the easiest approach is usually to split the line " +"into whitespace-delimited words using the :meth:`~str.split` method of " +"string objects and then convert decimal strings to numeric values " +"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " +"\"sep\" parameter which is useful if the line uses something other than " +"whitespace as a separator." msgstr "" -msgid "For more complicated input parsing, regular expressions are more powerful than C's ``sscanf`` and better suited for the task." +#: ../../faq/programming.rst:1020 +msgid "" +"For more complicated input parsing, regular expressions are more powerful " +"than C's ``sscanf`` and better suited for the task." msgstr "" +#: ../../faq/programming.rst:1025 msgid "What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?" msgstr "" +#: ../../faq/programming.rst:1027 msgid "See the :ref:`unicode-howto`." msgstr "" +#: ../../faq/programming.rst:1033 msgid "Can I end a raw string with an odd number of backslashes?" msgstr "" -msgid "A raw string ending with an odd number of backslashes will escape the string's quote::" +#: ../../faq/programming.rst:1035 +msgid "" +"A raw string ending with an odd number of backslashes will escape the " +"string's quote::" msgstr "" +#: ../../faq/programming.rst:1037 msgid "" ">>> r'C:\\this\\will\\not\\work\\'\n" " File \"\", line 1\n" @@ -965,95 +1562,182 @@ msgid "" "SyntaxError: unterminated string literal (detected at line 1)" msgstr "" -msgid "There are several workarounds for this. One is to use regular strings and double the backslashes::" +#: ../../faq/programming.rst:1043 +msgid "" +"There are several workarounds for this. One is to use regular strings and " +"double the backslashes::" msgstr "" +#: ../../faq/programming.rst:1046 msgid "" ">>> 'C:\\\\this\\\\will\\\\work\\\\'\n" "'C:\\\\this\\\\will\\\\work\\\\'" msgstr "" -msgid "Another is to concatenate a regular string containing an escaped backslash to the raw string::" +#: ../../faq/programming.rst:1049 +msgid "" +"Another is to concatenate a regular string containing an escaped backslash " +"to the raw string::" msgstr "" +#: ../../faq/programming.rst:1052 msgid "" ">>> r'C:\\this\\will\\work' '\\\\'\n" "'C:\\\\this\\\\will\\\\work\\\\'" msgstr "" -msgid "It is also possible to use :func:`os.path.join` to append a backslash on Windows::" +#: ../../faq/programming.rst:1055 +msgid "" +"It is also possible to use :func:`os.path.join` to append a backslash on " +"Windows::" msgstr "" +#: ../../faq/programming.rst:1057 msgid "" ">>> os.path.join(r'C:\\this\\will\\work', '')\n" "'C:\\\\this\\\\will\\\\work\\\\'" msgstr "" -msgid "Note that while a backslash will \"escape\" a quote for the purposes of determining where the raw string ends, no escaping occurs when interpreting the value of the raw string. That is, the backslash remains present in the value of the raw string::" +#: ../../faq/programming.rst:1060 +msgid "" +"Note that while a backslash will \"escape\" a quote for the purposes of " +"determining where the raw string ends, no escaping occurs when interpreting " +"the value of the raw string. That is, the backslash remains present in the " +"value of the raw string::" msgstr "" +#: ../../faq/programming.rst:1065 msgid "" ">>> r'backslash\\'preserved'\n" "\"backslash\\\\'preserved\"" msgstr "" +#: ../../faq/programming.rst:1068 msgid "Also see the specification in the :ref:`language reference `." msgstr "" +#: ../../faq/programming.rst:1072 msgid "Performance" msgstr "" +#: ../../faq/programming.rst:1075 msgid "My program is too slow. How do I speed it up?" msgstr "" -msgid "That's a tough one, in general. First, here is a list of things to remember before diving further:" +#: ../../faq/programming.rst:1077 +msgid "" +"That's a tough one, in general. First, here is a list of things to remember " +"before diving further:" msgstr "" -msgid "Performance characteristics vary across Python implementations. This FAQ focuses on :term:`CPython`." +#: ../../faq/programming.rst:1080 +msgid "" +"Performance characteristics vary across Python implementations. This FAQ " +"focuses on :term:`CPython`." msgstr "" -msgid "Behaviour can vary across operating systems, especially when talking about I/O or multi-threading." +#: ../../faq/programming.rst:1082 +msgid "" +"Behaviour can vary across operating systems, especially when talking about I/" +"O or multi-threading." msgstr "" -msgid "You should always find the hot spots in your program *before* attempting to optimize any code (see the :mod:`profile` module)." +#: ../../faq/programming.rst:1084 +msgid "" +"You should always find the hot spots in your program *before* attempting to " +"optimize any code (see the :mod:`profile` module)." msgstr "" -msgid "Writing benchmark scripts will allow you to iterate quickly when searching for improvements (see the :mod:`timeit` module)." +#: ../../faq/programming.rst:1086 +msgid "" +"Writing benchmark scripts will allow you to iterate quickly when searching " +"for improvements (see the :mod:`timeit` module)." msgstr "" -msgid "It is highly recommended to have good code coverage (through unit testing or any other technique) before potentially introducing regressions hidden in sophisticated optimizations." +#: ../../faq/programming.rst:1088 +msgid "" +"It is highly recommended to have good code coverage (through unit testing or " +"any other technique) before potentially introducing regressions hidden in " +"sophisticated optimizations." msgstr "" -msgid "That being said, there are many tricks to speed up Python code. Here are some general principles which go a long way towards reaching acceptable performance levels:" +#: ../../faq/programming.rst:1092 +msgid "" +"That being said, there are many tricks to speed up Python code. Here are " +"some general principles which go a long way towards reaching acceptable " +"performance levels:" msgstr "" -msgid "Making your algorithms faster (or changing to faster ones) can yield much larger benefits than trying to sprinkle micro-optimization tricks all over your code." +#: ../../faq/programming.rst:1096 +msgid "" +"Making your algorithms faster (or changing to faster ones) can yield much " +"larger benefits than trying to sprinkle micro-optimization tricks all over " +"your code." msgstr "" -msgid "Use the right data structures. Study documentation for the :ref:`bltin-types` and the :mod:`collections` module." +#: ../../faq/programming.rst:1100 +msgid "" +"Use the right data structures. Study documentation for the :ref:`bltin-" +"types` and the :mod:`collections` module." msgstr "" -msgid "When the standard library provides a primitive for doing something, it is likely (although not guaranteed) to be faster than any alternative you may come up with. This is doubly true for primitives written in C, such as builtins and some extension types. For example, be sure to use either the :meth:`list.sort` built-in method or the related :func:`sorted` function to do sorting (and see the :ref:`sortinghowto` for examples of moderately advanced usage)." +#: ../../faq/programming.rst:1103 +msgid "" +"When the standard library provides a primitive for doing something, it is " +"likely (although not guaranteed) to be faster than any alternative you may " +"come up with. This is doubly true for primitives written in C, such as " +"builtins and some extension types. For example, be sure to use either " +"the :meth:`list.sort` built-in method or the related :func:`sorted` function " +"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"advanced usage)." msgstr "" -msgid "Abstractions tend to create indirections and force the interpreter to work more. If the levels of indirection outweigh the amount of useful work done, your program will be slower. You should avoid excessive abstraction, especially under the form of tiny functions or methods (which are also often detrimental to readability)." +#: ../../faq/programming.rst:1111 +msgid "" +"Abstractions tend to create indirections and force the interpreter to work " +"more. If the levels of indirection outweigh the amount of useful work done, " +"your program will be slower. You should avoid excessive abstraction, " +"especially under the form of tiny functions or methods (which are also often " +"detrimental to readability)." msgstr "" -msgid "If you have reached the limit of what pure Python can allow, there are tools to take you further away. For example, `Cython `_ can compile a slightly modified version of Python code into a C extension, and can be used on many different platforms. Cython can take advantage of compilation (and optional type annotations) to make your code significantly faster than when interpreted. If you are confident in your C programming skills, you can also :ref:`write a C extension module ` yourself." +#: ../../faq/programming.rst:1117 +msgid "" +"If you have reached the limit of what pure Python can allow, there are tools " +"to take you further away. For example, `Cython `_ can " +"compile a slightly modified version of Python code into a C extension, and " +"can be used on many different platforms. Cython can take advantage of " +"compilation (and optional type annotations) to make your code significantly " +"faster than when interpreted. If you are confident in your C programming " +"skills, you can also :ref:`write a C extension module ` " +"yourself." msgstr "" -msgid "The wiki page devoted to `performance tips `_." +#: ../../faq/programming.rst:1127 +msgid "" +"The wiki page devoted to `performance tips `_." msgstr "" +#: ../../faq/programming.rst:1134 msgid "What is the most efficient way to concatenate many strings together?" msgstr "" -msgid ":class:`str` and :class:`bytes` objects are immutable, therefore concatenating many strings together is inefficient as each concatenation creates a new object. In the general case, the total runtime cost is quadratic in the total string length." +#: ../../faq/programming.rst:1136 +msgid "" +":class:`str` and :class:`bytes` objects are immutable, therefore " +"concatenating many strings together is inefficient as each concatenation " +"creates a new object. In the general case, the total runtime cost is " +"quadratic in the total string length." msgstr "" -msgid "To accumulate many :class:`str` objects, the recommended idiom is to place them into a list and call :meth:`str.join` at the end::" +#: ../../faq/programming.rst:1141 +msgid "" +"To accumulate many :class:`str` objects, the recommended idiom is to place " +"them into a list and call :meth:`str.join` at the end::" msgstr "" +#: ../../faq/programming.rst:1144 msgid "" "chunks = []\n" "for s in my_strings:\n" @@ -1061,68 +1745,113 @@ msgid "" "result = ''.join(chunks)" msgstr "" +#: ../../faq/programming.rst:1149 msgid "(Another reasonably efficient idiom is to use :class:`io.StringIO`.)" msgstr "" -msgid "To accumulate many :class:`bytes` objects, the recommended idiom is to extend a :class:`bytearray` object using in-place concatenation (the ``+=`` operator)::" +#: ../../faq/programming.rst:1151 +msgid "" +"To accumulate many :class:`bytes` objects, the recommended idiom is to " +"extend a :class:`bytearray` object using in-place concatenation (the ``+=`` " +"operator)::" msgstr "" +#: ../../faq/programming.rst:1154 msgid "" "result = bytearray()\n" "for b in my_bytes_objects:\n" " result += b" msgstr "" +#: ../../faq/programming.rst:1160 msgid "Sequences (tuples/lists)" msgstr "" +#: ../../faq/programming.rst:1163 msgid "How do I convert between tuples and lists?" msgstr "" -msgid "The type constructor ``tuple(seq)`` converts any sequence (actually, any iterable) into a tuple with the same items in the same order." +#: ../../faq/programming.rst:1165 +msgid "" +"The type constructor ``tuple(seq)`` converts any sequence (actually, any " +"iterable) into a tuple with the same items in the same order." msgstr "" -msgid "For example, ``tuple([1, 2, 3])`` yields ``(1, 2, 3)`` and ``tuple('abc')`` yields ``('a', 'b', 'c')``. If the argument is a tuple, it does not make a copy but returns the same object, so it is cheap to call :func:`tuple` when you aren't sure that an object is already a tuple." +#: ../../faq/programming.rst:1168 +msgid "" +"For example, ``tuple([1, 2, 3])`` yields ``(1, 2, 3)`` and ``tuple('abc')`` " +"yields ``('a', 'b', 'c')``. If the argument is a tuple, it does not make a " +"copy but returns the same object, so it is cheap to call :func:`tuple` when " +"you aren't sure that an object is already a tuple." msgstr "" -msgid "The type constructor ``list(seq)`` converts any sequence or iterable into a list with the same items in the same order. For example, ``list((1, 2, 3))`` yields ``[1, 2, 3]`` and ``list('abc')`` yields ``['a', 'b', 'c']``. If the argument is a list, it makes a copy just like ``seq[:]`` would." +#: ../../faq/programming.rst:1173 +msgid "" +"The type constructor ``list(seq)`` converts any sequence or iterable into a " +"list with the same items in the same order. For example, ``list((1, 2, " +"3))`` yields ``[1, 2, 3]`` and ``list('abc')`` yields ``['a', 'b', 'c']``. " +"If the argument is a list, it makes a copy just like ``seq[:]`` would." msgstr "" +#: ../../faq/programming.rst:1180 msgid "What's a negative index?" msgstr "" -msgid "Python sequences are indexed with positive numbers and negative numbers. For positive numbers 0 is the first index 1 is the second index and so forth. For negative indices -1 is the last index and -2 is the penultimate (next to last) index and so forth. Think of ``seq[-n]`` as the same as ``seq[len(seq)-n]``." +#: ../../faq/programming.rst:1182 +msgid "" +"Python sequences are indexed with positive numbers and negative numbers. " +"For positive numbers 0 is the first index 1 is the second index and so " +"forth. For negative indices -1 is the last index and -2 is the penultimate " +"(next to last) index and so forth. Think of ``seq[-n]`` as the same as " +"``seq[len(seq)-n]``." msgstr "" -msgid "Using negative indices can be very convenient. For example ``S[:-1]`` is all of the string except for its last character, which is useful for removing the trailing newline from a string." +#: ../../faq/programming.rst:1187 +msgid "" +"Using negative indices can be very convenient. For example ``S[:-1]`` is " +"all of the string except for its last character, which is useful for " +"removing the trailing newline from a string." msgstr "" +#: ../../faq/programming.rst:1193 msgid "How do I iterate over a sequence in reverse order?" msgstr "" +#: ../../faq/programming.rst:1195 msgid "Use the :func:`reversed` built-in function::" msgstr "" +#: ../../faq/programming.rst:1197 msgid "" "for x in reversed(sequence):\n" " ... # do something with x ..." msgstr "" -msgid "This won't touch your original sequence, but build a new copy with reversed order to iterate over." +#: ../../faq/programming.rst:1200 +msgid "" +"This won't touch your original sequence, but build a new copy with reversed " +"order to iterate over." msgstr "" +#: ../../faq/programming.rst:1205 msgid "How do you remove duplicates from a list?" msgstr "" +#: ../../faq/programming.rst:1207 msgid "See the Python Cookbook for a long discussion of many ways to do this:" msgstr "" +#: ../../faq/programming.rst:1209 msgid "https://code.activestate.com/recipes/52560/" msgstr "" -msgid "If you don't mind reordering the list, sort it and then scan from the end of the list, deleting duplicates as you go::" +#: ../../faq/programming.rst:1211 +msgid "" +"If you don't mind reordering the list, sort it and then scan from the end of " +"the list, deleting duplicates as you go::" msgstr "" +#: ../../faq/programming.rst:1214 msgid "" "if mylist:\n" " mylist.sort()\n" @@ -1134,118 +1863,185 @@ msgid "" " last = mylist[i]" msgstr "" -msgid "If all elements of the list may be used as set keys (that is, they are all :term:`hashable`) this is often faster::" +#: ../../faq/programming.rst:1223 +msgid "" +"If all elements of the list may be used as set keys (that is, they are " +"all :term:`hashable`) this is often faster::" msgstr "" +#: ../../faq/programming.rst:1226 msgid "mylist = list(set(mylist))" msgstr "" -msgid "This converts the list into a set, thereby removing duplicates, and then back into a list." +#: ../../faq/programming.rst:1228 +msgid "" +"This converts the list into a set, thereby removing duplicates, and then " +"back into a list." msgstr "" +#: ../../faq/programming.rst:1233 msgid "How do you remove multiple items from a list?" msgstr "" -msgid "As with removing duplicates, explicitly iterating in reverse with a delete condition is one possibility. However, it is easier and faster to use slice replacement with an implicit or explicit forward iteration. Here are three variations::" +#: ../../faq/programming.rst:1235 +msgid "" +"As with removing duplicates, explicitly iterating in reverse with a delete " +"condition is one possibility. However, it is easier and faster to use slice " +"replacement with an implicit or explicit forward iteration. Here are three " +"variations::" msgstr "" +#: ../../faq/programming.rst:1240 msgid "" "mylist[:] = filter(keep_function, mylist)\n" "mylist[:] = (x for x in mylist if keep_condition)\n" "mylist[:] = [x for x in mylist if keep_condition]" msgstr "" +#: ../../faq/programming.rst:1244 msgid "The list comprehension may be fastest." msgstr "" +#: ../../faq/programming.rst:1248 msgid "How do you make an array in Python?" msgstr "" +#: ../../faq/programming.rst:1250 msgid "Use a list::" msgstr "" +#: ../../faq/programming.rst:1252 msgid "[\"this\", 1, \"is\", \"an\", \"array\"]" msgstr "" -msgid "Lists are equivalent to C or Pascal arrays in their time complexity; the primary difference is that a Python list can contain objects of many different types." +#: ../../faq/programming.rst:1254 +msgid "" +"Lists are equivalent to C or Pascal arrays in their time complexity; the " +"primary difference is that a Python list can contain objects of many " +"different types." msgstr "" -msgid "The ``array`` module also provides methods for creating arrays of fixed types with compact representations, but they are slower to index than lists. Also note that `NumPy `_ and other third-party packages define array-like structures with various characteristics as well." +#: ../../faq/programming.rst:1257 +msgid "" +"The ``array`` module also provides methods for creating arrays of fixed " +"types with compact representations, but they are slower to index than " +"lists. Also note that `NumPy `_ and other third-party " +"packages define array-like structures with various characteristics as well." msgstr "" -msgid "To get Lisp-style linked lists, you can emulate *cons cells* using tuples::" +#: ../../faq/programming.rst:1263 +msgid "" +"To get Lisp-style linked lists, you can emulate *cons cells* using tuples::" msgstr "" +#: ../../faq/programming.rst:1265 msgid "lisp_list = (\"like\", (\"this\", (\"example\", None) ) )" msgstr "" -msgid "If mutability is desired, you could use lists instead of tuples. Here the analogue of a Lisp *car* is ``lisp_list[0]`` and the analogue of *cdr* is ``lisp_list[1]``. Only do this if you're sure you really need to, because it's usually a lot slower than using Python lists." +#: ../../faq/programming.rst:1267 +msgid "" +"If mutability is desired, you could use lists instead of tuples. Here the " +"analogue of a Lisp *car* is ``lisp_list[0]`` and the analogue of *cdr* is " +"``lisp_list[1]``. Only do this if you're sure you really need to, because " +"it's usually a lot slower than using Python lists." msgstr "" +#: ../../faq/programming.rst:1276 msgid "How do I create a multidimensional list?" msgstr "" +#: ../../faq/programming.rst:1278 msgid "You probably tried to make a multidimensional array like this::" msgstr "" +#: ../../faq/programming.rst:1280 msgid ">>> A = [[None] * 2] * 3" msgstr "" +#: ../../faq/programming.rst:1282 msgid "This looks correct if you print it:" msgstr "" +#: ../../faq/programming.rst:1288 msgid "" ">>> A\n" "[[None, None], [None, None], [None, None]]" msgstr "" +#: ../../faq/programming.rst:1293 msgid "But when you assign a value, it shows up in multiple places:" msgstr "" +#: ../../faq/programming.rst:1299 msgid "" ">>> A[0][0] = 5\n" ">>> A\n" "[[5, None], [5, None], [5, None]]" msgstr "" -msgid "The reason is that replicating a list with ``*`` doesn't create copies, it only creates references to the existing objects. The ``*3`` creates a list containing 3 references to the same list of length two. Changes to one row will show in all rows, which is almost certainly not what you want." +#: ../../faq/programming.rst:1305 +msgid "" +"The reason is that replicating a list with ``*`` doesn't create copies, it " +"only creates references to the existing objects. The ``*3`` creates a list " +"containing 3 references to the same list of length two. Changes to one row " +"will show in all rows, which is almost certainly not what you want." msgstr "" -msgid "The suggested approach is to create a list of the desired length first and then fill in each element with a newly created list::" +#: ../../faq/programming.rst:1310 +msgid "" +"The suggested approach is to create a list of the desired length first and " +"then fill in each element with a newly created list::" msgstr "" +#: ../../faq/programming.rst:1313 msgid "" "A = [None] * 3\n" "for i in range(3):\n" " A[i] = [None] * 2" msgstr "" -msgid "This generates a list containing 3 different lists of length two. You can also use a list comprehension::" +#: ../../faq/programming.rst:1317 +msgid "" +"This generates a list containing 3 different lists of length two. You can " +"also use a list comprehension::" msgstr "" +#: ../../faq/programming.rst:1320 msgid "" "w, h = 2, 3\n" "A = [[None] * w for i in range(h)]" msgstr "" -msgid "Or, you can use an extension that provides a matrix datatype; `NumPy `_ is the best known." +#: ../../faq/programming.rst:1323 +msgid "" +"Or, you can use an extension that provides a matrix datatype; `NumPy " +"`_ is the best known." msgstr "" +#: ../../faq/programming.rst:1328 msgid "How do I apply a method or function to a sequence of objects?" msgstr "" -msgid "To call a method or function and accumulate the return values in a list, a :term:`list comprehension` is an elegant solution::" +#: ../../faq/programming.rst:1330 +msgid "" +"To call a method or function and accumulate the return values in a list, " +"a :term:`list comprehension` is an elegant solution::" msgstr "" +#: ../../faq/programming.rst:1333 msgid "" "result = [obj.method() for obj in mylist]\n" "\n" "result = [function(obj) for obj in mylist]" msgstr "" -msgid "To just run the method or function without saving the return values, a plain :keyword:`for` loop will suffice::" +#: ../../faq/programming.rst:1337 +msgid "" +"To just run the method or function without saving the return values, a " +"plain :keyword:`for` loop will suffice::" msgstr "" +#: ../../faq/programming.rst:1340 msgid "" "for obj in mylist:\n" " obj.method()\n" @@ -1254,18 +2050,30 @@ msgid "" " function(obj)" msgstr "" -msgid "Why does a_tuple[i] += ['item'] raise an exception when the addition works?" +#: ../../faq/programming.rst:1350 +msgid "" +"Why does a_tuple[i] += ['item'] raise an exception when the addition works?" msgstr "" -msgid "This is because of a combination of the fact that augmented assignment operators are *assignment* operators, and the difference between mutable and immutable objects in Python." +#: ../../faq/programming.rst:1352 +msgid "" +"This is because of a combination of the fact that augmented assignment " +"operators are *assignment* operators, and the difference between mutable and " +"immutable objects in Python." msgstr "" -msgid "This discussion applies in general when augmented assignment operators are applied to elements of a tuple that point to mutable objects, but we'll use a ``list`` and ``+=`` as our exemplar." +#: ../../faq/programming.rst:1356 +msgid "" +"This discussion applies in general when augmented assignment operators are " +"applied to elements of a tuple that point to mutable objects, but we'll use " +"a ``list`` and ``+=`` as our exemplar." msgstr "" +#: ../../faq/programming.rst:1360 msgid "If you wrote::" msgstr "" +#: ../../faq/programming.rst:1362 msgid "" ">>> a_tuple = (1, 2)\n" ">>> a_tuple[0] += 1\n" @@ -1274,12 +2082,22 @@ msgid "" "TypeError: 'tuple' object does not support item assignment" msgstr "" -msgid "The reason for the exception should be immediately clear: ``1`` is added to the object ``a_tuple[0]`` points to (``1``), producing the result object, ``2``, but when we attempt to assign the result of the computation, ``2``, to element ``0`` of the tuple, we get an error because we can't change what an element of a tuple points to." +#: ../../faq/programming.rst:1368 +msgid "" +"The reason for the exception should be immediately clear: ``1`` is added to " +"the object ``a_tuple[0]`` points to (``1``), producing the result object, " +"``2``, but when we attempt to assign the result of the computation, ``2``, " +"to element ``0`` of the tuple, we get an error because we can't change what " +"an element of a tuple points to." msgstr "" -msgid "Under the covers, what this augmented assignment statement is doing is approximately this::" +#: ../../faq/programming.rst:1374 +msgid "" +"Under the covers, what this augmented assignment statement is doing is " +"approximately this::" msgstr "" +#: ../../faq/programming.rst:1377 msgid "" ">>> result = a_tuple[0] + 1\n" ">>> a_tuple[0] = result\n" @@ -1288,12 +2106,17 @@ msgid "" "TypeError: 'tuple' object does not support item assignment" msgstr "" -msgid "It is the assignment part of the operation that produces the error, since a tuple is immutable." +#: ../../faq/programming.rst:1383 +msgid "" +"It is the assignment part of the operation that produces the error, since a " +"tuple is immutable." msgstr "" +#: ../../faq/programming.rst:1386 msgid "When you write something like::" msgstr "" +#: ../../faq/programming.rst:1388 msgid "" ">>> a_tuple = (['foo'], 'bar')\n" ">>> a_tuple[0] += ['item']\n" @@ -1302,17 +2125,30 @@ msgid "" "TypeError: 'tuple' object does not support item assignment" msgstr "" -msgid "The exception is a bit more surprising, and even more surprising is the fact that even though there was an error, the append worked::" +#: ../../faq/programming.rst:1394 +msgid "" +"The exception is a bit more surprising, and even more surprising is the fact " +"that even though there was an error, the append worked::" msgstr "" +#: ../../faq/programming.rst:1397 msgid "" ">>> a_tuple[0]\n" "['foo', 'item']" msgstr "" -msgid "To see why this happens, you need to know that (a) if an object implements an :meth:`~object.__iadd__` magic method, it gets called when the ``+=`` augmented assignment is executed, and its return value is what gets used in the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent to calling :meth:`~sequence.extend` on the list and returning the list. That's why we say that for lists, ``+=`` is a \"shorthand\" for :meth:`list.extend`::" +#: ../../faq/programming.rst:1400 +msgid "" +"To see why this happens, you need to know that (a) if an object implements " +"an :meth:`~object.__iadd__` magic method, it gets called when the ``+=`` " +"augmented assignment is executed, and its return value is what gets used in " +"the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent " +"to calling :meth:`~sequence.extend` on the list and returning the list. " +"That's why we say that for lists, ``+=`` is a \"shorthand\" " +"for :meth:`list.extend`::" msgstr "" +#: ../../faq/programming.rst:1408 msgid "" ">>> a_list = []\n" ">>> a_list += [1]\n" @@ -1320,20 +2156,29 @@ msgid "" "[1]" msgstr "" +#: ../../faq/programming.rst:1413 msgid "This is equivalent to::" msgstr "" +#: ../../faq/programming.rst:1415 msgid "" ">>> result = a_list.__iadd__([1])\n" ">>> a_list = result" msgstr "" -msgid "The object pointed to by a_list has been mutated, and the pointer to the mutated object is assigned back to ``a_list``. The end result of the assignment is a no-op, since it is a pointer to the same object that ``a_list`` was previously pointing to, but the assignment still happens." +#: ../../faq/programming.rst:1418 +msgid "" +"The object pointed to by a_list has been mutated, and the pointer to the " +"mutated object is assigned back to ``a_list``. The end result of the " +"assignment is a no-op, since it is a pointer to the same object that " +"``a_list`` was previously pointing to, but the assignment still happens." msgstr "" +#: ../../faq/programming.rst:1423 msgid "Thus, in our tuple example what is happening is equivalent to::" msgstr "" +#: ../../faq/programming.rst:1425 msgid "" ">>> result = a_tuple[0].__iadd__(['item'])\n" ">>> a_tuple[0] = result\n" @@ -1342,68 +2187,130 @@ msgid "" "TypeError: 'tuple' object does not support item assignment" msgstr "" -msgid "The :meth:`!__iadd__` succeeds, and thus the list is extended, but even though ``result`` points to the same object that ``a_tuple[0]`` already points to, that final assignment still results in an error, because tuples are immutable." +#: ../../faq/programming.rst:1431 +msgid "" +"The :meth:`!__iadd__` succeeds, and thus the list is extended, but even " +"though ``result`` points to the same object that ``a_tuple[0]`` already " +"points to, that final assignment still results in an error, because tuples " +"are immutable." msgstr "" -msgid "I want to do a complicated sort: can you do a Schwartzian Transform in Python?" +#: ../../faq/programming.rst:1437 +msgid "" +"I want to do a complicated sort: can you do a Schwartzian Transform in " +"Python?" msgstr "" -msgid "The technique, attributed to Randal Schwartz of the Perl community, sorts the elements of a list by a metric which maps each element to its \"sort value\". In Python, use the ``key`` argument for the :meth:`list.sort` method::" +#: ../../faq/programming.rst:1439 +msgid "" +"The technique, attributed to Randal Schwartz of the Perl community, sorts " +"the elements of a list by a metric which maps each element to its \"sort " +"value\". In Python, use the ``key`` argument for the :meth:`list.sort` " +"method::" msgstr "" +#: ../../faq/programming.rst:1443 msgid "" "Isorted = L[:]\n" "Isorted.sort(key=lambda s: int(s[10:15]))" msgstr "" +#: ../../faq/programming.rst:1448 msgid "How can I sort one list by values from another list?" msgstr "" -msgid "Merge them into an iterator of tuples, sort the resulting list, and then pick out the element you want." +#: ../../faq/programming.rst:1450 +msgid "" +"Merge them into an iterator of tuples, sort the resulting list, and then " +"pick out the element you want." msgstr "" +#: ../../faq/programming.rst:1465 msgid "Objects" msgstr "" +#: ../../faq/programming.rst:1468 msgid "What is a class?" msgstr "" -msgid "A class is the particular object type created by executing a class statement. Class objects are used as templates to create instance objects, which embody both the data (attributes) and code (methods) specific to a datatype." +#: ../../faq/programming.rst:1470 +msgid "" +"A class is the particular object type created by executing a class " +"statement. Class objects are used as templates to create instance objects, " +"which embody both the data (attributes) and code (methods) specific to a " +"datatype." msgstr "" -msgid "A class can be based on one or more other classes, called its base class(es). It then inherits the attributes and methods of its base classes. This allows an object model to be successively refined by inheritance. You might have a generic ``Mailbox`` class that provides basic accessor methods for a mailbox, and subclasses such as ``MboxMailbox``, ``MaildirMailbox``, ``OutlookMailbox`` that handle various specific mailbox formats." +#: ../../faq/programming.rst:1474 +msgid "" +"A class can be based on one or more other classes, called its base " +"class(es). It then inherits the attributes and methods of its base classes. " +"This allows an object model to be successively refined by inheritance. You " +"might have a generic ``Mailbox`` class that provides basic accessor methods " +"for a mailbox, and subclasses such as ``MboxMailbox``, ``MaildirMailbox``, " +"``OutlookMailbox`` that handle various specific mailbox formats." msgstr "" +#: ../../faq/programming.rst:1483 msgid "What is a method?" msgstr "" -msgid "A method is a function on some object ``x`` that you normally call as ``x.name(arguments...)``. Methods are defined as functions inside the class definition::" +#: ../../faq/programming.rst:1485 +msgid "" +"A method is a function on some object ``x`` that you normally call as " +"``x.name(arguments...)``. Methods are defined as functions inside the class " +"definition::" msgstr "" +#: ../../faq/programming.rst:1489 msgid "" "class C:\n" " def meth(self, arg):\n" " return arg * 2 + self.attribute" msgstr "" +#: ../../faq/programming.rst:1495 msgid "What is self?" msgstr "" -msgid "Self is merely a conventional name for the first argument of a method. A method defined as ``meth(self, a, b, c)`` should be called as ``x.meth(a, b, c)`` for some instance ``x`` of the class in which the definition occurs; the called method will think it is called as ``meth(x, a, b, c)``." +#: ../../faq/programming.rst:1497 +msgid "" +"Self is merely a conventional name for the first argument of a method. A " +"method defined as ``meth(self, a, b, c)`` should be called as ``x.meth(a, b, " +"c)`` for some instance ``x`` of the class in which the definition occurs; " +"the called method will think it is called as ``meth(x, a, b, c)``." msgstr "" +#: ../../faq/programming.rst:1502 msgid "See also :ref:`why-self`." msgstr "" -msgid "How do I check if an object is an instance of a given class or of a subclass of it?" +#: ../../faq/programming.rst:1506 +msgid "" +"How do I check if an object is an instance of a given class or of a subclass " +"of it?" msgstr "" -msgid "Use the built-in function :func:`isinstance(obj, cls) `. You can check if an object is an instance of any of a number of classes by providing a tuple instead of a single class, for example, ``isinstance(obj, (class1, class2, ...))``, and can also check whether an object is one of Python's built-in types, for example, ``isinstance(obj, str)`` or ``isinstance(obj, (int, float, complex))``." +#: ../../faq/programming.rst:1508 +msgid "" +"Use the built-in function :func:`isinstance(obj, cls) `. You " +"can check if an object is an instance of any of a number of classes by " +"providing a tuple instead of a single class, for example, ``isinstance(obj, " +"(class1, class2, ...))``, and can also check whether an object is one of " +"Python's built-in types, for example, ``isinstance(obj, str)`` or " +"``isinstance(obj, (int, float, complex))``." msgstr "" -msgid "Note that :func:`isinstance` also checks for virtual inheritance from an :term:`abstract base class`. So, the test will return ``True`` for a registered class even if hasn't directly or indirectly inherited from it. To test for \"true inheritance\", scan the :term:`method resolution order` (MRO) of the class:" +#: ../../faq/programming.rst:1515 +msgid "" +"Note that :func:`isinstance` also checks for virtual inheritance from " +"an :term:`abstract base class`. So, the test will return ``True`` for a " +"registered class even if hasn't directly or indirectly inherited from it. " +"To test for \"true inheritance\", scan the :term:`method resolution order` " +"(MRO) of the class:" msgstr "" +#: ../../faq/programming.rst:1521 msgid "" "from collections.abc import Mapping\n" "\n" @@ -1416,6 +2323,7 @@ msgid "" "Mapping.register(P)" msgstr "" +#: ../../faq/programming.rst:1533 msgid "" ">>> c = C()\n" ">>> isinstance(c, C) # direct\n" @@ -1434,9 +2342,17 @@ msgid "" "False" msgstr "" -msgid "Note that most programs do not use :func:`isinstance` on user-defined classes very often. If you are developing the classes yourself, a more proper object-oriented style is to define methods on the classes that encapsulate a particular behaviour, instead of checking the object's class and doing a different thing based on what class it is. For example, if you have a function that does something::" +#: ../../faq/programming.rst:1551 +msgid "" +"Note that most programs do not use :func:`isinstance` on user-defined " +"classes very often. If you are developing the classes yourself, a more " +"proper object-oriented style is to define methods on the classes that " +"encapsulate a particular behaviour, instead of checking the object's class " +"and doing a different thing based on what class it is. For example, if you " +"have a function that does something::" msgstr "" +#: ../../faq/programming.rst:1558 msgid "" "def search(obj):\n" " if isinstance(obj, Mailbox):\n" @@ -1446,9 +2362,13 @@ msgid "" " elif ..." msgstr "" -msgid "A better approach is to define a ``search()`` method on all the classes and just call it::" +#: ../../faq/programming.rst:1565 +msgid "" +"A better approach is to define a ``search()`` method on all the classes and " +"just call it::" msgstr "" +#: ../../faq/programming.rst:1568 msgid "" "class Mailbox:\n" " def search(self):\n" @@ -1461,15 +2381,27 @@ msgid "" "obj.search()" msgstr "" +#: ../../faq/programming.rst:1580 msgid "What is delegation?" msgstr "" -msgid "Delegation is an object-oriented technique (also called a design pattern). Let's say you have an object ``x`` and want to change the behaviour of just one of its methods. You can create a new class that provides a new implementation of the method you're interested in changing and delegates all other methods to the corresponding method of ``x``." +#: ../../faq/programming.rst:1582 +msgid "" +"Delegation is an object-oriented technique (also called a design pattern). " +"Let's say you have an object ``x`` and want to change the behaviour of just " +"one of its methods. You can create a new class that provides a new " +"implementation of the method you're interested in changing and delegates all " +"other methods to the corresponding method of ``x``." msgstr "" -msgid "Python programmers can easily implement delegation. For example, the following class implements a class that behaves like a file but converts all written data to uppercase::" +#: ../../faq/programming.rst:1588 +msgid "" +"Python programmers can easily implement delegation. For example, the " +"following class implements a class that behaves like a file but converts all " +"written data to uppercase::" msgstr "" +#: ../../faq/programming.rst:1592 msgid "" "class UpperOut:\n" "\n" @@ -1483,12 +2415,26 @@ msgid "" " return getattr(self._outfile, name)" msgstr "" -msgid "Here the ``UpperOut`` class redefines the ``write()`` method to convert the argument string to uppercase before calling the underlying ``self._outfile.write()`` method. All other methods are delegated to the underlying ``self._outfile`` object. The delegation is accomplished via the :meth:`~object.__getattr__` method; consult :ref:`the language reference ` for more information about controlling attribute access." +#: ../../faq/programming.rst:1603 +msgid "" +"Here the ``UpperOut`` class redefines the ``write()`` method to convert the " +"argument string to uppercase before calling the underlying " +"``self._outfile.write()`` method. All other methods are delegated to the " +"underlying ``self._outfile`` object. The delegation is accomplished via " +"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " +"` for more information about controlling attribute access." msgstr "" -msgid "Note that for more general cases delegation can get trickier. When attributes must be set as well as retrieved, the class must define a :meth:`~object.__setattr__` method too, and it must do so carefully. The basic implementation of :meth:`!__setattr__` is roughly equivalent to the following::" +#: ../../faq/programming.rst:1610 +msgid "" +"Note that for more general cases delegation can get trickier. When " +"attributes must be set as well as retrieved, the class must define " +"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " +"basic implementation of :meth:`!__setattr__` is roughly equivalent to the " +"following::" msgstr "" +#: ../../faq/programming.rst:1615 msgid "" "class X:\n" " ...\n" @@ -1497,9 +2443,14 @@ msgid "" " ..." msgstr "" -msgid "Many :meth:`~object.__setattr__` implementations call :meth:`!object.__setattr__` to set an attribute on self without causing infinite recursion::" +#: ../../faq/programming.rst:1621 +msgid "" +"Many :meth:`~object.__setattr__` implementations call :meth:`!" +"object.__setattr__` to set an attribute on self without causing infinite " +"recursion::" msgstr "" +#: ../../faq/programming.rst:1624 msgid "" "class X:\n" " def __setattr__(self, name, value):\n" @@ -1507,30 +2458,50 @@ msgid "" " object.__setattr__(self, name, value)" msgstr "" -msgid "Alternatively, it is possible to set attributes by inserting entries into :attr:`self.__dict__ ` directly." +#: ../../faq/programming.rst:1629 +msgid "" +"Alternatively, it is possible to set attributes by inserting entries " +"into :attr:`self.__dict__ ` directly." msgstr "" -msgid "How do I call a method defined in a base class from a derived class that extends it?" +#: ../../faq/programming.rst:1634 +msgid "" +"How do I call a method defined in a base class from a derived class that " +"extends it?" msgstr "" +#: ../../faq/programming.rst:1636 msgid "Use the built-in :func:`super` function::" msgstr "" +#: ../../faq/programming.rst:1638 msgid "" "class Derived(Base):\n" " def meth(self):\n" " super().meth() # calls Base.meth" msgstr "" -msgid "In the example, :func:`super` will automatically determine the instance from which it was called (the ``self`` value), look up the :term:`method resolution order` (MRO) with ``type(self).__mro__``, and return the next in line after ``Derived`` in the MRO: ``Base``." +#: ../../faq/programming.rst:1642 +msgid "" +"In the example, :func:`super` will automatically determine the instance from " +"which it was called (the ``self`` value), look up the :term:`method " +"resolution order` (MRO) with ``type(self).__mro__``, and return the next in " +"line after ``Derived`` in the MRO: ``Base``." msgstr "" +#: ../../faq/programming.rst:1649 msgid "How can I organize my code to make it easier to change the base class?" msgstr "" -msgid "You could assign the base class to an alias and derive from the alias. Then all you have to change is the value assigned to the alias. Incidentally, this trick is also handy if you want to decide dynamically (such as depending on availability of resources) which base class to use. Example::" +#: ../../faq/programming.rst:1651 +msgid "" +"You could assign the base class to an alias and derive from the alias. Then " +"all you have to change is the value assigned to the alias. Incidentally, " +"this trick is also handy if you want to decide dynamically (such as " +"depending on availability of resources) which base class to use. Example::" msgstr "" +#: ../../faq/programming.rst:1656 msgid "" "class Base:\n" " ...\n" @@ -1541,15 +2512,23 @@ msgid "" " ..." msgstr "" +#: ../../faq/programming.rst:1666 msgid "How do I create static class data and static class methods?" msgstr "" -msgid "Both static data and static methods (in the sense of C++ or Java) are supported in Python." +#: ../../faq/programming.rst:1668 +msgid "" +"Both static data and static methods (in the sense of C++ or Java) are " +"supported in Python." msgstr "" -msgid "For static data, simply define a class attribute. To assign a new value to the attribute, you have to explicitly use the class name in the assignment::" +#: ../../faq/programming.rst:1671 +msgid "" +"For static data, simply define a class attribute. To assign a new value to " +"the attribute, you have to explicitly use the class name in the assignment::" msgstr "" +#: ../../faq/programming.rst:1674 msgid "" "class C:\n" " count = 0 # number of times C.__init__ called\n" @@ -1561,18 +2540,30 @@ msgid "" " return C.count # or return self.count" msgstr "" -msgid "``c.count`` also refers to ``C.count`` for any ``c`` such that ``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some class on the base-class search path from ``c.__class__`` back to ``C``." +#: ../../faq/programming.rst:1683 +msgid "" +"``c.count`` also refers to ``C.count`` for any ``c`` such that " +"``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some " +"class on the base-class search path from ``c.__class__`` back to ``C``." msgstr "" -msgid "Caution: within a method of C, an assignment like ``self.count = 42`` creates a new and unrelated instance named \"count\" in ``self``'s own dict. Rebinding of a class-static data name must always specify the class whether inside a method or not::" +#: ../../faq/programming.rst:1687 +msgid "" +"Caution: within a method of C, an assignment like ``self.count = 42`` " +"creates a new and unrelated instance named \"count\" in ``self``'s own " +"dict. Rebinding of a class-static data name must always specify the class " +"whether inside a method or not::" msgstr "" +#: ../../faq/programming.rst:1692 msgid "C.count = 314" msgstr "" +#: ../../faq/programming.rst:1694 msgid "Static methods are possible::" msgstr "" +#: ../../faq/programming.rst:1696 msgid "" "class C:\n" " @staticmethod\n" @@ -1581,26 +2572,39 @@ msgid "" " ..." msgstr "" -msgid "However, a far more straightforward way to get the effect of a static method is via a simple module-level function::" +#: ../../faq/programming.rst:1702 +msgid "" +"However, a far more straightforward way to get the effect of a static method " +"is via a simple module-level function::" msgstr "" +#: ../../faq/programming.rst:1705 msgid "" "def getcount():\n" " return C.count" msgstr "" -msgid "If your code is structured so as to define one class (or tightly related class hierarchy) per module, this supplies the desired encapsulation." +#: ../../faq/programming.rst:1708 +msgid "" +"If your code is structured so as to define one class (or tightly related " +"class hierarchy) per module, this supplies the desired encapsulation." msgstr "" +#: ../../faq/programming.rst:1713 msgid "How can I overload constructors (or methods) in Python?" msgstr "" -msgid "This answer actually applies to all methods, but the question usually comes up first in the context of constructors." +#: ../../faq/programming.rst:1715 +msgid "" +"This answer actually applies to all methods, but the question usually comes " +"up first in the context of constructors." msgstr "" +#: ../../faq/programming.rst:1718 msgid "In C++ you'd write:" msgstr "" +#: ../../faq/programming.rst:1720 msgid "" "class C {\n" " C() { cout << \"No arguments\\n\"; }\n" @@ -1608,9 +2612,13 @@ msgid "" "}" msgstr "" -msgid "In Python you have to write a single constructor that catches all cases using default arguments. For example::" +#: ../../faq/programming.rst:1727 +msgid "" +"In Python you have to write a single constructor that catches all cases " +"using default arguments. For example::" msgstr "" +#: ../../faq/programming.rst:1730 msgid "" "class C:\n" " def __init__(self, i=None):\n" @@ -1620,29 +2628,45 @@ msgid "" " print(\"Argument is\", i)" msgstr "" +#: ../../faq/programming.rst:1737 msgid "This is not entirely equivalent, but close enough in practice." msgstr "" +#: ../../faq/programming.rst:1739 msgid "You could also try a variable-length argument list, for example::" msgstr "" +#: ../../faq/programming.rst:1741 msgid "" "def __init__(self, *args):\n" " ..." msgstr "" +#: ../../faq/programming.rst:1744 msgid "The same approach works for all method definitions." msgstr "" +#: ../../faq/programming.rst:1748 msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "" -msgid "Variable names with double leading underscores are \"mangled\" to provide a simple but effective way to define class private variables. Any identifier of the form ``__spam`` (at least two leading underscores, at most one trailing underscore) is textually replaced with ``_classname__spam``, where ``classname`` is the current class name with any leading underscores stripped." +#: ../../faq/programming.rst:1750 +msgid "" +"Variable names with double leading underscores are \"mangled\" to provide a " +"simple but effective way to define class private variables. Any identifier " +"of the form ``__spam`` (at least two leading underscores, at most one " +"trailing underscore) is textually replaced with ``_classname__spam``, where " +"``classname`` is the current class name with any leading underscores " +"stripped." msgstr "" -msgid "The identifier can be used unchanged within the class, but to access it outside the class, the mangled name must be used:" +#: ../../faq/programming.rst:1756 +msgid "" +"The identifier can be used unchanged within the class, but to access it " +"outside the class, the mangled name must be used:" msgstr "" +#: ../../faq/programming.rst:1759 msgid "" "class A:\n" " def __one(self):\n" @@ -1657,72 +2681,158 @@ msgid "" "four = 4 * A()._A__one()" msgstr "" -msgid "In particular, this does not guarantee privacy since an outside user can still deliberately access the private attribute; many Python programmers never bother to use private variable names at all." +#: ../../faq/programming.rst:1773 +msgid "" +"In particular, this does not guarantee privacy since an outside user can " +"still deliberately access the private attribute; many Python programmers " +"never bother to use private variable names at all." msgstr "" -msgid "The :ref:`private name mangling specifications ` for details and special cases." +#: ../../faq/programming.rst:1779 +msgid "" +"The :ref:`private name mangling specifications ` for " +"details and special cases." msgstr "" +#: ../../faq/programming.rst:1784 msgid "My class defines __del__ but it is not called when I delete the object." msgstr "" +#: ../../faq/programming.rst:1786 msgid "There are several possible reasons for this." msgstr "" -msgid "The :keyword:`del` statement does not necessarily call :meth:`~object.__del__` -- it simply decrements the object's reference count, and if this reaches zero :meth:`!__del__` is called." +#: ../../faq/programming.rst:1788 +msgid "" +"The :keyword:`del` statement does not necessarily " +"call :meth:`~object.__del__` -- it simply decrements the object's reference " +"count, and if this reaches zero :meth:`!__del__` is called." msgstr "" -msgid "If your data structures contain circular links (for example, a tree where each child has a parent reference and each parent has a list of children) the reference counts will never go back to zero. Once in a while Python runs an algorithm to detect such cycles, but the garbage collector might run some time after the last reference to your data structure vanishes, so your :meth:`!__del__` method may be called at an inconvenient and random time. This is inconvenient if you're trying to reproduce a problem. Worse, the order in which object's :meth:`!__del__` methods are executed is arbitrary. You can run :func:`gc.collect` to force a collection, but there *are* pathological cases where objects will never be collected." +#: ../../faq/programming.rst:1792 +msgid "" +"If your data structures contain circular links (for example, a tree where " +"each child has a parent reference and each parent has a list of children) " +"the reference counts will never go back to zero. Once in a while Python " +"runs an algorithm to detect such cycles, but the garbage collector might run " +"some time after the last reference to your data structure vanishes, so " +"your :meth:`!__del__` method may be called at an inconvenient and random " +"time. This is inconvenient if you're trying to reproduce a problem. Worse, " +"the order in which object's :meth:`!__del__` methods are executed is " +"arbitrary. You can run :func:`gc.collect` to force a collection, but there " +"*are* pathological cases where objects will never be collected." msgstr "" -msgid "Despite the cycle collector, it's still a good idea to define an explicit ``close()`` method on objects to be called whenever you're done with them. The ``close()`` method can then remove attributes that refer to subobjects. Don't call :meth:`!__del__` directly -- :meth:`!__del__` should call ``close()`` and ``close()`` should make sure that it can be called more than once for the same object." +#: ../../faq/programming.rst:1803 +msgid "" +"Despite the cycle collector, it's still a good idea to define an explicit " +"``close()`` method on objects to be called whenever you're done with them. " +"The ``close()`` method can then remove attributes that refer to subobjects. " +"Don't call :meth:`!__del__` directly -- :meth:`!__del__` should call " +"``close()`` and ``close()`` should make sure that it can be called more than " +"once for the same object." msgstr "" -msgid "Another way to avoid cyclical references is to use the :mod:`weakref` module, which allows you to point to objects without incrementing their reference count. Tree data structures, for instance, should use weak references for their parent and sibling references (if they need them!)." +#: ../../faq/programming.rst:1810 +msgid "" +"Another way to avoid cyclical references is to use the :mod:`weakref` " +"module, which allows you to point to objects without incrementing their " +"reference count. Tree data structures, for instance, should use weak " +"references for their parent and sibling references (if they need them!)." msgstr "" -msgid "Finally, if your :meth:`!__del__` method raises an exception, a warning message is printed to :data:`sys.stderr`." +#: ../../faq/programming.rst:1823 +msgid "" +"Finally, if your :meth:`!__del__` method raises an exception, a warning " +"message is printed to :data:`sys.stderr`." msgstr "" +#: ../../faq/programming.rst:1828 msgid "How do I get a list of all instances of a given class?" msgstr "" -msgid "Python does not keep track of all instances of a class (or of a built-in type). You can program the class's constructor to keep track of all instances by keeping a list of weak references to each instance." +#: ../../faq/programming.rst:1830 +msgid "" +"Python does not keep track of all instances of a class (or of a built-in " +"type). You can program the class's constructor to keep track of all " +"instances by keeping a list of weak references to each instance." msgstr "" +#: ../../faq/programming.rst:1836 msgid "Why does the result of ``id()`` appear to be not unique?" msgstr "" -msgid "The :func:`id` builtin returns an integer that is guaranteed to be unique during the lifetime of the object. Since in CPython, this is the object's memory address, it happens frequently that after an object is deleted from memory, the next freshly created object is allocated at the same position in memory. This is illustrated by this example:" +#: ../../faq/programming.rst:1838 +msgid "" +"The :func:`id` builtin returns an integer that is guaranteed to be unique " +"during the lifetime of the object. Since in CPython, this is the object's " +"memory address, it happens frequently that after an object is deleted from " +"memory, the next freshly created object is allocated at the same position in " +"memory. This is illustrated by this example:" msgstr "" -msgid "The two ids belong to different integer objects that are created before, and deleted immediately after execution of the ``id()`` call. To be sure that objects whose id you want to examine are still alive, create another reference to the object:" +#: ../../faq/programming.rst:1849 +msgid "" +"The two ids belong to different integer objects that are created before, and " +"deleted immediately after execution of the ``id()`` call. To be sure that " +"objects whose id you want to examine are still alive, create another " +"reference to the object:" msgstr "" +#: ../../faq/programming.rst:1864 msgid "When can I rely on identity tests with the *is* operator?" msgstr "" -msgid "The ``is`` operator tests for object identity. The test ``a is b`` is equivalent to ``id(a) == id(b)``." +#: ../../faq/programming.rst:1866 +msgid "" +"The ``is`` operator tests for object identity. The test ``a is b`` is " +"equivalent to ``id(a) == id(b)``." msgstr "" -msgid "The most important property of an identity test is that an object is always identical to itself, ``a is a`` always returns ``True``. Identity tests are usually faster than equality tests. And unlike equality tests, identity tests are guaranteed to return a boolean ``True`` or ``False``." +#: ../../faq/programming.rst:1869 +msgid "" +"The most important property of an identity test is that an object is always " +"identical to itself, ``a is a`` always returns ``True``. Identity tests are " +"usually faster than equality tests. And unlike equality tests, identity " +"tests are guaranteed to return a boolean ``True`` or ``False``." msgstr "" -msgid "However, identity tests can *only* be substituted for equality tests when object identity is assured. Generally, there are three circumstances where identity is guaranteed:" +#: ../../faq/programming.rst:1874 +msgid "" +"However, identity tests can *only* be substituted for equality tests when " +"object identity is assured. Generally, there are three circumstances where " +"identity is guaranteed:" msgstr "" -msgid "Assignments create new names but do not change object identity. After the assignment ``new = old``, it is guaranteed that ``new is old``." +#: ../../faq/programming.rst:1878 +msgid "" +"Assignments create new names but do not change object identity. After the " +"assignment ``new = old``, it is guaranteed that ``new is old``." msgstr "" -msgid "Putting an object in a container that stores object references does not change object identity. After the list assignment ``s[0] = x``, it is guaranteed that ``s[0] is x``." +#: ../../faq/programming.rst:1881 +msgid "" +"Putting an object in a container that stores object references does not " +"change object identity. After the list assignment ``s[0] = x``, it is " +"guaranteed that ``s[0] is x``." msgstr "" -msgid "If an object is a singleton, it means that only one instance of that object can exist. After the assignments ``a = None`` and ``b = None``, it is guaranteed that ``a is b`` because ``None`` is a singleton." +#: ../../faq/programming.rst:1885 +msgid "" +"If an object is a singleton, it means that only one instance of that object " +"can exist. After the assignments ``a = None`` and ``b = None``, it is " +"guaranteed that ``a is b`` because ``None`` is a singleton." msgstr "" -msgid "In most other circumstances, identity tests are inadvisable and equality tests are preferred. In particular, identity tests should not be used to check constants such as :class:`int` and :class:`str` which aren't guaranteed to be singletons::" +#: ../../faq/programming.rst:1889 +msgid "" +"In most other circumstances, identity tests are inadvisable and equality " +"tests are preferred. In particular, identity tests should not be used to " +"check constants such as :class:`int` and :class:`str` which aren't " +"guaranteed to be singletons::" msgstr "" +#: ../../faq/programming.rst:1894 msgid "" ">>> a = 10_000_000\n" ">>> b = 5_000_000\n" @@ -1737,9 +2847,11 @@ msgid "" "False" msgstr "" +#: ../../faq/programming.rst:1906 msgid "Likewise, new instances of mutable containers are never identical::" msgstr "" +#: ../../faq/programming.rst:1908 msgid "" ">>> a = []\n" ">>> b = []\n" @@ -1747,15 +2859,28 @@ msgid "" "False" msgstr "" -msgid "In the standard library code, you will see several common patterns for correctly using identity tests:" +#: ../../faq/programming.rst:1913 +msgid "" +"In the standard library code, you will see several common patterns for " +"correctly using identity tests:" msgstr "" -msgid "As recommended by :pep:`8`, an identity test is the preferred way to check for ``None``. This reads like plain English in code and avoids confusion with other objects that may have boolean values that evaluate to false." +#: ../../faq/programming.rst:1916 +msgid "" +"As recommended by :pep:`8`, an identity test is the preferred way to check " +"for ``None``. This reads like plain English in code and avoids confusion " +"with other objects that may have boolean values that evaluate to false." msgstr "" -msgid "Detecting optional arguments can be tricky when ``None`` is a valid input value. In those situations, you can create a singleton sentinel object guaranteed to be distinct from other objects. For example, here is how to implement a method that behaves like :meth:`dict.pop`:" +#: ../../faq/programming.rst:1920 +msgid "" +"Detecting optional arguments can be tricky when ``None`` is a valid input " +"value. In those situations, you can create a singleton sentinel object " +"guaranteed to be distinct from other objects. For example, here is how to " +"implement a method that behaves like :meth:`dict.pop`:" msgstr "" +#: ../../faq/programming.rst:1925 msgid "" "_sentinel = object()\n" "\n" @@ -1769,12 +2894,20 @@ msgid "" " return default" msgstr "" -msgid "Container implementations sometimes need to augment equality tests with identity tests. This prevents the code from being confused by objects such as ``float('NaN')`` that are not equal to themselves." +#: ../../faq/programming.rst:1938 +msgid "" +"Container implementations sometimes need to augment equality tests with " +"identity tests. This prevents the code from being confused by objects such " +"as ``float('NaN')`` that are not equal to themselves." msgstr "" -msgid "For example, here is the implementation of :meth:`!collections.abc.Sequence.__contains__`::" +#: ../../faq/programming.rst:1942 +msgid "" +"For example, here is the implementation of :meth:`!" +"collections.abc.Sequence.__contains__`::" msgstr "" +#: ../../faq/programming.rst:1945 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -1783,15 +2916,26 @@ msgid "" " return False" msgstr "" -msgid "How can a subclass control what data is stored in an immutable instance?" +#: ../../faq/programming.rst:1953 +msgid "" +"How can a subclass control what data is stored in an immutable instance?" msgstr "" -msgid "When subclassing an immutable type, override the :meth:`~object.__new__` method instead of the :meth:`~object.__init__` method. The latter only runs *after* an instance is created, which is too late to alter data in an immutable instance." +#: ../../faq/programming.rst:1955 +msgid "" +"When subclassing an immutable type, override the :meth:`~object.__new__` " +"method instead of the :meth:`~object.__init__` method. The latter only runs " +"*after* an instance is created, which is too late to alter data in an " +"immutable instance." msgstr "" -msgid "All of these immutable classes have a different signature than their parent class:" +#: ../../faq/programming.rst:1960 +msgid "" +"All of these immutable classes have a different signature than their parent " +"class:" msgstr "" +#: ../../faq/programming.rst:1963 msgid "" "import datetime as dt\n" "\n" @@ -1815,9 +2959,11 @@ msgid "" " return super().__new__(cls, s)" msgstr "" +#: ../../faq/programming.rst:1986 msgid "The classes can be used like this:" msgstr "" +#: ../../faq/programming.rst:1988 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -1829,27 +2975,52 @@ msgid "" "'blog-why-python-rocks'" msgstr "" +#: ../../faq/programming.rst:2003 msgid "How do I cache method calls?" msgstr "" -msgid "The two principal tools for caching methods are :func:`functools.cached_property` and :func:`functools.lru_cache`. The former stores results at the instance level and the latter at the class level." +#: ../../faq/programming.rst:2005 +msgid "" +"The two principal tools for caching methods " +"are :deco:`functools.cached_property` and :deco:`functools.lru_cache`. The " +"former stores results at the instance level and the latter at the class " +"level." msgstr "" -msgid "The ``cached_property`` approach only works with methods that do not take any arguments. It does not create a reference to the instance. The cached method result will be kept only as long as the instance is alive." +#: ../../faq/programming.rst:2010 +msgid "" +"The ``cached_property`` approach only works with methods that do not take " +"any arguments. It does not create a reference to the instance. The cached " +"method result will be kept only as long as the instance is alive." msgstr "" -msgid "The advantage is that when an instance is no longer used, the cached method result will be released right away. The disadvantage is that if instances accumulate, so too will the accumulated method results. They can grow without bound." +#: ../../faq/programming.rst:2014 +msgid "" +"The advantage is that when an instance is no longer used, the cached method " +"result will be released right away. The disadvantage is that if instances " +"accumulate, so too will the accumulated method results. They can grow " +"without bound." msgstr "" -msgid "The ``lru_cache`` approach works with methods that have :term:`hashable` arguments. It creates a reference to the instance unless special efforts are made to pass in weak references." +#: ../../faq/programming.rst:2019 +msgid "" +"The ``lru_cache`` approach works with methods that have :term:`hashable` " +"arguments. It creates a reference to the instance unless special efforts " +"are made to pass in weak references." msgstr "" -msgid "The advantage of the least recently used algorithm is that the cache is bounded by the specified *maxsize*. The disadvantage is that instances are kept alive until they age out of the cache or until the cache is cleared." +#: ../../faq/programming.rst:2023 +msgid "" +"The advantage of the least recently used algorithm is that the cache is " +"bounded by the specified *maxsize*. The disadvantage is that instances are " +"kept alive until they age out of the cache or until the cache is cleared." msgstr "" +#: ../../faq/programming.rst:2028 msgid "This example shows the various techniques::" msgstr "" +#: ../../faq/programming.rst:2030 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -1874,12 +3045,22 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -msgid "The above example assumes that the *station_id* never changes. If the relevant instance attributes are mutable, the ``cached_property`` approach can't be made to work because it cannot detect changes to the attributes." +#: ../../faq/programming.rst:2052 +msgid "" +"The above example assumes that the *station_id* never changes. If the " +"relevant instance attributes are mutable, the ``cached_property`` approach " +"can't be made to work because it cannot detect changes to the attributes." msgstr "" -msgid "To make the ``lru_cache`` approach work when the *station_id* is mutable, the class needs to define the :meth:`~object.__eq__` and :meth:`~object.__hash__` methods so that the cache can detect relevant attribute updates::" +#: ../../faq/programming.rst:2057 +msgid "" +"To make the ``lru_cache`` approach work when the *station_id* is mutable, " +"the class needs to define the :meth:`~object.__eq__` " +"and :meth:`~object.__hash__` methods so that the cache can detect relevant " +"attribute updates::" msgstr "" +#: ../../faq/programming.rst:2061 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -1902,50 +3083,105 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" +#: ../../faq/programming.rst:2083 msgid "Modules" msgstr "" +#: ../../faq/programming.rst:2086 msgid "How do I create a .pyc file?" msgstr "" -msgid "When a module is imported for the first time (or when the source file has changed since the current compiled file was created) a ``.pyc`` file containing the compiled code should be created in a ``__pycache__`` subdirectory of the directory containing the ``.py`` file. The ``.pyc`` file will have a filename that starts with the same name as the ``.py`` file, and ends with ``.pyc``, with a middle component that depends on the particular ``python`` binary that created it. (See :pep:`3147` for details.)" +#: ../../faq/programming.rst:2088 +msgid "" +"When a module is imported for the first time (or when the source file has " +"changed since the current compiled file was created) a ``.pyc`` file " +"containing the compiled code should be created in a ``__pycache__`` " +"subdirectory of the directory containing the ``.py`` file. The ``.pyc`` " +"file will have a filename that starts with the same name as the ``.py`` " +"file, and ends with ``.pyc``, with a middle component that depends on the " +"particular ``python`` binary that created it. (See :pep:`3147` for details.)" msgstr "" -msgid "One reason that a ``.pyc`` file may not be created is a permissions problem with the directory containing the source file, meaning that the ``__pycache__`` subdirectory cannot be created. This can happen, for example, if you develop as one user but run as another, such as if you are testing with a web server." +#: ../../faq/programming.rst:2096 +msgid "" +"One reason that a ``.pyc`` file may not be created is a permissions problem " +"with the directory containing the source file, meaning that the " +"``__pycache__`` subdirectory cannot be created. This can happen, for " +"example, if you develop as one user but run as another, such as if you are " +"testing with a web server." msgstr "" -msgid "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, creation of a .pyc file is automatic if you're importing a module and Python has the ability (permissions, free space, and so on) to create a ``__pycache__`` subdirectory and write the compiled module to that subdirectory." +#: ../../faq/programming.rst:2101 +msgid "" +"Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " +"creation of a .pyc file is automatic if you're importing a module and Python " +"has the ability (permissions, free space, and so on) to create a " +"``__pycache__`` subdirectory and write the compiled module to that " +"subdirectory." msgstr "" -msgid "Running Python on a top-level script is not considered an import and no ``.pyc`` will be created. For example, if you have a top-level module ``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for ``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created for ``foo`` since ``foo.py`` isn't being imported." +#: ../../faq/programming.rst:2106 +msgid "" +"Running Python on a top-level script is not considered an import and no " +"``.pyc`` will be created. For example, if you have a top-level module " +"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " +"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " +"for ``foo`` since ``foo.py`` isn't being imported." msgstr "" -msgid "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``.pyc`` file for a module that is not imported -- you can, using the :mod:`py_compile` and :mod:`compileall` modules." +#: ../../faq/programming.rst:2113 +msgid "" +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " +"``.pyc`` file for a module that is not imported -- you can, using " +"the :mod:`py_compile` and :mod:`compileall` modules." msgstr "" -msgid "The :mod:`py_compile` module can manually compile any module. One way is to use the ``compile()`` function in that module interactively::" +#: ../../faq/programming.rst:2117 +msgid "" +"The :mod:`py_compile` module can manually compile any module. One way is to " +"use the ``compile()`` function in that module interactively::" msgstr "" +#: ../../faq/programming.rst:2120 msgid "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py')" msgstr "" -msgid "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same location as ``foo.py`` (or you can override that with the optional parameter *cfile*)." +#: ../../faq/programming.rst:2123 +msgid "" +"This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " +"location as ``foo.py`` (or you can override that with the optional parameter " +"*cfile*)." msgstr "" -msgid "You can also automatically compile all files in a directory or directories using the :mod:`compileall` module. You can do it from the shell prompt by running ``compileall.py`` and providing the path of a directory containing Python files to compile::" +#: ../../faq/programming.rst:2127 +msgid "" +"You can also automatically compile all files in a directory or directories " +"using the :mod:`compileall` module. You can do it from the shell prompt by " +"running ``compileall.py`` and providing the path of a directory containing " +"Python files to compile::" msgstr "" +#: ../../faq/programming.rst:2132 msgid "python -m compileall ." msgstr "" +#: ../../faq/programming.rst:2136 msgid "How do I find the current module name?" msgstr "" -msgid "A module can find out its own module name by looking at the predefined global variable ``__name__``. If this has the value ``'__main__'``, the program is running as a script. Many modules that are usually used by importing them also provide a command-line interface or a self-test, and only execute this code after checking ``__name__``::" +#: ../../faq/programming.rst:2138 +msgid "" +"A module can find out its own module name by looking at the predefined " +"global variable ``__name__``. If this has the value ``'__main__'``, the " +"program is running as a script. Many modules that are usually used by " +"importing them also provide a command-line interface or a self-test, and " +"only execute this code after checking ``__name__``::" msgstr "" +#: ../../faq/programming.rst:2144 msgid "" "def main():\n" " print('Running test...')\n" @@ -1955,118 +3191,190 @@ msgid "" " main()" msgstr "" +#: ../../faq/programming.rst:2153 msgid "How can I have modules that mutually import each other?" msgstr "" +#: ../../faq/programming.rst:2155 msgid "Suppose you have the following modules:" msgstr "" +#: ../../faq/programming.rst:2157 msgid ":file:`foo.py`::" msgstr "" +#: ../../faq/programming.rst:2159 msgid "" "from bar import bar_var\n" "foo_var = 1" msgstr "" +#: ../../faq/programming.rst:2162 msgid ":file:`bar.py`::" msgstr "" +#: ../../faq/programming.rst:2164 msgid "" "from foo import foo_var\n" "bar_var = 2" msgstr "" +#: ../../faq/programming.rst:2167 msgid "The problem is that the interpreter will perform the following steps:" msgstr "" +#: ../../faq/programming.rst:2169 msgid "main imports ``foo``" msgstr "" +#: ../../faq/programming.rst:2170 msgid "Empty globals for ``foo`` are created" msgstr "" +#: ../../faq/programming.rst:2171 msgid "``foo`` is compiled and starts executing" msgstr "" +#: ../../faq/programming.rst:2172 msgid "``foo`` imports ``bar``" msgstr "" +#: ../../faq/programming.rst:2173 msgid "Empty globals for ``bar`` are created" msgstr "" +#: ../../faq/programming.rst:2174 msgid "``bar`` is compiled and starts executing" msgstr "" -msgid "``bar`` imports ``foo`` (which is a no-op since there already is a module named ``foo``)" +#: ../../faq/programming.rst:2175 +msgid "" +"``bar`` imports ``foo`` (which is a no-op since there already is a module " +"named ``foo``)" msgstr "" -msgid "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set ``bar.foo_var = foo.foo_var``" +#: ../../faq/programming.rst:2176 +msgid "" +"The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " +"``bar.foo_var = foo.foo_var``" msgstr "" -msgid "The last step fails, because Python isn't done with interpreting ``foo`` yet and the global symbol dictionary for ``foo`` is still empty." +#: ../../faq/programming.rst:2178 +msgid "" +"The last step fails, because Python isn't done with interpreting ``foo`` yet " +"and the global symbol dictionary for ``foo`` is still empty." msgstr "" -msgid "The same thing happens when you use ``import foo``, and then try to access ``foo.foo_var`` in global code." +#: ../../faq/programming.rst:2181 +msgid "" +"The same thing happens when you use ``import foo``, and then try to access " +"``foo.foo_var`` in global code." msgstr "" +#: ../../faq/programming.rst:2184 msgid "There are (at least) three possible workarounds for this problem." msgstr "" -msgid "Guido van Rossum recommends avoiding all uses of ``from import ...``, and placing all code inside functions. Initializations of global variables and class variables should use constants or built-in functions only. This means everything from an imported module is referenced as ``.``." +#: ../../faq/programming.rst:2186 +msgid "" +"Guido van Rossum recommends avoiding all uses of ``from " +"import ...``, and placing all code inside functions. Initializations of " +"global variables and class variables should use constants or built-in " +"functions only. This means everything from an imported module is referenced " +"as ``.``." msgstr "" -msgid "Jim Roskind suggests performing steps in the following order in each module:" +#: ../../faq/programming.rst:2191 +msgid "" +"Jim Roskind suggests performing steps in the following order in each module:" msgstr "" -msgid "exports (globals, functions, and classes that don't need imported base classes)" +#: ../../faq/programming.rst:2193 +msgid "" +"exports (globals, functions, and classes that don't need imported base " +"classes)" msgstr "" +#: ../../faq/programming.rst:2195 msgid "``import`` statements" msgstr "" -msgid "active code (including globals that are initialized from imported values)." +#: ../../faq/programming.rst:2196 +msgid "" +"active code (including globals that are initialized from imported values)." msgstr "" -msgid "Van Rossum doesn't like this approach much because the imports appear in a strange place, but it does work." +#: ../../faq/programming.rst:2198 +msgid "" +"Van Rossum doesn't like this approach much because the imports appear in a " +"strange place, but it does work." msgstr "" -msgid "Matthias Urlichs recommends restructuring your code so that the recursive import is not necessary in the first place." +#: ../../faq/programming.rst:2201 +msgid "" +"Matthias Urlichs recommends restructuring your code so that the recursive " +"import is not necessary in the first place." msgstr "" +#: ../../faq/programming.rst:2204 msgid "These solutions are not mutually exclusive." msgstr "" +#: ../../faq/programming.rst:2208 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "" -msgid "Consider using the convenience function :func:`~importlib.import_module` from :mod:`importlib` instead::" +#: ../../faq/programming.rst:2210 +msgid "" +"Consider using the convenience function :func:`~importlib.import_module` " +"from :mod:`importlib` instead::" msgstr "" +#: ../../faq/programming.rst:2213 msgid "z = importlib.import_module('x.y.z')" msgstr "" -msgid "When I edit an imported module and reimport it, the changes don't show up. Why does this happen?" +#: ../../faq/programming.rst:2217 +msgid "" +"When I edit an imported module and reimport it, the changes don't show up. " +"Why does this happen?" msgstr "" -msgid "For reasons of efficiency as well as consistency, Python only reads the module file on the first time a module is imported. If it didn't, in a program consisting of many modules where each one imports the same basic module, the basic module would be parsed and re-parsed many times. To force re-reading of a changed module, do this::" +#: ../../faq/programming.rst:2219 +msgid "" +"For reasons of efficiency as well as consistency, Python only reads the " +"module file on the first time a module is imported. If it didn't, in a " +"program consisting of many modules where each one imports the same basic " +"module, the basic module would be parsed and re-parsed many times. To force " +"re-reading of a changed module, do this::" msgstr "" +#: ../../faq/programming.rst:2225 msgid "" "import importlib\n" "import modname\n" "importlib.reload(modname)" msgstr "" -msgid "Warning: this technique is not 100% fool-proof. In particular, modules containing statements like::" +#: ../../faq/programming.rst:2229 +msgid "" +"Warning: this technique is not 100% fool-proof. In particular, modules " +"containing statements like::" msgstr "" +#: ../../faq/programming.rst:2232 msgid "from modname import some_objects" msgstr "" -msgid "will continue to work with the old version of the imported objects. If the module contains class definitions, existing class instances will *not* be updated to use the new class definition. This can result in the following paradoxical behaviour::" +#: ../../faq/programming.rst:2234 +msgid "" +"will continue to work with the old version of the imported objects. If the " +"module contains class definitions, existing class instances will *not* be " +"updated to use the new class definition. This can result in the following " +"paradoxical behaviour::" msgstr "" +#: ../../faq/programming.rst:2239 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -2077,9 +3385,13 @@ msgid "" "False" msgstr "" -msgid "The nature of the problem is made clear if you print out the \"identity\" of the class objects::" +#: ../../faq/programming.rst:2247 +msgid "" +"The nature of the problem is made clear if you print out the \"identity\" of " +"the class objects::" msgstr "" +#: ../../faq/programming.rst:2250 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" @@ -2087,14 +3399,18 @@ msgid "" "'0x4198d0'" msgstr "" +#: ../../faq/programming.rst:409 msgid "argument" msgstr "" +#: ../../faq/programming.rst:409 msgid "difference from parameter" msgstr "" +#: ../../faq/programming.rst:409 msgid "parameter" msgstr "" +#: ../../faq/programming.rst:409 msgid "difference from argument" msgstr "" diff --git a/faq/windows.po b/faq/windows.po index 7041e4e47..ebc540a08 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,54 +24,98 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../faq/windows.rst:9 msgid "Python on Windows FAQ" msgstr "" +#: ../../faq/windows.rst:12 msgid "Contents" msgstr "" +#: ../../faq/windows.rst:22 msgid "How do I run a Python program under Windows?" msgstr "" -msgid "This is not necessarily a straightforward question. If you are already familiar with running programs from the Windows command line then everything will seem obvious; otherwise, you might need a little more guidance." +#: ../../faq/windows.rst:24 +msgid "" +"This is not necessarily a straightforward question. If you are already " +"familiar with running programs from the Windows command line then everything " +"will seem obvious; otherwise, you might need a little more guidance." msgstr "" -msgid "Unless you use some sort of integrated development environment, you will end up *typing* Windows commands into what is referred to as a \"Command prompt window\". Usually you can create such a window from your search bar by searching for ``cmd``. You should be able to recognize when you have started such a window because you will see a Windows \"command prompt\", which usually looks like this:" +#: ../../faq/windows.rst:28 +msgid "" +"Unless you use some sort of integrated development environment, you will end " +"up *typing* Windows commands into what is referred to as a \"Command prompt " +"window\". Usually you can create such a window from your search bar by " +"searching for ``cmd``. You should be able to recognize when you have " +"started such a window because you will see a Windows \"command prompt\", " +"which usually looks like this:" msgstr "" +#: ../../faq/windows.rst:35 msgid "C:\\>" msgstr "" -msgid "The letter may be different, and there might be other things after it, so you might just as easily see something like:" +#: ../../faq/windows.rst:39 +msgid "" +"The letter may be different, and there might be other things after it, so " +"you might just as easily see something like:" msgstr "" +#: ../../faq/windows.rst:42 msgid "D:\\YourName\\Projects\\Python>" msgstr "" -msgid "depending on how your computer has been set up and what else you have recently done with it. Once you have started such a window, you are well on the way to running Python programs." +#: ../../faq/windows.rst:46 +msgid "" +"depending on how your computer has been set up and what else you have " +"recently done with it. Once you have started such a window, you are well on " +"the way to running Python programs." msgstr "" -msgid "You need to realize that your Python scripts have to be processed by another program called the Python *interpreter*. The interpreter reads your script, compiles it into bytecodes, and then executes the bytecodes to run your program. So, how do you arrange for the interpreter to handle your Python?" +#: ../../faq/windows.rst:50 +msgid "" +"You need to realize that your Python scripts have to be processed by another " +"program called the Python *interpreter*. The interpreter reads your script, " +"compiles it into bytecodes, and then executes the bytecodes to run your " +"program. So, how do you arrange for the interpreter to handle your Python?" msgstr "" -msgid "First, you need to make sure that your command window recognises the word \"py\" as an instruction to start the interpreter. If you have opened a command window, you should try entering the command ``py`` and hitting return:" +#: ../../faq/windows.rst:55 +msgid "" +"First, you need to make sure that your command window recognises the word " +"\"py\" as an instruction to start the interpreter. If you have opened a " +"command window, you should try entering the command ``py`` and hitting " +"return:" msgstr "" +#: ../../faq/windows.rst:60 msgid "C:\\Users\\YourName> py" msgstr "" +#: ../../faq/windows.rst:64 msgid "You should then see something like:" msgstr "" +#: ../../faq/windows.rst:66 msgid "" -"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32\n" -"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n" +"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit " +"(Intel)] on win32\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" ">>>" msgstr "" -msgid "You have started the interpreter in \"interactive mode\". That means you can enter Python statements or expressions interactively and have them executed or evaluated while you wait. This is one of Python's strongest features. Check it by entering a few expressions of your choice and seeing the results:" +#: ../../faq/windows.rst:72 +msgid "" +"You have started the interpreter in \"interactive mode\". That means you can " +"enter Python statements or expressions interactively and have them executed " +"or evaluated while you wait. This is one of Python's strongest features. " +"Check it by entering a few expressions of your choice and seeing the results:" msgstr "" +#: ../../faq/windows.rst:77 msgid "" ">>> print(\"Hello\")\n" "Hello\n" @@ -79,83 +123,195 @@ msgid "" "'HelloHelloHello'" msgstr "" -msgid "Many people use the interactive mode as a convenient yet highly programmable calculator. When you want to end your interactive Python session, call the :func:`exit` function or hold the :kbd:`Ctrl` key down while you enter a :kbd:`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows command prompt." +#: ../../faq/windows.rst:84 +msgid "" +"Many people use the interactive mode as a convenient yet highly programmable " +"calculator. When you want to end your interactive Python session, call " +"the :func:`exit` function or hold the :kbd:`Ctrl` key down while you enter " +"a :kbd:`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows " +"command prompt." msgstr "" -msgid "You may also find that you have a Start-menu entry such as :menuselection:`Start --> Programs --> Python 3.x --> Python (command line)` that results in you seeing the ``>>>`` prompt in a new window. If so, the window will disappear after you call the :func:`exit` function or enter the :kbd:`Ctrl-Z` character; Windows is running a single \"python\" command in the window, and closes it when you terminate the interpreter." +#: ../../faq/windows.rst:90 +msgid "" +"You may also find that you have a Start-menu entry such " +"as :menuselection:`Start --> Programs --> Python 3.x --> Python (command " +"line)` that results in you seeing the ``>>>`` prompt in a new window. If " +"so, the window will disappear after you call the :func:`exit` function or " +"enter the :kbd:`Ctrl-Z` character; Windows is running a single \"python\" " +"command in the window, and closes it when you terminate the interpreter." msgstr "" -msgid "Now that we know the ``py`` command is recognized, you can give your Python script to it. You'll have to give either an absolute or a relative path to the Python script. Let's say your Python script is located in your desktop and is named ``hello.py``, and your command prompt is nicely opened in your home directory so you're seeing something similar to::" +#: ../../faq/windows.rst:97 +msgid "" +"Now that we know the ``py`` command is recognized, you can give your Python " +"script to it. You'll have to give either an absolute or a relative path to " +"the Python script. Let's say your Python script is located in your desktop " +"and is named ``hello.py``, and your command prompt is nicely opened in your " +"home directory so you're seeing something similar to::" msgstr "" +#: ../../faq/windows.rst:104 msgid "C:\\Users\\YourName>" msgstr "" -msgid "So now you'll ask the ``py`` command to give your script to Python by typing ``py`` followed by your script path::" +#: ../../faq/windows.rst:106 +msgid "" +"So now you'll ask the ``py`` command to give your script to Python by typing " +"``py`` followed by your script path::" msgstr "" +#: ../../faq/windows.rst:110 msgid "" "C:\\Users\\YourName> py Desktop\\hello.py\n" "hello" msgstr "" +#: ../../faq/windows.rst:114 msgid "How do I make Python scripts executable?" msgstr "" -msgid "On Windows, the standard Python installer already associates the .py extension with a file type (Python.File) and gives that file type an open command that runs the interpreter (``D:\\Program Files\\Python\\python.exe \"%1\" %*``). This is enough to make scripts executable from the command prompt as 'foo.py'. If you'd rather be able to execute the script by simple typing 'foo' with no extension you need to add .py to the PATHEXT environment variable." +#: ../../faq/windows.rst:116 +msgid "" +"On Windows, the standard Python installer already associates the .py " +"extension with a file type (Python.File) and gives that file type an open " +"command that runs the interpreter (``D:\\Program Files\\Python\\python.exe " +"\"%1\" %*``). This is enough to make scripts executable from the command " +"prompt as 'foo.py'. If you'd rather be able to execute the script by simple " +"typing 'foo' with no extension you need to add .py to the PATHEXT " +"environment variable." msgstr "" +#: ../../faq/windows.rst:124 msgid "Why does Python sometimes take so long to start?" msgstr "" -msgid "Usually Python starts very quickly on Windows, but occasionally there are bug reports that Python suddenly begins to take a long time to start up. This is made even more puzzling because Python will work fine on other Windows systems which appear to be configured identically." +#: ../../faq/windows.rst:126 +msgid "" +"Usually Python starts very quickly on Windows, but occasionally there are " +"bug reports that Python suddenly begins to take a long time to start up. " +"This is made even more puzzling because Python will work fine on other " +"Windows systems which appear to be configured identically." msgstr "" -msgid "The problem may be caused by a misconfiguration of virus checking software on the problem machine. Some virus scanners have been known to introduce startup overhead of two orders of magnitude when the scanner is configured to monitor all reads from the filesystem. Try checking the configuration of virus scanning software on your systems to ensure that they are indeed configured identically. McAfee, when configured to scan all file system read activity, is a particular offender." +#: ../../faq/windows.rst:131 +msgid "" +"The problem may be caused by a misconfiguration of virus checking software " +"on the problem machine. Some virus scanners have been known to introduce " +"startup overhead of two orders of magnitude when the scanner is configured " +"to monitor all reads from the filesystem. Try checking the configuration of " +"virus scanning software on your systems to ensure that they are indeed " +"configured identically. McAfee, when configured to scan all file system read " +"activity, is a particular offender." msgstr "" +#: ../../faq/windows.rst:141 msgid "How do I make an executable from a Python script?" msgstr "" -msgid "See :ref:`faq-create-standalone-binary` for a list of tools that can be used to make executables." +#: ../../faq/windows.rst:143 +msgid "" +"See :ref:`faq-create-standalone-binary` for a list of tools that can be used " +"to make executables." msgstr "" +#: ../../faq/windows.rst:148 msgid "Is a ``*.pyd`` file the same as a DLL?" msgstr "" -msgid "Yes, .pyd files are dll's, but there are a few differences. If you have a DLL named ``foo.pyd``, then it must have a function ``PyInit_foo()``. You can then write Python \"import foo\", and Python will search for foo.pyd (as well as foo.py, foo.pyc) and if it finds it, will attempt to call ``PyInit_foo()`` to initialize it. You do not link your .exe with foo.lib, as that would cause Windows to require the DLL to be present." +#: ../../faq/windows.rst:150 +msgid "" +"Yes, .pyd files are dll's, but there are a few differences. If you have a " +"DLL named ``foo.pyd``, then it must have a function ``PyInit_foo()``. You " +"can then write Python \"import foo\", and Python will search for foo.pyd (as " +"well as foo.py, foo.pyc) and if it finds it, will attempt to call " +"``PyInit_foo()`` to initialize it. You do not link your .exe with foo.lib, " +"as that would cause Windows to require the DLL to be present." msgstr "" -msgid "Note that the search path for foo.pyd is PYTHONPATH, not the same as the path that Windows uses to search for foo.dll. Also, foo.pyd need not be present to run your program, whereas if you linked your program with a dll, the dll is required. Of course, foo.pyd is required if you want to say ``import foo``. In a DLL, linkage is declared in the source code with ``__declspec(dllexport)``. In a .pyd, linkage is defined in a list of available functions." +#: ../../faq/windows.rst:157 +msgid "" +"Note that the search path for foo.pyd is PYTHONPATH, not the same as the " +"path that Windows uses to search for foo.dll. Also, foo.pyd need not be " +"present to run your program, whereas if you linked your program with a dll, " +"the dll is required. Of course, foo.pyd is required if you want to say " +"``import foo``. In a DLL, linkage is declared in the source code with " +"``__declspec(dllexport)``. In a .pyd, linkage is defined in a list of " +"available functions." msgstr "" +#: ../../faq/windows.rst:166 msgid "How can I embed Python into a Windows application?" msgstr "" -msgid "Embedding the Python interpreter in a Windows app can be summarized as follows:" +#: ../../faq/windows.rst:168 +msgid "" +"Embedding the Python interpreter in a Windows app can be summarized as " +"follows:" msgstr "" -msgid "Do **not** build Python into your .exe file directly. On Windows, Python must be a DLL to handle importing modules that are themselves DLL's. (This is the first key undocumented fact.) Instead, link to :file:`python{NN}.dll`; it is typically installed in ``C:\\Windows\\System``. *NN* is the Python version, a number such as \"33\" for Python 3.3." +#: ../../faq/windows.rst:170 +msgid "" +"Do **not** build Python into your .exe file directly. On Windows, Python " +"must be a DLL to handle importing modules that are themselves DLL's. (This " +"is the first key undocumented fact.) Instead, link " +"to :file:`python{NN}.dll`; it is typically installed in ``C:" +"\\Windows\\System``. *NN* is the Python version, a number such as \"33\" " +"for Python 3.3." msgstr "" -msgid "You can link to Python in two different ways. Load-time linking means linking against :file:`python{NN}.lib`, while run-time linking means linking against :file:`python{NN}.dll`. (General note: :file:`python{NN}.lib` is the so-called \"import lib\" corresponding to :file:`python{NN}.dll`. It merely defines symbols for the linker.)" +#: ../../faq/windows.rst:176 +msgid "" +"You can link to Python in two different ways. Load-time linking means " +"linking against :file:`python{NN}.lib`, while run-time linking means linking " +"against :file:`python{NN}.dll`. (General note: :file:`python{NN}.lib` is " +"the so-called \"import lib\" corresponding to :file:`python{NN}.dll`. It " +"merely defines symbols for the linker.)" msgstr "" -msgid "Run-time linking greatly simplifies link options; everything happens at run time. Your code must load :file:`python{NN}.dll` using the Windows ``LoadLibraryEx()`` routine. The code must also use access routines and data in :file:`python{NN}.dll` (that is, Python's C API's) using pointers obtained by the Windows ``GetProcAddress()`` routine. Macros can make using these pointers transparent to any C code that calls routines in Python's C API." +#: ../../faq/windows.rst:182 +msgid "" +"Run-time linking greatly simplifies link options; everything happens at run " +"time. Your code must load :file:`python{NN}.dll` using the Windows " +"``LoadLibraryEx()`` routine. The code must also use access routines and " +"data in :file:`python{NN}.dll` (that is, Python's C API's) using pointers " +"obtained by the Windows ``GetProcAddress()`` routine. Macros can make using " +"these pointers transparent to any C code that calls routines in Python's C " +"API." msgstr "" -msgid "If you use SWIG, it is easy to create a Python \"extension module\" that will make the app's data and methods available to Python. SWIG will handle just about all the grungy details for you. The result is C code that you link *into* your .exe file (!) You do **not** have to create a DLL file, and this also simplifies linking." +#: ../../faq/windows.rst:191 +msgid "" +"If you use SWIG, it is easy to create a Python \"extension module\" that " +"will make the app's data and methods available to Python. SWIG will handle " +"just about all the grungy details for you. The result is C code that you " +"link *into* your .exe file (!) You do **not** have to create a DLL file, " +"and this also simplifies linking." msgstr "" -msgid "SWIG will create an init function (a C function) whose name depends on the name of the extension module. For example, if the name of the module is leo, the init function will be called initleo(). If you use SWIG shadow classes, as you should, the init function will be called initleoc(). This initializes a mostly hidden helper class used by the shadow class." +#: ../../faq/windows.rst:197 +msgid "" +"SWIG will create an init function (a C function) whose name depends on the " +"name of the extension module. For example, if the name of the module is " +"leo, the init function will be called initleo(). If you use SWIG shadow " +"classes, as you should, the init function will be called initleoc(). This " +"initializes a mostly hidden helper class used by the shadow class." msgstr "" -msgid "The reason you can link the C code in step 2 into your .exe file is that calling the initialization function is equivalent to importing the module into Python! (This is the second key undocumented fact.)" +#: ../../faq/windows.rst:203 +msgid "" +"The reason you can link the C code in step 2 into your .exe file is that " +"calling the initialization function is equivalent to importing the module " +"into Python! (This is the second key undocumented fact.)" msgstr "" -msgid "In short, you can use the following code to initialize the Python interpreter with your extension module." +#: ../../faq/windows.rst:207 +msgid "" +"In short, you can use the following code to initialize the Python " +"interpreter with your extension module." msgstr "" +#: ../../faq/windows.rst:210 msgid "" "#include \n" "...\n" @@ -164,53 +320,110 @@ msgid "" "PyRun_SimpleString(\"import myApp\"); // Import the shadow class." msgstr "" -msgid "There are two problems with Python's C API which will become apparent if you use a compiler other than MSVC, the compiler used to build pythonNN.dll." +#: ../../faq/windows.rst:218 +msgid "" +"There are two problems with Python's C API which will become apparent if you " +"use a compiler other than MSVC, the compiler used to build pythonNN.dll." msgstr "" -msgid "Problem 1: The so-called \"Very High Level\" functions that take ``FILE *`` arguments will not work in a multi-compiler environment because each compiler's notion of a ``struct FILE`` will be different. From an implementation standpoint these are very low level functions." +#: ../../faq/windows.rst:221 +msgid "" +"Problem 1: The so-called \"Very High Level\" functions that take ``FILE *`` " +"arguments will not work in a multi-compiler environment because each " +"compiler's notion of a ``struct FILE`` will be different. From an " +"implementation standpoint these are very low level functions." msgstr "" -msgid "Problem 2: SWIG generates the following code when generating wrappers to void functions:" +#: ../../faq/windows.rst:226 +msgid "" +"Problem 2: SWIG generates the following code when generating wrappers to " +"void functions:" msgstr "" +#: ../../faq/windows.rst:229 msgid "" "Py_INCREF(Py_None);\n" "_resultobj = Py_None;\n" "return _resultobj;" msgstr "" -msgid "Alas, Py_None is a macro that expands to a reference to a complex data structure called _Py_NoneStruct inside pythonNN.dll. Again, this code will fail in a mult-compiler environment. Replace such code by:" +#: ../../faq/windows.rst:235 +msgid "" +"Alas, Py_None is a macro that expands to a reference to a complex data " +"structure called _Py_NoneStruct inside pythonNN.dll. Again, this code will " +"fail in a mult-compiler environment. Replace such code by:" msgstr "" +#: ../../faq/windows.rst:239 msgid "return Py_BuildValue(\"\");" msgstr "" -msgid "It may be possible to use SWIG's ``%typemap`` command to make the change automatically, though I have not been able to get this to work (I'm a complete SWIG newbie)." +#: ../../faq/windows.rst:243 +msgid "" +"It may be possible to use SWIG's ``%typemap`` command to make the change " +"automatically, though I have not been able to get this to work (I'm a " +"complete SWIG newbie)." msgstr "" -msgid "Using a Python shell script to put up a Python interpreter window from inside your Windows app is not a good idea; the resulting window will be independent of your app's windowing system. Rather, you (or the wxPythonWindow class) should create a \"native\" interpreter window. It is easy to connect that window to the Python interpreter. You can redirect Python's i/o to _any_ object that supports read and write, so all you need is a Python object (defined in your extension module) that contains read() and write() methods." +#: ../../faq/windows.rst:247 +msgid "" +"Using a Python shell script to put up a Python interpreter window from " +"inside your Windows app is not a good idea; the resulting window will be " +"independent of your app's windowing system. Rather, you (or the " +"wxPythonWindow class) should create a \"native\" interpreter window. It is " +"easy to connect that window to the Python interpreter. You can redirect " +"Python's i/o to _any_ object that supports read and write, so all you need " +"is a Python object (defined in your extension module) that contains read() " +"and write() methods." msgstr "" +#: ../../faq/windows.rst:256 msgid "How do I keep editors from inserting tabs into my Python source?" msgstr "" -msgid "The FAQ does not recommend using tabs, and the Python style guide, :pep:`8`, recommends 4 spaces for distributed Python code; this is also the Emacs python-mode default." +#: ../../faq/windows.rst:258 +msgid "" +"The FAQ does not recommend using tabs, and the Python style guide, :pep:`8`, " +"recommends 4 spaces for distributed Python code; this is also the Emacs " +"python-mode default." msgstr "" -msgid "Under any editor, mixing tabs and spaces is a bad idea. MSVC is no different in this respect, and is easily configured to use spaces: Take :menuselection:`Tools --> Options --> Tabs`, and for file type \"Default\" set \"Tab size\" and \"Indent size\" to 4, and select the \"Insert spaces\" radio button." +#: ../../faq/windows.rst:262 +msgid "" +"Under any editor, mixing tabs and spaces is a bad idea. MSVC is no " +"different in this respect, and is easily configured to use spaces: " +"Take :menuselection:`Tools --> Options --> Tabs`, and for file type " +"\"Default\" set \"Tab size\" and \"Indent size\" to 4, and select the " +"\"Insert spaces\" radio button." msgstr "" -msgid "Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs and spaces are causing problems in leading whitespace. You may also run the :mod:`tabnanny` module to check a directory tree in batch mode." +#: ../../faq/windows.rst:267 +msgid "" +"Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs and " +"spaces are causing problems in leading whitespace. You may also run " +"the :mod:`tabnanny` module to check a directory tree in batch mode." msgstr "" +#: ../../faq/windows.rst:274 msgid "How do I check for a keypress without blocking?" msgstr "" -msgid "Use the :mod:`msvcrt` module. This is a standard Windows-specific extension module. It defines a function ``kbhit()`` which checks whether a keyboard hit is present, and ``getch()`` which gets one character without echoing it." +#: ../../faq/windows.rst:276 +msgid "" +"Use the :mod:`msvcrt` module. This is a standard Windows-specific extension " +"module. It defines a function ``kbhit()`` which checks whether a keyboard " +"hit is present, and ``getch()`` which gets one character without echoing it." msgstr "" +#: ../../faq/windows.rst:281 msgid "How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error?" msgstr "" -msgid "This can occur on Python 3.5 and later when using Windows 8.1 or earlier without all updates having been installed. First ensure your operating system is supported and is up to date, and if that does not resolve the issue, visit the `Microsoft support page `_ for guidance on manually installing the C Runtime update." +#: ../../faq/windows.rst:283 +msgid "" +"This can occur on Python 3.5 and later when using Windows 8.1 or earlier " +"without all updates having been installed. First ensure your operating " +"system is supported and is up to date, and if that does not resolve the " +"issue, visit the `Microsoft support page `_ for guidance on manually installing the C Runtime update." msgstr "" diff --git a/glossary.po b/glossary.po index 2dc5ac2e9..07312b5b6 100644 --- a/glossary.po +++ b/glossary.po @@ -16,8 +16,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" -"PO-Revision-Date: 2026-08-24 16:15+0330\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" +"PO-Revision-Date: 2026-08-25 20:53+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -27,60 +27,111 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.6\n" +#: ../../glossary.rst:5 msgid "Glossary" msgstr "واژه‌نامه" +#: ../../glossary.rst:10 msgid "``>>>``" msgstr "``>>>``" +#: ../../glossary.rst:12 msgid "The default Python prompt of the :term:`interactive` shell. Often seen for code examples which can be executed interactively in the interpreter." msgstr "اعلان پیش‌فرض پایتون در پوستهٔ :term:`تعاملی `. اغلب برای نمونه‌های کدی دیده می‌شود که می‌توان آن‌ها را به‌صورت تعاملی در مفسر اجرا کرد." +#: ../../glossary.rst:15 msgid "``...``" msgstr "``...``" +#: ../../glossary.rst:17 msgid "Can refer to:" msgstr "می‌تواند به موارد زیر اشاره کند:" -msgid "The default Python prompt of the :term:`interactive` shell when entering the code for an indented code block, when within a pair of matching left and right delimiters (parentheses, square brackets, curly braces or triple quotes), or after specifying a decorator." -msgstr "اعلان پیش‌فرض پایتون در پوستهٔ :term:`تعاملی ` هنگام وارد کردن کد برای یک بلوک کد تورفته، زمانی که درون یک جفت جداکنندهٔ چپ و راست متناظر (پرانتزها، کروشه‌ها، آکولادها یا علامت‌های نقل‌قول سه‌گانه) قرار دارید، یا پس از مشخص کردن یک دکوراتور." +#: ../../glossary.rst:19 +msgid "" +"The default Python prompt of the :term:`interactive` shell when entering the code for an indented code block, when within a pair of matching left and right " +"delimiters (parentheses, square brackets, curly braces or triple quotes), or after specifying a decorator." +msgstr "" +"اعلان پیش‌فرض پایتون در پوستهٔ :term:`تعاملی ` هنگام وارد کردن کد برای یک بلوک کد تورفته، زمانی که درون یک جفت جداکنندهٔ چپ و راست متناظر (پرانتزها، " +"کروشه‌ها، آکولادها یا علامت‌های نقل‌قول سه‌گانه) قرار دارید، یا پس از مشخص کردن یک دکوراتور." +#: ../../glossary.rst:26 msgid "The three dots form of the :ref:`Ellipsis ` object." msgstr "شکل سه‌نقطه‌ای شیء :ref:`Ellipsis `." +#: ../../glossary.rst:27 msgid "abstract base class" msgstr "کلاس پایهٔ انتزاعی" -msgid "Abstract base classes complement :term:`duck-typing` by providing a way to define interfaces when other techniques like :func:`hasattr` would be clumsy or subtly wrong (for example with :ref:`magic methods `). ABCs introduce virtual subclasses, which are classes that don't inherit from a class but are still recognized by :func:`isinstance` and :func:`issubclass`; see the :mod:`abc` module documentation. Python comes with many built-in ABCs for data structures (in the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` module), import finders and loaders (in the :mod:`importlib.abc` module). You can create your own ABCs with the :mod:`abc` module." -msgstr "کلاس‌های پایهٔ انتزاعی با فراهم کردن روشی برای تعریف رابط‌ها، زمانی که تکنیک‌های دیگری مانند :func:`hasattr` دست‌وپاگیر یا به‌طور ضمنی نادرست هستند (برای مثال با :ref:`magic methods `)، :term:`نوع‌دهی اردکی ` را تکمیل می‌کنند. ABCها زیرکلاس‌های مجازی معرفی می‌کنند، که کلاس‌هایی هستند که از یک کلاس دیگر به ارث نمی‌برند اما همچنان توسط :func:`isinstance` و :func:`issubclass` شناخته می‌شوند؛ مستندات ماژول :mod:`abc` را ببینید. پایتون همراه با ABCهای توکار بسیاری برای ساختارهای داده (در ماژول :mod:`collections.abc`)، اعداد (در ماژول :mod:`numbers`)، جریان‌ها (در ماژول :mod:`io`)، یابنده‌ها و بارگذارهای ایمپورت (در ماژول :mod:`importlib.abc`) ارائه می‌شود. شما می‌توانید ABCهای سفارشی خود را با ماژول :mod:`abc` ایجاد کنید." +#: ../../glossary.rst:29 +msgid "" +"Abstract base classes complement :term:`duck-typing` by providing a way to define interfaces when other techniques like :func:`hasattr` would be clumsy or subtly " +"wrong (for example with :ref:`magic methods `). ABCs introduce virtual subclasses, which are classes that don't inherit from a class but are " +"still recognized by :func:`isinstance` and :func:`issubclass`; see the :mod:`abc` module documentation. Python comes with many built-in ABCs for data structures " +"(in the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` module), import finders and loaders (in " +"the :mod:`importlib.abc` module). You can create your own ABCs with the :mod:`abc` module." +msgstr "" +"کلاس‌های پایهٔ انتزاعی با فراهم کردن روشی برای تعریف رابط‌ها، زمانی که تکنیک‌های دیگری مانند :func:`hasattr` دست‌وپاگیر یا به‌طور ضمنی نادرست هستند (برای مثال " +"با :ref:`magic methods `)، :term:`نوع‌دهی اردکی ` را تکمیل می‌کنند. ABCها زیرکلاس‌های مجازی معرفی می‌کنند، که کلاس‌هایی هستند که از یک " +"کلاس دیگر به ارث نمی‌برند اما همچنان توسط :func:`isinstance` و :func:`issubclass` شناخته می‌شوند؛ مستندات ماژول :mod:`abc` را ببینید. پایتون همراه با ABCهای توکار " +"بسیاری برای ساختارهای داده (در ماژول :mod:`collections.abc`)، اعداد (در ماژول :mod:`numbers`)، جریان‌ها (در ماژول :mod:`io`)، یابنده‌ها و بارگذارهای ایمپورت (در " +"ماژول :mod:`importlib.abc`) ارائه می‌شود. شما می‌توانید ABCهای سفارشی خود را با ماژول :mod:`abc` ایجاد کنید." +#: ../../glossary.rst:40 msgid "annotate function" msgstr "توابع حاشیه‌گذاری" -msgid "A callable that can be called to retrieve the :term:`annotations ` of an object. Annotate functions are usually :term:`functions `, automatically generated as the :attr:`~object.__annotate__` attribute of functions, classes, and modules. Annotate functions are a subset of :term:`evaluate functions `." -msgstr "فراخوانی‌پذیری که می‌توان آن را برای بازیابی :term:`حاشیه‌گذاری ` یک شیء فراخوانی کرد. توابع حاشیه‌گذاری معمولاً :term:`تابع ` هستند که به‌صورت خودکار به‌عنوان ویژگی :attr:`~object.__annotate__` توابع، کلاس‌ها و ماژول‌ها تولید می‌شوند. توابع حاشیه‌گذاری زیرمجموعه‌ای از :term:`تابع ارزیابی ` هستند." +#: ../../glossary.rst:42 +msgid "" +"A callable that can be called to retrieve the :term:`annotations ` of an object. Annotate functions are usually :term:`functions `, " +"automatically generated as the :attr:`~object.__annotate__` attribute of functions, classes, and modules. Annotate functions are a subset of :term:`evaluate " +"functions `." +msgstr "" +"فراخوانی‌پذیری که می‌توان آن را برای بازیابی :term:`حاشیه‌گذاری ` یک شیء فراخوانی کرد. توابع حاشیه‌گذاری معمولاً :term:`تابع ` هستند که به‌صورت " +"خودکار به‌عنوان ویژگی :attr:`~object.__annotate__` توابع، کلاس‌ها و ماژول‌ها تولید می‌شوند. توابع حاشیه‌گذاری زیرمجموعه‌ای از :term:`تابع ارزیابی ` " +"هستند." +#: ../../glossary.rst:47 msgid "annotation" msgstr "حاشیه‌گذاری" +#: ../../glossary.rst:49 msgid "A label associated with a variable, a class attribute or a function parameter or return value, used by convention as a :term:`type hint`." msgstr "برچسبی مرتبط با یک متغیر، یک ویژگی کلاس، یا یک پارامتر تابع یا مقدار بازگشتی، که طبق قرارداد به‌عنوان یک :term:`راهنمای نوع ` استفاده می‌شود." -msgid "Annotations of local variables cannot be accessed at runtime, but annotations of global variables, class attributes, and functions can be retrieved by calling :func:`annotationlib.get_annotations` on modules, classes, and functions, respectively." -msgstr "حاشیه‌گذاری‌های متغیرهای محلی را نمی‌توان در زمان ران‌تایم دسترسی کرد، اما حاشیه‌گذاری‌های متغیرهای سراسری، ویژگی‌های کلاس و توابع را می‌توان با فراخوانی :func:`annotationlib.get_annotations` به‌ترتیب روی ماژول‌ها، کلاس‌ها و توابع بازیابی کرد." +#: ../../glossary.rst:53 +msgid "" +"Annotations of local variables cannot be accessed at runtime, but annotations of global variables, class attributes, and functions can be retrieved by " +"calling :func:`annotationlib.get_annotations` on modules, classes, and functions, respectively." +msgstr "" +"حاشیه‌گذاری‌های متغیرهای محلی را نمی‌توان در زمان ران‌تایم دسترسی کرد، اما حاشیه‌گذاری‌های متغیرهای سراسری، ویژگی‌های کلاس و توابع را می‌توان با " +"فراخوانی :func:`annotationlib.get_annotations` به‌ترتیب روی ماژول‌ها، کلاس‌ها و توابع بازیابی کرد." -msgid "See :term:`variable annotation`, :term:`function annotation`, :pep:`484`, :pep:`526`, and :pep:`649`, which describe this functionality. Also see :ref:`annotations-howto` for best practices on working with annotations." -msgstr "همچنین به :term:`حاشیه‌نویسی متغیر `، :term:`حاشیه‌گذاری تابع `، :pep:`484`، :pep:`526` و :pep:`649` مراجعه کنید که این قابلیت را توضیح می‌دهند. همچنین برای بهترین روش‌ها در کار با حاشیه‌گذاری‌ها، :ref:`annotations-howto` را ببینید." +#: ../../glossary.rst:58 +msgid "" +"See :term:`variable annotation`, :term:`function annotation`, :pep:`484`, :pep:`526`, and :pep:`649`, which describe this functionality. Also " +"see :ref:`annotations-howto` for best practices on working with annotations." +msgstr "" +"همچنین به :term:`حاشیه‌نویسی متغیر `، :term:`حاشیه‌گذاری تابع `، :pep:`484`، :pep:`526` و :pep:`649` مراجعه کنید که این " +"قابلیت را توضیح می‌دهند. همچنین برای بهترین روش‌ها در کار با حاشیه‌گذاری‌ها، :ref:`annotations-howto` را ببینید." +#: ../../glossary.rst:62 msgid "argument" msgstr "آرگومان" +#: ../../glossary.rst:64 msgid "A value passed to a :term:`function` (or :term:`method`) when calling the function. There are two kinds of argument:" msgstr "مقداری که هنگام فراخوانی یک :term:`تابع ` (یا :term:`متد `) به آن تابع ارسال می‌شود. دو نوع آرگومان وجود دارد:" -msgid ":dfn:`keyword argument`: an argument preceded by an identifier (e.g. ``name=``) in a function call or passed as a value in a dictionary preceded by ``**``. For example, ``3`` and ``5`` are both keyword arguments in the following calls to :func:`complex`::" -msgstr ":dfn:`keyword argument`: آرگومانی که در فراخوانی تابع با یک شناسه (برای مثال ``name=``) پیش از آن قرار گرفته است، یا به‌عنوان مقداری در یک دیکشنری که پیش از آن ``**`` آمده است، ارسال می‌شود. برای مثال، ``3`` و ``5`` هر دو در فراخوانی‌های زیر از :func:`complex` آرگومان کلیدواژه‌ای هستند::" +#: ../../glossary.rst:67 +msgid "" +":dfn:`keyword argument`: an argument preceded by an identifier (e.g. ``name=``) in a function call or passed as a value in a dictionary preceded by ``**``. For " +"example, ``3`` and ``5`` are both keyword arguments in the following calls to :func:`complex`::" +msgstr "" +":dfn:`keyword argument`: آرگومانی که در فراخوانی تابع با یک شناسه (برای مثال ``name=``) پیش از آن قرار گرفته است، یا به‌عنوان مقداری در یک دیکشنری که پیش از آن " +"``**`` آمده است، ارسال می‌شود. برای مثال، ``3`` و ``5`` هر دو در فراخوانی‌های زیر از :func:`complex` آرگومان کلیدواژه‌ای هستند::" +#: ../../glossary.rst:72 msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" @@ -88,9 +139,15 @@ msgstr "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" -msgid ":dfn:`positional argument`: an argument that is not a keyword argument. Positional arguments can appear at the beginning of an argument list and/or be passed as elements of an :term:`iterable` preceded by ``*``. For example, ``3`` and ``5`` are both positional arguments in the following calls::" -msgstr ":dfn:`positional argument`: آرگومانی که آرگومان کلیدواژه‌ای نیست. آرگومان‌های جایگاهی می‌توانند در ابتدای یک فهرست آرگومان ظاهر شوند و/یا به‌عنوان عناصر یک :term:`تکرارپذیر ` که پیش از آن ``*`` آمده است، ارسال شوند. برای مثال، ``3`` و ``5`` هر دو در فراخوانی‌های زیر آرگومان جایگاهی هستند::" +#: ../../glossary.rst:75 +msgid "" +":dfn:`positional argument`: an argument that is not a keyword argument. Positional arguments can appear at the beginning of an argument list and/or be passed as " +"elements of an :term:`iterable` preceded by ``*``. For example, ``3`` and ``5`` are both positional arguments in the following calls::" +msgstr "" +":dfn:`positional argument`: آرگومانی که آرگومان کلیدواژه‌ای نیست. آرگومان‌های جایگاهی می‌توانند در ابتدای یک فهرست آرگومان ظاهر شوند و/یا به‌عنوان عناصر " +"یک :term:`تکرارپذیر ` که پیش از آن ``*`` آمده است، ارسال شوند. برای مثال، ``3`` و ``5`` هر دو در فراخوانی‌های زیر آرگومان جایگاهی هستند::" +#: ../../glossary.rst:81 msgid "" "complex(3, 5)\n" "complex(*(3, 5))" @@ -98,171 +155,351 @@ msgstr "" "complex(3, 5)\n" "complex(*(3, 5))" -msgid "Arguments are assigned to the named local variables in a function body. See the :ref:`calls` section for the rules governing this assignment. Syntactically, any expression can be used to represent an argument; the evaluated value is assigned to the local variable." -msgstr "آرگومان‌ها به متغیرهای محلی نام‌گذاری‌شده در بدنهٔ یک تابع اختصاص داده می‌شوند. برای قوانین حاکم بر این تخصیص، بخش :ref:`calls` را ببینید. از نظر سینتکس، هر عبارتی می‌تواند برای نمایش یک آرگومان استفاده شود؛ مقدار ارزیابی‌شده به متغیر محلی اختصاص داده می‌شود." +#: ../../glossary.rst:84 +msgid "" +"Arguments are assigned to the named local variables in a function body. See the :ref:`calls` section for the rules governing this assignment. Syntactically, any " +"expression can be used to represent an argument; the evaluated value is assigned to the local variable." +msgstr "" +"آرگومان‌ها به متغیرهای محلی نام‌گذاری‌شده در بدنهٔ یک تابع اختصاص داده می‌شوند. برای قوانین حاکم بر این تخصیص، بخش :ref:`calls` را ببینید. از نظر سینتکس، هر عبارتی " +"می‌تواند برای نمایش یک آرگومان استفاده شود؛ مقدار ارزیابی‌شده به متغیر محلی اختصاص داده می‌شود." -msgid "See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the difference between arguments and parameters `, and :pep:`362`." -msgstr "همچنین به ورودی واژه‌نامه‌ای :term:`پارامتر `، پرسش متداول دربارهٔ :ref:`تفاوت بین آرگومان‌ها و پارامترها ` و :pep:`362` مراجعه کنید." +#: ../../glossary.rst:89 +msgid "" +"See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the difference between arguments and parameters `, " +"and :pep:`362`." +msgstr "" +"همچنین به ورودی واژه‌نامه‌ای :term:`پارامتر `، پرسش متداول دربارهٔ :ref:`تفاوت بین آرگومان‌ها و پارامترها ` و :pep:`362` مراجعه " +"کنید." +#: ../../glossary.rst:92 msgid "asynchronous context manager" msgstr "مدیر زمینهٔ ناهمگام" -msgid "An object which controls the environment seen in an :keyword:`async with` statement by defining :meth:`~object.__aenter__` and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." -msgstr "شی‌ءای که با تعریف متدهای :meth:`~object.__aenter__` و :meth:`~object.__aexit__`، محیط مشاهده‌شده در یک دستور :keyword:`async with` را کنترل می‌کند. این قابلیت توسط :pep:`492` معرفی شد." +#: ../../glossary.rst:94 +msgid "" +"An object which controls the environment seen in an :keyword:`async with` statement by defining :meth:`~object.__aenter__` and :meth:`~object.__aexit__` methods. " +"Introduced by :pep:`492`." +msgstr "" +"شی‌ءای که با تعریف متدهای :meth:`~object.__aenter__` و :meth:`~object.__aexit__`، محیط مشاهده‌شده در یک دستور :keyword:`async with` را کنترل می‌کند. این قابلیت " +"توسط :pep:`492` معرفی شد." +#: ../../glossary.rst:97 msgid "asynchronous generator" msgstr "تولیدگر ناهمگام" -msgid "A function which returns an :term:`asynchronous generator iterator`. It looks like a coroutine function defined with :keyword:`async def` except that it contains :keyword:`yield` expressions for producing a series of values usable in an :keyword:`async for` loop." -msgstr "تابعی که یک :term:`تکرارگر تولیدگر ناهمگام ` بازمی‌گرداند. این تابع شبیه یک تابع هم‌روال که با :keyword:`async def` تعریف شده است به نظر می‌رسد، با این تفاوت که شامل عبارت‌های :keyword:`yield` برای تولید مجموعه‌ای از مقادیر قابل استفاده در یک حلقهٔ :keyword:`async for` است." +#: ../../glossary.rst:99 +msgid "" +"Informally used to mean either an :term:`asynchronous generator function` or an :term:`asynchronous generator iterator`, depending on context. The formal " +"terms :term:`asynchronous generator function` and :term:`asynchronous generator iterator` are uncommon in practice; \"asynchronous generator\" alone is almost " +"always sufficient." +msgstr "" +"به‌صورت غیررسمی برای اشاره به یک :term:`تابع هم‌تولیدگر ناهمگام ` یا یک :term:`تکرارگر تولیدگر ناهمگام `، بسته به زمینه، استفاده می‌شود. اصطلاحات رسمی :term:`تابع تولیدگر ناهمگام ` و :term:`تکرارگر تولیدگر ناهمگام ` در عمل کمتر استفاده می‌شوند؛ «تولیدگر ناهمگام» به‌تنهایی تقریباً همیشه کافی است." -msgid "Usually refers to an asynchronous generator function, but may refer to an *asynchronous generator iterator* in some contexts. In cases where the intended meaning isn't clear, using the full terms avoids ambiguity." -msgstr "معمولاً به یک تابع تولیدگر ناهمگام اشاره دارد، اما در برخی زمینه‌ها ممکن است به یک *تکرارگر تولیدگر ناهمگام* اشاره کند. در مواردی که معنای مورد نظر واضح نیست، استفاده از اصطلاحات کامل از ابهام جلوگیری می‌کند." +#: ../../glossary.rst:104 +msgid "asynchronous generator function" +msgstr "تابع تولیدگر ناهمگام" +#: ../../glossary.rst:106 +msgid "" +"A function which returns an :term:`asynchronous generator iterator`. It looks like a coroutine function defined with :keyword:`async def` except that it " +"contains :keyword:`yield` expressions for producing a series of values usable in an :keyword:`async for` loop. See :pep:`525`." +msgstr "" +"تابعی که یک :term:`تکرارگر تولیدگر ناهمگام ` بازمی‌گرداند. این تابع شبیه یک تابع هم‌روال که با :keyword:`async def` تعریف شده است " +"به نظر می‌رسد، با این تفاوت که شامل عبارت‌های :keyword:`yield` برای تولید مجموعه‌ای از مقادیر قابل استفاده در یک حلقهٔ :keyword:`async for` است. :pep:`525` را " +"ببینید." + +#: ../../glossary.rst:111 msgid "An asynchronous generator function may contain :keyword:`await` expressions as well as :keyword:`async for`, and :keyword:`async with` statements." msgstr "یک تابع تولیدگر ناهمگام ممکن است علاوه بر عبارت‌های :keyword:`async for` و دستورهای :keyword:`async with`، شامل عبارت‌های :keyword:`await` نیز باشد." +#: ../../glossary.rst:114 msgid "asynchronous generator iterator" msgstr "تکرارگر تولیدگر ناهمگام" -msgid "An object created by an :term:`asynchronous generator` function." -msgstr "شی‌ءای که توسط یک تابع :term:`تولیدگر ناهمگام ` ایجاد می‌شود." +#: ../../glossary.rst:116 +msgid "An object created by an :term:`asynchronous generator function`." +msgstr "شی‌ءای که توسط یک :term:`تابع تولیدگر ناهمگام ` ایجاد می‌شود." -msgid "This is an :term:`asynchronous iterator` which when called using the :meth:`~object.__anext__` method returns an awaitable object which will execute the body of the asynchronous generator function until the next :keyword:`yield` expression." -msgstr "این یک :term:`تکرارگر ناهمگام ` است که هنگام فراخوانی با استفاده از متد :meth:`~object.__anext__`، یک شیء awaitable بازمی‌گرداند که بدنهٔ تابع تولیدگر ناهمگام را تا عبارت :keyword:`yield` بعدی اجرا خواهد کرد." +#: ../../glossary.rst:118 +msgid "" +"This is an :term:`asynchronous iterator` which when called using the :meth:`~object.__anext__` method returns an awaitable object which will execute the body of " +"the asynchronous generator function until the next :keyword:`yield` expression." +msgstr "" +"این یک :term:`تکرارگر ناهمگام ` است که هنگام فراخوانی با استفاده از متد :meth:`~object.__anext__`، یک شیء awaitable بازمی‌گرداند که بدنهٔ " +"تابع تولیدگر ناهمگام را تا عبارت :keyword:`yield` بعدی اجرا خواهد کرد." -msgid "Each :keyword:`yield` temporarily suspends processing, remembering the execution state (including local variables and pending try-statements). When the *asynchronous generator iterator* effectively resumes with another awaitable returned by :meth:`~object.__anext__`, it picks up where it left off. See :pep:`492` and :pep:`525`." -msgstr "هر :keyword:`yield` پردازش را به‌طور موقت متوقف می‌کند و وضعیت اجرا (شامل متغیرهای محلی و دستورهای try در انتظار) را به خاطر می‌سپارد. هنگامی که *تکرارگر تولیدگر ناهمگام* عملاً با یک شیء awaitable دیگر که توسط :meth:`~object.__anext__` بازگردانده شده است ادامه می‌یابد، از همان نقطه‌ای که متوقف شده بود ادامه می‌دهد. :pep:`492` و :pep:`525` را ببینید." +#: ../../glossary.rst:123 +msgid "" +"Each :keyword:`yield` temporarily suspends processing, remembering the execution state (including local variables and pending try-statements). When the " +"*asynchronous generator iterator* effectively resumes with another awaitable returned by :meth:`~object.__anext__`, it picks up where it left off. See :pep:`492` " +"and :pep:`525`." +msgstr "" +"هر :keyword:`yield` پردازش را به‌طور موقت متوقف می‌کند و وضعیت اجرا (شامل متغیرهای محلی و دستورهای try در انتظار) را به خاطر می‌سپارد. هنگامی که *تکرارگر تولیدگر " +"ناهمگام* عملاً با یک شیء awaitable دیگر که توسط :meth:`~object.__anext__` بازگردانده شده است ادامه می‌یابد، از همان نقطه‌ای که متوقف شده بود ادامه می‌دهد. :pep:`492` " +"و :pep:`525` را ببینید." +#: ../../glossary.rst:128 msgid "asynchronous iterable" msgstr "تکرارپذیر ناهمگام" -msgid "An object, that can be used in an :keyword:`async for` statement. Must return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` method. Introduced by :pep:`492`." -msgstr "شی‌ءای که می‌تواند در یک دستور :keyword:`async for` استفاده شود. باید از متد :meth:`~object.__aiter__` خود یک :term:`تکرارگر ناهمگام ` بازگرداند. این قابلیت توسط :pep:`492` معرفی شد." +#: ../../glossary.rst:130 +msgid "" +"An object, that can be used in an :keyword:`async for` statement. Must return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` method. " +"Introduced by :pep:`492`." +msgstr "" +"شی‌ءای که می‌تواند در یک دستور :keyword:`async for` استفاده شود. باید از متد :meth:`~object.__aiter__` خود یک :term:`تکرارگر ناهمگام ` " +"بازگرداند. این قابلیت توسط :pep:`492` معرفی شد." +#: ../../glossary.rst:133 msgid "asynchronous iterator" msgstr "تکرارگر ناهمگام" -msgid "An object that implements the :meth:`~object.__aiter__` and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must return an :term:`awaitable` object. :keyword:`async for` resolves the awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` method until it raises a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." -msgstr "شی‌ءای که متدهای :meth:`~object.__aiter__` و :meth:`~object.__anext__` را پیاده‌سازی می‌کند. :meth:`~object.__anext__` باید یک شیء :term:`awaitable ` بازگرداند. :keyword:`async for` اشیای awaitable بازگردانده‌شده توسط متد :meth:`~object.__anext__` یک تکرارگر ناهمگام را تا زمانی که یک استثنای :exc:`StopAsyncIteration` پرتاب شود، حل می‌کند. این قابلیت توسط :pep:`492` معرفی شد." +#: ../../glossary.rst:135 +msgid "" +"An object that implements the :meth:`~object.__aiter__` and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must return an :term:`awaitable` " +"object. :keyword:`async for` resolves the awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` method until it raises " +"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." +msgstr "" +"شی‌ءای که متدهای :meth:`~object.__aiter__` و :meth:`~object.__anext__` را پیاده‌سازی می‌کند. :meth:`~object.__anext__` باید یک شیء :term:`awaitable ` " +"بازگرداند. :keyword:`async for` اشیای awaitable بازگردانده‌شده توسط متد :meth:`~object.__anext__` یک تکرارگر ناهمگام را تا زمانی که یک " +"استثنای :exc:`StopAsyncIteration` پرتاب شود، حل می‌کند. این قابلیت توسط :pep:`492` معرفی شد." +#: ../../glossary.rst:140 msgid "atomic operation" msgstr "عملیات اتمی" -msgid "An operation that appears to execute as a single, indivisible step: no other thread can observe it half-done, and its effects become visible all at once. Python does not guarantee that high-level statements are atomic (for example, ``x += 1`` performs multiple bytecode operations and is not atomic). Atomicity is only guaranteed where explicitly documented. See also :term:`race condition` and :term:`data race`." -msgstr "عملیاتی که به نظر می‌رسد به‌عنوان یک گام واحد و تقسیم‌ناپذیر اجرا می‌شود: هیچ نخ دیگری نمی‌تواند اجرای ناقص آن را مشاهده کند و اثرات آن یکباره قابل مشاهده می‌شوند. پایتون تضمین نمی‌کند که دستورهای سطح بالا اتمی باشند (برای مثال، ``x += 1`` چندین عملیات بایت‌کد انجام می‌دهد و اتمی نیست). اتمی بودن فقط در مواردی تضمین می‌شود که به‌صراحت مستند شده باشند. همچنین :term:`شرط رقابت ` و :term:`رقابت داده ` را ببینید." +#: ../../glossary.rst:142 +msgid "" +"An operation that appears to execute as a single, indivisible step: no other thread can observe it half-done, and its effects become visible all at once. Python " +"does not guarantee that high-level statements are atomic (for example, ``x += 1`` performs multiple bytecode operations and is not atomic). Atomicity is only " +"guaranteed where explicitly documented. See also :term:`race condition` and :term:`data race`." +msgstr "" +"عملیاتی که به نظر می‌رسد به‌عنوان یک گام واحد و تقسیم‌ناپذیر اجرا می‌شود: هیچ نخ دیگری نمی‌تواند اجرای ناقص آن را مشاهده کند و اثرات آن یکباره قابل مشاهده می‌شوند. " +"پایتون تضمین نمی‌کند که دستورهای سطح بالا اتمی باشند (برای مثال، ``x += 1`` چندین عملیات بایت‌کد انجام می‌دهد و اتمی نیست). اتمی بودن فقط در مواردی تضمین می‌شود که " +"به‌صراحت مستند شده باشند. همچنین :term:`شرط رقابت ` و :term:`رقابت داده ` را ببینید." +#: ../../glossary.rst:148 msgid "attached thread state" msgstr "وضعیت نخ متصل" +#: ../../glossary.rst:151 msgid "A :term:`thread state` that is active for the current OS thread." msgstr "یک :term:`وضعیت نخ اجرایی ` که برای نخ فعلی سیستم‌عامل فعال است." +#: ../../glossary.rst:153 msgid "When a :term:`thread state` is attached, the OS thread has access to the full Python C API and can safely invoke the bytecode interpreter." -msgstr "هنگامی که یک :term:`وضعیت نخ اجرایی ` متصل است، نخ سیستم‌عامل به تمام API زبان C پایتون دسترسی دارد و می‌تواند به‌طور ایمن مفسر بایت‌کد را فراخوانی کند." +msgstr "" +"هنگامی که یک :term:`وضعیت نخ اجرایی ` متصل است، نخ سیستم‌عامل به تمام API زبان C پایتون دسترسی دارد و می‌تواند به‌طور ایمن مفسر بایت‌کد را فراخوانی کند." -msgid "Unless a function explicitly notes otherwise, attempting to call the C API without an attached thread state will result in a fatal error or undefined behavior. A thread state can be attached and detached explicitly by the user through the C API, or implicitly by the runtime, including during blocking C calls and by the bytecode interpreter in between calls." -msgstr "مگر این‌که یک تابع به‌طور صریح خلاف آن را ذکر کند، تلاش برای فراخوانی API زبان C بدون یک وضعیت نخ متصل، به یک خطای مهلک یا رفتار تعریف‌نشده منجر خواهد شد. یک وضعیت نخ می‌تواند به‌صورت صریح توسط کاربر از طریق API زبان C متصل و جدا شود، یا به‌صورت ضمنی توسط ران‌تایم، از جمله در طول فراخوانی‌های C مسدودکننده و توسط مفسر بایت‌کد در بین فراخوانی‌ها، مدیریت شود." +#: ../../glossary.rst:157 +msgid "" +"Unless a function explicitly notes otherwise, attempting to call the C API without an attached thread state will result in a fatal error or undefined behavior. A " +"thread state can be attached and detached explicitly by the user through the C API, or implicitly by the runtime, including during blocking C calls and by the " +"bytecode interpreter in between calls." +msgstr "" +"مگر این‌که یک تابع به‌طور صریح خلاف آن را ذکر کند، تلاش برای فراخوانی API زبان C بدون یک وضعیت نخ متصل، به یک خطای مهلک یا رفتار تعریف‌نشده منجر خواهد شد. یک وضعیت " +"نخ می‌تواند به‌صورت صریح توسط کاربر از طریق API زبان C متصل و جدا شود، یا به‌صورت ضمنی توسط ران‌تایم، از جمله در طول فراخوانی‌های C مسدودکننده و توسط مفسر بایت‌کد در " +"بین فراخوانی‌ها، مدیریت شود." -msgid "On most builds of Python, having an attached thread state implies that the caller holds the :term:`GIL` for the current interpreter, so only one OS thread can have an attached thread state at a given moment. In :term:`free-threaded builds ` of Python, threads can concurrently hold an attached thread state, allowing for true parallelism of the bytecode interpreter." -msgstr "در بیشتر ساخت‌های پایتون، داشتن یک وضعیت نخ متصل به این معناست که فراخواننده :term:`GIL ` را برای مفسر فعلی در اختیار دارد، بنابراین در یک لحظهٔ مشخص فقط یک نخ سیستم‌عامل می‌تواند یک وضعیت نخ متصل داشته باشد. در :term:`ساخت نخ‌آزاد ` پایتون، نخ‌ها می‌توانند به‌طور هم‌زمان وضعیت نخ متصل داشته باشند، که امکان موازی‌سازی واقعی مفسر بایت‌کد را فراهم می‌کند." +#: ../../glossary.rst:164 +msgid "" +"On most builds of Python, having an attached thread state implies that the caller holds the :term:`GIL` for the current interpreter, so only one OS thread can " +"have an attached thread state at a given moment. In :term:`free-threaded builds ` of Python, threads can concurrently hold an attached thread " +"state, allowing for true parallelism of the bytecode interpreter." +msgstr "" +"در بیشتر ساخت‌های پایتون، داشتن یک وضعیت نخ متصل به این معناست که فراخواننده :term:`GIL ` را برای مفسر فعلی در اختیار دارد، بنابراین در یک لحظهٔ مشخص فقط یک نخ " +"سیستم‌عامل می‌تواند یک وضعیت نخ متصل داشته باشد. در :term:`ساخت نخ‌آزاد ` پایتون، نخ‌ها می‌توانند به‌طور هم‌زمان وضعیت نخ متصل داشته باشند، که امکان " +"موازی‌سازی واقعی مفسر بایت‌کد را فراهم می‌کند." +#: ../../glossary.rst:170 msgid "attribute" msgstr "ویژگی" -msgid "A value associated with an object which is usually referenced by name using dotted expressions. For example, if an object *o* has an attribute *a* it would be referenced as *o.a*." -msgstr "مقداری مرتبط با یک شیء که معمولاً با استفاده از عبارت‌های نقطه‌ای و با نام به آن ارجاع داده می‌شود. برای مثال، اگر یک شیء *o* دارای یک ویژگی *a* باشد، با *o.a* به آن ارجاع داده خواهد شد." +#: ../../glossary.rst:172 +msgid "" +"A value associated with an object which is usually referenced by name using dotted expressions. For example, if an object *o* has an attribute *a* it would be " +"referenced as *o.a*." +msgstr "" +"مقداری مرتبط با یک شیء که معمولاً با استفاده از عبارت‌های نقطه‌ای و با نام به آن ارجاع داده می‌شود. برای مثال، اگر یک شیء *o* دارای یک ویژگی *a* باشد، با *o.a* به آن " +"ارجاع داده خواهد شد." -msgid "It is possible to give an object an attribute whose name is not an identifier as defined by :ref:`identifiers`, for example using :func:`setattr`, if the object allows it. Such an attribute will not be accessible using a dotted expression, and would instead need to be retrieved with :func:`getattr`." -msgstr "اگر شیء اجازه دهد، می‌توان با استفاده از :func:`setattr`، ویژگی‌ای با نامی که یک شناسه مطابق تعریف :ref:`identifiers` نیست به آن اختصاص داد. چنین ویژگی‌ای با استفاده از یک عبارت نقطه‌ای قابل دسترسی نخواهد بود و باید در عوض با :func:`getattr` بازیابی شود." +#: ../../glossary.rst:177 +msgid "" +"It is possible to give an object an attribute whose name is not an identifier as defined by :ref:`identifiers`, for example using :func:`setattr`, if the object " +"allows it. Such an attribute will not be accessible using a dotted expression, and would instead need to be retrieved with :func:`getattr`." +msgstr "" +"اگر شیء اجازه دهد، می‌توان با استفاده از :func:`setattr`، ویژگی‌ای با نامی که یک شناسه مطابق تعریف :ref:`identifiers` نیست به آن اختصاص داد. چنین ویژگی‌ای با استفاده " +"از یک عبارت نقطه‌ای قابل دسترسی نخواهد بود و باید در عوض با :func:`getattr` بازیابی شود." +#: ../../glossary.rst:182 msgid "awaitable" msgstr "awaitable" -msgid "An object that can be used in an :keyword:`await` expression. Can be a :term:`coroutine` or an object with an :meth:`~object.__await__` method. See also :pep:`492`." -msgstr "شیءای که می‌تواند در یک عبارت :keyword:`await` استفاده شود. می‌تواند یک :term:`هم‌روال ` یا شی‌ءای با متد :meth:`~object.__await__` باشد. همچنین :pep:`492` را ببینید." +#: ../../glossary.rst:184 +msgid "" +"An object that can be used in an :keyword:`await` expression. Can be a :term:`coroutine` or an object with an :meth:`~object.__await__` method. See " +"also :pep:`492`." +msgstr "" +"شیءای که می‌تواند در یک عبارت :keyword:`await` استفاده شود. می‌تواند یک :term:`هم‌روال ` یا شی‌ءای با متد :meth:`~object.__await__` باشد. همچنین :pep:`492` " +"را ببینید." +#: ../../glossary.rst:187 msgid "BDFL" msgstr "BDFL" +#: ../../glossary.rst:189 msgid "Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." msgstr "Benevolent Dictator For Life، نام دیگر `Guido van Rossum `_، خالق پایتون." +#: ../../glossary.rst:191 msgid "binary file" msgstr "فایل دودویی" -msgid "A :term:`file object` able to read and write :term:`bytes-like objects `. Examples of binary files are files opened in binary mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io.BytesIO` and :class:`gzip.GzipFile`." -msgstr "یک :term:`شیء فایل ` که می‌تواند :term:`شیء شبه‌بایت ` را بخواند و بنویسد. نمونه‌هایی از فایل‌های دودویی، فایل‌هایی هستند که در حالت دودویی باز شده‌اند (``'rb'``، ``'wb'`` یا ``'rb+'``)، :data:`sys.stdin.buffer `، :data:`sys.stdout.buffer ` و نمونه‌هایی از :class:`io.BytesIO` و :class:`gzip.GzipFile`." +#: ../../glossary.rst:193 +msgid "" +"A :term:`file object` able to read and write :term:`bytes-like objects `. Examples of binary files are files opened in binary mode (``'rb'``, " +"``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, and instances of :class:`io.BytesIO` " +"and :class:`gzip.GzipFile`." +msgstr "" +"یک :term:`شیء فایل ` که می‌تواند :term:`شیء شبه‌بایت ` را بخواند و بنویسد. نمونه‌هایی از فایل‌های دودویی، فایل‌هایی هستند که در حالت " +"دودویی باز شده‌اند (``'rb'``، ``'wb'`` یا ``'rb+'``)، :data:`sys.stdin.buffer `، :data:`sys.stdout.buffer ` و نمونه‌هایی " +"از :class:`io.BytesIO` و :class:`gzip.GzipFile`." +#: ../../glossary.rst:200 msgid "See also :term:`text file` for a file object able to read and write :class:`str` objects." msgstr "همچنین :term:`فایل متنی ` را برای یک شیء فایل که می‌تواند اشیای :class:`str` را بخواند و بنویسد ببینید." +#: ../../glossary.rst:202 msgid "borrowed reference" msgstr "ارجاع قرض‌گرفته‌شده" -msgid "In Python's C API, a borrowed reference is a reference to an object, where the code using the object does not own the reference. It becomes a dangling pointer if the object is destroyed. For example, a garbage collection can remove the last :term:`strong reference` to the object and so destroy it." -msgstr "در API زبان C پایتون، ارجاع قرض‌گرفته‌شده ارجاعی به یک شیء است که در آن کدی که از شیء استفاده می‌کند مالک ارجاع نیست. اگر شیء نابود شود، این ارجاع به یک اشاره‌گر آویزان تبدیل می‌شود. برای مثال، جمع‌آوری زباله می‌تواند آخرین :term:`ارجاع قوی ` به شیء را حذف کند و در نتیجه آن را نابود کند." +#: ../../glossary.rst:204 +msgid "" +"In Python's C API, a borrowed reference is a reference to an object, where the code using the object does not own the reference. It becomes a dangling pointer if " +"the object is destroyed. For example, a garbage collection can remove the last :term:`strong reference` to the object and so destroy it." +msgstr "" +"در API زبان C پایتون، ارجاع قرض‌گرفته‌شده ارجاعی به یک شیء است که در آن کدی که از شیء استفاده می‌کند مالک ارجاع نیست. اگر شیء نابود شود، این ارجاع به یک اشاره‌گر " +"آویزان تبدیل می‌شود. برای مثال، جمع‌آوری زباله می‌تواند آخرین :term:`ارجاع قوی ` به شیء را حذف کند و در نتیجه آن را نابود کند." -msgid "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended to convert it to a :term:`strong reference` in-place, except when the object cannot be destroyed before the last usage of the borrowed reference. The :c:func:`Py_NewRef` function can be used to create a new :term:`strong reference`." -msgstr "فراخوانی :c:func:`Py_INCREF` روی :term:`ارجاع قرض‌گرفته‌شده ` توصیه می‌شود تا آن را درجا به یک :term:`ارجاع قوی ` تبدیل کند، مگر زمانی که شیء نمی‌تواند پیش از آخرین استفاده از ارجاع قرض‌گرفته‌شده نابود شود. تابع :c:func:`Py_NewRef` می‌تواند برای ایجاد یک :term:`ارجاع قوی ` جدید استفاده شود." +#: ../../glossary.rst:210 +msgid "" +"Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended to convert it to a :term:`strong reference` in-place, except when the object cannot " +"be destroyed before the last usage of the borrowed reference. The :c:func:`Py_NewRef` function can be used to create a new :term:`strong reference`." +msgstr "" +"فراخوانی :c:func:`Py_INCREF` روی :term:`ارجاع قرض‌گرفته‌شده ` توصیه می‌شود تا آن را درجا به یک :term:`ارجاع قوی ` تبدیل کند، " +"مگر زمانی که شیء نمی‌تواند پیش از آخرین استفاده از ارجاع قرض‌گرفته‌شده نابود شود. تابع :c:func:`Py_NewRef` می‌تواند برای ایجاد یک :term:`ارجاع قوی ` " +"جدید استفاده شود." +#: ../../glossary.rst:215 msgid "bytes-like object" msgstr "شیء شبه‌بایت" -msgid "An object that supports the :ref:`bufferobjects` and can export a C-:term:`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as well as many common :class:`memoryview` objects. Bytes-like objects can be used for various operations that work with binary data; these include compression, saving to a binary file, and sending over a socket." -msgstr "شی‌ءای که از :ref:`bufferobjects` پشتیبانی می‌کند و می‌تواند یک بافر C-:term:`پیوسته ` صادر کند. این شامل همهٔ اشیای :class:`bytes`، :class:`bytearray` و :class:`array.array` و همچنین بسیاری از اشیای رایج :class:`memoryview` می‌شود. اشیای شبه‌بایت می‌توانند برای عملیات مختلفی که با داده‌های دودویی کار می‌کنند استفاده شوند؛ از جمله فشرده‌سازی، ذخیره در یک فایل دودویی و ارسال از طریق یک سوکت." +#: ../../glossary.rst:217 +msgid "" +"An object that supports the :ref:`bufferobjects` and can export a C-:term:`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " +"and :class:`array.array` objects, as well as many common :class:`memoryview` objects. Bytes-like objects can be used for various operations that work with binary " +"data; these include compression, saving to a binary file, and sending over a socket." +msgstr "" +"شی‌ءای که از :ref:`bufferobjects` پشتیبانی می‌کند و می‌تواند یک بافر C-:term:`پیوسته ` صادر کند. این شامل همهٔ اشیای :class:`bytes`، :class:`bytearray` " +"و :class:`array.array` و همچنین بسیاری از اشیای رایج :class:`memoryview` می‌شود. اشیای شبه‌بایت می‌توانند برای عملیات مختلفی که با داده‌های دودویی کار می‌کنند استفاده " +"شوند؛ از جمله فشرده‌سازی، ذخیره در یک فایل دودویی و ارسال از طریق یک سوکت." -msgid "Some operations need the binary data to be mutable. The documentation often refers to these as \"read-write bytes-like objects\". Example mutable buffer objects include :class:`bytearray` and a :class:`memoryview` of a :class:`bytearray`. Other operations require the binary data to be stored in immutable objects (\"read-only bytes-like objects\"); examples of these include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." -msgstr "برخی عملیات‌ها نیاز دارند که داده‌های دودویی تغییرپذیر باشند. مستندات اغلب به این موارد با عنوان «اشیای شبه‌بایت خواندن-نوشتن» اشاره می‌کنند. نمونه‌هایی از اشیای بافر تغییرپذیر شامل :class:`bytearray` و یک :class:`memoryview` از یک :class:`bytearray` هستند. عملیات‌های دیگر نیاز دارند که داده‌های دودویی در اشیای تغییرناپذیر ذخیره شوند («اشیای شبه‌بایت فقط‌خواندنی»)؛ نمونه‌هایی از این موارد شامل :class:`bytes` و یک :class:`memoryview` از یک شیء :class:`bytes` هستند." +#: ../../glossary.rst:224 +msgid "" +"Some operations need the binary data to be mutable. The documentation often refers to these as \"read-write bytes-like objects\". Example mutable buffer objects " +"include :class:`bytearray` and a :class:`memoryview` of a :class:`bytearray`. Other operations require the binary data to be stored in immutable objects (\"read-" +"only bytes-like objects\"); examples of these include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." +msgstr "" +"برخی عملیات‌ها نیاز دارند که داده‌های دودویی تغییرپذیر باشند. مستندات اغلب به این موارد با عنوان «اشیای شبه‌بایت خواندن-نوشتن» اشاره می‌کنند. نمونه‌هایی از اشیای بافر " +"تغییرپذیر شامل :class:`bytearray` و یک :class:`memoryview` از یک :class:`bytearray` هستند. عملیات‌های دیگر نیاز دارند که داده‌های دودویی در اشیای تغییرناپذیر ذخیره " +"شوند («اشیای شبه‌بایت فقط‌خواندنی»)؛ نمونه‌هایی از این موارد شامل :class:`bytes` و یک :class:`memoryview` از یک شیء :class:`bytes` هستند." +#: ../../glossary.rst:232 msgid "bytecode" msgstr "بایت‌کد" -msgid "Python source code is compiled into bytecode, the internal representation of a Python program in the CPython interpreter. The bytecode is also cached in ``.pyc`` files so that executing the same file is faster the second time (recompilation from source to bytecode can be avoided). This \"intermediate language\" is said to run on a :term:`virtual machine` that executes the machine code corresponding to each bytecode. Do note that bytecodes are not expected to work between different Python virtual machines, nor to be stable between Python releases." -msgstr "کد منبع پایتون به بایت‌کد کامپایل می‌شود؛ بایت‌کد نمایش داخلی یک برنامهٔ پایتون در مفسر CPython است. بایت‌کد همچنین در فایل‌های ``.pyc`` ذخیره می‌شود تا اجرای همان فایل در بار دوم سریع‌تر باشد (می‌توان از کامپایل دوباره از منبع به بایت‌کد جلوگیری کرد). گفته می‌شود این «زبان میانی» روی یک :term:`ماشین مجازی ` اجرا می‌شود که کد ماشین متناظر با هر بایت‌کد را اجرا می‌کند. توجه داشته باشید که انتظار نمی‌رود بایت‌کدها بین ماشین‌های مجازی مختلف پایتون کار کنند یا بین نسخه‌های مختلف پایتون پایدار باشند." +#: ../../glossary.rst:234 +msgid "" +"Python source code is compiled into bytecode, the internal representation of a Python program in the CPython interpreter. The bytecode is also cached in ``.pyc`` " +"files so that executing the same file is faster the second time (recompilation from source to bytecode can be avoided). This \"intermediate language\" is said to " +"run on a :term:`virtual machine` that executes the machine code corresponding to each bytecode. Do note that bytecodes are not expected to work between different " +"Python virtual machines, nor to be stable between Python releases." +msgstr "" +"کد منبع پایتون به بایت‌کد کامپایل می‌شود؛ بایت‌کد نمایش داخلی یک برنامهٔ پایتون در مفسر CPython است. بایت‌کد همچنین در فایل‌های ``.pyc`` ذخیره می‌شود تا اجرای همان فایل " +"در بار دوم سریع‌تر باشد (می‌توان از کامپایل دوباره از منبع به بایت‌کد جلوگیری کرد). گفته می‌شود این «زبان میانی» روی یک :term:`ماشین مجازی ` اجرا " +"می‌شود که کد ماشین متناظر با هر بایت‌کد را اجرا می‌کند. توجه داشته باشید که انتظار نمی‌رود بایت‌کدها بین ماشین‌های مجازی مختلف پایتون کار کنند یا بین نسخه‌های مختلف " +"پایتون پایدار باشند." +#: ../../glossary.rst:244 msgid "A list of bytecode instructions can be found in the documentation for :ref:`the dis module `." msgstr "فهرستی از دستورهای بایت‌کد را می‌توان در مستندات :ref:`the dis module ` یافت." +#: ../../glossary.rst:246 msgid "callable" msgstr "فراخوانی‌پذیر" +#: ../../glossary.rst:248 msgid "A callable is an object that can be called, possibly with a set of arguments (see :term:`argument`), with the following syntax::" msgstr "یک فراخوانی‌پذیر شی‌ءای است که می‌توان آن را، احتمالاً با مجموعه‌ای از آرگومان‌ها (به :term:`آرگومان ` مراجعه کنید)، با سینتکس زیر فراخوانی کرد::" +#: ../../glossary.rst:251 msgid "callable(argument1, argument2, argumentN)" msgstr "callable(argument1, argument2, argumentN)" -msgid "A :term:`function`, and by extension a :term:`method`, is a callable. An instance of a class that implements the :meth:`~object.__call__` method is also a callable." -msgstr "یک :term:`تابع ` و به‌تبع آن یک :term:`متد `، یک فراخوانی‌پذیر است. یک نمونه از یک کلاس که متد :meth:`~object.__call__` را پیاده‌سازی می‌کند نیز یک فراخوانی‌پذیر است." +#: ../../glossary.rst:253 +msgid "" +"A :term:`function`, and by extension a :term:`method`, is a callable. An instance of a class that implements the :meth:`~object.__call__` method is also a " +"callable." +msgstr "" +"یک :term:`تابع ` و به‌تبع آن یک :term:`متد `، یک فراخوانی‌پذیر است. یک نمونه از یک کلاس که متد :meth:`~object.__call__` را پیاده‌سازی می‌کند نیز یک " +"فراخوانی‌پذیر است." +#: ../../glossary.rst:256 msgid "callback" msgstr "کال‌بک" +#: ../../glossary.rst:258 msgid "A subroutine function which is passed as an argument to be executed at some point in the future." msgstr "یک تابع زیرروال که به‌عنوان آرگومان ارسال می‌شود تا در نقطه‌ای در آینده اجرا شود." +#: ../../glossary.rst:260 msgid "class" msgstr "کلاس" +#: ../../glossary.rst:262 msgid "A template for creating user-defined objects. Class definitions normally contain method definitions which operate on instances of the class." msgstr "الگویی برای ایجاد اشیای تعریف‌شده توسط کاربر. تعریف‌های کلاس معمولاً شامل تعریف‌های متد هستند که روی نمونه‌های کلاس عمل می‌کنند." +#: ../../glossary.rst:265 msgid "class variable" msgstr "متغیر کلاس" +#: ../../glossary.rst:267 msgid "A variable defined in a class and intended to be modified only at class level (i.e., not in an instance of the class)." msgstr "متغیری که در یک کلاس تعریف شده است و قرار است فقط در سطح کلاس تغییر داده شود (یعنی نه در یک نمونه از کلاس)." +#: ../../glossary.rst:269 msgid "closure variable" msgstr "متغیر بستار" -msgid "A :term:`free variable` referenced from a :term:`nested scope` that is defined in an outer scope rather than being resolved at runtime from the globals or builtin namespaces. May be explicitly defined with the :keyword:`nonlocal` keyword to allow write access, or implicitly defined if the variable is only being read." -msgstr "یک :term:`متغیر آزاد ` که از یک :term:`محدودهٔ تو‌در‌تو ` ارجاع داده می‌شود و در یک محدودهٔ بیرونی تعریف شده است، به‌جای این‌که در زمان ران‌تایم از نام‌فضاهای سراسری یا توکار حل شود. ممکن است به‌طور صریح با کلیدواژهٔ :keyword:`nonlocal` تعریف شود تا امکان دسترسی نوشتن فراهم شود، یا اگر متغیر فقط خوانده می‌شود، به‌طور ضمنی تعریف شود." +#: ../../glossary.rst:271 +msgid "" +"A :term:`free variable` referenced from a :term:`nested scope` that is defined in an outer scope rather than being resolved at runtime from the globals or builtin " +"namespaces. May be explicitly defined with the :keyword:`nonlocal` keyword to allow write access, or implicitly defined if the variable is only being read." +msgstr "" +"یک :term:`متغیر آزاد ` که از یک :term:`محدودهٔ تو‌در‌تو ` ارجاع داده می‌شود و در یک محدودهٔ بیرونی تعریف شده است، به‌جای این‌که در زمان " +"ران‌تایم از نام‌فضاهای سراسری یا توکار حل شود. ممکن است به‌طور صریح با کلیدواژهٔ :keyword:`nonlocal` تعریف شود تا امکان دسترسی نوشتن فراهم شود، یا اگر متغیر فقط " +"خوانده می‌شود، به‌طور ضمنی تعریف شود." -msgid "For example, in the ``inner`` function in the following code, both ``x`` and ``print`` are :term:`free variables `, but only ``x`` is a *closure variable*::" +#: ../../glossary.rst:276 +msgid "" +"For example, in the ``inner`` function in the following code, both ``x`` and ``print`` are :term:`free variables `, but only ``x`` is a *closure " +"variable*::" msgstr "برای مثال، در تابع ``inner`` در کد زیر، هر دو مورد ``x`` و ``print`` :term:`متغیر آزاد ` هستند، اما فقط ``x`` یک *متغیر بستار* است::" +#: ../../glossary.rst:279 msgid "" "def outer():\n" " x = 0\n" @@ -280,117 +517,240 @@ msgstr "" " print(x)\n" " return inner" -msgid "Due to the :attr:`codeobject.co_freevars` attribute (which, despite its name, only includes the names of closure variables rather than listing all referenced free variables), the more general :term:`free variable` term is sometimes used even when the intended meaning is to refer specifically to closure variables." -msgstr "به‌دلیل ویژگی :attr:`codeobject.co_freevars` (که با وجود نامش، فقط نام‌های متغیرهای بستار را شامل می‌شود و همهٔ متغیرهای آزاد ارجاع‌داده‌شده را فهرست نمی‌کند)، اصطلاح کلی‌تر :term:`متغیر آزاد ` گاهی حتی زمانی استفاده می‌شود که معنای مورد نظر به‌طور مشخص اشاره به متغیرهای بستار دارد." +#: ../../glossary.rst:287 +msgid "" +"Due to the :attr:`codeobject.co_freevars` attribute (which, despite its name, only includes the names of closure variables rather than listing all referenced free " +"variables), the more general :term:`free variable` term is sometimes used even when the intended meaning is to refer specifically to closure variables." +msgstr "" +"به‌دلیل ویژگی :attr:`codeobject.co_freevars` (که با وجود نامش، فقط نام‌های متغیرهای بستار را شامل می‌شود و همهٔ متغیرهای آزاد ارجاع‌داده‌شده را فهرست نمی‌کند)، اصطلاح " +"کلی‌تر :term:`متغیر آزاد ` گاهی حتی زمانی استفاده می‌شود که معنای مورد نظر به‌طور مشخص اشاره به متغیرهای بستار دارد." +#: ../../glossary.rst:291 msgid "complex number" msgstr "عدد مختلط" -msgid "An extension of the familiar real number system in which all numbers are expressed as a sum of a real part and an imaginary part. Imaginary numbers are real multiples of the imaginary unit (the square root of ``-1``), often written ``i`` in mathematics or ``j`` in engineering. Python has built-in support for complex numbers, which are written with this latter notation; the imaginary part is written with a ``j`` suffix, e.g., ``3+1j``. To get access to complex equivalents of the :mod:`math` module, use :mod:`cmath`. Use of complex numbers is a fairly advanced mathematical feature. If you're not aware of a need for them, it's almost certain you can safely ignore them." -msgstr "گسترشی از سیستم آشنای اعداد حقیقی که در آن همهٔ اعداد به‌صورت مجموع یک بخش حقیقی و یک بخش موهومی بیان می‌شوند. اعداد موهومی مضرب‌های حقیقی واحد موهومی (ریشهٔ دوم ``-1``) هستند که در ریاضیات اغلب با ``i`` و در مهندسی با ``j`` نوشته می‌شود. پایتون پشتیبانی توکار از اعداد مختلط دارد که با این نمادگذاری اخیر نوشته می‌شوند؛ بخش موهومی با پسوند ``j`` نوشته می‌شود، برای مثال ``3+1j``. برای دسترسی به معادل‌های مختلط ماژول :mod:`math`، از :mod:`cmath` استفاده کنید. استفاده از اعداد مختلط یک ویژگی نسبتاً پیشرفتهٔ ریاضی است. اگر از نیاز به آن‌ها آگاه نیستید، تقریباً قطعی است که می‌توانید با خیال راحت آن‌ها را نادیده بگیرید." +#: ../../glossary.rst:293 +msgid "" +"An extension of the familiar real number system in which all numbers are expressed as a sum of a real part and an imaginary part. Imaginary numbers are real " +"multiples of the imaginary unit (the square root of ``-1``), often written ``i`` in mathematics or ``j`` in engineering. Python has built-in support for complex " +"numbers, which are written with this latter notation; the imaginary part is written with a ``j`` suffix, e.g., ``3+1j``. To get access to complex equivalents of " +"the :mod:`math` module, use :mod:`cmath`. Use of complex numbers is a fairly advanced mathematical feature. If you're not aware of a need for them, it's almost " +"certain you can safely ignore them." +msgstr "" +"گسترشی از سیستم آشنای اعداد حقیقی که در آن همهٔ اعداد به‌صورت مجموع یک بخش حقیقی و یک بخش موهومی بیان می‌شوند. اعداد موهومی مضرب‌های حقیقی واحد موهومی (ریشهٔ دوم " +"``-1``) هستند که در ریاضیات اغلب با ``i`` و در مهندسی با ``j`` نوشته می‌شود. پایتون پشتیبانی توکار از اعداد مختلط دارد که با این نمادگذاری اخیر نوشته می‌شوند؛ بخش " +"موهومی با پسوند ``j`` نوشته می‌شود، برای مثال ``3+1j``. برای دسترسی به معادل‌های مختلط ماژول :mod:`math`، از :mod:`cmath` استفاده کنید. استفاده از اعداد مختلط یک " +"ویژگی نسبتاً پیشرفتهٔ ریاضی است. اگر از نیاز به آن‌ها آگاه نیستید، تقریباً قطعی است که می‌توانید با خیال راحت آن‌ها را نادیده بگیرید." +#: ../../glossary.rst:303 msgid "concurrency" msgstr "هم‌زمانی" -msgid "The ability of a computer program to perform multiple tasks at the same time. Python provides libraries for writing programs that make use of different forms of concurrency. :mod:`asyncio` is a library for dealing with asynchronous tasks and coroutines. :mod:`threading` provides access to operating system threads and :mod:`multiprocessing` to operating system processes. Multi-core processors can execute threads and processes on different CPU cores at the same time (see :term:`parallelism`)." -msgstr "توانایی یک برنامهٔ کامپیوتری برای انجام چندین کار در یک زمان. پایتون کتابخانه‌هایی برای نوشتن برنامه‌هایی که از شکل‌های مختلف هم‌زمانی استفاده می‌کنند فراهم می‌کند. :mod:`asyncio` کتابخانه‌ای برای کار با وظایف ناهمگام و coroutineها است. :mod:`threading` دسترسی به نخ‌های سیستم‌عامل و :mod:`multiprocessing` دسترسی به پردازه‌های سیستم‌عامل را فراهم می‌کنند. پردازنده‌های چند‌هسته‌ای می‌توانند نخ‌ها و پردازه‌ها را روی هسته‌های مختلف CPU به‌طور هم‌زمان اجرا کنند (به :term:`موازی‌سازی ` مراجعه کنید)." +#: ../../glossary.rst:305 +msgid "" +"The ability of a computer program to perform multiple tasks at the same time. Python provides libraries for writing programs that make use of different forms of " +"concurrency. :mod:`asyncio` is a library for dealing with asynchronous tasks and coroutines. :mod:`threading` provides access to operating system threads " +"and :mod:`multiprocessing` to operating system processes. Multi-core processors can execute threads and processes on different CPU cores at the same time " +"(see :term:`parallelism`)." +msgstr "" +"توانایی یک برنامهٔ کامپیوتری برای انجام چندین کار در یک زمان. پایتون کتابخانه‌هایی برای نوشتن برنامه‌هایی که از شکل‌های مختلف هم‌زمانی استفاده می‌کنند فراهم " +"می‌کند. :mod:`asyncio` کتابخانه‌ای برای کار با وظایف ناهمگام و coroutineها است. :mod:`threading` دسترسی به نخ‌های سیستم‌عامل و :mod:`multiprocessing` دسترسی به " +"پردازه‌های سیستم‌عامل را فراهم می‌کنند. پردازنده‌های چند‌هسته‌ای می‌توانند نخ‌ها و پردازه‌ها را روی هسته‌های مختلف CPU به‌طور هم‌زمان اجرا کنند (به :term:`موازی‌سازی " +"` مراجعه کنید)." +#: ../../glossary.rst:313 msgid "concurrent modification" msgstr "تغییر هم‌زمان" -msgid "When multiple threads modify shared data at the same time. Concurrent modification without proper synchronization can cause :term:`race conditions `, and might also trigger a :term:`data race `, data corruption, or both." -msgstr "هنگامی که چندین نخ در یک زمان داده‌های اشتراکی را تغییر می‌دهند. تغییر هم‌زمان بدون همگام‌سازی مناسب می‌تواند باعث :term:`شرط رقابت ` شود و همچنین ممکن است یک :term:`رقابت داده `، خرابی داده یا هر دو را ایجاد کند." +#: ../../glossary.rst:315 +msgid "" +"When multiple threads modify shared data at the same time. Concurrent modification without proper synchronization can cause :term:`race conditions `, and might also trigger a :term:`data race `, data corruption, or both." +msgstr "" +"هنگامی که چندین نخ در یک زمان داده‌های اشتراکی را تغییر می‌دهند. تغییر هم‌زمان بدون همگام‌سازی مناسب می‌تواند باعث :term:`شرط رقابت ` شود و همچنین ممکن " +"است یک :term:`رقابت داده `، خرابی داده یا هر دو را ایجاد کند." +#: ../../glossary.rst:319 msgid "context" msgstr "زمینه" +#: ../../glossary.rst:321 msgid "This term has different meanings depending on where and how it is used. Some common meanings:" msgstr "این اصطلاح بسته به محل و نحوهٔ استفاده، معانی متفاوتی دارد. برخی از معانی رایج:" +#: ../../glossary.rst:324 msgid "The temporary state or environment established by a :term:`context manager` via a :keyword:`with` statement." msgstr "وضعیت یا محیط موقتی که توسط یک :term:`مدیر زمینه ` از طریق یک دستور :keyword:`with` ایجاد می‌شود." -msgid "The collection of key­value bindings associated with a particular :class:`contextvars.Context` object and accessed via :class:`~contextvars.ContextVar` objects. Also see :term:`context variable`." -msgstr "مجموعهٔ اتصال‌های کلید-مقدار مرتبط با یک شیء :class:`contextvars.Context` خاص و قابل دسترسی از طریق اشیای :class:`~contextvars.ContextVar`. همچنین :term:`متغیر زمینه ` را ببینید." +#: ../../glossary.rst:326 +msgid "" +"The collection of key­value bindings associated with a particular :class:`contextvars.Context` object and accessed via :class:`~contextvars.ContextVar` objects. " +"Also see :term:`context variable`." +msgstr "" +"مجموعهٔ اتصال‌های کلید-مقدار مرتبط با یک شیء :class:`contextvars.Context` خاص و قابل دسترسی از طریق اشیای :class:`~contextvars.ContextVar`. همچنین :term:`متغیر " +"زمینه ` را ببینید." +#: ../../glossary.rst:330 msgid "A :class:`contextvars.Context` object. Also see :term:`current context`." msgstr "یک شیء :class:`contextvars.Context`. همچنین :term:`زمینه فعلی ` را ببینید." +#: ../../glossary.rst:332 msgid "context management protocol" msgstr "پروتکل مدیریت زمینه" +#: ../../glossary.rst:334 msgid "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by the :keyword:`with` statement. See :pep:`343`." msgstr "متدهای :meth:`~object.__enter__` و :meth:`~object.__exit__` که توسط دستور :keyword:`with` فراخوانی می‌شوند. :pep:`343` را ببینید." +#: ../../glossary.rst:336 msgid "context manager" msgstr "مدیر زمینه" +#: ../../glossary.rst:338 msgid "An object which implements the :term:`context management protocol` and controls the environment seen in a :keyword:`with` statement. See :pep:`343`." -msgstr "شی‌ءای که :term:`پروتکل مدیریت زمینه ` را پیاده‌سازی می‌کند و محیط مشاهده‌شده در یک دستور :keyword:`with` را کنترل می‌کند. :pep:`343` را ببینید." +msgstr "" +"شی‌ءای که :term:`پروتکل مدیریت زمینه ` را پیاده‌سازی می‌کند و محیط مشاهده‌شده در یک دستور :keyword:`with` را کنترل می‌کند. :pep:`343` را " +"ببینید." +#: ../../glossary.rst:341 msgid "context variable" msgstr "متغیر زمینه" -msgid "A variable whose value depends on which context is the :term:`current context`. Values are accessed via :class:`contextvars.ContextVar` objects. Context variables are primarily used to isolate state between concurrent asynchronous tasks." -msgstr "متغیری که مقدار آن به این بستگی دارد که کدام زمینه :term:`زمینه فعلی ` است. مقادیر از طریق اشیای :class:`contextvars.ContextVar` قابل دسترسی هستند. متغیرهای زمینه عمدتاً برای جداسازی وضعیت بین وظایف ناهمگام هم‌زمان استفاده می‌شوند." +#: ../../glossary.rst:343 +msgid "" +"A variable whose value depends on which context is the :term:`current context`. Values are accessed via :class:`contextvars.ContextVar` objects. Context " +"variables are primarily used to isolate state between concurrent asynchronous tasks." +msgstr "" +"متغیری که مقدار آن به این بستگی دارد که کدام زمینه :term:`زمینه فعلی ` است. مقادیر از طریق اشیای :class:`contextvars.ContextVar` قابل دسترسی " +"هستند. متغیرهای زمینه عمدتاً برای جداسازی وضعیت بین وظایف ناهمگام هم‌زمان استفاده می‌شوند." +#: ../../glossary.rst:347 msgid "contiguous" msgstr "پیوسته" -msgid "A buffer is considered contiguous exactly if it is either *C-contiguous* or *Fortran contiguous*. Zero-dimensional buffers are C and Fortran contiguous. In one-dimensional arrays, the items must be laid out in memory next to each other, in order of increasing indexes starting from zero. In multidimensional C-contiguous arrays, the last index varies the fastest when visiting items in order of memory address. However, in Fortran contiguous arrays, the first index varies the fastest." -msgstr "یک بافر دقیقاً پیوسته در نظر گرفته می‌شود اگر یا *C-contiguous* یا *Fortran contiguous* باشد. بافرهای صفر‌بعدی هم C و هم Fortran پیوسته هستند. در آرایه‌های یک‌بعدی، آیتم‌ها باید در حافظه در کنار یکدیگر و به‌ترتیب اندیس‌های افزایشی که از صفر شروع می‌شوند قرار گرفته باشند. در آرایه‌های چندبعدی C-contiguous، هنگام بازدید از آیتم‌ها به‌ترتیب آدرس حافظه، آخرین اندیس سریع‌ترین تغییر را دارد. با این حال، در آرایه‌های Fortran contiguous، اولین اندیس سریع‌ترین تغییر را دارد." +#: ../../glossary.rst:351 +msgid "" +"A buffer is considered contiguous exactly if it is either *C-contiguous* or *Fortran contiguous*. Zero-dimensional buffers are C and Fortran contiguous. In one-" +"dimensional arrays, the items must be laid out in memory next to each other, in order of increasing indexes starting from zero. In multidimensional C-contiguous " +"arrays, the last index varies the fastest when visiting items in order of memory address. However, in Fortran contiguous arrays, the first index varies the " +"fastest." +msgstr "" +"یک بافر دقیقاً پیوسته در نظر گرفته می‌شود اگر یا *C-contiguous* یا *Fortran contiguous* باشد. بافرهای صفر‌بعدی هم C و هم Fortran پیوسته هستند. در آرایه‌های یک‌بعدی، " +"آیتم‌ها باید در حافظه در کنار یکدیگر و به‌ترتیب اندیس‌های افزایشی که از صفر شروع می‌شوند قرار گرفته باشند. در آرایه‌های چندبعدی C-contiguous، هنگام بازدید از آیتم‌ها " +"به‌ترتیب آدرس حافظه، آخرین اندیس سریع‌ترین تغییر را دارد. با این حال، در آرایه‌های Fortran contiguous، اولین اندیس سریع‌ترین تغییر را دارد." +#: ../../glossary.rst:359 msgid "coroutine" msgstr "هم‌روال" -msgid "Coroutines are a more generalized form of subroutines. Subroutines are entered at one point and exited at another point. Coroutines can be entered, exited, and resumed at many different points. They can be implemented with the :keyword:`async def` statement. See also :pep:`492`." -msgstr "هم‌روال‌ها شکل کلی‌تری از زیرروال‌ها هستند. زیرروال‌ها از یک نقطه وارد و از نقطه‌ای دیگر خارج می‌شوند. هم‌روال‌ها می‌توانند از نقاط مختلفی وارد، خارج و از سر گرفته شوند. آن‌ها می‌توانند با دستور :keyword:`async def` پیاده‌سازی شوند. همچنین :pep:`492` را ببینید." +#: ../../glossary.rst:361 +msgid "" +"Coroutines are a more generalized form of subroutines. Subroutines are entered at one point and exited at another point. Coroutines can be entered, exited, and " +"resumed at many different points. They can be implemented with the :keyword:`async def` statement. See also :pep:`492`." +msgstr "" +"هم‌روال‌ها شکل کلی‌تری از زیرروال‌ها هستند. زیرروال‌ها از یک نقطه وارد و از نقطه‌ای دیگر خارج می‌شوند. هم‌روال‌ها می‌توانند از نقاط مختلفی وارد، خارج و از سر گرفته شوند. " +"آن‌ها می‌توانند با دستور :keyword:`async def` پیاده‌سازی شوند. همچنین :pep:`492` را ببینید." +#: ../../glossary.rst:366 msgid "coroutine function" msgstr "تابع هم‌روال" -msgid "A function which returns a :term:`coroutine` object. A coroutine function may be defined with the :keyword:`async def` statement, and may contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. These were introduced by :pep:`492`." -msgstr "تابعی که یک شیء :term:`هم‌روال ` بازمی‌گرداند. یک تابع هم‌روال می‌تواند با دستور :keyword:`async def` تعریف شود و می‌تواند شامل کلیدواژه‌های :keyword:`await`، :keyword:`async for` و :keyword:`async with` باشد. این موارد توسط :pep:`492` معرفی شدند." +#: ../../glossary.rst:368 +msgid "" +"A function which returns a :term:`coroutine` object. A coroutine function may be defined with the :keyword:`async def` statement, and may " +"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. These were introduced by :pep:`492`." +msgstr "" +"تابعی که یک شیء :term:`هم‌روال ` بازمی‌گرداند. یک تابع هم‌روال می‌تواند با دستور :keyword:`async def` تعریف شود و می‌تواند شامل " +"کلیدواژه‌های :keyword:`await`، :keyword:`async for` و :keyword:`async with` باشد. این موارد توسط :pep:`492` معرفی شدند." +#: ../../glossary.rst:373 msgid "CPython" msgstr "CPython" -msgid "The canonical implementation of the Python programming language, as distributed on `python.org `_. The term \"CPython\" is used when necessary to distinguish this implementation from others such as Jython or IronPython." -msgstr "پیاده‌سازی مرجع زبان برنامه‌نویسی پایتون، همان‌طور که در `python.org `_ توزیع می‌شود. اصطلاح «CPython» در مواقعی استفاده می‌شود که لازم باشد این پیاده‌سازی از موارد دیگری مانند Jython یا IronPython متمایز شود." +#: ../../glossary.rst:375 +msgid "" +"The canonical implementation of the Python programming language, as distributed on `python.org `_. The term \"CPython\" is used when " +"necessary to distinguish this implementation from others such as Jython or IronPython." +msgstr "" +"پیاده‌سازی مرجع زبان برنامه‌نویسی پایتون، همان‌طور که در `python.org `_ توزیع می‌شود. اصطلاح «CPython» در مواقعی استفاده می‌شود که لازم باشد " +"این پیاده‌سازی از موارد دیگری مانند Jython یا IronPython متمایز شود." +#: ../../glossary.rst:379 msgid "current context" msgstr "زمینه فعلی" -msgid "The :term:`context` (:class:`contextvars.Context` object) that is currently used by :class:`~contextvars.ContextVar` objects to access (get or set) the values of :term:`context variables `. Each thread has its own current context. Frameworks for executing asynchronous tasks (see :mod:`asyncio`) associate each task with a context which becomes the current context whenever the task starts or resumes execution." -msgstr ":term:`زمینه ` (:class:`contextvars.Context`) که در حال حاضر توسط اشیای :class:`~contextvars.ContextVar` برای دسترسی (دریافت یا تنظیم) مقادیر :term:`متغیر زمینه ` استفاده می‌شود. هر نخ، زمینهٔ فعلی خود را دارد. چارچوب‌های اجرای وظایف ناهمگام (به :mod:`asyncio` مراجعه کنید) هر وظیفه را با یک زمینه مرتبط می‌کنند که هر زمان وظیفه شروع یا ادامهٔ اجرا می‌دهد، به زمینهٔ فعلی تبدیل می‌شود." +#: ../../glossary.rst:381 +msgid "" +"The :term:`context` (:class:`contextvars.Context` object) that is currently used by :class:`~contextvars.ContextVar` objects to access (get or set) the values " +"of :term:`context variables `. Each thread has its own current context. Frameworks for executing asynchronous tasks (see :mod:`asyncio`) " +"associate each task with a context which becomes the current context whenever the task starts or resumes execution." +msgstr "" +":term:`زمینه ` (:class:`contextvars.Context`) که در حال حاضر توسط اشیای :class:`~contextvars.ContextVar` برای دسترسی (دریافت یا تنظیم) " +"مقادیر :term:`متغیر زمینه ` استفاده می‌شود. هر نخ، زمینهٔ فعلی خود را دارد. چارچوب‌های اجرای وظایف ناهمگام (به :mod:`asyncio` مراجعه کنید) هر وظیفه " +"را با یک زمینه مرتبط می‌کنند که هر زمان وظیفه شروع یا ادامهٔ اجرا می‌دهد، به زمینهٔ فعلی تبدیل می‌شود." +#: ../../glossary.rst:387 msgid "cyclic isolate" msgstr "جدایهٔ چرخه‌ای" -msgid "A subgroup of one or more objects that reference each other in a reference cycle, but are not referenced by objects outside the group. The goal of the :term:`cyclic garbage collector ` is to identify these groups and break the reference cycles so that the memory can be reclaimed." -msgstr "زیرگروهی شامل یک یا چند شیء که در یک چرخهٔ ارجاع به یکدیگر ارجاع می‌دهند، اما توسط اشیای خارج از گروه ارجاع داده نمی‌شوند. هدف :term:`زباله‌روبی ` شناسایی این گروه‌ها و شکستن چرخه‌های ارجاع است تا حافظه بتواند بازیابی شود." +#: ../../glossary.rst:389 +msgid "" +"A subgroup of one or more objects that reference each other in a reference cycle, but are not referenced by objects outside the group. The goal of " +"the :term:`cyclic garbage collector ` is to identify these groups and break the reference cycles so that the memory can be reclaimed." +msgstr "" +"زیرگروهی شامل یک یا چند شیء که در یک چرخهٔ ارجاع به یکدیگر ارجاع می‌دهند، اما توسط اشیای خارج از گروه ارجاع داده نمی‌شوند. هدف :term:`زباله‌روبی ` " +"شناسایی این گروه‌ها و شکستن چرخه‌های ارجاع است تا حافظه بتواند بازیابی شود." +#: ../../glossary.rst:393 msgid "data race" msgstr "رقابت داده" -msgid "A situation where multiple threads access the same memory location concurrently, at least one of the accesses is a write, and the threads do not use any synchronization to control their access. Data races lead to :term:`non-deterministic` behavior and can cause data corruption. Proper use of :term:`locks ` and other :term:`synchronization primitives ` prevents data races. Note that data races can only happen in native code, but that :term:`native code` might be exposed in a Python API. See also :term:`race condition` and :term:`thread-safe`." -msgstr "وضعیتی که در آن چندین نخ به یک محل حافظهٔ یکسان به‌طور هم‌زمان دسترسی دارند، دست‌کم یکی از دسترسی‌ها نوشتن است و نخ‌ها برای کنترل دسترسی خود از هیچ همگام‌سازی‌ای استفاده نمی‌کنند. رقابت‌های داده به رفتار :term:`غیرقطعی ` منجر می‌شوند و می‌توانند باعث خرابی داده شوند. استفادهٔ درست از :term:`قفل ` و دیگر :term:`اولیه ` از رقابت‌های داده جلوگیری می‌کند. توجه داشته باشید که رقابت‌های داده فقط در کد بومی رخ می‌دهند، اما آن :term:`کد بومی ` ممکن است در یک API پایتون در معرض استفاده قرار گرفته باشد. همچنین :term:`شرط رقابت ` و :term:`ایمن برای نخ‌های اجرایی ` را ببینید." +#: ../../glossary.rst:395 +msgid "" +"A situation where multiple threads access the same memory location concurrently, at least one of the accesses is a write, and the threads do not use any " +"synchronization to control their access. Data races lead to :term:`non-deterministic` behavior and can cause data corruption. Proper use of :term:`locks ` " +"and other :term:`synchronization primitives ` prevents data races. Note that data races can only happen in native code, but " +"that :term:`native code` might be exposed in a Python API. See also :term:`race condition` and :term:`thread-safe`." +msgstr "" +"وضعیتی که در آن چندین نخ به یک محل حافظهٔ یکسان به‌طور هم‌زمان دسترسی دارند، دست‌کم یکی از دسترسی‌ها نوشتن است و نخ‌ها برای کنترل دسترسی خود از هیچ همگام‌سازی‌ای استفاده " +"نمی‌کنند. رقابت‌های داده به رفتار :term:`غیرقطعی ` منجر می‌شوند و می‌توانند باعث خرابی داده شوند. استفادهٔ درست از :term:`قفل ` و " +"دیگر :term:`اولیه ` از رقابت‌های داده جلوگیری می‌کند. توجه داشته باشید که رقابت‌های داده فقط در کد بومی رخ می‌دهند، اما آن :term:`کد بومی " +"` ممکن است در یک API پایتون در معرض استفاده قرار گرفته باشد. همچنین :term:`شرط رقابت ` و :term:`ایمن برای نخ‌های اجرایی ` " +"را ببینید." +#: ../../glossary.rst:404 msgid "deadlock" msgstr "بن‌بست" -msgid "A situation in which two or more tasks (threads, processes, or coroutines) wait indefinitely for each other to release resources or complete actions, preventing any from making progress. For example, if thread A holds lock 1 and waits for lock 2, while thread B holds lock 2 and waits for lock 1, both threads will wait indefinitely. In Python this often arises from acquiring multiple locks in conflicting orders or from circular join/await dependencies. Deadlocks can be avoided by always acquiring multiple :term:`locks ` in a consistent order. See also :term:`lock` and :term:`reentrant`." -msgstr "وضعیتی که در آن دو یا چند وظیفه (نخ‌ها، پردازه‌ها یا هم‌روال‌ها) به‌طور نامحدود منتظر می‌مانند تا یکدیگر منابع را آزاد کنند یا اقداماتی را کامل کنند، و در نتیجه هیچ‌کدام نمی‌توانند پیشرفت کنند. برای مثال، اگر نخ A قفل ۱ را در اختیار داشته باشد و منتظر قفل ۲ باشد، در حالی که نخ B قفل ۲ را در اختیار دارد و منتظر قفل ۱ است، هر دو نخ به‌طور نامحدود منتظر خواهند ماند. در پایتون، این وضعیت اغلب از دریافت چندین قفل با ترتیب‌های ناسازگار یا از وابستگی‌های join/await چرخه‌ای ایجاد می‌شود. می‌توان با همیشه دریافت کردن چندین :term:`قفل ` به یک ترتیب ثابت از بن‌بست‌ها جلوگیری کرد. همچنین :term:`قفل ` و :term:`بازورودپذیر ` را ببینید." +#: ../../glossary.rst:406 +msgid "" +"A situation in which two or more tasks (threads, processes, or coroutines) wait indefinitely for each other to release resources or complete actions, preventing " +"any from making progress. For example, if thread A holds lock 1 and waits for lock 2, while thread B holds lock 2 and waits for lock 1, both threads will wait " +"indefinitely. In Python this often arises from acquiring multiple locks in conflicting orders or from circular join/await dependencies. Deadlocks can be avoided " +"by always acquiring multiple :term:`locks ` in a consistent order. See also :term:`lock` and :term:`reentrant`." +msgstr "" +"وضعیتی که در آن دو یا چند وظیفه (نخ‌ها، پردازه‌ها یا هم‌روال‌ها) به‌طور نامحدود منتظر می‌مانند تا یکدیگر منابع را آزاد کنند یا اقداماتی را کامل کنند، و در نتیجه هیچ‌کدام " +"نمی‌توانند پیشرفت کنند. برای مثال، اگر نخ A قفل ۱ را در اختیار داشته باشد و منتظر قفل ۲ باشد، در حالی که نخ B قفل ۲ را در اختیار دارد و منتظر قفل ۱ است، هر دو نخ " +"به‌طور نامحدود منتظر خواهند ماند. در پایتون، این وضعیت اغلب از دریافت چندین قفل با ترتیب‌های ناسازگار یا از وابستگی‌های join/await چرخه‌ای ایجاد می‌شود. می‌توان با " +"همیشه دریافت کردن چندین :term:`قفل ` به یک ترتیب ثابت از بن‌بست‌ها جلوگیری کرد. همچنین :term:`قفل ` و :term:`بازورودپذیر ` را ببینید." +#: ../../glossary.rst:415 msgid "decorator" msgstr "دکوراتور" -msgid "A function returning another function, usually applied as a function transformation using the ``@wrapper`` syntax. Common examples for decorators are :func:`classmethod` and :func:`staticmethod`." -msgstr "تابعی که تابع دیگری را بازمی‌گرداند و معمولاً با استفاده از سینتکس ``@wrapper`` به‌عنوان یک تبدیل تابع اعمال می‌شود. نمونه‌های رایج دکوراتورها :func:`classmethod` و :func:`staticmethod` هستند." +#: ../../glossary.rst:417 +msgid "" +"A function returning another function, usually applied as a function transformation using the ``@wrapper`` syntax. Common examples for decorators " +"are :deco:`classmethod` and :deco:`staticmethod`." +msgstr "" +"تابعی که تابع دیگری را بازمی‌گرداند و معمولاً با استفاده از سینتکس ``@wrapper`` به‌عنوان یک تبدیل تابع اعمال می‌شود. نمونه‌های رایج دکوراتورها :func:`classmethod` " +"و :func:`staticmethod` هستند." +#: ../../glossary.rst:421 msgid "The decorator syntax is merely syntactic sugar, the following two function definitions are semantically equivalent::" msgstr "سینتکس دکوراتور صرفاً یک قند نحوی (syntactic sugar) است؛ دو تعریف تابع زیر از نظر معنایی معادل هستند::" +#: ../../glossary.rst:424 msgid "" "def f(arg):\n" " ...\n" @@ -408,174 +768,337 @@ msgstr "" "def f(arg):\n" " ..." -msgid "The same concept exists for classes, but is less commonly used there. See the documentation for :ref:`function definitions ` and :ref:`class definitions ` for more about decorators." -msgstr "همین مفهوم برای کلاس‌ها نیز وجود دارد، اما استفاده از آن در آنجا کمتر رایج است. برای اطلاعات بیشتر دربارهٔ دکوراتورها، مستندات :ref:`function definitions ` و :ref:`class definitions ` را ببینید." +#: ../../glossary.rst:432 +msgid "" +"The same concept exists for classes, but is less commonly used there. See the documentation for :ref:`function definitions ` and :ref:`class " +"definitions ` for more about decorators." +msgstr "" +"همین مفهوم برای کلاس‌ها نیز وجود دارد، اما استفاده از آن در آنجا کمتر رایج است. برای اطلاعات بیشتر دربارهٔ دکوراتورها، مستندات :ref:`function definitions " +"` و :ref:`class definitions ` را ببینید." +#: ../../glossary.rst:435 msgid "descriptor" msgstr "توصیف‌گر" -msgid "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`. When a class attribute is a descriptor, its special binding behavior is triggered upon attribute lookup. Normally, using *a.b* to get, set or delete an attribute looks up the object named *b* in the class dictionary for *a*, but if *b* is a descriptor, the respective descriptor method gets called. Understanding descriptors is a key to a deep understanding of Python because they are the basis for many features including functions, methods, properties, class methods, static methods, and reference to super classes." -msgstr "هر شی‌ءای که متدهای :meth:`~object.__get__`، :meth:`~object.__set__` یا :meth:`~object.__delete__` را تعریف کند. هنگامی که یک ویژگی کلاس یک توصیف‌گر باشد، رفتار اتصال ویژهٔ آن هنگام جست‌وجوی ویژگی فعال می‌شود. معمولاً استفاده از *a.b* برای دریافت، تنظیم یا حذف یک ویژگی، شیء با نام *b* را در دیکشنری کلاس *a* جست‌وجو می‌کند، اما اگر *b* یک توصیف‌گر باشد، متد مربوط به توصیف‌گر فراخوانی می‌شود. درک توصیف‌گرها کلیدی برای درک عمیق پایتون است، زیرا آن‌ها پایهٔ بسیاری از قابلیت‌ها از جمله توابع، متدها، ویژگی‌ها، متدهای کلاس، متدهای ایستا و ارجاع به کلاس‌های بالادستی هستند." +#: ../../glossary.rst:437 +msgid "" +"Any object which defines the methods :meth:`~object.__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " +"special binding behavior is triggered upon attribute lookup. Normally, using *a.b* to get, set or delete an attribute looks up the object named *b* in the class " +"dictionary for *a*, but if *b* is a descriptor, the respective descriptor method gets called. Understanding descriptors is a key to a deep understanding of " +"Python because they are the basis for many features including functions, methods, properties, class methods, static methods, and reference to super classes." +msgstr "" +"هر شی‌ءای که متدهای :meth:`~object.__get__`، :meth:`~object.__set__` یا :meth:`~object.__delete__` را تعریف کند. هنگامی که یک ویژگی کلاس یک توصیف‌گر باشد، رفتار " +"اتصال ویژهٔ آن هنگام جست‌وجوی ویژگی فعال می‌شود. معمولاً استفاده از *a.b* برای دریافت، تنظیم یا حذف یک ویژگی، شیء با نام *b* را در دیکشنری کلاس *a* جست‌وجو می‌کند، اما " +"اگر *b* یک توصیف‌گر باشد، متد مربوط به توصیف‌گر فراخوانی می‌شود. درک توصیف‌گرها کلیدی برای درک عمیق پایتون است، زیرا آن‌ها پایهٔ بسیاری از قابلیت‌ها از جمله توابع، " +"متدها، ویژگی‌ها، متدهای کلاس، متدهای ایستا و ارجاع به کلاس‌های بالادستی هستند." +#: ../../glossary.rst:448 msgid "For more information about descriptors' methods, see :ref:`descriptors` or the :ref:`Descriptor How To Guide `." msgstr "برای اطلاعات بیشتر دربارهٔ متدهای توصیف‌گرها، :ref:`descriptors` یا :ref:`Descriptor How To Guide ` را ببینید." +#: ../../glossary.rst:450 msgid "dictionary" msgstr "دیکشنری" -msgid "An associative array, where arbitrary keys are mapped to values. The keys can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` methods. Called a hash in Perl." -msgstr "یک آرایهٔ انجمنی که در آن کلیدهای دلخواه به مقادیر نگاشت می‌شوند. کلیدها می‌توانند هر شیءای باشند که متدهای :meth:`~object.__hash__` و :meth:`~object.__eq__` را داشته باشد. در Perl به آن hash گفته می‌شود." +#: ../../glossary.rst:452 +msgid "" +"An associative array, where arbitrary keys are mapped to values. The keys can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` methods. " +"Called a hash in Perl." +msgstr "" +"یک آرایهٔ انجمنی که در آن کلیدهای دلخواه به مقادیر نگاشت می‌شوند. کلیدها می‌توانند هر شیءای باشند که متدهای :meth:`~object.__hash__` و :meth:`~object.__eq__` را " +"داشته باشد. در Perl به آن hash گفته می‌شود." +#: ../../glossary.rst:456 msgid "dictionary comprehension" msgstr "درک دیکشنری" -msgid "A compact way to process all or part of the elements in an iterable and return a dictionary with the results. ``results = {n: n ** 2 for n in range(10)}`` generates a dictionary containing key ``n`` mapped to value ``n ** 2``. See :ref:`comprehensions`." -msgstr "روشی فشرده برای پردازش همه یا بخشی از عناصر یک تکرارپذیر و بازگرداندن یک دیکشنری با نتایج. ``results = {n: n ** 2 for n in range(10)}`` یک دیکشنری ایجاد می‌کند که شامل کلید ``n`` نگاشت‌شده به مقدار ``n ** 2`` است. :ref:`comprehensions` را ببینید." +#: ../../glossary.rst:458 +msgid "" +"A compact way to process all or part of the elements in an iterable and return a dictionary with the results. ``results = {n: n ** 2 for n in range(10)}`` " +"generates a dictionary containing key ``n`` mapped to value ``n ** 2``. See :ref:`comprehensions`." +msgstr "" +"روشی فشرده برای پردازش همه یا بخشی از عناصر یک تکرارپذیر و بازگرداندن یک دیکشنری با نتایج. ``results = {n: n ** 2 for n in range(10)}`` یک دیکشنری ایجاد می‌کند که " +"شامل کلید ``n`` نگاشت‌شده به مقدار ``n ** 2`` است. :ref:`comprehensions` را ببینید." +#: ../../glossary.rst:462 msgid "dictionary view" msgstr "نمای دیکشنری" -msgid "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:`dict.items` are called dictionary views. They provide a dynamic view on the dictionary’s entries, which means that when the dictionary changes, the view reflects these changes. To force the dictionary view to become a full list use ``list(dictview)``. See :ref:`dict-views`." -msgstr "اشیایی که توسط :meth:`dict.keys`، :meth:`dict.values` و :meth:`dict.items` بازگردانده می‌شوند، نماهای دیکشنری نامیده می‌شوند. آن‌ها نمایی پویا از ورودی‌های دیکشنری فراهم می‌کنند، به این معنا که هنگام تغییر دیکشنری، نما نیز این تغییرات را منعکس می‌کند. برای تبدیل نمای دیکشنری به یک فهرست کامل از ``list(dictview)`` استفاده کنید. :ref:`dict-views` را ببینید." +#: ../../glossary.rst:464 +msgid "" +"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:`dict.items` are called dictionary views. They provide a dynamic view on the " +"dictionary’s entries, which means that when the dictionary changes, the view reflects these changes. To force the dictionary view to become a full list use " +"``list(dictview)``. See :ref:`dict-views`." +msgstr "" +"اشیایی که توسط :meth:`dict.keys`، :meth:`dict.values` و :meth:`dict.items` بازگردانده می‌شوند، نماهای دیکشنری نامیده می‌شوند. آن‌ها نمایی پویا از ورودی‌های دیکشنری " +"فراهم می‌کنند، به این معنا که هنگام تغییر دیکشنری، نما نیز این تغییرات را منعکس می‌کند. برای تبدیل نمای دیکشنری به یک فهرست کامل از ``list(dictview)`` استفاده " +"کنید. :ref:`dict-views` را ببینید." +#: ../../glossary.rst:470 msgid "docstring" msgstr "رشتهٔ مستندات" -msgid "A string literal which appears as the first expression in a class, function or module. While ignored when the suite is executed, it is recognized by the compiler and put into the :attr:`~definition.__doc__` attribute of the enclosing class, function or module. Since it is available via introspection, it is the canonical place for documentation of the object." -msgstr "یک مقدار رشته‌ای که به‌عنوان اولین عبارت در یک کلاس، تابع یا ماژول ظاهر می‌شود. اگرچه هنگام اجرای مجموعه نادیده گرفته می‌شود، توسط کامپایلر شناسایی شده و در ویژگی :attr:`~definition.__doc__` کلاس، تابع یا ماژول دربرگیرنده قرار داده می‌شود. از آنجا که از طریق درون‌بینی در دسترس است، مکان استاندارد برای مستندسازی شیء محسوب می‌شود." +#: ../../glossary.rst:472 +msgid "" +"A string literal which appears as the first expression in a class, function or module. While ignored when the suite is executed, it is recognized by the compiler " +"and put into the :attr:`~definition.__doc__` attribute of the enclosing class, function or module. Since it is available via introspection, it is the canonical " +"place for documentation of the object." +msgstr "" +"یک مقدار رشته‌ای که به‌عنوان اولین عبارت در یک کلاس، تابع یا ماژول ظاهر می‌شود. اگرچه هنگام اجرای مجموعه نادیده گرفته می‌شود، توسط کامپایلر شناسایی شده و در " +"ویژگی :attr:`~definition.__doc__` کلاس، تابع یا ماژول دربرگیرنده قرار داده می‌شود. از آنجا که از طریق درون‌بینی در دسترس است، مکان استاندارد برای مستندسازی شیء " +"محسوب می‌شود." +#: ../../glossary.rst:478 msgid "duck-typing" msgstr "نوع‌دهی اردکی" -msgid "A programming style which does not look at an object's type to determine if it has the right interface; instead, the method or attribute is simply called or used (\"If it looks like a duck and quacks like a duck, it must be a duck.\") By emphasizing interfaces rather than specific types, well-designed code improves its flexibility by allowing polymorphic substitution. Duck-typing avoids tests using :func:`type` or :func:`isinstance`. (Note, however, that duck-typing can be complemented with :term:`abstract base classes `.) Instead, it typically employs :func:`hasattr` tests or :term:`EAFP` programming." -msgstr "سبک برنامه‌نویسی‌ای که برای تعیین داشتن رابط مناسب توسط یک شیء، به نوع آن نگاه نمی‌کند؛ در عوض، متد یا ویژگی به‌سادگی فراخوانی یا استفاده می‌شود («اگر شبیه اردک است و مانند اردک صدا می‌دهد، پس باید اردک باشد.»). با تأکید بر رابط‌ها به‌جای نوع‌های خاص، کد با طراحی خوب با امکان جایگزینی چندریخت، انعطاف‌پذیری خود را افزایش می‌دهد. نوع‌دهی اردکی از آزمون‌های مبتنی بر :func:`type` یا :func:`isinstance` اجتناب می‌کند. (با این حال، توجه داشته باشید که نوع‌دهی اردکی می‌تواند با :term:`کلاس پایهٔ انتزاعی ` تکمیل شود.) در عوض، معمولاً از آزمون‌های :func:`hasattr` یا برنامه‌نویسی :term:`EAFP ` استفاده می‌کند." +#: ../../glossary.rst:480 +msgid "" +"A programming style which does not look at an object's type to determine if it has the right interface; instead, the method or attribute is simply called or used " +"(\"If it looks like a duck and quacks like a duck, it must be a duck.\") By emphasizing interfaces rather than specific types, well-designed code improves its " +"flexibility by allowing polymorphic substitution. Duck-typing avoids tests using :func:`type` or :func:`isinstance`. (Note, however, that duck-typing can be " +"complemented with :term:`abstract base classes `.) Instead, it typically employs :func:`hasattr` tests or :term:`EAFP` programming." +msgstr "" +"سبک برنامه‌نویسی‌ای که برای تعیین داشتن رابط مناسب توسط یک شیء، به نوع آن نگاه نمی‌کند؛ در عوض، متد یا ویژگی به‌سادگی فراخوانی یا استفاده می‌شود («اگر شبیه اردک است و " +"مانند اردک صدا می‌دهد، پس باید اردک باشد.»). با تأکید بر رابط‌ها به‌جای نوع‌های خاص، کد با طراحی خوب با امکان جایگزینی چندریخت، انعطاف‌پذیری خود را افزایش می‌دهد. " +"نوع‌دهی اردکی از آزمون‌های مبتنی بر :func:`type` یا :func:`isinstance` اجتناب می‌کند. (با این حال، توجه داشته باشید که نوع‌دهی اردکی می‌تواند با :term:`کلاس پایهٔ " +"انتزاعی ` تکمیل شود.) در عوض، معمولاً از آزمون‌های :func:`hasattr` یا برنامه‌نویسی :term:`EAFP ` استفاده می‌کند." +#: ../../glossary.rst:489 msgid "dunder" msgstr "داندر" -msgid "An informal short-hand for \"double underscore\", used when talking about a :term:`special method`. For example, ``__init__`` is often pronounced \"dunder init\"." -msgstr "یک شکل کوتاه و غیررسمی برای «دو زیرخط» که هنگام صحبت دربارهٔ یک :term:`متد ویژه ` استفاده می‌شود. برای مثال، ``__init__`` اغلب «داندر اینیت» تلفظ می‌شود." +#: ../../glossary.rst:491 +msgid "" +"An informal short-hand for \"double underscore\", used when talking about a :term:`special method`. For example, ``__init__`` is often pronounced \"dunder init\"." +msgstr "" +"یک شکل کوتاه و غیررسمی برای «دو زیرخط» که هنگام صحبت دربارهٔ یک :term:`متد ویژه ` استفاده می‌شود. برای مثال، ``__init__`` اغلب «داندر اینیت» تلفظ " +"می‌شود." +#: ../../glossary.rst:494 msgid "EAFP" msgstr "EAFP" -msgid "Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many :keyword:`try` and :keyword:`except` statements. The technique contrasts with the :term:`LBYL` style common to many other languages such as C." -msgstr "آسان‌تر است که درخواست بخشش کنید تا اجازه. این سبک رایج کدنویسی پایتون وجود کلیدها یا ویژگی‌های معتبر را فرض می‌کند و اگر این فرض نادرست باشد، استثناها را دریافت می‌کند. این سبک پاک و سریع با وجود تعداد زیادی دستورهای :keyword:`try` و :keyword:`except` شناخته می‌شود. این روش در تضاد با سبک :term:`LBYL ` است که در بسیاری از زبان‌های دیگر مانند C رایج است." +#: ../../glossary.rst:496 +msgid "" +"Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the " +"assumption proves false. This clean and fast style is characterized by the presence of many :keyword:`try` and :keyword:`except` statements. The technique " +"contrasts with the :term:`LBYL` style common to many other languages such as C." +msgstr "" +"آسان‌تر است که درخواست بخشش کنید تا اجازه. این سبک رایج کدنویسی پایتون وجود کلیدها یا ویژگی‌های معتبر را فرض می‌کند و اگر این فرض نادرست باشد، استثناها را دریافت " +"می‌کند. این سبک پاک و سریع با وجود تعداد زیادی دستورهای :keyword:`try` و :keyword:`except` شناخته می‌شود. این روش در تضاد با سبک :term:`LBYL ` است که در " +"بسیاری از زبان‌های دیگر مانند C رایج است." +#: ../../glossary.rst:502 msgid "evaluate function" msgstr "تابع ارزیابی" -msgid "A function that can be called to evaluate a lazily evaluated attribute of an object, such as the value of type aliases created with the :keyword:`type` statement." +#: ../../glossary.rst:504 +msgid "" +"A function that can be called to evaluate a lazily evaluated attribute of an object, such as the value of type aliases created with the :keyword:`type` statement." msgstr "تابعی که می‌توان آن را برای ارزیابی یک ویژگی با ارزیابی تنبل یک شیء فراخوانی کرد، مانند مقدار نام‌های مستعار نوع که با دستور :keyword:`type` ایجاد شده‌اند." +#: ../../glossary.rst:507 msgid "expression" msgstr "عبارت" -msgid "A piece of syntax which can be evaluated to some value. In other words, an expression is an accumulation of expression elements like literals, names, attribute access, operators or function calls which all return a value. In contrast to many other languages, not all language constructs are expressions. There are also :term:`statement`\\s which cannot be used as expressions, such as :keyword:`while`. Assignments are also statements, not expressions." -msgstr "بخشی از سینتکس که می‌تواند به یک مقدار ارزیابی شود. به بیان دیگر، یک عبارت مجموعه‌ای از عناصر عبارت مانند لفظ‌ها، نام‌ها، دسترسی به ویژگی، عملگرها یا فراخوانی‌های تابع است که همه مقداری بازمی‌گردانند. برخلاف بسیاری از زبان‌های دیگر، همهٔ ساختارهای زبان عبارت نیستند. همچنین :term:`دستور `\\هایی وجود دارند که نمی‌توان از آن‌ها به‌عنوان عبارت استفاده کرد، مانند :keyword:`while`. تخصیص‌ها نیز دستور هستند، نه عبارت." +#: ../../glossary.rst:509 +msgid "" +"A piece of syntax which can be evaluated to some value. In other words, an expression is an accumulation of expression elements like literals, names, attribute " +"access, operators or function calls which all return a value. In contrast to many other languages, not all language constructs are expressions. There are " +"also :term:`statement`\\s which cannot be used as expressions, such as :keyword:`while`. Assignments are also statements, not expressions." +msgstr "" +"بخشی از سینتکس که می‌تواند به یک مقدار ارزیابی شود. به بیان دیگر، یک عبارت مجموعه‌ای از عناصر عبارت مانند لفظ‌ها، نام‌ها، دسترسی به ویژگی، عملگرها یا فراخوانی‌های تابع " +"است که همه مقداری بازمی‌گردانند. برخلاف بسیاری از زبان‌های دیگر، همهٔ ساختارهای زبان عبارت نیستند. همچنین :term:`دستور `\\هایی وجود دارند که نمی‌توان از " +"آن‌ها به‌عنوان عبارت استفاده کرد، مانند :keyword:`while`. تخصیص‌ها نیز دستور هستند، نه عبارت." +#: ../../glossary.rst:516 msgid "extension module" msgstr "ماژول افزونه" +#: ../../glossary.rst:518 msgid "A module written in C or C++, using Python's C API to interact with the core and with user code." msgstr "ماژول نوشته‌شده به زبان C یا C++ که از API زبان C پایتون برای تعامل با هسته و کد کاربر استفاده می‌کند." +#: ../../glossary.rst:520 msgid "f-string" msgstr "اف‌استرینگ" +#: ../../glossary.rst:521 msgid "f-strings" msgstr "اف‌استرینگ‌ها" -msgid "String literals prefixed with ``f`` or ``F`` are commonly called \"f-strings\" which is short for :ref:`formatted string literals `. See also :pep:`498`." -msgstr "رشته‌های لفظی که با ``f`` یا ``F`` پیشوندگذاری شده‌اند، معمولاً «اف‌استرینگ» نامیده می‌شوند که کوتاه‌شدهٔ :ref:`formatted string literals ` است. همچنین :pep:`498` را ببینید." +#: ../../glossary.rst:523 +msgid "" +"String literals prefixed with ``f`` or ``F`` are commonly called \"f-strings\" which is short for :ref:`formatted string literals `. See " +"also :pep:`498`." +msgstr "" +"رشته‌های لفظی که با ``f`` یا ``F`` پیشوندگذاری شده‌اند، معمولاً «اف‌استرینگ» نامیده می‌شوند که کوتاه‌شدهٔ :ref:`formatted string literals ` است. " +"همچنین :pep:`498` را ببینید." +#: ../../glossary.rst:526 msgid "file object" msgstr "شیء فایل" -msgid "An object exposing a file-oriented API (with methods such as :meth:`!read` or :meth:`!write`) to an underlying resource. Depending on the way it was created, a file object can mediate access to a real on-disk file or to another type of storage or communication device (for example standard input/output, in-memory buffers, sockets, pipes, etc.). File objects are also called :dfn:`file-like objects` or :dfn:`streams`." -msgstr "شی‌ءای که یک API فایل‌محور (با متدهایی مانند :meth:`!read` یا :meth:`!write`) برای یک منبع زیربنایی ارائه می‌دهد. بسته به نحوهٔ ایجاد آن، یک شیء فایل می‌تواند دسترسی به یک فایل واقعی روی دیسک یا نوع دیگری از فضای ذخیره‌سازی یا دستگاه ارتباطی را مدیریت کند (برای مثال ورودی/خروجی استاندارد، بافرهای درون‌حافظه‌ای، سوکت‌ها، پایپ‌ها و غیره). اشیای فایل همچنین با نام‌های :dfn:`file-like objects` یا :dfn:`streams` شناخته می‌شوند." +#: ../../glossary.rst:528 +msgid "" +"An object exposing a file-oriented API (with methods such as :meth:`!read` or :meth:`!write`) to an underlying resource. Depending on the way it was created, a " +"file object can mediate access to a real on-disk file or to another type of storage or communication device (for example standard input/output, in-memory buffers, " +"sockets, pipes, etc.). File objects are also called :dfn:`file-like objects` or :dfn:`streams`." +msgstr "" +"شی‌ءای که یک API فایل‌محور (با متدهایی مانند :meth:`!read` یا :meth:`!write`) برای یک منبع زیربنایی ارائه می‌دهد. بسته به نحوهٔ ایجاد آن، یک شیء فایل می‌تواند دسترسی " +"به یک فایل واقعی روی دیسک یا نوع دیگری از فضای ذخیره‌سازی یا دستگاه ارتباطی را مدیریت کند (برای مثال ورودی/خروجی استاندارد، بافرهای درون‌حافظه‌ای، سوکت‌ها، پایپ‌ها و " +"غیره). اشیای فایل همچنین با نام‌های :dfn:`file-like objects` یا :dfn:`streams` شناخته می‌شوند." -msgid "There are actually three categories of file objects: raw :term:`binary files `, buffered :term:`binary files ` and :term:`text files `. Their interfaces are defined in the :mod:`io` module. The canonical way to create a file object is by using the :func:`open` function." -msgstr "در واقع سه دسته از اشیای فایل وجود دارد: :term:`فایل دودویی ` خام، :term:`فایل دودویی ` بافرشده و :term:`فایل متنی `. رابط‌های آن‌ها در ماژول :mod:`io` تعریف شده‌اند. روش استاندارد ایجاد یک شیء فایل، استفاده از تابع :func:`open` است." +#: ../../glossary.rst:536 +msgid "" +"There are actually three categories of file objects: raw :term:`binary files `, buffered :term:`binary files ` and :term:`text files " +"`. Their interfaces are defined in the :mod:`io` module. The canonical way to create a file object is by using the :func:`open` function." +msgstr "" +"در واقع سه دسته از اشیای فایل وجود دارد: :term:`فایل دودویی ` خام، :term:`فایل دودویی ` بافرشده و :term:`فایل متنی `. رابط‌های " +"آن‌ها در ماژول :mod:`io` تعریف شده‌اند. روش استاندارد ایجاد یک شیء فایل، استفاده از تابع :func:`open` است." +#: ../../glossary.rst:541 msgid "file-like object" msgstr "شیء شبه‌فایل" +#: ../../glossary.rst:543 msgid "A synonym for :term:`file object`." msgstr "هم‌معنای :term:`شیء فایل `." +#: ../../glossary.rst:544 msgid "filesystem encoding and error handler" msgstr "کدگذاری سیستم فایل و مدیریت‌کنندهٔ خطا" +#: ../../glossary.rst:546 msgid "Encoding and error handler used by Python to decode bytes from the operating system and encode Unicode to the operating system." msgstr "کدگذاری و مدیریت‌کنندهٔ خطایی که پایتون برای کدگشایی بایت‌ها از سیستم‌عامل و کدگذاری یونیکد به سیستم‌عامل استفاده می‌کند." -msgid "The filesystem encoding must guarantee to successfully decode all bytes below 128. If the file system encoding fails to provide this guarantee, API functions can raise :exc:`UnicodeError`." -msgstr "کدگذاری سیستم فایل باید تضمین کند که همهٔ بایت‌های کمتر از ۱۲۸ را با موفقیت کدگشایی می‌کند. اگر کدگذاری سیستم فایل نتواند این تضمین را ارائه دهد، توابع API ممکن است استثنای :exc:`UnicodeError` ایجاد کنند." +#: ../../glossary.rst:549 +msgid "" +"The filesystem encoding must guarantee to successfully decode all bytes below 128. If the file system encoding fails to provide this guarantee, API functions can " +"raise :exc:`UnicodeError`." +msgstr "" +"کدگذاری سیستم فایل باید تضمین کند که همهٔ بایت‌های کمتر از ۱۲۸ را با موفقیت کدگشایی می‌کند. اگر کدگذاری سیستم فایل نتواند این تضمین را ارائه دهد، توابع API ممکن است " +"استثنای :exc:`UnicodeError` ایجاد کنند." +#: ../../glossary.rst:553 msgid "The :func:`sys.getfilesystemencoding` and :func:`sys.getfilesystemencodeerrors` functions can be used to get the filesystem encoding and error handler." msgstr "از توابع :func:`sys.getfilesystemencoding` و :func:`sys.getfilesystemencodeerrors` می‌توان برای دریافت کدگذاری سیستم فایل و مدیریت‌کنندهٔ خطا استفاده کرد." -msgid "The :term:`filesystem encoding and error handler` are configured at Python startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig.filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." -msgstr ":term:`کدگذاری سیستم فایل و مدیریت‌کنندهٔ خطا ` در هنگام راه‌اندازی پایتون توسط تابع :c:func:`PyConfig_Read` پیکربندی می‌شوند: اعضای :c:member:`~PyConfig.filesystem_encoding` و :c:member:`~PyConfig.filesystem_errors` از :c:type:`PyConfig` را ببینید." +#: ../../glossary.rst:557 +msgid "" +"The :term:`filesystem encoding and error handler` are configured at Python startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +msgstr "" +":term:`کدگذاری سیستم فایل و مدیریت‌کنندهٔ خطا ` در هنگام راه‌اندازی پایتون توسط تابع :c:func:`PyConfig_Read` پیکربندی می‌شوند: " +"اعضای :c:member:`~PyConfig.filesystem_encoding` و :c:member:`~PyConfig.filesystem_errors` از :c:type:`PyConfig` را ببینید." +#: ../../glossary.rst:562 msgid "See also the :term:`locale encoding`." msgstr "همچنین :term:`کدگذاری محلی ` را ببینید." +#: ../../glossary.rst:563 msgid "finder" msgstr "یابنده" +#: ../../glossary.rst:565 msgid "An object that tries to find the :term:`loader` for a module that is being imported." msgstr "شیءای که تلاش می‌کند :term:`بارگذار ` مربوط به ماژولی را که در حال ایمپورت شدن است پیدا کند." -msgid "There are two types of finder: :term:`meta path finders ` for use with :data:`sys.meta_path`, and :term:`path entry finders ` for use with :data:`sys.path_hooks`." -msgstr "دو نوع یابنده وجود دارد: :term:`یابندهٔ مسیر فراداده ` برای استفاده با :data:`sys.meta_path` و :term:`یابندهٔ ورودی مسیر ` برای استفاده با :data:`sys.path_hooks`." +#: ../../glossary.rst:568 +msgid "" +"There are two types of finder: :term:`meta path finders ` for use with :data:`sys.meta_path`, and :term:`path entry finders ` " +"for use with :data:`sys.path_hooks`." +msgstr "" +"دو نوع یابنده وجود دارد: :term:`یابندهٔ مسیر فراداده ` برای استفاده با :data:`sys.meta_path` و :term:`یابندهٔ ورودی مسیر ` برای " +"استفاده با :data:`sys.path_hooks`." +#: ../../glossary.rst:572 msgid "See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "برای جزئیات بسیار بیشتر، :ref:`finders-and-loaders` و :mod:`importlib` را ببینید." +#: ../../glossary.rst:573 msgid "floor division" msgstr "تقسیم کف" -msgid "Mathematical division that rounds down to nearest integer. The floor division operator is ``//``. For example, the expression ``11 // 4`` evaluates to ``2`` in contrast to the ``2.75`` returned by float true division. Note that ``(-11) // 4`` is ``-3`` because that is ``-2.75`` rounded *downward*. See :pep:`238`." -msgstr "تقسیم ریاضی که به نزدیک‌ترین عدد صحیح پایین گرد می‌شود. عملگر تقسیم کف ``//`` است. برای مثال، عبارت ``11 // 4`` به ``2`` ارزیابی می‌شود، در حالی که تقسیم حقیقی با عدد اعشاری مقدار ``2.75`` را بازمی‌گرداند. توجه داشته باشید که ``(-11) // 4`` برابر ``-3`` است، زیرا ``-2.75`` به سمت *پایین* گرد می‌شود. :pep:`238` را ببینید." +#: ../../glossary.rst:575 +msgid "" +"Mathematical division that rounds down to nearest integer. The floor division operator is ``//``. For example, the expression ``11 // 4`` evaluates to ``2`` in " +"contrast to the ``2.75`` returned by float true division. Note that ``(-11) // 4`` is ``-3`` because that is ``-2.75`` rounded *downward*. See :pep:`238`." +msgstr "" +"تقسیم ریاضی که به نزدیک‌ترین عدد صحیح پایین گرد می‌شود. عملگر تقسیم کف ``//`` است. برای مثال، عبارت ``11 // 4`` به ``2`` ارزیابی می‌شود، در حالی که تقسیم حقیقی با " +"عدد اعشاری مقدار ``2.75`` را بازمی‌گرداند. توجه داشته باشید که ``(-11) // 4`` برابر ``-3`` است، زیرا ``-2.75`` به سمت *پایین* گرد می‌شود. :pep:`238` را ببینید." +#: ../../glossary.rst:580 msgid "free threading" msgstr "نخ‌گذاری آزاد" -msgid "A threading model where multiple threads can run Python bytecode simultaneously within the same interpreter. This is in contrast to the :term:`global interpreter lock` which allows only one thread to execute Python bytecode at a time. See :pep:`703`." -msgstr "مدل نخ‌ای که در آن چندین نخ می‌توانند بایت‌کد پایتون را به‌طور هم‌زمان درون همان مفسر اجرا کنند. این در تضاد با :term:`قفل مفسر سراسری ` است که اجازه می‌دهد فقط یک نخ در هر زمان بایت‌کد پایتون را اجرا کند. :pep:`703` را ببینید." +#: ../../glossary.rst:582 +msgid "" +"A threading model where multiple threads can run Python bytecode simultaneously within the same interpreter. This is in contrast to the :term:`global interpreter " +"lock` which allows only one thread to execute Python bytecode at a time. See :pep:`703`." +msgstr "" +"مدل نخ‌ای که در آن چندین نخ می‌توانند بایت‌کد پایتون را به‌طور هم‌زمان درون همان مفسر اجرا کنند. این در تضاد با :term:`قفل مفسر سراسری ` است " +"که اجازه می‌دهد فقط یک نخ در هر زمان بایت‌کد پایتون را اجرا کند. :pep:`703` را ببینید." +#: ../../glossary.rst:586 msgid "free-threaded build" msgstr "ساخت نخ‌آزاد" +#: ../../glossary.rst:589 msgid "A build of :term:`CPython` that supports :term:`free threading`, configured using the :option:`--disable-gil` option before compilation." -msgstr "ساختی از :term:`CPython ` که از :term:`نخ‌گذاری آزاد ` پشتیبانی می‌کند و با استفاده از گزینهٔ :option:`--disable-gil` پیش از کامپایل پیکربندی شده است." +msgstr "" +"ساختی از :term:`CPython ` که از :term:`نخ‌گذاری آزاد ` پشتیبانی می‌کند و با استفاده از گزینهٔ :option:`--disable-gil` پیش از کامپایل " +"پیکربندی شده است." +#: ../../glossary.rst:592 msgid "See :ref:`freethreading-python-howto`." msgstr ":ref:`freethreading-python-howto` را ببینید." +#: ../../glossary.rst:593 msgid "free variable" msgstr "متغیر آزاد" -msgid "Formally, as defined in the :ref:`language execution model `, a free variable is any variable used in a namespace which is not a local variable in that namespace. See :term:`closure variable` for an example. Pragmatically, due to the name of the :attr:`codeobject.co_freevars` attribute, the term is also sometimes used as a synonym for :term:`closure variable`." -msgstr "به‌صورت رسمی، همان‌طور که در :ref:`language execution model ` تعریف شده است، یک متغیر آزاد هر متغیری است که در یک نام‌فضا استفاده می‌شود اما در آن نام‌فضا یک متغیر محلی نیست. برای نمونه، :term:`متغیر بستار ` را ببینید. از نظر عملی، به‌دلیل نام ویژگی :attr:`codeobject.co_freevars`، این اصطلاح گاهی به‌عنوان مترادفی برای :term:`متغیر بستار ` نیز استفاده می‌شود." +#: ../../glossary.rst:595 +msgid "" +"Formally, as defined in the :ref:`language execution model `, a free variable is any variable used in a namespace which is not a local variable in " +"that namespace. See :term:`closure variable` for an example. Pragmatically, due to the name of the :attr:`codeobject.co_freevars` attribute, the term is also " +"sometimes used as a synonym for :term:`closure variable`." +msgstr "" +"به‌صورت رسمی، همان‌طور که در :ref:`language execution model ` تعریف شده است، یک متغیر آزاد هر متغیری است که در یک نام‌فضا استفاده می‌شود اما در آن نام‌فضا " +"یک متغیر محلی نیست. برای نمونه، :term:`متغیر بستار ` را ببینید. از نظر عملی، به‌دلیل نام ویژگی :attr:`codeobject.co_freevars`، این اصطلاح گاهی " +"به‌عنوان مترادفی برای :term:`متغیر بستار ` نیز استفاده می‌شود." +#: ../../glossary.rst:600 msgid "function" msgstr "تابع" -msgid "A series of statements which returns some value to a caller. It can also be passed zero or more :term:`arguments ` which may be used in the execution of the body. See also :term:`parameter`, :term:`method`, and the :ref:`function` section." -msgstr "مجموعه‌ای از دستورها که مقداری را به یک فراخواننده بازمی‌گرداند. همچنین می‌تواند صفر یا چند :term:`آرگومان ` دریافت کند که ممکن است در اجرای بدنه استفاده شوند. همچنین :term:`پارامتر `، :term:`متد ` و بخش :ref:`function` را ببینید." +#: ../../glossary.rst:602 +msgid "" +"A series of statements which returns some value to a caller. It can also be passed zero or more :term:`arguments ` which may be used in the execution of " +"the body. See also :term:`parameter`, :term:`method`, and the :ref:`function` section." +msgstr "" +"مجموعه‌ای از دستورها که مقداری را به یک فراخواننده بازمی‌گرداند. همچنین می‌تواند صفر یا چند :term:`آرگومان ` دریافت کند که ممکن است در اجرای بدنه استفاده " +"شوند. همچنین :term:`پارامتر `، :term:`متد ` و بخش :ref:`function` را ببینید." +#: ../../glossary.rst:606 msgid "function annotation" msgstr "حاشیه‌گذاری تابع" +#: ../../glossary.rst:608 msgid "An :term:`annotation` of a function parameter or return value." msgstr "یک :term:`حاشیه‌گذاری ` برای پارامتر یک تابع یا مقدار بازگشتی." -msgid "Function annotations are usually used for :term:`type hints `: for example, this function is expected to take two :class:`int` arguments and is also expected to have an :class:`int` return value::" -msgstr "حاشیه‌گذاری‌های تابع معمولاً برای :term:`راهنمای نوع ` استفاده می‌شوند: برای مثال، انتظار می‌رود این تابع دو آرگومان :class:`int` دریافت کند و همچنین یک مقدار بازگشتی :class:`int` داشته باشد::" +#: ../../glossary.rst:610 +msgid "" +"Function annotations are usually used for :term:`type hints `: for example, this function is expected to take two :class:`int` arguments and is also " +"expected to have an :class:`int` return value::" +msgstr "" +"حاشیه‌گذاری‌های تابع معمولاً برای :term:`راهنمای نوع ` استفاده می‌شوند: برای مثال، انتظار می‌رود این تابع دو آرگومان :class:`int` دریافت کند و همچنین یک " +"مقدار بازگشتی :class:`int` داشته باشد::" +#: ../../glossary.rst:615 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -583,18 +1106,33 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" +#: ../../glossary.rst:618 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "نحو حاشیه‌گذاری تابع در بخش :ref:`function` توضیح داده شده است." -msgid "See :term:`variable annotation` and :pep:`484`, which describe this functionality. Also see :ref:`annotations-howto` for best practices on working with annotations." -msgstr "به :term:`حاشیه‌نویسی متغیر ` و :pep:`484` مراجعه کنید که این قابلیت را توضیح می‌دهند. همچنین برای بهترین روش‌ها در کار با حاشیه‌گذاری‌ها، :ref:`annotations-howto` را ببینید." +#: ../../glossary.rst:620 +msgid "" +"See :term:`variable annotation` and :pep:`484`, which describe this functionality. Also see :ref:`annotations-howto` for best practices on working with " +"annotations." +msgstr "" +"به :term:`حاشیه‌نویسی متغیر ` و :pep:`484` مراجعه کنید که این قابلیت را توضیح می‌دهند. همچنین برای بهترین روش‌ها در کار با " +"حاشیه‌گذاری‌ها، :ref:`annotations-howto` را ببینید." +#: ../../glossary.rst:624 msgid "__future__" msgstr "__future__" -msgid "A :ref:`future statement `, ``from __future__ import ``, directs the compiler to compile the current module using syntax or semantics that will become standard in a future release of Python. The :mod:`__future__` module documents the possible values of *feature*. By importing this module and evaluating its variables, you can see when a new feature was first added to the language and when it will (or did) become the default::" -msgstr "یک :ref:`future statement `، یعنی ``from __future__ import ``, به کامپایلر دستور می‌دهد ماژول فعلی را با استفاده از سینتکس یا معناشناسی‌ای کامپایل کند که در یک انتشار آیندهٔ پایتون استاندارد خواهد شد. ماژول :mod:`__future__` مقادیر ممکن *feature* را مستند می‌کند. با ایمپورت این ماژول و ارزیابی متغیرهای آن، می‌توانید ببینید چه زمانی یک ویژگی جدید برای اولین بار به زبان اضافه شده است و چه زمانی به حالت پیش‌فرض تبدیل خواهد شد (یا شده است)::" +#: ../../glossary.rst:626 +msgid "" +"A :ref:`future statement `, ``from __future__ import ``, directs the compiler to compile the current module using syntax or semantics that will " +"become standard in a future release of Python. The :mod:`__future__` module documents the possible values of *feature*. By importing this module and evaluating " +"its variables, you can see when a new feature was first added to the language and when it will (or did) become the default::" +msgstr "" +"یک :ref:`future statement `، یعنی ``from __future__ import ``, به کامپایلر دستور می‌دهد ماژول فعلی را با استفاده از سینتکس یا معناشناسی‌ای کامپایل " +"کند که در یک انتشار آیندهٔ پایتون استاندارد خواهد شد. ماژول :mod:`__future__` مقادیر ممکن *feature* را مستند می‌کند. با ایمپورت این ماژول و ارزیابی متغیرهای آن، " +"می‌توانید ببینید چه زمانی یک ویژگی جدید برای اولین بار به زبان اضافه شده است و چه زمانی به حالت پیش‌فرض تبدیل خواهد شد (یا شده است)::" +#: ../../glossary.rst:634 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -604,36 +1142,79 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" +#: ../../glossary.rst:637 msgid "garbage collection" msgstr "زباله‌روبی" -msgid "The process of freeing memory when it is not used anymore. Python performs garbage collection via reference counting and a cyclic garbage collector that is able to detect and break reference cycles. The garbage collector can be controlled using the :mod:`gc` module." -msgstr "فرایند آزادسازی حافظه هنگامی که دیگر استفاده نمی‌شود. پایتون زباله‌روبی را از طریق شمارش ارجاع‌ها و یک زباله‌روب چرخه‌ای که قادر به شناسایی و شکستن چرخه‌های ارجاع است انجام می‌دهد. زباله‌روب را می‌توان با استفاده از ماژول :mod:`gc` کنترل کرد." +#: ../../glossary.rst:639 +msgid "" +"The process of freeing memory when it is not used anymore. Python performs garbage collection via reference counting and a cyclic garbage collector that is able " +"to detect and break reference cycles. The garbage collector can be controlled using the :mod:`gc` module." +msgstr "" +"فرایند آزادسازی حافظه هنگامی که دیگر استفاده نمی‌شود. پایتون زباله‌روبی را از طریق شمارش ارجاع‌ها و یک زباله‌روب چرخه‌ای که قادر به شناسایی و شکستن چرخه‌های ارجاع است " +"انجام می‌دهد. زباله‌روب را می‌توان با استفاده از ماژول :mod:`gc` کنترل کرد." +#: ../../glossary.rst:644 ../../glossary.rst:645 msgid "generator" msgstr "تولیدگر" -msgid "A function which returns a :term:`generator iterator`. It looks like a normal function except that it contains :keyword:`yield` expressions for producing a series of values usable in a for-loop or that can be retrieved one at a time with the :func:`next` function." -msgstr "تابعی که یک :term:`تکرارگر تولیدگر ` بازمی‌گرداند. این تابع شبیه یک تابع معمولی است، با این تفاوت که شامل عبارت‌های :keyword:`yield` برای تولید مجموعه‌ای از مقادیر قابل استفاده در یک حلقهٔ for یا قابل بازیابی یکی‌یکی با تابع :func:`next` است." +#: ../../glossary.rst:647 +msgid "" +"Informally used to mean either a :term:`generator function` or a :term:`generator iterator`, depending on context. The formal terms :term:`generator function` " +"and :term:`generator iterator` are uncommon in practice; \"generator\" alone is almost always sufficient." +msgstr "" +"به‌صورت غیررسمی برای اشاره به یک :term:`تابع تولیدگر ` یا یک :term:`تکرارگر تولیدگر `، بسته به زمینه، استفاده می‌شود. اصطلاحات " +"رسمی :term:`تابع تولیدگر ` و :term:`تکرارگر تولیدگر ` در عمل کمتر استفاده می‌شوند؛ «تولیدگر» به‌تنهایی تقریباً همیشه کافی است." + +#: ../../glossary.rst:652 ../../glossary.rst:653 +msgid "generator function" +msgstr "تابع مولد" -msgid "Usually refers to a generator function, but may refer to a *generator iterator* in some contexts. In cases where the intended meaning isn't clear, using the full terms avoids ambiguity." -msgstr "معمولاً به یک تابع تولیدگر اشاره دارد، اما در برخی زمینه‌ها ممکن است به یک *تکرارگر تولیدگر* اشاره کند. در مواردی که معنای مورد نظر واضح نیست، استفاده از اصطلاحات کامل از ابهام جلوگیری می‌کند." +#: ../../glossary.rst:655 +msgid "" +"A function which returns a :term:`generator` object. It looks like a normal function except that it contains :keyword:`yield` expressions for producing a series " +"of values usable in a :keyword:`for`-loop or that can be retrieved one at a time with the :func:`next` function. See :ref:`yieldexpr`." +msgstr "" +"تابعی که یک شیء :term:`تولیدگر ` بازمی‌گرداند. این تابع شبیه یک تابع معمولی است، با این تفاوت که شامل عبارت‌های :keyword:`yield` برای تولید مجموعه‌ای از " +"مقادیر قابل استفاده در یک حلقهٔ :keyword:`for` یا قابل بازیابی یکی‌یکی با تابع :func:`next` است. :ref:`yieldexpr` را ببینید." +#: ../../glossary.rst:660 msgid "generator iterator" msgstr "تکرارگر تولیدگر" -msgid "An object created by a :term:`generator` function." -msgstr "شیءای که توسط یک تابع :term:`تولیدگر ` ایجاد می‌شود." +#: ../../glossary.rst:662 +msgid "An object created by a :term:`generator function` or a :term:`generator expression`." +msgstr "شیءای که توسط یک :term:`تابع تولیدگر ` یا یک :term:`عبارت تولیدگر ` ایجاد می‌شود." + +#: ../../glossary.rst:665 +msgid "" +"Each :keyword:`yield` temporarily suspends processing, remembering the execution state (including local variables and pending try-statements). When the *generator " +"iterator* resumes, it picks up where it left off (in contrast to functions which start fresh on every invocation)." +msgstr "" +"هر :keyword:`yield` پردازش را به‌طور موقت متوقف می‌کند و وضعیت اجرا (شامل متغیرهای محلی و دستورهای try در انتظار) را به خاطر می‌سپارد. هنگامی که *تکرارگر تولیدگر* " +"ادامهٔ اجرا می‌دهد، از همان نقطه‌ای که متوقف شده بود ادامه می‌دهد (برخلاف توابع که در هر فراخوانی از ابتدا شروع می‌شوند)." -msgid "Each :keyword:`yield` temporarily suspends processing, remembering the execution state (including local variables and pending try-statements). When the *generator iterator* resumes, it picks up where it left off (in contrast to functions which start fresh on every invocation)." -msgstr "هر :keyword:`yield` پردازش را به‌طور موقت متوقف می‌کند و وضعیت اجرا (شامل متغیرهای محلی و دستورهای try در انتظار) را به خاطر می‌سپارد. هنگامی که *تکرارگر تولیدگر* ادامهٔ اجرا می‌دهد، از همان نقطه‌ای که متوقف شده بود ادامه می‌دهد (برخلاف توابع که در هر فراخوانی از ابتدا شروع می‌شوند)." +#: ../../glossary.rst:670 +msgid "" +"Generator iterators also implement the :meth:`~generator.send` method to send a value into the suspended generator, and the :meth:`~generator.throw` method to " +"raise an exception at the point where the generator was paused. See :ref:`generator-methods`." +msgstr "" +"تکرارگرهای تولیدگر همچنین متد :meth:`~generator.send` را برای ارسال یک مقدار به تولیدگر متوقف‌شده و متد :meth:`~generator.throw` را برای پرتاب یک استثنا در نقطه‌ای که " +"تولیدگر در آن متوقف شده است، پیاده‌سازی می‌کنند. بخش :ref:`generator-methods` را ببینید." +#: ../../glossary.rst:675 ../../glossary.rst:676 msgid "generator expression" msgstr "عبارت تولیدگر" -msgid "An :term:`expression` that returns an :term:`iterator`. It looks like a normal expression followed by a :keyword:`!for` clause defining a loop variable, range, and an optional :keyword:`!if` clause. The combined expression generates values for an enclosing function::" -msgstr "یک :term:`عبارت ` که یک :term:`تکرارگر ` بازمی‌گرداند. این عبارت شبیه یک عبارت معمولی است که پس از آن یک بند :keyword:`!for` برای تعریف متغیر حلقه، محدوده و یک بند اختیاری :keyword:`!if` قرار گرفته است. عبارت ترکیبی، مقادیری را برای یک تابع دربرگیرنده تولید می‌کند::" +#: ../../glossary.rst:678 +msgid "" +"An :term:`expression` that returns an :term:`iterator`. It looks like a normal expression followed by a :keyword:`!for` clause defining a loop variable, range, " +"and an optional :keyword:`!if` clause. The combined expression generates values for an enclosing function::" +msgstr "" +"یک :term:`عبارت ` که یک :term:`تکرارگر ` بازمی‌گرداند. این عبارت شبیه یک عبارت معمولی است که پس از آن یک بند :keyword:`!for` برای تعریف متغیر " +"حلقه، محدوده و یک بند اختیاری :keyword:`!if` قرار گرفته است. عبارت ترکیبی، مقادیری را برای یک تابع دربرگیرنده تولید می‌کند::" +#: ../../glossary.rst:683 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -641,351 +1222,691 @@ msgstr "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" +#: ../../glossary.rst:685 msgid "generic function" msgstr "تابع عمومی" -msgid "A function composed of multiple functions implementing the same operation for different types. Which implementation should be used during a call is determined by the dispatch algorithm." -msgstr "تابعی که از چندین تابع تشکیل شده است که یک عملیات یکسان را برای نوع‌های مختلف پیاده‌سازی می‌کنند. این‌که هنگام یک فراخوانی کدام پیاده‌سازی استفاده شود، توسط الگوریتم ارسال تعیین می‌شود." +#: ../../glossary.rst:687 +msgid "" +"A function composed of multiple functions implementing the same operation for different types. Which implementation should be used during a call is determined by " +"the dispatch algorithm." +msgstr "" +"تابعی که از چندین تابع تشکیل شده است که یک عملیات یکسان را برای نوع‌های مختلف پیاده‌سازی می‌کنند. این‌که هنگام یک فراخوانی کدام پیاده‌سازی استفاده شود، توسط الگوریتم " +"ارسال تعیین می‌شود." -msgid "See also the :term:`single dispatch` glossary entry, the :func:`functools.singledispatch` decorator, and :pep:`443`." +#: ../../glossary.rst:691 +msgid "See also the :term:`single dispatch` glossary entry, the :deco:`functools.singledispatch` decorator, and :pep:`443`." msgstr "همچنین به ورودی واژه‌نامه‌ای :term:`توزیع تک‌گانه `، دکوریتور :func:`functools.singledispatch` و :pep:`443` مراجعه کنید." +#: ../../glossary.rst:693 msgid "generic type" msgstr "نوع عمومی" -msgid "A :term:`type` that can be parameterized; typically a :ref:`container class` such as :class:`list` or :class:`dict`. Used for :term:`type hints ` and :term:`annotations `." -msgstr "یک :term:`نوع ` که می‌تواند پارامتری شود؛ معمولاً یک :ref:`container class` مانند :class:`list` یا :class:`dict`. برای :term:`راهنمای نوع ` و :term:`حاشیه‌گذاری ` استفاده می‌شود." +#: ../../glossary.rst:695 +msgid "" +"A :term:`type` that can be parameterized; typically a :ref:`container class` such as :class:`list` or :class:`dict`. Used for :term:`type hints " +"` and :term:`annotations `." +msgstr "" +"یک :term:`نوع ` که می‌تواند پارامتری شود؛ معمولاً یک :ref:`container class` مانند :class:`list` یا :class:`dict`. برای :term:`راهنمای نوع " +"` و :term:`حاشیه‌گذاری ` استفاده می‌شود." +#: ../../glossary.rst:700 msgid "For more details, see :ref:`generic alias types`, :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." msgstr "برای جزئیات بیشتر، :ref:`generic alias types`، :pep:`483`، :pep:`484`، :pep:`585` و ماژول :mod:`typing` را ببینید." +#: ../../glossary.rst:702 msgid "GIL" msgstr "GIL" +#: ../../glossary.rst:704 msgid "See :term:`global interpreter lock`." msgstr ":term:`قفل مفسر سراسری ` را ببینید." +#: ../../glossary.rst:705 msgid "global interpreter lock" msgstr "قفل مفسر سراسری" -msgid "The mechanism used by the :term:`CPython` interpreter to assure that only one thread executes Python :term:`bytecode` at a time. This simplifies the CPython implementation by making the object model (including critical built-in types such as :class:`dict`) implicitly safe against concurrent access. Locking the entire interpreter makes it easier for the interpreter to be multi-threaded, at the expense of much of the parallelism afforded by multi-processor machines." -msgstr "سازوکاری که توسط مفسر :term:`CPython ` استفاده می‌شود تا تضمین کند در هر زمان فقط یک نخ :term:`بایت‌کد ` پایتون را اجرا می‌کند. این کار پیاده‌سازی CPython را ساده‌تر می‌کند، زیرا مدل شیء (شامل نوع‌های توکار مهمی مانند :class:`dict`) به‌طور ضمنی در برابر دسترسی هم‌زمان ایمن می‌شود. قفل کردن کل مفسر باعث می‌شود چندنخی کردن مفسر آسان‌تر شود، اما به قیمت از دست دادن بخش زیادی از موازی‌سازی‌ای که ماشین‌های چندپردازنده‌ای فراهم می‌کنند." +#: ../../glossary.rst:707 +msgid "" +"The mechanism used by the :term:`CPython` interpreter to assure that only one thread executes Python :term:`bytecode` at a time. This simplifies the CPython " +"implementation by making the object model (including critical built-in types such as :class:`dict`) implicitly safe against concurrent access. Locking the entire " +"interpreter makes it easier for the interpreter to be multi-threaded, at the expense of much of the parallelism afforded by multi-processor machines." +msgstr "" +"سازوکاری که توسط مفسر :term:`CPython ` استفاده می‌شود تا تضمین کند در هر زمان فقط یک نخ :term:`بایت‌کد ` پایتون را اجرا می‌کند. این کار پیاده‌سازی " +"CPython را ساده‌تر می‌کند، زیرا مدل شیء (شامل نوع‌های توکار مهمی مانند :class:`dict`) به‌طور ضمنی در برابر دسترسی هم‌زمان ایمن می‌شود. قفل کردن کل مفسر باعث می‌شود " +"چندنخی کردن مفسر آسان‌تر شود، اما به قیمت از دست دادن بخش زیادی از موازی‌سازی‌ای که ماشین‌های چندپردازنده‌ای فراهم می‌کنند." -msgid "However, some extension modules, either standard or third-party, are designed so as to release the GIL when doing computationally intensive tasks such as compression or hashing. Also, the GIL is always released when doing I/O." -msgstr "با این حال، برخی ماژول‌های افزونه، چه استاندارد و چه شخص ثالث، به‌گونه‌ای طراحی شده‌اند که هنگام انجام وظایف محاسباتی سنگین مانند فشرده‌سازی یا درهم‌سازی، GIL را آزاد کنند. همچنین، GIL همیشه هنگام انجام عملیات ورودی/خروجی آزاد می‌شود." +#: ../../glossary.rst:716 +msgid "" +"However, some extension modules, either standard or third-party, are designed so as to release the GIL when doing computationally intensive tasks such as " +"compression or hashing. Also, the GIL is always released when doing I/O." +msgstr "" +"با این حال، برخی ماژول‌های افزونه، چه استاندارد و چه شخص ثالث، به‌گونه‌ای طراحی شده‌اند که هنگام انجام وظایف محاسباتی سنگین مانند فشرده‌سازی یا درهم‌سازی، GIL را آزاد " +"کنند. همچنین، GIL همیشه هنگام انجام عملیات ورودی/خروجی آزاد می‌شود." -msgid "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` build configuration. After building Python with this option, code must be run with :option:`-X gil=0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 ` environment variable. This feature enables improved performance for multi-threaded applications and makes it easier to use multi-core CPUs efficiently. For more details, see :pep:`703`." -msgstr "از پایتون ۳.۱۳، می‌توان GIL را با استفاده از پیکربندی ساخت :option:`--disable-gil` غیرفعال کرد. پس از ساخت پایتون با این گزینه، کد باید با :option:`-X gil=0 <-X>` یا پس از تنظیم متغیر محیطی :envvar:`PYTHON_GIL=0 ` اجرا شود. این ویژگی عملکرد بهتر برای برنامه‌های چندنخی را فراهم می‌کند و استفادهٔ مؤثرتر از CPUهای چند‌هسته‌ای را آسان‌تر می‌سازد. برای جزئیات بیشتر، :pep:`703` را ببینید." +#: ../../glossary.rst:721 +msgid "" +"As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` build configuration. After building Python with this option, code must be run " +"with :option:`-X gil=0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 ` environment variable. This feature enables improved performance for multi-" +"threaded applications and makes it easier to use multi-core CPUs efficiently. For more details, see :pep:`703`." +msgstr "" +"از پایتون ۳.۱۳، می‌توان GIL را با استفاده از پیکربندی ساخت :option:`--disable-gil` غیرفعال کرد. پس از ساخت پایتون با این گزینه، کد باید با :option:`-X gil=0 <-X>` " +"یا پس از تنظیم متغیر محیطی :envvar:`PYTHON_GIL=0 ` اجرا شود. این ویژگی عملکرد بهتر برای برنامه‌های چندنخی را فراهم می‌کند و استفادهٔ مؤثرتر از CPUهای " +"چند‌هسته‌ای را آسان‌تر می‌سازد. برای جزئیات بیشتر، :pep:`703` را ببینید." -msgid "In prior versions of Python's C API, a function might declare that it requires the GIL to be held in order to use it. This refers to having an :term:`attached thread state`." -msgstr "در نسخه‌های پیشین API زبان C پایتون، یک تابع ممکن بود اعلام کند که برای استفاده از آن، لازم است GIL در اختیار گرفته شده باشد. این موضوع به داشتن یک :term:`وضعیت نخ متصل ` اشاره دارد." +#: ../../glossary.rst:728 +msgid "" +"In prior versions of Python's C API, a function might declare that it requires the GIL to be held in order to use it. This refers to having an :term:`attached " +"thread state`." +msgstr "" +"در نسخه‌های پیشین API زبان C پایتون، یک تابع ممکن بود اعلام کند که برای استفاده از آن، لازم است GIL در اختیار گرفته شده باشد. این موضوع به داشتن یک :term:`وضعیت نخ " +"متصل ` اشاره دارد." +#: ../../glossary.rst:731 msgid "global state" msgstr "وضعیت سراسری" -msgid "Data that is accessible throughout a program, such as module-level variables, class variables, or C static variables in :term:`extension modules `. In multi-threaded programs, global state shared between threads typically requires synchronization to avoid :term:`race conditions ` and :term:`data races `." -msgstr "داده‌ای که در سراسر یک برنامه قابل دسترسی است، مانند متغیرهای سطح ماژول، متغیرهای کلاس یا متغیرهای ایستای C در :term:`ماژول افزونه `. در برنامه‌های چندنخی، وضعیت سراسری اشتراک‌گذاری‌شده بین نخ‌ها معمولاً برای جلوگیری از :term:`شرط رقابت ` و :term:`رقابت داده ` به همگام‌سازی نیاز دارد." +#: ../../glossary.rst:733 +msgid "" +"Data that is accessible throughout a program, such as module-level variables, class variables, or C static variables in :term:`extension modules `. In multi-threaded programs, global state shared between threads typically requires synchronization to avoid :term:`race conditions ` " +"and :term:`data races `." +msgstr "" +"داده‌ای که در سراسر یک برنامه قابل دسترسی است، مانند متغیرهای سطح ماژول، متغیرهای کلاس یا متغیرهای ایستای C در :term:`ماژول افزونه `. در " +"برنامه‌های چندنخی، وضعیت سراسری اشتراک‌گذاری‌شده بین نخ‌ها معمولاً برای جلوگیری از :term:`شرط رقابت ` و :term:`رقابت داده ` به همگام‌سازی " +"نیاز دارد." +#: ../../glossary.rst:739 msgid "hash-based pyc" msgstr "pyc مبتنی بر هش" -msgid "A bytecode cache file that uses the hash rather than the last-modified time of the corresponding source file to determine its validity. See :ref:`pyc-invalidation`." +#: ../../glossary.rst:741 +msgid "" +"A bytecode cache file that uses the hash rather than the last-modified time of the corresponding source file to determine its validity. See :ref:`pyc-" +"invalidation`." msgstr "یک فایل نهانگاه بایت‌کد که به‌جای زمان آخرین تغییر فایل منبع متناظر، از هش آن برای تعیین اعتبار خود استفاده می‌کند. :ref:`pyc-invalidation` را ببینید." +#: ../../glossary.rst:744 msgid "hashable" msgstr "قابل درهم‌سازی" -msgid "An object is *hashable* if it has a hash value which never changes during its lifetime (it needs a :meth:`~object.__hash__` method), and can be compared to other objects (it needs an :meth:`~object.__eq__` method). Hashable objects which compare equal must have the same hash value." -msgstr "یک شیء *قابل درهم‌سازی* است اگر دارای یک مقدار هش باشد که در طول عمر آن هرگز تغییر نمی‌کند (به یک متد :meth:`~object.__hash__` نیاز دارد) و بتوان آن را با اشیای دیگر مقایسه کرد (به یک متد :meth:`~object.__eq__` نیاز دارد). اشیای قابل درهم‌سازی که برابر مقایسه می‌شوند باید مقدار هش یکسانی داشته باشند." +#: ../../glossary.rst:746 +msgid "" +"An object is *hashable* if it has a hash value which never changes during its lifetime (it needs a :meth:`~object.__hash__` method), and can be compared to other " +"objects (it needs an :meth:`~object.__eq__` method). Hashable objects which compare equal must have the same hash value." +msgstr "" +"یک شیء *قابل درهم‌سازی* است اگر دارای یک مقدار هش باشد که در طول عمر آن هرگز تغییر نمی‌کند (به یک متد :meth:`~object.__hash__` نیاز دارد) و بتوان آن را با اشیای " +"دیگر مقایسه کرد (به یک متد :meth:`~object.__eq__` نیاز دارد). اشیای قابل درهم‌سازی که برابر مقایسه می‌شوند باید مقدار هش یکسانی داشته باشند." +#: ../../glossary.rst:752 msgid "Hashability makes an object usable as a dictionary key and a set member, because these data structures use the hash value internally." msgstr "قابل درهم‌سازی بودن باعث می‌شود یک شیء به‌عنوان کلید دیکشنری و عضو مجموعه قابل استفاده باشد، زیرا این ساختارهای داده مقدار هش را به‌صورت داخلی استفاده می‌کنند." -msgid "Most of Python's immutable built-in objects are hashable; mutable containers (such as lists or dictionaries) are not; immutable containers (such as tuples and frozensets) are only hashable if their elements are hashable. Objects which are instances of user-defined classes are hashable by default. They all compare unequal (except with themselves), and their hash value is derived from their :func:`id`." -msgstr "بیشتر اشیای توکار تغییرناپذیر پایتون قابل درهم‌سازی هستند؛ محفظه‌های تغییرپذیر (مانند فهرست‌ها یا دیکشنری‌ها) قابل درهم‌سازی نیستند؛ محفظه‌های تغییرناپذیر (مانند تاپل‌ها یا frozensetها) فقط در صورتی قابل درهم‌سازی هستند که عناصرشان قابل درهم‌سازی باشند. اشیایی که نمونه‌هایی از کلاس‌های تعریف‌شده توسط کاربر هستند، به‌طور پیش‌فرض قابل درهم‌سازی هستند. همهٔ آن‌ها نابرابر مقایسه می‌شوند (به‌جز با خودشان) و مقدار هش آن‌ها از :func:`id` آن‌ها مشتق می‌شود." +#: ../../glossary.rst:755 +msgid "" +"Most of Python's immutable built-in objects are hashable; mutable containers (such as lists or dictionaries) are not; immutable containers (such as tuples and " +"frozensets) are only hashable if their elements are hashable. Objects which are instances of user-defined classes are hashable by default. They all compare " +"unequal (except with themselves), and their hash value is derived from their :func:`id`." +msgstr "" +"بیشتر اشیای توکار تغییرناپذیر پایتون قابل درهم‌سازی هستند؛ محفظه‌های تغییرپذیر (مانند فهرست‌ها یا دیکشنری‌ها) قابل درهم‌سازی نیستند؛ محفظه‌های تغییرناپذیر (مانند تاپل‌ها " +"یا frozensetها) فقط در صورتی قابل درهم‌سازی هستند که عناصرشان قابل درهم‌سازی باشند. اشیایی که نمونه‌هایی از کلاس‌های تعریف‌شده توسط کاربر هستند، به‌طور پیش‌فرض قابل " +"درهم‌سازی هستند. همهٔ آن‌ها نابرابر مقایسه می‌شوند (به‌جز با خودشان) و مقدار هش آن‌ها از :func:`id` آن‌ها مشتق می‌شود." +#: ../../glossary.rst:762 msgid "IDLE" msgstr "IDLE" -msgid "An Integrated Development and Learning Environment for Python. :ref:`idle` is a basic editor and interpreter environment which ships with the standard distribution of Python." +#: ../../glossary.rst:764 +msgid "" +"An Integrated Development and Learning Environment for Python. :ref:`idle` is a basic editor and interpreter environment which ships with the standard " +"distribution of Python." msgstr "یک محیط توسعه و یادگیری یکپارچه برای پایتون. :ref:`idle` یک محیط ویرایشگر و مفسر پایه است که همراه با توزیع استاندارد پایتون ارائه می‌شود." +#: ../../glossary.rst:767 msgid "immortal" msgstr "نامیرا" +#: ../../glossary.rst:769 msgid "*Immortal objects* are a CPython implementation detail introduced in :pep:`683`." msgstr "*اشیای نامیرا* یک جزئیات پیاده‌سازی CPython هستند که در :pep:`683` معرفی شده‌اند." -msgid "If an object is immortal, its :term:`reference count` is never modified, and therefore it is never deallocated while the interpreter is running. For example, :const:`True` and :const:`None` are immortal in CPython." -msgstr "اگر یک شیء نامیرا باشد، :term:`شمارندهٔ ارجاع ` آن هرگز تغییر نمی‌کند و بنابراین تا زمانی که مفسر در حال اجرا است، هرگز آزاد نمی‌شود. برای مثال، :const:`True` و :const:`None` در CPython نامیرا هستند." +#: ../../glossary.rst:772 +msgid "" +"If an object is immortal, its :term:`reference count` is never modified, and therefore it is never deallocated while the interpreter is running. For " +"example, :const:`True` and :const:`None` are immortal in CPython." +msgstr "" +"اگر یک شیء نامیرا باشد، :term:`شمارندهٔ ارجاع ` آن هرگز تغییر نمی‌کند و بنابراین تا زمانی که مفسر در حال اجرا است، هرگز آزاد نمی‌شود. برای " +"مثال، :const:`True` و :const:`None` در CPython نامیرا هستند." +#: ../../glossary.rst:776 msgid "Immortal objects can be identified via :func:`sys._is_immortal`, or via :c:func:`PyUnstable_IsImmortal` in the C API." msgstr "اشیای نامیرا را می‌توان از طریق :func:`sys._is_immortal` یا از طریق :c:func:`PyUnstable_IsImmortal` در API زبان C شناسایی کرد." +#: ../../glossary.rst:778 msgid "immutable" msgstr "تغییرناپذیر" -msgid "An object with a fixed value. Immutable objects include numbers, strings and tuples. Such an object cannot be altered. A new object has to be created if a different value has to be stored. They play an important role in places where a constant hash value is needed, for example as a key in a dictionary. Immutable objects are inherently :term:`thread-safe` because their state cannot be modified after creation, eliminating concerns about improperly synchronized :term:`concurrent modification`." -msgstr "شیءای با مقدار ثابت. اشیای تغییرناپذیر شامل اعداد، نخ‌ها و تاپل‌ها هستند. چنین شی‌ءای نمی‌تواند تغییر داده شود. اگر لازم باشد مقدار متفاوتی ذخیره شود، باید شیء جدیدی ایجاد شود. آن‌ها در جاهایی که مقدار هش ثابت لازم است، برای مثال به‌عنوان یک کلید در یک دیکشنری، نقش مهمی دارند. اشیای تغییرناپذیر ذاتاً :term:`ایمن برای نخ‌های اجرایی ` هستند، زیرا وضعیت آن‌ها پس از ایجاد قابل تغییر نیست و نگرانی‌ها دربارهٔ :term:`تغییر هم‌زمان ` که به‌درستی همگام‌سازی نشده است، از بین می‌رود." +#: ../../glossary.rst:780 +msgid "" +"An object with a fixed value. Immutable objects include numbers, strings and tuples. Such an object cannot be altered. A new object has to be created if a " +"different value has to be stored. They play an important role in places where a constant hash value is needed, for example as a key in a dictionary. Immutable " +"objects are inherently :term:`thread-safe` because their state cannot be modified after creation, eliminating concerns about improperly " +"synchronized :term:`concurrent modification`." +msgstr "" +"شیءای با مقدار ثابت. اشیای تغییرناپذیر شامل اعداد، نخ‌ها و تاپل‌ها هستند. چنین شی‌ءای نمی‌تواند تغییر داده شود. اگر لازم باشد مقدار متفاوتی ذخیره شود، باید شیء جدیدی " +"ایجاد شود. آن‌ها در جاهایی که مقدار هش ثابت لازم است، برای مثال به‌عنوان یک کلید در یک دیکشنری، نقش مهمی دارند. اشیای تغییرناپذیر ذاتاً :term:`ایمن برای نخ‌های اجرایی " +"` هستند، زیرا وضعیت آن‌ها پس از ایجاد قابل تغییر نیست و نگرانی‌ها دربارهٔ :term:`تغییر هم‌زمان ` که به‌درستی همگام‌سازی نشده است، " +"از بین می‌رود." +#: ../../glossary.rst:787 msgid "import path" msgstr "ایمپورت مسیر" -msgid "A list of locations (or :term:`path entries `) that are searched by the :term:`path based finder` for modules to import. During import, this list of locations usually comes from :data:`sys.path`, but for subpackages it may also come from the parent package's ``__path__`` attribute." -msgstr "فهرستی از مکان‌ها (یا :term:`ورودی مسیر `) که توسط :term:`یابندهٔ مبتنی بر مسیر ` برای ماژول‌های قابل ایمپورت جست‌وجو می‌شود. هنگام ایمپورت، این فهرست از مکان‌ها معمولاً از :data:`sys.path` می‌آید، اما برای زیر‌بسته‌ها ممکن است از ویژگی ``__path__`` بستهٔ والد نیز به‌دست آید." +#: ../../glossary.rst:789 +msgid "" +"A list of locations (or :term:`path entries `) that are searched by the :term:`path based finder` for modules to import. During import, this list of " +"locations usually comes from :data:`sys.path`, but for subpackages it may also come from the parent package's ``__path__`` attribute." +msgstr "" +"فهرستی از مکان‌ها (یا :term:`ورودی مسیر `) که توسط :term:`یابندهٔ مبتنی بر مسیر ` برای ماژول‌های قابل ایمپورت جست‌وجو می‌شود. هنگام " +"ایمپورت، این فهرست از مکان‌ها معمولاً از :data:`sys.path` می‌آید، اما برای زیر‌بسته‌ها ممکن است از ویژگی ``__path__`` بستهٔ والد نیز به‌دست آید." +#: ../../glossary.rst:794 msgid "importing" msgstr "ایمپورت کردن" +#: ../../glossary.rst:796 msgid "The process by which Python code in one module is made available to Python code in another module." msgstr "فرایندی که طی آن کد پایتون در یک ماژول برای کد پایتون در ماژولی دیگر در دسترس قرار می‌گیرد." +#: ../../glossary.rst:798 msgid "importer" msgstr "ایمپورت‌کننده" +#: ../../glossary.rst:800 msgid "An object that both finds and loads a module; both a :term:`finder` and :term:`loader` object." msgstr "شی‌ءای که هم یک ماژول را پیدا می‌کند و هم آن را بارگذاری می‌کند؛ هم یک شیء :term:`یابنده ` و هم یک شیء :term:`بارگذار `." +#: ../../glossary.rst:802 msgid "index" msgstr "اندیس" +#: ../../glossary.rst:804 msgid "A numeric value that represents the position of an element in a :term:`sequence`." msgstr "مقداری عددی که موقعیت یک المان را در یک :term:`دنباله ` نشان می‌دهد." +#: ../../glossary.rst:807 msgid "In Python, indexing starts at zero. For example, ``things[0]`` names the *first* element of ``things``; ``things[1]`` names the second one." msgstr "در پایتون، اندیس‌گذاری از صفر شروع می‌شود. برای مثال، ``things[0]`` نخستین المان ``things`` را نام‌گذاری می‌کند؛ ``things[1]`` دومین مورد را نام‌گذاری می‌کند." +#: ../../glossary.rst:811 msgid "In some contexts, Python allows negative indexes for counting from the end of a sequence, and indexing using :term:`slices `." msgstr "در برخی زمینه‌ها، پایتون اجازه می‌دهد از اندیس‌های منفی برای شمارش از انتهای یک دنباله و از اندیس‌گذاری با استفاده از :term:`برش ` استفاده شود." +#: ../../glossary.rst:814 msgid "See also :term:`subscript`." msgstr "همچنین :term:`زیرنویس ` را ببینید." +#: ../../glossary.rst:815 msgid "interactive" msgstr "تعاملی" -msgid "Python has an interactive interpreter which means you can enter statements and expressions at the interpreter prompt, immediately execute them and see their results. Just launch ``python`` with no arguments (possibly by selecting it from your computer's main menu). It is a very powerful way to test out new ideas or inspect modules and packages (remember ``help(x)``). For more on interactive mode, see :ref:`tut-interac`." -msgstr "پایتون یک مفسر تعاملی دارد، یعنی می‌توانید دستورها و عبارت‌ها را در اعلان مفسر وارد کنید، آن‌ها را بلافاصله اجرا کنید و نتایجشان را ببینید. فقط ``python`` را بدون آرگومان اجرا کنید (احتمالاً با انتخاب آن از منوی اصلی رایانهٔ خود). این روش بسیار قدرتمندی برای آزمایش ایده‌های جدید یا بررسی ماژول‌ها و بسته‌ها است (``help(x)`` را به خاطر داشته باشید). برای اطلاعات بیشتر دربارهٔ حالت تعاملی، :ref:`tut-interac` را ببینید." +#: ../../glossary.rst:817 +msgid "" +"Python has an interactive interpreter which means you can enter statements and expressions at the interpreter prompt, immediately execute them and see their " +"results. Just launch ``python`` with no arguments (possibly by selecting it from your computer's main menu). It is a very powerful way to test out new ideas or " +"inspect modules and packages (remember ``help(x)``). For more on interactive mode, see :ref:`tut-interac`." +msgstr "" +"پایتون یک مفسر تعاملی دارد، یعنی می‌توانید دستورها و عبارت‌ها را در اعلان مفسر وارد کنید، آن‌ها را بلافاصله اجرا کنید و نتایجشان را ببینید. فقط ``python`` را بدون " +"آرگومان اجرا کنید (احتمالاً با انتخاب آن از منوی اصلی رایانهٔ خود). این روش بسیار قدرتمندی برای آزمایش ایده‌های جدید یا بررسی ماژول‌ها و بسته‌ها است (``help(x)`` را به " +"خاطر داشته باشید). برای اطلاعات بیشتر دربارهٔ حالت تعاملی، :ref:`tut-interac` را ببینید." +#: ../../glossary.rst:824 msgid "interpreted" msgstr "تفسیری" -msgid "Python is an interpreted language, as opposed to a compiled one, though the distinction can be blurry because of the presence of the bytecode compiler. This means that source files can be run directly without explicitly creating an executable which is then run. Interpreted languages typically have a shorter development/debug cycle than compiled ones, though their programs generally also run more slowly. See also :term:`interactive`." -msgstr "پایتون زبانی تفسیری است، در مقابل زبان‌های کامپایل‌شده، هرچند به‌دلیل وجود کامپایلر بایت‌کد، این تمایز می‌تواند مبهم باشد. این یعنی فایل‌های منبع را می‌توان بدون ایجاد صریح یک فایل اجرایی که سپس اجرا شود، مستقیماً اجرا کرد. زبان‌های تفسیری معمولاً چرخهٔ توسعه/اشکال‌زدایی کوتاه‌تری نسبت به زبان‌های کامپایل‌شده دارند، هرچند برنامه‌های آن‌ها معمولاً کندتر اجرا می‌شوند. همچنین :term:`تعاملی ` را ببینید." +#: ../../glossary.rst:826 +msgid "" +"Python is an interpreted language, as opposed to a compiled one, though the distinction can be blurry because of the presence of the bytecode compiler. This " +"means that source files can be run directly without explicitly creating an executable which is then run. Interpreted languages typically have a shorter " +"development/debug cycle than compiled ones, though their programs generally also run more slowly. See also :term:`interactive`." +msgstr "" +"پایتون زبانی تفسیری است، در مقابل زبان‌های کامپایل‌شده، هرچند به‌دلیل وجود کامپایلر بایت‌کد، این تمایز می‌تواند مبهم باشد. این یعنی فایل‌های منبع را می‌توان بدون ایجاد " +"صریح یک فایل اجرایی که سپس اجرا شود، مستقیماً اجرا کرد. زبان‌های تفسیری معمولاً چرخهٔ توسعه/اشکال‌زدایی کوتاه‌تری نسبت به زبان‌های کامپایل‌شده دارند، هرچند برنامه‌های آن‌ها " +"معمولاً کندتر اجرا می‌شوند. همچنین :term:`تعاملی ` را ببینید." +#: ../../glossary.rst:833 msgid "interpreter shutdown" msgstr "خاموشی مفسر" -msgid "When asked to shut down, the Python interpreter enters a special phase where it gradually releases all allocated resources, such as modules and various critical internal structures. It also makes several calls to the :term:`garbage collector `. This can trigger the execution of code in user-defined destructors or weakref callbacks. Code executed during the shutdown phase can encounter various exceptions as the resources it relies on may not function anymore (common examples are library modules or the warnings machinery)." -msgstr "هنگامی که از مفسر پایتون خواسته می‌شود خاموش شود، وارد مرحلهٔ ویژه‌ای می‌شود که در آن به‌تدریج همهٔ منابع تخصیص‌یافته، مانند ماژول‌ها و ساختارهای داخلی مهم مختلف، آزاد می‌شوند. همچنین چندین فراخوانی به :term:`زباله‌روبی ` انجام می‌دهد. این کار می‌تواند اجرای کد در نابودگرهای تعریف‌شده توسط کاربر یا کال‌بک‌های weakref را فعال کند. کدی که در مرحلهٔ خاموشی اجرا می‌شود ممکن است با استثناهای مختلفی روبه‌رو شود، زیرا منابعی که به آن‌ها وابسته است ممکن است دیگر کار نکنند (نمونه‌های رایج شامل ماژول‌های کتابخانه یا سازوکار هشدارها هستند)." +#: ../../glossary.rst:835 +msgid "" +"When asked to shut down, the Python interpreter enters a special phase where it gradually releases all allocated resources, such as modules and various critical " +"internal structures. It also makes several calls to the :term:`garbage collector `. This can trigger the execution of code in user-defined " +"destructors or weakref callbacks. Code executed during the shutdown phase can encounter various exceptions as the resources it relies on may not function anymore " +"(common examples are library modules or the warnings machinery)." +msgstr "" +"هنگامی که از مفسر پایتون خواسته می‌شود خاموش شود، وارد مرحلهٔ ویژه‌ای می‌شود که در آن به‌تدریج همهٔ منابع تخصیص‌یافته، مانند ماژول‌ها و ساختارهای داخلی مهم مختلف، آزاد " +"می‌شوند. همچنین چندین فراخوانی به :term:`زباله‌روبی ` انجام می‌دهد. این کار می‌تواند اجرای کد در نابودگرهای تعریف‌شده توسط کاربر یا کال‌بک‌های " +"weakref را فعال کند. کدی که در مرحلهٔ خاموشی اجرا می‌شود ممکن است با استثناهای مختلفی روبه‌رو شود، زیرا منابعی که به آن‌ها وابسته است ممکن است دیگر کار نکنند " +"(نمونه‌های رایج شامل ماژول‌های کتابخانه یا سازوکار هشدارها هستند)." +#: ../../glossary.rst:844 msgid "The main reason for interpreter shutdown is that the ``__main__`` module or the script being run has finished executing." msgstr "دلیل اصلی خاموشی مفسر این است که ماژول ``__main__`` یا اسکریپتی که در حال اجرا است، اجرای خود را به پایان رسانده است." +#: ../../glossary.rst:846 msgid "iterable" msgstr "تکرارپذیر" -msgid "An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as :class:`list`, :class:`str`, and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:`file objects `, and objects of any classes you define with an :meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method that implements :term:`sequence` semantics." -msgstr "شیءای که قادر است اعضای خود را یکی‌یکی بازگرداند. نمونه‌هایی از تکرارپذیرها شامل همهٔ نوع‌های دنباله‌ای (مانند :class:`list`، :class:`str` و :class:`tuple`) و برخی نوع‌های غیرتوالی مانند :class:`dict`، :term:`شیء فایل ` و اشیای هر کلاسی که شما با متد :meth:`~object.__iter__` یا با متد :meth:`~object.__getitem__` که معناشناسی :term:`دنباله ` را پیاده‌سازی می‌کند تعریف می‌کنید، هستند." +#: ../../glossary.rst:848 +msgid "" +"An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as :class:`list`, :class:`str`, " +"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:`file objects `, and objects of any classes you define with " +"an :meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method that implements :term:`sequence` semantics." +msgstr "" +"شیءای که قادر است اعضای خود را یکی‌یکی بازگرداند. نمونه‌هایی از تکرارپذیرها شامل همهٔ نوع‌های دنباله‌ای (مانند :class:`list`، :class:`str` و :class:`tuple`) و برخی " +"نوع‌های غیرتوالی مانند :class:`dict`، :term:`شیء فایل ` و اشیای هر کلاسی که شما با متد :meth:`~object.__iter__` یا با متد :meth:`~object.__getitem__` " +"که معناشناسی :term:`دنباله ` را پیاده‌سازی می‌کند تعریف می‌کنید، هستند." -msgid "Iterables can be used in a :keyword:`for` loop and in many other places where a sequence is needed (:func:`zip`, :func:`map`, ...). When an iterable object is passed as an argument to the built-in function :func:`iter`, it returns an iterator for the object. This iterator is good for one pass over the set of values. When using iterables, it is usually not necessary to call :func:`iter` or deal with iterator objects yourself. The :keyword:`for` statement does that automatically for you, creating a temporary unnamed variable to hold the iterator for the duration of the loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." -msgstr "تکرارپذیرها را می‌توان در یک حلقهٔ :keyword:`for` و در بسیاری از مکان‌های دیگری که یک دنباله لازم است (:func:`zip`، :func:`map` و ...) استفاده کرد. هنگامی که یک شیء تکرارپذیر به‌عنوان آرگومان به تابع توکار :func:`iter` داده می‌شود، یک تکرارگر برای آن شیء بازمی‌گرداند. این تکرارگر برای یک بار پیمایش مجموعهٔ مقادیر مناسب است. هنگام استفاده از تکرارپذیرها، معمولاً لازم نیست خودتان :func:`iter` را فراخوانی کنید یا با اشیای تکرارگر سروکار داشته باشید. دستور :keyword:`for` این کار را به‌طور خودکار برای شما انجام می‌دهد و یک متغیر موقتِ بدون نام ایجاد می‌کند تا در طول حلقه تکرارگر را نگه دارد. همچنین :term:`تکرارگر `، :term:`دنباله ` و :term:`تولیدگر ` را ببینید." +#: ../../glossary.rst:856 +msgid "" +"Iterables can be used in a :keyword:`for` loop and in many other places where a sequence is needed (:func:`zip`, :func:`map`, ...). When an iterable object is " +"passed as an argument to the built-in function :func:`iter`, it returns an iterator for the object. This iterator is good for one pass over the set of values. " +"When using iterables, it is usually not necessary to call :func:`iter` or deal with iterator objects yourself. The :keyword:`for` statement does that " +"automatically for you, creating a temporary unnamed variable to hold the iterator for the duration of the loop. See also :term:`iterator`, :term:`sequence`, " +"and :term:`generator`." +msgstr "" +"تکرارپذیرها را می‌توان در یک حلقهٔ :keyword:`for` و در بسیاری از مکان‌های دیگری که یک دنباله لازم است (:func:`zip`، :func:`map` و ...) استفاده کرد. هنگامی که یک شیء " +"تکرارپذیر به‌عنوان آرگومان به تابع توکار :func:`iter` داده می‌شود، یک تکرارگر برای آن شیء بازمی‌گرداند. این تکرارگر برای یک بار پیمایش مجموعهٔ مقادیر مناسب است. هنگام " +"استفاده از تکرارپذیرها، معمولاً لازم نیست خودتان :func:`iter` را فراخوانی کنید یا با اشیای تکرارگر سروکار داشته باشید. دستور :keyword:`for` این کار را به‌طور خودکار " +"برای شما انجام می‌دهد و یک متغیر موقتِ بدون نام ایجاد می‌کند تا در طول حلقه تکرارگر را نگه دارد. همچنین :term:`تکرارگر `، :term:`دنباله ` " +"و :term:`تولیدگر ` را ببینید." +#: ../../glossary.rst:866 msgid "iterator" msgstr "تکرارگر" -msgid "An object representing a stream of data. Repeated calls to the iterator's :meth:`~iterator.__next__` method (or passing it to the built-in function :func:`next`) return successive items in the stream. When no more data are available a :exc:`StopIteration` exception is raised instead. At this point, the iterator object is exhausted and any further calls to its :meth:`!__next__` method just raise :exc:`StopIteration` again. Iterators are required to have an :meth:`~iterator.__iter__` method that returns the iterator object itself so every iterator is also iterable and may be used in most places where other iterables are accepted. One notable exception is code which attempts multiple iteration passes. A container object (such as a :class:`list`) produces a fresh new iterator each time you pass it to the :func:`iter` function or use it in a :keyword:`for` loop. Attempting this with an iterator will just return the same exhausted iterator object used in the previous iteration pass, making it appear like an empty container." -msgstr "شیءای که جریانی از داده‌ها را نمایش می‌دهد. فراخوانی‌های تکراری متد :meth:`~iterator.__next__` تکرارگر (یا ارسال آن به تابع توکار :func:`next`) آیتم‌های پیاپی در جریان را بازمی‌گرداند. هنگامی که دادهٔ بیشتری در دسترس نباشد، به‌جای آن استثنای :exc:`StopIteration` پرتاب می‌شود. در این نقطه، شیء تکرارگر تمام شده است و هر فراخوانی بعدی متد :meth:`!__next__` آن، دوباره فقط استثنای :exc:`StopIteration` ایجاد می‌کند. تکرارگرها باید متد :meth:`~iterator.__iter__` داشته باشند که خود شیء تکرارگر را بازمی‌گرداند، بنابراین هر تکرارگر تکرارپذیر نیز هست و می‌تواند در بیشتر جاهایی که تکرارپذیرهای دیگر پذیرفته می‌شوند استفاده شود. یک استثنای قابل توجه، کدی است که تلاش می‌کند چندین بار پیمایش انجام دهد. یک شیء محفظه‌ای (مانند :class:`list`) هر بار که به تابع :func:`iter` داده شود یا در یک حلقهٔ :keyword:`for` استفاده شود، یک تکرارگر جدید تولید می‌کند. تلاش برای انجام این کار با یک تکرارگر، فقط همان شیء تکرارگر تمام‌شده‌ای را بازمی‌گرداند که در پیمایش قبلی استفاده شده بود و باعث می‌شود مانند یک محفظهٔ خالی به نظر برسد." - +#: ../../glossary.rst:868 +msgid "" +"An object representing a stream of data. Repeated calls to the iterator's :meth:`~iterator.__next__` method (or passing it to the built-in function :func:`next`) " +"return successive items in the stream. When no more data are available a :exc:`StopIteration` exception is raised instead. At this point, the iterator object is " +"exhausted and any further calls to its :meth:`!__next__` method just raise :exc:`StopIteration` again. Iterators are required to have " +"an :meth:`~iterator.__iter__` method that returns the iterator object itself so every iterator is also iterable and may be used in most places where other " +"iterables are accepted. One notable exception is code which attempts multiple iteration passes. A container object (such as a :class:`list`) produces a fresh " +"new iterator each time you pass it to the :func:`iter` function or use it in a :keyword:`for` loop. Attempting this with an iterator will just return the same " +"exhausted iterator object used in the previous iteration pass, making it appear like an empty container." +msgstr "" +"شیءای که جریانی از داده‌ها را نمایش می‌دهد. فراخوانی‌های تکراری متد :meth:`~iterator.__next__` تکرارگر (یا ارسال آن به تابع توکار :func:`next`) آیتم‌های پیاپی در " +"جریان را بازمی‌گرداند. هنگامی که دادهٔ بیشتری در دسترس نباشد، به‌جای آن استثنای :exc:`StopIteration` پرتاب می‌شود. در این نقطه، شیء تکرارگر تمام شده است و هر فراخوانی " +"بعدی متد :meth:`!__next__` آن، دوباره فقط استثنای :exc:`StopIteration` ایجاد می‌کند. تکرارگرها باید متد :meth:`~iterator.__iter__` داشته باشند که خود شیء تکرارگر " +"را بازمی‌گرداند، بنابراین هر تکرارگر تکرارپذیر نیز هست و می‌تواند در بیشتر جاهایی که تکرارپذیرهای دیگر پذیرفته می‌شوند استفاده شود. یک استثنای قابل توجه، کدی است که " +"تلاش می‌کند چندین بار پیمایش انجام دهد. یک شیء محفظه‌ای (مانند :class:`list`) هر بار که به تابع :func:`iter` داده شود یا در یک حلقهٔ :keyword:`for` استفاده شود، یک " +"تکرارگر جدید تولید می‌کند. تلاش برای انجام این کار با یک تکرارگر، فقط همان شیء تکرارگر تمام‌شده‌ای را بازمی‌گرداند که در پیمایش قبلی استفاده شده بود و باعث می‌شود " +"مانند یک محفظهٔ خالی به نظر برسد." + +#: ../../glossary.rst:883 msgid "More information can be found in :ref:`typeiter`." msgstr "اطلاعات بیشتر را می‌توان در :ref:`typeiter` یافت." -msgid "CPython does not consistently apply the requirement that an iterator define :meth:`~iterator.__iter__`. And also please note that :term:`free-threaded ` CPython does not guarantee :term:`thread-safe` behavior of iterator operations." -msgstr "CPython به‌طور سازگار الزام تعریف متد :meth:`~iterator.__iter__` برای یک تکرارگر را اعمال نمی‌کند. همچنین توجه داشته باشید که CPython :term:`نخ‌گذاری آزاد ` رفتار :term:`ایمن برای نخ‌های اجرایی ` را برای عملیات تکرارگرها تضمین نمی‌کند." +#: ../../glossary.rst:887 +msgid "" +"CPython does not consistently apply the requirement that an iterator define :meth:`~iterator.__iter__`. And also please note that :term:`free-threaded ` CPython does not guarantee :term:`thread-safe` behavior of iterator operations." +msgstr "" +"CPython به‌طور سازگار الزام تعریف متد :meth:`~iterator.__iter__` برای یک تکرارگر را اعمال نمی‌کند. همچنین توجه داشته باشید که CPython :term:`نخ‌گذاری آزاد ` رفتار :term:`ایمن برای نخ‌های اجرایی ` را برای عملیات تکرارگرها تضمین نمی‌کند." +#: ../../glossary.rst:892 msgid "key" msgstr "کلید" +#: ../../glossary.rst:894 msgid "A value that identifies an entry in a :term:`mapping`. See also :term:`subscript`." msgstr "مقداری که یک ورودی را در یک :term:`نگاشت ` شناسایی می‌کند. همچنین :term:`زیرنویس ` را ببینید." +#: ../../glossary.rst:896 msgid "key function" msgstr "تابع کلید" -msgid "A key function or collation function is a callable that returns a value used for sorting or ordering. For example, :func:`locale.strxfrm` is used to produce a sort key that is aware of locale specific sort conventions." -msgstr "یک تابع کلید یا تابع هم‌ترازی، یک شیء قابل فراخوانی است که مقداری را بازمی‌گرداند که برای مرتب‌سازی یا ترتیب‌دهی استفاده می‌شود. برای مثال، :func:`locale.strxfrm` برای تولید یک کلید مرتب‌سازی که از قراردادهای مرتب‌سازی خاص یک محلی آگاه است استفاده می‌شود." +#: ../../glossary.rst:898 +msgid "" +"A key function or collation function is a callable that returns a value used for sorting or ordering. For example, :func:`locale.strxfrm` is used to produce a " +"sort key that is aware of locale specific sort conventions." +msgstr "" +"یک تابع کلید یا تابع هم‌ترازی، یک شیء قابل فراخوانی است که مقداری را بازمی‌گرداند که برای مرتب‌سازی یا ترتیب‌دهی استفاده می‌شود. برای مثال، :func:`locale.strxfrm` برای " +"تولید یک کلید مرتب‌سازی که از قراردادهای مرتب‌سازی خاص یک محلی آگاه است استفاده می‌شود." -msgid "A number of tools in Python accept key functions to control how elements are ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, and :func:`itertools.groupby`." -msgstr "تعدادی از ابزارهای پایتون، توابع کلید را برای کنترل نحوهٔ ترتیب‌دهی یا گروه‌بندی المان‌ها می‌پذیرند. این ابزارها شامل :func:`min`، :func:`max`، :func:`sorted`، :meth:`list.sort`، :func:`heapq.merge`، :func:`heapq.nsmallest`، :func:`heapq.nlargest` و :func:`itertools.groupby` هستند." +#: ../../glossary.rst:903 +msgid "" +"A number of tools in Python accept key functions to control how elements are ordered or grouped. They " +"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " +"and :func:`itertools.groupby`." +msgstr "" +"تعدادی از ابزارهای پایتون، توابع کلید را برای کنترل نحوهٔ ترتیب‌دهی یا گروه‌بندی المان‌ها می‌پذیرند. این ابزارها " +"شامل :func:`min`، :func:`max`، :func:`sorted`، :meth:`list.sort`، :func:`heapq.merge`، :func:`heapq.nsmallest`، :func:`heapq.nlargest` و :func:`itertools.groupby` " +"هستند." -msgid "There are several ways to create a key function. For example. the :meth:`str.casefold` method can serve as a key function for case insensitive sorts. Alternatively, a key function can be built from a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` are three key function constructors. See the :ref:`Sorting HOW TO ` for examples of how to create and use key functions." -msgstr "چندین روش برای ایجاد یک تابع کلید وجود دارد. برای مثال، متد :meth:`str.casefold` می‌تواند به‌عنوان یک تابع کلید برای مرتب‌سازی‌های بدون حساسیت به بزرگی و کوچکی حروف استفاده شود. همچنین، یک تابع کلید می‌تواند از یک عبارت :keyword:`lambda` مانند ``lambda r: (r[0], r[2])`` ساخته شود. علاوه بر این، :func:`operator.attrgetter`، :func:`operator.itemgetter` و :func:`operator.methodcaller` سه سازندهٔ تابع کلید هستند. برای نمونه‌هایی از نحوهٔ ایجاد و استفاده از توابع کلید، :ref:`Sorting HOW TO ` را ببینید." +#: ../../glossary.rst:909 +msgid "" +"There are several ways to create a key function. For example. the :meth:`str.casefold` method can serve as a key function for case insensitive sorts. " +"Alternatively, a key function can be built from a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " +"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` are three key function constructors. See the :ref:`Sorting HOW " +"TO ` for examples of how to create and use key functions." +msgstr "" +"چندین روش برای ایجاد یک تابع کلید وجود دارد. برای مثال، متد :meth:`str.casefold` می‌تواند به‌عنوان یک تابع کلید برای مرتب‌سازی‌های بدون حساسیت به بزرگی و کوچکی حروف " +"استفاده شود. همچنین، یک تابع کلید می‌تواند از یک عبارت :keyword:`lambda` مانند ``lambda r: (r[0], r[2])`` ساخته شود. علاوه بر " +"این، :func:`operator.attrgetter`، :func:`operator.itemgetter` و :func:`operator.methodcaller` سه سازندهٔ تابع کلید هستند. برای نمونه‌هایی از نحوهٔ ایجاد و استفاده از " +"توابع کلید، :ref:`Sorting HOW TO ` را ببینید." +#: ../../glossary.rst:916 msgid "keyword argument" msgstr "آرگومان کلیدواژه‌ای" +#: ../../glossary.rst:918 ../../glossary.rst:1305 msgid "See :term:`argument`." msgstr ":term:`آرگومان ` را ببینید." +#: ../../glossary.rst:919 msgid "lambda" msgstr "lambda" -msgid "An anonymous inline function consisting of a single :term:`expression` which is evaluated when the function is called. The syntax to create a lambda function is ``lambda [parameters]: expression``" -msgstr "یک تابع درون‌خطی بی‌نام که از یک :term:`عبارت ` واحد تشکیل شده است و هنگام فراخوانی تابع ارزیابی می‌شود. سینتکس ایجاد یک تابع lambda به‌صورت ``lambda [parameters]: expression`` است" +#: ../../glossary.rst:921 +msgid "" +"An anonymous inline function consisting of a single :term:`expression` which is evaluated when the function is called. The syntax to create a lambda function is " +"``lambda [parameters]: expression``" +msgstr "" +"یک تابع درون‌خطی بی‌نام که از یک :term:`عبارت ` واحد تشکیل شده است و هنگام فراخوانی تابع ارزیابی می‌شود. سینتکس ایجاد یک تابع lambda به‌صورت ``lambda " +"[parameters]: expression`` است" +#: ../../glossary.rst:924 msgid "LBYL" msgstr "LBYL" -msgid "Look before you leap. This coding style explicitly tests for pre-conditions before making calls or lookups. This style contrasts with the :term:`EAFP` approach and is characterized by the presence of many :keyword:`if` statements." -msgstr "پیش از جهش نگاه کنید. این سبک کدنویسی پیش‌شرط‌ها را پیش از انجام فراخوانی‌ها یا جست‌وجوها به‌طور صریح آزمایش می‌کند. این سبک در تضاد با رویکرد :term:`EAFP ` است و با وجود تعداد زیادی دستور :keyword:`if` شناخته می‌شود." +#: ../../glossary.rst:926 +msgid "" +"Look before you leap. This coding style explicitly tests for pre-conditions before making calls or lookups. This style contrasts with the :term:`EAFP` approach " +"and is characterized by the presence of many :keyword:`if` statements." +msgstr "" +"پیش از جهش نگاه کنید. این سبک کدنویسی پیش‌شرط‌ها را پیش از انجام فراخوانی‌ها یا جست‌وجوها به‌طور صریح آزمایش می‌کند. این سبک در تضاد با رویکرد :term:`EAFP ` است و " +"با وجود تعداد زیادی دستور :keyword:`if` شناخته می‌شود." -msgid "In a multi-threaded environment, the LBYL approach can risk introducing a :term:`race condition` between \"the looking\" and \"the leaping\". For example, the code, ``if key in mapping: return mapping[key]`` can fail if another thread removes *key* from *mapping* after the test, but before the lookup. This issue can be solved with :term:`locks ` or by using the :term:`EAFP` approach. See also :term:`thread-safe`." -msgstr "در یک محیط چندنخی، رویکرد LBYL می‌تواند خطر ایجاد یک :term:`شرط رقابت ` بین «نگاه کردن» و «جهش کردن» را به همراه داشته باشد. برای مثال، کد ``if key in mapping: return mapping[key]`` ممکن است شکست بخورد اگر نخ‌ای دیگر پس از آزمون، اما پیش از جست‌وجو، *key* را از *mapping* حذف کند. این مشکل را می‌توان با :term:`قفل ` یا با استفاده از رویکرد :term:`EAFP ` حل کرد. همچنین :term:`ایمن برای نخ‌های اجرایی ` را ببینید." +#: ../../glossary.rst:931 +msgid "" +"In a multi-threaded environment, the LBYL approach can risk introducing a :term:`race condition` between \"the looking\" and \"the leaping\". For example, the " +"code, ``if key in mapping: return mapping[key]`` can fail if another thread removes *key* from *mapping* after the test, but before the lookup. This issue can be " +"solved with :term:`locks ` or by using the :term:`EAFP` approach. See also :term:`thread-safe`." +msgstr "" +"در یک محیط چندنخی، رویکرد LBYL می‌تواند خطر ایجاد یک :term:`شرط رقابت ` بین «نگاه کردن» و «جهش کردن» را به همراه داشته باشد. برای مثال، کد ``if key " +"in mapping: return mapping[key]`` ممکن است شکست بخورد اگر نخ‌ای دیگر پس از آزمون، اما پیش از جست‌وجو، *key* را از *mapping* حذف کند. این مشکل را می‌توان " +"با :term:`قفل ` یا با استفاده از رویکرد :term:`EAFP ` حل کرد. همچنین :term:`ایمن برای نخ‌های اجرایی ` را ببینید." +#: ../../glossary.rst:937 msgid "lexical analyzer" msgstr "تحلیلگر واژگانی" +#: ../../glossary.rst:940 msgid "Formal name for the *tokenizer*; see :term:`token`." msgstr "نام رسمی برای *tokenizer*؛ :term:`توکن ` را ببینید." +#: ../../glossary.rst:941 msgid "list" msgstr "فهرست" -msgid "A built-in Python :term:`sequence`. Despite its name it is more akin to an array in other languages than to a linked list since access to elements is *O*\\ (1)." -msgstr "یک :term:`دنباله ` توکار پایتون. با وجود نام آن، این نوع بیشتر شبیه یک آرایه در زبان‌های دیگر است تا یک فهرست پیوندی، زیرا دسترسی به المان‌ها *O*\\ (1) است." +#: ../../glossary.rst:943 +msgid "" +"A built-in Python :term:`sequence`. Despite its name it is more akin to an array in other languages than to a linked list since access to elements is *O*\\ (1)." +msgstr "" +"یک :term:`دنباله ` توکار پایتون. با وجود نام آن، این نوع بیشتر شبیه یک آرایه در زبان‌های دیگر است تا یک فهرست پیوندی، زیرا دسترسی به المان‌ها *O*\\ (1) " +"است." +#: ../../glossary.rst:946 msgid "list comprehension" msgstr "درک فهرستی" -msgid "A compact way to process all or part of the elements in a sequence and return a list with the results. ``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` generates a list of strings containing even hex numbers (0x..) in the range from 0 to 255. The :keyword:`if` clause is optional. If omitted, all elements in ``range(256)`` are processed." -msgstr "روشی فشرده برای پردازش همه یا بخشی از المان‌های یک دنباله و بازگرداندن یک فهرست با نتایج. ``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` فهرستی از نخ‌ها شامل اعداد مبنای شانزده زوج (0x..) در محدودهٔ ۰ تا ۲۵۵ تولید می‌کند. بند :keyword:`if` اختیاری است. اگر حذف شود، همهٔ المان‌های ``range(256)`` پردازش می‌شوند." +#: ../../glossary.rst:948 +msgid "" +"A compact way to process all or part of the elements in a sequence and return a list with the results. ``result = ['{:#04x}'.format(x) for x in range(256) if x % " +"2 == 0]`` generates a list of strings containing even hex numbers (0x..) in the range from 0 to 255. The :keyword:`if` clause is optional. If omitted, all " +"elements in ``range(256)`` are processed." +msgstr "" +"روشی فشرده برای پردازش همه یا بخشی از المان‌های یک دنباله و بازگرداندن یک فهرست با نتایج. ``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` " +"فهرستی از نخ‌ها شامل اعداد مبنای شانزده زوج (0x..) در محدودهٔ ۰ تا ۲۵۵ تولید می‌کند. بند :keyword:`if` اختیاری است. اگر حذف شود، همهٔ المان‌های ``range(256)`` پردازش " +"می‌شوند." +#: ../../glossary.rst:954 msgid "lock" msgstr "قفل" -msgid "A :term:`synchronization primitive` that allows only one thread at a time to access a shared resource. A thread must acquire a lock before accessing the protected resource and release it afterward. If a thread attempts to acquire a lock that is already held by another thread, it will block until the lock becomes available. Python's :mod:`threading` module provides :class:`~threading.Lock` (a basic lock) and :class:`~threading.RLock` (a :term:`reentrant` lock). Locks are used to prevent :term:`race conditions ` and ensure :term:`thread-safe` access to shared data. Alternative design patterns to locks exist such as queues, producer/consumer patterns, and thread-local state. See also :term:`deadlock`, and :term:`reentrant`." -msgstr "یک :term:`اولیه ` که در هر زمان فقط به یک نخ اجازهٔ دسترسی به یک منبع اشتراکی را می‌دهد. یک نخ باید پیش از دسترسی به منبع محافظت‌شده، یک قفل را به‌دست آورد و پس از آن آن را آزاد کند. اگر یک نخ تلاش کند قفلی را به‌دست آورد که پیش‌تر توسط نخ‌ای دیگر در اختیار گرفته شده است، تا زمانی که قفل در دسترس قرار گیرد مسدود می‌شود. ماژول :mod:`threading` پایتون، :class:`~threading.Lock` (یک قفل پایه) و :class:`~threading.RLock` (یک قفل :term:`بازورودپذیر `) را فراهم می‌کند. قفل‌ها برای جلوگیری از :term:`شرط رقابت ` و تضمین دسترسی :term:`ایمن برای نخ‌های اجرایی ` به داده‌های اشتراکی استفاده می‌شوند. الگوهای طراحی جایگزین برای قفل‌ها وجود دارند، مانند صف‌ها، الگوهای تولیدکننده/مصرف‌کننده و وضعیت محلی نخ. همچنین :term:`بن‌بست ` و :term:`بازورودپذیر ` را ببینید." - +#: ../../glossary.rst:956 +msgid "" +"A :term:`synchronization primitive` that allows only one thread at a time to access a shared resource. A thread must acquire a lock before accessing the " +"protected resource and release it afterward. If a thread attempts to acquire a lock that is already held by another thread, it will block until the lock becomes " +"available. Python's :mod:`threading` module provides :class:`~threading.Lock` (a basic lock) and :class:`~threading.RLock` (a :term:`reentrant` lock). Locks are " +"used to prevent :term:`race conditions ` and ensure :term:`thread-safe` access to shared data. Alternative design patterns to locks exist such as " +"queues, producer/consumer patterns, and thread-local state. See also :term:`deadlock`, and :term:`reentrant`." +msgstr "" +"یک :term:`اولیه ` که در هر زمان فقط به یک نخ اجازهٔ دسترسی به یک منبع اشتراکی را می‌دهد. یک نخ باید پیش از دسترسی به منبع محافظت‌شده، یک " +"قفل را به‌دست آورد و پس از آن آن را آزاد کند. اگر یک نخ تلاش کند قفلی را به‌دست آورد که پیش‌تر توسط نخ‌ای دیگر در اختیار گرفته شده است، تا زمانی که قفل در دسترس قرار " +"گیرد مسدود می‌شود. ماژول :mod:`threading` پایتون، :class:`~threading.Lock` (یک قفل پایه) و :class:`~threading.RLock` (یک قفل :term:`بازورودپذیر `) را " +"فراهم می‌کند. قفل‌ها برای جلوگیری از :term:`شرط رقابت ` و تضمین دسترسی :term:`ایمن برای نخ‌های اجرایی ` به داده‌های اشتراکی استفاده " +"می‌شوند. الگوهای طراحی جایگزین برای قفل‌ها وجود دارند، مانند صف‌ها، الگوهای تولیدکننده/مصرف‌کننده و وضعیت محلی نخ. همچنین :term:`بن‌بست ` " +"و :term:`بازورودپذیر ` را ببینید." + +#: ../../glossary.rst:967 msgid "lock-free" msgstr "بدون قفل" -msgid "An operation that does not acquire any :term:`lock` and uses atomic CPU instructions to ensure correctness. Lock-free operations can execute concurrently without blocking each other and cannot be blocked by operations that hold locks. In :term:`free-threaded ` Python, built-in types like :class:`dict` and :class:`list` provide lock-free read operations, which means other threads may observe intermediate states during multi-step modifications even when those modifications hold the :term:`per-object lock`." -msgstr "عملیاتی که هیچ :term:`قفل `\\ ای به‌دست نمی‌آورد و برای تضمین درستی از دستورهای اتمی CPU استفاده می‌کند. عملیات‌های بدون قفل می‌توانند به‌طور هم‌زمان و بدون مسدود کردن یکدیگر اجرا شوند و نمی‌توانند توسط عملیات‌هایی که قفل‌ها را در اختیار دارند مسدود شوند. در پایتون :term:`نخ‌گذاری آزاد `، نوع‌های توکار مانند :class:`dict` و :class:`list` عملیات‌های خواندن بدون قفل ارائه می‌کنند، یعنی نخ‌های دیگر ممکن است در طول تغییرات چندمرحله‌ای، حتی زمانی که آن تغییرات :term:`قفلِ هر شیء ` را نگه داشته‌اند، وضعیت‌های میانی را مشاهده کنند." +#: ../../glossary.rst:969 +msgid "" +"An operation that does not acquire any :term:`lock` and uses atomic CPU instructions to ensure correctness. Lock-free operations can execute concurrently without " +"blocking each other and cannot be blocked by operations that hold locks. In :term:`free-threaded ` Python, built-in types like :class:`dict` " +"and :class:`list` provide lock-free read operations, which means other threads may observe intermediate states during multi-step modifications even when those " +"modifications hold the :term:`per-object lock`." +msgstr "" +"عملیاتی که هیچ :term:`قفل `\\ ای به‌دست نمی‌آورد و برای تضمین درستی از دستورهای اتمی CPU استفاده می‌کند. عملیات‌های بدون قفل می‌توانند به‌طور هم‌زمان و بدون مسدود " +"کردن یکدیگر اجرا شوند و نمی‌توانند توسط عملیات‌هایی که قفل‌ها را در اختیار دارند مسدود شوند. در پایتون :term:`نخ‌گذاری آزاد `، نوع‌های توکار " +"مانند :class:`dict` و :class:`list` عملیات‌های خواندن بدون قفل ارائه می‌کنند، یعنی نخ‌های دیگر ممکن است در طول تغییرات چندمرحله‌ای، حتی زمانی که آن تغییرات :term:`قفلِ " +"هر شیء ` را نگه داشته‌اند، وضعیت‌های میانی را مشاهده کنند." +#: ../../glossary.rst:977 msgid "loader" msgstr "بارگذار" -msgid "An object that loads a module. It must define the :meth:`!exec_module` and :meth:`!create_module` methods to implement the :class:`~importlib.abc.Loader` interface. A loader is typically returned by a :term:`finder`. See also:" -msgstr "شیءای که یک ماژول را بارگذاری می‌کند. برای پیاده‌سازی رابط :class:`~importlib.abc.Loader` باید متدهای :meth:`!exec_module` و :meth:`!create_module` را تعریف کند. یک بارگذار معمولاً توسط یک :term:`یابنده ` بازگردانده می‌شود. همچنین ببینید:" +#: ../../glossary.rst:979 +msgid "" +"An object that loads a module. It must define the :meth:`!exec_module` and :meth:`!create_module` methods to implement the :class:`~importlib.abc.Loader` " +"interface. A loader is typically returned by a :term:`finder`. See also:" +msgstr "" +"شیءای که یک ماژول را بارگذاری می‌کند. برای پیاده‌سازی رابط :class:`~importlib.abc.Loader` باید متدهای :meth:`!exec_module` و :meth:`!create_module` را تعریف کند. یک " +"بارگذار معمولاً توسط یک :term:`یابنده ` بازگردانده می‌شود. همچنین ببینید:" +#: ../../glossary.rst:985 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" +#: ../../glossary.rst:986 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" +#: ../../glossary.rst:987 msgid ":pep:`302`" msgstr ":pep:`302`" +#: ../../glossary.rst:988 msgid "locale encoding" msgstr "کدگذاری محلی" +#: ../../glossary.rst:990 msgid "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) `." msgstr "در یونیکس، این همان کدگذاری محلی LC_CTYPE است. می‌توان آن را با :func:`locale.setlocale(locale.LC_CTYPE, new_locale) ` تنظیم کرد." +#: ../../glossary.rst:993 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "در ویندوز، این همان صفحهٔ کد ANSI است (برای مثال ``\"cp1252\"``)." +#: ../../glossary.rst:995 msgid "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "در Android و VxWorks، پایتون از ``\"utf-8\"`` به‌عنوان کدگذاری محلی استفاده می‌کند." +#: ../../glossary.rst:997 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr "از :func:`locale.getencoding` می‌توان برای دریافت کدگذاری محلی استفاده کرد." +#: ../../glossary.rst:999 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "همچنین :term:`کدگذاری سیستم فایل و مدیریت‌کنندهٔ خطا ` را ببینید." +#: ../../glossary.rst:1000 msgid "magic method" msgstr "متد جادویی" +#: ../../glossary.rst:1004 msgid "An informal synonym for :term:`special method`." msgstr "یک مترادف غیررسمی برای :term:`متد ویژه `." +#: ../../glossary.rst:1005 msgid "mapping" msgstr "نگاشت" -msgid "A container object that supports arbitrary key lookups and implements the methods specified in the :class:`collections.abc.Mapping` or :class:`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` and :class:`collections.Counter`." -msgstr "یک شیء محفظه‌ای که از جست‌وجوی کلیدهای دلخواه پشتیبانی می‌کند و متدهای مشخص‌شده در :class:`collections.abc.Mapping` یا :class:`collections.abc.MutableMapping` :ref:`abstract base classes ` را پیاده‌سازی می‌کند. نمونه‌ها شامل :class:`dict`، :class:`collections.defaultdict`، :class:`collections.OrderedDict` و :class:`collections.Counter` هستند." +#: ../../glossary.rst:1007 +msgid "" +"A container object that supports arbitrary key lookups and implements the methods specified in the :class:`collections.abc.Mapping` " +"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes `. Examples " +"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` and :class:`collections.Counter`." +msgstr "" +"یک شیء محفظه‌ای که از جست‌وجوی کلیدهای دلخواه پشتیبانی می‌کند و متدهای مشخص‌شده در :class:`collections.abc.Mapping` " +"یا :class:`collections.abc.MutableMapping` :ref:`abstract base classes ` را پیاده‌سازی می‌کند. نمونه‌ها " +"شامل :class:`dict`، :class:`collections.defaultdict`، :class:`collections.OrderedDict` و :class:`collections.Counter` هستند." +#: ../../glossary.rst:1013 msgid "meta path finder" msgstr "یابندهٔ مسیر فراداده" -msgid "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path finders are related to, but different from :term:`path entry finders `." -msgstr "یک :term:`یابنده ` که از جست‌وجوی :data:`sys.meta_path` بازگردانده می‌شود. یابنده‌های مسیر فراداده با :term:`یابندهٔ ورودی مسیر ` مرتبط هستند، اما با آن‌ها تفاوت دارند." +#: ../../glossary.rst:1015 +msgid "" +"A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path finders are related to, but different from :term:`path entry finders `." +msgstr "" +"یک :term:`یابنده ` که از جست‌وجوی :data:`sys.meta_path` بازگردانده می‌شود. یابنده‌های مسیر فراداده با :term:`یابندهٔ ورودی مسیر ` مرتبط " +"هستند، اما با آن‌ها تفاوت دارند." +#: ../../glossary.rst:1019 msgid "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path finders implement." msgstr "برای متدهایی که یابنده‌های مسیر فراداده پیاده‌سازی می‌کنند، :class:`importlib.abc.MetaPathFinder` را ببینید." +#: ../../glossary.rst:1021 msgid "metaclass" msgstr "فراکلاس" -msgid "The class of a class. Class definitions create a class name, a class dictionary, and a list of base classes. The metaclass is responsible for taking those three arguments and creating the class. Most object oriented programming languages provide a default implementation. What makes Python special is that it is possible to create custom metaclasses. Most users never need this tool, but when the need arises, metaclasses can provide powerful, elegant solutions. They have been used for logging attribute access, adding thread-safety, tracking object creation, implementing singletons, and many other tasks." -msgstr "کلاس یک کلاس. تعریف‌های کلاس یک نام کلاس، یک دیکشنری کلاس و یک فهرست از کلاس‌های پایه ایجاد می‌کنند. فراکلاس مسئول دریافت این سه آرگومان و ایجاد کلاس است. بیشتر زبان‌های برنامه‌نویسی شیءگرا یک پیاده‌سازی پیش‌فرض ارائه می‌کنند. چیزی که پایتون را ویژه می‌کند این است که امکان ایجاد فراکلاس‌های سفارشی وجود دارد. بیشتر کاربران هرگز به این ابزار نیاز پیدا نمی‌کنند، اما هنگامی که نیاز به آن پیش بیاید، فراکلاس‌ها می‌توانند راه‌حل‌های قدرتمند و ظریفی ارائه دهند. از آن‌ها برای ثبت دسترسی به ویژگی‌ها، افزودن ایمنی نخ‌ای، پیگیری ایجاد شیء، پیاده‌سازی تک‌نمونه‌ها و بسیاری کارهای دیگر استفاده شده است." +#: ../../glossary.rst:1023 +msgid "" +"The class of a class. Class definitions create a class name, a class dictionary, and a list of base classes. The metaclass is responsible for taking those three " +"arguments and creating the class. Most object oriented programming languages provide a default implementation. What makes Python special is that it is possible " +"to create custom metaclasses. Most users never need this tool, but when the need arises, metaclasses can provide powerful, elegant solutions. They have been " +"used for logging attribute access, adding thread-safety, tracking object creation, implementing singletons, and many other tasks." +msgstr "" +"کلاس یک کلاس. تعریف‌های کلاس یک نام کلاس، یک دیکشنری کلاس و یک فهرست از کلاس‌های پایه ایجاد می‌کنند. فراکلاس مسئول دریافت این سه آرگومان و ایجاد کلاس است. بیشتر " +"زبان‌های برنامه‌نویسی شیءگرا یک پیاده‌سازی پیش‌فرض ارائه می‌کنند. چیزی که پایتون را ویژه می‌کند این است که امکان ایجاد فراکلاس‌های سفارشی وجود دارد. بیشتر کاربران هرگز " +"به این ابزار نیاز پیدا نمی‌کنند، اما هنگامی که نیاز به آن پیش بیاید، فراکلاس‌ها می‌توانند راه‌حل‌های قدرتمند و ظریفی ارائه دهند. از آن‌ها برای ثبت دسترسی به ویژگی‌ها، " +"افزودن ایمنی نخ‌ای، پیگیری ایجاد شیء، پیاده‌سازی تک‌نمونه‌ها و بسیاری کارهای دیگر استفاده شده است." +#: ../../glossary.rst:1033 msgid "More information can be found in :ref:`metaclasses`." msgstr "اطلاعات بیشتر را می‌توان در :ref:`metaclasses` یافت." +#: ../../glossary.rst:1002 ../../glossary.rst:1034 ../../glossary.rst:1488 msgid "method" msgstr "متد" -msgid "A function which is defined inside a class body. If called as an attribute of an instance of that class, the method will get the instance object as its first :term:`argument` (which is usually called ``self``). See :term:`function` and :term:`nested scope`." -msgstr "تابعی که درون بدنهٔ یک کلاس تعریف شده است. اگر به‌عنوان یک ویژگی از یک نمونهٔ آن کلاس فراخوانی شود، متد شیء نمونه را به‌عنوان نخستین :term:`آرگومان ` خود دریافت می‌کند (که معمولاً ``self`` نامیده می‌شود). :term:`تابع ` و :term:`محدودهٔ تو‌در‌تو ` را ببینید." +#: ../../glossary.rst:1036 +msgid "" +"A function which is defined inside a class body. If called as an attribute of an instance of that class, the method will get the instance object as its " +"first :term:`argument` (which is usually called ``self``). See :term:`function` and :term:`nested scope`." +msgstr "" +"تابعی که درون بدنهٔ یک کلاس تعریف شده است. اگر به‌عنوان یک ویژگی از یک نمونهٔ آن کلاس فراخوانی شود، متد شیء نمونه را به‌عنوان نخستین :term:`آرگومان ` خود " +"دریافت می‌کند (که معمولاً ``self`` نامیده می‌شود). :term:`تابع ` و :term:`محدودهٔ تو‌در‌تو ` را ببینید." +#: ../../glossary.rst:1040 msgid "method resolution order" msgstr "ترتیب حل متد" -msgid "Method Resolution Order is the order in which base classes are searched for a member during lookup. See :ref:`python_2.3_mro` for details of the algorithm used by the Python interpreter since the 2.3 release." -msgstr "ترتیب حل متد، ترتیبی است که در آن کلاس‌های پایه هنگام جست‌وجوی یک عضو بررسی می‌شوند. برای جزئیات الگوریتمی که مفسر پایتون از انتشار ۲.۳ به بعد استفاده می‌کند، :ref:`python_2.3_mro` را ببینید." +#: ../../glossary.rst:1042 +msgid "" +"Method Resolution Order is the order in which base classes are searched for a member during lookup. See :ref:`python_2.3_mro` for details of the algorithm used by " +"the Python interpreter since the 2.3 release." +msgstr "" +"ترتیب حل متد، ترتیبی است که در آن کلاس‌های پایه هنگام جست‌وجوی یک عضو بررسی می‌شوند. برای جزئیات الگوریتمی که مفسر پایتون از انتشار ۲.۳ به بعد استفاده " +"می‌کند، :ref:`python_2.3_mro` را ببینید." +#: ../../glossary.rst:1045 msgid "module" msgstr "ماژول" -msgid "An object that serves as an organizational unit of Python code. Modules have a namespace containing arbitrary Python objects. Modules are loaded into Python by the process of :term:`importing`." -msgstr "شیءای که به‌عنوان واحد سازمان‌دهی کد پایتون عمل می‌کند. ماژول‌ها یک نام‌فضا دارند که شامل اشیای دلخواه پایتون است. ماژول‌ها از طریق فرایند :term:`ایمپورت کردن ` در پایتون بارگذاری می‌شوند." +#: ../../glossary.rst:1047 +msgid "" +"An object that serves as an organizational unit of Python code. Modules have a namespace containing arbitrary Python objects. Modules are loaded into Python by " +"the process of :term:`importing`." +msgstr "" +"شیءای که به‌عنوان واحد سازمان‌دهی کد پایتون عمل می‌کند. ماژول‌ها یک نام‌فضا دارند که شامل اشیای دلخواه پایتون است. ماژول‌ها از طریق فرایند :term:`ایمپورت کردن " +"` در پایتون بارگذاری می‌شوند." +#: ../../glossary.rst:1051 msgid "See also :term:`package`." msgstr "همچنین :term:`بسته ` را ببینید." +#: ../../glossary.rst:1052 msgid "module spec" msgstr "مشخصات ماژول" +#: ../../glossary.rst:1054 msgid "A namespace containing the import-related information used to load a module. An instance of :class:`importlib.machinery.ModuleSpec`." msgstr "نام‌فضایی که شامل اطلاعات مرتبط با ایمپورت است و برای بارگذاری یک ماژول استفاده می‌شود. یک نمونه از :class:`importlib.machinery.ModuleSpec`." +#: ../../glossary.rst:1057 msgid "See also :ref:`module-specs`." msgstr "همچنین :ref:`module-specs` را ببینید." +#: ../../glossary.rst:1058 msgid "MRO" msgstr "MRO" +#: ../../glossary.rst:1060 msgid "See :term:`method resolution order`." msgstr ":term:`ترتیب حل متد ` را ببینید." +#: ../../glossary.rst:1061 msgid "mutable" msgstr "تغییرپذیر" -msgid "An :term:`object` with state that is allowed to change during the course of the program. In multi-threaded programs, mutable objects that are shared between threads require careful synchronization to avoid :term:`race conditions `. See also :term:`immutable`, :term:`thread-safe`, and :term:`concurrent modification`." -msgstr "یک :term:`شیء ` که وضعیت آن در طول اجرای برنامه اجازهٔ تغییر دارد. در برنامه‌های چندنخی، اشیای تغییرپذیری که بین نخ‌ها اشتراک‌گذاری می‌شوند، برای جلوگیری از :term:`شرط رقابت ` به همگام‌سازی دقیق نیاز دارند. همچنین :term:`تغییرناپذیر `، :term:`ایمن برای نخ‌های اجرایی ` و :term:`تغییر هم‌زمان ` را ببینید." +#: ../../glossary.rst:1063 +msgid "" +"An :term:`object` with state that is allowed to change during the course of the program. In multi-threaded programs, mutable objects that are shared between " +"threads require careful synchronization to avoid :term:`race conditions `. See also :term:`immutable`, :term:`thread-safe`, and :term:`concurrent " +"modification`." +msgstr "" +"یک :term:`شیء ` که وضعیت آن در طول اجرای برنامه اجازهٔ تغییر دارد. در برنامه‌های چندنخی، اشیای تغییرپذیری که بین نخ‌ها اشتراک‌گذاری می‌شوند، برای جلوگیری " +"از :term:`شرط رقابت ` به همگام‌سازی دقیق نیاز دارند. همچنین :term:`تغییرناپذیر `، :term:`ایمن برای نخ‌های اجرایی ` " +"و :term:`تغییر هم‌زمان ` را ببینید." +#: ../../glossary.rst:1068 msgid "named tuple" msgstr "تاپل نام‌دار" -msgid "The term \"named tuple\" applies to any type or class that inherits from tuple and whose indexable elements are also accessible using named attributes. The type or class may have other features as well." -msgstr "اصطلاح «تاپل نام‌دار» برای هر نوع یا کلاسی به‌کار می‌رود که از tuple ارث‌بری می‌کند و المان‌های قابل دسترسی با اندیس آن، با استفاده از ویژگی‌های نام‌دار نیز قابل دسترسی هستند. این نوع یا کلاس ممکن است ویژگی‌های دیگری نیز داشته باشد." +#: ../../glossary.rst:1070 +msgid "" +"The term \"named tuple\" applies to any type or class that inherits from tuple and whose indexable elements are also accessible using named attributes. The type " +"or class may have other features as well." +msgstr "" +"اصطلاح «تاپل نام‌دار» برای هر نوع یا کلاسی به‌کار می‌رود که از tuple ارث‌بری می‌کند و المان‌های قابل دسترسی با اندیس آن، با استفاده از ویژگی‌های نام‌دار نیز قابل دسترسی " +"هستند. این نوع یا کلاس ممکن است ویژگی‌های دیگری نیز داشته باشد." -msgid "Several built-in types are named tuples, including the values returned by :func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys.float_info`::" -msgstr "چندین نوع توکار، تاپل نام‌دار هستند، از جمله مقادیری که توسط :func:`time.localtime` و :func:`os.stat` بازگردانده می‌شوند. نمونهٔ دیگر :data:`sys.float_info` است::" +#: ../../glossary.rst:1074 +msgid "" +"Several built-in types are named tuples, including the values returned by :func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys.float_info`::" +msgstr "" +"چندین نوع توکار، تاپل نام‌دار هستند، از جمله مقادیری که توسط :func:`time.localtime` و :func:`os.stat` بازگردانده می‌شوند. نمونهٔ دیگر :data:`sys.float_info` است::" +#: ../../glossary.rst:1078 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -1001,219 +1922,433 @@ msgstr "" ">>> isinstance(sys.float_info, tuple) # نوعی تاپل\n" "True" -msgid "Some named tuples are built-in types (such as the above examples). Alternatively, a named tuple can be created from a regular class definition that inherits from :class:`tuple` and that defines named fields. Such a class can be written by hand, or it can be created by inheriting :class:`typing.NamedTuple`, or with the factory function :func:`collections.namedtuple`. The latter techniques also add some extra methods that may not be found in hand-written or built-in named tuples." -msgstr "برخی تاپل‌های نام‌دار، نوع‌های توکار هستند (مانند نمونه‌های بالا). روش دیگر، ایجاد یک تاپل نام‌دار از طریق یک تعریف کلاس معمولی است که از :class:`tuple` ارث‌بری می‌کند و فیلدهای نام‌دار را تعریف می‌کند. چنین کلاسی را می‌توان به‌صورت دستی نوشت، یا با ارث‌بری از :class:`typing.NamedTuple`، یا با تابع کارخانهٔ :func:`collections.namedtuple` ایجاد کرد. دو روش اخیر همچنین چند متد اضافی اضافه می‌کنند که ممکن است در تاپل‌های نام‌دار دست‌نویس یا توکار وجود نداشته باشند." +#: ../../glossary.rst:1085 +msgid "" +"Some named tuples are built-in types (such as the above examples). Alternatively, a named tuple can be created from a regular class definition that inherits " +"from :class:`tuple` and that defines named fields. Such a class can be written by hand, or it can be created by inheriting :class:`typing.NamedTuple`, or with " +"the factory function :func:`collections.namedtuple`. The latter techniques also add some extra methods that may not be found in hand-written or built-in named " +"tuples." +msgstr "" +"برخی تاپل‌های نام‌دار، نوع‌های توکار هستند (مانند نمونه‌های بالا). روش دیگر، ایجاد یک تاپل نام‌دار از طریق یک تعریف کلاس معمولی است که از :class:`tuple` ارث‌بری می‌کند و " +"فیلدهای نام‌دار را تعریف می‌کند. چنین کلاسی را می‌توان به‌صورت دستی نوشت، یا با ارث‌بری از :class:`typing.NamedTuple`، یا با تابع " +"کارخانهٔ :func:`collections.namedtuple` ایجاد کرد. دو روش اخیر همچنین چند متد اضافی اضافه می‌کنند که ممکن است در تاپل‌های نام‌دار دست‌نویس یا توکار وجود نداشته باشند." +#: ../../glossary.rst:1093 msgid "namespace" msgstr "نام‌فضا" -msgid "The place where a variable is stored. Namespaces are implemented as dictionaries. There are the local, global and built-in namespaces as well as nested namespaces in objects (in methods). Namespaces support modularity by preventing naming conflicts. For instance, the functions :func:`builtins.open <.open>` and :func:`os.open` are distinguished by their namespaces. Namespaces also aid readability and maintainability by making it clear which module implements a function. For instance, writing :func:`random.seed` or :func:`itertools.islice` makes it clear that those functions are implemented by the :mod:`random` and :mod:`itertools` modules, respectively." -msgstr "محلی که یک متغیر در آن ذخیره می‌شود. نام‌فضاها به‌صورت دیکشنری پیاده‌سازی می‌شوند. نام‌فضاهای محلی، سراسری و توکار، همچنین نام‌فضاهای تو‌در‌تو در اشیا (در متدها) وجود دارند. نام‌فضاها با جلوگیری از تداخل نام‌ها، پیمانه‌ای بودن را پشتیبانی می‌کنند. برای نمونه، تابع‌های :func:`builtins.open <.open>` و :func:`os.open` با استفاده از نام‌فضاهای خود از یکدیگر متمایز می‌شوند. نام‌فضاها همچنین با مشخص کردن اینکه کدام ماژول یک تابع را پیاده‌سازی می‌کند، به خوانایی و نگه‌داری‌پذیری کمک می‌کنند. برای نمونه، نوشتن :func:`random.seed` یا :func:`itertools.islice` مشخص می‌کند که این تابع‌ها به‌ترتیب توسط ماژول‌های :mod:`random` و :mod:`itertools` پیاده‌سازی شده‌اند." +#: ../../glossary.rst:1095 +msgid "" +"The place where a variable is stored. Namespaces are implemented as dictionaries. There are the local, global and built-in namespaces as well as nested " +"namespaces in objects (in methods). Namespaces support modularity by preventing naming conflicts. For instance, the functions :func:`builtins.open <.open>` " +"and :func:`os.open` are distinguished by their namespaces. Namespaces also aid readability and maintainability by making it clear which module implements a " +"function. For instance, writing :func:`random.seed` or :func:`itertools.islice` makes it clear that those functions are implemented by the :mod:`random` " +"and :mod:`itertools` modules, respectively." +msgstr "" +"محلی که یک متغیر در آن ذخیره می‌شود. نام‌فضاها به‌صورت دیکشنری پیاده‌سازی می‌شوند. نام‌فضاهای محلی، سراسری و توکار، همچنین نام‌فضاهای تو‌در‌تو در اشیا (در متدها) وجود " +"دارند. نام‌فضاها با جلوگیری از تداخل نام‌ها، پیمانه‌ای بودن را پشتیبانی می‌کنند. برای نمونه، تابع‌های :func:`builtins.open <.open>` و :func:`os.open` با استفاده از " +"نام‌فضاهای خود از یکدیگر متمایز می‌شوند. نام‌فضاها همچنین با مشخص کردن اینکه کدام ماژول یک تابع را پیاده‌سازی می‌کند، به خوانایی و نگه‌داری‌پذیری کمک می‌کنند. برای نمونه، " +"نوشتن :func:`random.seed` یا :func:`itertools.islice` مشخص می‌کند که این تابع‌ها به‌ترتیب توسط ماژول‌های :mod:`random` و :mod:`itertools` پیاده‌سازی شده‌اند." +#: ../../glossary.rst:1105 msgid "namespace package" msgstr "بستهٔ نام‌فضا" -msgid "A :term:`package` which serves only as a container for subpackages. Namespace packages may have no physical representation, and specifically are not like a :term:`regular package` because they have no ``__init__.py`` file." -msgstr "یک :term:`بسته ` که فقط به‌عنوان محفظه‌ای برای زیربسته‌ها عمل می‌کند. بسته‌های نام‌فضا ممکن است نمایش فیزیکی نداشته باشند و به‌طور مشخص مانند یک :term:`بستهٔ معمولی ` نیستند، زیرا فایل ``__init__.py`` ندارند." +#: ../../glossary.rst:1107 +msgid "" +"A :term:`package` which serves only as a container for subpackages. Namespace packages may have no physical representation, and specifically are not like " +"a :term:`regular package` because they have no ``__init__.py`` file." +msgstr "" +"یک :term:`بسته ` که فقط به‌عنوان محفظه‌ای برای زیربسته‌ها عمل می‌کند. بسته‌های نام‌فضا ممکن است نمایش فیزیکی نداشته باشند و به‌طور مشخص مانند یک :term:`بستهٔ " +"معمولی ` نیستند، زیرا فایل ``__init__.py`` ندارند." -msgid "Namespace packages allow several individually installable packages to have a common parent package. Otherwise, it is recommended to use a :term:`regular package`." -msgstr "بسته‌های نام‌فضا به چندین بستهٔ قابل نصب مستقل اجازه می‌دهند که یک بستهٔ والد مشترک داشته باشند. در غیر این صورت، توصیه می‌شود از یک :term:`بستهٔ معمولی ` استفاده کنید." +#: ../../glossary.rst:1112 +msgid "" +"Namespace packages allow several individually installable packages to have a common parent package. Otherwise, it is recommended to use a :term:`regular package`." +msgstr "" +"بسته‌های نام‌فضا به چندین بستهٔ قابل نصب مستقل اجازه می‌دهند که یک بستهٔ والد مشترک داشته باشند. در غیر این صورت، توصیه می‌شود از یک :term:`بستهٔ معمولی ` استفاده کنید." +#: ../../glossary.rst:1115 msgid "For more information, see :pep:`420` and :ref:`reference-namespace-package`." msgstr "برای اطلاعات بیشتر، :pep:`420` و :ref:`reference-namespace-package` را ببینید." +#: ../../glossary.rst:1117 msgid "See also :term:`module`." msgstr "همچنین :term:`ماژول ` را ببینید." +#: ../../glossary.rst:1118 msgid "native code" msgstr "کد بومی" -msgid "Code that is compiled to machine instructions and runs directly on the processor, as opposed to code that is interpreted or runs in a virtual machine. In the context of Python, native code typically refers to C, C++, Rust or Fortran code in :term:`extension modules ` that can be called from Python. See also :term:`extension module`." -msgstr "کدی که به دستورهای ماشین کامپایل شده و مستقیماً روی پردازنده اجرا می‌شود، برخلاف کدی که تفسیر می‌شود یا در یک ماشین مجازی اجرا می‌شود. در زمینهٔ پایتون، کد بومی معمولاً به کد C، C++، Rust یا Fortran در :term:`ماژول افزونه ` اشاره دارد که می‌توانند از پایتون فراخوانی شوند. همچنین :term:`ماژول افزونه ` را ببینید." +#: ../../glossary.rst:1120 +msgid "" +"Code that is compiled to machine instructions and runs directly on the processor, as opposed to code that is interpreted or runs in a virtual machine. In the " +"context of Python, native code typically refers to C, C++, Rust or Fortran code in :term:`extension modules ` that can be called from Python. " +"See also :term:`extension module`." +msgstr "" +"کدی که به دستورهای ماشین کامپایل شده و مستقیماً روی پردازنده اجرا می‌شود، برخلاف کدی که تفسیر می‌شود یا در یک ماشین مجازی اجرا می‌شود. در زمینهٔ پایتون، کد بومی معمولاً " +"به کد C، C++، Rust یا Fortran در :term:`ماژول افزونه ` اشاره دارد که می‌توانند از پایتون فراخوانی شوند. همچنین :term:`ماژول افزونه ` را ببینید." +#: ../../glossary.rst:1125 msgid "nested scope" msgstr "محدودهٔ تو‌در‌تو" -msgid "The ability to refer to a variable in an enclosing definition. For instance, a function defined inside another function can refer to variables in the outer function. Note that nested scopes by default work only for reference and not for assignment. Local variables both read and write in the innermost scope. Likewise, global variables read and write to the global namespace. The :keyword:`nonlocal` allows writing to outer scopes." -msgstr "توانایی ارجاع به یک متغیر در یک تعریف دربرگیرنده. برای مثال، تابعی که داخل تابع دیگری تعریف شده است می‌تواند به متغیرهای تابع بیرونی دسترسی داشته باشد. توجه کنید که محدوده‌های تو‌در‌تو به‌صورت پیش‌فرض فقط برای ارجاع دادن و نه برای انتساب کار می‌کنند. متغیرهای محلی هم در نزدیک‌ترین محدوده خوانده و نوشته می‌شوند. به همین ترتیب، متغیرهای سراسری از نام‌فضای سراسری خوانده و در آن نوشته می‌شوند. کلیدواژهٔ :keyword:`nonlocal` امکان نوشتن در محدوده‌های بیرونی را فراهم می‌کند." +#: ../../glossary.rst:1127 +msgid "" +"The ability to refer to a variable in an enclosing definition. For instance, a function defined inside another function can refer to variables in the outer " +"function. Note that nested scopes by default work only for reference and not for assignment. Local variables both read and write in the innermost scope. " +"Likewise, global variables read and write to the global namespace. The :keyword:`nonlocal` allows writing to outer scopes." +msgstr "" +"توانایی ارجاع به یک متغیر در یک تعریف دربرگیرنده. برای مثال، تابعی که داخل تابع دیگری تعریف شده است می‌تواند به متغیرهای تابع بیرونی دسترسی داشته باشد. توجه کنید " +"که محدوده‌های تو‌در‌تو به‌صورت پیش‌فرض فقط برای ارجاع دادن و نه برای انتساب کار می‌کنند. متغیرهای محلی هم در نزدیک‌ترین محدوده خوانده و نوشته می‌شوند. به همین ترتیب، " +"متغیرهای سراسری از نام‌فضای سراسری خوانده و در آن نوشته می‌شوند. کلیدواژهٔ :keyword:`nonlocal` امکان نوشتن در محدوده‌های بیرونی را فراهم می‌کند." +#: ../../glossary.rst:1134 msgid "new-style class" msgstr "کلاس سبک جدید" -msgid "Old name for the flavor of classes now used for all class objects. In earlier Python versions, only new-style classes could use Python's newer, versatile features like :attr:`~object.__slots__`, descriptors, properties, :meth:`~object.__getattribute__`, class methods, and static methods." -msgstr "نام قدیمی برای گونه‌ای از کلاس‌ها که اکنون برای همهٔ اشیای کلاس استفاده می‌شود. در نسخه‌های قدیمی‌تر پایتون، فقط کلاس‌های سبک جدید می‌توانستند از قابلیت‌های جدیدتر و انعطاف‌پذیر پایتون مانند :attr:`~object.__slots__`، توصیف‌گرها، ویژگی‌ها، :meth:`~object.__getattribute__`، متدهای کلاس و متدهای ایستا استفاده کنند." +#: ../../glossary.rst:1136 +msgid "" +"Old name for the flavor of classes now used for all class objects. In earlier Python versions, only new-style classes could use Python's newer, versatile " +"features like :attr:`~object.__slots__`, descriptors, properties, :meth:`~object.__getattribute__`, class methods, and static methods." +msgstr "" +"نام قدیمی برای گونه‌ای از کلاس‌ها که اکنون برای همهٔ اشیای کلاس استفاده می‌شود. در نسخه‌های قدیمی‌تر پایتون، فقط کلاس‌های سبک جدید می‌توانستند از قابلیت‌های جدیدتر و " +"انعطاف‌پذیر پایتون مانند :attr:`~object.__slots__`، توصیف‌گرها، ویژگی‌ها، :meth:`~object.__getattribute__`، متدهای کلاس و متدهای ایستا استفاده کنند." +#: ../../glossary.rst:1141 msgid "non-deterministic" msgstr "غیرقطعی" -msgid "Behavior where the outcome of a program can vary between executions with the same inputs. In multi-threaded programs, non-deterministic behavior often results from :term:`race conditions ` where the relative timing or interleaving of threads affects the result. Proper synchronization using :term:`locks ` and other :term:`synchronization primitives ` helps ensure deterministic behavior." -msgstr "رفتاری که در آن نتیجهٔ یک برنامه می‌تواند بین اجراهای مختلف با ورودی‌های یکسان متفاوت باشد. در برنامه‌های چندنخی، رفتار غیرقطعی اغلب از :term:`شرط رقابت ` ناشی می‌شود که در آن زمان‌بندی نسبی یا درهم‌تنیدگی نخ‌ها بر نتیجه تأثیر می‌گذارد. همگام‌سازی مناسب با استفاده از :term:`قفل ` و دیگر :term:`اولیه ` به تضمین رفتار قطعی کمک می‌کند." +#: ../../glossary.rst:1143 +msgid "" +"Behavior where the outcome of a program can vary between executions with the same inputs. In multi-threaded programs, non-deterministic behavior often results " +"from :term:`race conditions ` where the relative timing or interleaving of threads affects the result. Proper synchronization using :term:`locks " +"` and other :term:`synchronization primitives ` helps ensure deterministic behavior." +msgstr "" +"رفتاری که در آن نتیجهٔ یک برنامه می‌تواند بین اجراهای مختلف با ورودی‌های یکسان متفاوت باشد. در برنامه‌های چندنخی، رفتار غیرقطعی اغلب از :term:`شرط رقابت ` ناشی می‌شود که در آن زمان‌بندی نسبی یا درهم‌تنیدگی نخ‌ها بر نتیجه تأثیر می‌گذارد. همگام‌سازی مناسب با استفاده از :term:`قفل ` و دیگر :term:`اولیه " +"` به تضمین رفتار قطعی کمک می‌کند." +#: ../../glossary.rst:1150 msgid "object" msgstr "شیء" +#: ../../glossary.rst:1152 msgid "Any data with state (attributes or value) and defined behavior (methods). Also the ultimate base class of any :term:`new-style class`." msgstr "هر داده‌ای با وضعیت (ویژگی‌ها یا مقدار) و رفتار تعریف‌شده (متدها). همچنین کلاس پایهٔ نهایی هر :term:`کلاس سبک جدید `." +#: ../../glossary.rst:1155 msgid "optimized scope" msgstr "محدودهٔ بهینه‌شده" -msgid "A scope where target local variable names are reliably known to the compiler when the code is compiled, allowing optimization of read and write access to these names. The local namespaces for functions, generators, coroutines, comprehensions, and generator expressions are optimized in this fashion. Note: most interpreter optimizations are applied to all scopes, only those relying on a known set of local and nonlocal variable names are restricted to optimized scopes." -msgstr "محدوده‌ای که در آن نام‌های متغیرهای محلی هدف هنگام کامپایل کد به‌طور قابل اطمینانی برای کامپایلر شناخته شده‌اند و امکان بهینه‌سازی دسترسی خواندن و نوشتن به این نام‌ها فراهم می‌شود. نام‌فضاهای محلی برای تابع‌ها، تولیدگرها، هم‌روال‌ها، درک‌ها و عبارت‌های تولیدگر به این روش بهینه می‌شوند. توجه کنید: بیشتر بهینه‌سازی‌های مفسر روی همهٔ محدوده‌ها اعمال می‌شوند؛ تنها بهینه‌سازی‌هایی که به مجموعهٔ شناخته‌شده‌ای از نام‌های متغیرهای محلی و غیرمحلی وابسته هستند، به محدوده‌های بهینه‌شده محدود می‌شوند." +#: ../../glossary.rst:1157 +msgid "" +"A scope where target local variable names are reliably known to the compiler when the code is compiled, allowing optimization of read and write access to these " +"names. The local namespaces for functions, generators, coroutines, comprehensions, and generator expressions are optimized in this fashion. Note: most interpreter " +"optimizations are applied to all scopes, only those relying on a known set of local and nonlocal variable names are restricted to optimized scopes." +msgstr "" +"محدوده‌ای که در آن نام‌های متغیرهای محلی هدف هنگام کامپایل کد به‌طور قابل اطمینانی برای کامپایلر شناخته شده‌اند و امکان بهینه‌سازی دسترسی خواندن و نوشتن به این نام‌ها " +"فراهم می‌شود. نام‌فضاهای محلی برای تابع‌ها، تولیدگرها، هم‌روال‌ها، درک‌ها و عبارت‌های تولیدگر به این روش بهینه می‌شوند. توجه کنید: بیشتر بهینه‌سازی‌های مفسر روی همهٔ " +"محدوده‌ها اعمال می‌شوند؛ تنها بهینه‌سازی‌هایی که به مجموعهٔ شناخته‌شده‌ای از نام‌های متغیرهای محلی و غیرمحلی وابسته هستند، به محدوده‌های بهینه‌شده محدود می‌شوند." +#: ../../glossary.rst:1164 msgid "optional module" msgstr "ماژول اختیاری" -msgid "An :term:`extension module` that is part of the :term:`standard library`, but may be absent in some builds of :term:`CPython`, usually due to missing third-party libraries or because the module is not available for a given platform." -msgstr "یک :term:`ماژول افزونه ` که بخشی از :term:`کتابخانهٔ استاندارد ` است، اما ممکن است در برخی ساخت‌های :term:`CPython ` وجود نداشته باشد؛ معمولاً به دلیل نبود کتابخانه‌های شخص ثالث یا در دسترس نبودن ماژول برای یک سکوی مشخص." +#: ../../glossary.rst:1166 +msgid "" +"An :term:`extension module` that is part of the :term:`standard library`, but may be absent in some builds of :term:`CPython`, usually due to missing third-party " +"libraries or because the module is not available for a given platform." +msgstr "" +"یک :term:`ماژول افزونه ` که بخشی از :term:`کتابخانهٔ استاندارد ` است، اما ممکن است در برخی ساخت‌های :term:`CPython ` " +"وجود نداشته باشد؛ معمولاً به دلیل نبود کتابخانه‌های شخص ثالث یا در دسترس نبودن ماژول برای یک سکوی مشخص." +#: ../../glossary.rst:1171 msgid "See :ref:`optional-module-requirements` for a list of optional modules that require third-party libraries." msgstr "برای فهرستی از ماژول‌های اختیاری که به کتابخانه‌های شخص ثالث نیاز دارند، :ref:`optional-module-requirements` را ببینید." +#: ../../glossary.rst:1173 msgid "package" msgstr "بسته" +#: ../../glossary.rst:1175 msgid "A Python :term:`module` which can contain submodules or recursively, subpackages. Technically, a package is a Python module with a ``__path__`` attribute." -msgstr "یک :term:`ماژول ` پایتون که می‌تواند شامل زیرماژول‌ها یا به‌صورت بازگشتی، زیربسته‌ها باشد. از نظر فنی، یک بسته یک ماژول پایتون با ویژگی ``__path__`` است." +msgstr "" +"یک :term:`ماژول ` پایتون که می‌تواند شامل زیرماژول‌ها یا به‌صورت بازگشتی، زیربسته‌ها باشد. از نظر فنی، یک بسته یک ماژول پایتون با ویژگی ``__path__`` است." +#: ../../glossary.rst:1179 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "همچنین :term:`بستهٔ معمولی ` و :term:`بستهٔ نام‌فضا ` را ببینید." +#: ../../glossary.rst:1180 msgid "parallelism" msgstr "موازی‌سازی" -msgid "Executing multiple operations at the same time (e.g. on multiple CPU cores). In Python builds with the :term:`global interpreter lock (GIL) `, only one thread runs Python bytecode at a time, so taking advantage of multiple CPU cores typically involves multiple processes (e.g. :mod:`multiprocessing`) or native extensions that release the GIL. In :term:`free-threaded ` Python, multiple Python threads can run Python code simultaneously on different cores." -msgstr "اجرای چندین عملیات در یک زمان (برای مثال روی چند هستهٔ CPU). در ساخت‌های پایتون با :term:`قفل مفسر سراسری `، تنها یک نخ در هر لحظه بایت‌کد پایتون را اجرا می‌کند، بنابراین بهره‌گیری از چند هستهٔ CPU معمولاً شامل چند فرایند (برای مثال :mod:`multiprocessing`) یا افزونه‌های بومی است که GIL را آزاد می‌کنند. در پایتون :term:`نخ‌گذاری آزاد `، چندین نخ پایتون می‌توانند به‌طور هم‌زمان کد پایتون را روی هسته‌های مختلف اجرا کنند." +#: ../../glossary.rst:1182 +msgid "" +"Executing multiple operations at the same time (e.g. on multiple CPU cores). In Python builds with the :term:`global interpreter lock (GIL) `, only one thread runs Python bytecode at a time, so taking advantage of multiple CPU cores typically involves multiple processes " +"(e.g. :mod:`multiprocessing`) or native extensions that release the GIL. In :term:`free-threaded ` Python, multiple Python threads can run Python " +"code simultaneously on different cores." +msgstr "" +"اجرای چندین عملیات در یک زمان (برای مثال روی چند هستهٔ CPU). در ساخت‌های پایتون با :term:`قفل مفسر سراسری `، تنها یک نخ در هر لحظه بایت‌کد " +"پایتون را اجرا می‌کند، بنابراین بهره‌گیری از چند هستهٔ CPU معمولاً شامل چند فرایند (برای مثال :mod:`multiprocessing`) یا افزونه‌های بومی است که GIL را آزاد می‌کنند. در " +"پایتون :term:`نخ‌گذاری آزاد `، چندین نخ پایتون می‌توانند به‌طور هم‌زمان کد پایتون را روی هسته‌های مختلف اجرا کنند." +#: ../../glossary.rst:1190 msgid "parameter" msgstr "پارامتر" -msgid "A named entity in a :term:`function` (or method) definition that specifies an :term:`argument` (or in some cases, arguments) that the function can accept. There are five kinds of parameter:" -msgstr "یک موجودیت نام‌گذاری‌شده در تعریف یک :term:`تابع ` (یا متد) که یک :term:`آرگومان ` (یا در برخی موارد، آرگومان‌ها) را مشخص می‌کند که تابع می‌تواند بپذیرد. پنج نوع پارامتر وجود دارد:" +#: ../../glossary.rst:1192 +msgid "" +"A named entity in a :term:`function` (or method) definition that specifies an :term:`argument` (or in some cases, arguments) that the function can accept. There " +"are five kinds of parameter:" +msgstr "" +"یک موجودیت نام‌گذاری‌شده در تعریف یک :term:`تابع ` (یا متد) که یک :term:`آرگومان ` (یا در برخی موارد، آرگومان‌ها) را مشخص می‌کند که تابع می‌تواند " +"بپذیرد. پنج نوع پارامتر وجود دارد:" -msgid ":dfn:`positional-or-keyword`: specifies an argument that can be passed either :term:`positionally ` or as a :term:`keyword argument `. This is the default kind of parameter, for example *foo* and *bar* in the following::" -msgstr ":dfn:`positional-or-keyword`: آرگومانی را مشخص می‌کند که می‌تواند به‌صورت :term:`آرگومان جایگاهی ` یا به‌عنوان یک :term:`آرگومان کلیدواژه‌ای ` ارسال شود. این نوع پیش‌فرض پارامتر است، برای مثال *foo* و *bar* در موارد زیر::" +#: ../../glossary.rst:1196 +msgid "" +":dfn:`positional-or-keyword`: specifies an argument that can be passed either :term:`positionally ` or as a :term:`keyword argument `. This " +"is the default kind of parameter, for example *foo* and *bar* in the following::" +msgstr "" +":dfn:`positional-or-keyword`: آرگومانی را مشخص می‌کند که می‌تواند به‌صورت :term:`آرگومان جایگاهی ` یا به‌عنوان یک :term:`آرگومان کلیدواژه‌ای ` " +"ارسال شود. این نوع پیش‌فرض پارامتر است، برای مثال *foo* و *bar* در موارد زیر::" +#: ../../glossary.rst:1201 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -msgid ":dfn:`positional-only`: specifies an argument that can be supplied only by position. Positional-only parameters can be defined by including a ``/`` character in the parameter list of the function definition after them, for example *posonly1* and *posonly2* in the following::" -msgstr ":dfn:`positional-only`: آرگومانی را مشخص می‌کند که فقط می‌تواند بر اساس جایگاه ارائه شود. پارامترهای فقط-جایگاهی را می‌توان با قرار دادن یک نویسهٔ ``/`` در فهرست پارامترهای تعریف تابع پس از آن‌ها تعریف کرد، برای مثال *posonly1* و *posonly2* در موارد زیر::" +#: ../../glossary.rst:1205 +msgid "" +":dfn:`positional-only`: specifies an argument that can be supplied only by position. Positional-only parameters can be defined by including a ``/`` character in " +"the parameter list of the function definition after them, for example *posonly1* and *posonly2* in the following::" +msgstr "" +":dfn:`positional-only`: آرگومانی را مشخص می‌کند که فقط می‌تواند بر اساس جایگاه ارائه شود. پارامترهای فقط-جایگاهی را می‌توان با قرار دادن یک نویسهٔ ``/`` در فهرست " +"پارامترهای تعریف تابع پس از آن‌ها تعریف کرد، برای مثال *posonly1* و *posonly2* در موارد زیر::" +#: ../../glossary.rst:1210 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -msgid ":dfn:`keyword-only`: specifies an argument that can be supplied only by keyword. Keyword-only parameters can be defined by including a single var-positional parameter or bare ``*`` in the parameter list of the function definition before them, for example *kw_only1* and *kw_only2* in the following::" -msgstr ":dfn:`keyword-only`: آرگومانی را مشخص می‌کند که فقط می‌تواند با کلیدواژه ارسال شود. پارامترهای فقط کلیدواژه‌ای را می‌توان با قرار دادن یک پارامتر var-positional یا ``*`` بدون نام در فهرست پارامترهای تعریف تابع پیش از آن‌ها تعریف کرد، برای مثال *kw_only1* و *kw_only2* در موارد زیر::" +#: ../../glossary.rst:1214 +msgid "" +":dfn:`keyword-only`: specifies an argument that can be supplied only by keyword. Keyword-only parameters can be defined by including a single var-positional " +"parameter or bare ``*`` in the parameter list of the function definition before them, for example *kw_only1* and *kw_only2* in the following::" +msgstr "" +":dfn:`keyword-only`: آرگومانی را مشخص می‌کند که فقط می‌تواند با کلیدواژه ارسال شود. پارامترهای فقط کلیدواژه‌ای را می‌توان با قرار دادن یک پارامتر var-positional یا " +"``*`` بدون نام در فهرست پارامترهای تعریف تابع پیش از آن‌ها تعریف کرد، برای مثال *kw_only1* و *kw_only2* در موارد زیر::" +#: ../../glossary.rst:1220 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -msgid ":dfn:`var-positional`: specifies that an arbitrary sequence of positional arguments can be provided (in addition to any positional arguments already accepted by other parameters). Such a parameter can be defined by prepending the parameter name with ``*``, for example *args* in the following::" -msgstr ":dfn:`var-positional`: مشخص می‌کند که یک دنبالهٔ دلخواه از آرگومان‌های جایگاهی می‌تواند ارائه شود (علاوه بر هر آرگومان جایگاهی که پیش‌تر توسط پارامترهای دیگر پذیرفته شده است). چنین پارامتری را می‌توان با افزودن ``*`` به ابتدای نام پارامتر تعریف کرد، برای مثال *args* در موارد زیر::" +#: ../../glossary.rst:1222 +msgid "" +":dfn:`var-positional`: specifies that an arbitrary sequence of positional arguments can be provided (in addition to any positional arguments already accepted by " +"other parameters). Such a parameter can be defined by prepending the parameter name with ``*``, for example *args* in the following::" +msgstr "" +":dfn:`var-positional`: مشخص می‌کند که یک دنبالهٔ دلخواه از آرگومان‌های جایگاهی می‌تواند ارائه شود (علاوه بر هر آرگومان جایگاهی که پیش‌تر توسط پارامترهای دیگر پذیرفته " +"شده است). چنین پارامتری را می‌توان با افزودن ``*`` به ابتدای نام پارامتر تعریف کرد، برای مثال *args* در موارد زیر::" +#: ../../glossary.rst:1228 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -msgid ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be provided (in addition to any keyword arguments already accepted by other parameters). Such a parameter can be defined by prepending the parameter name with ``**``, for example *kwargs* in the example above." -msgstr ":dfn:`var-keyword`: مشخص می‌کند که تعداد دلخواهی از آرگومان‌های کلیدواژه‌ای می‌تواند ارائه شود (علاوه بر هر آرگومان کلیدواژه‌ای که پیش‌تر توسط پارامترهای دیگر پذیرفته شده است). چنین پارامتری را می‌توان با افزودن ``**`` به ابتدای نام پارامتر تعریف کرد، برای مثال *kwargs* در مثال بالا." +#: ../../glossary.rst:1230 +msgid "" +":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be provided (in addition to any keyword arguments already accepted by other " +"parameters). Such a parameter can be defined by prepending the parameter name with ``**``, for example *kwargs* in the example above." +msgstr "" +":dfn:`var-keyword`: مشخص می‌کند که تعداد دلخواهی از آرگومان‌های کلیدواژه‌ای می‌تواند ارائه شود (علاوه بر هر آرگومان کلیدواژه‌ای که پیش‌تر توسط پارامترهای دیگر پذیرفته " +"شده است). چنین پارامتری را می‌توان با افزودن ``**`` به ابتدای نام پارامتر تعریف کرد، برای مثال *kwargs* در مثال بالا." +#: ../../glossary.rst:1236 msgid "Parameters can specify both optional and required arguments, as well as default values for some optional arguments." msgstr "پارامترها می‌توانند هم آرگومان‌های اختیاری و ضروری، و هم مقدارهای پیش‌فرض برای برخی آرگومان‌های اختیاری را مشخص کنند." -msgid "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the difference between arguments and parameters `, the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:`362`." -msgstr "همچنین مدخل واژه‌نامهٔ :term:`آرگومان `، پرسش متداول دربارهٔ :ref:`تفاوت بین آرگومان‌ها و پارامترها `، کلاس :class:`inspect.Parameter`، بخش :ref:`function` و :pep:`362` را ببینید." +#: ../../glossary.rst:1239 +msgid "" +"See also the :term:`argument` glossary entry, the FAQ question on :ref:`the difference between arguments and parameters `, " +"the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:`362`." +msgstr "" +"همچنین مدخل واژه‌نامهٔ :term:`آرگومان `، پرسش متداول دربارهٔ :ref:`تفاوت بین آرگومان‌ها و پارامترها `، " +"کلاس :class:`inspect.Parameter`، بخش :ref:`function` و :pep:`362` را ببینید." +#: ../../glossary.rst:1243 msgid "per-object lock" msgstr "قفلِ هر شیء" -msgid "A :term:`lock` associated with an individual object instance rather than a global lock shared across all objects. In :term:`free-threaded ` Python, built-in types like :class:`dict` and :class:`list` use per-object locks to allow concurrent operations on different objects while serializing operations on the same object. Operations that hold the per-object lock prevent other locking operations on the same object from proceeding, but do not block :term:`lock-free` operations." -msgstr "یک :term:`قفل ` مرتبط با یک نمونهٔ شیء منفرد، به‌جای یک قفل سراسری که بین همهٔ اشیا اشتراک‌گذاری شده باشد. در پایتون :term:`نخ‌گذاری آزاد `، نوع‌های توکار مانند :class:`dict` و :class:`list` از قفل‌های هر شیء استفاده می‌کنند تا امکان عملیات هم‌زمان روی اشیای مختلف را فراهم کنند، در حالی که عملیات روی همان شیء را به‌صورت ترتیبی اجرا می‌کنند. عملیات‌هایی که قفل هر شیء را نگه می‌دارند، از ادامهٔ دیگر عملیات‌های قفل‌کننده روی همان شیء جلوگیری می‌کنند، اما عملیات‌های :term:`بدون قفل ` را مسدود نمی‌کنند." +#: ../../glossary.rst:1245 +msgid "" +"A :term:`lock` associated with an individual object instance rather than a global lock shared across all objects. In :term:`free-threaded ` " +"Python, built-in types like :class:`dict` and :class:`list` use per-object locks to allow concurrent operations on different objects while serializing operations " +"on the same object. Operations that hold the per-object lock prevent other locking operations on the same object from proceeding, but do not block :term:`lock-" +"free` operations." +msgstr "" +"یک :term:`قفل ` مرتبط با یک نمونهٔ شیء منفرد، به‌جای یک قفل سراسری که بین همهٔ اشیا اشتراک‌گذاری شده باشد. در پایتون :term:`نخ‌گذاری آزاد `، " +"نوع‌های توکار مانند :class:`dict` و :class:`list` از قفل‌های هر شیء استفاده می‌کنند تا امکان عملیات هم‌زمان روی اشیای مختلف را فراهم کنند، در حالی که عملیات روی همان " +"شیء را به‌صورت ترتیبی اجرا می‌کنند. عملیات‌هایی که قفل هر شیء را نگه می‌دارند، از ادامهٔ دیگر عملیات‌های قفل‌کننده روی همان شیء جلوگیری می‌کنند، اما عملیات‌های :term:`بدون " +"قفل ` را مسدود نمی‌کنند." +#: ../../glossary.rst:1253 msgid "path entry" msgstr "ورودی مسیر" +#: ../../glossary.rst:1255 msgid "A single location on the :term:`import path` which the :term:`path based finder` consults to find modules for importing." msgstr "یک مکان منفرد در :term:`ایمپورت مسیر ` که :term:`یابندهٔ مبتنی بر مسیر ` برای یافتن ماژول‌ها جهت ایمپورت بررسی می‌کند." +#: ../../glossary.rst:1257 msgid "path entry finder" msgstr "یابندهٔ ورودی مسیر" -msgid "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :term:`path entry hook`) which knows how to locate modules given a :term:`path entry`." -msgstr "یک :term:`یابنده ` که توسط یک فراخوانی‌پذیر در :data:`sys.path_hooks` (یعنی یک :term:`قلاب ورودی مسیر `) بازگردانده می‌شود و می‌داند چگونه با داشتن یک :term:`ورودی مسیر `، ماژول‌ها را پیدا کند." +#: ../../glossary.rst:1259 +msgid "" +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :term:`path entry hook`) which knows how to locate modules given a :term:`path entry`." +msgstr "" +"یک :term:`یابنده ` که توسط یک فراخوانی‌پذیر در :data:`sys.path_hooks` (یعنی یک :term:`قلاب ورودی مسیر `) بازگردانده می‌شود و می‌داند چگونه " +"با داشتن یک :term:`ورودی مسیر `، ماژول‌ها را پیدا کند." +#: ../../glossary.rst:1263 msgid "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry finders implement." msgstr "برای متدهایی که یابنده‌های ورودی مسیر پیاده‌سازی می‌کنند، :class:`importlib.abc.PathEntryFinder` را ببینید." +#: ../../glossary.rst:1265 msgid "path entry hook" msgstr "قلاب ورودی مسیر" +#: ../../glossary.rst:1267 msgid "A callable on the :data:`sys.path_hooks` list which returns a :term:`path entry finder` if it knows how to find modules on a specific :term:`path entry`." -msgstr "یک فراخوانی‌پذیر در فهرست :data:`sys.path_hooks` که اگر بداند چگونه ماژول‌ها را در یک :term:`ورودی مسیر ` مشخص پیدا کند، یک :term:`یابندهٔ ورودی مسیر ` بازمی‌گرداند." +msgstr "" +"یک فراخوانی‌پذیر در فهرست :data:`sys.path_hooks` که اگر بداند چگونه ماژول‌ها را در یک :term:`ورودی مسیر ` مشخص پیدا کند، یک :term:`یابندهٔ ورودی مسیر " +"` بازمی‌گرداند." +#: ../../glossary.rst:1270 msgid "path based finder" msgstr "یابندهٔ مبتنی بر مسیر" +#: ../../glossary.rst:1272 msgid "One of the default :term:`meta path finders ` which searches an :term:`import path` for modules." msgstr "یکی از :term:`یابندهٔ مسیر فراداده ` پیش‌فرض که یک :term:`ایمپورت مسیر ` را برای یافتن ماژول‌ها جست‌وجو می‌کند." +#: ../../glossary.rst:1274 msgid "path-like object" msgstr "شیء شبه‌مسیر" -msgid "An object representing a file system path. A path-like object is either a :class:`str` or :class:`bytes` object representing a path, or an object implementing the :class:`os.PathLike` protocol. An object that supports the :class:`os.PathLike` protocol can be converted to a :class:`str` or :class:`bytes` file system path by calling the :func:`os.fspath` function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:`str` or :class:`bytes` result instead, respectively. Introduced by :pep:`519`." -msgstr "شی‌ءای که یک مسیر سامانهٔ فایل را نمایش می‌دهد. یک شیء شبه‌مسیر یا یک شیء :class:`str` یا :class:`bytes` است که یک مسیر را نمایش می‌دهد، یا شی‌ءای است که پروتکل :class:`os.PathLike` را پیاده‌سازی می‌کند. شی‌ءای که از پروتکل :class:`os.PathLike` پشتیبانی می‌کند، می‌تواند با فراخوانی تابع :func:`os.fspath` به یک مسیر سامانهٔ فایل :class:`str` یا :class:`bytes` تبدیل شود؛ :func:`os.fsdecode` و :func:`os.fsencode` می‌توانند به‌ترتیب برای تضمین نتیجهٔ :class:`str` یا :class:`bytes` استفاده شوند. معرفی‌شده در :pep:`519`." +#: ../../glossary.rst:1276 +msgid "" +"An object representing a file system path. A path-like object is either a :class:`str` or :class:`bytes` object representing a path, or an object implementing " +"the :class:`os.PathLike` protocol. An object that supports the :class:`os.PathLike` protocol can be converted to a :class:`str` or :class:`bytes` file system path " +"by calling the :func:`os.fspath` function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:`str` or :class:`bytes` result instead, " +"respectively. Introduced by :pep:`519`." +msgstr "" +"شی‌ءای که یک مسیر سامانهٔ فایل را نمایش می‌دهد. یک شیء شبه‌مسیر یا یک شیء :class:`str` یا :class:`bytes` است که یک مسیر را نمایش می‌دهد، یا شی‌ءای است که " +"پروتکل :class:`os.PathLike` را پیاده‌سازی می‌کند. شی‌ءای که از پروتکل :class:`os.PathLike` پشتیبانی می‌کند، می‌تواند با فراخوانی تابع :func:`os.fspath` به یک مسیر " +"سامانهٔ فایل :class:`str` یا :class:`bytes` تبدیل شود؛ :func:`os.fsdecode` و :func:`os.fsencode` می‌توانند به‌ترتیب برای تضمین نتیجهٔ :class:`str` یا :class:`bytes` " +"استفاده شوند. معرفی‌شده در :pep:`519`." +#: ../../glossary.rst:1284 msgid "PEP" msgstr "PEP" -msgid "Python Enhancement Proposal. A PEP is a design document providing information to the Python community, or describing a new feature for Python or its processes or environment. PEPs should provide a concise technical specification and a rationale for proposed features." -msgstr "پیشنهاد بهبود پایتون. یک PEP یک سند طراحی است که اطلاعاتی را برای کامیونیتی پایتون ارائه می‌کند، یا یک ویژگی جدید برای پایتون، فرایندهای آن یا محیط آن را توصیف می‌کند. PEPها باید یک مشخصات فنی مختصر و یک منطق برای ویژگی‌های پیشنهادی ارائه کنند." +#: ../../glossary.rst:1286 +msgid "" +"Python Enhancement Proposal. A PEP is a design document providing information to the Python community, or describing a new feature for Python or its processes or " +"environment. PEPs should provide a concise technical specification and a rationale for proposed features." +msgstr "" +"پیشنهاد بهبود پایتون. یک PEP یک سند طراحی است که اطلاعاتی را برای کامیونیتی پایتون ارائه می‌کند، یا یک ویژگی جدید برای پایتون، فرایندهای آن یا محیط آن را توصیف " +"می‌کند. PEPها باید یک مشخصات فنی مختصر و یک منطق برای ویژگی‌های پیشنهادی ارائه کنند." -msgid "PEPs are intended to be the primary mechanisms for proposing major new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python. The PEP author is responsible for building consensus within the community and documenting dissenting opinions." -msgstr "PEP ها برای این طراحی شده‌اند که سازوکارهای اصلی پیشنهاد ویژگی‌های بزرگ جدید، جمع‌آوری نظرهای کامیونیتی دربارهٔ یک موضوع و مستندسازی تصمیم‌های طراحی گرفته‌شده برای پایتون باشند. نویسندهٔ PEP مسئول ایجاد توافق در کامیونیتی و مستندسازی دیدگاه‌های مخالف است." +#: ../../glossary.rst:1292 +msgid "" +"PEPs are intended to be the primary mechanisms for proposing major new features, for collecting community input on an issue, and for documenting the design " +"decisions that have gone into Python. The PEP author is responsible for building consensus within the community and documenting dissenting opinions." +msgstr "" +"PEP ها برای این طراحی شده‌اند که سازوکارهای اصلی پیشنهاد ویژگی‌های بزرگ جدید، جمع‌آوری نظرهای کامیونیتی دربارهٔ یک موضوع و مستندسازی تصمیم‌های طراحی گرفته‌شده برای " +"پایتون باشند. نویسندهٔ PEP مسئول ایجاد توافق در کامیونیتی و مستندسازی دیدگاه‌های مخالف است." +#: ../../glossary.rst:1298 msgid "See :pep:`1`." msgstr ":pep:`1` را ببینید." +#: ../../glossary.rst:1299 msgid "portion" msgstr "بخش" +#: ../../glossary.rst:1301 msgid "A set of files in a single directory (possibly stored in a zip file) that contribute to a namespace package, as defined in :pep:`420`." msgstr "مجموعه‌ای از فایل‌ها در یک پوشهٔ واحد (که ممکن است در یک فایل zip ذخیره شده باشند) که در یک بستهٔ نام‌فضا، همان‌طور که در :pep:`420` تعریف شده است، مشارکت می‌کنند." +#: ../../glossary.rst:1303 msgid "positional argument" msgstr "آرگومان جایگاهی" +#: ../../glossary.rst:1306 msgid "provisional API" msgstr "API موقت" -msgid "A provisional API is one which has been deliberately excluded from the standard library's backwards compatibility guarantees. While major changes to such interfaces are not expected, as long as they are marked provisional, backwards incompatible changes (up to and including removal of the interface) may occur if deemed necessary by core developers. Such changes will not be made gratuitously -- they will occur only if serious fundamental flaws are uncovered that were missed prior to the inclusion of the API." -msgstr "یک API موقت، رابطی است که به‌طور عمدی از تضمین‌های سازگاری رو‌به‌عقب کتابخانهٔ استاندارد خارج شده است. با اینکه تغییرات بزرگ در چنین رابط‌هایی انتظار نمی‌رود، تا زمانی که موقت علامت‌گذاری شده باشند، اگر توسعه‌دهندگان اصلی آن را ضروری بدانند، تغییرات ناسازگار با نسخه‌های پیشین (تا حذف کامل رابط نیز) ممکن است رخ دهد. چنین تغییراتی بدون دلیل انجام نخواهند شد؛ آن‌ها تنها در صورتی رخ می‌دهند که نقص‌های بنیادی و جدی‌ای کشف شوند که پیش از اضافه شدن API از آن‌ها چشم‌پوشی شده بود." +#: ../../glossary.rst:1308 +msgid "" +"A provisional API is one which has been deliberately excluded from the standard library's backwards compatibility guarantees. While major changes to such " +"interfaces are not expected, as long as they are marked provisional, backwards incompatible changes (up to and including removal of the interface) may occur if " +"deemed necessary by core developers. Such changes will not be made gratuitously -- they will occur only if serious fundamental flaws are uncovered that were " +"missed prior to the inclusion of the API." +msgstr "" +"یک API موقت، رابطی است که به‌طور عمدی از تضمین‌های سازگاری رو‌به‌عقب کتابخانهٔ استاندارد خارج شده است. با اینکه تغییرات بزرگ در چنین رابط‌هایی انتظار نمی‌رود، تا زمانی " +"که موقت علامت‌گذاری شده باشند، اگر توسعه‌دهندگان اصلی آن را ضروری بدانند، تغییرات ناسازگار با نسخه‌های پیشین (تا حذف کامل رابط نیز) ممکن است رخ دهد. چنین تغییراتی " +"بدون دلیل انجام نخواهند شد؛ آن‌ها تنها در صورتی رخ می‌دهند که نقص‌های بنیادی و جدی‌ای کشف شوند که پیش از اضافه شدن API از آن‌ها چشم‌پوشی شده بود." -msgid "Even for provisional APIs, backwards incompatible changes are seen as a \"solution of last resort\" - every attempt will still be made to find a backwards compatible resolution to any identified problems." -msgstr "حتی برای APIهای موقت، تغییرات ناسازگار با نسخه‌های پیشین به‌عنوان «راه‌حل آخر» در نظر گرفته می‌شوند؛ همچنان هر تلاشی برای یافتن راه‌حلی سازگار با نسخه‌های پیشین برای مشکلات شناسایی‌شده انجام خواهد شد." +#: ../../glossary.rst:1317 +msgid "" +"Even for provisional APIs, backwards incompatible changes are seen as a \"solution of last resort\" - every attempt will still be made to find a backwards " +"compatible resolution to any identified problems." +msgstr "" +"حتی برای APIهای موقت، تغییرات ناسازگار با نسخه‌های پیشین به‌عنوان «راه‌حل آخر» در نظر گرفته می‌شوند؛ همچنان هر تلاشی برای یافتن راه‌حلی سازگار با نسخه‌های پیشین برای " +"مشکلات شناسایی‌شده انجام خواهد شد." -msgid "This process allows the standard library to continue to evolve over time, without locking in problematic design errors for extended periods of time. See :pep:`411` for more details." -msgstr "این فرایند به کتابخانهٔ استاندارد اجازه می‌دهد در طول زمان به تکامل خود ادامه دهد، بدون اینکه خطاهای طراحی مشکل‌ساز را برای دوره‌های طولانی تثبیت کند. برای جزئیات بیشتر، :pep:`411` را ببینید." +#: ../../glossary.rst:1321 +msgid "" +"This process allows the standard library to continue to evolve over time, without locking in problematic design errors for extended periods of time. " +"See :pep:`411` for more details." +msgstr "" +"این فرایند به کتابخانهٔ استاندارد اجازه می‌دهد در طول زمان به تکامل خود ادامه دهد، بدون اینکه خطاهای طراحی مشکل‌ساز را برای دوره‌های طولانی تثبیت کند. برای جزئیات " +"بیشتر، :pep:`411` را ببینید." +#: ../../glossary.rst:1324 msgid "provisional package" msgstr "بستهٔ موقت" +#: ../../glossary.rst:1326 msgid "See :term:`provisional API`." msgstr ":term:`API موقت ` را ببینید." +#: ../../glossary.rst:1327 msgid "Python 3000" msgstr "پایتون ۳۰۰۰" -msgid "Nickname for the Python 3.x release line (coined long ago when the release of version 3 was something in the distant future.) This is also abbreviated \"Py3k\"." +#: ../../glossary.rst:1329 +msgid "" +"Nickname for the Python 3.x release line (coined long ago when the release of version 3 was something in the distant future.) This is also abbreviated \"Py3k\"." msgstr "نام مستعار برای خط انتشار Python ۳.x (که مدت‌ها پیش، زمانی که انتشار نسخهٔ ۳ چیزی در آیندهٔ دور بود، ساخته شد.) این عبارت همچنین به‌صورت «Py3k» کوتاه می‌شود." +#: ../../glossary.rst:1332 msgid "Pythonic" msgstr "پایتونی" -msgid "An idea or piece of code which closely follows the most common idioms of the Python language, rather than implementing code using concepts common to other languages. For example, a common idiom in Python is to loop over all elements of an iterable using a :keyword:`for` statement. Many other languages don't have this type of construct, so people unfamiliar with Python sometimes use a numerical counter instead::" -msgstr "ایده یا بخشی از کد که به‌جای پیاده‌سازی با مفاهیم رایج در زبان‌های دیگر، به‌طور نزدیک از شیوه‌های رایج زبان پایتون پیروی می‌کند. برای مثال، یک شیوهٔ رایج در پایتون این است که با استفاده از دستور :keyword:`for` روی همهٔ المان‌های یک تکرارپذیر حلقه زده شود. بسیاری از زبان‌های دیگر چنین ساختاری ندارند، بنابراین افرادی که با پایتون آشنا نیستند گاهی به‌جای آن از یک شمارندهٔ عددی استفاده می‌کنند::" +#: ../../glossary.rst:1334 +msgid "" +"An idea or piece of code which closely follows the most common idioms of the Python language, rather than implementing code using concepts common to other " +"languages. For example, a common idiom in Python is to loop over all elements of an iterable using a :keyword:`for` statement. Many other languages don't have " +"this type of construct, so people unfamiliar with Python sometimes use a numerical counter instead::" +msgstr "" +"ایده یا بخشی از کد که به‌جای پیاده‌سازی با مفاهیم رایج در زبان‌های دیگر، به‌طور نزدیک از شیوه‌های رایج زبان پایتون پیروی می‌کند. برای مثال، یک شیوهٔ رایج در پایتون این " +"است که با استفاده از دستور :keyword:`for` روی همهٔ المان‌های یک تکرارپذیر حلقه زده شود. بسیاری از زبان‌های دیگر چنین ساختاری ندارند، بنابراین افرادی که با پایتون " +"آشنا نیستند گاهی به‌جای آن از یک شمارندهٔ عددی استفاده می‌کنند::" +#: ../../glossary.rst:1341 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -1221,9 +2356,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" +#: ../../glossary.rst:1344 msgid "As opposed to the cleaner, Pythonic method::" msgstr "در مقابل، روش تمیزتر و پایتونی::" +#: ../../glossary.rst:1346 msgid "" "for piece in food:\n" " print(piece)" @@ -1231,12 +2368,19 @@ msgstr "" "for piece in food:\n" " print(piece)" +#: ../../glossary.rst:1348 msgid "qualified name" msgstr "نام واجد شرایط" -msgid "A dotted name showing the \"path\" from a module's global scope to a class, function or method defined in that module, as defined in :pep:`3155`. For top-level functions and classes, the qualified name is the same as the object's name::" -msgstr "نامی نقطه‌گذاری‌شده که «مسیر» از محدودهٔ سراسری یک ماژول تا یک کلاس، تابع یا متد تعریف‌شده در آن ماژول را نشان می‌دهد، همان‌طور که در :pep:`3155` تعریف شده است. برای تابع‌ها و کلاس‌های سطح بالا، نام واجد شرایط همان نام شیء است::" +#: ../../glossary.rst:1350 +msgid "" +"A dotted name showing the \"path\" from a module's global scope to a class, function or method defined in that module, as defined in :pep:`3155`. For top-level " +"functions and classes, the qualified name is the same as the object's name::" +msgstr "" +"نامی نقطه‌گذاری‌شده که «مسیر» از محدودهٔ سراسری یک ماژول تا یک کلاس، تابع یا متد تعریف‌شده در آن ماژول را نشان می‌دهد، همان‌طور که در :pep:`3155` تعریف شده است. برای " +"تابع‌ها و کلاس‌های سطح بالا، نام واجد شرایط همان نام شیء است::" +#: ../../glossary.rst:1355 msgid "" ">>> class C:\n" "... class D:\n" @@ -1262,9 +2406,14 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -msgid "When used to refer to modules, the *fully qualified name* means the entire dotted path to the module, including any parent packages, e.g. ``email.mime.text``::" -msgstr "هنگامی که برای اشاره به ماژول‌ها استفاده می‌شود، *نام کاملاً واجد شرایط* به معنای کل مسیر نقطه‌گذاری‌شده به ماژول است که شامل هر بستهٔ والد نیز می‌شود، برای مثال ``email.mime.text``::" +#: ../../glossary.rst:1367 +msgid "" +"When used to refer to modules, the *fully qualified name* means the entire dotted path to the module, including any parent packages, e.g. ``email.mime.text``::" +msgstr "" +"هنگامی که برای اشاره به ماژول‌ها استفاده می‌شود، *نام کاملاً واجد شرایط* به معنای کل مسیر نقطه‌گذاری‌شده به ماژول است که شامل هر بستهٔ والد نیز می‌شود، برای مثال " +"``email.mime.text``::" +#: ../../glossary.rst:1371 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -1274,237 +2423,484 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" +#: ../../glossary.rst:1374 msgid "race condition" msgstr "شرط رقابت" -msgid "A condition of a program where the behavior depends on the relative timing or ordering of events, particularly in multi-threaded programs. Race conditions can lead to :term:`non-deterministic` behavior and bugs that are difficult to reproduce. A :term:`data race` is a specific type of race condition involving unsynchronized access to shared memory. The :term:`LBYL` coding style is particularly susceptible to race conditions in multi-threaded code. Using :term:`locks ` and other :term:`synchronization primitives ` helps prevent race conditions." -msgstr "شرایطی در یک برنامه که در آن رفتار به زمان‌بندی نسبی یا ترتیب رویدادها وابسته است، به‌ویژه در برنامه‌های چندنخی. شرایط رقابت می‌توانند به رفتار :term:`غیرقطعی ` و خطاهایی منجر شوند که بازتولید آن‌ها دشوار است. یک :term:`رقابت داده ` نوع خاصی از شرط رقابت است که شامل دسترسی بدون همگام‌سازی به حافظهٔ اشتراکی می‌شود. سبک کدنویسی :term:`LBYL ` در کد چندنخی به‌طور ویژه در برابر شرایط رقابت آسیب‌پذیر است. استفاده از :term:`قفل ` و دیگر :term:`اولیه ` به جلوگیری از شرایط رقابت کمک می‌کند." +#: ../../glossary.rst:1376 +msgid "" +"A condition of a program where the behavior depends on the relative timing or ordering of events, particularly in multi-threaded programs. Race conditions can " +"lead to :term:`non-deterministic` behavior and bugs that are difficult to reproduce. A :term:`data race` is a specific type of race condition involving " +"unsynchronized access to shared memory. The :term:`LBYL` coding style is particularly susceptible to race conditions in multi-threaded code. Using :term:`locks " +"` and other :term:`synchronization primitives ` helps prevent race conditions." +msgstr "" +"شرایطی در یک برنامه که در آن رفتار به زمان‌بندی نسبی یا ترتیب رویدادها وابسته است، به‌ویژه در برنامه‌های چندنخی. شرایط رقابت می‌توانند به رفتار :term:`غیرقطعی ` و خطاهایی منجر شوند که بازتولید آن‌ها دشوار است. یک :term:`رقابت داده ` نوع خاصی از شرط رقابت است که شامل دسترسی بدون همگام‌سازی به حافظهٔ " +"اشتراکی می‌شود. سبک کدنویسی :term:`LBYL ` در کد چندنخی به‌طور ویژه در برابر شرایط رقابت آسیب‌پذیر است. استفاده از :term:`قفل ` و دیگر :term:`اولیه " +"` به جلوگیری از شرایط رقابت کمک می‌کند." +#: ../../glossary.rst:1386 msgid "reference count" msgstr "شمارندهٔ ارجاع" -msgid "The number of references to an object. When the reference count of an object drops to zero, it is deallocated. Some objects are :term:`immortal` and have reference counts that are never modified, and therefore the objects are never deallocated. Reference counting is generally not visible to Python code, but it is a key element of the :term:`CPython` implementation. Programmers can call the :func:`sys.getrefcount` function to return the reference count for a particular object." -msgstr "تعداد ارجاع‌ها به یک شیء. هنگامی که تعداد ارجاع‌های یک شیء به صفر کاهش یابد، آن شیء از حافظه آزاد می‌شود. برخی اشیاء :term:`نامیرا ` هستند و تعداد ارجاع‌های آن‌ها هرگز تغییر نمی‌کند و بنابراین این اشیاء هرگز از حافظه آزاد نمی‌شوند. شمارش ارجاع‌ها عموماً برای کد پایتون قابل مشاهده نیست، اما یکی از عناصر کلیدی پیاده‌سازی :term:`CPython ` است. برنامه‌نویسان می‌توانند تابع :func:`sys.getrefcount` را فراخوانی کنند تا تعداد ارجاع‌های یک شیء خاص را برگرداند." +#: ../../glossary.rst:1388 +msgid "" +"The number of references to an object. When the reference count of an object drops to zero, it is deallocated. Some objects are :term:`immortal` and have " +"reference counts that are never modified, and therefore the objects are never deallocated. Reference counting is generally not visible to Python code, but it is " +"a key element of the :term:`CPython` implementation. Programmers can call the :func:`sys.getrefcount` function to return the reference count for a particular " +"object." +msgstr "" +"تعداد ارجاع‌ها به یک شیء. هنگامی که تعداد ارجاع‌های یک شیء به صفر کاهش یابد، آن شیء از حافظه آزاد می‌شود. برخی اشیاء :term:`نامیرا ` هستند و تعداد ارجاع‌های " +"آن‌ها هرگز تغییر نمی‌کند و بنابراین این اشیاء هرگز از حافظه آزاد نمی‌شوند. شمارش ارجاع‌ها عموماً برای کد پایتون قابل مشاهده نیست، اما یکی از عناصر کلیدی " +"پیاده‌سازی :term:`CPython ` است. برنامه‌نویسان می‌توانند تابع :func:`sys.getrefcount` را فراخوانی کنند تا تعداد ارجاع‌های یک شیء خاص را برگرداند." -msgid "In :term:`CPython`, reference counts are not considered to be stable or well-defined values; the number of references to an object, and how that number is affected by Python code, may be different between versions." -msgstr "در :term:`CPython `، تعداد ارجاع‌ها مقادیر پایدار یا به‌خوبی تعریف‌شده‌ای در نظر گرفته نمی‌شوند؛ تعداد ارجاع‌ها به یک شیء و نحوه تأثیرپذیری این تعداد از کد پایتون ممکن است بین نسخه‌ها متفاوت باشد." +#: ../../glossary.rst:1397 +msgid "" +"In :term:`CPython`, reference counts are not considered to be stable or well-defined values; the number of references to an object, and how that number is " +"affected by Python code, may be different between versions." +msgstr "" +"در :term:`CPython `، تعداد ارجاع‌ها مقادیر پایدار یا به‌خوبی تعریف‌شده‌ای در نظر گرفته نمی‌شوند؛ تعداد ارجاع‌ها به یک شیء و نحوه تأثیرپذیری این تعداد از کد " +"پایتون ممکن است بین نسخه‌ها متفاوت باشد." +#: ../../glossary.rst:1401 msgid "regular package" msgstr "بستهٔ معمولی" +#: ../../glossary.rst:1403 msgid "A traditional :term:`package`, such as a directory containing an ``__init__.py`` file." msgstr "یک :term:`بسته ` سنتی، مانند پوشه‌ای که شامل یک فایل ``__init__.py`` است." +#: ../../glossary.rst:1406 msgid "See also :term:`namespace package`." msgstr "همچنین :term:`بستهٔ نام‌فضا ` را ببینید." +#: ../../glossary.rst:1407 msgid "reentrant" msgstr "بازورودپذیر" -msgid "A property of a function or :term:`lock` that allows it to be called or acquired multiple times by the same thread without causing errors or a :term:`deadlock`." -msgstr "ویژگی یک تابع یا :term:`قفل ` که به آن اجازه می‌دهد بدون ایجاد خطا یا یک :term:`بن‌بست `، چندین بار توسط یک نخ اجرایی یکسان فراخوانی یا دریافت شود." +#: ../../glossary.rst:1409 +msgid "" +"A property of a function or :term:`lock` that allows it to be called or acquired multiple times by the same thread without causing errors or a :term:`deadlock`." +msgstr "" +"ویژگی یک تابع یا :term:`قفل ` که به آن اجازه می‌دهد بدون ایجاد خطا یا یک :term:`بن‌بست `، چندین بار توسط یک نخ اجرایی یکسان فراخوانی یا دریافت شود." -msgid "For functions, reentrancy means the function can be safely called again before a previous invocation has completed, which is important when functions may be called recursively or from signal handlers. Thread-unsafe functions may be :term:`non-deterministic` if they're called reentrantly in a multithreaded program." -msgstr "در مورد توابع، بازورودپذیری به این معناست که می‌توان تابع را پیش از کامل‌شدن یک فراخوانی قبلی، دوباره با ایمنی فراخوانی کرد؛ این موضوع زمانی اهمیت دارد که توابع ممکن است به‌صورت بازگشتی یا از درون دستگردان‌های سیگنال فراخوانی شوند. توابع ناایمن برای نخ‌های اجرایی ممکن است در صورتی که در یک برنامهٔ چندنخی به‌صورت بازورودپذیر فراخوانی شوند، :term:`غیرقطعی ` باشند." +#: ../../glossary.rst:1413 +msgid "" +"For functions, reentrancy means the function can be safely called again before a previous invocation has completed, which is important when functions may be " +"called recursively or from signal handlers. Thread-unsafe functions may be :term:`non-deterministic` if they're called reentrantly in a multithreaded program." +msgstr "" +"در مورد توابع، بازورودپذیری به این معناست که می‌توان تابع را پیش از کامل‌شدن یک فراخوانی قبلی، دوباره با ایمنی فراخوانی کرد؛ این موضوع زمانی اهمیت دارد که توابع " +"ممکن است به‌صورت بازگشتی یا از درون دستگردان‌های سیگنال فراخوانی شوند. توابع ناایمن برای نخ‌های اجرایی ممکن است در صورتی که در یک برنامهٔ چندنخی به‌صورت بازورودپذیر " +"فراخوانی شوند، :term:`غیرقطعی ` باشند." -msgid "For locks, Python's :class:`threading.RLock` (reentrant lock) is reentrant, meaning a thread that already holds the lock can acquire it again without blocking. In contrast, :class:`threading.Lock` is not reentrant - attempting to acquire it twice from the same thread will cause a deadlock." -msgstr "در مورد قفل‌ها، :class:`threading.RLock` پایتون (قفل بازورودپذیر) بازورودپذیر است؛ یعنی نخ اجرایی‌ای که از پیش قفل را در اختیار دارد، می‌تواند دوباره آن را دریافت کند، بدون آنکه مسدود شود. در مقابل، :class:`threading.Lock` بازورودپذیر نیست؛ تلاش برای دریافت آن دو بار از همان نخ اجرایی باعث یک بن‌بست می‌شود." +#: ../../glossary.rst:1419 +msgid "" +"For locks, Python's :class:`threading.RLock` (reentrant lock) is reentrant, meaning a thread that already holds the lock can acquire it again without blocking. " +"In contrast, :class:`threading.Lock` is not reentrant - attempting to acquire it twice from the same thread will cause a deadlock." +msgstr "" +"در مورد قفل‌ها، :class:`threading.RLock` پایتون (قفل بازورودپذیر) بازورودپذیر است؛ یعنی نخ اجرایی‌ای که از پیش قفل را در اختیار دارد، می‌تواند دوباره آن را دریافت " +"کند، بدون آنکه مسدود شود. در مقابل، :class:`threading.Lock` بازورودپذیر نیست؛ تلاش برای دریافت آن دو بار از همان نخ اجرایی باعث یک بن‌بست می‌شود." +#: ../../glossary.rst:1425 msgid "See also :term:`lock` and :term:`deadlock`." msgstr "همچنین :term:`قفل ` و :term:`بن‌بست ` را ببینید." +#: ../../glossary.rst:1426 msgid "REPL" msgstr "REPL" +#: ../../glossary.rst:1428 msgid "An acronym for the \"read–eval–print loop\", another name for the :term:`interactive` interpreter shell." msgstr "سرواژهٔ «read–eval–print loop» و نام دیگری برای پوستهٔ مفسر :term:`تعاملی ` است." +#: ../../glossary.rst:1430 msgid "__slots__" msgstr "__slots__" -msgid "A declaration inside a class that saves memory by pre-declaring space for instance attributes and eliminating instance dictionaries. Though popular, the technique is somewhat tricky to get right and is best reserved for rare cases where there are large numbers of instances in a memory-critical application." -msgstr "یک اعلان درون یک کلاس که با پیش‌اعلام فضای موردنیاز برای ویژگی‌های نمونه و حذف دیکشنری‌های نمونه، در حافظه صرفه‌جویی می‌کند. با وجود محبوبیت این روش، پیاده‌سازی درست آن تا حدی دشوار است و بهتر است آن را به موارد نادری محدود کنید که تعداد نمونه‌ها زیاد است و برنامه از نظر حافظه حساس است." +#: ../../glossary.rst:1432 +msgid "" +"A declaration inside a class that saves memory by pre-declaring space for instance attributes and eliminating instance dictionaries. Though popular, the " +"technique is somewhat tricky to get right and is best reserved for rare cases where there are large numbers of instances in a memory-critical application." +msgstr "" +"یک اعلان درون یک کلاس که با پیش‌اعلام فضای موردنیاز برای ویژگی‌های نمونه و حذف دیکشنری‌های نمونه، در حافظه صرفه‌جویی می‌کند. با وجود محبوبیت این روش، پیاده‌سازی درست آن " +"تا حدی دشوار است و بهتر است آن را به موارد نادری محدود کنید که تعداد نمونه‌ها زیاد است و برنامه از نظر حافظه حساس است." +#: ../../glossary.rst:1437 msgid "sequence" msgstr "دنباله" -msgid "An :term:`iterable` which supports efficient element access using integer indices via the :meth:`~object.__getitem__` special method and defines a :meth:`~object.__len__` method that returns the length of the sequence. Some built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a sequence because the lookups use arbitrary :term:`hashable` keys rather than integers." -msgstr "یک :term:`تکرارپذیر ` که از دسترسی کارآمد به المان‌ها با استفاده از اندیس‌های عدد صحیح از طریق متد ویژهٔ :meth:`~object.__getitem__` پشتیبانی می‌کند و متد :meth:`~object.__len__` را تعریف می‌کند که طول دنباله را برمی‌گرداند. برخی از انواع دنبالهٔ توکار عبارت‌اند از :class:`list`، :class:`str`، :class:`tuple` و :class:`bytes`. توجه کنید که :class:`dict` نیز از :meth:`~object.__getitem__` و :meth:`!__len__` پشتیبانی می‌کند، اما به‌جای دنباله، نگاشت در نظر گرفته می‌شود، زیرا جست‌وجوها از کلیدهای :term:`قابل درهم‌سازی ` دلخواه به‌جای اعداد صحیح استفاده می‌کنند." +#: ../../glossary.rst:1439 +msgid "" +"An :term:`iterable` which supports efficient element access using integer indices via the :meth:`~object.__getitem__` special method and defines " +"a :meth:`~object.__len__` method that returns the length of the sequence. Some built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " +"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a sequence " +"because the lookups use arbitrary :term:`hashable` keys rather than integers." +msgstr "" +"یک :term:`تکرارپذیر ` که از دسترسی کارآمد به المان‌ها با استفاده از اندیس‌های عدد صحیح از طریق متد ویژهٔ :meth:`~object.__getitem__` پشتیبانی می‌کند و " +"متد :meth:`~object.__len__` را تعریف می‌کند که طول دنباله را برمی‌گرداند. برخی از انواع دنبالهٔ توکار عبارت‌اند از :class:`list`، :class:`str`، :class:`tuple` " +"و :class:`bytes`. توجه کنید که :class:`dict` نیز از :meth:`~object.__getitem__` و :meth:`!__len__` پشتیبانی می‌کند، اما به‌جای دنباله، نگاشت در نظر گرفته می‌شود، " +"زیرا جست‌وجوها از کلیدهای :term:`قابل درهم‌سازی ` دلخواه به‌جای اعداد صحیح استفاده می‌کنند." -msgid "The :class:`collections.abc.Sequence` abstract base class defines a much richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:`~object.__len__`, adding :meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~object.__contains__`, and :meth:`~object.__reversed__`. Types that implement this expanded interface can be registered explicitly using :func:`~abc.ABCMeta.register`. For more documentation on sequence methods generally, see :ref:`Common Sequence Operations `." -msgstr "کلاس پایهٔ انتزاعی :class:`collections.abc.Sequence` رابط بسیار غنی‌تری را تعریف می‌کند که فراتر از صرفاً :meth:`~object.__getitem__` و :meth:`~object.__len__` است و :meth:`~sequence.count`، :meth:`~sequence.index`، :meth:`~object.__contains__` و :meth:`~object.__reversed__` را نیز اضافه می‌کند. نوع‌هایی که این رابط گسترش‌یافته را پیاده‌سازی می‌کنند، می‌توانند به‌طور صریح با استفاده از :func:`~abc.ABCMeta.register` ثبت شوند. برای مستندات بیشتر دربارهٔ متدهای دنباله به‌طور کلی، :ref:`Common Sequence Operations ` را ببینید." +#: ../../glossary.rst:1448 +msgid "" +"The :class:`collections.abc.Sequence` abstract base class defines a much richer interface that goes beyond just :meth:`~object.__getitem__` " +"and :meth:`~object.__len__`, adding :meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~object.__contains__`, and :meth:`~object.__reversed__`. Types that " +"implement this expanded interface can be registered explicitly using :func:`~abc.ABCMeta.register`. For more documentation on sequence methods generally, " +"see :ref:`Common Sequence Operations `." +msgstr "" +"کلاس پایهٔ انتزاعی :class:`collections.abc.Sequence` رابط بسیار غنی‌تری را تعریف می‌کند که فراتر از صرفاً :meth:`~object.__getitem__` و :meth:`~object.__len__` است " +"و :meth:`~sequence.count`، :meth:`~sequence.index`، :meth:`~object.__contains__` و :meth:`~object.__reversed__` را نیز اضافه می‌کند. نوع‌هایی که این رابط گسترش‌یافته " +"را پیاده‌سازی می‌کنند، می‌توانند به‌طور صریح با استفاده از :func:`~abc.ABCMeta.register` ثبت شوند. برای مستندات بیشتر دربارهٔ متدهای دنباله به‌طور کلی، :ref:`Common " +"Sequence Operations ` را ببینید." +#: ../../glossary.rst:1458 msgid "set comprehension" msgstr "درک مجموعه‌ای" -msgid "A compact way to process all or part of the elements in an iterable and return a set with the results. ``results = {c for c in 'abracadabra' if c not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:`comprehensions`." -msgstr "روشی فشرده برای پردازش همه یا بخشی از المان‌های یک تکرارپذیر و بازگرداندن یک مجموعه با نتایج. ``results = {c for c in 'abracadabra' if c not in 'abc'}`` مجموعه‌ای از رشته‌ها به‌شکل ``{'r', 'd'}`` تولید می‌کند. :ref:`comprehensions` را ببینید." +#: ../../glossary.rst:1460 +msgid "" +"A compact way to process all or part of the elements in an iterable and return a set with the results. ``results = {c for c in 'abracadabra' if c not in 'abc'}`` " +"generates the set of strings ``{'r', 'd'}``. See :ref:`comprehensions`." +msgstr "" +"روشی فشرده برای پردازش همه یا بخشی از المان‌های یک تکرارپذیر و بازگرداندن یک مجموعه با نتایج. ``results = {c for c in 'abracadabra' if c not in 'abc'}`` مجموعه‌ای " +"از رشته‌ها به‌شکل ``{'r', 'd'}`` تولید می‌کند. :ref:`comprehensions` را ببینید." +#: ../../glossary.rst:1464 msgid "single dispatch" msgstr "توزیع تک‌گانه" +#: ../../glossary.rst:1466 msgid "A form of :term:`generic function` dispatch where the implementation is chosen based on the type of a single argument." msgstr "نوعی توزیع :term:`تابع عمومی ` که در آن پیاده‌سازی بر اساس نوع یک آرگومان واحد انتخاب می‌شود." +#: ../../glossary.rst:1468 msgid "slice" msgstr "برش" -msgid "An object of type :class:`slice`, used to describe a portion of a :term:`sequence`. A slice object is created when using the :ref:`slicing ` form of :ref:`subscript notation `, with colons inside square brackets, such as in ``variable_name[1:3:5]``." -msgstr "یک شیء از نوع :class:`slice` که برای توصیف بخشی از یک :term:`دنباله ` استفاده می‌شود. یک شیء برش هنگام استفاده از شکل :ref:`slicing ` در :ref:`subscript notation `، با دو نقطه درون کروشه‌ها، مانند ``variable_name[1:3:5]``، ایجاد می‌شود." +#: ../../glossary.rst:1470 +msgid "" +"An object of type :class:`slice`, used to describe a portion of a :term:`sequence`. A slice object is created when using the :ref:`slicing ` form " +"of :ref:`subscript notation `, with colons inside square brackets, such as in ``variable_name[1:3:5]``." +msgstr "" +"یک شیء از نوع :class:`slice` که برای توصیف بخشی از یک :term:`دنباله ` استفاده می‌شود. یک شیء برش هنگام استفاده از شکل :ref:`slicing ` " +"در :ref:`subscript notation `، با دو نقطه درون کروشه‌ها، مانند ``variable_name[1:3:5]``، ایجاد می‌شود." +#: ../../glossary.rst:1475 msgid "soft deprecated" msgstr "منسوخ‌سازی نرم" -msgid "A soft deprecated API should not be used in new code, but it is safe for already existing code to use it. The API remains documented and tested, but will not be enhanced further." -msgstr "از یک API که به‌صورت منسوخ‌سازی نرم علامت‌گذاری شده است نباید در کد جدید استفاده شود، اما استفاده از آن در کدهای موجود ایمن است. این API همچنان مستندسازی و آزمایش می‌شود، اما دیگر بهبود داده نخواهد شد." +#: ../../glossary.rst:1477 +msgid "" +"A soft deprecated API should not be used in new code, but it is safe for already existing code to use it. The API remains documented and tested, but will not be " +"enhanced further." +msgstr "" +"از یک API که به‌صورت منسوخ‌سازی نرم علامت‌گذاری شده است نباید در کد جدید استفاده شود، اما استفاده از آن در کدهای موجود ایمن است. این API همچنان مستندسازی و آزمایش " +"می‌شود، اما دیگر بهبود داده نخواهد شد." +#: ../../glossary.rst:1481 msgid "Soft deprecation, unlike normal deprecation, does not plan on removing the API and will not emit warnings." msgstr "منسوخ‌سازی نرم، برخلاف منسوخ‌سازی معمولی، قصد حذف API را ندارد و هیچ هشداری نیز ایجاد نمی‌کند." +#: ../../glossary.rst:1484 msgid "See `PEP 387: Soft Deprecation `_." msgstr "`PEP 387: Soft Deprecation `_ را نیز ببینید." +#: ../../glossary.rst:1486 msgid "special method" msgstr "متد ویژه" -msgid "A method that is called implicitly by Python to execute a certain operation on a type, such as addition. Such methods have names starting and ending with double underscores. Special methods are documented in :ref:`specialnames`." -msgstr "متدی که به‌طور ضمنی توسط پایتون فراخوانی می‌شود تا عملیاتی خاص را روی یک نوع، مانند جمع، اجرا کند. نام این متدها با دو زیرخط آغاز و با دو زیرخط پایان می‌یابد. متدهای ویژه در :ref:`specialnames` مستند شده‌اند." +#: ../../glossary.rst:1490 +msgid "" +"A method that is called implicitly by Python to execute a certain operation on a type, such as addition. Such methods have names starting and ending with double " +"underscores. Special methods are documented in :ref:`specialnames`." +msgstr "" +"متدی که به‌طور ضمنی توسط پایتون فراخوانی می‌شود تا عملیاتی خاص را روی یک نوع، مانند جمع، اجرا کند. نام این متدها با دو زیرخط آغاز و با دو زیرخط پایان می‌یابد. متدهای " +"ویژه در :ref:`specialnames` مستند شده‌اند." +#: ../../glossary.rst:1494 msgid "standard library" msgstr "کتابخانهٔ استاندارد" -msgid "The collection of :term:`packages `, :term:`modules ` and :term:`extension modules ` distributed as a part of the official Python interpreter package. The exact membership of the collection may vary based on platform, available system libraries, or other criteria. Documentation can be found at :ref:`library-index`." -msgstr "مجموعه‌ای از :term:`بسته `، :term:`ماژول ` و :term:`ماژول افزونه ` که به‌عنوان بخشی از بستهٔ رسمی مفسر پایتون توزیع می‌شوند. اعضای دقیق این مجموعه ممکن است بر اساس سکو، کتابخانه‌های سیستمی موجود یا معیارهای دیگر متفاوت باشند. مستندات آن را می‌توانید در :ref:`library-index` پیدا کنید." +#: ../../glossary.rst:1496 +msgid "" +"The collection of :term:`packages `, :term:`modules ` and :term:`extension modules ` distributed as a part of the official " +"Python interpreter package. The exact membership of the collection may vary based on platform, available system libraries, or other criteria. Documentation can " +"be found at :ref:`library-index`." +msgstr "" +"مجموعه‌ای از :term:`بسته `، :term:`ماژول ` و :term:`ماژول افزونه ` که به‌عنوان بخشی از بستهٔ رسمی مفسر پایتون توزیع می‌شوند. اعضای " +"دقیق این مجموعه ممکن است بر اساس سکو، کتابخانه‌های سیستمی موجود یا معیارهای دیگر متفاوت باشند. مستندات آن را می‌توانید در :ref:`library-index` پیدا کنید." +#: ../../glossary.rst:1502 msgid "See also :data:`sys.stdlib_module_names` for a list of all possible standard library module names." msgstr "همچنین :data:`sys.stdlib_module_names` را برای فهرستی از همهٔ نام‌های ممکن ماژول‌های کتابخانهٔ استاندارد ببینید." +#: ../../glossary.rst:1504 msgid "statement" msgstr "دستور" -msgid "A statement is part of a suite (a \"block\" of code). A statement is either an :term:`expression` or one of several constructs with a keyword, such as :keyword:`if`, :keyword:`while` or :keyword:`for`." -msgstr "دستور بخشی از یک مجموعه (یک «بلوک» کد) است. یک دستور یا یک :term:`عبارت ` است یا یکی از چند ساختار دارای کلیدواژه، مانند :keyword:`if`، :keyword:`while` یا :keyword:`for`." +#: ../../glossary.rst:1506 +msgid "" +"A statement is part of a suite (a \"block\" of code). A statement is either an :term:`expression` or one of several constructs with a keyword, such " +"as :keyword:`if`, :keyword:`while` or :keyword:`for`." +msgstr "" +"دستور بخشی از یک مجموعه (یک «بلوک» کد) است. یک دستور یا یک :term:`عبارت ` است یا یکی از چند ساختار دارای کلیدواژه، " +"مانند :keyword:`if`، :keyword:`while` یا :keyword:`for`." +#: ../../glossary.rst:1509 msgid "static type checker" msgstr "بررسی‌کنندهٔ نوع ایستا" -msgid "An external tool that reads Python code and analyzes it, looking for issues such as incorrect types. See also :term:`type hints ` and the :mod:`typing` module." -msgstr "یک ابزار خارجی که کد پایتون را می‌خواند و آن را تحلیل می‌کند و به‌دنبال مشکلاتی مانند نوع‌های نادرست می‌گردد. همچنین :term:`راهنمای نوع ` و ماژول :mod:`typing` را ببینید." +#: ../../glossary.rst:1511 +msgid "" +"An external tool that reads Python code and analyzes it, looking for issues such as incorrect types. See also :term:`type hints ` and the :mod:`typing` " +"module." +msgstr "" +"یک ابزار خارجی که کد پایتون را می‌خواند و آن را تحلیل می‌کند و به‌دنبال مشکلاتی مانند نوع‌های نادرست می‌گردد. همچنین :term:`راهنمای نوع ` و " +"ماژول :mod:`typing` را ببینید." +#: ../../glossary.rst:1514 msgid "stdlib" msgstr "stdlib" +#: ../../glossary.rst:1516 msgid "An abbreviation of :term:`standard library`." msgstr "شکل کوتاه‌شدهٔ :term:`کتابخانهٔ استاندارد `." +#: ../../glossary.rst:1517 +msgid "steal" +msgstr "دزدیدن" + +#: ../../glossary.rst:1519 +msgid "" +"In Python's C API, \"*stealing*\" an argument means that ownership of the argument is transferred to the called function. The caller must not use that reference " +"after the call. Generally, functions that \"steal\" an argument do so even if they fail." +msgstr "" +"در C API پایتون، «دزدیدن» یک آرگومان به این معناست که مالکیت آرگومان به تابع فراخوانی‌شده منتقل می‌شود. فراخواننده نباید پس از فراخوانی از آن ارجاع استفاده کند. " +"به‌طور کلی، توابعی که یک آرگومان را «می‌دزدند»، این کار را حتی در صورت شکست نیز انجام می‌دهند." + +#: ../../glossary.rst:1524 +msgid "See :ref:`api-refcountdetails` for a full explanation." +msgstr "برای توضیح کامل، بخش :ref:`api-refcountdetails` را ببینید." + +#: ../../glossary.rst:1525 msgid "strong reference" msgstr "ارجاع قوی" -msgid "In Python's C API, a strong reference is a reference to an object which is owned by the code holding the reference. The strong reference is taken by calling :c:func:`Py_INCREF` when the reference is created and released with :c:func:`Py_DECREF` when the reference is deleted." -msgstr "در API زبان C پایتون، ارجاع قوی ارجاعی به یک شیء است که کدی که ارجاع را در اختیار دارد، مالک آن است. ارجاع قوی هنگام ایجاد ارجاع با فراخوانی :c:func:`Py_INCREF` گرفته می‌شود و هنگام حذف ارجاع با :c:func:`Py_DECREF` آزاد می‌شود." +#: ../../glossary.rst:1527 +msgid "" +"In Python's C API, a strong reference is a reference to an object which is owned by the code holding the reference. The strong reference is taken by " +"calling :c:func:`Py_INCREF` when the reference is created and released with :c:func:`Py_DECREF` when the reference is deleted." +msgstr "" +"در API زبان C پایتون، ارجاع قوی ارجاعی به یک شیء است که کدی که ارجاع را در اختیار دارد، مالک آن است. ارجاع قوی هنگام ایجاد ارجاع با فراخوانی :c:func:`Py_INCREF` " +"گرفته می‌شود و هنگام حذف ارجاع با :c:func:`Py_DECREF` آزاد می‌شود." -msgid "The :c:func:`Py_NewRef` function can be used to create a strong reference to an object. Usually, the :c:func:`Py_DECREF` function must be called on the strong reference before exiting the scope of the strong reference, to avoid leaking one reference." -msgstr "از تابع :c:func:`Py_NewRef` می‌توان برای ایجاد یک ارجاع قوی به یک شیء استفاده کرد. معمولاً باید تابع :c:func:`Py_DECREF` پیش از خروج از محدودهٔ ارجاع قوی، روی آن فراخوانی شود تا از نشت یک ارجاع جلوگیری شود." +#: ../../glossary.rst:1533 +msgid "" +"The :c:func:`Py_NewRef` function can be used to create a strong reference to an object. Usually, the :c:func:`Py_DECREF` function must be called on the strong " +"reference before exiting the scope of the strong reference, to avoid leaking one reference." +msgstr "" +"از تابع :c:func:`Py_NewRef` می‌توان برای ایجاد یک ارجاع قوی به یک شیء استفاده کرد. معمولاً باید تابع :c:func:`Py_DECREF` پیش از خروج از محدودهٔ ارجاع قوی، روی آن " +"فراخوانی شود تا از نشت یک ارجاع جلوگیری شود." +#: ../../glossary.rst:1538 msgid "See also :term:`borrowed reference`." msgstr "همچنین :term:`ارجاع قرض‌گرفته‌شده ` را ببینید." +#: ../../glossary.rst:1539 msgid "subscript" msgstr "زیرنویس" -msgid "The expression in square brackets of a :ref:`subscription expression `, for example, the ``3`` in ``items[3]``. Usually used to select an element of a container. Also called a :term:`key` when subscripting a :term:`mapping`, or an :term:`index` when subscripting a :term:`sequence`." -msgstr "عبارت درون کروشه‌های یک :ref:`subscription expression `، برای مثال ``3`` در ``items[3]``. معمولاً برای انتخاب یک المان از یک کانتینر استفاده می‌شود. هنگام زیرنویس‌گذاری یک :term:`نگاشت `، به آن :term:`کلید ` نیز گفته می‌شود و هنگام زیرنویس‌گذاری یک :term:`دنباله `، به آن :term:`اندیس ` گفته می‌شود." +#: ../../glossary.rst:1541 +msgid "" +"The expression in square brackets of a :ref:`subscription expression `, for example, the ``3`` in ``items[3]``. Usually used to select an element " +"of a container. Also called a :term:`key` when subscripting a :term:`mapping`, or an :term:`index` when subscripting a :term:`sequence`." +msgstr "" +"عبارت درون کروشه‌های یک :ref:`subscription expression `، برای مثال ``3`` در ``items[3]``. معمولاً برای انتخاب یک المان از یک کانتینر استفاده می‌شود. " +"هنگام زیرنویس‌گذاری یک :term:`نگاشت `، به آن :term:`کلید ` نیز گفته می‌شود و هنگام زیرنویس‌گذاری یک :term:`دنباله `، به آن :term:`اندیس " +"` گفته می‌شود." +#: ../../glossary.rst:1547 msgid "synchronization primitive" msgstr "اولیه" -msgid "A basic building block for coordinating (synchronizing) the execution of multiple threads to ensure :term:`thread-safe` access to shared resources. Python's :mod:`threading` module provides several synchronization primitives including :class:`~threading.Lock`, :class:`~threading.RLock`, :class:`~threading.Semaphore`, :class:`~threading.Condition`, :class:`~threading.Event`, and :class:`~threading.Barrier`. Additionally, the :mod:`queue` module provides multi-producer, multi-consumer queues that are especially useful in multithreaded programs. These primitives help prevent :term:`race conditions ` and coordinate thread execution. See also :term:`lock`." -msgstr "یک سازهٔ پایه برای هماهنگ‌سازی اجرای چند نخ اجرایی، با هدف اطمینان از دسترسی :term:`ایمن برای نخ‌های اجرایی ` به منابع مشترک. ماژول :mod:`threading` پایتون چندین اولیهٔ همگام‌سازی، از جمله :class:`~threading.Lock`، :class:`~threading.RLock`، :class:`~threading.Semaphore`، :class:`~threading.Condition`، :class:`~threading.Event` و :class:`~threading.Barrier` را فراهم می‌کند. افزون بر این، ماژول :mod:`queue` صف‌های چندتولیدکننده، چندمصرف‌کننده‌ای را فراهم می‌کند که به‌ویژه در برنامه‌های چندنخی مفید هستند. این اولیه‌ها به جلوگیری از :term:`شرط رقابت ` و هماهنگ‌سازی اجرای نخ‌های اجرایی کمک می‌کنند. همچنین :term:`قفل ` را ببینید." +#: ../../glossary.rst:1549 +msgid "" +"A basic building block for coordinating (synchronizing) the execution of multiple threads to ensure :term:`thread-safe` access to shared resources. " +"Python's :mod:`threading` module provides several synchronization primitives " +"including :class:`~threading.Lock`, :class:`~threading.RLock`, :class:`~threading.Semaphore`, :class:`~threading.Condition`, :class:`~threading.Event`, " +"and :class:`~threading.Barrier`. Additionally, the :mod:`queue` module provides multi-producer, multi-consumer queues that are especially useful in multithreaded " +"programs. These primitives help prevent :term:`race conditions ` and coordinate thread execution. See also :term:`lock`." +msgstr "" +"یک سازهٔ پایه برای هماهنگ‌سازی اجرای چند نخ اجرایی، با هدف اطمینان از دسترسی :term:`ایمن برای نخ‌های اجرایی ` به منابع مشترک. ماژول :mod:`threading` " +"پایتون چندین اولیهٔ همگام‌سازی، از " +"جمله :class:`~threading.Lock`، :class:`~threading.RLock`، :class:`~threading.Semaphore`، :class:`~threading.Condition`، :class:`~threading.Event` " +"و :class:`~threading.Barrier` را فراهم می‌کند. افزون بر این، ماژول :mod:`queue` صف‌های چندتولیدکننده، چندمصرف‌کننده‌ای را فراهم می‌کند که به‌ویژه در برنامه‌های چندنخی " +"مفید هستند. این اولیه‌ها به جلوگیری از :term:`شرط رقابت ` و هماهنگ‌سازی اجرای نخ‌های اجرایی کمک می‌کنند. همچنین :term:`قفل ` را ببینید." +#: ../../glossary.rst:1559 msgid "t-string" msgstr "تی‌استرینگ" +#: ../../glossary.rst:1560 msgid "t-strings" msgstr "تی‌استرینگ‌ها" +#: ../../glossary.rst:1562 msgid "String literals prefixed with ``t`` or ``T`` are commonly called \"t-strings\" which is short for :ref:`template string literals `." msgstr "لیترال‌های رشته‌ای که با ``t`` یا ``T`` پیشوندگذاری شده‌اند، معمولاً «t-string» نامیده می‌شوند که شکل کوتاه‌شدهٔ :ref:`template string literals ` است." +#: ../../glossary.rst:1565 msgid "text encoding" msgstr "کدگذاری متن" -msgid "A string in Python is a sequence of Unicode code points (in range ``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be serialized as a sequence of bytes." -msgstr "یک رشته در پایتون دنباله‌ای از نقاط کد یونیکد است (در محدودهٔ ``U+0000``--``U+10FFFF``). برای ذخیره یا انتقال یک رشته، لازم است آن را به‌صورت دنباله‌ای از بایت‌ها سریال‌سازی کرد." +#: ../../glossary.rst:1567 +msgid "" +"A string in Python is a sequence of Unicode code points (in range ``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be serialized as a " +"sequence of bytes." +msgstr "" +"یک رشته در پایتون دنباله‌ای از نقاط کد یونیکد است (در محدودهٔ ``U+0000``--``U+10FFFF``). برای ذخیره یا انتقال یک رشته، لازم است آن را به‌صورت دنباله‌ای از بایت‌ها " +"سریال‌سازی کرد." +#: ../../glossary.rst:1571 msgid "Serializing a string into a sequence of bytes is known as \"encoding\", and recreating the string from the sequence of bytes is known as \"decoding\"." msgstr "سریال‌سازی یک رشته به‌صورت دنباله‌ای از بایت‌ها «کدگذاری» نامیده می‌شود و بازسازی رشته از دنبالهٔ بایت‌ها «کدگشایی» نام دارد." +#: ../../glossary.rst:1574 msgid "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." msgstr "انواع مختلفی از :ref:`codecs ` برای سریال‌سازی متن وجود دارند که در مجموع «کدگذاری‌های متن» نامیده می‌شوند." +#: ../../glossary.rst:1577 msgid "text file" msgstr "فایل متنی" -msgid "A :term:`file object` able to read and write :class:`str` objects. Often, a text file actually accesses a byte-oriented datastream and handles the :term:`text encoding` automatically. Examples of text files are files opened in text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances of :class:`io.StringIO`." -msgstr "یک :term:`شیء فایل ` که می‌تواند اشیای :class:`str` را بخواند و بنویسد. یک فایل متنی اغلب در واقع به یک جریان دادهٔ بایت‌محور دسترسی دارد و :term:`کدگذاری متن ` را به‌طور خودکار مدیریت می‌کند. نمونه‌هایی از فایل‌های متنی، فایل‌هایی هستند که در حالت متنی باز شده‌اند (``'r'`` یا ``'w'``)، :data:`sys.stdin`، :data:`sys.stdout` و نمونه‌های :class:`io.StringIO`." +#: ../../glossary.rst:1579 +msgid "" +"A :term:`file object` able to read and write :class:`str` objects. Often, a text file actually accesses a byte-oriented datastream and handles the :term:`text " +"encoding` automatically. Examples of text files are files opened in text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " +"of :class:`io.StringIO`." +msgstr "" +"یک :term:`شیء فایل ` که می‌تواند اشیای :class:`str` را بخواند و بنویسد. یک فایل متنی اغلب در واقع به یک جریان دادهٔ بایت‌محور دسترسی دارد " +"و :term:`کدگذاری متن ` را به‌طور خودکار مدیریت می‌کند. نمونه‌هایی از فایل‌های متنی، فایل‌هایی هستند که در حالت متنی باز شده‌اند (``'r'`` یا " +"``'w'``)، :data:`sys.stdin`، :data:`sys.stdout` و نمونه‌های :class:`io.StringIO`." +#: ../../glossary.rst:1586 msgid "See also :term:`binary file` for a file object able to read and write :term:`bytes-like objects `." msgstr "همچنین برای یک شیء فایل که می‌تواند :term:`شیء شبه‌بایت ` را بخواند و بنویسد، :term:`فایل دودویی ` را ببینید." +#: ../../glossary.rst:1588 msgid "thread state" msgstr "وضعیت نخ اجرایی" -msgid "The information used by the :term:`CPython` runtime to run in an OS thread. For example, this includes the current exception, if any, and the state of the bytecode interpreter." -msgstr "اطلاعاتی که :term:`CPython ` ران‌تایم برای اجرا در یک نخ اجرایی سیستم‌عامل استفاده می‌کند. برای مثال، این اطلاعات شامل استثنای فعلی، در صورت وجود، و وضعیت مفسر بایت‌کد است." +#: ../../glossary.rst:1591 +msgid "" +"The information used by the :term:`CPython` runtime to run in an OS thread. For example, this includes the current exception, if any, and the state of the " +"bytecode interpreter." +msgstr "" +"اطلاعاتی که :term:`CPython ` ران‌تایم برای اجرا در یک نخ اجرایی سیستم‌عامل استفاده می‌کند. برای مثال، این اطلاعات شامل استثنای فعلی، در صورت وجود، و وضعیت " +"مفسر بایت‌کد است." -msgid "Each thread state is bound to a single OS thread, but threads may have many thread states available. At most, one of them may be :term:`attached ` at once." -msgstr "هر وضعیت نخ اجرایی به یک نخ اجرایی سیستم‌عامل واحد وابسته است، اما نخ‌های اجرایی ممکن است وضعیت‌های نخ اجرایی متعددی در دسترس داشته باشند. در هر لحظه حداکثر یکی از آن‌ها می‌تواند :term:`وضعیت نخ متصل ` باشد." +#: ../../glossary.rst:1595 +msgid "" +"Each thread state is bound to a single OS thread, but threads may have many thread states available. At most, one of them may be :term:`attached ` at once." +msgstr "" +"هر وضعیت نخ اجرایی به یک نخ اجرایی سیستم‌عامل واحد وابسته است، اما نخ‌های اجرایی ممکن است وضعیت‌های نخ اجرایی متعددی در دسترس داشته باشند. در هر لحظه حداکثر یکی از " +"آن‌ها می‌تواند :term:`وضعیت نخ متصل ` باشد." -msgid "An :term:`attached thread state` is required to call most of Python's C API, unless a function explicitly documents otherwise. The bytecode interpreter only runs under an attached thread state." -msgstr "برای فراخوانی بیشتر API زبان C پایتون، یک :term:`وضعیت نخ متصل ` لازم است، مگر اینکه تابعی صراحتاً خلاف آن را مستند کرده باشد. مفسر بایت‌کد فقط در یک وضعیت نخ اجرایی پیوست‌شده اجرا می‌شود." +#: ../../glossary.rst:1599 +msgid "" +"An :term:`attached thread state` is required to call most of Python's C API, unless a function explicitly documents otherwise. The bytecode interpreter only runs " +"under an attached thread state." +msgstr "" +"برای فراخوانی بیشتر API زبان C پایتون، یک :term:`وضعیت نخ متصل ` لازم است، مگر اینکه تابعی صراحتاً خلاف آن را مستند کرده باشد. مفسر بایت‌کد " +"فقط در یک وضعیت نخ اجرایی پیوست‌شده اجرا می‌شود." -msgid "Each thread state belongs to a single interpreter, but each interpreter may have many thread states, including multiple for the same OS thread. Thread states from multiple interpreters may be bound to the same thread, but only one can be :term:`attached ` in that thread at any given moment." -msgstr "هر وضعیت نخ اجرایی به یک مفسر واحد تعلق دارد، اما هر مفسر ممکن است وضعیت‌های نخ اجرایی متعددی داشته باشد، از جمله چند وضعیت برای یک نخ اجرایی سیستم‌عامل یکسان. وضعیت‌های نخ اجرایی از مفسرهای متعدد ممکن است به یک نخ اجرایی یکسان وابسته باشند، اما در هر لحظه فقط یکی از آن‌ها می‌تواند در آن نخ اجرایی :term:`وضعیت نخ متصل ` باشد." +#: ../../glossary.rst:1603 +msgid "" +"Each thread state belongs to a single interpreter, but each interpreter may have many thread states, including multiple for the same OS thread. Thread states from " +"multiple interpreters may be bound to the same thread, but only one can be :term:`attached ` in that thread at any given moment." +msgstr "" +"هر وضعیت نخ اجرایی به یک مفسر واحد تعلق دارد، اما هر مفسر ممکن است وضعیت‌های نخ اجرایی متعددی داشته باشد، از جمله چند وضعیت برای یک نخ اجرایی سیستم‌عامل یکسان. " +"وضعیت‌های نخ اجرایی از مفسرهای متعدد ممکن است به یک نخ اجرایی یکسان وابسته باشند، اما در هر لحظه فقط یکی از آن‌ها می‌تواند در آن نخ اجرایی :term:`وضعیت نخ متصل " +"` باشد." +#: ../../glossary.rst:1609 msgid "See :ref:`Thread State and the Global Interpreter Lock ` for more information." msgstr "برای اطلاعات بیشتر، :ref:`Thread State and the Global Interpreter Lock ` را ببینید." +#: ../../glossary.rst:1611 msgid "thread-safe" msgstr "ایمن برای نخ‌های اجرایی" -msgid "A module, function, or class that behaves correctly when used by multiple threads concurrently. Thread-safe code uses appropriate :term:`synchronization primitives ` like :term:`locks ` to protect shared mutable state, or is designed to avoid shared mutable state entirely. In the :term:`free-threaded ` build, built-in types like :class:`dict`, :class:`list`, and :class:`set` use internal locking to make many operations thread-safe, although thread safety is not necessarily guaranteed. Code that is not thread-safe may experience :term:`race conditions ` and :term:`data races ` when used in multi-threaded programs." -msgstr "یک ماژول، تابع یا کلاس که هنگام استفادهٔ هم‌زمان توسط چند نخ اجرایی، به‌درستی رفتار می‌کند. کد ایمن برای نخ‌های اجرایی از :term:`اولیه ` مناسب، مانند :term:`قفل `، برای محافظت از وضعیت تغییرپذیر مشترک استفاده می‌کند یا به‌گونه‌ای طراحی شده است که به‌طور کامل از وضعیت تغییرپذیر مشترک اجتناب کند. در ساخت :term:`نخ‌گذاری آزاد `، نوع‌های توکار مانند :class:`dict`، :class:`list` و :class:`set` از قفل‌گذاری داخلی برای ایمن‌کردن بسیاری از عملیات در برابر اجرای هم‌زمان نخ‌های اجرایی استفاده می‌کنند، هرچند ایمنی در برابر نخ‌های اجرایی لزوماً تضمین‌شده نیست. کدی که برای نخ‌های اجرایی ایمن نیست، هنگام استفاده در برنامه‌های چندنخی ممکن است دچار :term:`شرط رقابت ` و :term:`رقابت داده ` شود." +#: ../../glossary.rst:1613 +msgid "" +"A module, function, or class that behaves correctly when used by multiple threads concurrently. Thread-safe code uses appropriate :term:`synchronization " +"primitives ` like :term:`locks ` to protect shared mutable state, or is designed to avoid shared mutable state entirely. In " +"the :term:`free-threaded ` build, built-in types like :class:`dict`, :class:`list`, and :class:`set` use internal locking to make many operations " +"thread-safe, although thread safety is not necessarily guaranteed. Code that is not thread-safe may experience :term:`race conditions ` " +"and :term:`data races ` when used in multi-threaded programs." +msgstr "" +"یک ماژول، تابع یا کلاس که هنگام استفادهٔ هم‌زمان توسط چند نخ اجرایی، به‌درستی رفتار می‌کند. کد ایمن برای نخ‌های اجرایی از :term:`اولیه ` " +"مناسب، مانند :term:`قفل `، برای محافظت از وضعیت تغییرپذیر مشترک استفاده می‌کند یا به‌گونه‌ای طراحی شده است که به‌طور کامل از وضعیت تغییرپذیر مشترک اجتناب کند. " +"در ساخت :term:`نخ‌گذاری آزاد `، نوع‌های توکار مانند :class:`dict`، :class:`list` و :class:`set` از قفل‌گذاری داخلی برای ایمن‌کردن بسیاری از عملیات در " +"برابر اجرای هم‌زمان نخ‌های اجرایی استفاده می‌کنند، هرچند ایمنی در برابر نخ‌های اجرایی لزوماً تضمین‌شده نیست. کدی که برای نخ‌های اجرایی ایمن نیست، هنگام استفاده در " +"برنامه‌های چندنخی ممکن است دچار :term:`شرط رقابت ` و :term:`رقابت داده ` شود." +#: ../../glossary.rst:1624 msgid "token" msgstr "توکن" -msgid "A small unit of source code, generated by the :ref:`lexical analyzer ` (also called the *tokenizer*). Names, numbers, strings, operators, newlines and similar are represented by tokens." -msgstr "واحد کوچکی از کد منبع که توسط :ref:`lexical analyzer ` (که *tokenizer* نیز نامیده می‌شود) تولید می‌شود. نام‌ها، اعداد، رشته‌ها، عملگرها، نویسه‌های خط جدید و موارد مشابه به‌صورت توکن نمایش داده می‌شوند." +#: ../../glossary.rst:1627 +msgid "" +"A small unit of source code, generated by the :ref:`lexical analyzer ` (also called the *tokenizer*). Names, numbers, strings, operators, newlines and " +"similar are represented by tokens." +msgstr "" +"واحد کوچکی از کد منبع که توسط :ref:`lexical analyzer ` (که *tokenizer* نیز نامیده می‌شود) تولید می‌شود. نام‌ها، اعداد، رشته‌ها، عملگرها، نویسه‌های خط جدید و " +"موارد مشابه به‌صورت توکن نمایش داده می‌شوند." +#: ../../glossary.rst:1632 msgid "The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:`token` module contains information on the various types of tokens." msgstr "ماژول :mod:`tokenize` تحلیل‌گر واژگانی پایتون را در دسترس قرار می‌دهد. ماژول :mod:`token` حاوی اطلاعاتی دربارهٔ انواع مختلف توکن‌ها است." +#: ../../glossary.rst:1635 msgid "triple-quoted string" msgstr "رشتهٔ سه‌نقل‌قولی" -msgid "A string which is bound by three instances of either a quotation mark (\") or an apostrophe ('). While they don't provide any functionality not available with single-quoted strings, they are useful for a number of reasons. They allow you to include unescaped single and double quotes within a string and they can span multiple lines without the use of the continuation character, making them especially useful when writing docstrings." -msgstr "رشته‌ای که با سه نمونه از یکی از علامت‌های نقل‌قول (\") یا آپاستروف (') محصور شده است. با اینکه این رشته‌ها قابلیت جدیدی فراتر از رشته‌های تک‌نقل‌قولی فراهم نمی‌کنند، به دلایل متعددی مفید هستند. آن‌ها به شما اجازه می‌دهند علامت‌های نقل‌قول تکی و دوتایی را بدون خنثی‌سازی درون یک رشته قرار دهید و می‌توانند بدون استفاده از نویسهٔ ادامهٔ خط، چندین خط را دربر بگیرند؛ بنابراین هنگام نوشتن docstringها به‌ویژه مفید هستند." +#: ../../glossary.rst:1637 +msgid "" +"A string which is bound by three instances of either a quotation mark (\") or an apostrophe ('). While they don't provide any functionality not available with " +"single-quoted strings, they are useful for a number of reasons. They allow you to include unescaped single and double quotes within a string and they can span " +"multiple lines without the use of the continuation character, making them especially useful when writing docstrings." +msgstr "" +"رشته‌ای که با سه نمونه از یکی از علامت‌های نقل‌قول (\") یا آپاستروف (') محصور شده است. با اینکه این رشته‌ها قابلیت جدیدی فراتر از رشته‌های تک‌نقل‌قولی فراهم نمی‌کنند، به " +"دلایل متعددی مفید هستند. آن‌ها به شما اجازه می‌دهند علامت‌های نقل‌قول تکی و دوتایی را بدون خنثی‌سازی درون یک رشته قرار دهید و می‌توانند بدون استفاده از نویسهٔ ادامهٔ خط، " +"چندین خط را دربر بگیرند؛ بنابراین هنگام نوشتن docstringها به‌ویژه مفید هستند." +#: ../../glossary.rst:1644 msgid "type" msgstr "نوع" -msgid "The type of a Python object determines what kind of object it is; every object has a type. An object's type is accessible as its :attr:`~object.__class__` attribute or can be retrieved with ``type(obj)``." -msgstr "نوع یک شیء پایتون تعیین می‌کند که آن شیء از چه نوعی است؛ هر شیء یک نوع دارد. نوع یک شیء به‌عنوان ویژگی :attr:`~object.__class__` آن در دسترس است یا می‌توان آن را با ``type(obj)`` به‌دست آورد." +#: ../../glossary.rst:1646 +msgid "" +"The type of a Python object determines what kind of object it is; every object has a type. An object's type is accessible as its :attr:`~object.__class__` " +"attribute or can be retrieved with ``type(obj)``." +msgstr "" +"نوع یک شیء پایتون تعیین می‌کند که آن شیء از چه نوعی است؛ هر شیء یک نوع دارد. نوع یک شیء به‌عنوان ویژگی :attr:`~object.__class__` آن در دسترس است یا می‌توان آن را با " +"``type(obj)`` به‌دست آورد." +#: ../../glossary.rst:1650 msgid "type alias" msgstr "نام مستعار نوع" +#: ../../glossary.rst:1652 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "مترادفی برای یک نوع که با نسبت‌دادن نوع به یک شناسه ایجاد می‌شود." +#: ../../glossary.rst:1654 msgid "Type aliases are useful for simplifying :term:`type hints `. For example::" msgstr "نام‌های مستعار نوع برای ساده‌سازی :term:`راهنمای نوع ` مفید هستند. برای مثال::" +#: ../../glossary.rst:1657 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -1514,9 +2910,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" +#: ../../glossary.rst:1661 msgid "could be made more readable like this::" msgstr "می‌توانست به این شکل خواناتر شود::" +#: ../../glossary.rst:1663 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -1528,36 +2926,55 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" +#: ../../glossary.rst:1668 ../../glossary.rst:1682 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "برای توضیح این قابلیت، :mod:`typing` و :pep:`484` را ببینید." +#: ../../glossary.rst:1669 msgid "type hint" msgstr "راهنمای نوع" +#: ../../glossary.rst:1671 msgid "An :term:`annotation` that specifies the expected type for a variable, a class attribute, or a function parameter or return value." msgstr "یک :term:`حاشیه‌گذاری ` که نوع مورد انتظار برای یک متغیر، یک ویژگی کلاس، یا یک پارامتر یا مقدار بازگشتی تابع را مشخص می‌کند." -msgid "Type hints are optional and are not enforced by Python but they are useful to :term:`static type checkers `. They can also aid IDEs with code completion and refactoring." -msgstr "راهنماهای نوع اختیاری هستند و پایتون آن‌ها را اعمال نمی‌کند، اما برای :term:`بررسی‌کنندهٔ نوع ایستا ` مفید هستند. آن‌ها همچنین می‌توانند به IDEها در تکمیل کد و بازآرایی کد کمک کنند." +#: ../../glossary.rst:1674 +msgid "" +"Type hints are optional and are not enforced by Python but they are useful to :term:`static type checkers `. They can also aid IDEs with code " +"completion and refactoring." +msgstr "" +"راهنماهای نوع اختیاری هستند و پایتون آن‌ها را اعمال نمی‌کند، اما برای :term:`بررسی‌کنندهٔ نوع ایستا ` مفید هستند. آن‌ها همچنین می‌توانند به IDEها " +"در تکمیل کد و بازآرایی کد کمک کنند." +#: ../../glossary.rst:1678 msgid "Type hints of global variables, class attributes, and functions, but not local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "راهنماهای نوع متغیرهای سراسری، ویژگی‌های کلاس و توابع، اما نه متغیرهای محلی، با استفاده از :func:`typing.get_type_hints` قابل دسترسی هستند." +#: ../../glossary.rst:1683 msgid "universal newlines" msgstr "خط جدید همگانی" -msgid "A manner of interpreting text streams in which all of the following are recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the Windows convention ``'\\r\\n'``, and the old Macintosh convention ``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes.splitlines` for an additional use." -msgstr "روشی برای تفسیر جریان‌های متنی که در آن همهٔ موارد زیر به‌عنوان پایان یک خط شناخته می‌شوند: قرارداد پایان خط یونیکس ``'\\n'``، قرارداد ویندوز ``'\\r\\n'`` و قرارداد قدیمی مکینتاش ``'\\r'``. همچنین :pep:`278` و :pep:`3116` و نیز :func:`bytes.splitlines` را برای کاربردی دیگر ببینید." +#: ../../glossary.rst:1685 +msgid "" +"A manner of interpreting text streams in which all of the following are recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the Windows " +"convention ``'\\r\\n'``, and the old Macintosh convention ``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes.splitlines` for an additional use." +msgstr "" +"روشی برای تفسیر جریان‌های متنی که در آن همهٔ موارد زیر به‌عنوان پایان یک خط شناخته می‌شوند: قرارداد پایان خط یونیکس ``'\\n'``، قرارداد ویندوز ``'\\r\\n'`` و قرارداد " +"قدیمی مکینتاش ``'\\r'``. همچنین :pep:`278` و :pep:`3116` و نیز :func:`bytes.splitlines` را برای کاربردی دیگر ببینید." +#: ../../glossary.rst:1690 msgid "variable annotation" msgstr "حاشیه‌نویسی متغیر" +#: ../../glossary.rst:1692 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "یک :term:`حاشیه‌گذاری ` برای یک متغیر یا یک ویژگی کلاس." +#: ../../glossary.rst:1694 msgid "When annotating a variable or a class attribute, assignment is optional::" msgstr "هنگام حاشیه‌نویسی یک متغیر یا یک ویژگی کلاس، انتساب اختیاری است::" +#: ../../glossary.rst:1696 msgid "" "class C:\n" " field: 'annotation'" @@ -1565,59 +2982,107 @@ msgstr "" "class C:\n" " field: 'annotation'" +#: ../../glossary.rst:1699 msgid "Variable annotations are usually used for :term:`type hints `: for example this variable is expected to take :class:`int` values::" msgstr "حاشیه‌نویسی‌های متغیر معمولاً برای :term:`راهنمای نوع ` استفاده می‌شوند؛ برای مثال، انتظار می‌رود این متغیر مقادیر :class:`int` را بپذیرد::" +#: ../../glossary.rst:1703 msgid "count: int = 0" msgstr "count: int = 0" +#: ../../glossary.rst:1705 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "سینتکس حاشیه‌نویسی متغیر در بخش :ref:`annassign` توضیح داده شده است." -msgid "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe this functionality. Also see :ref:`annotations-howto` for best practices on working with annotations." -msgstr "همچنین :term:`حاشیه‌گذاری تابع `، :pep:`484` و :pep:`526` را که این قابلیت را توصیف می‌کنند، ببینید. برای بهترین روش‌های کار با حاشیه‌نویسی‌ها نیز :ref:`annotations-howto` را ببینید." +#: ../../glossary.rst:1707 +msgid "" +"See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe this functionality. Also see :ref:`annotations-howto` for best practices on working " +"with annotations." +msgstr "" +"همچنین :term:`حاشیه‌گذاری تابع `، :pep:`484` و :pep:`526` را که این قابلیت را توصیف می‌کنند، ببینید. برای بهترین روش‌های کار با حاشیه‌نویسی‌ها " +"نیز :ref:`annotations-howto` را ببینید." +#: ../../glossary.rst:1711 msgid "virtual environment" msgstr "محیط مجازی" -msgid "A cooperatively isolated runtime environment that allows Python users and applications to install and upgrade Python distribution packages without interfering with the behaviour of other Python applications running on the same system." -msgstr "یک محیط ران‌تایم ایزوله‌شدهٔ مشارکتی که به کاربران و برنامه‌های پایتون اجازه می‌دهد بسته‌های توزیعی پایتون را بدون تداخل با رفتار سایر برنامه‌های پایتونی در حال اجرا روی همان سیستم، نصب و ارتقا دهند." +#: ../../glossary.rst:1713 +msgid "" +"A cooperatively isolated runtime environment that allows Python users and applications to install and upgrade Python distribution packages without interfering " +"with the behaviour of other Python applications running on the same system." +msgstr "" +"یک محیط ران‌تایم ایزوله‌شدهٔ مشارکتی که به کاربران و برنامه‌های پایتون اجازه می‌دهد بسته‌های توزیعی پایتون را بدون تداخل با رفتار سایر برنامه‌های پایتونی در حال اجرا روی " +"همان سیستم، نصب و ارتقا دهند." +#: ../../glossary.rst:1718 msgid "See also :mod:`venv`." msgstr "همچنین :mod:`venv` را ببینید." +#: ../../glossary.rst:1719 msgid "virtual machine" msgstr "ماشین مجازی" +#: ../../glossary.rst:1721 msgid "A computer defined entirely in software. Python's virtual machine executes the :term:`bytecode` emitted by the bytecode compiler." msgstr "یک رایانه که به‌طور کامل در نرم‌افزار تعریف شده است. ماشین مجازی پایتون :term:`بایت‌کد ` تولیدشده توسط کامپایلر بایت‌کد را اجرا می‌کند." +#: ../../glossary.rst:1723 msgid "walrus operator" msgstr "عملگر والروس" -msgid "A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a walrus if you turn your head." -msgstr "روشی شوخ‌طبعانه برای اشاره به عملگر :ref:`assignment expression ` یعنی ``:=``، زیرا اگر سرتان را کمی کج کنید، ظاهر آن تا حدی شبیه یک والروس است." +#: ../../glossary.rst:1725 +msgid "" +"A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a walrus if you turn your " +"head." +msgstr "" +"روشی شوخ‌طبعانه برای اشاره به عملگر :ref:`assignment expression ` یعنی ``:=``، زیرا اگر سرتان را کمی کج کنید، ظاهر آن تا حدی شبیه یک والروس " +"است." +#: ../../glossary.rst:1728 msgid "Zen of Python" msgstr "ذن پایتون" -msgid "Listing of Python design principles and philosophies that are helpful in understanding and using the language. The listing can be found by typing \"``import this``\" at the interactive prompt." -msgstr "فهرستی از اصول و فلسفه‌های طراحی پایتون که برای درک و استفاده از این زبان مفید هستند. این فهرست با واردکردن «``import this``» در اعلان تعاملی قابل مشاهده است." +#: ../../glossary.rst:1730 +msgid "" +"Listing of Python design principles and philosophies that are helpful in understanding and using the language. The listing can be found by typing \"``import " +"this``\" at the interactive prompt." +msgstr "" +"فهرستی از اصول و فلسفه‌های طراحی پایتون که برای درک و استفاده از این زبان مفید هستند. این فهرست با واردکردن «``import this``» در اعلان تعاملی قابل مشاهده است." +#: ../../glossary.rst:24 msgid "..." msgstr "..." +#: ../../glossary.rst:24 msgid "ellipsis literal" msgstr "لیترال سه‌نقطه" +#: ../../glossary.rst:349 msgid "C-contiguous" msgstr "پیوسته در C" +#: ../../glossary.rst:349 msgid "Fortran contiguous" msgstr "پیوسته در Fortran" +#: ../../glossary.rst:1002 msgid "magic" msgstr "جادو" +#: ../../glossary.rst:1488 msgid "special" -msgstr "ویژه" \ No newline at end of file +msgstr "ویژه" + +#~ msgid "" +#~ "Usually refers to an asynchronous generator function, but may refer to an *asynchronous generator iterator* in some contexts. In cases where the intended " +#~ "meaning isn't clear, using the full terms avoids ambiguity." +#~ msgstr "" +#~ "معمولاً به یک تابع تولیدگر ناهمگام اشاره دارد، اما در برخی زمینه‌ها ممکن است به یک *تکرارگر تولیدگر ناهمگام* اشاره کند. در مواردی که معنای مورد نظر واضح نیست، " +#~ "استفاده از اصطلاحات کامل از ابهام جلوگیری می‌کند." + +#~ msgid "" +#~ "Usually refers to a generator function, but may refer to a *generator iterator* in some contexts. In cases where the intended meaning isn't clear, using the " +#~ "full terms avoids ambiguity." +#~ msgstr "" +#~ "معمولاً به یک تابع تولیدگر اشاره دارد، اما در برخی زمینه‌ها ممکن است به یک *تکرارگر تولیدگر* اشاره کند. در مواردی که معنای مورد نظر واضح نیست، استفاده از " +#~ "اصطلاحات کامل از ابهام جلوگیری می‌کند." diff --git a/howto/a-conceptual-overview-of-asyncio.po b/howto/a-conceptual-overview-of-asyncio.po index 41ed107ee..a724d297f 100644 --- a/howto/a-conceptual-overview-of-asyncio.po +++ b/howto/a-conceptual-overview-of-asyncio.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,51 +19,108 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:5 msgid "A Conceptual Overview of :mod:`!asyncio`" msgstr "" -msgid "This :ref:`HOWTO ` article seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:7 +msgid "" +"This :ref:`HOWTO ` article seeks to help you build a sturdy mental " +"model of how :mod:`asyncio` fundamentally works, helping you understand the " +"how and why behind the recommended patterns." msgstr "" -msgid "You might be curious about some key :mod:`!asyncio` concepts. By the end of this article, you'll be able to comfortably answer these questions:" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:11 +msgid "" +"You might be curious about some key :mod:`!asyncio` concepts. By the end of " +"this article, you'll be able to comfortably answer these questions:" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:14 msgid "What's happening behind the scenes when an object is awaited?" msgstr "" -msgid "How does :mod:`!asyncio` differentiate between a task which doesn't need CPU time (such as a network request or file read) as opposed to a task that does (such as computing n-factorial)?" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:15 +msgid "" +"How does :mod:`!asyncio` differentiate between a task which doesn't need CPU " +"time (such as a network request or file read) as opposed to a task that does " +"(such as computing n-factorial)?" msgstr "" -msgid "How to write an asynchronous variant of an operation, such as an async sleep or database request." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:18 +msgid "" +"How to write an asynchronous variant of an operation, such as an async sleep " +"or database request." msgstr "" -msgid "The `guide `_ that inspired this HOWTO article, by Alexander Nordin." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:23 +msgid "" +"The `guide `_ that inspired this HOWTO article, by Alexander Nordin." msgstr "" -msgid "This in-depth `YouTube tutorial series `_ on ``asyncio`` created by Python core team member, Łukasz Langa." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:25 +msgid "" +"This in-depth `YouTube tutorial series `_ on ``asyncio`` " +"created by Python core team member, Łukasz Langa." msgstr "" -msgid "`500 Lines or Less: A Web Crawler With asyncio Coroutines `_ by A. Jesse Jiryu Davis and Guido van Rossum." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:28 +msgid "" +"`500 Lines or Less: A Web Crawler With asyncio Coroutines `_ by A. " +"Jesse Jiryu Davis and Guido van Rossum." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:34 msgid "A conceptual overview part 1: the high-level" msgstr "" -msgid "In part 1, we'll cover the main, high-level building blocks of :mod:`!asyncio`: the event loop, coroutine functions, coroutine objects, tasks, and ``await``." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:36 +msgid "" +"In part 1, we'll cover the main, high-level building blocks of :mod:`!" +"asyncio`: the event loop, coroutine functions, coroutine objects, tasks, and " +"``await``." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:41 msgid "Event Loop" msgstr "" -msgid "Everything in :mod:`!asyncio` happens relative to the event loop. It's the star of the show. It's like an orchestra conductor. It's behind the scenes managing resources. Some power is explicitly granted to it, but a lot of its ability to get things done comes from the respect and cooperation of its worker bees." -msgstr "" - -msgid "In more technical terms, the event loop contains a collection of jobs to be run. Some jobs are added directly by you, and some indirectly by :mod:`!asyncio`. The event loop takes a job from its backlog of work and invokes it (or \"gives it control\"), similar to calling a function, and then that job runs. Once it pauses or completes, it returns control to the event loop. The event loop will then select another job from its pool and invoke it. You can *roughly* think of the collection of jobs as a queue: jobs are added and then processed one at a time, generally (but not always) in order. This process repeats indefinitely, with the event loop cycling endlessly onwards. If there are no more jobs pending execution, the event loop is smart enough to rest and avoid needlessly wasting CPU cycles, and will come back when there's more work to be done." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:43 +msgid "" +"Everything in :mod:`!asyncio` happens relative to the event loop. It's the " +"star of the show. It's like an orchestra conductor. It's behind the scenes " +"managing resources. Some power is explicitly granted to it, but a lot of its " +"ability to get things done comes from the respect and cooperation of its " +"worker bees." msgstr "" -msgid "Effective execution relies on jobs sharing well and cooperating; a greedy job could hog control and leave the other jobs to starve, rendering the overall event loop approach rather useless." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:50 +msgid "" +"In more technical terms, the event loop contains a collection of jobs to be " +"run. Some jobs are added directly by you, and some indirectly by :mod:`!" +"asyncio`. The event loop takes a job from its backlog of work and invokes it " +"(or \"gives it control\"), similar to calling a function, and then that job " +"runs. Once it pauses or completes, it returns control to the event loop. The " +"event loop will then select another job from its pool and invoke it. You can " +"*roughly* think of the collection of jobs as a queue: jobs are added and " +"then processed one at a time, generally (but not always) in order. This " +"process repeats indefinitely, with the event loop cycling endlessly onwards. " +"If there are no more jobs pending execution, the event loop is smart enough " +"to rest and avoid needlessly wasting CPU cycles, and will come back when " +"there's more work to be done." +msgstr "" + +#: ../../howto/a-conceptual-overview-of-asyncio.rst:64 +msgid "" +"Effective execution relies on jobs sharing well and cooperating; a greedy " +"job could hog control and leave the other jobs to starve, rendering the " +"overall event loop approach rather useless." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:70 msgid "" "import asyncio\n" "\n" @@ -73,12 +130,15 @@ msgid "" "event_loop.run_forever()" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:79 msgid "Asynchronous functions and coroutines" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:81 msgid "This is a basic, boring Python function::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:83 msgid "" "def hello_printer():\n" " print(\n" @@ -88,43 +148,74 @@ msgid "" " )" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:90 msgid "Calling a regular function invokes its logic or body::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:92 msgid "" ">>> hello_printer()\n" "Hi, I am a lowly, simple printer, though I have all I need in life --\n" "fresh paper and my dearly beloved octopus partner in crime." msgstr "" -msgid "The :ref:`async def `, as opposed to just a plain ``def``, makes this an asynchronous function (or \"coroutine function\"). Calling it creates and returns a :ref:`coroutine ` object." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:96 +msgid "" +"The :ref:`async def `, as opposed to just a plain ``def``, makes " +"this an asynchronous function (or \"coroutine function\"). Calling it " +"creates and returns a :ref:`coroutine ` object." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:102 msgid "" "async def loudmouth_penguin(magic_number: int):\n" " print(\n" -" \"I am a super special talking penguin. Far cooler than that printer. \"\n" +" \"I am a super special talking penguin. Far cooler than that printer. " +"\"\n" " f\"By the way, my lucky number is: {magic_number}.\"\n" " )" msgstr "" -msgid "Calling the async function, ``loudmouth_penguin``, does not execute the print statement; instead, it creates a coroutine object::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:108 +msgid "" +"Calling the async function, ``loudmouth_penguin``, does not execute the " +"print statement; instead, it creates a coroutine object::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:111 msgid "" ">>> loudmouth_penguin(magic_number=3)\n" "" msgstr "" -msgid "The terms \"coroutine function\" and \"coroutine object\" are often conflated as coroutine. That can be confusing! In this article, coroutine specifically refers to a coroutine object, or more precisely, an instance of :data:`types.CoroutineType` (native coroutine). Note that coroutines can also exist as instances of :class:`collections.abc.Coroutine` -- a distinction that matters for type checking." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:114 +msgid "" +"The terms \"coroutine function\" and \"coroutine object\" are often " +"conflated as coroutine. That can be confusing! In this article, coroutine " +"specifically refers to a coroutine object, or more precisely, an instance " +"of :class:`types.CoroutineType` (native coroutine). Note that coroutines can " +"also exist as instances of :class:`collections.abc.Coroutine` -- a " +"distinction that matters for type checking." msgstr "" -msgid "A coroutine represents the function's body or logic. A coroutine has to be explicitly started; again, merely creating the coroutine does not start it. Notably, the coroutine can be paused and resumed at various points within the function's body. That pausing and resuming ability is what allows for asynchronous behavior!" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:123 +msgid "" +"A coroutine represents the function's body or logic. A coroutine has to be " +"explicitly started; again, merely creating the coroutine does not start it. " +"Notably, the coroutine can be paused and resumed at various points within " +"the function's body. That pausing and resuming ability is what allows for " +"asynchronous behavior!" msgstr "" -msgid "Coroutines and coroutine functions were built by leveraging the functionality of :term:`generators ` and :term:`generator functions `. Recall, a generator function is a function that :keyword:`yield`\\s, like this one::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:130 +msgid "" +"Coroutines and coroutine functions were built by leveraging the " +"functionality of :term:`generators ` " +"and :term:`generator functions `. Recall, a generator function is " +"a function that :keyword:`yield`\\s, like this one::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:136 msgid "" "def get_random_number():\n" " # This would be a bad random number generator!\n" @@ -137,17 +228,26 @@ msgid "" " ..." msgstr "" -msgid "Similar to a coroutine function, calling a generator function does not run it. Instead, it creates a generator object::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:146 +msgid "" +"Similar to a coroutine function, calling a generator function does not run " +"it. Instead, it creates a generator object::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:149 msgid "" ">>> get_random_number()\n" "" msgstr "" -msgid "You can proceed to the next ``yield`` of a generator by using the built-in function :func:`next`. In other words, the generator runs, then pauses. For example::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:152 +msgid "" +"You can proceed to the next ``yield`` of a generator by using the built-in " +"function :func:`next`. In other words, the generator runs, then pauses. For " +"example::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:157 msgid "" ">>> generator = get_random_number()\n" ">>> next(generator)\n" @@ -158,27 +258,53 @@ msgid "" "7" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:167 msgid "Tasks" msgstr "" -msgid "Roughly speaking, :ref:`tasks ` are coroutines (not coroutine functions) tied to an event loop. A task also maintains a list of callback functions whose importance will become clear in a moment when we discuss :keyword:`await`. The recommended way to create tasks is via :func:`asyncio.create_task`." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:169 +msgid "" +"Roughly speaking, :ref:`tasks ` are coroutines (not " +"coroutine functions) tied to an event loop. A task also maintains a list of " +"callback functions whose importance will become clear in a moment when we " +"discuss :keyword:`await`. The recommended way to create tasks is " +"via :func:`asyncio.create_task`." msgstr "" -msgid "Creating a task automatically schedules it for execution (by adding a callback to run it in the event loop's to-do list, that is, collection of jobs)." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:175 +msgid "" +"Creating a task automatically schedules it for execution (by adding a " +"callback to run it in the event loop's to-do list, that is, collection of " +"jobs)." msgstr "" -msgid ":mod:`!asyncio` automatically associates tasks with the event loop for you. This automatic association was purposely designed into :mod:`!asyncio` for the sake of simplicity. Without it, you'd have to keep track of the event loop object and pass it to any coroutine function that wants to create tasks, adding redundant clutter to your code." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:178 +msgid "" +":mod:`!asyncio` automatically associates tasks with the event loop for you. " +"This automatic association was purposely designed into :mod:`!asyncio` for " +"the sake of simplicity. Without it, you'd have to keep track of the event " +"loop object and pass it to any coroutine function that wants to create " +"tasks, adding redundant clutter to your code." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:187 msgid "" "coroutine = loudmouth_penguin(magic_number=5)\n" -"# This creates a Task object and schedules its execution via the event loop.\n" +"# This creates a Task object and schedules its execution via the event " +"loop.\n" "task = asyncio.create_task(coroutine)" msgstr "" -msgid "Earlier, we manually created the event loop and set it to run forever. In practice, it's recommended to use (and common to see) :func:`asyncio.run`, which takes care of managing the event loop and ensuring the provided coroutine finishes before advancing. For example, many async programs follow this setup::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:191 +msgid "" +"Earlier, we manually created the event loop and set it to run forever. In " +"practice, it's recommended to use (and common to see) :func:`asyncio.run`, " +"which takes care of managing the event loop and ensuring the provided " +"coroutine finishes before advancing. For example, many async programs follow " +"this setup::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:197 msgid "" "import asyncio\n" "\n" @@ -193,9 +319,15 @@ msgid "" " print(\"coroutine main() is done!\")" msgstr "" -msgid "It's important to be aware that the task itself is not added to the event loop, only a callback to the task is. This matters if the task object you created is garbage collected before it's called by the event loop. For example, consider this program:" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:209 +msgid "" +"It's important to be aware that the task itself is not added to the event " +"loop, only a callback to the task is. This matters if the task object you " +"created is garbage collected before it's called by the event loop. For " +"example, consider this program:" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:215 msgid "" "async def hello():\n" " print(\"hello!\")\n" @@ -209,26 +341,50 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "Because there's no reference to the task object created on line 5, it *might* be garbage collected before the event loop invokes it. Later instructions in the coroutine ``main()`` hand control back to the event loop so it can invoke other jobs. When the event loop eventually tries to run the task, it might fail and discover the task object does not exist! This can also happen even if a coroutine keeps a reference to a task but completes before that task finishes. When the coroutine exits, local variables go out of scope and may be subject to garbage collection. In practice, ``asyncio`` and Python's garbage collector work pretty hard to ensure this sort of thing doesn't happen. But that's no reason to be reckless!" -msgstr "" - +#: ../../howto/a-conceptual-overview-of-asyncio.rst:229 +msgid "" +"Because there's no reference to the task object created on line 5, it " +"*might* be garbage collected before the event loop invokes it. Later " +"instructions in the coroutine ``main()`` hand control back to the event loop " +"so it can invoke other jobs. When the event loop eventually tries to run the " +"task, it might fail and discover the task object does not exist! This can " +"also happen even if a coroutine keeps a reference to a task but completes " +"before that task finishes. When the coroutine exits, local variables go out " +"of scope and may be subject to garbage collection. In practice, ``asyncio`` " +"and Python's garbage collector work pretty hard to ensure this sort of thing " +"doesn't happen. But that's no reason to be reckless!" +msgstr "" + +#: ../../howto/a-conceptual-overview-of-asyncio.rst:245 msgid "await" msgstr "" -msgid ":keyword:`await` is a Python keyword that's commonly used in one of two different ways::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:247 +msgid "" +":keyword:`await` is a Python keyword that's commonly used in one of two " +"different ways::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:250 msgid "" "await task\n" "await coroutine" msgstr "" -msgid "In a crucial way, the behavior of ``await`` depends on the type of object being awaited." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:253 +msgid "" +"In a crucial way, the behavior of ``await`` depends on the type of object " +"being awaited." msgstr "" -msgid "Awaiting a task will cede control from the current task or coroutine to the event loop. In the process of relinquishing control, a few important things happen. We'll use the following code example to illustrate::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:256 +msgid "" +"Awaiting a task will cede control from the current task or coroutine to the " +"event loop. In the process of relinquishing control, a few important things " +"happen. We'll use the following code example to illustrate::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:261 msgid "" "async def plant_a_tree():\n" " dig_the_hole_task = asyncio.create_task(dig_the_hole())\n" @@ -238,18 +394,42 @@ msgid "" " ..." msgstr "" -msgid "In this example, imagine the event loop has passed control to the start of the coroutine ``plant_a_tree()``. As seen above, the coroutine creates a task and then awaits it. The ``await dig_the_hole_task`` instruction adds a callback (which will resume ``plant_a_tree()``) to the ``dig_the_hole_task`` object's list of callbacks. And then, the instruction cedes control to the event loop. Some time later, the event loop will pass control to ``dig_the_hole_task`` and the task will finish whatever it needs to do. Once the task finishes, it will add its various callbacks to the event loop, in this case, a call to resume ``plant_a_tree()``." -msgstr "" - -msgid "Generally speaking, when the awaited task finishes (``dig_the_hole_task``), the original task or coroutine (``plant_a_tree()``) is added back to the event loop's to-do list to be resumed." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:268 +msgid "" +"In this example, imagine the event loop has passed control to the start of " +"the coroutine ``plant_a_tree()``. As seen above, the coroutine creates a " +"task and then awaits it. The ``await dig_the_hole_task`` instruction adds a " +"callback (which will resume ``plant_a_tree()``) to the ``dig_the_hole_task`` " +"object's list of callbacks. And then, the instruction cedes control to the " +"event loop. Some time later, the event loop will pass control to " +"``dig_the_hole_task`` and the task will finish whatever it needs to do. Once " +"the task finishes, it will add its various callbacks to the event loop, in " +"this case, a call to resume ``plant_a_tree()``." +msgstr "" + +#: ../../howto/a-conceptual-overview-of-asyncio.rst:279 +msgid "" +"Generally speaking, when the awaited task finishes (``dig_the_hole_task``), " +"the original task or coroutine (``plant_a_tree()``) is added back to the " +"event loop's to-do list to be resumed." msgstr "" -msgid "This is a basic, yet reliable mental model. In practice, the control handoffs are slightly more complex, but not by much. In part 2, we'll walk through the details that make this possible." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:283 +msgid "" +"This is a basic, yet reliable mental model. In practice, the control " +"handoffs are slightly more complex, but not by much. In part 2, we'll walk " +"through the details that make this possible." msgstr "" -msgid "**Unlike tasks, awaiting a coroutine does not hand control back to the event loop!** Wrapping a coroutine in a task first, then awaiting that would cede control. The behavior of ``await coroutine`` is effectively the same as invoking a regular, synchronous Python function. Consider this program::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:287 +msgid "" +"**Unlike tasks, awaiting a coroutine does not hand control back to the event " +"loop!** Wrapping a coroutine in a task first, then awaiting that would cede " +"control. The behavior of ``await coroutine`` is effectively the same as " +"invoking a regular, synchronous Python function. Consider this program::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:295 msgid "" "import asyncio\n" "\n" @@ -269,9 +449,16 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "The first statement in the coroutine ``main()`` creates ``task_b`` and schedules it for execution via the event loop. Then, ``coro_a()`` is repeatedly awaited. Control never cedes to the event loop, which is why we see the output of all three ``coro_a()`` invocations before ``coro_b()``'s output:" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:312 +msgid "" +"The first statement in the coroutine ``main()`` creates ``task_b`` and " +"schedules it for execution via the event loop. Then, ``coro_a()`` is " +"repeatedly awaited. Control never cedes to the event loop, which is why we " +"see the output of all three ``coro_a()`` invocations before ``coro_b()``'s " +"output:" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:318 msgid "" "I am coro_a(). Hi!\n" "I am coro_a(). Hi!\n" @@ -279,9 +466,16 @@ msgid "" "I am coro_b(). I sure hope no one hogs the event loop..." msgstr "" -msgid "If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, the behavior changes. The coroutine ``main()`` cedes control to the event loop with that statement. The event loop then proceeds through its backlog of work, calling ``task_b`` and then the task which wraps ``coro_a()`` before resuming the coroutine ``main()``." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:325 +msgid "" +"If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, " +"the behavior changes. The coroutine ``main()`` cedes control to the event " +"loop with that statement. The event loop then proceeds through its backlog " +"of work, calling ``task_b`` and then the task which wraps ``coro_a()`` " +"before resuming the coroutine ``main()``." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:332 msgid "" "I am coro_b(). I sure hope no one hogs the event loop...\n" "I am coro_a(). Hi!\n" @@ -289,27 +483,56 @@ msgid "" "I am coro_a(). Hi!" msgstr "" -msgid "This behavior of ``await coroutine`` can trip a lot of people up! That example highlights how using only ``await coroutine`` could unintentionally hog control from other tasks and effectively stall the event loop. :func:`asyncio.run` can help you detect such occurrences via the ``debug=True`` flag, which enables :ref:`debug mode `. Among other things, it will log any coroutines that monopolize execution for 100ms or longer." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:339 +msgid "" +"This behavior of ``await coroutine`` can trip a lot of people up! That " +"example highlights how using only ``await coroutine`` could unintentionally " +"hog control from other tasks and effectively stall the event " +"loop. :func:`asyncio.run` can help you detect such occurrences via the " +"``debug=True`` flag, which enables :ref:`debug mode `. " +"Among other things, it will log any coroutines that monopolize execution for " +"100ms or longer." msgstr "" -msgid "The design intentionally trades off some conceptual clarity around usage of ``await`` for improved performance. Each time a task is awaited, control needs to be passed all the way up the call stack to the event loop. That might sound minor, but in a large program with many ``await`` statements and a deep call stack, that overhead can add up to a meaningful performance drag." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:349 +msgid "" +"The design intentionally trades off some conceptual clarity around usage of " +"``await`` for improved performance. Each time a task is awaited, control " +"needs to be passed all the way up the call stack to the event loop. That " +"might sound minor, but in a large program with many ``await`` statements and " +"a deep call stack, that overhead can add up to a meaningful performance drag." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:358 msgid "A conceptual overview part 2: the nuts and bolts" msgstr "" -msgid "Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage control flow. This is where the magic happens. You'll come away from this section knowing what ``await`` does behind the scenes and how to make your own asynchronous operators." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:360 +msgid "" +"Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage " +"control flow. This is where the magic happens. You'll come away from this " +"section knowing what ``await`` does behind the scenes and how to make your " +"own asynchronous operators." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:368 msgid "The inner workings of coroutines" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:370 msgid ":mod:`!asyncio` leverages four components to pass around control." msgstr "" -msgid ":meth:`coroutine.send(arg) ` is the method used to start or resume a coroutine. If the coroutine was paused and is now being resumed, the argument ``arg`` will be sent in as the return value of the ``yield`` statement which originally paused it. If the coroutine is being used for the first time (as opposed to being resumed), ``arg`` must be ``None``." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:372 +msgid "" +":meth:`coroutine.send(arg) ` is the method used to start or " +"resume a coroutine. If the coroutine was paused and is now being resumed, " +"the argument ``arg`` will be sent in as the return value of the ``yield`` " +"statement which originally paused it. If the coroutine is being used for the " +"first time (as opposed to being resumed), ``arg`` must be ``None``." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:380 msgid "" "class Rock:\n" " def __await__(self):\n" @@ -327,7 +550,8 @@ msgid "" "\n" "coroutine = main()\n" "intermediate_result = coroutine.send(None)\n" -"print(f\"Coroutine paused and returned intermediate value: {intermediate_result}.\")\n" +"print(f\"Coroutine paused and returned intermediate value: " +"{intermediate_result}.\")\n" "\n" "print(f\"Resuming coroutine and sending in value: 42.\")\n" "try:\n" @@ -337,15 +561,31 @@ msgid "" "print(f\"Coroutine main() finished and provided value: {returned_value}.\")" msgstr "" -msgid ":ref:`yield `, as usual, pauses execution and returns control to the caller. In the example above, the ``yield``, on line 3, is called by ``... = await rock`` on line 11. More broadly speaking, ``await`` calls the :meth:`~object.__await__` method of the given object. ``await`` also does one more very special thing: it propagates (or \"passes along\") any ``yield``\\ s it receives up the call chain. In this case, that's back to ``... = coroutine.send(None)`` on line 16." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:408 +msgid "" +":ref:`yield `, as usual, pauses execution and returns control to " +"the caller. In the example above, the ``yield``, on line 3, is called by " +"``... = await rock`` on line 11. More broadly speaking, ``await`` calls " +"the :meth:`~object.__await__` method of the given object. ``await`` also " +"does one more very special thing: it propagates (or \"passes along\") any " +"``yield``\\ s it receives up the call chain. In this case, that's back to " +"``... = coroutine.send(None)`` on line 16." msgstr "" -msgid "The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The coroutine picks back up from where it ``yield``\\ ed (or paused) on line 3 and executes the remaining statements in its body. When a coroutine finishes, it raises a :exc:`StopIteration` exception with the return value attached in the :attr:`~StopIteration.value` attribute." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:418 +msgid "" +"The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The " +"coroutine picks back up from where it ``yield``\\ ed (or paused) on line 3 " +"and executes the remaining statements in its body. When a coroutine " +"finishes, it raises a :exc:`StopIteration` exception with the return value " +"attached in the :attr:`~StopIteration.value` attribute." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:424 msgid "That snippet produces this output:" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:426 msgid "" "Beginning coroutine main().\n" "Awaiting rock...\n" @@ -356,42 +596,96 @@ msgid "" "Coroutine main() finished and provided value: 23." msgstr "" -msgid "It's worth pausing for a moment here and making sure you followed the various ways that control flow and values were passed. A lot of important ideas were covered and it's worth ensuring your understanding is firm." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:436 +msgid "" +"It's worth pausing for a moment here and making sure you followed the " +"various ways that control flow and values were passed. A lot of important " +"ideas were covered and it's worth ensuring your understanding is firm." msgstr "" -msgid "The only way to yield (or effectively cede control) from a coroutine is to ``await`` an object that ``yield``\\ s in its ``__await__`` method. That might sound odd to you. You might be thinking:" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:440 +msgid "" +"The only way to yield (or effectively cede control) from a coroutine is to " +"``await`` an object that ``yield``\\ s in its ``__await__`` method. That " +"might sound odd to you. You might be thinking:" msgstr "" -msgid "1. What about a ``yield`` directly within the coroutine function? The coroutine function becomes an :ref:`async generator function `, a different beast entirely." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:444 +msgid "" +"1. What about a ``yield`` directly within the coroutine function? The " +"coroutine function becomes an :ref:`async generator function `, a different beast entirely." msgstr "" -msgid "2. What about a :ref:`yield from ` within the coroutine function to a (plain) generator? That causes the error: ``SyntaxError: yield from not allowed in a coroutine.`` This was intentionally designed for the sake of simplicity -- mandating only one way of using coroutines. Initially ``yield`` was barred as well, but was re-accepted to allow for async generators. Despite that, ``yield from`` and ``await`` effectively do the same thing." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:449 +msgid "" +"2. What about a :ref:`yield from ` within the coroutine function " +"to a (plain) generator? That causes the error: ``SyntaxError: yield from not " +"allowed in a coroutine.`` This was intentionally designed for the sake of " +"simplicity -- mandating only one way of using coroutines. Initially " +"``yield`` was barred as well, but was re-accepted to allow for async " +"generators. Despite that, ``yield from`` and ``await`` effectively do the " +"same thing." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:460 msgid "Futures" msgstr "" -msgid "A :ref:`future ` is an object meant to represent a computation's status and result. The term is a nod to the idea of something still to come or not yet happened, and the object is a way to keep an eye on that something." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:462 +msgid "" +"A :ref:`future ` is an object meant to represent a " +"computation's status and result. The term is a nod to the idea of something " +"still to come or not yet happened, and the object is a way to keep an eye on " +"that something." msgstr "" -msgid "A future has a few important attributes. One is its state, which can be either \"pending\", \"cancelled\", or \"done\". Another is its result, which is set when the state transitions to done. Unlike a coroutine, a future does not represent the actual computation to be done; instead, it represents the status and result of that computation, kind of like a status light (red, yellow, or green) or indicator." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:467 +msgid "" +"A future has a few important attributes. One is its state, which can be " +"either \"pending\", \"cancelled\", or \"done\". Another is its result, which " +"is set when the state transitions to done. Unlike a coroutine, a future does " +"not represent the actual computation to be done; instead, it represents the " +"status and result of that computation, kind of like a status light (red, " +"yellow, or green) or indicator." msgstr "" -msgid ":class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain these various capabilities. The prior section said tasks store a list of callbacks, which wasn't entirely accurate. It's actually the ``Future`` class that implements this logic, which ``Task`` inherits." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:474 +msgid "" +":class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain " +"these various capabilities. The prior section said tasks store a list of " +"callbacks, which wasn't entirely accurate. It's actually the ``Future`` " +"class that implements this logic, which ``Task`` inherits." msgstr "" -msgid "Futures may also be used directly (not via tasks). Tasks mark themselves as done when their coroutine is complete. Futures are much more versatile and will be marked as done when you say so. In this way, they're the flexible interface for you to make your own conditions for waiting and resuming." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:481 +msgid "" +"Futures may also be used directly (not via tasks). Tasks mark themselves as " +"done when their coroutine is complete. Futures are much more versatile and " +"will be marked as done when you say so. In this way, they're the flexible " +"interface for you to make your own conditions for waiting and resuming." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:489 msgid "A homemade asyncio.sleep" msgstr "" -msgid "We'll go through an example of how you could leverage a future to create your own variant of asynchronous sleep (``async_sleep``) which mimics :func:`asyncio.sleep`." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:491 +msgid "" +"We'll go through an example of how you could leverage a future to create " +"your own variant of asynchronous sleep (``async_sleep``) which " +"mimics :func:`asyncio.sleep`." msgstr "" -msgid "This snippet registers a few tasks with the event loop and then awaits the task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` coroutine. We want that task to finish only after three seconds have elapsed, but without preventing other tasks from running." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:495 +msgid "" +"This snippet registers a few tasks with the event loop and then awaits the " +"task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` " +"coroutine. We want that task to finish only after three seconds have " +"elapsed, but without preventing other tasks from running." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:502 msgid "" "async def other_work():\n" " print(\"I like work. Work work.\")\n" @@ -417,25 +711,53 @@ msgid "" " await asyncio.gather(*work_tasks)" msgstr "" -msgid "Below, we use a future to enable custom control over when that task will be marked as done. If :meth:`future.set_result() ` (the method responsible for marking that future as done) is never called, then this task will never finish. We've also enlisted the help of another task, which we'll see in a moment, that will monitor how much time has elapsed and, accordingly, call ``future.set_result()``." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:526 +msgid "" +"Below, we use a future to enable custom control over when that task will be " +"marked as done. If :meth:`future.set_result() ` " +"(the method responsible for marking that future as done) is never called, " +"then this task will never finish. We've also enlisted the help of another " +"task, which we'll see in a moment, that will monitor how much time has " +"elapsed and, accordingly, call ``future.set_result()``." msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:537 msgid "" "async def async_sleep(seconds: float):\n" " future = asyncio.Future()\n" " time_to_wake = time.time() + seconds\n" " # Add the watcher-task to the event loop.\n" -" watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake))\n" +" watcher_task = asyncio.create_task(_sleep_watcher(future, " +"time_to_wake))\n" " # Block until the future is marked as done.\n" " await future" msgstr "" -msgid "Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield`` from its ``__await__`` method, ceding control to the event loop. This is effectively the same as calling ``asyncio.sleep(0)``, but this approach offers more clarity, not to mention it's somewhat cheating to use ``asyncio.sleep`` when showcasing how to implement it!" -msgstr "" - -msgid "As usual, the event loop cycles through its tasks, giving them control and receiving control back when they pause or finish. The ``watcher_task``, which runs the coroutine ``_sleep_watcher(...)``, will be invoked once per full cycle of the event loop. On each resumption, it'll check the time and if not enough has elapsed, then it'll pause once again and hand control back to the event loop. Once enough time has elapsed, ``_sleep_watcher(...)`` marks the future as done and completes by exiting its infinite ``while`` loop. Given this helper task is only invoked once per cycle of the event loop, you'd be correct to note that this asynchronous sleep will sleep *at least* three seconds, rather than exactly three seconds. Note this is also true of ``asyncio.sleep``." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:545 +msgid "" +"Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield`` from " +"its ``__await__`` method, ceding control to the event loop. This is " +"effectively the same as calling ``asyncio.sleep(0)``, but this approach " +"offers more clarity, not to mention it's somewhat cheating to use " +"``asyncio.sleep`` when showcasing how to implement it!" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:551 +msgid "" +"As usual, the event loop cycles through its tasks, giving them control and " +"receiving control back when they pause or finish. The ``watcher_task``, " +"which runs the coroutine ``_sleep_watcher(...)``, will be invoked once per " +"full cycle of the event loop. On each resumption, it'll check the time and " +"if not enough has elapsed, then it'll pause once again and hand control back " +"to the event loop. Once enough time has elapsed, ``_sleep_watcher(...)`` " +"marks the future as done and completes by exiting its infinite ``while`` " +"loop. Given this helper task is only invoked once per cycle of the event " +"loop, you'd be correct to note that this asynchronous sleep will sleep *at " +"least* three seconds, rather than exactly three seconds. Note this is also " +"true of ``asyncio.sleep``." +msgstr "" + +#: ../../howto/a-conceptual-overview-of-asyncio.rst:567 msgid "" "class YieldToEventLoop:\n" " def __await__(self):\n" @@ -451,9 +773,11 @@ msgid "" " await YieldToEventLoop()" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:580 msgid "Here is the full program's output:" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:582 msgid "" "$ python custom-async-sleep.py\n" "Beginning asynchronous sleep at time: 14:52:22.\n" @@ -463,9 +787,16 @@ msgid "" "Done asynchronous sleep at time: 14:52:25." msgstr "" -msgid "You might feel this implementation of asynchronous sleep was unnecessarily convoluted. And, well, it was. The example was meant to showcase the versatility of futures with a simple example that could be mimicked for more complex needs. For reference, you could implement it without futures, like so::" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:591 +msgid "" +"You might feel this implementation of asynchronous sleep was unnecessarily " +"convoluted. And, well, it was. The example was meant to showcase the " +"versatility of futures with a simple example that could be mimicked for more " +"complex needs. For reference, you could implement it without futures, like " +"so::" msgstr "" +#: ../../howto/a-conceptual-overview-of-asyncio.rst:598 msgid "" "async def simpler_async_sleep(seconds):\n" " time_to_wake = time.time() + seconds\n" @@ -476,5 +807,9 @@ msgid "" " await YieldToEventLoop()" msgstr "" -msgid "But that's all for now. Hopefully you're ready to more confidently dive into some async programming or check out advanced topics in the :mod:`rest of the documentation `." +#: ../../howto/a-conceptual-overview-of-asyncio.rst:606 +msgid "" +"But that's all for now. Hopefully you're ready to more confidently dive into " +"some async programming or check out advanced topics in the :mod:`rest of the " +"documentation `." msgstr "" diff --git a/howto/annotations.po b/howto/annotations.po index e58543d8c..7f2959f3b 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,57 +24,127 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/annotations.rst:5 msgid "Annotations Best Practices" msgstr "" +#: ../../howto/annotations.rst:0 msgid "author" msgstr "" +#: ../../howto/annotations.rst:7 msgid "Larry Hastings" msgstr "" +#: ../../howto/annotations.rst:-1 msgid "Abstract" msgstr "" -msgid "This document is designed to encapsulate the best practices for working with annotations dicts. If you write Python code that examines ``__annotations__`` on Python objects, we encourage you to follow the guidelines described below." +#: ../../howto/annotations.rst:11 +msgid "" +"This document is designed to encapsulate the best practices for working with " +"annotations dicts. If you write Python code that examines " +"``__annotations__`` on Python objects, we encourage you to follow the " +"guidelines described below." msgstr "" -msgid "The document is organized into four sections: best practices for accessing the annotations of an object in Python versions 3.10 and newer, best practices for accessing the annotations of an object in Python versions 3.9 and older, other best practices for ``__annotations__`` that apply to any Python version, and quirks of ``__annotations__``." +#: ../../howto/annotations.rst:16 +msgid "" +"The document is organized into four sections: best practices for accessing " +"the annotations of an object in Python versions 3.10 and newer, best " +"practices for accessing the annotations of an object in Python versions 3.9 " +"and older, other best practices for ``__annotations__`` that apply to any " +"Python version, and quirks of ``__annotations__``." msgstr "" -msgid "Note that this document is specifically about working with ``__annotations__``, not uses *for* annotations. If you're looking for information on how to use \"type hints\" in your code, please see the :mod:`typing` module." +#: ../../howto/annotations.rst:26 +msgid "" +"Note that this document is specifically about working with " +"``__annotations__``, not uses *for* annotations. If you're looking for " +"information on how to use \"type hints\" in your code, please see " +"the :mod:`typing` module." msgstr "" +#: ../../howto/annotations.rst:33 msgid "Accessing The Annotations Dict Of An Object In Python 3.10 And Newer" msgstr "" -msgid "Python 3.10 adds a new function to the standard library: :func:`inspect.get_annotations`. In Python versions 3.10 through 3.13, calling this function is the best practice for accessing the annotations dict of any object that supports annotations. This function can also \"un-stringize\" stringized annotations for you." +#: ../../howto/annotations.rst:35 +msgid "" +"Python 3.10 adds a new function to the standard " +"library: :func:`inspect.get_annotations`. In Python versions 3.10 through " +"3.13, calling this function is the best practice for accessing the " +"annotations dict of any object that supports annotations. This function can " +"also \"un-stringize\" stringized annotations for you." msgstr "" -msgid "In Python 3.14, there is a new :mod:`annotationlib` module with functionality for working with annotations. This includes a :func:`annotationlib.get_annotations` function, which supersedes :func:`inspect.get_annotations`." +#: ../../howto/annotations.rst:42 +msgid "" +"In Python 3.14, there is a new :mod:`annotationlib` module with " +"functionality for working with annotations. This includes " +"a :func:`annotationlib.get_annotations` function, which " +"supersedes :func:`inspect.get_annotations`." msgstr "" -msgid "If for some reason :func:`inspect.get_annotations` isn't viable for your use case, you may access the ``__annotations__`` data member manually. Best practice for this changed in Python 3.10 as well: as of Python 3.10, ``o.__annotations__`` is guaranteed to *always* work on Python functions, classes, and modules. If you're certain the object you're examining is one of these three *specific* objects, you may simply use ``o.__annotations__`` to get at the object's annotations dict." +#: ../../howto/annotations.rst:47 +msgid "" +"If for some reason :func:`inspect.get_annotations` isn't viable for your use " +"case, you may access the ``__annotations__`` data member manually. Best " +"practice for this changed in Python 3.10 as well: as of Python 3.10, " +"``o.__annotations__`` is guaranteed to *always* work on Python functions, " +"classes, and modules. If you're certain the object you're examining is one " +"of these three *specific* objects, you may simply use ``o.__annotations__`` " +"to get at the object's annotations dict." msgstr "" -msgid "However, other types of callables--for example, callables created by :func:`functools.partial`--may not have an ``__annotations__`` attribute defined. When accessing the ``__annotations__`` of a possibly unknown object, best practice in Python versions 3.10 and newer is to call :func:`getattr` with three arguments, for example ``getattr(o, '__annotations__', None)``." +#: ../../howto/annotations.rst:57 +msgid "" +"However, other types of callables--for example, callables created " +"by :func:`functools.partial`--may not have an ``__annotations__`` attribute " +"defined. When accessing the ``__annotations__`` of a possibly unknown " +"object, best practice in Python versions 3.10 and newer is to " +"call :func:`getattr` with three arguments, for example ``getattr(o, " +"'__annotations__', None)``." msgstr "" -msgid "Before Python 3.10, accessing ``__annotations__`` on a class that defines no annotations but that has a parent class with annotations would return the parent's ``__annotations__``. In Python 3.10 and newer, the child class's annotations will be an empty dict instead." +#: ../../howto/annotations.rst:65 +msgid "" +"Before Python 3.10, accessing ``__annotations__`` on a class that defines no " +"annotations but that has a parent class with annotations would return the " +"parent's ``__annotations__``. In Python 3.10 and newer, the child class's " +"annotations will be an empty dict instead." msgstr "" +#: ../../howto/annotations.rst:73 msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older" msgstr "" -msgid "In Python 3.9 and older, accessing the annotations dict of an object is much more complicated than in newer versions. The problem is a design flaw in these older versions of Python, specifically to do with class annotations." +#: ../../howto/annotations.rst:75 +msgid "" +"In Python 3.9 and older, accessing the annotations dict of an object is much " +"more complicated than in newer versions. The problem is a design flaw in " +"these older versions of Python, specifically to do with class annotations." msgstr "" -msgid "Best practice for accessing the annotations dict of other objects--functions, other callables, and modules--is the same as best practice for 3.10, assuming you aren't calling :func:`inspect.get_annotations`: you should use three-argument :func:`getattr` to access the object's ``__annotations__`` attribute." +#: ../../howto/annotations.rst:80 +msgid "" +"Best practice for accessing the annotations dict of other objects--" +"functions, other callables, and modules--is the same as best practice for " +"3.10, assuming you aren't calling :func:`inspect.get_annotations`: you " +"should use three-argument :func:`getattr` to access the object's " +"``__annotations__`` attribute." msgstr "" -msgid "Unfortunately, this isn't best practice for classes. The problem is that, since ``__annotations__`` is optional on classes, and because classes can inherit attributes from their base classes, accessing the ``__annotations__`` attribute of a class may inadvertently return the annotations dict of a *base class.* As an example::" +#: ../../howto/annotations.rst:87 +msgid "" +"Unfortunately, this isn't best practice for classes. The problem is that, " +"since ``__annotations__`` is optional on classes, and because classes can " +"inherit attributes from their base classes, accessing the " +"``__annotations__`` attribute of a class may inadvertently return the " +"annotations dict of a *base class.* As an example::" msgstr "" +#: ../../howto/annotations.rst:94 msgid "" "class Base:\n" " a: int = 3\n" @@ -86,15 +156,28 @@ msgid "" "print(Derived.__annotations__)" msgstr "" +#: ../../howto/annotations.rst:103 msgid "This will print the annotations dict from ``Base``, not ``Derived``." msgstr "" -msgid "Your code will have to have a separate code path if the object you're examining is a class (``isinstance(o, type)``). In that case, best practice relies on an implementation detail of Python 3.9 and before: if a class has annotations defined, they are stored in the class's :attr:`~type.__dict__` dictionary. Since the class may or may not have annotations defined, best practice is to call the :meth:`~dict.get` method on the class dict." +#: ../../howto/annotations.rst:106 +msgid "" +"Your code will have to have a separate code path if the object you're " +"examining is a class (``isinstance(o, type)``). In that case, best practice " +"relies on an implementation detail of Python 3.9 and before: if a class has " +"annotations defined, they are stored in the class's :attr:`~type.__dict__` " +"dictionary. Since the class may or may not have annotations defined, best " +"practice is to call the :meth:`~dict.get` method on the class dict." msgstr "" -msgid "To put it all together, here is some sample code that safely accesses the ``__annotations__`` attribute on an arbitrary object in Python 3.9 and before::" +#: ../../howto/annotations.rst:114 +msgid "" +"To put it all together, here is some sample code that safely accesses the " +"``__annotations__`` attribute on an arbitrary object in Python 3.9 and " +"before::" msgstr "" +#: ../../howto/annotations.rst:118 msgid "" "if isinstance(o, type):\n" " ann = o.__dict__.get('__annotations__', None)\n" @@ -102,84 +185,185 @@ msgid "" " ann = getattr(o, '__annotations__', None)" msgstr "" -msgid "After running this code, ``ann`` should be either a dictionary or ``None``. You're encouraged to double-check the type of ``ann`` using :func:`isinstance` before further examination." +#: ../../howto/annotations.rst:123 +msgid "" +"After running this code, ``ann`` should be either a dictionary or ``None``. " +"You're encouraged to double-check the type of ``ann`` " +"using :func:`isinstance` before further examination." msgstr "" -msgid "Note that some exotic or malformed type objects may not have a :attr:`~type.__dict__` attribute, so for extra safety you may also wish to use :func:`getattr` to access :attr:`!__dict__`." +#: ../../howto/annotations.rst:128 +msgid "" +"Note that some exotic or malformed type objects may not have " +"a :attr:`~type.__dict__` attribute, so for extra safety you may also wish to " +"use :func:`getattr` to access :attr:`!__dict__`." msgstr "" +#: ../../howto/annotations.rst:134 msgid "Manually Un-Stringizing Stringized Annotations" msgstr "" -msgid "In situations where some annotations may be \"stringized\", and you wish to evaluate those strings to produce the Python values they represent, it really is best to call :func:`inspect.get_annotations` to do this work for you." +#: ../../howto/annotations.rst:136 +msgid "" +"In situations where some annotations may be \"stringized\", and you wish to " +"evaluate those strings to produce the Python values they represent, it " +"really is best to call :func:`inspect.get_annotations` to do this work for " +"you." msgstr "" -msgid "If you're using Python 3.9 or older, or if for some reason you can't use :func:`inspect.get_annotations`, you'll need to duplicate its logic. You're encouraged to examine the implementation of :func:`inspect.get_annotations` in the current Python version and follow a similar approach." +#: ../../howto/annotations.rst:142 +msgid "" +"If you're using Python 3.9 or older, or if for some reason you can't " +"use :func:`inspect.get_annotations`, you'll need to duplicate its logic. " +"You're encouraged to examine the implementation " +"of :func:`inspect.get_annotations` in the current Python version and follow " +"a similar approach." msgstr "" -msgid "In a nutshell, if you wish to evaluate a stringized annotation on an arbitrary object ``o``:" +#: ../../howto/annotations.rst:148 +msgid "" +"In a nutshell, if you wish to evaluate a stringized annotation on an " +"arbitrary object ``o``:" msgstr "" -msgid "If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when calling :func:`eval`." +#: ../../howto/annotations.rst:151 +msgid "" +"If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when " +"calling :func:`eval`." msgstr "" -msgid "If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the ``globals``, and ``dict(vars(o))`` as the ``locals``, when calling :func:`eval`." +#: ../../howto/annotations.rst:153 +msgid "" +"If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the " +"``globals``, and ``dict(vars(o))`` as the ``locals``, when " +"calling :func:`eval`." msgstr "" -msgid "If ``o`` is a wrapped callable using :func:`functools.update_wrapper`, :func:`functools.wraps`, or :func:`functools.partial`, iteratively unwrap it by accessing either ``o.__wrapped__`` or ``o.func`` as appropriate, until you have found the root unwrapped function." +#: ../../howto/annotations.rst:156 +msgid "" +"If ``o`` is a wrapped callable " +"using :func:`functools.update_wrapper`, :deco:`functools.wraps`, " +"or :func:`functools.partial`, iteratively unwrap it by accessing either " +"``o.__wrapped__`` or ``o.func`` as appropriate, until you have found the " +"root unwrapped function." msgstr "" -msgid "If ``o`` is a callable (but not a class), use :attr:`o.__globals__ ` as the globals when calling :func:`eval`." +#: ../../howto/annotations.rst:160 +msgid "" +"If ``o`` is a callable (but not a class), use :attr:`o.__globals__ " +"` as the globals when calling :func:`eval`." msgstr "" -msgid "However, not all string values used as annotations can be successfully turned into Python values by :func:`eval`. String values could theoretically contain any valid string, and in practice there are valid use cases for type hints that require annotating with string values that specifically *can't* be evaluated. For example:" +#: ../../howto/annotations.rst:164 +msgid "" +"However, not all string values used as annotations can be successfully " +"turned into Python values by :func:`eval`. String values could theoretically " +"contain any valid string, and in practice there are valid use cases for type " +"hints that require annotating with string values that specifically *can't* " +"be evaluated. For example:" msgstr "" -msgid ":pep:`604` union types using ``|``, before support for this was added to Python 3.10." +#: ../../howto/annotations.rst:171 +msgid "" +":pep:`604` union types using ``|``, before support for this was added to " +"Python 3.10." msgstr "" -msgid "Definitions that aren't needed at runtime, only imported when :const:`typing.TYPE_CHECKING` is true." +#: ../../howto/annotations.rst:173 +msgid "" +"Definitions that aren't needed at runtime, only imported " +"when :const:`typing.TYPE_CHECKING` is true." msgstr "" -msgid "If :func:`eval` attempts to evaluate such values, it will fail and raise an exception. So, when designing a library API that works with annotations, it's recommended to only attempt to evaluate string values when explicitly requested to by the caller." +#: ../../howto/annotations.rst:176 +msgid "" +"If :func:`eval` attempts to evaluate such values, it will fail and raise an " +"exception. So, when designing a library API that works with annotations, " +"it's recommended to only attempt to evaluate string values when explicitly " +"requested to by the caller." msgstr "" +#: ../../howto/annotations.rst:184 msgid "Best Practices For ``__annotations__`` In Any Python Version" msgstr "" -msgid "You should avoid assigning to the ``__annotations__`` member of objects directly. Let Python manage setting ``__annotations__``." +#: ../../howto/annotations.rst:186 +msgid "" +"You should avoid assigning to the ``__annotations__`` member of objects " +"directly. Let Python manage setting ``__annotations__``." msgstr "" -msgid "If you do assign directly to the ``__annotations__`` member of an object, you should always set it to a ``dict`` object." +#: ../../howto/annotations.rst:189 +msgid "" +"If you do assign directly to the ``__annotations__`` member of an object, " +"you should always set it to a ``dict`` object." msgstr "" -msgid "You should avoid accessing ``__annotations__`` directly on any object. Instead, use :func:`annotationlib.get_annotations` (Python 3.14+) or :func:`inspect.get_annotations` (Python 3.10+)." +#: ../../howto/annotations.rst:192 +msgid "" +"You should avoid accessing ``__annotations__`` directly on any object. " +"Instead, use :func:`annotationlib.get_annotations` (Python 3.14+) " +"or :func:`inspect.get_annotations` (Python 3.10+)." msgstr "" -msgid "If you do directly access the ``__annotations__`` member of an object, you should ensure that it's a dictionary before attempting to examine its contents." +#: ../../howto/annotations.rst:196 +msgid "" +"If you do directly access the ``__annotations__`` member of an object, you " +"should ensure that it's a dictionary before attempting to examine its " +"contents." msgstr "" +#: ../../howto/annotations.rst:200 msgid "You should avoid modifying ``__annotations__`` dicts." msgstr "" -msgid "You should avoid deleting the ``__annotations__`` attribute of an object." +#: ../../howto/annotations.rst:202 +msgid "" +"You should avoid deleting the ``__annotations__`` attribute of an object." msgstr "" +#: ../../howto/annotations.rst:207 msgid "``__annotations__`` Quirks" msgstr "" -msgid "In all versions of Python 3, function objects lazy-create an annotations dict if no annotations are defined on that object. You can delete the ``__annotations__`` attribute using ``del fn.__annotations__``, but if you then access ``fn.__annotations__`` the object will create a new empty dict that it will store and return as its annotations. Deleting the annotations on a function before it has lazily created its annotations dict will throw an ``AttributeError``; using ``del fn.__annotations__`` twice in a row is guaranteed to always throw an ``AttributeError``." +#: ../../howto/annotations.rst:209 +msgid "" +"In all versions of Python 3, function objects lazy-create an annotations " +"dict if no annotations are defined on that object. You can delete the " +"``__annotations__`` attribute using ``del fn.__annotations__``, but if you " +"then access ``fn.__annotations__`` the object will create a new empty dict " +"that it will store and return as its annotations. Deleting the annotations " +"on a function before it has lazily created its annotations dict will throw " +"an ``AttributeError``; using ``del fn.__annotations__`` twice in a row is " +"guaranteed to always throw an ``AttributeError``." msgstr "" -msgid "Everything in the above paragraph also applies to class and module objects in Python 3.10 and newer." +#: ../../howto/annotations.rst:219 +msgid "" +"Everything in the above paragraph also applies to class and module objects " +"in Python 3.10 and newer." msgstr "" -msgid "In all versions of Python 3, you can set ``__annotations__`` on a function object to ``None``. However, subsequently accessing the annotations on that object using ``fn.__annotations__`` will lazy-create an empty dictionary as per the first paragraph of this section. This is *not* true of modules and classes, in any Python version; those objects permit setting ``__annotations__`` to any Python value, and will retain whatever value is set." +#: ../../howto/annotations.rst:222 +msgid "" +"In all versions of Python 3, you can set ``__annotations__`` on a function " +"object to ``None``. However, subsequently accessing the annotations on that " +"object using ``fn.__annotations__`` will lazy-create an empty dictionary as " +"per the first paragraph of this section. This is *not* true of modules and " +"classes, in any Python version; those objects permit setting " +"``__annotations__`` to any Python value, and will retain whatever value is " +"set." msgstr "" -msgid "If Python stringizes your annotations for you (using ``from __future__ import annotations``), and you specify a string as an annotation, the string will itself be quoted. In effect the annotation is quoted *twice.* For example::" +#: ../../howto/annotations.rst:230 +msgid "" +"If Python stringizes your annotations for you (using ``from __future__ " +"import annotations``), and you specify a string as an annotation, the string " +"will itself be quoted. In effect the annotation is quoted *twice.* For " +"example::" msgstr "" +#: ../../howto/annotations.rst:236 msgid "" "from __future__ import annotations\n" "def foo(a: \"str\"): pass\n" @@ -187,11 +371,29 @@ msgid "" "print(foo.__annotations__)" msgstr "" -msgid "This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a \"quirk\"; it's mentioned here simply because it might be surprising." +#: ../../howto/annotations.rst:241 +msgid "" +"This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a " +"\"quirk\"; it's mentioned here simply because it might be surprising." msgstr "" -msgid "If you use a class with a custom metaclass and access ``__annotations__`` on the class, you may observe unexpected behavior; see :pep:`749 <749#pep749-metaclasses>` for some examples. You can avoid these quirks by using :func:`annotationlib.get_annotations` on Python 3.14+ or :func:`inspect.get_annotations` on Python 3.10+. On earlier versions of Python, you can avoid these bugs by accessing the annotations from the class's :attr:`~type.__dict__` (for example, ``cls.__dict__.get('__annotations__', None)``)." +#: ../../howto/annotations.rst:244 +msgid "" +"If you use a class with a custom metaclass and access ``__annotations__`` on " +"the class, you may observe unexpected behavior; see :pep:`749 <749#pep749-" +"metaclasses>` for some examples. You can avoid these quirks by " +"using :func:`annotationlib.get_annotations` on Python 3.14+ " +"or :func:`inspect.get_annotations` on Python 3.10+. On earlier versions of " +"Python, you can avoid these bugs by accessing the annotations from the " +"class's :attr:`~type.__dict__` (for example, " +"``cls.__dict__.get('__annotations__', None)``)." msgstr "" -msgid "In some versions of Python, instances of classes may have an ``__annotations__`` attribute. However, this is not supported functionality. If you need the annotations of an instance, you can use :func:`type` to access its class (for example, ``annotationlib.get_annotations(type(myinstance))`` on Python 3.14+)." +#: ../../howto/annotations.rst:253 +msgid "" +"In some versions of Python, instances of classes may have an " +"``__annotations__`` attribute. However, this is not supported functionality. " +"If you need the annotations of an instance, you can use :func:`type` to " +"access its class (for example, " +"``annotationlib.get_annotations(type(myinstance))`` on Python 3.14+)." msgstr "" diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po index aeddc61ec..b06686c1c 100644 --- a/howto/argparse-optparse.po +++ b/howto/argparse-optparse.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-10-11 14:19+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,62 +23,120 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/argparse-optparse.rst:8 msgid "Migrating ``optparse`` code to ``argparse``" msgstr "" -msgid "The :mod:`argparse` module offers several higher level features not natively provided by the :mod:`optparse` module, including:" +#: ../../howto/argparse-optparse.rst:10 +msgid "" +"The :mod:`argparse` module offers several higher level features not natively " +"provided by the :mod:`optparse` module, including:" msgstr "" +#: ../../howto/argparse-optparse.rst:13 msgid "Handling positional arguments." msgstr "" +#: ../../howto/argparse-optparse.rst:14 msgid "Supporting subcommands." msgstr "" +#: ../../howto/argparse-optparse.rst:15 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "" +#: ../../howto/argparse-optparse.rst:16 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" +#: ../../howto/argparse-optparse.rst:17 msgid "Producing more informative usage messages." msgstr "" +#: ../../howto/argparse-optparse.rst:18 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" -msgid "Originally, the :mod:`argparse` module attempted to maintain compatibility with :mod:`optparse`. However, the fundamental design differences between supporting declarative command line option processing (while leaving positional argument processing to application code), and supporting both named options and positional arguments in the declarative interface mean that the API has diverged from that of ``optparse`` over time." +#: ../../howto/argparse-optparse.rst:20 +msgid "" +"Originally, the :mod:`argparse` module attempted to maintain compatibility " +"with :mod:`optparse`. However, the fundamental design differences between " +"supporting declarative command line option processing (while leaving " +"positional argument processing to application code), and supporting both " +"named options and positional arguments in the declarative interface mean " +"that the API has diverged from that of ``optparse`` over time." msgstr "" -msgid "As described in :ref:`choosing-an-argument-parser`, applications that are currently using :mod:`optparse` and are happy with the way it works can just continue to use ``optparse``." +#: ../../howto/argparse-optparse.rst:27 +msgid "" +"As described in :ref:`choosing-an-argument-parser`, applications that are " +"currently using :mod:`optparse` and are happy with the way it works can just " +"continue to use ``optparse``." msgstr "" -msgid "Application developers that are considering migrating should also review the list of intrinsic behavioural differences described in that section before deciding whether or not migration is desirable." +#: ../../howto/argparse-optparse.rst:31 +msgid "" +"Application developers that are considering migrating should also review the " +"list of intrinsic behavioural differences described in that section before " +"deciding whether or not migration is desirable." msgstr "" -msgid "For applications that do choose to migrate from :mod:`optparse` to :mod:`argparse`, the following suggestions should be helpful:" +#: ../../howto/argparse-optparse.rst:35 +msgid "" +"For applications that do choose to migrate from :mod:`optparse` " +"to :mod:`argparse`, the following suggestions should be helpful:" msgstr "" -msgid "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:`ArgumentParser.add_argument` calls." +#: ../../howto/argparse-optparse.rst:38 +msgid "" +"Replace all :meth:`optparse.OptionParser.add_option` calls " +"with :meth:`ArgumentParser.add_argument` calls." msgstr "" -msgid "Replace ``(options, args) = parser.parse_args()`` with ``args = parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls for the positional arguments. Keep in mind that what was previously called ``options``, now in the :mod:`argparse` context is called ``args``." +#: ../../howto/argparse-optparse.rst:41 +msgid "" +"Replace ``(options, args) = parser.parse_args()`` with ``args = " +"parser.parse_args()`` and add additional :meth:`ArgumentParser.add_argument` " +"calls for the positional arguments. Keep in mind that what was previously " +"called ``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" -msgid "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:`~ArgumentParser.parse_args`." +#: ../../howto/argparse-optparse.rst:46 +msgid "" +"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by " +"using :meth:`~ArgumentParser.parse_intermixed_args` instead " +"of :meth:`~ArgumentParser.parse_args`." msgstr "" -msgid "Replace callback actions and the ``callback_*`` keyword arguments with ``type`` or ``action`` arguments." +#: ../../howto/argparse-optparse.rst:50 +msgid "" +"Replace callback actions and the ``callback_*`` keyword arguments with " +"``type`` or ``action`` arguments." msgstr "" -msgid "Replace string names for ``type`` keyword arguments with the corresponding type objects (e.g. int, float, complex, etc)." +#: ../../howto/argparse-optparse.rst:53 +msgid "" +"Replace string names for ``type`` keyword arguments with the corresponding " +"type objects (e.g. int, float, complex, etc)." msgstr "" -msgid "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse.OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." +#: ../../howto/argparse-optparse.rst:56 +msgid "" +"Replace :class:`optparse.Values` with :class:`Namespace` " +"and :exc:`optparse.OptionError` and :exc:`optparse.OptionValueError` " +"with :exc:`ArgumentError`." msgstr "" -msgid "Replace strings with implicit arguments such as ``%default`` or ``%prog`` with the standard Python syntax to use dictionaries to format strings, that is, ``%(default)s`` and ``%(prog)s``." +#: ../../howto/argparse-optparse.rst:60 +msgid "" +"Replace strings with implicit arguments such as ``%default`` or ``%prog`` " +"with the standard Python syntax to use dictionaries to format strings, that " +"is, ``%(default)s`` and ``%(prog)s``." msgstr "" -msgid "Replace the OptionParser constructor ``version`` argument with a call to ``parser.add_argument('--version', action='version', version='')``." +#: ../../howto/argparse-optparse.rst:64 +msgid "" +"Replace the OptionParser constructor ``version`` argument with a call to " +"``parser.add_argument('--version', action='version', version='')``." msgstr "" diff --git a/howto/argparse.po b/howto/argparse.po index f5d45b979..01a86de42 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,27 +24,49 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/argparse.rst:5 msgid "Argparse Tutorial" msgstr "" +#: ../../howto/argparse.rst:0 msgid "author" msgstr "" +#: ../../howto/argparse.rst:7 msgid "Tshepang Mbambo" msgstr "" -msgid "This tutorial is intended to be a gentle introduction to :mod:`argparse`, the recommended command-line parsing module in the Python standard library." -msgstr "" - -msgid "The standard library includes two other libraries directly related to command-line parameter processing: the lower level :mod:`optparse` module (which may require more code to configure for a given application, but also allows an application to request behaviors that ``argparse`` doesn't support), and the very low level :mod:`getopt` (which specifically serves as an equivalent to the :c:func:`!getopt` family of functions available to C programmers). While neither of those modules is covered directly in this guide, many of the core concepts in ``argparse`` first originated in ``optparse``, so some aspects of this tutorial will also be relevant to ``optparse`` users." +#: ../../howto/argparse.rst:11 +msgid "" +"This tutorial is intended to be a gentle introduction to :mod:`argparse`, " +"the recommended command-line parsing module in the Python standard library." msgstr "" +#: ../../howto/argparse.rst:16 +msgid "" +"The standard library includes two other libraries directly related to " +"command-line parameter processing: the lower level :mod:`optparse` module " +"(which may require more code to configure for a given application, but also " +"allows an application to request behaviors that ``argparse`` doesn't " +"support), and the very low level :mod:`getopt` (which specifically serves as " +"an equivalent to the :c:func:`!getopt` family of functions available to C " +"programmers). While neither of those modules is covered directly in this " +"guide, many of the core concepts in ``argparse`` first originated in " +"``optparse``, so some aspects of this tutorial will also be relevant to " +"``optparse`` users." +msgstr "" + +#: ../../howto/argparse.rst:29 msgid "Concepts" msgstr "" -msgid "Let's show the sort of functionality that we are going to explore in this introductory tutorial by making use of the :command:`ls` command:" +#: ../../howto/argparse.rst:31 +msgid "" +"Let's show the sort of functionality that we are going to explore in this " +"introductory tutorial by making use of the :command:`ls` command:" msgstr "" +#: ../../howto/argparse.rst:34 msgid "" "$ ls\n" "cpython devguide prog.py pypy rm-unused-function.patch\n" @@ -64,36 +86,63 @@ msgid "" "..." msgstr "" +#: ../../howto/argparse.rst:53 msgid "A few concepts we can learn from the four commands:" msgstr "" -msgid "The :command:`ls` command is useful when run without any options at all. It defaults to displaying the contents of the current directory." +#: ../../howto/argparse.rst:55 +msgid "" +"The :command:`ls` command is useful when run without any options at all. It " +"defaults to displaying the contents of the current directory." msgstr "" -msgid "If we want beyond what it provides by default, we tell it a bit more. In this case, we want it to display a different directory, ``pypy``. What we did is specify what is known as a positional argument. It's named so because the program should know what to do with the value, solely based on where it appears on the command line. This concept is more relevant to a command like :command:`cp`, whose most basic usage is ``cp SRC DEST``. The first position is *what you want copied,* and the second position is *where you want it copied to*." +#: ../../howto/argparse.rst:58 +msgid "" +"If we want beyond what it provides by default, we tell it a bit more. In " +"this case, we want it to display a different directory, ``pypy``. What we " +"did is specify what is known as a positional argument. It's named so because " +"the program should know what to do with the value, solely based on where it " +"appears on the command line. This concept is more relevant to a command " +"like :command:`cp`, whose most basic usage is ``cp SRC DEST``. The first " +"position is *what you want copied,* and the second position is *where you " +"want it copied to*." msgstr "" -msgid "Now, say we want to change behaviour of the program. In our example, we display more info for each file instead of just showing the file names. The ``-l`` in that case is known as an optional argument." +#: ../../howto/argparse.rst:67 +msgid "" +"Now, say we want to change behaviour of the program. In our example, we " +"display more info for each file instead of just showing the file names. The " +"``-l`` in that case is known as an optional argument." msgstr "" -msgid "That's a snippet of the help text. It's very useful in that you can come across a program you have never used before, and can figure out how it works simply by reading its help text." +#: ../../howto/argparse.rst:71 +msgid "" +"That's a snippet of the help text. It's very useful in that you can come " +"across a program you have never used before, and can figure out how it works " +"simply by reading its help text." msgstr "" +#: ../../howto/argparse.rst:77 msgid "The basics" msgstr "" +#: ../../howto/argparse.rst:79 msgid "Let us start with a very simple example which does (almost) nothing::" msgstr "" +#: ../../howto/argparse.rst:81 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" "parser.parse_args()" msgstr "" +#: ../../howto/argparse.rst:85 ../../howto/argparse.rst:193 +#: ../../howto/argparse.rst:214 msgid "Following is a result of running the code:" msgstr "" +#: ../../howto/argparse.rst:87 msgid "" "$ python prog.py\n" "$ python prog.py --help\n" @@ -109,24 +158,40 @@ msgid "" "prog.py: error: unrecognized arguments: foo" msgstr "" +#: ../../howto/argparse.rst:102 ../../howto/argparse.rst:259 +#: ../../howto/argparse.rst:303 msgid "Here is what is happening:" msgstr "" -msgid "Running the script without any options results in nothing displayed to stdout. Not so useful." +#: ../../howto/argparse.rst:104 +msgid "" +"Running the script without any options results in nothing displayed to " +"stdout. Not so useful." msgstr "" -msgid "The second one starts to display the usefulness of the :mod:`argparse` module. We have done almost nothing, but already we get a nice help message." +#: ../../howto/argparse.rst:107 +msgid "" +"The second one starts to display the usefulness of the :mod:`argparse` " +"module. We have done almost nothing, but already we get a nice help message." msgstr "" -msgid "The ``--help`` option, which can also be shortened to ``-h``, is the only option we get for free (i.e. no need to specify it). Specifying anything else results in an error. But even then, we do get a useful usage message, also for free." +#: ../../howto/argparse.rst:110 +msgid "" +"The ``--help`` option, which can also be shortened to ``-h``, is the only " +"option we get for free (i.e. no need to specify it). Specifying anything " +"else results in an error. But even then, we do get a useful usage message, " +"also for free." msgstr "" +#: ../../howto/argparse.rst:117 msgid "Introducing Positional arguments" msgstr "" +#: ../../howto/argparse.rst:119 msgid "An example::" msgstr "" +#: ../../howto/argparse.rst:121 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -135,9 +200,11 @@ msgid "" "print(args.echo)" msgstr "" +#: ../../howto/argparse.rst:127 msgid "And running the code:" msgstr "" +#: ../../howto/argparse.rst:129 msgid "" "$ python prog.py\n" "usage: prog.py [-h] echo\n" @@ -154,24 +221,46 @@ msgid "" "foo" msgstr "" +#: ../../howto/argparse.rst:145 msgid "Here is what's happening:" msgstr "" -msgid "We've added the :meth:`~ArgumentParser.add_argument` method, which is what we use to specify which command-line options the program is willing to accept. In this case, I've named it ``echo`` so that it's in line with its function." +#: ../../howto/argparse.rst:147 +msgid "" +"We've added the :meth:`~ArgumentParser.add_argument` method, which is what " +"we use to specify which command-line options the program is willing to " +"accept. In this case, I've named it ``echo`` so that it's in line with its " +"function." msgstr "" +#: ../../howto/argparse.rst:151 msgid "Calling our program now requires us to specify an option." msgstr "" -msgid "The :meth:`~ArgumentParser.parse_args` method actually returns some data from the options specified, in this case, ``echo``." +#: ../../howto/argparse.rst:153 +msgid "" +"The :meth:`~ArgumentParser.parse_args` method actually returns some data " +"from the options specified, in this case, ``echo``." msgstr "" -msgid "The variable is some form of 'magic' that :mod:`argparse` performs for free (i.e. no need to specify which variable that value is stored in). You will also notice that its name matches the string argument given to the method, ``echo``." +#: ../../howto/argparse.rst:156 +msgid "" +"The variable is some form of 'magic' that :mod:`argparse` performs for free " +"(i.e. no need to specify which variable that value is stored in). You will " +"also notice that its name matches the string argument given to the method, " +"``echo``." msgstr "" -msgid "Note however that, although the help display looks nice and all, it currently is not as helpful as it can be. For example we see that we got ``echo`` as a positional argument, but we don't know what it does, other than by guessing or by reading the source code. So, let's make it a bit more useful::" +#: ../../howto/argparse.rst:161 +msgid "" +"Note however that, although the help display looks nice and all, it " +"currently is not as helpful as it can be. For example we see that we got " +"``echo`` as a positional argument, but we don't know what it does, other " +"than by guessing or by reading the source code. So, let's make it a bit more " +"useful::" msgstr "" +#: ../../howto/argparse.rst:166 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -180,9 +269,11 @@ msgid "" "print(args.echo)" msgstr "" +#: ../../howto/argparse.rst:172 msgid "And we get:" msgstr "" +#: ../../howto/argparse.rst:174 msgid "" "$ python prog.py -h\n" "usage: prog.py [-h] echo\n" @@ -194,17 +285,21 @@ msgid "" " -h, --help show this help message and exit" msgstr "" +#: ../../howto/argparse.rst:185 msgid "Now, how about doing something even more useful::" msgstr "" +#: ../../howto/argparse.rst:187 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" -"parser.add_argument(\"square\", help=\"display a square of a given number\")\n" +"parser.add_argument(\"square\", help=\"display a square of a given " +"number\")\n" "args = parser.parse_args()\n" "print(args.square**2)" msgstr "" +#: ../../howto/argparse.rst:195 msgid "" "$ python prog.py 4\n" "Traceback (most recent call last):\n" @@ -213,18 +308,25 @@ msgid "" "TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'" msgstr "" -msgid "That didn't go so well. That's because :mod:`argparse` treats the options we give it as strings, unless we tell it otherwise. So, let's tell :mod:`argparse` to treat that input as an integer::" +#: ../../howto/argparse.rst:203 +msgid "" +"That didn't go so well. That's because :mod:`argparse` treats the options we " +"give it as strings, unless we tell it otherwise. So, let's " +"tell :mod:`argparse` to treat that input as an integer::" msgstr "" +#: ../../howto/argparse.rst:207 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" -"parser.add_argument(\"square\", help=\"display a square of a given number\",\n" +"parser.add_argument(\"square\", help=\"display a square of a given " +"number\",\n" " type=int)\n" "args = parser.parse_args()\n" "print(args.square**2)" msgstr "" +#: ../../howto/argparse.rst:216 msgid "" "$ python prog.py 4\n" "16\n" @@ -233,15 +335,23 @@ msgid "" "prog.py: error: argument square: invalid int value: 'four'" msgstr "" -msgid "That went well. The program now even helpfully quits on bad illegal input before proceeding." +#: ../../howto/argparse.rst:224 +msgid "" +"That went well. The program now even helpfully quits on bad illegal input " +"before proceeding." msgstr "" +#: ../../howto/argparse.rst:229 msgid "Introducing Optional arguments" msgstr "" -msgid "So far we have been playing with positional arguments. Let us have a look on how to add optional ones::" +#: ../../howto/argparse.rst:231 +msgid "" +"So far we have been playing with positional arguments. Let us have a look on " +"how to add optional ones::" msgstr "" +#: ../../howto/argparse.rst:234 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -251,9 +361,12 @@ msgid "" " print(\"verbosity turned on\")" msgstr "" +#: ../../howto/argparse.rst:241 ../../howto/argparse.rst:287 +#: ../../howto/argparse.rst:403 ../../howto/argparse.rst:437 msgid "And the output:" msgstr "" +#: ../../howto/argparse.rst:243 msgid "" "$ python prog.py --verbosity 1\n" "verbosity turned on\n" @@ -270,21 +383,39 @@ msgid "" "prog.py: error: argument --verbosity: expected one argument" msgstr "" -msgid "The program is written so as to display something when ``--verbosity`` is specified and display nothing when not." +#: ../../howto/argparse.rst:261 +msgid "" +"The program is written so as to display something when ``--verbosity`` is " +"specified and display nothing when not." msgstr "" -msgid "To show that the option is actually optional, there is no error when running the program without it. Note that by default, if an optional argument isn't used, the relevant variable, in this case ``args.verbosity``, is given ``None`` as a value, which is the reason it fails the truth test of the :keyword:`if` statement." +#: ../../howto/argparse.rst:264 +msgid "" +"To show that the option is actually optional, there is no error when running " +"the program without it. Note that by default, if an optional argument isn't " +"used, the relevant variable, in this case ``args.verbosity``, is given " +"``None`` as a value, which is the reason it fails the truth test of " +"the :keyword:`if` statement." msgstr "" +#: ../../howto/argparse.rst:270 msgid "The help message is a bit different." msgstr "" -msgid "When using the ``--verbosity`` option, one must also specify some value, any value." +#: ../../howto/argparse.rst:272 +msgid "" +"When using the ``--verbosity`` option, one must also specify some value, any " +"value." msgstr "" -msgid "The above example accepts arbitrary integer values for ``--verbosity``, but for our simple program, only two values are actually useful, ``True`` or ``False``. Let's modify the code accordingly::" +#: ../../howto/argparse.rst:275 +msgid "" +"The above example accepts arbitrary integer values for ``--verbosity``, but " +"for our simple program, only two values are actually useful, ``True`` or " +"``False``. Let's modify the code accordingly::" msgstr "" +#: ../../howto/argparse.rst:279 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -295,6 +426,7 @@ msgid "" " print(\"verbosity turned on\")" msgstr "" +#: ../../howto/argparse.rst:289 msgid "" "$ python prog.py --verbose\n" "verbosity turned on\n" @@ -309,34 +441,53 @@ msgid "" " --verbose increase output verbosity" msgstr "" -msgid "The option is now more of a flag than something that requires a value. We even changed the name of the option to match that idea. Note that we now specify a new keyword, ``action``, and give it the value ``\"store_true\"``. This means that, if the option is specified, assign the value ``True`` to ``args.verbose``. Not specifying it implies ``False``." +#: ../../howto/argparse.rst:305 +msgid "" +"The option is now more of a flag than something that requires a value. We " +"even changed the name of the option to match that idea. Note that we now " +"specify a new keyword, ``action``, and give it the value ``\"store_true\"``. " +"This means that, if the option is specified, assign the value ``True`` to " +"``args.verbose``. Not specifying it implies ``False``." msgstr "" -msgid "It complains when you specify a value, in true spirit of what flags actually are." +#: ../../howto/argparse.rst:312 +msgid "" +"It complains when you specify a value, in true spirit of what flags actually " +"are." msgstr "" +#: ../../howto/argparse.rst:315 msgid "Notice the different help text." msgstr "" +#: ../../howto/argparse.rst:319 msgid "Short options" msgstr "" -msgid "If you are familiar with command line usage, you will notice that I haven't yet touched on the topic of short versions of the options. It's quite simple::" +#: ../../howto/argparse.rst:321 +msgid "" +"If you are familiar with command line usage, you will notice that I haven't " +"yet touched on the topic of short versions of the options. It's quite " +"simple::" msgstr "" +#: ../../howto/argparse.rst:325 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" -"parser.add_argument(\"-v\", \"--verbose\", help=\"increase output verbosity\",\n" +"parser.add_argument(\"-v\", \"--verbose\", help=\"increase output " +"verbosity\",\n" " action=\"store_true\")\n" "args = parser.parse_args()\n" "if args.verbose:\n" " print(\"verbosity turned on\")" msgstr "" +#: ../../howto/argparse.rst:333 msgid "And here goes:" msgstr "" +#: ../../howto/argparse.rst:335 msgid "" "$ python prog.py -v\n" "verbosity turned on\n" @@ -348,15 +499,19 @@ msgid "" " -v, --verbose increase output verbosity" msgstr "" +#: ../../howto/argparse.rst:346 msgid "Note that the new ability is also reflected in the help text." msgstr "" +#: ../../howto/argparse.rst:350 msgid "Combining Positional and Optional arguments" msgstr "" +#: ../../howto/argparse.rst:352 msgid "Our program keeps growing in complexity::" msgstr "" +#: ../../howto/argparse.rst:354 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -372,9 +527,11 @@ msgid "" " print(answer)" msgstr "" +#: ../../howto/argparse.rst:367 msgid "And now the output:" msgstr "" +#: ../../howto/argparse.rst:369 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] square\n" @@ -387,15 +544,21 @@ msgid "" "the square of 4 equals 16" msgstr "" +#: ../../howto/argparse.rst:381 msgid "We've brought back a positional argument, hence the complaint." msgstr "" +#: ../../howto/argparse.rst:383 msgid "Note that the order does not matter." msgstr "" -msgid "How about we give this program of ours back the ability to have multiple verbosity values, and actually get to use them::" +#: ../../howto/argparse.rst:385 +msgid "" +"How about we give this program of ours back the ability to have multiple " +"verbosity values, and actually get to use them::" msgstr "" +#: ../../howto/argparse.rst:388 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -413,6 +576,7 @@ msgid "" " print(answer)" msgstr "" +#: ../../howto/argparse.rst:405 msgid "" "$ python prog.py 4\n" "16\n" @@ -427,9 +591,14 @@ msgid "" "16" msgstr "" -msgid "These all look good except the last one, which exposes a bug in our program. Let's fix it by restricting the values the ``--verbosity`` option can accept::" +#: ../../howto/argparse.rst:419 +msgid "" +"These all look good except the last one, which exposes a bug in our program. " +"Let's fix it by restricting the values the ``--verbosity`` option can " +"accept::" msgstr "" +#: ../../howto/argparse.rst:422 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -447,10 +616,12 @@ msgid "" " print(answer)" msgstr "" +#: ../../howto/argparse.rst:439 msgid "" "$ python prog.py 4 -v 3\n" "usage: prog.py [-h] [-v {0,1,2}] square\n" -"prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, 1, 2)\n" +"prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, " +"1, 2)\n" "$ python prog.py 4 -h\n" "usage: prog.py [-h] [-v {0,1,2}] square\n" "\n" @@ -463,12 +634,20 @@ msgid "" " increase output verbosity" msgstr "" -msgid "Note that the change also reflects both in the error message as well as the help string." +#: ../../howto/argparse.rst:455 +msgid "" +"Note that the change also reflects both in the error message as well as the " +"help string." msgstr "" -msgid "Now, let's use a different approach of playing with verbosity, which is pretty common. It also matches the way the CPython executable handles its own verbosity argument (check the output of ``python --help``)::" +#: ../../howto/argparse.rst:458 +msgid "" +"Now, let's use a different approach of playing with verbosity, which is " +"pretty common. It also matches the way the CPython executable handles its " +"own verbosity argument (check the output of ``python --help``)::" msgstr "" +#: ../../howto/argparse.rst:462 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -486,9 +665,13 @@ msgid "" " print(answer)" msgstr "" -msgid "We have introduced another action, \"count\", to count the number of occurrences of specific options." +#: ../../howto/argparse.rst:477 +msgid "" +"We have introduced another action, \"count\", to count the number of " +"occurrences of specific options." msgstr "" +#: ../../howto/argparse.rst:481 msgid "" "$ python prog.py 4\n" "16\n" @@ -514,30 +697,50 @@ msgid "" "16" msgstr "" -msgid "Yes, it's now more of a flag (similar to ``action=\"store_true\"``) in the previous version of our script. That should explain the complaint." +#: ../../howto/argparse.rst:506 +msgid "" +"Yes, it's now more of a flag (similar to ``action=\"store_true\"``) in the " +"previous version of our script. That should explain the complaint." msgstr "" +#: ../../howto/argparse.rst:509 msgid "It also behaves similar to \"store_true\" action." msgstr "" -msgid "Now here's a demonstration of what the \"count\" action gives. You've probably seen this sort of usage before." +#: ../../howto/argparse.rst:511 +msgid "" +"Now here's a demonstration of what the \"count\" action gives. You've " +"probably seen this sort of usage before." msgstr "" -msgid "And if you don't specify the ``-v`` flag, that flag is considered to have ``None`` value." +#: ../../howto/argparse.rst:514 +msgid "" +"And if you don't specify the ``-v`` flag, that flag is considered to have " +"``None`` value." msgstr "" -msgid "As should be expected, specifying the long form of the flag, we should get the same output." +#: ../../howto/argparse.rst:517 +msgid "" +"As should be expected, specifying the long form of the flag, we should get " +"the same output." msgstr "" -msgid "Sadly, our help output isn't very informative on the new ability our script has acquired, but that can always be fixed by improving the documentation for our script (e.g. via the ``help`` keyword argument)." +#: ../../howto/argparse.rst:520 +msgid "" +"Sadly, our help output isn't very informative on the new ability our script " +"has acquired, but that can always be fixed by improving the documentation " +"for our script (e.g. via the ``help`` keyword argument)." msgstr "" +#: ../../howto/argparse.rst:524 msgid "That last output exposes a bug in our program." msgstr "" +#: ../../howto/argparse.rst:527 msgid "Let's fix::" msgstr "" +#: ../../howto/argparse.rst:529 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -557,9 +760,11 @@ msgid "" " print(answer)" msgstr "" +#: ../../howto/argparse.rst:546 msgid "And this is what it gives:" msgstr "" +#: ../../howto/argparse.rst:548 msgid "" "$ python prog.py 4 -vvv\n" "the square of 4 equals 16\n" @@ -572,15 +777,21 @@ msgid "" "TypeError: '>=' not supported between instances of 'NoneType' and 'int'" msgstr "" -msgid "First output went well, and fixes the bug we had before. That is, we want any value >= 2 to be as verbose as possible." +#: ../../howto/argparse.rst:561 +msgid "" +"First output went well, and fixes the bug we had before. That is, we want " +"any value >= 2 to be as verbose as possible." msgstr "" +#: ../../howto/argparse.rst:564 msgid "Third output not so good." msgstr "" +#: ../../howto/argparse.rst:566 msgid "Let's fix that bug::" msgstr "" +#: ../../howto/argparse.rst:568 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -598,26 +809,43 @@ msgid "" " print(answer)" msgstr "" -msgid "We've just introduced yet another keyword, ``default``. We've set it to ``0`` in order to make it comparable to the other int values. Remember that by default, if an optional argument isn't specified, it gets the ``None`` value, and that cannot be compared to an int value (hence the :exc:`TypeError` exception)." +#: ../../howto/argparse.rst:583 +msgid "" +"We've just introduced yet another keyword, ``default``. We've set it to " +"``0`` in order to make it comparable to the other int values. Remember that " +"by default, if an optional argument isn't specified, it gets the ``None`` " +"value, and that cannot be compared to an int value (hence " +"the :exc:`TypeError` exception)." msgstr "" +#: ../../howto/argparse.rst:590 msgid "And:" msgstr "" +#: ../../howto/argparse.rst:592 msgid "" "$ python prog.py 4\n" "16" msgstr "" -msgid "You can go quite far just with what we've learned so far, and we have only scratched the surface. The :mod:`argparse` module is very powerful, and we'll explore a bit more of it before we end this tutorial." +#: ../../howto/argparse.rst:597 +msgid "" +"You can go quite far just with what we've learned so far, and we have only " +"scratched the surface. The :mod:`argparse` module is very powerful, and " +"we'll explore a bit more of it before we end this tutorial." msgstr "" +#: ../../howto/argparse.rst:604 msgid "Getting a little more advanced" msgstr "" -msgid "What if we wanted to expand our tiny program to perform other powers, not just squares::" +#: ../../howto/argparse.rst:606 +msgid "" +"What if we wanted to expand our tiny program to perform other powers, not " +"just squares::" msgstr "" +#: ../../howto/argparse.rst:609 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -634,9 +862,12 @@ msgid "" " print(answer)" msgstr "" +#: ../../howto/argparse.rst:623 ../../howto/argparse.rst:661 +#: ../../howto/argparse.rst:877 msgid "Output:" msgstr "" +#: ../../howto/argparse.rst:625 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] x y\n" @@ -655,9 +886,14 @@ msgid "" "4^2 == 16" msgstr "" -msgid "Notice that so far we've been using verbosity level to *change* the text that gets displayed. The following example instead uses verbosity level to display *more* text instead::" +#: ../../howto/argparse.rst:644 +msgid "" +"Notice that so far we've been using verbosity level to *change* the text " +"that gets displayed. The following example instead uses verbosity level to " +"display *more* text instead::" msgstr "" +#: ../../howto/argparse.rst:648 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -673,6 +909,7 @@ msgid "" "print(answer)" msgstr "" +#: ../../howto/argparse.rst:663 msgid "" "$ python prog.py 4 2\n" "16\n" @@ -683,12 +920,18 @@ msgid "" "4^2 == 16" msgstr "" +#: ../../howto/argparse.rst:677 msgid "Specifying ambiguous arguments" msgstr "" -msgid "When there is ambiguity in deciding whether an argument is positional or for an argument, ``--`` can be used to tell :meth:`~ArgumentParser.parse_args` that everything after that is a positional argument::" +#: ../../howto/argparse.rst:679 +msgid "" +"When there is ambiguity in deciding whether an argument is positional or for " +"an argument, ``--`` can be used to tell :meth:`~ArgumentParser.parse_args` " +"that everything after that is a positional argument::" msgstr "" +#: ../../howto/argparse.rst:683 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-n', nargs='+')\n" @@ -710,12 +953,22 @@ msgid "" "Namespace(args=['2', '3'], n=['1'])" msgstr "" +#: ../../howto/argparse.rst:704 msgid "Conflicting options" msgstr "" -msgid "So far, we have been working with two methods of an :class:`argparse.ArgumentParser` instance. Let's introduce a third one, :meth:`~ArgumentParser.add_mutually_exclusive_group`. It allows for us to specify options that conflict with each other. Let's also change the rest of the program so that the new functionality makes more sense: we'll introduce the ``--quiet`` option, which will be the opposite of the ``--verbose`` one::" +#: ../../howto/argparse.rst:706 +msgid "" +"So far, we have been working with two methods of " +"an :class:`argparse.ArgumentParser` instance. Let's introduce a third " +"one, :meth:`~ArgumentParser.add_mutually_exclusive_group`. It allows for us " +"to specify options that conflict with each other. Let's also change the rest " +"of the program so that the new functionality makes more sense: we'll " +"introduce the ``--quiet`` option, which will be the opposite of the ``--" +"verbose`` one::" msgstr "" +#: ../../howto/argparse.rst:714 msgid "" "import argparse\n" "\n" @@ -736,9 +989,13 @@ msgid "" " print(f\"{args.x}^{args.y} == {answer}\")" msgstr "" -msgid "Our program is now simpler, and we've lost some functionality for the sake of demonstration. Anyways, here's the output:" +#: ../../howto/argparse.rst:732 +msgid "" +"Our program is now simpler, and we've lost some functionality for the sake " +"of demonstration. Anyways, here's the output:" msgstr "" +#: ../../howto/argparse.rst:735 msgid "" "$ python prog.py 4 2\n" "4^2 == 16\n" @@ -754,16 +1011,25 @@ msgid "" "prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose" msgstr "" -msgid "That should be easy to follow. I've added that last output so you can see the sort of flexibility you get, i.e. mixing long form options with short form ones." +#: ../../howto/argparse.rst:750 +msgid "" +"That should be easy to follow. I've added that last output so you can see " +"the sort of flexibility you get, i.e. mixing long form options with short " +"form ones." msgstr "" -msgid "Before we conclude, you probably want to tell your users the main purpose of your program, just in case they don't know::" +#: ../../howto/argparse.rst:754 +msgid "" +"Before we conclude, you probably want to tell your users the main purpose of " +"your program, just in case they don't know::" msgstr "" +#: ../../howto/argparse.rst:757 msgid "" "import argparse\n" "\n" -"parser = argparse.ArgumentParser(description=\"calculate X to the power of Y\")\n" +"parser = argparse.ArgumentParser(description=\"calculate X to the power of " +"Y\")\n" "group = parser.add_mutually_exclusive_group()\n" "group.add_argument(\"-v\", \"--verbose\", action=\"store_true\")\n" "group.add_argument(\"-q\", \"--quiet\", action=\"store_true\")\n" @@ -780,9 +1046,14 @@ msgid "" " print(f\"{args.x}^{args.y} == {answer}\")" msgstr "" -msgid "Note that slight difference in the usage text. Note the ``[-v | -q]``, which tells us that we can either use ``-v`` or ``-q``, but not both at the same time:" +#: ../../howto/argparse.rst:775 +msgid "" +"Note that slight difference in the usage text. Note the ``[-v | -q]``, which " +"tells us that we can either use ``-v`` or ``-q``, but not both at the same " +"time:" msgstr "" +#: ../../howto/argparse.rst:779 ../../howto/argparse.rst:806 msgid "" "$ python prog.py --help\n" "usage: prog.py [-h] [-v | -q] x y\n" @@ -799,53 +1070,98 @@ msgid "" " -q, --quiet" msgstr "" +#: ../../howto/argparse.rst:797 msgid "How to translate the argparse output" msgstr "" -msgid "The output of the :mod:`argparse` module such as its help text and error messages are all made translatable using the :mod:`gettext` module. This allows applications to easily localize messages produced by :mod:`argparse`. See also :ref:`i18n-howto`." +#: ../../howto/argparse.rst:799 +msgid "" +"The output of the :mod:`argparse` module such as its help text and error " +"messages are all made translatable using the :mod:`gettext` module. This " +"allows applications to easily localize messages produced by :mod:`argparse`. " +"See also :ref:`i18n-howto`." msgstr "" +#: ../../howto/argparse.rst:804 msgid "For instance, in this :mod:`argparse` output:" msgstr "" -msgid "The strings ``usage:``, ``positional arguments:``, ``options:`` and ``show this help message and exit`` are all translatable." +#: ../../howto/argparse.rst:822 +msgid "" +"The strings ``usage:``, ``positional arguments:``, ``options:`` and ``show " +"this help message and exit`` are all translatable." msgstr "" -msgid "In order to translate these strings, they must first be extracted into a ``.po`` file. For example, using `Babel `__, run this command:" +#: ../../howto/argparse.rst:825 +msgid "" +"In order to translate these strings, they must first be extracted into a " +"``.po`` file. For example, using `Babel `__, run " +"this command:" msgstr "" +#: ../../howto/argparse.rst:829 msgid "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" msgstr "" -msgid "This command will extract all translatable strings from the :mod:`argparse` module and output them into a file named ``messages.po``. This command assumes that your Python installation is in ``/usr/lib``." +#: ../../howto/argparse.rst:833 +msgid "" +"This command will extract all translatable strings from the :mod:`argparse` " +"module and output them into a file named ``messages.po``. This command " +"assumes that your Python installation is in ``/usr/lib``." msgstr "" -msgid "You can find out the location of the :mod:`argparse` module on your system using this script::" +#: ../../howto/argparse.rst:837 +msgid "" +"You can find out the location of the :mod:`argparse` module on your system " +"using this script::" msgstr "" +#: ../../howto/argparse.rst:840 msgid "" "import argparse\n" "print(argparse.__file__)" msgstr "" -msgid "Once the messages in the ``.po`` file are translated and the translations are installed using :mod:`gettext`, :mod:`argparse` will be able to display the translated messages." +#: ../../howto/argparse.rst:843 +msgid "" +"Once the messages in the ``.po`` file are translated and the translations " +"are installed using :mod:`gettext`, :mod:`argparse` will be able to display " +"the translated messages." msgstr "" -msgid "To translate your own strings in the :mod:`argparse` output, use :mod:`gettext`." +#: ../../howto/argparse.rst:847 +msgid "" +"To translate your own strings in the :mod:`argparse` output, " +"use :mod:`gettext`." msgstr "" +#: ../../howto/argparse.rst:850 msgid "Custom type converters" msgstr "" -msgid "The :mod:`argparse` module allows you to specify custom type converters for your command-line arguments. This allows you to modify user input before it's stored in the :class:`argparse.Namespace`. This can be useful when you need to pre-process the input before it is used in your program." +#: ../../howto/argparse.rst:852 +msgid "" +"The :mod:`argparse` module allows you to specify custom type converters for " +"your command-line arguments. This allows you to modify user input before " +"it's stored in the :class:`argparse.Namespace`. This can be useful when you " +"need to pre-process the input before it is used in your program." msgstr "" -msgid "When using a custom type converter, you can use any callable that takes a single string argument (the argument value) and returns the converted value. However, if you need to handle more complex scenarios, you can use a custom action class with the **action** parameter instead." +#: ../../howto/argparse.rst:857 +msgid "" +"When using a custom type converter, you can use any callable that takes a " +"single string argument (the argument value) and returns the converted value. " +"However, if you need to handle more complex scenarios, you can use a custom " +"action class with the **action** parameter instead." msgstr "" -msgid "For example, let's say you want to handle arguments with different prefixes and process them accordingly::" +#: ../../howto/argparse.rst:862 +msgid "" +"For example, let's say you want to handle arguments with different prefixes " +"and process them accordingly::" msgstr "" +#: ../../howto/argparse.rst:865 msgid "" "import argparse\n" "\n" @@ -860,25 +1176,44 @@ msgid "" "print(args)" msgstr "" +#: ../../howto/argparse.rst:879 msgid "" "$ python prog.py -a value1 +a value2\n" "Namespace(a=[('-', 'value1'), ('+', 'value2')])" msgstr "" +#: ../../howto/argparse.rst:884 msgid "In this example, we:" msgstr "" -msgid "Created a parser with custom prefix characters using the ``prefix_chars`` parameter." +#: ../../howto/argparse.rst:886 +msgid "" +"Created a parser with custom prefix characters using the ``prefix_chars`` " +"parameter." msgstr "" -msgid "Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter to create custom type converters to store the value in a tuple with the prefix." +#: ../../howto/argparse.rst:889 +msgid "" +"Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter " +"to create custom type converters to store the value in a tuple with the " +"prefix." msgstr "" -msgid "Without the custom type converters, the arguments would have treated the ``-a`` and ``+a`` as the same argument, which would have been undesirable. By using custom type converters, we were able to differentiate between the two arguments." +#: ../../howto/argparse.rst:892 +msgid "" +"Without the custom type converters, the arguments would have treated the ``-" +"a`` and ``+a`` as the same argument, which would have been undesirable. By " +"using custom type converters, we were able to differentiate between the two " +"arguments." msgstr "" +#: ../../howto/argparse.rst:897 msgid "Conclusion" msgstr "" -msgid "The :mod:`argparse` module offers a lot more than shown here. Its docs are quite detailed and thorough, and full of examples. Having gone through this tutorial, you should easily digest them without feeling overwhelmed." +#: ../../howto/argparse.rst:899 +msgid "" +"The :mod:`argparse` module offers a lot more than shown here. Its docs are " +"quite detailed and thorough, and full of examples. Having gone through this " +"tutorial, you should easily digest them without feeling overwhelmed." msgstr "" diff --git a/howto/clinic.po b/howto/clinic.po index 711224e1d..124ae5f95 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,8 +23,12 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/clinic.rst:8 msgid "Argument Clinic How-To" msgstr "" -msgid "The Argument Clinic How-TO has been moved to the `Python Developer's Guide `__." +#: ../../howto/clinic.rst:13 +msgid "" +"The Argument Clinic How-TO has been moved to the `Python Developer's Guide " +"`__." msgstr "" diff --git a/howto/cporting.po b/howto/cporting.po index 5b178be6e..e8857d7c9 100644 --- a/howto/cporting.po +++ b/howto/cporting.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:52+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,17 +21,33 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/cporting.rst:7 msgid "Porting Extension Modules to Python 3" msgstr "" -msgid "We recommend the following resources for porting extension modules to Python 3:" +#: ../../howto/cporting.rst:9 +msgid "" +"We recommend the following resources for porting extension modules to Python " +"3:" msgstr "" -msgid "The `Migrating C extensions`_ chapter from *Supporting Python 3: An in-depth guide*, a book on moving from Python 2 to Python 3 in general, guides the reader through porting an extension module." +#: ../../howto/cporting.rst:11 +msgid "" +"The `Migrating C extensions`_ chapter from *Supporting Python 3: An in-depth " +"guide*, a book on moving from Python 2 to Python 3 in general, guides the " +"reader through porting an extension module." msgstr "" -msgid "The `Porting guide`_ from the *py3c* project provides opinionated suggestions with supporting code." +#: ../../howto/cporting.rst:15 +msgid "" +"The `Porting guide`_ from the *py3c* project provides opinionated " +"suggestions with supporting code." msgstr "" -msgid ":ref:`Recommended third party tools ` offer abstractions over the Python's C API. Extensions generally need to be re-written to use one of them, but the library then handles differences between various Python versions and implementations." +#: ../../howto/cporting.rst:17 +msgid "" +":ref:`Recommended third party tools ` offer abstractions over " +"the Python's C API. Extensions generally need to be re-written to use one of " +"them, but the library then handles differences between various Python " +"versions and implementations." msgstr "" diff --git a/howto/curses.po b/howto/curses.po index 6437ad533..f5c1afee1 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,104 +24,212 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/curses.rst:5 msgid "Curses Programming with Python" msgstr "" +#: ../../howto/curses.rst:0 msgid "Author" msgstr "" +#: ../../howto/curses.rst:9 msgid "A.M. Kuchling, Eric S. Raymond" msgstr "" +#: ../../howto/curses.rst:0 msgid "Release" msgstr "" +#: ../../howto/curses.rst:10 msgid "2.04" msgstr "" +#: ../../howto/curses.rst:-1 msgid "Abstract" msgstr "" -msgid "This document describes how to use the :mod:`curses` extension module to control text-mode displays." +#: ../../howto/curses.rst:15 +msgid "" +"This document describes how to use the :mod:`curses` extension module to " +"control text-mode displays." msgstr "" +#: ../../howto/curses.rst:20 msgid "What is curses?" msgstr "" -msgid "The curses library supplies a terminal-independent screen-painting and keyboard-handling facility for text-based terminals; such terminals include VT100s, the Linux console, and the simulated terminal provided by various programs. Display terminals support various control codes to perform common operations such as moving the cursor, scrolling the screen, and erasing areas. Different terminals use widely differing codes, and often have their own minor quirks." -msgstr "" - -msgid "In a world of graphical displays, one might ask \"why bother\"? It's true that character-cell display terminals are an obsolete technology, but there are niches in which being able to do fancy things with them are still valuable. One niche is on small-footprint or embedded Unixes that don't run an X server. Another is tools such as OS installers and kernel configurators that may have to run before any graphical support is available." +#: ../../howto/curses.rst:22 +msgid "" +"The curses library supplies a terminal-independent screen-painting and " +"keyboard-handling facility for text-based terminals; such terminals include " +"VT100s, the Linux console, and the simulated terminal provided by various " +"programs. Display terminals support various control codes to perform common " +"operations such as moving the cursor, scrolling the screen, and erasing " +"areas. Different terminals use widely differing codes, and often have their " +"own minor quirks." msgstr "" -msgid "The curses library provides fairly basic functionality, providing the programmer with an abstraction of a display containing multiple non-overlapping windows of text. The contents of a window can be changed in various ways---adding text, erasing it, changing its appearance---and the curses library will figure out what control codes need to be sent to the terminal to produce the right output. curses doesn't provide many user-interface concepts such as buttons, checkboxes, or dialogs; if you need such features, consider a user interface library such as :pypi:`Urwid`." +#: ../../howto/curses.rst:30 +msgid "" +"In a world of graphical displays, one might ask \"why bother\"? It's true " +"that character-cell display terminals are an obsolete technology, but there " +"are niches in which being able to do fancy things with them are still " +"valuable. One niche is on small-footprint or embedded Unixes that don't run " +"an X server. Another is tools such as OS installers and kernel " +"configurators that may have to run before any graphical support is available." msgstr "" -msgid "The curses library was originally written for BSD Unix; the later System V versions of Unix from AT&T added many enhancements and new functions. BSD curses is no longer maintained, having been replaced by ncurses, which is an open-source implementation of the AT&T interface. If you're using an open-source Unix such as Linux or FreeBSD, your system almost certainly uses ncurses. Since most current commercial Unix versions are based on System V code, all the functions described here will probably be available. The older versions of curses carried by some proprietary Unixes may not support everything, though." +#: ../../howto/curses.rst:38 +msgid "" +"The curses library provides fairly basic functionality, providing the " +"programmer with an abstraction of a display containing multiple non-" +"overlapping windows of text. The contents of a window can be changed in " +"various ways---adding text, erasing it, changing its appearance---and the " +"curses library will figure out what control codes need to be sent to the " +"terminal to produce the right output. curses doesn't provide many user-" +"interface concepts such as buttons, checkboxes, or dialogs; if you need such " +"features, consider a user interface library such as :pypi:`Urwid`." msgstr "" -msgid "The Windows version of Python doesn't include the :mod:`curses` module. A ported version called :pypi:`UniCurses` is available." +#: ../../howto/curses.rst:48 +msgid "" +"The curses library was originally written for BSD Unix; the later System V " +"versions of Unix from AT&T added many enhancements and new functions. BSD " +"curses is no longer maintained, having been replaced by ncurses, which is an " +"open-source implementation of the AT&T interface. If you're using an open-" +"source Unix such as Linux or FreeBSD, your system almost certainly uses " +"ncurses. Since most current commercial Unix versions are based on System V " +"code, all the functions described here will probably be available. The " +"older versions of curses carried by some proprietary Unixes may not support " +"everything, though." +msgstr "" + +#: ../../howto/curses.rst:58 +msgid "" +"The Windows version of Python doesn't include the :mod:`curses` module. The " +"third-party :pypi:`windows-curses` package provides the same interface on " +"Windows." msgstr "" +#: ../../howto/curses.rst:63 msgid "The Python curses module" msgstr "" -msgid "The Python module is a fairly simple wrapper over the C functions provided by curses; if you're already familiar with curses programming in C, it's really easy to transfer that knowledge to Python. The biggest difference is that the Python interface makes things simpler by merging different C functions such as :c:func:`!addstr`, :c:func:`!mvaddstr`, and :c:func:`!mvwaddstr` into a single :meth:`~curses.window.addstr` method. You'll see this covered in more detail later." +#: ../../howto/curses.rst:65 +msgid "" +"The Python module is a fairly simple wrapper over the C functions provided " +"by curses; if you're already familiar with curses programming in C, it's " +"really easy to transfer that knowledge to Python. The biggest difference is " +"that the Python interface makes things simpler by merging different C " +"functions such as :c:func:`!addstr`, :c:func:`!mvaddstr`, and :c:func:`!" +"mvwaddstr` into a single :meth:`~curses.window.addstr` method. You'll see " +"this covered in more detail later." msgstr "" -msgid "This HOWTO is an introduction to writing text-mode programs with curses and Python. It doesn't attempt to be a complete guide to the curses API; for that, see the Python library guide's section on ncurses, and the C manual pages for ncurses. It will, however, give you the basic ideas." +#: ../../howto/curses.rst:73 +msgid "" +"This HOWTO is an introduction to writing text-mode programs with curses and " +"Python. It doesn't attempt to be a complete guide to the curses API; for " +"that, see the Python library guide's section on ncurses, and the C manual " +"pages for ncurses. It will, however, give you the basic ideas." msgstr "" +#: ../../howto/curses.rst:80 msgid "Starting and ending a curses application" msgstr "" -msgid "Before doing anything, curses must be initialized. This is done by calling the :func:`~curses.initscr` function, which will determine the terminal type, send any required setup codes to the terminal, and create various internal data structures. If successful, :func:`!initscr` returns a window object representing the entire screen; this is usually called ``stdscr`` after the name of the corresponding C variable. ::" +#: ../../howto/curses.rst:82 +msgid "" +"Before doing anything, curses must be initialized. This is done by calling " +"the :func:`~curses.initscr` function, which will determine the terminal " +"type, send any required setup codes to the terminal, and create various " +"internal data structures. If successful, :func:`!initscr` returns a window " +"object representing the entire screen; this is usually called ``stdscr`` " +"after the name of the corresponding C variable. ::" msgstr "" +#: ../../howto/curses.rst:90 msgid "" "import curses\n" "stdscr = curses.initscr()" msgstr "" -msgid "Usually curses applications turn off automatic echoing of keys to the screen, in order to be able to read keys and only display them under certain circumstances. This requires calling the :func:`~curses.noecho` function. ::" +#: ../../howto/curses.rst:93 +msgid "" +"Usually curses applications turn off automatic echoing of keys to the " +"screen, in order to be able to read keys and only display them under certain " +"circumstances. This requires calling the :func:`~curses.noecho` function. ::" msgstr "" +#: ../../howto/curses.rst:98 msgid "curses.noecho()" msgstr "" -msgid "Applications will also commonly need to react to keys instantly, without requiring the Enter key to be pressed; this is called cbreak mode, as opposed to the usual buffered input mode. ::" +#: ../../howto/curses.rst:100 +msgid "" +"Applications will also commonly need to react to keys instantly, without " +"requiring the Enter key to be pressed; this is called cbreak mode, as " +"opposed to the usual buffered input mode. ::" msgstr "" +#: ../../howto/curses.rst:104 msgid "curses.cbreak()" msgstr "" -msgid "Terminals usually return special keys, such as the cursor keys or navigation keys such as Page Up and Home, as a multibyte escape sequence. While you could write your application to expect such sequences and process them accordingly, curses can do it for you, returning a special value such as :const:`curses.KEY_LEFT`. To get curses to do the job, you'll have to enable keypad mode. ::" +#: ../../howto/curses.rst:106 +msgid "" +"Terminals usually return special keys, such as the cursor keys or navigation " +"keys such as Page Up and Home, as a multibyte escape sequence. While you " +"could write your application to expect such sequences and process them " +"accordingly, curses can do it for you, returning a special value such " +"as :const:`curses.KEY_LEFT`. To get curses to do the job, you'll have to " +"enable keypad mode. ::" msgstr "" +#: ../../howto/curses.rst:113 msgid "stdscr.keypad(True)" msgstr "" -msgid "Terminating a curses application is much easier than starting one. You'll need to call::" +#: ../../howto/curses.rst:115 +msgid "" +"Terminating a curses application is much easier than starting one. You'll " +"need to call::" msgstr "" +#: ../../howto/curses.rst:118 msgid "" "curses.nocbreak()\n" "stdscr.keypad(False)\n" "curses.echo()" msgstr "" -msgid "to reverse the curses-friendly terminal settings. Then call the :func:`~curses.endwin` function to restore the terminal to its original operating mode. ::" +#: ../../howto/curses.rst:122 +msgid "" +"to reverse the curses-friendly terminal settings. Then call " +"the :func:`~curses.endwin` function to restore the terminal to its original " +"operating mode. ::" msgstr "" +#: ../../howto/curses.rst:126 msgid "curses.endwin()" msgstr "" -msgid "A common problem when debugging a curses application is to get your terminal messed up when the application dies without restoring the terminal to its previous state. In Python this commonly happens when your code is buggy and raises an uncaught exception. Keys are no longer echoed to the screen when you type them, for example, which makes using the shell difficult." +#: ../../howto/curses.rst:128 +msgid "" +"A common problem when debugging a curses application is to get your terminal " +"messed up when the application dies without restoring the terminal to its " +"previous state. In Python this commonly happens when your code is buggy and " +"raises an uncaught exception. Keys are no longer echoed to the screen when " +"you type them, for example, which makes using the shell difficult." msgstr "" -msgid "In Python you can avoid these complications and make debugging much easier by importing the :func:`curses.wrapper` function and using it like this::" +#: ../../howto/curses.rst:134 +msgid "" +"In Python you can avoid these complications and make debugging much easier " +"by importing the :func:`curses.wrapper` function and using it like this::" msgstr "" +#: ../../howto/curses.rst:137 msgid "" "from curses import wrapper\n" "\n" @@ -140,42 +248,104 @@ msgid "" "wrapper(main)" msgstr "" -msgid "The :func:`~curses.wrapper` function takes a callable object and does the initializations described above, also initializing colors if color support is present. :func:`!wrapper` then runs your provided callable. Once the callable returns, :func:`!wrapper` will restore the original state of the terminal. The callable is called inside a :keyword:`try`...\\ :keyword:`except` that catches exceptions, restores the state of the terminal, and then re-raises the exception. Therefore your terminal won't be left in a funny state on exception and you'll be able to read the exception's message and traceback." -msgstr "" - +#: ../../howto/curses.rst:153 +msgid "" +"The :func:`~curses.wrapper` function takes a callable object and does the " +"initializations described above, also initializing colors if color support " +"is present. :func:`!wrapper` then runs your provided callable. Once the " +"callable returns, :func:`!wrapper` will restore the original state of the " +"terminal. The callable is called inside a :keyword:`try`..." +"\\ :keyword:`except` that catches exceptions, restores the state of the " +"terminal, and then re-raises the exception. Therefore your terminal won't " +"be left in a funny state on exception and you'll be able to read the " +"exception's message and traceback." +msgstr "" + +#: ../../howto/curses.rst:165 msgid "Windows and Pads" msgstr "" -msgid "Windows are the basic abstraction in curses. A window object represents a rectangular area of the screen, and supports methods to display text, erase it, allow the user to input strings, and so forth." +#: ../../howto/curses.rst:167 +msgid "" +"Windows are the basic abstraction in curses. A window object represents a " +"rectangular area of the screen, and supports methods to display text, erase " +"it, allow the user to input strings, and so forth." msgstr "" -msgid "The ``stdscr`` object returned by the :func:`~curses.initscr` function is a window object that covers the entire screen. Many programs may need only this single window, but you might wish to divide the screen into smaller windows, in order to redraw or clear them separately. The :func:`~curses.newwin` function creates a new window of a given size, returning the new window object. ::" +#: ../../howto/curses.rst:171 +msgid "" +"The ``stdscr`` object returned by the :func:`~curses.initscr` function is a " +"window object that covers the entire screen. Many programs may need only " +"this single window, but you might wish to divide the screen into smaller " +"windows, in order to redraw or clear them separately. " +"The :func:`~curses.newwin` function creates a new window of a given size, " +"returning the new window object. ::" msgstr "" +#: ../../howto/curses.rst:178 msgid "" "begin_x = 20; begin_y = 7\n" "height = 5; width = 40\n" "win = curses.newwin(height, width, begin_y, begin_x)" msgstr "" -msgid "Note that the coordinate system used in curses is unusual. Coordinates are always passed in the order *y,x*, and the top-left corner of a window is coordinate (0,0). This breaks the normal convention for handling coordinates where the *x* coordinate comes first. This is an unfortunate difference from most other computer applications, but it's been part of curses since it was first written, and it's too late to change things now." +#: ../../howto/curses.rst:182 +msgid "" +"Note that the coordinate system used in curses is unusual. Coordinates are " +"always passed in the order *y,x*, and the top-left corner of a window is " +"coordinate (0,0). This breaks the normal convention for handling " +"coordinates where the *x* coordinate comes first. This is an unfortunate " +"difference from most other computer applications, but it's been part of " +"curses since it was first written, and it's too late to change things now." msgstr "" -msgid "Your application can determine the size of the screen by using the :data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and *x* sizes. Legal coordinates will then extend from ``(0,0)`` to ``(curses.LINES - 1, curses.COLS - 1)``." +#: ../../howto/curses.rst:190 +msgid "" +"Your application can determine the size of the screen by using " +"the :data:`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* " +"and *x* sizes. Legal coordinates will then extend from ``(0,0)`` to " +"``(curses.LINES - 1, curses.COLS - 1)``." msgstr "" -msgid "When you call a method to display or erase text, the effect doesn't immediately show up on the display. Instead you must call the :meth:`~curses.window.refresh` method of window objects to update the screen." +#: ../../howto/curses.rst:195 +msgid "" +"When you call a method to display or erase text, the effect doesn't " +"immediately show up on the display. Instead you must call " +"the :meth:`~curses.window.refresh` method of window objects to update the " +"screen." msgstr "" -msgid "This is because curses was originally written with slow 300-baud terminal connections in mind; with these terminals, minimizing the time required to redraw the screen was very important. Instead curses accumulates changes to the screen and displays them in the most efficient manner when you call :meth:`!refresh`. For example, if your program displays some text in a window and then clears the window, there's no need to send the original text because they're never visible." +#: ../../howto/curses.rst:200 +msgid "" +"This is because curses was originally written with slow 300-baud terminal " +"connections in mind; with these terminals, minimizing the time required to " +"redraw the screen was very important. Instead curses accumulates changes to " +"the screen and displays them in the most efficient manner when you " +"call :meth:`!refresh`. For example, if your program displays some text in a " +"window and then clears the window, there's no need to send the original text " +"because they're never visible." msgstr "" -msgid "In practice, explicitly telling curses to redraw a window doesn't really complicate programming with curses much. Most programs go into a flurry of activity, and then pause waiting for a keypress or some other action on the part of the user. All you have to do is to be sure that the screen has been redrawn before pausing to wait for user input, by first calling :meth:`!stdscr.refresh` or the :meth:`!refresh` method of some other relevant window." +#: ../../howto/curses.rst:209 +msgid "" +"In practice, explicitly telling curses to redraw a window doesn't really " +"complicate programming with curses much. Most programs go into a flurry of " +"activity, and then pause waiting for a keypress or some other action on the " +"part of the user. All you have to do is to be sure that the screen has been " +"redrawn before pausing to wait for user input, by first calling :meth:`!" +"stdscr.refresh` or the :meth:`!refresh` method of some other relevant window." msgstr "" -msgid "A pad is a special case of a window; it can be larger than the actual display screen, and only a portion of the pad displayed at a time. Creating a pad requires the pad's height and width, while refreshing a pad requires giving the coordinates of the on-screen area where a subsection of the pad will be displayed. ::" +#: ../../howto/curses.rst:217 +msgid "" +"A pad is a special case of a window; it can be larger than the actual " +"display screen, and only a portion of the pad displayed at a time. Creating " +"a pad requires the pad's height and width, while refreshing a pad requires " +"giving the coordinates of the on-screen area where a subsection of the pad " +"will be displayed. ::" msgstr "" +#: ../../howto/curses.rst:223 msgid "" "pad = curses.newpad(100, 100)\n" "# These loops fill the pad with letters; addch() is\n" @@ -193,194 +363,391 @@ msgid "" "pad.refresh( 0,0, 5,5, 20,75)" msgstr "" -msgid "The :meth:`!refresh` call displays a section of the pad in the rectangle extending from coordinate (5,5) to coordinate (20,75) on the screen; the upper left corner of the displayed section is coordinate (0,0) on the pad. Beyond that difference, pads are exactly like ordinary windows and support the same methods." +#: ../../howto/curses.rst:238 +msgid "" +"The :meth:`!refresh` call displays a section of the pad in the rectangle " +"extending from coordinate (5,5) to coordinate (20,75) on the screen; the " +"upper left corner of the displayed section is coordinate (0,0) on the pad. " +"Beyond that difference, pads are exactly like ordinary windows and support " +"the same methods." msgstr "" -msgid "If you have multiple windows and pads on screen there is a more efficient way to update the screen and prevent annoying screen flicker as each part of the screen gets updated. :meth:`!refresh` actually does two things:" +#: ../../howto/curses.rst:244 +msgid "" +"If you have multiple windows and pads on screen there is a more efficient " +"way to update the screen and prevent annoying screen flicker as each part of " +"the screen gets updated. :meth:`!refresh` actually does two things:" msgstr "" -msgid "Calls the :meth:`~curses.window.noutrefresh` method of each window to update an underlying data structure representing the desired state of the screen." +#: ../../howto/curses.rst:249 +msgid "" +"Calls the :meth:`~curses.window.noutrefresh` method of each window to update " +"an underlying data structure representing the desired state of the screen." msgstr "" -msgid "Calls the function :func:`~curses.doupdate` function to change the physical screen to match the desired state recorded in the data structure." +#: ../../howto/curses.rst:252 +msgid "" +"Calls the function :func:`~curses.doupdate` function to change the physical " +"screen to match the desired state recorded in the data structure." msgstr "" -msgid "Instead you can call :meth:`!noutrefresh` on a number of windows to update the data structure, and then call :func:`!doupdate` to update the screen." +#: ../../howto/curses.rst:255 +msgid "" +"Instead you can call :meth:`!noutrefresh` on a number of windows to update " +"the data structure, and then call :func:`!doupdate` to update the screen." msgstr "" +#: ../../howto/curses.rst:261 msgid "Displaying Text" msgstr "" -msgid "From a C programmer's point of view, curses may sometimes look like a twisty maze of functions, all subtly different. For example, :c:func:`!addstr` displays a string at the current cursor location in the ``stdscr`` window, while :c:func:`!mvaddstr` moves to a given y,x coordinate first before displaying the string. :c:func:`!waddstr` is just like :c:func:`!addstr`, but allows specifying a window to use instead of using ``stdscr`` by default. :c:func:`!mvwaddstr` allows specifying both a window and a coordinate." +#: ../../howto/curses.rst:263 +msgid "" +"From a C programmer's point of view, curses may sometimes look like a twisty " +"maze of functions, all subtly different. For example, :c:func:`!addstr` " +"displays a string at the current cursor location in the ``stdscr`` window, " +"while :c:func:`!mvaddstr` moves to a given y,x coordinate first before " +"displaying the string. :c:func:`!waddstr` is just like :c:func:`!addstr`, " +"but allows specifying a window to use instead of using ``stdscr`` by " +"default. :c:func:`!mvwaddstr` allows specifying both a window and a " +"coordinate." msgstr "" -msgid "Fortunately the Python interface hides all these details. ``stdscr`` is a window object like any other, and methods such as :meth:`~curses.window.addstr` accept multiple argument forms. Usually there are four different forms." +#: ../../howto/curses.rst:272 +msgid "" +"Fortunately the Python interface hides all these details. ``stdscr`` is a " +"window object like any other, and methods such " +"as :meth:`~curses.window.addstr` accept multiple argument forms. Usually " +"there are four different forms." msgstr "" +#: ../../howto/curses.rst:278 msgid "Form" msgstr "" +#: ../../howto/curses.rst:278 ../../howto/curses.rst:346 msgid "Description" msgstr "" +#: ../../howto/curses.rst:280 msgid "*str* or *ch*" msgstr "" +#: ../../howto/curses.rst:280 msgid "Display the string *str* or character *ch* at the current position" msgstr "" +#: ../../howto/curses.rst:283 msgid "*str* or *ch*, *attr*" msgstr "" -msgid "Display the string *str* or character *ch*, using attribute *attr* at the current position" +#: ../../howto/curses.rst:283 +msgid "" +"Display the string *str* or character *ch*, using attribute *attr* at the " +"current position" msgstr "" +#: ../../howto/curses.rst:287 msgid "*y*, *x*, *str* or *ch*" msgstr "" +#: ../../howto/curses.rst:287 msgid "Move to position *y,x* within the window, and display *str* or *ch*" msgstr "" +#: ../../howto/curses.rst:290 msgid "*y*, *x*, *str* or *ch*, *attr*" msgstr "" -msgid "Move to position *y,x* within the window, and display *str* or *ch*, using attribute *attr*" +#: ../../howto/curses.rst:290 +msgid "" +"Move to position *y,x* within the window, and display *str* or *ch*, using " +"attribute *attr*" msgstr "" -msgid "Attributes allow displaying text in highlighted forms such as boldface, underline, reverse code, or in color. They'll be explained in more detail in the next subsection." +#: ../../howto/curses.rst:294 +msgid "" +"Attributes allow displaying text in highlighted forms such as boldface, " +"underline, reverse code, or in color. They'll be explained in more detail " +"in the next subsection." msgstr "" -msgid "The :meth:`~curses.window.addstr` method takes a Python string or bytestring as the value to be displayed. The contents of bytestrings are sent to the terminal as-is. Strings are encoded to bytes using the value of the window's :attr:`~window.encoding` attribute; this defaults to the default system encoding as returned by :func:`locale.getencoding`." +#: ../../howto/curses.rst:299 +msgid "" +"The :meth:`~curses.window.addstr` method takes a Python string or bytestring " +"as the value to be displayed. The contents of bytestrings are sent to the " +"terminal as-is. Strings are encoded to bytes using the value of the " +"window's :attr:`~window.encoding` attribute; this defaults to the default " +"system encoding as returned by :func:`locale.getencoding`." msgstr "" -msgid "The :meth:`~curses.window.addch` methods take a character, which can be either a string of length 1, a bytestring of length 1, or an integer." +#: ../../howto/curses.rst:305 +msgid "" +"The :meth:`~curses.window.addch` methods take a character, which can be " +"either a string of length 1, a bytestring of length 1, or an integer." msgstr "" -msgid "Constants are provided for extension characters; these constants are integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/- symbol, and :const:`ACS_ULCORNER` is the upper left corner of a box (handy for drawing borders). You can also use the appropriate Unicode character." +#: ../../howto/curses.rst:308 +msgid "" +"Constants are provided for extension characters; these constants are " +"integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/- " +"symbol, and :const:`ACS_ULCORNER` is the upper left corner of a box (handy " +"for drawing borders). You can also use the appropriate Unicode character." msgstr "" -msgid "Windows remember where the cursor was left after the last operation, so if you leave out the *y,x* coordinates, the string or character will be displayed wherever the last operation left off. You can also move the cursor with the ``move(y,x)`` method. Because some terminals always display a flashing cursor, you may want to ensure that the cursor is positioned in some location where it won't be distracting; it can be confusing to have the cursor blinking at some apparently random location." +#: ../../howto/curses.rst:314 +msgid "" +"Windows remember where the cursor was left after the last operation, so if " +"you leave out the *y,x* coordinates, the string or character will be " +"displayed wherever the last operation left off. You can also move the " +"cursor with the ``move(y,x)`` method. Because some terminals always display " +"a flashing cursor, you may want to ensure that the cursor is positioned in " +"some location where it won't be distracting; it can be confusing to have the " +"cursor blinking at some apparently random location." msgstr "" -msgid "If your application doesn't need a blinking cursor at all, you can call ``curs_set(False)`` to make it invisible. For compatibility with older curses versions, there's a ``leaveok(bool)`` function that's a synonym for :func:`~curses.curs_set`. When *bool* is true, the curses library will attempt to suppress the flashing cursor, and you won't need to worry about leaving it in odd locations." +#: ../../howto/curses.rst:322 +msgid "" +"If your application doesn't need a blinking cursor at all, you can call " +"``curs_set(False)`` to make it invisible. For compatibility with older " +"curses versions, there's a ``leaveok(bool)`` function that's a synonym " +"for :func:`~curses.curs_set`. When *bool* is true, the curses library will " +"attempt to suppress the flashing cursor, and you won't need to worry about " +"leaving it in odd locations." msgstr "" +#: ../../howto/curses.rst:331 msgid "Attributes and Color" msgstr "" -msgid "Characters can be displayed in different ways. Status lines in a text-based application are commonly shown in reverse video, or a text viewer may need to highlight certain words. curses supports this by allowing you to specify an attribute for each cell on the screen." +#: ../../howto/curses.rst:333 +msgid "" +"Characters can be displayed in different ways. Status lines in a text-based " +"application are commonly shown in reverse video, or a text viewer may need " +"to highlight certain words. curses supports this by allowing you to specify " +"an attribute for each cell on the screen." msgstr "" -msgid "An attribute is an integer, each bit representing a different attribute. You can try to display text with multiple attribute bits set, but curses doesn't guarantee that all the possible combinations are available, or that they're all visually distinct. That depends on the ability of the terminal being used, so it's safest to stick to the most commonly available attributes, listed here." +#: ../../howto/curses.rst:338 +msgid "" +"An attribute is an integer, each bit representing a different attribute. " +"You can try to display text with multiple attribute bits set, but curses " +"doesn't guarantee that all the possible combinations are available, or that " +"they're all visually distinct. That depends on the ability of the terminal " +"being used, so it's safest to stick to the most commonly available " +"attributes, listed here." msgstr "" +#: ../../howto/curses.rst:346 msgid "Attribute" msgstr "" +#: ../../howto/curses.rst:348 msgid ":const:`A_BLINK`" msgstr "" +#: ../../howto/curses.rst:348 msgid "Blinking text" msgstr "" +#: ../../howto/curses.rst:350 msgid ":const:`A_BOLD`" msgstr "" +#: ../../howto/curses.rst:350 msgid "Extra bright or bold text" msgstr "" +#: ../../howto/curses.rst:352 msgid ":const:`A_DIM`" msgstr "" +#: ../../howto/curses.rst:352 msgid "Half bright text" msgstr "" +#: ../../howto/curses.rst:354 msgid ":const:`A_REVERSE`" msgstr "" +#: ../../howto/curses.rst:354 msgid "Reverse-video text" msgstr "" +#: ../../howto/curses.rst:356 msgid ":const:`A_STANDOUT`" msgstr "" +#: ../../howto/curses.rst:356 msgid "The best highlighting mode available" msgstr "" +#: ../../howto/curses.rst:358 msgid ":const:`A_UNDERLINE`" msgstr "" +#: ../../howto/curses.rst:358 msgid "Underlined text" msgstr "" -msgid "So, to display a reverse-video status line on the top line of the screen, you could code::" +#: ../../howto/curses.rst:361 +msgid "" +"So, to display a reverse-video status line on the top line of the screen, " +"you could code::" msgstr "" +#: ../../howto/curses.rst:364 msgid "" "stdscr.addstr(0, 0, \"Current mode: Typing mode\",\n" " curses.A_REVERSE)\n" "stdscr.refresh()" msgstr "" -msgid "The curses library also supports color on those terminals that provide it. The most common such terminal is probably the Linux console, followed by color xterms." +#: ../../howto/curses.rst:368 +msgid "" +"The curses library also supports color on those terminals that provide it. " +"The most common such terminal is probably the Linux console, followed by " +"color xterms." msgstr "" -msgid "To use color, you must call the :func:`~curses.start_color` function soon after calling :func:`~curses.initscr`, to initialize the default color set (the :func:`curses.wrapper` function does this automatically). Once that's done, the :func:`~curses.has_colors` function returns TRUE if the terminal in use can actually display color. (Note: curses uses the American spelling 'color', instead of the Canadian/British spelling 'colour'. If you're used to the British spelling, you'll have to resign yourself to misspelling it for the sake of these functions.)" +#: ../../howto/curses.rst:372 +msgid "" +"To use color, you must call the :func:`~curses.start_color` function soon " +"after calling :func:`~curses.initscr`, to initialize the default color set " +"(the :func:`curses.wrapper` function does this automatically). Once that's " +"done, the :func:`~curses.has_colors` function returns TRUE if the terminal " +"in use can actually display color. (Note: curses uses the American spelling " +"'color', instead of the Canadian/British spelling 'colour'. If you're used " +"to the British spelling, you'll have to resign yourself to misspelling it " +"for the sake of these functions.)" msgstr "" -msgid "The curses library maintains a finite number of color pairs, containing a foreground (or text) color and a background color. You can get the attribute value corresponding to a color pair with the :func:`~curses.color_pair` function; this can be bitwise-OR'ed with other attributes such as :const:`A_REVERSE`, but again, such combinations are not guaranteed to work on all terminals." +#: ../../howto/curses.rst:382 +msgid "" +"The curses library maintains a finite number of color pairs, containing a " +"foreground (or text) color and a background color. You can get the " +"attribute value corresponding to a color pair with " +"the :func:`~curses.color_pair` function; this can be bitwise-OR'ed with " +"other attributes such as :const:`A_REVERSE`, but again, such combinations " +"are not guaranteed to work on all terminals." msgstr "" +#: ../../howto/curses.rst:389 msgid "An example, which displays a line of text using color pair 1::" msgstr "" +#: ../../howto/curses.rst:391 msgid "" "stdscr.addstr(\"Pretty text\", curses.color_pair(1))\n" "stdscr.refresh()" msgstr "" -msgid "As I said before, a color pair consists of a foreground and background color. The ``init_pair(n, f, b)`` function changes the definition of color pair *n*, to foreground color f and background color b. Color pair 0 is hard-wired to white on black, and cannot be changed." +#: ../../howto/curses.rst:394 +msgid "" +"As I said before, a color pair consists of a foreground and background " +"color. The ``init_pair(n, f, b)`` function changes the definition of color " +"pair *n*, to foreground color f and background color b. Color pair 0 is " +"hard-wired to white on black, and cannot be changed." msgstr "" -msgid "Colors are numbered, and :func:`start_color` initializes 8 basic colors when it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white. The :mod:`curses` module defines named constants for each of these colors: :const:`curses.COLOR_BLACK`, :const:`curses.COLOR_RED`, and so forth." +#: ../../howto/curses.rst:399 +msgid "" +"Colors are numbered, and :func:`start_color` initializes 8 basic colors when " +"it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, " +"4:blue, 5:magenta, 6:cyan, and 7:white. The :mod:`curses` module defines " +"named constants for each of these " +"colors: :const:`curses.COLOR_BLACK`, :const:`curses.COLOR_RED`, and so forth." msgstr "" -msgid "Let's put all this together. To change color 1 to red text on a white background, you would call::" +#: ../../howto/curses.rst:405 +msgid "" +"Let's put all this together. To change color 1 to red text on a white " +"background, you would call::" msgstr "" +#: ../../howto/curses.rst:408 msgid "curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)" msgstr "" -msgid "When you change a color pair, any text already displayed using that color pair will change to the new colors. You can also display new text in this color with::" +#: ../../howto/curses.rst:410 +msgid "" +"When you change a color pair, any text already displayed using that color " +"pair will change to the new colors. You can also display new text in this " +"color with::" msgstr "" +#: ../../howto/curses.rst:414 msgid "stdscr.addstr(0,0, \"RED ALERT!\", curses.color_pair(1))" msgstr "" -msgid "Very fancy terminals can change the definitions of the actual colors to a given RGB value. This lets you change color 1, which is usually red, to purple or blue or any other color you like. Unfortunately, the Linux console doesn't support this, so I'm unable to try it out, and can't provide any examples. You can check if your terminal can do this by calling :func:`~curses.can_change_color`, which returns ``True`` if the capability is there. If you're lucky enough to have such a talented terminal, consult your system's man pages for more information." +#: ../../howto/curses.rst:416 +msgid "" +"Very fancy terminals can change the definitions of the actual colors to a " +"given RGB value. This lets you change color 1, which is usually red, to " +"purple or blue or any other color you like. Unfortunately, the Linux " +"console doesn't support this, so I'm unable to try it out, and can't provide " +"any examples. You can check if your terminal can do this by " +"calling :func:`~curses.can_change_color`, which returns ``True`` if the " +"capability is there. If you're lucky enough to have such a talented " +"terminal, consult your system's man pages for more information." msgstr "" +#: ../../howto/curses.rst:427 msgid "User Input" msgstr "" -msgid "The C curses library offers only very simple input mechanisms. Python's :mod:`curses` module adds a basic text-input widget. (Other libraries such as :pypi:`Urwid` have more extensive collections of widgets.)" +#: ../../howto/curses.rst:429 +msgid "" +"The C curses library offers only very simple input mechanisms. " +"Python's :mod:`curses` module adds a basic text-input widget. (Other " +"libraries such as :pypi:`Urwid` have more extensive collections of widgets.)" msgstr "" +#: ../../howto/curses.rst:433 msgid "There are two methods for getting input from a window:" msgstr "" -msgid ":meth:`~curses.window.getch` refreshes the screen and then waits for the user to hit a key, displaying the key if :func:`~curses.echo` has been called earlier. You can optionally specify a coordinate to which the cursor should be moved before pausing." -msgstr "" - -msgid ":meth:`~curses.window.getkey` does the same thing but converts the integer to a string. Individual characters are returned as 1-character strings, and special keys such as function keys return longer strings containing a key name such as ``KEY_UP`` or ``^G``." +#: ../../howto/curses.rst:435 +msgid "" +":meth:`~curses.window.getch` refreshes the screen and then waits for the " +"user to hit a key, displaying the key if :func:`~curses.echo` has been " +"called earlier. You can optionally specify a coordinate to which the cursor " +"should be moved before pausing." msgstr "" -msgid "It's possible to not wait for the user using the :meth:`~curses.window.nodelay` window method. After ``nodelay(True)``, :meth:`!getch` and :meth:`!getkey` for the window become non-blocking. To signal that no input is ready, :meth:`!getch` returns ``curses.ERR`` (a value of -1) and :meth:`!getkey` raises an exception. There's also a :func:`~curses.halfdelay` function, which can be used to (in effect) set a timer on each :meth:`!getch`; if no input becomes available within a specified delay (measured in tenths of a second), curses raises an exception." +#: ../../howto/curses.rst:440 +msgid "" +":meth:`~curses.window.getkey` does the same thing but converts the integer " +"to a string. Individual characters are returned as 1-character strings, and " +"special keys such as function keys return longer strings containing a key " +"name such as ``KEY_UP`` or ``^G``." msgstr "" -msgid "The :meth:`!getch` method returns an integer; if it's between 0 and 255, it represents the ASCII code of the key pressed. Values greater than 255 are special keys such as Page Up, Home, or the cursor keys. You can compare the value returned to constants such as :const:`curses.KEY_PPAGE`, :const:`curses.KEY_HOME`, or :const:`curses.KEY_LEFT`. The main loop of your program may look something like this::" +#: ../../howto/curses.rst:445 +msgid "" +"It's possible to not wait for the user using " +"the :meth:`~curses.window.nodelay` window method. After " +"``nodelay(True)``, :meth:`!getch` and :meth:`!getkey` for the window become " +"non-blocking. To signal that no input is ready, :meth:`!getch` returns " +"``curses.ERR`` (a value of -1) and :meth:`!getkey` raises an exception. " +"There's also a :func:`~curses.halfdelay` function, which can be used to (in " +"effect) set a timer on each :meth:`!getch`; if no input becomes available " +"within a specified delay (measured in tenths of a second), curses raises an " +"exception." +msgstr "" + +#: ../../howto/curses.rst:455 +msgid "" +"The :meth:`!getch` method returns an integer; if it's between 0 and 255, it " +"represents the ASCII code of the key pressed. Values greater than 255 are " +"special keys such as Page Up, Home, or the cursor keys. You can compare the " +"value returned to constants such " +"as :const:`curses.KEY_PPAGE`, :const:`curses.KEY_HOME`, " +"or :const:`curses.KEY_LEFT`. The main loop of your program may look " +"something like this::" msgstr "" +#: ../../howto/curses.rst:462 msgid "" "while True:\n" " c = stdscr.getch()\n" @@ -392,12 +759,26 @@ msgid "" " x = y = 0" msgstr "" -msgid "The :mod:`curses.ascii` module supplies ASCII class membership functions that take either integer or 1-character string arguments; these may be useful in writing more readable tests for such loops. It also supplies conversion functions that take either integer or 1-character-string arguments and return the same type. For example, :func:`curses.ascii.ctrl` returns the control character corresponding to its argument." +#: ../../howto/curses.rst:471 +msgid "" +"The :mod:`curses.ascii` module supplies ASCII class membership functions " +"that take either integer or 1-character string arguments; these may be " +"useful in writing more readable tests for such loops. It also supplies " +"conversion functions that take either integer or 1-character-string " +"arguments and return the same type. For example, :func:`curses.ascii.ctrl` " +"returns the control character corresponding to its argument." msgstr "" -msgid "There's also a method to retrieve an entire string, :meth:`~curses.window.getstr`. It isn't used very often, because its functionality is quite limited; the only editing keys available are the backspace key and the Enter key, which terminates the string. It can optionally be limited to a fixed number of characters. ::" +#: ../../howto/curses.rst:478 +msgid "" +"There's also a method to retrieve an entire " +"string, :meth:`~curses.window.getstr`. It isn't used very often, because " +"its functionality is quite limited; the only editing keys available are the " +"backspace key and the Enter key, which terminates the string. It can " +"optionally be limited to a fixed number of characters. ::" msgstr "" +#: ../../howto/curses.rst:484 msgid "" "curses.echo() # Enable echoing of characters\n" "\n" @@ -405,9 +786,16 @@ msgid "" "s = stdscr.getstr(0,0, 15)" msgstr "" -msgid "The :mod:`curses.textpad` module supplies a text box that supports an Emacs-like set of keybindings. Various methods of the :class:`~curses.textpad.Textbox` class support editing with input validation and gathering the edit results either with or without trailing spaces. Here's an example::" +#: ../../howto/curses.rst:489 +msgid "" +"The :mod:`curses.textpad` module supplies a text box that supports an Emacs-" +"like set of keybindings. Various methods of " +"the :class:`~curses.textpad.Textbox` class support editing with input " +"validation and gathering the edit results either with or without trailing " +"spaces. Here's an example::" msgstr "" +#: ../../howto/curses.rst:495 msgid "" "import curses\n" "from curses.textpad import Textbox, rectangle\n" @@ -428,32 +816,67 @@ msgid "" " message = box.gather()" msgstr "" -msgid "See the library documentation on :mod:`curses.textpad` for more details." +#: ../../howto/curses.rst:513 +msgid "" +"See the library documentation on :mod:`curses.textpad` for more details." msgstr "" +#: ../../howto/curses.rst:517 msgid "For More Information" msgstr "" -msgid "This HOWTO doesn't cover some advanced topics, such as reading the contents of the screen or capturing mouse events from an xterm instance, but the Python library page for the :mod:`curses` module is now reasonably complete. You should browse it next." +#: ../../howto/curses.rst:519 +msgid "" +"This HOWTO doesn't cover some advanced topics, such as reading the contents " +"of the screen or capturing mouse events from an xterm instance, but the " +"Python library page for the :mod:`curses` module is now reasonably " +"complete. You should browse it next." msgstr "" -msgid "If you're in doubt about the detailed behavior of the curses functions, consult the manual pages for your curses implementation, whether it's ncurses or a proprietary Unix vendor's. The manual pages will document any quirks, and provide complete lists of all the functions, attributes, and :ref:`ACS_\\* ` characters available to you." +#: ../../howto/curses.rst:524 +msgid "" +"If you're in doubt about the detailed behavior of the curses functions, " +"consult the manual pages for your curses implementation, whether it's " +"ncurses or a proprietary Unix vendor's. The manual pages will document any " +"quirks, and provide complete lists of all the functions, attributes, " +"and :ref:`ACS_\\* ` characters available to you." msgstr "" -msgid "Because the curses API is so large, some functions aren't supported in the Python interface. Often this isn't because they're difficult to implement, but because no one has needed them yet. Also, Python doesn't yet support the menu library associated with ncurses. Patches adding support for these would be welcome; see `the Python Developer's Guide `_ to learn more about submitting patches to Python." +#: ../../howto/curses.rst:531 +msgid "" +"Because the curses API is so large, some functions aren't supported in the " +"Python interface. Often this isn't because they're difficult to implement, " +"but because no one has needed them yet. Also, Python doesn't yet support " +"the menu library associated with ncurses. Patches adding support for these " +"would be welcome; see `the Python Developer's Guide `_ to learn more about submitting patches to Python." msgstr "" -msgid "`Writing Programs with NCURSES `_: a lengthy tutorial for C programmers." +#: ../../howto/curses.rst:539 +msgid "" +"`Writing Programs with NCURSES `_: a lengthy tutorial for C programmers." msgstr "" +#: ../../howto/curses.rst:541 msgid "`The ncurses man page `_" msgstr "" -msgid "`The ncurses FAQ `_" +#: ../../howto/curses.rst:542 +msgid "" +"`The ncurses FAQ `_" msgstr "" -msgid "`\"Use curses... don't swear\" `_: video of a PyCon 2013 talk on controlling terminals using curses or Urwid." +#: ../../howto/curses.rst:543 +msgid "" +"`\"Use curses... don't swear\" `_: video of a PyCon 2013 talk on controlling terminals using " +"curses or Urwid." msgstr "" -msgid "`\"Console Applications with Urwid\" `_: video of a PyCon CA 2012 talk demonstrating some applications written using Urwid." +#: ../../howto/curses.rst:545 +msgid "" +"`\"Console Applications with Urwid\" `_: video of a PyCon CA 2012 talk demonstrating some " +"applications written using Urwid." msgstr "" diff --git a/howto/descriptor.po b/howto/descriptor.po index 0e75f4afd..81aca118b 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,72 +24,115 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/descriptor.rst:5 msgid "Descriptor Guide" msgstr "" +#: ../../howto/descriptor.rst:0 msgid "Author" msgstr "" +#: ../../howto/descriptor.rst:7 msgid "Raymond Hettinger" msgstr "" +#: ../../howto/descriptor.rst:0 msgid "Contact" msgstr "" +#: ../../howto/descriptor.rst:8 msgid "" msgstr "" +#: ../../howto/descriptor.rst:11 msgid "Contents" msgstr "" -msgid ":term:`Descriptors ` let objects customize attribute lookup, storage, and deletion." +#: ../../howto/descriptor.rst:13 +msgid "" +":term:`Descriptors ` let objects customize attribute lookup, " +"storage, and deletion." msgstr "" +#: ../../howto/descriptor.rst:16 msgid "This guide has four major sections:" msgstr "" -msgid "The \"primer\" gives a basic overview, moving gently from simple examples, adding one feature at a time. Start here if you're new to descriptors." +#: ../../howto/descriptor.rst:18 +msgid "" +"The \"primer\" gives a basic overview, moving gently from simple examples, " +"adding one feature at a time. Start here if you're new to descriptors." msgstr "" -msgid "The second section shows a complete, practical descriptor example. If you already know the basics, start there." +#: ../../howto/descriptor.rst:21 +msgid "" +"The second section shows a complete, practical descriptor example. If you " +"already know the basics, start there." msgstr "" -msgid "The third section provides a more technical tutorial that goes into the detailed mechanics of how descriptors work. Most people don't need this level of detail." +#: ../../howto/descriptor.rst:24 +msgid "" +"The third section provides a more technical tutorial that goes into the " +"detailed mechanics of how descriptors work. Most people don't need this " +"level of detail." msgstr "" -msgid "The last section has pure Python equivalents for built-in descriptors that are written in C. Read this if you're curious about how functions turn into bound methods or about the implementation of common tools like :func:`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." +#: ../../howto/descriptor.rst:28 +msgid "" +"The last section has pure Python equivalents for built-in descriptors that " +"are written in C. Read this if you're curious about how functions turn into " +"bound methods or about the implementation of common tools " +"like :deco:`classmethod`, :deco:`staticmethod`, :deco:`property`, " +"and :term:`__slots__`." msgstr "" +#: ../../howto/descriptor.rst:36 msgid "Primer" msgstr "" -msgid "In this primer, we start with the most basic possible example and then we'll add new capabilities one by one." +#: ../../howto/descriptor.rst:38 +msgid "" +"In this primer, we start with the most basic possible example and then we'll " +"add new capabilities one by one." msgstr "" +#: ../../howto/descriptor.rst:43 msgid "Simple example: A descriptor that returns a constant" msgstr "" -msgid "The :class:`!Ten` class is a descriptor whose :meth:`~object.__get__` method always returns the constant ``10``:" +#: ../../howto/descriptor.rst:45 +msgid "" +"The :class:`!Ten` class is a descriptor whose :meth:`~object.__get__` method " +"always returns the constant ``10``:" msgstr "" +#: ../../howto/descriptor.rst:48 msgid "" "class Ten:\n" " def __get__(self, obj, objtype=None):\n" " return 10" msgstr "" -msgid "To use the descriptor, it must be stored as a class variable in another class:" +#: ../../howto/descriptor.rst:54 +msgid "" +"To use the descriptor, it must be stored as a class variable in another " +"class:" msgstr "" +#: ../../howto/descriptor.rst:56 msgid "" "class A:\n" " x = 5 # Regular class attribute\n" " y = Ten() # Descriptor instance" msgstr "" -msgid "An interactive session shows the difference between normal attribute lookup and descriptor lookup:" +#: ../../howto/descriptor.rst:62 +msgid "" +"An interactive session shows the difference between normal attribute lookup " +"and descriptor lookup:" msgstr "" +#: ../../howto/descriptor.rst:65 msgid "" ">>> a = A() # Make an instance of class A\n" ">>> a.x # Normal attribute lookup\n" @@ -98,24 +141,42 @@ msgid "" "10" msgstr "" -msgid "In the ``a.x`` attribute lookup, the dot operator finds ``'x': 5`` in the class dictionary. In the ``a.y`` lookup, the dot operator finds a descriptor instance, recognized by its ``__get__`` method. Calling that method returns ``10``." +#: ../../howto/descriptor.rst:73 +msgid "" +"In the ``a.x`` attribute lookup, the dot operator finds ``'x': 5`` in the " +"class dictionary. In the ``a.y`` lookup, the dot operator finds a " +"descriptor instance, recognized by its ``__get__`` method. Calling that " +"method returns ``10``." msgstr "" -msgid "Note that the value ``10`` is not stored in either the class dictionary or the instance dictionary. Instead, the value ``10`` is computed on demand." +#: ../../howto/descriptor.rst:78 +msgid "" +"Note that the value ``10`` is not stored in either the class dictionary or " +"the instance dictionary. Instead, the value ``10`` is computed on demand." msgstr "" -msgid "This example shows how a simple descriptor works, but it isn't very useful. For retrieving constants, normal attribute lookup would be better." +#: ../../howto/descriptor.rst:81 +msgid "" +"This example shows how a simple descriptor works, but it isn't very useful. " +"For retrieving constants, normal attribute lookup would be better." msgstr "" -msgid "In the next section, we'll create something more useful, a dynamic lookup." +#: ../../howto/descriptor.rst:84 +msgid "" +"In the next section, we'll create something more useful, a dynamic lookup." msgstr "" +#: ../../howto/descriptor.rst:88 msgid "Dynamic lookups" msgstr "" -msgid "Interesting descriptors typically run computations instead of returning constants:" +#: ../../howto/descriptor.rst:90 +msgid "" +"Interesting descriptors typically run computations instead of returning " +"constants:" msgstr "" +#: ../../howto/descriptor.rst:93 msgid "" "import os\n" "\n" @@ -132,33 +193,60 @@ msgid "" " self.dirname = dirname # Regular instance attribute" msgstr "" -msgid "An interactive session shows that the lookup is dynamic — it computes different, updated answers each time::" +#: ../../howto/descriptor.rst:109 +msgid "" +"An interactive session shows that the lookup is dynamic — it computes " +"different, updated answers each time::" msgstr "" +#: ../../howto/descriptor.rst:112 msgid "" ">>> s = Directory('songs')\n" ">>> g = Directory('games')\n" -">>> s.size # The songs directory has twenty files\n" +">>> s.size # The songs directory has twenty " +"files\n" "20\n" -">>> g.size # The games directory has three files\n" +">>> g.size # The games directory has three " +"files\n" "3\n" ">>> os.remove('games/chess') # Delete a game\n" -">>> g.size # File count is automatically updated\n" +">>> g.size # File count is automatically " +"updated\n" "2" msgstr "" -msgid "Besides showing how descriptors can run computations, this example also reveals the purpose of the parameters to :meth:`~object.__get__`. The *self* parameter is *size*, an instance of *DirectorySize*. The *obj* parameter is either *g* or *s*, an instance of *Directory*. It is the *obj* parameter that lets the :meth:`~object.__get__` method learn the target directory. The *objtype* parameter is the class *Directory*." +#: ../../howto/descriptor.rst:122 +msgid "" +"Besides showing how descriptors can run computations, this example also " +"reveals the purpose of the parameters to :meth:`~object.__get__`. The " +"*self* parameter is *size*, an instance of *DirectorySize*. The *obj* " +"parameter is either *g* or *s*, an instance of *Directory*. It is the *obj* " +"parameter that lets the :meth:`~object.__get__` method learn the target " +"directory. The *objtype* parameter is the class *Directory*." msgstr "" +#: ../../howto/descriptor.rst:131 msgid "Managed attributes" msgstr "" -msgid "A popular use for descriptors is managing access to instance data. The descriptor is assigned to a public attribute in the class dictionary while the actual data is stored as a private attribute in the instance dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object.__set__` methods are triggered when the public attribute is accessed." +#: ../../howto/descriptor.rst:133 +msgid "" +"A popular use for descriptors is managing access to instance data. The " +"descriptor is assigned to a public attribute in the class dictionary while " +"the actual data is stored as a private attribute in the instance " +"dictionary. The descriptor's :meth:`~object.__get__` " +"and :meth:`~object.__set__` methods are triggered when the public attribute " +"is accessed." msgstr "" -msgid "In the following example, *age* is the public attribute and *_age* is the private attribute. When the public attribute is accessed, the descriptor logs the lookup or update:" +#: ../../howto/descriptor.rst:139 +msgid "" +"In the following example, *age* is the public attribute and *_age* is the " +"private attribute. When the public attribute is accessed, the descriptor " +"logs the lookup or update:" msgstr "" +#: ../../howto/descriptor.rst:143 msgid "" "import logging\n" "\n" @@ -187,46 +275,70 @@ msgid "" " self.age += 1 # Calls both __get__() and __set__()" msgstr "" -msgid "An interactive session shows that all access to the managed attribute *age* is logged, but that the regular attribute *name* is not logged:" +#: ../../howto/descriptor.rst:172 +msgid "" +"An interactive session shows that all access to the managed attribute *age* " +"is logged, but that the regular attribute *name* is not logged:" msgstr "" +#: ../../howto/descriptor.rst:181 msgid "" ">>> mary = Person('Mary M', 30) # The initial age update is logged\n" "INFO:root:Updating 'age' to 30\n" ">>> dave = Person('David D', 40)\n" "INFO:root:Updating 'age' to 40\n" "\n" -">>> vars(mary) # The actual data is in a private attribute\n" +">>> vars(mary) # The actual data is in a private " +"attribute\n" "{'name': 'Mary M', '_age': 30}\n" ">>> vars(dave)\n" "{'name': 'David D', '_age': 40}\n" "\n" -">>> mary.age # Access the data and log the lookup\n" +">>> mary.age # Access the data and log the " +"lookup\n" "INFO:root:Accessing 'age' giving 30\n" "30\n" ">>> mary.birthday() # Updates are logged as well\n" "INFO:root:Accessing 'age' giving 30\n" "INFO:root:Updating 'age' to 31\n" "\n" -">>> dave.name # Regular attribute lookup isn't logged\n" +">>> dave.name # Regular attribute lookup isn't " +"logged\n" "'David D'\n" -">>> dave.age # Only the managed attribute is logged\n" +">>> dave.age # Only the managed attribute is " +"logged\n" "INFO:root:Accessing 'age' giving 40\n" "40" msgstr "" -msgid "One major issue with this example is that the private name *_age* is hardwired in the *LoggedAgeAccess* class. That means that each instance can only have one logged attribute and that its name is unchangeable. In the next example, we'll fix that problem." +#: ../../howto/descriptor.rst:206 +msgid "" +"One major issue with this example is that the private name *_age* is " +"hardwired in the *LoggedAgeAccess* class. That means that each instance can " +"only have one logged attribute and that its name is unchangeable. In the " +"next example, we'll fix that problem." msgstr "" +#: ../../howto/descriptor.rst:213 msgid "Customized names" msgstr "" -msgid "When a class uses descriptors, it can inform each descriptor about which variable name was used." +#: ../../howto/descriptor.rst:215 +msgid "" +"When a class uses descriptors, it can inform each descriptor about which " +"variable name was used." msgstr "" -msgid "In this example, the :class:`!Person` class has two descriptor instances, *name* and *age*. When the :class:`!Person` class is defined, it makes a callback to :meth:`~object.__set_name__` in *LoggedAccess* so that the field names can be recorded, giving each descriptor its own *public_name* and *private_name*:" +#: ../../howto/descriptor.rst:218 +msgid "" +"In this example, the :class:`!Person` class has two descriptor instances, " +"*name* and *age*. When the :class:`!Person` class is defined, it makes a " +"callback to :meth:`~object.__set_name__` in *LoggedAccess* so that the field " +"names can be recorded, giving each descriptor its own *public_name* and " +"*private_name*:" msgstr "" +#: ../../howto/descriptor.rst:223 msgid "" "import logging\n" "\n" @@ -260,9 +372,15 @@ msgid "" " self.age += 1" msgstr "" -msgid "An interactive session shows that the :class:`!Person` class has called :meth:`~object.__set_name__` so that the field names would be recorded. Here we call :func:`vars` to look up the descriptor without triggering it:" +#: ../../howto/descriptor.rst:256 +msgid "" +"An interactive session shows that the :class:`!Person` class has " +"called :meth:`~object.__set_name__` so that the field names would be " +"recorded. Here we call :func:`vars` to look up the descriptor without " +"triggering it:" msgstr "" +#: ../../howto/descriptor.rst:260 msgid "" ">>> vars(vars(Person)['name'])\n" "{'public_name': 'name', 'private_name': '_name'}\n" @@ -270,9 +388,11 @@ msgid "" "{'public_name': 'age', 'private_name': '_age'}" msgstr "" +#: ../../howto/descriptor.rst:267 msgid "The new class now logs access to both *name* and *age*:" msgstr "" +#: ../../howto/descriptor.rst:275 msgid "" ">>> pete = Person('Peter P', 10)\n" "INFO:root:Updating 'name' to 'Peter P'\n" @@ -282,9 +402,11 @@ msgid "" "INFO:root:Updating 'age' to 20" msgstr "" +#: ../../howto/descriptor.rst:284 msgid "The two *Person* instances contain only the private names:" msgstr "" +#: ../../howto/descriptor.rst:286 msgid "" ">>> vars(pete)\n" "{'_name': 'Peter P', '_age': 10}\n" @@ -292,45 +414,88 @@ msgid "" "{'_name': 'Catherine C', '_age': 20}" msgstr "" +#: ../../howto/descriptor.rst:295 msgid "Closing thoughts" msgstr "" -msgid "A :term:`descriptor` is what we call any object that defines :meth:`~object.__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." +#: ../../howto/descriptor.rst:297 +msgid "" +"A :term:`descriptor` is what we call any object that " +"defines :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`." msgstr "" -msgid "Optionally, descriptors can have a :meth:`~object.__set_name__` method. This is only used in cases where a descriptor needs to know either the class where it was created or the name of class variable it was assigned to. (This method, if present, is called even if the class is not a descriptor.)" +#: ../../howto/descriptor.rst:300 +msgid "" +"Optionally, descriptors can have a :meth:`~object.__set_name__` method. " +"This is only used in cases where a descriptor needs to know either the class " +"where it was created or the name of class variable it was assigned to. " +"(This method, if present, is called even if the class is not a descriptor.)" msgstr "" -msgid "Descriptors get invoked by the dot operator during attribute lookup. If a descriptor is accessed indirectly with ``vars(some_class)[descriptor_name]``, the descriptor instance is returned without invoking it." +#: ../../howto/descriptor.rst:305 +msgid "" +"Descriptors get invoked by the dot operator during attribute lookup. If a " +"descriptor is accessed indirectly with ``vars(some_class)" +"[descriptor_name]``, the descriptor instance is returned without invoking it." msgstr "" -msgid "Descriptors only work when used as class variables. When put in instances, they have no effect." +#: ../../howto/descriptor.rst:309 +msgid "" +"Descriptors only work when used as class variables. When put in instances, " +"they have no effect." msgstr "" -msgid "The main motivation for descriptors is to provide a hook allowing objects stored in class variables to control what happens during attribute lookup." +#: ../../howto/descriptor.rst:312 +msgid "" +"The main motivation for descriptors is to provide a hook allowing objects " +"stored in class variables to control what happens during attribute lookup." msgstr "" -msgid "Traditionally, the calling class controls what happens during lookup. Descriptors invert that relationship and allow the data being looked-up to have a say in the matter." +#: ../../howto/descriptor.rst:315 +msgid "" +"Traditionally, the calling class controls what happens during lookup. " +"Descriptors invert that relationship and allow the data being looked-up to " +"have a say in the matter." msgstr "" -msgid "Descriptors are used throughout the language. It is how functions turn into bound methods. Common tools like :func:`classmethod`, :func:`staticmethod`, :func:`property`, and :func:`functools.cached_property` are all implemented as descriptors." +#: ../../howto/descriptor.rst:319 +msgid "" +"Descriptors are used throughout the language. It is how functions turn into " +"bound methods. Common tools " +"like :deco:`classmethod`, :deco:`staticmethod`, :deco:`property`, " +"and :deco:`functools.cached_property` are all implemented as descriptors." msgstr "" +#: ../../howto/descriptor.rst:326 msgid "Complete Practical Example" msgstr "" -msgid "In this example, we create a practical and powerful tool for locating notoriously hard to find data corruption bugs." +#: ../../howto/descriptor.rst:328 +msgid "" +"In this example, we create a practical and powerful tool for locating " +"notoriously hard to find data corruption bugs." msgstr "" +#: ../../howto/descriptor.rst:333 msgid "Validator class" msgstr "" -msgid "A validator is a descriptor for managed attribute access. Prior to storing any data, it verifies that the new value meets various type and range restrictions. If those restrictions aren't met, it raises an exception to prevent data corruption at its source." +#: ../../howto/descriptor.rst:335 +msgid "" +"A validator is a descriptor for managed attribute access. Prior to storing " +"any data, it verifies that the new value meets various type and range " +"restrictions. If those restrictions aren't met, it raises an exception to " +"prevent data corruption at its source." msgstr "" -msgid "This :class:`!Validator` class is both an :term:`abstract base class` and a managed attribute descriptor:" +#: ../../howto/descriptor.rst:340 +msgid "" +"This :class:`!Validator` class is both an :term:`abstract base class` and a " +"managed attribute descriptor:" msgstr "" +#: ../../howto/descriptor.rst:343 msgid "" "from abc import ABC, abstractmethod\n" "\n" @@ -351,24 +516,41 @@ msgid "" " pass" msgstr "" -msgid "Custom validators need to inherit from :class:`!Validator` and must supply a :meth:`!validate` method to test various restrictions as needed." +#: ../../howto/descriptor.rst:363 +msgid "" +"Custom validators need to inherit from :class:`!Validator` and must supply " +"a :meth:`!validate` method to test various restrictions as needed." msgstr "" +#: ../../howto/descriptor.rst:368 msgid "Custom validators" msgstr "" +#: ../../howto/descriptor.rst:370 msgid "Here are three practical data validation utilities:" msgstr "" -msgid ":class:`!OneOf` verifies that a value is one of a restricted set of options." +#: ../../howto/descriptor.rst:372 +msgid "" +":class:`!OneOf` verifies that a value is one of a restricted set of options." msgstr "" -msgid ":class:`!Number` verifies that a value is either an :class:`int` or :class:`float`. Optionally, it verifies that a value is between a given minimum or maximum." +#: ../../howto/descriptor.rst:374 +msgid "" +":class:`!Number` verifies that a value is either an :class:`int` " +"or :class:`float`. Optionally, it verifies that a value is between a given " +"minimum or maximum." msgstr "" -msgid ":class:`!String` verifies that a value is a :class:`str`. Optionally, it validates a given minimum or maximum length. It can validate a user-defined `predicate `_ as well." +#: ../../howto/descriptor.rst:378 +msgid "" +":class:`!String` verifies that a value is a :class:`str`. Optionally, it " +"validates a given minimum or maximum length. It can validate a user-defined " +"`predicate `_ " +"as well." msgstr "" +#: ../../howto/descriptor.rst:383 msgid "" "class OneOf(Validator):\n" "\n" @@ -411,7 +593,8 @@ msgid "" " raise TypeError(f'Expected {value!r} to be a str')\n" " if self.minsize is not None and len(value) < self.minsize:\n" " raise ValueError(\n" -" f'Expected {value!r} to be no smaller than {self.minsize!r}'\n" +" f'Expected {value!r} to be no smaller than {self.minsize!" +"r}'\n" " )\n" " if self.maxsize is not None and len(value) > self.maxsize:\n" " raise ValueError(\n" @@ -423,12 +606,15 @@ msgid "" " )" msgstr "" +#: ../../howto/descriptor.rst:439 msgid "Practical application" msgstr "" +#: ../../howto/descriptor.rst:441 msgid "Here's how the data validators can be used in a real class:" msgstr "" +#: ../../howto/descriptor.rst:443 msgid "" "class Component:\n" "\n" @@ -442,14 +628,18 @@ msgid "" " self.quantity = quantity" msgstr "" +#: ../../howto/descriptor.rst:456 msgid "The descriptors prevent invalid instances from being created:" msgstr "" +#: ../../howto/descriptor.rst:458 msgid "" -">>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all uppercase\n" +">>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all " +"uppercase\n" "Traceback (most recent call last):\n" " ...\n" -"ValueError: Expected to be true for 'Widget'\n" +"ValueError: Expected to be true for " +"'Widget'\n" "\n" ">>> Component('WIDGET', 'metle', 5) # Blocked: 'metle' is misspelled\n" "Traceback (most recent call last):\n" @@ -469,84 +659,170 @@ msgid "" ">>> c = Component('WIDGET', 'metal', 5) # Allowed: The inputs are valid" msgstr "" +#: ../../howto/descriptor.rst:484 msgid "Technical Tutorial" msgstr "" -msgid "What follows is a more technical tutorial for the mechanics and details of how descriptors work." +#: ../../howto/descriptor.rst:486 +msgid "" +"What follows is a more technical tutorial for the mechanics and details of " +"how descriptors work." msgstr "" +#: ../../howto/descriptor.rst:491 msgid "Abstract" msgstr "" -msgid "Defines descriptors, summarizes the protocol, and shows how descriptors are called. Provides an example showing how object relational mappings work." +#: ../../howto/descriptor.rst:493 +msgid "" +"Defines descriptors, summarizes the protocol, and shows how descriptors are " +"called. Provides an example showing how object relational mappings work." msgstr "" -msgid "Learning about descriptors not only provides access to a larger toolset, it creates a deeper understanding of how Python works." +#: ../../howto/descriptor.rst:496 +msgid "" +"Learning about descriptors not only provides access to a larger toolset, it " +"creates a deeper understanding of how Python works." msgstr "" +#: ../../howto/descriptor.rst:501 msgid "Definition and introduction" msgstr "" -msgid "In general, a descriptor is an attribute value that has one of the methods in the descriptor protocol. Those methods are :meth:`~object.__get__`, :meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those methods are defined for an attribute, it is said to be a :term:`descriptor`." +#: ../../howto/descriptor.rst:503 +msgid "" +"In general, a descriptor is an attribute value that has one of the methods " +"in the descriptor protocol. Those methods " +"are :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"attribute, it is said to be a :term:`descriptor`." msgstr "" -msgid "The default behavior for attribute access is to get, set, or delete the attribute from an object's dictionary. For instance, ``a.x`` has a lookup chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and continuing through the method resolution order of ``type(a)``. If the looked-up value is an object defining one of the descriptor methods, then Python may override the default behavior and invoke the descriptor method instead. Where this occurs in the precedence chain depends on which descriptor methods were defined." +#: ../../howto/descriptor.rst:508 +msgid "" +"The default behavior for attribute access is to get, set, or delete the " +"attribute from an object's dictionary. For instance, ``a.x`` has a lookup " +"chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and " +"continuing through the method resolution order of ``type(a)``. If the looked-" +"up value is an object defining one of the descriptor methods, then Python " +"may override the default behavior and invoke the descriptor method instead. " +"Where this occurs in the precedence chain depends on which descriptor " +"methods were defined." msgstr "" -msgid "Descriptors are a powerful, general purpose protocol. They are the mechanism behind properties, methods, static methods, class methods, and :func:`super`. They are used throughout Python itself. Descriptors simplify the underlying C code and offer a flexible set of new tools for everyday Python programs." +#: ../../howto/descriptor.rst:517 +msgid "" +"Descriptors are a powerful, general purpose protocol. They are the " +"mechanism behind properties, methods, static methods, class methods, " +"and :func:`super`. They are used throughout Python itself. Descriptors " +"simplify the underlying C code and offer a flexible set of new tools for " +"everyday Python programs." msgstr "" +#: ../../howto/descriptor.rst:525 msgid "Descriptor protocol" msgstr "" +#: ../../howto/descriptor.rst:527 msgid "``descr.__get__(self, obj, type=None)``" msgstr "" +#: ../../howto/descriptor.rst:529 msgid "``descr.__set__(self, obj, value)``" msgstr "" +#: ../../howto/descriptor.rst:531 msgid "``descr.__delete__(self, obj)``" msgstr "" -msgid "That is all there is to it. Define any of these methods and an object is considered a descriptor and can override default behavior upon being looked up as an attribute." +#: ../../howto/descriptor.rst:533 +msgid "" +"That is all there is to it. Define any of these methods and an object is " +"considered a descriptor and can override default behavior upon being looked " +"up as an attribute." msgstr "" -msgid "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, it is considered a data descriptor. Descriptors that only define :meth:`~object.__get__` are called non-data descriptors (they are often used for methods but other uses are possible)." +#: ../../howto/descriptor.rst:537 +msgid "" +"If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " +"it is considered a data descriptor. Descriptors that only " +"define :meth:`~object.__get__` are called non-data descriptors (they are " +"often used for methods but other uses are possible)." msgstr "" -msgid "Data and non-data descriptors differ in how overrides are calculated with respect to entries in an instance's dictionary. If an instance's dictionary has an entry with the same name as a data descriptor, the data descriptor takes precedence. If an instance's dictionary has an entry with the same name as a non-data descriptor, the dictionary entry takes precedence." +#: ../../howto/descriptor.rst:542 +msgid "" +"Data and non-data descriptors differ in how overrides are calculated with " +"respect to entries in an instance's dictionary. If an instance's dictionary " +"has an entry with the same name as a data descriptor, the data descriptor " +"takes precedence. If an instance's dictionary has an entry with the same " +"name as a non-data descriptor, the dictionary entry takes precedence." msgstr "" -msgid "To make a read-only data descriptor, define both :meth:`~object.__get__` and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` method with an exception raising placeholder is enough to make it a data descriptor." +#: ../../howto/descriptor.rst:548 +msgid "" +"To make a read-only data descriptor, define both :meth:`~object.__get__` " +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising " +"an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` " +"method with an exception raising placeholder is enough to make it a data " +"descriptor." msgstr "" +#: ../../howto/descriptor.rst:555 msgid "Overview of descriptor invocation" msgstr "" -msgid "A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc.__get__(None, cls)``." +#: ../../howto/descriptor.rst:557 +msgid "" +"A descriptor can be called directly with ``desc.__get__(obj)`` or " +"``desc.__get__(None, cls)``." msgstr "" -msgid "But it is more common for a descriptor to be invoked automatically from attribute access." +#: ../../howto/descriptor.rst:560 +msgid "" +"But it is more common for a descriptor to be invoked automatically from " +"attribute access." msgstr "" -msgid "The expression ``obj.x`` looks up the attribute ``x`` in the chain of namespaces for ``obj``. If the search finds a descriptor outside of the instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is invoked according to the precedence rules listed below." +#: ../../howto/descriptor.rst:563 +msgid "" +"The expression ``obj.x`` looks up the attribute ``x`` in the chain of " +"namespaces for ``obj``. If the search finds a descriptor outside of the " +"instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is " +"invoked according to the precedence rules listed below." msgstr "" -msgid "The details of invocation depend on whether ``obj`` is an object, class, or instance of super." +#: ../../howto/descriptor.rst:568 +msgid "" +"The details of invocation depend on whether ``obj`` is an object, class, or " +"instance of super." msgstr "" +#: ../../howto/descriptor.rst:573 msgid "Invocation from an instance" msgstr "" -msgid "Instance lookup scans through a chain of namespaces giving data descriptors the highest priority, followed by instance variables, then non-data descriptors, then class variables, and lastly :meth:`~object.__getattr__` if it is provided." +#: ../../howto/descriptor.rst:575 +msgid "" +"Instance lookup scans through a chain of namespaces giving data descriptors " +"the highest priority, followed by instance variables, then non-data " +"descriptors, then class variables, and lastly :meth:`~object.__getattr__` if " +"it is provided." msgstr "" -msgid "If a descriptor is found for ``a.x``, then it is invoked with: ``desc.__get__(a, type(a))``." +#: ../../howto/descriptor.rst:580 +msgid "" +"If a descriptor is found for ``a.x``, then it is invoked with: " +"``desc.__get__(a, type(a))``." msgstr "" -msgid "The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here is a pure Python equivalent:" +#: ../../howto/descriptor.rst:583 +msgid "" +"The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here " +"is a pure Python equivalent:" msgstr "" +#: ../../howto/descriptor.rst:586 msgid "" "def find_name_in_mro(cls, name, default):\n" " \"Emulate _PyType_Lookup() in Objects/typeobject.c\"\n" @@ -568,18 +844,31 @@ msgid "" " if hasattr(obj, '__dict__') and name in vars(obj):\n" " return vars(obj)[name] # instance variable\n" " if descr_get is not null:\n" -" return descr_get(cls_var, obj, objtype) # non-data descriptor\n" +" return descr_get(cls_var, obj, objtype) # non-data " +"descriptor\n" " if cls_var is not null:\n" " return cls_var # class variable\n" " raise AttributeError(name)" msgstr "" -msgid "Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object.__getattribute__` code. That is why calling :meth:`~object.__getattribute__` directly or with ``super().__getattribute__`` will bypass :meth:`~object.__getattr__` entirely." +#: ../../howto/descriptor.rst:722 +msgid "" +"Note, there is no :meth:`~object.__getattr__` hook in " +"the :meth:`~object.__getattribute__` code. That is why " +"calling :meth:`~object.__getattribute__` directly or with " +"``super().__getattribute__`` will bypass :meth:`~object.__getattr__` " +"entirely." msgstr "" -msgid "Instead, it is the dot operator and the :func:`getattr` function that are responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. Their logic is encapsulated in a helper function:" +#: ../../howto/descriptor.rst:726 +msgid "" +"Instead, it is the dot operator and the :func:`getattr` function that are " +"responsible for invoking :meth:`~object.__getattr__` " +"whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. " +"Their logic is encapsulated in a helper function:" msgstr "" +#: ../../howto/descriptor.rst:731 msgid "" "def getattr_hook(obj, name):\n" " \"Emulate slot_tp_getattr_hook() in Objects/typeobject.c\"\n" @@ -591,84 +880,156 @@ msgid "" " return type(obj).__getattr__(obj, name) # __getattr__" msgstr "" +#: ../../howto/descriptor.rst:776 msgid "Invocation from a class" msgstr "" -msgid "The logic for a dotted lookup such as ``A.x`` is in :meth:`!type.__getattribute__`. The steps are similar to those for :meth:`!object.__getattribute__` but the instance dictionary lookup is replaced by a search through the class's :term:`method resolution order`." +#: ../../howto/descriptor.rst:778 +msgid "" +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!" +"type.__getattribute__`. The steps are similar to those for :meth:`!" +"object.__getattribute__` but the instance dictionary lookup is replaced by a " +"search through the class's :term:`method resolution order`." msgstr "" +#: ../../howto/descriptor.rst:783 msgid "If a descriptor is found, it is invoked with ``desc.__get__(None, A)``." msgstr "" -msgid "The full C implementation can be found in :c:func:`!type_getattro` and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." +#: ../../howto/descriptor.rst:785 +msgid "" +"The full C implementation can be found in :c:func:`!type_getattro` " +"and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" +#: ../../howto/descriptor.rst:790 msgid "Invocation from super" msgstr "" -msgid "The logic for super's dotted lookup is in the :meth:`~object.__getattribute__` method for object returned by :func:`super`." +#: ../../howto/descriptor.rst:792 +msgid "" +"The logic for super's dotted lookup is in " +"the :meth:`~object.__getattribute__` method for object returned " +"by :func:`super`." msgstr "" -msgid "A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__.__mro__`` for the base class ``B`` immediately following ``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is returned unchanged." +#: ../../howto/descriptor.rst:795 +msgid "" +"A dotted lookup such as ``super(A, obj).m`` searches " +"``obj.__class__.__mro__`` for the base class ``B`` immediately following " +"``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a " +"descriptor, ``m`` is returned unchanged." msgstr "" -msgid "The full C implementation can be found in :c:func:`!super_getattro` in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in `Guido's Tutorial `_." +#: ../../howto/descriptor.rst:800 +msgid "" +"The full C implementation can be found in :c:func:`!super_getattro` " +"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"`Guido's Tutorial `_." msgstr "" +#: ../../howto/descriptor.rst:807 msgid "Summary of invocation logic" msgstr "" -msgid "The mechanism for descriptors is embedded in the :meth:`~object.__getattribute__` methods for :class:`object`, :class:`type`, and :func:`super`." +#: ../../howto/descriptor.rst:809 +msgid "" +"The mechanism for descriptors is embedded in " +"the :meth:`~object.__getattribute__` methods " +"for :class:`object`, :class:`type`, and :func:`super`." msgstr "" +#: ../../howto/descriptor.rst:812 msgid "The important points to remember are:" msgstr "" +#: ../../howto/descriptor.rst:814 msgid "Descriptors are invoked by the :meth:`~object.__getattribute__` method." msgstr "" -msgid "Classes inherit this machinery from :class:`object`, :class:`type`, or :func:`super`." +#: ../../howto/descriptor.rst:816 +msgid "" +"Classes inherit this machinery from :class:`object`, :class:`type`, " +"or :func:`super`." msgstr "" -msgid "Overriding :meth:`~object.__getattribute__` prevents automatic descriptor calls because all the descriptor logic is in that method." +#: ../../howto/descriptor.rst:819 +msgid "" +"Overriding :meth:`~object.__getattribute__` prevents automatic descriptor " +"calls because all the descriptor logic is in that method." msgstr "" -msgid ":meth:`!object.__getattribute__` and :meth:`!type.__getattribute__` make different calls to :meth:`~object.__get__`. The first includes the instance and may include the class. The second puts in ``None`` for the instance and always includes the class." +#: ../../howto/descriptor.rst:822 +msgid "" +":meth:`!object.__getattribute__` and :meth:`!type.__getattribute__` make " +"different calls to :meth:`~object.__get__`. The first includes the instance " +"and may include the class. The second puts in ``None`` for the instance and " +"always includes the class." msgstr "" +#: ../../howto/descriptor.rst:827 msgid "Data descriptors always override instance dictionaries." msgstr "" +#: ../../howto/descriptor.rst:829 msgid "Non-data descriptors may be overridden by instance dictionaries." msgstr "" +#: ../../howto/descriptor.rst:833 msgid "Automatic name notification" msgstr "" -msgid "Sometimes it is desirable for a descriptor to know what class variable name it was assigned to. When a new class is created, the :class:`type` metaclass scans the dictionary of the new class. If any of the entries are descriptors and if they define :meth:`~object.__set_name__`, that method is called with two arguments. The *owner* is the class where the descriptor is used, and the *name* is the class variable the descriptor was assigned to." +#: ../../howto/descriptor.rst:835 +msgid "" +"Sometimes it is desirable for a descriptor to know what class variable name " +"it was assigned to. When a new class is created, the :class:`type` " +"metaclass scans the dictionary of the new class. If any of the entries are " +"descriptors and if they define :meth:`~object.__set_name__`, that method is " +"called with two arguments. The *owner* is the class where the descriptor is " +"used, and the *name* is the class variable the descriptor was assigned to." msgstr "" -msgid "The implementation details are in :c:func:`!type_new` and :c:func:`!set_names` in :source:`Objects/typeobject.c`." +#: ../../howto/descriptor.rst:842 +msgid "" +"The implementation details are in :c:func:`!type_new` and :c:func:`!" +"set_names` in :source:`Objects/typeobject.c`." msgstr "" -msgid "Since the update logic is in :meth:`!type.__new__`, notifications only take place at the time of class creation. If descriptors are added to the class afterwards, :meth:`~object.__set_name__` will need to be called manually." +#: ../../howto/descriptor.rst:845 +msgid "" +"Since the update logic is in :meth:`!type.__new__`, notifications only take " +"place at the time of class creation. If descriptors are added to the class " +"afterwards, :meth:`~object.__set_name__` will need to be called manually." msgstr "" +#: ../../howto/descriptor.rst:851 msgid "ORM example" msgstr "" -msgid "The following code is a simplified skeleton showing how data descriptors could be used to implement an `object relational mapping `_." +#: ../../howto/descriptor.rst:853 +msgid "" +"The following code is a simplified skeleton showing how data descriptors " +"could be used to implement an `object relational mapping `_." msgstr "" -msgid "The essential idea is that the data is stored in an external database. The Python instances only hold keys to the database's tables. Descriptors take care of lookups or updates:" +#: ../../howto/descriptor.rst:857 +msgid "" +"The essential idea is that the data is stored in an external database. The " +"Python instances only hold keys to the database's tables. Descriptors take " +"care of lookups or updates:" msgstr "" +#: ../../howto/descriptor.rst:861 msgid "" "class Field:\n" "\n" " def __set_name__(self, owner, name):\n" -" self.fetch = f'SELECT {name} FROM {owner.table} WHERE {owner.key}=?;'\n" -" self.store = f'UPDATE {owner.table} SET {name}=? WHERE {owner.key}=?;'\n" +" self.fetch = f'SELECT {name} FROM {owner.table} WHERE {owner.key}" +"=?;'\n" +" self.store = f'UPDATE {owner.table} SET {name}=? WHERE {owner.key}" +"=?;'\n" "\n" " def __get__(self, obj, objtype=None):\n" " return conn.execute(self.fetch, [obj.key]).fetchone()[0]\n" @@ -678,9 +1039,14 @@ msgid "" " conn.commit()" msgstr "" -msgid "We can use the :class:`!Field` class to define `models `_ that describe the schema for each table in a database:" +#: ../../howto/descriptor.rst:876 +msgid "" +"We can use the :class:`!Field` class to define `models `_ that describe the schema for each " +"table in a database:" msgstr "" +#: ../../howto/descriptor.rst:880 msgid "" "class Movie:\n" " table = 'Movies' # Table name\n" @@ -702,17 +1068,23 @@ msgid "" " self.key = key" msgstr "" +#: ../../howto/descriptor.rst:901 msgid "To use the models, first connect to the database::" msgstr "" +#: ../../howto/descriptor.rst:903 msgid "" ">>> import sqlite3\n" ">>> conn = sqlite3.connect('entertainment.db')" msgstr "" -msgid "An interactive session shows how data is retrieved from the database and how it can be updated:" +#: ../../howto/descriptor.rst:906 +msgid "" +"An interactive session shows how data is retrieved from the database and how " +"it can be updated:" msgstr "" +#: ../../howto/descriptor.rst:934 msgid "" ">>> Movie('Star Wars').director\n" "'George Lucas'\n" @@ -728,24 +1100,39 @@ msgid "" "'J.J. Abrams'" msgstr "" +#: ../../howto/descriptor.rst:955 msgid "Pure Python Equivalents" msgstr "" -msgid "The descriptor protocol is simple and offers exciting possibilities. Several use cases are so common that they have been prepackaged into built-in tools. Properties, bound methods, static methods, class methods, and \\_\\_slots\\_\\_ are all based on the descriptor protocol." +#: ../../howto/descriptor.rst:957 +msgid "" +"The descriptor protocol is simple and offers exciting possibilities. " +"Several use cases are so common that they have been prepackaged into built-" +"in tools. Properties, bound methods, static methods, class methods, and " +"\\_\\_slots\\_\\_ are all based on the descriptor protocol." msgstr "" +#: ../../howto/descriptor.rst:964 msgid "Properties" msgstr "" -msgid "Calling :func:`property` is a succinct way of building a data descriptor that triggers a function call upon access to an attribute. Its signature is::" +#: ../../howto/descriptor.rst:966 +msgid "" +"Calling :func:`property` is a succinct way of building a data descriptor " +"that triggers a function call upon access to an attribute. Its signature " +"is::" msgstr "" +#: ../../howto/descriptor.rst:969 msgid "property(fget=None, fset=None, fdel=None, doc=None) -> property" msgstr "" -msgid "The documentation shows a typical use to define a managed attribute ``x``:" +#: ../../howto/descriptor.rst:971 +msgid "" +"The documentation shows a typical use to define a managed attribute ``x``:" msgstr "" +#: ../../howto/descriptor.rst:973 msgid "" "class C:\n" " def getx(self): return self.__x\n" @@ -754,9 +1141,14 @@ msgid "" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" msgstr "" -msgid "To see how :func:`property` is implemented in terms of the descriptor protocol, here is a pure Python equivalent that implements most of the core functionality:" +#: ../../howto/descriptor.rst:995 +msgid "" +"To see how :func:`property` is implemented in terms of the descriptor " +"protocol, here is a pure Python equivalent that implements most of the core " +"functionality:" msgstr "" +#: ../../howto/descriptor.rst:998 msgid "" "class Property:\n" " \"Emulate PyProperty_Type() in Objects/descrobject.c\"\n" @@ -799,12 +1191,24 @@ msgid "" " return type(self)(self.fget, self.fset, fdel, self.__doc__)" msgstr "" -msgid "The :func:`property` builtin helps whenever a user interface has granted attribute access and then subsequent changes require the intervention of a method." +#: ../../howto/descriptor.rst:1122 +msgid "" +"The :func:`property` builtin helps whenever a user interface has granted " +"attribute access and then subsequent changes require the intervention of a " +"method." msgstr "" -msgid "For instance, a spreadsheet class may grant access to a cell value through ``Cell('b10').value``. Subsequent improvements to the program require the cell to be recalculated on every access; however, the programmer does not want to affect existing client code accessing the attribute directly. The solution is to wrap access to the value attribute in a property data descriptor:" +#: ../../howto/descriptor.rst:1126 +msgid "" +"For instance, a spreadsheet class may grant access to a cell value through " +"``Cell('b10').value``. Subsequent improvements to the program require the " +"cell to be recalculated on every access; however, the programmer does not " +"want to affect existing client code accessing the attribute directly. The " +"solution is to wrap access to the value attribute in a property data " +"descriptor:" msgstr "" +#: ../../howto/descriptor.rst:1132 msgid "" "class Cell:\n" " ...\n" @@ -816,21 +1220,37 @@ msgid "" " return self._value" msgstr "" -msgid "Either the built-in :func:`property` or our :func:`!Property` equivalent would work in this example." +#: ../../howto/descriptor.rst:1143 +msgid "" +"Either the built-in :func:`property` or our :func:`!Property` equivalent " +"would work in this example." msgstr "" +#: ../../howto/descriptor.rst:1148 msgid "Functions and methods" msgstr "" -msgid "Python's object oriented features are built upon a function based environment. Using non-data descriptors, the two are merged seamlessly." +#: ../../howto/descriptor.rst:1150 +msgid "" +"Python's object oriented features are built upon a function based " +"environment. Using non-data descriptors, the two are merged seamlessly." msgstr "" -msgid "Functions stored in class dictionaries get turned into methods when invoked. Methods only differ from regular functions in that the object instance is prepended to the other arguments. By convention, the instance is called *self* but could be called *this* or any other variable name." +#: ../../howto/descriptor.rst:1153 +msgid "" +"Functions stored in class dictionaries get turned into methods when invoked. " +"Methods only differ from regular functions in that the object instance is " +"prepended to the other arguments. By convention, the instance is called " +"*self* but could be called *this* or any other variable name." msgstr "" -msgid "Methods can be created manually with :class:`types.MethodType` which is roughly equivalent to:" +#: ../../howto/descriptor.rst:1158 +msgid "" +"Methods can be created manually with :class:`types.MethodType` which is " +"roughly equivalent to:" msgstr "" +#: ../../howto/descriptor.rst:1161 msgid "" "class MethodType:\n" " \"Emulate PyMethod_Type in Objects/classobject.c\"\n" @@ -859,9 +1279,15 @@ msgid "" " return self" msgstr "" -msgid "To support automatic creation of methods, functions include the :meth:`~object.__get__` method for binding methods during attribute access. This means that functions are non-data descriptors that return bound methods during dotted lookup from an instance. Here's how it works:" +#: ../../howto/descriptor.rst:1189 +msgid "" +"To support automatic creation of methods, functions include " +"the :meth:`~object.__get__` method for binding methods during attribute " +"access. This means that functions are non-data descriptors that return " +"bound methods during dotted lookup from an instance. Here's how it works:" msgstr "" +#: ../../howto/descriptor.rst:1194 msgid "" "class Function:\n" " ...\n" @@ -873,9 +1299,13 @@ msgid "" " return MethodType(self, obj)" msgstr "" -msgid "Running the following class in the interpreter shows how the function descriptor works in practice:" +#: ../../howto/descriptor.rst:1205 +msgid "" +"Running the following class in the interpreter shows how the function " +"descriptor works in practice:" msgstr "" +#: ../../howto/descriptor.rst:1208 msgid "" "class D:\n" " def f(self):\n" @@ -885,42 +1315,63 @@ msgid "" " pass" msgstr "" -msgid "The function has a :term:`qualified name` attribute to support introspection:" +#: ../../howto/descriptor.rst:1226 +msgid "" +"The function has a :term:`qualified name` attribute to support introspection:" msgstr "" +#: ../../howto/descriptor.rst:1228 msgid "" ">>> D.f.__qualname__\n" "'D.f'" msgstr "" -msgid "Accessing the function through the class dictionary does not invoke :meth:`~object.__get__`. Instead, it just returns the underlying function object::" +#: ../../howto/descriptor.rst:1233 +msgid "" +"Accessing the function through the class dictionary does not " +"invoke :meth:`~object.__get__`. Instead, it just returns the underlying " +"function object::" msgstr "" +#: ../../howto/descriptor.rst:1236 msgid "" ">>> D.__dict__['f']\n" "" msgstr "" -msgid "Dotted access from a class calls :meth:`~object.__get__` which just returns the underlying function unchanged::" +#: ../../howto/descriptor.rst:1239 +msgid "" +"Dotted access from a class calls :meth:`~object.__get__` which just returns " +"the underlying function unchanged::" msgstr "" +#: ../../howto/descriptor.rst:1242 msgid "" ">>> D.f\n" "" msgstr "" -msgid "The interesting behavior occurs during dotted access from an instance. The dotted lookup calls :meth:`~object.__get__` which returns a bound method object::" +#: ../../howto/descriptor.rst:1245 +msgid "" +"The interesting behavior occurs during dotted access from an instance. The " +"dotted lookup calls :meth:`~object.__get__` which returns a bound method " +"object::" msgstr "" +#: ../../howto/descriptor.rst:1248 msgid "" ">>> d = D()\n" ">>> d.f\n" ">" msgstr "" -msgid "Internally, the bound method stores the underlying function and the bound instance::" +#: ../../howto/descriptor.rst:1252 +msgid "" +"Internally, the bound method stores the underlying function and the bound " +"instance::" msgstr "" +#: ../../howto/descriptor.rst:1255 msgid "" ">>> d.f.__func__\n" "\n" @@ -929,66 +1380,112 @@ msgid "" "<__main__.D object at 0x00B18C90>" msgstr "" -msgid "If you have ever wondered where *self* comes from in regular methods or where *cls* comes from in class methods, this is it!" +#: ../../howto/descriptor.rst:1261 +msgid "" +"If you have ever wondered where *self* comes from in regular methods or " +"where *cls* comes from in class methods, this is it!" msgstr "" +#: ../../howto/descriptor.rst:1266 msgid "Kinds of methods" msgstr "" -msgid "Non-data descriptors provide a simple mechanism for variations on the usual patterns of binding functions into methods." +#: ../../howto/descriptor.rst:1268 +msgid "" +"Non-data descriptors provide a simple mechanism for variations on the usual " +"patterns of binding functions into methods." msgstr "" -msgid "To recap, functions have a :meth:`~object.__get__` method so that they can be converted to a method when accessed as attributes. The non-data descriptor transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. Calling ``cls.f(*args)`` becomes ``f(*args)``." +#: ../../howto/descriptor.rst:1271 +msgid "" +"To recap, functions have a :meth:`~object.__get__` method so that they can " +"be converted to a method when accessed as attributes. The non-data " +"descriptor transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. " +"Calling ``cls.f(*args)`` becomes ``f(*args)``." msgstr "" +#: ../../howto/descriptor.rst:1276 msgid "This chart summarizes the binding and its two most useful variants:" msgstr "" +#: ../../howto/descriptor.rst:1279 msgid "Transformation" msgstr "" +#: ../../howto/descriptor.rst:1279 msgid "Called from an object" msgstr "" +#: ../../howto/descriptor.rst:1279 msgid "Called from a class" msgstr "" +#: ../../howto/descriptor.rst:1282 msgid "function" msgstr "" +#: ../../howto/descriptor.rst:1282 msgid "f(obj, \\*args)" msgstr "" +#: ../../howto/descriptor.rst:1282 ../../howto/descriptor.rst:1284 msgid "f(\\*args)" msgstr "" +#: ../../howto/descriptor.rst:1284 msgid "staticmethod" msgstr "" +#: ../../howto/descriptor.rst:1286 msgid "classmethod" msgstr "" +#: ../../howto/descriptor.rst:1286 msgid "f(type(obj), \\*args)" msgstr "" +#: ../../howto/descriptor.rst:1286 msgid "f(cls, \\*args)" msgstr "" +#: ../../howto/descriptor.rst:1291 msgid "Static methods" msgstr "" -msgid "Static methods return the underlying function without changes. Calling either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a result, the function becomes identically accessible from either an object or a class." +#: ../../howto/descriptor.rst:1293 +msgid "" +"Static methods return the underlying function without changes. Calling " +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " +"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " +"\"f\")``. As a result, the function becomes identically accessible from " +"either an object or a class." msgstr "" -msgid "Good candidates for static methods are methods that do not reference the ``self`` variable." +#: ../../howto/descriptor.rst:1299 +msgid "" +"Good candidates for static methods are methods that do not reference the " +"``self`` variable." msgstr "" -msgid "For instance, a statistics package may include a container class for experimental data. The class provides normal methods for computing the average, mean, median, and other descriptive statistics that depend on the data. However, there may be useful functions which are conceptually related but do not depend on the data. For instance, ``erf(x)`` is handy conversion routine that comes up in statistical work but does not directly depend on a particular dataset. It can be called either from an object or the class: ``s.erf(1.5) --> 0.9332`` or ``Sample.erf(1.5) --> 0.9332``." +#: ../../howto/descriptor.rst:1302 +msgid "" +"For instance, a statistics package may include a container class for " +"experimental data. The class provides normal methods for computing the " +"average, mean, median, and other descriptive statistics that depend on the " +"data. However, there may be useful functions which are conceptually related " +"but do not depend on the data. For instance, ``erf(x)`` is handy conversion " +"routine that comes up in statistical work but does not directly depend on a " +"particular dataset. It can be called either from an object or the class: " +"``s.erf(1.5) --> 0.9332`` or ``Sample.erf(1.5) --> 0.9332``." msgstr "" -msgid "Since static methods return the underlying function with no changes, the example calls are unexciting:" +#: ../../howto/descriptor.rst:1311 +msgid "" +"Since static methods return the underlying function with no changes, the " +"example calls are unexciting:" msgstr "" +#: ../../howto/descriptor.rst:1314 msgid "" "class E:\n" " @staticmethod\n" @@ -996,6 +1493,7 @@ msgid "" " return x * 10" msgstr "" +#: ../../howto/descriptor.rst:1321 msgid "" ">>> E.f(3)\n" "30\n" @@ -1003,9 +1501,13 @@ msgid "" "30" msgstr "" -msgid "Using the non-data descriptor protocol, a pure Python version of :func:`staticmethod` would look like this:" +#: ../../howto/descriptor.rst:1328 +msgid "" +"Using the non-data descriptor protocol, a pure Python version " +"of :deco:`staticmethod` would look like this:" msgstr "" +#: ../../howto/descriptor.rst:1331 msgid "" "import functools\n" "\n" @@ -1027,15 +1529,27 @@ msgid "" " return self.f.__annotations__" msgstr "" -msgid "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute that refers to the underlying function. Also it carries forward the attributes necessary to make the wrapper look like the wrapped function, including :attr:`~function.__name__`, :attr:`~function.__qualname__`, and :attr:`~function.__doc__`." +#: ../../howto/descriptor.rst:1352 +msgid "" +"The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " +"that refers to the underlying function. Also it carries forward the " +"attributes necessary to make the wrapper look like the wrapped function, " +"including :attr:`~function.__name__`, :attr:`~function.__qualname__`, " +"and :attr:`~function.__doc__`." msgstr "" +#: ../../howto/descriptor.rst:1421 msgid "Class methods" msgstr "" -msgid "Unlike static methods, class methods prepend the class reference to the argument list before calling the function. This format is the same for whether the caller is an object or a class:" +#: ../../howto/descriptor.rst:1423 +msgid "" +"Unlike static methods, class methods prepend the class reference to the " +"argument list before calling the function. This format is the same for " +"whether the caller is an object or a class:" msgstr "" +#: ../../howto/descriptor.rst:1427 msgid "" "class F:\n" " @classmethod\n" @@ -1043,6 +1557,7 @@ msgid "" " return cls.__name__, x" msgstr "" +#: ../../howto/descriptor.rst:1434 msgid "" ">>> F.f(3)\n" "('F', 3)\n" @@ -1050,9 +1565,16 @@ msgid "" "('F', 3)" msgstr "" -msgid "This behavior is useful whenever the method only needs to have a class reference and does not rely on data stored in a specific instance. One use for class methods is to create alternate class constructors. For example, the classmethod :func:`dict.fromkeys` creates a new dictionary from a list of keys. The pure Python equivalent is:" +#: ../../howto/descriptor.rst:1441 +msgid "" +"This behavior is useful whenever the method only needs to have a class " +"reference and does not rely on data stored in a specific instance. One use " +"for class methods is to create alternate class constructors. For example, " +"the classmethod :func:`dict.fromkeys` creates a new dictionary from a list " +"of keys. The pure Python equivalent is:" msgstr "" +#: ../../howto/descriptor.rst:1447 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1064,9 +1586,11 @@ msgid "" " return d" msgstr "" +#: ../../howto/descriptor.rst:1458 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" +#: ../../howto/descriptor.rst:1460 msgid "" ">>> d = Dict.fromkeys('abracadabra')\n" ">>> type(d) is Dict\n" @@ -1075,9 +1599,13 @@ msgid "" "{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" msgstr "" -msgid "Using the non-data descriptor protocol, a pure Python version of :func:`classmethod` would look like this:" +#: ../../howto/descriptor.rst:1468 +msgid "" +"Using the non-data descriptor protocol, a pure Python version " +"of :deco:`classmethod` would look like this:" msgstr "" +#: ../../howto/descriptor.rst:1471 msgid "" "import functools\n" "\n" @@ -1094,23 +1622,40 @@ msgid "" " return MethodType(self.f, cls)" msgstr "" -msgid "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a ``__wrapped__`` attribute that refers to the underlying function. Also it carries forward the attributes necessary to make the wrapper look like the wrapped function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, and :attr:`~function.__annotations__`." +#: ../../howto/descriptor.rst:1533 +msgid "" +"The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " +"``__wrapped__`` attribute that refers to the underlying function. Also it " +"carries forward the attributes necessary to make the wrapper look like the " +"wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" +#: ../../howto/descriptor.rst:1542 msgid "Member objects and __slots__" msgstr "" -msgid "When a class defines ``__slots__``, it replaces instance dictionaries with a fixed-length array of slot values. From a user point of view that has several effects:" +#: ../../howto/descriptor.rst:1544 +msgid "" +"When a class defines ``__slots__``, it replaces instance dictionaries with a " +"fixed-length array of slot values. From a user point of view that has " +"several effects:" msgstr "" -msgid "1. Provides immediate detection of bugs due to misspelled attribute assignments. Only attribute names specified in ``__slots__`` are allowed:" +#: ../../howto/descriptor.rst:1548 +msgid "" +"1. Provides immediate detection of bugs due to misspelled attribute " +"assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" +#: ../../howto/descriptor.rst:1551 msgid "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" msgstr "" +#: ../../howto/descriptor.rst:1556 msgid "" ">>> auto = Vehicle()\n" ">>> auto.id_nubmer = 'VYE483814LQEX'\n" @@ -1119,13 +1664,18 @@ msgid "" "AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" msgstr "" -msgid "2. Helps create immutable objects where descriptors manage access to private attributes stored in ``__slots__``:" +#: ../../howto/descriptor.rst:1564 +msgid "" +"2. Helps create immutable objects where descriptors manage access to private " +"attributes stored in ``__slots__``:" msgstr "" +#: ../../howto/descriptor.rst:1567 msgid "" "class Immutable:\n" "\n" -" __slots__ = ('_dept', '_name') # Replace the instance dictionary\n" +" __slots__ = ('_dept', '_name') # Replace the instance " +"dictionary\n" "\n" " def __init__(self, dept, name):\n" " self._dept = dept # Store to private attribute\n" @@ -1140,6 +1690,7 @@ msgid "" " return self._name" msgstr "" +#: ../../howto/descriptor.rst:1585 msgid "" ">>> mark = Immutable('Botany', 'Mark Watney')\n" ">>> mark.dept\n" @@ -1154,15 +1705,27 @@ msgid "" "AttributeError: 'Immutable' object has no attribute 'location'" msgstr "" -msgid "3. Saves memory. On a 64-bit Linux build, an instance with two attributes takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight design pattern `_ likely only matters when a large number of instances are going to be created." +#: ../../howto/descriptor.rst:1599 +msgid "" +"3. Saves memory. On a 64-bit Linux build, an instance with two attributes " +"takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " +"design pattern `_ likely " +"only matters when a large number of instances are going to be created." msgstr "" -msgid "4. Improves speed. Reading instance variables is 35% faster with ``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." +#: ../../howto/descriptor.rst:1604 +msgid "" +"4. Improves speed. Reading instance variables is 35% faster with " +"``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -msgid "5. Blocks tools like :func:`functools.cached_property` which require an instance dictionary to function correctly:" +#: ../../howto/descriptor.rst:1607 +msgid "" +"5. Blocks tools like :deco:`functools.cached_property` which require an " +"instance dictionary to function correctly:" msgstr "" +#: ../../howto/descriptor.rst:1610 msgid "" "from functools import cached_property\n" "\n" @@ -1175,6 +1738,7 @@ msgid "" " for n in reversed(range(100_000)))" msgstr "" +#: ../../howto/descriptor.rst:1622 msgid "" ">>> CP().pi\n" "Traceback (most recent call last):\n" @@ -1182,9 +1746,17 @@ msgid "" "TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." msgstr "" -msgid "It is not possible to create an exact drop-in pure Python version of ``__slots__`` because it requires direct access to C structures and control over object memory allocation. However, we can build a mostly faithful simulation where the actual C structure for slots is emulated by a private ``_slotvalues`` list. Reads and writes to that private structure are managed by member descriptors:" +#: ../../howto/descriptor.rst:1629 +msgid "" +"It is not possible to create an exact drop-in pure Python version of " +"``__slots__`` because it requires direct access to C structures and control " +"over object memory allocation. However, we can build a mostly faithful " +"simulation where the actual C structure for slots is emulated by a private " +"``_slotvalues`` list. Reads and writes to that private structure are " +"managed by member descriptors:" msgstr "" +#: ../../howto/descriptor.rst:1636 msgid "" "null = object()\n" "\n" @@ -1223,9 +1795,13 @@ msgid "" " return f''" msgstr "" -msgid "The :meth:`!type.__new__` method takes care of adding member objects to class variables:" +#: ../../howto/descriptor.rst:1674 +msgid "" +"The :meth:`!type.__new__` method takes care of adding member objects to " +"class variables:" msgstr "" +#: ../../howto/descriptor.rst:1677 msgid "" "class Type(type):\n" " 'Simulate how the type metaclass adds member objects for slots'\n" @@ -1239,9 +1815,14 @@ msgid "" " return type.__new__(mcls, clsname, bases, mapping, **kwargs)" msgstr "" -msgid "The :meth:`object.__new__` method takes care of creating instances that have slots instead of an instance dictionary. Here is a rough simulation in pure Python:" +#: ../../howto/descriptor.rst:1690 +msgid "" +"The :meth:`object.__new__` method takes care of creating instances that have " +"slots instead of an instance dictionary. Here is a rough simulation in pure " +"Python:" msgstr "" +#: ../../howto/descriptor.rst:1694 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -1273,9 +1854,13 @@ msgid "" " super().__delattr__(name)" msgstr "" -msgid "To use the simulation in a real class, just inherit from :class:`!Object` and set the :term:`metaclass` to :class:`Type`:" +#: ../../howto/descriptor.rst:1725 +msgid "" +"To use the simulation in a real class, just inherit from :class:`!Object` " +"and set the :term:`metaclass` to :class:`Type`:" msgstr "" +#: ../../howto/descriptor.rst:1728 msgid "" "class H(Object, metaclass=Type):\n" " 'Instance variables stored in slots'\n" @@ -1287,9 +1872,12 @@ msgid "" " self.y = y" msgstr "" -msgid "At this point, the metaclass has loaded member objects for *x* and *y*::" +#: ../../howto/descriptor.rst:1739 +msgid "" +"At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" +#: ../../howto/descriptor.rst:1741 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -1301,9 +1889,13 @@ msgid "" " 'y': }" msgstr "" -msgid "When instances are created, they have a ``slot_values`` list where the attributes are stored:" +#: ../../howto/descriptor.rst:1760 +msgid "" +"When instances are created, they have a ``slot_values`` list where the " +"attributes are stored:" msgstr "" +#: ../../howto/descriptor.rst:1763 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -1313,9 +1905,11 @@ msgid "" "{'_slotvalues': [55, 20]}" msgstr "" +#: ../../howto/descriptor.rst:1772 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" +#: ../../howto/descriptor.rst:1774 msgid "" ">>> h.xz\n" "Traceback (most recent call last):\n" diff --git a/howto/enum.po b/howto/enum.po index 1a9f8bed3..cefe763c8 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,15 +24,24 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/enum.rst:5 msgid "Enum HOWTO" msgstr "" -msgid "An :class:`Enum` is a set of symbolic names bound to unique values. They are similar to global variables, but they offer a more useful :func:`repr`, grouping, type-safety, and a few other features." +#: ../../howto/enum.rst:11 +msgid "" +"An :class:`Enum` is a set of symbolic names bound to unique values. They " +"are similar to global variables, but they offer a more useful :func:`repr`, " +"grouping, type-safety, and a few other features." msgstr "" -msgid "They are most useful when you have a variable that can take one of a limited selection of values. For example, the days of the week::" +#: ../../howto/enum.rst:15 +msgid "" +"They are most useful when you have a variable that can take one of a limited " +"selection of values. For example, the days of the week::" msgstr "" +#: ../../howto/enum.rst:18 msgid "" ">>> from enum import Enum\n" ">>> class Weekday(Enum):\n" @@ -45,9 +54,11 @@ msgid "" "... SUNDAY = 7" msgstr "" +#: ../../howto/enum.rst:28 msgid "Or perhaps the RGB primary colors::" msgstr "" +#: ../../howto/enum.rst:30 msgid "" ">>> from enum import Enum\n" ">>> class Color(Enum):\n" @@ -56,34 +67,55 @@ msgid "" "... BLUE = 3" msgstr "" -msgid "As you can see, creating an :class:`Enum` is as simple as writing a class that inherits from :class:`Enum` itself." +#: ../../howto/enum.rst:36 +msgid "" +"As you can see, creating an :class:`Enum` is as simple as writing a class " +"that inherits from :class:`Enum` itself." msgstr "" +#: ../../howto/enum.rst:39 msgid "Case of Enum Members" msgstr "" -msgid "Because Enums are used to represent constants, and to help avoid issues with name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples." +#: ../../howto/enum.rst:41 +msgid "" +"Because Enums are used to represent constants, and to help avoid issues with " +"name clashes between mixin-class methods/attributes and enum names, we " +"strongly recommend using UPPER_CASE names for members, and will be using " +"that style in our examples." msgstr "" -msgid "Depending on the nature of the enum a member's value may or may not be important, but either way that value can be used to get the corresponding member::" +#: ../../howto/enum.rst:46 +msgid "" +"Depending on the nature of the enum a member's value may or may not be " +"important, but either way that value can be used to get the corresponding " +"member::" msgstr "" +#: ../../howto/enum.rst:50 msgid "" ">>> Weekday(3)\n" "" msgstr "" -msgid "As you can see, the ``repr()`` of a member shows the enum name, the member name, and the value. The ``str()`` of a member shows only the enum name and member name::" +#: ../../howto/enum.rst:53 +msgid "" +"As you can see, the ``repr()`` of a member shows the enum name, the member " +"name, and the value. The ``str()`` of a member shows only the enum name and " +"member name::" msgstr "" +#: ../../howto/enum.rst:57 msgid "" ">>> print(Weekday.THURSDAY)\n" "Weekday.THURSDAY" msgstr "" +#: ../../howto/enum.rst:60 msgid "The *type* of an enumeration member is the enum it belongs to::" msgstr "" +#: ../../howto/enum.rst:62 msgid "" ">>> type(Weekday.MONDAY)\n" "\n" @@ -91,34 +123,50 @@ msgid "" "True" msgstr "" +#: ../../howto/enum.rst:67 msgid "Enum members have an attribute that contains just their :attr:`!name`::" msgstr "" +#: ../../howto/enum.rst:69 msgid "" ">>> print(Weekday.TUESDAY.name)\n" "TUESDAY" msgstr "" +#: ../../howto/enum.rst:72 msgid "Likewise, they have an attribute for their :attr:`!value`::" msgstr "" +#: ../../howto/enum.rst:75 msgid "" ">>> Weekday.WEDNESDAY.value\n" "3" msgstr "" -msgid "Unlike many languages that treat enumerations solely as name/value pairs, Python Enums can have behavior added. For example, :class:`datetime.date` has two methods for returning the weekday: :meth:`~datetime.date.weekday` and :meth:`~datetime.date.isoweekday`. The difference is that one of them counts from 0-6 and the other from 1-7. Rather than keep track of that ourselves we can add a method to the :class:`!Weekday` enum to extract the day from the :class:`~datetime.date` instance and return the matching enum member::" +#: ../../howto/enum.rst:78 +msgid "" +"Unlike many languages that treat enumerations solely as name/value pairs, " +"Python Enums can have behavior added. For example, :class:`datetime.date` " +"has two methods for returning the weekday: :meth:`~datetime.date.weekday` " +"and :meth:`~datetime.date.isoweekday`. The difference is that one of them " +"counts from 0-6 and the other from 1-7. Rather than keep track of that " +"ourselves we can add a method to the :class:`!Weekday` enum to extract the " +"day from the :class:`~datetime.date` instance and return the matching enum " +"member::" msgstr "" +#: ../../howto/enum.rst:87 msgid "" "@classmethod\n" "def from_date(cls, date):\n" " return cls(date.isoweekday())" msgstr "" +#: ../../howto/enum.rst:91 msgid "The complete :class:`!Weekday` enum now looks like this::" msgstr "" +#: ../../howto/enum.rst:93 msgid "" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -134,21 +182,32 @@ msgid "" "... return cls(date.isoweekday())" msgstr "" +#: ../../howto/enum.rst:106 msgid "Now we can find out what today is! Observe::" msgstr "" +#: ../../howto/enum.rst:108 msgid "" ">>> import datetime as dt\n" ">>> Weekday.from_date(dt.date.today())\n" "" msgstr "" -msgid "Of course, if you're reading this on some other day, you'll see that day instead." +#: ../../howto/enum.rst:112 +msgid "" +"Of course, if you're reading this on some other day, you'll see that day " +"instead." msgstr "" -msgid "This :class:`!Weekday` enum is great if our variable only needs one day, but what if we need several? Maybe we're writing a function to plot chores during a week, and don't want to use a :class:`list` -- we could use a different type of :class:`Enum`::" +#: ../../howto/enum.rst:114 +msgid "" +"This :class:`!Weekday` enum is great if our variable only needs one day, but " +"what if we need several? Maybe we're writing a function to plot chores " +"during a week, and don't want to use a :class:`list` -- we could use a " +"different type of :class:`Enum`::" msgstr "" +#: ../../howto/enum.rst:119 msgid "" ">>> from enum import Flag\n" ">>> class Weekday(Flag):\n" @@ -161,30 +220,43 @@ msgid "" "... SUNDAY = 64" msgstr "" -msgid "We've changed two things: we're inherited from :class:`Flag`, and the values are all powers of 2." +#: ../../howto/enum.rst:129 +msgid "" +"We've changed two things: we're inherited from :class:`Flag`, and the values " +"are all powers of 2." msgstr "" -msgid "Just like the original :class:`!Weekday` enum above, we can have a single selection::" +#: ../../howto/enum.rst:132 +msgid "" +"Just like the original :class:`!Weekday` enum above, we can have a single " +"selection::" msgstr "" +#: ../../howto/enum.rst:134 msgid "" ">>> first_week_day = Weekday.MONDAY\n" ">>> first_week_day\n" "" msgstr "" -msgid "But :class:`Flag` also allows us to combine several members into a single variable::" +#: ../../howto/enum.rst:138 +msgid "" +"But :class:`Flag` also allows us to combine several members into a single " +"variable::" msgstr "" +#: ../../howto/enum.rst:141 msgid "" ">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" ">>> weekend\n" "" msgstr "" +#: ../../howto/enum.rst:145 msgid "You can even iterate over a :class:`Flag` variable::" msgstr "" +#: ../../howto/enum.rst:147 msgid "" ">>> for day in weekend:\n" "... print(day)\n" @@ -192,20 +264,25 @@ msgid "" "Weekday.SUNDAY" msgstr "" +#: ../../howto/enum.rst:152 msgid "Okay, let's get some chores set up::" msgstr "" +#: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday.FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" +#: ../../howto/enum.rst:160 msgid "And a function to display the chores for a given day::" msgstr "" +#: ../../howto/enum.rst:162 msgid "" ">>> def show_chores(chores, day):\n" "... for chore, days in chores.items():\n" @@ -216,9 +293,13 @@ msgid "" "answer SO questions" msgstr "" -msgid "In cases where the actual values of the members do not matter, you can save yourself some work and use :func:`auto` for the values::" +#: ../../howto/enum.rst:170 +msgid "" +"In cases where the actual values of the members do not matter, you can save " +"yourself some work and use :func:`auto` for the values::" msgstr "" +#: ../../howto/enum.rst:173 msgid "" ">>> from enum import auto\n" ">>> class Weekday(Flag):\n" @@ -232,12 +313,18 @@ msgid "" "... WEEKEND = SATURDAY | SUNDAY" msgstr "" +#: ../../howto/enum.rst:189 msgid "Programmatic access to enumeration members and their attributes" msgstr "" -msgid "Sometimes it's useful to access members in enumerations programmatically (i.e. situations where ``Color.RED`` won't do because the exact color is not known at program-writing time). ``Enum`` allows such access::" +#: ../../howto/enum.rst:191 +msgid "" +"Sometimes it's useful to access members in enumerations programmatically " +"(i.e. situations where ``Color.RED`` won't do because the exact color is not " +"known at program-writing time). ``Enum`` allows such access::" msgstr "" +#: ../../howto/enum.rst:195 msgid "" ">>> Color(1)\n" "\n" @@ -245,9 +332,11 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:200 msgid "If you want to access enum members by *name*, use item access::" msgstr "" +#: ../../howto/enum.rst:202 msgid "" ">>> Color['RED']\n" "\n" @@ -255,9 +344,12 @@ msgid "" "" msgstr "" -msgid "If you have an enum member and need its :attr:`!name` or :attr:`!value`::" +#: ../../howto/enum.rst:207 +msgid "" +"If you have an enum member and need its :attr:`!name` or :attr:`!value`::" msgstr "" +#: ../../howto/enum.rst:209 msgid "" ">>> member = Color.RED\n" ">>> member.name\n" @@ -266,12 +358,15 @@ msgid "" "1" msgstr "" +#: ../../howto/enum.rst:217 msgid "Duplicating enum members and values" msgstr "" +#: ../../howto/enum.rst:219 msgid "Having two enum members with the same name is invalid::" msgstr "" +#: ../../howto/enum.rst:221 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -282,9 +377,16 @@ msgid "" "TypeError: 'SQUARE' already defined as 2" msgstr "" -msgid "However, an enum member can have other names associated with it. Given two entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` is an alias for the member ``A``. By-value lookup of the value of ``A`` will return the member ``A``. By-name lookup of ``A`` will return the member ``A``. By-name lookup of ``B`` will also return the member ``A``::" +#: ../../howto/enum.rst:229 +msgid "" +"However, an enum member can have other names associated with it. Given two " +"entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " +"is an alias for the member ``A``. By-value lookup of the value of ``A`` " +"will return the member ``A``. By-name lookup of ``A`` will return the " +"member ``A``. By-name lookup of ``B`` will also return the member ``A``::" msgstr "" +#: ../../howto/enum.rst:235 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -300,15 +402,24 @@ msgid "" "" msgstr "" -msgid "Attempting to create a member with the same name as an already defined attribute (another member, a method, etc.) or attempting to create an attribute with the same name as a member is not allowed." +#: ../../howto/enum.rst:250 +msgid "" +"Attempting to create a member with the same name as an already defined " +"attribute (another member, a method, etc.) or attempting to create an " +"attribute with the same name as a member is not allowed." msgstr "" +#: ../../howto/enum.rst:256 msgid "Ensuring unique enumeration values" msgstr "" -msgid "By default, enumerations allow multiple names as aliases for the same value. When this behavior isn't desired, you can use the :func:`unique` decorator::" +#: ../../howto/enum.rst:258 +msgid "" +"By default, enumerations allow multiple names as aliases for the same value. " +"When this behavior isn't desired, you can use the :deco:`unique` decorator::" msgstr "" +#: ../../howto/enum.rst:261 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -323,12 +434,15 @@ msgid "" "ValueError: duplicate values found in : FOUR -> THREE" msgstr "" +#: ../../howto/enum.rst:275 msgid "Using automatic values" msgstr "" +#: ../../howto/enum.rst:277 msgid "If the exact value is unimportant you can use :class:`auto`::" msgstr "" +#: ../../howto/enum.rst:279 msgid "" ">>> from enum import Enum, auto\n" ">>> class Color(Enum):\n" @@ -340,9 +454,13 @@ msgid "" "[1, 2, 3]" msgstr "" -msgid "The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden::" +#: ../../howto/enum.rst:288 +msgid "" +"The values are chosen by :func:`~Enum._generate_next_value_`, which can be " +"overridden::" msgstr "" +#: ../../howto/enum.rst:291 msgid "" ">>> class AutoName(Enum):\n" "... @staticmethod\n" @@ -359,28 +477,44 @@ msgid "" "['NORTH', 'SOUTH', 'EAST', 'WEST']" msgstr "" -msgid "The :meth:`~Enum._generate_next_value_` method must be defined before any members." +#: ../../howto/enum.rst:307 +msgid "" +"The :meth:`~Enum._generate_next_value_` method must be defined before any " +"members." msgstr "" +#: ../../howto/enum.rst:310 msgid "Iteration" msgstr "" +#: ../../howto/enum.rst:312 msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "" +#: ../../howto/enum.rst:314 msgid "" ">>> list(Shape)\n" "[, , ]\n" ">>> list(Weekday)\n" -"[, , , , , , ]" +"[, , , " +", , , " +"]" msgstr "" -msgid "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` aren't shown." +#: ../../howto/enum.rst:319 +msgid "" +"Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` " +"aren't shown." msgstr "" -msgid "The special attribute ``__members__`` is a read-only ordered mapping of names to members. It includes all names defined in the enumeration, including the aliases::" +#: ../../howto/enum.rst:321 +msgid "" +"The special attribute ``__members__`` is a read-only ordered mapping of " +"names to members. It includes all names defined in the enumeration, " +"including the aliases::" msgstr "" +#: ../../howto/enum.rst:325 msgid "" ">>> for name, member in Shape.__members__.items():\n" "... name, member\n" @@ -391,23 +525,34 @@ msgid "" "('ALIAS_FOR_SQUARE', )" msgstr "" -msgid "The ``__members__`` attribute can be used for detailed programmatic access to the enumeration members. For example, finding all the aliases::" +#: ../../howto/enum.rst:333 +msgid "" +"The ``__members__`` attribute can be used for detailed programmatic access " +"to the enumeration members. For example, finding all the aliases::" msgstr "" +#: ../../howto/enum.rst:336 msgid "" -">>> [name for name, member in Shape.__members__.items() if member.name != name]\n" +">>> [name for name, member in Shape.__members__.items() if member.name != " +"name]\n" "['ALIAS_FOR_SQUARE']" msgstr "" -msgid "Aliases for flags include values with multiple flags set, such as ``3``, and no flags set, i.e. ``0``." +#: ../../howto/enum.rst:341 +msgid "" +"Aliases for flags include values with multiple flags set, such as ``3``, and " +"no flags set, i.e. ``0``." msgstr "" +#: ../../howto/enum.rst:346 msgid "Comparisons" msgstr "" +#: ../../howto/enum.rst:348 msgid "Enumeration members are compared by identity::" msgstr "" +#: ../../howto/enum.rst:350 msgid "" ">>> Color.RED is Color.RED\n" "True\n" @@ -417,9 +562,13 @@ msgid "" "True" msgstr "" -msgid "Ordered comparisons between enumeration values are *not* supported. Enum members are not integers (but see `IntEnum`_ below)::" +#: ../../howto/enum.rst:357 +msgid "" +"Ordered comparisons between enumeration values are *not* supported. Enum " +"members are not integers (but see `IntEnum`_ below)::" msgstr "" +#: ../../howto/enum.rst:360 msgid "" ">>> Color.RED < Color.BLUE\n" "Traceback (most recent call last):\n" @@ -427,9 +576,11 @@ msgid "" "TypeError: '<' not supported between instances of 'Color' and 'Color'" msgstr "" +#: ../../howto/enum.rst:365 msgid "Equality comparisons are defined though::" msgstr "" +#: ../../howto/enum.rst:367 msgid "" ">>> Color.BLUE == Color.RED\n" "False\n" @@ -439,26 +590,46 @@ msgid "" "True" msgstr "" -msgid "Comparisons against non-enumeration values will always compare not equal (again, :class:`IntEnum` was explicitly designed to behave differently, see below)::" +#: ../../howto/enum.rst:374 +msgid "" +"Comparisons against non-enumeration values will always compare not equal " +"(again, :class:`IntEnum` was explicitly designed to behave differently, see " +"below)::" msgstr "" +#: ../../howto/enum.rst:378 msgid "" ">>> Color.BLUE == 2\n" "False" msgstr "" -msgid "It is possible to reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members." +#: ../../howto/enum.rst:383 +msgid "" +"It is possible to reload modules -- if a reloaded module contains enums, " +"they will be recreated, and the new members may not compare identical/equal " +"to the original members." msgstr "" +#: ../../howto/enum.rst:388 msgid "Allowed members and attributes of enumerations" msgstr "" -msgid "Most of the examples above use integers for enumeration values. Using integers is short and handy (and provided by default by the `Functional API`_), but not strictly enforced. In the vast majority of use-cases, one doesn't care what the actual value of an enumeration is. But if the value *is* important, enumerations can have arbitrary values." +#: ../../howto/enum.rst:390 +msgid "" +"Most of the examples above use integers for enumeration values. Using " +"integers is short and handy (and provided by default by the `Functional " +"API`_), but not strictly enforced. In the vast majority of use-cases, one " +"doesn't care what the actual value of an enumeration is. But if the value " +"*is* important, enumerations can have arbitrary values." msgstr "" -msgid "Enumerations are Python classes, and can have methods and special methods as usual. If we have this enumeration::" +#: ../../howto/enum.rst:396 +msgid "" +"Enumerations are Python classes, and can have methods and special methods as " +"usual. If we have this enumeration::" msgstr "" +#: ../../howto/enum.rst:399 msgid "" ">>> class Mood(Enum):\n" "... FUNKY = 1\n" @@ -478,9 +649,11 @@ msgid "" "..." msgstr "" +#: ../../howto/enum.rst:416 msgid "Then::" msgstr "" +#: ../../howto/enum.rst:418 msgid "" ">>> Mood.favorite_mood()\n" "\n" @@ -490,29 +663,56 @@ msgid "" "'my custom str! 1'" msgstr "" -msgid "The rules for what is allowed are as follows: names that start and end with a single underscore are reserved by enum and cannot be used; all other attributes defined within an enumeration will become members of this enumeration, with the exception of special methods (:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also descriptors), and variable names listed in :attr:`~Enum._ignore_`." +#: ../../howto/enum.rst:425 +msgid "" +"The rules for what is allowed are as follows: names that start and end with " +"a single underscore are reserved by enum and cannot be used; all other " +"attributes defined within an enumeration will become members of this " +"enumeration, with the exception of special methods " +"(:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors " +"(methods are also descriptors), and variable names listed " +"in :attr:`~Enum._ignore_`." msgstr "" -msgid "Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:`~object.__init__`, any value(s) given to the enum member will be passed into those methods. See `Planet`_ for an example." +#: ../../howto/enum.rst:432 +msgid "" +"Note: if your enumeration defines :meth:`~object.__new__` and/" +"or :meth:`~object.__init__`, any value(s) given to the enum member will be " +"passed into those methods. See `Planet`_ for an example." msgstr "" -msgid "The :meth:`~object.__new__` method, if defined, is used during creation of the Enum members; it is then replaced by Enum's :meth:`~object.__new__` which is used after class creation for lookup of existing members. See :ref:`new-vs-init` for more details." +#: ../../howto/enum.rst:438 +msgid "" +"The :meth:`~object.__new__` method, if defined, is used during creation of " +"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " +"which is used after class creation for lookup of existing members. " +"See :ref:`new-vs-init` for more details." msgstr "" +#: ../../howto/enum.rst:445 msgid "Restricted Enum subclassing" msgstr "" -msgid "A new :class:`Enum` class must have one base enum class, up to one concrete data type, and as many :class:`object`-based mixin classes as needed. The order of these base classes is::" +#: ../../howto/enum.rst:447 +msgid "" +"A new :class:`Enum` class must have one base enum class, up to one concrete " +"data type, and as many :class:`object`-based mixin classes as needed. The " +"order of these base classes is::" msgstr "" +#: ../../howto/enum.rst:451 msgid "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" msgstr "" -msgid "Also, subclassing an enumeration is allowed only if the enumeration does not define any members. So this is forbidden::" +#: ../../howto/enum.rst:454 +msgid "" +"Also, subclassing an enumeration is allowed only if the enumeration does not " +"define any members. So this is forbidden::" msgstr "" +#: ../../howto/enum.rst:457 msgid "" ">>> class MoreColor(Color):\n" "... PINK = 17\n" @@ -522,9 +722,11 @@ msgid "" "TypeError: cannot extend " msgstr "" +#: ../../howto/enum.rst:464 msgid "But this is allowed::" msgstr "" +#: ../../howto/enum.rst:466 msgid "" ">>> class Foo(Enum):\n" "... def some_behavior(self):\n" @@ -536,15 +738,25 @@ msgid "" "..." msgstr "" -msgid "Allowing subclassing of enums that define members would lead to a violation of some important invariants of types and instances. On the other hand, it makes sense to allow sharing some common behavior between a group of enumerations. (See `OrderedEnum`_ for an example.)" +#: ../../howto/enum.rst:475 +msgid "" +"Allowing subclassing of enums that define members would lead to a violation " +"of some important invariants of types and instances. On the other hand, it " +"makes sense to allow sharing some common behavior between a group of " +"enumerations. (See `OrderedEnum`_ for an example.)" msgstr "" +#: ../../howto/enum.rst:484 msgid "Dataclass support" msgstr "" -msgid "When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" +#: ../../howto/enum.rst:486 +msgid "" +"When inheriting from a :class:`~dataclasses.dataclass`, " +"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" msgstr "" +#: ../../howto/enum.rst:489 msgid "" ">>> from dataclasses import dataclass, field\n" ">>> @dataclass\n" @@ -561,15 +773,27 @@ msgid "" "" msgstr "" -msgid "Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the standard :func:`repr`." +#: ../../howto/enum.rst:503 +msgid "" +"Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the " +"standard :func:`repr`." msgstr "" -msgid "Only the dataclass fields are shown in the value area, not the dataclass' name." +#: ../../howto/enum.rst:506 +msgid "" +"Only the dataclass fields are shown in the value area, not the dataclass' " +"name." msgstr "" -msgid "Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its subclasses is not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other::" +#: ../../howto/enum.rst:512 +msgid "" +"Adding :deco:`~dataclasses.dataclass` decorator to :class:`Enum` and its " +"subclasses is not supported. It will not raise any errors, but it will " +"produce very strange results at runtime, such as members being equal to each " +"other::" msgstr "" +#: ../../howto/enum.rst:517 msgid "" ">>> @dataclass # don't do this: it does not make any sense\n" "... class Color(Enum):\n" @@ -582,12 +806,15 @@ msgid "" "True" msgstr "" +#: ../../howto/enum.rst:529 msgid "Pickling" msgstr "" +#: ../../howto/enum.rst:531 msgid "Enumerations can be pickled and unpickled::" msgstr "" +#: ../../howto/enum.rst:533 msgid "" ">>> from test.test_enum import Fruit\n" ">>> from pickle import dumps, loads\n" @@ -595,30 +822,50 @@ msgid "" "True" msgstr "" -msgid "The usual restrictions for pickling apply: picklable enums must be defined in the top level of a module, since unpickling requires them to be importable from that module." +#: ../../howto/enum.rst:538 +msgid "" +"The usual restrictions for pickling apply: picklable enums must be defined " +"in the top level of a module, since unpickling requires them to be " +"importable from that module." msgstr "" -msgid "With pickle protocol version 4 it is possible to easily pickle enums nested in other classes." +#: ../../howto/enum.rst:544 +msgid "" +"With pickle protocol version 4 it is possible to easily pickle enums nested " +"in other classes." msgstr "" -msgid "It is possible to modify how enum members are pickled/unpickled by defining :meth:`~object.__reduce_ex__` in the enumeration class. The default method is by-value, but enums with complicated values may want to use by-name::" +#: ../../howto/enum.rst:547 +msgid "" +"It is possible to modify how enum members are pickled/unpickled by " +"defining :meth:`~object.__reduce_ex__` in the enumeration class. The " +"default method is by-value, but enums with complicated values may want to " +"use by-name::" msgstr "" +#: ../../howto/enum.rst:551 msgid "" ">>> import enum\n" ">>> class MyEnum(enum.Enum):\n" "... __reduce_ex__ = enum.pickle_by_enum_name" msgstr "" -msgid "Using by-name for flags is not recommended, as unnamed aliases will not unpickle." +#: ../../howto/enum.rst:557 +msgid "" +"Using by-name for flags is not recommended, as unnamed aliases will not " +"unpickle." msgstr "" +#: ../../howto/enum.rst:562 msgid "Functional API" msgstr "" -msgid "The :class:`Enum` class is callable, providing the following functional API::" +#: ../../howto/enum.rst:564 +msgid "" +"The :class:`Enum` class is callable, providing the following functional API::" msgstr "" +#: ../../howto/enum.rst:566 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" ">>> Animal\n" @@ -629,12 +876,25 @@ msgid "" "[, , , ]" msgstr "" -msgid "The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of the enumeration." +#: ../../howto/enum.rst:574 +msgid "" +"The semantics of this API resemble :class:`~collections.namedtuple`. The " +"first argument of the call to :class:`Enum` is the name of the enumeration." msgstr "" -msgid "The second argument is the *source* of enumeration member names. It can be a whitespace-separated string of names, a sequence of names, a sequence of 2-tuples with key/value pairs, or a mapping (e.g. dictionary) of names to values. The last two options enable assigning arbitrary values to enumerations; the others auto-assign increasing integers starting with 1 (use the ``start`` parameter to specify a different starting value). A new class derived from :class:`Enum` is returned. In other words, the above assignment to :class:`!Animal` is equivalent to::" +#: ../../howto/enum.rst:577 +msgid "" +"The second argument is the *source* of enumeration member names. It can be " +"a whitespace-separated string of names, a sequence of names, a sequence of 2-" +"tuples with key/value pairs, or a mapping (e.g. dictionary) of names to " +"values. The last two options enable assigning arbitrary values to " +"enumerations; the others auto-assign increasing integers starting with 1 " +"(use the ``start`` parameter to specify a different starting value). A new " +"class derived from :class:`Enum` is returned. In other words, the above " +"assignment to :class:`!Animal` is equivalent to::" msgstr "" +#: ../../howto/enum.rst:586 msgid "" ">>> class Animal(Enum):\n" "... ANT = 1\n" @@ -644,27 +904,51 @@ msgid "" "..." msgstr "" -msgid "The reason for defaulting to ``1`` as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``." +#: ../../howto/enum.rst:593 +msgid "" +"The reason for defaulting to ``1`` as the starting number and not ``0`` is " +"that ``0`` is ``False`` in a boolean sense, but by default enum members all " +"evaluate to ``True``." msgstr "" -msgid "Pickling enums created with the functional API can be tricky as frame stack implementation details are used to try and figure out which module the enumeration is being created in (e.g. it will fail if you use a utility function in a separate module, and also may not work on IronPython or Jython). The solution is to specify the module name explicitly as follows::" +#: ../../howto/enum.rst:597 +msgid "" +"Pickling enums created with the functional API can be tricky as frame stack " +"implementation details are used to try and figure out which module the " +"enumeration is being created in (e.g. it will fail if you use a utility " +"function in a separate module, and also may not work on IronPython or " +"Jython). The solution is to specify the module name explicitly as follows::" msgstr "" +#: ../../howto/enum.rst:603 msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" msgstr "" -msgid "If ``module`` is not supplied, and Enum cannot determine what it is, the new Enum members will not be unpicklable; to keep errors closer to the source, pickling will be disabled." +#: ../../howto/enum.rst:607 +msgid "" +"If ``module`` is not supplied, and Enum cannot determine what it is, the new " +"Enum members will not be unpicklable; to keep errors closer to the source, " +"pickling will be disabled." msgstr "" -msgid "The new pickle protocol 4 also, in some circumstances, relies on :attr:`~type.__qualname__` being set to the location where pickle will be able to find the class. For example, if the class was made available in class SomeData in the global scope::" +#: ../../howto/enum.rst:611 +msgid "" +"The new pickle protocol 4 also, in some circumstances, relies " +"on :attr:`~type.__qualname__` being set to the location where pickle will be " +"able to find the class. For example, if the class was made available in " +"class SomeData in the global scope::" msgstr "" -msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" +#: ../../howto/enum.rst:616 +msgid "" +">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" msgstr "" +#: ../../howto/enum.rst:618 msgid "The complete signature is::" msgstr "" +#: ../../howto/enum.rst:620 msgid "" "Enum(\n" " value='NewEnumName',\n" @@ -677,57 +961,81 @@ msgid "" " )" msgstr "" +#: ../../howto/enum.rst:630 msgid "*value*: What the new enum class will record as its name." msgstr "" -msgid "*names*: The enum members. This can be a whitespace- or comma-separated string (values will start at 1 unless otherwise specified)::" +#: ../../howto/enum.rst:632 +msgid "" +"*names*: The enum members. This can be a whitespace- or comma-separated " +"string (values will start at 1 unless otherwise specified)::" msgstr "" +#: ../../howto/enum.rst:635 msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" msgstr "" +#: ../../howto/enum.rst:637 msgid "or an iterator of names::" msgstr "" +#: ../../howto/enum.rst:639 msgid "['RED', 'GREEN', 'BLUE']" msgstr "" +#: ../../howto/enum.rst:641 msgid "or an iterator of (name, value) pairs::" msgstr "" +#: ../../howto/enum.rst:643 msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" msgstr "" +#: ../../howto/enum.rst:645 msgid "or a mapping::" msgstr "" +#: ../../howto/enum.rst:647 msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" msgstr "" +#: ../../howto/enum.rst:649 msgid "*module*: name of module where new enum class can be found." msgstr "" +#: ../../howto/enum.rst:651 msgid "*qualname*: where in module new enum class can be found." msgstr "" +#: ../../howto/enum.rst:653 msgid "*type*: type to mix in to new enum class." msgstr "" +#: ../../howto/enum.rst:655 msgid "*start*: number to start counting at if only names are passed in." msgstr "" +#: ../../howto/enum.rst:657 msgid "The *start* parameter was added." msgstr "" +#: ../../howto/enum.rst:662 msgid "Derived Enumerations" msgstr "" +#: ../../howto/enum.rst:665 msgid "IntEnum" msgstr "" -msgid "The first variation of :class:`Enum` that is provided is also a subclass of :class:`int`. Members of an :class:`IntEnum` can be compared to integers; by extension, integer enumerations of different types can also be compared to each other::" +#: ../../howto/enum.rst:667 +msgid "" +"The first variation of :class:`Enum` that is provided is also a subclass " +"of :class:`int`. Members of an :class:`IntEnum` can be compared to " +"integers; by extension, integer enumerations of different types can also be " +"compared to each other::" msgstr "" +#: ../../howto/enum.rst:672 msgid "" ">>> from enum import IntEnum\n" ">>> class Shape(IntEnum):\n" @@ -746,9 +1054,13 @@ msgid "" "True" msgstr "" -msgid "However, they still can't be compared to standard :class:`Enum` enumerations::" +#: ../../howto/enum.rst:688 +msgid "" +"However, they still can't be compared to standard :class:`Enum` " +"enumerations::" msgstr "" +#: ../../howto/enum.rst:690 msgid "" ">>> class Shape(IntEnum):\n" "... CIRCLE = 1\n" @@ -762,9 +1074,12 @@ msgid "" "False" msgstr "" -msgid ":class:`IntEnum` values behave like integers in other ways you'd expect::" +#: ../../howto/enum.rst:701 +msgid "" +":class:`IntEnum` values behave like integers in other ways you'd expect::" msgstr "" +#: ../../howto/enum.rst:703 msgid "" ">>> int(Shape.CIRCLE)\n" "1\n" @@ -774,27 +1089,49 @@ msgid "" "[0, 1]" msgstr "" +#: ../../howto/enum.rst:712 msgid "StrEnum" msgstr "" -msgid "The second variation of :class:`Enum` that is provided is also a subclass of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; by extension, string enumerations of different types can also be compared to each other." +#: ../../howto/enum.rst:714 +msgid "" +"The second variation of :class:`Enum` that is provided is also a subclass " +"of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; " +"by extension, string enumerations of different types can also be compared to " +"each other." msgstr "" +#: ../../howto/enum.rst:723 msgid "IntFlag" msgstr "" -msgid "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also based on :class:`int`. The difference being :class:`IntFlag` members can be combined using the bitwise operators (&, \\|, ^, ~) and the result is still an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be used wherever an :class:`int` is used." +#: ../../howto/enum.rst:725 +msgid "" +"The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " +"based on :class:`int`. The difference being :class:`IntFlag` members can be " +"combined using the bitwise operators (&, \\|, ^, ~) and the result is still " +"an :class:`IntFlag` member, if possible. " +"Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be " +"used wherever an :class:`int` is used." msgstr "" -msgid "Any operation on an :class:`IntFlag` member besides the bit-wise operations will lose the :class:`IntFlag` membership." +#: ../../howto/enum.rst:733 +msgid "" +"Any operation on an :class:`IntFlag` member besides the bit-wise operations " +"will lose the :class:`IntFlag` membership." msgstr "" -msgid "Bit-wise operations that result in invalid :class:`IntFlag` values will lose the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." +#: ../../howto/enum.rst:736 +msgid "" +"Bit-wise operations that result in invalid :class:`IntFlag` values will lose " +"the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." msgstr "" +#: ../../howto/enum.rst:743 msgid "Sample :class:`IntFlag` class::" msgstr "" +#: ../../howto/enum.rst:745 msgid "" ">>> from enum import IntFlag\n" ">>> class Perm(IntFlag):\n" @@ -811,9 +1148,11 @@ msgid "" "True" msgstr "" +#: ../../howto/enum.rst:759 msgid "It is also possible to name the combinations::" msgstr "" +#: ../../howto/enum.rst:761 msgid "" ">>> class Perm(IntFlag):\n" "... R = 4\n" @@ -829,12 +1168,20 @@ msgid "" "" msgstr "" -msgid "Named combinations are considered aliases. Aliases do not show up during iteration, but can be returned from by-value lookups." +#: ../../howto/enum.rst:776 +msgid "" +"Named combinations are considered aliases. Aliases do not show up during " +"iteration, but can be returned from by-value lookups." msgstr "" -msgid "Another important difference between :class:`IntFlag` and :class:`Enum` is that if no flags are set (the value is 0), its boolean evaluation is :data:`False`::" +#: ../../howto/enum.rst:781 +msgid "" +"Another important difference between :class:`IntFlag` and :class:`Enum` is " +"that if no flags are set (the value is 0), its boolean evaluation " +"is :data:`False`::" msgstr "" +#: ../../howto/enum.rst:784 msgid "" ">>> Perm.R & Perm.X\n" "\n" @@ -842,9 +1189,13 @@ msgid "" "False" msgstr "" -msgid "Because :class:`IntFlag` members are also subclasses of :class:`int` they can be combined with them (but may lose :class:`IntFlag` membership::" +#: ../../howto/enum.rst:789 +msgid "" +"Because :class:`IntFlag` members are also subclasses of :class:`int` they " +"can be combined with them (but may lose :class:`IntFlag` membership::" msgstr "" +#: ../../howto/enum.rst:792 msgid "" ">>> Perm.X | 4\n" "\n" @@ -853,31 +1204,49 @@ msgid "" "9" msgstr "" -msgid "The negation operator, ``~``, always returns an :class:`IntFlag` member with a positive value::" +#: ../../howto/enum.rst:800 +msgid "" +"The negation operator, ``~``, always returns an :class:`IntFlag` member with " +"a positive value::" msgstr "" +#: ../../howto/enum.rst:803 msgid "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" msgstr "" +#: ../../howto/enum.rst:806 msgid ":class:`IntFlag` members can also be iterated over::" msgstr "" +#: ../../howto/enum.rst:808 msgid "" ">>> list(RW)\n" "[, ]" msgstr "" +#: ../../howto/enum.rst:815 msgid "Flag" msgstr "" -msgid "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, any other :class:`Flag` enumeration, nor :class:`int`. While it is possible to specify the values directly it is recommended to use :class:`auto` as the value and let :class:`Flag` select an appropriate value." +#: ../../howto/enum.rst:817 +msgid "" +"The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " +"members can be combined using the bitwise operators (&, \\|, ^, ~). " +"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " +"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " +"to specify the values directly it is recommended to use :class:`auto` as the " +"value and let :class:`Flag` select an appropriate value." msgstr "" -msgid "Like :class:`IntFlag`, if a combination of :class:`Flag` members results in no flags being set, the boolean evaluation is :data:`False`::" +#: ../../howto/enum.rst:826 +msgid "" +"Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " +"no flags being set, the boolean evaluation is :data:`False`::" msgstr "" +#: ../../howto/enum.rst:829 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -891,9 +1260,13 @@ msgid "" "False" msgstr "" -msgid "Individual flags should have values that are powers of two (1, 2, 4, 8, ...), while combinations of flags will not::" +#: ../../howto/enum.rst:840 +msgid "" +"Individual flags should have values that are powers of two (1, 2, 4, " +"8, ...), while combinations of flags will not::" msgstr "" +#: ../../howto/enum.rst:843 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -905,9 +1278,13 @@ msgid "" "" msgstr "" -msgid "Giving a name to the \"no flags set\" condition does not change its boolean value::" +#: ../../howto/enum.rst:852 +msgid "" +"Giving a name to the \"no flags set\" condition does not change its boolean " +"value::" msgstr "" +#: ../../howto/enum.rst:855 msgid "" ">>> class Color(Flag):\n" "... BLACK = 0\n" @@ -921,68 +1298,131 @@ msgid "" "False" msgstr "" +#: ../../howto/enum.rst:866 msgid ":class:`Flag` members can also be iterated over::" msgstr "" +#: ../../howto/enum.rst:868 msgid "" ">>> purple = Color.RED | Color.BLUE\n" ">>> list(purple)\n" "[, ]" msgstr "" -msgid "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic promises of an enumeration (by being comparable to integers, and thus by transitivity to other unrelated enumerations). :class:`IntEnum` and :class:`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` will not do; for example, when integer constants are replaced with enumerations, or for interoperability with other systems." +#: ../../howto/enum.rst:876 +msgid "" +"For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " +"recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " +"promises of an enumeration (by being comparable to integers, and thus by " +"transitivity to other unrelated enumerations). :class:`IntEnum` " +"and :class:`IntFlag` should be used only in cases where :class:`Enum` " +"and :class:`Flag` will not do; for example, when integer constants are " +"replaced with enumerations, or for interoperability with other systems." msgstr "" +#: ../../howto/enum.rst:886 msgid "Others" msgstr "" -msgid "While :class:`IntEnum` is part of the :mod:`enum` module, it would be very simple to implement independently::" +#: ../../howto/enum.rst:888 +msgid "" +"While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " +"simple to implement independently::" msgstr "" +#: ../../howto/enum.rst:891 msgid "" "class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" msgstr "" -msgid "This demonstrates how similar derived enumerations can be defined; for example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:`int`." +#: ../../howto/enum.rst:894 +msgid "" +"This demonstrates how similar derived enumerations can be defined; for " +"example a :class:`!FloatEnum` that mixes in :class:`float` instead " +"of :class:`int`." msgstr "" +#: ../../howto/enum.rst:897 msgid "Some rules:" msgstr "" -msgid "When subclassing :class:`Enum`, mix-in types must appear before the :class:`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` example above." +#: ../../howto/enum.rst:899 +msgid "" +"When subclassing :class:`Enum`, mix-in types must appear before " +"the :class:`Enum` class itself in the sequence of bases, as in " +"the :class:`IntEnum` example above." msgstr "" -msgid "Mix-in types must be subclassable. For example, :class:`bool` and :class:`range` are not subclassable and will throw an error during Enum creation if used as the mix-in type." +#: ../../howto/enum.rst:902 +msgid "" +"Mix-in types must be subclassable. For example, :class:`bool` " +"and :class:`range` are not subclassable and will throw an error during Enum " +"creation if used as the mix-in type." msgstr "" -msgid "While :class:`Enum` can have members of any type, once you mix in an additional type, all the members must have values of that type, e.g. :class:`int` above. This restriction does not apply to mix-ins which only add methods and don't specify another type." +#: ../../howto/enum.rst:905 +msgid "" +"While :class:`Enum` can have members of any type, once you mix in an " +"additional type, all the members must have values of that type, " +"e.g. :class:`int` above. This restriction does not apply to mix-ins which " +"only add methods and don't specify another type." msgstr "" -msgid "When another data type is mixed in, the :attr:`~Enum.value` attribute is *not the same* as the enum member itself, although it is equivalent and will compare equal." +#: ../../howto/enum.rst:909 +msgid "" +"When another data type is mixed in, the :attr:`~Enum.value` attribute is " +"*not the same* as the enum member itself, although it is equivalent and will " +"compare equal." msgstr "" -msgid "A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:`~dataclasses.dataclass`" +#: ../../howto/enum.rst:912 +msgid "" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or " +"a :class:`~dataclasses.dataclass`" msgstr "" -msgid "%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in type." +#: ../../howto/enum.rst:914 +msgid "" +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " +"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " +"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " +"its mixed-in type." msgstr "" -msgid ":ref:`Formatted string literals `, :meth:`str.format`, and :func:`format` will use the enum's :meth:`~object.__str__` method." +#: ../../howto/enum.rst:917 +msgid "" +":ref:`Formatted string literals `, :meth:`str.format`, " +"and :func:`format` will use the enum's :meth:`~object.__str__` method." msgstr "" -msgid "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are designed to be drop-in replacements for existing constants, their :meth:`~object.__str__` method has been reset to their data types' :meth:`~object.__str__` method." +#: ../../howto/enum.rst:922 +msgid "" +"Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " +"designed to be drop-in replacements for existing constants, " +"their :meth:`~object.__str__` method has been reset to their data " +"types' :meth:`~object.__str__` method." msgstr "" +#: ../../howto/enum.rst:930 msgid "When to use :meth:`~object.__new__` vs. :meth:`~object.__init__`" msgstr "" -msgid ":meth:`~object.__new__` must be used whenever you want to customize the actual value of the :class:`Enum` member. Any other modifications may go in either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:`~object.__init__` being preferred." +#: ../../howto/enum.rst:932 +msgid "" +":meth:`~object.__new__` must be used whenever you want to customize the " +"actual value of the :class:`Enum` member. Any other modifications may go in " +"either :meth:`~object.__new__` or :meth:`~object.__init__`, " +"with :meth:`~object.__init__` being preferred." msgstr "" -msgid "For example, if you want to pass several items to the constructor, but only want one of them to be the value::" +#: ../../howto/enum.rst:936 +msgid "" +"For example, if you want to pass several items to the constructor, but only " +"want one of them to be the value::" msgstr "" +#: ../../howto/enum.rst:939 msgid "" ">>> class Coordinate(bytes, Enum):\n" "... \"\"\"\n" @@ -1007,36 +1447,62 @@ msgid "" "Coordinate.VY" msgstr "" -msgid "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the one that is found; instead, use the data type directly." +#: ../../howto/enum.rst:963 +msgid "" +"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " +"one that is found; instead, use the data type directly." msgstr "" +#: ../../howto/enum.rst:968 msgid "Finer Points" msgstr "" +#: ../../howto/enum.rst:971 msgid "Supported ``__dunder__`` and ``_sunder_`` names" msgstr "" -msgid "The supported ``__dunder__`` and ``_sunder_`` names can be found in the :ref:`Enum API documentation `." +#: ../../howto/enum.rst:973 +msgid "" +"The supported ``__dunder__`` and ``_sunder_`` names can be found in " +"the :ref:`Enum API documentation `." msgstr "" +#: ../../howto/enum.rst:977 msgid "_Private__names" msgstr "" -msgid ":ref:`Private names ` are not converted to enum members, but remain normal attributes." +#: ../../howto/enum.rst:979 +msgid "" +":ref:`Private names ` are not converted to enum " +"members, but remain normal attributes." msgstr "" +#: ../../howto/enum.rst:986 msgid "``Enum`` member type" msgstr "" -msgid "Enum members are instances of their enum class, and are normally accessed as ``EnumClass.member``. In certain situations, such as writing custom enum behavior, being able to access one member directly from another is useful, and is supported; however, in order to avoid name clashes between member names and attributes/methods from mixed-in classes, upper-case names are strongly recommended." +#: ../../howto/enum.rst:988 +msgid "" +"Enum members are instances of their enum class, and are normally accessed as " +"``EnumClass.member``. In certain situations, such as writing custom enum " +"behavior, being able to access one member directly from another is useful, " +"and is supported; however, in order to avoid name clashes between member " +"names and attributes/methods from mixed-in classes, upper-case names are " +"strongly recommended." msgstr "" +#: ../../howto/enum.rst:999 msgid "Creating members that are mixed with other data types" msgstr "" -msgid "When subclassing other data types, such as :class:`int` or :class:`str`, with an :class:`Enum`, all values after the ``=`` are passed to that data type's constructor. For example::" +#: ../../howto/enum.rst:1001 +msgid "" +"When subclassing other data types, such as :class:`int` or :class:`str`, " +"with an :class:`Enum`, all values after the ``=`` are passed to that data " +"type's constructor. For example::" msgstr "" +#: ../../howto/enum.rst:1005 msgid "" ">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" "... example = '11', 16 # so x='11' and base=16\n" @@ -1045,39 +1511,61 @@ msgid "" "17" msgstr "" +#: ../../howto/enum.rst:1013 msgid "Boolean value of ``Enum`` classes and members" msgstr "" -msgid "Enum classes that are mixed with non-:class:`Enum` types (such as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's rules; otherwise, all members evaluate as :data:`True`. To make your own enum's boolean evaluation depend on the member's value add the following to your class::" +#: ../../howto/enum.rst:1015 +msgid "" +"Enum classes that are mixed with non-:class:`Enum` types (such " +"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " +"type's rules; otherwise, all members evaluate as :data:`True`. To make your " +"own enum's boolean evaluation depend on the member's value add the following " +"to your class::" msgstr "" +#: ../../howto/enum.rst:1021 msgid "" "def __bool__(self):\n" " return bool(self.value)" msgstr "" +#: ../../howto/enum.rst:1024 msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." msgstr "" +#: ../../howto/enum.rst:1028 msgid "``Enum`` classes with methods" msgstr "" -msgid "If you give your enum subclass extra methods, like the `Planet`_ class below, those methods will show up in a :func:`dir` of the member, but not of the class::" +#: ../../howto/enum.rst:1030 +msgid "" +"If you give your enum subclass extra methods, like the `Planet`_ class " +"below, those methods will show up in a :func:`dir` of the member, but not of " +"the class::" msgstr "" +#: ../../howto/enum.rst:1034 msgid "" ">>> dir(Planet)\n" -"['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" +"['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " +"'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" ">>> dir(Planet.EARTH)\n" -"['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', 'surface_gravity', 'value']" +"['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " +"'surface_gravity', 'value']" msgstr "" +#: ../../howto/enum.rst:1041 msgid "Combining members of ``Flag``" msgstr "" -msgid "Iterating over a combination of :class:`Flag` members will only return the members that are comprised of a single bit::" +#: ../../howto/enum.rst:1043 +msgid "" +"Iterating over a combination of :class:`Flag` members will only return the " +"members that are comprised of a single bit::" msgstr "" +#: ../../howto/enum.rst:1046 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1093,12 +1581,15 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:1061 msgid "``Flag`` and ``IntFlag`` minutia" msgstr "" +#: ../../howto/enum.rst:1063 msgid "Using the following snippet for our examples::" msgstr "" +#: ../../howto/enum.rst:1065 msgid "" ">>> class Color(IntFlag):\n" "... BLACK = 0\n" @@ -1110,26 +1601,35 @@ msgid "" "..." msgstr "" +#: ../../howto/enum.rst:1074 msgid "the following are true:" msgstr "" +#: ../../howto/enum.rst:1076 msgid "single-bit flags are canonical" msgstr "" +#: ../../howto/enum.rst:1077 msgid "multi-bit and zero-bit flags are aliases" msgstr "" +#: ../../howto/enum.rst:1078 msgid "only canonical flags are returned during iteration::" msgstr "" +#: ../../howto/enum.rst:1080 msgid "" ">>> list(Color.WHITE)\n" "[, , ]" msgstr "" -msgid "negating a flag or flag set returns a new flag/flag set with the corresponding positive integer value::" +#: ../../howto/enum.rst:1083 +msgid "" +"negating a flag or flag set returns a new flag/flag set with the " +"corresponding positive integer value::" msgstr "" +#: ../../howto/enum.rst:1086 msgid "" ">>> Color.BLUE\n" "\n" @@ -1138,9 +1638,11 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:1092 msgid "names of pseudo-flags are constructed from their members' names::" msgstr "" +#: ../../howto/enum.rst:1094 msgid "" ">>> (Color.RED | Color.GREEN).name\n" "'RED|GREEN'\n" @@ -1154,9 +1656,11 @@ msgid "" "True" msgstr "" +#: ../../howto/enum.rst:1105 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" +#: ../../howto/enum.rst:1107 msgid "" ">>> Color.RED | Color.BLUE\n" "\n" @@ -1168,17 +1672,25 @@ msgid "" "" msgstr "" -msgid "membership / containment checking: zero-valued flags are always considered to be contained::" +#: ../../howto/enum.rst:1116 +msgid "" +"membership / containment checking: zero-valued flags are always considered " +"to be contained::" msgstr "" +#: ../../howto/enum.rst:1119 msgid "" ">>> Color.BLACK in Color.WHITE\n" "True" msgstr "" -msgid "otherwise, only if all bits of one flag are in the other flag will True be returned::" +#: ../../howto/enum.rst:1122 +msgid "" +"otherwise, only if all bits of one flag are in the other flag will True be " +"returned::" msgstr "" +#: ../../howto/enum.rst:1125 msgid "" ">>> Color.PURPLE in Color.WHITE\n" "True\n" @@ -1187,120 +1699,200 @@ msgid "" "False" msgstr "" -msgid "There is a new boundary mechanism that controls how out-of-range / invalid bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" +#: ../../howto/enum.rst:1131 +msgid "" +"There is a new boundary mechanism that controls how out-of-range / invalid " +"bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" +#: ../../howto/enum.rst:1134 msgid "STRICT --> raises an exception when presented with invalid values" msgstr "" +#: ../../howto/enum.rst:1135 msgid "CONFORM --> discards any invalid bits" msgstr "" +#: ../../howto/enum.rst:1136 msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" +#: ../../howto/enum.rst:1137 msgid "KEEP --> keep the extra bits" msgstr "" +#: ../../howto/enum.rst:1139 msgid "keeps Flag status and extra bits" msgstr "" +#: ../../howto/enum.rst:1140 msgid "extra bits do not show up in iteration" msgstr "" +#: ../../howto/enum.rst:1141 msgid "extra bits do show up in repr() and str()" msgstr "" -msgid "The default for Flag is ``STRICT``, the default for ``IntFlag`` is ``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl.Options`` for an example of when ``KEEP`` is needed)." +#: ../../howto/enum.rst:1143 +msgid "" +"The default for Flag is ``STRICT``, the default for ``IntFlag`` is " +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " +"``ssl.Options`` for an example of when ``KEEP`` is needed)." msgstr "" +#: ../../howto/enum.rst:1151 msgid "How are Enums and Flags different?" msgstr "" -msgid "Enums have a custom metaclass that affects many aspects of both derived :class:`Enum` classes and their instances (members)." +#: ../../howto/enum.rst:1153 +msgid "" +"Enums have a custom metaclass that affects many aspects of both " +"derived :class:`Enum` classes and their instances (members)." msgstr "" +#: ../../howto/enum.rst:1158 msgid "Enum Classes" msgstr "" -msgid "The :class:`EnumType` metaclass is responsible for providing the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` and other methods that allow one to do things with an :class:`Enum` class that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in Color``. :class:`EnumType` is responsible for ensuring that various other methods on the final :class:`Enum` class are correct (such as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:`~object.__repr__`)." +#: ../../howto/enum.rst:1160 +msgid "" +"The :class:`EnumType` metaclass is responsible for providing " +"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"and other methods that allow one to do things with an :class:`Enum` class " +"that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " +"Color``. :class:`EnumType` is responsible for ensuring that various other " +"methods on the final :class:`Enum` class are correct (such " +"as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` " +"and :meth:`~object.__repr__`)." msgstr "" +#: ../../howto/enum.rst:1169 msgid "Flag Classes" msgstr "" -msgid "Flags have an expanded view of aliasing: to be canonical, the value of a flag needs to be a power-of-two value, and not a duplicate name. So, in addition to the :class:`Enum` definition of alias, a flag with no value (a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is considered an alias." +#: ../../howto/enum.rst:1171 +msgid "" +"Flags have an expanded view of aliasing: to be canonical, the value of a " +"flag needs to be a power-of-two value, and not a duplicate name. So, in " +"addition to the :class:`Enum` definition of alias, a flag with no value " +"(a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"considered an alias." msgstr "" +#: ../../howto/enum.rst:1177 msgid "Enum Members (aka instances)" msgstr "" -msgid "The most interesting thing about enum members is that they are singletons. :class:`EnumType` creates them all while it is creating the enum class itself, and then puts a custom :meth:`~object.__new__` in place to ensure that no new ones are ever instantiated by returning only the existing member instances." +#: ../../howto/enum.rst:1179 +msgid "" +"The most interesting thing about enum members is that they are " +"singletons. :class:`EnumType` creates them all while it is creating the enum " +"class itself, and then puts a custom :meth:`~object.__new__` in place to " +"ensure that no new ones are ever instantiated by returning only the existing " +"member instances." msgstr "" +#: ../../howto/enum.rst:1185 msgid "Flag Members" msgstr "" -msgid "Flag members can be iterated over just like the :class:`Flag` class, and only the canonical members will be returned. For example::" +#: ../../howto/enum.rst:1187 +msgid "" +"Flag members can be iterated over just like the :class:`Flag` class, and " +"only the canonical members will be returned. For example::" msgstr "" +#: ../../howto/enum.rst:1190 msgid "" ">>> list(Color)\n" "[, , ]" msgstr "" +#: ../../howto/enum.rst:1193 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" msgstr "" -msgid "Inverting a flag member returns the corresponding positive value, rather than a negative value --- for example::" +#: ../../howto/enum.rst:1195 +msgid "" +"Inverting a flag member returns the corresponding positive value, rather " +"than a negative value --- for example::" msgstr "" +#: ../../howto/enum.rst:1198 msgid "" ">>> ~Color.RED\n" "" msgstr "" -msgid "Flag members have a length corresponding to the number of power-of-two values they contain. For example::" +#: ../../howto/enum.rst:1201 +msgid "" +"Flag members have a length corresponding to the number of power-of-two " +"values they contain. For example::" msgstr "" +#: ../../howto/enum.rst:1204 msgid "" ">>> len(Color.PURPLE)\n" "2" msgstr "" +#: ../../howto/enum.rst:1211 msgid "Enum Cookbook" msgstr "" -msgid "While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :class:`IntFlag` are expected to cover the majority of use-cases, they cannot cover them all. Here are recipes for some different types of enumerations that can be used directly, or as examples for creating one's own." +#: ../../howto/enum.rst:1214 +msgid "" +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " +"and :class:`IntFlag` are expected to cover the majority of use-cases, they " +"cannot cover them all. Here are recipes for some different types of " +"enumerations that can be used directly, or as examples for creating one's " +"own." msgstr "" +#: ../../howto/enum.rst:1221 msgid "Omitting values" msgstr "" -msgid "In many use-cases, one doesn't care what the actual value of an enumeration is. There are several ways to define this type of simple enumeration:" +#: ../../howto/enum.rst:1223 +msgid "" +"In many use-cases, one doesn't care what the actual value of an enumeration " +"is. There are several ways to define this type of simple enumeration:" msgstr "" +#: ../../howto/enum.rst:1226 msgid "use instances of :class:`auto` for the value" msgstr "" +#: ../../howto/enum.rst:1227 msgid "use instances of :class:`object` as the value" msgstr "" +#: ../../howto/enum.rst:1228 msgid "use a descriptive string as the value" msgstr "" -msgid "use a tuple as the value and a custom :meth:`~object.__new__` to replace the tuple with an :class:`int` value" +#: ../../howto/enum.rst:1229 +msgid "" +"use a tuple as the value and a custom :meth:`~object.__new__` to replace the " +"tuple with an :class:`int` value" msgstr "" -msgid "Using any of these methods signifies to the user that these values are not important, and also enables one to add, remove, or reorder members without having to renumber the remaining members." +#: ../../howto/enum.rst:1232 +msgid "" +"Using any of these methods signifies to the user that these values are not " +"important, and also enables one to add, remove, or reorder members without " +"having to renumber the remaining members." msgstr "" +#: ../../howto/enum.rst:1238 msgid "Using :class:`auto`" msgstr "" +#: ../../howto/enum.rst:1240 msgid "Using :class:`auto` would look like::" msgstr "" +#: ../../howto/enum.rst:1242 msgid "" ">>> class Color(Enum):\n" "... RED = auto()\n" @@ -1311,12 +1903,15 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:1252 msgid "Using :class:`object`" msgstr "" +#: ../../howto/enum.rst:1254 msgid "Using :class:`object` would look like::" msgstr "" +#: ../../howto/enum.rst:1256 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -1327,9 +1922,13 @@ msgid "" ">" msgstr "" -msgid "This is also a good example of why you might want to write your own :meth:`~object.__repr__`::" +#: ../../howto/enum.rst:1264 +msgid "" +"This is also a good example of why you might want to write your " +"own :meth:`~object.__repr__`::" msgstr "" +#: ../../howto/enum.rst:1267 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -1342,12 +1941,15 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:1280 msgid "Using a descriptive string" msgstr "" +#: ../../howto/enum.rst:1282 msgid "Using a string as the value would look like::" msgstr "" +#: ../../howto/enum.rst:1284 msgid "" ">>> class Color(Enum):\n" "... RED = 'stop'\n" @@ -1358,12 +1960,15 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:1294 msgid "Using a custom :meth:`~object.__new__`" msgstr "" +#: ../../howto/enum.rst:1296 msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" msgstr "" +#: ../../howto/enum.rst:1298 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls):\n" @@ -1381,9 +1986,13 @@ msgid "" "" msgstr "" -msgid "To make a more general purpose ``AutoNumber``, add ``*args`` to the signature::" +#: ../../howto/enum.rst:1313 +msgid "" +"To make a more general purpose ``AutoNumber``, add ``*args`` to the " +"signature::" msgstr "" +#: ../../howto/enum.rst:1315 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls, *args): # this is the only change from above\n" @@ -1394,9 +2003,13 @@ msgid "" "..." msgstr "" -msgid "Then when you inherit from ``AutoNumber`` you can write your own ``__init__`` to handle any extra arguments::" +#: ../../howto/enum.rst:1323 +msgid "" +"Then when you inherit from ``AutoNumber`` you can write your own " +"``__init__`` to handle any extra arguments::" msgstr "" +#: ../../howto/enum.rst:1326 msgid "" ">>> class Swatch(AutoNumber):\n" "... def __init__(self, pantone='unknown'):\n" @@ -1413,21 +2026,35 @@ msgid "" "'unknown'" msgstr "" -msgid "The :meth:`~object.__new__` method, if defined, is used during creation of the Enum members; it is then replaced by Enum's :meth:`~object.__new__` which is used after class creation for lookup of existing members." +#: ../../howto/enum.rst:1342 +msgid "" +"The :meth:`~object.__new__` method, if defined, is used during creation of " +"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " +"which is used after class creation for lookup of existing members." msgstr "" -msgid "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the one that is found; instead, use the data type directly -- e.g.::" +#: ../../howto/enum.rst:1348 +msgid "" +"*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " +"one that is found; instead, use the data type directly -- e.g.::" msgstr "" +#: ../../howto/enum.rst:1351 msgid "obj = int.__new__(cls, value)" msgstr "" +#: ../../howto/enum.rst:1355 msgid "OrderedEnum" msgstr "" -msgid "An ordered enumeration that is not based on :class:`IntEnum` and so maintains the normal :class:`Enum` invariants (such as not being comparable to other enumerations)::" +#: ../../howto/enum.rst:1357 +msgid "" +"An ordered enumeration that is not based on :class:`IntEnum` and so " +"maintains the normal :class:`Enum` invariants (such as not being comparable " +"to other enumerations)::" msgstr "" +#: ../../howto/enum.rst:1361 msgid "" ">>> class OrderedEnum(Enum):\n" "... def __ge__(self, other):\n" @@ -1458,12 +2085,17 @@ msgid "" "True" msgstr "" +#: ../../howto/enum.rst:1391 msgid "DuplicateFreeEnum" msgstr "" -msgid "Raises an error if a duplicate member value is found instead of creating an alias::" +#: ../../howto/enum.rst:1393 +msgid "" +"Raises an error if a duplicate member value is found instead of creating an " +"alias::" msgstr "" +#: ../../howto/enum.rst:1396 msgid "" ">>> class DuplicateFreeEnum(Enum):\n" "... def __init__(self, *args):\n" @@ -1472,7 +2104,8 @@ msgid "" "... a = self.name\n" "... e = cls(self.value).name\n" "... raise ValueError(\n" -"... \"aliases not allowed in DuplicateFreeEnum: %r --> %r\"\n" +"... \"aliases not allowed in DuplicateFreeEnum: %r --> " +"%r\"\n" "... % (a, e))\n" "...\n" ">>> class Color(DuplicateFreeEnum):\n" @@ -1486,15 +2119,22 @@ msgid "" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" -msgid "This is a useful example for subclassing Enum to add or change other behaviors as well as disallowing aliases. If the only desired change is disallowing aliases, the :func:`unique` decorator can be used instead." +#: ../../howto/enum.rst:1418 +msgid "" +"This is a useful example for subclassing Enum to add or change other " +"behaviors as well as disallowing aliases. If the only desired change is " +"disallowing aliases, the :func:`unique` decorator can be used instead." msgstr "" +#: ../../howto/enum.rst:1425 msgid "MultiValueEnum" msgstr "" +#: ../../howto/enum.rst:1427 msgid "Supports having more than one value per member::" msgstr "" +#: ../../howto/enum.rst:1429 msgid "" ">>> class MultiValueEnum(Enum):\n" "... def __new__(cls, value, *values):\n" @@ -1514,12 +2154,17 @@ msgid "" "" msgstr "" +#: ../../howto/enum.rst:1448 msgid "Planet" msgstr "" -msgid "If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value of the enum member will be passed to those methods::" +#: ../../howto/enum.rst:1450 +msgid "" +"If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value " +"of the enum member will be passed to those methods::" msgstr "" +#: ../../howto/enum.rst:1453 msgid "" ">>> class Planet(Enum):\n" "... MERCURY = (3.303e+23, 2.4397e6)\n" @@ -1545,12 +2190,15 @@ msgid "" "9.802652743337129" msgstr "" +#: ../../howto/enum.rst:1479 msgid "TimePeriod" msgstr "" +#: ../../howto/enum.rst:1481 msgid "An example to show the :attr:`~Enum._ignore_` attribute in use::" msgstr "" +#: ../../howto/enum.rst:1483 msgid "" ">>> import datetime as dt\n" ">>> class Period(dt.timedelta, Enum):\n" @@ -1561,13 +2209,20 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[, ]\n" +"[, ]\n" ">>> list(Period)[-2:]\n" -"[, ]" +"[, ]" msgstr "" +#: ../../howto/enum.rst:1500 msgid "Subclassing EnumType" msgstr "" -msgid "While most enum needs can be met by customizing :class:`Enum` subclasses, either with class decorators or custom functions, :class:`EnumType` can be subclassed to provide a different Enum experience." +#: ../../howto/enum.rst:1502 +msgid "" +"While most enum needs can be met by customizing :class:`Enum` subclasses, " +"either with class decorators or custom functions, :class:`EnumType` can be " +"subclassed to provide a different Enum experience." msgstr "" diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index 6c941461a..a869cb2aa 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-06-20 06:42+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,42 +23,76 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/free-threading-extensions.rst:7 msgid "C API Extension Support for Free Threading" msgstr "" -msgid "Starting with the 3.13 release, CPython has support for running with the :term:`global interpreter lock` (GIL) disabled in a configuration called :term:`free threading`. This document describes how to adapt C API extensions to support free threading." +#: ../../howto/free-threading-extensions.rst:9 +msgid "" +"Starting with the 3.13 release, CPython has support for running with " +"the :term:`global interpreter lock` (GIL) disabled in a configuration " +"called :term:`free threading`. This document describes how to adapt C API " +"extensions to support free threading." msgstr "" +#: ../../howto/free-threading-extensions.rst:16 msgid "Identifying the Free-Threaded Build in C" msgstr "" -msgid "The CPython C API exposes the ``Py_GIL_DISABLED`` macro: in the free-threaded build it's defined to ``1``, and in the regular build it's not defined. You can use it to enable code that only runs under the free-threaded build::" +#: ../../howto/free-threading-extensions.rst:18 +msgid "" +"The CPython C API exposes the ``Py_GIL_DISABLED`` macro: in the free-" +"threaded build it's defined to ``1``, and in the regular build it's not " +"defined. You can use it to enable code that only runs under the free-" +"threaded build::" msgstr "" +#: ../../howto/free-threading-extensions.rst:22 msgid "" "#ifdef Py_GIL_DISABLED\n" "/* code that only runs in the free-threaded build */\n" "#endif" msgstr "" -msgid "On Windows, this macro is not defined automatically, but must be specified to the compiler when building. The :func:`sysconfig.get_config_var` function can be used to determine whether the current running interpreter had the macro defined." +#: ../../howto/free-threading-extensions.rst:28 +msgid "" +"On Windows, this macro is not defined automatically, but must be specified " +"to the compiler when building. The :func:`sysconfig.get_config_var` function " +"can be used to determine whether the current running interpreter had the " +"macro defined." msgstr "" +#: ../../howto/free-threading-extensions.rst:35 msgid "Module Initialization" msgstr "" -msgid "Extension modules need to explicitly indicate that they support running with the GIL disabled; otherwise importing the extension will raise a warning and enable the GIL at runtime." +#: ../../howto/free-threading-extensions.rst:37 +msgid "" +"Extension modules need to explicitly indicate that they support running with " +"the GIL disabled; otherwise importing the extension will raise a warning and " +"enable the GIL at runtime." msgstr "" -msgid "There are two ways to indicate that an extension module supports running with the GIL disabled depending on whether the extension uses multi-phase or single-phase initialization." +#: ../../howto/free-threading-extensions.rst:41 +msgid "" +"There are two ways to indicate that an extension module supports running " +"with the GIL disabled depending on whether the extension uses multi-phase or " +"single-phase initialization." msgstr "" +#: ../../howto/free-threading-extensions.rst:46 msgid "Multi-Phase Initialization" msgstr "" -msgid "Extensions that use multi-phase initialization (i.e., :c:func:`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in the module definition. If your extension supports older versions of CPython, you should guard the slot with a :c:data:`PY_VERSION_HEX` check." +#: ../../howto/free-threading-extensions.rst:48 +msgid "" +"Extensions that use multi-phase initialization " +"(i.e., :c:func:`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in " +"the module definition. If your extension supports older versions of " +"CPython, you should guard the slot with a :c:data:`PY_VERSION_HEX` check." msgstr "" +#: ../../howto/free-threading-extensions.rst:55 msgid "" "static struct PyModuleDef_Slot module_slots[] = {\n" " ...\n" @@ -75,12 +109,21 @@ msgid "" "};" msgstr "" +#: ../../howto/free-threading-extensions.rst:71 msgid "Single-Phase Initialization" msgstr "" -msgid "Extensions that use single-phase initialization (i.e., :c:func:`PyModule_Create`) should call :c:func:`PyUnstable_Module_SetGIL` to indicate that they support running with the GIL disabled. The function is only defined in the free-threaded build, so you should guard the call with ``#ifdef Py_GIL_DISABLED`` to avoid compilation errors in the regular build." +#: ../../howto/free-threading-extensions.rst:73 +msgid "" +"Extensions that use single-phase initialization " +"(i.e., :c:func:`PyModule_Create`) should " +"call :c:func:`PyUnstable_Module_SetGIL` to indicate that they support " +"running with the GIL disabled. The function is only defined in the free-" +"threaded build, so you should guard the call with ``#ifdef Py_GIL_DISABLED`` " +"to avoid compilation errors in the regular build." msgstr "" +#: ../../howto/free-threading-extensions.rst:81 msgid "" "static struct PyModuleDef moduledef = {\n" " PyModuleDef_HEAD_INIT,\n" @@ -101,33 +144,63 @@ msgid "" "}" msgstr "" +#: ../../howto/free-threading-extensions.rst:101 msgid "General API Guidelines" msgstr "" +#: ../../howto/free-threading-extensions.rst:103 msgid "Most of the C API is thread-safe, but there are some exceptions." msgstr "" -msgid "**Struct Fields**: Accessing fields in Python C API objects or structs directly is not thread-safe if the field may be concurrently modified." +#: ../../howto/free-threading-extensions.rst:105 +msgid "" +"**Struct Fields**: Accessing fields in Python C API objects or structs " +"directly is not thread-safe if the field may be concurrently modified." msgstr "" -msgid "**Macros**: Accessor macros like :c:macro:`PyList_GET_ITEM`, :c:macro:`PyList_SET_ITEM`, and macros like :c:macro:`PySequence_Fast_GET_SIZE` that use the object returned by :c:func:`PySequence_Fast` do not perform any error checking or locking. These macros are not thread-safe if the container object may be modified concurrently." +#: ../../howto/free-threading-extensions.rst:107 +msgid "" +"**Macros**: Accessor macros " +"like :c:macro:`PyList_GET_ITEM`, :c:macro:`PyList_SET_ITEM`, and macros " +"like :c:macro:`PySequence_Fast_GET_SIZE` that use the object returned " +"by :c:func:`PySequence_Fast` do not perform any error checking or locking. " +"These macros are not thread-safe if the container object may be modified " +"concurrently." msgstr "" -msgid "**Borrowed References**: C API functions that return :term:`borrowed references ` may not be thread-safe if the containing object is modified concurrently. See the section on :ref:`borrowed references ` for more information." +#: ../../howto/free-threading-extensions.rst:113 +msgid "" +"**Borrowed References**: C API functions that return :term:`borrowed " +"references ` may not be thread-safe if the containing " +"object is modified concurrently. See the section on :ref:`borrowed " +"references ` for more information." msgstr "" +#: ../../howto/free-threading-extensions.rst:120 msgid "Container Thread Safety" msgstr "" -msgid "Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, and :c:struct:`PySetObject` perform internal locking in the free-threaded build. For example, the :c:func:`PyList_Append` will lock the list before appending an item." +#: ../../howto/free-threading-extensions.rst:122 +msgid "" +"Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, " +"and :c:struct:`PySetObject` perform internal locking in the free-threaded " +"build. For example, the :c:func:`PyList_Append` will lock the list before " +"appending an item." msgstr "" +#: ../../howto/free-threading-extensions.rst:130 msgid "``PyDict_Next``" msgstr "" -msgid "A notable exception is :c:func:`PyDict_Next`, which does not lock the dictionary. You should use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to protect the dictionary while iterating over it if the dictionary may be concurrently modified::" +#: ../../howto/free-threading-extensions.rst:132 +msgid "" +"A notable exception is :c:func:`PyDict_Next`, which does not lock the " +"dictionary. You should use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to protect " +"the dictionary while iterating over it if the dictionary may be concurrently " +"modified::" msgstr "" +#: ../../howto/free-threading-extensions.rst:137 msgid "" "Py_BEGIN_CRITICAL_SECTION(dict);\n" "PyObject *key, *value;\n" @@ -138,156 +211,282 @@ msgid "" "Py_END_CRITICAL_SECTION();" msgstr "" +#: ../../howto/free-threading-extensions.rst:147 msgid "Borrowed References" msgstr "" -msgid "Some C API functions return :term:`borrowed references `. These APIs are not thread-safe if the containing object is modified concurrently. For example, it's not safe to use :c:func:`PyList_GetItem` if the list may be modified concurrently." +#: ../../howto/free-threading-extensions.rst:151 +msgid "" +"Some C API functions return :term:`borrowed references `. These APIs are not thread-safe if the containing object is " +"modified concurrently. For example, it's not safe to " +"use :c:func:`PyList_GetItem` if the list may be modified concurrently." msgstr "" -msgid "The following table lists some borrowed reference APIs and their replacements that return :term:`strong references `." +#: ../../howto/free-threading-extensions.rst:156 +msgid "" +"The following table lists some borrowed reference APIs and their " +"replacements that return :term:`strong references `." msgstr "" +#: ../../howto/free-threading-extensions.rst:160 msgid "Borrowed reference API" msgstr "" +#: ../../howto/free-threading-extensions.rst:160 msgid "Strong reference API" msgstr "" +#: ../../howto/free-threading-extensions.rst:162 msgid ":c:func:`PyList_GetItem`" msgstr "" +#: ../../howto/free-threading-extensions.rst:162 +#: ../../howto/free-threading-extensions.rst:164 msgid ":c:func:`PyList_GetItemRef`" msgstr "" +#: ../../howto/free-threading-extensions.rst:164 msgid ":c:func:`PyList_GET_ITEM`" msgstr "" +#: ../../howto/free-threading-extensions.rst:166 msgid ":c:func:`PyDict_GetItem`" msgstr "" +#: ../../howto/free-threading-extensions.rst:166 +#: ../../howto/free-threading-extensions.rst:168 msgid ":c:func:`PyDict_GetItemRef`" msgstr "" +#: ../../howto/free-threading-extensions.rst:168 msgid ":c:func:`PyDict_GetItemWithError`" msgstr "" +#: ../../howto/free-threading-extensions.rst:170 msgid ":c:func:`PyDict_GetItemString`" msgstr "" +#: ../../howto/free-threading-extensions.rst:170 msgid ":c:func:`PyDict_GetItemStringRef`" msgstr "" +#: ../../howto/free-threading-extensions.rst:172 msgid ":c:func:`PyDict_SetDefault`" msgstr "" +#: ../../howto/free-threading-extensions.rst:172 msgid ":c:func:`PyDict_SetDefaultRef`" msgstr "" +#: ../../howto/free-threading-extensions.rst:174 msgid ":c:func:`PyDict_Next`" msgstr "" +#: ../../howto/free-threading-extensions.rst:174 msgid "none (see :ref:`PyDict_Next`)" msgstr "" +#: ../../howto/free-threading-extensions.rst:176 msgid ":c:func:`PyWeakref_GetObject`" msgstr "" +#: ../../howto/free-threading-extensions.rst:176 +#: ../../howto/free-threading-extensions.rst:178 msgid ":c:func:`PyWeakref_GetRef`" msgstr "" +#: ../../howto/free-threading-extensions.rst:178 msgid ":c:func:`PyWeakref_GET_OBJECT`" msgstr "" +#: ../../howto/free-threading-extensions.rst:180 msgid ":c:func:`PyImport_AddModule`" msgstr "" +#: ../../howto/free-threading-extensions.rst:180 msgid ":c:func:`PyImport_AddModuleRef`" msgstr "" +#: ../../howto/free-threading-extensions.rst:182 msgid ":c:func:`PyCell_GET`" msgstr "" +#: ../../howto/free-threading-extensions.rst:182 msgid ":c:func:`PyCell_Get`" msgstr "" -msgid "Not all APIs that return borrowed references are problematic. For example, :c:func:`PyTuple_GetItem` is safe because tuples are immutable. Similarly, not all uses of the above APIs are problematic. For example, :c:func:`PyDict_GetItem` is often used for parsing keyword argument dictionaries in function calls; those keyword argument dictionaries are effectively private (not accessible by other threads), so using borrowed references in that context is safe." +#: ../../howto/free-threading-extensions.rst:185 +msgid "" +"Not all APIs that return borrowed references are problematic. For " +"example, :c:func:`PyTuple_GetItem` is safe because tuples are immutable. " +"Similarly, not all uses of the above APIs are problematic. For " +"example, :c:func:`PyDict_GetItem` is often used for parsing keyword argument " +"dictionaries in function calls; those keyword argument dictionaries are " +"effectively private (not accessible by other threads), so using borrowed " +"references in that context is safe." msgstr "" -msgid "Some of these functions were added in Python 3.13. You can use the `pythoncapi-compat `_ package to provide implementations of these functions for older Python versions." +#: ../../howto/free-threading-extensions.rst:193 +msgid "" +"Some of these functions were added in Python 3.13. You can use the " +"`pythoncapi-compat `_ package " +"to provide implementations of these functions for older Python versions." msgstr "" +#: ../../howto/free-threading-extensions.rst:201 msgid "Memory Allocation APIs" msgstr "" -msgid "Python's memory management C API provides functions in three different :ref:`allocation domains `: \"raw\", \"mem\", and \"object\". For thread-safety, the free-threaded build requires that only Python objects are allocated using the object domain, and that all Python objects are allocated using that domain. This differs from the prior Python versions, where this was only a best practice and not a hard requirement." +#: ../../howto/free-threading-extensions.rst:203 +msgid "" +"Python's memory management C API provides functions in three " +"different :ref:`allocation domains `: \"raw\", \"mem\", " +"and \"object\". For thread-safety, the free-threaded build requires that " +"only Python objects are allocated using the object domain, and that all " +"Python objects are allocated using that domain. This differs from the prior " +"Python versions, where this was only a best practice and not a hard " +"requirement." msgstr "" -msgid "Search for uses of :c:func:`PyObject_Malloc` in your extension and check that the allocated memory is used for Python objects. Use :c:func:`PyMem_Malloc` to allocate buffers instead of :c:func:`PyObject_Malloc`." +#: ../../howto/free-threading-extensions.rst:212 +msgid "" +"Search for uses of :c:func:`PyObject_Malloc` in your extension and check " +"that the allocated memory is used for Python objects. " +"Use :c:func:`PyMem_Malloc` to allocate buffers instead " +"of :c:func:`PyObject_Malloc`." msgstr "" +#: ../../howto/free-threading-extensions.rst:219 msgid "Thread State and GIL APIs" msgstr "" -msgid "Python provides a set of functions and macros to manage thread state and the GIL, such as:" +#: ../../howto/free-threading-extensions.rst:221 +msgid "" +"Python provides a set of functions and macros to manage thread state and the " +"GIL, such as:" msgstr "" +#: ../../howto/free-threading-extensions.rst:224 msgid ":c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`" msgstr "" +#: ../../howto/free-threading-extensions.rst:225 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`" msgstr "" +#: ../../howto/free-threading-extensions.rst:226 msgid ":c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS`" msgstr "" -msgid "These functions should still be used in the free-threaded build to manage thread state even when the :term:`GIL` is disabled. For example, if you create a thread outside of Python, you must call :c:func:`PyGILState_Ensure` before calling into the Python API to ensure that the thread has a valid Python thread state." +#: ../../howto/free-threading-extensions.rst:228 +msgid "" +"These functions should still be used in the free-threaded build to manage " +"thread state even when the :term:`GIL` is disabled. For example, if you " +"create a thread outside of Python, you must call :c:func:`PyGILState_Ensure` " +"before calling into the Python API to ensure that the thread has a valid " +"Python thread state." msgstr "" -msgid "You should continue to call :c:func:`PyEval_SaveThread` or :c:macro:`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O or lock acquisitions, to allow other threads to run the :term:`cyclic garbage collector `." +#: ../../howto/free-threading-extensions.rst:234 +msgid "" +"You should continue to call :c:func:`PyEval_SaveThread` " +"or :c:macro:`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O " +"or lock acquisitions, to allow other threads to run the :term:`cyclic " +"garbage collector `." msgstr "" +#: ../../howto/free-threading-extensions.rst:241 msgid "Protecting Internal Extension State" msgstr "" -msgid "Your extension may have internal state that was previously protected by the GIL. You may need to add locking to protect this state. The approach will depend on your extension, but some common patterns include:" +#: ../../howto/free-threading-extensions.rst:243 +msgid "" +"Your extension may have internal state that was previously protected by the " +"GIL. You may need to add locking to protect this state. The approach will " +"depend on your extension, but some common patterns include:" msgstr "" -msgid "**Caches**: global caches are a common source of shared state. Consider using a lock to protect the cache or disabling it in the free-threaded build if the cache is not critical for performance." +#: ../../howto/free-threading-extensions.rst:247 +msgid "" +"**Caches**: global caches are a common source of shared state. Consider " +"using a lock to protect the cache or disabling it in the free-threaded build " +"if the cache is not critical for performance." msgstr "" -msgid "**Global State**: global state may need to be protected by a lock or moved to thread local storage. C11 and C++11 provide the ``thread_local`` or ``_Thread_local`` for `thread-local storage `_." +#: ../../howto/free-threading-extensions.rst:250 +msgid "" +"**Global State**: global state may need to be protected by a lock or moved " +"to thread local storage. C11 and C++11 provide the ``thread_local`` or " +"``_Thread_local`` for `thread-local storage `_." msgstr "" +#: ../../howto/free-threading-extensions.rst:257 msgid "Critical Sections" msgstr "" -msgid "In the free-threaded build, CPython provides a mechanism called \"critical sections\" to protect data that would otherwise be protected by the GIL. While extension authors may not interact with the internal critical section implementation directly, understanding their behavior is crucial when using certain C API functions or managing shared state in the free-threaded build." +#: ../../howto/free-threading-extensions.rst:261 +msgid "" +"In the free-threaded build, CPython provides a mechanism called \"critical " +"sections\" to protect data that would otherwise be protected by the GIL. " +"While extension authors may not interact with the internal critical section " +"implementation directly, understanding their behavior is crucial when using " +"certain C API functions or managing shared state in the free-threaded build." msgstr "" +#: ../../howto/free-threading-extensions.rst:268 msgid "What Are Critical Sections?" msgstr "" -msgid "Conceptually, critical sections act as a deadlock avoidance layer built on top of simple mutexes. Each thread maintains a stack of active critical sections. When a thread needs to acquire a lock associated with a critical section (e.g., implicitly when calling a thread-safe C API function like :c:func:`PyDict_SetItem`, or explicitly using macros), it attempts to acquire the underlying mutex." +#: ../../howto/free-threading-extensions.rst:270 +msgid "" +"Conceptually, critical sections act as a deadlock avoidance layer built on " +"top of simple mutexes. Each thread maintains a stack of active critical " +"sections. When a thread needs to acquire a lock associated with a critical " +"section (e.g., implicitly when calling a thread-safe C API function " +"like :c:func:`PyDict_SetItem`, or explicitly using macros), it attempts to " +"acquire the underlying mutex." msgstr "" +#: ../../howto/free-threading-extensions.rst:278 msgid "Using Critical Sections" msgstr "" +#: ../../howto/free-threading-extensions.rst:280 msgid "The primary APIs for using critical sections are:" msgstr "" -msgid ":c:macro:`Py_BEGIN_CRITICAL_SECTION` and :c:macro:`Py_END_CRITICAL_SECTION` - For locking a single object" +#: ../../howto/free-threading-extensions.rst:282 +msgid "" +":c:macro:`Py_BEGIN_CRITICAL_SECTION` and :c:macro:`Py_END_CRITICAL_SECTION` " +"- For locking a single object" msgstr "" -msgid ":c:macro:`Py_BEGIN_CRITICAL_SECTION2` and :c:macro:`Py_END_CRITICAL_SECTION2` - For locking two objects simultaneously" +#: ../../howto/free-threading-extensions.rst:285 +msgid "" +":c:macro:`Py_BEGIN_CRITICAL_SECTION2` " +"and :c:macro:`Py_END_CRITICAL_SECTION2` - For locking two objects " +"simultaneously" msgstr "" -msgid "These macros must be used in matching pairs and must appear in the same C scope, since they establish a new local scope. These macros are no-ops in non-free-threaded builds, so they can be safely added to code that needs to support both build types." +#: ../../howto/free-threading-extensions.rst:288 +msgid "" +"These macros must be used in matching pairs and must appear in the same C " +"scope, since they establish a new local scope. These macros are no-ops in " +"non-free-threaded builds, so they can be safely added to code that needs to " +"support both build types." msgstr "" -msgid "A common use of a critical section would be to lock an object while accessing an internal attribute of it. For example, if an extension type has an internal count field, you could use a critical section while reading or writing that field::" +#: ../../howto/free-threading-extensions.rst:293 +msgid "" +"A common use of a critical section would be to lock an object while " +"accessing an internal attribute of it. For example, if an extension type " +"has an internal count field, you could use a critical section while reading " +"or writing that field::" msgstr "" +#: ../../howto/free-threading-extensions.rst:298 msgid "" "// read the count, returns new reference to internal count value\n" "PyObject *result;\n" @@ -302,92 +501,195 @@ msgid "" "Py_END_CRITICAL_SECTION();" msgstr "" +#: ../../howto/free-threading-extensions.rst:312 msgid "How Critical Sections Work" msgstr "" -msgid "Unlike traditional locks, critical sections do not guarantee exclusive access throughout their entire duration. If a thread would block while holding a critical section (e.g., by acquiring another lock or performing I/O), the critical section is temporarily suspended—all locks are released—and then resumed when the blocking operation completes." +#: ../../howto/free-threading-extensions.rst:314 +msgid "" +"Unlike traditional locks, critical sections do not guarantee exclusive " +"access throughout their entire duration. If a thread would block while " +"holding a critical section (e.g., by acquiring another lock or performing I/" +"O), the critical section is temporarily suspended—all locks are released—and " +"then resumed when the blocking operation completes." msgstr "" -msgid "This behavior is similar to what happens with the GIL when a thread makes a blocking call. The key differences are:" +#: ../../howto/free-threading-extensions.rst:320 +msgid "" +"This behavior is similar to what happens with the GIL when a thread makes a " +"blocking call. The key differences are:" msgstr "" +#: ../../howto/free-threading-extensions.rst:323 msgid "Critical sections operate on a per-object basis rather than globally" msgstr "" -msgid "Critical sections follow a stack discipline within each thread (the \"begin\" and \"end\" macros enforce this since they must be paired and within the same scope)" +#: ../../howto/free-threading-extensions.rst:325 +msgid "" +"Critical sections follow a stack discipline within each thread (the " +"\"begin\" and \"end\" macros enforce this since they must be paired and " +"within the same scope)" msgstr "" -msgid "Critical sections automatically release and reacquire locks around potential blocking operations" +#: ../../howto/free-threading-extensions.rst:328 +msgid "" +"Critical sections automatically release and reacquire locks around potential " +"blocking operations" msgstr "" +#: ../../howto/free-threading-extensions.rst:332 msgid "Deadlock Avoidance" msgstr "" +#: ../../howto/free-threading-extensions.rst:334 msgid "Critical sections help avoid deadlocks in two ways:" msgstr "" -msgid "If a thread tries to acquire a lock that's already held by another thread, it first suspends all of its active critical sections, temporarily releasing their locks" +#: ../../howto/free-threading-extensions.rst:336 +msgid "" +"If a thread tries to acquire a lock that's already held by another thread, " +"it first suspends all of its active critical sections, temporarily releasing " +"their locks" msgstr "" -msgid "When the blocking operation completes, only the top-most critical section is reacquired first" +#: ../../howto/free-threading-extensions.rst:340 +msgid "" +"When the blocking operation completes, only the top-most critical section is " +"reacquired first" msgstr "" -msgid "This means you cannot rely on nested critical sections to lock multiple objects at once, as the inner critical section may suspend the outer ones. Instead, use :c:macro:`Py_BEGIN_CRITICAL_SECTION2` to lock two objects simultaneously." +#: ../../howto/free-threading-extensions.rst:343 +msgid "" +"This means you cannot rely on nested critical sections to lock multiple " +"objects at once, as the inner critical section may suspend the outer ones. " +"Instead, use :c:macro:`Py_BEGIN_CRITICAL_SECTION2` to lock two objects " +"simultaneously." msgstr "" -msgid "Note that the locks described above are only :c:type:`PyMutex` based locks. The critical section implementation does not know about or affect other locking mechanisms that might be in use, like POSIX mutexes. Also note that while blocking on any :c:type:`PyMutex` causes the critical sections to be suspended, only the mutexes that are part of the critical sections are released. If :c:type:`PyMutex` is used without a critical section, it will not be released and therefore does not get the same deadlock avoidance." +#: ../../howto/free-threading-extensions.rst:347 +msgid "" +"Note that the locks described above are only :c:type:`PyMutex` based locks. " +"The critical section implementation does not know about or affect other " +"locking mechanisms that might be in use, like POSIX mutexes. Also note that " +"while blocking on any :c:type:`PyMutex` causes the critical sections to be " +"suspended, only the mutexes that are part of the critical sections are " +"released. If :c:type:`PyMutex` is used without a critical section, it will " +"not be released and therefore does not get the same deadlock avoidance." msgstr "" +#: ../../howto/free-threading-extensions.rst:356 msgid "Important Considerations" msgstr "" -msgid "Critical sections may temporarily release their locks, allowing other threads to modify the protected data. Be careful about making assumptions about the state of the data after operations that might block." +#: ../../howto/free-threading-extensions.rst:358 +msgid "" +"Critical sections may temporarily release their locks, allowing other " +"threads to modify the protected data. Be careful about making assumptions " +"about the state of the data after operations that might block." msgstr "" -msgid "Because locks can be temporarily released (suspended), entering a critical section does not guarantee exclusive access to the protected resource throughout the section's duration. If code within a critical section calls another function that blocks (e.g., acquires another lock, performs blocking I/O), all locks held by the thread via critical sections will be released. This is similar to how the GIL can be released during blocking calls." +#: ../../howto/free-threading-extensions.rst:362 +msgid "" +"Because locks can be temporarily released (suspended), entering a critical " +"section does not guarantee exclusive access to the protected resource " +"throughout the section's duration. If code within a critical section calls " +"another function that blocks (e.g., acquires another lock, performs blocking " +"I/O), all locks held by the thread via critical sections will be released. " +"This is similar to how the GIL can be released during blocking calls." msgstr "" -msgid "Only the lock(s) associated with the most recently entered (top-most) critical section are guaranteed to be held at any given time. Locks for outer, nested critical sections might have been suspended." +#: ../../howto/free-threading-extensions.rst:369 +msgid "" +"Only the lock(s) associated with the most recently entered (top-most) " +"critical section are guaranteed to be held at any given time. Locks for " +"outer, nested critical sections might have been suspended." msgstr "" -msgid "You can lock at most two objects simultaneously with these APIs. If you need to lock more objects, you'll need to restructure your code." +#: ../../howto/free-threading-extensions.rst:373 +msgid "" +"You can lock at most two objects simultaneously with these APIs. If you need " +"to lock more objects, you'll need to restructure your code." msgstr "" -msgid "While critical sections will not deadlock if you attempt to lock the same object twice, they are less efficient than purpose-built reentrant locks for this use case." +#: ../../howto/free-threading-extensions.rst:376 +msgid "" +"While critical sections will not deadlock if you attempt to lock the same " +"object twice, they are less efficient than purpose-built reentrant locks for " +"this use case." msgstr "" -msgid "When using :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, the order of the objects doesn't affect correctness (the implementation handles deadlock avoidance), but it's good practice to always lock objects in a consistent order." +#: ../../howto/free-threading-extensions.rst:380 +msgid "" +"When using :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, the order of the objects " +"doesn't affect correctness (the implementation handles deadlock avoidance), " +"but it's good practice to always lock objects in a consistent order." msgstr "" -msgid "Remember that the critical section macros are primarily for protecting access to *Python objects* that might be involved in internal CPython operations susceptible to the deadlock scenarios described above. For protecting purely internal extension state, standard mutexes or other synchronization primitives might be more appropriate." +#: ../../howto/free-threading-extensions.rst:384 +msgid "" +"Remember that the critical section macros are primarily for protecting " +"access to *Python objects* that might be involved in internal CPython " +"operations susceptible to the deadlock scenarios described above. For " +"protecting purely internal extension state, standard mutexes or other " +"synchronization primitives might be more appropriate." msgstr "" +#: ../../howto/free-threading-extensions.rst:392 msgid "Building Extensions for the Free-Threaded Build" msgstr "" -msgid "C API extensions need to be built specifically for the free-threaded build. The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." +#: ../../howto/free-threading-extensions.rst:394 +msgid "" +"C API extensions need to be built specifically for the free-threaded build. " +"The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." msgstr "" -msgid "`pypa/manylinux `_ supports the free-threaded build, with the ``t`` suffix, such as ``python3.14t``." +#: ../../howto/free-threading-extensions.rst:397 +msgid "" +"`pypa/manylinux `_ supports the free-" +"threaded build, with the ``t`` suffix, such as ``python3.14t``." msgstr "" -msgid "`pypa/cibuildwheel `_ supports building wheels for the free-threaded build of Python 3.14 and newer." +#: ../../howto/free-threading-extensions.rst:399 +msgid "" +"`pypa/cibuildwheel `_ supports " +"building wheels for the free-threaded build of Python 3.14 and newer." msgstr "" +#: ../../howto/free-threading-extensions.rst:403 msgid "Limited C API and Stable ABI" msgstr "" -msgid "The free-threaded build does not currently support the :ref:`Limited C API ` or the stable ABI. If you use `setuptools `_ to build your extension and currently set ``py_limited_api=True`` you can use ``py_limited_api=not sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` to opt out of the limited API when building with the free-threaded build." +#: ../../howto/free-threading-extensions.rst:405 +msgid "" +"The free-threaded build does not currently support the :ref:`Limited C API " +"` or the stable ABI. If you use `setuptools `_ to build your extension and " +"currently set ``py_limited_api=True`` you can use ``py_limited_api=not " +"sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` to opt out of the limited " +"API when building with the free-threaded build." msgstr "" -msgid "You will need to build separate wheels specifically for the free-threaded build. If you currently use the stable ABI, you can continue to build a single wheel for multiple non-free-threaded Python versions." +#: ../../howto/free-threading-extensions.rst:413 +msgid "" +"You will need to build separate wheels specifically for the free-threaded " +"build. If you currently use the stable ABI, you can continue to build a " +"single wheel for multiple non-free-threaded Python versions." msgstr "" +#: ../../howto/free-threading-extensions.rst:419 msgid "Windows" msgstr "" -msgid "Due to a limitation of the official Windows installer, you will need to manually define ``Py_GIL_DISABLED=1`` when building extensions from source." +#: ../../howto/free-threading-extensions.rst:421 +msgid "" +"Due to a limitation of the official Windows installer, you will need to " +"manually define ``Py_GIL_DISABLED=1`` when building extensions from source." msgstr "" -msgid "`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for extension authors." +#: ../../howto/free-threading-extensions.rst:426 +msgid "" +"`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " +"extension authors." msgstr "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index 61647648f..6bacd32f2 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-10-04 14:19+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,203 +23,437 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/free-threading-python.rst:5 msgid "Python support for free threading" msgstr "" -msgid "Starting with the 3.13 release, CPython has support for a build of Python called :term:`free threading` where the :term:`global interpreter lock` (GIL) is disabled. Free-threaded execution allows for full utilization of the available processing power by running threads in parallel on available CPU cores. While not all software will benefit from this automatically, programs designed with threading in mind will run faster on multi-core hardware." +#: ../../howto/free-threading-python.rst:7 +msgid "" +"Starting with the 3.13 release, CPython has support for a build of Python " +"called :term:`free threading` where the :term:`global interpreter lock` " +"(GIL) is disabled. Free-threaded execution allows for full utilization of " +"the available processing power by running threads in parallel on available " +"CPU cores. While not all software will benefit from this automatically, " +"programs designed with threading in mind will run faster on multi-core " +"hardware." msgstr "" -msgid "Some third-party packages, in particular ones with an :term:`extension module`, may not be ready for use in a free-threaded build, and will re-enable the :term:`GIL`." +#: ../../howto/free-threading-python.rst:14 +msgid "" +"Some third-party packages, in particular ones with an :term:`extension " +"module`, may not be ready for use in a free-threaded build, and will re-" +"enable the :term:`GIL`." msgstr "" -msgid "This document describes the implications of free threading for Python code. See :ref:`freethreading-extensions-howto` for information on how to write C extensions that support the free-threaded build." +#: ../../howto/free-threading-python.rst:18 +msgid "" +"This document describes the implications of free threading for Python code. " +"See :ref:`freethreading-extensions-howto` for information on how to write C " +"extensions that support the free-threaded build." msgstr "" -msgid ":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an overall description of free-threaded Python." +#: ../../howto/free-threading-python.rst:24 +msgid "" +":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " +"overall description of free-threaded Python." msgstr "" +#: ../../howto/free-threading-python.rst:29 msgid "Installation" msgstr "" -msgid "Starting with Python 3.13, the official macOS and Windows installers optionally support installing free-threaded Python binaries. The installers are available at https://www.python.org/downloads/." +#: ../../howto/free-threading-python.rst:31 +msgid "" +"Starting with Python 3.13, the official macOS and Windows installers " +"optionally support installing free-threaded Python binaries. The installers " +"are available at https://www.python.org/downloads/." msgstr "" -msgid "For information on other platforms, see the `Installing a Free-Threaded Python `_, a community-maintained installation guide for installing free-threaded Python." +#: ../../howto/free-threading-python.rst:35 +msgid "" +"For information on other platforms, see the `Installing a Free-Threaded " +"Python `_, a " +"community-maintained installation guide for installing free-threaded Python." msgstr "" -msgid "When building CPython from source, the :option:`--disable-gil` configure option should be used to build a free-threaded Python interpreter." +#: ../../howto/free-threading-python.rst:39 +msgid "" +"When building CPython from source, the :option:`--disable-gil` configure " +"option should be used to build a free-threaded Python interpreter." msgstr "" +#: ../../howto/free-threading-python.rst:44 msgid "Identifying free-threaded Python" msgstr "" -msgid "To check if the current interpreter supports free-threading, :option:`python -VV <-V>` and :data:`sys.version` contain \"free-threading build\". The new :func:`sys._is_gil_enabled` function can be used to check whether the GIL is actually disabled in the running process." +#: ../../howto/free-threading-python.rst:46 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :data:`sys.version` contain \"free-threading build\". The " +"new :func:`sys._is_gil_enabled` function can be used to check whether the " +"GIL is actually disabled in the running process." msgstr "" -msgid "The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable can be used to determine whether the build supports free threading. If the variable is set to ``1``, then the build supports free threading. This is the recommended mechanism for decisions related to the build configuration." +#: ../../howto/free-threading-python.rst:51 +msgid "" +"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " +"can be used to determine whether the build supports free threading. If the " +"variable is set to ``1``, then the build supports free threading. This is " +"the recommended mechanism for decisions related to the build configuration." msgstr "" +#: ../../howto/free-threading-python.rst:58 msgid "The global interpreter lock in free-threaded Python" msgstr "" -msgid "Free-threaded builds of CPython support optionally running with the GIL enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or the command-line option :option:`-X gil`." +#: ../../howto/free-threading-python.rst:60 +msgid "" +"Free-threaded builds of CPython support optionally running with the GIL " +"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " +"the command-line option :option:`-X gil`." msgstr "" -msgid "The GIL may also automatically be enabled when importing a C-API extension module that is not explicitly marked as supporting free threading. A warning will be printed in this case." +#: ../../howto/free-threading-python.rst:64 +msgid "" +"The GIL may also automatically be enabled when importing a C-API extension " +"module that is not explicitly marked as supporting free threading. A " +"warning will be printed in this case." msgstr "" -msgid "In addition to individual package documentation, the following websites track the status of popular packages support for free threading:" +#: ../../howto/free-threading-python.rst:68 +msgid "" +"In addition to individual package documentation, the following websites " +"track the status of popular packages support for free threading:" msgstr "" +#: ../../howto/free-threading-python.rst:71 msgid "https://py-free-threading.github.io/tracking/" msgstr "" +#: ../../howto/free-threading-python.rst:72 msgid "https://hugovk.github.io/free-threaded-wheels/" msgstr "" +#: ../../howto/free-threading-python.rst:76 msgid "Thread safety" msgstr "" -msgid "The free-threaded build of CPython aims to provide similar thread-safety behavior at the Python level to the default GIL-enabled build. Built-in types like :class:`dict`, :class:`list`, and :class:`set` use internal locks to protect against concurrent modifications in ways that behave similarly to the GIL. However, Python has not historically guaranteed specific behavior for concurrent modifications to these built-in types, so this should be treated as a description of the current implementation, not a guarantee of current or future behavior." +#: ../../howto/free-threading-python.rst:78 +msgid "" +"The free-threaded build of CPython aims to provide similar thread-safety " +"behavior at the Python level to the default GIL-enabled build. Built-in " +"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks " +"to protect against concurrent modifications in ways that behave similarly to " +"the GIL. However, Python has not historically guaranteed specific behavior " +"for concurrent modifications to these built-in types, so this should be " +"treated as a description of the current implementation, not a guarantee of " +"current or future behavior." msgstr "" -msgid "It's recommended to use the :class:`threading.Lock` or other synchronization primitives instead of relying on the internal locks of built-in types, when possible." +#: ../../howto/free-threading-python.rst:89 +msgid "" +"It's recommended to use the :class:`threading.Lock` or other synchronization " +"primitives instead of relying on the internal locks of built-in types, when " +"possible." msgstr "" +#: ../../howto/free-threading-python.rst:95 msgid "Known limitations" msgstr "" -msgid "This section describes known limitations of the free-threaded CPython build." +#: ../../howto/free-threading-python.rst:97 +msgid "" +"This section describes known limitations of the free-threaded CPython build." msgstr "" +#: ../../howto/free-threading-python.rst:100 msgid "Immortalization" msgstr "" -msgid "In the free-threaded build, some objects are :term:`immortal`. Immortal objects are not deallocated and have reference counts that are never modified. This is done to avoid reference count contention that would prevent efficient multi-threaded scaling." +#: ../../howto/free-threading-python.rst:102 +msgid "" +"In the free-threaded build, some objects are :term:`immortal`. Immortal " +"objects are not deallocated and have reference counts that are never " +"modified. This is done to avoid reference count contention that would " +"prevent efficient multi-threaded scaling." msgstr "" +#: ../../howto/free-threading-python.rst:107 msgid "As of the 3.14 release, immortalization is limited to:" msgstr "" -msgid "Code constants: numeric literals, string literals, and tuple literals composed of other constants." +#: ../../howto/free-threading-python.rst:109 +msgid "" +"Code constants: numeric literals, string literals, and tuple literals " +"composed of other constants." msgstr "" +#: ../../howto/free-threading-python.rst:111 msgid "Strings interned by :func:`sys.intern`." msgstr "" +#: ../../howto/free-threading-python.rst:115 msgid "Frame objects" msgstr "" -msgid "It is not safe to access :attr:`frame.f_locals` from a :ref:`frame ` object if that frame is currently executing in another thread, and doing so may crash the interpreter." +#: ../../howto/free-threading-python.rst:117 +msgid "" +"It is not safe to access :attr:`frame.f_locals` from a :ref:`frame ` object if that frame is currently executing in another thread, and " +"doing so may crash the interpreter." msgstr "" +#: ../../howto/free-threading-python.rst:123 msgid "Iterators" msgstr "" -msgid "It is generally not thread-safe to access the same iterator object from multiple threads concurrently, and threads may see duplicate or missing elements." +#: ../../howto/free-threading-python.rst:125 +msgid "" +"It is generally not thread-safe to access the same iterator object from " +"multiple threads concurrently, and threads may see duplicate or missing " +"elements." msgstr "" +#: ../../howto/free-threading-python.rst:131 msgid "Single-threaded performance" msgstr "" -msgid "The free-threaded build has additional overhead when executing Python code compared to the default GIL-enabled build. The amount of overhead depends on the workload and hardware. On the pyperformance benchmark suite, the average overhead ranges from about 1% on macOS aarch64 to 8% on x86-64 Linux systems." +#: ../../howto/free-threading-python.rst:133 +msgid "" +"The free-threaded build has additional overhead when executing Python code " +"compared to the default GIL-enabled build. The amount of overhead depends " +"on the workload and hardware. On the pyperformance benchmark suite, the " +"average overhead ranges from about 1% on macOS aarch64 to 8% on x86-64 Linux " +"systems." msgstr "" +#: ../../howto/free-threading-python.rst:141 msgid "Behavioral changes" msgstr "" -msgid "This section describes CPython behavioural changes with the free-threaded build." +#: ../../howto/free-threading-python.rst:143 +msgid "" +"This section describes CPython behavioural changes with the free-threaded " +"build." msgstr "" +#: ../../howto/free-threading-python.rst:148 msgid "Context variables" msgstr "" -msgid "In the free-threaded build, the flag :data:`~sys.flags.thread_inherit_context` is set to true by default which causes threads created with :class:`threading.Thread` to start with a copy of the :class:`~contextvars.Context()` of the caller of :meth:`~threading.Thread.start`. In the default GIL-enabled build, the flag defaults to false so threads start with an empty :class:`~contextvars.Context()`." +#: ../../howto/free-threading-python.rst:150 +msgid "" +"In the free-threaded build, the " +"flag :data:`~sys.flags.thread_inherit_context` is set to true by default " +"which causes threads created with :class:`threading.Thread` to start with a " +"copy of the :class:`~contextvars.Context()` of the caller " +"of :meth:`~threading.Thread.start`. In the default GIL-enabled build, the " +"flag defaults to false so threads start with an " +"empty :class:`~contextvars.Context()`." msgstr "" +#: ../../howto/free-threading-python.rst:160 msgid "Warning filters" msgstr "" -msgid "In the free-threaded build, the flag :data:`~sys.flags.context_aware_warnings` is set to true by default. In the default GIL-enabled build, the flag defaults to false. If the flag is true then the :class:`warnings.catch_warnings` context manager uses a context variable for warning filters. If the flag is false then :class:`~warnings.catch_warnings` modifies the global filters list, which is not thread-safe. See the :mod:`warnings` module for more details." +#: ../../howto/free-threading-python.rst:162 +msgid "" +"In the free-threaded build, the " +"flag :data:`~sys.flags.context_aware_warnings` is set to true by default. " +"In the default GIL-enabled build, the flag defaults to false. If the flag " +"is true then the :class:`warnings.catch_warnings` context manager uses a " +"context variable for warning filters. If the flag is false " +"then :class:`~warnings.catch_warnings` modifies the global filters list, " +"which is not thread-safe. See the :mod:`warnings` module for more details." msgstr "" +#: ../../howto/free-threading-python.rst:171 msgid "Increased memory usage" msgstr "" -msgid "The free-threaded build will typically use more memory compared to the default build. There are multiple reasons for this, mostly due to design decisions." +#: ../../howto/free-threading-python.rst:173 +msgid "" +"The free-threaded build will typically use more memory compared to the " +"default build. There are multiple reasons for this, mostly due to design " +"decisions." msgstr "" +#: ../../howto/free-threading-python.rst:178 msgid "All interned strings are immortal" msgstr "" -msgid "For modern Python versions (since version 2.3), interning a string (e.g. with :func:`sys.intern`) does not cause it to become immortal. Instead, if the last reference to that string disappears, it will be removed from the interned string table. This is not the case for the free-threaded build and any interned string will become immortal, surviving until interpreter shutdown." +#: ../../howto/free-threading-python.rst:180 +msgid "" +"For modern Python versions (since version 2.3), interning a string (e.g. " +"with :func:`sys.intern`) does not cause it to become immortal. Instead, if " +"the last reference to that string disappears, it will be removed from the " +"interned string table. This is not the case for the free-threaded build and " +"any interned string will become immortal, surviving until interpreter " +"shutdown." msgstr "" +#: ../../howto/free-threading-python.rst:188 msgid "Non-GC objects have a larger object header" msgstr "" -msgid "The free-threaded build uses a different :c:type:`PyObject` structure. Instead of having the GC related information allocated before the :c:type:`PyObject` structure, like in the default build, the GC related info is part of the normal object header. For example, on the AMD64 platform, ``None`` uses 32 bytes on the free-threaded build vs 16 bytes for the default build. GC objects (such as dicts and lists) are the same size for both builds since the free-threaded build does not use additional space for the GC info." +#: ../../howto/free-threading-python.rst:190 +msgid "" +"The free-threaded build uses a different :c:type:`PyObject` structure. " +"Instead of having the GC related information allocated before " +"the :c:type:`PyObject` structure, like in the default build, the GC related " +"info is part of the normal object header. For example, on the AMD64 " +"platform, ``None`` uses 32 bytes on the free-threaded build vs 16 bytes for " +"the default build. GC objects (such as dicts and lists) are the same size " +"for both builds since the free-threaded build does not use additional space " +"for the GC info." msgstr "" +#: ../../howto/free-threading-python.rst:200 msgid "QSBR can delay freeing of memory" msgstr "" -msgid "In order to safely implement lock-free data structures, a safe memory reclamation (SMR) scheme is used, known as quiescent state-based reclamation (QSBR). This means that the memory backing data structures allowing lock-free access will use QSBR, which defers the free operation, rather than immediately freeing the memory. Two examples of these data structures are the list object and the dictionary keys object. See ``InternalDocs/qsbr.md`` in the CPython source tree for more details on how QSBR is implemented. Running :func:`gc.collect` should cause all memory being held by QSBR to be actually freed. Note that even when QSBR frees the memory, the underlying memory allocator may not immediately return that memory to the OS and so the resident set size (RSS) of the process might not decrease." -msgstr "" - +#: ../../howto/free-threading-python.rst:202 +msgid "" +"In order to safely implement lock-free data structures, a safe memory " +"reclamation (SMR) scheme is used, known as quiescent state-based reclamation " +"(QSBR). This means that the memory backing data structures allowing lock-" +"free access will use QSBR, which defers the free operation, rather than " +"immediately freeing the memory. Two examples of these data structures are " +"the list object and the dictionary keys object. See ``InternalDocs/" +"qsbr.md`` in the CPython source tree for more details on how QSBR is " +"implemented. Running :func:`gc.collect` should cause all memory being held " +"by QSBR to be actually freed. Note that even when QSBR frees the memory, " +"the underlying memory allocator may not immediately return that memory to " +"the OS and so the resident set size (RSS) of the process might not decrease." +msgstr "" + +#: ../../howto/free-threading-python.rst:216 msgid "mimalloc allocator vs pymalloc" msgstr "" -msgid "The default build will normally use the \"pymalloc\" memory allocator for small allocations (512 bytes or smaller). The free-threaded build does not use pymalloc and allocates all Python objects using the \"mimalloc\" allocator. The pymalloc allocator has the following properties that help keep memory usage low: small per-allocated-block overhead, effective memory fragmentation prevention, and quick return of free memory to the operating system. The mimalloc allocator does quite well in these respects as well but can have some more overhead." -msgstr "" - -msgid "In the free-threaded build, mimalloc manages memory in a number of separate heaps (currently four). For example, all GC supporting objects are allocated from their own heap. Using separate heaps means that free memory in one heap cannot be used for an allocation that uses another heap. Also, some heaps are configured to use QSBR (quiescent-state based reclamation) when freeing the memory that backs up the heap (known as \"pages\" in mimalloc terminology). The use of QSBR creates a delay between all memory blocks for a page being freed and the memory page being released, either for new allocations or back to the OS." +#: ../../howto/free-threading-python.rst:218 +msgid "" +"The default build will normally use the \"pymalloc\" memory allocator for " +"small allocations (512 bytes or smaller). The free-threaded build does not " +"use pymalloc and allocates all Python objects using the \"mimalloc\" " +"allocator. The pymalloc allocator has the following properties that help " +"keep memory usage low: small per-allocated-block overhead, effective memory " +"fragmentation prevention, and quick return of free memory to the operating " +"system. The mimalloc allocator does quite well in these respects as well " +"but can have some more overhead." msgstr "" -msgid "The mimalloc allocator also defers returning freed memory back to the OS. You can reduce that delay by setting the environment variable :envvar:`!MIMALLOC_PURGE_DELAY` to ``0``. Note that this will likely reduce the performance of the allocator." +#: ../../howto/free-threading-python.rst:227 +msgid "" +"In the free-threaded build, mimalloc manages memory in a number of separate " +"heaps (currently four). For example, all GC supporting objects are " +"allocated from their own heap. Using separate heaps means that free memory " +"in one heap cannot be used for an allocation that uses another heap. Also, " +"some heaps are configured to use QSBR (quiescent-state based reclamation) " +"when freeing the memory that backs up the heap (known as \"pages\" in " +"mimalloc terminology). The use of QSBR creates a delay between all memory " +"blocks for a page being freed and the memory page being released, either for " +"new allocations or back to the OS." +msgstr "" + +#: ../../howto/free-threading-python.rst:237 +msgid "" +"The mimalloc allocator also defers returning freed memory back to the OS. " +"You can reduce that delay by setting the environment variable :envvar:`!" +"MIMALLOC_PURGE_DELAY` to ``0``. Note that this will likely reduce the " +"performance of the allocator." msgstr "" +#: ../../howto/free-threading-python.rst:244 msgid "Free-threaded reference counting can cause objects to live longer" msgstr "" -msgid "In the default build, when an object's reference count reaches zero, it is normally deallocated. The free-threaded build uses \"biased reference counting\", with a fast-path for objects \"owned\" by the current thread and a slow path for other objects. See :pep:`703` for additional details. Any time an object's reference count ends up in a \"queued\" state, deallocation can be deferred. The queued state is cleared from the \"eval breaker\" section of the bytecode evaluator." +#: ../../howto/free-threading-python.rst:246 +msgid "" +"In the default build, when an object's reference count reaches zero, it is " +"normally deallocated. The free-threaded build uses \"biased reference " +"counting\", with a fast-path for objects \"owned\" by the current thread and " +"a slow path for other objects. See :pep:`703` for additional details. Any " +"time an object's reference count ends up in a \"queued\" state, deallocation " +"can be deferred. The queued state is cleared from the \"eval breaker\" " +"section of the bytecode evaluator." msgstr "" -msgid "The free-threaded build also allows a different mode of reference counting, known as \"deferred reference counting\". This mode is enabled by setting a flag on a per-object basis. Deferred reference counting is enabled for the following types:" +#: ../../howto/free-threading-python.rst:254 +msgid "" +"The free-threaded build also allows a different mode of reference counting, " +"known as \"deferred reference counting\". This mode is enabled by setting a " +"flag on a per-object basis. Deferred reference counting is enabled for the " +"following types:" msgstr "" +#: ../../howto/free-threading-python.rst:259 msgid "module objects" msgstr "" +#: ../../howto/free-threading-python.rst:260 msgid "module top-level functions" msgstr "" +#: ../../howto/free-threading-python.rst:261 msgid "class methods defined in the class scope" msgstr "" +#: ../../howto/free-threading-python.rst:262 msgid "descriptor objects" msgstr "" +#: ../../howto/free-threading-python.rst:263 msgid "thread-local objects, created by :class:`threading.local`" msgstr "" -msgid "When deferred reference counting is enabled, references from Python function stacks are not added to the reference count. This scheme reduces the overhead of reference counting, especially for objects used from multiple threads. Because the stack references are not counted, objects with deferred reference counting are not immediately freed when their internal reference count goes to zero. Instead, they are examined by the next GC run and, if no stack references to them are found, they are freed. This means these objects are freed by the GC and not when their reference count goes to zero, as is typical." -msgstr "" - +#: ../../howto/free-threading-python.rst:265 +msgid "" +"When deferred reference counting is enabled, references from Python function " +"stacks are not added to the reference count. This scheme reduces the " +"overhead of reference counting, especially for objects used from multiple " +"threads. Because the stack references are not counted, objects with deferred " +"reference counting are not immediately freed when their internal reference " +"count goes to zero. Instead, they are examined by the next GC run and, if " +"no stack references to them are found, they are freed. This means these " +"objects are freed by the GC and not when their reference count goes to zero, " +"as is typical." +msgstr "" + +#: ../../howto/free-threading-python.rst:276 msgid "Per-thread reference counting can delay freeing objects" msgstr "" -msgid "To avoid contention on the reference count fields of frequently shared objects, the free-threaded build also uses \"per-thread reference counting\" for a few selected object types. Rather than updating a single shared reference count, each thread maintains its own local reference count array, indexed by a unique id assigned to the object. The true reference count is only computed by summing the per-thread counts when the object's local count drops to zero. Per-thread reference counting is currently used for:" +#: ../../howto/free-threading-python.rst:278 +msgid "" +"To avoid contention on the reference count fields of frequently shared " +"objects, the free-threaded build also uses \"per-thread reference counting\" " +"for a few selected object types. Rather than updating a single shared " +"reference count, each thread maintains its own local reference count array, " +"indexed by a unique id assigned to the object. The true reference count is " +"only computed by summing the per-thread counts when the object's local count " +"drops to zero. Per-thread reference counting is currently used for:" msgstr "" +#: ../../howto/free-threading-python.rst:286 msgid "heap type objects (classes created in Python)" msgstr "" +#: ../../howto/free-threading-python.rst:287 msgid "code objects" msgstr "" +#: ../../howto/free-threading-python.rst:288 msgid "the ``__dict__`` of module objects" msgstr "" -msgid "Because the per-thread counts must be merged back to the object before it can be deallocated, objects using per-thread reference counting are typically freed later than they would be in the default build. In particular, such an object is usually not freed until the thread that referenced it reaches a safe point (for example, in the \"eval breaker\" section of the bytecode evaluator) or exits. Running :func:`gc.collect` will merge the per-thread counts and allow these objects to be freed." +#: ../../howto/free-threading-python.rst:290 +msgid "" +"Because the per-thread counts must be merged back to the object before it " +"can be deallocated, objects using per-thread reference counting are " +"typically freed later than they would be in the default build. In " +"particular, such an object is usually not freed until the thread that " +"referenced it reaches a safe point (for example, in the \"eval breaker\" " +"section of the bytecode evaluator) or exits. Running :func:`gc.collect` " +"will merge the per-thread counts and allow these objects to be freed." msgstr "" diff --git a/howto/functional.po b/howto/functional.po index a193720dd..aef126da5 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,138 +24,321 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/functional.rst:5 msgid "Functional Programming HOWTO" msgstr "" +#: ../../howto/functional.rst:0 msgid "Author" msgstr "" +#: ../../howto/functional.rst:7 msgid "\\A. M. Kuchling" msgstr "" +#: ../../howto/functional.rst:0 msgid "Release" msgstr "" +#: ../../howto/functional.rst:8 msgid "0.32" msgstr "" -msgid "In this document, we'll take a tour of Python's features suitable for implementing programs in a functional style. After an introduction to the concepts of functional programming, we'll look at language features such as :term:`iterator`\\s and :term:`generator`\\s and relevant library modules such as :mod:`itertools` and :mod:`functools`." +#: ../../howto/functional.rst:10 +msgid "" +"In this document, we'll take a tour of Python's features suitable for " +"implementing programs in a functional style. After an introduction to the " +"concepts of functional programming, we'll look at language features such " +"as :term:`iterator`\\s and :term:`generator`\\s and relevant library modules " +"such as :mod:`itertools` and :mod:`functools`." msgstr "" +#: ../../howto/functional.rst:18 msgid "Introduction" msgstr "" -msgid "This section explains the basic concept of functional programming; if you're just interested in learning about Python language features, skip to the next section on :ref:`functional-howto-iterators`." -msgstr "" - -msgid "Programming languages support decomposing problems in several different ways:" +#: ../../howto/functional.rst:20 +msgid "" +"This section explains the basic concept of functional programming; if you're " +"just interested in learning about Python language features, skip to the next " +"section on :ref:`functional-howto-iterators`." msgstr "" -msgid "Most programming languages are **procedural**: programs are lists of instructions that tell the computer what to do with the program's input. C, Pascal, and even Unix shells are procedural languages." +#: ../../howto/functional.rst:24 +msgid "" +"Programming languages support decomposing problems in several different ways:" msgstr "" -msgid "In **declarative** languages, you write a specification that describes the problem to be solved, and the language implementation figures out how to perform the computation efficiently. SQL is the declarative language you're most likely to be familiar with; a SQL query describes the data set you want to retrieve, and the SQL engine decides whether to scan tables or use indexes, which subclauses should be performed first, etc." +#: ../../howto/functional.rst:26 +msgid "" +"Most programming languages are **procedural**: programs are lists of " +"instructions that tell the computer what to do with the program's input. C, " +"Pascal, and even Unix shells are procedural languages." msgstr "" -msgid "**Object-oriented** programs manipulate collections of objects. Objects have internal state and support methods that query or modify this internal state in some way. Smalltalk and Java are object-oriented languages. C++ and Python are languages that support object-oriented programming, but don't force the use of object-oriented features." +#: ../../howto/functional.rst:30 +msgid "" +"In **declarative** languages, you write a specification that describes the " +"problem to be solved, and the language implementation figures out how to " +"perform the computation efficiently. SQL is the declarative language you're " +"most likely to be familiar with; a SQL query describes the data set you want " +"to retrieve, and the SQL engine decides whether to scan tables or use " +"indexes, which subclauses should be performed first, etc." msgstr "" -msgid "**Functional** programming decomposes a problem into a set of functions. Ideally, functions only take inputs and produce outputs, and don't have any internal state that affects the output produced for a given input. Well-known functional languages include the ML family (Standard ML, OCaml, and other variants) and Haskell." +#: ../../howto/functional.rst:37 +msgid "" +"**Object-oriented** programs manipulate collections of objects. Objects " +"have internal state and support methods that query or modify this internal " +"state in some way. Smalltalk and Java are object-oriented languages. C++ " +"and Python are languages that support object-oriented programming, but don't " +"force the use of object-oriented features." msgstr "" -msgid "The designers of some computer languages choose to emphasize one particular approach to programming. This often makes it difficult to write programs that use a different approach. Other languages are multi-paradigm languages that support several different approaches. Lisp, C++, and Python are multi-paradigm; you can write programs or libraries that are largely procedural, object-oriented, or functional in all of these languages. In a large program, different sections might be written using different approaches; the GUI might be object-oriented while the processing logic is procedural or functional, for example." +#: ../../howto/functional.rst:43 +msgid "" +"**Functional** programming decomposes a problem into a set of functions. " +"Ideally, functions only take inputs and produce outputs, and don't have any " +"internal state that affects the output produced for a given input. Well-" +"known functional languages include the ML family (Standard ML, OCaml, and " +"other variants) and Haskell." msgstr "" -msgid "In a functional program, input flows through a set of functions. Each function operates on its input and produces some output. Functional style discourages functions with side effects that modify internal state or make other changes that aren't visible in the function's return value. Functions that have no side effects at all are called **purely functional**. Avoiding side effects means not using data structures that get updated as a program runs; every function's output must only depend on its input." +#: ../../howto/functional.rst:49 +msgid "" +"The designers of some computer languages choose to emphasize one particular " +"approach to programming. This often makes it difficult to write programs " +"that use a different approach. Other languages are multi-paradigm languages " +"that support several different approaches. Lisp, C++, and Python are multi-" +"paradigm; you can write programs or libraries that are largely procedural, " +"object-oriented, or functional in all of these languages. In a large " +"program, different sections might be written using different approaches; the " +"GUI might be object-oriented while the processing logic is procedural or " +"functional, for example." +msgstr "" + +#: ../../howto/functional.rst:60 +msgid "" +"In a functional program, input flows through a set of functions. Each " +"function operates on its input and produces some output. Functional style " +"discourages functions with side effects that modify internal state or make " +"other changes that aren't visible in the function's return value. Functions " +"that have no side effects at all are called **purely functional**. Avoiding " +"side effects means not using data structures that get updated as a program " +"runs; every function's output must only depend on its input." msgstr "" -msgid "Some languages are very strict about purity and don't even have assignment statements such as ``a=3`` or ``c = a + b``, but it's difficult to avoid all side effects, such as printing to the screen or writing to a disk file. Another example is a call to the :func:`print` or :func:`time.sleep` function, neither of which returns a useful value. Both are called only for their side effects of sending some text to the screen or pausing execution for a second." +#: ../../howto/functional.rst:68 +msgid "" +"Some languages are very strict about purity and don't even have assignment " +"statements such as ``a=3`` or ``c = a + b``, but it's difficult to avoid all " +"side effects, such as printing to the screen or writing to a disk file. " +"Another example is a call to the :func:`print` or :func:`time.sleep` " +"function, neither of which returns a useful value. Both are called only for " +"their side effects of sending some text to the screen or pausing execution " +"for a second." msgstr "" -msgid "Python programs written in functional style usually won't go to the extreme of avoiding all I/O or all assignments; instead, they'll provide a functional-appearing interface but will use non-functional features internally. For example, the implementation of a function will still use assignments to local variables, but won't modify global variables or have other side effects." +#: ../../howto/functional.rst:75 +msgid "" +"Python programs written in functional style usually won't go to the extreme " +"of avoiding all I/O or all assignments; instead, they'll provide a " +"functional-appearing interface but will use non-functional features " +"internally. For example, the implementation of a function will still use " +"assignments to local variables, but won't modify global variables or have " +"other side effects." msgstr "" -msgid "Functional programming can be considered the opposite of object-oriented programming. Objects are little capsules containing some internal state along with a collection of method calls that let you modify this state, and programs consist of making the right set of state changes. Functional programming wants to avoid state changes as much as possible and works with data flowing between functions. In Python you might combine the two approaches by writing functions that take and return instances representing objects in your application (e-mail messages, transactions, etc.)." +#: ../../howto/functional.rst:81 +msgid "" +"Functional programming can be considered the opposite of object-oriented " +"programming. Objects are little capsules containing some internal state " +"along with a collection of method calls that let you modify this state, and " +"programs consist of making the right set of state changes. Functional " +"programming wants to avoid state changes as much as possible and works with " +"data flowing between functions. In Python you might combine the two " +"approaches by writing functions that take and return instances representing " +"objects in your application (e-mail messages, transactions, etc.)." msgstr "" -msgid "Functional design may seem like an odd constraint to work under. Why should you avoid objects and side effects? There are theoretical and practical advantages to the functional style:" +#: ../../howto/functional.rst:90 +msgid "" +"Functional design may seem like an odd constraint to work under. Why should " +"you avoid objects and side effects? There are theoretical and practical " +"advantages to the functional style:" msgstr "" +#: ../../howto/functional.rst:94 msgid "Formal provability." msgstr "" +#: ../../howto/functional.rst:95 msgid "Modularity." msgstr "" +#: ../../howto/functional.rst:96 msgid "Composability." msgstr "" +#: ../../howto/functional.rst:97 msgid "Ease of debugging and testing." msgstr "" +#: ../../howto/functional.rst:101 msgid "Formal provability" msgstr "" -msgid "A theoretical benefit is that it's easier to construct a mathematical proof that a functional program is correct." +#: ../../howto/functional.rst:103 +msgid "" +"A theoretical benefit is that it's easier to construct a mathematical proof " +"that a functional program is correct." msgstr "" -msgid "For a long time researchers have been interested in finding ways to mathematically prove programs correct. This is different from testing a program on numerous inputs and concluding that its output is usually correct, or reading a program's source code and concluding that the code looks right; the goal is instead a rigorous proof that a program produces the right result for all possible inputs." +#: ../../howto/functional.rst:106 +msgid "" +"For a long time researchers have been interested in finding ways to " +"mathematically prove programs correct. This is different from testing a " +"program on numerous inputs and concluding that its output is usually " +"correct, or reading a program's source code and concluding that the code " +"looks right; the goal is instead a rigorous proof that a program produces " +"the right result for all possible inputs." msgstr "" -msgid "The technique used to prove programs correct is to write down **invariants**, properties of the input data and of the program's variables that are always true. For each line of code, you then show that if invariants X and Y are true **before** the line is executed, the slightly different invariants X' and Y' are true **after** the line is executed. This continues until you reach the end of the program, at which point the invariants should match the desired conditions on the program's output." +#: ../../howto/functional.rst:113 +msgid "" +"The technique used to prove programs correct is to write down " +"**invariants**, properties of the input data and of the program's variables " +"that are always true. For each line of code, you then show that if " +"invariants X and Y are true **before** the line is executed, the slightly " +"different invariants X' and Y' are true **after** the line is executed. " +"This continues until you reach the end of the program, at which point the " +"invariants should match the desired conditions on the program's output." msgstr "" -msgid "Functional programming's avoidance of assignments arose because assignments are difficult to handle with this technique; assignments can break invariants that were true before the assignment without producing any new invariants that can be propagated onward." +#: ../../howto/functional.rst:121 +msgid "" +"Functional programming's avoidance of assignments arose because assignments " +"are difficult to handle with this technique; assignments can break " +"invariants that were true before the assignment without producing any new " +"invariants that can be propagated onward." msgstr "" -msgid "Unfortunately, proving programs correct is largely impractical and not relevant to Python software. Even trivial programs require proofs that are several pages long; the proof of correctness for a moderately complicated program would be enormous, and few or none of the programs you use daily (the Python interpreter, your XML parser, your web browser) could be proven correct. Even if you wrote down or generated a proof, there would then be the question of verifying the proof; maybe there's an error in it, and you wrongly believe you've proved the program correct." +#: ../../howto/functional.rst:126 +msgid "" +"Unfortunately, proving programs correct is largely impractical and not " +"relevant to Python software. Even trivial programs require proofs that are " +"several pages long; the proof of correctness for a moderately complicated " +"program would be enormous, and few or none of the programs you use daily " +"(the Python interpreter, your XML parser, your web browser) could be proven " +"correct. Even if you wrote down or generated a proof, there would then be " +"the question of verifying the proof; maybe there's an error in it, and you " +"wrongly believe you've proved the program correct." msgstr "" +#: ../../howto/functional.rst:137 msgid "Modularity" msgstr "" -msgid "A more practical benefit of functional programming is that it forces you to break apart your problem into small pieces. Programs are more modular as a result. It's easier to specify and write a small function that does one thing than a large function that performs a complicated transformation. Small functions are also easier to read and to check for errors." +#: ../../howto/functional.rst:139 +msgid "" +"A more practical benefit of functional programming is that it forces you to " +"break apart your problem into small pieces. Programs are more modular as a " +"result. It's easier to specify and write a small function that does one " +"thing than a large function that performs a complicated transformation. " +"Small functions are also easier to read and to check for errors." msgstr "" +#: ../../howto/functional.rst:147 msgid "Ease of debugging and testing" msgstr "" +#: ../../howto/functional.rst:149 msgid "Testing and debugging a functional-style program is easier." msgstr "" -msgid "Debugging is simplified because functions are generally small and clearly specified. When a program doesn't work, each function is an interface point where you can check that the data are correct. You can look at the intermediate inputs and outputs to quickly isolate the function that's responsible for a bug." +#: ../../howto/functional.rst:151 +msgid "" +"Debugging is simplified because functions are generally small and clearly " +"specified. When a program doesn't work, each function is an interface point " +"where you can check that the data are correct. You can look at the " +"intermediate inputs and outputs to quickly isolate the function that's " +"responsible for a bug." msgstr "" -msgid "Testing is easier because each function is a potential subject for a unit test. Functions don't depend on system state that needs to be replicated before running a test; instead you only have to synthesize the right input and then check that the output matches expectations." +#: ../../howto/functional.rst:156 +msgid "" +"Testing is easier because each function is a potential subject for a unit " +"test. Functions don't depend on system state that needs to be replicated " +"before running a test; instead you only have to synthesize the right input " +"and then check that the output matches expectations." msgstr "" +#: ../../howto/functional.rst:163 msgid "Composability" msgstr "" -msgid "As you work on a functional-style program, you'll write a number of functions with varying inputs and outputs. Some of these functions will be unavoidably specialized to a particular application, but others will be useful in a wide variety of programs. For example, a function that takes a directory path and returns all the XML files in the directory, or a function that takes a filename and returns its contents, can be applied to many different situations." +#: ../../howto/functional.rst:165 +msgid "" +"As you work on a functional-style program, you'll write a number of " +"functions with varying inputs and outputs. Some of these functions will be " +"unavoidably specialized to a particular application, but others will be " +"useful in a wide variety of programs. For example, a function that takes a " +"directory path and returns all the XML files in the directory, or a function " +"that takes a filename and returns its contents, can be applied to many " +"different situations." msgstr "" -msgid "Over time you'll form a personal library of utilities. Often you'll assemble new programs by arranging existing functions in a new configuration and writing a few functions specialized for the current task." +#: ../../howto/functional.rst:172 +msgid "" +"Over time you'll form a personal library of utilities. Often you'll " +"assemble new programs by arranging existing functions in a new configuration " +"and writing a few functions specialized for the current task." msgstr "" +#: ../../howto/functional.rst:180 msgid "Iterators" msgstr "" -msgid "I'll start by looking at a Python language feature that's an important foundation for writing functional-style programs: iterators." +#: ../../howto/functional.rst:182 +msgid "" +"I'll start by looking at a Python language feature that's an important " +"foundation for writing functional-style programs: iterators." msgstr "" -msgid "An iterator is an object representing a stream of data; this object returns the data one element at a time. A Python iterator must support a method called :meth:`~iterator.__next__` that takes no arguments and always returns the next element of the stream. If there are no more elements in the stream, :meth:`~iterator.__next__` must raise the :exc:`StopIteration` exception. Iterators don't have to be finite, though; it's perfectly reasonable to write an iterator that produces an infinite stream of data." +#: ../../howto/functional.rst:185 +msgid "" +"An iterator is an object representing a stream of data; this object returns " +"the data one element at a time. A Python iterator must support a method " +"called :meth:`~iterator.__next__` that takes no arguments and always returns " +"the next element of the stream. If there are no more elements in the " +"stream, :meth:`~iterator.__next__` must raise the :exc:`StopIteration` " +"exception. Iterators don't have to be finite, though; it's perfectly " +"reasonable to write an iterator that produces an infinite stream of data." msgstr "" -msgid "The built-in :func:`iter` function takes an arbitrary object and tries to return an iterator that will return the object's contents or elements, raising :exc:`TypeError` if the object doesn't support iteration. Several of Python's built-in data types support iteration, the most common being lists and dictionaries. An object is called :term:`iterable` if you can get an iterator for it." +#: ../../howto/functional.rst:193 +msgid "" +"The built-in :func:`iter` function takes an arbitrary object and tries to " +"return an iterator that will return the object's contents or elements, " +"raising :exc:`TypeError` if the object doesn't support iteration. Several " +"of Python's built-in data types support iteration, the most common being " +"lists and dictionaries. An object is called :term:`iterable` if you can get " +"an iterator for it." msgstr "" +#: ../../howto/functional.rst:200 msgid "You can experiment with the iteration interface manually:" msgstr "" -msgid "Python expects iterable objects in several different contexts, the most important being the :keyword:`for` statement. In the statement ``for X in Y``, Y must be an iterator or some object for which :func:`iter` can create an iterator. These two statements are equivalent::" +#: ../../howto/functional.rst:218 +msgid "" +"Python expects iterable objects in several different contexts, the most " +"important being the :keyword:`for` statement. In the statement ``for X in " +"Y``, Y must be an iterator or some object for which :func:`iter` can create " +"an iterator. These two statements are equivalent::" msgstr "" +#: ../../howto/functional.rst:224 msgid "" "for i in iter(obj):\n" " print(i)\n" @@ -164,27 +347,59 @@ msgid "" " print(i)" msgstr "" -msgid "Iterators can be materialized as lists or tuples by using the :func:`list` or :func:`tuple` constructor functions:" +#: ../../howto/functional.rst:230 +msgid "" +"Iterators can be materialized as lists or tuples by using the :func:`list` " +"or :func:`tuple` constructor functions:" msgstr "" -msgid "Sequence unpacking also supports iterators: if you know an iterator will return N elements, you can unpack them into an N-tuple:" +#: ../../howto/functional.rst:239 +msgid "" +"Sequence unpacking also supports iterators: if you know an iterator will " +"return N elements, you can unpack them into an N-tuple:" msgstr "" -msgid "Built-in functions such as :func:`max` and :func:`min` can take a single iterator argument and will return the largest or smallest element. The ``\"in\"`` and ``\"not in\"`` operators also support iterators: ``X in iterator`` is true if X is found in the stream returned by the iterator. You'll run into obvious problems if the iterator is infinite; :func:`max`, :func:`min` will never return, and if the element X never appears in the stream, the ``\"in\"`` and ``\"not in\"`` operators won't return either." +#: ../../howto/functional.rst:248 +msgid "" +"Built-in functions such as :func:`max` and :func:`min` can take a single " +"iterator argument and will return the largest or smallest element. The " +"``\"in\"`` and ``\"not in\"`` operators also support iterators: ``X in " +"iterator`` is true if X is found in the stream returned by the iterator. " +"You'll run into obvious problems if the iterator is " +"infinite; :func:`max`, :func:`min` will never return, and if the element X " +"never appears in the stream, the ``\"in\"`` and ``\"not in\"`` operators " +"won't return either." msgstr "" -msgid "Note that you can only go forward in an iterator; there's no way to get the previous element, reset the iterator, or make a copy of it. Iterator objects can optionally provide these additional capabilities, but the iterator protocol only specifies the :meth:`~iterator.__next__` method. Functions may therefore consume all of the iterator's output, and if you need to do something different with the same stream, you'll have to create a new iterator." +#: ../../howto/functional.rst:256 +msgid "" +"Note that you can only go forward in an iterator; there's no way to get the " +"previous element, reset the iterator, or make a copy of it. Iterator " +"objects can optionally provide these additional capabilities, but the " +"iterator protocol only specifies the :meth:`~iterator.__next__` method. " +"Functions may therefore consume all of the iterator's output, and if you " +"need to do something different with the same stream, you'll have to create a " +"new iterator." msgstr "" +#: ../../howto/functional.rst:266 msgid "Data Types That Support Iterators" msgstr "" -msgid "We've already seen how lists and tuples support iterators. In fact, any Python sequence type, such as strings, will automatically support creation of an iterator." +#: ../../howto/functional.rst:268 +msgid "" +"We've already seen how lists and tuples support iterators. In fact, any " +"Python sequence type, such as strings, will automatically support creation " +"of an iterator." msgstr "" -msgid "Calling :func:`iter` on a dictionary returns an iterator that will loop over the dictionary's keys::" +#: ../../howto/functional.rst:272 +msgid "" +"Calling :func:`iter` on a dictionary returns an iterator that will loop over " +"the dictionary's keys::" msgstr "" +#: ../../howto/functional.rst:275 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -204,27 +419,49 @@ msgid "" "Dec 12" msgstr "" -msgid "Note that starting with Python 3.7, dictionary iteration order is guaranteed to be the same as the insertion order. In earlier versions, the behaviour was unspecified and could vary between implementations." +#: ../../howto/functional.rst:292 +msgid "" +"Note that starting with Python 3.7, dictionary iteration order is guaranteed " +"to be the same as the insertion order. In earlier versions, the behaviour " +"was unspecified and could vary between implementations." msgstr "" -msgid "Applying :func:`iter` to a dictionary always loops over the keys, but dictionaries have methods that return other iterators. If you want to iterate over values or key/value pairs, you can explicitly call the :meth:`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator." +#: ../../howto/functional.rst:296 +msgid "" +"Applying :func:`iter` to a dictionary always loops over the keys, but " +"dictionaries have methods that return other iterators. If you want to " +"iterate over values or key/value pairs, you can explicitly call " +"the :meth:`~dict.values` or :meth:`~dict.items` methods to get an " +"appropriate iterator." msgstr "" -msgid "The :func:`dict` constructor can accept an iterator that returns a finite stream of ``(key, value)`` tuples:" +#: ../../howto/functional.rst:302 +msgid "" +"The :func:`dict` constructor can accept an iterator that returns a finite " +"stream of ``(key, value)`` tuples:" msgstr "" -msgid "Files also support iteration by calling the :meth:`~io.TextIOBase.readline` method until there are no more lines in the file. This means you can read each line of a file like this::" +#: ../../howto/functional.rst:309 +msgid "" +"Files also support iteration by calling the :meth:`~io.TextIOBase.readline` " +"method until there are no more lines in the file. This means you can read " +"each line of a file like this::" msgstr "" +#: ../../howto/functional.rst:313 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" -msgid "Sets can take their contents from an iterable and let you iterate over the set's elements::" +#: ../../howto/functional.rst:317 +msgid "" +"Sets can take their contents from an iterable and let you iterate over the " +"set's elements::" msgstr "" +#: ../../howto/functional.rst:320 msgid "" ">>> S = {2, 3, 5, 7, 11, 13}\n" ">>> for i in S:\n" @@ -237,15 +474,28 @@ msgid "" "13" msgstr "" +#: ../../howto/functional.rst:333 msgid "Generator expressions and list comprehensions" msgstr "" -msgid "Two common operations on an iterator's output are 1) performing some operation for every element, 2) selecting a subset of elements that meet some condition. For example, given a list of strings, you might want to strip off trailing whitespace from each line or extract all the strings containing a given substring." +#: ../../howto/functional.rst:335 +msgid "" +"Two common operations on an iterator's output are 1) performing some " +"operation for every element, 2) selecting a subset of elements that meet " +"some condition. For example, given a list of strings, you might want to " +"strip off trailing whitespace from each line or extract all the strings " +"containing a given substring." msgstr "" -msgid "List comprehensions and generator expressions (short form: \"listcomps\" and \"genexps\") are a concise notation for such operations, borrowed from the functional programming language Haskell (https://www.haskell.org/). You can strip all the whitespace from a stream of strings with the following code::" +#: ../../howto/functional.rst:341 +msgid "" +"List comprehensions and generator expressions (short form: \"listcomps\" and " +"\"genexps\") are a concise notation for such operations, borrowed from the " +"functional programming language Haskell (https://www.haskell.org/). You can " +"strip all the whitespace from a stream of strings with the following code::" msgstr "" +#: ../../howto/functional.rst:346 msgid "" ">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" "\n" @@ -256,20 +506,36 @@ msgid "" ">>> stripped_list = [line.strip() for line in line_list]" msgstr "" -msgid "You can select only certain elements by adding an ``\"if\"`` condition::" +#: ../../howto/functional.rst:354 +msgid "" +"You can select only certain elements by adding an ``\"if\"`` condition::" msgstr "" +#: ../../howto/functional.rst:356 msgid "" ">>> stripped_list = [line.strip() for line in line_list\n" "... if line != \"\"]" msgstr "" -msgid "With a list comprehension, you get back a Python list; ``stripped_list`` is a list containing the resulting lines, not an iterator. Generator expressions return an iterator that computes the values as necessary, not needing to materialize all the values at once. This means that list comprehensions aren't useful if you're working with iterators that return an infinite stream or a very large amount of data. Generator expressions are preferable in these situations." +#: ../../howto/functional.rst:359 +msgid "" +"With a list comprehension, you get back a Python list; ``stripped_list`` is " +"a list containing the resulting lines, not an iterator. Generator " +"expressions return an iterator that computes the values as necessary, not " +"needing to materialize all the values at once. This means that list " +"comprehensions aren't useful if you're working with iterators that return an " +"infinite stream or a very large amount of data. Generator expressions are " +"preferable in these situations." msgstr "" -msgid "Generator expressions are surrounded by parentheses (\"()\") and list comprehensions are surrounded by square brackets (\"[]\"). Generator expressions have the form::" +#: ../../howto/functional.rst:366 +msgid "" +"Generator expressions are surrounded by parentheses (\"()\") and list " +"comprehensions are surrounded by square brackets (\"[]\"). Generator " +"expressions have the form::" msgstr "" +#: ../../howto/functional.rst:370 msgid "" "( expression for expr in sequence1\n" " if condition1\n" @@ -282,24 +548,48 @@ msgid "" " if conditionN )" msgstr "" -msgid "Again, for a list comprehension only the outside brackets are different (square brackets instead of parentheses)." +#: ../../howto/functional.rst:380 +msgid "" +"Again, for a list comprehension only the outside brackets are different " +"(square brackets instead of parentheses)." msgstr "" -msgid "The elements of the generated output will be the successive values of ``expression``. The ``if`` clauses are all optional; if present, ``expression`` is only evaluated and added to the result when ``condition`` is true." +#: ../../howto/functional.rst:383 +msgid "" +"The elements of the generated output will be the successive values of " +"``expression``. The ``if`` clauses are all optional; if present, " +"``expression`` is only evaluated and added to the result when ``condition`` " +"is true." msgstr "" -msgid "Generator expressions always have to be written inside parentheses, but the parentheses signalling a function call also count. If you want to create an iterator that will be immediately passed to a function you can write::" +#: ../../howto/functional.rst:387 +msgid "" +"Generator expressions always have to be written inside parentheses, but the " +"parentheses signalling a function call also count. If you want to create an " +"iterator that will be immediately passed to a function you can write::" msgstr "" +#: ../../howto/functional.rst:391 msgid "obj_total = sum(obj.count for obj in list_all_objects())" msgstr "" -msgid "The ``for...in`` clauses contain the sequences to be iterated over. The sequences do not have to be the same length, because they are iterated over from left to right, **not** in parallel. For each element in ``sequence1``, ``sequence2`` is looped over from the beginning. ``sequence3`` is then looped over for each resulting pair of elements from ``sequence1`` and ``sequence2``." +#: ../../howto/functional.rst:393 +msgid "" +"The ``for...in`` clauses contain the sequences to be iterated over. The " +"sequences do not have to be the same length, because they are iterated over " +"from left to right, **not** in parallel. For each element in ``sequence1``, " +"``sequence2`` is looped over from the beginning. ``sequence3`` is then " +"looped over for each resulting pair of elements from ``sequence1`` and " +"``sequence2``." msgstr "" -msgid "To put it another way, a list comprehension or generator expression is equivalent to the following Python code::" +#: ../../howto/functional.rst:399 +msgid "" +"To put it another way, a list comprehension or generator expression is " +"equivalent to the following Python code::" msgstr "" +#: ../../howto/functional.rst:402 msgid "" "for expr1 in sequence1:\n" " if not (condition1):\n" @@ -316,12 +606,22 @@ msgid "" " # the expression." msgstr "" -msgid "This means that when there are multiple ``for...in`` clauses but no ``if`` clauses, the length of the resulting output will be equal to the product of the lengths of all the sequences. If you have two lists of length 3, the output list is 9 elements long:" +#: ../../howto/functional.rst:416 +msgid "" +"This means that when there are multiple ``for...in`` clauses but no ``if`` " +"clauses, the length of the resulting output will be equal to the product of " +"the lengths of all the sequences. If you have two lists of length 3, the " +"output list is 9 elements long:" msgstr "" -msgid "To avoid introducing an ambiguity into Python's grammar, if ``expression`` is creating a tuple, it must be surrounded with parentheses. The first list comprehension below is a syntax error, while the second one is correct::" +#: ../../howto/functional.rst:428 +msgid "" +"To avoid introducing an ambiguity into Python's grammar, if ``expression`` " +"is creating a tuple, it must be surrounded with parentheses. The first list " +"comprehension below is a syntax error, while the second one is correct::" msgstr "" +#: ../../howto/functional.rst:432 msgid "" "# Syntax error\n" "[x, y for x in seq1 for y in seq2]\n" @@ -329,39 +629,90 @@ msgid "" "[(x, y) for x in seq1 for y in seq2]" msgstr "" +#: ../../howto/functional.rst:439 msgid "Generators" msgstr "" -msgid "Generators are a special class of functions that simplify the task of writing iterators. Regular functions compute a value and return it, but generators return an iterator that returns a stream of values." -msgstr "" - -msgid "You're doubtless familiar with how regular function calls work in Python or C. When you call a function, it gets a private namespace where its local variables are created. When the function reaches a ``return`` statement, the local variables are destroyed and the value is returned to the caller. A later call to the same function creates a new private namespace and a fresh set of local variables. But, what if the local variables weren't thrown away on exiting a function? What if you could later resume the function where it left off? This is what generators provide; they can be thought of as resumable functions." +#: ../../howto/functional.rst:441 +msgid "" +"Generators are a special class of functions that simplify the task of " +"writing iterators. Regular functions compute a value and return it, but " +"generators return an iterator that returns a stream of values." msgstr "" +#: ../../howto/functional.rst:445 +msgid "" +"You're doubtless familiar with how regular function calls work in Python or " +"C. When you call a function, it gets a private namespace where its local " +"variables are created. When the function reaches a ``return`` statement, " +"the local variables are destroyed and the value is returned to the caller. " +"A later call to the same function creates a new private namespace and a " +"fresh set of local variables. But, what if the local variables weren't " +"thrown away on exiting a function? What if you could later resume the " +"function where it left off? This is what generators provide; they can be " +"thought of as resumable functions." +msgstr "" + +#: ../../howto/functional.rst:454 msgid "Here's the simplest example of a generator function:" msgstr "" -msgid "Any function containing a :keyword:`yield` keyword is a generator function; this is detected by Python's :term:`bytecode` compiler which compiles the function specially as a result." +#: ../../howto/functional.rst:460 +msgid "" +"Any function containing a :keyword:`yield` keyword is a generator function; " +"this is detected by Python's :term:`bytecode` compiler which compiles the " +"function specially as a result." msgstr "" -msgid "When you call a generator function, it doesn't return a single value; instead it returns a generator object that supports the iterator protocol. On executing the ``yield`` expression, the generator outputs the value of ``i``, similar to a ``return`` statement. The big difference between ``yield`` and a ``return`` statement is that on reaching a ``yield`` the generator's state of execution is suspended and local variables are preserved. On the next call to the generator's :meth:`~generator.__next__` method, the function will resume executing." +#: ../../howto/functional.rst:464 +msgid "" +"When you call a generator function, it doesn't return a single value; " +"instead it returns a generator object that supports the iterator protocol. " +"On executing the ``yield`` expression, the generator outputs the value of " +"``i``, similar to a ``return`` statement. The big difference between " +"``yield`` and a ``return`` statement is that on reaching a ``yield`` the " +"generator's state of execution is suspended and local variables are " +"preserved. On the next call to the generator's :meth:`~generator.__next__` " +"method, the function will resume executing." msgstr "" +#: ../../howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" msgstr "" -msgid "You could equally write ``for i in generate_ints(5)``, or ``a, b, c = generate_ints(3)``." +#: ../../howto/functional.rst:490 +msgid "" +"You could equally write ``for i in generate_ints(5)``, or ``a, b, c = " +"generate_ints(3)``." msgstr "" -msgid "Inside a generator function, ``return value`` causes ``StopIteration(value)`` to be raised from the :meth:`~generator.__next__` method. Once this happens, or the bottom of the function is reached, the procession of values ends and the generator cannot yield any further values." +#: ../../howto/functional.rst:493 +msgid "" +"Inside a generator function, ``return value`` causes " +"``StopIteration(value)`` to be raised from the :meth:`~generator.__next__` " +"method. Once this happens, or the bottom of the function is reached, the " +"procession of values ends and the generator cannot yield any further values." msgstr "" -msgid "You could achieve the effect of generators manually by writing your own class and storing all the local variables of the generator as instance variables. For example, returning a list of integers could be done by setting ``self.count`` to 0, and having the :meth:`~iterator.__next__` method increment ``self.count`` and return it. However, for a moderately complicated generator, writing a corresponding class can be much messier." +#: ../../howto/functional.rst:498 +msgid "" +"You could achieve the effect of generators manually by writing your own " +"class and storing all the local variables of the generator as instance " +"variables. For example, returning a list of integers could be done by " +"setting ``self.count`` to 0, and having the :meth:`~iterator.__next__` " +"method increment ``self.count`` and return it. However, for a moderately " +"complicated generator, writing a corresponding class can be much messier." msgstr "" -msgid "The test suite included with Python's library, :source:`Lib/test/test_generators.py`, contains a number of more interesting examples. Here's one generator that implements an in-order traversal of a tree using generators recursively. ::" +#: ../../howto/functional.rst:506 +msgid "" +"The test suite included with Python's library, :source:`Lib/test/" +"test_generators.py`, contains a number of more interesting examples. Here's " +"one generator that implements an in-order traversal of a tree using " +"generators recursively. ::" msgstr "" +#: ../../howto/functional.rst:511 msgid "" "# A recursive generator that generates Tree leaves in in-order.\n" "def inorder(t):\n" @@ -375,33 +726,73 @@ msgid "" " yield x" msgstr "" -msgid "Two other examples in ``test_generators.py`` produce solutions for the N-Queens problem (placing N queens on an NxN chess board so that no queen threatens another) and the Knight's Tour (finding a route that takes a knight to every square of an NxN chessboard without visiting any square twice)." +#: ../../howto/functional.rst:522 +msgid "" +"Two other examples in ``test_generators.py`` produce solutions for the N-" +"Queens problem (placing N queens on an NxN chess board so that no queen " +"threatens another) and the Knight's Tour (finding a route that takes a " +"knight to every square of an NxN chessboard without visiting any square " +"twice)." msgstr "" +#: ../../howto/functional.rst:530 msgid "Passing values into a generator" msgstr "" -msgid "In Python 2.4 and earlier, generators only produced output. Once a generator's code was invoked to create an iterator, there was no way to pass any new information into the function when its execution is resumed. You could hack together this ability by making the generator look at a global variable or by passing in some mutable object that callers then modify, but these approaches are messy." +#: ../../howto/functional.rst:532 +msgid "" +"In Python 2.4 and earlier, generators only produced output. Once a " +"generator's code was invoked to create an iterator, there was no way to pass " +"any new information into the function when its execution is resumed. You " +"could hack together this ability by making the generator look at a global " +"variable or by passing in some mutable object that callers then modify, but " +"these approaches are messy." msgstr "" -msgid "In Python 2.5 there's a simple way to pass values into a generator. :keyword:`yield` became an expression, returning a value that can be assigned to a variable or otherwise operated on::" +#: ../../howto/functional.rst:539 +msgid "" +"In Python 2.5 there's a simple way to pass values into a " +"generator. :keyword:`yield` became an expression, returning a value that can " +"be assigned to a variable or otherwise operated on::" msgstr "" +#: ../../howto/functional.rst:543 msgid "val = (yield i)" msgstr "" -msgid "I recommend that you **always** put parentheses around a ``yield`` expression when you're doing something with the returned value, as in the above example. The parentheses aren't always necessary, but it's easier to always add them instead of having to remember when they're needed." +#: ../../howto/functional.rst:545 +msgid "" +"I recommend that you **always** put parentheses around a ``yield`` " +"expression when you're doing something with the returned value, as in the " +"above example. The parentheses aren't always necessary, but it's easier to " +"always add them instead of having to remember when they're needed." msgstr "" -msgid "(:pep:`342` explains the exact rules, which are that a ``yield``-expression must always be parenthesized except when it occurs at the top-level expression on the right-hand side of an assignment. This means you can write ``val = yield i`` but have to use parentheses when there's an operation, as in ``val = (yield i) + 12``.)" +#: ../../howto/functional.rst:550 +msgid "" +"(:pep:`342` explains the exact rules, which are that a ``yield``-expression " +"must always be parenthesized except when it occurs at the top-level " +"expression on the right-hand side of an assignment. This means you can " +"write ``val = yield i`` but have to use parentheses when there's an " +"operation, as in ``val = (yield i) + 12``.)" msgstr "" -msgid "Values are sent into a generator by calling its :meth:`send(value) ` method. This method resumes the generator's code and the ``yield`` expression returns the specified value. If the regular :meth:`~generator.__next__` method is called, the ``yield`` returns ``None``." +#: ../../howto/functional.rst:556 +msgid "" +"Values are sent into a generator by calling its :meth:`send(value) " +"` method. This method resumes the generator's code and the " +"``yield`` expression returns the specified value. If the " +"regular :meth:`~generator.__next__` method is called, the ``yield`` returns " +"``None``." msgstr "" -msgid "Here's a simple counter that increments by 1 and allows changing the value of the internal counter." +#: ../../howto/functional.rst:561 +msgid "" +"Here's a simple counter that increments by 1 and allows changing the value " +"of the internal counter." msgstr "" +#: ../../howto/functional.rst:564 msgid "" "def counter(maximum):\n" " i = 0\n" @@ -414,57 +805,114 @@ msgid "" " i += 1" msgstr "" +#: ../../howto/functional.rst:576 msgid "And here's an example of changing the counter:" msgstr "" -msgid "Because ``yield`` will often be returning ``None``, you should always check for this case. Don't just use its value in expressions unless you're sure that the :meth:`~generator.send` method will be the only method used to resume your generator function." +#: ../../howto/functional.rst:593 +msgid "" +"Because ``yield`` will often be returning ``None``, you should always check " +"for this case. Don't just use its value in expressions unless you're sure " +"that the :meth:`~generator.send` method will be the only method used to " +"resume your generator function." msgstr "" -msgid "In addition to :meth:`~generator.send`, there are two other methods on generators:" +#: ../../howto/functional.rst:598 +msgid "" +"In addition to :meth:`~generator.send`, there are two other methods on " +"generators:" msgstr "" -msgid ":meth:`throw(value) ` is used to raise an exception inside the generator; the exception is raised by the ``yield`` expression where the generator's execution is paused." +#: ../../howto/functional.rst:601 +msgid "" +":meth:`throw(value) ` is used to raise an exception inside " +"the generator; the exception is raised by the ``yield`` expression where the " +"generator's execution is paused." msgstr "" -msgid ":meth:`~generator.close` sends a :exc:`GeneratorExit` exception to the generator to terminate the iteration. On receiving this exception, the generator's code must either raise :exc:`GeneratorExit` or :exc:`StopIteration`; catching the exception and doing anything else is illegal and will trigger a :exc:`RuntimeError`. :meth:`~generator.close` will also be called by Python's garbage collector when the generator is garbage-collected." +#: ../../howto/functional.rst:605 +msgid "" +":meth:`~generator.close` sends a :exc:`GeneratorExit` exception to the " +"generator to terminate the iteration. On receiving this exception, the " +"generator's code must either raise :exc:`GeneratorExit` " +"or :exc:`StopIteration`; catching the exception and doing anything else is " +"illegal and will trigger a :exc:`RuntimeError`. :meth:`~generator.close` " +"will also be called by Python's garbage collector when the generator is " +"garbage-collected." msgstr "" -msgid "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I suggest using a ``try: ... finally:`` suite instead of catching :exc:`GeneratorExit`." +#: ../../howto/functional.rst:613 +msgid "" +"If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " +"suggest using a ``try: ... finally:`` suite instead of " +"catching :exc:`GeneratorExit`." msgstr "" -msgid "The cumulative effect of these changes is to turn generators from one-way producers of information into both producers and consumers." +#: ../../howto/functional.rst:616 +msgid "" +"The cumulative effect of these changes is to turn generators from one-way " +"producers of information into both producers and consumers." msgstr "" -msgid "Generators also become **coroutines**, a more generalized form of subroutines. Subroutines are entered at one point and exited at another point (the top of the function, and a ``return`` statement), but coroutines can be entered, exited, and resumed at many different points (the ``yield`` statements)." +#: ../../howto/functional.rst:619 +msgid "" +"Generators also become **coroutines**, a more generalized form of " +"subroutines. Subroutines are entered at one point and exited at another " +"point (the top of the function, and a ``return`` statement), but coroutines " +"can be entered, exited, and resumed at many different points (the ``yield`` " +"statements)." msgstr "" +#: ../../howto/functional.rst:626 msgid "Built-in functions" msgstr "" -msgid "Let's look in more detail at built-in functions often used with iterators." +#: ../../howto/functional.rst:628 +msgid "" +"Let's look in more detail at built-in functions often used with iterators." msgstr "" -msgid "Two of Python's built-in functions, :func:`map` and :func:`filter` duplicate the features of generator expressions:" +#: ../../howto/functional.rst:630 +msgid "" +"Two of Python's built-in functions, :func:`map` and :func:`filter` duplicate " +"the features of generator expressions:" msgstr "" -msgid ":func:`map(f, iterA, iterB, ...) ` returns an iterator over the sequence" +#: ../../howto/functional.rst:633 +msgid "" +":func:`map(f, iterA, iterB, ...) ` returns an iterator over the sequence" msgstr "" -msgid "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." +#: ../../howto/functional.rst:634 +msgid "" +"``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." msgstr "" +#: ../../howto/functional.rst:644 msgid "You can of course achieve the same effect with a list comprehension." msgstr "" -msgid ":func:`filter(predicate, iter) ` returns an iterator over all the sequence elements that meet a certain condition, and is similarly duplicated by list comprehensions. A **predicate** is a function that returns the truth value of some condition; for use with :func:`filter`, the predicate must take a single value." +#: ../../howto/functional.rst:646 +msgid "" +":func:`filter(predicate, iter) ` returns an iterator over all the " +"sequence elements that meet a certain condition, and is similarly duplicated " +"by list comprehensions. A **predicate** is a function that returns the " +"truth value of some condition; for use with :func:`filter`, the predicate " +"must take a single value." msgstr "" +#: ../../howto/functional.rst:659 msgid "This can also be written as a list comprehension:" msgstr "" -msgid ":func:`enumerate(iter, start=0) ` counts off the elements in the iterable returning 2-tuples containing the count (from *start*) and each element. ::" +#: ../../howto/functional.rst:665 +msgid "" +":func:`enumerate(iter, start=0) ` counts off the elements in the " +"iterable returning 2-tuples containing the count (from *start*) and each " +"element. ::" msgstr "" +#: ../../howto/functional.rst:669 msgid "" ">>> for item in enumerate(['subject', 'verb', 'object']):\n" "... print(item)\n" @@ -473,9 +921,13 @@ msgid "" "(2, 'object')" msgstr "" -msgid ":func:`enumerate` is often used when looping through a list and recording the indexes at which certain conditions are met::" +#: ../../howto/functional.rst:675 +msgid "" +":func:`enumerate` is often used when looping through a list and recording " +"the indexes at which certain conditions are met::" msgstr "" +#: ../../howto/functional.rst:678 msgid "" "f = open('data.txt', 'r')\n" "for i, line in enumerate(f):\n" @@ -483,9 +935,15 @@ msgid "" " print('Blank line at line #%i' % i)" msgstr "" -msgid ":func:`sorted(iterable, key=None, reverse=False) ` collects all the elements of the iterable into a list, sorts the list, and returns the sorted result. The *key* and *reverse* arguments are passed through to the constructed list's :meth:`~list.sort` method. ::" +#: ../../howto/functional.rst:683 +msgid "" +":func:`sorted(iterable, key=None, reverse=False) ` collects all the " +"elements of the iterable into a list, sorts the list, and returns the sorted " +"result. The *key* and *reverse* arguments are passed through to the " +"constructed list's :meth:`~list.sort` method. ::" msgstr "" +#: ../../howto/functional.rst:688 msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" @@ -498,61 +956,103 @@ msgid "" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" -msgid "(For a more detailed discussion of sorting, see the :ref:`sortinghowto`.)" +#: ../../howto/functional.rst:698 +msgid "" +"(For a more detailed discussion of sorting, see the :ref:`sortinghowto`.)" msgstr "" -msgid "The :func:`any(iter) ` and :func:`all(iter) ` built-ins look at the truth values of an iterable's contents. :func:`any` returns ``True`` if any element in the iterable is a true value, and :func:`all` returns ``True`` if all of the elements are true values:" +#: ../../howto/functional.rst:701 +msgid "" +"The :func:`any(iter) ` and :func:`all(iter) ` built-ins look at " +"the truth values of an iterable's contents. :func:`any` returns ``True`` if " +"any element in the iterable is a true value, and :func:`all` returns " +"``True`` if all of the elements are true values:" msgstr "" -msgid ":func:`zip(iterA, iterB, ...) ` takes one element from each iterable and returns them in a tuple::" +#: ../../howto/functional.rst:720 +msgid "" +":func:`zip(iterA, iterB, ...) ` takes one element from each iterable " +"and returns them in a tuple::" msgstr "" +#: ../../howto/functional.rst:723 msgid "" "zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2), ('c', 3)" msgstr "" -msgid "It doesn't construct an in-memory list and exhaust all the input iterators before returning; instead tuples are constructed and returned only if they're requested. (The technical term for this behaviour is `lazy evaluation `__.)" +#: ../../howto/functional.rst:726 +msgid "" +"It doesn't construct an in-memory list and exhaust all the input iterators " +"before returning; instead tuples are constructed and returned only if " +"they're requested. (The technical term for this behaviour is `lazy " +"evaluation `__.)" msgstr "" -msgid "This iterator is intended to be used with iterables that are all of the same length. If the iterables are of different lengths, the resulting stream will be the same length as the shortest iterable. ::" +#: ../../howto/functional.rst:731 +msgid "" +"This iterator is intended to be used with iterables that are all of the same " +"length. If the iterables are of different lengths, the resulting stream " +"will be the same length as the shortest iterable. ::" msgstr "" +#: ../../howto/functional.rst:735 msgid "" "zip(['a', 'b'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2)" msgstr "" -msgid "You should avoid doing this, though, because an element may be taken from the longer iterators and discarded. This means you can't go on to use the iterators further because you risk skipping a discarded element." +#: ../../howto/functional.rst:738 +msgid "" +"You should avoid doing this, though, because an element may be taken from " +"the longer iterators and discarded. This means you can't go on to use the " +"iterators further because you risk skipping a discarded element." msgstr "" +#: ../../howto/functional.rst:744 msgid "The itertools module" msgstr "" -msgid "The :mod:`itertools` module contains a number of commonly used iterators as well as functions for combining several iterators. This section will introduce the module's contents by showing small examples." +#: ../../howto/functional.rst:746 +msgid "" +"The :mod:`itertools` module contains a number of commonly used iterators as " +"well as functions for combining several iterators. This section will " +"introduce the module's contents by showing small examples." msgstr "" +#: ../../howto/functional.rst:750 msgid "The module's functions fall into a few broad classes:" msgstr "" +#: ../../howto/functional.rst:752 msgid "Functions that create a new iterator based on an existing iterator." msgstr "" +#: ../../howto/functional.rst:753 msgid "Functions for treating an iterator's elements as function arguments." msgstr "" +#: ../../howto/functional.rst:754 msgid "Functions for selecting portions of an iterator's output." msgstr "" +#: ../../howto/functional.rst:755 msgid "A function for grouping an iterator's output." msgstr "" +#: ../../howto/functional.rst:758 msgid "Creating new iterators" msgstr "" -msgid ":func:`itertools.count(start, step) ` returns an infinite stream of evenly spaced values. You can optionally supply the starting number, which defaults to 0, and the interval between numbers, which defaults to 1::" +#: ../../howto/functional.rst:760 +msgid "" +":func:`itertools.count(start, step) ` returns an infinite " +"stream of evenly spaced values. You can optionally supply the starting " +"number, which defaults to 0, and the interval between numbers, which " +"defaults to 1::" msgstr "" +#: ../../howto/functional.rst:764 msgid "" "itertools.count() =>\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" @@ -562,17 +1062,28 @@ msgid "" " 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ..." msgstr "" -msgid ":func:`itertools.cycle(iter) ` saves a copy of the contents of a provided iterable and returns a new iterator that returns its elements from first to last. The new iterator will repeat these elements infinitely. ::" +#: ../../howto/functional.rst:771 +msgid "" +":func:`itertools.cycle(iter) ` saves a copy of the contents " +"of a provided iterable and returns a new iterator that returns its elements " +"from first to last. The new iterator will repeat these elements " +"infinitely. ::" msgstr "" +#: ../../howto/functional.rst:775 msgid "" "itertools.cycle([1, 2, 3, 4, 5]) =>\n" " 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." msgstr "" -msgid ":func:`itertools.repeat(elem, [n]) ` returns the provided element *n* times, or returns the element endlessly if *n* is not provided. ::" +#: ../../howto/functional.rst:778 +msgid "" +":func:`itertools.repeat(elem, [n]) ` returns the provided " +"element *n* times, or returns the element endlessly if *n* is not " +"provided. ::" msgstr "" +#: ../../howto/functional.rst:781 msgid "" "itertools.repeat('abc') =>\n" " abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\n" @@ -580,17 +1091,32 @@ msgid "" " abc, abc, abc, abc, abc" msgstr "" -msgid ":func:`itertools.chain(iterA, iterB, ...) ` takes an arbitrary number of iterables as input, and returns all the elements of the first iterator, then all the elements of the second, and so on, until all of the iterables have been exhausted. ::" +#: ../../howto/functional.rst:786 +msgid "" +":func:`itertools.chain(iterA, iterB, ...) ` takes an " +"arbitrary number of iterables as input, and returns all the elements of the " +"first iterator, then all the elements of the second, and so on, until all of " +"the iterables have been exhausted. ::" msgstr "" +#: ../../howto/functional.rst:791 msgid "" "itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" " a, b, c, 1, 2, 3" msgstr "" -msgid ":func:`itertools.islice(iter, [start], stop, [step]) ` returns a stream that's a slice of the iterator. With a single *stop* argument, it will return the first *stop* elements. If you supply a starting index, you'll get *stop-start* elements, and if you supply a value for *step*, elements will be skipped accordingly. Unlike Python's string and list slicing, you can't use negative values for *start*, *stop*, or *step*. ::" +#: ../../howto/functional.rst:794 +msgid "" +":func:`itertools.islice(iter, [start], stop, [step]) ` " +"returns a stream that's a slice of the iterator. With a single *stop* " +"argument, it will return the first *stop* elements. If you supply a " +"starting index, you'll get *stop-start* elements, and if you supply a value " +"for *step*, elements will be skipped accordingly. Unlike Python's string " +"and list slicing, you can't use negative values for *start*, *stop*, or " +"*step*. ::" msgstr "" +#: ../../howto/functional.rst:801 msgid "" "itertools.islice(range(10), 8) =>\n" " 0, 1, 2, 3, 4, 5, 6, 7\n" @@ -600,9 +1126,17 @@ msgid "" " 2, 4, 6" msgstr "" -msgid ":func:`itertools.tee(iter, [n]) ` replicates an iterator; it returns *n* independent iterators that will all return the contents of the source iterator. If you don't supply a value for *n*, the default is 2. Replicating iterators requires saving some of the contents of the source iterator, so this can consume significant memory if the iterator is large and one of the new iterators is consumed more than the others. ::" +#: ../../howto/functional.rst:808 +msgid "" +":func:`itertools.tee(iter, [n]) ` replicates an iterator; it " +"returns *n* independent iterators that will all return the contents of the " +"source iterator. If you don't supply a value for *n*, the default is 2. " +"Replicating iterators requires saving some of the contents of the source " +"iterator, so this can consume significant memory if the iterator is large " +"and one of the new iterators is consumed more than the others. ::" msgstr "" +#: ../../howto/functional.rst:816 msgid "" "itertools.tee( itertools.count() ) =>\n" " iterA, iterB\n" @@ -614,15 +1148,28 @@ msgid "" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..." msgstr "" +#: ../../howto/functional.rst:827 msgid "Calling functions on elements" msgstr "" -msgid "The :mod:`operator` module contains a set of functions corresponding to Python's operators. Some examples are :func:`operator.add(a, b) ` (adds two values), :func:`operator.ne(a, b) ` (same as ``a != b``), and :func:`operator.attrgetter('id') ` (returns a callable that fetches the ``.id`` attribute)." +#: ../../howto/functional.rst:829 +msgid "" +"The :mod:`operator` module contains a set of functions corresponding to " +"Python's operators. Some examples are :func:`operator.add(a, b) " +"` (adds two values), :func:`operator.ne(a, b) ` " +"(same as ``a != b``), and :func:`operator.attrgetter('id') " +"` (returns a callable that fetches the ``.id`` " +"attribute)." msgstr "" -msgid ":func:`itertools.starmap(func, iter) ` assumes that the iterable will return a stream of tuples, and calls *func* using these tuples as the arguments::" +#: ../../howto/functional.rst:835 +msgid "" +":func:`itertools.starmap(func, iter) ` assumes that the " +"iterable will return a stream of tuples, and calls *func* using these tuples " +"as the arguments::" msgstr "" +#: ../../howto/functional.rst:839 msgid "" "itertools.starmap(os.path.join,\n" " [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" @@ -631,23 +1178,37 @@ msgid "" " /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby" msgstr "" +#: ../../howto/functional.rst:847 msgid "Selecting elements" msgstr "" -msgid "Another group of functions chooses a subset of an iterator's elements based on a predicate." +#: ../../howto/functional.rst:849 +msgid "" +"Another group of functions chooses a subset of an iterator's elements based " +"on a predicate." msgstr "" -msgid ":func:`itertools.filterfalse(predicate, iter) ` is the opposite of :func:`filter`, returning all elements for which the predicate returns false::" +#: ../../howto/functional.rst:852 +msgid "" +":func:`itertools.filterfalse(predicate, iter) ` is " +"the opposite of :func:`filter`, returning all elements for which the " +"predicate returns false::" msgstr "" +#: ../../howto/functional.rst:856 msgid "" "itertools.filterfalse(is_even, itertools.count()) =>\n" " 1, 3, 5, 7, 9, 11, 13, 15, ..." msgstr "" -msgid ":func:`itertools.takewhile(predicate, iter) ` returns elements for as long as the predicate returns true. Once the predicate returns false, the iterator will signal the end of its results. ::" +#: ../../howto/functional.rst:859 +msgid "" +":func:`itertools.takewhile(predicate, iter) ` returns " +"elements for as long as the predicate returns true. Once the predicate " +"returns false, the iterator will signal the end of its results. ::" msgstr "" +#: ../../howto/functional.rst:863 msgid "" "def less_than_10(x):\n" " return x < 10\n" @@ -659,9 +1220,14 @@ msgid "" " 0" msgstr "" -msgid ":func:`itertools.dropwhile(predicate, iter) ` discards elements while the predicate returns true, and then returns the rest of the iterable's results. ::" +#: ../../howto/functional.rst:872 +msgid "" +":func:`itertools.dropwhile(predicate, iter) ` discards " +"elements while the predicate returns true, and then returns the rest of the " +"iterable's results. ::" msgstr "" +#: ../../howto/functional.rst:876 msgid "" "itertools.dropwhile(less_than_10, itertools.count()) =>\n" " 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" @@ -670,20 +1236,32 @@ msgid "" " 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..." msgstr "" -msgid ":func:`itertools.compress(data, selectors) ` takes two iterators and returns only those elements of *data* for which the corresponding element of *selectors* is true, stopping whenever either one is exhausted::" +#: ../../howto/functional.rst:882 +msgid "" +":func:`itertools.compress(data, selectors) ` takes two " +"iterators and returns only those elements of *data* for which the " +"corresponding element of *selectors* is true, stopping whenever either one " +"is exhausted::" msgstr "" +#: ../../howto/functional.rst:886 msgid "" "itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" " 1, 2, 5" msgstr "" +#: ../../howto/functional.rst:891 msgid "Combinatoric functions" msgstr "" -msgid "The :func:`itertools.combinations(iterable, r) ` returns an iterator giving all possible *r*-tuple combinations of the elements contained in *iterable*. ::" +#: ../../howto/functional.rst:893 +msgid "" +"The :func:`itertools.combinations(iterable, r) ` " +"returns an iterator giving all possible *r*-tuple combinations of the " +"elements contained in *iterable*. ::" msgstr "" +#: ../../howto/functional.rst:897 msgid "" "itertools.combinations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -697,9 +1275,17 @@ msgid "" " (3, 4, 5)" msgstr "" -msgid "The elements within each tuple remain in the same order as *iterable* returned them. For example, the number 1 is always before 2, 3, 4, or 5 in the examples above. A similar function, :func:`itertools.permutations(iterable, r=None) `, removes this constraint on the order, returning all possible arrangements of length *r*::" +#: ../../howto/functional.rst:908 +msgid "" +"The elements within each tuple remain in the same order as *iterable* " +"returned them. For example, the number 1 is always before 2, 3, 4, or 5 in " +"the examples above. A similar " +"function, :func:`itertools.permutations(iterable, r=None) " +"`, removes this constraint on the order, returning " +"all possible arrangements of length *r*::" msgstr "" +#: ../../howto/functional.rst:915 msgid "" "itertools.permutations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -714,24 +1300,41 @@ msgid "" " (5, 4, 3, 2, 1)" msgstr "" -msgid "If you don't supply a value for *r* the length of the iterable is used, meaning that all the elements are permuted." +#: ../../howto/functional.rst:927 +msgid "" +"If you don't supply a value for *r* the length of the iterable is used, " +"meaning that all the elements are permuted." msgstr "" -msgid "Note that these functions produce all of the possible combinations by position and don't require that the contents of *iterable* are unique::" +#: ../../howto/functional.rst:930 +msgid "" +"Note that these functions produce all of the possible combinations by " +"position and don't require that the contents of *iterable* are unique::" msgstr "" +#: ../../howto/functional.rst:933 msgid "" "itertools.permutations('aba', 3) =>\n" " ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" " ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')" msgstr "" -msgid "The identical tuple ``('a', 'a', 'b')`` occurs twice, but the two 'a' strings came from different positions." +#: ../../howto/functional.rst:937 +msgid "" +"The identical tuple ``('a', 'a', 'b')`` occurs twice, but the two 'a' " +"strings came from different positions." msgstr "" -msgid "The :func:`itertools.combinations_with_replacement(iterable, r) ` function relaxes a different constraint: elements can be repeated within a single tuple. Conceptually an element is selected for the first position of each tuple and then is replaced before the second element is selected. ::" +#: ../../howto/functional.rst:940 +msgid "" +"The :func:`itertools.combinations_with_replacement(iterable, r) " +"` function relaxes a different " +"constraint: elements can be repeated within a single tuple. Conceptually an " +"element is selected for the first position of each tuple and then is " +"replaced before the second element is selected. ::" msgstr "" +#: ../../howto/functional.rst:946 msgid "" "itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>\n" " (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -741,15 +1344,27 @@ msgid "" " (5, 5)" msgstr "" +#: ../../howto/functional.rst:955 msgid "Grouping elements" msgstr "" -msgid "The last function I'll discuss, :func:`itertools.groupby(iter, key_func=None) `, is the most complicated. ``key_func(elem)`` is a function that can compute a key value for each element returned by the iterable. If you don't supply a key function, the key is simply each element itself." +#: ../../howto/functional.rst:957 +msgid "" +"The last function I'll discuss, :func:`itertools.groupby(iter, " +"key_func=None) `, is the most complicated. " +"``key_func(elem)`` is a function that can compute a key value for each " +"element returned by the iterable. If you don't supply a key function, the " +"key is simply each element itself." msgstr "" -msgid ":func:`~itertools.groupby` collects all the consecutive elements from the underlying iterable that have the same key value, and returns a stream of 2-tuples containing a key value and an iterator for the elements with that key." +#: ../../howto/functional.rst:962 +msgid "" +":func:`~itertools.groupby` collects all the consecutive elements from the " +"underlying iterable that have the same key value, and returns a stream of 2-" +"tuples containing a key value and an iterator for the elements with that key." msgstr "" +#: ../../howto/functional.rst:968 msgid "" "city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" " ('Anchorage', 'AK'), ('Nome', 'AK'),\n" @@ -774,24 +1389,49 @@ msgid "" " ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')" msgstr "" -msgid ":func:`~itertools.groupby` assumes that the underlying iterable's contents will already be sorted based on the key. Note that the returned iterators also use the underlying iterable, so you have to consume the results of iterator-1 before requesting iterator-2 and its corresponding key." +#: ../../howto/functional.rst:990 +msgid "" +":func:`~itertools.groupby` assumes that the underlying iterable's contents " +"will already be sorted based on the key. Note that the returned iterators " +"also use the underlying iterable, so you have to consume the results of " +"iterator-1 before requesting iterator-2 and its corresponding key." msgstr "" +#: ../../howto/functional.rst:997 msgid "The functools module" msgstr "" -msgid "The :mod:`functools` module contains some higher-order functions. A **higher-order function** takes one or more functions as input and returns a new function. The most useful tool in this module is the :func:`functools.partial` function." +#: ../../howto/functional.rst:999 +msgid "" +"The :mod:`functools` module contains some higher-order functions. A **higher-" +"order function** takes one or more functions as input and returns a new " +"function. The most useful tool in this module is " +"the :func:`functools.partial` function." msgstr "" -msgid "For programs written in a functional style, you'll sometimes want to construct variants of existing functions that have some of the parameters filled in. Consider a Python function ``f(a, b, c)``; you may wish to create a new function ``g(b, c)`` that's equivalent to ``f(1, b, c)``; you're filling in a value for one of ``f()``'s parameters. This is called \"partial function application\"." +#: ../../howto/functional.rst:1004 +msgid "" +"For programs written in a functional style, you'll sometimes want to " +"construct variants of existing functions that have some of the parameters " +"filled in. Consider a Python function ``f(a, b, c)``; you may wish to create " +"a new function ``g(b, c)`` that's equivalent to ``f(1, b, c)``; you're " +"filling in a value for one of ``f()``'s parameters. This is called " +"\"partial function application\"." msgstr "" -msgid "The constructor for :func:`~functools.partial` takes the arguments ``(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)``. The resulting object is callable, so you can just call it to invoke ``function`` with the filled-in arguments." +#: ../../howto/functional.rst:1010 +msgid "" +"The constructor for :func:`~functools.partial` takes the arguments " +"``(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)``. The " +"resulting object is callable, so you can just call it to invoke ``function`` " +"with the filled-in arguments." msgstr "" +#: ../../howto/functional.rst:1015 msgid "Here's a small but realistic example::" msgstr "" +#: ../../howto/functional.rst:1017 msgid "" "import functools\n" "\n" @@ -804,9 +1444,22 @@ msgid "" "server_log('Unable to open socket')" msgstr "" -msgid ":func:`functools.reduce(func, iter, [initial_value]) ` cumulatively performs an operation on all the iterable's elements and, therefore, can't be applied to infinite iterables. *func* must be a function that takes two elements and returns a single value. :func:`functools.reduce` takes the first two elements A and B returned by the iterator and calculates ``func(A, B)``. It then requests the third element, C, calculates ``func(func(A, B), C)``, combines this result with the fourth element returned, and continues until the iterable is exhausted. If the iterable returns no values at all, a :exc:`TypeError` exception is raised. If the initial value is supplied, it's used as a starting point and ``func(initial_value, A)`` is the first calculation. ::" -msgstr "" - +#: ../../howto/functional.rst:1027 +msgid "" +":func:`functools.reduce(func, iter, [initial_value]) ` " +"cumulatively performs an operation on all the iterable's elements and, " +"therefore, can't be applied to infinite iterables. *func* must be a function " +"that takes two elements and returns a single " +"value. :func:`functools.reduce` takes the first two elements A and B " +"returned by the iterator and calculates ``func(A, B)``. It then requests " +"the third element, C, calculates ``func(func(A, B), C)``, combines this " +"result with the fourth element returned, and continues until the iterable is " +"exhausted. If the iterable returns no values at all, a :exc:`TypeError` " +"exception is raised. If the initial value is supplied, it's used as a " +"starting point and ``func(initial_value, A)`` is the first calculation. ::" +msgstr "" + +#: ../../howto/functional.rst:1039 msgid "" ">>> import operator, functools\n" ">>> functools.reduce(operator.concat, ['A', 'BB', 'C'])\n" @@ -821,12 +1474,20 @@ msgid "" "1" msgstr "" -msgid "If you use :func:`operator.add` with :func:`functools.reduce`, you'll add up all the elements of the iterable. This case is so common that there's a special built-in called :func:`sum` to compute it:" +#: ../../howto/functional.rst:1051 +msgid "" +"If you use :func:`operator.add` with :func:`functools.reduce`, you'll add up " +"all the elements of the iterable. This case is so common that there's a " +"special built-in called :func:`sum` to compute it:" msgstr "" -msgid "For many uses of :func:`functools.reduce`, though, it can be clearer to just write the obvious :keyword:`for` loop::" +#: ../../howto/functional.rst:1063 +msgid "" +"For many uses of :func:`functools.reduce`, though, it can be clearer to just " +"write the obvious :keyword:`for` loop::" msgstr "" +#: ../../howto/functional.rst:1066 msgid "" "import functools\n" "# Instead of:\n" @@ -838,9 +1499,16 @@ msgid "" " product *= i" msgstr "" -msgid "A related function is :func:`itertools.accumulate(iterable, func=operator.add) `. It performs the same calculation, but instead of returning only the final result, :func:`~itertools.accumulate` returns an iterator that also yields each partial result::" +#: ../../howto/functional.rst:1075 +msgid "" +"A related function is :func:`itertools.accumulate(iterable, " +"func=operator.add) `. It performs the same " +"calculation, but instead of returning only the final " +"result, :func:`~itertools.accumulate` returns an iterator that also yields " +"each partial result::" msgstr "" +#: ../../howto/functional.rst:1080 msgid "" "itertools.accumulate([1, 2, 3, 4, 5]) =>\n" " 1, 3, 6, 10, 15\n" @@ -849,59 +1517,94 @@ msgid "" " 1, 2, 6, 24, 120" msgstr "" +#: ../../howto/functional.rst:1088 msgid "The operator module" msgstr "" -msgid "The :mod:`operator` module was mentioned earlier. It contains a set of functions corresponding to Python's operators. These functions are often useful in functional-style code because they save you from writing trivial functions that perform a single operation." +#: ../../howto/functional.rst:1090 +msgid "" +"The :mod:`operator` module was mentioned earlier. It contains a set of " +"functions corresponding to Python's operators. These functions are often " +"useful in functional-style code because they save you from writing trivial " +"functions that perform a single operation." msgstr "" +#: ../../howto/functional.rst:1095 msgid "Some of the functions in this module are:" msgstr "" -msgid "Math operations: ``add()``, ``sub()``, ``mul()``, ``floordiv()``, ``abs()``, ..." +#: ../../howto/functional.rst:1097 +msgid "" +"Math operations: ``add()``, ``sub()``, ``mul()``, ``floordiv()``, " +"``abs()``, ..." msgstr "" +#: ../../howto/functional.rst:1098 msgid "Logical operations: ``not_()``, ``truth()``." msgstr "" +#: ../../howto/functional.rst:1099 msgid "Bitwise operations: ``and_()``, ``or_()``, ``invert()``." msgstr "" -msgid "Comparisons: ``eq()``, ``ne()``, ``lt()``, ``le()``, ``gt()``, and ``ge()``." +#: ../../howto/functional.rst:1100 +msgid "" +"Comparisons: ``eq()``, ``ne()``, ``lt()``, ``le()``, ``gt()``, and ``ge()``." msgstr "" +#: ../../howto/functional.rst:1101 msgid "Object identity: ``is_()``, ``is_not()``." msgstr "" +#: ../../howto/functional.rst:1103 msgid "Consult the operator module's documentation for a complete list." msgstr "" +#: ../../howto/functional.rst:1107 msgid "Small functions and the lambda expression" msgstr "" -msgid "When writing functional-style programs, you'll often need little functions that act as predicates or that combine elements in some way." +#: ../../howto/functional.rst:1109 +msgid "" +"When writing functional-style programs, you'll often need little functions " +"that act as predicates or that combine elements in some way." msgstr "" -msgid "If there's a Python built-in or a module function that's suitable, you don't need to define a new function at all::" +#: ../../howto/functional.rst:1112 +msgid "" +"If there's a Python built-in or a module function that's suitable, you don't " +"need to define a new function at all::" msgstr "" +#: ../../howto/functional.rst:1115 msgid "" "stripped_lines = [line.strip() for line in lines]\n" "existing_files = filter(os.path.exists, file_list)" msgstr "" -msgid "If the function you need doesn't exist, you need to write it. One way to write small functions is to use the :keyword:`lambda` expression. ``lambda`` takes a number of parameters and an expression combining these parameters, and creates an anonymous function that returns the value of the expression::" +#: ../../howto/functional.rst:1118 +msgid "" +"If the function you need doesn't exist, you need to write it. One way to " +"write small functions is to use the :keyword:`lambda` expression. " +"``lambda`` takes a number of parameters and an expression combining these " +"parameters, and creates an anonymous function that returns the value of the " +"expression::" msgstr "" +#: ../../howto/functional.rst:1123 msgid "" "adder = lambda x, y: x+y\n" "\n" "print_assign = lambda name, value: name + '=' + str(value)" msgstr "" -msgid "An alternative is to just use the ``def`` statement and define a function in the usual way::" +#: ../../howto/functional.rst:1127 +msgid "" +"An alternative is to just use the ``def`` statement and define a function in " +"the usual way::" msgstr "" +#: ../../howto/functional.rst:1130 msgid "" "def adder(x, y):\n" " return x + y\n" @@ -910,20 +1613,36 @@ msgid "" " return name + '=' + str(value)" msgstr "" -msgid "Which alternative is preferable? That's a style question; my usual course is to avoid using ``lambda``." +#: ../../howto/functional.rst:1136 +msgid "" +"Which alternative is preferable? That's a style question; my usual course " +"is to avoid using ``lambda``." msgstr "" -msgid "One reason for my preference is that ``lambda`` is quite limited in the functions it can define. The result has to be computable as a single expression, which means you can't have multiway ``if... elif... else`` comparisons or ``try... except`` statements. If you try to do too much in a ``lambda`` statement, you'll end up with an overly complicated expression that's hard to read. Quick, what's the following code doing? ::" +#: ../../howto/functional.rst:1139 +msgid "" +"One reason for my preference is that ``lambda`` is quite limited in the " +"functions it can define. The result has to be computable as a single " +"expression, which means you can't have multiway ``if... elif... else`` " +"comparisons or ``try... except`` statements. If you try to do too much in a " +"``lambda`` statement, you'll end up with an overly complicated expression " +"that's hard to read. Quick, what's the following code doing? ::" msgstr "" +#: ../../howto/functional.rst:1146 msgid "" "import functools\n" "total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" msgstr "" -msgid "You can figure it out, but it takes time to disentangle the expression to figure out what's going on. Using a short nested ``def`` statements makes things a little bit better::" +#: ../../howto/functional.rst:1149 +msgid "" +"You can figure it out, but it takes time to disentangle the expression to " +"figure out what's going on. Using a short nested ``def`` statements makes " +"things a little bit better::" msgstr "" +#: ../../howto/functional.rst:1153 msgid "" "import functools\n" "def combine(a, b):\n" @@ -932,113 +1651,191 @@ msgid "" "total = functools.reduce(combine, items)[1]" msgstr "" +#: ../../howto/functional.rst:1159 msgid "But it would be best of all if I had simply used a ``for`` loop::" msgstr "" +#: ../../howto/functional.rst:1161 msgid "" "total = 0\n" "for a, b in items:\n" " total += b" msgstr "" +#: ../../howto/functional.rst:1165 msgid "Or the :func:`sum` built-in and a generator expression::" msgstr "" +#: ../../howto/functional.rst:1167 msgid "total = sum(b for a, b in items)" msgstr "" -msgid "Many uses of :func:`functools.reduce` are clearer when written as ``for`` loops." +#: ../../howto/functional.rst:1169 +msgid "" +"Many uses of :func:`functools.reduce` are clearer when written as ``for`` " +"loops." msgstr "" -msgid "Fredrik Lundh once suggested the following set of rules for refactoring uses of ``lambda``:" +#: ../../howto/functional.rst:1171 +msgid "" +"Fredrik Lundh once suggested the following set of rules for refactoring uses " +"of ``lambda``:" msgstr "" +#: ../../howto/functional.rst:1174 msgid "Write a lambda function." msgstr "" +#: ../../howto/functional.rst:1175 msgid "Write a comment explaining what the heck that lambda does." msgstr "" -msgid "Study the comment for a while, and think of a name that captures the essence of the comment." +#: ../../howto/functional.rst:1176 +msgid "" +"Study the comment for a while, and think of a name that captures the essence " +"of the comment." msgstr "" +#: ../../howto/functional.rst:1178 msgid "Convert the lambda to a def statement, using that name." msgstr "" +#: ../../howto/functional.rst:1179 msgid "Remove the comment." msgstr "" -msgid "I really like these rules, but you're free to disagree about whether this lambda-free style is better." +#: ../../howto/functional.rst:1181 +msgid "" +"I really like these rules, but you're free to disagree about whether this " +"lambda-free style is better." msgstr "" +#: ../../howto/functional.rst:1186 msgid "Revision History and Acknowledgements" msgstr "" -msgid "The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: Ian Bicking, Nick Coghlan, Nick Efford, Raymond Hettinger, Jim Jewett, Mike Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake Winton." +#: ../../howto/functional.rst:1188 +msgid "" +"The author would like to thank the following people for offering " +"suggestions, corrections and assistance with various drafts of this article: " +"Ian Bicking, Nick Coghlan, Nick Efford, Raymond Hettinger, Jim Jewett, Mike " +"Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake Winton." msgstr "" +#: ../../howto/functional.rst:1193 msgid "Version 0.1: posted June 30 2006." msgstr "" +#: ../../howto/functional.rst:1195 msgid "Version 0.11: posted July 1 2006. Typo fixes." msgstr "" -msgid "Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into one. Typo fixes." +#: ../../howto/functional.rst:1197 +msgid "" +"Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into " +"one. Typo fixes." msgstr "" -msgid "Version 0.21: Added more references suggested on the tutor mailing list." +#: ../../howto/functional.rst:1200 +msgid "" +"Version 0.21: Added more references suggested on the tutor mailing list." msgstr "" -msgid "Version 0.30: Adds a section on the ``functional`` module written by Collin Winter; adds short section on the operator module; a few other edits." +#: ../../howto/functional.rst:1202 +msgid "" +"Version 0.30: Adds a section on the ``functional`` module written by Collin " +"Winter; adds short section on the operator module; a few other edits." msgstr "" +#: ../../howto/functional.rst:1207 msgid "References" msgstr "" +#: ../../howto/functional.rst:1210 msgid "General" msgstr "" -msgid "**Structure and Interpretation of Computer Programs**, by Harold Abelson and Gerald Jay Sussman with Julie Sussman. The book can be found at https://mitpress.mit.edu/sicp. In this classic textbook of computer science, chapters 2 and 3 discuss the use of sequences and streams to organize the data flow inside a program. The book uses Scheme for its examples, but many of the design approaches described in these chapters are applicable to functional-style Python code." +#: ../../howto/functional.rst:1212 +msgid "" +"**Structure and Interpretation of Computer Programs**, by Harold Abelson and " +"Gerald Jay Sussman with Julie Sussman. The book can be found at https://" +"mitpress.mit.edu/sicp. In this classic textbook of computer science, " +"chapters 2 and 3 discuss the use of sequences and streams to organize the " +"data flow inside a program. The book uses Scheme for its examples, but many " +"of the design approaches described in these chapters are applicable to " +"functional-style Python code." msgstr "" -msgid "https://defmacro.org/2006/06/19/fp.html: A general introduction to functional programming that uses Java examples and has a lengthy historical introduction." +#: ../../howto/functional.rst:1220 +msgid "" +"https://defmacro.org/2006/06/19/fp.html: A general introduction to " +"functional programming that uses Java examples and has a lengthy historical " +"introduction." msgstr "" -msgid "https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia entry describing functional programming." +#: ../../howto/functional.rst:1223 +msgid "" +"https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia " +"entry describing functional programming." msgstr "" +#: ../../howto/functional.rst:1226 msgid "https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines." msgstr "" -msgid "https://en.wikipedia.org/wiki/Partial_application: Entry for the concept of partial function application." +#: ../../howto/functional.rst:1228 +msgid "" +"https://en.wikipedia.org/wiki/Partial_application: Entry for the concept of " +"partial function application." msgstr "" -msgid "https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying." +#: ../../howto/functional.rst:1230 +msgid "" +"https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying." msgstr "" +#: ../../howto/functional.rst:1233 msgid "Python-specific" msgstr "" -msgid "https://gnosis.cx/TPiP/: The first chapter of David Mertz's book :title-reference:`Text Processing in Python` discusses functional programming for text processing, in the section titled \"Utilizing Higher-Order Functions in Text Processing\"." +#: ../../howto/functional.rst:1235 +msgid "" +"https://gnosis.cx/TPiP/: The first chapter of David Mertz's book :title-" +"reference:`Text Processing in Python` discusses functional programming for " +"text processing, in the section titled \"Utilizing Higher-Order Functions in " +"Text Processing\"." msgstr "" -msgid "Mertz also wrote a 3-part series of articles on functional programming for IBM's DeveloperWorks site; see `part 1 `__, `part 2 `__, and `part 3 `__," +#: ../../howto/functional.rst:1240 +msgid "" +"Mertz also wrote a 3-part series of articles on functional programming for " +"IBM's DeveloperWorks site; see `part 1 `__, `part 2 `__, and " +"`part 3 `__," msgstr "" +#: ../../howto/functional.rst:1248 msgid "Python documentation" msgstr "" +#: ../../howto/functional.rst:1250 msgid "Documentation for the :mod:`itertools` module." msgstr "" +#: ../../howto/functional.rst:1252 msgid "Documentation for the :mod:`functools` module." msgstr "" +#: ../../howto/functional.rst:1254 msgid "Documentation for the :mod:`operator` module." msgstr "" +#: ../../howto/functional.rst:1256 msgid ":pep:`289`: \"Generator Expressions\"" msgstr "" -msgid ":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new generator features in Python 2.5." +#: ../../howto/functional.rst:1258 +msgid "" +":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new " +"generator features in Python 2.5." msgstr "" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index fc6020d59..265e7e8b2 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-02-25 01:11+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,134 +22,239 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/gdb_helpers.rst:5 msgid "Debugging C API extensions and CPython Internals with GDB" msgstr "" -msgid "This document explains how the Python GDB extension, ``python-gdb.py``, can be used with the GDB debugger to debug CPython extensions and the CPython interpreter itself." +#: ../../howto/gdb_helpers.rst:9 +msgid "" +"This document explains how the Python GDB extension, ``python-gdb.py``, can " +"be used with the GDB debugger to debug CPython extensions and the CPython " +"interpreter itself." msgstr "" -msgid "When debugging low-level problems such as crashes or deadlocks, a low-level debugger, such as GDB, is useful to diagnose and correct the issue. By default, GDB (or any of its front-ends) doesn't support high-level information specific to the CPython interpreter." +#: ../../howto/gdb_helpers.rst:13 +msgid "" +"When debugging low-level problems such as crashes or deadlocks, a low-level " +"debugger, such as GDB, is useful to diagnose and correct the issue. By " +"default, GDB (or any of its front-ends) doesn't support high-level " +"information specific to the CPython interpreter." msgstr "" -msgid "The ``python-gdb.py`` extension adds CPython interpreter information to GDB. The extension helps introspect the stack of currently executing Python functions. Given a Python object represented by a :c:expr:`PyObject *` pointer, the extension surfaces the type and value of the object." +#: ../../howto/gdb_helpers.rst:18 +msgid "" +"The ``python-gdb.py`` extension adds CPython interpreter information to GDB. " +"The extension helps introspect the stack of currently executing Python " +"functions. Given a Python object represented by a :c:expr:`PyObject *` " +"pointer, the extension surfaces the type and value of the object." msgstr "" -msgid "Developers who are working on CPython extensions or tinkering with parts of CPython that are written in C can use this document to learn how to use the ``python-gdb.py`` extension with GDB." +#: ../../howto/gdb_helpers.rst:23 +msgid "" +"Developers who are working on CPython extensions or tinkering with parts of " +"CPython that are written in C can use this document to learn how to use the " +"``python-gdb.py`` extension with GDB." msgstr "" -msgid "This document assumes that you are familiar with the basics of GDB and the CPython C API. It consolidates guidance from the `devguide `_ and the `Python wiki `_." +#: ../../howto/gdb_helpers.rst:29 +msgid "" +"This document assumes that you are familiar with the basics of GDB and the " +"CPython C API. It consolidates guidance from the `devguide `_ and the `Python wiki `_." msgstr "" +#: ../../howto/gdb_helpers.rst:36 msgid "Prerequisites" msgstr "" +#: ../../howto/gdb_helpers.rst:38 msgid "You need to have:" msgstr "" -msgid "GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the sources of Python 3.11 or earlier.)" +#: ../../howto/gdb_helpers.rst:40 +msgid "" +"GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the " +"sources of Python 3.11 or earlier.)" msgstr "" -msgid "GDB-compatible debugging information for Python and any extension you are debugging." +#: ../../howto/gdb_helpers.rst:42 +msgid "" +"GDB-compatible debugging information for Python and any extension you are " +"debugging." msgstr "" +#: ../../howto/gdb_helpers.rst:44 msgid "The ``python-gdb.py`` extension." msgstr "" -msgid "The extension is built with Python, but might be distributed separately or not at all. Below, we include tips for a few common systems as examples. Note that even if the instructions match your system, they might be outdated." +#: ../../howto/gdb_helpers.rst:46 +msgid "" +"The extension is built with Python, but might be distributed separately or " +"not at all. Below, we include tips for a few common systems as examples. " +"Note that even if the instructions match your system, they might be outdated." msgstr "" +#: ../../howto/gdb_helpers.rst:52 msgid "Setup with Python built from source" msgstr "" -msgid "When you build CPython from source, debugging information should be available, and the build should add a ``python-gdb.py`` file to the root directory of your repository." +#: ../../howto/gdb_helpers.rst:54 +msgid "" +"When you build CPython from source, debugging information should be " +"available, and the build should add a ``python-gdb.py`` file to the root " +"directory of your repository." msgstr "" -msgid "To activate support, you must add the directory containing ``python-gdb.py`` to GDB's \"auto-load-safe-path\". If you haven't done this, recent versions of GDB will print out a warning with instructions on how to do this." +#: ../../howto/gdb_helpers.rst:58 +msgid "" +"To activate support, you must add the directory containing ``python-gdb.py`` " +"to GDB's \"auto-load-safe-path\". If you haven't done this, recent versions " +"of GDB will print out a warning with instructions on how to do this." msgstr "" -msgid "If you do not see instructions for your version of GDB, put this in your configuration file (``~/.gdbinit`` or ``~/.config/gdb/gdbinit``)::" +#: ../../howto/gdb_helpers.rst:65 +msgid "" +"If you do not see instructions for your version of GDB, put this in your " +"configuration file (``~/.gdbinit`` or ``~/.config/gdb/gdbinit``)::" msgstr "" +#: ../../howto/gdb_helpers.rst:68 msgid "add-auto-load-safe-path /path/to/cpython" msgstr "" +#: ../../howto/gdb_helpers.rst:70 msgid "You can also add multiple paths, separated by ``:``." msgstr "" +#: ../../howto/gdb_helpers.rst:74 msgid "Setup for Python from a Linux distro" msgstr "" -msgid "Most Linux systems provide debug information for the system Python in a package called ``python-debuginfo``, ``python-dbg`` or similar. For example:" +#: ../../howto/gdb_helpers.rst:76 +msgid "" +"Most Linux systems provide debug information for the system Python in a " +"package called ``python-debuginfo``, ``python-dbg`` or similar. For example:" msgstr "" +#: ../../howto/gdb_helpers.rst:80 msgid "Fedora:" msgstr "" +#: ../../howto/gdb_helpers.rst:82 msgid "" "sudo dnf install gdb\n" "sudo dnf debuginfo-install python3" msgstr "" +#: ../../howto/gdb_helpers.rst:87 msgid "Ubuntu:" msgstr "" +#: ../../howto/gdb_helpers.rst:89 msgid "sudo apt install gdb python3-dbg" msgstr "" -msgid "On several recent Linux systems, GDB can download debugging symbols automatically using *debuginfod*. However, this will not install the ``python-gdb.py`` extension; you generally do need to install the debug info package separately." +#: ../../howto/gdb_helpers.rst:93 +msgid "" +"On several recent Linux systems, GDB can download debugging symbols " +"automatically using *debuginfod*. However, this will not install the " +"``python-gdb.py`` extension; you generally do need to install the debug info " +"package separately." msgstr "" +#: ../../howto/gdb_helpers.rst:100 msgid "Using the Debug build and Development mode" msgstr "" +#: ../../howto/gdb_helpers.rst:102 msgid "For easier debugging, you might want to:" msgstr "" -msgid "Use a :ref:`debug build ` of Python. (When building from source, use ``configure --with-pydebug``. On Linux distros, install and run a package like ``python-debug`` or ``python-dbg``, if available.)" +#: ../../howto/gdb_helpers.rst:104 +msgid "" +"Use a :ref:`debug build ` of Python. (When building from " +"source, use ``configure --with-pydebug``. On Linux distros, install and run " +"a package like ``python-debug`` or ``python-dbg``, if available.)" msgstr "" +#: ../../howto/gdb_helpers.rst:107 msgid "Use the runtime :ref:`development mode ` (``-X dev``)." msgstr "" -msgid "Both enable extra assertions and disable some optimizations. Sometimes this hides the bug you are trying to find, but in most cases they make the process easier." +#: ../../howto/gdb_helpers.rst:109 +msgid "" +"Both enable extra assertions and disable some optimizations. Sometimes this " +"hides the bug you are trying to find, but in most cases they make the " +"process easier." msgstr "" +#: ../../howto/gdb_helpers.rst:115 msgid "Using the ``python-gdb`` extension" msgstr "" -msgid "When the extension is loaded, it provides two main features: pretty printers for Python values, and additional commands." +#: ../../howto/gdb_helpers.rst:117 +msgid "" +"When the extension is loaded, it provides two main features: pretty printers " +"for Python values, and additional commands." msgstr "" +#: ../../howto/gdb_helpers.rst:121 msgid "Pretty-printers" msgstr "" -msgid "This is what a GDB backtrace looks like (truncated) when this extension is enabled::" +#: ../../howto/gdb_helpers.rst:123 +msgid "" +"This is what a GDB backtrace looks like (truncated) when this extension is " +"enabled::" msgstr "" +#: ../../howto/gdb_helpers.rst:126 msgid "" -"#0 0x000000000041a6b1 in PyObject_Malloc (nbytes=Cannot access memory at address 0x7fffff7fefe8\n" +"#0 0x000000000041a6b1 in PyObject_Malloc (nbytes=Cannot access memory at " +"address 0x7fffff7fefe8\n" ") at Objects/obmalloc.c:748\n" -"#1 0x000000000041b7c0 in _PyObject_DebugMallocApi (id=111 'o', nbytes=24) at Objects/obmalloc.c:1445\n" -"#2 0x000000000041b717 in _PyObject_DebugMalloc (nbytes=24) at Objects/obmalloc.c:1412\n" -"#3 0x000000000044060a in _PyUnicode_New (length=11) at Objects/unicodeobject.c:346\n" -"#4 0x00000000004466aa in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x5c2b8d \"__lltrace__\", size=11, errors=0x0, consumed=\n" +"#1 0x000000000041b7c0 in _PyObject_DebugMallocApi (id=111 'o', nbytes=24) " +"at Objects/obmalloc.c:1445\n" +"#2 0x000000000041b717 in _PyObject_DebugMalloc (nbytes=24) at Objects/" +"obmalloc.c:1412\n" +"#3 0x000000000044060a in _PyUnicode_New (length=11) at Objects/" +"unicodeobject.c:346\n" +"#4 0x00000000004466aa in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x5c2b8d " +"\"__lltrace__\", size=11, errors=0x0, consumed=\n" " 0x0) at Objects/unicodeobject.c:2531\n" -"#5 0x0000000000446647 in PyUnicodeUCS2_DecodeUTF8 (s=0x5c2b8d \"__lltrace__\", size=11, errors=0x0)\n" +"#5 0x0000000000446647 in PyUnicodeUCS2_DecodeUTF8 (s=0x5c2b8d " +"\"__lltrace__\", size=11, errors=0x0)\n" " at Objects/unicodeobject.c:2495\n" -"#6 0x0000000000440d1b in PyUnicodeUCS2_FromStringAndSize (u=0x5c2b8d \"__lltrace__\", size=11)\n" +"#6 0x0000000000440d1b in PyUnicodeUCS2_FromStringAndSize (u=0x5c2b8d " +"\"__lltrace__\", size=11)\n" " at Objects/unicodeobject.c:551\n" -"#7 0x0000000000440d94 in PyUnicodeUCS2_FromString (u=0x5c2b8d \"__lltrace__\") at Objects/unicodeobject.c:569\n" +"#7 0x0000000000440d94 in PyUnicodeUCS2_FromString (u=0x5c2b8d " +"\"__lltrace__\") at Objects/unicodeobject.c:569\n" "#8 0x0000000000584abd in PyDict_GetItemString (v=\n" -" {'Yuck': , '__builtins__': , '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', '__package__': None, 'y': , 'dict': {0: 0, 1: 1, 2: 2, 3: 3}, '__cached__': None, '__name__': '__main__', 'z': , '__doc__': None}, key=\n" +" {'Yuck': , '__builtins__': , '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', " +"'__package__': None, 'y': , 'dict': {0: 0, 1: " +"1, 2: 2, 3: 3}, '__cached__': None, '__name__': '__main__', 'z': , '__doc__': None}, key=\n" " 0x5c2b8d \"__lltrace__\") at Objects/dictobject.c:2171" msgstr "" -msgid "Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed as its ``repr()``, rather than an opaque ``PyObject *`` pointer." +#: ../../howto/gdb_helpers.rst:142 +msgid "" +"Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed " +"as its ``repr()``, rather than an opaque ``PyObject *`` pointer." msgstr "" -msgid "The extension works by supplying a custom printing routine for values of type ``PyObject *``. If you need to access lower-level details of an object, then cast the value to a pointer of the appropriate type. For example::" +#: ../../howto/gdb_helpers.rst:145 +msgid "" +"The extension works by supplying a custom printing routine for values of " +"type ``PyObject *``. If you need to access lower-level details of an " +"object, then cast the value to a pointer of the appropriate type. For " +"example::" msgstr "" +#: ../../howto/gdb_helpers.rst:149 msgid "" "(gdb) p globals\n" "$1 = {'__builtins__': , '__name__':\n" @@ -171,12 +276,22 @@ msgid "" " me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}" msgstr "" -msgid "Note that the pretty-printers do not actually call ``repr()``. For basic types, they try to match its result closely." +#: ../../howto/gdb_helpers.rst:168 +msgid "" +"Note that the pretty-printers do not actually call ``repr()``. For basic " +"types, they try to match its result closely." msgstr "" -msgid "An area that can be confusing is that the custom printer for some types look a lot like GDB's built-in printer for standard types. For example, the pretty-printer for a Python ``int`` (:c:expr:`PyLongObject *`) gives a representation that is not distinguishable from one of a regular machine-level integer::" +#: ../../howto/gdb_helpers.rst:171 +msgid "" +"An area that can be confusing is that the custom printer for some types look " +"a lot like GDB's built-in printer for standard types. For example, the " +"pretty-printer for a Python ``int`` (:c:expr:`PyLongObject *`) gives a " +"representation that is not distinguishable from one of a regular machine-" +"level integer::" msgstr "" +#: ../../howto/gdb_helpers.rst:177 msgid "" "(gdb) p some_machine_integer\n" "$3 = 42\n" @@ -185,46 +300,70 @@ msgid "" "$4 = 42" msgstr "" -msgid "The internal structure can be revealed with a cast to :c:expr:`PyLongObject *`::" +#: ../../howto/gdb_helpers.rst:183 +msgid "" +"The internal structure can be revealed with a cast to :c:expr:`PyLongObject " +"*`::" msgstr "" +#: ../../howto/gdb_helpers.rst:185 msgid "" "(gdb) p *(PyLongObject*)some_python_integer\n" -"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1},\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" "ob_digit = {42}}" msgstr "" -msgid "A similar confusion can arise with the ``str`` type, where the output looks a lot like gdb's built-in printer for ``char *``::" +#: ../../howto/gdb_helpers.rst:189 +msgid "" +"A similar confusion can arise with the ``str`` type, where the output looks " +"a lot like gdb's built-in printer for ``char *``::" msgstr "" +#: ../../howto/gdb_helpers.rst:192 msgid "" "(gdb) p ptr_to_python_str\n" "$6 = '__builtins__'" msgstr "" -msgid "The pretty-printer for ``str`` instances defaults to using single-quotes (as does Python's ``repr`` for strings) whereas the standard printer for ``char *`` values uses double-quotes and contains a hexadecimal address::" +#: ../../howto/gdb_helpers.rst:195 +msgid "" +"The pretty-printer for ``str`` instances defaults to using single-quotes (as " +"does Python's ``repr`` for strings) whereas the standard printer for ``char " +"*`` values uses double-quotes and contains a hexadecimal address::" msgstr "" +#: ../../howto/gdb_helpers.rst:199 msgid "" "(gdb) p ptr_to_char_star\n" "$7 = 0x6d72c0 \"hello world\"" msgstr "" -msgid "Again, the implementation details can be revealed with a cast to :c:expr:`PyUnicodeObject *`::" +#: ../../howto/gdb_helpers.rst:202 +msgid "" +"Again, the implementation details can be revealed with a cast " +"to :c:expr:`PyUnicodeObject *`::" msgstr "" +#: ../../howto/gdb_helpers.rst:205 msgid "" "(gdb) p *(PyUnicodeObject*)$6\n" "$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,\n" "str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}" msgstr "" +#: ../../howto/gdb_helpers.rst:210 msgid "``py-list``" msgstr "" -msgid "The extension adds a ``py-list`` command, which lists the Python source code (if any) for the current frame in the selected thread. The current line is marked with a \">\"::" +#: ../../howto/gdb_helpers.rst:212 +msgid "" +"The extension adds a ``py-list`` command, which lists the Python source code " +"(if any) for the current frame in the selected thread. The current line is " +"marked with a \">\"::" msgstr "" +#: ../../howto/gdb_helpers.rst:216 msgid "" "(gdb) py-list\n" " 901 if options.profile:\n" @@ -240,24 +379,42 @@ msgid "" " 911 # properly quit on a keyboard interrupt..." msgstr "" -msgid "Use ``py-list START`` to list at a different line number within the Python source, and ``py-list START,END`` to list a specific range of lines within the Python source." +#: ../../howto/gdb_helpers.rst:229 +msgid "" +"Use ``py-list START`` to list at a different line number within the Python " +"source, and ``py-list START,END`` to list a specific range of lines within " +"the Python source." msgstr "" +#: ../../howto/gdb_helpers.rst:234 msgid "``py-up`` and ``py-down``" msgstr "" -msgid "The ``py-up`` and ``py-down`` commands are analogous to GDB's regular ``up`` and ``down`` commands, but try to move at the level of CPython frames, rather than C frames." +#: ../../howto/gdb_helpers.rst:236 +msgid "" +"The ``py-up`` and ``py-down`` commands are analogous to GDB's regular ``up`` " +"and ``down`` commands, but try to move at the level of CPython frames, " +"rather than C frames." msgstr "" -msgid "GDB is not always able to read the relevant frame information, depending on the optimization level with which CPython was compiled. Internally, the commands look for C frames that are executing the default frame evaluation function (that is, the core bytecode interpreter loop within CPython) and look up the value of the related ``PyFrameObject *``." +#: ../../howto/gdb_helpers.rst:240 +msgid "" +"GDB is not always able to read the relevant frame information, depending on " +"the optimization level with which CPython was compiled. Internally, the " +"commands look for C frames that are executing the default frame evaluation " +"function (that is, the core bytecode interpreter loop within CPython) and " +"look up the value of the related ``PyFrameObject *``." msgstr "" +#: ../../howto/gdb_helpers.rst:246 msgid "They emit the frame number (at the C level) within the thread." msgstr "" +#: ../../howto/gdb_helpers.rst:248 ../../howto/gdb_helpers.rst:320 msgid "For example::" msgstr "" +#: ../../howto/gdb_helpers.rst:250 msgid "" "(gdb) py-up\n" "#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/\n" @@ -265,24 +422,33 @@ msgid "" " u = UI()\n" "(gdb) py-up\n" "#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/\n" -"gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=)\n" +"gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=)\n" " main.start_game()\n" "(gdb) py-up\n" "Unable to find an older python frame" msgstr "" +#: ../../howto/gdb_helpers.rst:261 msgid "so we're at the top of the Python stack." msgstr "" -msgid "The frame numbers correspond to those displayed by GDB's standard ``backtrace`` command. The command skips C frames which are not executing Python code." +#: ../../howto/gdb_helpers.rst:263 +msgid "" +"The frame numbers correspond to those displayed by GDB's standard " +"``backtrace`` command. The command skips C frames which are not executing " +"Python code." msgstr "" +#: ../../howto/gdb_helpers.rst:267 msgid "Going back down::" msgstr "" +#: ../../howto/gdb_helpers.rst:269 msgid "" "(gdb) py-down\n" -"#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game ()\n" +"#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"main.py, line 906, in start_game ()\n" " u = UI()\n" "(gdb) py-down\n" "#34 (unable to read python frame information)\n" @@ -291,10 +457,27 @@ msgid "" "(gdb) py-down\n" "#19 (unable to read python frame information)\n" "(gdb) py-down\n" -"#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/game_selector.py, line 201, in run_swallowed_dialog (self=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], dialog=, saved_game_model=, sudoku_maker=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, " +"'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 " +"5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 " +"3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 " +"8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 " +"9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 " +"0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], " +"dialog=, saved_game_model=, sudoku_maker=, main_page=0) at remote 0x98fa6e4>, d=)\n" +"#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"dialog_swallower.py, line 48, in run_dialog " +"(self=, main_page=0) " +"at remote 0x98fa6e4>, d=)\n" " gtk.main()\n" "(gdb) py-down\n" "#8 (unable to read python frame information)\n" @@ -302,25 +485,37 @@ msgid "" "Unable to find a newer python frame" msgstr "" +#: ../../howto/gdb_helpers.rst:289 msgid "and we're at the bottom of the Python stack." msgstr "" -msgid "Note that in Python 3.12 and newer, the same C stack frame can be used for multiple Python stack frames. This means that ``py-up`` and ``py-down`` may move multiple Python frames at once. For example::" +#: ../../howto/gdb_helpers.rst:291 +msgid "" +"Note that in Python 3.12 and newer, the same C stack frame can be used for " +"multiple Python stack frames. This means that ``py-up`` and ``py-down`` may " +"move multiple Python frames at once. For example::" msgstr "" +#: ../../howto/gdb_helpers.rst:295 msgid "" "(gdb) py-up\n" -"#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function (n=0)\n" +"#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function " +"(n=0)\n" " time.sleep(5)\n" -"#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursive_function (n=1)\n" +"#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursive_function " +"(n=1)\n" " recursive_function(n-1)\n" -"#6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursive_function (n=2)\n" +"#6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursive_function " +"(n=2)\n" " recursive_function(n-1)\n" -"#6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursive_function (n=3)\n" +"#6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursive_function " +"(n=3)\n" " recursive_function(n-1)\n" -"#6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursive_function (n=4)\n" +"#6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursive_function " +"(n=4)\n" " recursive_function(n-1)\n" -"#6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursive_function (n=5)\n" +"#6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursive_function " +"(n=5)\n" " recursive_function(n-1)\n" "#6 Frame 0x7ffff7fb6020, for file /tmp/rec.py, line 9, in ()\n" " recursive_function(5)\n" @@ -328,37 +523,71 @@ msgid "" "Unable to find an older python frame" msgstr "" +#: ../../howto/gdb_helpers.rst:315 msgid "``py-bt``" msgstr "" -msgid "The ``py-bt`` command attempts to display a Python-level backtrace of the current thread." +#: ../../howto/gdb_helpers.rst:317 +msgid "" +"The ``py-bt`` command attempts to display a Python-level backtrace of the " +"current thread." msgstr "" +#: ../../howto/gdb_helpers.rst:322 msgid "" "(gdb) py-bt\n" "#8 (unable to read python frame information)\n" -"#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/dialog_swallower.py, line 48, in run_dialog (self=, main_page=0) at remote 0x98fa6e4>, d=)\n" +"#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"dialog_swallower.py, line 48, in run_dialog " +"(self=, main_page=0) " +"at remote 0x98fa6e4>, d=)\n" " gtk.main()\n" -"#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/game_selector.py, line 201, in run_swallowed_dialog (self=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], dialog=, saved_game_model=, sudoku_maker=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, " +"'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 " +"5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 " +"3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 " +"8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 " +"9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 " +"0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], " +"dialog=, saved_game_model=, sudoku_maker=)\n" +"#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"gnome_sudoku.py, line 22, in start_game (main=)\n" " main.start_game()" msgstr "" -msgid "The frame numbers correspond to those displayed by GDB's standard ``backtrace`` command." +#: ../../howto/gdb_helpers.rst:336 +msgid "" +"The frame numbers correspond to those displayed by GDB's standard " +"``backtrace`` command." msgstr "" +#: ../../howto/gdb_helpers.rst:340 msgid "``py-print``" msgstr "" -msgid "The ``py-print`` command looks up a Python name and tries to print it. It looks in locals within the current thread, then globals, then finally builtins::" +#: ../../howto/gdb_helpers.rst:342 +msgid "" +"The ``py-print`` command looks up a Python name and tries to print it. It " +"looks in locals within the current thread, then globals, then finally " +"builtins::" msgstr "" +#: ../../howto/gdb_helpers.rst:346 msgid "" "(gdb) py-print self\n" "local 'self' = ,\n" @@ -371,15 +600,23 @@ msgid "" "'scarlet_pimpernel' not found" msgstr "" -msgid "If the current C frame corresponds to multiple Python frames, ``py-print`` only considers the first one." +#: ../../howto/gdb_helpers.rst:356 +msgid "" +"If the current C frame corresponds to multiple Python frames, ``py-print`` " +"only considers the first one." msgstr "" +#: ../../howto/gdb_helpers.rst:360 msgid "``py-locals``" msgstr "" -msgid "The ``py-locals`` command looks up all Python locals within the current Python frame in the selected thread, and prints their representations::" +#: ../../howto/gdb_helpers.rst:362 +msgid "" +"The ``py-locals`` command looks up all Python locals within the current " +"Python frame in the selected thread, and prints their representations::" msgstr "" +#: ../../howto/gdb_helpers.rst:365 msgid "" "(gdb) py-locals\n" "self = ,\n" @@ -387,9 +624,13 @@ msgid "" "d = " msgstr "" -msgid "If the current C frame corresponds to multiple Python frames, locals from all of them will be shown::" +#: ../../howto/gdb_helpers.rst:370 +msgid "" +"If the current C frame corresponds to multiple Python frames, locals from " +"all of them will be shown::" msgstr "" +#: ../../howto/gdb_helpers.rst:373 msgid "" "(gdb) py-locals\n" "Locals for recursive_function\n" @@ -407,68 +648,142 @@ msgid "" "Locals for " msgstr "" +#: ../../howto/gdb_helpers.rst:390 msgid "Use with GDB commands" msgstr "" -msgid "The extension commands complement GDB's built-in commands. For example, you can use a frame numbers shown by ``py-bt`` with the ``frame`` command to go a specific frame within the selected thread, like this::" +#: ../../howto/gdb_helpers.rst:392 +msgid "" +"The extension commands complement GDB's built-in commands. For example, you " +"can use a frame numbers shown by ``py-bt`` with the ``frame`` command to go " +"a specific frame within the selected thread, like this::" msgstr "" +#: ../../howto/gdb_helpers.rst:396 msgid "" "(gdb) py-bt\n" "(output snipped)\n" -"#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in ()\n" +"#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in " +"()\n" " main()\n" "(gdb) frame 68\n" -"#68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in (), throwflag=0) at Python/ceval.c:2665\n" +"#68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/" +"test/regrtest.py, line 1548, in (), throwflag=0) at Python/" +"ceval.c:2665\n" "2665 x = call_function(&sp, oparg);\n" "(gdb) py-list\n" -"1543 # Run the tests in a context manager that temporary changes the CWD to a\n" -"1544 # temporary and writable directory. If it's not possible to create or\n" -"1545 # change the CWD, the original CWD will be used. The original CWD is\n" +"1543 # Run the tests in a context manager that temporary changes the " +"CWD to a\n" +"1544 # temporary and writable directory. If it's not possible to " +"create or\n" +"1545 # change the CWD, the original CWD will be used. The original " +"CWD is\n" "1546 # available from test_support.SAVEDCWD.\n" "1547 with test_support.temp_cwd(TESTCWD, quiet=True):\n" ">1548 main()" msgstr "" -msgid "The ``info threads`` command will give you a list of the threads within the process, and you can use the ``thread`` command to select a different one::" +#: ../../howto/gdb_helpers.rst:411 +msgid "" +"The ``info threads`` command will give you a list of the threads within the " +"process, and you can use the ``thread`` command to select a different one::" msgstr "" +#: ../../howto/gdb_helpers.rst:414 msgid "" "(gdb) info threads\n" -" 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86\n" -" 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86\n" -"* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82" +" 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +" 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +"* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../" +"sysdeps/unix/syscall-template.S:82" msgstr "" -msgid "You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to run a command on all threads. With ``py-bt``, this lets you see what every thread is doing at the Python level::" +#: ../../howto/gdb_helpers.rst:419 +msgid "" +"You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to " +"run a command on all threads. With ``py-bt``, this lets you see what every " +"thread is doing at the Python level::" msgstr "" +#: ../../howto/gdb_helpers.rst:423 msgid "" "(gdb) t a a py-bt\n" "\n" "Thread 105 (Thread 0x7fffefa18710 (LWP 10260)):\n" -"#5 Frame 0x7fffd00019d0, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in _acquire_restore (self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, count_owner=(1, 140737213728528), count=1, owner=140737213728528)\n" +"#5 Frame 0x7fffd00019d0, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 155, in _acquire_restore " +"(self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, " +"_RLock__block=, _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140737213728528), count=1, " +"owner=140737213728528)\n" " self.__block.acquire()\n" -"#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, _release_save=, release=, _acquire_restore=, _Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, timeout=None, waiter=, saved_state=(1, 140737213728528))\n" +"#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140737213728528))\n" " self._acquire_restore(saved_state)\n" -"#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f ()\n" +"#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" " cond.wait()\n" -"#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140737213728528)\n" +"#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140737213728528)\n" " f()\n" "\n" "Thread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):\n" -"#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in _acquire_restore (self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, count_owner=(1, 140736940992272), count=1, owner=140736940992272)\n" +"#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 155, in _acquire_restore " +"(self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, " +"_RLock__block=, _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140736940992272), count=1, " +"owner=140736940992272)\n" " self.__block.acquire()\n" -"#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, _release_save=, release=, _acquire_restore=, _Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, timeout=None, waiter=, saved_state=(1, 140736940992272))\n" +"#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140736940992272))\n" " self._acquire_restore(saved_state)\n" -"#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 348, in f ()\n" +"#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" " cond.wait()\n" -"#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 37, in task (tid=140736940992272)\n" +"#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140736940992272)\n" " f()\n" "\n" "Thread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):\n" -"#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 16, in _wait ()\n" +"#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 16, in _wait ()\n" " time.sleep(0.01)\n" -"#8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/lock_tests.py, line 378, in _check_notify (self=, skipped=[], _mirrorOutput=False, testsRun=39, buffer=False, _original_stderr=, _stdout_buffer=, _stderr_buffer=, _moduleSetUpFailed=False, expectedFailures=[], errors=[], _previousTestClass=, unexpectedSuccesses=[], failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, _threads=(0,), _cleanups=[], _type_equality_funcs={: , : , : , : , , skipped=[], _mirrorOutput=False, testsRun=39, " +"buffer=False, _original_stderr=, " +"_stdout_buffer=, " +"_stderr_buffer=, " +"_moduleSetUpFailed=False, expectedFailures=[], errors=[], " +"_previousTestClass=, unexpectedSuccesses=[], " +"failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, " +"_threads=(0,), _cleanups=[], _type_equality_funcs={: , : " +", : " +", : " +", , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,92 +23,126 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/index.rst:5 msgid "Python HOWTOs" msgstr "" -msgid "Python HOWTOs are documents that cover a specific topic in-depth. Modeled on the Linux Documentation Project's HOWTO collection, this collection is an effort to foster documentation that's more detailed than the Python Library Reference." +#: ../../howto/index.rst:7 +msgid "" +"Python HOWTOs are documents that cover a specific topic in-depth. Modeled on " +"the Linux Documentation Project's HOWTO collection, this collection is an " +"effort to foster documentation that's more detailed than the Python Library " +"Reference." msgstr "" +#: ../../howto/index.rst:42 msgid "General:" msgstr "" +#: ../../howto/index.rst:44 msgid ":ref:`a-conceptual-overview-of-asyncio`" msgstr "" +#: ../../howto/index.rst:45 msgid ":ref:`annotations-howto`" msgstr "" +#: ../../howto/index.rst:46 msgid ":ref:`argparse-tutorial`" msgstr "" +#: ../../howto/index.rst:47 msgid ":ref:`descriptorhowto`" msgstr "" +#: ../../howto/index.rst:48 msgid ":ref:`enum-howto`" msgstr "" +#: ../../howto/index.rst:49 msgid ":ref:`functional-howto`" msgstr "" +#: ../../howto/index.rst:50 msgid ":ref:`ipaddress-howto`" msgstr "" +#: ../../howto/index.rst:51 msgid ":ref:`logging-howto`" msgstr "" +#: ../../howto/index.rst:52 msgid ":ref:`logging-cookbook`" msgstr "" +#: ../../howto/index.rst:53 msgid ":ref:`regex-howto`" msgstr "" +#: ../../howto/index.rst:54 msgid ":ref:`sortinghowto`" msgstr "" +#: ../../howto/index.rst:55 msgid ":ref:`unicode-howto`" msgstr "" +#: ../../howto/index.rst:56 msgid ":ref:`urllib-howto`" msgstr "" +#: ../../howto/index.rst:58 msgid "Advanced development:" msgstr "" +#: ../../howto/index.rst:60 msgid ":ref:`curses-howto`" msgstr "" +#: ../../howto/index.rst:61 msgid ":ref:`freethreading-python-howto`" msgstr "" +#: ../../howto/index.rst:62 msgid ":ref:`freethreading-extensions-howto`" msgstr "" +#: ../../howto/index.rst:63 msgid ":ref:`isolating-extensions-howto`" msgstr "" +#: ../../howto/index.rst:64 msgid ":ref:`python_2.3_mro`" msgstr "" +#: ../../howto/index.rst:65 msgid ":ref:`socket-howto`" msgstr "" +#: ../../howto/index.rst:66 msgid ":ref:`timerfd-howto`" msgstr "" +#: ../../howto/index.rst:67 msgid ":ref:`cporting-howto`" msgstr "" +#: ../../howto/index.rst:69 msgid "Debugging and profiling:" msgstr "" +#: ../../howto/index.rst:71 msgid ":ref:`gdb`" msgstr "" +#: ../../howto/index.rst:72 msgid ":ref:`instrumentation`" msgstr "" +#: ../../howto/index.rst:73 msgid ":ref:`perf_profiling`" msgstr "" +#: ../../howto/index.rst:74 msgid ":ref:`remote-debugging`" msgstr "" diff --git a/howto/instrumentation.po b/howto/instrumentation.po index c23397d91..fe3c3b97c 100644 --- a/howto/instrumentation.po +++ b/howto/instrumentation.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,143 +25,219 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/instrumentation.rst:7 msgid "Instrumenting CPython with DTrace and SystemTap" msgstr "" +#: ../../howto/instrumentation.rst:0 msgid "author" msgstr "" +#: ../../howto/instrumentation.rst:9 msgid "David Malcolm" msgstr "" +#: ../../howto/instrumentation.rst:10 msgid "Łukasz Langa" msgstr "" -msgid "DTrace and SystemTap are monitoring tools, each providing a way to inspect what the processes on a computer system are doing. They both use domain-specific languages allowing a user to write scripts which:" +#: ../../howto/instrumentation.rst:12 +msgid "" +"DTrace and SystemTap are monitoring tools, each providing a way to inspect " +"what the processes on a computer system are doing. They both use domain-" +"specific languages allowing a user to write scripts which:" msgstr "" +#: ../../howto/instrumentation.rst:16 msgid "filter which processes are to be observed" msgstr "" +#: ../../howto/instrumentation.rst:17 msgid "gather data from the processes of interest" msgstr "" +#: ../../howto/instrumentation.rst:18 msgid "generate reports on the data" msgstr "" -msgid "As of Python 3.6, CPython can be built with embedded \"markers\", also known as \"probes\", that can be observed by a DTrace or SystemTap script, making it easier to monitor what the CPython processes on a system are doing." +#: ../../howto/instrumentation.rst:20 +msgid "" +"As of Python 3.6, CPython can be built with embedded \"markers\", also known " +"as \"probes\", that can be observed by a DTrace or SystemTap script, making " +"it easier to monitor what the CPython processes on a system are doing." msgstr "" -msgid "DTrace markers are implementation details of the CPython interpreter. No guarantees are made about probe compatibility between versions of CPython. DTrace scripts can stop working or work incorrectly without warning when changing CPython versions." +#: ../../howto/instrumentation.rst:27 +msgid "" +"DTrace markers are implementation details of the CPython interpreter. No " +"guarantees are made about probe compatibility between versions of CPython. " +"DTrace scripts can stop working or work incorrectly without warning when " +"changing CPython versions." msgstr "" +#: ../../howto/instrumentation.rst:34 msgid "Enabling the static markers" msgstr "" -msgid "macOS comes with built-in support for DTrace. On Linux, in order to build CPython with the embedded markers for SystemTap, the SystemTap development tools must be installed." +#: ../../howto/instrumentation.rst:36 +msgid "" +"macOS comes with built-in support for DTrace. On Linux, in order to build " +"CPython with the embedded markers for SystemTap, the SystemTap development " +"tools must be installed." msgstr "" +#: ../../howto/instrumentation.rst:40 msgid "On a Linux machine, this can be done via::" msgstr "" +#: ../../howto/instrumentation.rst:42 msgid "$ yum install systemtap-sdt-devel" msgstr "" +#: ../../howto/instrumentation.rst:44 msgid "or::" msgstr "" +#: ../../howto/instrumentation.rst:46 msgid "$ sudo apt-get install systemtap-sdt-dev" msgstr "" -msgid "CPython must then be :option:`configured with the --with-dtrace option <--with-dtrace>`:" +#: ../../howto/instrumentation.rst:49 +msgid "" +"CPython must then be :option:`configured with the --with-dtrace option <--" +"with-dtrace>`:" msgstr "" +#: ../../howto/instrumentation.rst:52 msgid "checking for --with-dtrace... yes" msgstr "" -msgid "On macOS, you can list available DTrace probes by running a Python process in the background and listing all probes made available by the Python provider::" +#: ../../howto/instrumentation.rst:56 +msgid "" +"On macOS, you can list available DTrace probes by running a Python process " +"in the background and listing all probes made available by the Python " +"provider::" msgstr "" +#: ../../howto/instrumentation.rst:60 msgid "" "$ python3.6 -q &\n" "$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6\n" "\n" " ID PROVIDER MODULE FUNCTION NAME\n" -"29564 python18035 python3.6 _PyEval_EvalFrameDefault function-entry\n" -"29565 python18035 python3.6 dtrace_function_entry function-entry\n" -"29566 python18035 python3.6 _PyEval_EvalFrameDefault function-return\n" -"29567 python18035 python3.6 dtrace_function_return function-return\n" -"29568 python18035 python3.6 collect gc-done\n" -"29569 python18035 python3.6 collect gc-start\n" +"29564 python18035 python3.6 _PyEval_EvalFrameDefault " +"function-entry\n" +"29565 python18035 python3.6 dtrace_function_entry " +"function-entry\n" +"29566 python18035 python3.6 _PyEval_EvalFrameDefault " +"function-return\n" +"29567 python18035 python3.6 dtrace_function_return " +"function-return\n" +"29568 python18035 python3.6 collect gc-" +"done\n" +"29569 python18035 python3.6 collect gc-" +"start\n" "29570 python18035 python3.6 _PyEval_EvalFrameDefault line\n" "29571 python18035 python3.6 maybe_dtrace_line line" msgstr "" -msgid "On Linux, you can verify if the SystemTap static markers are present in the built binary by seeing if it contains a \".note.stapsdt\" section." +#: ../../howto/instrumentation.rst:73 +msgid "" +"On Linux, you can verify if the SystemTap static markers are present in the " +"built binary by seeing if it contains a \".note.stapsdt\" section." msgstr "" +#: ../../howto/instrumentation.rst:78 msgid "" "$ readelf -S ./python | grep .note.stapsdt\n" "[30] .note.stapsdt NOTE 0000000000000000 00308d78" msgstr "" -msgid "If you've built Python as a shared library (with the :option:`--enable-shared` configure option), you need to look instead within the shared library. For example::" +#: ../../howto/instrumentation.rst:81 +msgid "" +"If you've built Python as a shared library (with the :option:`--enable-" +"shared` configure option), you need to look instead within the shared " +"library. For example::" msgstr "" +#: ../../howto/instrumentation.rst:85 msgid "" "$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt\n" "[29] .note.stapsdt NOTE 0000000000000000 00365b68" msgstr "" +#: ../../howto/instrumentation.rst:88 msgid "Sufficiently modern readelf can print the metadata::" msgstr "" +#: ../../howto/instrumentation.rst:90 msgid "" "$ readelf -n ./python\n" "\n" "Displaying notes found at file offset 0x00000254 with length 0x00000020:\n" " Owner Data size Description\n" -" GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)\n" +" GNU 0x00000010 NT_GNU_ABI_TAG (ABI version " +"tag)\n" " OS: Linux, ABI: 2.6.32\n" "\n" "Displaying notes found at file offset 0x00000274 with length 0x00000024:\n" " Owner Data size Description\n" -" GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)\n" +" GNU 0x00000014 NT_GNU_BUILD_ID (unique build " +"ID bitstring)\n" " Build ID: df924a2b08a7e89f6e11251d4602022977af2670\n" "\n" "Displaying notes found at file offset 0x002d6c30 with length 0x00000144:\n" " Owner Data size Description\n" -" stapsdt 0x00000031 NT_STAPSDT (SystemTap probe descriptors)\n" +" stapsdt 0x00000031 NT_STAPSDT (SystemTap probe " +"descriptors)\n" " Provider: python\n" " Name: gc__start\n" -" Location: 0x00000000004371c3, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bf6\n" +" Location: 0x00000000004371c3, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bf6\n" " Arguments: -4@%ebx\n" -" stapsdt 0x00000030 NT_STAPSDT (SystemTap probe descriptors)\n" +" stapsdt 0x00000030 NT_STAPSDT (SystemTap probe " +"descriptors)\n" " Provider: python\n" " Name: gc__done\n" -" Location: 0x00000000004374e1, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bf8\n" +" Location: 0x00000000004374e1, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bf8\n" " Arguments: -8@%rax\n" -" stapsdt 0x00000045 NT_STAPSDT (SystemTap probe descriptors)\n" +" stapsdt 0x00000045 NT_STAPSDT (SystemTap probe " +"descriptors)\n" " Provider: python\n" " Name: function__entry\n" -" Location: 0x000000000053db6c, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6be8\n" +" Location: 0x000000000053db6c, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6be8\n" " Arguments: 8@%rbp 8@%r12 -4@%eax\n" -" stapsdt 0x00000046 NT_STAPSDT (SystemTap probe descriptors)\n" +" stapsdt 0x00000046 NT_STAPSDT (SystemTap probe " +"descriptors)\n" " Provider: python\n" " Name: function__return\n" -" Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bea\n" +" Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bea\n" " Arguments: 8@%rbp 8@%r12 -4@%eax" msgstr "" -msgid "The above metadata contains information for SystemTap describing how it can patch strategically placed machine code instructions to enable the tracing hooks used by a SystemTap script." +#: ../../howto/instrumentation.rst:125 +msgid "" +"The above metadata contains information for SystemTap describing how it can " +"patch strategically placed machine code instructions to enable the tracing " +"hooks used by a SystemTap script." msgstr "" +#: ../../howto/instrumentation.rst:131 msgid "Static DTrace probes" msgstr "" -msgid "The following example DTrace script can be used to show the call/return hierarchy of a Python script, only tracing within the invocation of a function called \"start\". In other words, import-time function invocations are not going to be listed:" +#: ../../howto/instrumentation.rst:133 +msgid "" +"The following example DTrace script can be used to show the call/return " +"hierarchy of a Python script, only tracing within the invocation of a " +"function called \"start\". In other words, import-time function invocations " +"are not going to be listed:" msgstr "" +#: ../../howto/instrumentation.rst:138 msgid "" "self int indent;\n" "\n" @@ -176,7 +252,8 @@ msgid "" "{\n" " printf(\"%d\\t%*s:\", timestamp, 15, probename);\n" " printf(\"%*s\", self->indent, \"\");\n" -" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), arg2);\n" +" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), " +"arg2);\n" " self->indent++;\n" "}\n" "\n" @@ -186,7 +263,8 @@ msgid "" " self->indent--;\n" " printf(\"%d\\t%*s:\", timestamp, 15, probename);\n" " printf(\"%*s\", self->indent, \"\");\n" -" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), arg2);\n" +" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), " +"arg2);\n" "}\n" "\n" "python$target:::function-return\n" @@ -196,15 +274,19 @@ msgid "" "}" msgstr "" +#: ../../howto/instrumentation.rst:172 ../../howto/instrumentation.rst:230 msgid "It can be invoked like this::" msgstr "" +#: ../../howto/instrumentation.rst:174 msgid "$ sudo dtrace -q -s call_stack.d -c \"python3.6 script.py\"" msgstr "" +#: ../../howto/instrumentation.rst:176 ../../howto/instrumentation.rst:236 msgid "The output looks like this:" msgstr "" +#: ../../howto/instrumentation.rst:178 msgid "" "156641360502280 function-entry:call_stack.py:start:23\n" "156641360518804 function-entry: call_stack.py:function_1:1\n" @@ -226,15 +308,24 @@ msgid "" "156641360747370 function-return:call_stack.py:start:28" msgstr "" +#: ../../howto/instrumentation.rst:201 msgid "Static SystemTap markers" msgstr "" -msgid "The low-level way to use the SystemTap integration is to use the static markers directly. This requires you to explicitly state the binary file containing them." +#: ../../howto/instrumentation.rst:203 +msgid "" +"The low-level way to use the SystemTap integration is to use the static " +"markers directly. This requires you to explicitly state the binary file " +"containing them." msgstr "" -msgid "For example, this SystemTap script can be used to show the call/return hierarchy of a Python script:" +#: ../../howto/instrumentation.rst:207 +msgid "" +"For example, this SystemTap script can be used to show the call/return " +"hierarchy of a Python script:" msgstr "" +#: ../../howto/instrumentation.rst:210 msgid "" "probe process(\"python\").mark(\"function__entry\") {\n" " filename = user_string($arg1);\n" @@ -255,12 +346,14 @@ msgid "" "}" msgstr "" +#: ../../howto/instrumentation.rst:232 msgid "" "$ stap \\\n" " show-call-hierarchy.stp \\\n" " -c \"./python test.py\"" msgstr "" +#: ../../howto/instrumentation.rst:238 msgid "" "11408 python(8274): => __contains__ in Lib/_abcoll.py:362\n" "11414 python(8274): => __getitem__ in Lib/os.py:425\n" @@ -270,156 +363,254 @@ msgid "" "11433 python(8274): <= __contains__ in Lib/_abcoll.py:366" msgstr "" +#: ../../howto/instrumentation.rst:247 msgid "where the columns are:" msgstr "" +#: ../../howto/instrumentation.rst:249 msgid "time in microseconds since start of script" msgstr "" +#: ../../howto/instrumentation.rst:250 msgid "name of executable" msgstr "" +#: ../../howto/instrumentation.rst:251 msgid "PID of process" msgstr "" -msgid "and the remainder indicates the call/return hierarchy as the script executes." +#: ../../howto/instrumentation.rst:253 +msgid "" +"and the remainder indicates the call/return hierarchy as the script executes." msgstr "" -msgid "For a :option:`--enable-shared` build of CPython, the markers are contained within the libpython shared library, and the probe's dotted path needs to reflect this. For example, this line from the above example:" +#: ../../howto/instrumentation.rst:255 +msgid "" +"For a :option:`--enable-shared` build of CPython, the markers are contained " +"within the libpython shared library, and the probe's dotted path needs to " +"reflect this. For example, this line from the above example:" msgstr "" +#: ../../howto/instrumentation.rst:259 msgid "probe process(\"python\").mark(\"function__entry\") {" msgstr "" +#: ../../howto/instrumentation.rst:263 msgid "should instead read:" msgstr "" -msgid "probe process(\"python\").library(\"libpython3.6dm.so.1.0\").mark(\"function__entry\") {" +#: ../../howto/instrumentation.rst:265 +msgid "" +"probe " +"process(\"python\").library(\"libpython3.6dm.so.1.0\").mark(\"function__entry\") " +"{" msgstr "" +#: ../../howto/instrumentation.rst:269 msgid "(assuming a :ref:`debug build ` of CPython 3.6)" msgstr "" +#: ../../howto/instrumentation.rst:275 msgid "Available static markers" msgstr "" -msgid "This marker indicates that execution of a Python function has begun. It is only triggered for pure-Python (bytecode) functions." +#: ../../howto/instrumentation.rst:279 +msgid "" +"This marker indicates that execution of a Python function has begun. It is " +"only triggered for pure-Python (bytecode) functions." msgstr "" -msgid "The filename, function name, and line number are provided back to the tracing script as positional arguments, which must be accessed using ``$arg1``, ``$arg2``, ``$arg3``:" +#: ../../howto/instrumentation.rst:282 +msgid "" +"The filename, function name, and line number are provided back to the " +"tracing script as positional arguments, which must be accessed using " +"``$arg1``, ``$arg2``, ``$arg3``:" msgstr "" -msgid "``$arg1`` : ``(const char *)`` filename, accessible using ``user_string($arg1)``" +#: ../../howto/instrumentation.rst:286 +msgid "" +"``$arg1`` : ``(const char *)`` filename, accessible using " +"``user_string($arg1)``" msgstr "" -msgid "``$arg2`` : ``(const char *)`` function name, accessible using ``user_string($arg2)``" +#: ../../howto/instrumentation.rst:288 +msgid "" +"``$arg2`` : ``(const char *)`` function name, accessible using " +"``user_string($arg2)``" msgstr "" +#: ../../howto/instrumentation.rst:291 msgid "``$arg3`` : ``int`` line number" msgstr "" -msgid "This marker is the converse of :c:func:`!function__entry`, and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions." +#: ../../howto/instrumentation.rst:295 +msgid "" +"This marker is the converse of :c:func:`!function__entry`, and indicates " +"that execution of a Python function has ended (either via ``return``, or via " +"an exception). It is only triggered for pure-Python (bytecode) functions." msgstr "" +#: ../../howto/instrumentation.rst:299 msgid "The arguments are the same as for :c:func:`!function__entry`" msgstr "" -msgid "This marker indicates a Python line is about to be executed. It is the equivalent of line-by-line tracing with a Python profiler. It is not triggered within C functions." +#: ../../howto/instrumentation.rst:303 +msgid "" +"This marker indicates a Python line is about to be executed. It is the " +"equivalent of line-by-line tracing with a Python profiler. It is not " +"triggered within C functions." msgstr "" +#: ../../howto/instrumentation.rst:307 msgid "The arguments are the same as for :c:func:`!function__entry`." msgstr "" -msgid "Fires when the Python interpreter starts a garbage collection cycle. ``arg0`` is the generation to scan, like :func:`gc.collect`." +#: ../../howto/instrumentation.rst:311 +msgid "" +"Fires when the Python interpreter starts a garbage collection cycle. " +"``arg0`` is the generation to scan, like :func:`gc.collect`." msgstr "" -msgid "Fires when the Python interpreter finishes a garbage collection cycle. ``arg0`` is the number of collected objects." +#: ../../howto/instrumentation.rst:316 +msgid "" +"Fires when the Python interpreter finishes a garbage collection cycle. " +"``arg0`` is the number of collected objects." msgstr "" -msgid "Fires before :mod:`importlib` attempts to find and load the module. ``arg0`` is the module name." +#: ../../howto/instrumentation.rst:321 +msgid "" +"Fires before :mod:`importlib` attempts to find and load the module. ``arg0`` " +"is the module name." msgstr "" -msgid "Fires after :mod:`importlib`'s find_and_load function is called. ``arg0`` is the module name, ``arg1`` indicates if module was successfully loaded." +#: ../../howto/instrumentation.rst:328 +msgid "" +"Fires after :mod:`importlib`'s find_and_load function is called. ``arg0`` is " +"the module name, ``arg1`` indicates if module was successfully loaded." msgstr "" -msgid "Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is the event name as C string, ``arg1`` is a :c:type:`PyObject` pointer to a tuple object." +#: ../../howto/instrumentation.rst:337 +msgid "" +"Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is " +"the event name as C string, ``arg1`` is a :c:type:`PyObject` pointer to a " +"tuple object." msgstr "" +#: ../../howto/instrumentation.rst:345 msgid "C Entry Points" msgstr "" -msgid "To simplify triggering of DTrace markers, Python's C API comes with a number of helper functions that mirror each static marker. On builds of Python without DTrace enabled, these do nothing." +#: ../../howto/instrumentation.rst:347 +msgid "" +"To simplify triggering of DTrace markers, Python's C API comes with a number " +"of helper functions that mirror each static marker. On builds of Python " +"without DTrace enabled, these do nothing." msgstr "" -msgid "In general, it is not necessary to call these yourself, as Python will do it for you." +#: ../../howto/instrumentation.rst:351 +msgid "" +"In general, it is not necessary to call these yourself, as Python will do it " +"for you." msgstr "" +#: ../../howto/instrumentation.rst:358 msgid "C API Function" msgstr "" +#: ../../howto/instrumentation.rst:359 msgid "Static Marker" msgstr "" +#: ../../howto/instrumentation.rst:360 msgid "Notes" msgstr "" +#: ../../howto/instrumentation.rst:362 msgid ":c:func:`!line`" msgstr "" +#: ../../howto/instrumentation.rst:365 msgid ":c:func:`!function__entry`" msgstr "" +#: ../../howto/instrumentation.rst:368 msgid ":c:func:`!function__return`" msgstr "" +#: ../../howto/instrumentation.rst:371 msgid ":c:func:`!gc__start`" msgstr "" +#: ../../howto/instrumentation.rst:374 msgid ":c:func:`!gc__done`" msgstr "" +#: ../../howto/instrumentation.rst:377 msgid ":c:func:`!instance__new__start`" msgstr "" +#: ../../howto/instrumentation.rst:378 ../../howto/instrumentation.rst:381 +#: ../../howto/instrumentation.rst:384 ../../howto/instrumentation.rst:387 msgid "Not used by Python" msgstr "" +#: ../../howto/instrumentation.rst:380 msgid ":c:func:`!instance__new__done`" msgstr "" +#: ../../howto/instrumentation.rst:383 msgid ":c:func:`!instance__delete__start`" msgstr "" +#: ../../howto/instrumentation.rst:386 msgid ":c:func:`!instance__delete__done`" msgstr "" +#: ../../howto/instrumentation.rst:389 msgid ":c:func:`!import__find__load__start`" msgstr "" +#: ../../howto/instrumentation.rst:392 msgid ":c:func:`!import__find__load__done`" msgstr "" +#: ../../howto/instrumentation.rst:395 msgid ":c:func:`!audit`" msgstr "" +#: ../../howto/instrumentation.rst:400 msgid "C Probing Checks" msgstr "" -msgid "All calls to ``PyDTrace`` functions must be guarded by a call to one of these functions. This allows Python to minimize performance impact when probing is disabled." +#: ../../howto/instrumentation.rst:415 +msgid "" +"All calls to ``PyDTrace`` functions must be guarded by a call to one of " +"these functions. This allows Python to minimize performance impact when " +"probing is disabled." msgstr "" -msgid "On builds without DTrace enabled, these functions do nothing and return ``0``." +#: ../../howto/instrumentation.rst:419 +msgid "" +"On builds without DTrace enabled, these functions do nothing and return " +"``0``." msgstr "" +#: ../../howto/instrumentation.rst:423 msgid "SystemTap Tapsets" msgstr "" -msgid "The higher-level way to use the SystemTap integration is to use a \"tapset\": SystemTap's equivalent of a library, which hides some of the lower-level details of the static markers." +#: ../../howto/instrumentation.rst:425 +msgid "" +"The higher-level way to use the SystemTap integration is to use a " +"\"tapset\": SystemTap's equivalent of a library, which hides some of the " +"lower-level details of the static markers." msgstr "" +#: ../../howto/instrumentation.rst:429 msgid "Here is a tapset file, based on a non-shared build of CPython:" msgstr "" +#: ../../howto/instrumentation.rst:431 msgid "" "/*\n" " Provide a higher-level wrapping around the function__entry and\n" @@ -432,7 +623,8 @@ msgid "" " lineno = $arg3;\n" " frameptr = $arg4\n" "}\n" -"probe python.function.return = process(\"python\").mark(\"function__return\")\n" +"probe python.function.return = " +"process(\"python\").mark(\"function__return\")\n" "{\n" " filename = user_string($arg1);\n" " funcname = user_string($arg2);\n" @@ -441,21 +633,38 @@ msgid "" "}" msgstr "" -msgid "If this file is installed in SystemTap's tapset directory (e.g. ``/usr/share/systemtap/tapset``), then these additional probepoints become available:" +#: ../../howto/instrumentation.rst:452 +msgid "" +"If this file is installed in SystemTap's tapset directory (e.g. ``/usr/share/" +"systemtap/tapset``), then these additional probepoints become available:" msgstr "" -msgid "This probe point indicates that execution of a Python function has begun. It is only triggered for pure-Python (bytecode) functions." +#: ../../howto/instrumentation.rst:458 +msgid "" +"This probe point indicates that execution of a Python function has begun. It " +"is only triggered for pure-Python (bytecode) functions." msgstr "" -msgid "This probe point is the converse of ``python.function.return``, and indicates that execution of a Python function has ended (either via ``return``, or via an exception). It is only triggered for pure-Python (bytecode) functions." +#: ../../howto/instrumentation.rst:463 +msgid "" +"This probe point is the converse of ``python.function.return``, and " +"indicates that execution of a Python function has ended (either via " +"``return``, or via an exception). It is only triggered for pure-Python " +"(bytecode) functions." msgstr "" +#: ../../howto/instrumentation.rst:470 msgid "Examples" msgstr "" -msgid "This SystemTap script uses the tapset above to more cleanly implement the example given above of tracing the Python function-call hierarchy, without needing to directly name the static markers:" +#: ../../howto/instrumentation.rst:471 +msgid "" +"This SystemTap script uses the tapset above to more cleanly implement the " +"example given above of tracing the Python function-call hierarchy, without " +"needing to directly name the static markers:" msgstr "" +#: ../../howto/instrumentation.rst:475 msgid "" "probe python.function.entry\n" "{\n" @@ -470,9 +679,14 @@ msgid "" "}" msgstr "" -msgid "The following script uses the tapset above to provide a top-like view of all running CPython code, showing the top 20 most frequently entered bytecode frames, each second, across the whole system:" +#: ../../howto/instrumentation.rst:490 +msgid "" +"The following script uses the tapset above to provide a top-like view of all " +"running CPython code, showing the top 20 most frequently entered bytecode " +"frames, each second, across the whole system:" msgstr "" +#: ../../howto/instrumentation.rst:494 msgid "" "global fn_calls;\n" "\n" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 39ff0be20..973ce2d99 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,48 +24,89 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/ipaddress.rst:9 msgid "An introduction to the ipaddress module" msgstr "" +#: ../../howto/ipaddress.rst:0 msgid "author" msgstr "" +#: ../../howto/ipaddress.rst:11 msgid "Peter Moody" msgstr "" +#: ../../howto/ipaddress.rst:12 msgid "Nick Coghlan" msgstr "" +#: ../../howto/ipaddress.rst:-1 msgid "Overview" msgstr "" -msgid "This document aims to provide a gentle introduction to the :mod:`ipaddress` module. It is aimed primarily at users that aren't already familiar with IP networking terminology, but may also be useful to network engineers wanting an overview of how :mod:`ipaddress` represents IP network addressing concepts." +#: ../../howto/ipaddress.rst:16 +msgid "" +"This document aims to provide a gentle introduction to the :mod:`ipaddress` " +"module. It is aimed primarily at users that aren't already familiar with IP " +"networking terminology, but may also be useful to network engineers wanting " +"an overview of how :mod:`ipaddress` represents IP network addressing " +"concepts." msgstr "" +#: ../../howto/ipaddress.rst:24 msgid "Creating Address/Network/Interface objects" msgstr "" -msgid "Since :mod:`ipaddress` is a module for inspecting and manipulating IP addresses, the first thing you'll want to do is create some objects. You can use :mod:`ipaddress` to create objects from strings and integers." +#: ../../howto/ipaddress.rst:26 +msgid "" +"Since :mod:`ipaddress` is a module for inspecting and manipulating IP " +"addresses, the first thing you'll want to do is create some objects. You " +"can use :mod:`ipaddress` to create objects from strings and integers." msgstr "" +#: ../../howto/ipaddress.rst:32 msgid "A Note on IP Versions" msgstr "" -msgid "For readers that aren't particularly familiar with IP addressing, it's important to know that the Internet Protocol (IP) is currently in the process of moving from version 4 of the protocol to version 6. This transition is occurring largely because version 4 of the protocol doesn't provide enough addresses to handle the needs of the whole world, especially given the increasing number of devices with direct connections to the internet." +#: ../../howto/ipaddress.rst:34 +msgid "" +"For readers that aren't particularly familiar with IP addressing, it's " +"important to know that the Internet Protocol (IP) is currently in the " +"process of moving from version 4 of the protocol to version 6. This " +"transition is occurring largely because version 4 of the protocol doesn't " +"provide enough addresses to handle the needs of the whole world, especially " +"given the increasing number of devices with direct connections to the " +"internet." msgstr "" -msgid "Explaining the details of the differences between the two versions of the protocol is beyond the scope of this introduction, but readers need to at least be aware that these two versions exist, and it will sometimes be necessary to force the use of one version or the other." +#: ../../howto/ipaddress.rst:41 +msgid "" +"Explaining the details of the differences between the two versions of the " +"protocol is beyond the scope of this introduction, but readers need to at " +"least be aware that these two versions exist, and it will sometimes be " +"necessary to force the use of one version or the other." msgstr "" +#: ../../howto/ipaddress.rst:48 msgid "IP Host Addresses" msgstr "" -msgid "Addresses, often referred to as \"host addresses\" are the most basic unit when working with IP addressing. The simplest way to create addresses is to use the :func:`ipaddress.ip_address` factory function, which automatically determines whether to create an IPv4 or IPv6 address based on the passed in value:" +#: ../../howto/ipaddress.rst:50 +msgid "" +"Addresses, often referred to as \"host addresses\" are the most basic unit " +"when working with IP addressing. The simplest way to create addresses is to " +"use the :func:`ipaddress.ip_address` factory function, which automatically " +"determines whether to create an IPv4 or IPv6 address based on the passed in " +"value:" msgstr "" -msgid "Addresses can also be created directly from integers. Values that will fit within 32 bits are assumed to be IPv4 addresses::" +#: ../../howto/ipaddress.rst:61 +msgid "" +"Addresses can also be created directly from integers. Values that will fit " +"within 32 bits are assumed to be IPv4 addresses::" msgstr "" +#: ../../howto/ipaddress.rst:64 msgid "" ">>> ipaddress.ip_address(3221225985)\n" "IPv4Address('192.0.2.1')\n" @@ -73,9 +114,14 @@ msgid "" "IPv6Address('2001:db8::1')" msgstr "" -msgid "To force the use of IPv4 or IPv6 addresses, the relevant classes can be invoked directly. This is particularly useful to force creation of IPv6 addresses for small integers::" +#: ../../howto/ipaddress.rst:69 +msgid "" +"To force the use of IPv4 or IPv6 addresses, the relevant classes can be " +"invoked directly. This is particularly useful to force creation of IPv6 " +"addresses for small integers::" msgstr "" +#: ../../howto/ipaddress.rst:73 msgid "" ">>> ipaddress.ip_address(1)\n" "IPv4Address('0.0.0.1')\n" @@ -85,15 +131,29 @@ msgid "" "IPv6Address('::1')" msgstr "" +#: ../../howto/ipaddress.rst:82 msgid "Defining Networks" msgstr "" -msgid "Host addresses are usually grouped together into IP networks, so :mod:`ipaddress` provides a way to create, inspect and manipulate network definitions. IP network objects are constructed from strings that define the range of host addresses that are part of that network. The simplest form for that information is a \"network address/network prefix\" pair, where the prefix defines the number of leading bits that are compared to determine whether or not an address is part of the network and the network address defines the expected value of those bits." +#: ../../howto/ipaddress.rst:84 +msgid "" +"Host addresses are usually grouped together into IP networks, " +"so :mod:`ipaddress` provides a way to create, inspect and manipulate network " +"definitions. IP network objects are constructed from strings that define the " +"range of host addresses that are part of that network. The simplest form for " +"that information is a \"network address/network prefix\" pair, where the " +"prefix defines the number of leading bits that are compared to determine " +"whether or not an address is part of the network and the network address " +"defines the expected value of those bits." msgstr "" -msgid "As for addresses, a factory function is provided that determines the correct IP version automatically::" +#: ../../howto/ipaddress.rst:93 +msgid "" +"As for addresses, a factory function is provided that determines the correct " +"IP version automatically::" msgstr "" +#: ../../howto/ipaddress.rst:96 msgid "" ">>> ipaddress.ip_network('192.0.2.0/24')\n" "IPv4Network('192.0.2.0/24')\n" @@ -101,12 +161,24 @@ msgid "" "IPv6Network('2001:db8::/96')" msgstr "" -msgid "Network objects cannot have any host bits set. The practical effect of this is that ``192.0.2.1/24`` does not describe a network. Such definitions are referred to as interface objects since the ip-on-a-network notation is commonly used to describe network interfaces of a computer on a given network and are described further in the next section." +#: ../../howto/ipaddress.rst:101 +msgid "" +"Network objects cannot have any host bits set. The practical effect of this " +"is that ``192.0.2.1/24`` does not describe a network. Such definitions are " +"referred to as interface objects since the ip-on-a-network notation is " +"commonly used to describe network interfaces of a computer on a given " +"network and are described further in the next section." msgstr "" -msgid "By default, attempting to create a network object with host bits set will result in :exc:`ValueError` being raised. To request that the additional bits instead be coerced to zero, the flag ``strict=False`` can be passed to the constructor::" +#: ../../howto/ipaddress.rst:107 +msgid "" +"By default, attempting to create a network object with host bits set will " +"result in :exc:`ValueError` being raised. To request that the additional " +"bits instead be coerced to zero, the flag ``strict=False`` can be passed to " +"the constructor::" msgstr "" +#: ../../howto/ipaddress.rst:112 msgid "" ">>> ipaddress.ip_network('192.0.2.1/24')\n" "Traceback (most recent call last):\n" @@ -116,9 +188,15 @@ msgid "" "IPv4Network('192.0.2.0/24')" msgstr "" -msgid "While the string form offers significantly more flexibility, networks can also be defined with integers, just like host addresses. In this case, the network is considered to contain only the single address identified by the integer, so the network prefix includes the entire network address::" +#: ../../howto/ipaddress.rst:119 +msgid "" +"While the string form offers significantly more flexibility, networks can " +"also be defined with integers, just like host addresses. In this case, the " +"network is considered to contain only the single address identified by the " +"integer, so the network prefix includes the entire network address::" msgstr "" +#: ../../howto/ipaddress.rst:124 msgid "" ">>> ipaddress.ip_network(3221225984)\n" "IPv4Network('192.0.2.0/32')\n" @@ -126,27 +204,51 @@ msgid "" "IPv6Network('2001:db8::/128')" msgstr "" -msgid "As with addresses, creation of a particular kind of network can be forced by calling the class constructor directly instead of using the factory function." +#: ../../howto/ipaddress.rst:129 +msgid "" +"As with addresses, creation of a particular kind of network can be forced by " +"calling the class constructor directly instead of using the factory function." msgstr "" +#: ../../howto/ipaddress.rst:135 msgid "Host Interfaces" msgstr "" -msgid "As mentioned just above, if you need to describe an address on a particular network, neither the address nor the network classes are sufficient. Notation like ``192.0.2.1/24`` is commonly used by network engineers and the people who write tools for firewalls and routers as shorthand for \"the host ``192.0.2.1`` on the network ``192.0.2.0/24``\", Accordingly, :mod:`ipaddress` provides a set of hybrid classes that associate an address with a particular network. The interface for creation is identical to that for defining network objects, except that the address portion isn't constrained to being a network address." -msgstr "" - -msgid "Integer inputs are accepted (as with networks), and use of a particular IP version can be forced by calling the relevant constructor directly." +#: ../../howto/ipaddress.rst:137 +msgid "" +"As mentioned just above, if you need to describe an address on a particular " +"network, neither the address nor the network classes are sufficient. " +"Notation like ``192.0.2.1/24`` is commonly used by network engineers and the " +"people who write tools for firewalls and routers as shorthand for \"the host " +"``192.0.2.1`` on the network ``192.0.2.0/24``\", " +"Accordingly, :mod:`ipaddress` provides a set of hybrid classes that " +"associate an address with a particular network. The interface for creation " +"is identical to that for defining network objects, except that the address " +"portion isn't constrained to being a network address." +msgstr "" + +#: ../../howto/ipaddress.rst:152 +msgid "" +"Integer inputs are accepted (as with networks), and use of a particular IP " +"version can be forced by calling the relevant constructor directly." msgstr "" +#: ../../howto/ipaddress.rst:157 msgid "Inspecting Address/Network/Interface Objects" msgstr "" -msgid "You've gone to the trouble of creating an IPv(4|6)(Address|Network|Interface) object, so you probably want to get information about it. :mod:`ipaddress` tries to make doing this easy and intuitive." +#: ../../howto/ipaddress.rst:159 +msgid "" +"You've gone to the trouble of creating an IPv(4|6)(Address|Network|" +"Interface) object, so you probably want to get information about " +"it. :mod:`ipaddress` tries to make doing this easy and intuitive." msgstr "" +#: ../../howto/ipaddress.rst:163 msgid "Extracting the IP version::" msgstr "" +#: ../../howto/ipaddress.rst:165 msgid "" ">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" ">>> addr6 = ipaddress.ip_address('2001:db8::1')\n" @@ -156,9 +258,11 @@ msgid "" "4" msgstr "" +#: ../../howto/ipaddress.rst:172 msgid "Obtaining the network from an interface::" msgstr "" +#: ../../howto/ipaddress.rst:174 msgid "" ">>> host4 = ipaddress.ip_interface('192.0.2.1/24')\n" ">>> host4.network\n" @@ -168,9 +272,11 @@ msgid "" "IPv6Network('2001:db8::/96')" msgstr "" +#: ../../howto/ipaddress.rst:181 msgid "Finding out how many individual addresses are in a network::" msgstr "" +#: ../../howto/ipaddress.rst:183 msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> net4.num_addresses\n" @@ -180,9 +286,11 @@ msgid "" "4294967296" msgstr "" +#: ../../howto/ipaddress.rst:190 msgid "Iterating through the \"usable\" addresses on a network::" msgstr "" +#: ../../howto/ipaddress.rst:192 msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" @@ -197,12 +305,17 @@ msgid "" "192.0.2.254" msgstr "" -msgid "Obtaining the netmask (i.e. set bits corresponding to the network prefix) or the hostmask (any bits that are not part of the netmask):" +#: ../../howto/ipaddress.rst:205 +msgid "" +"Obtaining the netmask (i.e. set bits corresponding to the network prefix) or " +"the hostmask (any bits that are not part of the netmask):" msgstr "" +#: ../../howto/ipaddress.rst:220 msgid "Exploding or compressing the address::" msgstr "" +#: ../../howto/ipaddress.rst:222 msgid "" ">>> addr6.exploded\n" "'2001:0db8:0000:0000:0000:0000:0000:0001'\n" @@ -214,15 +327,25 @@ msgid "" "'2001:db8::/96'" msgstr "" -msgid "While IPv4 doesn't support explosion or compression, the associated objects still provide the relevant properties so that version neutral code can easily ensure the most concise or most verbose form is used for IPv6 addresses while still correctly handling IPv4 addresses." +#: ../../howto/ipaddress.rst:231 +msgid "" +"While IPv4 doesn't support explosion or compression, the associated objects " +"still provide the relevant properties so that version neutral code can " +"easily ensure the most concise or most verbose form is used for IPv6 " +"addresses while still correctly handling IPv4 addresses." msgstr "" +#: ../../howto/ipaddress.rst:238 msgid "Networks as lists of Addresses" msgstr "" -msgid "It's sometimes useful to treat networks as lists. This means it is possible to index them like this::" +#: ../../howto/ipaddress.rst:240 +msgid "" +"It's sometimes useful to treat networks as lists. This means it is possible " +"to index them like this::" msgstr "" +#: ../../howto/ipaddress.rst:243 msgid "" ">>> net4[1]\n" "IPv4Address('192.0.2.1')\n" @@ -234,17 +357,23 @@ msgid "" "IPv6Address('2001:db8::ffff:ffff')" msgstr "" -msgid "It also means that network objects lend themselves to using the list membership test syntax like this::" +#: ../../howto/ipaddress.rst:253 +msgid "" +"It also means that network objects lend themselves to using the list " +"membership test syntax like this::" msgstr "" +#: ../../howto/ipaddress.rst:256 msgid "" "if address in network:\n" " # do something" msgstr "" +#: ../../howto/ipaddress.rst:259 msgid "Containment testing is done efficiently based on the network prefix::" msgstr "" +#: ../../howto/ipaddress.rst:261 msgid "" ">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" ">>> addr4 in ipaddress.ip_network('192.0.2.0/24')\n" @@ -253,26 +382,40 @@ msgid "" "False" msgstr "" +#: ../../howto/ipaddress.rst:269 msgid "Comparisons" msgstr "" -msgid ":mod:`ipaddress` provides some simple, hopefully intuitive ways to compare objects, where it makes sense::" +#: ../../howto/ipaddress.rst:271 +msgid "" +":mod:`ipaddress` provides some simple, hopefully intuitive ways to compare " +"objects, where it makes sense::" msgstr "" +#: ../../howto/ipaddress.rst:274 msgid "" ">>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2')\n" "True" msgstr "" -msgid "A :exc:`TypeError` exception is raised if you try to compare objects of different versions or different types." +#: ../../howto/ipaddress.rst:277 +msgid "" +"A :exc:`TypeError` exception is raised if you try to compare objects of " +"different versions or different types." msgstr "" +#: ../../howto/ipaddress.rst:282 msgid "Using IP Addresses with other modules" msgstr "" -msgid "Other modules that use IP addresses (such as :mod:`socket`) usually won't accept objects from this module directly. Instead, they must be coerced to an integer or string that the other module will accept::" +#: ../../howto/ipaddress.rst:284 +msgid "" +"Other modules that use IP addresses (such as :mod:`socket`) usually won't " +"accept objects from this module directly. Instead, they must be coerced to " +"an integer or string that the other module will accept::" msgstr "" +#: ../../howto/ipaddress.rst:288 msgid "" ">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" ">>> str(addr4)\n" @@ -281,18 +424,36 @@ msgid "" "3221225985" msgstr "" +#: ../../howto/ipaddress.rst:296 msgid "Getting more detail when instance creation fails" msgstr "" -msgid "When creating address/network/interface objects using the version-agnostic factory functions, any errors will be reported as :exc:`ValueError` with a generic error message that simply says the passed in value was not recognized as an object of that type. The lack of a specific error is because it's necessary to know whether the value is *supposed* to be IPv4 or IPv6 in order to provide more detail on why it has been rejected." +#: ../../howto/ipaddress.rst:298 +msgid "" +"When creating address/network/interface objects using the version-agnostic " +"factory functions, any errors will be reported as :exc:`ValueError` with a " +"generic error message that simply says the passed in value was not " +"recognized as an object of that type. The lack of a specific error is " +"because it's necessary to know whether the value is *supposed* to be IPv4 or " +"IPv6 in order to provide more detail on why it has been rejected." msgstr "" -msgid "To support use cases where it is useful to have access to this additional detail, the individual class constructors actually raise the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the definition failed to parse correctly." +#: ../../howto/ipaddress.rst:305 +msgid "" +"To support use cases where it is useful to have access to this additional " +"detail, the individual class constructors actually raise " +"the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` " +"and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the " +"definition failed to parse correctly." msgstr "" -msgid "The error messages are significantly more detailed when using the class constructors directly. For example::" +#: ../../howto/ipaddress.rst:311 +msgid "" +"The error messages are significantly more detailed when using the class " +"constructors directly. For example::" msgstr "" +#: ../../howto/ipaddress.rst:314 msgid "" ">>> ipaddress.ip_address(\"192.168.0.256\")\n" "Traceback (most recent call last):\n" @@ -301,7 +462,8 @@ msgid "" ">>> ipaddress.IPv4Address(\"192.168.0.256\")\n" "Traceback (most recent call last):\n" " ...\n" -"ipaddress.AddressValueError: Octet 256 (> 255) not permitted in '192.168.0.256'\n" +"ipaddress.AddressValueError: Octet 256 (> 255) not permitted in " +"'192.168.0.256'\n" "\n" ">>> ipaddress.ip_network(\"192.168.0.1/64\")\n" "Traceback (most recent call last):\n" @@ -313,9 +475,14 @@ msgid "" "ipaddress.NetmaskValueError: '64' is not a valid netmask" msgstr "" -msgid "However, both of the module specific exceptions have :exc:`ValueError` as their parent class, so if you're not concerned with the particular type of error, you can still write code like the following::" +#: ../../howto/ipaddress.rst:332 +msgid "" +"However, both of the module specific exceptions have :exc:`ValueError` as " +"their parent class, so if you're not concerned with the particular type of " +"error, you can still write code like the following::" msgstr "" +#: ../../howto/ipaddress.rst:336 msgid "" "try:\n" " network = ipaddress.IPv4Network(address)\n" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 881a4a6b4..71c8b3b86 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2022-11-05 19:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,66 +24,139 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/isolating-extensions.rst:7 msgid "Isolating Extension Modules" msgstr "" +#: ../../howto/isolating-extensions.rst:-1 msgid "Abstract" msgstr "" -msgid "Traditionally, state belonging to Python extension modules was kept in C ``static`` variables, which have process-wide scope. This document describes problems of such per-process state and shows a safer way: per-module state." +#: ../../howto/isolating-extensions.rst:11 +msgid "" +"Traditionally, state belonging to Python extension modules was kept in C " +"``static`` variables, which have process-wide scope. This document describes " +"problems of such per-process state and shows a safer way: per-module state." msgstr "" -msgid "The document also describes how to switch to per-module state where possible. This transition involves allocating space for that state, potentially switching from static types to heap types, and—perhaps most importantly—accessing per-module state from code." +#: ../../howto/isolating-extensions.rst:16 +msgid "" +"The document also describes how to switch to per-module state where " +"possible. This transition involves allocating space for that state, " +"potentially switching from static types to heap types, and—perhaps most " +"importantly—accessing per-module state from code." msgstr "" +#: ../../howto/isolating-extensions.rst:23 msgid "Who should read this" msgstr "" -msgid "This guide is written for maintainers of :ref:`C-API ` extensions who would like to make that extension safer to use in applications where Python itself is used as a library." +#: ../../howto/isolating-extensions.rst:25 +msgid "" +"This guide is written for maintainers of :ref:`C-API ` " +"extensions who would like to make that extension safer to use in " +"applications where Python itself is used as a library." msgstr "" +#: ../../howto/isolating-extensions.rst:31 msgid "Background" msgstr "" -msgid "An *interpreter* is the context in which Python code runs. It contains configuration (e.g. the import path) and runtime state (e.g. the set of imported modules)." +#: ../../howto/isolating-extensions.rst:33 +msgid "" +"An *interpreter* is the context in which Python code runs. It contains " +"configuration (e.g. the import path) and runtime state (e.g. the set of " +"imported modules)." msgstr "" -msgid "Python supports running multiple interpreters in one process. There are two cases to think about—users may run interpreters:" +#: ../../howto/isolating-extensions.rst:37 +msgid "" +"Python supports running multiple interpreters in one process. There are two " +"cases to think about—users may run interpreters:" msgstr "" -msgid "in sequence, with several :c:func:`Py_InitializeEx`/:c:func:`Py_FinalizeEx` cycles, and" +#: ../../howto/isolating-extensions.rst:40 +msgid "" +"in sequence, with several :c:func:`Py_InitializeEx`/:c:func:`Py_FinalizeEx` " +"cycles, and" msgstr "" -msgid "in parallel, managing \"sub-interpreters\" using :c:func:`Py_NewInterpreter`/:c:func:`Py_EndInterpreter`." +#: ../../howto/isolating-extensions.rst:42 +msgid "" +"in parallel, managing \"sub-interpreters\" " +"using :c:func:`Py_NewInterpreter`/:c:func:`Py_EndInterpreter`." msgstr "" -msgid "Both cases (and combinations of them) would be most useful when embedding Python within a library. Libraries generally shouldn't make assumptions about the application that uses them, which include assuming a process-wide \"main Python interpreter\"." +#: ../../howto/isolating-extensions.rst:45 +msgid "" +"Both cases (and combinations of them) would be most useful when embedding " +"Python within a library. Libraries generally shouldn't make assumptions " +"about the application that uses them, which include assuming a process-wide " +"\"main Python interpreter\"." msgstr "" -msgid "Historically, Python extension modules don't handle this use case well. Many extension modules (and even some stdlib modules) use *per-process* global state, because C ``static`` variables are extremely easy to use. Thus, data that should be specific to an interpreter ends up being shared between interpreters. Unless the extension developer is careful, it is very easy to introduce edge cases that lead to crashes when a module is loaded in more than one interpreter in the same process." +#: ../../howto/isolating-extensions.rst:50 +msgid "" +"Historically, Python extension modules don't handle this use case well. Many " +"extension modules (and even some stdlib modules) use *per-process* global " +"state, because C ``static`` variables are extremely easy to use. Thus, data " +"that should be specific to an interpreter ends up being shared between " +"interpreters. Unless the extension developer is careful, it is very easy to " +"introduce edge cases that lead to crashes when a module is loaded in more " +"than one interpreter in the same process." msgstr "" -msgid "Unfortunately, *per-interpreter* state is not easy to achieve. Extension authors tend to not keep multiple interpreters in mind when developing, and it is currently cumbersome to test the behavior." +#: ../../howto/isolating-extensions.rst:58 +msgid "" +"Unfortunately, *per-interpreter* state is not easy to achieve. Extension " +"authors tend to not keep multiple interpreters in mind when developing, and " +"it is currently cumbersome to test the behavior." msgstr "" +#: ../../howto/isolating-extensions.rst:63 msgid "Enter Per-Module State" msgstr "" -msgid "Instead of focusing on per-interpreter state, Python's C API is evolving to better support the more granular *per-module* state. This means that C-level data should be attached to a *module object*. Each interpreter creates its own module object, keeping the data separate. For testing the isolation, multiple module objects corresponding to a single extension can even be loaded in a single interpreter." +#: ../../howto/isolating-extensions.rst:65 +msgid "" +"Instead of focusing on per-interpreter state, Python's C API is evolving to " +"better support the more granular *per-module* state. This means that C-level " +"data should be attached to a *module object*. Each interpreter creates its " +"own module object, keeping the data separate. For testing the isolation, " +"multiple module objects corresponding to a single extension can even be " +"loaded in a single interpreter." msgstr "" -msgid "Per-module state provides an easy way to think about lifetime and resource ownership: the extension module will initialize when a module object is created, and clean up when it's freed. In this regard, a module is just like any other :c:expr:`PyObject *`; there are no \"on interpreter shutdown\" hooks to think—or forget—about." +#: ../../howto/isolating-extensions.rst:72 +msgid "" +"Per-module state provides an easy way to think about lifetime and resource " +"ownership: the extension module will initialize when a module object is " +"created, and clean up when it's freed. In this regard, a module is just like " +"any other :c:expr:`PyObject *`; there are no \"on interpreter shutdown\" " +"hooks to think—or forget—about." msgstr "" -msgid "Note that there are use cases for different kinds of \"globals\": per-process, per-interpreter, per-thread or per-task state. With per-module state as the default, these are still possible, but you should treat them as exceptional cases: if you need them, you should give them additional care and testing. (Note that this guide does not cover them.)" +#: ../../howto/isolating-extensions.rst:78 +msgid "" +"Note that there are use cases for different kinds of \"globals\": per-" +"process, per-interpreter, per-thread or per-task state. With per-module " +"state as the default, these are still possible, but you should treat them as " +"exceptional cases: if you need them, you should give them additional care " +"and testing. (Note that this guide does not cover them.)" msgstr "" +#: ../../howto/isolating-extensions.rst:87 msgid "Isolated Module Objects" msgstr "" -msgid "The key point to keep in mind when developing an extension module is that several module objects can be created from a single shared library. For example:" +#: ../../howto/isolating-extensions.rst:89 +msgid "" +"The key point to keep in mind when developing an extension module is that " +"several module objects can be created from a single shared library. For " +"example:" msgstr "" +#: ../../howto/isolating-extensions.rst:93 msgid "" ">>> import sys\n" ">>> import binascii\n" @@ -94,18 +167,38 @@ msgid "" "False" msgstr "" -msgid "As a rule of thumb, the two modules should be completely independent. All objects and state specific to the module should be encapsulated within the module object, not shared with other module objects, and cleaned up when the module object is deallocated. Since this just is a rule of thumb, exceptions are possible (see `Managing Global State`_), but they will need more thought and attention to edge cases." +#: ../../howto/isolating-extensions.rst:103 +msgid "" +"As a rule of thumb, the two modules should be completely independent. All " +"objects and state specific to the module should be encapsulated within the " +"module object, not shared with other module objects, and cleaned up when the " +"module object is deallocated. Since this just is a rule of thumb, exceptions " +"are possible (see `Managing Global State`_), but they will need more thought " +"and attention to edge cases." msgstr "" -msgid "While some modules could do with less stringent restrictions, isolated modules make it easier to set clear expectations and guidelines that work across a variety of use cases." +#: ../../howto/isolating-extensions.rst:111 +msgid "" +"While some modules could do with less stringent restrictions, isolated " +"modules make it easier to set clear expectations and guidelines that work " +"across a variety of use cases." msgstr "" +#: ../../howto/isolating-extensions.rst:117 msgid "Surprising Edge Cases" msgstr "" -msgid "Note that isolated modules do create some surprising edge cases. Most notably, each module object will typically not share its classes and exceptions with other similar modules. Continuing from the `example above `__, note that ``old_binascii.Error`` and ``binascii.Error`` are separate objects. In the following code, the exception is *not* caught:" +#: ../../howto/isolating-extensions.rst:119 +msgid "" +"Note that isolated modules do create some surprising edge cases. Most " +"notably, each module object will typically not share its classes and " +"exceptions with other similar modules. Continuing from the `example above " +"`__, note that ``old_binascii.Error`` and " +"``binascii.Error`` are separate objects. In the following code, the " +"exception is *not* caught:" msgstr "" +#: ../../howto/isolating-extensions.rst:126 msgid "" ">>> old_binascii.Error == binascii.Error\n" "False\n" @@ -119,60 +212,126 @@ msgid "" "binascii.Error: Non-hexadecimal digit found" msgstr "" -msgid "This is expected. Notice that pure-Python modules behave the same way: it is a part of how Python works." +#: ../../howto/isolating-extensions.rst:139 +msgid "" +"This is expected. Notice that pure-Python modules behave the same way: it is " +"a part of how Python works." msgstr "" -msgid "The goal is to make extension modules safe at the C level, not to make hacks behave intuitively. Mutating ``sys.modules`` \"manually\" counts as a hack." +#: ../../howto/isolating-extensions.rst:142 +msgid "" +"The goal is to make extension modules safe at the C level, not to make hacks " +"behave intuitively. Mutating ``sys.modules`` \"manually\" counts as a hack." msgstr "" +#: ../../howto/isolating-extensions.rst:148 msgid "Making Modules Safe with Multiple Interpreters" msgstr "" +#: ../../howto/isolating-extensions.rst:152 msgid "Managing Global State" msgstr "" -msgid "Sometimes, the state associated with a Python module is not specific to that module, but to the entire process (or something else \"more global\" than a module). For example:" +#: ../../howto/isolating-extensions.rst:154 +msgid "" +"Sometimes, the state associated with a Python module is not specific to that " +"module, but to the entire process (or something else \"more global\" than a " +"module). For example:" msgstr "" +#: ../../howto/isolating-extensions.rst:158 msgid "The ``readline`` module manages *the* terminal." msgstr "" -msgid "A module running on a circuit board wants to control *the* on-board LED." +#: ../../howto/isolating-extensions.rst:159 +msgid "" +"A module running on a circuit board wants to control *the* on-board LED." msgstr "" -msgid "In these cases, the Python module should provide *access* to the global state, rather than *own* it. If possible, write the module so that multiple copies of it can access the state independently (along with other libraries, whether for Python or other languages). If that is not possible, consider explicit locking." +#: ../../howto/isolating-extensions.rst:162 +msgid "" +"In these cases, the Python module should provide *access* to the global " +"state, rather than *own* it. If possible, write the module so that multiple " +"copies of it can access the state independently (along with other libraries, " +"whether for Python or other languages). If that is not possible, consider " +"explicit locking." msgstr "" -msgid "If it is necessary to use process-global state, the simplest way to avoid issues with multiple interpreters is to explicitly prevent a module from being loaded more than once per process—see :ref:`isolating-extensions-optout`." +#: ../../howto/isolating-extensions.rst:168 +msgid "" +"If it is necessary to use process-global state, the simplest way to avoid " +"issues with multiple interpreters is to explicitly prevent a module from " +"being loaded more than once per process—see :ref:`isolating-extensions-" +"optout`." msgstr "" +#: ../../howto/isolating-extensions.rst:175 msgid "Managing Per-Module State" msgstr "" -msgid "To use per-module state, use :ref:`multi-phase extension module initialization `. This signals that your module supports multiple interpreters correctly." +#: ../../howto/isolating-extensions.rst:177 +msgid "" +"To use per-module state, use :ref:`multi-phase extension module " +"initialization `. This signals that your module " +"supports multiple interpreters correctly." msgstr "" -msgid "Set ``PyModuleDef.m_size`` to a positive number to request that many bytes of storage local to the module. Usually, this will be set to the size of some module-specific ``struct``, which can store all of the module's C-level state. In particular, it is where you should put pointers to classes (including exceptions, but excluding static types) and settings (e.g. ``csv``'s :py:data:`~csv.field_size_limit`) which the C code needs to function." +#: ../../howto/isolating-extensions.rst:181 +msgid "" +"Set ``PyModuleDef.m_size`` to a positive number to request that many bytes " +"of storage local to the module. Usually, this will be set to the size of " +"some module-specific ``struct``, which can store all of the module's C-level " +"state. In particular, it is where you should put pointers to classes " +"(including exceptions, but excluding static types) and settings (e.g. " +"``csv``'s :py:data:`~csv.field_size_limit`) which the C code needs to " +"function." msgstr "" -msgid "Another option is to store state in the module's ``__dict__``, but you must avoid crashing when users modify ``__dict__`` from Python code. This usually means error- and type-checking at the C level, which is easy to get wrong and hard to test sufficiently." +#: ../../howto/isolating-extensions.rst:190 +msgid "" +"Another option is to store state in the module's ``__dict__``, but you must " +"avoid crashing when users modify ``__dict__`` from Python code. This usually " +"means error- and type-checking at the C level, which is easy to get wrong " +"and hard to test sufficiently." msgstr "" -msgid "However, if module state is not needed in C code, storing it in ``__dict__`` only is a good idea." +#: ../../howto/isolating-extensions.rst:195 +msgid "" +"However, if module state is not needed in C code, storing it in ``__dict__`` " +"only is a good idea." msgstr "" -msgid "If the module state includes ``PyObject`` pointers, the module object must hold references to those objects and implement the module-level hooks ``m_traverse``, ``m_clear`` and ``m_free``. These work like ``tp_traverse``, ``tp_clear`` and ``tp_free`` of a class. Adding them will require some work and make the code longer; this is the price for modules which can be unloaded cleanly." +#: ../../howto/isolating-extensions.rst:198 +msgid "" +"If the module state includes ``PyObject`` pointers, the module object must " +"hold references to those objects and implement the module-level hooks " +"``m_traverse``, ``m_clear`` and ``m_free``. These work like ``tp_traverse``, " +"``tp_clear`` and ``tp_free`` of a class. Adding them will require some work " +"and make the code longer; this is the price for modules which can be " +"unloaded cleanly." msgstr "" -msgid "An example of a module with per-module state is currently available as `xxlimited `__; example module initialization shown at the bottom of the file." +#: ../../howto/isolating-extensions.rst:205 +msgid "" +"An example of a module with per-module state is currently available as " +"`xxlimited `__; example module initialization shown at the bottom of the " +"file." msgstr "" +#: ../../howto/isolating-extensions.rst:213 msgid "Opt-Out: Limiting to One Module Object per Process" msgstr "" -msgid "A non-negative ``PyModuleDef.m_size`` signals that a module supports multiple interpreters correctly. If this is not yet the case for your module, you can explicitly make your module loadable only once per process. For example::" +#: ../../howto/isolating-extensions.rst:215 +msgid "" +"A non-negative ``PyModuleDef.m_size`` signals that a module supports " +"multiple interpreters correctly. If this is not yet the case for your " +"module, you can explicitly make your module loadable only once per process. " +"For example::" msgstr "" +#: ../../howto/isolating-extensions.rst:220 msgid "" "// A process-wide flag\n" "static int loaded = 0;\n" @@ -196,15 +355,27 @@ msgid "" "}" msgstr "" -msgid "If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare for future re-initialization, it should clear the ``loaded`` flag. In this case, your module won't support multiple instances existing *concurrently*, but it will, for example, support being loaded after Python runtime shutdown (:c:func:`Py_FinalizeEx`) and re-initialization (:c:func:`Py_Initialize`)." +#: ../../howto/isolating-extensions.rst:242 +msgid "" +"If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare " +"for future re-initialization, it should clear the ``loaded`` flag. In this " +"case, your module won't support multiple instances existing *concurrently*, " +"but it will, for example, support being loaded after Python runtime shutdown " +"(:c:func:`Py_FinalizeEx`) and re-initialization (:c:func:`Py_Initialize`)." msgstr "" +#: ../../howto/isolating-extensions.rst:251 msgid "Module State Access from Functions" msgstr "" -msgid "Accessing the state from module-level functions is straightforward. Functions get the module object as their first argument; for extracting the state, you can use ``PyModule_GetState``::" +#: ../../howto/isolating-extensions.rst:253 +msgid "" +"Accessing the state from module-level functions is straightforward. " +"Functions get the module object as their first argument; for extracting the " +"state, you can use ``PyModule_GetState``::" msgstr "" +#: ../../howto/isolating-extensions.rst:257 msgid "" "static PyObject *\n" "func(PyObject *module, PyObject *args)\n" @@ -217,81 +388,164 @@ msgid "" "}" msgstr "" -msgid "``PyModule_GetState`` may return ``NULL`` without setting an exception if there is no module state, i.e. ``PyModuleDef.m_size`` was zero. In your own module, you're in control of ``m_size``, so this is easy to prevent." +#: ../../howto/isolating-extensions.rst:268 +msgid "" +"``PyModule_GetState`` may return ``NULL`` without setting an exception if " +"there is no module state, i.e. ``PyModuleDef.m_size`` was zero. In your own " +"module, you're in control of ``m_size``, so this is easy to prevent." msgstr "" +#: ../../howto/isolating-extensions.rst:275 msgid "Heap Types" msgstr "" -msgid "Traditionally, types defined in C code are *static*; that is, ``static PyTypeObject`` structures defined directly in code and initialized using ``PyType_Ready()``." +#: ../../howto/isolating-extensions.rst:277 +msgid "" +"Traditionally, types defined in C code are *static*; that is, ``static " +"PyTypeObject`` structures defined directly in code and initialized using " +"``PyType_Ready()``." msgstr "" -msgid "Such types are necessarily shared across the process. Sharing them between module objects requires paying attention to any state they own or access. To limit the possible issues, static types are immutable at the Python level: for example, you can't set ``str.myattribute = 123``." +#: ../../howto/isolating-extensions.rst:281 +msgid "" +"Such types are necessarily shared across the process. Sharing them between " +"module objects requires paying attention to any state they own or access. To " +"limit the possible issues, static types are immutable at the Python level: " +"for example, you can't set ``str.myattribute = 123``." msgstr "" -msgid "Sharing truly immutable objects between interpreters is fine, as long as they don't provide access to mutable objects. However, in CPython, every Python object has a mutable implementation detail: the reference count. Changes to the refcount are guarded by the GIL. Thus, code that shares any Python objects across interpreters implicitly depends on CPython's current, process-wide GIL." +#: ../../howto/isolating-extensions.rst:287 +msgid "" +"Sharing truly immutable objects between interpreters is fine, as long as " +"they don't provide access to mutable objects. However, in CPython, every " +"Python object has a mutable implementation detail: the reference count. " +"Changes to the refcount are guarded by the GIL. Thus, code that shares any " +"Python objects across interpreters implicitly depends on CPython's current, " +"process-wide GIL." msgstr "" -msgid "Because they are immutable and process-global, static types cannot access \"their\" module state. If any method of such a type requires access to module state, the type must be converted to a *heap-allocated type*, or *heap type* for short. These correspond more closely to classes created by Python's ``class`` statement." +#: ../../howto/isolating-extensions.rst:294 +msgid "" +"Because they are immutable and process-global, static types cannot access " +"\"their\" module state. If any method of such a type requires access to " +"module state, the type must be converted to a *heap-allocated type*, or " +"*heap type* for short. These correspond more closely to classes created by " +"Python's ``class`` statement." msgstr "" +#: ../../howto/isolating-extensions.rst:301 msgid "For new modules, using heap types by default is a good rule of thumb." msgstr "" +#: ../../howto/isolating-extensions.rst:305 msgid "Changing Static Types to Heap Types" msgstr "" -msgid "Static types can be converted to heap types, but note that the heap type API was not designed for \"lossless\" conversion from static types—that is, creating a type that works exactly like a given static type. So, when rewriting the class definition in a new API, you are likely to unintentionally change a few details (e.g. pickleability or inherited slots). Always test the details that are important to you." +#: ../../howto/isolating-extensions.rst:307 +msgid "" +"Static types can be converted to heap types, but note that the heap type API " +"was not designed for \"lossless\" conversion from static types—that is, " +"creating a type that works exactly like a given static type. So, when " +"rewriting the class definition in a new API, you are likely to " +"unintentionally change a few details (e.g. pickleability or inherited " +"slots). Always test the details that are important to you." msgstr "" -msgid "Watch out for the following two points in particular (but note that this is not a comprehensive list):" +#: ../../howto/isolating-extensions.rst:316 +msgid "" +"Watch out for the following two points in particular (but note that this is " +"not a comprehensive list):" msgstr "" -msgid "Unlike static types, heap type objects are mutable by default. Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag to prevent mutability." +#: ../../howto/isolating-extensions.rst:319 +msgid "" +"Unlike static types, heap type objects are mutable by default. Use " +"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag to prevent mutability." msgstr "" -msgid "Heap types inherit :c:member:`~PyTypeObject.tp_new` by default, so it may become possible to instantiate them from Python code. You can prevent this with the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag." +#: ../../howto/isolating-extensions.rst:321 +msgid "" +"Heap types inherit :c:member:`~PyTypeObject.tp_new` by default, so it may " +"become possible to instantiate them from Python code. You can prevent this " +"with the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag." msgstr "" +#: ../../howto/isolating-extensions.rst:327 msgid "Defining Heap Types" msgstr "" -msgid "Heap types can be created by filling a :c:struct:`PyType_Spec` structure, a description or \"blueprint\" of a class, and calling :c:func:`PyType_FromModuleAndSpec` to construct a new class object." +#: ../../howto/isolating-extensions.rst:329 +msgid "" +"Heap types can be created by filling a :c:struct:`PyType_Spec` structure, a " +"description or \"blueprint\" of a class, and " +"calling :c:func:`PyType_FromModuleAndSpec` to construct a new class object." msgstr "" -msgid "Other functions, like :c:func:`PyType_FromSpec`, can also create heap types, but :c:func:`PyType_FromModuleAndSpec` associates the module with the class, allowing access to the module state from methods." +#: ../../howto/isolating-extensions.rst:334 +msgid "" +"Other functions, like :c:func:`PyType_FromSpec`, can also create heap types, " +"but :c:func:`PyType_FromModuleAndSpec` associates the module with the class, " +"allowing access to the module state from methods." msgstr "" -msgid "The class should generally be stored in *both* the module state (for safe access from C) and the module's ``__dict__`` (for access from Python code)." +#: ../../howto/isolating-extensions.rst:338 +msgid "" +"The class should generally be stored in *both* the module state (for safe " +"access from C) and the module's ``__dict__`` (for access from Python code)." msgstr "" +#: ../../howto/isolating-extensions.rst:344 msgid "Garbage-Collection Protocol" msgstr "" -msgid "Instances of heap types hold a reference to their type. This ensures that the type isn't destroyed before all its instances are, but may result in reference cycles that need to be broken by the garbage collector." +#: ../../howto/isolating-extensions.rst:346 +msgid "" +"Instances of heap types hold a reference to their type. This ensures that " +"the type isn't destroyed before all its instances are, but may result in " +"reference cycles that need to be broken by the garbage collector." msgstr "" -msgid "To avoid memory leaks, instances of heap types must implement the garbage collection protocol. That is, heap types should:" +#: ../../howto/isolating-extensions.rst:351 +msgid "" +"To avoid memory leaks, instances of heap types must implement the garbage " +"collection protocol. That is, heap types should:" msgstr "" +#: ../../howto/isolating-extensions.rst:355 msgid "Have the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -msgid "Define a traverse function using :c:data:`Py_tp_traverse`, which visits the type (e.g. using ``Py_VISIT(Py_TYPE(self))``)." +#: ../../howto/isolating-extensions.rst:356 +msgid "" +"Define a traverse function using :c:data:`Py_tp_traverse`, which visits the " +"type (e.g. using ``Py_VISIT(Py_TYPE(self))``)." msgstr "" -msgid "Please refer to the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` and :c:member:`~PyTypeObject.tp_traverse` for additional considerations." +#: ../../howto/isolating-extensions.rst:359 +msgid "" +"Please refer to the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` " +"and :c:member:`~PyTypeObject.tp_traverse` for additional considerations." msgstr "" -msgid "The API for defining heap types grew organically, leaving it somewhat awkward to use in its current state. The following sections will guide you through common issues." +#: ../../howto/isolating-extensions.rst:363 +msgid "" +"The API for defining heap types grew organically, leaving it somewhat " +"awkward to use in its current state. The following sections will guide you " +"through common issues." msgstr "" +#: ../../howto/isolating-extensions.rst:369 msgid "``tp_traverse`` in Python 3.8 and lower" msgstr "" -msgid "The requirement to visit the type from ``tp_traverse`` was added in Python 3.9. If you support Python 3.8 and lower, the traverse function must *not* visit the type, so it must be more complicated::" +#: ../../howto/isolating-extensions.rst:371 +msgid "" +"The requirement to visit the type from ``tp_traverse`` was added in Python " +"3.9. If you support Python 3.8 and lower, the traverse function must *not* " +"visit the type, so it must be more complicated::" msgstr "" +#: ../../howto/isolating-extensions.rst:375 msgid "" "static int my_traverse(PyObject *self, visitproc visit, void *arg)\n" "{\n" @@ -302,30 +556,47 @@ msgid "" "}" msgstr "" -msgid "Unfortunately, :c:data:`Py_Version` was only added in Python 3.11. As a replacement, use:" +#: ../../howto/isolating-extensions.rst:383 +msgid "" +"Unfortunately, :c:data:`Py_Version` was only added in Python 3.11. As a " +"replacement, use:" msgstr "" +#: ../../howto/isolating-extensions.rst:386 msgid ":c:macro:`PY_VERSION_HEX`, if not using the stable ABI, or" msgstr "" -msgid ":py:data:`sys.version_info` (via :c:func:`PySys_GetObject` and :c:func:`PyArg_ParseTuple`)." +#: ../../howto/isolating-extensions.rst:387 +msgid "" +":py:data:`sys.version_info` (via :c:func:`PySys_GetObject` " +"and :c:func:`PyArg_ParseTuple`)." msgstr "" +#: ../../howto/isolating-extensions.rst:392 msgid "Delegating ``tp_traverse``" msgstr "" -msgid "If your traverse function delegates to the :c:member:`~PyTypeObject.tp_traverse` of its base class (or another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that only heap type are expected to visit the type in ``tp_traverse``." +#: ../../howto/isolating-extensions.rst:394 +msgid "" +"If your traverse function delegates to " +"the :c:member:`~PyTypeObject.tp_traverse` of its base class (or another " +"type), ensure that ``Py_TYPE(self)`` is visited only once. Note that only " +"heap type are expected to visit the type in ``tp_traverse``." msgstr "" +#: ../../howto/isolating-extensions.rst:399 msgid "For example, if your traverse function includes::" msgstr "" +#: ../../howto/isolating-extensions.rst:401 msgid "base->tp_traverse(self, visit, arg)" msgstr "" +#: ../../howto/isolating-extensions.rst:403 msgid "...and ``base`` may be a static type, then it should also include::" msgstr "" +#: ../../howto/isolating-extensions.rst:405 msgid "" "if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" " // a heap type's tp_traverse already visited Py_TYPE(self)\n" @@ -336,24 +607,38 @@ msgid "" "}" msgstr "" -msgid "It is not necessary to handle the type's reference count in :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_clear`." +#: ../../howto/isolating-extensions.rst:413 +msgid "" +"It is not necessary to handle the type's reference count " +"in :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_clear`." msgstr "" +#: ../../howto/isolating-extensions.rst:418 msgid "Defining ``tp_dealloc``" msgstr "" -msgid "If your type has a custom :c:member:`~PyTypeObject.tp_dealloc` function, it needs to:" +#: ../../howto/isolating-extensions.rst:420 +msgid "" +"If your type has a custom :c:member:`~PyTypeObject.tp_dealloc` function, it " +"needs to:" msgstr "" -msgid "call :c:func:`PyObject_GC_UnTrack` before any fields are invalidated, and" +#: ../../howto/isolating-extensions.rst:423 +msgid "" +"call :c:func:`PyObject_GC_UnTrack` before any fields are invalidated, and" msgstr "" +#: ../../howto/isolating-extensions.rst:424 msgid "decrement the reference count of the type." msgstr "" -msgid "To keep the type valid while ``tp_free`` is called, the type's refcount needs to be decremented *after* the instance is deallocated. For example::" +#: ../../howto/isolating-extensions.rst:426 +msgid "" +"To keep the type valid while ``tp_free`` is called, the type's refcount " +"needs to be decremented *after* the instance is deallocated. For example::" msgstr "" +#: ../../howto/isolating-extensions.rst:429 msgid "" "static void my_dealloc(PyObject *self)\n" "{\n" @@ -365,51 +650,81 @@ msgid "" "}" msgstr "" -msgid "The default ``tp_dealloc`` function does this, so if your type does *not* override ``tp_dealloc`` you don't need to add it." +#: ../../howto/isolating-extensions.rst:438 +msgid "" +"The default ``tp_dealloc`` function does this, so if your type does *not* " +"override ``tp_dealloc`` you don't need to add it." msgstr "" +#: ../../howto/isolating-extensions.rst:444 msgid "Not overriding ``tp_free``" msgstr "" -msgid "The :c:member:`~PyTypeObject.tp_free` slot of a heap type must be set to :c:func:`PyObject_GC_Del`. This is the default; do not override it." +#: ../../howto/isolating-extensions.rst:446 +msgid "" +"The :c:member:`~PyTypeObject.tp_free` slot of a heap type must be set " +"to :c:func:`PyObject_GC_Del`. This is the default; do not override it." msgstr "" +#: ../../howto/isolating-extensions.rst:452 msgid "Avoiding ``PyObject_New``" msgstr "" +#: ../../howto/isolating-extensions.rst:454 msgid "GC-tracked objects need to be allocated using GC-aware functions." msgstr "" +#: ../../howto/isolating-extensions.rst:456 msgid "If you use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:" msgstr "" -msgid "Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible. That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::" +#: ../../howto/isolating-extensions.rst:458 +msgid "" +"Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible. " +"That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::" msgstr "" +#: ../../howto/isolating-extensions.rst:461 msgid "TYPE *o = typeobj->tp_alloc(typeobj, 0);" msgstr "" -msgid "Replace ``o = PyObject_NewVar(TYPE, typeobj, size)`` with the same, but use size instead of the 0." +#: ../../howto/isolating-extensions.rst:463 +msgid "" +"Replace ``o = PyObject_NewVar(TYPE, typeobj, size)`` with the same, but use " +"size instead of the 0." msgstr "" -msgid "If the above is not possible (e.g. inside a custom ``tp_alloc``), call :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`::" +#: ../../howto/isolating-extensions.rst:466 +msgid "" +"If the above is not possible (e.g. inside a custom ``tp_alloc``), " +"call :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`::" msgstr "" +#: ../../howto/isolating-extensions.rst:469 msgid "" "TYPE *o = PyObject_GC_New(TYPE, typeobj);\n" "\n" "TYPE *o = PyObject_GC_NewVar(TYPE, typeobj, size);" msgstr "" +#: ../../howto/isolating-extensions.rst:475 msgid "Module State Access from Classes" msgstr "" -msgid "If you have a type object defined with :c:func:`PyType_FromModuleAndSpec`, you can call :c:func:`PyType_GetModule` to get the associated module, and then :c:func:`PyModule_GetState` to get the module's state." +#: ../../howto/isolating-extensions.rst:477 +msgid "" +"If you have a type object defined with :c:func:`PyType_FromModuleAndSpec`, " +"you can call :c:func:`PyType_GetModule` to get the associated module, and " +"then :c:func:`PyModule_GetState` to get the module's state." msgstr "" -msgid "To save a some tedious error-handling boilerplate code, you can combine these two steps with :c:func:`PyType_GetModuleState`, resulting in::" +#: ../../howto/isolating-extensions.rst:481 +msgid "" +"To save a some tedious error-handling boilerplate code, you can combine " +"these two steps with :c:func:`PyType_GetModuleState`, resulting in::" msgstr "" +#: ../../howto/isolating-extensions.rst:484 msgid "" "my_struct *state = (my_struct*)PyType_GetModuleState(type);\n" "if (state == NULL) {\n" @@ -417,21 +732,39 @@ msgid "" "}" msgstr "" +#: ../../howto/isolating-extensions.rst:491 msgid "Module State Access from Regular Methods" msgstr "" -msgid "Accessing the module-level state from methods of a class is somewhat more complicated, but is possible thanks to API introduced in Python 3.9. To get the state, you need to first get the *defining class*, and then get the module state from it." +#: ../../howto/isolating-extensions.rst:493 +msgid "" +"Accessing the module-level state from methods of a class is somewhat more " +"complicated, but is possible thanks to API introduced in Python 3.9. To get " +"the state, you need to first get the *defining class*, and then get the " +"module state from it." msgstr "" -msgid "The largest roadblock is getting *the class a method was defined in*, or that method's \"defining class\" for short. The defining class can have a reference to the module it is part of." +#: ../../howto/isolating-extensions.rst:498 +msgid "" +"The largest roadblock is getting *the class a method was defined in*, or " +"that method's \"defining class\" for short. The defining class can have a " +"reference to the module it is part of." msgstr "" -msgid "Do not confuse the defining class with ``Py_TYPE(self)``. If the method is called on a *subclass* of your type, ``Py_TYPE(self)`` will refer to that subclass, which may be defined in different module than yours." +#: ../../howto/isolating-extensions.rst:502 +msgid "" +"Do not confuse the defining class with ``Py_TYPE(self)``. If the method is " +"called on a *subclass* of your type, ``Py_TYPE(self)`` will refer to that " +"subclass, which may be defined in different module than yours." msgstr "" -msgid "The following Python code can illustrate the concept. ``Base.get_defining_class`` returns ``Base`` even if ``type(self) == Sub``:" +#: ../../howto/isolating-extensions.rst:507 +msgid "" +"The following Python code can illustrate the concept. " +"``Base.get_defining_class`` returns ``Base`` even if ``type(self) == Sub``:" msgstr "" +#: ../../howto/isolating-extensions.rst:511 msgid "" "class Base:\n" " def get_type_of_self(self):\n" @@ -444,9 +777,15 @@ msgid "" " pass" msgstr "" -msgid "For a method to get its \"defining class\", it must use the :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS ` :c:type:`calling convention ` and the corresponding :c:type:`PyCMethod` signature::" +#: ../../howto/isolating-extensions.rst:523 +msgid "" +"For a method to get its \"defining class\", it must use " +"the :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS ` :c:type:`calling convention ` and " +"the corresponding :c:type:`PyCMethod` signature::" msgstr "" +#: ../../howto/isolating-extensions.rst:528 msgid "" "PyObject *PyCMethod(\n" " PyObject *self, // object the method was called on\n" @@ -456,12 +795,17 @@ msgid "" " PyObject *kwnames) // NULL, or dict of keyword arguments" msgstr "" -msgid "Once you have the defining class, call :c:func:`PyType_GetModuleState` to get the state of its associated module." +#: ../../howto/isolating-extensions.rst:535 +msgid "" +"Once you have the defining class, call :c:func:`PyType_GetModuleState` to " +"get the state of its associated module." msgstr "" +#: ../../howto/isolating-extensions.rst:538 msgid "For example::" msgstr "" +#: ../../howto/isolating-extensions.rst:540 msgid "" "static PyObject *\n" "example_method(PyObject *self,\n" @@ -488,18 +832,33 @@ msgid "" "}" msgstr "" +#: ../../howto/isolating-extensions.rst:566 msgid "Module State Access from Slot Methods, Getters and Setters" msgstr "" +#: ../../howto/isolating-extensions.rst:570 msgid "This is new in Python 3.11." msgstr "" -msgid "Slot methods—the fast C equivalents for special methods, such as :c:member:`~PyNumberMethods.nb_add` for :py:attr:`~object.__add__` or :c:member:`~PyTypeObject.tp_new` for initialization—have a very simple API that doesn't allow passing in the defining class, unlike with :c:type:`PyCMethod`. The same goes for getters and setters defined with :c:type:`PyGetSetDef`." +#: ../../howto/isolating-extensions.rst:578 +msgid "" +"Slot methods—the fast C equivalents for special methods, such " +"as :c:member:`~PyNumberMethods.nb_add` for :py:attr:`~object.__add__` " +"or :c:member:`~PyTypeObject.tp_new` for initialization—have a very simple " +"API that doesn't allow passing in the defining class, unlike " +"with :c:type:`PyCMethod`. The same goes for getters and setters defined " +"with :c:type:`PyGetSetDef`." msgstr "" -msgid "To access the module state in these cases, use the :c:func:`PyType_GetModuleByDef` function, and pass in the module definition. Once you have the module, call :c:func:`PyModule_GetState` to get the state::" +#: ../../howto/isolating-extensions.rst:585 +msgid "" +"To access the module state in these cases, use " +"the :c:func:`PyType_GetModuleByDef` function, and pass in the module " +"definition. Once you have the module, call :c:func:`PyModule_GetState` to " +"get the state::" msgstr "" +#: ../../howto/isolating-extensions.rst:590 msgid "" "PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &module_def);\n" "my_struct *state = (my_struct*)PyModule_GetState(module);\n" @@ -508,38 +867,73 @@ msgid "" "}" msgstr "" -msgid ":c:func:`!PyType_GetModuleByDef` works by searching the :term:`method resolution order` (i.e. all superclasses) for the first superclass that has a corresponding module." +#: ../../howto/isolating-extensions.rst:596 +msgid "" +":c:func:`!PyType_GetModuleByDef` works by searching the :term:`method " +"resolution order` (i.e. all superclasses) for the first superclass that has " +"a corresponding module." msgstr "" -msgid "In very exotic cases (inheritance chains spanning multiple modules created from the same definition), :c:func:`!PyType_GetModuleByDef` might not return the module of the true defining class. However, it will always return a module with the same definition, ensuring a compatible C memory layout." +#: ../../howto/isolating-extensions.rst:602 +msgid "" +"In very exotic cases (inheritance chains spanning multiple modules created " +"from the same definition), :c:func:`!PyType_GetModuleByDef` might not return " +"the module of the true defining class. However, it will always return a " +"module with the same definition, ensuring a compatible C memory layout." msgstr "" +#: ../../howto/isolating-extensions.rst:610 msgid "Lifetime of the Module State" msgstr "" -msgid "When a module object is garbage-collected, its module state is freed. For each pointer to (a part of) the module state, you must hold a reference to the module object." +#: ../../howto/isolating-extensions.rst:612 +msgid "" +"When a module object is garbage-collected, its module state is freed. For " +"each pointer to (a part of) the module state, you must hold a reference to " +"the module object." msgstr "" -msgid "Usually this is not an issue, because types created with :c:func:`PyType_FromModuleAndSpec`, and their instances, hold a reference to the module. However, you must be careful in reference counting when you reference module state from other places, such as callbacks for external libraries." +#: ../../howto/isolating-extensions.rst:616 +msgid "" +"Usually this is not an issue, because types created " +"with :c:func:`PyType_FromModuleAndSpec`, and their instances, hold a " +"reference to the module. However, you must be careful in reference counting " +"when you reference module state from other places, such as callbacks for " +"external libraries." msgstr "" +#: ../../howto/isolating-extensions.rst:625 msgid "Open Issues" msgstr "" +#: ../../howto/isolating-extensions.rst:627 msgid "Several issues around per-module state and heap types are still open." msgstr "" -msgid "Discussions about improving the situation are best held on the `discuss forum under c-api tag `__." +#: ../../howto/isolating-extensions.rst:629 +msgid "" +"Discussions about improving the situation are best held on the `discuss " +"forum under c-api tag `__." msgstr "" +#: ../../howto/isolating-extensions.rst:633 msgid "Per-Class Scope" msgstr "" -msgid "It is currently (as of Python 3.11) not possible to attach state to individual *types* without relying on CPython implementation details (which may change in the future—perhaps, ironically, to allow a proper solution for per-class scope)." +#: ../../howto/isolating-extensions.rst:635 +msgid "" +"It is currently (as of Python 3.11) not possible to attach state to " +"individual *types* without relying on CPython implementation details (which " +"may change in the future—perhaps, ironically, to allow a proper solution for " +"per-class scope)." msgstr "" +#: ../../howto/isolating-extensions.rst:642 msgid "Lossless Conversion to Heap Types" msgstr "" -msgid "The heap type API was not designed for \"lossless\" conversion from static types; that is, creating a type that works exactly like a given static type." +#: ../../howto/isolating-extensions.rst:644 +msgid "" +"The heap type API was not designed for \"lossless\" conversion from static " +"types; that is, creating a type that works exactly like a given static type." msgstr "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 97dd45fdc..f027982a3 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,24 +24,42 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/logging-cookbook.rst:5 msgid "Logging Cookbook" msgstr "" +#: ../../howto/logging-cookbook.rst:0 msgid "Author" msgstr "" +#: ../../howto/logging-cookbook.rst:7 msgid "Vinay Sajip " msgstr "" -msgid "This page contains a number of recipes related to logging, which have been found useful in the past. For links to tutorial and reference information, please see :ref:`cookbook-ref-links`." +#: ../../howto/logging-cookbook.rst:9 +msgid "" +"This page contains a number of recipes related to logging, which have been " +"found useful in the past. For links to tutorial and reference information, " +"please see :ref:`cookbook-ref-links`." msgstr "" +#: ../../howto/logging-cookbook.rst:16 msgid "Using logging in multiple modules" msgstr "" -msgid "Multiple calls to ``logging.getLogger('someLogger')`` return a reference to the same logger object. This is true not only within the same module, but also across modules as long as it is in the same Python interpreter process. It is true for references to the same object; additionally, application code can define and configure a parent logger in one module and create (but not configure) a child logger in a separate module, and all logger calls to the child will pass up to the parent. Here is a main module::" +#: ../../howto/logging-cookbook.rst:18 +msgid "" +"Multiple calls to ``logging.getLogger('someLogger')`` return a reference to " +"the same logger object. This is true not only within the same module, but " +"also across modules as long as it is in the same Python interpreter " +"process. It is true for references to the same object; additionally, " +"application code can define and configure a parent logger in one module and " +"create (but not configure) a child logger in a separate module, and all " +"logger calls to the child will pass up to the parent. Here is a main " +"module::" msgstr "" +#: ../../howto/logging-cookbook.rst:26 msgid "" "import logging\n" "import auxiliary_module\n" @@ -56,7 +74,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -74,9 +93,11 @@ msgid "" "logger.info('done with auxiliary_module.some_function()')" msgstr "" +#: ../../howto/logging-cookbook.rst:56 msgid "Here is the auxiliary module::" msgstr "" +#: ../../howto/logging-cookbook.rst:58 msgid "" "import logging\n" "\n" @@ -85,7 +106,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = logging.getLogger('spam_application.auxiliary.Auxiliary')\n" +" self.logger = " +"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -97,9 +119,11 @@ msgid "" " module_logger.info('received a call to \"some_function\"')" msgstr "" +#: ../../howto/logging-cookbook.rst:76 msgid "The output looks like this:" msgstr "" +#: ../../howto/logging-cookbook.rst:78 msgid "" "2005-03-23 23:47:11,663 - spam_application - INFO -\n" " creating an instance of auxiliary_module.Auxiliary\n" @@ -123,12 +147,17 @@ msgid "" " done with auxiliary_module.some_function()" msgstr "" +#: ../../howto/logging-cookbook.rst:102 msgid "Logging from multiple threads" msgstr "" -msgid "Logging from multiple threads requires no special effort. The following example shows logging from the main (initial) thread and another thread::" +#: ../../howto/logging-cookbook.rst:104 +msgid "" +"Logging from multiple threads requires no special effort. The following " +"example shows logging from the main (initial) thread and another thread::" msgstr "" +#: ../../howto/logging-cookbook.rst:107 msgid "" "import logging\n" "import threading\n" @@ -140,7 +169,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" +"(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -157,9 +187,11 @@ msgid "" " main()" msgstr "" +#: ../../howto/logging-cookbook.rst:133 msgid "When run, the script should print something like the following:" msgstr "" +#: ../../howto/logging-cookbook.rst:135 msgid "" " 0 Thread-1 Hi from myfunc\n" " 3 MainThread Hello from main\n" @@ -180,15 +212,29 @@ msgid "" "4518 Thread-1 Hi from myfunc" msgstr "" -msgid "This shows the logging output interspersed as one might expect. This approach works for more threads than shown here, of course." +#: ../../howto/logging-cookbook.rst:155 +msgid "" +"This shows the logging output interspersed as one might expect. This " +"approach works for more threads than shown here, of course." msgstr "" +#: ../../howto/logging-cookbook.rst:159 msgid "Multiple handlers and formatters" msgstr "" -msgid "Loggers are plain Python objects. The :meth:`~Logger.addHandler` method has no minimum or maximum quota for the number of handlers you may add. Sometimes it will be beneficial for an application to log all messages of all severities to a text file while simultaneously logging errors or above to the console. To set this up, simply configure the appropriate handlers. The logging calls in the application code will remain unchanged. Here is a slight modification to the previous simple module-based configuration example::" +#: ../../howto/logging-cookbook.rst:161 +msgid "" +"Loggers are plain Python objects. The :meth:`~Logger.addHandler` method has " +"no minimum or maximum quota for the number of handlers you may add. " +"Sometimes it will be beneficial for an application to log all messages of " +"all severities to a text file while simultaneously logging errors or above " +"to the console. To set this up, simply configure the appropriate handlers. " +"The logging calls in the application code will remain unchanged. Here is a " +"slight modification to the previous simple module-based configuration " +"example::" msgstr "" +#: ../../howto/logging-cookbook.rst:169 msgid "" "import logging\n" "\n" @@ -201,7 +247,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -216,24 +263,46 @@ msgid "" "logger.critical('critical message')" msgstr "" -msgid "Notice that the 'application' code does not care about multiple handlers. All that changed was the addition and configuration of a new handler named *fh*." +#: ../../howto/logging-cookbook.rst:194 +msgid "" +"Notice that the 'application' code does not care about multiple handlers. " +"All that changed was the addition and configuration of a new handler named " +"*fh*." msgstr "" -msgid "The ability to create new handlers with higher- or lower-severity filters can be very helpful when writing and testing an application. Instead of using many ``print`` statements for debugging, use ``logger.debug``: Unlike the print statements, which you will have to delete or comment out later, the logger.debug statements can remain intact in the source code and remain dormant until you need them again. At that time, the only change that needs to happen is to modify the severity level of the logger and/or handler to debug." +#: ../../howto/logging-cookbook.rst:197 +msgid "" +"The ability to create new handlers with higher- or lower-severity filters " +"can be very helpful when writing and testing an application. Instead of " +"using many ``print`` statements for debugging, use ``logger.debug``: Unlike " +"the print statements, which you will have to delete or comment out later, " +"the logger.debug statements can remain intact in the source code and remain " +"dormant until you need them again. At that time, the only change that needs " +"to happen is to modify the severity level of the logger and/or handler to " +"debug." msgstr "" +#: ../../howto/logging-cookbook.rst:208 msgid "Logging to multiple destinations" msgstr "" -msgid "Let's say you want to log to console and file with different message formats and in differing circumstances. Say you want to log messages with levels of DEBUG and higher to file, and those messages at level INFO and higher to the console. Let's also assume that the file should contain timestamps, but the console messages should not. Here's how you can achieve this::" +#: ../../howto/logging-cookbook.rst:210 +msgid "" +"Let's say you want to log to console and file with different message formats " +"and in differing circumstances. Say you want to log messages with levels of " +"DEBUG and higher to file, and those messages at level INFO and higher to the " +"console. Let's also assume that the file should contain timestamps, but the " +"console messages should not. Here's how you can achieve this::" msgstr "" +#: ../../howto/logging-cookbook.rst:216 msgid "" "import logging\n" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s %" +"(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -247,7 +316,8 @@ msgid "" "# add the handler to the root logger\n" "logging.getLogger().addHandler(console)\n" "\n" -"# Now, we can log to the root logger, or any other logger. First the root...\n" +"# Now, we can log to the root logger, or any other logger. First the " +"root...\n" "logging.info('Jackdaws love my big sphinx of quartz.')\n" "\n" "# Now, define a couple of other loggers which might represent areas in your\n" @@ -262,9 +332,11 @@ msgid "" "logger2.error('The five boxing wizards jump quickly.')" msgstr "" +#: ../../howto/logging-cookbook.rst:248 msgid "When you run this, on the console you will see" msgstr "" +#: ../../howto/logging-cookbook.rst:250 msgid "" "root : INFO Jackdaws love my big sphinx of quartz.\n" "myapp.area1 : INFO How quickly daft jumping zebras vex.\n" @@ -272,44 +344,70 @@ msgid "" "myapp.area2 : ERROR The five boxing wizards jump quickly." msgstr "" +#: ../../howto/logging-cookbook.rst:257 msgid "and in the file you will see something like" msgstr "" +#: ../../howto/logging-cookbook.rst:259 msgid "" "10-22 22:19 root INFO Jackdaws love my big sphinx of quartz.\n" "10-22 22:19 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.\n" "10-22 22:19 myapp.area1 INFO How quickly daft jumping zebras vex.\n" -"10-22 22:19 myapp.area2 WARNING Jail zesty vixen who grabbed pay from quack.\n" +"10-22 22:19 myapp.area2 WARNING Jail zesty vixen who grabbed pay from " +"quack.\n" "10-22 22:19 myapp.area2 ERROR The five boxing wizards jump quickly." msgstr "" -msgid "As you can see, the DEBUG message only shows up in the file. The other messages are sent to both destinations." +#: ../../howto/logging-cookbook.rst:267 +msgid "" +"As you can see, the DEBUG message only shows up in the file. The other " +"messages are sent to both destinations." msgstr "" -msgid "This example uses console and file handlers, but you can use any number and combination of handlers you choose." +#: ../../howto/logging-cookbook.rst:270 +msgid "" +"This example uses console and file handlers, but you can use any number and " +"combination of handlers you choose." msgstr "" -msgid "Note that the above choice of log filename ``/tmp/myapp.log`` implies use of a standard location for temporary files on POSIX systems. On Windows, you may need to choose a different directory name for the log - just ensure that the directory exists and that you have the permissions to create and update files in it." +#: ../../howto/logging-cookbook.rst:273 +msgid "" +"Note that the above choice of log filename ``/tmp/myapp.log`` implies use of " +"a standard location for temporary files on POSIX systems. On Windows, you " +"may need to choose a different directory name for the log - just ensure that " +"the directory exists and that you have the permissions to create and update " +"files in it." msgstr "" +#: ../../howto/logging-cookbook.rst:282 msgid "Custom handling of levels" msgstr "" -msgid "Sometimes, you might want to do something slightly different from the standard handling of levels in handlers, where all levels above a threshold get processed by a handler. To do this, you need to use filters. Let's look at a scenario where you want to arrange things as follows:" +#: ../../howto/logging-cookbook.rst:284 +msgid "" +"Sometimes, you might want to do something slightly different from the " +"standard handling of levels in handlers, where all levels above a threshold " +"get processed by a handler. To do this, you need to use filters. Let's look " +"at a scenario where you want to arrange things as follows:" msgstr "" +#: ../../howto/logging-cookbook.rst:289 msgid "Send messages of severity ``INFO`` and ``WARNING`` to ``sys.stdout``" msgstr "" +#: ../../howto/logging-cookbook.rst:290 msgid "Send messages of severity ``ERROR`` and above to ``sys.stderr``" msgstr "" +#: ../../howto/logging-cookbook.rst:291 msgid "Send messages of severity ``DEBUG`` and above to file ``app.log``" msgstr "" +#: ../../howto/logging-cookbook.rst:293 msgid "Suppose you configure logging with the following JSON:" msgstr "" +#: ../../howto/logging-cookbook.rst:295 msgid "" "{\n" " \"version\": 1,\n" @@ -350,9 +448,17 @@ msgid "" "}" msgstr "" -msgid "This configuration does *almost* what we want, except that ``sys.stdout`` would show messages of severity ``ERROR`` and only events of this severity and higher will be tracked as well as ``INFO`` and ``WARNING`` messages. To prevent this, we can set up a filter which excludes those messages and add it to the relevant handler. This can be configured by adding a ``filters`` section parallel to ``formatters`` and ``handlers``:" +#: ../../howto/logging-cookbook.rst:335 +msgid "" +"This configuration does *almost* what we want, except that ``sys.stdout`` " +"would show messages of severity ``ERROR`` and only events of this severity " +"and higher will be tracked as well as ``INFO`` and ``WARNING`` messages. To " +"prevent this, we can set up a filter which excludes those messages and add " +"it to the relevant handler. This can be configured by adding a ``filters`` " +"section parallel to ``formatters`` and ``handlers``:" msgstr "" +#: ../../howto/logging-cookbook.rst:341 msgid "" "{\n" " \"filters\": {\n" @@ -364,9 +470,11 @@ msgid "" "}" msgstr "" +#: ../../howto/logging-cookbook.rst:352 msgid "and changing the section on the ``stdout`` handler to add it:" msgstr "" +#: ../../howto/logging-cookbook.rst:354 msgid "" "{\n" " \"stdout\": {\n" @@ -379,9 +487,13 @@ msgid "" "}" msgstr "" -msgid "A filter is just a function, so we can define the ``filter_maker`` (a factory function) as follows:" +#: ../../howto/logging-cookbook.rst:366 +msgid "" +"A filter is just a function, so we can define the ``filter_maker`` (a " +"factory function) as follows:" msgstr "" +#: ../../howto/logging-cookbook.rst:369 msgid "" "def filter_maker(level):\n" " level = getattr(logging, level)\n" @@ -392,12 +504,22 @@ msgid "" " return filter" msgstr "" -msgid "This converts the string argument passed in to a numeric level, and returns a function which only returns ``True`` if the level of the passed in record is at or below the specified level. Note that in this example I have defined the ``filter_maker`` in a test script ``main.py`` that I run from the command line, so its module will be ``__main__`` - hence the ``__main__.filter_maker`` in the filter configuration. You will need to change that if you define it in a different module." +#: ../../howto/logging-cookbook.rst:379 +msgid "" +"This converts the string argument passed in to a numeric level, and returns " +"a function which only returns ``True`` if the level of the passed in record " +"is at or below the specified level. Note that in this example I have defined " +"the ``filter_maker`` in a test script ``main.py`` that I run from the " +"command line, so its module will be ``__main__`` - hence the " +"``__main__.filter_maker`` in the filter configuration. You will need to " +"change that if you define it in a different module." msgstr "" +#: ../../howto/logging-cookbook.rst:387 msgid "With the filter added, we can run ``main.py``, which in full is:" msgstr "" +#: ../../howto/logging-cookbook.rst:389 msgid "" "import json\n" "import logging\n" @@ -466,15 +588,19 @@ msgid "" "logging.critical('A CRITICAL message')" msgstr "" +#: ../../howto/logging-cookbook.rst:457 msgid "And after running it like this:" msgstr "" +#: ../../howto/logging-cookbook.rst:459 msgid "python main.py 2>stderr.log >stdout.log" msgstr "" +#: ../../howto/logging-cookbook.rst:463 msgid "We can see the results are as expected:" msgstr "" +#: ../../howto/logging-cookbook.rst:465 msgid "" "$ more *.log\n" "::::::::::::::\n" @@ -497,12 +623,15 @@ msgid "" "WARNING - A WARNING message" msgstr "" +#: ../../howto/logging-cookbook.rst:489 msgid "Configuration server example" msgstr "" +#: ../../howto/logging-cookbook.rst:491 msgid "Here is an example of a module using the logging configuration server::" msgstr "" +#: ../../howto/logging-cookbook.rst:493 msgid "" "import logging\n" "import logging.config\n" @@ -534,9 +663,14 @@ msgid "" " t.join()" msgstr "" -msgid "And here is a script that takes a filename and sends that file to the server, properly preceded with the binary-encoded length, as the new logging configuration::" +#: ../../howto/logging-cookbook.rst:522 +msgid "" +"And here is a script that takes a filename and sends that file to the " +"server, properly preceded with the binary-encoded length, as the new logging " +"configuration::" msgstr "" +#: ../../howto/logging-cookbook.rst:526 msgid "" "#!/usr/bin/env python\n" "import socket, sys, struct\n" @@ -556,27 +690,67 @@ msgid "" "print('complete')" msgstr "" +#: ../../howto/logging-cookbook.rst:547 msgid "Dealing with handlers that block" msgstr "" -msgid "Sometimes you have to get your logging handlers to do their work without blocking the thread you're logging from. This is common in web applications, though of course it also occurs in other scenarios." -msgstr "" - -msgid "A common culprit which demonstrates sluggish behaviour is the :class:`SMTPHandler`: sending emails can take a long time, for a number of reasons outside the developer's control (for example, a poorly performing mail or network infrastructure). But almost any network-based handler can block: Even a :class:`SocketHandler` operation may do a DNS query under the hood which is too slow (and this query can be deep in the socket library code, below the Python layer, and outside your control)." +#: ../../howto/logging-cookbook.rst:551 +msgid "" +"Sometimes you have to get your logging handlers to do their work without " +"blocking the thread you're logging from. This is common in web applications, " +"though of course it also occurs in other scenarios." msgstr "" -msgid "One solution is to use a two-part approach. For the first part, attach only a :class:`QueueHandler` to those loggers which are accessed from performance-critical threads. They simply write to their queue, which can be sized to a large enough capacity or initialized with no upper bound to their size. The write to the queue will typically be accepted quickly, though you will probably need to catch the :exc:`queue.Full` exception as a precaution in your code. If you are a library developer who has performance-critical threads in their code, be sure to document this (together with a suggestion to attach only ``QueueHandlers`` to your loggers) for the benefit of other developers who will use your code." +#: ../../howto/logging-cookbook.rst:555 +msgid "" +"A common culprit which demonstrates sluggish behaviour is " +"the :class:`SMTPHandler`: sending emails can take a long time, for a number " +"of reasons outside the developer's control (for example, a poorly performing " +"mail or network infrastructure). But almost any network-based handler can " +"block: Even a :class:`SocketHandler` operation may do a DNS query under the " +"hood which is too slow (and this query can be deep in the socket library " +"code, below the Python layer, and outside your control)." msgstr "" -msgid "The second part of the solution is :class:`QueueListener`, which has been designed as the counterpart to :class:`QueueHandler`. A :class:`QueueListener` is very simple: it's passed a queue and some handlers, and it fires up an internal thread which listens to its queue for LogRecords sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that matter). The ``LogRecords`` are removed from the queue and passed to the handlers for processing." +#: ../../howto/logging-cookbook.rst:563 +msgid "" +"One solution is to use a two-part approach. For the first part, attach only " +"a :class:`QueueHandler` to those loggers which are accessed from performance-" +"critical threads. They simply write to their queue, which can be sized to a " +"large enough capacity or initialized with no upper bound to their size. The " +"write to the queue will typically be accepted quickly, though you will " +"probably need to catch the :exc:`queue.Full` exception as a precaution in " +"your code. If you are a library developer who has performance-critical " +"threads in their code, be sure to document this (together with a suggestion " +"to attach only ``QueueHandlers`` to your loggers) for the benefit of other " +"developers who will use your code." +msgstr "" + +#: ../../howto/logging-cookbook.rst:574 +msgid "" +"The second part of the solution is :class:`QueueListener`, which has been " +"designed as the counterpart to :class:`QueueHandler`. " +"A :class:`QueueListener` is very simple: it's passed a queue and some " +"handlers, and it fires up an internal thread which listens to its queue for " +"LogRecords sent from ``QueueHandlers`` (or any other source of " +"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " +"queue and passed to the handlers for processing." msgstr "" -msgid "The advantage of having a separate :class:`QueueListener` class is that you can use the same instance to service multiple ``QueueHandlers``. This is more resource-friendly than, say, having threaded versions of the existing handler classes, which would eat up one thread per handler for no particular benefit." +#: ../../howto/logging-cookbook.rst:582 +msgid "" +"The advantage of having a separate :class:`QueueListener` class is that you " +"can use the same instance to service multiple ``QueueHandlers``. This is " +"more resource-friendly than, say, having threaded versions of the existing " +"handler classes, which would eat up one thread per handler for no particular " +"benefit." msgstr "" +#: ../../howto/logging-cookbook.rst:587 msgid "An example of using these two classes follows (imports omitted)::" msgstr "" +#: ../../howto/logging-cookbook.rst:589 msgid "" "que = queue.Queue(-1) # no limit on size\n" "queue_handler = QueueHandler(que)\n" @@ -595,21 +769,44 @@ msgid "" "listener.stop()" msgstr "" +#: ../../howto/logging-cookbook.rst:605 msgid "which, when run, will produce:" msgstr "" +#: ../../howto/logging-cookbook.rst:607 msgid "MainThread: Look out!" msgstr "" -msgid "Although the earlier discussion wasn't specifically talking about async code, but rather about slow logging handlers, it should be noted that when logging from async code, network and even file handlers could lead to problems (blocking the event loop) because some logging is done from :mod:`asyncio` internals. It might be best, if any async code is used in an application, to use the above approach for logging, so that any blocking code runs only in the ``QueueListener`` thread." +#: ../../howto/logging-cookbook.rst:611 +msgid "" +"Although the earlier discussion wasn't specifically talking about async " +"code, but rather about slow logging handlers, it should be noted that when " +"logging from async code, network and even file handlers could lead to " +"problems (blocking the event loop) because some logging is done " +"from :mod:`asyncio` internals. It might be best, if any async code is used " +"in an application, to use the above approach for logging, so that any " +"blocking code runs only in the ``QueueListener`` thread." msgstr "" -msgid "Prior to Python 3.5, the :class:`QueueListener` always passed every message received from the queue to every handler it was initialized with. (This was because it was assumed that level filtering was all done on the other side, where the queue is filled.) From 3.5 onwards, this behaviour can be changed by passing a keyword argument ``respect_handler_level=True`` to the listener's constructor. When this is done, the listener compares the level of each message with the handler's level, and only passes a message to a handler if it's appropriate to do so." +#: ../../howto/logging-cookbook.rst:619 +msgid "" +"Prior to Python 3.5, the :class:`QueueListener` always passed every message " +"received from the queue to every handler it was initialized with. (This was " +"because it was assumed that level filtering was all done on the other side, " +"where the queue is filled.) From 3.5 onwards, this behaviour can be changed " +"by passing a keyword argument ``respect_handler_level=True`` to the " +"listener's constructor. When this is done, the listener compares the level " +"of each message with the handler's level, and only passes a message to a " +"handler if it's appropriate to do so." msgstr "" -msgid "The :class:`QueueListener` can be started (and stopped) via the :keyword:`with` statement. For example:" +#: ../../howto/logging-cookbook.rst:629 +msgid "" +"The :class:`QueueListener` can be started (and stopped) via " +"the :keyword:`with` statement. For example:" msgstr "" +#: ../../howto/logging-cookbook.rst:633 msgid "" "with QueueListener(que, handler) as listener:\n" " # The queue listener automatically starts\n" @@ -619,12 +816,18 @@ msgid "" "# the 'with' block is exited." msgstr "" +#: ../../howto/logging-cookbook.rst:645 msgid "Sending and receiving logging events across a network" msgstr "" -msgid "Let's say you want to send logging events across a network, and handle them at the receiving end. A simple way of doing this is attaching a :class:`SocketHandler` instance to the root logger at the sending end::" +#: ../../howto/logging-cookbook.rst:647 +msgid "" +"Let's say you want to send logging events across a network, and handle them " +"at the receiving end. A simple way of doing this is attaching " +"a :class:`SocketHandler` instance to the root logger at the sending end::" msgstr "" +#: ../../howto/logging-cookbook.rst:651 msgid "" "import logging, logging.handlers\n" "\n" @@ -636,7 +839,8 @@ msgid "" "# an unformatted pickle\n" "rootLogger.addHandler(socketHandler)\n" "\n" -"# Now, we can log to the root logger, or any other logger. First the root...\n" +"# Now, we can log to the root logger, or any other logger. First the " +"root...\n" "logging.info('Jackdaws love my big sphinx of quartz.')\n" "\n" "# Now, define a couple of other loggers which might represent areas in your\n" @@ -651,9 +855,13 @@ msgid "" "logger2.error('The five boxing wizards jump quickly.')" msgstr "" -msgid "At the receiving end, you can set up a receiver using the :mod:`socketserver` module. Here is a basic working example::" +#: ../../howto/logging-cookbook.rst:675 +msgid "" +"At the receiving end, you can set up a receiver using " +"the :mod:`socketserver` module. Here is a basic working example::" msgstr "" +#: ../../howto/logging-cookbook.rst:678 msgid "" "import pickle\n" "import logging\n" @@ -691,7 +899,8 @@ msgid "" " return pickle.loads(data)\n" "\n" " def handleLogRecord(self, record):\n" -" # if a name is specified, we use the named logger rather than the one\n" +" # if a name is specified, we use the named logger rather than the " +"one\n" " # implied by the record.\n" " if self.server.logname is not None:\n" " name = self.server.logname\n" @@ -714,7 +923,8 @@ msgid "" " def __init__(self, host='localhost',\n" " port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,\n" " handler=LogRecordStreamHandler):\n" -" socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)\n" +" socketserver.ThreadingTCPServer.__init__(self, (host, port), " +"handler)\n" " self.abort = 0\n" " self.timeout = 1\n" " self.logname = None\n" @@ -732,7 +942,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" +"(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -741,9 +952,13 @@ msgid "" " main()" msgstr "" -msgid "First run the server, and then the client. On the client side, nothing is printed on the console; on the server side, you should see something like:" +#: ../../howto/logging-cookbook.rst:763 +msgid "" +"First run the server, and then the client. On the client side, nothing is " +"printed on the console; on the server side, you should see something like:" msgstr "" +#: ../../howto/logging-cookbook.rst:766 msgid "" "About to start TCP server...\n" " 59 root INFO Jackdaws love my big sphinx of quartz.\n" @@ -753,117 +968,230 @@ msgid "" " 69 myapp.area2 ERROR The five boxing wizards jump quickly." msgstr "" -msgid "Note that there are some security issues with pickle in some scenarios. If these affect you, you can use an alternative serialization scheme by overriding the :meth:`~SocketHandler.makePickle` method and implementing your alternative there, as well as adapting the above script to use your alternative serialization." +#: ../../howto/logging-cookbook.rst:775 +msgid "" +"Note that there are some security issues with pickle in some scenarios. If " +"these affect you, you can use an alternative serialization scheme by " +"overriding the :meth:`~SocketHandler.makePickle` method and implementing " +"your alternative there, as well as adapting the above script to use your " +"alternative serialization." msgstr "" +#: ../../howto/logging-cookbook.rst:783 msgid "Running a logging socket listener in production" msgstr "" -msgid "To run a logging listener in production, you may need to use a process-management tool such as `Supervisor `_. `Here is a Gist `__ which provides the bare-bones files to run the above functionality using Supervisor. It consists of the following files:" +#: ../../howto/logging-cookbook.rst:787 +msgid "" +"To run a logging listener in production, you may need to use a process-" +"management tool such as `Supervisor `_. `Here is a " +"Gist `__ which provides the bare-bones files to run " +"the above functionality using Supervisor. It consists of the following files:" msgstr "" +#: ../../howto/logging-cookbook.rst:794 msgid "File" msgstr "" +#: ../../howto/logging-cookbook.rst:794 msgid "Purpose" msgstr "" +#: ../../howto/logging-cookbook.rst:796 msgid ":file:`prepare.sh`" msgstr "" +#: ../../howto/logging-cookbook.rst:796 msgid "A Bash script to prepare the environment for testing" msgstr "" +#: ../../howto/logging-cookbook.rst:799 msgid ":file:`supervisor.conf`" msgstr "" -msgid "The Supervisor configuration file, which has entries for the listener and a multi-process web application" +#: ../../howto/logging-cookbook.rst:799 +msgid "" +"The Supervisor configuration file, which has entries for the listener and a " +"multi-process web application" msgstr "" +#: ../../howto/logging-cookbook.rst:803 msgid ":file:`ensure_app.sh`" msgstr "" -msgid "A Bash script to ensure that Supervisor is running with the above configuration" +#: ../../howto/logging-cookbook.rst:803 +msgid "" +"A Bash script to ensure that Supervisor is running with the above " +"configuration" msgstr "" +#: ../../howto/logging-cookbook.rst:806 msgid ":file:`log_listener.py`" msgstr "" -msgid "The socket listener program which receives log events and records them to a file" +#: ../../howto/logging-cookbook.rst:806 +msgid "" +"The socket listener program which receives log events and records them to a " +"file" msgstr "" +#: ../../howto/logging-cookbook.rst:809 msgid ":file:`main.py`" msgstr "" -msgid "A simple web application which performs logging via a socket connected to the listener" +#: ../../howto/logging-cookbook.rst:809 +msgid "" +"A simple web application which performs logging via a socket connected to " +"the listener" msgstr "" +#: ../../howto/logging-cookbook.rst:812 msgid ":file:`webapp.json`" msgstr "" +#: ../../howto/logging-cookbook.rst:812 msgid "A JSON configuration file for the web application" msgstr "" +#: ../../howto/logging-cookbook.rst:814 msgid ":file:`client.py`" msgstr "" +#: ../../howto/logging-cookbook.rst:814 msgid "A Python script to exercise the web application" msgstr "" -msgid "The web application uses `Gunicorn `_, which is a popular web application server that starts multiple worker processes to handle requests. This example setup shows how the workers can write to the same log file without conflicting with one another --- they all go through the socket listener." +#: ../../howto/logging-cookbook.rst:817 +msgid "" +"The web application uses `Gunicorn `_, which is a " +"popular web application server that starts multiple worker processes to " +"handle requests. This example setup shows how the workers can write to the " +"same log file without conflicting with one another --- they all go through " +"the socket listener." msgstr "" +#: ../../howto/logging-cookbook.rst:822 msgid "To test these files, do the following in a POSIX environment:" msgstr "" -msgid "Download `the Gist `__ as a ZIP archive using the :guilabel:`Download ZIP` button." +#: ../../howto/logging-cookbook.rst:824 +msgid "" +"Download `the Gist `__ as a ZIP archive using " +"the :guilabel:`Download ZIP` button." msgstr "" +#: ../../howto/logging-cookbook.rst:827 msgid "Unzip the above files from the archive into a scratch directory." msgstr "" -msgid "In the scratch directory, run ``bash prepare.sh`` to get things ready. This creates a :file:`run` subdirectory to contain Supervisor-related and log files, and a :file:`venv` subdirectory to contain a virtual environment into which ``bottle``, ``gunicorn`` and ``supervisor`` are installed." +#: ../../howto/logging-cookbook.rst:829 +msgid "" +"In the scratch directory, run ``bash prepare.sh`` to get things ready. This " +"creates a :file:`run` subdirectory to contain Supervisor-related and log " +"files, and a :file:`venv` subdirectory to contain a virtual environment into " +"which ``bottle``, ``gunicorn`` and ``supervisor`` are installed." msgstr "" -msgid "Run ``bash ensure_app.sh`` to ensure that Supervisor is running with the above configuration." +#: ../../howto/logging-cookbook.rst:834 +msgid "" +"Run ``bash ensure_app.sh`` to ensure that Supervisor is running with the " +"above configuration." msgstr "" -msgid "Run ``venv/bin/python client.py`` to exercise the web application, which will lead to records being written to the log." +#: ../../howto/logging-cookbook.rst:837 +msgid "" +"Run ``venv/bin/python client.py`` to exercise the web application, which " +"will lead to records being written to the log." msgstr "" -msgid "Inspect the log files in the :file:`run` subdirectory. You should see the most recent log lines in files matching the pattern :file:`app.log*`. They won't be in any particular order, since they have been handled concurrently by different worker processes in a non-deterministic way." +#: ../../howto/logging-cookbook.rst:840 +msgid "" +"Inspect the log files in the :file:`run` subdirectory. You should see the " +"most recent log lines in files matching the pattern :file:`app.log*`. They " +"won't be in any particular order, since they have been handled concurrently " +"by different worker processes in a non-deterministic way." msgstr "" -msgid "You can shut down the listener and the web application by running ``venv/bin/supervisorctl -c supervisor.conf shutdown``." +#: ../../howto/logging-cookbook.rst:845 +msgid "" +"You can shut down the listener and the web application by running ``venv/bin/" +"supervisorctl -c supervisor.conf shutdown``." msgstr "" -msgid "You may need to tweak the configuration files in the unlikely event that the configured ports clash with something else in your test environment." +#: ../../howto/logging-cookbook.rst:848 +msgid "" +"You may need to tweak the configuration files in the unlikely event that the " +"configured ports clash with something else in your test environment." msgstr "" -msgid "The default configuration uses a TCP socket on port 9020. You can use a Unix Domain socket instead of a TCP socket by doing the following:" +#: ../../howto/logging-cookbook.rst:851 +msgid "" +"The default configuration uses a TCP socket on port 9020. You can use a Unix " +"Domain socket instead of a TCP socket by doing the following:" msgstr "" -msgid "In :file:`listener.json`, add a ``socket`` key with the path to the domain socket you want to use. If this key is present, the listener listens on the corresponding domain socket and not on a TCP socket (the ``port`` key is ignored)." +#: ../../howto/logging-cookbook.rst:854 +msgid "" +"In :file:`listener.json`, add a ``socket`` key with the path to the domain " +"socket you want to use. If this key is present, the listener listens on the " +"corresponding domain socket and not on a TCP socket (the ``port`` key is " +"ignored)." msgstr "" -msgid "In :file:`webapp.json`, change the socket handler configuration dictionary so that the ``host`` value is the path to the domain socket, and set the ``port`` value to ``null``." +#: ../../howto/logging-cookbook.rst:859 +msgid "" +"In :file:`webapp.json`, change the socket handler configuration dictionary " +"so that the ``host`` value is the path to the domain socket, and set the " +"``port`` value to ``null``." msgstr "" +#: ../../howto/logging-cookbook.rst:869 msgid "Adding contextual information to your logging output" msgstr "" -msgid "Sometimes you want logging output to contain contextual information in addition to the parameters passed to the logging call. For example, in a networked application, it may be desirable to log client-specific information in the log (e.g. remote client's username, or IP address). Although you could use the *extra* parameter to achieve this, it's not always convenient to pass the information in this way. While it might be tempting to create :class:`Logger` instances on a per-connection basis, this is not a good idea because these instances are not garbage collected. While this is not a problem in practice, when the number of :class:`Logger` instances is dependent on the level of granularity you want to use in logging an application, it could be hard to manage if the number of :class:`Logger` instances becomes effectively unbounded." -msgstr "" - +#: ../../howto/logging-cookbook.rst:871 +msgid "" +"Sometimes you want logging output to contain contextual information in " +"addition to the parameters passed to the logging call. For example, in a " +"networked application, it may be desirable to log client-specific " +"information in the log (e.g. remote client's username, or IP address). " +"Although you could use the *extra* parameter to achieve this, it's not " +"always convenient to pass the information in this way. While it might be " +"tempting to create :class:`Logger` instances on a per-connection basis, this " +"is not a good idea because these instances are not garbage collected. While " +"this is not a problem in practice, when the number of :class:`Logger` " +"instances is dependent on the level of granularity you want to use in " +"logging an application, it could be hard to manage if the number " +"of :class:`Logger` instances becomes effectively unbounded." +msgstr "" + +#: ../../howto/logging-cookbook.rst:886 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -msgid "An easy way in which you can pass contextual information to be output along with logging event information is to use the :class:`LoggerAdapter` class. This class is designed to look like a :class:`Logger`, so that you can call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` and :meth:`log`. These methods have the same signatures as their counterparts in :class:`Logger`, so you can use the two types of instances interchangeably." +#: ../../howto/logging-cookbook.rst:888 +msgid "" +"An easy way in which you can pass contextual information to be output along " +"with logging event information is to use the :class:`LoggerAdapter` class. " +"This class is designed to look like a :class:`Logger`, so that you can " +"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " +"and :meth:`log`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" -msgid "When you create an instance of :class:`LoggerAdapter`, you pass it a :class:`Logger` instance and a dict-like object which contains your contextual information. When you call one of the logging methods on an instance of :class:`LoggerAdapter`, it delegates the call to the underlying instance of :class:`Logger` passed to its constructor, and arranges to pass the contextual information in the delegated call. Here's a snippet from the code of :class:`LoggerAdapter`::" +#: ../../howto/logging-cookbook.rst:896 +msgid "" +"When you create an instance of :class:`LoggerAdapter`, you pass it " +"a :class:`Logger` instance and a dict-like object which contains your " +"contextual information. When you call one of the logging methods on an " +"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " +"instance of :class:`Logger` passed to its constructor, and arranges to pass " +"the contextual information in the delegated call. Here's a snippet from the " +"code of :class:`LoggerAdapter`::" msgstr "" +#: ../../howto/logging-cookbook.rst:904 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -874,12 +1202,32 @@ msgid "" " self.logger.debug(msg, *args, **kwargs)" msgstr "" -msgid "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where the contextual information is added to the logging output. It's passed the message and keyword arguments of the logging call, and it passes back (potentially) modified versions of these to use in the call to the underlying logger. The default implementation of this method leaves the message alone, but inserts an 'extra' key in the keyword argument whose value is the dict-like object passed to the constructor. Of course, if you had passed an 'extra' keyword argument in the call to the adapter, it will be silently overwritten." -msgstr "" - -msgid "The advantage of using 'extra' is that the values in the dict-like object are merged into the :class:`LogRecord` instance's __dict__, allowing you to use customized strings with your :class:`Formatter` instances which know about the keys of the dict-like object. If you need a different method, e.g. if you want to prepend or append the contextual information to the message string, you just need to subclass :class:`LoggerAdapter` and override :meth:`~LoggerAdapter.process` to do what you need. Here is a simple example::" +#: ../../howto/logging-cookbook.rst:912 +msgid "" +"The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " +"the contextual information is added to the logging output. It's passed the " +"message and keyword arguments of the logging call, and it passes back " +"(potentially) modified versions of these to use in the call to the " +"underlying logger. The default implementation of this method leaves the " +"message alone, but inserts an 'extra' key in the keyword argument whose " +"value is the dict-like object passed to the constructor. Of course, if you " +"had passed an 'extra' keyword argument in the call to the adapter, it will " +"be silently overwritten." +msgstr "" + +#: ../../howto/logging-cookbook.rst:921 +msgid "" +"The advantage of using 'extra' is that the values in the dict-like object " +"are merged into the :class:`LogRecord` instance's __dict__, allowing you to " +"use customized strings with your :class:`Formatter` instances which know " +"about the keys of the dict-like object. If you need a different method, e.g. " +"if you want to prepend or append the contextual information to the message " +"string, you just need to subclass :class:`LoggerAdapter` and " +"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " +"simple example::" msgstr "" +#: ../../howto/logging-cookbook.rst:929 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -890,32 +1238,61 @@ msgid "" " return '[%s] %s' % (self.extra['connid'], msg), kwargs" msgstr "" +#: ../../howto/logging-cookbook.rst:937 msgid "which you can use like this::" msgstr "" +#: ../../howto/logging-cookbook.rst:939 msgid "" "logger = logging.getLogger(__name__)\n" "adapter = CustomAdapter(logger, {'connid': some_conn_id})" msgstr "" -msgid "Then any events that you log to the adapter will have the value of ``some_conn_id`` prepended to the log messages." +#: ../../howto/logging-cookbook.rst:942 +msgid "" +"Then any events that you log to the adapter will have the value of " +"``some_conn_id`` prepended to the log messages." msgstr "" +#: ../../howto/logging-cookbook.rst:946 msgid "Using objects other than dicts to pass contextual information" msgstr "" -msgid "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you could pass an instance of a class which implements ``__getitem__`` and ``__iter__`` so that it looks like a dict to logging. This would be useful if you want to generate values dynamically (whereas the values in a dict would be constant)." +#: ../../howto/logging-cookbook.rst:948 +msgid "" +"You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " +"could pass an instance of a class which implements ``__getitem__`` and " +"``__iter__`` so that it looks like a dict to logging. This would be useful " +"if you want to generate values dynamically (whereas the values in a dict " +"would be constant)." msgstr "" +#: ../../howto/logging-cookbook.rst:957 msgid "Using Filters to impart contextual information" msgstr "" -msgid "You can also add contextual information to log output using a user-defined :class:`Filter`. ``Filter`` instances are allowed to modify the ``LogRecords`` passed to them, including adding additional attributes which can then be output using a suitable format string, or if needed a custom :class:`Formatter`." +#: ../../howto/logging-cookbook.rst:959 +msgid "" +"You can also add contextual information to log output using a user-" +"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " +"``LogRecords`` passed to them, including adding additional attributes which " +"can then be output using a suitable format string, or if needed a " +"custom :class:`Formatter`." msgstr "" -msgid "For example in a web application, the request being processed (or at least, the interesting parts of it) can be stored in a threadlocal (:class:`threading.local`) variable, and then accessed from a ``Filter`` to add, say, information from the request - say, the remote IP address and remote user's username - to the ``LogRecord``, using the attribute names 'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the same format string can be used to get similar output to that shown above. Here's an example script::" +#: ../../howto/logging-cookbook.rst:964 +msgid "" +"For example in a web application, the request being processed (or at least, " +"the interesting parts of it) can be stored in a threadlocal " +"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " +"add, say, information from the request - say, the remote IP address and " +"remote user's username - to the ``LogRecord``, using the attribute names " +"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " +"same format string can be used to get similar output to that shown above. " +"Here's an example script::" msgstr "" +#: ../../howto/logging-cookbook.rst:973 msgid "" "import logging\n" "from random import choice\n" @@ -938,9 +1315,11 @@ msgid "" " return True\n" "\n" "if __name__ == '__main__':\n" -" levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)\n" +" levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, " +"logging.CRITICAL)\n" " logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)-15s %(name)-5s %(levelname)-8s IP: %(ip)-15s User: %(user)-8s %(message)s')\n" +" format='%(asctime)-15s %(name)-5s %(levelname)-8s " +"IP: %(ip)-15s User: %(user)-8s %(message)s')\n" " a1 = logging.getLogger('a.b.c')\n" " a2 = logging.getLogger('d.e.f')\n" "\n" @@ -952,39 +1331,72 @@ msgid "" " for x in range(10):\n" " lvl = choice(levels)\n" " lvlname = logging.getLevelName(lvl)\n" -" a2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, 'parameters')" +" a2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, " +"'parameters')" msgstr "" +#: ../../howto/logging-cookbook.rst:1010 msgid "which, when run, produces something like:" msgstr "" +#: ../../howto/logging-cookbook.rst:1012 msgid "" -"2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A debug message\n" -"2010-09-06 22:38:15,300 a.b.c INFO IP: 192.168.0.1 User: sheila An info message with some parameters\n" -"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A message at CRITICAL level with 2 parameters\n" -"2010-09-06 22:38:15,300 d.e.f ERROR IP: 127.0.0.1 User: jim A message at ERROR level with 2 parameters\n" -"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 127.0.0.1 User: sheila A message at DEBUG level with 2 parameters\n" -"2010-09-06 22:38:15,300 d.e.f ERROR IP: 123.231.231.123 User: fred A message at ERROR level with 2 parameters\n" -"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 192.168.0.1 User: jim A message at CRITICAL level with 2 parameters\n" -"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A message at CRITICAL level with 2 parameters\n" -"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 192.168.0.1 User: jim A message at DEBUG level with 2 parameters\n" -"2010-09-06 22:38:15,301 d.e.f ERROR IP: 127.0.0.1 User: sheila A message at ERROR level with 2 parameters\n" -"2010-09-06 22:38:15,301 d.e.f DEBUG IP: 123.231.231.123 User: fred A message at DEBUG level with 2 parameters\n" -"2010-09-06 22:38:15,301 d.e.f INFO IP: 123.231.231.123 User: fred A message at INFO level with 2 parameters" -msgstr "" - +"2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " +"debug message\n" +"2010-09-06 22:38:15,300 a.b.c INFO IP: 192.168.0.1 User: sheila An " +"info message with some parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f ERROR IP: 127.0.0.1 User: jim A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 127.0.0.1 User: sheila A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f ERROR IP: 123.231.231.123 User: fred A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 192.168.0.1 User: jim A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 192.168.0.1 User: jim A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f ERROR IP: 127.0.0.1 User: sheila A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f DEBUG IP: 123.231.231.123 User: fred A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f INFO IP: 123.231.231.123 User: fred A " +"message at INFO level with 2 parameters" +msgstr "" + +#: ../../howto/logging-cookbook.rst:1028 msgid "Use of ``contextvars``" msgstr "" -msgid "Since Python 3.7, the :mod:`contextvars` module has provided context-local storage which works for both :mod:`threading` and :mod:`asyncio` processing needs. This type of storage may thus be generally preferable to thread-locals. The following example shows how, in a multi-threaded environment, logs can populated with contextual information such as, for example, request attributes handled by web applications." +#: ../../howto/logging-cookbook.rst:1030 +msgid "" +"Since Python 3.7, the :mod:`contextvars` module has provided context-local " +"storage which works for both :mod:`threading` and :mod:`asyncio` processing " +"needs. This type of storage may thus be generally preferable to thread-" +"locals. The following example shows how, in a multi-threaded environment, " +"logs can populated with contextual information such as, for example, request " +"attributes handled by web applications." msgstr "" -msgid "For the purposes of illustration, say that you have different web applications, each independent of the other but running in the same Python process and using a library common to them. How can each of these applications have their own log, where all logging messages from the library (and other request processing code) are directed to the appropriate application's log file, while including in the log additional contextual information such as client IP, HTTP request method and client username?" +#: ../../howto/logging-cookbook.rst:1036 +msgid "" +"For the purposes of illustration, say that you have different web " +"applications, each independent of the other but running in the same Python " +"process and using a library common to them. How can each of these " +"applications have their own log, where all logging messages from the library " +"(and other request processing code) are directed to the appropriate " +"application's log file, while including in the log additional contextual " +"information such as client IP, HTTP request method and client username?" msgstr "" +#: ../../howto/logging-cookbook.rst:1043 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" +#: ../../howto/logging-cookbook.rst:1045 msgid "" "# webapplib.py\n" "import logging\n" @@ -999,9 +1411,14 @@ msgid "" " time.sleep(0.01)" msgstr "" -msgid "We can simulate the multiple web applications by means of two simple classes, ``Request`` and ``WebApp``. These simulate how real threaded web applications work - each request is handled by a thread:" +#: ../../howto/logging-cookbook.rst:1059 +msgid "" +"We can simulate the multiple web applications by means of two simple " +"classes, ``Request`` and ``WebApp``. These simulate how real threaded web " +"applications work - each request is handled by a thread:" msgstr "" +#: ../../howto/logging-cookbook.rst:1063 msgid "" "# main.py\n" "import argparse\n" @@ -1018,7 +1435,8 @@ msgid "" "\n" "class Request:\n" " \"\"\"\n" -" A simple dummy request class which just holds dummy HTTP request method,\n" +" A simple dummy request class which just holds dummy HTTP request " +"method,\n" " client IP address and client username\n" " \"\"\"\n" " def __init__(self, method, ip, user):\n" @@ -1026,9 +1444,12 @@ msgid "" " self.ip = ip\n" " self.user = user\n" "\n" -"# A dummy set of requests which will be used in the simulation - we'll just pick\n" -"# from this list randomly. Note that all GET requests are from 192.168.2.XXX\n" -"# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three users\n" +"# A dummy set of requests which will be used in the simulation - we'll just " +"pick\n" +"# from this list randomly. Note that all GET requests are from " +"192.168.2.XXX\n" +"# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " +"users\n" "# are represented in the sample requests.\n" "\n" "REQUESTS = [\n" @@ -1040,12 +1461,15 @@ msgid "" " Request('POST', '192.168.3.22', 'sheila'),\n" "]\n" "\n" -"# Note that the format string includes references to request context information\n" +"# Note that the format string includes references to request context " +"information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" +"(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" -"# Create our context variables. These will be filled at the start of request\n" +"# Create our context variables. These will be filled at the start of " +"request\n" "# processing, and used in the logging that happens during that processing\n" "\n" "ctx_request = ContextVar('request')\n" @@ -1053,7 +1477,8 @@ msgid "" "\n" "class InjectingFilter(logging.Filter):\n" " \"\"\"\n" -" A filter which injects context-specific information into logs and ensures\n" +" A filter which injects context-specific information into logs and " +"ensures\n" " that only information for a specific webapp is included in its log\n" " \"\"\"\n" " def __init__(self, app):\n" @@ -1069,7 +1494,8 @@ msgid "" "\n" "class WebApp:\n" " \"\"\"\n" -" A dummy web application class which has its own handler and filter for a\n" +" A dummy web application class which has its own handler and filter for " +"a\n" " webapp-specific log.\n" " \"\"\"\n" " def __init__(self, name):\n" @@ -1084,7 +1510,8 @@ msgid "" " def process_request(self, request):\n" " \"\"\"\n" " This is the dummy method for processing a request. It's called on a\n" -" different thread for every request. We store the context information into\n" +" different thread for every request. We store the context information " +"into\n" " the context vars before doing anything else.\n" " \"\"\"\n" " ctx_request.set(request)\n" @@ -1100,14 +1527,17 @@ msgid "" " ap = argparse.ArgumentParser(formatter_class=adhf, prog=fn,\n" " description='Simulate a couple of web '\n" " 'applications handling some '\n" -" 'requests, showing how request '\n" +" 'requests, showing how request " +"'\n" " 'context can be used to '\n" " 'populate logs')\n" " aa = ap.add_argument\n" -" aa('--count', '-c', type=int, default=100, help='How many requests to simulate')\n" +" aa('--count', '-c', type=int, default=100, help='How many requests to " +"simulate')\n" " options = ap.parse_args()\n" "\n" -" # Create the dummy webapps and put them in a list which we can use to select\n" +" # Create the dummy webapps and put them in a list which we can use to " +"select\n" " # from randomly\n" " app1 = WebApp('app1')\n" " app2 = WebApp('app2')\n" @@ -1125,7 +1555,8 @@ msgid "" " app = choice(apps)\n" " request = choice(REQUESTS)\n" " # Process the request in its own thread\n" -" t = threading.Thread(target=app.process_request, args=(request,))\n" +" t = threading.Thread(target=app.process_request, " +"args=(request,))\n" " threads.append(t)\n" " t.start()\n" " except KeyboardInterrupt:\n" @@ -1142,9 +1573,18 @@ msgid "" " main()" msgstr "" -msgid "If you run the above, you should find that roughly half the requests go into :file:`app1.log` and the rest into :file:`app2.log`, and the all the requests are logged to :file:`app.log`. Each webapp-specific log will contain only log entries for only that webapp, and the request information will be displayed consistently in the log (i.e. the information in each dummy request will always appear together in a log line). This is illustrated by the following shell output:" +#: ../../howto/logging-cookbook.rst:1203 +msgid "" +"If you run the above, you should find that roughly half the requests go " +"into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " +"requests are logged to :file:`app.log`. Each webapp-specific log will " +"contain only log entries for only that webapp, and the request information " +"will be displayed consistently in the log (i.e. the information in each " +"dummy request will always appear together in a log line). This is " +"illustrated by the following shell output:" msgstr "" +#: ../../howto/logging-cookbook.rst:1210 msgid "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" @@ -1155,24 +1595,40 @@ msgid "" " 300 app.log\n" " 600 total\n" "~/logging-contextual-webapp$ head -3 app1.log\n" -"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request processing started\n" -"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello from webapplib!\n" -"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request processing started\n" +"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello " +"from webapplib!\n" +"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" "~/logging-contextual-webapp$ head -3 app2.log\n" -"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request processing started\n" -"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello from webapplib!\n" -"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request processing started\n" +"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request " +"processing started\n" +"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello " +"from webapplib!\n" +"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request " +"processing started\n" "~/logging-contextual-webapp$ head app.log\n" -"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request processing started\n" -"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello from webapplib!\n" -"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request processing started\n" -"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request processing started\n" -"Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello from webapplib!\n" -"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello from webapplib!\n" -"Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request processing started\n" -"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request processing started\n" -"Thread-4 (process_request) app2 webapplib fred 192.168.2.22 GET Hello from webapplib!\n" -"Thread-6 (process_request) app1 __main__ jim 192.168.3.21 POST Request processing started\n" +"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request " +"processing started\n" +"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello " +"from webapplib!\n" +"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request " +"processing started\n" +"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello " +"from webapplib!\n" +"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello " +"from webapplib!\n" +"Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request " +"processing started\n" +"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-4 (process_request) app2 webapplib fred 192.168.2.22 GET Hello " +"from webapplib!\n" +"Thread-6 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" "~/logging-contextual-webapp$ grep app1 app1.log | wc -l\n" "153\n" "~/logging-contextual-webapp$ grep app2 app2.log | wc -l\n" @@ -1183,12 +1639,19 @@ msgid "" "147" msgstr "" +#: ../../howto/logging-cookbook.rst:1250 msgid "Imparting contextual information in handlers" msgstr "" -msgid "Each :class:`~Handler` has its own chain of filters. If you want to add contextual information to a :class:`LogRecord` without leaking it to other handlers, you can use a filter that returns a new :class:`~LogRecord` instead of modifying it in-place, as shown in the following script::" +#: ../../howto/logging-cookbook.rst:1252 +msgid "" +"Each :class:`~Handler` has its own chain of filters. If you want to add " +"contextual information to a :class:`LogRecord` without leaking it to other " +"handlers, you can use a filter that returns a new :class:`~LogRecord` " +"instead of modifying it in-place, as shown in the following script::" msgstr "" +#: ../../howto/logging-cookbook.rst:1257 msgid "" "import copy\n" "import logging\n" @@ -1210,18 +1673,51 @@ msgid "" " logger.info('A log message')" msgstr "" +#: ../../howto/logging-cookbook.rst:1279 msgid "Logging to a single file from multiple processes" msgstr "" -msgid "Although logging is thread-safe, and logging to a single file from multiple threads in a single process *is* supported, logging to a single file from *multiple processes* is *not* supported, because there is no standard way to serialize access to a single file across multiple processes in Python. If you need to log to a single file from multiple processes, one way of doing this is to have all the processes log to a :class:`~handlers.SocketHandler`, and have a separate process which implements a socket server which reads from the socket and logs to file. (If you prefer, you can dedicate one thread in one of the existing processes to perform this function.) :ref:`This section ` documents this approach in more detail and includes a working socket receiver which can be used as a starting point for you to adapt in your own applications." -msgstr "" - -msgid "You could also write your own handler which uses the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to serialize access to the file from your processes. The stdlib :class:`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." -msgstr "" - -msgid "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send all logging events to one of the processes in your multi-process application. The following example script demonstrates how you can do this; in the example a separate listener process listens for events sent by other processes and logs them according to its own logging configuration. Although the example only demonstrates one way of doing it (for example, you may want to use a listener thread rather than a separate listener process -- the implementation would be analogous) it does allow for completely different logging configurations for the listener and the other processes in your application, and can be used as the basis for code meeting your own specific requirements::" +#: ../../howto/logging-cookbook.rst:1281 +msgid "" +"Although logging is thread-safe, and logging to a single file from multiple " +"threads in a single process *is* supported, logging to a single file from " +"*multiple processes* is *not* supported, because there is no standard way to " +"serialize access to a single file across multiple processes in Python. If " +"you need to log to a single file from multiple processes, one way of doing " +"this is to have all the processes log to a :class:`~handlers.SocketHandler`, " +"and have a separate process which implements a socket server which reads " +"from the socket and logs to file. (If you prefer, you can dedicate one " +"thread in one of the existing processes to perform this " +"function.) :ref:`This section ` documents this approach in " +"more detail and includes a working socket receiver which can be used as a " +"starting point for you to adapt in your own applications." +msgstr "" + +#: ../../howto/logging-cookbook.rst:1294 +msgid "" +"You could also write your own handler which uses " +"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " +"module to serialize access to the file from your processes. The " +"stdlib :class:`FileHandler` and subclasses do not make use " +"of :mod:`multiprocessing`." msgstr "" +#: ../../howto/logging-cookbook.rst:1301 +msgid "" +"Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " +"all logging events to one of the processes in your multi-process " +"application. The following example script demonstrates how you can do this; " +"in the example a separate listener process listens for events sent by other " +"processes and logs them according to its own logging configuration. Although " +"the example only demonstrates one way of doing it (for example, you may want " +"to use a listener thread rather than a separate listener process -- the " +"implementation would be analogous) it does allow for completely different " +"logging configurations for the listener and the other processes in your " +"application, and can be used as the basis for code meeting your own specific " +"requirements::" +msgstr "" + +#: ../../howto/logging-cookbook.rst:1312 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1233,21 +1729,29 @@ msgid "" "import time\n" "\n" "#\n" -"# Because you'll want to define the logging configurations for listener and workers, the\n" -"# listener and worker process functions take a configurer parameter which is a callable\n" -"# for configuring logging for that process. These functions are also passed the queue,\n" +"# Because you'll want to define the logging configurations for listener and " +"workers, the\n" +"# listener and worker process functions take a configurer parameter which is " +"a callable\n" +"# for configuring logging for that process. These functions are also passed " +"the queue,\n" "# which they use for communication.\n" "#\n" -"# In practice, you can configure the listener however you want, but note that in this\n" -"# simple example, the listener does not apply level or filter logic to received records.\n" -"# In practice, you would probably want to do this logic in the worker processes, to avoid\n" +"# In practice, you can configure the listener however you want, but note " +"that in this\n" +"# simple example, the listener does not apply level or filter logic to " +"received records.\n" +"# In practice, you would probably want to do this logic in the worker " +"processes, to avoid\n" "# sending events which would be filtered out between processes.\n" "#\n" -"# The size of the rotated files is made small so you can see the results easily.\n" +"# The size of the rotated files is made small so you can see the results " +"easily.\n" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" +"(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1259,10 +1763,12 @@ msgid "" " while True:\n" " try:\n" " record = queue.get()\n" -" if record is None: # We send this as a sentinel to tell the listener to quit.\n" +" if record is None: # We send this as a sentinel to tell the " +"listener to quit.\n" " break\n" " logger = logging.getLogger(record.name)\n" -" logger.handle(record) # No level or filter logic applied - just do it!\n" +" logger.handle(record) # No level or filter logic applied - just " +"do it!\n" " except Exception:\n" " import sys, traceback\n" " print('Whoops! Problem:', file=sys.stderr)\n" @@ -1291,7 +1797,8 @@ msgid "" " # send all messages, for demo; no other level or filter logic applied.\n" " root.setLevel(logging.DEBUG)\n" "\n" -"# This is the worker process top-level loop, which just logs ten events with\n" +"# This is the worker process top-level loop, which just logs ten events " +"with\n" "# random intervening delays before terminating.\n" "# The print messages are just so you know it's doing something!\n" "def worker_process(queue, configurer):\n" @@ -1306,7 +1813,8 @@ msgid "" " logger.log(level, message)\n" " print('Worker finished: %s' % name)\n" "\n" -"# Here's where the demo gets orchestrated. Create the queue, create and start\n" +"# Here's where the demo gets orchestrated. Create the queue, create and " +"start\n" "# the listener, create ten workers and start them, wait for them to finish,\n" "# then send a None to the queue to tell the listener to finish.\n" "def main():\n" @@ -1329,9 +1837,13 @@ msgid "" " main()" msgstr "" -msgid "A variant of the above script keeps the logging in the main process, in a separate thread::" +#: ../../howto/logging-cookbook.rst:1417 +msgid "" +"A variant of the above script keeps the logging in the main process, in a " +"separate thread::" msgstr "" +#: ../../howto/logging-cookbook.rst:1420 msgid "" "import logging\n" "import logging.config\n" @@ -1371,7 +1883,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -1411,7 +1924,8 @@ msgid "" " }\n" " workers = []\n" " for i in range(5):\n" -" wp = Process(target=worker_process, name='worker %d' % (i + 1), args=(q,))\n" +" wp = Process(target=worker_process, name='worker %d' % (i + 1), " +"args=(q,))\n" " workers.append(wp)\n" " wp.start()\n" " logging.config.dictConfig(d)\n" @@ -1426,27 +1940,46 @@ msgid "" " lp.join()" msgstr "" -msgid "This variant shows how you can e.g. apply configuration for particular loggers - e.g. the ``foo`` logger has a special handler which stores all events in the ``foo`` subsystem in a file ``mplog-foo.log``. This will be used by the logging machinery in the main process (even though the logging events are generated in the worker processes) to direct the messages to the appropriate destinations." +#: ../../howto/logging-cookbook.rst:1512 +msgid "" +"This variant shows how you can e.g. apply configuration for particular " +"loggers - e.g. the ``foo`` logger has a special handler which stores all " +"events in the ``foo`` subsystem in a file ``mplog-foo.log``. This will be " +"used by the logging machinery in the main process (even though the logging " +"events are generated in the worker processes) to direct the messages to the " +"appropriate destinations." msgstr "" +#: ../../howto/logging-cookbook.rst:1519 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "" -msgid "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start your worker processes, you need to create the queue slightly differently. Instead of" +#: ../../howto/logging-cookbook.rst:1521 +msgid "" +"If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " +"your worker processes, you need to create the queue slightly differently. " +"Instead of" msgstr "" +#: ../../howto/logging-cookbook.rst:1525 msgid "queue = multiprocessing.Queue(-1)" msgstr "" +#: ../../howto/logging-cookbook.rst:1529 msgid "you should use" msgstr "" -msgid "queue = multiprocessing.Manager().Queue(-1) # also works with the examples above" +#: ../../howto/logging-cookbook.rst:1531 +msgid "" +"queue = multiprocessing.Manager().Queue(-1) # also works with the examples " +"above" msgstr "" +#: ../../howto/logging-cookbook.rst:1535 msgid "and you can then replace the worker creation from this::" msgstr "" +#: ../../howto/logging-cookbook.rst:1537 msgid "" "workers = []\n" "for i in range(10):\n" @@ -1458,27 +1991,47 @@ msgid "" " w.join()" msgstr "" +#: ../../howto/logging-cookbook.rst:1546 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" +#: ../../howto/logging-cookbook.rst:1548 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" +#: ../../howto/logging-cookbook.rst:1553 msgid "Deploying web applications using Gunicorn and uWSGI" msgstr "" -msgid "When deploying web applications using `Gunicorn `_ or `uWSGI `_ (or similar), multiple worker processes are created to handle client requests. In such environments, avoid creating file-based handlers directly in your web application. Instead, use a :class:`SocketHandler` to log from the web application to a listener in a separate process. This can be set up using a process management tool such as Supervisor - see `Running a logging socket listener in production`_ for more details." +#: ../../howto/logging-cookbook.rst:1555 +msgid "" +"When deploying web applications using `Gunicorn `_ or " +"`uWSGI `_ (or similar), " +"multiple worker processes are created to handle client requests. In such " +"environments, avoid creating file-based handlers directly in your web " +"application. Instead, use a :class:`SocketHandler` to log from the web " +"application to a listener in a separate process. This can be set up using a " +"process management tool such as Supervisor - see `Running a logging socket " +"listener in production`_ for more details." msgstr "" +#: ../../howto/logging-cookbook.rst:1565 msgid "Using file rotation" msgstr "" -msgid "Sometimes you want to let a log file grow to a certain size, then open a new file and log to that. You may want to keep a certain number of these files, and when that many files have been created, rotate the files so that the number of files and the size of the files both remain bounded. For this usage pattern, the logging package provides a :class:`RotatingFileHandler`::" +#: ../../howto/logging-cookbook.rst:1570 +msgid "" +"Sometimes you want to let a log file grow to a certain size, then open a new " +"file and log to that. You may want to keep a certain number of these files, " +"and when that many files have been created, rotate the files so that the " +"number of files and the size of the files both remain bounded. For this " +"usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" +#: ../../howto/logging-cookbook.rst:1576 msgid "" "import glob\n" "import logging\n" @@ -1507,9 +2060,13 @@ msgid "" " print(filename)" msgstr "" -msgid "The result should be 6 separate files, each with part of the log history for the application:" +#: ../../howto/logging-cookbook.rst:1602 +msgid "" +"The result should be 6 separate files, each with part of the log history for " +"the application:" msgstr "" +#: ../../howto/logging-cookbook.rst:1605 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -1519,21 +2076,47 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -msgid "The most current file is always :file:`logging_rotatingfile_example.out`, and each time it reaches the size limit it is renamed with the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix (``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." +#: ../../howto/logging-cookbook.rst:1614 +msgid "" +"The most current file is always :file:`logging_rotatingfile_example.out`, " +"and each time it reaches the size limit it is renamed with the suffix " +"``.1``. Each of the existing backup files is renamed to increment the suffix " +"(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -msgid "Obviously this example sets the log length much too small as an extreme example. You would want to set *maxBytes* to an appropriate value." +#: ../../howto/logging-cookbook.rst:1619 +msgid "" +"Obviously this example sets the log length much too small as an extreme " +"example. You would want to set *maxBytes* to an appropriate value." msgstr "" +#: ../../howto/logging-cookbook.rst:1627 msgid "Use of alternative formatting styles" msgstr "" -msgid "When logging was added to the Python standard library, the only way of formatting messages with variable content was to use the %-formatting method. Since then, Python has gained two new formatting approaches: :class:`string.Template` (added in Python 2.4) and :meth:`str.format` (added in Python 2.6)." -msgstr "" - -msgid "Logging (as of 3.2) provides improved support for these two additional formatting styles. The :class:`Formatter` class been enhanced to take an additional, optional keyword parameter named ``style``. This defaults to ``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond to the other two formatting styles. Backwards compatibility is maintained by default (as you would expect), but by explicitly specifying a style parameter, you get the ability to specify format strings which work with :meth:`str.format` or :class:`string.Template`. Here's an example console session to show the possibilities:" +#: ../../howto/logging-cookbook.rst:1629 +msgid "" +"When logging was added to the Python standard library, the only way of " +"formatting messages with variable content was to use the %-formatting " +"method. Since then, Python has gained two new formatting " +"approaches: :class:`string.Template` (added in Python 2.4) " +"and :meth:`str.format` (added in Python 2.6)." msgstr "" +#: ../../howto/logging-cookbook.rst:1635 +msgid "" +"Logging (as of 3.2) provides improved support for these two additional " +"formatting styles. The :class:`Formatter` class been enhanced to take an " +"additional, optional keyword parameter named ``style``. This defaults to " +"``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " +"to the other two formatting styles. Backwards compatibility is maintained by " +"default (as you would expect), but by explicitly specifying a style " +"parameter, you get the ability to specify format strings which work " +"with :meth:`str.format` or :class:`string.Template`. Here's an example " +"console session to show the possibilities:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:1645 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -1558,21 +2141,46 @@ msgid "" ">>>" msgstr "" -msgid "Note that the formatting of logging messages for final output to logs is completely independent of how an individual logging message is constructed. That can still use %-formatting, as shown here::" +#: ../../howto/logging-cookbook.rst:1669 +msgid "" +"Note that the formatting of logging messages for final output to logs is " +"completely independent of how an individual logging message is constructed. " +"That can still use %-formatting, as shown here::" msgstr "" +#: ../../howto/logging-cookbook.rst:1673 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -msgid "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take positional parameters for the actual logging message itself, with keyword parameters used only for determining options for how to handle the actual logging call (e.g. the ``exc_info`` keyword parameter to indicate that traceback information should be logged, or the ``extra`` keyword parameter to indicate additional contextual information to be added to the log). So you cannot directly make logging calls using :meth:`str.format` or :class:`string.Template` syntax, because internally the logging package uses %-formatting to merge the format string and the variable arguments. There would be no changing this while preserving backward compatibility, since all logging calls which are out there in existing code will be using %-format strings." -msgstr "" - -msgid "There is, however, a way that you can use {}- and $- formatting to construct your individual log messages. Recall that for a message you can use an arbitrary object as a message format string, and that the logging package will call ``str()`` on that object to get the actual format string. Consider the following two classes::" +#: ../../howto/logging-cookbook.rst:1677 +msgid "" +"Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " +"positional parameters for the actual logging message itself, with keyword " +"parameters used only for determining options for how to handle the actual " +"logging call (e.g. the ``exc_info`` keyword parameter to indicate that " +"traceback information should be logged, or the ``extra`` keyword parameter " +"to indicate additional contextual information to be added to the log). So " +"you cannot directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." +msgstr "" + +#: ../../howto/logging-cookbook.rst:1690 +msgid "" +"There is, however, a way that you can use {}- and $- formatting to construct " +"your individual log messages. Recall that for a message you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call ``str()`` on that object to get the actual format string. Consider " +"the following two classes::" msgstr "" +#: ../../howto/logging-cookbook.rst:1696 ../../howto/logging-cookbook.rst:2784 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -1593,12 +2201,25 @@ msgid "" " return Template(self.fmt).substitute(**self.kwargs)" msgstr "" -msgid "Either of these can be used in place of a format string, to allow {}- or $-formatting to be used to build the actual \"message\" part which appears in the formatted log output in place of \"%(message)s\" or \"{message}\" or \"$message\". It's a little unwieldy to use the class names whenever you want to log something, but it's quite palatable if you use an alias such as __ (double underscore --- not to be confused with _, the single underscore used as a synonym/alias for :func:`gettext.gettext` or its brethren)." +#: ../../howto/logging-cookbook.rst:1714 +msgid "" +"Either of these can be used in place of a format string, to allow {}- or $-" +"formatting to be used to build the actual \"message\" part which appears in " +"the formatted log output in place of \"%(message)s\" or \"{message}\" or " +"\"$message\". It's a little unwieldy to use the class names whenever you " +"want to log something, but it's quite palatable if you use an alias such as " +"__ (double underscore --- not to be confused with _, the single underscore " +"used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -msgid "The above classes are not included in Python, though they're easy enough to copy and paste into your own code. They can be used as follows (assuming that they're declared in a module called ``wherever``):" +#: ../../howto/logging-cookbook.rst:1722 +msgid "" +"The above classes are not included in Python, though they're easy enough to " +"copy and paste into your own code. They can be used as follows (assuming " +"that they're declared in a module called ``wherever``):" msgstr "" +#: ../../howto/logging-cookbook.rst:1726 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -1617,15 +2238,31 @@ msgid "" ">>>" msgstr "" -msgid "While the above examples use ``print()`` to show how the formatting works, you would of course use ``logger.debug()`` or similar to actually log using this approach." +#: ../../howto/logging-cookbook.rst:1744 +msgid "" +"While the above examples use ``print()`` to show how the formatting works, " +"you would of course use ``logger.debug()`` or similar to actually log using " +"this approach." msgstr "" -msgid "One thing to note is that you pay no significant performance penalty with this approach: the actual formatting happens not when you make the logging call, but when (and if) the logged message is actually about to be output to a log by a handler. So the only slightly unusual thing which might trip you up is that the parentheses go around the format string and the arguments, not just the format string. That's because the __ notation is just syntax sugar for a constructor call to one of the :samp:`{XXX}Message` classes." +#: ../../howto/logging-cookbook.rst:1748 +msgid "" +"One thing to note is that you pay no significant performance penalty with " +"this approach: the actual formatting happens not when you make the logging " +"call, but when (and if) the logged message is actually about to be output to " +"a log by a handler. So the only slightly unusual thing which might trip you " +"up is that the parentheses go around the format string and the arguments, " +"not just the format string. That's because the __ notation is just syntax " +"sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -msgid "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar effect to the above, as in the following example::" +#: ../../howto/logging-cookbook.rst:1756 +msgid "" +"If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " +"effect to the above, as in the following example::" msgstr "" +#: ../../howto/logging-cookbook.rst:1759 msgid "" "import logging\n" "\n" @@ -1654,48 +2291,113 @@ msgid "" " main()" msgstr "" -msgid "The above script should log the message ``Hello, world!`` when run with Python 3.8 or later." +#: ../../howto/logging-cookbook.rst:1785 +msgid "" +"The above script should log the message ``Hello, world!`` when run with " +"Python 3.8 or later." msgstr "" +#: ../../howto/logging-cookbook.rst:1794 msgid "Customizing ``LogRecord``" msgstr "" -msgid "Every logging event is represented by a :class:`LogRecord` instance. When an event is logged and not filtered out by a logger's level, a :class:`LogRecord` is created, populated with information about the event and then passed to the handlers for that logger (and its ancestors, up to and including the logger where further propagation up the hierarchy is disabled). Before Python 3.2, there were only two places where this creation was done:" +#: ../../howto/logging-cookbook.rst:1796 +msgid "" +"Every logging event is represented by a :class:`LogRecord` instance. When an " +"event is logged and not filtered out by a logger's level, " +"a :class:`LogRecord` is created, populated with information about the event " +"and then passed to the handlers for that logger (and its ancestors, up to " +"and including the logger where further propagation up the hierarchy is " +"disabled). Before Python 3.2, there were only two places where this creation " +"was done:" msgstr "" -msgid ":meth:`Logger.makeRecord`, which is called in the normal process of logging an event. This invoked :class:`LogRecord` directly to create an instance." +#: ../../howto/logging-cookbook.rst:1803 +msgid "" +":meth:`Logger.makeRecord`, which is called in the normal process of logging " +"an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -msgid ":func:`makeLogRecord`, which is called with a dictionary containing attributes to be added to the LogRecord. This is typically invoked when a suitable dictionary has been received over the network (e.g. in pickle form via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:`~handlers.HTTPHandler`)." +#: ../../howto/logging-cookbook.rst:1806 +msgid "" +":func:`makeLogRecord`, which is called with a dictionary containing " +"attributes to be added to the LogRecord. This is typically invoked when a " +"suitable dictionary has been received over the network (e.g. in pickle form " +"via a :class:`~handlers.SocketHandler`, or in JSON form via " +"an :class:`~handlers.HTTPHandler`)." msgstr "" -msgid "This has usually meant that if you need to do anything special with a :class:`LogRecord`, you've had to do one of the following." +#: ../../howto/logging-cookbook.rst:1812 +msgid "" +"This has usually meant that if you need to do anything special with " +"a :class:`LogRecord`, you've had to do one of the following." msgstr "" -msgid "Create your own :class:`Logger` subclass, which overrides :meth:`Logger.makeRecord`, and set it using :func:`~logging.setLoggerClass` before any loggers that you care about are instantiated." +#: ../../howto/logging-cookbook.rst:1815 +msgid "" +"Create your own :class:`Logger` subclass, which " +"overrides :meth:`Logger.makeRecord`, and set it " +"using :func:`~logging.setLoggerClass` before any loggers that you care about " +"are instantiated." msgstr "" -msgid "Add a :class:`Filter` to a logger or handler, which does the necessary special manipulation you need when its :meth:`~Filter.filter` method is called." +#: ../../howto/logging-cookbook.rst:1818 +msgid "" +"Add a :class:`Filter` to a logger or handler, which does the necessary " +"special manipulation you need when its :meth:`~Filter.filter` method is " +"called." msgstr "" -msgid "The first approach would be a little unwieldy in the scenario where (say) several different libraries wanted to do different things. Each would attempt to set its own :class:`Logger` subclass, and the one which did this last would win." +#: ../../howto/logging-cookbook.rst:1822 +msgid "" +"The first approach would be a little unwieldy in the scenario where (say) " +"several different libraries wanted to do different things. Each would " +"attempt to set its own :class:`Logger` subclass, and the one which did this " +"last would win." msgstr "" -msgid "The second approach works reasonably well for many cases, but does not allow you to e.g. use a specialized subclass of :class:`LogRecord`. Library developers can set a suitable filter on their loggers, but they would have to remember to do this every time they introduced a new logger (which they would do simply by adding new packages or modules and doing ::" +#: ../../howto/logging-cookbook.rst:1827 +msgid "" +"The second approach works reasonably well for many cases, but does not allow " +"you to e.g. use a specialized subclass of :class:`LogRecord`. Library " +"developers can set a suitable filter on their loggers, but they would have " +"to remember to do this every time they introduced a new logger (which they " +"would do simply by adding new packages or modules and doing ::" msgstr "" +#: ../../howto/logging-cookbook.rst:1833 msgid "logger = logging.getLogger(__name__)" msgstr "" -msgid "at module level). It's probably one too many things to think about. Developers could also add the filter to a :class:`~logging.NullHandler` attached to their top-level logger, but this would not be invoked if an application developer attached a handler to a lower-level library logger --- so output from that handler would not reflect the intentions of the library developer." +#: ../../howto/logging-cookbook.rst:1835 +msgid "" +"at module level). It's probably one too many things to think about. " +"Developers could also add the filter to a :class:`~logging.NullHandler` " +"attached to their top-level logger, but this would not be invoked if an " +"application developer attached a handler to a lower-level library logger --- " +"so output from that handler would not reflect the intentions of the library " +"developer." msgstr "" -msgid "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done through a factory, which you can specify. The factory is just a callable you can set with :func:`~logging.setLogRecordFactory`, and interrogate with :func:`~logging.getLogRecordFactory`. The factory is invoked with the same signature as the :class:`~logging.LogRecord` constructor, as :class:`LogRecord` is the default setting for the factory." +#: ../../howto/logging-cookbook.rst:1841 +msgid "" +"In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " +"through a factory, which you can specify. The factory is just a callable you " +"can set with :func:`~logging.setLogRecordFactory`, and interrogate " +"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " +"same signature as the :class:`~logging.LogRecord` constructor, " +"as :class:`LogRecord` is the default setting for the factory." msgstr "" -msgid "This approach allows a custom factory to control all aspects of LogRecord creation. For example, you could return a subclass, or just add some additional attributes to the record once created, using a pattern similar to this::" +#: ../../howto/logging-cookbook.rst:1848 +msgid "" +"This approach allows a custom factory to control all aspects of LogRecord " +"creation. For example, you could return a subclass, or just add some " +"additional attributes to the record once created, using a pattern similar to " +"this::" msgstr "" +#: ../../howto/logging-cookbook.rst:1852 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1707,18 +2409,32 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -msgid "This pattern allows different libraries to chain factories together, and as long as they don't overwrite each other's attributes or unintentionally overwrite the attributes provided as standard, there should be no surprises. However, it should be borne in mind that each link in the chain adds run-time overhead to all logging operations, and the technique should only be used when the use of a :class:`Filter` does not provide the desired result." +#: ../../howto/logging-cookbook.rst:1861 +msgid "" +"This pattern allows different libraries to chain factories together, and as " +"long as they don't overwrite each other's attributes or unintentionally " +"overwrite the attributes provided as standard, there should be no surprises. " +"However, it should be borne in mind that each link in the chain adds run-" +"time overhead to all logging operations, and the technique should only be " +"used when the use of a :class:`Filter` does not provide the desired result." msgstr "" +#: ../../howto/logging-cookbook.rst:1873 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" +#: ../../howto/logging-cookbook.rst:1876 ../../howto/logging-cookbook.rst:2009 msgid "Subclass ``QueueHandler``" msgstr "" -msgid "You can use a :class:`QueueHandler` subclass to send messages to other kinds of queues, for example a ZeroMQ 'publish' socket. In the example below,the socket is created separately and passed to the handler (as its 'queue')::" +#: ../../howto/logging-cookbook.rst:1878 +msgid "" +"You can use a :class:`QueueHandler` subclass to send messages to other kinds " +"of queues, for example a ZeroMQ 'publish' socket. In the example below,the " +"socket is created separately and passed to the handler (as its 'queue')::" msgstr "" +#: ../../howto/logging-cookbook.rst:1882 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -1735,9 +2451,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -msgid "Of course there are other ways of organizing this, for example passing in the data needed by the handler to create the socket::" +#: ../../howto/logging-cookbook.rst:1897 +msgid "" +"Of course there are other ways of organizing this, for example passing in " +"the data needed by the handler to create the socket::" msgstr "" +#: ../../howto/logging-cookbook.rst:1900 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -1753,18 +2473,24 @@ msgid "" " self.queue.close()" msgstr "" +#: ../../howto/logging-cookbook.rst:1915 ../../howto/logging-cookbook.rst:1945 msgid "Subclass ``QueueListener``" msgstr "" -msgid "You can also subclass :class:`QueueListener` to get messages from other kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" +#: ../../howto/logging-cookbook.rst:1917 +msgid "" +"You can also subclass :class:`QueueListener` to get messages from other " +"kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" +#: ../../howto/logging-cookbook.rst:1920 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" " self.ctx = kwargs.get('ctx') or zmq.Context()\n" " socket = zmq.Socket(self.ctx, zmq.SUB)\n" -" socket.setsockopt_string(zmq.SUBSCRIBE, '') # subscribe to everything\n" +" socket.setsockopt_string(zmq.SUBSCRIBE, '') # subscribe to " +"everything\n" " socket.connect(uri)\n" " super().__init__(socket, *handlers, **kwargs)\n" "\n" @@ -1773,12 +2499,20 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" +#: ../../howto/logging-cookbook.rst:1935 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -msgid "In a similar way to the above section, we can implement a listener and handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following snippets illustrate -- you can test them in an environment which has ``pynng`` installed. Just for variety, we present the listener first." +#: ../../howto/logging-cookbook.rst:1937 +msgid "" +"In a similar way to the above section, we can implement a listener and " +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The " +"following snippets illustrate -- you can test them in an environment which " +"has ``pynng`` installed. Just for variety, we present the listener first." msgstr "" +#: ../../howto/logging-cookbook.rst:1947 msgid "" "# listener.py\n" "import json\n" @@ -1794,7 +2528,7 @@ msgid "" "class NNGSocketListener(logging.handlers.QueueListener):\n" "\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" -" # Have a timeout for interruptability, and open a\n" +" # Have a timeout for interruptibility, and open a\n" " # subscriber socket\n" " socket = pynng.Sub0(listen=uri, recv_timeout=500)\n" " # The b'' subscription matches all topics\n" @@ -1827,7 +2561,8 @@ msgid "" " pass\n" "\n" "logging.getLogger('pynng').propagate = False\n" -"listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), topics=b'')\n" +"listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), " +"topics=b'')\n" "listener.start()\n" "print('Press Ctrl-C to stop.')\n" "try:\n" @@ -1839,6 +2574,7 @@ msgid "" " listener.stop()" msgstr "" +#: ../../howto/logging-cookbook.rst:2013 msgid "" "# sender.py\n" "import json\n" @@ -1871,7 +2607,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s %(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s %" +"(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -1886,9 +2623,14 @@ msgid "" " time.sleep(delay)" msgstr "" -msgid "You can run the above two snippets in separate command shells. If we run the listener in one shell and run the sender in two separate shells, we should see something like the following. In the first sender shell:" +#: ../../howto/logging-cookbook.rst:2060 +msgid "" +"You can run the above two snippets in separate command shells. If we run the " +"listener in one shell and run the sender in two separate shells, we should " +"see something like the following. In the first sender shell:" msgstr "" +#: ../../howto/logging-cookbook.rst:2064 msgid "" "$ python sender.py\n" "DEBUG myapp 613 Message no. 1\n" @@ -1902,9 +2644,11 @@ msgid "" "(and so on)" msgstr "" +#: ../../howto/logging-cookbook.rst:2077 msgid "In the second sender shell:" msgstr "" +#: ../../howto/logging-cookbook.rst:2079 msgid "" "$ python sender.py\n" "INFO myapp.lib2 657 Message no. 1\n" @@ -1918,9 +2662,11 @@ msgid "" "(and so on)" msgstr "" +#: ../../howto/logging-cookbook.rst:2092 msgid "In the listener shell:" msgstr "" +#: ../../howto/logging-cookbook.rst:2094 msgid "" "$ python listener.py\n" "Press Ctrl-C to stop.\n" @@ -1943,22 +2689,33 @@ msgid "" "(and so on)" msgstr "" -msgid "As you can see, the logging from the two sender processes is interleaved in the listener's output." +#: ../../howto/logging-cookbook.rst:2116 +msgid "" +"As you can see, the logging from the two sender processes is interleaved in " +"the listener's output." msgstr "" +#: ../../howto/logging-cookbook.rst:2121 msgid "An example dictionary-based configuration" msgstr "" -msgid "Below is an example of a logging configuration dictionary - it's taken from the `documentation on the Django project `_. This dictionary is passed to :func:`~config.dictConfig` to put the configuration into effect::" +#: ../../howto/logging-cookbook.rst:2123 +msgid "" +"Below is an example of a logging configuration dictionary - it's taken from " +"the `documentation on the Django project `_. This dictionary is passed " +"to :func:`~config.dictConfig` to put the configuration into effect::" msgstr "" +#: ../../howto/logging-cookbook.rst:2127 msgid "" "LOGGING = {\n" " 'version': 1,\n" " 'disable_existing_loggers': False,\n" " 'formatters': {\n" " 'verbose': {\n" -" 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',\n" +" 'format': '{levelname} {asctime} {module} {process:d} {thread:d} " +"{message}',\n" " 'style': '{',\n" " },\n" " 'simple': {\n" @@ -2003,15 +2760,24 @@ msgid "" "}" msgstr "" -msgid "For more information about this configuration, you can see the `relevant section `_ of the Django documentation." +#: ../../howto/logging-cookbook.rst:2176 +msgid "" +"For more information about this configuration, you can see the `relevant " +"section `_ of the Django documentation." msgstr "" +#: ../../howto/logging-cookbook.rst:2183 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -msgid "An example of how you can define a namer and rotator is given in the following runnable script, which shows gzip compression of the log file::" +#: ../../howto/logging-cookbook.rst:2185 +msgid "" +"An example of how you can define a namer and rotator is given in the " +"following runnable script, which shows gzip compression of the log file::" msgstr "" +#: ../../howto/logging-cookbook.rst:2188 msgid "" "import gzip\n" "import logging\n" @@ -2029,7 +2795,8 @@ msgid "" " os.remove(source)\n" "\n" "\n" -"rh = logging.handlers.RotatingFileHandler('rotated.log', maxBytes=128, backupCount=5)\n" +"rh = logging.handlers.RotatingFileHandler('rotated.log', maxBytes=128, " +"backupCount=5)\n" "rh.rotator = rotator\n" "rh.namer = namer\n" "\n" @@ -2042,9 +2809,12 @@ msgid "" " root.info(f'Message no. {i + 1}')" msgstr "" -msgid "After running this, you will see six new files, five of which are compressed:" +#: ../../howto/logging-cookbook.rst:2216 +msgid "" +"After running this, you will see six new files, five of which are compressed:" msgstr "" +#: ../../howto/logging-cookbook.rst:2218 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2055,18 +2825,38 @@ msgid "" "2023-01-20 02:28:17,767 Message no. 998" msgstr "" +#: ../../howto/logging-cookbook.rst:2229 msgid "A more elaborate multiprocessing example" msgstr "" -msgid "The following working example shows how logging can be used with multiprocessing using configuration files. The configurations are fairly simple, but serve to illustrate how more complex ones could be implemented in a real multiprocessing scenario." -msgstr "" - -msgid "In the example, the main process spawns a listener process and some worker processes. Each of the main process, the listener and the workers have three separate configurations (the workers all share the same configuration). We can see logging in the main process, how the workers log to a QueueHandler and how the listener implements a QueueListener and a more complex logging configuration, and arranges to dispatch events received via the queue to the handlers specified in the configuration. Note that these configurations are purely illustrative, but you should be able to adapt this example to your own scenario." +#: ../../howto/logging-cookbook.rst:2231 +msgid "" +"The following working example shows how logging can be used with " +"multiprocessing using configuration files. The configurations are fairly " +"simple, but serve to illustrate how more complex ones could be implemented " +"in a real multiprocessing scenario." msgstr "" -msgid "Here's the script - the docstrings and the comments hopefully explain how it works::" +#: ../../howto/logging-cookbook.rst:2236 +msgid "" +"In the example, the main process spawns a listener process and some worker " +"processes. Each of the main process, the listener and the workers have three " +"separate configurations (the workers all share the same configuration). We " +"can see logging in the main process, how the workers log to a QueueHandler " +"and how the listener implements a QueueListener and a more complex logging " +"configuration, and arranges to dispatch events received via the queue to the " +"handlers specified in the configuration. Note that these configurations are " +"purely illustrative, but you should be able to adapt this example to your " +"own scenario." +msgstr "" + +#: ../../howto/logging-cookbook.rst:2246 +msgid "" +"Here's the script - the docstrings and the comments hopefully explain how it " +"works::" msgstr "" +#: ../../howto/logging-cookbook.rst:2249 msgid "" "import logging\n" "import logging.config\n" @@ -2078,7 +2868,8 @@ msgid "" "\n" "class MyHandler:\n" " \"\"\"\n" -" A simple handler for logging events. It runs in the listener process and\n" +" A simple handler for logging events. It runs in the listener process " +"and\n" " dispatches events to loggers based on the name in the received record,\n" " which then get dispatched, by the logging system, to the handlers\n" " configured for those loggers.\n" @@ -2091,9 +2882,11 @@ msgid "" " logger = logging.getLogger(record.name)\n" "\n" " if logger.isEnabledFor(record.levelno):\n" -" # The process name is transformed just to show that it's the listener\n" +" # The process name is transformed just to show that it's the " +"listener\n" " # doing the logging to files and console\n" -" record.processName = '%s (for %s)' % (current_process().name, record.processName)\n" +" record.processName = '%s (for %s)' % (current_process().name, " +"record.processName)\n" " logger.handle(record)\n" "\n" "def listener_process(q, stop_event, config):\n" @@ -2116,7 +2909,8 @@ msgid "" " # exist in the child, so it would be created and the message\n" " # would appear - hence the \"if posix\" clause.\n" " logger = logging.getLogger('setup')\n" -" logger.critical('Should not appear, because of disabled logger ...')\n" +" logger.critical('Should not appear, because of disabled " +"logger ...')\n" " stop_event.wait()\n" " listener.stop()\n" "\n" @@ -2147,7 +2941,8 @@ msgid "" " # exist in the child, so it would be created and the message\n" " # would appear - hence the \"if posix\" clause.\n" " logger = logging.getLogger('setup')\n" -" logger.critical('Should not appear, because of disabled logger ...')\n" +" logger.critical('Should not appear, because of disabled " +"logger ...')\n" " for i in range(100):\n" " lvl = random.choice(levels)\n" " logger = logging.getLogger(random.choice(loggers))\n" @@ -2156,7 +2951,8 @@ msgid "" "\n" "def main():\n" " q = Queue()\n" -" # The main process gets a simple configuration which prints to the console.\n" +" # The main process gets a simple configuration which prints to the " +"console.\n" " config_initial = {\n" " 'version': 1,\n" " 'handlers': {\n" @@ -2170,9 +2966,11 @@ msgid "" " 'level': 'DEBUG'\n" " }\n" " }\n" -" # The worker process configuration is just a QueueHandler attached to the\n" +" # The worker process configuration is just a QueueHandler attached to " +"the\n" " # root logger, which allows all messages to be sent to the queue.\n" -" # We disable existing loggers to disable the \"setup\" logger used in the\n" +" # We disable existing loggers to disable the \"setup\" logger used in " +"the\n" " # parent process. This is needed on POSIX because the logger will\n" " # be there in the child following a fork().\n" " config_worker = {\n" @@ -2190,9 +2988,11 @@ msgid "" " }\n" " }\n" " # The listener process configuration shows that the full flexibility of\n" -" # logging configuration is available to dispatch events to handlers however\n" +" # logging configuration is available to dispatch events to handlers " +"however\n" " # you want.\n" -" # We disable existing loggers to disable the \"setup\" logger used in the\n" +" # We disable existing loggers to disable the \"setup\" logger used in " +"the\n" " # parent process. This is needed on POSIX because the logger will\n" " # be there in the child following a fork().\n" " config_listener = {\n" @@ -2201,11 +3001,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" +"(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -2244,7 +3046,8 @@ msgid "" " 'level': 'DEBUG'\n" " }\n" " }\n" -" # Log some initial events, just to show that logging in the parent works\n" +" # Log some initial events, just to show that logging in the parent " +"works\n" " # normally.\n" " logging.config.dictConfig(config_initial)\n" " logger = logging.getLogger('setup')\n" @@ -2276,42 +3079,93 @@ msgid "" " main()" msgstr "" +#: ../../howto/logging-cookbook.rst:2458 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -msgid ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a set of bytes which have the following structure: an optional pure-ASCII component, followed by a UTF-8 Byte Order Mark (BOM), followed by Unicode encoded using UTF-8. (See the :rfc:`relevant section of the specification <5424#section-6>`.)" +#: ../../howto/logging-cookbook.rst:2460 +msgid "" +":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " +"set of bytes which have the following structure: an optional pure-ASCII " +"component, followed by a UTF-8 Byte Order Mark (BOM), followed by Unicode " +"encoded using UTF-8. (See the :rfc:`relevant section of the specification " +"<5424#section-6>`.)" msgstr "" -msgid "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to insert a BOM into the message, but unfortunately, it was implemented incorrectly, with the BOM appearing at the beginning of the message and hence not allowing any pure-ASCII component to appear before it." +#: ../../howto/logging-cookbook.rst:2466 +msgid "" +"In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " +"insert a BOM into the message, but unfortunately, it was implemented " +"incorrectly, with the BOM appearing at the beginning of the message and " +"hence not allowing any pure-ASCII component to appear before it." msgstr "" -msgid "As this behaviour is broken, the incorrect BOM insertion code is being removed from Python 3.2.4 and later. However, it is not being replaced, and if you want to produce :rfc:`5424`-compliant messages which include a BOM, an optional pure-ASCII sequence before it and arbitrary Unicode after it, encoded using UTF-8, then you need to do the following:" +#: ../../howto/logging-cookbook.rst:2472 +msgid "" +"As this behaviour is broken, the incorrect BOM insertion code is being " +"removed from Python 3.2.4 and later. However, it is not being replaced, and " +"if you want to produce :rfc:`5424`-compliant messages which include a BOM, " +"an optional pure-ASCII sequence before it and arbitrary Unicode after it, " +"encoded using UTF-8, then you need to do the following:" msgstr "" -msgid "Attach a :class:`~logging.Formatter` instance to your :class:`~logging.handlers.SysLogHandler` instance, with a format string such as::" +#: ../../howto/logging-cookbook.rst:2478 +msgid "" +"Attach a :class:`~logging.Formatter` instance to " +"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " +"such as::" msgstr "" +#: ../../howto/logging-cookbook.rst:2482 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -msgid "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." +#: ../../howto/logging-cookbook.rst:2484 +msgid "" +"The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " +"a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -msgid "Replace the ASCII section with whatever placeholders you like, but make sure that the data that appears in there after substitution is always ASCII (that way, it will remain unchanged after UTF-8 encoding)." +#: ../../howto/logging-cookbook.rst:2487 +msgid "" +"Replace the ASCII section with whatever placeholders you like, but make sure " +"that the data that appears in there after substitution is always ASCII (that " +"way, it will remain unchanged after UTF-8 encoding)." msgstr "" -msgid "Replace the Unicode section with whatever placeholders you like; if the data which appears there after substitution contains characters outside the ASCII range, that's fine -- it will be encoded using UTF-8." +#: ../../howto/logging-cookbook.rst:2491 +msgid "" +"Replace the Unicode section with whatever placeholders you like; if the data " +"which appears there after substitution contains characters outside the ASCII " +"range, that's fine -- it will be encoded using UTF-8." msgstr "" -msgid "The formatted message *will* be encoded using UTF-8 encoding by ``SysLogHandler``. If you follow the above rules, you should be able to produce :rfc:`5424`-compliant messages. If you don't, logging may not complain, but your messages will not be RFC 5424-compliant, and your syslog daemon may complain." +#: ../../howto/logging-cookbook.rst:2495 +msgid "" +"The formatted message *will* be encoded using UTF-8 encoding by " +"``SysLogHandler``. If you follow the above rules, you should be able to " +"produce :rfc:`5424`-compliant messages. If you don't, logging may not " +"complain, but your messages will not be RFC 5424-compliant, and your syslog " +"daemon may complain." msgstr "" +#: ../../howto/logging-cookbook.rst:2502 msgid "Implementing structured logging" msgstr "" -msgid "Although most logging messages are intended for reading by humans, and thus not readily machine-parseable, there might be circumstances where you want to output messages in a structured format which *is* capable of being parsed by a program (without needing complex regular expressions to parse the log message). This is straightforward to achieve using the logging package. There are a number of ways in which this could be achieved, but the following is a simple approach which uses JSON to serialise the event in a machine-parseable manner::" +#: ../../howto/logging-cookbook.rst:2504 +msgid "" +"Although most logging messages are intended for reading by humans, and thus " +"not readily machine-parseable, there might be circumstances where you want " +"to output messages in a structured format which *is* capable of being parsed " +"by a program (without needing complex regular expressions to parse the log " +"message). This is straightforward to achieve using the logging package. " +"There are a number of ways in which this could be achieved, but the " +"following is a simple approach which uses JSON to serialise the event in a " +"machine-parseable manner::" msgstr "" +#: ../../howto/logging-cookbook.rst:2512 msgid "" "import json\n" "import logging\n" @@ -2330,18 +3184,29 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" +#: ../../howto/logging-cookbook.rst:2528 msgid "If the above script is run, it prints:" msgstr "" -msgid "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": \"bar\"}" +#: ../../howto/logging-cookbook.rst:2530 +msgid "" +"message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " +"\"bar\"}" msgstr "" -msgid "Note that the order of items might be different according to the version of Python used." +#: ../../howto/logging-cookbook.rst:2534 ../../howto/logging-cookbook.rst:2576 +msgid "" +"Note that the order of items might be different according to the version of " +"Python used." msgstr "" -msgid "If you need more specialised processing, you can use a custom JSON encoder, as in the following complete example::" +#: ../../howto/logging-cookbook.rst:2537 +msgid "" +"If you need more specialised processing, you can use a custom JSON encoder, " +"as in the following complete example::" msgstr "" +#: ../../howto/logging-cookbook.rst:2540 msgid "" "import json\n" "import logging\n" @@ -2374,18 +3239,29 @@ msgid "" " main()" msgstr "" +#: ../../howto/logging-cookbook.rst:2570 msgid "When the above script is run, it prints:" msgstr "" +#: ../../howto/logging-cookbook.rst:2572 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "" +#: ../../howto/logging-cookbook.rst:2585 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -msgid "There are times when you want to customize logging handlers in particular ways, and if you use :func:`dictConfig` you may be able to do this without subclassing. As an example, consider that you may want to set the ownership of a log file. On POSIX, this is easily done using :func:`shutil.chown`, but the file handlers in the stdlib don't offer built-in support. You can customize handler creation using a plain function such as::" +#: ../../howto/logging-cookbook.rst:2587 +msgid "" +"There are times when you want to customize logging handlers in particular " +"ways, and if you use :func:`dictConfig` you may be able to do this without " +"subclassing. As an example, consider that you may want to set the ownership " +"of a log file. On POSIX, this is easily done using :func:`shutil.chown`, but " +"the file handlers in the stdlib don't offer built-in support. You can " +"customize handler creation using a plain function such as::" msgstr "" +#: ../../howto/logging-cookbook.rst:2594 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -2395,9 +3271,14 @@ msgid "" " return logging.FileHandler(filename, mode, encoding)" msgstr "" -msgid "You can then specify, in a logging configuration passed to :func:`dictConfig`, that a logging handler be created by calling this function::" +#: ../../howto/logging-cookbook.rst:2601 +msgid "" +"You can then specify, in a logging configuration passed " +"to :func:`dictConfig`, that a logging handler be created by calling this " +"function::" msgstr "" +#: ../../howto/logging-cookbook.rst:2604 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -2430,9 +3311,14 @@ msgid "" "}" msgstr "" -msgid "In this example I am setting the ownership using the ``pulse`` user and group, just for the purposes of illustration. Putting it together into a working script, ``chowntest.py``::" +#: ../../howto/logging-cookbook.rst:2634 +msgid "" +"In this example I am setting the ownership using the ``pulse`` user and " +"group, just for the purposes of illustration. Putting it together into a " +"working script, ``chowntest.py``::" msgstr "" +#: ../../howto/logging-cookbook.rst:2638 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -2478,9 +3364,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" +#: ../../howto/logging-cookbook.rst:2681 msgid "To run this, you will probably need to run as ``root``:" msgstr "" +#: ../../howto/logging-cookbook.rst:2683 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -2489,66 +3377,159 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -msgid "Note that this example uses Python 3.3 because that's where :func:`shutil.chown` makes an appearance. This approach should work with any Python version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the actual ownership change using e.g. :func:`os.chown`." +#: ../../howto/logging-cookbook.rst:2691 +msgid "" +"Note that this example uses Python 3.3 because that's " +"where :func:`shutil.chown` makes an appearance. This approach should work " +"with any Python version that supports :func:`dictConfig` - namely, Python " +"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " +"actual ownership change using e.g. :func:`os.chown`." msgstr "" -msgid "In practice, the handler-creating function may be in a utility module somewhere in your project. Instead of the line in the configuration::" +#: ../../howto/logging-cookbook.rst:2697 +msgid "" +"In practice, the handler-creating function may be in a utility module " +"somewhere in your project. Instead of the line in the configuration::" msgstr "" +#: ../../howto/logging-cookbook.rst:2700 msgid "'()': owned_file_handler," msgstr "" +#: ../../howto/logging-cookbook.rst:2702 msgid "you could use e.g.::" msgstr "" +#: ../../howto/logging-cookbook.rst:2704 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "" -msgid "where ``project.util`` can be replaced with the actual name of the package where the function resides. In the above working script, using ``'ext://__main__.owned_file_handler'`` should work. Here, the actual callable is resolved by :func:`dictConfig` from the ``ext://`` specification." +#: ../../howto/logging-cookbook.rst:2706 +msgid "" +"where ``project.util`` can be replaced with the actual name of the package " +"where the function resides. In the above working script, using ``'ext://" +"__main__.owned_file_handler'`` should work. Here, the actual callable is " +"resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -msgid "This example hopefully also points the way to how you could implement other types of file change - e.g. setting specific POSIX permission bits - in the same way, using :func:`os.chmod`." +#: ../../howto/logging-cookbook.rst:2711 +msgid "" +"This example hopefully also points the way to how you could implement other " +"types of file change - e.g. setting specific POSIX permission bits - in the " +"same way, using :func:`os.chmod`." msgstr "" -msgid "Of course, the approach could also be extended to types of handler other than a :class:`~logging.FileHandler` - for example, one of the rotating file handlers, or a different type of handler altogether." +#: ../../howto/logging-cookbook.rst:2715 +msgid "" +"Of course, the approach could also be extended to types of handler other " +"than a :class:`~logging.FileHandler` - for example, one of the rotating file " +"handlers, or a different type of handler altogether." msgstr "" +#: ../../howto/logging-cookbook.rst:2725 msgid "Using particular formatting styles throughout your application" msgstr "" -msgid "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword parameter which, while defaulting to ``%`` for backward compatibility, allowed the specification of ``{`` or ``$`` to support the formatting approaches supported by :meth:`str.format` and :class:`string.Template`. Note that this governs the formatting of logging messages for final output to logs, and is completely orthogonal to how an individual logging message is constructed." -msgstr "" - -msgid "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take positional parameters for the actual logging message itself, with keyword parameters used only for determining options for how to handle the logging call (e.g. the ``exc_info`` keyword parameter to indicate that traceback information should be logged, or the ``extra`` keyword parameter to indicate additional contextual information to be added to the log). So you cannot directly make logging calls using :meth:`str.format` or :class:`string.Template` syntax, because internally the logging package uses %-formatting to merge the format string and the variable arguments. There would be no changing this while preserving backward compatibility, since all logging calls which are out there in existing code will be using %-format strings." +#: ../../howto/logging-cookbook.rst:2727 +msgid "" +"In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " +"parameter which, while defaulting to ``%`` for backward compatibility, " +"allowed the specification of ``{`` or ``$`` to support the formatting " +"approaches supported by :meth:`str.format` and :class:`string.Template`. " +"Note that this governs the formatting of logging messages for final output " +"to logs, and is completely orthogonal to how an individual logging message " +"is constructed." msgstr "" -msgid "There have been suggestions to associate format styles with specific loggers, but that approach also runs into backward compatibility problems because any existing code could be using a given logger name and using %-formatting." +#: ../../howto/logging-cookbook.rst:2734 +msgid "" +"Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " +"positional parameters for the actual logging message itself, with keyword " +"parameters used only for determining options for how to handle the logging " +"call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " +"information should be logged, or the ``extra`` keyword parameter to indicate " +"additional contextual information to be added to the log). So you cannot " +"directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." +msgstr "" + +#: ../../howto/logging-cookbook.rst:2746 +msgid "" +"There have been suggestions to associate format styles with specific " +"loggers, but that approach also runs into backward compatibility problems " +"because any existing code could be using a given logger name and using %-" +"formatting." msgstr "" -msgid "For logging to work interoperably between any third-party libraries and your code, decisions about formatting need to be made at the level of the individual logging call. This opens up a couple of ways in which alternative formatting styles can be accommodated." +#: ../../howto/logging-cookbook.rst:2750 +msgid "" +"For logging to work interoperably between any third-party libraries and your " +"code, decisions about formatting need to be made at the level of the " +"individual logging call. This opens up a couple of ways in which alternative " +"formatting styles can be accommodated." msgstr "" +#: ../../howto/logging-cookbook.rst:2757 msgid "Using LogRecord factories" msgstr "" -msgid "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned above, the logging package gained the ability to allow users to set their own :class:`LogRecord` subclasses, using the :func:`setLogRecordFactory` function. You can use this to set your own subclass of :class:`LogRecord`, which does the Right Thing by overriding the :meth:`~LogRecord.getMessage` method. The base class implementation of this method is where the ``msg % args`` formatting happens, and where you can substitute your alternate formatting; however, you should be careful to support all formatting styles and allow %-formatting as the default, to ensure interoperability with other code. Care should also be taken to call ``str(self.msg)``, just as the base implementation does." -msgstr "" - -msgid "Refer to the reference documentation on :func:`setLogRecordFactory` and :class:`LogRecord` for more information." +#: ../../howto/logging-cookbook.rst:2759 +msgid "" +"In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " +"above, the logging package gained the ability to allow users to set their " +"own :class:`LogRecord` subclasses, using the :func:`setLogRecordFactory` " +"function. You can use this to set your own subclass of :class:`LogRecord`, " +"which does the Right Thing by overriding the :meth:`~LogRecord.getMessage` " +"method. The base class implementation of this method is where the ``msg % " +"args`` formatting happens, and where you can substitute your alternate " +"formatting; however, you should be careful to support all formatting styles " +"and allow %-formatting as the default, to ensure interoperability with other " +"code. Care should also be taken to call ``str(self.msg)``, just as the base " +"implementation does." +msgstr "" + +#: ../../howto/logging-cookbook.rst:2770 +msgid "" +"Refer to the reference documentation on :func:`setLogRecordFactory` " +"and :class:`LogRecord` for more information." msgstr "" +#: ../../howto/logging-cookbook.rst:2775 msgid "Using custom message objects" msgstr "" -msgid "There is another, perhaps simpler way that you can use {}- and $- formatting to construct your individual log messages. You may recall (from :ref:`arbitrary-object-messages`) that when logging you can use an arbitrary object as a message format string, and that the logging package will call :func:`str` on that object to get the actual format string. Consider the following two classes::" +#: ../../howto/logging-cookbook.rst:2777 +msgid "" +"There is another, perhaps simpler way that you can use {}- and $- formatting " +"to construct your individual log messages. You may recall " +"(from :ref:`arbitrary-object-messages`) that when logging you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call :func:`str` on that object to get the actual format string. " +"Consider the following two classes::" msgstr "" -msgid "Either of these can be used in place of a format string, to allow {}- or $-formatting to be used to build the actual \"message\" part which appears in the formatted log output in place of “%(message)s” or “{message}” or “$message”. If you find it a little unwieldy to use the class names whenever you want to log something, you can make it more palatable if you use an alias such as ``M`` or ``_`` for the message (or perhaps ``__``, if you are using ``_`` for localization)." +#: ../../howto/logging-cookbook.rst:2802 +msgid "" +"Either of these can be used in place of a format string, to allow {}- or $-" +"formatting to be used to build the actual \"message\" part which appears in " +"the formatted log output in place of “%(message)s” or “{message}” or " +"“$message”. If you find it a little unwieldy to use the class names whenever " +"you want to log something, you can make it more palatable if you use an " +"alias such as ``M`` or ``_`` for the message (or perhaps ``__``, if you are " +"using ``_`` for localization)." msgstr "" -msgid "Examples of this approach are given below. Firstly, formatting with :meth:`str.format`::" +#: ../../howto/logging-cookbook.rst:2810 +msgid "" +"Examples of this approach are given below. Firstly, formatting " +"with :meth:`str.format`::" msgstr "" +#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -2558,13 +3539,16 @@ msgid "" ">>> p = Point()\n" ">>> p.x = 0.5\n" ">>> p.y = 0.5\n" -">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', point=p))\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', " +"point=p))\n" "Message with coordinates: (0.50, 0.50)" msgstr "" +#: ../../howto/logging-cookbook.rst:2824 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" +#: ../../howto/logging-cookbook.rst:2826 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -2572,15 +3556,38 @@ msgid "" ">>>" msgstr "" -msgid "One thing to note is that you pay no significant performance penalty with this approach: the actual formatting happens not when you make the logging call, but when (and if) the logged message is actually about to be output to a log by a handler. So the only slightly unusual thing which might trip you up is that the parentheses go around the format string and the arguments, not just the format string. That’s because the __ notation is just syntax sugar for a constructor call to one of the :samp:`{XXX}Message` classes shown above." +#: ../../howto/logging-cookbook.rst:2831 +msgid "" +"One thing to note is that you pay no significant performance penalty with " +"this approach: the actual formatting happens not when you make the logging " +"call, but when (and if) the logged message is actually about to be output to " +"a log by a handler. So the only slightly unusual thing which might trip you " +"up is that the parentheses go around the format string and the arguments, " +"not just the format string. That’s because the __ notation is just syntax " +"sugar for a constructor call to one of the :samp:`{XXX}Message` classes " +"shown above." msgstr "" +#: ../../howto/logging-cookbook.rst:2845 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -msgid "You *can* configure filters using :func:`~logging.config.dictConfig`, though it might not be obvious at first glance how to do it (hence this recipe). Since :class:`~logging.Filter` is the only filter class included in the standard library, and it is unlikely to cater to many requirements (it's only there as a base class), you will typically need to define your own :class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter.filter` method. To do this, specify the ``()`` key in the configuration dictionary for the filter, specifying a callable which will be used to create the filter (a class is the most obvious, but you can provide any callable which returns a :class:`~logging.Filter` instance). Here is a complete example::" -msgstr "" - +#: ../../howto/logging-cookbook.rst:2847 +msgid "" +"You *can* configure filters using :func:`~logging.config.dictConfig`, though " +"it might not be obvious at first glance how to do it (hence this recipe). " +"Since :class:`~logging.Filter` is the only filter class included in the " +"standard library, and it is unlikely to cater to many requirements (it's " +"only there as a base class), you will typically need to define your " +"own :class:`~logging.Filter` subclass with an " +"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " +"``()`` key in the configuration dictionary for the filter, specifying a " +"callable which will be used to create the filter (a class is the most " +"obvious, but you can provide any callable which returns " +"a :class:`~logging.Filter` instance). Here is a complete example::" +msgstr "" + +#: ../../howto/logging-cookbook.rst:2858 msgid "" "import logging\n" "import logging.config\n" @@ -2625,30 +3632,57 @@ msgid "" " logging.debug('hello - noshow')" msgstr "" -msgid "This example shows how you can pass configuration data to the callable which constructs the instance, in the form of keyword parameters. When run, the above script will print:" +#: ../../howto/logging-cookbook.rst:2900 +msgid "" +"This example shows how you can pass configuration data to the callable which " +"constructs the instance, in the form of keyword parameters. When run, the " +"above script will print:" msgstr "" +#: ../../howto/logging-cookbook.rst:2904 msgid "changed: hello" msgstr "" +#: ../../howto/logging-cookbook.rst:2908 msgid "which shows that the filter is working as configured." msgstr "" +#: ../../howto/logging-cookbook.rst:2910 msgid "A couple of extra points to note:" msgstr "" -msgid "If you can't refer to the callable directly in the configuration (e.g. if it lives in a different module, and you can't import it directly where the configuration dictionary is), you can use the form ``ext://...`` as described in :ref:`logging-config-dict-externalobj`. For example, you could have used the text ``'ext://__main__.MyFilter'`` instead of ``MyFilter`` in the above example." +#: ../../howto/logging-cookbook.rst:2912 +msgid "" +"If you can't refer to the callable directly in the configuration (e.g. if it " +"lives in a different module, and you can't import it directly where the " +"configuration dictionary is), you can use the form ``ext://...`` as " +"described in :ref:`logging-config-dict-externalobj`. For example, you could " +"have used the text ``'ext://__main__.MyFilter'`` instead of ``MyFilter`` in " +"the above example." msgstr "" -msgid "As well as for filters, this technique can also be used to configure custom handlers and formatters. See :ref:`logging-config-dict-userdef` for more information on how logging supports using user-defined objects in its configuration, and see the other cookbook recipe :ref:`custom-handlers` above." +#: ../../howto/logging-cookbook.rst:2919 +msgid "" +"As well as for filters, this technique can also be used to configure custom " +"handlers and formatters. See :ref:`logging-config-dict-userdef` for more " +"information on how logging supports using user-defined objects in its " +"configuration, and see the other cookbook recipe :ref:`custom-handlers` " +"above." msgstr "" +#: ../../howto/logging-cookbook.rst:2928 msgid "Customized exception formatting" msgstr "" -msgid "There might be times when you want to do customized exception formatting - for argument's sake, let's say you want exactly one line per logged event, even when exception information is present. You can do this with a custom formatter class, as shown in the following example::" +#: ../../howto/logging-cookbook.rst:2930 +msgid "" +"There might be times when you want to do customized exception formatting - " +"for argument's sake, let's say you want exactly one line per logged event, " +"even when exception information is present. You can do this with a custom " +"formatter class, as shown in the following example::" msgstr "" +#: ../../howto/logging-cookbook.rst:2935 msgid "" "import logging\n" "\n" @@ -2687,23 +3721,47 @@ msgid "" " main()" msgstr "" +#: ../../howto/logging-cookbook.rst:2971 msgid "When run, this produces a file with exactly two lines:" msgstr "" +#: ../../howto/logging-cookbook.rst:2973 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" -"28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback (most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x = 1 / 0\\nZeroDivisionError: division by zero'|" +"28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " +"(most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x " +"= 1 / 0\\nZeroDivisionError: division by zero'|" msgstr "" -msgid "While the above treatment is simplistic, it points the way to how exception information can be formatted to your liking. The :mod:`traceback` module may be helpful for more specialized needs." +#: ../../howto/logging-cookbook.rst:2978 +msgid "" +"While the above treatment is simplistic, it points the way to how exception " +"information can be formatted to your liking. The :mod:`traceback` module may " +"be helpful for more specialized needs." msgstr "" +#: ../../howto/logging-cookbook.rst:2985 msgid "Speaking logging messages" msgstr "" -msgid "There might be situations when it is desirable to have logging messages rendered in an audible rather than a visible format. This is easy to do if you have text-to-speech (TTS) functionality available in your system, even if it doesn't have a Python binding. Most TTS systems have a command line program you can run, and this can be invoked from a handler using :mod:`subprocess`. It's assumed here that TTS command line programs won't expect to interact with users or take a long time to complete, and that the frequency of logged messages will be not so high as to swamp the user with messages, and that it's acceptable to have the messages spoken one at a time rather than concurrently, The example implementation below waits for one message to be spoken before the next is processed, and this might cause other handlers to be kept waiting. Here is a short example showing the approach, which assumes that the ``espeak`` TTS package is available::" -msgstr "" - +#: ../../howto/logging-cookbook.rst:2987 +msgid "" +"There might be situations when it is desirable to have logging messages " +"rendered in an audible rather than a visible format. This is easy to do if " +"you have text-to-speech (TTS) functionality available in your system, even " +"if it doesn't have a Python binding. Most TTS systems have a command line " +"program you can run, and this can be invoked from a handler " +"using :mod:`subprocess`. It's assumed here that TTS command line programs " +"won't expect to interact with users or take a long time to complete, and " +"that the frequency of logged messages will be not so high as to swamp the " +"user with messages, and that it's acceptable to have the messages spoken one " +"at a time rather than concurrently, The example implementation below waits " +"for one message to be spoken before the next is processed, and this might " +"cause other handlers to be kept waiting. Here is a short example showing the " +"approach, which assumes that the ``espeak`` TTS package is available::" +msgstr "" + +#: ../../howto/logging-cookbook.rst:3000 msgid "" "import logging\n" "import subprocess\n" @@ -2735,30 +3793,72 @@ msgid "" " sys.exit(main())" msgstr "" -msgid "When run, this script should say \"Hello\" and then \"Goodbye\" in a female voice." +#: ../../howto/logging-cookbook.rst:3029 +msgid "" +"When run, this script should say \"Hello\" and then \"Goodbye\" in a female " +"voice." msgstr "" -msgid "The above approach can, of course, be adapted to other TTS systems and even other systems altogether which can process messages via external programs run from a command line." +#: ../../howto/logging-cookbook.rst:3031 +msgid "" +"The above approach can, of course, be adapted to other TTS systems and even " +"other systems altogether which can process messages via external programs " +"run from a command line." msgstr "" +#: ../../howto/logging-cookbook.rst:3039 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -msgid "There might be situations where you want to log messages in a temporary area and only output them if a certain condition occurs. For example, you may want to start logging debug events in a function, and if the function completes without errors, you don't want to clutter the log with the collected debug information, but if there is an error, you want all the debug information to be output as well as the error." -msgstr "" - -msgid "Here is an example which shows how you could do this using a decorator for your functions where you want logging to behave this way. It makes use of the :class:`logging.handlers.MemoryHandler`, which allows buffering of logged events until some condition occurs, at which point the buffered events are ``flushed`` - passed to another handler (the ``target`` handler) for processing. By default, the ``MemoryHandler`` flushed when its buffer gets filled up or an event whose level is greater than or equal to a specified threshold is seen. You can use this recipe with a more specialised subclass of ``MemoryHandler`` if you want custom flushing behavior." +#: ../../howto/logging-cookbook.rst:3041 +msgid "" +"There might be situations where you want to log messages in a temporary area " +"and only output them if a certain condition occurs. For example, you may " +"want to start logging debug events in a function, and if the function " +"completes without errors, you don't want to clutter the log with the " +"collected debug information, but if there is an error, you want all the " +"debug information to be output as well as the error." msgstr "" -msgid "The example script has a simple function, ``foo``, which just cycles through all the logging levels, writing to ``sys.stderr`` to say what level it's about to log at, and then actually logging a message at that level. You can pass a parameter to ``foo`` which, if true, will log at ERROR and CRITICAL levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." +#: ../../howto/logging-cookbook.rst:3048 +msgid "" +"Here is an example which shows how you could do this using a decorator for " +"your functions where you want logging to behave this way. It makes use of " +"the :class:`logging.handlers.MemoryHandler`, which allows buffering of " +"logged events until some condition occurs, at which point the buffered " +"events are ``flushed`` - passed to another handler (the ``target`` handler) " +"for processing. By default, the ``MemoryHandler`` flushed when its buffer " +"gets filled up or an event whose level is greater than or equal to a " +"specified threshold is seen. You can use this recipe with a more specialised " +"subclass of ``MemoryHandler`` if you want custom flushing behavior." +msgstr "" + +#: ../../howto/logging-cookbook.rst:3058 +msgid "" +"The example script has a simple function, ``foo``, which just cycles through " +"all the logging levels, writing to ``sys.stderr`` to say what level it's " +"about to log at, and then actually logging a message at that level. You can " +"pass a parameter to ``foo`` which, if true, will log at ERROR and CRITICAL " +"levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -msgid "The script just arranges to decorate ``foo`` with a decorator which will do the conditional logging that's required. The decorator takes a logger as a parameter and attaches a memory handler for the duration of the call to the decorated function. The decorator can be additionally parameterised using a target handler, a level at which flushing should occur, and a capacity for the buffer (number of records buffered). These default to a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` respectively." +#: ../../howto/logging-cookbook.rst:3064 +msgid "" +"The script just arranges to decorate ``foo`` with a decorator which will do " +"the conditional logging that's required. The decorator takes a logger as a " +"parameter and attaches a memory handler for the duration of the call to the " +"decorated function. The decorator can be additionally parameterised using a " +"target handler, a level at which flushing should occur, and a capacity for " +"the buffer (number of records buffered). These default to " +"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " +"``logging.ERROR`` and ``100`` respectively." msgstr "" +#: ../../howto/logging-cookbook.rst:3072 msgid "Here's the script::" msgstr "" +#: ../../howto/logging-cookbook.rst:3074 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -2767,14 +3867,16 @@ msgid "" "logger = logging.getLogger(__name__)\n" "logger.addHandler(logging.NullHandler())\n" "\n" -"def log_if_errors(logger, target_handler=None, flush_level=None, capacity=None):\n" +"def log_if_errors(logger, target_handler=None, flush_level=None, " +"capacity=None):\n" " if target_handler is None:\n" " target_handler = logging.StreamHandler()\n" " if flush_level is None:\n" " flush_level = logging.ERROR\n" " if capacity is None:\n" " capacity = 100\n" -" handler = MemoryHandler(capacity, flushLevel=flush_level, target=target_handler)\n" +" handler = MemoryHandler(capacity, flushLevel=flush_level, " +"target=target_handler)\n" "\n" " def decorator(fn):\n" " def wrapper(*args, **kwargs):\n" @@ -2822,9 +3924,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" +#: ../../howto/logging-cookbook.rst:3135 msgid "When this script is run, the following output should be observed:" msgstr "" +#: ../../howto/logging-cookbook.rst:3137 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -2853,31 +3957,49 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -msgid "As you can see, actual logging output only occurs when an event is logged whose severity is ERROR or greater, but in that case, any previous events at lower severities are also logged." +#: ../../howto/logging-cookbook.rst:3165 +msgid "" +"As you can see, actual logging output only occurs when an event is logged " +"whose severity is ERROR or greater, but in that case, any previous events at " +"lower severities are also logged." msgstr "" +#: ../../howto/logging-cookbook.rst:3169 msgid "You can of course use the conventional means of decoration::" msgstr "" +#: ../../howto/logging-cookbook.rst:3171 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" +#: ../../howto/logging-cookbook.rst:3179 msgid "Sending logging messages to email, with buffering" msgstr "" -msgid "To illustrate how you can send log messages via email, so that a set number of messages are sent per email, you can subclass :class:`~logging.handlers.BufferingHandler`. In the following example, which you can adapt to suit your specific needs, a simple test harness is provided which allows you to run the script with command line arguments specifying what you typically need to send things via SMTP. (Run the downloaded script with the ``-h`` argument to see the required and optional arguments.)" +#: ../../howto/logging-cookbook.rst:3181 +msgid "" +"To illustrate how you can send log messages via email, so that a set number " +"of messages are sent per email, you can " +"subclass :class:`~logging.handlers.BufferingHandler`. In the following " +"example, which you can adapt to suit your specific needs, a simple test " +"harness is provided which allows you to run the script with command line " +"arguments specifying what you typically need to send things via SMTP. (Run " +"the downloaded script with the ``-h`` argument to see the required and " +"optional arguments.)" msgstr "" +#: ../../howto/logging-cookbook.rst:3189 msgid "" "import logging\n" "import logging.handlers\n" "import smtplib\n" "\n" "class BufferingSMTPHandler(logging.handlers.BufferingHandler):\n" -" def __init__(self, mailhost, port, username, password, fromaddr, toaddrs,\n" +" def __init__(self, mailhost, port, username, password, fromaddr, " +"toaddrs,\n" " subject, capacity):\n" " logging.handlers.BufferingHandler.__init__(self, capacity)\n" " self.mailhost = mailhost\n" @@ -2889,7 +4011,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" +"(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -2897,7 +4020,8 @@ msgid "" " smtp = smtplib.SMTP(self.mailhost, self.mailport)\n" " smtp.starttls()\n" " smtp.login(self.username, self.password)\n" -" msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n\" % (self.fromaddr, ','.join(self.toaddrs), self.subject)\n" +" msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n\" " +"% (self.fromaddr, ','.join(self.toaddrs), self.subject)\n" " for record in self.buffer:\n" " s = self.format(record)\n" " msg = msg + s + \"\\r\\n\"\n" @@ -2935,15 +4059,25 @@ msgid "" " h.close()" msgstr "" -msgid "If you run this script and your SMTP server is correctly set up, you should find that it sends eleven emails to the addressee you specify. The first ten emails will each have ten log messages, and the eleventh will have two messages. That makes up 102 messages as specified in the script." +#: ../../howto/logging-cookbook.rst:3253 +msgid "" +"If you run this script and your SMTP server is correctly set up, you should " +"find that it sends eleven emails to the addressee you specify. The first ten " +"emails will each have ten log messages, and the eleventh will have two " +"messages. That makes up 102 messages as specified in the script." msgstr "" +#: ../../howto/logging-cookbook.rst:3261 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -msgid "Sometimes you want to format times using UTC, which can be done using a class such as ``UTCFormatter``, shown below::" +#: ../../howto/logging-cookbook.rst:3263 +msgid "" +"Sometimes you want to format times using UTC, which can be done using a " +"class such as ``UTCFormatter``, shown below::" msgstr "" +#: ../../howto/logging-cookbook.rst:3266 msgid "" "import logging\n" "import time\n" @@ -2952,9 +4086,15 @@ msgid "" " converter = time.gmtime" msgstr "" -msgid "and you can then use the ``UTCFormatter`` in your code instead of :class:`~logging.Formatter`. If you want to do that via configuration, you can use the :func:`~logging.config.dictConfig` API with an approach illustrated by the following complete example::" +#: ../../howto/logging-cookbook.rst:3272 +msgid "" +"and you can then use the ``UTCFormatter`` in your code instead " +"of :class:`~logging.Formatter`. If you want to do that via configuration, " +"you can use the :func:`~logging.config.dictConfig` API with an approach " +"illustrated by the following complete example::" msgstr "" +#: ../../howto/logging-cookbook.rst:3277 msgid "" "import logging\n" "import logging.config\n" @@ -2995,23 +4135,37 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" +#: ../../howto/logging-cookbook.rst:3315 msgid "When this script is run, it should print something like:" msgstr "" +#: ../../howto/logging-cookbook.rst:3317 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" msgstr "" -msgid "showing how the time is formatted both as local time and UTC, one for each handler." +#: ../../howto/logging-cookbook.rst:3322 +msgid "" +"showing how the time is formatted both as local time and UTC, one for each " +"handler." msgstr "" +#: ../../howto/logging-cookbook.rst:3329 msgid "Using a context manager for selective logging" msgstr "" -msgid "There are times when it would be useful to temporarily change the logging configuration and revert it back after doing something. For this, a context manager is the most obvious way of saving and restoring the logging context. Here is a simple example of such a context manager, which allows you to optionally change the logging level and add a logging handler purely in the scope of the context manager::" +#: ../../howto/logging-cookbook.rst:3331 +msgid "" +"There are times when it would be useful to temporarily change the logging " +"configuration and revert it back after doing something. For this, a context " +"manager is the most obvious way of saving and restoring the logging context. " +"Here is a simple example of such a context manager, which allows you to " +"optionally change the logging level and add a logging handler purely in the " +"scope of the context manager::" msgstr "" +#: ../../howto/logging-cookbook.rst:3338 msgid "" "import logging\n" "import sys\n" @@ -3040,12 +4194,22 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -msgid "If you specify a level value, the logger's level is set to that value in the scope of the with block covered by the context manager. If you specify a handler, it is added to the logger on entry to the block and removed on exit from the block. You can also ask the manager to close the handler for you on block exit - you could do this if you don't need the handler any more." +#: ../../howto/logging-cookbook.rst:3364 +msgid "" +"If you specify a level value, the logger's level is set to that value in the " +"scope of the with block covered by the context manager. If you specify a " +"handler, it is added to the logger on entry to the block and removed on exit " +"from the block. You can also ask the manager to close the handler for you on " +"block exit - you could do this if you don't need the handler any more." msgstr "" -msgid "To illustrate how it works, we can add the following block of code to the above::" +#: ../../howto/logging-cookbook.rst:3370 +msgid "" +"To illustrate how it works, we can add the following block of code to the " +"above::" msgstr "" +#: ../../howto/logging-cookbook.rst:3373 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -3057,18 +4221,32 @@ msgid "" " logger.debug('3. This should appear once on stderr.')\n" " logger.debug('4. This should not appear.')\n" " h = logging.StreamHandler(sys.stdout)\n" -" with LoggingContext(logger, level=logging.DEBUG, handler=h, close=True):\n" -" logger.debug('5. This should appear twice - once on stderr and once on stdout.')\n" +" with LoggingContext(logger, level=logging.DEBUG, handler=h, " +"close=True):\n" +" logger.debug('5. This should appear twice - once on stderr and once " +"on stdout.')\n" " logger.info('6. This should appear just once on stderr.')\n" " logger.debug('7. This should not appear.')" msgstr "" -msgid "We initially set the logger's level to ``INFO``, so message #1 appears and message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the following ``with`` block, and so message #3 appears. After the block exits, the logger's level is restored to ``INFO`` and so message #4 doesn't appear. In the next ``with`` block, we set the level to ``DEBUG`` again but also add a handler writing to ``sys.stdout``. Thus, message #5 appears twice on the console (once via ``stderr`` and once via ``stdout``). After the ``with`` statement's completion, the status is as it was before so message #6 appears (like message #1) whereas message #7 doesn't (just like message #2)." -msgstr "" - +#: ../../howto/logging-cookbook.rst:3388 +msgid "" +"We initially set the logger's level to ``INFO``, so message #1 appears and " +"message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " +"following ``with`` block, and so message #3 appears. After the block exits, " +"the logger's level is restored to ``INFO`` and so message #4 doesn't appear. " +"In the next ``with`` block, we set the level to ``DEBUG`` again but also add " +"a handler writing to ``sys.stdout``. Thus, message #5 appears twice on the " +"console (once via ``stderr`` and once via ``stdout``). After the ``with`` " +"statement's completion, the status is as it was before so message #6 appears " +"(like message #1) whereas message #7 doesn't (just like message #2)." +msgstr "" + +#: ../../howto/logging-cookbook.rst:3398 msgid "If we run the resulting script, the result is as follows:" msgstr "" +#: ../../howto/logging-cookbook.rst:3400 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -3078,17 +4256,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -msgid "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the following, which is the only message written to ``stdout``:" +#: ../../howto/logging-cookbook.rst:3409 +msgid "" +"If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " +"following, which is the only message written to ``stdout``:" msgstr "" +#: ../../howto/logging-cookbook.rst:3412 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" +#: ../../howto/logging-cookbook.rst:3417 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" +#: ../../howto/logging-cookbook.rst:3419 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -3097,30 +4281,53 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -msgid "In this case, the message #5 printed to ``stdout`` doesn't appear, as expected." +#: ../../howto/logging-cookbook.rst:3427 +msgid "" +"In this case, the message #5 printed to ``stdout`` doesn't appear, as " +"expected." msgstr "" -msgid "Of course, the approach described here can be generalised, for example to attach logging filters temporarily. Note that the above code works in Python 2 as well as Python 3." +#: ../../howto/logging-cookbook.rst:3429 +msgid "" +"Of course, the approach described here can be generalised, for example to " +"attach logging filters temporarily. Note that the above code works in Python " +"2 as well as Python 3." msgstr "" +#: ../../howto/logging-cookbook.rst:3437 msgid "A CLI application starter template" msgstr "" +#: ../../howto/logging-cookbook.rst:3439 msgid "Here's an example which shows how you can:" msgstr "" +#: ../../howto/logging-cookbook.rst:3441 msgid "Use a logging level based on command-line arguments" msgstr "" -msgid "Dispatch to multiple subcommands in separate files, all logging at the same level in a consistent way" +#: ../../howto/logging-cookbook.rst:3442 +msgid "" +"Dispatch to multiple subcommands in separate files, all logging at the same " +"level in a consistent way" msgstr "" +#: ../../howto/logging-cookbook.rst:3444 msgid "Make use of simple, minimal configuration" msgstr "" -msgid "Suppose we have a command-line application whose job is to stop, start or restart some services. This could be organised for the purposes of illustration as a file ``app.py`` that is the main script for the application, with individual commands implemented in ``start.py``, ``stop.py`` and ``restart.py``. Suppose further that we want to control the verbosity of the application via a command-line argument, defaulting to ``logging.INFO``. Here's one way that ``app.py`` could be written::" +#: ../../howto/logging-cookbook.rst:3446 +msgid "" +"Suppose we have a command-line application whose job is to stop, start or " +"restart some services. This could be organised for the purposes of " +"illustration as a file ``app.py`` that is the main script for the " +"application, with individual commands implemented in ``start.py``, " +"``stop.py`` and ``restart.py``. Suppose further that we want to control the " +"verbosity of the application via a command-line argument, defaulting to " +"``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" +#: ../../howto/logging-cookbook.rst:3454 msgid "" "import argparse\n" "import importlib\n" @@ -3143,17 +4350,20 @@ msgid "" " stop_cmd.add_argument('names', metavar='NAME', nargs='+',\n" " help='Name of service to stop')\n" " restart_cmd = subparsers.add_parser('restart',\n" -" help='Restart one or more services')\n" +" help='Restart one or more " +"services')\n" " restart_cmd.add_argument('names', metavar='NAME', nargs='+',\n" " help='Name of service to restart')\n" " options = parser.parse_args()\n" -" # the code to dispatch commands could all be in this file. For the purposes\n" +" # the code to dispatch commands could all be in this file. For the " +"purposes\n" " # of illustration only, we implement each command in a separate module.\n" " try:\n" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % options.command)\n" +" print('Unable to find the code for command \\'%s\\'' % " +"options.command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -3164,9 +4374,13 @@ msgid "" " sys.exit(main())" msgstr "" -msgid "And the ``start``, ``stop`` and ``restart`` commands can be implemented in separate modules, like so for starting::" +#: ../../howto/logging-cookbook.rst:3495 +msgid "" +"And the ``start``, ``stop`` and ``restart`` commands can be implemented in " +"separate modules, like so for starting::" msgstr "" +#: ../../howto/logging-cookbook.rst:3498 msgid "" "# start.py\n" "import logging\n" @@ -3179,9 +4393,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" +#: ../../howto/logging-cookbook.rst:3508 msgid "and thus for stopping::" msgstr "" +#: ../../howto/logging-cookbook.rst:3510 msgid "" "# stop.py\n" "import logging\n" @@ -3203,9 +4419,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" +#: ../../howto/logging-cookbook.rst:3529 msgid "and similarly for restarting::" msgstr "" +#: ../../howto/logging-cookbook.rst:3531 msgid "" "# restart.py\n" "import logging\n" @@ -3227,9 +4445,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -msgid "If we run this application with the default log level, we get output like this:" +#: ../../howto/logging-cookbook.rst:3550 +msgid "" +"If we run this application with the default log level, we get output like " +"this:" msgstr "" +#: ../../howto/logging-cookbook.rst:3552 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -3241,12 +4463,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -msgid "The first word is the logging level, and the second word is the module or package name of the place where the event was logged." +#: ../../howto/logging-cookbook.rst:3563 +msgid "" +"The first word is the logging level, and the second word is the module or " +"package name of the place where the event was logged." msgstr "" -msgid "If we change the logging level, then we can change the information sent to the log. For example, if we want more information:" +#: ../../howto/logging-cookbook.rst:3566 +msgid "" +"If we change the logging level, then we can change the information sent to " +"the log. For example, if we want more information:" msgstr "" +#: ../../howto/logging-cookbook.rst:3569 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -3261,33 +4490,61 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" +#: ../../howto/logging-cookbook.rst:3583 msgid "And if we want less:" msgstr "" +#: ../../howto/logging-cookbook.rst:3585 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -msgid "In this case, the commands don't print anything to the console, since nothing at ``WARNING`` level or above is logged by them." +#: ../../howto/logging-cookbook.rst:3591 +msgid "" +"In this case, the commands don't print anything to the console, since " +"nothing at ``WARNING`` level or above is logged by them." msgstr "" +#: ../../howto/logging-cookbook.rst:3597 msgid "A Qt GUI for logging" msgstr "" -msgid "A question that comes up from time to time is about how to log to a GUI application. The `Qt `_ framework is a popular cross-platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:`PyQt5` libraries." +#: ../../howto/logging-cookbook.rst:3599 +msgid "" +"A question that comes up from time to time is about how to log to a GUI " +"application. The `Qt `_ framework is a popular cross-" +"platform UI framework with Python bindings using :pypi:`PySide2` " +"or :pypi:`PyQt5` libraries." msgstr "" -msgid "The following example shows how to log to a Qt GUI. This introduces a simple ``QtHandler`` class which takes a callable, which should be a slot in the main thread that does GUI updates. A worker thread is also created to show how you can log to the GUI from both the UI itself (via a button for manual logging) as well as a worker thread doing work in the background (here, just logging messages at random levels with random short delays in between)." +#: ../../howto/logging-cookbook.rst:3604 +msgid "" +"The following example shows how to log to a Qt GUI. This introduces a simple " +"``QtHandler`` class which takes a callable, which should be a slot in the " +"main thread that does GUI updates. A worker thread is also created to show " +"how you can log to the GUI from both the UI itself (via a button for manual " +"logging) as well as a worker thread doing work in the background (here, just " +"logging messages at random levels with random short delays in between)." msgstr "" -msgid "The worker thread is implemented using Qt's ``QThread`` class rather than the :mod:`threading` module, as there are circumstances where one has to use ``QThread``, which offers better integration with other ``Qt`` components." +#: ../../howto/logging-cookbook.rst:3611 +msgid "" +"The worker thread is implemented using Qt's ``QThread`` class rather than " +"the :mod:`threading` module, as there are circumstances where one has to use " +"``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -msgid "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, ``PySide2`` or ``PyQt5``. You should be able to adapt the approach to earlier versions of Qt. Please refer to the comments in the code snippet for more detailed information." +#: ../../howto/logging-cookbook.rst:3615 +msgid "" +"The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " +"``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " +"earlier versions of Qt. Please refer to the comments in the code snippet for " +"more detailed information." msgstr "" +#: ../../howto/logging-cookbook.rst:3620 msgid "" "import logging\n" "import random\n" @@ -3318,21 +4575,27 @@ msgid "" "\n" "\n" "#\n" -"# Signals need to be contained in a QObject or subclass in order to be correctly\n" +"# Signals need to be contained in a QObject or subclass in order to be " +"correctly\n" "# initialized.\n" "#\n" "class Signaller(QtCore.QObject):\n" " signal = Signal(str, logging.LogRecord)\n" "\n" "#\n" -"# Output to a Qt GUI is only supposed to happen on the main thread. So, this\n" -"# handler is designed to take a slot function which is set up to run in the main\n" +"# Output to a Qt GUI is only supposed to happen on the main thread. So, " +"this\n" +"# handler is designed to take a slot function which is set up to run in the " +"main\n" "# thread. In this example, the function takes a string argument which is a\n" -"# formatted log message, and the log record which generated it. The formatted\n" -"# string is just a convenience - you could format a string for output any way\n" +"# formatted log message, and the log record which generated it. The " +"formatted\n" +"# string is just a convenience - you could format a string for output any " +"way\n" "# you like in the slot function itself.\n" "#\n" -"# You specify the slot function to do whatever GUI updates you want. The handler\n" +"# You specify the slot function to do whatever GUI updates you want. The " +"handler\n" "# doesn't know or care about specific UI elements.\n" "#\n" "class QtHandler(logging.Handler):\n" @@ -3346,8 +4609,10 @@ msgid "" " self.signaller.signal.emit(s, record)\n" "\n" "#\n" -"# This example uses QThreads, which means that the threads at the Python level\n" -"# are named something like \"Dummy-1\". The function below gets the Qt name of the\n" +"# This example uses QThreads, which means that the threads at the Python " +"level\n" +"# are named something like \"Dummy-1\". The function below gets the Qt name " +"of the\n" "# current thread.\n" "#\n" "def ctname():\n" @@ -3361,13 +4626,18 @@ msgid "" " logging.CRITICAL)\n" "\n" "#\n" -"# This worker class represents work that is done in a thread separate to the\n" -"# main thread. The way the thread is kicked off to do work is via a button press\n" +"# This worker class represents work that is done in a thread separate to " +"the\n" +"# main thread. The way the thread is kicked off to do work is via a button " +"press\n" "# that connects to a slot in the worker.\n" "#\n" -"# Because the default threadName value in the LogRecord isn't much use, we add\n" -"# a qThreadName which contains the QThread name as computed above, and pass that\n" -"# value in an \"extra\" dictionary which is used to update the LogRecord with the\n" +"# Because the default threadName value in the LogRecord isn't much use, we " +"add\n" +"# a qThreadName which contains the QThread name as computed above, and pass " +"that\n" +"# value in an \"extra\" dictionary which is used to update the LogRecord " +"with the\n" "# QThread name.\n" "#\n" "# This example worker just outputs messages sequentially, interspersed with\n" @@ -3379,7 +4649,8 @@ msgid "" " extra = {'qThreadName': ctname() }\n" " logger.debug('Started work', extra=extra)\n" " i = 1\n" -" # Let the thread run until interrupted. This allows reasonably clean\n" +" # Let the thread run until interrupted. This allows reasonably " +"clean\n" " # thread termination.\n" " while not QtCore.QThread.currentThread().isInterruptionRequested():\n" " delay = 0.5 + random.random() * 2\n" @@ -3389,7 +4660,8 @@ msgid "" " raise ValueError('Exception raised: %d' % i)\n" " else:\n" " level = random.choice(LEVELS)\n" -" logger.log(level, 'Message after delay of %3.1f: %d', delay, i, extra=extra)\n" +" logger.log(level, 'Message after delay of %3.1f: %d', " +"delay, i, extra=extra)\n" " except ValueError as e:\n" " logger.exception('Failed: %s', e, extra=extra)\n" " i += 1\n" @@ -3429,7 +4701,8 @@ msgid "" " self.log_button = PB('Log a message at a random level', self)\n" " self.clear_button = PB('Clear log window', self)\n" " self.handler = h = QtHandler(self.update_status)\n" -" # Remember to use qThreadName rather than threadName in the format string.\n" +" # Remember to use qThreadName rather than threadName in the format " +"string.\n" " fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s'\n" " formatter = logging.Formatter(fs)\n" " h.setFormatter(formatter)\n" @@ -3453,7 +4726,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : self.work_button.setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : " +"self.work_button.setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -3465,7 +4739,8 @@ msgid "" " self.worker_thread.start()\n" "\n" " def kill_thread(self):\n" -" # Just tell the worker to stop, then tell it to quit and wait for that\n" +" # Just tell the worker to stop, then tell it to quit and wait for " +"that\n" " # to happen\n" " self.worker_thread.requestInterruption()\n" " if self.worker_thread.isRunning():\n" @@ -3491,7 +4766,8 @@ msgid "" " @Slot()\n" " def manual_update(self):\n" " # This function uses the formatted message passed in, but also uses\n" -" # information from the record to format the message in an appropriate\n" +" # information from the record to format the message in an " +"appropriate\n" " # color according to its severity (level).\n" " level = random.choice(LEVELS)\n" " extra = {'qThreadName': ctname() }\n" @@ -3518,15 +4794,29 @@ msgid "" " main()" msgstr "" +#: ../../howto/logging-cookbook.rst:3851 msgid "Logging to syslog with RFC5424 support" msgstr "" -msgid "Although :rfc:`5424` dates from 2009, most syslog servers are configured by default to use the older :rfc:`3164`, which hails from 2001. When ``logging`` was added to Python in 2003, it supported the earlier (and only existing) protocol at the time. Since RFC 5424 came out, as there has not been widespread deployment of it in syslog servers, the :class:`~logging.handlers.SysLogHandler` functionality has not been updated." +#: ../../howto/logging-cookbook.rst:3853 +msgid "" +"Although :rfc:`5424` dates from 2009, most syslog servers are configured by " +"default to use the older :rfc:`3164`, which hails from 2001. When " +"``logging`` was added to Python in 2003, it supported the earlier (and only " +"existing) protocol at the time. Since RFC 5424 came out, as there has not " +"been widespread deployment of it in syslog servers, " +"the :class:`~logging.handlers.SysLogHandler` functionality has not been " +"updated." msgstr "" -msgid "RFC 5424 contains some useful features such as support for structured data, and if you need to be able to log to a syslog server with support for it, you can do so with a subclassed handler which looks something like this::" +#: ../../howto/logging-cookbook.rst:3860 +msgid "" +"RFC 5424 contains some useful features such as support for structured data, " +"and if you need to be able to log to a syslog server with support for it, " +"you can do so with a subclassed handler which looks something like this::" msgstr "" +#: ../../howto/logging-cookbook.rst:3864 msgid "" "import datetime as dt\n" "import logging.handlers\n" @@ -3568,10 +4858,13 @@ msgid "" " sdata = '-'\n" " if hasattr(record, 'structured_data'):\n" " sd = record.structured_data\n" -" # This should be a dict where the keys are SD-ID and the value is a\n" -" # dict mapping PARAM-NAME to PARAM-VALUE (refer to the RFC for what these\n" +" # This should be a dict where the keys are SD-ID and the value " +"is a\n" +" # dict mapping PARAM-NAME to PARAM-VALUE (refer to the RFC for " +"what these\n" " # mean)\n" -" # There's no error checking here - it's purely for illustration, and you\n" +" # There's no error checking here - it's purely for illustration, " +"and you\n" " # can adapt this code for use in production environments\n" " parts = []\n" "\n" @@ -3588,12 +4881,20 @@ msgid "" " part += ']'\n" " parts.append(part)\n" " sdata = ''.join(parts)\n" -" return f'{version} {asctime} {hostname} {appname} {procid} {msgid} {sdata} {msg}'" +" return f'{version} {asctime} {hostname} {appname} {procid} {msgid} " +"{sdata} {msg}'" msgstr "" -msgid "You'll need to be familiar with RFC 5424 to fully understand the above code, and it may be that you have slightly different needs (e.g. for how you pass structural data to the log). Nevertheless, the above should be adaptable to your speciric needs. With the above handler, you'd pass structured data using something like this::" +#: ../../howto/logging-cookbook.rst:3926 +msgid "" +"You'll need to be familiar with RFC 5424 to fully understand the above code, " +"and it may be that you have slightly different needs (e.g. for how you pass " +"structural data to the log). Nevertheless, the above should be adaptable to " +"your speciric needs. With the above handler, you'd pass structured data " +"using something like this::" msgstr "" +#: ../../howto/logging-cookbook.rst:3931 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -3604,12 +4905,19 @@ msgid "" "logger.debug('Message %d', i, extra=extra)" msgstr "" +#: ../../howto/logging-cookbook.rst:3940 msgid "How to treat a logger like an output stream" msgstr "" -msgid "Sometimes, you need to interface to a third-party API which expects a file-like object to write to, but you want to direct the API's output to a logger. You can do this using a class which wraps a logger with a file-like API. Here's a short script illustrating such a class:" +#: ../../howto/logging-cookbook.rst:3942 +msgid "" +"Sometimes, you need to interface to a third-party API which expects a file-" +"like object to write to, but you want to direct the API's output to a " +"logger. You can do this using a class which wraps a logger with a file-like " +"API. Here's a short script illustrating such a class:" msgstr "" +#: ../../howto/logging-cookbook.rst:3947 msgid "" "import logging\n" "\n" @@ -3623,12 +4931,14 @@ msgid "" " self.logger.log(self.level, message)\n" "\n" " def flush(self):\n" -" # doesn't actually do anything, but might be expected of a file-like\n" +" # doesn't actually do anything, but might be expected of a file-" +"like\n" " # object - so optional depending on your situation\n" " pass\n" "\n" " def close(self):\n" -" # doesn't actually do anything, but might be expected of a file-like\n" +" # doesn't actually do anything, but might be expected of a file-" +"like\n" " # object - so optional depending on your situation. You might want\n" " # to set a flag so that later calls to write raise an exception\n" " pass\n" @@ -3645,17 +4955,23 @@ msgid "" " main()" msgstr "" +#: ../../howto/logging-cookbook.rst:3982 msgid "When this script is run, it prints" msgstr "" +#: ../../howto/logging-cookbook.rst:3984 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" -msgid "You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys.stderr`` by doing something like this:" +#: ../../howto/logging-cookbook.rst:3989 +msgid "" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " +"``sys.stderr`` by doing something like this:" msgstr "" +#: ../../howto/logging-cookbook.rst:3992 msgid "" "import sys\n" "\n" @@ -3663,9 +4979,15 @@ msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" -msgid "You should do this *after* configuring logging for your needs. In the above example, the :func:`~logging.basicConfig` call does this (using the ``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). Then, you'd get this kind of result:" +#: ../../howto/logging-cookbook.rst:3999 +msgid "" +"You should do this *after* configuring logging for your needs. In the above " +"example, the :func:`~logging.basicConfig` call does this (using the " +"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " +"instance). Then, you'd get this kind of result:" msgstr "" +#: ../../howto/logging-cookbook.rst:4004 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -3674,28 +4996,41 @@ msgid "" ">>>" msgstr "" -msgid "Of course, the examples above show output according to the format used by :func:`~logging.basicConfig`, but you can use a different formatter when you configure logging." +#: ../../howto/logging-cookbook.rst:4012 +msgid "" +"Of course, the examples above show output according to the format used " +"by :func:`~logging.basicConfig`, but you can use a different formatter when " +"you configure logging." msgstr "" -msgid "Note that with the above scheme, you are somewhat at the mercy of buffering and the sequence of write calls which you are intercepting. For example, with the definition of ``LoggerWriter`` above, if you have the snippet" +#: ../../howto/logging-cookbook.rst:4016 +msgid "" +"Note that with the above scheme, you are somewhat at the mercy of buffering " +"and the sequence of write calls which you are intercepting. For example, " +"with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" +#: ../../howto/logging-cookbook.rst:4020 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" +#: ../../howto/logging-cookbook.rst:4025 msgid "then running the script results in" msgstr "" +#: ../../howto/logging-cookbook.rst:4027 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" -"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 53, in \n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 53, " +"in \n" "\n" "WARNING:demo:\n" "WARNING:demo:main()\n" -"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 49, in main\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 49, " +"in main\n" "\n" "WARNING:demo:\n" "WARNING:demo:1 / 0\n" @@ -3704,9 +5039,17 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -msgid "As you can see, this output isn't ideal. That's because the underlying code which writes to ``sys.stderr`` makes multiple writes, each of which results in a separate logged line (for example, the last three lines above). To get around this problem, you need to buffer things and only output log lines when newlines are seen. Let's use a slightly better implementation of ``LoggerWriter``:" +#: ../../howto/logging-cookbook.rst:4043 +msgid "" +"As you can see, this output isn't ideal. That's because the underlying code " +"which writes to ``sys.stderr`` makes multiple writes, each of which results " +"in a separate logged line (for example, the last three lines above). To get " +"around this problem, you need to buffer things and only output log lines " +"when newlines are seen. Let's use a slightly better implementation of " +"``LoggerWriter``:" msgstr "" +#: ../../howto/logging-cookbook.rst:4049 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -3726,24 +5069,40 @@ msgid "" " self.logger.log(self.level, part)" msgstr "" -msgid "This just buffers up stuff until a newline is seen, and then logs complete lines. With this approach, you get better output:" +#: ../../howto/logging-cookbook.rst:4068 +msgid "" +"This just buffers up stuff until a newline is seen, and then logs complete " +"lines. With this approach, you get better output:" msgstr "" +#: ../../howto/logging-cookbook.rst:4071 msgid "" "WARNING:demo:Traceback (most recent call last):\n" -"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, in \n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " +"in \n" "WARNING:demo: main()\n" -"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, in main\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, " +"in main\n" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" msgstr "" +#: ../../howto/logging-cookbook.rst:4081 msgid "How to uniformly handle newlines in logging output" msgstr "" -msgid "Usually, messages that are logged (say to console or file) consist of a single line of text. However, sometimes there is a need to handle messages with multiple lines - whether because a logging format string contains newlines, or logged data contains newlines. If you want to handle such messages uniformly, so that each line in the logged message appears uniformly formatted as if it was logged separately, you can do this using a handler mixin, as in the following snippet:" +#: ../../howto/logging-cookbook.rst:4083 +msgid "" +"Usually, messages that are logged (say to console or file) consist of a " +"single line of text. However, sometimes there is a need to handle messages " +"with multiple lines - whether because a logging format string contains " +"newlines, or logged data contains newlines. If you want to handle such " +"messages uniformly, so that each line in the logged message appears " +"uniformly formatted as if it was logged separately, you can do this using a " +"handler mixin, as in the following snippet:" msgstr "" +#: ../../howto/logging-cookbook.rst:4091 msgid "" "# Assume this is in a module mymixins.py\n" "import copy\n" @@ -3762,9 +5121,11 @@ msgid "" " super().emit(rec)" msgstr "" +#: ../../howto/logging-cookbook.rst:4109 msgid "You can use the mixin as in the following script:" msgstr "" +#: ../../howto/logging-cookbook.rst:4111 msgid "" "import logging\n" "\n" @@ -3776,17 +5137,21 @@ msgid "" " pass\n" "\n" "if __name__ == '__main__':\n" -" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-9s %(message)s',\n" +" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %" +"(levelname)-9s %(message)s',\n" " handlers = [StreamHandler()])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" " logger.debug('Another single line')\n" -" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled again')" +" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled " +"again')" msgstr "" +#: ../../howto/logging-cookbook.rst:4130 msgid "The script, when run, prints something like:" msgstr "" +#: ../../howto/logging-cookbook.rst:4132 msgid "" "2025-07-02 13:54:47,234 DEBUG Single line\n" "2025-07-02 13:54:47,234 DEBUG Multiple lines:\n" @@ -3797,9 +5162,14 @@ msgid "" "2025-07-02 13:54:47,234 DEBUG can't get fooled again" msgstr "" -msgid "If, on the other hand, you are concerned about `log injection `_, you can use a formatter which escapes newlines, as per the following example:" +#: ../../howto/logging-cookbook.rst:4142 +msgid "" +"If, on the other hand, you are concerned about `log injection `_, you can use a formatter " +"which escapes newlines, as per the following example:" msgstr "" +#: ../../howto/logging-cookbook.rst:4146 msgid "" "import logging\n" "\n" @@ -3812,101 +5182,187 @@ msgid "" "\n" "if __name__ == '__main__':\n" " h = logging.StreamHandler()\n" -" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %(message)s'))\n" +" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s %" +"(message)s'))\n" " logging.basicConfig(level=logging.DEBUG, handlers = [h])\n" " logger.debug('Single line')\n" " logger.debug('Multiple lines:\\nfool me once ...')\n" " logger.debug('Another single line')\n" -" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled again')" +" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled " +"again')" msgstr "" -msgid "You can, of course, use whatever escaping scheme makes the most sense for you. The script, when run, should produce output like this:" +#: ../../howto/logging-cookbook.rst:4166 +msgid "" +"You can, of course, use whatever escaping scheme makes the most sense for " +"you. The script, when run, should produce output like this:" msgstr "" +#: ../../howto/logging-cookbook.rst:4169 msgid "" "2025-07-09 06:47:33,783 DEBUG Single line\n" "2025-07-09 06:47:33,783 DEBUG Multiple lines:\\nfool me once ...\n" "2025-07-09 06:47:33,783 DEBUG Another single line\n" -"2025-07-09 06:47:33,783 DEBUG Multiple lines:\\nfool me ...\\ncan't get fooled again" +"2025-07-09 06:47:33,783 DEBUG Multiple lines:\\nfool me ...\\ncan't get " +"fooled again" msgstr "" -msgid "Escaping behaviour can't be the stdlib default , as it would break backwards compatibility." +#: ../../howto/logging-cookbook.rst:4176 +msgid "" +"Escaping behaviour can't be the stdlib default , as it would break backwards " +"compatibility." msgstr "" +#: ../../howto/logging-cookbook.rst:4182 msgid "Patterns to avoid" msgstr "" -msgid "Although the preceding sections have described ways of doing things you might need to do or deal with, it is worth mentioning some usage patterns which are *unhelpful*, and which should therefore be avoided in most cases. The following sections are in no particular order." +#: ../../howto/logging-cookbook.rst:4184 +msgid "" +"Although the preceding sections have described ways of doing things you " +"might need to do or deal with, it is worth mentioning some usage patterns " +"which are *unhelpful*, and which should therefore be avoided in most cases. " +"The following sections are in no particular order." msgstr "" +#: ../../howto/logging-cookbook.rst:4190 msgid "Opening the same log file multiple times" msgstr "" -msgid "On Windows, you will generally not be able to open the same file multiple times as this will lead to a \"file is in use by another process\" error. However, on POSIX platforms you'll not get any errors if you open the same file multiple times. This could be done accidentally, for example by:" +#: ../../howto/logging-cookbook.rst:4192 +msgid "" +"On Windows, you will generally not be able to open the same file multiple " +"times as this will lead to a \"file is in use by another process\" error. " +"However, on POSIX platforms you'll not get any errors if you open the same " +"file multiple times. This could be done accidentally, for example by:" msgstr "" -msgid "Adding a file handler more than once which references the same file (e.g. by a copy/paste/forget-to-change error)." +#: ../../howto/logging-cookbook.rst:4197 +msgid "" +"Adding a file handler more than once which references the same file (e.g. by " +"a copy/paste/forget-to-change error)." msgstr "" -msgid "Opening two files that look different, as they have different names, but are the same because one is a symbolic link to the other." +#: ../../howto/logging-cookbook.rst:4200 +msgid "" +"Opening two files that look different, as they have different names, but are " +"the same because one is a symbolic link to the other." msgstr "" -msgid "Forking a process, following which both parent and child have a reference to the same file. This might be through use of the :mod:`multiprocessing` module, for example." +#: ../../howto/logging-cookbook.rst:4203 +msgid "" +"Forking a process, following which both parent and child have a reference to " +"the same file. This might be through use of the :mod:`multiprocessing` " +"module, for example." msgstr "" -msgid "Opening a file multiple times might *appear* to work most of the time, but can lead to a number of problems in practice:" +#: ../../howto/logging-cookbook.rst:4207 +msgid "" +"Opening a file multiple times might *appear* to work most of the time, but " +"can lead to a number of problems in practice:" msgstr "" -msgid "Logging output can be garbled because multiple threads or processes try to write to the same file. Although logging guards against concurrent use of the same handler instance by multiple threads, there is no such protection if concurrent writes are attempted by two different threads using two different handler instances which happen to point to the same file." +#: ../../howto/logging-cookbook.rst:4210 +msgid "" +"Logging output can be garbled because multiple threads or processes try to " +"write to the same file. Although logging guards against concurrent use of " +"the same handler instance by multiple threads, there is no such protection " +"if concurrent writes are attempted by two different threads using two " +"different handler instances which happen to point to the same file." msgstr "" -msgid "An attempt to delete a file (e.g. during file rotation) silently fails, because there is another reference pointing to it. This can lead to confusion and wasted debugging time - log entries end up in unexpected places, or are lost altogether. Or a file that was supposed to be moved remains in place, and grows in size unexpectedly despite size-based rotation being supposedly in place." +#: ../../howto/logging-cookbook.rst:4216 +msgid "" +"An attempt to delete a file (e.g. during file rotation) silently fails, " +"because there is another reference pointing to it. This can lead to " +"confusion and wasted debugging time - log entries end up in unexpected " +"places, or are lost altogether. Or a file that was supposed to be moved " +"remains in place, and grows in size unexpectedly despite size-based rotation " +"being supposedly in place." msgstr "" -msgid "Use the techniques outlined in :ref:`multiple-processes` to circumvent such issues." +#: ../../howto/logging-cookbook.rst:4223 +msgid "" +"Use the techniques outlined in :ref:`multiple-processes` to circumvent such " +"issues." msgstr "" +#: ../../howto/logging-cookbook.rst:4227 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -msgid "While there might be unusual cases where you'll need to do this, in general there is no point because loggers are singletons. Code can always access a given logger instance by name using ``logging.getLogger(name)``, so passing instances around and holding them as instance attributes is pointless. Note that in other languages such as Java and C#, loggers are often static class attributes. However, this pattern doesn't make sense in Python, where the module (and not the class) is the unit of software decomposition." +#: ../../howto/logging-cookbook.rst:4229 +msgid "" +"While there might be unusual cases where you'll need to do this, in general " +"there is no point because loggers are singletons. Code can always access a " +"given logger instance by name using ``logging.getLogger(name)``, so passing " +"instances around and holding them as instance attributes is pointless. Note " +"that in other languages such as Java and C#, loggers are often static class " +"attributes. However, this pattern doesn't make sense in Python, where the " +"module (and not the class) is the unit of software decomposition." msgstr "" -msgid "Adding handlers other than :class:`~logging.NullHandler` to a logger in a library" +#: ../../howto/logging-cookbook.rst:4238 +msgid "" +"Adding handlers other than :class:`~logging.NullHandler` to a logger in a " +"library" msgstr "" -msgid "Configuring logging by adding handlers, formatters and filters is the responsibility of the application developer, not the library developer. If you are maintaining a library, ensure that you don't add handlers to any of your loggers other than a :class:`~logging.NullHandler` instance." +#: ../../howto/logging-cookbook.rst:4240 +msgid "" +"Configuring logging by adding handlers, formatters and filters is the " +"responsibility of the application developer, not the library developer. If " +"you are maintaining a library, ensure that you don't add handlers to any of " +"your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" +#: ../../howto/logging-cookbook.rst:4246 msgid "Creating a lot of loggers" msgstr "" -msgid "Loggers are singletons that are never freed during a script execution, and so creating lots of loggers will use up memory which can't then be freed. Rather than create a logger per e.g. file processed or network connection made, use the :ref:`existing mechanisms ` for passing contextual information into your logs and restrict the loggers created to those describing areas within your application (generally modules, but occasionally slightly more fine-grained than that)." +#: ../../howto/logging-cookbook.rst:4248 +msgid "" +"Loggers are singletons that are never freed during a script execution, and " +"so creating lots of loggers will use up memory which can't then be freed. " +"Rather than create a logger per e.g. file processed or network connection " +"made, use the :ref:`existing mechanisms ` for passing " +"contextual information into your logs and restrict the loggers created to " +"those describing areas within your application (generally modules, but " +"occasionally slightly more fine-grained than that)." msgstr "" +#: ../../howto/logging-cookbook.rst:4259 msgid "Other resources" msgstr "" +#: ../../howto/logging-cookbook.rst:4263 msgid "Module :mod:`logging`" msgstr "" +#: ../../howto/logging-cookbook.rst:4264 msgid "API reference for the logging module." msgstr "" +#: ../../howto/logging-cookbook.rst:4266 msgid "Module :mod:`logging.config`" msgstr "" +#: ../../howto/logging-cookbook.rst:4267 msgid "Configuration API for the logging module." msgstr "" +#: ../../howto/logging-cookbook.rst:4269 msgid "Module :mod:`logging.handlers`" msgstr "" +#: ../../howto/logging-cookbook.rst:4270 msgid "Useful handlers included with the logging module." msgstr "" +#: ../../howto/logging-cookbook.rst:4272 msgid ":ref:`Basic Tutorial `" msgstr "" +#: ../../howto/logging-cookbook.rst:4274 msgid ":ref:`Advanced Tutorial `" msgstr "" diff --git a/howto/logging.po b/howto/logging.po index 41547e5f4..eb624d3b8 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,160 +24,280 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/logging.rst:5 msgid "Logging HOWTO" msgstr "" +#: ../../howto/logging.rst:0 msgid "Author" msgstr "" +#: ../../howto/logging.rst:7 msgid "Vinay Sajip " msgstr "" -msgid "This page contains tutorial information. For links to reference information and a logging cookbook, please see :ref:`tutorial-ref-links`." +#: ../../howto/logging.rst:13 +msgid "" +"This page contains tutorial information. For links to reference information " +"and a logging cookbook, please see :ref:`tutorial-ref-links`." msgstr "" +#: ../../howto/logging.rst:17 msgid "Basic Logging Tutorial" msgstr "" -msgid "Logging is a means of tracking events that happen when some software runs. The software's developer adds logging calls to their code to indicate that certain events have occurred. An event is described by a descriptive message which can optionally contain variable data (i.e. data that is potentially different for each occurrence of the event). Events also have an importance which the developer ascribes to the event; the importance can also be called the *level* or *severity*." +#: ../../howto/logging.rst:19 +msgid "" +"Logging is a means of tracking events that happen when some software runs. " +"The software's developer adds logging calls to their code to indicate that " +"certain events have occurred. An event is described by a descriptive message " +"which can optionally contain variable data (i.e. data that is potentially " +"different for each occurrence of the event). Events also have an importance " +"which the developer ascribes to the event; the importance can also be called " +"the *level* or *severity*." msgstr "" +#: ../../howto/logging.rst:28 msgid "When to use logging" msgstr "" -msgid "You can access logging functionality by creating a logger via ``logger = logging.getLogger(__name__)``, and then calling the logger's :meth:`~Logger.debug`, :meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error` and :meth:`~Logger.critical` methods. To determine when to use logging, and to see which logger methods to use when, see the table below. It states, for each of a set of common tasks, the best tool to use for that task." +#: ../../howto/logging.rst:30 +msgid "" +"You can access logging functionality by creating a logger via ``logger = " +"logging.getLogger(__name__)``, and then calling the " +"logger's :meth:`~Logger.debug`, :meth:`~Logger.info`, :meth:`~Logger.warning`, :meth:`~Logger.error` " +"and :meth:`~Logger.critical` methods. To determine when to use logging, and " +"to see which logger methods to use when, see the table below. It states, for " +"each of a set of common tasks, the best tool to use for that task." msgstr "" +#: ../../howto/logging.rst:38 msgid "Task you want to perform" msgstr "" +#: ../../howto/logging.rst:38 msgid "The best tool for the task" msgstr "" -msgid "Display console output for ordinary usage of a command line script or program" +#: ../../howto/logging.rst:40 +msgid "" +"Display console output for ordinary usage of a command line script or program" msgstr "" +#: ../../howto/logging.rst:40 msgid ":func:`print`" msgstr "" -msgid "Report events that occur during normal operation of a program (e.g. for status monitoring or fault investigation)" +#: ../../howto/logging.rst:44 +msgid "" +"Report events that occur during normal operation of a program (e.g. for " +"status monitoring or fault investigation)" msgstr "" -msgid "A logger's :meth:`~Logger.info` (or :meth:`~Logger.debug` method for very detailed output for diagnostic purposes)" +#: ../../howto/logging.rst:44 +msgid "" +"A logger's :meth:`~Logger.info` (or :meth:`~Logger.debug` method for very " +"detailed output for diagnostic purposes)" msgstr "" +#: ../../howto/logging.rst:49 msgid "Issue a warning regarding a particular runtime event" msgstr "" -msgid ":func:`warnings.warn` in library code if the issue is avoidable and the client application should be modified to eliminate the warning" +#: ../../howto/logging.rst:49 +msgid "" +":func:`warnings.warn` in library code if the issue is avoidable and the " +"client application should be modified to eliminate the warning" msgstr "" -msgid "A logger's :meth:`~Logger.warning` method if there is nothing the client application can do about the situation, but the event should still be noted" +#: ../../howto/logging.rst:54 +msgid "" +"A logger's :meth:`~Logger.warning` method if there is nothing the client " +"application can do about the situation, but the event should still be noted" msgstr "" +#: ../../howto/logging.rst:60 msgid "Report an error regarding a particular runtime event" msgstr "" +#: ../../howto/logging.rst:60 msgid "Raise an exception" msgstr "" -msgid "Report suppression of an error without raising an exception (e.g. error handler in a long-running server process)" +#: ../../howto/logging.rst:63 +msgid "" +"Report suppression of an error without raising an exception (e.g. error " +"handler in a long-running server process)" msgstr "" -msgid "A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` or :meth:`~Logger.critical` method as appropriate for the specific error and application domain" +#: ../../howto/logging.rst:63 +msgid "" +"A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` " +"or :meth:`~Logger.critical` method as appropriate for the specific error and " +"application domain" msgstr "" -msgid "The logger methods are named after the level or severity of the events they are used to track. The standard levels and their applicability are described below (in increasing order of severity):" +#: ../../howto/logging.rst:70 +msgid "" +"The logger methods are named after the level or severity of the events they " +"are used to track. The standard levels and their applicability are described " +"below (in increasing order of severity):" msgstr "" +#: ../../howto/logging.rst:77 ../../howto/logging.rst:875 msgid "Level" msgstr "" +#: ../../howto/logging.rst:77 msgid "When it's used" msgstr "" +#: ../../howto/logging.rst:79 ../../howto/logging.rst:885 msgid "``DEBUG``" msgstr "" -msgid "Detailed information, typically of interest only when diagnosing problems." +#: ../../howto/logging.rst:79 +msgid "" +"Detailed information, typically of interest only when diagnosing problems." msgstr "" +#: ../../howto/logging.rst:82 ../../howto/logging.rst:883 msgid "``INFO``" msgstr "" +#: ../../howto/logging.rst:82 msgid "Confirmation that things are working as expected." msgstr "" +#: ../../howto/logging.rst:85 ../../howto/logging.rst:881 msgid "``WARNING``" msgstr "" -msgid "An indication that something unexpected happened, or indicative of some problem in the near future (e.g. 'disk space low'). The software is still working as expected." +#: ../../howto/logging.rst:85 +msgid "" +"An indication that something unexpected happened, or indicative of some " +"problem in the near future (e.g. 'disk space low'). The software is still " +"working as expected." msgstr "" +#: ../../howto/logging.rst:90 ../../howto/logging.rst:879 msgid "``ERROR``" msgstr "" -msgid "Due to a more serious problem, the software has not been able to perform some function." +#: ../../howto/logging.rst:90 +msgid "" +"Due to a more serious problem, the software has not been able to perform " +"some function." msgstr "" +#: ../../howto/logging.rst:93 ../../howto/logging.rst:877 msgid "``CRITICAL``" msgstr "" -msgid "A serious error, indicating that the program itself may be unable to continue running." +#: ../../howto/logging.rst:93 +msgid "" +"A serious error, indicating that the program itself may be unable to " +"continue running." msgstr "" -msgid "The default level is ``WARNING``, which means that only events of this severity and higher will be tracked, unless the logging package is configured to do otherwise." +#: ../../howto/logging.rst:97 +msgid "" +"The default level is ``WARNING``, which means that only events of this " +"severity and higher will be tracked, unless the logging package is " +"configured to do otherwise." msgstr "" -msgid "Events that are tracked can be handled in different ways. The simplest way of handling tracked events is to print them to the console. Another common way is to write them to a disk file." +#: ../../howto/logging.rst:100 +msgid "" +"Events that are tracked can be handled in different ways. The simplest way " +"of handling tracked events is to print them to the console. Another common " +"way is to write them to a disk file." msgstr "" +#: ../../howto/logging.rst:108 msgid "A simple example" msgstr "" +#: ../../howto/logging.rst:110 msgid "A very simple example is::" msgstr "" +#: ../../howto/logging.rst:112 msgid "" "import logging\n" "logging.warning('Watch out!') # will print a message to the console\n" "logging.info('I told you so') # will not print anything" msgstr "" +#: ../../howto/logging.rst:116 msgid "If you type these lines into a script and run it, you'll see:" msgstr "" +#: ../../howto/logging.rst:118 msgid "WARNING:root:Watch out!" msgstr "" -msgid "printed out on the console. The ``INFO`` message doesn't appear because the default level is ``WARNING``. The printed message includes the indication of the level and the description of the event provided in the logging call, i.e. 'Watch out!'. The actual output can be formatted quite flexibly if you need that; formatting options will also be explained later." +#: ../../howto/logging.rst:122 +msgid "" +"printed out on the console. The ``INFO`` message doesn't appear because the " +"default level is ``WARNING``. The printed message includes the indication of " +"the level and the description of the event provided in the logging call, " +"i.e. 'Watch out!'. The actual output can be formatted quite flexibly if you " +"need that; formatting options will also be explained later." msgstr "" -msgid "Notice that in this example, we use functions directly on the ``logging`` module, like ``logging.debug``, rather than creating a logger and calling functions on it. These functions operate on the root logger, but can be useful as they will call :func:`~logging.basicConfig` for you if it has not been called yet, like in this example. In larger programs you'll usually want to control the logging configuration explicitly however - so for that reason as well as others, it's better to create loggers and call their methods." +#: ../../howto/logging.rst:128 +msgid "" +"Notice that in this example, we use functions directly on the ``logging`` " +"module, like ``logging.debug``, rather than creating a logger and calling " +"functions on it. These functions operate on the root logger, but can be " +"useful as they will call :func:`~logging.basicConfig` for you if it has not " +"been called yet, like in this example. In larger programs you'll usually " +"want to control the logging configuration explicitly however - so for that " +"reason as well as others, it's better to create loggers and call their " +"methods." msgstr "" +#: ../../howto/logging.rst:137 msgid "Logging to a file" msgstr "" -msgid "A very common situation is that of recording logging events in a file, so let's look at that next. Be sure to try the following in a newly started Python interpreter, and don't just continue from the session described above::" +#: ../../howto/logging.rst:139 +msgid "" +"A very common situation is that of recording logging events in a file, so " +"let's look at that next. Be sure to try the following in a newly started " +"Python interpreter, and don't just continue from the session described " +"above::" msgstr "" +#: ../../howto/logging.rst:143 msgid "" "import logging\n" "logger = logging.getLogger(__name__)\n" -"logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)\n" +"logging.basicConfig(filename='example.log', encoding='utf-8', " +"level=logging.DEBUG)\n" "logger.debug('This message should go to the log file')\n" "logger.info('So should this')\n" "logger.warning('And this, too')\n" "logger.error('And non-ASCII stuff, too, like Øresund and Malmö')" msgstr "" -msgid "The *encoding* argument was added. In earlier Python versions, or if not specified, the encoding used is the default value used by :func:`open`. While not shown in the above example, an *errors* argument can also now be passed, which determines how encoding errors are handled. For available values and the default, see the documentation for :func:`open`." +#: ../../howto/logging.rst:151 +msgid "" +"The *encoding* argument was added. In earlier Python versions, or if not " +"specified, the encoding used is the default value used by :func:`open`. " +"While not shown in the above example, an *errors* argument can also now be " +"passed, which determines how encoding errors are handled. For available " +"values and the default, see the documentation for :func:`open`." msgstr "" -msgid "And now if we open the file and look at what we have, we should find the log messages:" +#: ../../howto/logging.rst:158 +msgid "" +"And now if we open the file and look at what we have, we should find the log " +"messages:" msgstr "" +#: ../../howto/logging.rst:161 msgid "" "DEBUG:__main__:This message should go to the log file\n" "INFO:__main__:So should this\n" @@ -185,24 +305,40 @@ msgid "" "ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö" msgstr "" -msgid "This example also shows how you can set the logging level which acts as the threshold for tracking. In this case, because we set the threshold to ``DEBUG``, all of the messages were printed." +#: ../../howto/logging.rst:168 +msgid "" +"This example also shows how you can set the logging level which acts as the " +"threshold for tracking. In this case, because we set the threshold to " +"``DEBUG``, all of the messages were printed." msgstr "" -msgid "If you want to set the logging level from a command-line option such as:" +#: ../../howto/logging.rst:172 +msgid "" +"If you want to set the logging level from a command-line option such as:" msgstr "" +#: ../../howto/logging.rst:174 msgid "--log=INFO" msgstr "" -msgid "and you have the value of the parameter passed for ``--log`` in some variable *loglevel*, you can use::" +#: ../../howto/logging.rst:178 +msgid "" +"and you have the value of the parameter passed for ``--log`` in some " +"variable *loglevel*, you can use::" msgstr "" +#: ../../howto/logging.rst:181 msgid "getattr(logging, loglevel.upper())" msgstr "" -msgid "to get the value which you'll pass to :func:`basicConfig` via the *level* argument. You may want to error check any user input value, perhaps as in the following example::" +#: ../../howto/logging.rst:183 +msgid "" +"to get the value which you'll pass to :func:`basicConfig` via the *level* " +"argument. You may want to error check any user input value, perhaps as in " +"the following example::" msgstr "" +#: ../../howto/logging.rst:187 msgid "" "# assuming loglevel is bound to the string value obtained from the\n" "# command line argument. Convert to upper case to allow the user to\n" @@ -213,286 +349,596 @@ msgid "" "logging.basicConfig(level=numeric_level, ...)" msgstr "" -msgid "The call to :func:`basicConfig` should come *before* any calls to a logger's methods such as :meth:`~Logger.debug`, :meth:`~Logger.info`, etc. Otherwise, that logging event may not be handled in the desired manner." +#: ../../howto/logging.rst:195 +msgid "" +"The call to :func:`basicConfig` should come *before* any calls to a logger's " +"methods such as :meth:`~Logger.debug`, :meth:`~Logger.info`, etc. Otherwise, " +"that logging event may not be handled in the desired manner." msgstr "" -msgid "If you run the above script several times, the messages from successive runs are appended to the file *example.log*. If you want each run to start afresh, not remembering the messages from earlier runs, you can specify the *filemode* argument, by changing the call in the above example to::" +#: ../../howto/logging.rst:199 +msgid "" +"If you run the above script several times, the messages from successive runs " +"are appended to the file *example.log*. If you want each run to start " +"afresh, not remembering the messages from earlier runs, you can specify the " +"*filemode* argument, by changing the call in the above example to::" msgstr "" -msgid "logging.basicConfig(filename='example.log', filemode='w', level=logging.DEBUG)" +#: ../../howto/logging.rst:204 +msgid "" +"logging.basicConfig(filename='example.log', filemode='w', " +"level=logging.DEBUG)" msgstr "" -msgid "The output will be the same as before, but the log file is no longer appended to, so the messages from earlier runs are lost." +#: ../../howto/logging.rst:206 +msgid "" +"The output will be the same as before, but the log file is no longer " +"appended to, so the messages from earlier runs are lost." msgstr "" +#: ../../howto/logging.rst:211 msgid "Logging variable data" msgstr "" -msgid "To log variable data, use a format string for the event description message and append the variable data as arguments. For example::" +#: ../../howto/logging.rst:213 +msgid "" +"To log variable data, use a format string for the event description message " +"and append the variable data as arguments. For example::" msgstr "" +#: ../../howto/logging.rst:216 msgid "" "import logging\n" "logging.warning('%s before you %s', 'Look', 'leap!')" msgstr "" +#: ../../howto/logging.rst:219 msgid "will display:" msgstr "" +#: ../../howto/logging.rst:221 msgid "WARNING:root:Look before you leap!" msgstr "" -msgid "As you can see, merging of variable data into the event description message uses the old, %-style of string formatting. This is for backwards compatibility: the logging package pre-dates newer formatting options such as :meth:`str.format` and :class:`string.Template`. These newer formatting options *are* supported, but exploring them is outside the scope of this tutorial: see :ref:`formatting-styles` for more information." +#: ../../howto/logging.rst:225 +msgid "" +"As you can see, merging of variable data into the event description message " +"uses the old, %-style of string formatting. This is for backwards " +"compatibility: the logging package pre-dates newer formatting options such " +"as :meth:`str.format` and :class:`string.Template`. These newer formatting " +"options *are* supported, but exploring them is outside the scope of this " +"tutorial: see :ref:`formatting-styles` for more information." msgstr "" +#: ../../howto/logging.rst:234 msgid "Changing the format of displayed messages" msgstr "" -msgid "To change the format which is used to display messages, you need to specify the format you want to use::" +#: ../../howto/logging.rst:236 +msgid "" +"To change the format which is used to display messages, you need to specify " +"the format you want to use::" msgstr "" +#: ../../howto/logging.rst:239 msgid "" "import logging\n" -"logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)\n" +"logging.basicConfig(format='%(levelname)s:%(message)s', " +"level=logging.DEBUG)\n" "logging.debug('This message should appear on the console')\n" "logging.info('So should this')\n" "logging.warning('And this, too')" msgstr "" +#: ../../howto/logging.rst:245 msgid "which would print:" msgstr "" +#: ../../howto/logging.rst:247 msgid "" "DEBUG:This message should appear on the console\n" "INFO:So should this\n" "WARNING:And this, too" msgstr "" -msgid "Notice that the 'root' which appeared in earlier examples has disappeared. For a full set of things that can appear in format strings, you can refer to the documentation for :ref:`logrecord-attributes`, but for simple usage, you just need the *levelname* (severity), *message* (event description, including variable data) and perhaps to display when the event occurred. This is described in the next section." +#: ../../howto/logging.rst:253 +msgid "" +"Notice that the 'root' which appeared in earlier examples has disappeared. " +"For a full set of things that can appear in format strings, you can refer to " +"the documentation for :ref:`logrecord-attributes`, but for simple usage, you " +"just need the *levelname* (severity), *message* (event description, " +"including variable data) and perhaps to display when the event occurred. " +"This is described in the next section." msgstr "" +#: ../../howto/logging.rst:262 msgid "Displaying the date/time in messages" msgstr "" -msgid "To display the date and time of an event, you would place '%(asctime)s' in your format string::" +#: ../../howto/logging.rst:264 +msgid "" +"To display the date and time of an event, you would place '%(asctime)s' in " +"your format string::" msgstr "" +#: ../../howto/logging.rst:267 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s')\n" "logging.warning('is when this event was logged.')" msgstr "" +#: ../../howto/logging.rst:271 msgid "which should print something like this:" msgstr "" +#: ../../howto/logging.rst:273 msgid "2010-12-12 11:41:42,612 is when this event was logged." msgstr "" -msgid "The default format for date/time display (shown above) is like ISO8601 or :rfc:`3339`. If you need more control over the formatting of the date/time, provide a *datefmt* argument to ``basicConfig``, as in this example::" +#: ../../howto/logging.rst:277 +msgid "" +"The default format for date/time display (shown above) is like ISO8601 " +"or :rfc:`3339`. If you need more control over the formatting of the date/" +"time, provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" +#: ../../howto/logging.rst:281 msgid "" "import logging\n" -"logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')\n" +"logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:" +"%M:%S %p')\n" "logging.warning('is when this event was logged.')" msgstr "" +#: ../../howto/logging.rst:285 msgid "which would display something like this:" msgstr "" +#: ../../howto/logging.rst:287 msgid "12/12/2010 11:46:36 AM is when this event was logged." msgstr "" -msgid "The format of the *datefmt* argument is the same as supported by :func:`time.strftime`." +#: ../../howto/logging.rst:291 +msgid "" +"The format of the *datefmt* argument is the same as supported " +"by :func:`time.strftime`." msgstr "" +#: ../../howto/logging.rst:296 msgid "Next Steps" msgstr "" -msgid "That concludes the basic tutorial. It should be enough to get you up and running with logging. There's a lot more that the logging package offers, but to get the best out of it, you'll need to invest a little more of your time in reading the following sections. If you're ready for that, grab some of your favourite beverage and carry on." +#: ../../howto/logging.rst:298 +msgid "" +"That concludes the basic tutorial. It should be enough to get you up and " +"running with logging. There's a lot more that the logging package offers, " +"but to get the best out of it, you'll need to invest a little more of your " +"time in reading the following sections. If you're ready for that, grab some " +"of your favourite beverage and carry on." msgstr "" -msgid "If your logging needs are simple, then use the above examples to incorporate logging into your own scripts, and if you run into problems or don't understand something, please post a question in the Help category of the `Python discussion forum `_ and you should receive help before too long." +#: ../../howto/logging.rst:304 +msgid "" +"If your logging needs are simple, then use the above examples to incorporate " +"logging into your own scripts, and if you run into problems or don't " +"understand something, please post a question in the Help category of the " +"`Python discussion forum `_ and you " +"should receive help before too long." msgstr "" -msgid "Still here? You can carry on reading the next few sections, which provide a slightly more advanced/in-depth tutorial than the basic one above. After that, you can take a look at the :ref:`logging-cookbook`." +#: ../../howto/logging.rst:310 +msgid "" +"Still here? You can carry on reading the next few sections, which provide a " +"slightly more advanced/in-depth tutorial than the basic one above. After " +"that, you can take a look at the :ref:`logging-cookbook`." msgstr "" +#: ../../howto/logging.rst:318 msgid "Advanced Logging Tutorial" msgstr "" -msgid "The logging library takes a modular approach and offers several categories of components: loggers, handlers, filters, and formatters." +#: ../../howto/logging.rst:320 +msgid "" +"The logging library takes a modular approach and offers several categories " +"of components: loggers, handlers, filters, and formatters." msgstr "" +#: ../../howto/logging.rst:323 msgid "Loggers expose the interface that application code directly uses." msgstr "" -msgid "Handlers send the log records (created by loggers) to the appropriate destination." +#: ../../howto/logging.rst:324 +msgid "" +"Handlers send the log records (created by loggers) to the appropriate " +"destination." msgstr "" -msgid "Filters provide a finer grained facility for determining which log records to output." +#: ../../howto/logging.rst:326 +msgid "" +"Filters provide a finer grained facility for determining which log records " +"to output." msgstr "" +#: ../../howto/logging.rst:328 msgid "Formatters specify the layout of log records in the final output." msgstr "" -msgid "Log event information is passed between loggers, handlers, filters and formatters in a :class:`LogRecord` instance." +#: ../../howto/logging.rst:330 +msgid "" +"Log event information is passed between loggers, handlers, filters and " +"formatters in a :class:`LogRecord` instance." msgstr "" -msgid "Logging is performed by calling methods on instances of the :class:`Logger` class (hereafter called :dfn:`loggers`). Each instance has a name, and they are conceptually arranged in a namespace hierarchy using dots (periods) as separators. For example, a logger named 'scan' is the parent of loggers 'scan.text', 'scan.html' and 'scan.pdf'. Logger names can be anything you want, and indicate the area of an application in which a logged message originates." +#: ../../howto/logging.rst:333 +msgid "" +"Logging is performed by calling methods on instances of the :class:`Logger` " +"class (hereafter called :dfn:`loggers`). Each instance has a name, and they " +"are conceptually arranged in a namespace hierarchy using dots (periods) as " +"separators. For example, a logger named 'scan' is the parent of loggers " +"'scan.text', 'scan.html' and 'scan.pdf'. Logger names can be anything you " +"want, and indicate the area of an application in which a logged message " +"originates." msgstr "" -msgid "A good convention to use when naming loggers is to use a module-level logger, in each module which uses logging, named as follows::" +#: ../../howto/logging.rst:340 +msgid "" +"A good convention to use when naming loggers is to use a module-level " +"logger, in each module which uses logging, named as follows::" msgstr "" +#: ../../howto/logging.rst:343 msgid "logger = logging.getLogger(__name__)" msgstr "" -msgid "This means that logger names track the package/module hierarchy, and it's intuitively obvious where events are logged just from the logger name." +#: ../../howto/logging.rst:345 +msgid "" +"This means that logger names track the package/module hierarchy, and it's " +"intuitively obvious where events are logged just from the logger name." msgstr "" -msgid "The root of the hierarchy of loggers is called the root logger. That's the logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` and :func:`critical`, which just call the same-named method of the root logger. The functions and the methods have the same signatures. The root logger's name is printed as 'root' in the logged output." +#: ../../howto/logging.rst:348 +msgid "" +"The root of the hierarchy of loggers is called the root logger. That's the " +"logger used by the " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical`, which just call the same-named method of the root " +"logger. The functions and the methods have the same signatures. The root " +"logger's name is printed as 'root' in the logged output." msgstr "" -msgid "It is, of course, possible to log messages to different destinations. Support is included in the package for writing log messages to files, HTTP GET/POST locations, email via SMTP, generic sockets, queues, or OS-specific logging mechanisms such as syslog or the Windows NT event log. Destinations are served by :dfn:`handler` classes. You can create your own log destination class if you have special requirements not met by any of the built-in handler classes." +#: ../../howto/logging.rst:354 +msgid "" +"It is, of course, possible to log messages to different destinations. " +"Support is included in the package for writing log messages to files, HTTP " +"GET/POST locations, email via SMTP, generic sockets, queues, or OS-specific " +"logging mechanisms such as syslog or the Windows NT event log. Destinations " +"are served by :dfn:`handler` classes. You can create your own log " +"destination class if you have special requirements not met by any of the " +"built-in handler classes." msgstr "" -msgid "By default, no destination is set for any logging messages. You can specify a destination (such as console or file) by using :func:`basicConfig` as in the tutorial examples. If you call the functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` and :func:`critical`, they will check to see if no destination is set; and if one is not set, they will set a destination of the console (``sys.stderr``) and a default format for the displayed message before delegating to the root logger to do the actual message output." +#: ../../howto/logging.rst:361 +msgid "" +"By default, no destination is set for any logging messages. You can specify " +"a destination (such as console or file) by using :func:`basicConfig` as in " +"the tutorial examples. If you call the " +"functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` " +"and :func:`critical`, they will check to see if no destination is set; and " +"if one is not set, they will set a destination of the console " +"(``sys.stderr``) and a default format for the displayed message before " +"delegating to the root logger to do the actual message output." msgstr "" +#: ../../howto/logging.rst:369 msgid "The default format set by :func:`basicConfig` for messages is:" msgstr "" +#: ../../howto/logging.rst:371 msgid "severity:logger name:message" msgstr "" -msgid "You can change this by passing a format string to :func:`basicConfig` with the *format* keyword argument. For all options regarding how a format string is constructed, see :ref:`formatter-objects`." +#: ../../howto/logging.rst:375 +msgid "" +"You can change this by passing a format string to :func:`basicConfig` with " +"the *format* keyword argument. For all options regarding how a format string " +"is constructed, see :ref:`formatter-objects`." msgstr "" +#: ../../howto/logging.rst:380 msgid "Logging Flow" msgstr "" -msgid "The flow of log event information in loggers and handlers is illustrated in the following diagram." +#: ../../howto/logging.rst:382 +msgid "" +"The flow of log event information in loggers and handlers is illustrated in " +"the following diagram." msgstr "" +#: ../../howto/logging.rst:433 msgid "Loggers" msgstr "" -msgid ":class:`Logger` objects have a threefold job. First, they expose several methods to application code so that applications can log messages at runtime. Second, logger objects determine which log messages to act upon based upon severity (the default filtering facility) or filter objects. Third, logger objects pass along relevant log messages to all interested log handlers." +#: ../../howto/logging.rst:435 +msgid "" +":class:`Logger` objects have a threefold job. First, they expose several " +"methods to application code so that applications can log messages at " +"runtime. Second, logger objects determine which log messages to act upon " +"based upon severity (the default filtering facility) or filter objects. " +"Third, logger objects pass along relevant log messages to all interested log " +"handlers." msgstr "" -msgid "The most widely used methods on logger objects fall into two categories: configuration and message sending." +#: ../../howto/logging.rst:441 +msgid "" +"The most widely used methods on logger objects fall into two categories: " +"configuration and message sending." msgstr "" +#: ../../howto/logging.rst:444 msgid "These are the most common configuration methods:" msgstr "" -msgid ":meth:`Logger.setLevel` specifies the lowest-severity log message a logger will handle, where debug is the lowest built-in severity level and critical is the highest built-in severity. For example, if the severity level is INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL messages and will ignore DEBUG messages." -msgstr "" - -msgid ":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove handler objects from the logger object. Handlers are covered in more detail in :ref:`handler-basic`." +#: ../../howto/logging.rst:446 +msgid "" +":meth:`Logger.setLevel` specifies the lowest-severity log message a logger " +"will handle, where debug is the lowest built-in severity level and critical " +"is the highest built-in severity. For example, if the severity level is " +"INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL " +"messages and will ignore DEBUG messages." msgstr "" -msgid ":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove filter objects from the logger object. Filters are covered in more detail in :ref:`filter`." +#: ../../howto/logging.rst:452 +msgid "" +":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove " +"handler objects from the logger object. Handlers are covered in more detail " +"in :ref:`handler-basic`." msgstr "" -msgid "You don't need to always call these methods on every logger you create. See the last two paragraphs in this section." +#: ../../howto/logging.rst:456 +msgid "" +":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove " +"filter objects from the logger object. Filters are covered in more detail " +"in :ref:`filter`." msgstr "" -msgid "With the logger object configured, the following methods create log messages:" +#: ../../howto/logging.rst:460 +msgid "" +"You don't need to always call these methods on every logger you create. See " +"the last two paragraphs in this section." msgstr "" -msgid ":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:`Logger.error`, and :meth:`Logger.critical` all create log records with a message and a level that corresponds to their respective method names. The message is actually a format string, which may contain the standard string substitution syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their arguments is a list of objects that correspond with the substitution fields in the message. With regard to ``**kwargs``, the logging methods care only about a keyword of ``exc_info`` and use it to determine whether to log exception information." +#: ../../howto/logging.rst:463 +msgid "" +"With the logger object configured, the following methods create log messages:" msgstr "" -msgid ":meth:`Logger.exception` creates a log message similar to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` dumps a stack trace along with it. Call this method only from an exception handler." +#: ../../howto/logging.rst:465 +msgid "" +":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:`Logger.error`, " +"and :meth:`Logger.critical` all create log records with a message and a " +"level that corresponds to their respective method names. The message is " +"actually a format string, which may contain the standard string substitution " +"syntax of ``%s``, ``%d``, ``%f``, and so on. The rest of their arguments is " +"a list of objects that correspond with the substitution fields in the " +"message. With regard to ``**kwargs``, the logging methods care only about a " +"keyword of ``exc_info`` and use it to determine whether to log exception " +"information." +msgstr "" + +#: ../../howto/logging.rst:475 +msgid "" +":meth:`Logger.exception` creates a log message similar " +"to :meth:`Logger.error`. The difference is that :meth:`Logger.exception` " +"dumps a stack trace along with it. Call this method only from an exception " +"handler." msgstr "" -msgid ":meth:`Logger.log` takes a log level as an explicit argument. This is a little more verbose for logging messages than using the log level convenience methods listed above, but this is how to log at custom log levels." +#: ../../howto/logging.rst:479 +msgid "" +":meth:`Logger.log` takes a log level as an explicit argument. This is a " +"little more verbose for logging messages than using the log level " +"convenience methods listed above, but this is how to log at custom log " +"levels." msgstr "" -msgid ":func:`getLogger` returns a reference to a logger instance with the specified name if it is provided, or ``root`` if not. The names are period-separated hierarchical structures. Multiple calls to :func:`getLogger` with the same name will return a reference to the same logger object. Loggers that are further down in the hierarchical list are children of loggers higher up in the list. For example, given a logger with a name of ``foo``, loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all descendants of ``foo``." +#: ../../howto/logging.rst:483 +msgid "" +":func:`getLogger` returns a reference to a logger instance with the " +"specified name if it is provided, or ``root`` if not. The names are period-" +"separated hierarchical structures. Multiple calls to :func:`getLogger` with " +"the same name will return a reference to the same logger object. Loggers " +"that are further down in the hierarchical list are children of loggers " +"higher up in the list. For example, given a logger with a name of ``foo``, " +"loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all " +"descendants of ``foo``." msgstr "" -msgid "Loggers have a concept of *effective level*. If a level is not explicitly set on a logger, the level of its parent is used instead as its effective level. If the parent has no explicit level set, *its* parent is examined, and so on - all ancestors are searched until an explicitly set level is found. The root logger always has an explicit level set (``WARNING`` by default). When deciding whether to process an event, the effective level of the logger is used to determine whether the event is passed to the logger's handlers." +#: ../../howto/logging.rst:491 +msgid "" +"Loggers have a concept of *effective level*. If a level is not explicitly " +"set on a logger, the level of its parent is used instead as its effective " +"level. If the parent has no explicit level set, *its* parent is examined, " +"and so on - all ancestors are searched until an explicitly set level is " +"found. The root logger always has an explicit level set (``WARNING`` by " +"default). When deciding whether to process an event, the effective level of " +"the logger is used to determine whether the event is passed to the logger's " +"handlers." msgstr "" -msgid "Child loggers propagate messages up to the handlers associated with their ancestor loggers. Because of this, it is unnecessary to define and configure handlers for all the loggers an application uses. It is sufficient to configure handlers for a top-level logger and create child loggers as needed. (You can, however, turn off propagation by setting the *propagate* attribute of a logger to ``False``.)" +#: ../../howto/logging.rst:499 +msgid "" +"Child loggers propagate messages up to the handlers associated with their " +"ancestor loggers. Because of this, it is unnecessary to define and configure " +"handlers for all the loggers an application uses. It is sufficient to " +"configure handlers for a top-level logger and create child loggers as " +"needed. (You can, however, turn off propagation by setting the *propagate* " +"attribute of a logger to ``False``.)" msgstr "" +#: ../../howto/logging.rst:510 msgid "Handlers" msgstr "" -msgid ":class:`~logging.Handler` objects are responsible for dispatching the appropriate log messages (based on the log messages' severity) to the handler's specified destination. :class:`Logger` objects can add zero or more handler objects to themselves with an :meth:`~Logger.addHandler` method. As an example scenario, an application may want to send all log messages to a log file, all log messages of error or higher to stdout, and all messages of critical to an email address. This scenario requires three individual handlers where each handler is responsible for sending messages of a specific severity to a specific location." -msgstr "" - -msgid "The standard library includes quite a few handler types (see :ref:`useful-handlers`); the tutorials use mainly :class:`StreamHandler` and :class:`FileHandler` in its examples." +#: ../../howto/logging.rst:512 +msgid "" +":class:`~logging.Handler` objects are responsible for dispatching the " +"appropriate log messages (based on the log messages' severity) to the " +"handler's specified destination. :class:`Logger` objects can add zero or " +"more handler objects to themselves with an :meth:`~Logger.addHandler` " +"method. As an example scenario, an application may want to send all log " +"messages to a log file, all log messages of error or higher to stdout, and " +"all messages of critical to an email address. This scenario requires three " +"individual handlers where each handler is responsible for sending messages " +"of a specific severity to a specific location." +msgstr "" + +#: ../../howto/logging.rst:522 +msgid "" +"The standard library includes quite a few handler types (see :ref:`useful-" +"handlers`); the tutorials use mainly :class:`StreamHandler` " +"and :class:`FileHandler` in its examples." msgstr "" -msgid "There are very few methods in a handler for application developers to concern themselves with. The only handler methods that seem relevant for application developers who are using the built-in handler objects (that is, not creating custom handlers) are the following configuration methods:" +#: ../../howto/logging.rst:526 +msgid "" +"There are very few methods in a handler for application developers to " +"concern themselves with. The only handler methods that seem relevant for " +"application developers who are using the built-in handler objects (that is, " +"not creating custom handlers) are the following configuration methods:" msgstr "" -msgid "The :meth:`~Handler.setLevel` method, just as in logger objects, specifies the lowest severity that will be dispatched to the appropriate destination. Why are there two :meth:`~Handler.setLevel` methods? The level set in the logger determines which severity of messages it will pass to its handlers. The level set in each handler determines which messages that handler will send on." +#: ../../howto/logging.rst:531 +msgid "" +"The :meth:`~Handler.setLevel` method, just as in logger objects, specifies " +"the lowest severity that will be dispatched to the appropriate destination. " +"Why are there two :meth:`~Handler.setLevel` methods? The level set in the " +"logger determines which severity of messages it will pass to its handlers. " +"The level set in each handler determines which messages that handler will " +"send on." msgstr "" -msgid ":meth:`~Handler.setFormatter` selects a Formatter object for this handler to use." +#: ../../howto/logging.rst:537 +msgid "" +":meth:`~Handler.setFormatter` selects a Formatter object for this handler to " +"use." msgstr "" -msgid ":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively configure and deconfigure filter objects on handlers." +#: ../../howto/logging.rst:540 +msgid "" +":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively " +"configure and deconfigure filter objects on handlers." msgstr "" -msgid "Application code should not directly instantiate and use instances of :class:`Handler`. Instead, the :class:`Handler` class is a base class that defines the interface that all handlers should have and establishes some default behavior that child classes can use (or override)." +#: ../../howto/logging.rst:543 +msgid "" +"Application code should not directly instantiate and use instances " +"of :class:`Handler`. Instead, the :class:`Handler` class is a base class " +"that defines the interface that all handlers should have and establishes " +"some default behavior that child classes can use (or override)." msgstr "" +#: ../../howto/logging.rst:550 msgid "Formatters" msgstr "" -msgid "Formatter objects configure the final order, structure, and contents of the log message. Unlike the base :class:`logging.Handler` class, application code may instantiate formatter classes, although you could likely subclass the formatter if your application needs special behavior. The constructor takes three optional arguments -- a message format string, a date format string and a style indicator." +#: ../../howto/logging.rst:552 +msgid "" +"Formatter objects configure the final order, structure, and contents of the " +"log message. Unlike the base :class:`logging.Handler` class, application " +"code may instantiate formatter classes, although you could likely subclass " +"the formatter if your application needs special behavior. The constructor " +"takes three optional arguments -- a message format string, a date format " +"string and a style indicator." msgstr "" -msgid "If there is no message format string, the default is to use the raw message. If there is no date format string, the default date format is:" +#: ../../howto/logging.rst:561 +msgid "" +"If there is no message format string, the default is to use the raw " +"message. If there is no date format string, the default date format is:" msgstr "" +#: ../../howto/logging.rst:564 msgid "%Y-%m-%d %H:%M:%S" msgstr "" -msgid "with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, ``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be used." +#: ../../howto/logging.rst:568 +msgid "" +"with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, " +"``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be " +"used." msgstr "" -msgid "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :ref:`logrecord-attributes`. If the style is ``'{'``, the message format string is assumed to be compatible with :meth:`str.format` (using keyword arguments), while if the style is ``'$'`` then the message format string should conform to what is expected by :meth:`string.Template.substitute`." +#: ../../howto/logging.rst:571 +msgid "" +"If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented " +"in :ref:`logrecord-attributes`. If the style is ``'{'``, the message format " +"string is assumed to be compatible with :meth:`str.format` (using keyword " +"arguments), while if the style is ``'$'`` then the message format string " +"should conform to what is expected by :meth:`string.Template.substitute`." msgstr "" +#: ../../howto/logging.rst:578 msgid "Added the ``style`` parameter." msgstr "" -msgid "The following message format string will log the time in a human-readable format, the severity of the message, and the contents of the message, in that order::" +#: ../../howto/logging.rst:581 +msgid "" +"The following message format string will log the time in a human-readable " +"format, the severity of the message, and the contents of the message, in " +"that order::" msgstr "" +#: ../../howto/logging.rst:585 msgid "'%(asctime)s - %(levelname)s - %(message)s'" msgstr "" -msgid "Formatters use a user-configurable function to convert the creation time of a record to a tuple. By default, :func:`time.localtime` is used; to change this for a particular formatter instance, set the ``converter`` attribute of the instance to a function with the same signature as :func:`time.localtime` or :func:`time.gmtime`. To change it for all formatters, for example if you want all logging times to be shown in GMT, set the ``converter`` attribute in the Formatter class (to ``time.gmtime`` for GMT display)." +#: ../../howto/logging.rst:587 +msgid "" +"Formatters use a user-configurable function to convert the creation time of " +"a record to a tuple. By default, :func:`time.localtime` is used; to change " +"this for a particular formatter instance, set the ``converter`` attribute of " +"the instance to a function with the same signature as :func:`time.localtime` " +"or :func:`time.gmtime`. To change it for all formatters, for example if you " +"want all logging times to be shown in GMT, set the ``converter`` attribute " +"in the Formatter class (to ``time.gmtime`` for GMT display)." msgstr "" +#: ../../howto/logging.rst:597 msgid "Configuring Logging" msgstr "" +#: ../../howto/logging.rst:601 msgid "Programmers can configure logging in three ways:" msgstr "" -msgid "Creating loggers, handlers, and formatters explicitly using Python code that calls the configuration methods listed above." +#: ../../howto/logging.rst:603 +msgid "" +"Creating loggers, handlers, and formatters explicitly using Python code that " +"calls the configuration methods listed above." msgstr "" -msgid "Creating a logging config file and reading it using the :func:`fileConfig` function." +#: ../../howto/logging.rst:605 +msgid "" +"Creating a logging config file and reading it using the :func:`fileConfig` " +"function." msgstr "" -msgid "Creating a dictionary of configuration information and passing it to the :func:`dictConfig` function." +#: ../../howto/logging.rst:607 +msgid "" +"Creating a dictionary of configuration information and passing it to " +"the :func:`dictConfig` function." msgstr "" -msgid "For the reference documentation on the last two options, see :ref:`logging-config-api`. The following example configures a very simple logger, a console handler, and a simple formatter using Python code::" +#: ../../howto/logging.rst:610 +msgid "" +"For the reference documentation on the last two options, see :ref:`logging-" +"config-api`. The following example configures a very simple logger, a " +"console handler, and a simple formatter using Python code::" msgstr "" +#: ../../howto/logging.rst:614 msgid "" "import logging\n" "\n" @@ -505,7 +951,8 @@ msgid "" "ch.setLevel(logging.DEBUG)\n" "\n" "# create formatter\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "\n" "# add formatter to ch\n" "ch.setFormatter(formatter)\n" @@ -521,9 +968,12 @@ msgid "" "logger.critical('critical message')" msgstr "" -msgid "Running this module from the command line produces the following output:" +#: ../../howto/logging.rst:640 +msgid "" +"Running this module from the command line produces the following output:" msgstr "" +#: ../../howto/logging.rst:642 msgid "" "$ python simple_logging_module.py\n" "2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message\n" @@ -533,9 +983,14 @@ msgid "" "2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message" msgstr "" -msgid "The following Python module creates a logger, handler, and formatter nearly identical to those in the example listed above, with the only difference being the names of the objects::" +#: ../../howto/logging.rst:651 +msgid "" +"The following Python module creates a logger, handler, and formatter nearly " +"identical to those in the example listed above, with the only difference " +"being the names of the objects::" msgstr "" +#: ../../howto/logging.rst:655 msgid "" "import logging\n" "import logging.config\n" @@ -553,9 +1008,11 @@ msgid "" "logger.critical('critical message')" msgstr "" +#: ../../howto/logging.rst:670 msgid "Here is the logging.conf file:" msgstr "" +#: ../../howto/logging.rst:672 msgid "" "[loggers]\n" "keys=root,simpleExample\n" @@ -586,9 +1043,12 @@ msgid "" "format=%(asctime)s - %(name)s - %(levelname)s - %(message)s" msgstr "" -msgid "The output is nearly identical to that of the non-config-file-based example:" +#: ../../howto/logging.rst:702 +msgid "" +"The output is nearly identical to that of the non-config-file-based example:" msgstr "" +#: ../../howto/logging.rst:704 msgid "" "$ python simple_logging_config.py\n" "2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n" @@ -598,24 +1058,66 @@ msgid "" "2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message" msgstr "" -msgid "You can see that the config file approach has a few advantages over the Python code approach, mainly separation of configuration and code and the ability of noncoders to easily modify the logging properties." -msgstr "" - -msgid "The :func:`fileConfig` function takes a default parameter, ``disable_existing_loggers``, which defaults to ``True`` for reasons of backward compatibility. This may or may not be what you want, since it will cause any non-root loggers existing before the :func:`fileConfig` call to be disabled unless they (or an ancestor) are explicitly named in the configuration. Please refer to the reference documentation for more information, and specify ``False`` for this parameter if you wish." +#: ../../howto/logging.rst:713 +msgid "" +"You can see that the config file approach has a few advantages over the " +"Python code approach, mainly separation of configuration and code and the " +"ability of noncoders to easily modify the logging properties." msgstr "" -msgid "The dictionary passed to :func:`dictConfig` can also specify a Boolean value with key ``disable_existing_loggers``, which if not specified explicitly in the dictionary also defaults to being interpreted as ``True``. This leads to the logger-disabling behaviour described above, which may not be what you want - in which case, provide the key explicitly with a value of ``False``." +#: ../../howto/logging.rst:717 +msgid "" +"The :func:`fileConfig` function takes a default parameter, " +"``disable_existing_loggers``, which defaults to ``True`` for reasons of " +"backward compatibility. This may or may not be what you want, since it will " +"cause any non-root loggers existing before the :func:`fileConfig` call to be " +"disabled unless they (or an ancestor) are explicitly named in the " +"configuration. Please refer to the reference documentation for more " +"information, and specify ``False`` for this parameter if you wish." msgstr "" -msgid "Note that the class names referenced in config files need to be either relative to the logging module, or absolute values which can be resolved using normal import mechanisms. Thus, you could use either :class:`~logging.handlers.WatchedFileHandler` (relative to the logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in package ``mypackage`` and module ``mymodule``, where ``mypackage`` is available on the Python import path)." +#: ../../howto/logging.rst:725 +msgid "" +"The dictionary passed to :func:`dictConfig` can also specify a Boolean value " +"with key ``disable_existing_loggers``, which if not specified explicitly in " +"the dictionary also defaults to being interpreted as ``True``. This leads to " +"the logger-disabling behaviour described above, which may not be what you " +"want - in which case, provide the key explicitly with a value of ``False``." msgstr "" -msgid "In Python 3.2, a new means of configuring logging has been introduced, using dictionaries to hold configuration information. This provides a superset of the functionality of the config-file-based approach outlined above, and is the recommended configuration method for new applications and deployments. Because a Python dictionary is used to hold configuration information, and since you can populate that dictionary using different means, you have more options for configuration. For example, you can use a configuration file in JSON format, or, if you have access to YAML processing functionality, a file in YAML format, to populate the configuration dictionary. Or, of course, you can construct the dictionary in Python code, receive it in pickled form over a socket, or use whatever approach makes sense for your application." +#: ../../howto/logging.rst:735 +msgid "" +"Note that the class names referenced in config files need to be either " +"relative to the logging module, or absolute values which can be resolved " +"using normal import mechanisms. Thus, you could use " +"either :class:`~logging.handlers.WatchedFileHandler` (relative to the " +"logging module) or ``mypackage.mymodule.MyHandler`` (for a class defined in " +"package ``mypackage`` and module ``mymodule``, where ``mypackage`` is " +"available on the Python import path)." msgstr "" -msgid "Here's an example of the same configuration as above, in YAML format for the new dictionary-based approach:" +#: ../../howto/logging.rst:743 +msgid "" +"In Python 3.2, a new means of configuring logging has been introduced, using " +"dictionaries to hold configuration information. This provides a superset of " +"the functionality of the config-file-based approach outlined above, and is " +"the recommended configuration method for new applications and deployments. " +"Because a Python dictionary is used to hold configuration information, and " +"since you can populate that dictionary using different means, you have more " +"options for configuration. For example, you can use a configuration file in " +"JSON format, or, if you have access to YAML processing functionality, a file " +"in YAML format, to populate the configuration dictionary. Or, of course, you " +"can construct the dictionary in Python code, receive it in pickled form over " +"a socket, or use whatever approach makes sense for your application." +msgstr "" + +#: ../../howto/logging.rst:755 +msgid "" +"Here's an example of the same configuration as above, in YAML format for the " +"new dictionary-based approach:" msgstr "" +#: ../../howto/logging.rst:758 msgid "" "version: 1\n" "formatters:\n" @@ -637,277 +1139,577 @@ msgid "" " handlers: [console]" msgstr "" -msgid "For more information about logging using a dictionary, see :ref:`logging-config-api`." +#: ../../howto/logging.rst:779 +msgid "" +"For more information about logging using a dictionary, see :ref:`logging-" +"config-api`." msgstr "" +#: ../../howto/logging.rst:783 msgid "What happens if no configuration is provided" msgstr "" -msgid "If no logging configuration is provided, it is possible to have a situation where a logging event needs to be output, but no handlers can be found to output the event." +#: ../../howto/logging.rst:785 +msgid "" +"If no logging configuration is provided, it is possible to have a situation " +"where a logging event needs to be output, but no handlers can be found to " +"output the event." msgstr "" -msgid "The event is output using a 'handler of last resort', stored in :data:`lastResort`. This internal handler is not associated with any logger, and acts like a :class:`~logging.StreamHandler` which writes the event description message to the current value of ``sys.stderr`` (therefore respecting any redirections which may be in effect). No formatting is done on the message - just the bare event description message is printed. The handler's level is set to ``WARNING``, so all events at this and greater severities will be output." +#: ../../howto/logging.rst:789 +msgid "" +"The event is output using a 'handler of last resort', stored " +"in :data:`lastResort`. This internal handler is not associated with any " +"logger, and acts like a :class:`~logging.StreamHandler` which writes the " +"event description message to the current value of ``sys.stderr`` (therefore " +"respecting any redirections which may be in effect). No formatting is done " +"on the message - just the bare event description message is printed. The " +"handler's level is set to ``WARNING``, so all events at this and greater " +"severities will be output." msgstr "" +#: ../../howto/logging.rst:800 msgid "For versions of Python prior to 3.2, the behaviour is as follows:" msgstr "" -msgid "If :data:`raiseExceptions` is ``False`` (production mode), the event is silently dropped." +#: ../../howto/logging.rst:802 +msgid "" +"If :data:`raiseExceptions` is ``False`` (production mode), the event is " +"silently dropped." msgstr "" -msgid "If :data:`raiseExceptions` is ``True`` (development mode), a message 'No handlers could be found for logger X.Y.Z' is printed once." +#: ../../howto/logging.rst:805 +msgid "" +"If :data:`raiseExceptions` is ``True`` (development mode), a message 'No " +"handlers could be found for logger X.Y.Z' is printed once." msgstr "" -msgid "To obtain the pre-3.2 behaviour, :data:`lastResort` can be set to ``None``." +#: ../../howto/logging.rst:808 +msgid "" +"To obtain the pre-3.2 behaviour, :data:`lastResort` can be set to ``None``." msgstr "" +#: ../../howto/logging.rst:814 msgid "Configuring Logging for a Library" msgstr "" -msgid "When developing a library which uses logging, you should take care to document how the library uses logging - for example, the names of loggers used. Some consideration also needs to be given to its logging configuration. If the using application does not use logging, and library code makes logging calls, then (as described in the previous section) events of severity ``WARNING`` and greater will be printed to ``sys.stderr``. This is regarded as the best default behaviour." +#: ../../howto/logging.rst:816 +msgid "" +"When developing a library which uses logging, you should take care to " +"document how the library uses logging - for example, the names of loggers " +"used. Some consideration also needs to be given to its logging " +"configuration. If the using application does not use logging, and library " +"code makes logging calls, then (as described in the previous section) events " +"of severity ``WARNING`` and greater will be printed to ``sys.stderr``. This " +"is regarded as the best default behaviour." msgstr "" -msgid "If for some reason you *don't* want these messages printed in the absence of any logging configuration, you can attach a do-nothing handler to the top-level logger for your library. This avoids the message being printed, since a handler will always be found for the library's events: it just doesn't produce any output. If the library user configures logging for application use, presumably that configuration will add some handlers, and if levels are suitably configured then logging calls made in library code will send output to those handlers, as normal." +#: ../../howto/logging.rst:824 +msgid "" +"If for some reason you *don't* want these messages printed in the absence of " +"any logging configuration, you can attach a do-nothing handler to the top-" +"level logger for your library. This avoids the message being printed, since " +"a handler will always be found for the library's events: it just doesn't " +"produce any output. If the library user configures logging for application " +"use, presumably that configuration will add some handlers, and if levels are " +"suitably configured then logging calls made in library code will send output " +"to those handlers, as normal." msgstr "" -msgid "A do-nothing handler is included in the logging package: :class:`~logging.NullHandler` (since Python 3.1). An instance of this handler could be added to the top-level logger of the logging namespace used by the library (*if* you want to prevent your library's logged events being output to ``sys.stderr`` in the absence of logging configuration). If all logging by a library *foo* is done using loggers with names matching 'foo.x', 'foo.x.y', etc. then the code::" +#: ../../howto/logging.rst:833 +msgid "" +"A do-nothing handler is included in the logging " +"package: :class:`~logging.NullHandler` (since Python 3.1). An instance of " +"this handler could be added to the top-level logger of the logging namespace " +"used by the library (*if* you want to prevent your library's logged events " +"being output to ``sys.stderr`` in the absence of logging configuration). If " +"all logging by a library *foo* is done using loggers with names matching " +"'foo.x', 'foo.x.y', etc. then the code::" msgstr "" +#: ../../howto/logging.rst:841 msgid "" "import logging\n" "logging.getLogger('foo').addHandler(logging.NullHandler())" msgstr "" -msgid "should have the desired effect. If an organisation produces a number of libraries, then the logger name specified can be 'orgname.foo' rather than just 'foo'." +#: ../../howto/logging.rst:844 +msgid "" +"should have the desired effect. If an organisation produces a number of " +"libraries, then the logger name specified can be 'orgname.foo' rather than " +"just 'foo'." msgstr "" -msgid "It is strongly advised that you *do not log to the root logger* in your library. Instead, use a logger with a unique and easily identifiable name, such as the ``__name__`` for your library's top-level package or module. Logging to the root logger will make it difficult or impossible for the application developer to configure the logging verbosity or handlers of your library as they wish." +#: ../../howto/logging.rst:848 +msgid "" +"It is strongly advised that you *do not log to the root logger* in your " +"library. Instead, use a logger with a unique and easily identifiable name, " +"such as the ``__name__`` for your library's top-level package or module. " +"Logging to the root logger will make it difficult or impossible for the " +"application developer to configure the logging verbosity or handlers of your " +"library as they wish." msgstr "" -msgid "It is strongly advised that you *do not add any handlers other than* :class:`~logging.NullHandler` *to your library's loggers*. This is because the configuration of handlers is the prerogative of the application developer who uses your library. The application developer knows their target audience and what handlers are most appropriate for their application: if you add handlers 'under the hood', you might well interfere with their ability to carry out unit tests and deliver logs which suit their requirements." +#: ../../howto/logging.rst:855 +msgid "" +"It is strongly advised that you *do not add any handlers other " +"than* :class:`~logging.NullHandler` *to your library's loggers*. This is " +"because the configuration of handlers is the prerogative of the application " +"developer who uses your library. The application developer knows their " +"target audience and what handlers are most appropriate for their " +"application: if you add handlers 'under the hood', you might well interfere " +"with their ability to carry out unit tests and deliver logs which suit their " +"requirements." msgstr "" +#: ../../howto/logging.rst:866 msgid "Logging Levels" msgstr "" -msgid "The numeric values of logging levels are given in the following table. These are primarily of interest if you want to define your own levels, and need them to have specific values relative to the predefined levels. If you define a level with the same numeric value, it overwrites the predefined value; the predefined name is lost." +#: ../../howto/logging.rst:868 +msgid "" +"The numeric values of logging levels are given in the following table. These " +"are primarily of interest if you want to define your own levels, and need " +"them to have specific values relative to the predefined levels. If you " +"define a level with the same numeric value, it overwrites the predefined " +"value; the predefined name is lost." msgstr "" +#: ../../howto/logging.rst:875 msgid "Numeric value" msgstr "" +#: ../../howto/logging.rst:877 msgid "50" msgstr "" +#: ../../howto/logging.rst:879 msgid "40" msgstr "" +#: ../../howto/logging.rst:881 msgid "30" msgstr "" +#: ../../howto/logging.rst:883 msgid "20" msgstr "" +#: ../../howto/logging.rst:885 msgid "10" msgstr "" +#: ../../howto/logging.rst:887 msgid "``NOTSET``" msgstr "" +#: ../../howto/logging.rst:887 msgid "0" msgstr "" -msgid "Levels can also be associated with loggers, being set either by the developer or through loading a saved logging configuration. When a logging method is called on a logger, the logger compares its own level with the level associated with the method call. If the logger's level is higher than the method call's, no logging message is actually generated. This is the basic mechanism controlling the verbosity of logging output." -msgstr "" - -msgid "Logging messages are encoded as instances of the :class:`~logging.LogRecord` class. When a logger decides to actually log an event, a :class:`~logging.LogRecord` instance is created from the logging message." +#: ../../howto/logging.rst:890 +msgid "" +"Levels can also be associated with loggers, being set either by the " +"developer or through loading a saved logging configuration. When a logging " +"method is called on a logger, the logger compares its own level with the " +"level associated with the method call. If the logger's level is higher than " +"the method call's, no logging message is actually generated. This is the " +"basic mechanism controlling the verbosity of logging output." msgstr "" -msgid "Logging messages are subjected to a dispatch mechanism through the use of :dfn:`handlers`, which are instances of subclasses of the :class:`Handler` class. Handlers are responsible for ensuring that a logged message (in the form of a :class:`LogRecord`) ends up in a particular location (or set of locations) which is useful for the target audience for that message (such as end users, support desk staff, system administrators, developers). Handlers are passed :class:`LogRecord` instances intended for particular destinations. Each logger can have zero, one or more handlers associated with it (via the :meth:`~Logger.addHandler` method of :class:`Logger`). In addition to any handlers directly associated with a logger, *all handlers associated with all ancestors of the logger* are called to dispatch the message (unless the *propagate* flag for a logger is set to a false value, at which point the passing to ancestor handlers stops)." +#: ../../howto/logging.rst:897 +msgid "" +"Logging messages are encoded as instances of the :class:`~logging.LogRecord` " +"class. When a logger decides to actually log an event, " +"a :class:`~logging.LogRecord` instance is created from the logging message." msgstr "" -msgid "Just as for loggers, handlers can have levels associated with them. A handler's level acts as a filter in the same way as a logger's level does. If a handler decides to actually dispatch an event, the :meth:`~Handler.emit` method is used to send the message to its destination. Most user-defined subclasses of :class:`Handler` will need to override this :meth:`~Handler.emit`." +#: ../../howto/logging.rst:901 +msgid "" +"Logging messages are subjected to a dispatch mechanism through the use " +"of :dfn:`handlers`, which are instances of subclasses of " +"the :class:`Handler` class. Handlers are responsible for ensuring that a " +"logged message (in the form of a :class:`LogRecord`) ends up in a particular " +"location (or set of locations) which is useful for the target audience for " +"that message (such as end users, support desk staff, system administrators, " +"developers). Handlers are passed :class:`LogRecord` instances intended for " +"particular destinations. Each logger can have zero, one or more handlers " +"associated with it (via the :meth:`~Logger.addHandler` method " +"of :class:`Logger`). In addition to any handlers directly associated with a " +"logger, *all handlers associated with all ancestors of the logger* are " +"called to dispatch the message (unless the *propagate* flag for a logger is " +"set to a false value, at which point the passing to ancestor handlers stops)." +msgstr "" + +#: ../../howto/logging.rst:915 +msgid "" +"Just as for loggers, handlers can have levels associated with them. A " +"handler's level acts as a filter in the same way as a logger's level does. " +"If a handler decides to actually dispatch an event, " +"the :meth:`~Handler.emit` method is used to send the message to its " +"destination. Most user-defined subclasses of :class:`Handler` will need to " +"override this :meth:`~Handler.emit`." msgstr "" +#: ../../howto/logging.rst:924 msgid "Custom Levels" msgstr "" -msgid "Defining your own levels is possible, but should not be necessary, as the existing levels have been chosen on the basis of practical experience. However, if you are convinced that you need custom levels, great care should be exercised when doing this, and it is possibly *a very bad idea to define custom levels if you are developing a library*. That's because if multiple library authors all define their own custom levels, there is a chance that the logging output from such multiple libraries used together will be difficult for the using developer to control and/or interpret, because a given numeric value might mean different things for different libraries." -msgstr "" - +#: ../../howto/logging.rst:926 +msgid "" +"Defining your own levels is possible, but should not be necessary, as the " +"existing levels have been chosen on the basis of practical experience. " +"However, if you are convinced that you need custom levels, great care should " +"be exercised when doing this, and it is possibly *a very bad idea to define " +"custom levels if you are developing a library*. That's because if multiple " +"library authors all define their own custom levels, there is a chance that " +"the logging output from such multiple libraries used together will be " +"difficult for the using developer to control and/or interpret, because a " +"given numeric value might mean different things for different libraries." +msgstr "" + +#: ../../howto/logging.rst:939 msgid "Useful Handlers" msgstr "" -msgid "In addition to the base :class:`Handler` class, many useful subclasses are provided:" +#: ../../howto/logging.rst:941 +msgid "" +"In addition to the base :class:`Handler` class, many useful subclasses are " +"provided:" msgstr "" -msgid ":class:`StreamHandler` instances send messages to streams (file-like objects)." +#: ../../howto/logging.rst:944 +msgid "" +":class:`StreamHandler` instances send messages to streams (file-like " +"objects)." msgstr "" +#: ../../howto/logging.rst:947 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" -msgid ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that rotate log files at a certain point. It is not meant to be instantiated directly. Instead, use :class:`~handlers.RotatingFileHandler` or :class:`~handlers.TimedRotatingFileHandler`." +#: ../../howto/logging.rst:949 +msgid "" +":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " +"rotate log files at a certain point. It is not meant to be instantiated " +"directly. Instead, use :class:`~handlers.RotatingFileHandler` " +"or :class:`~handlers.TimedRotatingFileHandler`." msgstr "" -msgid ":class:`~handlers.RotatingFileHandler` instances send messages to disk files, with support for maximum log file sizes and log file rotation." +#: ../../howto/logging.rst:954 +msgid "" +":class:`~handlers.RotatingFileHandler` instances send messages to disk " +"files, with support for maximum log file sizes and log file rotation." msgstr "" -msgid ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk files, rotating the log file at certain timed intervals." +#: ../../howto/logging.rst:957 +msgid "" +":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " +"files, rotating the log file at certain timed intervals." msgstr "" -msgid ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. Since 3.4, Unix domain sockets are also supported." +#: ../../howto/logging.rst:960 +msgid "" +":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " +"Since 3.4, Unix domain sockets are also supported." msgstr "" -msgid ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. Since 3.4, Unix domain sockets are also supported." +#: ../../howto/logging.rst:963 +msgid "" +":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " +"Since 3.4, Unix domain sockets are also supported." msgstr "" -msgid ":class:`~handlers.SMTPHandler` instances send messages to a designated email address." +#: ../../howto/logging.rst:966 +msgid "" +":class:`~handlers.SMTPHandler` instances send messages to a designated email " +"address." msgstr "" -msgid ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog daemon, possibly on a remote machine." +#: ../../howto/logging.rst:969 +msgid "" +":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " +"daemon, possibly on a remote machine." msgstr "" -msgid ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows NT/2000/XP event log." +#: ../../howto/logging.rst:972 +msgid "" +":class:`~handlers.NTEventLogHandler` instances send messages to a Windows NT/" +"2000/XP event log." msgstr "" -msgid ":class:`~handlers.MemoryHandler` instances send messages to a buffer in memory, which is flushed whenever specific criteria are met." +#: ../../howto/logging.rst:975 +msgid "" +":class:`~handlers.MemoryHandler` instances send messages to a buffer in " +"memory, which is flushed whenever specific criteria are met." msgstr "" -msgid ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server using either ``GET`` or ``POST`` semantics." +#: ../../howto/logging.rst:978 +msgid "" +":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " +"using either ``GET`` or ``POST`` semantics." msgstr "" -msgid ":class:`~handlers.WatchedFileHandler` instances watch the file they are logging to. If the file changes, it is closed and reopened using the file name. This handler is only useful on Unix-like systems; Windows does not support the underlying mechanism used." +#: ../../howto/logging.rst:981 +msgid "" +":class:`~handlers.WatchedFileHandler` instances watch the file they are " +"logging to. If the file changes, it is closed and reopened using the file " +"name. This handler is only useful on Unix-like systems; Windows does not " +"support the underlying mechanism used." msgstr "" -msgid ":class:`~handlers.QueueHandler` instances send messages to a queue, such as those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." +#: ../../howto/logging.rst:986 +msgid "" +":class:`~handlers.QueueHandler` instances send messages to a queue, such as " +"those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -msgid ":class:`NullHandler` instances do nothing with error messages. They are used by library developers who want to use logging, but want to avoid the 'No handlers could be found for logger *XXX*' message which can be displayed if the library user has not configured logging. See :ref:`library-config` for more information." +#: ../../howto/logging.rst:989 +msgid "" +":class:`NullHandler` instances do nothing with error messages. They are used " +"by library developers who want to use logging, but want to avoid the 'No " +"handlers could be found for logger *XXX*' message which can be displayed if " +"the library user has not configured logging. See :ref:`library-config` for " +"more information." msgstr "" +#: ../../howto/logging.rst:995 msgid "The :class:`NullHandler` class." msgstr "" +#: ../../howto/logging.rst:998 msgid "The :class:`~handlers.QueueHandler` class." msgstr "" -msgid "The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` classes are defined in the core logging package. The other handlers are defined in a sub-module, :mod:`logging.handlers`. (There is also another sub-module, :mod:`logging.config`, for configuration functionality.)" +#: ../../howto/logging.rst:1001 +msgid "" +"The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` " +"classes are defined in the core logging package. The other handlers are " +"defined in a sub-module, :mod:`logging.handlers`. (There is also another sub-" +"module, :mod:`logging.config`, for configuration functionality.)" msgstr "" -msgid "Logged messages are formatted for presentation through instances of the :class:`Formatter` class. They are initialized with a format string suitable for use with the % operator and a dictionary." +#: ../../howto/logging.rst:1006 +msgid "" +"Logged messages are formatted for presentation through instances of " +"the :class:`Formatter` class. They are initialized with a format string " +"suitable for use with the % operator and a dictionary." msgstr "" -msgid "For formatting multiple messages in a batch, instances of :class:`BufferingFormatter` can be used. In addition to the format string (which is applied to each message in the batch), there is provision for header and trailer format strings." +#: ../../howto/logging.rst:1010 +msgid "" +"For formatting multiple messages in a batch, instances " +"of :class:`BufferingFormatter` can be used. In addition to the format string " +"(which is applied to each message in the batch), there is provision for " +"header and trailer format strings." msgstr "" -msgid "When filtering based on logger level and/or handler level is not enough, instances of :class:`Filter` can be added to both :class:`Logger` and :class:`Handler` instances (through their :meth:`~Handler.addFilter` method). Before deciding to process a message further, both loggers and handlers consult all their filters for permission. If any filter returns a false value, the message is not processed further." +#: ../../howto/logging.rst:1015 +msgid "" +"When filtering based on logger level and/or handler level is not enough, " +"instances of :class:`Filter` can be added to both :class:`Logger` " +"and :class:`Handler` instances (through their :meth:`~Handler.addFilter` " +"method). Before deciding to process a message further, both loggers and " +"handlers consult all their filters for permission. If any filter returns a " +"false value, the message is not processed further." msgstr "" -msgid "The basic :class:`Filter` functionality allows filtering by specific logger name. If this feature is used, messages sent to the named logger and its children are allowed through the filter, and all others dropped." +#: ../../howto/logging.rst:1022 +msgid "" +"The basic :class:`Filter` functionality allows filtering by specific logger " +"name. If this feature is used, messages sent to the named logger and its " +"children are allowed through the filter, and all others dropped." msgstr "" +#: ../../howto/logging.rst:1030 msgid "Exceptions raised during logging" msgstr "" -msgid "The logging package is designed to swallow exceptions which occur while logging in production. This is so that errors which occur while handling logging events - such as logging misconfiguration, network or other similar errors - do not cause the application using logging to terminate prematurely." +#: ../../howto/logging.rst:1032 +msgid "" +"The logging package is designed to swallow exceptions which occur while " +"logging in production. This is so that errors which occur while handling " +"logging events - such as logging misconfiguration, network or other similar " +"errors - do not cause the application using logging to terminate prematurely." msgstr "" -msgid ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never swallowed. Other exceptions which occur during the :meth:`~Handler.emit` method of a :class:`Handler` subclass are passed to its :meth:`~Handler.handleError` method." +#: ../../howto/logging.rst:1037 +msgid "" +":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " +"swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " +"method of a :class:`Handler` subclass are passed to " +"its :meth:`~Handler.handleError` method." msgstr "" -msgid "The default implementation of :meth:`~Handler.handleError` in :class:`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, is set. If set, a traceback is printed to :data:`sys.stderr`. If not set, the exception is swallowed." +#: ../../howto/logging.rst:1042 +msgid "" +"The default implementation of :meth:`~Handler.handleError` " +"in :class:`Handler` checks to see if a module-level " +"variable, :data:`raiseExceptions`, is set. If set, a traceback is printed " +"to :data:`sys.stderr`. If not set, the exception is swallowed." msgstr "" -msgid "The default value of :data:`raiseExceptions` is ``True``. This is because during development, you typically want to be notified of any exceptions that occur. It's advised that you set :data:`raiseExceptions` to ``False`` for production usage." +#: ../../howto/logging.rst:1048 +msgid "" +"The default value of :data:`raiseExceptions` is ``True``. This is because " +"during development, you typically want to be notified of any exceptions that " +"occur. It's advised that you set :data:`raiseExceptions` to ``False`` for " +"production usage." msgstr "" +#: ../../howto/logging.rst:1058 msgid "Using arbitrary objects as messages" msgstr "" -msgid "In the preceding sections and examples, it has been assumed that the message passed when logging the event is a string. However, this is not the only possibility. You can pass an arbitrary object as a message, and its :meth:`~object.__str__` method will be called when the logging system needs to convert it to a string representation. In fact, if you want to, you can avoid computing a string representation altogether - for example, the :class:`~handlers.SocketHandler` emits an event by pickling it and sending it over the wire." +#: ../../howto/logging.rst:1060 +msgid "" +"In the preceding sections and examples, it has been assumed that the message " +"passed when logging the event is a string. However, this is not the only " +"possibility. You can pass an arbitrary object as a message, and " +"its :meth:`~object.__str__` method will be called when the logging system " +"needs to convert it to a string representation. In fact, if you want to, you " +"can avoid computing a string representation altogether - for example, " +"the :class:`~handlers.SocketHandler` emits an event by pickling it and " +"sending it over the wire." msgstr "" +#: ../../howto/logging.rst:1071 msgid "Optimization" msgstr "" -msgid "Formatting of message arguments is deferred until it cannot be avoided. However, computing the arguments passed to the logging method can also be expensive, and you may want to avoid doing it if the logger will just throw away your event. To decide what to do, you can call the :meth:`~Logger.isEnabledFor` method which takes a level argument and returns true if the event would be created by the Logger for that level of call. You can write code like this::" +#: ../../howto/logging.rst:1073 +msgid "" +"Formatting of message arguments is deferred until it cannot be avoided. " +"However, computing the arguments passed to the logging method can also be " +"expensive, and you may want to avoid doing it if the logger will just throw " +"away your event. To decide what to do, you can call " +"the :meth:`~Logger.isEnabledFor` method which takes a level argument and " +"returns true if the event would be created by the Logger for that level of " +"call. You can write code like this::" msgstr "" +#: ../../howto/logging.rst:1081 msgid "" "if logger.isEnabledFor(logging.DEBUG):\n" " logger.debug('Message with %s, %s', expensive_func1(),\n" " expensive_func2())" msgstr "" -msgid "so that if the logger's threshold is set above ``DEBUG``, the calls to ``expensive_func1`` and ``expensive_func2`` are never made." +#: ../../howto/logging.rst:1085 +msgid "" +"so that if the logger's threshold is set above ``DEBUG``, the calls to " +"``expensive_func1`` and ``expensive_func2`` are never made." msgstr "" -msgid "In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive than you'd like (e.g. for deeply nested loggers where an explicit level is only set high up in the logger hierarchy). In such cases (or if you want to avoid calling a method in tight loops), you can cache the result of a call to :meth:`~Logger.isEnabledFor` in a local or instance variable, and use that instead of calling the method each time. Such a cached value would only need to be recomputed when the logging configuration changes dynamically while the application is running (which is not all that common)." +#: ../../howto/logging.rst:1088 +msgid "" +"In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive " +"than you'd like (e.g. for deeply nested loggers where an explicit level is " +"only set high up in the logger hierarchy). In such cases (or if you want to " +"avoid calling a method in tight loops), you can cache the result of a call " +"to :meth:`~Logger.isEnabledFor` in a local or instance variable, and use " +"that instead of calling the method each time. Such a cached value would only " +"need to be recomputed when the logging configuration changes dynamically " +"while the application is running (which is not all that common)." msgstr "" -msgid "There are other optimizations which can be made for specific applications which need more precise control over what logging information is collected. Here's a list of things you can do to avoid processing during logging which you don't need:" +#: ../../howto/logging.rst:1097 +msgid "" +"There are other optimizations which can be made for specific applications " +"which need more precise control over what logging information is collected. " +"Here's a list of things you can do to avoid processing during logging which " +"you don't need:" msgstr "" +#: ../../howto/logging.rst:1103 msgid "What you don't want to collect" msgstr "" +#: ../../howto/logging.rst:1103 msgid "How to avoid collecting it" msgstr "" +#: ../../howto/logging.rst:1105 msgid "Information about where calls were made from." msgstr "" -msgid "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys._getframe`, which may help to speed up your code in environments like PyPy (which can't speed up code that uses :func:`sys._getframe`)." +#: ../../howto/logging.rst:1105 +msgid "" +"Set ``logging._srcfile`` to ``None``. This avoids " +"calling :func:`sys._getframe`, which may help to speed up your code in " +"environments like PyPy (which can't speed up code that " +"uses :func:`sys._getframe`)." msgstr "" +#: ../../howto/logging.rst:1111 msgid "Threading information." msgstr "" +#: ../../howto/logging.rst:1111 msgid "Set ``logging.logThreads`` to ``False``." msgstr "" +#: ../../howto/logging.rst:1113 msgid "Current process ID (:func:`os.getpid`)" msgstr "" +#: ../../howto/logging.rst:1113 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "" -msgid "Current process name when using ``multiprocessing`` to manage multiple processes." +#: ../../howto/logging.rst:1115 +msgid "" +"Current process name when using ``multiprocessing`` to manage multiple " +"processes." msgstr "" +#: ../../howto/logging.rst:1115 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "" +#: ../../howto/logging.rst:1118 msgid "Current :class:`asyncio.Task` name when using ``asyncio``." msgstr "" +#: ../../howto/logging.rst:1118 msgid "Set ``logging.logAsyncioTasks`` to ``False``." msgstr "" -msgid "Also note that the core logging module only includes the basic handlers. If you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't take up any memory." +#: ../../howto/logging.rst:1122 +msgid "" +"Also note that the core logging module only includes the basic handlers. If " +"you don't import :mod:`logging.handlers` and :mod:`logging.config`, they " +"won't take up any memory." msgstr "" +#: ../../howto/logging.rst:1129 msgid "Other resources" msgstr "" +#: ../../howto/logging.rst:1133 msgid "Module :mod:`logging`" msgstr "" +#: ../../howto/logging.rst:1134 msgid "API reference for the logging module." msgstr "" +#: ../../howto/logging.rst:1136 msgid "Module :mod:`logging.config`" msgstr "" +#: ../../howto/logging.rst:1137 msgid "Configuration API for the logging module." msgstr "" +#: ../../howto/logging.rst:1139 msgid "Module :mod:`logging.handlers`" msgstr "" +#: ../../howto/logging.rst:1140 msgid "Useful handlers included with the logging module." msgstr "" +#: ../../howto/logging.rst:1142 msgid ":ref:`A logging cookbook `" msgstr "" diff --git a/howto/mro.po b/howto/mro.po index 0dd3bed48..ccf91ba4f 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-04-19 14:15+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,78 +23,171 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/mro.rst:4 msgid "The Python 2.3 Method Resolution Order" msgstr "" -msgid "This is a historical document, provided as an appendix to the official documentation. The Method Resolution Order discussed here was *introduced* in Python 2.3, but it is still used in later versions -- including Python 3." +#: ../../howto/mro.rst:8 +msgid "" +"This is a historical document, provided as an appendix to the official " +"documentation. The Method Resolution Order discussed here was *introduced* " +"in Python 2.3, but it is still used in later versions -- including Python 3." msgstr "" -msgid "By `Michele Simionato `__." +#: ../../howto/mro.rst:13 +msgid "By `Michele Simionato `__." msgstr "" +#: ../../howto/mro.rst:0 msgid "Abstract" msgstr "" -msgid "*This document is intended for Python programmers who want to understand the C3 Method Resolution Order used in Python 2.3. Although it is not intended for newbies, it is quite pedagogical with many worked out examples. I am not aware of other publicly available documents with the same scope, therefore it should be useful.*" +#: ../../howto/mro.rst:17 +msgid "" +"*This document is intended for Python programmers who want to understand the " +"C3 Method Resolution Order used in Python 2.3. Although it is not intended " +"for newbies, it is quite pedagogical with many worked out examples. I am " +"not aware of other publicly available documents with the same scope, " +"therefore it should be useful.*" msgstr "" +#: ../../howto/mro.rst:23 msgid "Disclaimer:" msgstr "" -msgid "*I donate this document to the Python Software Foundation, under the Python 2.3 license. As usual in these circumstances, I warn the reader that what follows* should *be correct, but I don't give any warranty. Use it at your own risk and peril!*" +#: ../../howto/mro.rst:25 +msgid "" +"*I donate this document to the Python Software Foundation, under the Python " +"2.3 license. As usual in these circumstances, I warn the reader that what " +"follows* should *be correct, but I don't give any warranty. Use it at your " +"own risk and peril!*" msgstr "" +#: ../../howto/mro.rst:30 msgid "Acknowledgments:" msgstr "" -msgid "*All the people of the Python mailing list who sent me their support. Paul Foley who pointed out various imprecisions and made me to add the part on local precedence ordering. David Goodger for help with the formatting in reStructuredText. David Mertz for help with the editing. Finally, Guido van Rossum who enthusiastically added this document to the official Python 2.3 home-page.*" +#: ../../howto/mro.rst:32 +msgid "" +"*All the people of the Python mailing list who sent me their support. Paul " +"Foley who pointed out various imprecisions and made me to add the part on " +"local precedence ordering. David Goodger for help with the formatting in " +"reStructuredText. David Mertz for help with the editing. Finally, Guido van " +"Rossum who enthusiastically added this document to the official Python 2.3 " +"home-page.*" msgstr "" +#: ../../howto/mro.rst:40 msgid "The beginning" msgstr "" +#: ../../howto/mro.rst:42 msgid "*Felix qui potuit rerum cognoscere causas* -- Virgilius" msgstr "" -msgid "Everything started with a post by Samuele Pedroni to the Python development mailing list [#]_. In his post, Samuele showed that the Python 2.2 method resolution order is not monotonic and he proposed to replace it with the C3 method resolution order. Guido agreed with his arguments and therefore now Python 2.3 uses C3. The C3 method itself has nothing to do with Python, since it was invented by people working on Dylan and it is described in a paper intended for lispers [#]_. The present paper gives a (hopefully) readable discussion of the C3 algorithm for Pythonistas who want to understand the reasons for the change." -msgstr "" - -msgid "First of all, let me point out that what I am going to say only applies to the *new style classes* introduced in Python 2.2: *classic classes* maintain their old method resolution order, depth first and then left to right. Therefore, there is no breaking of old code for classic classes; and even if in principle there could be breaking of code for Python 2.2 new style classes, in practice the cases in which the C3 resolution order differs from the Python 2.2 method resolution order are so rare that no real breaking of code is expected. Therefore:" +#: ../../howto/mro.rst:44 +msgid "" +"Everything started with a post by Samuele Pedroni to the Python development " +"mailing list [#]_. In his post, Samuele showed that the Python 2.2 method " +"resolution order is not monotonic and he proposed to replace it with the C3 " +"method resolution order. Guido agreed with his arguments and therefore now " +"Python 2.3 uses C3. The C3 method itself has nothing to do with Python, " +"since it was invented by people working on Dylan and it is described in a " +"paper intended for lispers [#]_. The present paper gives a (hopefully) " +"readable discussion of the C3 algorithm for Pythonistas who want to " +"understand the reasons for the change." +msgstr "" + +#: ../../howto/mro.rst:55 +msgid "" +"First of all, let me point out that what I am going to say only applies to " +"the *new style classes* introduced in Python 2.2: *classic classes* " +"maintain their old method resolution order, depth first and then left to " +"right. Therefore, there is no breaking of old code for classic classes; and " +"even if in principle there could be breaking of code for Python 2.2 new " +"style classes, in practice the cases in which the C3 resolution order " +"differs from the Python 2.2 method resolution order are so rare that no real " +"breaking of code is expected. Therefore:" msgstr "" +#: ../../howto/mro.rst:64 msgid "*Don't be scared!*" msgstr "" -msgid "Moreover, unless you make strong use of multiple inheritance and you have non-trivial hierarchies, you don't need to understand the C3 algorithm, and you can easily skip this paper. On the other hand, if you really want to know how multiple inheritance works, then this paper is for you. The good news is that things are not as complicated as you might expect." +#: ../../howto/mro.rst:66 +msgid "" +"Moreover, unless you make strong use of multiple inheritance and you have " +"non-trivial hierarchies, you don't need to understand the C3 algorithm, and " +"you can easily skip this paper. On the other hand, if you really want to " +"know how multiple inheritance works, then this paper is for you. The good " +"news is that things are not as complicated as you might expect." msgstr "" +#: ../../howto/mro.rst:73 msgid "Let me begin with some basic definitions." msgstr "" -msgid "Given a class C in a complicated multiple inheritance hierarchy, it is a non-trivial task to specify the order in which methods are overridden, i.e. to specify the order of the ancestors of C." +#: ../../howto/mro.rst:75 +msgid "" +"Given a class C in a complicated multiple inheritance hierarchy, it is a non-" +"trivial task to specify the order in which methods are overridden, i.e. to " +"specify the order of the ancestors of C." msgstr "" -msgid "The list of the ancestors of a class C, including the class itself, ordered from the nearest ancestor to the furthest, is called the class precedence list or the *linearization* of C." +#: ../../howto/mro.rst:79 +msgid "" +"The list of the ancestors of a class C, including the class itself, ordered " +"from the nearest ancestor to the furthest, is called the class precedence " +"list or the *linearization* of C." msgstr "" -msgid "The *Method Resolution Order* (MRO) is the set of rules that construct the linearization. In the Python literature, the idiom \"the MRO of C\" is also used as a synonymous for the linearization of the class C." +#: ../../howto/mro.rst:83 +msgid "" +"The *Method Resolution Order* (MRO) is the set of rules that construct the " +"linearization. In the Python literature, the idiom \"the MRO of C\" is also " +"used as a synonymous for the linearization of the class C." msgstr "" -msgid "For instance, in the case of single inheritance hierarchy, if C is a subclass of C1, and C1 is a subclass of C2, then the linearization of C is simply the list [C, C1 , C2]. However, with multiple inheritance hierarchies, the construction of the linearization is more cumbersome, since it is more difficult to construct a linearization that respects *local precedence ordering* and *monotonicity*." +#: ../../howto/mro.rst:88 +msgid "" +"For instance, in the case of single inheritance hierarchy, if C is a " +"subclass of C1, and C1 is a subclass of C2, then the linearization of C is " +"simply the list [C, C1 , C2]. However, with multiple inheritance " +"hierarchies, the construction of the linearization is more cumbersome, since " +"it is more difficult to construct a linearization that respects *local " +"precedence ordering* and *monotonicity*." msgstr "" -msgid "I will discuss the local precedence ordering later, but I can give the definition of monotonicity here. A MRO is monotonic when the following is true: *if C1 precedes C2 in the linearization of C, then C1 precedes C2 in the linearization of any subclass of C*. Otherwise, the innocuous operation of deriving a new class could change the resolution order of methods, potentially introducing very subtle bugs. Examples where this happens will be shown later." +#: ../../howto/mro.rst:96 +msgid "" +"I will discuss the local precedence ordering later, but I can give the " +"definition of monotonicity here. A MRO is monotonic when the following is " +"true: *if C1 precedes C2 in the linearization of C, then C1 precedes C2 in " +"the linearization of any subclass of C*. Otherwise, the innocuous operation " +"of deriving a new class could change the resolution order of methods, " +"potentially introducing very subtle bugs. Examples where this happens will " +"be shown later." msgstr "" -msgid "Not all classes admit a linearization. There are cases, in complicated hierarchies, where it is not possible to derive a class such that its linearization respects all the desired properties." +#: ../../howto/mro.rst:104 +msgid "" +"Not all classes admit a linearization. There are cases, in complicated " +"hierarchies, where it is not possible to derive a class such that its " +"linearization respects all the desired properties." msgstr "" +#: ../../howto/mro.rst:108 msgid "Here I give an example of this situation. Consider the hierarchy" msgstr "" -msgid "which can be represented with the following inheritance graph, where I have denoted with O the ``object`` class, which is the beginning of any hierarchy for new style classes:" +#: ../../howto/mro.rst:116 +msgid "" +"which can be represented with the following inheritance graph, where I have " +"denoted with O the ``object`` class, which is the beginning of any hierarchy " +"for new style classes:" msgstr "" +#: ../../howto/mro.rst:120 msgid "" " -----------\n" "| |\n" @@ -108,93 +201,156 @@ msgid "" " ?" msgstr "" -msgid "In this case, it is not possible to derive a new class C from A and B, since X precedes Y in A, but Y precedes X in B, therefore the method resolution order would be ambiguous in C." +#: ../../howto/mro.rst:133 +msgid "" +"In this case, it is not possible to derive a new class C from A and B, since " +"X precedes Y in A, but Y precedes X in B, therefore the method resolution " +"order would be ambiguous in C." msgstr "" -msgid "Python 2.3 raises an exception in this situation (TypeError: MRO conflict among bases Y, X) forbidding the naive programmer from creating ambiguous hierarchies. Python 2.2 instead does not raise an exception, but chooses an *ad hoc* ordering (CABXYO in this case)." +#: ../../howto/mro.rst:137 +msgid "" +"Python 2.3 raises an exception in this situation (TypeError: MRO conflict " +"among bases Y, X) forbidding the naive programmer from creating ambiguous " +"hierarchies. Python 2.2 instead does not raise an exception, but chooses an " +"*ad hoc* ordering (CABXYO in this case)." msgstr "" +#: ../../howto/mro.rst:143 msgid "The C3 Method Resolution Order" msgstr "" -msgid "Let me introduce a few simple notations which will be useful for the following discussion. I will use the shortcut notation::" +#: ../../howto/mro.rst:145 +msgid "" +"Let me introduce a few simple notations which will be useful for the " +"following discussion. I will use the shortcut notation::" msgstr "" +#: ../../howto/mro.rst:148 msgid "C1 C2 ... CN" msgstr "" +#: ../../howto/mro.rst:150 msgid "to indicate the list of classes [C1, C2, ... , CN]." msgstr "" +#: ../../howto/mro.rst:152 msgid "The *head* of the list is its first element::" msgstr "" +#: ../../howto/mro.rst:154 msgid "head = C1" msgstr "" +#: ../../howto/mro.rst:156 msgid "whereas the *tail* is the rest of the list::" msgstr "" +#: ../../howto/mro.rst:158 msgid "tail = C2 ... CN." msgstr "" +#: ../../howto/mro.rst:160 msgid "I shall also use the notation::" msgstr "" +#: ../../howto/mro.rst:162 msgid "C + (C1 C2 ... CN) = C C1 C2 ... CN" msgstr "" +#: ../../howto/mro.rst:164 msgid "to denote the sum of the lists [C] + [C1, C2, ... ,CN]." msgstr "" +#: ../../howto/mro.rst:166 msgid "Now I can explain how the MRO works in Python 2.3." msgstr "" -msgid "Consider a class C in a multiple inheritance hierarchy, with C inheriting from the base classes B1, B2, ... , BN. We want to compute the linearization L[C] of the class C. The rule is the following:" +#: ../../howto/mro.rst:168 +msgid "" +"Consider a class C in a multiple inheritance hierarchy, with C inheriting " +"from the base classes B1, B2, ... , BN. We want to compute the " +"linearization L[C] of the class C. The rule is the following:" msgstr "" -msgid "*the linearization of C is the sum of C plus the merge of the linearizations of the parents and the list of the parents.*" +#: ../../howto/mro.rst:173 +msgid "" +"*the linearization of C is the sum of C plus the merge of the linearizations " +"of the parents and the list of the parents.*" msgstr "" +#: ../../howto/mro.rst:176 msgid "In symbolic notation::" msgstr "" +#: ../../howto/mro.rst:178 msgid "L[C(B1 ... BN)] = C + merge(L[B1] ... L[BN], B1 ... BN)" msgstr "" -msgid "In particular, if C is the ``object`` class, which has no parents, the linearization is trivial::" +#: ../../howto/mro.rst:180 +msgid "" +"In particular, if C is the ``object`` class, which has no parents, the " +"linearization is trivial::" msgstr "" +#: ../../howto/mro.rst:183 msgid "L[object] = object." msgstr "" -msgid "However, in general one has to compute the merge according to the following prescription:" +#: ../../howto/mro.rst:185 +msgid "" +"However, in general one has to compute the merge according to the following " +"prescription:" msgstr "" -msgid "*take the head of the first list, i.e L[B1][0]; if this head is not in the tail of any of the other lists, then add it to the linearization of C and remove it from the lists in the merge, otherwise look at the head of the next list and take it, if it is a good head. Then repeat the operation until all the class are removed or it is impossible to find good heads. In this case, it is impossible to construct the merge, Python 2.3 will refuse to create the class C and will raise an exception.*" +#: ../../howto/mro.rst:188 +msgid "" +"*take the head of the first list, i.e L[B1][0]; if this head is not in the " +"tail of any of the other lists, then add it to the linearization of C and " +"remove it from the lists in the merge, otherwise look at the head of the " +"next list and take it, if it is a good head. Then repeat the operation " +"until all the class are removed or it is impossible to find good heads. In " +"this case, it is impossible to construct the merge, Python 2.3 will refuse " +"to create the class C and will raise an exception.*" msgstr "" -msgid "This prescription ensures that the merge operation *preserves* the ordering, if the ordering can be preserved. On the other hand, if the order cannot be preserved (as in the example of serious order disagreement discussed above) then the merge cannot be computed." +#: ../../howto/mro.rst:197 +msgid "" +"This prescription ensures that the merge operation *preserves* the ordering, " +"if the ordering can be preserved. On the other hand, if the order cannot be " +"preserved (as in the example of serious order disagreement discussed above) " +"then the merge cannot be computed." msgstr "" -msgid "The computation of the merge is trivial if C has only one parent (single inheritance); in this case::" +#: ../../howto/mro.rst:202 +msgid "" +"The computation of the merge is trivial if C has only one parent (single " +"inheritance); in this case::" msgstr "" +#: ../../howto/mro.rst:205 msgid "L[C(B)] = C + merge(L[B],B) = C + L[B]" msgstr "" -msgid "However, in the case of multiple inheritance things are more cumbersome and I don't expect you can understand the rule without a couple of examples ;-)" +#: ../../howto/mro.rst:207 +msgid "" +"However, in the case of multiple inheritance things are more cumbersome and " +"I don't expect you can understand the rule without a couple of examples ;-)" msgstr "" +#: ../../howto/mro.rst:212 msgid "Examples" msgstr "" +#: ../../howto/mro.rst:214 msgid "First example. Consider the following hierarchy:" msgstr "" +#: ../../howto/mro.rst:224 msgid "In this case the inheritance graph can be drawn as:" msgstr "" +#: ../../howto/mro.rst:226 msgid "" " 6\n" " ---\n" @@ -219,9 +375,11 @@ msgid "" " ---" msgstr "" +#: ../../howto/mro.rst:251 msgid "The linearizations of O,D,E and F are trivial::" msgstr "" +#: ../../howto/mro.rst:253 msgid "" "L[O] = O\n" "L[D] = D O\n" @@ -229,21 +387,32 @@ msgid "" "L[F] = F O" msgstr "" +#: ../../howto/mro.rst:258 msgid "The linearization of B can be computed as::" msgstr "" +#: ../../howto/mro.rst:260 msgid "L[B] = B + merge(DO, EO, DE)" msgstr "" -msgid "We see that D is a good head, therefore we take it and we are reduced to compute ``merge(O,EO,E)``. Now O is not a good head, since it is in the tail of the sequence EO. In this case the rule says that we have to skip to the next sequence. Then we see that E is a good head; we take it and we are reduced to compute ``merge(O,O)`` which gives O. Therefore::" +#: ../../howto/mro.rst:262 +msgid "" +"We see that D is a good head, therefore we take it and we are reduced to " +"compute ``merge(O,EO,E)``. Now O is not a good head, since it is in the " +"tail of the sequence EO. In this case the rule says that we have to skip to " +"the next sequence. Then we see that E is a good head; we take it and we are " +"reduced to compute ``merge(O,O)`` which gives O. Therefore::" msgstr "" +#: ../../howto/mro.rst:268 msgid "L[B] = B D E O" msgstr "" +#: ../../howto/mro.rst:270 msgid "Using the same procedure one finds::" msgstr "" +#: ../../howto/mro.rst:272 msgid "" "L[C] = C + merge(DO,FO,DF)\n" " = C + D + merge(O,FO,F)\n" @@ -251,9 +420,11 @@ msgid "" " = C D F O" msgstr "" +#: ../../howto/mro.rst:277 msgid "Now we can compute::" msgstr "" +#: ../../howto/mro.rst:279 msgid "" "L[A] = A + merge(BDEO,CDFO,BC)\n" " = A + B + merge(DEO,CDFO,C)\n" @@ -264,15 +435,28 @@ msgid "" " = A B C D E F O" msgstr "" -msgid "In this example, the linearization is ordered in a pretty nice way according to the inheritance level, in the sense that lower levels (i.e. more specialized classes) have higher precedence (see the inheritance graph). However, this is not the general case." +#: ../../howto/mro.rst:287 +msgid "" +"In this example, the linearization is ordered in a pretty nice way according " +"to the inheritance level, in the sense that lower levels (i.e. more " +"specialized classes) have higher precedence (see the inheritance graph). " +"However, this is not the general case." msgstr "" -msgid "I leave as an exercise for the reader to compute the linearization for my second example:" +#: ../../howto/mro.rst:292 +msgid "" +"I leave as an exercise for the reader to compute the linearization for my " +"second example:" msgstr "" -msgid "The only difference with the previous example is the change B(D,E) --> B(E,D); however even such a little modification completely changes the ordering of the hierarchy:" +#: ../../howto/mro.rst:303 +msgid "" +"The only difference with the previous example is the change B(D,E) --> " +"B(E,D); however even such a little modification completely changes the " +"ordering of the hierarchy:" msgstr "" +#: ../../howto/mro.rst:307 msgid "" " 6\n" " ---\n" @@ -297,15 +481,28 @@ msgid "" " ---" msgstr "" -msgid "Notice that the class E, which is in the second level of the hierarchy, precedes the class C, which is in the first level of the hierarchy, i.e. E is more specialized than C, even if it is in a higher level." +#: ../../howto/mro.rst:332 +msgid "" +"Notice that the class E, which is in the second level of the hierarchy, " +"precedes the class C, which is in the first level of the hierarchy, i.e. E " +"is more specialized than C, even if it is in a higher level." msgstr "" -msgid "A lazy programmer can obtain the MRO directly from Python 2.2, since in this case it coincides with the Python 2.3 linearization. It is enough to invoke the :meth:`~type.mro` method of class A:" +#: ../../howto/mro.rst:336 +msgid "" +"A lazy programmer can obtain the MRO directly from Python 2.2, since in this " +"case it coincides with the Python 2.3 linearization. It is enough to invoke " +"the :meth:`~type.mro` method of class A:" msgstr "" -msgid "Finally, let me consider the example discussed in the first section, involving a serious order disagreement. In this case, it is straightforward to compute the linearizations of O, X, Y, A and B:" +#: ../../howto/mro.rst:345 +msgid "" +"Finally, let me consider the example discussed in the first section, " +"involving a serious order disagreement. In this case, it is straightforward " +"to compute the linearizations of O, X, Y, A and B:" msgstr "" +#: ../../howto/mro.rst:349 msgid "" "L[O] = 0\n" "L[X] = X O\n" @@ -314,30 +511,50 @@ msgid "" "L[B] = B Y X O" msgstr "" -msgid "However, it is impossible to compute the linearization for a class C that inherits from A and B::" +#: ../../howto/mro.rst:357 +msgid "" +"However, it is impossible to compute the linearization for a class C that " +"inherits from A and B::" msgstr "" +#: ../../howto/mro.rst:360 msgid "" "L[C] = C + merge(AXYO, BYXO, AB)\n" " = C + A + merge(XYO, BYXO, B)\n" " = C + A + B + merge(XYO, YXO)" msgstr "" -msgid "At this point we cannot merge the lists XYO and YXO, since X is in the tail of YXO whereas Y is in the tail of XYO: therefore there are no good heads and the C3 algorithm stops. Python 2.3 raises an error and refuses to create the class C." +#: ../../howto/mro.rst:364 +msgid "" +"At this point we cannot merge the lists XYO and YXO, since X is in the tail " +"of YXO whereas Y is in the tail of XYO: therefore there are no good heads " +"and the C3 algorithm stops. Python 2.3 raises an error and refuses to " +"create the class C." msgstr "" +#: ../../howto/mro.rst:370 msgid "Bad Method Resolution Orders" msgstr "" -msgid "A MRO is *bad* when it breaks such fundamental properties as local precedence ordering and monotonicity. In this section, I will show that both the MRO for classic classes and the MRO for new style classes in Python 2.2 are bad." +#: ../../howto/mro.rst:372 +msgid "" +"A MRO is *bad* when it breaks such fundamental properties as local " +"precedence ordering and monotonicity. In this section, I will show that " +"both the MRO for classic classes and the MRO for new style classes in Python " +"2.2 are bad." msgstr "" -msgid "It is easier to start with the local precedence ordering. Consider the following example:" +#: ../../howto/mro.rst:377 +msgid "" +"It is easier to start with the local precedence ordering. Consider the " +"following example:" msgstr "" +#: ../../howto/mro.rst:384 msgid "with inheritance diagram" msgstr "" +#: ../../howto/mro.rst:386 msgid "" " O\n" " |\n" @@ -350,33 +567,65 @@ msgid "" " (buy eggs or spam ?)" msgstr "" -msgid "We see that class G inherits from F and E, with F *before* E: therefore we would expect the attribute *G.remember2buy* to be inherited by *F.remember2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" +#: ../../howto/mro.rst:399 +msgid "" +"We see that class G inherits from F and E, with F *before* E: therefore we " +"would expect the attribute *G.remember2buy* to be inherited by " +"*F.remember2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" msgstr "" -msgid "This is a breaking of local precedence ordering since the order in the local precedence list, i.e. the list of the parents of G, is not preserved in the Python 2.2 linearization of G::" +#: ../../howto/mro.rst:407 +msgid "" +"This is a breaking of local precedence ordering since the order in the local " +"precedence list, i.e. the list of the parents of G, is not preserved in the " +"Python 2.2 linearization of G::" msgstr "" +#: ../../howto/mro.rst:411 msgid "L[G,P22]= G E F object # F *follows* E" msgstr "" -msgid "One could argue that the reason why F follows E in the Python 2.2 linearization is that F is less specialized than E, since F is the superclass of E; nevertheless the breaking of local precedence ordering is quite non-intuitive and error prone. This is particularly true since it is a different from old style classes:" +#: ../../howto/mro.rst:413 +msgid "" +"One could argue that the reason why F follows E in the Python 2.2 " +"linearization is that F is less specialized than E, since F is the " +"superclass of E; nevertheless the breaking of local precedence ordering is " +"quite non-intuitive and error prone. This is particularly true since it is " +"a different from old style classes:" msgstr "" -msgid "In this case the MRO is GFEF and the local precedence ordering is preserved." +#: ../../howto/mro.rst:425 +msgid "" +"In this case the MRO is GFEF and the local precedence ordering is preserved." msgstr "" -msgid "As a general rule, hierarchies such as the previous one should be avoided, since it is unclear if F should override E or vice-versa. Python 2.3 solves the ambiguity by raising an exception in the creation of class G, effectively stopping the programmer from generating ambiguous hierarchies. The reason for that is that the C3 algorithm fails when the merge::" +#: ../../howto/mro.rst:428 +msgid "" +"As a general rule, hierarchies such as the previous one should be avoided, " +"since it is unclear if F should override E or vice-versa. Python 2.3 solves " +"the ambiguity by raising an exception in the creation of class G, " +"effectively stopping the programmer from generating ambiguous hierarchies. " +"The reason for that is that the C3 algorithm fails when the merge::" msgstr "" +#: ../../howto/mro.rst:435 msgid "merge(FO,EFO,FE)" msgstr "" -msgid "cannot be computed, because F is in the tail of EFO and E is in the tail of FE." +#: ../../howto/mro.rst:437 +msgid "" +"cannot be computed, because F is in the tail of EFO and E is in the tail of " +"FE." msgstr "" -msgid "The real solution is to design a non-ambiguous hierarchy, i.e. to derive G from E and F (the more specific first) and not from F and E; in this case the MRO is GEF without any doubt." +#: ../../howto/mro.rst:440 +msgid "" +"The real solution is to design a non-ambiguous hierarchy, i.e. to derive G " +"from E and F (the more specific first) and not from F and E; in this case " +"the MRO is GEF without any doubt." msgstr "" +#: ../../howto/mro.rst:444 msgid "" " O\n" " |\n" @@ -388,30 +637,56 @@ msgid "" " (eggs, no doubt)" msgstr "" -msgid "Python 2.3 forces the programmer to write good hierarchies (or, at least, less error-prone ones)." +#: ../../howto/mro.rst:456 +msgid "" +"Python 2.3 forces the programmer to write good hierarchies (or, at least, " +"less error-prone ones)." msgstr "" -msgid "On a related note, let me point out that the Python 2.3 algorithm is smart enough to recognize obvious mistakes, as the duplication of classes in the list of parents:" +#: ../../howto/mro.rst:459 +msgid "" +"On a related note, let me point out that the Python 2.3 algorithm is smart " +"enough to recognize obvious mistakes, as the duplication of classes in the " +"list of parents:" msgstr "" -msgid "Python 2.2 (both for classic classes and new style classes) in this situation, would not raise any exception." +#: ../../howto/mro.rst:469 +msgid "" +"Python 2.2 (both for classic classes and new style classes) in this " +"situation, would not raise any exception." msgstr "" -msgid "Finally, I would like to point out two lessons we have learned from this example:" +#: ../../howto/mro.rst:472 +msgid "" +"Finally, I would like to point out two lessons we have learned from this " +"example:" msgstr "" -msgid "despite the name, the MRO determines the resolution order of attributes, not only of methods;" +#: ../../howto/mro.rst:475 +msgid "" +"despite the name, the MRO determines the resolution order of attributes, not " +"only of methods;" msgstr "" -msgid "the default food for Pythonistas is spam ! (but you already knew that ;-)" +#: ../../howto/mro.rst:478 +msgid "" +"the default food for Pythonistas is spam ! (but you already knew that ;-)" msgstr "" -msgid "Having discussed the issue of local precedence ordering, let me now consider the issue of monotonicity. My goal is to show that neither the MRO for classic classes nor that for Python 2.2 new style classes is monotonic." +#: ../../howto/mro.rst:481 +msgid "" +"Having discussed the issue of local precedence ordering, let me now consider " +"the issue of monotonicity. My goal is to show that neither the MRO for " +"classic classes nor that for Python 2.2 new style classes is monotonic." msgstr "" -msgid "To prove that the MRO for classic classes is non-monotonic is rather trivial, it is enough to look at the diamond diagram:" +#: ../../howto/mro.rst:486 +msgid "" +"To prove that the MRO for classic classes is non-monotonic is rather " +"trivial, it is enough to look at the diamond diagram:" msgstr "" +#: ../../howto/mro.rst:489 msgid "" " C\n" " / \\\n" @@ -422,29 +697,49 @@ msgid "" " D" msgstr "" +#: ../../howto/mro.rst:500 msgid "One easily discerns the inconsistency::" msgstr "" +#: ../../howto/mro.rst:502 msgid "" "L[B,P21] = B C # B precedes C : B's methods win\n" "L[D,P21] = D A C B C # B follows C : C's methods win!" msgstr "" -msgid "On the other hand, there are no problems with the Python 2.2 and 2.3 MROs, they give both::" +#: ../../howto/mro.rst:505 +msgid "" +"On the other hand, there are no problems with the Python 2.2 and 2.3 MROs, " +"they give both::" msgstr "" +#: ../../howto/mro.rst:508 msgid "L[D] = D A B C" msgstr "" -msgid "Guido points out in his essay [#]_ that the classic MRO is not so bad in practice, since one can typically avoids diamonds for classic classes. But all new style classes inherit from ``object``, therefore diamonds are unavoidable and inconsistencies shows up in every multiple inheritance graph." +#: ../../howto/mro.rst:510 +msgid "" +"Guido points out in his essay [#]_ that the classic MRO is not so bad in " +"practice, since one can typically avoids diamonds for classic classes. But " +"all new style classes inherit from ``object``, therefore diamonds are " +"unavoidable and inconsistencies shows up in every multiple inheritance graph." msgstr "" -msgid "The MRO of Python 2.2 makes breaking monotonicity difficult, but not impossible. The following example, originally provided by Samuele Pedroni, shows that the MRO of Python 2.2 is non-monotonic:" +#: ../../howto/mro.rst:516 +msgid "" +"The MRO of Python 2.2 makes breaking monotonicity difficult, but not " +"impossible. The following example, originally provided by Samuele Pedroni, " +"shows that the MRO of Python 2.2 is non-monotonic:" msgstr "" -msgid "Here are the linearizations according to the C3 MRO (the reader should verify these linearizations as an exercise and draw the inheritance diagram ;-) ::" +#: ../../howto/mro.rst:530 +msgid "" +"Here are the linearizations according to the C3 MRO (the reader should " +"verify these linearizations as an exercise and draw the inheritance " +"diagram ;-) ::" msgstr "" +#: ../../howto/mro.rst:534 msgid "" "L[A] = A O\n" "L[B] = B O\n" @@ -457,25 +752,53 @@ msgid "" "L[Z] = Z K1 K2 K3 D A B C E O" msgstr "" -msgid "Python 2.2 gives exactly the same linearizations for A, B, C, D, E, K1, K2 and K3, but a different linearization for Z::" +#: ../../howto/mro.rst:544 +msgid "" +"Python 2.2 gives exactly the same linearizations for A, B, C, D, E, K1, K2 " +"and K3, but a different linearization for Z::" msgstr "" +#: ../../howto/mro.rst:547 msgid "L[Z,P22] = Z K1 K3 A K2 D B C E O" msgstr "" -msgid "It is clear that this linearization is *wrong*, since A comes before D whereas in the linearization of K3 A comes *after* D. In other words, in K3 methods derived by D override methods derived by A, but in Z, which still is a subclass of K3, methods derived by A override methods derived by D! This is a violation of monotonicity. Moreover, the Python 2.2 linearization of Z is also inconsistent with local precedence ordering, since the local precedence list of the class Z is [K1, K2, K3] (K2 precedes K3), whereas in the linearization of Z K2 *follows* K3. These problems explain why the 2.2 rule has been dismissed in favor of the C3 rule." -msgstr "" - +#: ../../howto/mro.rst:549 +msgid "" +"It is clear that this linearization is *wrong*, since A comes before D " +"whereas in the linearization of K3 A comes *after* D. In other words, in K3 " +"methods derived by D override methods derived by A, but in Z, which still is " +"a subclass of K3, methods derived by A override methods derived by D! This " +"is a violation of monotonicity. Moreover, the Python 2.2 linearization of Z " +"is also inconsistent with local precedence ordering, since the local " +"precedence list of the class Z is [K1, K2, K3] (K2 precedes K3), whereas in " +"the linearization of Z K2 *follows* K3. These problems explain why the 2.2 " +"rule has been dismissed in favor of the C3 rule." +msgstr "" + +#: ../../howto/mro.rst:561 msgid "The end" msgstr "" -msgid "This section is for the impatient reader, who skipped all the previous sections and jumped immediately to the end. This section is for the lazy programmer too, who didn't want to exercise her/his brain. Finally, it is for the programmer with some hubris, otherwise s/he would not be reading a paper on the C3 method resolution order in multiple inheritance hierarchies ;-) These three virtues taken all together (and *not* separately) deserve a prize: the prize is a short Python 2.2 script that allows you to compute the 2.3 MRO without risk to your brain. Simply change the last line to play with the various examples I have discussed in this paper.::" -msgstr "" - +#: ../../howto/mro.rst:563 +msgid "" +"This section is for the impatient reader, who skipped all the previous " +"sections and jumped immediately to the end. This section is for the lazy " +"programmer too, who didn't want to exercise her/his brain. Finally, it is " +"for the programmer with some hubris, otherwise s/he would not be reading a " +"paper on the C3 method resolution order in multiple inheritance " +"hierarchies ;-) These three virtues taken all together (and *not* " +"separately) deserve a prize: the prize is a short Python 2.2 script that " +"allows you to compute the 2.3 MRO without risk to your brain. Simply change " +"the last line to play with the various examples I have discussed in this " +"paper.::" +msgstr "" + +#: ../../howto/mro.rst:574 msgid "" "#\n" "\n" -"\"\"\"C3 algorithm by Samuele Pedroni (with readability enhanced by me).\"\"\"\n" +"\"\"\"C3 algorithm by Samuele Pedroni (with readability enhanced by me)." +"\"\"\"\n" "\n" "class __metaclass__(type):\n" " \"All classes are metamagically modified to be nicely printed\"\n" @@ -556,20 +879,33 @@ msgid "" "#" msgstr "" +#: ../../howto/mro.rst:656 msgid "That's all folks," msgstr "" +#: ../../howto/mro.rst:658 msgid "enjoy !" msgstr "" +#: ../../howto/mro.rst:662 msgid "Resources" msgstr "" -msgid "The thread on python-dev started by Samuele Pedroni: https://mail.python.org/pipermail/python-dev/2002-October/029035.html" +#: ../../howto/mro.rst:664 +msgid "" +"The thread on python-dev started by Samuele Pedroni: https://mail.python.org/" +"pipermail/python-dev/2002-October/029035.html" msgstr "" -msgid "The paper *A Monotonic Superclass Linearization for Dylan*: https://doi.org/10.1145/236337.236343" +#: ../../howto/mro.rst:667 +msgid "" +"The paper *A Monotonic Superclass Linearization for Dylan*: https://doi.org/" +"10.1145/236337.236343" msgstr "" -msgid "Guido van Rossum's essay, *Unifying types and classes in Python 2.2*: https://web.archive.org/web/20140210194412/http://www.python.org/download/releases/2.2.2/descrintro" +#: ../../howto/mro.rst:670 +msgid "" +"Guido van Rossum's essay, *Unifying types and classes in Python 2.2*: " +"https://web.archive.org/web/20140210194412/http://www.python.org/download/" +"releases/2.2.2/descrintro" msgstr "" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index c50d8222b..b8abb1d14 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2023-05-24 13:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,30 +23,58 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/perf_profiling.rst:7 msgid "Python support for the Linux ``perf`` profiler" msgstr "" +#: ../../howto/perf_profiling.rst:0 msgid "author" msgstr "" +#: ../../howto/perf_profiling.rst:9 msgid "Pablo Galindo" msgstr "" -msgid "`The Linux perf profiler `_ is a very powerful tool that allows you to profile and obtain information about the performance of your application. ``perf`` also has a very vibrant ecosystem of tools that aid with the analysis of the data that it produces." +#: ../../howto/perf_profiling.rst:11 +msgid "" +"`The Linux perf profiler `_ is a very powerful " +"tool that allows you to profile and obtain information about the performance " +"of your application. ``perf`` also has a very vibrant ecosystem of tools " +"that aid with the analysis of the data that it produces." msgstr "" -msgid "The main problem with using the ``perf`` profiler with Python applications is that ``perf`` only gets information about native symbols, that is, the names of functions and procedures written in C. This means that the names and file names of Python functions in your code will not appear in the output of ``perf``." +#: ../../howto/perf_profiling.rst:17 +msgid "" +"The main problem with using the ``perf`` profiler with Python applications " +"is that ``perf`` only gets information about native symbols, that is, the " +"names of functions and procedures written in C. This means that the names " +"and file names of Python functions in your code will not appear in the " +"output of ``perf``." msgstr "" -msgid "Since Python 3.12, the interpreter can run in a special mode that allows Python functions to appear in the output of the ``perf`` profiler. When this mode is enabled, the interpreter will interpose a small piece of code compiled on the fly before the execution of every Python function and it will teach ``perf`` the relationship between this piece of code and the associated Python function using :doc:`perf map files <../c-api/perfmaps>`." +#: ../../howto/perf_profiling.rst:22 +msgid "" +"Since Python 3.12, the interpreter can run in a special mode that allows " +"Python functions to appear in the output of the ``perf`` profiler. When this " +"mode is enabled, the interpreter will interpose a small piece of code " +"compiled on the fly before the execution of every Python function and it " +"will teach ``perf`` the relationship between this piece of code and the " +"associated Python function using :doc:`perf map files <../c-api/perfmaps>`." msgstr "" -msgid "Support for the ``perf`` profiler is currently only available for Linux on select architectures. Check the output of the ``configure`` build step or check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to see if your system is supported." +#: ../../howto/perf_profiling.rst:31 +msgid "" +"Support for the ``perf`` profiler is currently only available for Linux on " +"select architectures. Check the output of the ``configure`` build step or " +"check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to " +"see if your system is supported." msgstr "" +#: ../../howto/perf_profiling.rst:36 msgid "For example, consider the following script:" msgstr "" +#: ../../howto/perf_profiling.rst:38 msgid "" "def foo(n):\n" " result = 0\n" @@ -64,22 +92,27 @@ msgid "" " baz(1000000)" msgstr "" +#: ../../howto/perf_profiling.rst:55 msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::" msgstr "" +#: ../../howto/perf_profiling.rst:57 msgid "$ perf record -F 9999 -g -o perf.data python my_script.py" msgstr "" +#: ../../howto/perf_profiling.rst:59 msgid "Then we can use ``perf report`` to analyze the data:" msgstr "" +#: ../../howto/perf_profiling.rst:61 msgid "" "$ perf report --stdio -n -g\n" "\n" "# Children Self Samples Command Shared Object Symbol\n" "# ........ ........ ............ .......... .................. ..........................................\n" "#\n" -" 91.08% 0.00% 0 python.exe python.exe [.] _start\n" +" 91.08% 0.00% 0 python.exe python.exe [.] " +"_start\n" " |\n" " ---_start\n" " |\n" @@ -93,38 +126,63 @@ msgid "" " | | |\n" " | | |--55.02%--run_mod\n" " | | | |\n" -" | | | --54.65%--PyEval_EvalCode\n" -" | | | _PyEval_EvalFrameDefault\n" -" | | | PyObject_Vectorcall\n" -" | | | _PyEval_Vector\n" -" | | | _PyEval_EvalFrameDefault\n" -" | | | PyObject_Vectorcall\n" -" | | | _PyEval_Vector\n" -" | | | _PyEval_EvalFrameDefault\n" -" | | | PyObject_Vectorcall\n" -" | | | _PyEval_Vector\n" +" | | | --54.65%--" +"PyEval_EvalCode\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" " | | | |\n" -" | | | |--51.67%--_PyEval_EvalFrameDefault\n" -" | | | | |\n" -" | | | | |--11.52%--_PyLong_Add\n" -" | | | | | |\n" -" | | | | | |--2.97%--_PyObject_Malloc\n" +" | | | " +"|--51.67%--_PyEval_EvalFrameDefault\n" +" | | | " +"| |\n" +" | | | " +"| |--11.52%--_PyLong_Add\n" +" | | | " +"| | |\n" +" | | | " +"| | |--2.97%--_PyObject_Malloc\n" "..." msgstr "" -msgid "As you can see, the Python functions are not shown in the output, only ``_PyEval_EvalFrameDefault`` (the function that evaluates the Python bytecode) shows up. Unfortunately that's not very useful because all Python functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which bytecode-evaluating function." +#: ../../howto/perf_profiling.rst:100 +msgid "" +"As you can see, the Python functions are not shown in the output, only " +"``_PyEval_EvalFrameDefault`` (the function that evaluates the Python " +"bytecode) shows up. Unfortunately that's not very useful because all Python " +"functions use the same C function to evaluate bytecode so we cannot know " +"which Python function corresponds to which bytecode-evaluating function." msgstr "" -msgid "Instead, if we run the same experiment with ``perf`` support enabled we get:" +#: ../../howto/perf_profiling.rst:105 +msgid "" +"Instead, if we run the same experiment with ``perf`` support enabled we get:" msgstr "" +#: ../../howto/perf_profiling.rst:107 msgid "" "$ perf report --stdio -n -g\n" "\n" "# Children Self Samples Command Shared Object Symbol\n" "# ........ ........ ............ .......... .................. .....................................................................\n" "#\n" -" 90.58% 0.36% 1 python.exe python.exe [.] _start\n" +" 90.58% 0.36% 1 python.exe python.exe [.] " +"_start\n" " |\n" " ---_start\n" " |\n" @@ -138,56 +196,91 @@ msgid "" " | | |\n" " | | |--53.62%--run_mod\n" " | | | |\n" -" | | | --53.26%--PyEval_EvalCode\n" -" | | | py:::/src/script.py\n" -" | | | _PyEval_EvalFrameDefault\n" -" | | | PyObject_Vectorcall\n" -" | | | _PyEval_Vector\n" -" | | | py::baz:/src/script.py\n" -" | | | _PyEval_EvalFrameDefault\n" -" | | | PyObject_Vectorcall\n" -" | | | _PyEval_Vector\n" -" | | | py::bar:/src/script.py\n" -" | | | _PyEval_EvalFrameDefault\n" -" | | | PyObject_Vectorcall\n" -" | | | _PyEval_Vector\n" -" | | | py::foo:/src/script.py\n" +" | | | --53.26%--" +"PyEval_EvalCode\n" +" | | | py::" +":/src/script.py\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | py::baz:/" +"src/script.py\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | py::bar:/" +"src/script.py\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | py::foo:/" +"src/script.py\n" " | | | |\n" -" | | | |--51.81%--_PyEval_EvalFrameDefault\n" -" | | | | |\n" -" | | | | |--13.77%--_PyLong_Add\n" -" | | | | | |\n" -" | | | | | |--3.26%--_PyObject_Malloc" -msgstr "" - +" | | | " +"|--51.81%--_PyEval_EvalFrameDefault\n" +" | | | " +"| |\n" +" | | | " +"| |--13.77%--_PyLong_Add\n" +" | | | " +"| | |\n" +" | | | " +"| | |--3.26%--_PyObject_Malloc" +msgstr "" + +#: ../../howto/perf_profiling.rst:152 msgid "How to enable ``perf`` profiling support" msgstr "" -msgid "``perf`` profiling support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.deactivate_stack_trampoline`." +#: ../../howto/perf_profiling.rst:154 +msgid "" +"``perf`` profiling support can be enabled either from the start using the " +"environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-" +"X>` option, or dynamically using :func:`sys.activate_stack_trampoline` " +"and :func:`sys.deactivate_stack_trampoline`." msgstr "" -msgid "The :mod:`!sys` functions take precedence over the :option:`!-X` option, the :option:`!-X` option takes precedence over the environment variable." +#: ../../howto/perf_profiling.rst:160 +msgid "" +"The :mod:`!sys` functions take precedence over the :option:`!-X` option, " +"the :option:`!-X` option takes precedence over the environment variable." msgstr "" +#: ../../howto/perf_profiling.rst:163 msgid "Example, using the environment variable::" msgstr "" +#: ../../howto/perf_profiling.rst:165 msgid "" -"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python my_script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python " +"my_script.py\n" "$ perf report -g -i perf.data" msgstr "" +#: ../../howto/perf_profiling.rst:168 msgid "Example, using the :option:`!-X` option::" msgstr "" +#: ../../howto/perf_profiling.rst:170 msgid "" "$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" "$ perf report -g -i perf.data" msgstr "" +#: ../../howto/perf_profiling.rst:173 msgid "Example, using the :mod:`sys` APIs in file :file:`example.py`:" msgstr "" +#: ../../howto/perf_profiling.rst:175 msgid "" "import sys\n" "\n" @@ -198,85 +291,169 @@ msgid "" "non_profiled_stuff()" msgstr "" +#: ../../howto/perf_profiling.rst:185 msgid "...then::" msgstr "" +#: ../../howto/perf_profiling.rst:187 msgid "" "$ perf record -F 9999 -g -o perf.data python ./example.py\n" "$ perf report -g -i perf.data" msgstr "" +#: ../../howto/perf_profiling.rst:192 msgid "How to obtain the best results" msgstr "" -msgid "For best results, Python should be compiled with ``CFLAGS=\"-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer\"`` as this allows profilers to unwind using only the frame pointer and not on DWARF debug information. This is because as the code that is interposed to allow ``perf`` support is dynamically generated it doesn't have any DWARF debugging information available." +#: ../../howto/perf_profiling.rst:194 +msgid "" +"For best results, Python should be compiled with ``CFLAGS=\"-fno-omit-frame-" +"pointer -mno-omit-leaf-frame-pointer\"`` as this allows profilers to unwind " +"using only the frame pointer and not on DWARF debug information. This is " +"because as the code that is interposed to allow ``perf`` support is " +"dynamically generated it doesn't have any DWARF debugging information " +"available." msgstr "" -msgid "You can check if your system has been compiled with this flag by running::" +#: ../../howto/perf_profiling.rst:201 +msgid "" +"You can check if your system has been compiled with this flag by running::" msgstr "" +#: ../../howto/perf_profiling.rst:203 msgid "$ python -m sysconfig | grep 'no-omit-frame-pointer'" msgstr "" -msgid "If you don't see any output it means that your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``." +#: ../../howto/perf_profiling.rst:205 +msgid "" +"If you don't see any output it means that your interpreter has not been " +"compiled with frame pointers and therefore it may not be able to show Python " +"functions in the output of ``perf``." msgstr "" +#: ../../howto/perf_profiling.rst:211 msgid "How to work without frame pointers" msgstr "" -msgid "If you are working with a Python interpreter that has been compiled without frame pointers, you can still use the ``perf`` profiler, but the overhead will be a bit higher because Python needs to generate unwinding information for every Python function call on the fly. Additionally, ``perf`` will take more time to process the data because it will need to use the DWARF debugging information to unwind the stack and this is a slow process." +#: ../../howto/perf_profiling.rst:213 +msgid "" +"If you are working with a Python interpreter that has been compiled without " +"frame pointers, you can still use the ``perf`` profiler, but the overhead " +"will be a bit higher because Python needs to generate unwinding information " +"for every Python function call on the fly. Additionally, ``perf`` will take " +"more time to process the data because it will need to use the DWARF " +"debugging information to unwind the stack and this is a slow process." msgstr "" -msgid "To enable this mode, you can use the environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which will enable the JIT mode for the ``perf`` profiler." +#: ../../howto/perf_profiling.rst:220 +msgid "" +"To enable this mode, you can use the environment " +"variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` " +"option, which will enable the JIT mode for the ``perf`` profiler." msgstr "" -msgid "Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool." +#: ../../howto/perf_profiling.rst:226 +msgid "" +"Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 " +"will work with the JIT mode. The fix was also backported to the v6.7.2 " +"version of the tool." msgstr "" -msgid "Note that when checking the version of the ``perf`` tool (which can be done by running ``perf version``) you must take into account that some distros add some custom version numbers including a ``-`` character. This means that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``." +#: ../../howto/perf_profiling.rst:230 +msgid "" +"Note that when checking the version of the ``perf`` tool (which can be done " +"by running ``perf version``) you must take into account that some distros " +"add some custom version numbers including a ``-`` character. This means " +"that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``." msgstr "" -msgid "When using the perf JIT mode, you need an extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT information into the ``perf.data`` file.::" +#: ../../howto/perf_profiling.rst:235 +msgid "" +"When using the perf JIT mode, you need an extra step before you can run " +"``perf report``. You need to call the ``perf inject`` command to inject the " +"JIT information into the ``perf.data`` file.::" msgstr "" +#: ../../howto/perf_profiling.rst:239 msgid "" -"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py\n" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python " +"-Xperf_jit my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" msgstr "" +#: ../../howto/perf_profiling.rst:243 msgid "or using the environment variable::" msgstr "" +#: ../../howto/perf_profiling.rst:245 msgid "" -"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py\n" +"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o " +"perf.data python my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" msgstr "" -msgid "``perf inject --jit`` command will read ``perf.data``, automatically pick up the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and then create ``perf.jit.data`` which merges all the JIT information together. It should also create a lot of ``jitted-XXXX-N.so`` files in the current directory which are ELF images for all the JIT trampolines that were created by Python." +#: ../../howto/perf_profiling.rst:249 +msgid "" +"``perf inject --jit`` command will read ``perf.data``, automatically pick up " +"the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and " +"then create ``perf.jit.data`` which merges all the JIT information together. " +"It should also create a lot of ``jitted-XXXX-N.so`` files in the current " +"directory which are ELF images for all the JIT trampolines that were created " +"by Python." msgstr "" -msgid "When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of the stack of the process being profiled and save the information in the ``perf.data`` file. By default, the size of the stack dump is 8192 bytes, but you can change the size by passing it after a comma like ``--call-graph dwarf,16384``." +#: ../../howto/perf_profiling.rst:257 +msgid "" +"When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of " +"the stack of the process being profiled and save the information in the " +"``perf.data`` file. By default, the size of the stack dump is 8192 bytes, " +"but you can change the size by passing it after a comma like ``--call-graph " +"dwarf,16384``." msgstr "" -msgid "The size of the stack dump is important because if the size is too small ``perf`` will not be able to unwind the stack and the output will be incomplete. On the other hand, if the size is too big, then ``perf`` won't be able to sample the process as frequently as it would like as the overhead will be higher." +#: ../../howto/perf_profiling.rst:263 +msgid "" +"The size of the stack dump is important because if the size is too small " +"``perf`` will not be able to unwind the stack and the output will be " +"incomplete. On the other hand, if the size is too big, then ``perf`` won't " +"be able to sample the process as frequently as it would like as the overhead " +"will be higher." msgstr "" -msgid "The stack size is particularly important when profiling Python code compiled with low optimization levels (like ``-O0``), as these builds tend to have larger stack frames. If you are compiling Python with ``-O0`` and not seeing Python functions in your profiling output, try increasing the stack dump size to 65528 bytes (the maximum)::" +#: ../../howto/perf_profiling.rst:269 +msgid "" +"The stack size is particularly important when profiling Python code compiled " +"with low optimization levels (like ``-O0``), as these builds tend to have " +"larger stack frames. If you are compiling Python with ``-O0`` and not seeing " +"Python functions in your profiling output, try increasing the stack dump " +"size to 65528 bytes (the maximum)::" msgstr "" -msgid "$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py" +#: ../../howto/perf_profiling.rst:275 +msgid "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python " +"-Xperf_jit my_script.py" msgstr "" +#: ../../howto/perf_profiling.rst:277 msgid "Different compilation flags can significantly impact stack sizes:" msgstr "" -msgid "Builds with ``-O0`` typically have much larger stack frames than those with ``-O1`` or higher" +#: ../../howto/perf_profiling.rst:279 +msgid "" +"Builds with ``-O0`` typically have much larger stack frames than those with " +"``-O1`` or higher" msgstr "" -msgid "Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size" +#: ../../howto/perf_profiling.rst:280 +msgid "" +"Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size" msgstr "" -msgid "Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable stack unwinding" +#: ../../howto/perf_profiling.rst:281 +msgid "" +"Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable " +"stack unwinding" msgstr "" diff --git a/howto/pyporting.po b/howto/pyporting.po index 861687c96..da1def7d9 100644 --- a/howto/pyporting.po +++ b/howto/pyporting.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,41 +24,68 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/pyporting.rst:7 msgid "How to port Python 2 Code to Python 3" msgstr "" +#: ../../howto/pyporting.rst:0 msgid "author" msgstr "" +#: ../../howto/pyporting.rst:9 msgid "Brett Cannon" msgstr "" -msgid "Python 2 reached its official end-of-life at the start of 2020. This means that no new bug reports, fixes, or changes will be made to Python 2 - it's no longer supported: see :pep:`373` and `status of Python versions `_." +#: ../../howto/pyporting.rst:11 +msgid "" +"Python 2 reached its official end-of-life at the start of 2020. This means " +"that no new bug reports, fixes, or changes will be made to Python 2 - it's " +"no longer supported: see :pep:`373` and `status of Python versions `_." msgstr "" -msgid "If you are looking to port an extension module instead of pure Python code, please see :ref:`cporting-howto`." +#: ../../howto/pyporting.rst:16 +msgid "" +"If you are looking to port an extension module instead of pure Python code, " +"please see :ref:`cporting-howto`." msgstr "" -msgid "The archived python-porting_ mailing list may contain some useful guidance." +#: ../../howto/pyporting.rst:19 +msgid "" +"The archived python-porting_ mailing list may contain some useful guidance." msgstr "" -msgid "Since Python 3.11 the original porting guide was discontinued. You can find the old guide in the `archive `_." +#: ../../howto/pyporting.rst:21 +msgid "" +"Since Python 3.11 the original porting guide was discontinued. You can find " +"the old guide in the `archive `_." msgstr "" +#: ../../howto/pyporting.rst:27 msgid "Third-party guides" msgstr "" +#: ../../howto/pyporting.rst:29 msgid "There are also multiple third-party guides that might be useful:" msgstr "" +#: ../../howto/pyporting.rst:31 msgid "`Guide by Fedora `_" msgstr "" +#: ../../howto/pyporting.rst:32 msgid "`PyCon 2020 tutorial `_" msgstr "" -msgid "`Guide by DigitalOcean `_" +#: ../../howto/pyporting.rst:33 +msgid "" +"`Guide by DigitalOcean `_" msgstr "" -msgid "`Guide by ActiveState `_" +#: ../../howto/pyporting.rst:34 +msgid "" +"`Guide by ActiveState `_" msgstr "" diff --git a/howto/regex.po b/howto/regex.po index 1e43e9153..8d26abfa6 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,237 +24,479 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/regex.rst:5 msgid "Regular expression HOWTO" msgstr "" +#: ../../howto/regex.rst:0 msgid "Author" msgstr "" +#: ../../howto/regex.rst:7 msgid "A.M. Kuchling " msgstr "" +#: ../../howto/regex.rst:-1 msgid "Abstract" msgstr "" -msgid "This document is an introductory tutorial to using regular expressions in Python with the :mod:`re` module. It provides a gentler introduction than the corresponding section in the Library Reference." +#: ../../howto/regex.rst:18 +msgid "" +"This document is an introductory tutorial to using regular expressions in " +"Python with the :mod:`re` module. It provides a gentler introduction than " +"the corresponding section in the Library Reference." msgstr "" +#: ../../howto/regex.rst:24 msgid "Introduction" msgstr "" -msgid "Regular expressions (called REs, or regexes, or regex patterns) are essentially a tiny, highly specialized programming language embedded inside Python and made available through the :mod:`re` module. Using this little language, you specify the rules for the set of possible strings that you want to match; this set might contain English sentences, or e-mail addresses, or TeX commands, or anything you like. You can then ask questions such as \"Does this string match the pattern?\", or \"Is there a match for the pattern anywhere in this string?\". You can also use REs to modify a string or to split it apart in various ways." -msgstr "" - -msgid "Regular expression patterns are compiled into a series of bytecodes which are then executed by a matching engine written in C. For advanced use, it may be necessary to pay careful attention to how the engine will execute a given RE, and write the RE in a certain way in order to produce bytecode that runs faster. Optimization isn't covered in this document, because it requires that you have a good understanding of the matching engine's internals." +#: ../../howto/regex.rst:26 +msgid "" +"Regular expressions (called REs, or regexes, or regex patterns) are " +"essentially a tiny, highly specialized programming language embedded inside " +"Python and made available through the :mod:`re` module. Using this little " +"language, you specify the rules for the set of possible strings that you " +"want to match; this set might contain English sentences, or e-mail " +"addresses, or TeX commands, or anything you like. You can then ask " +"questions such as \"Does this string match the pattern?\", or \"Is there a " +"match for the pattern anywhere in this string?\". You can also use REs to " +"modify a string or to split it apart in various ways." +msgstr "" + +#: ../../howto/regex.rst:35 +msgid "" +"Regular expression patterns are compiled into a series of bytecodes which " +"are then executed by a matching engine written in C. For advanced use, it " +"may be necessary to pay careful attention to how the engine will execute a " +"given RE, and write the RE in a certain way in order to produce bytecode " +"that runs faster. Optimization isn't covered in this document, because it " +"requires that you have a good understanding of the matching engine's " +"internals." msgstr "" -msgid "The regular expression language is relatively small and restricted, so not all possible string processing tasks can be done using regular expressions. There are also tasks that *can* be done with regular expressions, but the expressions turn out to be very complicated. In these cases, you may be better off writing Python code to do the processing; while Python code will be slower than an elaborate regular expression, it will also probably be more understandable." +#: ../../howto/regex.rst:42 +msgid "" +"The regular expression language is relatively small and restricted, so not " +"all possible string processing tasks can be done using regular expressions. " +"There are also tasks that *can* be done with regular expressions, but the " +"expressions turn out to be very complicated. In these cases, you may be " +"better off writing Python code to do the processing; while Python code will " +"be slower than an elaborate regular expression, it will also probably be " +"more understandable." msgstr "" +#: ../../howto/regex.rst:51 msgid "Simple patterns" msgstr "" -msgid "We'll start by learning about the simplest possible regular expressions. Since regular expressions are used to operate on strings, we'll begin with the most common task: matching characters." +#: ../../howto/regex.rst:53 +msgid "" +"We'll start by learning about the simplest possible regular expressions. " +"Since regular expressions are used to operate on strings, we'll begin with " +"the most common task: matching characters." msgstr "" -msgid "For a detailed explanation of the computer science underlying regular expressions (deterministic and non-deterministic finite automata), you can refer to almost any textbook on writing compilers." +#: ../../howto/regex.rst:57 +msgid "" +"For a detailed explanation of the computer science underlying regular " +"expressions (deterministic and non-deterministic finite automata), you can " +"refer to almost any textbook on writing compilers." msgstr "" +#: ../../howto/regex.rst:63 msgid "Matching characters" msgstr "" -msgid "Most letters and characters will simply match themselves. For example, the regular expression ``test`` will match the string ``test`` exactly. (You can enable a case-insensitive mode that would let this RE match ``Test`` or ``TEST`` as well; more about this later.)" +#: ../../howto/regex.rst:65 +msgid "" +"Most letters and characters will simply match themselves. For example, the " +"regular expression ``test`` will match the string ``test`` exactly. (You " +"can enable a case-insensitive mode that would let this RE match ``Test`` or " +"``TEST`` as well; more about this later.)" msgstr "" -msgid "There are exceptions to this rule; some characters are special :dfn:`metacharacters`, and don't match themselves. Instead, they signal that some out-of-the-ordinary thing should be matched, or they affect other portions of the RE by repeating them or changing their meaning. Much of this document is devoted to discussing various metacharacters and what they do." +#: ../../howto/regex.rst:70 +msgid "" +"There are exceptions to this rule; some characters are " +"special :dfn:`metacharacters`, and don't match themselves. Instead, they " +"signal that some out-of-the-ordinary thing should be matched, or they affect " +"other portions of the RE by repeating them or changing their meaning. Much " +"of this document is devoted to discussing various metacharacters and what " +"they do." msgstr "" -msgid "Here's a complete list of the metacharacters; their meanings will be discussed in the rest of this HOWTO." +#: ../../howto/regex.rst:76 +msgid "" +"Here's a complete list of the metacharacters; their meanings will be " +"discussed in the rest of this HOWTO." msgstr "" +#: ../../howto/regex.rst:79 msgid ". ^ $ * + ? { } [ ] \\ | ( )" msgstr "" -msgid "The first metacharacters we'll look at are ``[`` and ``]``. They're used for specifying a character class, which is a set of characters that you wish to match. Characters can be listed individually, or a range of characters can be indicated by giving two characters and separating them by a ``'-'``. For example, ``[abc]`` will match any of the characters ``a``, ``b``, or ``c``; this is the same as ``[a-c]``, which uses a range to express the same set of characters. If you wanted to match only lowercase letters, your RE would be ``[a-z]``." +#: ../../howto/regex.rst:83 +msgid "" +"The first metacharacters we'll look at are ``[`` and ``]``. They're used for " +"specifying a character class, which is a set of characters that you wish to " +"match. Characters can be listed individually, or a range of characters can " +"be indicated by giving two characters and separating them by a ``'-'``. For " +"example, ``[abc]`` will match any of the characters ``a``, ``b``, or ``c``; " +"this is the same as ``[a-c]``, which uses a range to express the same set of " +"characters. If you wanted to match only lowercase letters, your RE would be " +"``[a-z]``." msgstr "" -msgid "Metacharacters (except ``\\``) are not active inside classes. For example, ``[akm$]`` will match any of the characters ``'a'``, ``'k'``, ``'m'``, or ``'$'``; ``'$'`` is usually a metacharacter, but inside a character class it's stripped of its special nature." +#: ../../howto/regex.rst:92 +msgid "" +"Metacharacters (except ``\\``) are not active inside classes. For example, " +"``[akm$]`` will match any of the characters ``'a'``, ``'k'``, ``'m'``, or " +"``'$'``; ``'$'`` is usually a metacharacter, but inside a character class " +"it's stripped of its special nature." msgstr "" -msgid "You can match the characters not listed within the class by :dfn:`complementing` the set. This is indicated by including a ``'^'`` as the first character of the class. For example, ``[^5]`` will match any character except ``'5'``. If the caret appears elsewhere in a character class, it does not have special meaning. For example: ``[5^]`` will match either a ``'5'`` or a ``'^'``." +#: ../../howto/regex.rst:97 +msgid "" +"You can match the characters not listed within the class " +"by :dfn:`complementing` the set. This is indicated by including a ``'^'`` " +"as the first character of the class. For example, ``[^5]`` will match any " +"character except ``'5'``. If the caret appears elsewhere in a character " +"class, it does not have special meaning. For example: ``[5^]`` will match " +"either a ``'5'`` or a ``'^'``." msgstr "" -msgid "Perhaps the most important metacharacter is the backslash, ``\\``. As in Python string literals, the backslash can be followed by various characters to signal various special sequences. It's also used to escape all the metacharacters so you can still match them in patterns; for example, if you need to match a ``[`` or ``\\``, you can precede them with a backslash to remove their special meaning: ``\\[`` or ``\\\\``." +#: ../../howto/regex.rst:103 +msgid "" +"Perhaps the most important metacharacter is the backslash, ``\\``. As in " +"Python string literals, the backslash can be followed by various characters " +"to signal various special sequences. It's also used to escape all the " +"metacharacters so you can still match them in patterns; for example, if you " +"need to match a ``[`` or ``\\``, you can precede them with a backslash to " +"remove their special meaning: ``\\[`` or ``\\\\``." msgstr "" -msgid "Some of the special sequences beginning with ``'\\'`` represent predefined sets of characters that are often useful, such as the set of digits, the set of letters, or the set of anything that isn't whitespace." +#: ../../howto/regex.rst:110 +msgid "" +"Some of the special sequences beginning with ``'\\'`` represent predefined " +"sets of characters that are often useful, such as the set of digits, the set " +"of letters, or the set of anything that isn't whitespace." msgstr "" -msgid "Let's take an example: ``\\w`` matches any alphanumeric character. If the regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the characters marked as letters in the Unicode database provided by the :mod:`unicodedata` module. You can use the more restricted definition of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when compiling the regular expression." +#: ../../howto/regex.rst:115 +msgid "" +"Let's take an example: ``\\w`` matches any alphanumeric character. If the " +"regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-" +"Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the " +"characters marked as letters in the Unicode database provided by " +"the :mod:`unicodedata` module. You can use the more restricted definition " +"of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when " +"compiling the regular expression." msgstr "" -msgid "The following list of special sequences isn't complete. For a complete list of sequences and expanded class definitions for Unicode string patterns, see the last part of :ref:`Regular Expression Syntax ` in the Standard Library reference. In general, the Unicode versions match any character that's in the appropriate category in the Unicode database." +#: ../../howto/regex.rst:123 +msgid "" +"The following list of special sequences isn't complete. For a complete list " +"of sequences and expanded class definitions for Unicode string patterns, see " +"the last part of :ref:`Regular Expression Syntax ` in the " +"Standard Library reference. In general, the Unicode versions match any " +"character that's in the appropriate category in the Unicode database." msgstr "" +#: ../../howto/regex.rst:130 msgid "``\\d``" msgstr "" +#: ../../howto/regex.rst:131 msgid "Matches any decimal digit; this is equivalent to the class ``[0-9]``." msgstr "" +#: ../../howto/regex.rst:133 msgid "``\\D``" msgstr "" -msgid "Matches any non-digit character; this is equivalent to the class ``[^0-9]``." +#: ../../howto/regex.rst:134 +msgid "" +"Matches any non-digit character; this is equivalent to the class ``[^0-9]``." msgstr "" +#: ../../howto/regex.rst:136 msgid "``\\s``" msgstr "" -msgid "Matches any whitespace character; this is equivalent to the class ``[ \\t\\n\\r\\f\\v]``." +#: ../../howto/regex.rst:137 +msgid "" +"Matches any whitespace character; this is equivalent to the class " +"``[ \\t\\n\\r\\f\\v]``." msgstr "" +#: ../../howto/regex.rst:140 msgid "``\\S``" msgstr "" -msgid "Matches any non-whitespace character; this is equivalent to the class ``[^ \\t\\n\\r\\f\\v]``." +#: ../../howto/regex.rst:141 +msgid "" +"Matches any non-whitespace character; this is equivalent to the class ``[^ " +"\\t\\n\\r\\f\\v]``." msgstr "" +#: ../../howto/regex.rst:144 msgid "``\\w``" msgstr "" -msgid "Matches any alphanumeric character; this is equivalent to the class ``[a-zA-Z0-9_]``." +#: ../../howto/regex.rst:145 +msgid "" +"Matches any alphanumeric character; this is equivalent to the class ``[a-zA-" +"Z0-9_]``." msgstr "" +#: ../../howto/regex.rst:148 msgid "``\\W``" msgstr "" -msgid "Matches any non-alphanumeric character; this is equivalent to the class ``[^a-zA-Z0-9_]``." +#: ../../howto/regex.rst:149 +msgid "" +"Matches any non-alphanumeric character; this is equivalent to the class " +"``[^a-zA-Z0-9_]``." msgstr "" -msgid "These sequences can be included inside a character class. For example, ``[\\s,.]`` is a character class that will match any whitespace character, or ``','`` or ``'.'``." +#: ../../howto/regex.rst:152 +msgid "" +"These sequences can be included inside a character class. For example, " +"``[\\s,.]`` is a character class that will match any whitespace character, " +"or ``','`` or ``'.'``." msgstr "" -msgid "The final metacharacter in this section is ``.``. It matches anything except a newline character, and there's an alternate mode (:const:`re.DOTALL`) where it will match even a newline. ``.`` is often used where you want to match \"any character\"." +#: ../../howto/regex.rst:156 +msgid "" +"The final metacharacter in this section is ``.``. It matches anything " +"except a newline character, and there's an alternate mode " +"(:const:`re.DOTALL`) where it will match even a newline. ``.`` is often " +"used where you want to match \"any character\"." msgstr "" +#: ../../howto/regex.rst:163 msgid "Repeating things" msgstr "" -msgid "Being able to match varying sets of characters is the first thing regular expressions can do that isn't already possible with the methods available on strings. However, if that was the only additional capability of regexes, they wouldn't be much of an advance. Another capability is that you can specify that portions of the RE must be repeated a certain number of times." +#: ../../howto/regex.rst:165 +msgid "" +"Being able to match varying sets of characters is the first thing regular " +"expressions can do that isn't already possible with the methods available on " +"strings. However, if that was the only additional capability of regexes, " +"they wouldn't be much of an advance. Another capability is that you can " +"specify that portions of the RE must be repeated a certain number of times." msgstr "" -msgid "The first metacharacter for repeating things that we'll look at is ``*``. ``*`` doesn't match the literal character ``'*'``; instead, it specifies that the previous character can be matched zero or more times, instead of exactly once." +#: ../../howto/regex.rst:171 +msgid "" +"The first metacharacter for repeating things that we'll look at is ``*``. " +"``*`` doesn't match the literal character ``'*'``; instead, it specifies " +"that the previous character can be matched zero or more times, instead of " +"exactly once." msgstr "" -msgid "For example, ``ca*t`` will match ``'ct'`` (0 ``'a'`` characters), ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 ``'a'`` characters), and so forth." +#: ../../howto/regex.rst:175 +msgid "" +"For example, ``ca*t`` will match ``'ct'`` (0 ``'a'`` characters), ``'cat'`` " +"(1 ``'a'``), ``'caaat'`` (3 ``'a'`` characters), and so forth." msgstr "" -msgid "Repetitions such as ``*`` are :dfn:`greedy`; when repeating a RE, the matching engine will try to repeat it as many times as possible. If later portions of the pattern don't match, the matching engine will then back up and try again with fewer repetitions." +#: ../../howto/regex.rst:178 +msgid "" +"Repetitions such as ``*`` are :dfn:`greedy`; when repeating a RE, the " +"matching engine will try to repeat it as many times as possible. If later " +"portions of the pattern don't match, the matching engine will then back up " +"and try again with fewer repetitions." msgstr "" -msgid "A step-by-step example will make this more obvious. Let's consider the expression ``a[bcd]*b``. This matches the letter ``'a'``, zero or more letters from the class ``[bcd]``, and finally ends with a ``'b'``. Now imagine matching this RE against the string ``'abcbd'``." +#: ../../howto/regex.rst:183 +msgid "" +"A step-by-step example will make this more obvious. Let's consider the " +"expression ``a[bcd]*b``. This matches the letter ``'a'``, zero or more " +"letters from the class ``[bcd]``, and finally ends with a ``'b'``. Now " +"imagine matching this RE against the string ``'abcbd'``." msgstr "" +#: ../../howto/regex.rst:189 msgid "Step" msgstr "" +#: ../../howto/regex.rst:189 msgid "Matched" msgstr "" +#: ../../howto/regex.rst:189 msgid "Explanation" msgstr "" +#: ../../howto/regex.rst:191 msgid "1" msgstr "" +#: ../../howto/regex.rst:191 msgid "``a``" msgstr "" +#: ../../howto/regex.rst:191 msgid "The ``a`` in the RE matches." msgstr "" +#: ../../howto/regex.rst:193 msgid "2" msgstr "" +#: ../../howto/regex.rst:193 msgid "``abcbd``" msgstr "" -msgid "The engine matches ``[bcd]*``, going as far as it can, which is to the end of the string." +#: ../../howto/regex.rst:193 +msgid "" +"The engine matches ``[bcd]*``, going as far as it can, which is to the end " +"of the string." msgstr "" +#: ../../howto/regex.rst:197 msgid "3" msgstr "" +#: ../../howto/regex.rst:197 ../../howto/regex.rst:205 msgid "*Failure*" msgstr "" -msgid "The engine tries to match ``b``, but the current position is at the end of the string, so it fails." +#: ../../howto/regex.rst:197 +msgid "" +"The engine tries to match ``b``, but the current position is at the end of " +"the string, so it fails." msgstr "" +#: ../../howto/regex.rst:202 msgid "4" msgstr "" +#: ../../howto/regex.rst:202 ../../howto/regex.rst:213 msgid "``abcb``" msgstr "" +#: ../../howto/regex.rst:202 msgid "Back up, so that ``[bcd]*`` matches one less character." msgstr "" +#: ../../howto/regex.rst:205 msgid "5" msgstr "" -msgid "Try ``b`` again, but the current position is at the last character, which is a ``'d'``." +#: ../../howto/regex.rst:205 +msgid "" +"Try ``b`` again, but the current position is at the last character, which is " +"a ``'d'``." msgstr "" +#: ../../howto/regex.rst:209 msgid "6" msgstr "" +#: ../../howto/regex.rst:209 msgid "``abc``" msgstr "" +#: ../../howto/regex.rst:209 msgid "Back up again, so that ``[bcd]*`` is only matching ``bc``." msgstr "" +#: ../../howto/regex.rst:213 msgid "7" msgstr "" -msgid "Try ``b`` again. This time the character at the current position is ``'b'``, so it succeeds." +#: ../../howto/regex.rst:213 +msgid "" +"Try ``b`` again. This time the character at the current position is " +"``'b'``, so it succeeds." msgstr "" -msgid "The end of the RE has now been reached, and it has matched ``'abcb'``. This demonstrates how the matching engine goes as far as it can at first, and if no match is found it will then progressively back up and retry the rest of the RE again and again. It will back up until it has tried zero matches for ``[bcd]*``, and if that subsequently fails, the engine will conclude that the string doesn't match the RE at all." +#: ../../howto/regex.rst:219 +msgid "" +"The end of the RE has now been reached, and it has matched ``'abcb'``. This " +"demonstrates how the matching engine goes as far as it can at first, and if " +"no match is found it will then progressively back up and retry the rest of " +"the RE again and again. It will back up until it has tried zero matches for " +"``[bcd]*``, and if that subsequently fails, the engine will conclude that " +"the string doesn't match the RE at all." msgstr "" -msgid "Another repeating metacharacter is ``+``, which matches one or more times. Pay careful attention to the difference between ``*`` and ``+``; ``*`` matches *zero* or more times, so whatever's being repeated may not be present at all, while ``+`` requires at least *one* occurrence. To use a similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 ``'a'``\\ s), but won't match ``'ct'``." +#: ../../howto/regex.rst:226 +msgid "" +"Another repeating metacharacter is ``+``, which matches one or more times. " +"Pay careful attention to the difference between ``*`` and ``+``; ``*`` " +"matches *zero* or more times, so whatever's being repeated may not be " +"present at all, while ``+`` requires at least *one* occurrence. To use a " +"similar example, ``ca+t`` will match ``'cat'`` (1 ``'a'``), ``'caaat'`` (3 " +"``'a'``\\ s), but won't match ``'ct'``." msgstr "" -msgid "There are two more repeating operators or quantifiers. The question mark character, ``?``, matches either once or zero times; you can think of it as marking something as being optional. For example, ``home-?brew`` matches either ``'homebrew'`` or ``'home-brew'``." +#: ../../howto/regex.rst:233 +msgid "" +"There are two more repeating operators or quantifiers. The question mark " +"character, ``?``, matches either once or zero times; you can think of it as " +"marking something as being optional. For example, ``home-?brew`` matches " +"either ``'homebrew'`` or ``'home-brew'``." msgstr "" -msgid "The most complicated quantifier is ``{m,n}``, where *m* and *n* are decimal integers. This quantifier means there must be at least *m* repetitions, and at most *n*. For example, ``a/{1,3}b`` will match ``'a/b'``, ``'a//b'``, and ``'a///b'``. It won't match ``'ab'``, which has no slashes, or ``'a////b'``, which has four." +#: ../../howto/regex.rst:238 +msgid "" +"The most complicated quantifier is ``{m,n}``, where *m* and *n* are decimal " +"integers. This quantifier means there must be at least *m* repetitions, and " +"at most *n*. For example, ``a/{1,3}b`` will match ``'a/b'``, ``'a//b'``, " +"and ``'a///b'``. It won't match ``'ab'``, which has no slashes, or ``'a////" +"b'``, which has four." msgstr "" -msgid "You can omit either *m* or *n*; in that case, a reasonable value is assumed for the missing value. Omitting *m* is interpreted as a lower limit of 0, while omitting *n* results in an upper bound of infinity." +#: ../../howto/regex.rst:244 +msgid "" +"You can omit either *m* or *n*; in that case, a reasonable value is assumed " +"for the missing value. Omitting *m* is interpreted as a lower limit of 0, " +"while omitting *n* results in an upper bound of infinity." msgstr "" -msgid "The simplest case ``{m}`` matches the preceding item exactly *m* times. For example, ``a/{2}b`` will only match ``'a//b'``." +#: ../../howto/regex.rst:248 +msgid "" +"The simplest case ``{m}`` matches the preceding item exactly *m* times. For " +"example, ``a/{2}b`` will only match ``'a//b'``." msgstr "" -msgid "Readers of a reductionist bent may notice that the three other quantifiers can all be expressed using this notation. ``{0,}`` is the same as ``*``, ``{1,}`` is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's better to use ``*``, ``+``, or ``?`` when you can, simply because they're shorter and easier to read." +#: ../../howto/regex.rst:251 +msgid "" +"Readers of a reductionist bent may notice that the three other quantifiers " +"can all be expressed using this notation. ``{0,}`` is the same as ``*``, " +"``{1,}`` is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's " +"better to use ``*``, ``+``, or ``?`` when you can, simply because they're " +"shorter and easier to read." msgstr "" +#: ../../howto/regex.rst:259 msgid "Using regular expressions" msgstr "" -msgid "Now that we've looked at some simple regular expressions, how do we actually use them in Python? The :mod:`re` module provides an interface to the regular expression engine, allowing you to compile REs into objects and then perform matches with them." +#: ../../howto/regex.rst:261 +msgid "" +"Now that we've looked at some simple regular expressions, how do we actually " +"use them in Python? The :mod:`re` module provides an interface to the " +"regular expression engine, allowing you to compile REs into objects and then " +"perform matches with them." msgstr "" +#: ../../howto/regex.rst:268 msgid "Compiling regular expressions" msgstr "" -msgid "Regular expressions are compiled into pattern objects, which have methods for various operations such as searching for pattern matches or performing string substitutions. ::" +#: ../../howto/regex.rst:270 +msgid "" +"Regular expressions are compiled into pattern objects, which have methods " +"for various operations such as searching for pattern matches or performing " +"string substitutions. ::" msgstr "" +#: ../../howto/regex.rst:274 msgid "" ">>> import re\n" ">>> p = re.compile('ab*')\n" @@ -262,126 +504,223 @@ msgid "" "re.compile('ab*')" msgstr "" -msgid ":func:`re.compile` also accepts an optional *flags* argument, used to enable various special features and syntax variations. We'll go over the available settings later, but for now a single example will do::" +#: ../../howto/regex.rst:279 +msgid "" +":func:`re.compile` also accepts an optional *flags* argument, used to enable " +"various special features and syntax variations. We'll go over the available " +"settings later, but for now a single example will do::" msgstr "" +#: ../../howto/regex.rst:283 msgid ">>> p = re.compile('ab*', re.IGNORECASE)" msgstr "" -msgid "The RE is passed to :func:`re.compile` as a string. REs are handled as strings because regular expressions aren't part of the core Python language, and no special syntax was created for expressing them. (There are applications that don't need REs at all, so there's no need to bloat the language specification by including them.) Instead, the :mod:`re` module is simply a C extension module included with Python, just like the :mod:`socket` or :mod:`zlib` modules." +#: ../../howto/regex.rst:285 +msgid "" +"The RE is passed to :func:`re.compile` as a string. REs are handled as " +"strings because regular expressions aren't part of the core Python language, " +"and no special syntax was created for expressing them. (There are " +"applications that don't need REs at all, so there's no need to bloat the " +"language specification by including them.) Instead, the :mod:`re` module is " +"simply a C extension module included with Python, just like " +"the :mod:`socket` or :mod:`zlib` modules." msgstr "" -msgid "Putting REs in strings keeps the Python language simpler, but has one disadvantage which is the topic of the next section." +#: ../../howto/regex.rst:292 +msgid "" +"Putting REs in strings keeps the Python language simpler, but has one " +"disadvantage which is the topic of the next section." msgstr "" +#: ../../howto/regex.rst:299 msgid "The backslash plague" msgstr "" -msgid "As stated earlier, regular expressions use the backslash character (``'\\'``) to indicate special forms or to allow special characters to be used without invoking their special meaning. This conflicts with Python's usage of the same character for the same purpose in string literals." +#: ../../howto/regex.rst:301 +msgid "" +"As stated earlier, regular expressions use the backslash character " +"(``'\\'``) to indicate special forms or to allow special characters to be " +"used without invoking their special meaning. This conflicts with Python's " +"usage of the same character for the same purpose in string literals." msgstr "" -msgid "Let's say you want to write a RE that matches the string ``\\section``, which might be found in a LaTeX file. To figure out what to write in the program code, start with the desired string to be matched. Next, you must escape any backslashes and other metacharacters by preceding them with a backslash, resulting in the string ``\\\\section``. The resulting string that must be passed to :func:`re.compile` must be ``\\\\section``. However, to express this as a Python string literal, both backslashes must be escaped *again*." +#: ../../howto/regex.rst:306 +msgid "" +"Let's say you want to write a RE that matches the string ``\\section``, " +"which might be found in a LaTeX file. To figure out what to write in the " +"program code, start with the desired string to be matched. Next, you must " +"escape any backslashes and other metacharacters by preceding them with a " +"backslash, resulting in the string ``\\\\section``. The resulting string " +"that must be passed to :func:`re.compile` must be ``\\\\section``. However, " +"to express this as a Python string literal, both backslashes must be escaped " +"*again*." msgstr "" +#: ../../howto/regex.rst:315 msgid "Characters" msgstr "" +#: ../../howto/regex.rst:315 msgid "Stage" msgstr "" +#: ../../howto/regex.rst:317 msgid "``\\section``" msgstr "" +#: ../../howto/regex.rst:317 msgid "Text string to be matched" msgstr "" +#: ../../howto/regex.rst:319 msgid "``\\\\section``" msgstr "" +#: ../../howto/regex.rst:319 msgid "Escaped backslash for :func:`re.compile`" msgstr "" +#: ../../howto/regex.rst:321 ../../howto/regex.rst:348 msgid "``\"\\\\\\\\section\"``" msgstr "" +#: ../../howto/regex.rst:321 msgid "Escaped backslashes for a string literal" msgstr "" -msgid "In short, to match a literal backslash, one has to write ``'\\\\\\\\'`` as the RE string, because the regular expression must be ``\\\\``, and each backslash must be expressed as ``\\\\`` inside a regular Python string literal. In REs that feature backslashes repeatedly, this leads to lots of repeated backslashes and makes the resulting strings difficult to understand." +#: ../../howto/regex.rst:324 +msgid "" +"In short, to match a literal backslash, one has to write ``'\\\\\\\\'`` as " +"the RE string, because the regular expression must be ``\\\\``, and each " +"backslash must be expressed as ``\\\\`` inside a regular Python string " +"literal. In REs that feature backslashes repeatedly, this leads to lots of " +"repeated backslashes and makes the resulting strings difficult to understand." msgstr "" -msgid "The solution is to use Python's raw string notation for regular expressions; backslashes are not handled in any special way in a string literal prefixed with ``'r'``, so ``r\"\\n\"`` is a two-character string containing ``'\\'`` and ``'n'``, while ``\"\\n\"`` is a one-character string containing a newline. Regular expressions will often be written in Python code using this raw string notation." +#: ../../howto/regex.rst:330 +msgid "" +"The solution is to use Python's raw string notation for regular expressions; " +"backslashes are not handled in any special way in a string literal prefixed " +"with ``'r'``, so ``r\"\\n\"`` is a two-character string containing ``'\\'`` " +"and ``'n'``, while ``\"\\n\"`` is a one-character string containing a " +"newline. Regular expressions will often be written in Python code using this " +"raw string notation." msgstr "" -msgid "In addition, special escape sequences that are valid in regular expressions, but not valid as Python string literals, now result in a :exc:`SyntaxWarning` and will eventually become a :exc:`SyntaxError`, which means the sequences will be invalid if raw string notation or escaping the backslashes isn't used." +#: ../../howto/regex.rst:336 +msgid "" +"In addition, special escape sequences that are valid in regular expressions, " +"but not valid as Python string literals, now result in " +"a :exc:`SyntaxWarning` and will eventually become a :exc:`SyntaxError`, " +"which means the sequences will be invalid if raw string notation or escaping " +"the backslashes isn't used." msgstr "" +#: ../../howto/regex.rst:344 msgid "Regular String" msgstr "" +#: ../../howto/regex.rst:344 msgid "Raw string" msgstr "" +#: ../../howto/regex.rst:346 msgid "``\"ab*\"``" msgstr "" +#: ../../howto/regex.rst:346 msgid "``r\"ab*\"``" msgstr "" +#: ../../howto/regex.rst:348 msgid "``r\"\\\\section\"``" msgstr "" +#: ../../howto/regex.rst:350 msgid "``\"\\\\w+\\\\s+\\\\1\"``" msgstr "" +#: ../../howto/regex.rst:350 msgid "``r\"\\w+\\s+\\1\"``" msgstr "" +#: ../../howto/regex.rst:355 msgid "Performing matches" msgstr "" -msgid "Once you have an object representing a compiled regular expression, what do you do with it? Pattern objects have several methods and attributes. Only the most significant ones will be covered here; consult the :mod:`re` docs for a complete listing." +#: ../../howto/regex.rst:357 +msgid "" +"Once you have an object representing a compiled regular expression, what do " +"you do with it? Pattern objects have several methods and attributes. Only " +"the most significant ones will be covered here; consult the :mod:`re` docs " +"for a complete listing." msgstr "" +#: ../../howto/regex.rst:363 ../../howto/regex.rst:417 +#: ../../howto/regex.rst:1072 msgid "Method/Attribute" msgstr "" +#: ../../howto/regex.rst:363 ../../howto/regex.rst:417 +#: ../../howto/regex.rst:1072 msgid "Purpose" msgstr "" +#: ../../howto/regex.rst:365 msgid "``match()``" msgstr "" +#: ../../howto/regex.rst:365 msgid "Determine if the RE matches at the beginning of the string." msgstr "" +#: ../../howto/regex.rst:368 msgid "``search()``" msgstr "" +#: ../../howto/regex.rst:368 msgid "Scan through a string, looking for any location where this RE matches." msgstr "" +#: ../../howto/regex.rst:371 msgid "``findall()``" msgstr "" +#: ../../howto/regex.rst:371 msgid "Find all substrings where the RE matches, and return them as a list." msgstr "" +#: ../../howto/regex.rst:374 msgid "``finditer()``" msgstr "" -msgid "Find all substrings where the RE matches, and return them as an :term:`iterator`." +#: ../../howto/regex.rst:374 +msgid "" +"Find all substrings where the RE matches, and return them as " +"an :term:`iterator`." msgstr "" -msgid ":meth:`~re.Pattern.match` and :meth:`~re.Pattern.search` return ``None`` if no match can be found. If they're successful, a :ref:`match object ` instance is returned, containing information about the match: where it starts and ends, the substring it matched, and more." +#: ../../howto/regex.rst:378 +msgid "" +":meth:`~re.Pattern.match` and :meth:`~re.Pattern.search` return ``None`` if " +"no match can be found. If they're successful, a :ref:`match object ` instance is returned, containing information about the match: " +"where it starts and ends, the substring it matched, and more." msgstr "" -msgid "You can learn about this by interactively experimenting with the :mod:`re` module." +#: ../../howto/regex.rst:383 +msgid "" +"You can learn about this by interactively experimenting with the :mod:`re` " +"module." msgstr "" -msgid "This HOWTO uses the standard Python interpreter for its examples. First, run the Python interpreter, import the :mod:`re` module, and compile a RE::" +#: ../../howto/regex.rst:386 +msgid "" +"This HOWTO uses the standard Python interpreter for its examples. First, run " +"the Python interpreter, import the :mod:`re` module, and compile a RE::" msgstr "" +#: ../../howto/regex.rst:389 msgid "" ">>> import re\n" ">>> p = re.compile('[a-z]+')\n" @@ -389,54 +728,80 @@ msgid "" "re.compile('[a-z]+')" msgstr "" -msgid "Now, you can try matching various strings against the RE ``[a-z]+``. An empty string shouldn't match at all, since ``+`` means 'one or more repetitions'. :meth:`~re.Pattern.match` should return ``None`` in this case, which will cause the interpreter to print no output. You can explicitly print the result of :meth:`!match` to make this clear. ::" +#: ../../howto/regex.rst:394 +msgid "" +"Now, you can try matching various strings against the RE ``[a-z]+``. An " +"empty string shouldn't match at all, since ``+`` means 'one or more " +"repetitions'. :meth:`~re.Pattern.match` should return ``None`` in this case, " +"which will cause the interpreter to print no output. You can explicitly " +"print the result of :meth:`!match` to make this clear. ::" msgstr "" +#: ../../howto/regex.rst:400 msgid "" ">>> p.match(\"\")\n" ">>> print(p.match(\"\"))\n" "None" msgstr "" -msgid "Now, let's try it on a string that it should match, such as ``tempo``. In this case, :meth:`~re.Pattern.match` will return a :ref:`match object `, so you should store the result in a variable for later use. ::" +#: ../../howto/regex.rst:404 +msgid "" +"Now, let's try it on a string that it should match, such as ``tempo``. In " +"this case, :meth:`~re.Pattern.match` will return a :ref:`match object `, so you should store the result in a variable for later use. ::" msgstr "" +#: ../../howto/regex.rst:408 msgid "" ">>> m = p.match('tempo')\n" ">>> m\n" "" msgstr "" -msgid "Now you can query the :ref:`match object ` for information about the matching string. Match object instances also have several methods and attributes; the most important ones are:" +#: ../../howto/regex.rst:412 +msgid "" +"Now you can query the :ref:`match object ` for information " +"about the matching string. Match object instances also have several methods " +"and attributes; the most important ones are:" msgstr "" +#: ../../howto/regex.rst:419 msgid "``group()``" msgstr "" +#: ../../howto/regex.rst:419 msgid "Return the string matched by the RE" msgstr "" +#: ../../howto/regex.rst:421 msgid "``start()``" msgstr "" +#: ../../howto/regex.rst:421 msgid "Return the starting position of the match" msgstr "" +#: ../../howto/regex.rst:423 msgid "``end()``" msgstr "" +#: ../../howto/regex.rst:423 msgid "Return the ending position of the match" msgstr "" +#: ../../howto/regex.rst:425 msgid "``span()``" msgstr "" +#: ../../howto/regex.rst:425 msgid "Return a tuple containing the (start, end) positions of the match" msgstr "" +#: ../../howto/regex.rst:429 msgid "Trying these methods will soon clarify their meaning::" msgstr "" +#: ../../howto/regex.rst:431 msgid "" ">>> m.group()\n" "'tempo'\n" @@ -446,9 +811,19 @@ msgid "" "(0, 5)" msgstr "" -msgid ":meth:`~re.Match.group` returns the substring that was matched by the RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and ending index of the match. :meth:`~re.Match.span` returns both start and end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only checks if the RE matches at the start of a string, :meth:`!start` will always be zero. However, the :meth:`~re.Pattern.search` method of patterns scans through the string, so the match may not start at zero in that case. ::" +#: ../../howto/regex.rst:438 +msgid "" +":meth:`~re.Match.group` returns the substring that was matched by the " +"RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting " +"and ending index of the match. :meth:`~re.Match.span` returns both start and " +"end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method " +"only checks if the RE matches at the start of a string, :meth:`!start` will " +"always be zero. However, the :meth:`~re.Pattern.search` method of patterns " +"scans through the string, so the match may not start at zero in that " +"case. ::" msgstr "" +#: ../../howto/regex.rst:446 msgid "" ">>> print(p.match('::: message'))\n" "None\n" @@ -460,9 +835,14 @@ msgid "" "(4, 11)" msgstr "" -msgid "In actual programs, the most common style is to store the :ref:`match object ` in a variable, and then check if it was ``None``. This usually looks like::" +#: ../../howto/regex.rst:455 +msgid "" +"In actual programs, the most common style is to store the :ref:`match object " +"` in a variable, and then check if it was ``None``. This " +"usually looks like::" msgstr "" +#: ../../howto/regex.rst:459 msgid "" "p = re.compile( ... )\n" "m = p.match( 'string goes here' )\n" @@ -472,21 +852,37 @@ msgid "" " print('No match')" msgstr "" -msgid "Two pattern methods return all of the matches for a pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" +#: ../../howto/regex.rst:466 +msgid "" +"Two pattern methods return all of the matches for a " +"pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" msgstr "" +#: ../../howto/regex.rst:469 msgid "" ">>> p = re.compile(r'\\d+')\n" ">>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')\n" "['12', '11', '10']" msgstr "" -msgid "The ``r`` prefix, making the literal a raw string literal, is needed in this example because escape sequences in a normal \"cooked\" string literal that are not recognized by Python, as opposed to regular expressions, now result in a :exc:`SyntaxWarning` and will eventually become a :exc:`SyntaxError`. See :ref:`the-backslash-plague`." +#: ../../howto/regex.rst:473 +msgid "" +"The ``r`` prefix, making the literal a raw string literal, is needed in this " +"example because escape sequences in a normal \"cooked\" string literal that " +"are not recognized by Python, as opposed to regular expressions, now result " +"in a :exc:`SyntaxWarning` and will eventually become a :exc:`SyntaxError`. " +"See :ref:`the-backslash-plague`." msgstr "" -msgid ":meth:`~re.Pattern.findall` has to create the entire list before it can be returned as the result. The :meth:`~re.Pattern.finditer` method returns a sequence of :ref:`match object ` instances as an :term:`iterator`::" +#: ../../howto/regex.rst:479 +msgid "" +":meth:`~re.Pattern.findall` has to create the entire list before it can be " +"returned as the result. The :meth:`~re.Pattern.finditer` method returns a " +"sequence of :ref:`match object ` instances as " +"an :term:`iterator`::" msgstr "" +#: ../../howto/regex.rst:483 msgid "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" ">>> iterator\n" @@ -499,12 +895,21 @@ msgid "" "(29, 31)" msgstr "" +#: ../../howto/regex.rst:495 msgid "Module-level functions" msgstr "" -msgid "You don't have to create a pattern object and call its methods; the :mod:`re` module also provides top-level functions called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, and so forth. These functions take the same arguments as the corresponding pattern method with the RE string added as the first argument, and still return either ``None`` or a :ref:`match object ` instance. ::" +#: ../../howto/regex.rst:497 +msgid "" +"You don't have to create a pattern object and call its methods; " +"the :mod:`re` module also provides top-level functions " +"called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, " +"and so forth. These functions take the same arguments as the corresponding " +"pattern method with the RE string added as the first argument, and still " +"return either ``None`` or a :ref:`match object ` instance. ::" msgstr "" +#: ../../howto/regex.rst:504 msgid "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" @@ -512,90 +917,193 @@ msgid "" "" msgstr "" -msgid "Under the hood, these functions simply create a pattern object for you and call the appropriate method on it. They also store the compiled object in a cache, so future calls using the same RE won't need to parse the pattern again and again." +#: ../../howto/regex.rst:509 +msgid "" +"Under the hood, these functions simply create a pattern object for you and " +"call the appropriate method on it. They also store the compiled object in a " +"cache, so future calls using the same RE won't need to parse the pattern " +"again and again." msgstr "" -msgid "Should you use these module-level functions, or should you get the pattern and call its methods yourself? If you're accessing a regex within a loop, pre-compiling it will save a few function calls. Outside of loops, there's not much difference thanks to the internal cache." +#: ../../howto/regex.rst:514 +msgid "" +"Should you use these module-level functions, or should you get the pattern " +"and call its methods yourself? If you're accessing a regex within a loop, " +"pre-compiling it will save a few function calls. Outside of loops, there's " +"not much difference thanks to the internal cache." msgstr "" +#: ../../howto/regex.rst:522 msgid "Compilation flags" msgstr "" -msgid "Compilation flags let you modify some aspects of how regular expressions work. Flags are available in the :mod:`re` module under two names, a long name such as :const:`IGNORECASE` and a short, one-letter form such as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-letter forms use the same letters; the short form of :const:`re.VERBOSE` is :const:`re.X`, for example.) Multiple flags can be specified by bitwise OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, for example." +#: ../../howto/regex.rst:526 +msgid "" +"Compilation flags let you modify some aspects of how regular expressions " +"work. Flags are available in the :mod:`re` module under two names, a long " +"name such as :const:`IGNORECASE` and a short, one-letter form such " +"as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-" +"letter forms use the same letters; the short form of :const:`re.VERBOSE` " +"is :const:`re.X`, for example.) Multiple flags can be specified by bitwise " +"OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, " +"for example." msgstr "" -msgid "Here's a table of the available flags, followed by a more detailed explanation of each one." +#: ../../howto/regex.rst:534 +msgid "" +"Here's a table of the available flags, followed by a more detailed " +"explanation of each one." msgstr "" +#: ../../howto/regex.rst:538 msgid "Flag" msgstr "" +#: ../../howto/regex.rst:538 msgid "Meaning" msgstr "" +#: ../../howto/regex.rst:540 msgid ":const:`ASCII`, :const:`A`" msgstr "" -msgid "Makes several escapes like ``\\w``, ``\\b``, ``\\s`` and ``\\d`` match only on ASCII characters with the respective property." +#: ../../howto/regex.rst:540 +msgid "" +"Makes several escapes like ``\\w``, ``\\b``, ``\\s`` and ``\\d`` match only " +"on ASCII characters with the respective property." msgstr "" +#: ../../howto/regex.rst:544 msgid ":const:`DOTALL`, :const:`S`" msgstr "" +#: ../../howto/regex.rst:544 msgid "Make ``.`` match any character, including newlines." msgstr "" +#: ../../howto/regex.rst:547 msgid ":const:`IGNORECASE`, :const:`I`" msgstr "" +#: ../../howto/regex.rst:547 msgid "Do case-insensitive matches." msgstr "" +#: ../../howto/regex.rst:549 msgid ":const:`LOCALE`, :const:`L`" msgstr "" +#: ../../howto/regex.rst:549 msgid "Do a locale-aware match." msgstr "" +#: ../../howto/regex.rst:551 msgid ":const:`MULTILINE`, :const:`M`" msgstr "" +#: ../../howto/regex.rst:551 msgid "Multi-line matching, affecting ``^`` and ``$``." msgstr "" +#: ../../howto/regex.rst:554 msgid ":const:`VERBOSE`, :const:`X` (for 'extended')" msgstr "" -msgid "Enable verbose REs, which can be organized more cleanly and understandably." -msgstr "" - -msgid "Perform case-insensitive matching; character class and literal strings will match letters by ignoring case. For example, ``[A-Z]`` will match lowercase letters, too. Full Unicode matching also works unless the :const:`ASCII` flag is used to disable non-ASCII matches. When the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or ``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing doesn't take the current locale into account; it will if you also set the :const:`LOCALE` flag." -msgstr "" - -msgid "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching dependent on the current locale instead of the Unicode database." +#: ../../howto/regex.rst:554 +msgid "" +"Enable verbose REs, which can be organized more cleanly and understandably." msgstr "" -msgid "Locales are a feature of the C library intended to help in writing programs that take account of language differences. For example, if you're processing encoded French text, you'd want to be able to write ``\\w+`` to match words, but ``\\w`` only matches the character class ``[A-Za-z]`` in bytes patterns; it won't match bytes corresponding to ``é`` or ``ç``. If your system is configured properly and a French locale is selected, certain C functions will tell the program that the byte corresponding to ``é`` should also be considered a letter. Setting the :const:`LOCALE` flag when compiling a regular expression will cause the resulting compiled object to use these C functions for ``\\w``; this is slower, but also enables ``\\w+`` to match French words as you'd expect. The use of this flag is discouraged in Python 3 as the locale mechanism is very unreliable, it only handles one \"culture\" at a time, and it only works with 8-bit locales. Unicode matching is already enabled by default in Python 3 for Unicode (str) patterns, and it is able to handle different locales/languages." +#: ../../howto/regex.rst:563 +msgid "" +"Perform case-insensitive matching; character class and literal strings will " +"match letters by ignoring case. For example, ``[A-Z]`` will match lowercase " +"letters, too. Full Unicode matching also works unless the :const:`ASCII` " +"flag is used to disable non-ASCII matches. When the Unicode patterns ``[a-" +"z]`` or ``[A-Z]`` are used in combination with the :const:`IGNORECASE` flag, " +"they will match the 52 ASCII letters and 4 additional non-ASCII letters: 'İ' " +"(U+0130, Latin capital letter I with dot above), 'ı' (U+0131, Latin small " +"letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, " +"Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or " +"``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing " +"doesn't take the current locale into account; it will if you also set " +"the :const:`LOCALE` flag." +msgstr "" + +#: ../../howto/regex.rst:581 +msgid "" +"Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " +"dependent on the current locale instead of the Unicode database." msgstr "" -msgid "(``^`` and ``$`` haven't been explained yet; they'll be introduced in section :ref:`more-metacharacters`.)" +#: ../../howto/regex.rst:584 +msgid "" +"Locales are a feature of the C library intended to help in writing programs " +"that take account of language differences. For example, if you're " +"processing encoded French text, you'd want to be able to write ``\\w+`` to " +"match words, but ``\\w`` only matches the character class ``[A-Za-z]`` in " +"bytes patterns; it won't match bytes corresponding to ``é`` or ``ç``. If " +"your system is configured properly and a French locale is selected, certain " +"C functions will tell the program that the byte corresponding to ``é`` " +"should also be considered a letter. Setting the :const:`LOCALE` flag when " +"compiling a regular expression will cause the resulting compiled object to " +"use these C functions for ``\\w``; this is slower, but also enables ``\\w+`` " +"to match French words as you'd expect. The use of this flag is discouraged " +"in Python 3 as the locale mechanism is very unreliable, it only handles one " +"\"culture\" at a time, and it only works with 8-bit locales. Unicode " +"matching is already enabled by default in Python 3 for Unicode (str) " +"patterns, and it is able to handle different locales/languages." +msgstr "" + +#: ../../howto/regex.rst:606 +msgid "" +"(``^`` and ``$`` haven't been explained yet; they'll be introduced in " +"section :ref:`more-metacharacters`.)" msgstr "" -msgid "Usually ``^`` matches only at the beginning of the string, and ``$`` matches only at the end of the string and immediately before the newline (if any) at the end of the string. When this flag is specified, ``^`` matches at the beginning of the string and at the beginning of each line within the string, immediately following each newline. Similarly, the ``$`` metacharacter matches either at the end of the string and at the end of each line (immediately preceding each newline)." +#: ../../howto/regex.rst:609 +msgid "" +"Usually ``^`` matches only at the beginning of the string, and ``$`` matches " +"only at the end of the string and immediately before the newline (if any) at " +"the end of the string. When this flag is specified, ``^`` matches at the " +"beginning of the string and at the beginning of each line within the string, " +"immediately following each newline. Similarly, the ``$`` metacharacter " +"matches either at the end of the string and at the end of each line " +"(immediately preceding each newline)." msgstr "" -msgid "Makes the ``'.'`` special character match any character at all, including a newline; without this flag, ``'.'`` will match anything *except* a newline." +#: ../../howto/regex.rst:622 +msgid "" +"Makes the ``'.'`` special character match any character at all, including a " +"newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -msgid "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\s`` and ``\\S`` perform ASCII-only matching instead of full Unicode matching. This is only meaningful for Unicode patterns, and is ignored for byte patterns." +#: ../../howto/regex.rst:630 +msgid "" +"Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\s`` and ``\\S`` perform ASCII-" +"only matching instead of full Unicode matching. This is only meaningful for " +"Unicode patterns, and is ignored for byte patterns." msgstr "" -msgid "This flag allows you to write regular expressions that are more readable by granting you more flexibility in how you can format them. When this flag has been specified, whitespace within the RE string is ignored, except when the whitespace is in a character class or preceded by an unescaped backslash; this lets you organize and indent the RE more clearly. This flag also lets you put comments within a RE that will be ignored by the engine; comments are marked by a ``'#'`` that's neither in a character class nor preceded by an unescaped backslash." +#: ../../howto/regex.rst:639 +msgid "" +"This flag allows you to write regular expressions that are more readable by " +"granting you more flexibility in how you can format them. When this flag " +"has been specified, whitespace within the RE string is ignored, except when " +"the whitespace is in a character class or preceded by an unescaped " +"backslash; this lets you organize and indent the RE more clearly. This flag " +"also lets you put comments within a RE that will be ignored by the engine; " +"comments are marked by a ``'#'`` that's neither in a character class nor " +"preceded by an unescaped backslash." msgstr "" -msgid "For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier it is to read? ::" +#: ../../howto/regex.rst:648 +msgid "" +"For example, here's a RE that uses :const:`re.VERBOSE`; see how much easier " +"it is to read? ::" msgstr "" +#: ../../howto/regex.rst:651 msgid "" "charref = re.compile(r\"\"\"\n" " &[#] # Start of a numeric entity reference\n" @@ -608,51 +1116,96 @@ msgid "" "\"\"\", re.VERBOSE)" msgstr "" +#: ../../howto/regex.rst:661 msgid "Without the verbose setting, the RE would look like this::" msgstr "" +#: ../../howto/regex.rst:663 msgid "" "charref = re.compile(\"&#(0[0-7]+\"\n" " \"|[0-9]+\"\n" " \"|x[0-9a-fA-F]+);\")" msgstr "" -msgid "In the above example, Python's automatic concatenation of string literals has been used to break up the RE into smaller pieces, but it's still more difficult to understand than the version using :const:`re.VERBOSE`." +#: ../../howto/regex.rst:667 +msgid "" +"In the above example, Python's automatic concatenation of string literals " +"has been used to break up the RE into smaller pieces, but it's still more " +"difficult to understand than the version using :const:`re.VERBOSE`." msgstr "" +#: ../../howto/regex.rst:673 msgid "More pattern power" msgstr "" -msgid "So far we've only covered a part of the features of regular expressions. In this section, we'll cover some new metacharacters, and how to use groups to retrieve portions of the text that was matched." +#: ../../howto/regex.rst:675 +msgid "" +"So far we've only covered a part of the features of regular expressions. In " +"this section, we'll cover some new metacharacters, and how to use groups to " +"retrieve portions of the text that was matched." msgstr "" +#: ../../howto/regex.rst:683 msgid "More metacharacters" msgstr "" -msgid "There are some metacharacters that we haven't covered yet. Most of them will be covered in this section." +#: ../../howto/regex.rst:685 +msgid "" +"There are some metacharacters that we haven't covered yet. Most of them " +"will be covered in this section." msgstr "" -msgid "Some of the remaining metacharacters to be discussed are :dfn:`zero-width assertions`. They don't cause the engine to advance through the string; instead, they consume no characters at all, and simply succeed or fail. For example, ``\\b`` is an assertion that the current position is located at a word boundary; the position isn't changed by the ``\\b`` at all. This means that zero-width assertions should never be repeated, because if they match once at a given location, they can obviously be matched an infinite number of times." +#: ../../howto/regex.rst:688 +msgid "" +"Some of the remaining metacharacters to be discussed are :dfn:`zero-width " +"assertions`. They don't cause the engine to advance through the string; " +"instead, they consume no characters at all, and simply succeed or fail. For " +"example, ``\\b`` is an assertion that the current position is located at a " +"word boundary; the position isn't changed by the ``\\b`` at all. This means " +"that zero-width assertions should never be repeated, because if they match " +"once at a given location, they can obviously be matched an infinite number " +"of times." msgstr "" +#: ../../howto/regex.rst:696 msgid "``|``" msgstr "" -msgid "Alternation, or the \"or\" operator. If *A* and *B* are regular expressions, ``A|B`` will match any string that matches either *A* or *B*. ``|`` has very low precedence in order to make it work reasonably when you're alternating multi-character strings. ``Crow|Servo`` will match either ``'Crow'`` or ``'Servo'``, not ``'Cro'``, a ``'w'`` or an ``'S'``, and ``'ervo'``." +#: ../../howto/regex.rst:697 +msgid "" +"Alternation, or the \"or\" operator. If *A* and *B* are regular " +"expressions, ``A|B`` will match any string that matches either *A* or *B*. " +"``|`` has very low precedence in order to make it work reasonably when " +"you're alternating multi-character strings. ``Crow|Servo`` will match either " +"``'Crow'`` or ``'Servo'``, not ``'Cro'``, a ``'w'`` or an ``'S'``, and " +"``'ervo'``." msgstr "" -msgid "To match a literal ``'|'``, use ``\\|``, or enclose it inside a character class, as in ``[|]``." +#: ../../howto/regex.rst:703 +msgid "" +"To match a literal ``'|'``, use ``\\|``, or enclose it inside a character " +"class, as in ``[|]``." msgstr "" +#: ../../howto/regex.rst:706 msgid "``^``" msgstr "" -msgid "Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has been set, this will only match at the beginning of the string. In :const:`MULTILINE` mode, this also matches immediately after each newline within the string." +#: ../../howto/regex.rst:707 +msgid "" +"Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has " +"been set, this will only match at the beginning of the string. " +"In :const:`MULTILINE` mode, this also matches immediately after each newline " +"within the string." msgstr "" -msgid "For example, if you wish to match the word ``From`` only at the beginning of a line, the RE to use is ``^From``. ::" +#: ../../howto/regex.rst:711 +msgid "" +"For example, if you wish to match the word ``From`` only at the beginning of " +"a line, the RE to use is ``^From``. ::" msgstr "" +#: ../../howto/regex.rst:714 msgid "" ">>> print(re.search('^From', 'From Here to Eternity'))\n" "\n" @@ -660,15 +1213,21 @@ msgid "" "None" msgstr "" +#: ../../howto/regex.rst:719 msgid "To match a literal ``'^'``, use ``\\^``." msgstr "" +#: ../../howto/regex.rst:721 msgid "``$``" msgstr "" -msgid "Matches at the end of a line, which is defined as either the end of the string, or any location followed by a newline character. ::" +#: ../../howto/regex.rst:722 +msgid "" +"Matches at the end of a line, which is defined as either the end of the " +"string, or any location followed by a newline character. ::" msgstr "" +#: ../../howto/regex.rst:725 msgid "" ">>> print(re.search('}$', '{block}'))\n" "\n" @@ -678,36 +1237,60 @@ msgid "" "" msgstr "" -msgid "To match a literal ``'$'``, use ``\\$`` or enclose it inside a character class, as in ``[$]``." +#: ../../howto/regex.rst:732 +msgid "" +"To match a literal ``'$'``, use ``\\$`` or enclose it inside a character " +"class, as in ``[$]``." msgstr "" +#: ../../howto/regex.rst:735 msgid "``\\A``" msgstr "" -msgid "Matches only at the start of the string. When not in :const:`MULTILINE` mode, ``\\A`` and ``^`` are effectively the same. In :const:`MULTILINE` mode, they're different: ``\\A`` still matches only at the beginning of the string, but ``^`` may match at any location inside the string that follows a newline character." +#: ../../howto/regex.rst:736 +msgid "" +"Matches only at the start of the string. When not in :const:`MULTILINE` " +"mode, ``\\A`` and ``^`` are effectively the same. In :const:`MULTILINE` " +"mode, they're different: ``\\A`` still matches only at the beginning of the " +"string, but ``^`` may match at any location inside the string that follows a " +"newline character." msgstr "" +#: ../../howto/regex.rst:741 msgid "``\\z``" msgstr "" +#: ../../howto/regex.rst:742 msgid "Matches only at the end of the string." msgstr "" +#: ../../howto/regex.rst:744 msgid "``\\Z``" msgstr "" +#: ../../howto/regex.rst:745 msgid "The same as ``\\z``. For compatibility with old Python versions." msgstr "" +#: ../../howto/regex.rst:747 msgid "``\\b``" msgstr "" -msgid "Word boundary. This is a zero-width assertion that matches only at the beginning or end of a word. A word is defined as a sequence of alphanumeric characters, so the end of a word is indicated by whitespace or a non-alphanumeric character." +#: ../../howto/regex.rst:748 +msgid "" +"Word boundary. This is a zero-width assertion that matches only at the " +"beginning or end of a word. A word is defined as a sequence of alphanumeric " +"characters, so the end of a word is indicated by whitespace or a non-" +"alphanumeric character." msgstr "" -msgid "The following example matches ``class`` only when it's a complete word; it won't match when it's contained inside another word. ::" +#: ../../howto/regex.rst:753 +msgid "" +"The following example matches ``class`` only when it's a complete word; it " +"won't match when it's contained inside another word. ::" msgstr "" +#: ../../howto/regex.rst:756 msgid "" ">>> p = re.compile(r'\\bclass\\b')\n" ">>> print(p.search('no class at all'))\n" @@ -718,9 +1301,18 @@ msgid "" "None" msgstr "" -msgid "There are two subtleties you should remember when using this special sequence. First, this is the worst collision between Python's string literals and regular expression sequences. In Python's string literals, ``\\b`` is the backspace character, ASCII value 8. If you're not using raw strings, then Python will convert the ``\\b`` to a backspace, and your RE won't match as you expect it to. The following example looks the same as our previous RE, but omits the ``'r'`` in front of the RE string. ::" +#: ../../howto/regex.rst:764 +msgid "" +"There are two subtleties you should remember when using this special " +"sequence. First, this is the worst collision between Python's string " +"literals and regular expression sequences. In Python's string literals, " +"``\\b`` is the backspace character, ASCII value 8. If you're not using raw " +"strings, then Python will convert the ``\\b`` to a backspace, and your RE " +"won't match as you expect it to. The following example looks the same as our " +"previous RE, but omits the ``'r'`` in front of the RE string. ::" msgstr "" +#: ../../howto/regex.rst:772 msgid "" ">>> p = re.compile('\\bclass\\b')\n" ">>> print(p.search('no class at all'))\n" @@ -729,21 +1321,37 @@ msgid "" "" msgstr "" -msgid "Second, inside a character class, where there's no use for this assertion, ``\\b`` represents the backspace character, for compatibility with Python's string literals." +#: ../../howto/regex.rst:778 +msgid "" +"Second, inside a character class, where there's no use for this assertion, " +"``\\b`` represents the backspace character, for compatibility with Python's " +"string literals." msgstr "" +#: ../../howto/regex.rst:782 msgid "``\\B``" msgstr "" -msgid "Another zero-width assertion, this is the opposite of ``\\b``, only matching when the current position is not at a word boundary." +#: ../../howto/regex.rst:783 +msgid "" +"Another zero-width assertion, this is the opposite of ``\\b``, only matching " +"when the current position is not at a word boundary." msgstr "" +#: ../../howto/regex.rst:788 msgid "Grouping" msgstr "" -msgid "Frequently you need to obtain more information than just whether the RE matched or not. Regular expressions are often used to dissect strings by writing a RE divided into several subgroups which match different components of interest. For example, an RFC-822 header line is divided into a header name and a value, separated by a ``':'``, like this:" +#: ../../howto/regex.rst:790 +msgid "" +"Frequently you need to obtain more information than just whether the RE " +"matched or not. Regular expressions are often used to dissect strings by " +"writing a RE divided into several subgroups which match different components " +"of interest. For example, an RFC-822 header line is divided into a header " +"name and a value, separated by a ``':'``, like this:" msgstr "" +#: ../../howto/regex.rst:796 msgid "" "From: author@example.com\n" "User-Agent: Thunderbird 1.5.0.9 (X11/20061227)\n" @@ -751,21 +1359,43 @@ msgid "" "To: editor@example.com" msgstr "" -msgid "This can be handled by writing a regular expression which matches an entire header line, and has one group which matches the header name, and another group which matches the header's value." +#: ../../howto/regex.rst:803 +msgid "" +"This can be handled by writing a regular expression which matches an entire " +"header line, and has one group which matches the header name, and another " +"group which matches the header's value." msgstr "" -msgid "Groups are marked by the ``'('``, ``')'`` metacharacters. ``'('`` and ``')'`` have much the same meaning as they do in mathematical expressions; they group together the expressions contained inside them, and you can repeat the contents of a group with a quantifier, such as ``*``, ``+``, ``?``, or ``{m,n}``. For example, ``(ab)*`` will match zero or more repetitions of ``ab``. ::" +#: ../../howto/regex.rst:807 +msgid "" +"Groups are marked by the ``'('``, ``')'`` metacharacters. ``'('`` and " +"``')'`` have much the same meaning as they do in mathematical expressions; " +"they group together the expressions contained inside them, and you can " +"repeat the contents of a group with a quantifier, such as ``*``, ``+``, ``?" +"``, or ``{m,n}``. For example, ``(ab)*`` will match zero or more " +"repetitions of ``ab``. ::" msgstr "" +#: ../../howto/regex.rst:814 msgid "" ">>> p = re.compile('(ab)*')\n" ">>> print(p.match('ababababab').span())\n" "(0, 10)" msgstr "" -msgid "Groups indicated with ``'('``, ``')'`` also capture the starting and ending index of the text that they match; this can be retrieved by passing an argument to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 is always present; it's the whole RE, so :ref:`match object ` methods all have group 0 as their default argument. Later we'll see how to express groups that don't capture the span of text that they match. ::" +#: ../../howto/regex.rst:818 +msgid "" +"Groups indicated with ``'('``, ``')'`` also capture the starting and ending " +"index of the text that they match; this can be retrieved by passing an " +"argument " +"to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, " +"and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 " +"is always present; it's the whole RE, so :ref:`match object ` " +"methods all have group 0 as their default argument. Later we'll see how to " +"express groups that don't capture the span of text that they match. ::" msgstr "" +#: ../../howto/regex.rst:827 msgid "" ">>> p = re.compile('(a)b')\n" ">>> m = p.match('ab')\n" @@ -775,9 +1405,14 @@ msgid "" "'ab'" msgstr "" -msgid "Subgroups are numbered from left to right, from 1 upward. Groups can be nested; to determine the number, just count the opening parenthesis characters, going from left to right. ::" +#: ../../howto/regex.rst:834 +msgid "" +"Subgroups are numbered from left to right, from 1 upward. Groups can be " +"nested; to determine the number, just count the opening parenthesis " +"characters, going from left to right. ::" msgstr "" +#: ../../howto/regex.rst:838 msgid "" ">>> p = re.compile('(a(b)c)d')\n" ">>> m = p.match('abcd')\n" @@ -789,58 +1424,118 @@ msgid "" "'b'" msgstr "" -msgid ":meth:`~re.Match.group` can be passed multiple group numbers at a time, in which case it will return a tuple containing the corresponding values for those groups. ::" +#: ../../howto/regex.rst:847 +msgid "" +":meth:`~re.Match.group` can be passed multiple group numbers at a time, in " +"which case it will return a tuple containing the corresponding values for " +"those groups. ::" msgstr "" +#: ../../howto/regex.rst:850 msgid "" ">>> m.group(2,1,2)\n" "('b', 'abc', 'b')" msgstr "" -msgid "The :meth:`~re.Match.groups` method returns a tuple containing the strings for all the subgroups, from 1 up to however many there are. ::" +#: ../../howto/regex.rst:853 +msgid "" +"The :meth:`~re.Match.groups` method returns a tuple containing the strings " +"for all the subgroups, from 1 up to however many there are. ::" msgstr "" +#: ../../howto/regex.rst:856 msgid "" ">>> m.groups()\n" "('abc', 'b')" msgstr "" -msgid "Backreferences in a pattern allow you to specify that the contents of an earlier capturing group must also be found at the current location in the string. For example, ``\\1`` will succeed if the exact contents of group 1 can be found at the current position, and fails otherwise. Remember that Python's string literals also use a backslash followed by numbers to allow including arbitrary characters in a string, so be sure to use a raw string when incorporating backreferences in a RE." +#: ../../howto/regex.rst:859 +msgid "" +"Backreferences in a pattern allow you to specify that the contents of an " +"earlier capturing group must also be found at the current location in the " +"string. For example, ``\\1`` will succeed if the exact contents of group 1 " +"can be found at the current position, and fails otherwise. Remember that " +"Python's string literals also use a backslash followed by numbers to allow " +"including arbitrary characters in a string, so be sure to use a raw string " +"when incorporating backreferences in a RE." msgstr "" +#: ../../howto/regex.rst:867 msgid "For example, the following RE detects doubled words in a string. ::" msgstr "" +#: ../../howto/regex.rst:869 msgid "" ">>> p = re.compile(r'\\b(\\w+)\\s+\\1\\b')\n" ">>> p.search('Paris in the the spring').group()\n" "'the the'" msgstr "" -msgid "Backreferences like this aren't often useful for just searching through a string --- there are few text formats which repeat data in this way --- but you'll soon find out that they're *very* useful when performing string substitutions." +#: ../../howto/regex.rst:873 +msgid "" +"Backreferences like this aren't often useful for just searching through a " +"string --- there are few text formats which repeat data in this way --- but " +"you'll soon find out that they're *very* useful when performing string " +"substitutions." msgstr "" +#: ../../howto/regex.rst:879 msgid "Non-capturing and named groups" msgstr "" -msgid "Elaborate REs may use many groups, both to capture substrings of interest, and to group and structure the RE itself. In complex REs, it becomes difficult to keep track of the group numbers. There are two features which help with this problem. Both of them use a common syntax for regular expression extensions, so we'll look at that first." +#: ../../howto/regex.rst:881 +msgid "" +"Elaborate REs may use many groups, both to capture substrings of interest, " +"and to group and structure the RE itself. In complex REs, it becomes " +"difficult to keep track of the group numbers. There are two features which " +"help with this problem. Both of them use a common syntax for regular " +"expression extensions, so we'll look at that first." msgstr "" -msgid "Perl 5 is well known for its powerful additions to standard regular expressions. For these new features the Perl developers couldn't choose new single-keystroke metacharacters or new special sequences beginning with ``\\`` without making Perl's regular expressions confusingly different from standard REs. If they chose ``&`` as a new metacharacter, for example, old expressions would be assuming that ``&`` was a regular character and wouldn't have escaped it by writing ``\\&`` or ``[&]``." +#: ../../howto/regex.rst:887 +msgid "" +"Perl 5 is well known for its powerful additions to standard regular " +"expressions. For these new features the Perl developers couldn't choose new " +"single-keystroke metacharacters or new special sequences beginning with " +"``\\`` without making Perl's regular expressions confusingly different from " +"standard REs. If they chose ``&`` as a new metacharacter, for example, old " +"expressions would be assuming that ``&`` was a regular character and " +"wouldn't have escaped it by writing ``\\&`` or ``[&]``." msgstr "" -msgid "The solution chosen by the Perl developers was to use ``(?...)`` as the extension syntax. ``?`` immediately after a parenthesis was a syntax error because the ``?`` would have nothing to repeat, so this didn't introduce any compatibility problems. The characters immediately after the ``?`` indicate what extension is being used, so ``(?=foo)`` is one thing (a positive lookahead assertion) and ``(?:foo)`` is something else (a non-capturing group containing the subexpression ``foo``)." +#: ../../howto/regex.rst:894 +msgid "" +"The solution chosen by the Perl developers was to use ``(?...)`` as the " +"extension syntax. ``?`` immediately after a parenthesis was a syntax error " +"because the ``?`` would have nothing to repeat, so this didn't introduce any " +"compatibility problems. The characters immediately after the ``?`` " +"indicate what extension is being used, so ``(?=foo)`` is one thing (a " +"positive lookahead assertion) and ``(?:foo)`` is something else (a non-" +"capturing group containing the subexpression ``foo``)." msgstr "" -msgid "Python supports several of Perl's extensions and adds an extension syntax to Perl's extension syntax. If the first character after the question mark is a ``P``, you know that it's an extension that's specific to Python." +#: ../../howto/regex.rst:902 +msgid "" +"Python supports several of Perl's extensions and adds an extension syntax to " +"Perl's extension syntax. If the first character after the question mark is " +"a ``P``, you know that it's an extension that's specific to Python." msgstr "" -msgid "Now that we've looked at the general extension syntax, we can return to the features that simplify working with groups in complex REs." +#: ../../howto/regex.rst:907 +msgid "" +"Now that we've looked at the general extension syntax, we can return to the " +"features that simplify working with groups in complex REs." msgstr "" -msgid "Sometimes you'll want to use a group to denote a part of a regular expression, but aren't interested in retrieving the group's contents. You can make this fact explicit by using a non-capturing group: ``(?:...)``, where you can replace the ``...`` with any other regular expression. ::" +#: ../../howto/regex.rst:910 +msgid "" +"Sometimes you'll want to use a group to denote a part of a regular " +"expression, but aren't interested in retrieving the group's contents. You " +"can make this fact explicit by using a non-capturing group: ``(?:...)``, " +"where you can replace the ``...`` with any other regular expression. ::" msgstr "" +#: ../../howto/regex.rst:915 msgid "" ">>> m = re.match(\"([abc])+\", \"abc\")\n" ">>> m.groups()\n" @@ -850,15 +1545,38 @@ msgid "" "()" msgstr "" -msgid "Except for the fact that you can't retrieve the contents of what the group matched, a non-capturing group behaves exactly the same as a capturing group; you can put anything inside it, repeat it with a repetition metacharacter such as ``*``, and nest it within other groups (capturing or non-capturing). ``(?:...)`` is particularly useful when modifying an existing pattern, since you can add new groups without changing how all the other groups are numbered. It should be mentioned that there's no performance difference in searching between capturing and non-capturing groups; neither form is any faster than the other." -msgstr "" - -msgid "A more significant feature is named groups: instead of referring to them by numbers, groups can be referenced by a name." +#: ../../howto/regex.rst:922 +msgid "" +"Except for the fact that you can't retrieve the contents of what the group " +"matched, a non-capturing group behaves exactly the same as a capturing " +"group; you can put anything inside it, repeat it with a repetition " +"metacharacter such as ``*``, and nest it within other groups (capturing or " +"non-capturing). ``(?:...)`` is particularly useful when modifying an " +"existing pattern, since you can add new groups without changing how all the " +"other groups are numbered. It should be mentioned that there's no " +"performance difference in searching between capturing and non-capturing " +"groups; neither form is any faster than the other." +msgstr "" + +#: ../../howto/regex.rst:931 +msgid "" +"A more significant feature is named groups: instead of referring to them by " +"numbers, groups can be referenced by a name." msgstr "" -msgid "The syntax for a named group is one of the Python-specific extensions: ``(?P...)``. *name* is, obviously, the name of the group. Named groups behave exactly like capturing groups, and additionally associate a name with a group. The :ref:`match object ` methods that deal with capturing groups all accept either integers that refer to the group by number or strings that contain the desired group's name. Named groups are still given numbers, so you can retrieve information about a group in two ways::" +#: ../../howto/regex.rst:934 +msgid "" +"The syntax for a named group is one of the Python-specific extensions: ``(?" +"P...)``. *name* is, obviously, the name of the group. Named groups " +"behave exactly like capturing groups, and additionally associate a name with " +"a group. The :ref:`match object ` methods that deal with " +"capturing groups all accept either integers that refer to the group by " +"number or strings that contain the desired group's name. Named groups are " +"still given numbers, so you can retrieve information about a group in two " +"ways::" msgstr "" +#: ../../howto/regex.rst:942 msgid "" ">>> p = re.compile(r'(?P\\b\\w+\\b)')\n" ">>> m = p.search( '(((( Lots of punctuation )))' )\n" @@ -868,18 +1586,27 @@ msgid "" "'Lots'" msgstr "" -msgid "Additionally, you can retrieve named groups as a dictionary with :meth:`~re.Match.groupdict`::" +#: ../../howto/regex.rst:949 +msgid "" +"Additionally, you can retrieve named groups as a dictionary " +"with :meth:`~re.Match.groupdict`::" msgstr "" +#: ../../howto/regex.rst:952 msgid "" ">>> m = re.match(r'(?P\\w+) (?P\\w+)', 'Jane Doe')\n" ">>> m.groupdict()\n" "{'first': 'Jane', 'last': 'Doe'}" msgstr "" -msgid "Named groups are handy because they let you use easily remembered names, instead of having to remember numbers. Here's an example RE from the :mod:`imaplib` module::" +#: ../../howto/regex.rst:956 +msgid "" +"Named groups are handy because they let you use easily remembered names, " +"instead of having to remember numbers. Here's an example RE from " +"the :mod:`imaplib` module::" msgstr "" +#: ../../howto/regex.rst:960 msgid "" "InternalDate = re.compile(r'INTERNALDATE \"'\n" " r'(?P[ 123][0-9])-(?P[A-Z][a-z][a-z])-'\n" @@ -889,123 +1616,242 @@ msgid "" " r'\"')" msgstr "" -msgid "It's obviously much easier to retrieve ``m.group('zonem')``, instead of having to remember to retrieve group 9." +#: ../../howto/regex.rst:967 +msgid "" +"It's obviously much easier to retrieve ``m.group('zonem')``, instead of " +"having to remember to retrieve group 9." msgstr "" -msgid "The syntax for backreferences in an expression such as ``(...)\\1`` refers to the number of the group. There's naturally a variant that uses the group name instead of the number. This is another Python extension: ``(?P=name)`` indicates that the contents of the group called *name* should again be matched at the current point. The regular expression for finding doubled words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P\\w+)\\s+(?P=word)\\b``::" +#: ../../howto/regex.rst:970 +msgid "" +"The syntax for backreferences in an expression such as ``(...)\\1`` refers " +"to the number of the group. There's naturally a variant that uses the group " +"name instead of the number. This is another Python extension: ``(?P=name)`` " +"indicates that the contents of the group called *name* should again be " +"matched at the current point. The regular expression for finding doubled " +"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P\\w+)\\s+" +"(?P=word)\\b``::" msgstr "" +#: ../../howto/regex.rst:977 msgid "" ">>> p = re.compile(r'\\b(?P\\w+)\\s+(?P=word)\\b')\n" ">>> p.search('Paris in the the spring').group()\n" "'the the'" msgstr "" +#: ../../howto/regex.rst:983 msgid "Lookahead assertions" msgstr "" -msgid "Another zero-width assertion is the lookahead assertion. Lookahead assertions are available in both positive and negative form, and look like this:" +#: ../../howto/regex.rst:985 +msgid "" +"Another zero-width assertion is the lookahead assertion. Lookahead " +"assertions are available in both positive and negative form, and look like " +"this:" msgstr "" +#: ../../howto/regex.rst:988 msgid "``(?=...)``" msgstr "" -msgid "Positive lookahead assertion. This succeeds if the contained regular expression, represented here by ``...``, successfully matches at the current location, and fails otherwise. But, once the contained expression has been tried, the matching engine doesn't advance at all; the rest of the pattern is tried right where the assertion started." +#: ../../howto/regex.rst:989 +msgid "" +"Positive lookahead assertion. This succeeds if the contained regular " +"expression, represented here by ``...``, successfully matches at the current " +"location, and fails otherwise. But, once the contained expression has been " +"tried, the matching engine doesn't advance at all; the rest of the pattern " +"is tried right where the assertion started." msgstr "" +#: ../../howto/regex.rst:995 msgid "``(?!...)``" msgstr "" -msgid "Negative lookahead assertion. This is the opposite of the positive assertion; it succeeds if the contained expression *doesn't* match at the current position in the string." +#: ../../howto/regex.rst:996 +msgid "" +"Negative lookahead assertion. This is the opposite of the positive " +"assertion; it succeeds if the contained expression *doesn't* match at the " +"current position in the string." msgstr "" -msgid "To make this concrete, let's look at a case where a lookahead is useful. Consider a simple pattern to match a filename and split it apart into a base name and an extension, separated by a ``.``. For example, in ``news.rc``, ``news`` is the base name, and ``rc`` is the filename's extension." +#: ../../howto/regex.rst:1000 +msgid "" +"To make this concrete, let's look at a case where a lookahead is useful. " +"Consider a simple pattern to match a filename and split it apart into a base " +"name and an extension, separated by a ``.``. For example, in ``news.rc``, " +"``news`` is the base name, and ``rc`` is the filename's extension." msgstr "" +#: ../../howto/regex.rst:1005 msgid "The pattern to match this is quite simple:" msgstr "" +#: ../../howto/regex.rst:1007 msgid "``.*[.].*$``" msgstr "" -msgid "Notice that the ``.`` needs to be treated specially because it's a metacharacter, so it's inside a character class to only match that specific character. Also notice the trailing ``$``; this is added to ensure that all the rest of the string must be included in the extension. This regular expression matches ``foo.bar`` and ``autoexec.bat`` and ``sendmail.cf`` and ``printers.conf``." +#: ../../howto/regex.rst:1009 +msgid "" +"Notice that the ``.`` needs to be treated specially because it's a " +"metacharacter, so it's inside a character class to only match that specific " +"character. Also notice the trailing ``$``; this is added to ensure that all " +"the rest of the string must be included in the extension. This regular " +"expression matches ``foo.bar`` and ``autoexec.bat`` and ``sendmail.cf`` and " +"``printers.conf``." msgstr "" -msgid "Now, consider complicating the problem a bit; what if you want to match filenames where the extension is not ``bat``? Some incorrect attempts:" +#: ../../howto/regex.rst:1016 +msgid "" +"Now, consider complicating the problem a bit; what if you want to match " +"filenames where the extension is not ``bat``? Some incorrect attempts:" msgstr "" +#: ../../howto/regex.rst:1019 msgid "``.*[.][^b].*$``" msgstr "" -msgid "The first attempt above tries to exclude ``bat`` by requiring that the first character of the extension is not a ``b``. This is wrong, because the pattern also doesn't match ``foo.bar``." +#: ../../howto/regex.rst:1021 +msgid "" +"The first attempt above tries to exclude ``bat`` by requiring that the first " +"character of the extension is not a ``b``. This is wrong, because the " +"pattern also doesn't match ``foo.bar``." msgstr "" +#: ../../howto/regex.rst:1025 msgid "``.*[.]([^b]..|.[^a].|..[^t])$``" msgstr "" -msgid "The expression gets messier when you try to patch up the first solution by requiring one of the following cases to match: the first character of the extension isn't ``b``; the second character isn't ``a``; or the third character isn't ``t``. This accepts ``foo.bar`` and rejects ``autoexec.bat``, but it requires a three-letter extension and won't accept a filename with a two-letter extension such as ``sendmail.cf``. We'll complicate the pattern again in an effort to fix it." +#: ../../howto/regex.rst:1027 +msgid "" +"The expression gets messier when you try to patch up the first solution by " +"requiring one of the following cases to match: the first character of the " +"extension isn't ``b``; the second character isn't ``a``; or the third " +"character isn't ``t``. This accepts ``foo.bar`` and rejects " +"``autoexec.bat``, but it requires a three-letter extension and won't accept " +"a filename with a two-letter extension such as ``sendmail.cf``. We'll " +"complicate the pattern again in an effort to fix it." msgstr "" +#: ../../howto/regex.rst:1035 msgid "``.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$``" msgstr "" -msgid "In the third attempt, the second and third letters are all made optional in order to allow matching extensions shorter than three characters, such as ``sendmail.cf``." +#: ../../howto/regex.rst:1037 +msgid "" +"In the third attempt, the second and third letters are all made optional in " +"order to allow matching extensions shorter than three characters, such as " +"``sendmail.cf``." msgstr "" -msgid "The pattern's getting really complicated now, which makes it hard to read and understand. Worse, if the problem changes and you want to exclude both ``bat`` and ``exe`` as extensions, the pattern would get even more complicated and confusing." +#: ../../howto/regex.rst:1041 +msgid "" +"The pattern's getting really complicated now, which makes it hard to read " +"and understand. Worse, if the problem changes and you want to exclude both " +"``bat`` and ``exe`` as extensions, the pattern would get even more " +"complicated and confusing." msgstr "" +#: ../../howto/regex.rst:1046 msgid "A negative lookahead cuts through all this confusion:" msgstr "" +#: ../../howto/regex.rst:1048 msgid "``.*[.](?!bat$)[^.]*$``" msgstr "" -msgid "The negative lookahead means: if the expression ``bat`` doesn't match at this point, try the rest of the pattern; if ``bat$`` does match, the whole pattern will fail. The trailing ``$`` is required to ensure that something like ``sample.batch``, where the extension only starts with ``bat``, will be allowed. The ``[^.]*`` makes sure that the pattern works when there are multiple dots in the filename." +#: ../../howto/regex.rst:1050 +msgid "" +"The negative lookahead means: if the expression ``bat`` doesn't match at " +"this point, try the rest of the pattern; if ``bat$`` does match, the whole " +"pattern will fail. The trailing ``$`` is required to ensure that something " +"like ``sample.batch``, where the extension only starts with ``bat``, will be " +"allowed. The ``[^.]*`` makes sure that the pattern works when there are " +"multiple dots in the filename." msgstr "" -msgid "Excluding another filename extension is now easy; simply add it as an alternative inside the assertion. The following pattern excludes filenames that end in either ``bat`` or ``exe``:" +#: ../../howto/regex.rst:1057 +msgid "" +"Excluding another filename extension is now easy; simply add it as an " +"alternative inside the assertion. The following pattern excludes filenames " +"that end in either ``bat`` or ``exe``:" msgstr "" +#: ../../howto/regex.rst:1061 msgid "``.*[.](?!bat$|exe$)[^.]*$``" msgstr "" +#: ../../howto/regex.rst:1065 msgid "Modifying strings" msgstr "" -msgid "Up to this point, we've simply performed searches against a static string. Regular expressions are also commonly used to modify strings in various ways, using the following pattern methods:" +#: ../../howto/regex.rst:1067 +msgid "" +"Up to this point, we've simply performed searches against a static string. " +"Regular expressions are also commonly used to modify strings in various " +"ways, using the following pattern methods:" msgstr "" +#: ../../howto/regex.rst:1074 msgid "``split()``" msgstr "" +#: ../../howto/regex.rst:1074 msgid "Split the string into a list, splitting it wherever the RE matches" msgstr "" +#: ../../howto/regex.rst:1077 msgid "``sub()``" msgstr "" -msgid "Find all substrings where the RE matches, and replace them with a different string" +#: ../../howto/regex.rst:1077 +msgid "" +"Find all substrings where the RE matches, and replace them with a different " +"string" msgstr "" +#: ../../howto/regex.rst:1080 msgid "``subn()``" msgstr "" -msgid "Does the same thing as :meth:`!sub`, but returns the new string and the number of replacements" +#: ../../howto/regex.rst:1080 +msgid "" +"Does the same thing as :meth:`!sub`, but returns the new string and the " +"number of replacements" msgstr "" +#: ../../howto/regex.rst:1087 msgid "Splitting strings" msgstr "" -msgid "The :meth:`~re.Pattern.split` method of a pattern splits a string apart wherever the RE matches, returning a list of the pieces. It's similar to the :meth:`~str.split` method of strings but provides much more generality in the delimiters that you can split by; string :meth:`!split` only supports splitting by whitespace or by a fixed string. As you'd expect, there's a module-level :func:`re.split` function, too." +#: ../../howto/regex.rst:1089 +msgid "" +"The :meth:`~re.Pattern.split` method of a pattern splits a string apart " +"wherever the RE matches, returning a list of the pieces. It's similar to " +"the :meth:`~str.split` method of strings but provides much more generality " +"in the delimiters that you can split by; string :meth:`!split` only supports " +"splitting by whitespace or by a fixed string. As you'd expect, there's a " +"module-level :func:`re.split` function, too." msgstr "" -msgid "Split *string* by the matches of the regular expression. If capturing parentheses are used in the RE, then their contents will also be returned as part of the resulting list. If *maxsplit* is nonzero, at most *maxsplit* splits are performed." +#: ../../howto/regex.rst:1100 +msgid "" +"Split *string* by the matches of the regular expression. If capturing " +"parentheses are used in the RE, then their contents will also be returned as " +"part of the resulting list. If *maxsplit* is nonzero, at most *maxsplit* " +"splits are performed." msgstr "" -msgid "You can limit the number of splits made, by passing a value for *maxsplit*. When *maxsplit* is nonzero, at most *maxsplit* splits will be made, and the remainder of the string is returned as the final element of the list. In the following example, the delimiter is any sequence of non-alphanumeric characters. ::" +#: ../../howto/regex.rst:1105 +msgid "" +"You can limit the number of splits made, by passing a value for *maxsplit*. " +"When *maxsplit* is nonzero, at most *maxsplit* splits will be made, and the " +"remainder of the string is returned as the final element of the list. In " +"the following example, the delimiter is any sequence of non-alphanumeric " +"characters. ::" msgstr "" +#: ../../howto/regex.rst:1111 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p.split('This is a test, short and sweet, of split().')\n" @@ -1014,9 +1860,15 @@ msgid "" "['This', 'is', 'a', 'test, short and sweet, of split().']" msgstr "" -msgid "Sometimes you're not only interested in what the text between delimiters is, but also need to know what the delimiter was. If capturing parentheses are used in the RE, then their values are also returned as part of the list. Compare the following calls::" +#: ../../howto/regex.rst:1117 +msgid "" +"Sometimes you're not only interested in what the text between delimiters is, " +"but also need to know what the delimiter was. If capturing parentheses are " +"used in the RE, then their values are also returned as part of the list. " +"Compare the following calls::" msgstr "" +#: ../../howto/regex.rst:1122 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p2 = re.compile(r'(\\W+)')\n" @@ -1026,9 +1878,13 @@ msgid "" "['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']" msgstr "" -msgid "The module-level function :func:`re.split` adds the RE to be used as the first argument, but is otherwise the same. ::" +#: ../../howto/regex.rst:1129 +msgid "" +"The module-level function :func:`re.split` adds the RE to be used as the " +"first argument, but is otherwise the same. ::" msgstr "" +#: ../../howto/regex.rst:1132 msgid "" ">>> re.split(r'[\\W]+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -1038,21 +1894,39 @@ msgid "" "['Words', 'words, words.']" msgstr "" +#: ../../howto/regex.rst:1141 msgid "Search and replace" msgstr "" -msgid "Another common task is to find all the matches for a pattern, and replace them with a different string. The :meth:`~re.Pattern.sub` method takes a replacement value, which can be either a string or a function, and the string to be processed." +#: ../../howto/regex.rst:1143 +msgid "" +"Another common task is to find all the matches for a pattern, and replace " +"them with a different string. The :meth:`~re.Pattern.sub` method takes a " +"replacement value, which can be either a string or a function, and the " +"string to be processed." msgstr "" -msgid "Returns the string obtained by replacing the leftmost non-overlapping occurrences of the RE in *string* by the replacement *replacement*. If the pattern isn't found, *string* is returned unchanged." +#: ../../howto/regex.rst:1150 +msgid "" +"Returns the string obtained by replacing the leftmost non-overlapping " +"occurrences of the RE in *string* by the replacement *replacement*. If the " +"pattern isn't found, *string* is returned unchanged." msgstr "" -msgid "The optional argument *count* is the maximum number of pattern occurrences to be replaced; *count* must be a non-negative integer. The default value of 0 means to replace all occurrences." +#: ../../howto/regex.rst:1154 +msgid "" +"The optional argument *count* is the maximum number of pattern occurrences " +"to be replaced; *count* must be a non-negative integer. The default value " +"of 0 means to replace all occurrences." msgstr "" -msgid "Here's a simple example of using the :meth:`~re.Pattern.sub` method. It replaces colour names with the word ``colour``::" +#: ../../howto/regex.rst:1158 +msgid "" +"Here's a simple example of using the :meth:`~re.Pattern.sub` method. It " +"replaces colour names with the word ``colour``::" msgstr "" +#: ../../howto/regex.rst:1161 msgid "" ">>> p = re.compile('(blue|white|red)')\n" ">>> p.sub('colour', 'blue socks and red shoes')\n" @@ -1061,9 +1935,14 @@ msgid "" "'colour socks and red shoes'" msgstr "" -msgid "The :meth:`~re.Pattern.subn` method does the same work, but returns a 2-tuple containing the new string value and the number of replacements that were performed::" +#: ../../howto/regex.rst:1167 +msgid "" +"The :meth:`~re.Pattern.subn` method does the same work, but returns a 2-" +"tuple containing the new string value and the number of replacements that " +"were performed::" msgstr "" +#: ../../howto/regex.rst:1170 msgid "" ">>> p = re.compile('(blue|white|red)')\n" ">>> p.subn('colour', 'blue socks and red shoes')\n" @@ -1072,30 +1951,56 @@ msgid "" "('no colours at all', 0)" msgstr "" -msgid "Empty matches are replaced only when they're not adjacent to a previous empty match. ::" +#: ../../howto/regex.rst:1176 +msgid "" +"Empty matches are replaced only when they're not adjacent to a previous " +"empty match. ::" msgstr "" +#: ../../howto/regex.rst:1179 msgid "" ">>> p = re.compile('x*')\n" ">>> p.sub('-', 'abxd')\n" "'-a-b--d-'" msgstr "" -msgid "If *replacement* is a string, any backslash escapes in it are processed. That is, ``\\n`` is converted to a single newline character, ``\\r`` is converted to a carriage return, and so forth. Unknown escapes such as ``\\&`` are left alone. Backreferences, such as ``\\6``, are replaced with the substring matched by the corresponding group in the RE. This lets you incorporate portions of the original text in the resulting replacement string." +#: ../../howto/regex.rst:1183 +msgid "" +"If *replacement* is a string, any backslash escapes in it are processed. " +"That is, ``\\n`` is converted to a single newline character, ``\\r`` is " +"converted to a carriage return, and so forth. Unknown escapes such as " +"``\\&`` are left alone. Backreferences, such as ``\\6``, are replaced with " +"the substring matched by the corresponding group in the RE. This lets you " +"incorporate portions of the original text in the resulting replacement " +"string." msgstr "" -msgid "This example matches the word ``section`` followed by a string enclosed in ``{``, ``}``, and changes ``section`` to ``subsection``::" +#: ../../howto/regex.rst:1190 +msgid "" +"This example matches the word ``section`` followed by a string enclosed in " +"``{``, ``}``, and changes ``section`` to ``subsection``::" msgstr "" +#: ../../howto/regex.rst:1193 msgid "" ">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n" ">>> p.sub(r'subsection{\\1}','section{First} section{second}')\n" "'subsection{First} subsection{second}'" msgstr "" -msgid "There's also a syntax for referring to named groups as defined by the ``(?P...)`` syntax. ``\\g`` will use the substring matched by the group named ``name``, and ``\\g`` uses the corresponding group number. ``\\g<2>`` is therefore equivalent to ``\\2``, but isn't ambiguous in a replacement string such as ``\\g<2>0``. (``\\20`` would be interpreted as a reference to group 20, not a reference to group 2 followed by the literal character ``'0'``.) The following substitutions are all equivalent, but use all three variations of the replacement string. ::" +#: ../../howto/regex.rst:1197 +msgid "" +"There's also a syntax for referring to named groups as defined by the ``(?" +"P...)`` syntax. ``\\g`` will use the substring matched by the " +"group named ``name``, and ``\\g`` uses the corresponding group " +"number. ``\\g<2>`` is therefore equivalent to ``\\2``, but isn't ambiguous " +"in a replacement string such as ``\\g<2>0``. (``\\20`` would be interpreted " +"as a reference to group 20, not a reference to group 2 followed by the " +"literal character ``'0'``.) The following substitutions are all equivalent, " +"but use all three variations of the replacement string. ::" msgstr "" +#: ../../howto/regex.rst:1206 msgid "" ">>> p = re.compile('section{ (?P [^}]* ) }', re.VERBOSE)\n" ">>> p.sub(r'subsection{\\1}','section{First}')\n" @@ -1106,12 +2011,22 @@ msgid "" "'subsection{First}'" msgstr "" -msgid "*replacement* can also be a function, which gives you even more control. If *replacement* is a function, the function is called for every non-overlapping occurrence of *pattern*. On each call, the function is passed a :ref:`match object ` argument for the match and can use this information to compute the desired replacement string and return it." +#: ../../howto/regex.rst:1214 +msgid "" +"*replacement* can also be a function, which gives you even more control. If " +"*replacement* is a function, the function is called for every non-" +"overlapping occurrence of *pattern*. On each call, the function is passed " +"a :ref:`match object ` argument for the match and can use " +"this information to compute the desired replacement string and return it." msgstr "" -msgid "In the following example, the replacement function translates decimals into hexadecimal::" +#: ../../howto/regex.rst:1220 +msgid "" +"In the following example, the replacement function translates decimals into " +"hexadecimal::" msgstr "" +#: ../../howto/regex.rst:1223 msgid "" ">>> def hexrepl(match):\n" "... \"Return the hex string for a decimal number\"\n" @@ -1123,36 +2038,87 @@ msgid "" "'Call 0xffd2 for printing, 0xc000 for user code.'" msgstr "" -msgid "When using the module-level :func:`re.sub` function, the pattern is passed as the first argument. The pattern may be provided as an object or as a string; if you need to specify regular expression flags, you must either use a pattern object as the first parameter, or use embedded modifiers in the pattern string, e.g. ``sub(\"(?i)b+\", \"x\", \"bbbb BBBB\")`` returns ``'x x'``." +#: ../../howto/regex.rst:1232 +msgid "" +"When using the module-level :func:`re.sub` function, the pattern is passed " +"as the first argument. The pattern may be provided as an object or as a " +"string; if you need to specify regular expression flags, you must either use " +"a pattern object as the first parameter, or use embedded modifiers in the " +"pattern string, e.g. ``sub(\"(?i)b+\", \"x\", \"bbbb BBBB\")`` returns ``'x " +"x'``." msgstr "" +#: ../../howto/regex.rst:1240 msgid "Common problems" msgstr "" -msgid "Regular expressions are a powerful tool for some applications, but in some ways their behaviour isn't intuitive and at times they don't behave the way you may expect them to. This section will point out some of the most common pitfalls." +#: ../../howto/regex.rst:1242 +msgid "" +"Regular expressions are a powerful tool for some applications, but in some " +"ways their behaviour isn't intuitive and at times they don't behave the way " +"you may expect them to. This section will point out some of the most common " +"pitfalls." msgstr "" +#: ../../howto/regex.rst:1248 msgid "Use string methods" msgstr "" -msgid "Sometimes using the :mod:`re` module is a mistake. If you're matching a fixed string, or a single character class, and you're not using any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the full power of regular expressions may not be required. Strings have several methods for performing operations with fixed strings and they're usually much faster, because the implementation is a single small C loop that's been optimized for the purpose, instead of the large, more generalized regular expression engine." -msgstr "" - -msgid "One example might be replacing a single fixed string with another one; for example, you might replace ``word`` with ``deed``. :func:`re.sub` seems like the function to use for this, but consider the :meth:`~str.replace` method. Note that :meth:`!replace` will also replace ``word`` inside words, turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would have done that, too. (To avoid performing the substitution on parts of words, the pattern would have to be ``\\bword\\b``, in order to require that ``word`` have a word boundary on either side. This takes the job beyond :meth:`!replace`'s abilities.)" +#: ../../howto/regex.rst:1250 +msgid "" +"Sometimes using the :mod:`re` module is a mistake. If you're matching a " +"fixed string, or a single character class, and you're not using " +"any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the " +"full power of regular expressions may not be required. Strings have several " +"methods for performing operations with fixed strings and they're usually " +"much faster, because the implementation is a single small C loop that's been " +"optimized for the purpose, instead of the large, more generalized regular " +"expression engine." msgstr "" -msgid "Another common task is deleting every occurrence of a single character from a string or replacing it with another single character. You might do this with something like ``re.sub('\\n', ' ', S)``, but :meth:`~str.translate` is capable of doing both tasks and will be faster than any regular expression operation can be." +#: ../../howto/regex.rst:1258 +msgid "" +"One example might be replacing a single fixed string with another one; for " +"example, you might replace ``word`` with ``deed``. :func:`re.sub` seems " +"like the function to use for this, but consider the :meth:`~str.replace` " +"method. Note that :meth:`!replace` will also replace ``word`` inside words, " +"turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would " +"have done that, too. (To avoid performing the substitution on parts of " +"words, the pattern would have to be ``\\bword\\b``, in order to require that " +"``word`` have a word boundary on either side. This takes the job " +"beyond :meth:`!replace`'s abilities.)" +msgstr "" + +#: ../../howto/regex.rst:1267 +msgid "" +"Another common task is deleting every occurrence of a single character from " +"a string or replacing it with another single character. You might do this " +"with something like ``re.sub('\\n', ' ', S)``, but :meth:`~str.translate` is " +"capable of doing both tasks and will be faster than any regular expression " +"operation can be." msgstr "" -msgid "In short, before turning to the :mod:`re` module, consider whether your problem can be solved with a faster and simpler string method." +#: ../../howto/regex.rst:1273 +msgid "" +"In short, before turning to the :mod:`re` module, consider whether your " +"problem can be solved with a faster and simpler string method." msgstr "" +#: ../../howto/regex.rst:1278 msgid "match() versus search()" msgstr "" -msgid "The :func:`~re.match` function only checks if the RE matches at the beginning of the string while :func:`~re.search` will scan forward through the string for a match. It's important to keep this distinction in mind. Remember, :func:`!match` will only report a successful match which will start at 0; if the match wouldn't start at zero, :func:`!match` will *not* report it. ::" +#: ../../howto/regex.rst:1280 +msgid "" +"The :func:`~re.match` function only checks if the RE matches at the " +"beginning of the string while :func:`~re.search` will scan forward through " +"the string for a match. It's important to keep this distinction in mind. " +"Remember, :func:`!match` will only report a successful match which will " +"start at 0; if the match wouldn't start at zero, :func:`!match` will *not* " +"report it. ::" msgstr "" +#: ../../howto/regex.rst:1286 msgid "" ">>> print(re.match('super', 'superstition').span())\n" "(0, 5)\n" @@ -1160,9 +2126,13 @@ msgid "" "None" msgstr "" -msgid "On the other hand, :func:`~re.search` will scan forward through the string, reporting the first match it finds. ::" +#: ../../howto/regex.rst:1291 +msgid "" +"On the other hand, :func:`~re.search` will scan forward through the string, " +"reporting the first match it finds. ::" msgstr "" +#: ../../howto/regex.rst:1294 msgid "" ">>> print(re.search('super', 'superstition').span())\n" "(0, 5)\n" @@ -1170,18 +2140,40 @@ msgid "" "(2, 7)" msgstr "" -msgid "Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``.*`` to the front of your RE. Resist this temptation and use :func:`re.search` instead. The regular expression compiler does some analysis of REs in order to speed up the process of looking for a match. One such analysis figures out what the first character of a match must be; for example, a pattern starting with ``Crow`` must match starting with a ``'C'``. The analysis lets the engine quickly scan through the string looking for the starting character, only trying the full match if a ``'C'`` is found." -msgstr "" - -msgid "Adding ``.*`` defeats this optimization, requiring scanning to the end of the string and then backtracking to find a match for the rest of the RE. Use :func:`re.search` instead." +#: ../../howto/regex.rst:1299 +msgid "" +"Sometimes you'll be tempted to keep using :func:`re.match`, and just add " +"``.*`` to the front of your RE. Resist this temptation and " +"use :func:`re.search` instead. The regular expression compiler does some " +"analysis of REs in order to speed up the process of looking for a match. " +"One such analysis figures out what the first character of a match must be; " +"for example, a pattern starting with ``Crow`` must match starting with a " +"``'C'``. The analysis lets the engine quickly scan through the string " +"looking for the starting character, only trying the full match if a ``'C'`` " +"is found." +msgstr "" + +#: ../../howto/regex.rst:1308 +msgid "" +"Adding ``.*`` defeats this optimization, requiring scanning to the end of " +"the string and then backtracking to find a match for the rest of the RE. " +"Use :func:`re.search` instead." msgstr "" +#: ../../howto/regex.rst:1314 msgid "Greedy versus non-greedy" msgstr "" -msgid "When repeating a regular expression, as in ``a*``, the resulting action is to consume as much of the pattern as possible. This fact often bites you when you're trying to match a pair of balanced delimiters, such as the angle brackets surrounding an HTML tag. The naive pattern for matching a single HTML tag doesn't work because of the greedy nature of ``.*``. ::" +#: ../../howto/regex.rst:1316 +msgid "" +"When repeating a regular expression, as in ``a*``, the resulting action is " +"to consume as much of the pattern as possible. This fact often bites you " +"when you're trying to match a pair of balanced delimiters, such as the angle " +"brackets surrounding an HTML tag. The naive pattern for matching a single " +"HTML tag doesn't work because of the greedy nature of ``.*``. ::" msgstr "" +#: ../../howto/regex.rst:1322 msgid "" ">>> s = 'Title'\n" ">>> len(s)\n" @@ -1192,32 +2184,72 @@ msgid "" "Title" msgstr "" -msgid "The RE matches the ``'<'`` in ``''``, and the ``.*`` consumes the rest of the string. There's still more left in the RE, though, and the ``>`` can't match at the end of the string, so the regular expression engine has to backtrack character by character until it finds a match for the ``>``. The final match extends from the ``'<'`` in ``''`` to the ``'>'`` in ``''``, which isn't what you want." +#: ../../howto/regex.rst:1330 +msgid "" +"The RE matches the ``'<'`` in ``''``, and the ``.*`` consumes the rest " +"of the string. There's still more left in the RE, though, and the ``>`` " +"can't match at the end of the string, so the regular expression engine has " +"to backtrack character by character until it finds a match for the ``>``. " +"The final match extends from the ``'<'`` in ``''`` to the ``'>'`` in " +"``''``, which isn't what you want." msgstr "" -msgid "In this case, the solution is to use the non-greedy quantifiers ``*?``, ``+?``, ``??``, or ``{m,n}?``, which match as *little* text as possible. In the above example, the ``'>'`` is tried immediately after the first ``'<'`` matches, and when it fails, the engine advances a character at a time, retrying the ``'>'`` at every step. This produces just the right result::" +#: ../../howto/regex.rst:1337 +msgid "" +"In this case, the solution is to use the non-greedy quantifiers ``*?``, ``+?" +"``, ``??``, or ``{m,n}?``, which match as *little* text as possible. In the " +"above example, the ``'>'`` is tried immediately after the first ``'<'`` " +"matches, and when it fails, the engine advances a character at a time, " +"retrying the ``'>'`` at every step. This produces just the right result::" msgstr "" +#: ../../howto/regex.rst:1343 msgid "" ">>> print(re.match('<.*?>', s).group())\n" "" msgstr "" -msgid "(Note that parsing HTML or XML with regular expressions is painful. Quick-and-dirty patterns will handle common cases, but HTML and XML have special cases that will break the obvious regular expression; by the time you've written a regular expression that handles all of the possible cases, the patterns will be *very* complicated. Use an HTML or XML parser module for such tasks.)" +#: ../../howto/regex.rst:1346 +msgid "" +"(Note that parsing HTML or XML with regular expressions is painful. Quick-" +"and-dirty patterns will handle common cases, but HTML and XML have special " +"cases that will break the obvious regular expression; by the time you've " +"written a regular expression that handles all of the possible cases, the " +"patterns will be *very* complicated. Use an HTML or XML parser module for " +"such tasks.)" msgstr "" +#: ../../howto/regex.rst:1354 msgid "Using re.VERBOSE" msgstr "" -msgid "By now you've probably noticed that regular expressions are a very compact notation, but they're not terribly readable. REs of moderate complexity can become lengthy collections of backslashes, parentheses, and metacharacters, making them difficult to read and understand." +#: ../../howto/regex.rst:1356 +msgid "" +"By now you've probably noticed that regular expressions are a very compact " +"notation, but they're not terribly readable. REs of moderate complexity can " +"become lengthy collections of backslashes, parentheses, and metacharacters, " +"making them difficult to read and understand." msgstr "" -msgid "For such REs, specifying the :const:`re.VERBOSE` flag when compiling the regular expression can be helpful, because it allows you to format the regular expression more clearly." +#: ../../howto/regex.rst:1361 +msgid "" +"For such REs, specifying the :const:`re.VERBOSE` flag when compiling the " +"regular expression can be helpful, because it allows you to format the " +"regular expression more clearly." msgstr "" -msgid "The ``re.VERBOSE`` flag has several effects. Whitespace in the regular expression that *isn't* inside a character class is ignored. This means that an expression such as ``dog | cat`` is equivalent to the less readable ``dog|cat``, but ``[a b]`` will still match the characters ``'a'``, ``'b'``, or a space. In addition, you can also put comments inside a RE; comments extend from a ``#`` character to the next newline. When used with triple-quoted strings, this enables REs to be formatted more neatly::" +#: ../../howto/regex.rst:1365 +msgid "" +"The ``re.VERBOSE`` flag has several effects. Whitespace in the regular " +"expression that *isn't* inside a character class is ignored. This means " +"that an expression such as ``dog | cat`` is equivalent to the less readable " +"``dog|cat``, but ``[a b]`` will still match the characters ``'a'``, ``'b'``, " +"or a space. In addition, you can also put comments inside a RE; comments " +"extend from a ``#`` character to the next newline. When used with triple-" +"quoted strings, this enables REs to be formatted more neatly::" msgstr "" +#: ../../howto/regex.rst:1373 msgid "" "pat = re.compile(r\"\"\"\n" " \\s* # Skip leading whitespace\n" @@ -1229,17 +2261,33 @@ msgid "" "\"\"\", re.VERBOSE)" msgstr "" +#: ../../howto/regex.rst:1382 msgid "This is far more readable than::" msgstr "" +#: ../../howto/regex.rst:1384 msgid "pat = re.compile(r\"\\s*(?P
[^:]+)\\s*:(?P.*?)\\s*$\")" msgstr "" +#: ../../howto/regex.rst:1388 msgid "Feedback" msgstr "" -msgid "Regular expressions are a complicated topic. Did this document help you understand them? Were there parts that were unclear, or problems you encountered that weren't covered here? If so, please send suggestions for improvements to the :ref:`issue tracker `." +#: ../../howto/regex.rst:1390 +msgid "" +"Regular expressions are a complicated topic. Did this document help you " +"understand them? Were there parts that were unclear, or problems you " +"encountered that weren't covered here? If so, please send suggestions for " +"improvements to the :ref:`issue tracker `." msgstr "" -msgid "The most complete book on regular expressions is almost certainly Jeffrey Friedl's Mastering Regular Expressions, published by O'Reilly. Unfortunately, it exclusively concentrates on Perl and Java's flavours of regular expressions, and doesn't contain any Python material at all, so it won't be useful as a reference for programming in Python. (The first edition covered Python's now-removed :mod:`!regex` module, which won't help you much.) Consider checking it out from your library." +#: ../../howto/regex.rst:1395 +msgid "" +"The most complete book on regular expressions is almost certainly Jeffrey " +"Friedl's Mastering Regular Expressions, published by O'Reilly. " +"Unfortunately, it exclusively concentrates on Perl and Java's flavours of " +"regular expressions, and doesn't contain any Python material at all, so it " +"won't be useful as a reference for programming in Python. (The first " +"edition covered Python's now-removed :mod:`!regex` module, which won't help " +"you much.) Consider checking it out from your library." msgstr "" diff --git a/howto/remote_debugging.po b/howto/remote_debugging.po index 0a9ba45b1..b29df84dd 100644 --- a/howto/remote_debugging.po +++ b/howto/remote_debugging.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,162 +19,293 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../howto/remote_debugging.rst:4 msgid "Remote debugging attachment protocol" msgstr "" -msgid "This protocol enables external tools to attach to a running CPython process and execute Python code remotely." +#: ../../howto/remote_debugging.rst:6 +msgid "" +"This protocol enables external tools to attach to a running CPython process " +"and execute Python code remotely." msgstr "" -msgid "Most platforms require elevated privileges to attach to another Python process." +#: ../../howto/remote_debugging.rst:9 +msgid "" +"Most platforms require elevated privileges to attach to another Python " +"process." msgstr "" +#: ../../howto/remote_debugging.rst:12 msgid "Disabling remote debugging" msgstr "" +#: ../../howto/remote_debugging.rst:14 msgid "To disable remote debugging support, use any of the following:" msgstr "" -msgid "Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to ``1`` before starting the interpreter." +#: ../../howto/remote_debugging.rst:16 +msgid "" +"Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to ``1`` " +"before starting the interpreter." msgstr "" +#: ../../howto/remote_debugging.rst:18 msgid "Use the :option:`-X disable_remote_debug` command-line option." msgstr "" +#: ../../howto/remote_debugging.rst:19 msgid "Compile Python with the :option:`--without-remote-debug` build flag." msgstr "" +#: ../../howto/remote_debugging.rst:24 msgid "Permission requirements" msgstr "" -msgid "Attaching to a running Python process for remote debugging requires elevated privileges on most platforms. The specific requirements and troubleshooting steps depend on your operating system:" +#: ../../howto/remote_debugging.rst:26 +msgid "" +"Attaching to a running Python process for remote debugging requires elevated " +"privileges on most platforms. The specific requirements and troubleshooting " +"steps depend on your operating system:" msgstr "" +#: ../../howto/remote_debugging.rst:31 msgid "Linux" msgstr "" -msgid "The tracer process must have the ``CAP_SYS_PTRACE`` capability or equivalent privileges. You can only trace processes you own and can signal. Tracing may fail if the process is already being traced, or if it is running with set-user-ID or set-group-ID. Security modules like Yama may further restrict tracing." +#: ../../howto/remote_debugging.rst:32 +msgid "" +"The tracer process must have the ``CAP_SYS_PTRACE`` capability or equivalent " +"privileges. You can only trace processes you own and can signal. Tracing may " +"fail if the process is already being traced, or if it is running with set-" +"user-ID or set-group-ID. Security modules like Yama may further restrict " +"tracing." msgstr "" +#: ../../howto/remote_debugging.rst:38 msgid "To temporarily relax ptrace restrictions (until reboot), run:" msgstr "" +#: ../../howto/remote_debugging.rst:40 msgid "``echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope``" msgstr "" -msgid "Disabling ``ptrace_scope`` reduces system hardening and should only be done in trusted environments." +#: ../../howto/remote_debugging.rst:44 +msgid "" +"Disabling ``ptrace_scope`` reduces system hardening and should only be done " +"in trusted environments." msgstr "" -msgid "If running inside a container, use ``--cap-add=SYS_PTRACE`` or ``--privileged``, and run as root if needed." +#: ../../howto/remote_debugging.rst:47 +msgid "" +"If running inside a container, use ``--cap-add=SYS_PTRACE`` or ``--" +"privileged``, and run as root if needed." msgstr "" +#: ../../howto/remote_debugging.rst:50 msgid "Try re-running the command with elevated privileges:" msgstr "" +#: ../../howto/remote_debugging.rst:52 msgid "``sudo -E !!``" msgstr "" +#: ../../howto/remote_debugging.rst:56 msgid "macOS" msgstr "" -msgid "To attach to another process, you typically need to run your debugging tool with elevated privileges. This can be done by using ``sudo`` or running as root." +#: ../../howto/remote_debugging.rst:57 +msgid "" +"To attach to another process, you typically need to run your debugging tool " +"with elevated privileges. This can be done by using ``sudo`` or running as " +"root." msgstr "" -msgid "Even when attaching to processes you own, macOS may block debugging unless the debugger is run with root privileges due to system security restrictions." +#: ../../howto/remote_debugging.rst:61 +msgid "" +"Even when attaching to processes you own, macOS may block debugging unless " +"the debugger is run with root privileges due to system security restrictions." msgstr "" +#: ../../howto/remote_debugging.rst:66 msgid "Windows" msgstr "" -msgid "To attach to another process, you usually need to run your debugging tool with administrative privileges. Start the command prompt or terminal as Administrator." +#: ../../howto/remote_debugging.rst:67 +msgid "" +"To attach to another process, you usually need to run your debugging tool " +"with administrative privileges. Start the command prompt or terminal as " +"Administrator." msgstr "" -msgid "Some processes may still be inaccessible even with Administrator rights, unless you have the ``SeDebugPrivilege`` privilege enabled." +#: ../../howto/remote_debugging.rst:71 +msgid "" +"Some processes may still be inaccessible even with Administrator rights, " +"unless you have the ``SeDebugPrivilege`` privilege enabled." msgstr "" -msgid "To resolve file or folder access issues, adjust the security permissions:" +#: ../../howto/remote_debugging.rst:74 +msgid "" +"To resolve file or folder access issues, adjust the security permissions:" msgstr "" +#: ../../howto/remote_debugging.rst:76 msgid "Right-click the file or folder and select **Properties**." msgstr "" +#: ../../howto/remote_debugging.rst:77 msgid "Go to the **Security** tab to view users and groups with access." msgstr "" +#: ../../howto/remote_debugging.rst:78 msgid "Click **Edit** to modify permissions." msgstr "" +#: ../../howto/remote_debugging.rst:79 msgid "Select your user account." msgstr "" +#: ../../howto/remote_debugging.rst:80 msgid "In **Permissions**, check **Read** or **Full control** as needed." msgstr "" +#: ../../howto/remote_debugging.rst:81 msgid "Click **Apply**, then **OK** to confirm." msgstr "" -msgid "Ensure you've satisfied all :ref:`permission-requirements` before proceeding." +#: ../../howto/remote_debugging.rst:86 +msgid "" +"Ensure you've satisfied all :ref:`permission-requirements` before proceeding." msgstr "" -msgid "This section describes the low-level protocol that enables external tools to inject and execute a Python script within a running CPython process." +#: ../../howto/remote_debugging.rst:88 +msgid "" +"This section describes the low-level protocol that enables external tools to " +"inject and execute a Python script within a running CPython process." msgstr "" -msgid "This mechanism forms the basis of the :func:`sys.remote_exec` function, which instructs a remote Python process to execute a ``.py`` file. However, this section does not document the usage of that function. Instead, it provides a detailed explanation of the underlying protocol, which takes as input the ``pid`` of a target Python process and the path to a Python source file to be executed. This information supports independent reimplementation of the protocol, regardless of programming language." +#: ../../howto/remote_debugging.rst:91 +msgid "" +"This mechanism forms the basis of the :func:`sys.remote_exec` function, " +"which instructs a remote Python process to execute a ``.py`` file. However, " +"this section does not document the usage of that function. Instead, it " +"provides a detailed explanation of the underlying protocol, which takes as " +"input the ``pid`` of a target Python process and the path to a Python source " +"file to be executed. This information supports independent reimplementation " +"of the protocol, regardless of programming language." msgstr "" -msgid "The execution of the injected script depends on the interpreter reaching a safe evaluation point. As a result, execution may be delayed depending on the runtime state of the target process." +#: ../../howto/remote_debugging.rst:101 +msgid "" +"The execution of the injected script depends on the interpreter reaching a " +"safe evaluation point. As a result, execution may be delayed depending on " +"the runtime state of the target process." msgstr "" -msgid "Once injected, the script is executed by the interpreter within the target process the next time a safe evaluation point is reached. This approach enables remote execution capabilities without modifying the behavior or structure of the running Python application." +#: ../../howto/remote_debugging.rst:105 +msgid "" +"Once injected, the script is executed by the interpreter within the target " +"process the next time a safe evaluation point is reached. This approach " +"enables remote execution capabilities without modifying the behavior or " +"structure of the running Python application." msgstr "" -msgid "Subsequent sections provide a step-by-step description of the protocol, including techniques for locating interpreter structures in memory, safely accessing internal fields, and triggering code execution. Platform-specific variations are noted where applicable, and example implementations are included to clarify each operation." +#: ../../howto/remote_debugging.rst:110 +msgid "" +"Subsequent sections provide a step-by-step description of the protocol, " +"including techniques for locating interpreter structures in memory, safely " +"accessing internal fields, and triggering code execution. Platform-specific " +"variations are noted where applicable, and example implementations are " +"included to clarify each operation." msgstr "" +#: ../../howto/remote_debugging.rst:117 msgid "Locating the PyRuntime structure" msgstr "" -msgid "CPython places the ``PyRuntime`` structure in a dedicated binary section to help external tools find it at runtime. The name and format of this section vary by platform. For example, ``.PyRuntime`` is used on ELF systems, and ``__DATA,__PyRuntime`` is used on macOS. Tools can find the offset of this structure by examining the binary on disk." +#: ../../howto/remote_debugging.rst:119 +msgid "" +"CPython places the ``PyRuntime`` structure in a dedicated binary section to " +"help external tools find it at runtime. The name and format of this section " +"vary by platform. For example, ``.PyRuntime`` is used on ELF systems, and " +"``__DATA,__PyRuntime`` is used on macOS. Tools can find the offset of this " +"structure by examining the binary on disk." msgstr "" -msgid "The ``PyRuntime`` structure contains CPython’s global interpreter state and provides access to other internal data, including the list of interpreters, thread states, and debugger support fields." +#: ../../howto/remote_debugging.rst:125 +msgid "" +"The ``PyRuntime`` structure contains CPython’s global interpreter state and " +"provides access to other internal data, including the list of interpreters, " +"thread states, and debugger support fields." msgstr "" -msgid "To work with a remote Python process, a debugger must first find the memory address of the ``PyRuntime`` structure in the target process. This address can’t be hardcoded or calculated from a symbol name, because it depends on where the operating system loaded the binary." +#: ../../howto/remote_debugging.rst:129 +msgid "" +"To work with a remote Python process, a debugger must first find the memory " +"address of the ``PyRuntime`` structure in the target process. This address " +"can’t be hardcoded or calculated from a symbol name, because it depends on " +"where the operating system loaded the binary." msgstr "" -msgid "The method for finding ``PyRuntime`` depends on the platform, but the steps are the same in general:" +#: ../../howto/remote_debugging.rst:134 +msgid "" +"The method for finding ``PyRuntime`` depends on the platform, but the steps " +"are the same in general:" msgstr "" -msgid "Find the base address where the Python binary or shared library was loaded in the target process." +#: ../../howto/remote_debugging.rst:137 +msgid "" +"Find the base address where the Python binary or shared library was loaded " +"in the target process." msgstr "" -msgid "Use the on-disk binary to locate the offset of the ``.PyRuntime`` section." +#: ../../howto/remote_debugging.rst:139 +msgid "" +"Use the on-disk binary to locate the offset of the ``.PyRuntime`` section." msgstr "" -msgid "Add the section offset to the base address to compute the address in memory." +#: ../../howto/remote_debugging.rst:140 +msgid "" +"Add the section offset to the base address to compute the address in memory." msgstr "" -msgid "The sections below explain how to do this on each supported platform and include example code." +#: ../../howto/remote_debugging.rst:142 +msgid "" +"The sections below explain how to do this on each supported platform and " +"include example code." msgstr "" +#: ../../howto/remote_debugging.rst:146 msgid "Linux (ELF)" msgstr "" +#: ../../howto/remote_debugging.rst:147 msgid "To find the ``PyRuntime`` structure on Linux:" msgstr "" -msgid "Read the process’s memory map (for example, ``/proc//maps``) to find the address where the Python executable or ``libpython`` was loaded." +#: ../../howto/remote_debugging.rst:149 +msgid "" +"Read the process’s memory map (for example, ``/proc//maps``) to find " +"the address where the Python executable or ``libpython`` was loaded." msgstr "" -msgid "Parse the ELF section headers in the binary to get the offset of the ``.PyRuntime`` section." +#: ../../howto/remote_debugging.rst:151 +msgid "" +"Parse the ELF section headers in the binary to get the offset of the " +"``.PyRuntime`` section." msgstr "" -msgid "Add that offset to the base address from step 1 to get the memory address of ``PyRuntime``." +#: ../../howto/remote_debugging.rst:153 +msgid "" +"Add that offset to the base address from step 1 to get the memory address of " +"``PyRuntime``." msgstr "" +#: ../../howto/remote_debugging.rst:156 ../../howto/remote_debugging.rst:218 +#: ../../howto/remote_debugging.rst:288 ../../howto/remote_debugging.rst:557 msgid "The following is an example implementation::" msgstr "" +#: ../../howto/remote_debugging.rst:158 msgid "" "def find_py_runtime_linux(pid: int) -> int:\n" " # Step 1: Try to find the Python executable in memory\n" @@ -197,30 +328,70 @@ msgid "" " return base_address + section_offset" msgstr "" -msgid "On Linux systems, there are two main approaches to read memory from another process. The first is through the ``/proc`` filesystem, specifically by reading from ``/proc/[pid]/mem`` which provides direct access to the process's memory. This requires appropriate permissions - either being the same user as the target process or having root access. The second approach is using the ``process_vm_readv()`` system call which provides a more efficient way to copy memory between processes. While ptrace's ``PTRACE_PEEKTEXT`` operation can also be used to read memory, it is significantly slower as it only reads one word at a time and requires multiple context switches between the tracer and tracee processes." -msgstr "" - -msgid "For parsing ELF sections, the process involves reading and interpreting the ELF file format structures from the binary file on disk. The ELF header contains a pointer to the section header table. Each section header contains metadata about a section including its name (stored in a separate string table), offset, and size. To find a specific section like .PyRuntime, you need to walk through these headers and match the section name. The section header then provides the offset where that section exists in the file, which can be used to calculate its runtime address when the binary is loaded into memory." -msgstr "" - -msgid "You can read more about the ELF file format in the `ELF specification `_." +#: ../../howto/remote_debugging.rst:179 +msgid "" +"On Linux systems, there are two main approaches to read memory from another " +"process. The first is through the ``/proc`` filesystem, specifically by " +"reading from ``/proc/[pid]/mem`` which provides direct access to the " +"process's memory. This requires appropriate permissions - either being the " +"same user as the target process or having root access. The second approach " +"is using the ``process_vm_readv()`` system call which provides a more " +"efficient way to copy memory between processes. While ptrace's " +"``PTRACE_PEEKTEXT`` operation can also be used to read memory, it is " +"significantly slower as it only reads one word at a time and requires " +"multiple context switches between the tracer and tracee processes." +msgstr "" + +#: ../../howto/remote_debugging.rst:190 +msgid "" +"For parsing ELF sections, the process involves reading and interpreting the " +"ELF file format structures from the binary file on disk. The ELF header " +"contains a pointer to the section header table. Each section header contains " +"metadata about a section including its name (stored in a separate string " +"table), offset, and size. To find a specific section like .PyRuntime, you " +"need to walk through these headers and match the section name. The section " +"header then provides the offset where that section exists in the file, which " +"can be used to calculate its runtime address when the binary is loaded into " +"memory." +msgstr "" + +#: ../../howto/remote_debugging.rst:199 +msgid "" +"You can read more about the ELF file format in the `ELF specification " +"`_." msgstr "" +#: ../../howto/remote_debugging.rst:204 msgid "macOS (Mach-O)" msgstr "" +#: ../../howto/remote_debugging.rst:205 msgid "To find the ``PyRuntime`` structure on macOS:" msgstr "" -msgid "Call ``task_for_pid()`` to get the ``mach_port_t`` task port for the target process. This handle is needed to read memory using APIs like ``mach_vm_read_overwrite`` and ``mach_vm_region``." +#: ../../howto/remote_debugging.rst:207 +msgid "" +"Call ``task_for_pid()`` to get the ``mach_port_t`` task port for the target " +"process. This handle is needed to read memory using APIs like " +"``mach_vm_read_overwrite`` and ``mach_vm_region``." msgstr "" -msgid "Scan the memory regions to find the one containing the Python executable or ``libpython``." +#: ../../howto/remote_debugging.rst:210 +msgid "" +"Scan the memory regions to find the one containing the Python executable or " +"``libpython``." msgstr "" -msgid "Load the binary file from disk and parse the Mach-O headers to find the section named ``PyRuntime`` in the ``__DATA`` segment. On macOS, symbol names are automatically prefixed with an underscore, so the ``PyRuntime`` symbol appears as ``_PyRuntime`` in the symbol table, but the section name is not affected." +#: ../../howto/remote_debugging.rst:212 +msgid "" +"Load the binary file from disk and parse the Mach-O headers to find the " +"section named ``PyRuntime`` in the ``__DATA`` segment. On macOS, symbol " +"names are automatically prefixed with an underscore, so the ``PyRuntime`` " +"symbol appears as ``_PyRuntime`` in the symbol table, but the section name " +"is not affected." msgstr "" +#: ../../howto/remote_debugging.rst:220 msgid "" "def find_py_runtime_macos(pid: int) -> int:\n" " # Step 1: Get access to the process's memory\n" @@ -246,36 +417,83 @@ msgid "" " return base_address + section_offset" msgstr "" -msgid "On macOS, accessing another process's memory requires using Mach-O specific APIs and file formats. The first step is obtaining a ``task_port`` handle via ``task_for_pid()``, which provides access to the target process's memory space. This handle enables memory operations through APIs like ``mach_vm_read_overwrite()``." +#: ../../howto/remote_debugging.rst:243 +msgid "" +"On macOS, accessing another process's memory requires using Mach-O specific " +"APIs and file formats. The first step is obtaining a ``task_port`` handle " +"via ``task_for_pid()``, which provides access to the target process's memory " +"space. This handle enables memory operations through APIs like " +"``mach_vm_read_overwrite()``." msgstr "" -msgid "The process memory can be examined using ``mach_vm_region()`` to scan through the virtual memory space, while ``proc_regionfilename()`` helps identify which binary files are loaded at each memory region. When the Python binary or library is found, its Mach-O headers need to be parsed to locate the ``PyRuntime`` structure." +#: ../../howto/remote_debugging.rst:249 +msgid "" +"The process memory can be examined using ``mach_vm_region()`` to scan " +"through the virtual memory space, while ``proc_regionfilename()`` helps " +"identify which binary files are loaded at each memory region. When the " +"Python binary or library is found, its Mach-O headers need to be parsed to " +"locate the ``PyRuntime`` structure." msgstr "" -msgid "The Mach-O format organizes code and data into segments and sections. The ``PyRuntime`` structure lives in a section named ``__PyRuntime`` within the ``__DATA`` segment. The actual runtime address calculation involves finding the ``__TEXT`` segment which serves as the binary's base address, then locating the ``__DATA`` segment containing our target section. The final address is computed by combining the base address with the appropriate section offsets from the Mach-O headers." +#: ../../howto/remote_debugging.rst:254 +msgid "" +"The Mach-O format organizes code and data into segments and sections. The " +"``PyRuntime`` structure lives in a section named ``__PyRuntime`` within the " +"``__DATA`` segment. The actual runtime address calculation involves finding " +"the ``__TEXT`` segment which serves as the binary's base address, then " +"locating the ``__DATA`` segment containing our target section. The final " +"address is computed by combining the base address with the appropriate " +"section offsets from the Mach-O headers." msgstr "" -msgid "Note that accessing another process's memory on macOS typically requires elevated privileges - either root access or special security entitlements granted to the debugging process." +#: ../../howto/remote_debugging.rst:262 +msgid "" +"Note that accessing another process's memory on macOS typically requires " +"elevated privileges - either root access or special security entitlements " +"granted to the debugging process." msgstr "" +#: ../../howto/remote_debugging.rst:268 msgid "Windows (PE)" msgstr "" +#: ../../howto/remote_debugging.rst:269 msgid "To find the ``PyRuntime`` structure on Windows:" msgstr "" -msgid "Use the ToolHelp API to enumerate all modules loaded in the target process. This is done using functions such as `CreateToolhelp32Snapshot `_, `Module32First `_, and `Module32Next `_." +#: ../../howto/remote_debugging.rst:271 +msgid "" +"Use the ToolHelp API to enumerate all modules loaded in the target process. " +"This is done using functions such as `CreateToolhelp32Snapshot `_, `Module32First `_, and " +"`Module32Next `_." msgstr "" -msgid "Identify the module corresponding to :file:`python.exe` or :file:`python{XY}.dll`, where ``X`` and ``Y`` are the major and minor version numbers of the Python version, and record its base address." +#: ../../howto/remote_debugging.rst:278 +msgid "" +"Identify the module corresponding to :file:`python.exe` " +"or :file:`python{XY}.dll`, where ``X`` and ``Y`` are the major and minor " +"version numbers of the Python version, and record its base address." msgstr "" -msgid "Locate the ``PyRuntim`` section. Due to the PE format's 8-character limit on section names (defined as ``IMAGE_SIZEOF_SHORT_NAME``), the original name ``PyRuntime`` is truncated. This section contains the ``PyRuntime`` structure." +#: ../../howto/remote_debugging.rst:281 +msgid "" +"Locate the ``PyRuntim`` section. Due to the PE format's 8-character limit on " +"section names (defined as ``IMAGE_SIZEOF_SHORT_NAME``), the original name " +"``PyRuntime`` is truncated. This section contains the ``PyRuntime`` " +"structure." msgstr "" -msgid "Retrieve the section’s relative virtual address (RVA) and add it to the base address of the module." +#: ../../howto/remote_debugging.rst:285 +msgid "" +"Retrieve the section’s relative virtual address (RVA) and add it to the base " +"address of the module." msgstr "" +#: ../../howto/remote_debugging.rst:290 msgid "" "def find_py_runtime_windows(pid: int) -> int:\n" " # Step 1: Try to find the Python executable in memory\n" @@ -299,54 +517,113 @@ msgid "" " return base_address + section_rva" msgstr "" -msgid "On Windows, accessing another process's memory requires using the Windows API functions like ``CreateToolhelp32Snapshot()`` and ``Module32First()/Module32Next()`` to enumerate loaded modules. The ``OpenProcess()`` function provides a handle to access the target process's memory space, enabling memory operations through ``ReadProcessMemory()``." +#: ../../howto/remote_debugging.rst:312 +msgid "" +"On Windows, accessing another process's memory requires using the Windows " +"API functions like ``CreateToolhelp32Snapshot()`` and ``Module32First()/" +"Module32Next()`` to enumerate loaded modules. The ``OpenProcess()`` function " +"provides a handle to access the target process's memory space, enabling " +"memory operations through ``ReadProcessMemory()``." msgstr "" -msgid "The process memory can be examined by enumerating loaded modules to find the Python binary or DLL. When found, its PE headers need to be parsed to locate the ``PyRuntime`` structure." +#: ../../howto/remote_debugging.rst:318 +msgid "" +"The process memory can be examined by enumerating loaded modules to find the " +"Python binary or DLL. When found, its PE headers need to be parsed to locate " +"the ``PyRuntime`` structure." msgstr "" -msgid "The PE format organizes code and data into sections. The ``PyRuntime`` structure lives in a section named \"PyRuntim\" (truncated from \"PyRuntime\" due to PE's 8-character name limit). The actual runtime address calculation involves finding the module's base address from the module entry, then locating our target section in the PE headers. The final address is computed by combining the base address with the section's virtual address from the PE section headers." +#: ../../howto/remote_debugging.rst:322 +msgid "" +"The PE format organizes code and data into sections. The ``PyRuntime`` " +"structure lives in a section named \"PyRuntim\" (truncated from " +"\"PyRuntime\" due to PE's 8-character name limit). The actual runtime " +"address calculation involves finding the module's base address from the " +"module entry, then locating our target section in the PE headers. The final " +"address is computed by combining the base address with the section's virtual " +"address from the PE section headers." msgstr "" -msgid "Note that accessing another process's memory on Windows typically requires appropriate privileges - either administrative access or the ``SeDebugPrivilege`` privilege granted to the debugging process." +#: ../../howto/remote_debugging.rst:329 +msgid "" +"Note that accessing another process's memory on Windows typically requires " +"appropriate privileges - either administrative access or the " +"``SeDebugPrivilege`` privilege granted to the debugging process." msgstr "" +#: ../../howto/remote_debugging.rst:335 msgid "Reading _Py_DebugOffsets" msgstr "" -msgid "Once the address of the ``PyRuntime`` structure has been determined, the next step is to read the ``_Py_DebugOffsets`` structure located at the beginning of the ``PyRuntime`` block." +#: ../../howto/remote_debugging.rst:337 +msgid "" +"Once the address of the ``PyRuntime`` structure has been determined, the " +"next step is to read the ``_Py_DebugOffsets`` structure located at the " +"beginning of the ``PyRuntime`` block." msgstr "" -msgid "This structure provides version-specific field offsets that are needed to safely read interpreter and thread state memory. These offsets vary between CPython versions and must be checked before use to ensure they are compatible." +#: ../../howto/remote_debugging.rst:341 +msgid "" +"This structure provides version-specific field offsets that are needed to " +"safely read interpreter and thread state memory. These offsets vary between " +"CPython versions and must be checked before use to ensure they are " +"compatible." msgstr "" +#: ../../howto/remote_debugging.rst:345 msgid "To read and check the debug offsets, follow these steps:" msgstr "" -msgid "Read memory from the target process starting at the ``PyRuntime`` address, covering the same number of bytes as the ``_Py_DebugOffsets`` structure. This structure is located at the very start of the ``PyRuntime`` memory block. Its layout is defined in CPython’s internal headers and stays the same within a given minor version, but may change in major versions." +#: ../../howto/remote_debugging.rst:347 +msgid "" +"Read memory from the target process starting at the ``PyRuntime`` address, " +"covering the same number of bytes as the ``_Py_DebugOffsets`` structure. " +"This structure is located at the very start of the ``PyRuntime`` memory " +"block. Its layout is defined in CPython’s internal headers and stays the " +"same within a given minor version, but may change in major versions." msgstr "" +#: ../../howto/remote_debugging.rst:353 msgid "Check that the structure contains valid data:" msgstr "" +#: ../../howto/remote_debugging.rst:355 msgid "The ``cookie`` field must match the expected debug marker." msgstr "" -msgid "The ``version`` field must match the version of the Python interpreter used by the debugger." +#: ../../howto/remote_debugging.rst:356 +msgid "" +"The ``version`` field must match the version of the Python interpreter used " +"by the debugger." msgstr "" -msgid "If either the debugger or the target process is using a pre-release version (for example, an alpha, beta, or release candidate), the versions must match exactly." +#: ../../howto/remote_debugging.rst:358 +msgid "" +"If either the debugger or the target process is using a pre-release version " +"(for example, an alpha, beta, or release candidate), the versions must match " +"exactly." msgstr "" -msgid "The ``free_threaded`` field must have the same value in both the debugger and the target process." +#: ../../howto/remote_debugging.rst:361 +msgid "" +"The ``free_threaded`` field must have the same value in both the debugger " +"and the target process." msgstr "" -msgid "If the structure is valid, the offsets it contains can be used to locate fields in memory. If any check fails, the debugger should stop the operation to avoid reading memory in the wrong format." +#: ../../howto/remote_debugging.rst:364 +msgid "" +"If the structure is valid, the offsets it contains can be used to locate " +"fields in memory. If any check fails, the debugger should stop the operation " +"to avoid reading memory in the wrong format." msgstr "" -msgid "The following is an example implementation that reads and checks ``_Py_DebugOffsets``::" +#: ../../howto/remote_debugging.rst:368 +msgid "" +"The following is an example implementation that reads and checks " +"``_Py_DebugOffsets``::" msgstr "" +#: ../../howto/remote_debugging.rst:371 msgid "" "def read_debug_offsets(pid: int, py_runtime_addr: int) -> DebugOffsets:\n" " # Step 1: Read memory from the target process at the PyRuntime address\n" @@ -370,57 +647,125 @@ msgid "" " return debug_offsets" msgstr "" +#: ../../howto/remote_debugging.rst:396 msgid "**Process suspension recommended**" msgstr "" -msgid "To avoid race conditions and ensure memory consistency, it is strongly recommended that the target process be suspended before performing any operations that read or write internal interpreter state. The Python runtime may concurrently mutate interpreter data structures—such as creating or destroying threads—during normal execution. This can result in invalid memory reads or writes." +#: ../../howto/remote_debugging.rst:398 +msgid "" +"To avoid race conditions and ensure memory consistency, it is strongly " +"recommended that the target process be suspended before performing any " +"operations that read or write internal interpreter state. The Python runtime " +"may concurrently mutate interpreter data structures—such as creating or " +"destroying threads—during normal execution. This can result in invalid " +"memory reads or writes." msgstr "" -msgid "A debugger may suspend execution by attaching to the process with ``ptrace`` or by sending a ``SIGSTOP`` signal. Execution should only be resumed after debugger-side memory operations are complete." +#: ../../howto/remote_debugging.rst:405 +msgid "" +"A debugger may suspend execution by attaching to the process with ``ptrace`` " +"or by sending a ``SIGSTOP`` signal. Execution should only be resumed after " +"debugger-side memory operations are complete." msgstr "" -msgid "Some tools, such as profilers or sampling-based debuggers, may operate on a running process without suspension. In such cases, tools must be explicitly designed to handle partially updated or inconsistent memory. For most debugger implementations, suspending the process remains the safest and most robust approach." +#: ../../howto/remote_debugging.rst:411 +msgid "" +"Some tools, such as profilers or sampling-based debuggers, may operate on a " +"running process without suspension. In such cases, tools must be explicitly " +"designed to handle partially updated or inconsistent memory. For most " +"debugger implementations, suspending the process remains the safest and most " +"robust approach." msgstr "" +#: ../../howto/remote_debugging.rst:419 msgid "Locating the interpreter and thread state" msgstr "" -msgid "Before code can be injected and executed in a remote Python process, the debugger must choose a thread in which to schedule execution. This is necessary because the control fields used to perform remote code injection are located in the ``_PyRemoteDebuggerSupport`` structure, which is embedded in a ``PyThreadState`` object. These fields are modified by the debugger to request execution of injected scripts." +#: ../../howto/remote_debugging.rst:421 +msgid "" +"Before code can be injected and executed in a remote Python process, the " +"debugger must choose a thread in which to schedule execution. This is " +"necessary because the control fields used to perform remote code injection " +"are located in the ``_PyRemoteDebuggerSupport`` structure, which is embedded " +"in a ``PyThreadState`` object. These fields are modified by the debugger to " +"request execution of injected scripts." msgstr "" -msgid "The ``PyThreadState`` structure represents a thread running inside a Python interpreter. It maintains the thread’s evaluation context and contains the fields required for debugger coordination. Locating a valid ``PyThreadState`` is therefore a key prerequisite for triggering execution remotely." +#: ../../howto/remote_debugging.rst:428 +msgid "" +"The ``PyThreadState`` structure represents a thread running inside a Python " +"interpreter. It maintains the thread’s evaluation context and contains the " +"fields required for debugger coordination. Locating a valid " +"``PyThreadState`` is therefore a key prerequisite for triggering execution " +"remotely." msgstr "" -msgid "A thread is typically selected based on its role or ID. In most cases, the main thread is used, but some tools may target a specific thread by its native thread ID. Once the target thread is chosen, the debugger must locate both the interpreter and the associated thread state structures in memory." +#: ../../howto/remote_debugging.rst:433 +msgid "" +"A thread is typically selected based on its role or ID. In most cases, the " +"main thread is used, but some tools may target a specific thread by its " +"native thread ID. Once the target thread is chosen, the debugger must locate " +"both the interpreter and the associated thread state structures in memory." msgstr "" +#: ../../howto/remote_debugging.rst:438 msgid "The relevant internal structures are defined as follows:" msgstr "" -msgid "``PyInterpreterState`` represents an isolated Python interpreter instance. Each interpreter maintains its own set of imported modules, built-in state, and thread state list. Although most Python applications use a single interpreter, CPython supports multiple interpreters in the same process." +#: ../../howto/remote_debugging.rst:440 +msgid "" +"``PyInterpreterState`` represents an isolated Python interpreter instance. " +"Each interpreter maintains its own set of imported modules, built-in state, " +"and thread state list. Although most Python applications use a single " +"interpreter, CPython supports multiple interpreters in the same process." msgstr "" -msgid "``PyThreadState`` represents a thread running within an interpreter. It contains execution state and the control fields used by the debugger." +#: ../../howto/remote_debugging.rst:445 +msgid "" +"``PyThreadState`` represents a thread running within an interpreter. It " +"contains execution state and the control fields used by the debugger." msgstr "" +#: ../../howto/remote_debugging.rst:448 msgid "To locate a thread:" msgstr "" -msgid "Use the offset ``runtime_state.interpreters_head`` to obtain the address of the first interpreter in the ``PyRuntime`` structure. This is the entry point to the linked list of active interpreters." +#: ../../howto/remote_debugging.rst:450 +msgid "" +"Use the offset ``runtime_state.interpreters_head`` to obtain the address of " +"the first interpreter in the ``PyRuntime`` structure. This is the entry " +"point to the linked list of active interpreters." msgstr "" -msgid "Use the offset ``interpreter_state.threads_main`` to access the main thread state associated with the selected interpreter. This is typically the most reliable thread to target." +#: ../../howto/remote_debugging.rst:454 +msgid "" +"Use the offset ``interpreter_state.threads_main`` to access the main thread " +"state associated with the selected interpreter. This is typically the most " +"reliable thread to target." msgstr "" -msgid "Optionally, use the offset ``interpreter_state.threads_head`` to iterate through the linked list of all thread states. Each ``PyThreadState`` structure contains a ``native_thread_id`` field, which may be compared to a target thread ID to find a specific thread." +#: ../../howto/remote_debugging.rst:458 +msgid "" +"Optionally, use the offset ``interpreter_state.threads_head`` to iterate " +"through the linked list of all thread states. Each ``PyThreadState`` " +"structure contains a ``native_thread_id`` field, which may be compared to a " +"target thread ID to find a specific thread." msgstr "" -msgid "Once a valid ``PyThreadState`` has been found, its address can be used in later steps of the protocol, such as writing debugger control fields and scheduling execution." +#: ../../howto/remote_debugging.rst:463 +msgid "" +"Once a valid ``PyThreadState`` has been found, its address can be used in " +"later steps of the protocol, such as writing debugger control fields and " +"scheduling execution." msgstr "" -msgid "The following is an example implementation that locates the main thread state::" +#: ../../howto/remote_debugging.rst:467 +msgid "" +"The following is an example implementation that locates the main thread " +"state::" msgstr "" +#: ../../howto/remote_debugging.rst:469 msgid "" "def find_main_thread_state(\n" " pid: int, py_runtime_addr: int, debug_offsets: DebugOffsets,\n" @@ -444,9 +789,13 @@ msgid "" " return thread_state_addr" msgstr "" -msgid "The following example demonstrates how to locate a thread by its native thread ID::" +#: ../../howto/remote_debugging.rst:490 +msgid "" +"The following example demonstrates how to locate a thread by its native " +"thread ID::" msgstr "" +#: ../../howto/remote_debugging.rst:493 msgid "" "def find_thread_by_id(\n" " pid: int,\n" @@ -475,39 +824,75 @@ msgid "" " raise RuntimeError(\"Thread with the given ID was not found\")" msgstr "" -msgid "Once a valid thread state has been located, the debugger can proceed with modifying its control fields and scheduling execution, as described in the next section." +#: ../../howto/remote_debugging.rst:520 +msgid "" +"Once a valid thread state has been located, the debugger can proceed with " +"modifying its control fields and scheduling execution, as described in the " +"next section." msgstr "" +#: ../../howto/remote_debugging.rst:525 msgid "Writing control information" msgstr "" -msgid "Once a valid ``PyThreadState`` structure has been identified, the debugger may modify control fields within it to schedule the execution of a specified Python script. These control fields are checked periodically by the interpreter, and when set correctly, they trigger the execution of remote code at a safe point in the evaluation loop." +#: ../../howto/remote_debugging.rst:527 +msgid "" +"Once a valid ``PyThreadState`` structure has been identified, the debugger " +"may modify control fields within it to schedule the execution of a specified " +"Python script. These control fields are checked periodically by the " +"interpreter, and when set correctly, they trigger the execution of remote " +"code at a safe point in the evaluation loop." msgstr "" -msgid "Each ``PyThreadState`` contains a ``_PyRemoteDebuggerSupport`` structure used for communication between the debugger and the interpreter. The locations of its fields are defined by the ``_Py_DebugOffsets`` structure and include the following:" +#: ../../howto/remote_debugging.rst:533 +msgid "" +"Each ``PyThreadState`` contains a ``_PyRemoteDebuggerSupport`` structure " +"used for communication between the debugger and the interpreter. The " +"locations of its fields are defined by the ``_Py_DebugOffsets`` structure " +"and include the following:" msgstr "" -msgid "``debugger_script_path``: A fixed-size buffer that holds the full path to a Python source file (``.py``). This file must be accessible and readable by the target process when execution is triggered." +#: ../../howto/remote_debugging.rst:538 +msgid "" +"``debugger_script_path``: A fixed-size buffer that holds the full path to a " +"Python source file (``.py``). This file must be accessible and readable by " +"the target process when execution is triggered." msgstr "" -msgid "``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the interpreter that a script is ready to be executed." +#: ../../howto/remote_debugging.rst:542 +msgid "" +"``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the " +"interpreter that a script is ready to be executed." msgstr "" -msgid "``eval_breaker``: A field checked by the interpreter during execution. Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this field causes the interpreter to pause and check for debugger activity." +#: ../../howto/remote_debugging.rst:545 +msgid "" +"``eval_breaker``: A field checked by the interpreter during execution. " +"Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this " +"field causes the interpreter to pause and check for debugger activity." msgstr "" -msgid "To complete the injection, the debugger must perform the following steps:" +#: ../../howto/remote_debugging.rst:549 +msgid "" +"To complete the injection, the debugger must perform the following steps:" msgstr "" +#: ../../howto/remote_debugging.rst:551 msgid "Write the full script path into the ``debugger_script_path`` buffer." msgstr "" +#: ../../howto/remote_debugging.rst:552 msgid "Set ``debugger_pending_call`` to ``1``." msgstr "" -msgid "Read the current value of ``eval_breaker``, set bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``), and write the updated value back. This signals the interpreter to check for debugger activity." +#: ../../howto/remote_debugging.rst:553 +msgid "" +"Read the current value of ``eval_breaker``, set bit 5 " +"(``_PY_EVAL_PLEASE_STOP_BIT``), and write the updated value back. This " +"signals the interpreter to check for debugger activity." msgstr "" +#: ../../howto/remote_debugging.rst:559 msgid "" "def inject_script(\n" " pid: int,\n" @@ -546,74 +931,153 @@ msgid "" " write_int(pid, eval_breaker_ptr, breaker)" msgstr "" -msgid "Once these fields are set, the debugger may resume the process (if it was suspended). The interpreter will process the request at the next safe evaluation point, load the script from disk, and execute it." +#: ../../howto/remote_debugging.rst:596 +msgid "" +"Once these fields are set, the debugger may resume the process (if it was " +"suspended). The interpreter will process the request at the next safe " +"evaluation point, load the script from disk, and execute it." msgstr "" -msgid "It is the responsibility of the debugger to ensure that the script file remains present and accessible to the target process during execution." +#: ../../howto/remote_debugging.rst:600 +msgid "" +"It is the responsibility of the debugger to ensure that the script file " +"remains present and accessible to the target process during execution." msgstr "" -msgid "Script execution is asynchronous. The script file cannot be deleted immediately after injection. The debugger should wait until the injected script has produced an observable effect before removing the file. This effect depends on what the script is designed to do. For example, a debugger might wait until the remote process connects back to a socket before removing the script. Once such an effect is observed, it is safe to assume the file is no longer needed." +#: ../../howto/remote_debugging.rst:605 +msgid "" +"Script execution is asynchronous. The script file cannot be deleted " +"immediately after injection. The debugger should wait until the injected " +"script has produced an observable effect before removing the file. This " +"effect depends on what the script is designed to do. For example, a debugger " +"might wait until the remote process connects back to a socket before " +"removing the script. Once such an effect is observed, it is safe to assume " +"the file is no longer needed." msgstr "" +#: ../../howto/remote_debugging.rst:614 msgid "Summary" msgstr "" +#: ../../howto/remote_debugging.rst:616 msgid "To inject and execute a Python script in a remote process:" msgstr "" +#: ../../howto/remote_debugging.rst:618 msgid "Locate the ``PyRuntime`` structure in the target process’s memory." msgstr "" -msgid "Read and validate the ``_Py_DebugOffsets`` structure at the beginning of ``PyRuntime``." +#: ../../howto/remote_debugging.rst:619 +msgid "" +"Read and validate the ``_Py_DebugOffsets`` structure at the beginning of " +"``PyRuntime``." msgstr "" +#: ../../howto/remote_debugging.rst:621 msgid "Use the offsets to locate a valid ``PyThreadState``." msgstr "" +#: ../../howto/remote_debugging.rst:622 msgid "Write the path to a Python script into ``debugger_script_path``." msgstr "" +#: ../../howto/remote_debugging.rst:623 msgid "Set the ``debugger_pending_call`` flag to ``1``." msgstr "" +#: ../../howto/remote_debugging.rst:624 msgid "Set ``_PY_EVAL_PLEASE_STOP_BIT`` in the ``eval_breaker`` field." msgstr "" -msgid "Resume the process (if suspended). The script will execute at the next safe evaluation point." +#: ../../howto/remote_debugging.rst:625 +msgid "" +"Resume the process (if suspended). The script will execute at the next safe " +"evaluation point." msgstr "" +#: ../../howto/remote_debugging.rst:631 msgid "Security and threat model" msgstr "" -msgid "The remote debugging protocol relies on the same operating system primitives used by native debuggers such as GDB and LLDB. Attaching to a process requires the **same privileges** that those debuggers require, for example ``ptrace`` / Yama LSM on Linux, ``task_for_pid`` on macOS, and ``SeDebugPrivilege`` on Windows. Python does not introduce any new privilege escalation path; if an attacker already possesses the permissions needed to attach to a process, they could equally use GDB to read memory or inject code." +#: ../../howto/remote_debugging.rst:633 +msgid "" +"The remote debugging protocol relies on the same operating system primitives " +"used by native debuggers such as GDB and LLDB. Attaching to a process " +"requires the **same privileges** that those debuggers require, for example " +"``ptrace`` / Yama LSM on Linux, ``task_for_pid`` on macOS, and " +"``SeDebugPrivilege`` on Windows. Python does not introduce any new " +"privilege escalation path; if an attacker already possesses the permissions " +"needed to attach to a process, they could equally use GDB to read memory or " +"inject code." msgstr "" -msgid "The following principles define what is, and is not, considered a security vulnerability in this feature:" +#: ../../howto/remote_debugging.rst:642 +msgid "" +"The following principles define what is, and is not, considered a security " +"vulnerability in this feature:" msgstr "" +#: ../../howto/remote_debugging.rst:645 msgid "Attaching requires OS-level privileges" msgstr "" -msgid "On every supported platform the operating system gates cross-process memory access behind privilege checks (``CAP_SYS_PTRACE``, root, or administrator rights). A report that demonstrates an issue only after these privileges have already been obtained is **not** a vulnerability in CPython, since the OS security boundary was already crossed." +#: ../../howto/remote_debugging.rst:646 +msgid "" +"On every supported platform the operating system gates cross-process memory " +"access behind privilege checks (``CAP_SYS_PTRACE``, root, or administrator " +"rights). A report that demonstrates an issue only after these privileges " +"have already been obtained is **not** a vulnerability in CPython, since the " +"OS security boundary was already crossed." msgstr "" -msgid "Crashes or memory errors when reading a compromised process are not vulnerabilities" +#: ../../howto/remote_debugging.rst:652 +msgid "" +"Crashes or memory errors when reading a compromised process are not " +"vulnerabilities" msgstr "" -msgid "A tool that reads internal interpreter state from a target process must trust that memory to be well-formed. If the target process has been corrupted or is controlled by an attacker, the debugger or profiler may crash, produce garbage output, or behave unpredictably. This is the same risk accepted by every ``ptrace``-based debugger. Bugs in this category (buffer overflows, segmentation faults, or undefined behaviour triggered by reading corrupted state) are **not** treated as security issues, though fixes that improve robustness are welcome." +#: ../../howto/remote_debugging.rst:653 +msgid "" +"A tool that reads internal interpreter state from a target process must " +"trust that memory to be well-formed. If the target process has been " +"corrupted or is controlled by an attacker, the debugger or profiler may " +"crash, produce garbage output, or behave unpredictably. This is the same " +"risk accepted by every ``ptrace``-based debugger. Bugs in this category " +"(buffer overflows, segmentation faults, or undefined behaviour triggered by " +"reading corrupted state) are **not** treated as security issues, though " +"fixes that improve robustness are welcome." msgstr "" +#: ../../howto/remote_debugging.rst:662 msgid "Vulnerabilities in the target process are not in scope" msgstr "" -msgid "If the Python process being debugged has already been compromised, the attacker already controls execution in that process. Demonstrating further impact from that starting point does not constitute a vulnerability in the remote debugging protocol." +#: ../../howto/remote_debugging.rst:663 +msgid "" +"If the Python process being debugged has already been compromised, the " +"attacker already controls execution in that process. Demonstrating further " +"impact from that starting point does not constitute a vulnerability in the " +"remote debugging protocol." msgstr "" +#: ../../howto/remote_debugging.rst:669 msgid "When to use ``PYTHON_DISABLE_REMOTE_DEBUG``" msgstr "" -msgid "The environment variable :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` (and the equivalent :option:`-X disable_remote_debug` flag) allows operators to disable the in-process side of the protocol as a **defence-in-depth** measure. This may be useful in hardened or sandboxed deployment environments where no debugging or profiling of the process is expected and reducing attack surface is a priority, even though the OS-level privilege checks already prevent unprivileged access." +#: ../../howto/remote_debugging.rst:671 +msgid "" +"The environment variable :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` (and the " +"equivalent :option:`-X disable_remote_debug` flag) allows operators to " +"disable the in-process side of the protocol as a **defence-in-depth** " +"measure. This may be useful in hardened or sandboxed deployment " +"environments where no debugging or profiling of the process is expected and " +"reducing attack surface is a priority, even though the OS-level privilege " +"checks already prevent unprivileged access." msgstr "" -msgid "Setting this variable does **not** affect other OS-level debugging interfaces (``ptrace``, ``/proc``, ``task_for_pid``, etc.), which remain available according to their own permission models." +#: ../../howto/remote_debugging.rst:679 +msgid "" +"Setting this variable does **not** affect other OS-level debugging " +"interfaces (``ptrace``, ``/proc``, ``task_for_pid``, etc.), which remain " +"available according to their own permission models." msgstr "" diff --git a/howto/sockets.po b/howto/sockets.po index 27c6c323a..8d533eef4 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,45 +24,90 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/sockets.rst:5 msgid "Socket Programming HOWTO" msgstr "" +#: ../../howto/sockets.rst:0 msgid "Author" msgstr "" +#: ../../howto/sockets.rst:7 msgid "Gordon McMillan" msgstr "" +#: ../../howto/sockets.rst:-1 msgid "Abstract" msgstr "" -msgid "Sockets are used nearly everywhere, but are one of the most severely misunderstood technologies around. This is a 10,000 foot overview of sockets. It's not really a tutorial - you'll still have work to do in getting things operational. It doesn't cover the fine points (and there are a lot of them), but I hope it will give you enough background to begin using them decently." +#: ../../howto/sockets.rst:12 +msgid "" +"Sockets are used nearly everywhere, but are one of the most severely " +"misunderstood technologies around. This is a 10,000 foot overview of " +"sockets. It's not really a tutorial - you'll still have work to do in " +"getting things operational. It doesn't cover the fine points (and there are " +"a lot of them), but I hope it will give you enough background to begin using " +"them decently." msgstr "" +#: ../../howto/sockets.rst:20 msgid "Sockets" msgstr "" -msgid "I'm only going to talk about INET (i.e. IPv4) sockets, but they account for at least 99% of the sockets in use. And I'll only talk about STREAM (i.e. TCP) sockets - unless you really know what you're doing (in which case this HOWTO isn't for you!), you'll get better behavior and performance from a STREAM socket than anything else. I will try to clear up the mystery of what a socket is, as well as some hints on how to work with blocking and non-blocking sockets. But I'll start by talking about blocking sockets. You'll need to know how they work before dealing with non-blocking sockets." +#: ../../howto/sockets.rst:22 +msgid "" +"I'm only going to talk about INET (i.e. IPv4) sockets, but they account for " +"at least 99% of the sockets in use. And I'll only talk about STREAM (i.e. " +"TCP) sockets - unless you really know what you're doing (in which case this " +"HOWTO isn't for you!), you'll get better behavior and performance from a " +"STREAM socket than anything else. I will try to clear up the mystery of what " +"a socket is, as well as some hints on how to work with blocking and non-" +"blocking sockets. But I'll start by talking about blocking sockets. You'll " +"need to know how they work before dealing with non-blocking sockets." msgstr "" -msgid "Part of the trouble with understanding these things is that \"socket\" can mean a number of subtly different things, depending on context. So first, let's make a distinction between a \"client\" socket - an endpoint of a conversation, and a \"server\" socket, which is more like a switchboard operator. The client application (your browser, for example) uses \"client\" sockets exclusively; the web server it's talking to uses both \"server\" sockets and \"client\" sockets." +#: ../../howto/sockets.rst:31 +msgid "" +"Part of the trouble with understanding these things is that \"socket\" can " +"mean a number of subtly different things, depending on context. So first, " +"let's make a distinction between a \"client\" socket - an endpoint of a " +"conversation, and a \"server\" socket, which is more like a switchboard " +"operator. The client application (your browser, for example) uses \"client\" " +"sockets exclusively; the web server it's talking to uses both \"server\" " +"sockets and \"client\" sockets." msgstr "" +#: ../../howto/sockets.rst:40 msgid "History" msgstr "" -msgid "Of the various forms of :abbr:`IPC (Inter Process Communication)`, sockets are by far the most popular. On any given platform, there are likely to be other forms of IPC that are faster, but for cross-platform communication, sockets are about the only game in town." +#: ../../howto/sockets.rst:42 +msgid "" +"Of the various forms of :abbr:`IPC (Inter Process Communication)`, sockets " +"are by far the most popular. On any given platform, there are likely to be " +"other forms of IPC that are faster, but for cross-platform communication, " +"sockets are about the only game in town." msgstr "" -msgid "They were invented in Berkeley as part of the BSD flavor of Unix. They spread like wildfire with the internet. With good reason --- the combination of sockets with INET makes talking to arbitrary machines around the world unbelievably easy (at least compared to other schemes)." +#: ../../howto/sockets.rst:47 +msgid "" +"They were invented in Berkeley as part of the BSD flavor of Unix. They " +"spread like wildfire with the internet. With good reason --- the combination " +"of sockets with INET makes talking to arbitrary machines around the world " +"unbelievably easy (at least compared to other schemes)." msgstr "" +#: ../../howto/sockets.rst:54 msgid "Creating a Socket" msgstr "" -msgid "Roughly speaking, when you clicked on the link that brought you to this page, your browser did something like the following::" +#: ../../howto/sockets.rst:56 +msgid "" +"Roughly speaking, when you clicked on the link that brought you to this " +"page, your browser did something like the following::" msgstr "" +#: ../../howto/sockets.rst:59 msgid "" "# create an INET, STREAMing socket\n" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" @@ -70,12 +115,21 @@ msgid "" "s.connect((\"www.python.org\", 80))" msgstr "" -msgid "When the ``connect`` completes, the socket ``s`` can be used to send in a request for the text of the page. The same socket will read the reply, and then be destroyed. That's right, destroyed. Client sockets are normally only used for one exchange (or a small set of sequential exchanges)." +#: ../../howto/sockets.rst:64 +msgid "" +"When the ``connect`` completes, the socket ``s`` can be used to send in a " +"request for the text of the page. The same socket will read the reply, and " +"then be destroyed. That's right, destroyed. Client sockets are normally only " +"used for one exchange (or a small set of sequential exchanges)." msgstr "" -msgid "What happens in the web server is a bit more complex. First, the web server creates a \"server socket\"::" +#: ../../howto/sockets.rst:70 +msgid "" +"What happens in the web server is a bit more complex. First, the web server " +"creates a \"server socket\"::" msgstr "" +#: ../../howto/sockets.rst:73 msgid "" "# create an INET, STREAMing socket\n" "serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" @@ -85,18 +139,38 @@ msgid "" "serversocket.listen(5)" msgstr "" -msgid "A couple things to notice: we used ``socket.gethostname()`` so that the socket would be visible to the outside world. If we had used ``s.bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would still have a \"server\" socket, but one that was only visible within the same machine. ``s.bind(('', 80))`` specifies that the socket is reachable by any address the machine happens to have." +#: ../../howto/sockets.rst:80 +msgid "" +"A couple things to notice: we used ``socket.gethostname()`` so that the " +"socket would be visible to the outside world. If we had used " +"``s.bind(('localhost', 80))`` or ``s.bind(('127.0.0.1', 80))`` we would " +"still have a \"server\" socket, but one that was only visible within the " +"same machine. ``s.bind(('', 80))`` specifies that the socket is reachable " +"by any address the machine happens to have." msgstr "" -msgid "A second thing to note: low number ports are usually reserved for \"well known\" services (HTTP, SNMP etc). If you're playing around, use a nice high number (4 digits)." +#: ../../howto/sockets.rst:87 +msgid "" +"A second thing to note: low number ports are usually reserved for \"well " +"known\" services (HTTP, SNMP etc). If you're playing around, use a nice high " +"number (4 digits)." msgstr "" -msgid "Finally, the argument to ``listen`` tells the socket library that we want it to queue up as many as 5 connect requests (the normal max) before refusing outside connections. If the rest of the code is written properly, that should be plenty." +#: ../../howto/sockets.rst:91 +msgid "" +"Finally, the argument to ``listen`` tells the socket library that we want it " +"to queue up as many as 5 connect requests (the normal max) before refusing " +"outside connections. If the rest of the code is written properly, that " +"should be plenty." msgstr "" -msgid "Now that we have a \"server\" socket, listening on port 80, we can enter the mainloop of the web server::" +#: ../../howto/sockets.rst:95 +msgid "" +"Now that we have a \"server\" socket, listening on port 80, we can enter the " +"mainloop of the web server::" msgstr "" +#: ../../howto/sockets.rst:98 msgid "" "while True:\n" " # accept connections from outside\n" @@ -107,42 +181,115 @@ msgid "" " ct.start()" msgstr "" -msgid "There's actually 3 general ways in which this loop could work - dispatching a thread to handle ``clientsocket``, create a new process to handle ``clientsocket``, or restructure this app to use non-blocking sockets, and multiplex between our \"server\" socket and any active ``clientsocket``\\ s using ``select``. More about that later. The important thing to understand now is this: this is *all* a \"server\" socket does. It doesn't send any data. It doesn't receive any data. It just produces \"client\" sockets. Each ``clientsocket`` is created in response to some *other* \"client\" socket doing a ``connect()`` to the host and port we're bound to. As soon as we've created that ``clientsocket``, we go back to listening for more connections. The two \"clients\" are free to chat it up - they are using some dynamically allocated port which will be recycled when the conversation ends." -msgstr "" - +#: ../../howto/sockets.rst:106 +msgid "" +"There's actually 3 general ways in which this loop could work - dispatching " +"a thread to handle ``clientsocket``, create a new process to handle " +"``clientsocket``, or restructure this app to use non-blocking sockets, and " +"multiplex between our \"server\" socket and any active ``clientsocket``\\ s " +"using ``select``. More about that later. The important thing to understand " +"now is this: this is *all* a \"server\" socket does. It doesn't send any " +"data. It doesn't receive any data. It just produces \"client\" sockets. Each " +"``clientsocket`` is created in response to some *other* \"client\" socket " +"doing a ``connect()`` to the host and port we're bound to. As soon as we've " +"created that ``clientsocket``, we go back to listening for more connections. " +"The two \"clients\" are free to chat it up - they are using some dynamically " +"allocated port which will be recycled when the conversation ends." +msgstr "" + +#: ../../howto/sockets.rst:121 msgid "IPC" msgstr "" -msgid "If you need fast IPC between two processes on one machine, you should look into pipes or shared memory. If you do decide to use AF_INET sockets, bind the \"server\" socket to ``'localhost'``. On most platforms, this will take a shortcut around a couple of layers of network code and be quite a bit faster." +#: ../../howto/sockets.rst:123 +msgid "" +"If you need fast IPC between two processes on one machine, you should look " +"into pipes or shared memory. If you do decide to use AF_INET sockets, bind " +"the \"server\" socket to ``'localhost'``. On most platforms, this will take " +"a shortcut around a couple of layers of network code and be quite a bit " +"faster." msgstr "" -msgid "The :mod:`multiprocessing` integrates cross-platform IPC into a higher-level API." +#: ../../howto/sockets.rst:129 +msgid "" +"The :mod:`multiprocessing` integrates cross-platform IPC into a higher-level " +"API." msgstr "" +#: ../../howto/sockets.rst:134 msgid "Using a Socket" msgstr "" -msgid "The first thing to note, is that the web browser's \"client\" socket and the web server's \"client\" socket are identical beasts. That is, this is a \"peer to peer\" conversation. Or to put it another way, *as the designer, you will have to decide what the rules of etiquette are for a conversation*. Normally, the ``connect``\\ ing socket starts the conversation, by sending in a request, or perhaps a signon. But that's a design decision - it's not a rule of sockets." -msgstr "" - -msgid "Now there are two sets of verbs to use for communication. You can use ``send`` and ``recv``, or you can transform your client socket into a file-like beast and use ``read`` and ``write``. The latter is the way Java presents its sockets. I'm not going to talk about it here, except to warn you that you need to use ``flush`` on sockets. These are buffered \"files\", and a common mistake is to ``write`` something, and then ``read`` for a reply. Without a ``flush`` in there, you may wait forever for the reply, because the request may still be in your output buffer." +#: ../../howto/sockets.rst:136 +msgid "" +"The first thing to note, is that the web browser's \"client\" socket and the " +"web server's \"client\" socket are identical beasts. That is, this is a " +"\"peer to peer\" conversation. Or to put it another way, *as the designer, " +"you will have to decide what the rules of etiquette are for a conversation*. " +"Normally, the ``connect``\\ ing socket starts the conversation, by sending " +"in a request, or perhaps a signon. But that's a design decision - it's not a " +"rule of sockets." msgstr "" -msgid "Now we come to the major stumbling block of sockets - ``send`` and ``recv`` operate on the network buffers. They do not necessarily handle all the bytes you hand them (or expect from them), because their major focus is handling the network buffers. In general, they return when the associated network buffers have been filled (``send``) or emptied (``recv``). They then tell you how many bytes they handled. It is *your* responsibility to call them again until your message has been completely dealt with." +#: ../../howto/sockets.rst:143 +msgid "" +"Now there are two sets of verbs to use for communication. You can use " +"``send`` and ``recv``, or you can transform your client socket into a file-" +"like beast and use ``read`` and ``write``. The latter is the way Java " +"presents its sockets. I'm not going to talk about it here, except to warn " +"you that you need to use ``flush`` on sockets. These are buffered \"files\", " +"and a common mistake is to ``write`` something, and then ``read`` for a " +"reply. Without a ``flush`` in there, you may wait forever for the reply, " +"because the request may still be in your output buffer." msgstr "" -msgid "When a ``recv`` returns 0 bytes, it means the other side has closed (or is in the process of closing) the connection. You will not receive any more data on this connection. Ever. You may be able to send data successfully; I'll talk more about this later." +#: ../../howto/sockets.rst:152 +msgid "" +"Now we come to the major stumbling block of sockets - ``send`` and ``recv`` " +"operate on the network buffers. They do not necessarily handle all the bytes " +"you hand them (or expect from them), because their major focus is handling " +"the network buffers. In general, they return when the associated network " +"buffers have been filled (``send``) or emptied (``recv``). They then tell " +"you how many bytes they handled. It is *your* responsibility to call them " +"again until your message has been completely dealt with." msgstr "" -msgid "A protocol like HTTP uses a socket for only one transfer. The client sends a request, then reads a reply. That's it. The socket is discarded. This means that a client can detect the end of the reply by receiving 0 bytes." +#: ../../howto/sockets.rst:160 +msgid "" +"When a ``recv`` returns 0 bytes, it means the other side has closed (or is " +"in the process of closing) the connection. You will not receive any more " +"data on this connection. Ever. You may be able to send data successfully; " +"I'll talk more about this later." msgstr "" -msgid "But if you plan to reuse your socket for further transfers, you need to realize that *there is no* :abbr:`EOT (End of Transfer)` *on a socket.* I repeat: if a socket ``send`` or ``recv`` returns after handling 0 bytes, the connection has been broken. If the connection has *not* been broken, you may wait on a ``recv`` forever, because the socket will *not* tell you that there's nothing more to read (for now). Now if you think about that a bit, you'll come to realize a fundamental truth of sockets: *messages must either be fixed length* (yuck), *or be delimited* (shrug), *or indicate how long they are* (much better), *or end by shutting down the connection*. The choice is entirely yours, (but some ways are righter than others)." +#: ../../howto/sockets.rst:165 +msgid "" +"A protocol like HTTP uses a socket for only one transfer. The client sends a " +"request, then reads a reply. That's it. The socket is discarded. This means " +"that a client can detect the end of the reply by receiving 0 bytes." msgstr "" -msgid "Assuming you don't want to end the connection, the simplest solution is a fixed length message::" +#: ../../howto/sockets.rst:169 +msgid "" +"But if you plan to reuse your socket for further transfers, you need to " +"realize that *there is no* :abbr:`EOT (End of Transfer)` *on a socket.* I " +"repeat: if a socket ``send`` or ``recv`` returns after handling 0 bytes, the " +"connection has been broken. If the connection has *not* been broken, you " +"may wait on a ``recv`` forever, because the socket will *not* tell you that " +"there's nothing more to read (for now). Now if you think about that a bit, " +"you'll come to realize a fundamental truth of sockets: *messages must either " +"be fixed length* (yuck), *or be delimited* (shrug), *or indicate how long " +"they are* (much better), *or end by shutting down the connection*. The " +"choice is entirely yours, (but some ways are righter than others)." +msgstr "" + +#: ../../howto/sockets.rst:180 +msgid "" +"Assuming you don't want to end the connection, the simplest solution is a " +"fixed length message::" msgstr "" +#: ../../howto/sockets.rst:183 msgid "" "class MySocket:\n" " \"\"\"demonstration class only\n" @@ -179,69 +326,188 @@ msgid "" " return b''.join(chunks)" msgstr "" -msgid "The sending code here is usable for almost any messaging scheme - in Python you send strings, and you can use ``len()`` to determine its length (even if it has embedded ``\\0`` characters). It's mostly the receiving code that gets more complex. (And in C, it's not much worse, except you can't use ``strlen`` if the message has embedded ``\\0``\\ s.)" +#: ../../howto/sockets.rst:217 +msgid "" +"The sending code here is usable for almost any messaging scheme - in Python " +"you send strings, and you can use ``len()`` to determine its length (even if " +"it has embedded ``\\0`` characters). It's mostly the receiving code that " +"gets more complex. (And in C, it's not much worse, except you can't use " +"``strlen`` if the message has embedded ``\\0``\\ s.)" msgstr "" -msgid "The easiest enhancement is to make the first character of the message an indicator of message type, and have the type determine the length. Now you have two ``recv``\\ s - the first to get (at least) that first character so you can look up the length, and the second in a loop to get the rest. If you decide to go the delimited route, you'll be receiving in some arbitrary chunk size, (4096 or 8192 is frequently a good match for network buffer sizes), and scanning what you've received for a delimiter." +#: ../../howto/sockets.rst:223 +msgid "" +"The easiest enhancement is to make the first character of the message an " +"indicator of message type, and have the type determine the length. Now you " +"have two ``recv``\\ s - the first to get (at least) that first character so " +"you can look up the length, and the second in a loop to get the rest. If you " +"decide to go the delimited route, you'll be receiving in some arbitrary " +"chunk size, (4096 or 8192 is frequently a good match for network buffer " +"sizes), and scanning what you've received for a delimiter." msgstr "" -msgid "One complication to be aware of: if your conversational protocol allows multiple messages to be sent back to back (without some kind of reply), and you pass ``recv`` an arbitrary chunk size, you may end up reading the start of a following message. You'll need to put that aside and hold onto it, until it's needed." +#: ../../howto/sockets.rst:231 +msgid "" +"One complication to be aware of: if your conversational protocol allows " +"multiple messages to be sent back to back (without some kind of reply), and " +"you pass ``recv`` an arbitrary chunk size, you may end up reading the start " +"of a following message. You'll need to put that aside and hold onto it, " +"until it's needed." msgstr "" -msgid "Prefixing the message with its length (say, as 5 numeric characters) gets more complex, because (believe it or not), you may not get all 5 characters in one ``recv``. In playing around, you'll get away with it; but in high network loads, your code will very quickly break unless you use two ``recv`` loops - the first to determine the length, the second to get the data part of the message. Nasty. This is also when you'll discover that ``send`` does not always manage to get rid of everything in one pass. And despite having read this, you will eventually get bit by it!" +#: ../../howto/sockets.rst:237 +msgid "" +"Prefixing the message with its length (say, as 5 numeric characters) gets " +"more complex, because (believe it or not), you may not get all 5 characters " +"in one ``recv``. In playing around, you'll get away with it; but in high " +"network loads, your code will very quickly break unless you use two ``recv`` " +"loops - the first to determine the length, the second to get the data part " +"of the message. Nasty. This is also when you'll discover that ``send`` does " +"not always manage to get rid of everything in one pass. And despite having " +"read this, you will eventually get bit by it!" msgstr "" -msgid "In the interests of space, building your character, (and preserving my competitive position), these enhancements are left as an exercise for the reader. Lets move on to cleaning up." +#: ../../howto/sockets.rst:246 +msgid "" +"In the interests of space, building your character, (and preserving my " +"competitive position), these enhancements are left as an exercise for the " +"reader. Lets move on to cleaning up." msgstr "" +#: ../../howto/sockets.rst:252 msgid "Binary Data" msgstr "" -msgid "It is perfectly possible to send binary data over a socket. The major problem is that not all machines use the same formats for binary data. For example, `network byte order `_ is big-endian, with the most significant byte first, so a 16 bit integer with the value ``1`` would be the two hex bytes ``00 01``. However, most common processors (x86/AMD64, ARM, RISC-V), are little-endian, with the least significant byte first - that same ``1`` would be ``01 00``." +#: ../../howto/sockets.rst:254 +msgid "" +"It is perfectly possible to send binary data over a socket. The major " +"problem is that not all machines use the same formats for binary data. For " +"example, `network byte order `_ is big-endian, with the most significant byte " +"first, so a 16 bit integer with the value ``1`` would be the two hex bytes " +"``00 01``. However, most common processors (x86/AMD64, ARM, RISC-V), are " +"little-endian, with the least significant byte first - that same ``1`` would " +"be ``01 00``." msgstr "" -msgid "Socket libraries have calls for converting 16 and 32 bit integers - ``ntohl, htonl, ntohs, htons`` where \"n\" means *network* and \"h\" means *host*, \"s\" means *short* and \"l\" means *long*. Where network order is host order, these do nothing, but where the machine is byte-reversed, these swap the bytes around appropriately." +#: ../../howto/sockets.rst:262 +msgid "" +"Socket libraries have calls for converting 16 and 32 bit integers - ``ntohl, " +"htonl, ntohs, htons`` where \"n\" means *network* and \"h\" means *host*, " +"\"s\" means *short* and \"l\" means *long*. Where network order is host " +"order, these do nothing, but where the machine is byte-reversed, these swap " +"the bytes around appropriately." msgstr "" -msgid "In these days of 64-bit machines, the ASCII representation of binary data is frequently smaller than the binary representation. That's because a surprising amount of the time, most integers have the value 0, or maybe 1. The string ``\"0\"`` would be two bytes, while a full 64-bit integer would be 8. Of course, this doesn't fit well with fixed-length messages. Decisions, decisions." +#: ../../howto/sockets.rst:268 +msgid "" +"In these days of 64-bit machines, the ASCII representation of binary data is " +"frequently smaller than the binary representation. That's because a " +"surprising amount of the time, most integers have the value 0, or maybe 1. " +"The string ``\"0\"`` would be two bytes, while a full 64-bit integer would " +"be 8. Of course, this doesn't fit well with fixed-length messages. " +"Decisions, decisions." msgstr "" +#: ../../howto/sockets.rst:277 msgid "Disconnecting" msgstr "" -msgid "Strictly speaking, you're supposed to use ``shutdown`` on a socket before you ``close`` it. The ``shutdown`` is an advisory to the socket at the other end. Depending on the argument you pass it, it can mean \"I'm not going to send anymore, but I'll still listen\", or \"I'm not listening, good riddance!\". Most socket libraries, however, are so used to programmers neglecting to use this piece of etiquette that normally a ``close`` is the same as ``shutdown(); close()``. So in most situations, an explicit ``shutdown`` is not needed." +#: ../../howto/sockets.rst:279 +msgid "" +"Strictly speaking, you're supposed to use ``shutdown`` on a socket before " +"you ``close`` it. The ``shutdown`` is an advisory to the socket at the " +"other end. Depending on the argument you pass it, it can mean \"I'm not " +"going to send anymore, but I'll still listen\", or \"I'm not listening, good " +"riddance!\". Most socket libraries, however, are so used to programmers " +"neglecting to use this piece of etiquette that normally a ``close`` is the " +"same as ``shutdown(); close()``. So in most situations, an explicit " +"``shutdown`` is not needed." msgstr "" -msgid "One way to use ``shutdown`` effectively is in an HTTP-like exchange. The client sends a request and then does a ``shutdown(1)``. This tells the server \"This client is done sending, but can still receive.\" The server can detect \"EOF\" by a receive of 0 bytes. It can assume it has the complete request. The server sends a reply. If the ``send`` completes successfully then, indeed, the client was still receiving." +#: ../../howto/sockets.rst:287 +msgid "" +"One way to use ``shutdown`` effectively is in an HTTP-like exchange. The " +"client sends a request and then does a ``shutdown(1)``. This tells the " +"server \"This client is done sending, but can still receive.\" The server " +"can detect \"EOF\" by a receive of 0 bytes. It can assume it has the " +"complete request. The server sends a reply. If the ``send`` completes " +"successfully then, indeed, the client was still receiving." msgstr "" -msgid "Python takes the automatic shutdown a step further, and says that when a socket is garbage collected, it will automatically do a ``close`` if it's needed. But relying on this is a very bad habit. If your socket just disappears without doing a ``close``, the socket at the other end may hang indefinitely, thinking you're just being slow. *Please* ``close`` your sockets when you're done." +#: ../../howto/sockets.rst:294 +msgid "" +"Python takes the automatic shutdown a step further, and says that when a " +"socket is garbage collected, it will automatically do a ``close`` if it's " +"needed. But relying on this is a very bad habit. If your socket just " +"disappears without doing a ``close``, the socket at the other end may hang " +"indefinitely, thinking you're just being slow. *Please* ``close`` your " +"sockets when you're done." msgstr "" +#: ../../howto/sockets.rst:302 msgid "When Sockets Die" msgstr "" -msgid "Probably the worst thing about using blocking sockets is what happens when the other side comes down hard (without doing a ``close``). Your socket is likely to hang. TCP is a reliable protocol, and it will wait a long, long time before giving up on a connection. If you're using threads, the entire thread is essentially dead. There's not much you can do about it. As long as you aren't doing something dumb, like holding a lock while doing a blocking read, the thread isn't really consuming much in the way of resources. Do *not* try to kill the thread - part of the reason that threads are more efficient than processes is that they avoid the overhead associated with the automatic recycling of resources. In other words, if you do manage to kill the thread, your whole process is likely to be screwed up." -msgstr "" - +#: ../../howto/sockets.rst:304 +msgid "" +"Probably the worst thing about using blocking sockets is what happens when " +"the other side comes down hard (without doing a ``close``). Your socket is " +"likely to hang. TCP is a reliable protocol, and it will wait a long, long " +"time before giving up on a connection. If you're using threads, the entire " +"thread is essentially dead. There's not much you can do about it. As long as " +"you aren't doing something dumb, like holding a lock while doing a blocking " +"read, the thread isn't really consuming much in the way of resources. Do " +"*not* try to kill the thread - part of the reason that threads are more " +"efficient than processes is that they avoid the overhead associated with the " +"automatic recycling of resources. In other words, if you do manage to kill " +"the thread, your whole process is likely to be screwed up." +msgstr "" + +#: ../../howto/sockets.rst:318 msgid "Non-blocking Sockets" msgstr "" -msgid "If you've understood the preceding, you already know most of what you need to know about the mechanics of using sockets. You'll still use the same calls, in much the same ways. It's just that, if you do it right, your app will be almost inside-out." +#: ../../howto/sockets.rst:320 +msgid "" +"If you've understood the preceding, you already know most of what you need " +"to know about the mechanics of using sockets. You'll still use the same " +"calls, in much the same ways. It's just that, if you do it right, your app " +"will be almost inside-out." msgstr "" -msgid "In Python, you use ``socket.setblocking(False)`` to make it non-blocking. In C, it's more complex, (for one thing, you'll need to choose between the BSD flavor ``O_NONBLOCK`` and the almost indistinguishable POSIX flavor ``O_NDELAY``, which is completely different from ``TCP_NODELAY``), but it's the exact same idea. You do this after creating the socket, but before using it. (Actually, if you're nuts, you can switch back and forth.)" +#: ../../howto/sockets.rst:325 +msgid "" +"In Python, you use ``socket.setblocking(False)`` to make it non-blocking. In " +"C, it's more complex, (for one thing, you'll need to choose between the BSD " +"flavor ``O_NONBLOCK`` and the almost indistinguishable POSIX flavor " +"``O_NDELAY``, which is completely different from ``TCP_NODELAY``), but it's " +"the exact same idea. You do this after creating the socket, but before using " +"it. (Actually, if you're nuts, you can switch back and forth.)" msgstr "" -msgid "The major mechanical difference is that ``send``, ``recv``, ``connect`` and ``accept`` can return without having done anything. You have (of course) a number of choices. You can check return code and error codes and generally drive yourself crazy. If you don't believe me, try it sometime. Your app will grow large, buggy and suck CPU. So let's skip the brain-dead solutions and do it right." +#: ../../howto/sockets.rst:332 +msgid "" +"The major mechanical difference is that ``send``, ``recv``, ``connect`` and " +"``accept`` can return without having done anything. You have (of course) a " +"number of choices. You can check return code and error codes and generally " +"drive yourself crazy. If you don't believe me, try it sometime. Your app " +"will grow large, buggy and suck CPU. So let's skip the brain-dead solutions " +"and do it right." msgstr "" +#: ../../howto/sockets.rst:339 msgid "Use ``select``." msgstr "" -msgid "In C, coding ``select`` is fairly complex. In Python, it's a piece of cake, but it's close enough to the C version that if you understand ``select`` in Python, you'll have little trouble with it in C::" +#: ../../howto/sockets.rst:341 +msgid "" +"In C, coding ``select`` is fairly complex. In Python, it's a piece of cake, " +"but it's close enough to the C version that if you understand ``select`` in " +"Python, you'll have little trouble with it in C::" msgstr "" +#: ../../howto/sockets.rst:345 msgid "" "ready_to_read, ready_to_write, in_error = \\\n" " select.select(\n" @@ -251,20 +517,57 @@ msgid "" " timeout)" msgstr "" -msgid "You pass ``select`` three lists: the first contains all sockets that you might want to try reading; the second all the sockets you might want to try writing to, and the last (normally left empty) those that you want to check for errors. You should note that a socket can go into more than one list. The ``select`` call is blocking, but you can give it a timeout. This is generally a sensible thing to do - give it a nice long timeout (say a minute) unless you have good reason to do otherwise." +#: ../../howto/sockets.rst:352 +msgid "" +"You pass ``select`` three lists: the first contains all sockets that you " +"might want to try reading; the second all the sockets you might want to try " +"writing to, and the last (normally left empty) those that you want to check " +"for errors. You should note that a socket can go into more than one list. " +"The ``select`` call is blocking, but you can give it a timeout. This is " +"generally a sensible thing to do - give it a nice long timeout (say a " +"minute) unless you have good reason to do otherwise." msgstr "" -msgid "In return, you will get three lists. They contain the sockets that are actually readable, writable and in error. Each of these lists is a subset (possibly empty) of the corresponding list you passed in." +#: ../../howto/sockets.rst:360 +msgid "" +"In return, you will get three lists. They contain the sockets that are " +"actually readable, writable and in error. Each of these lists is a subset " +"(possibly empty) of the corresponding list you passed in." msgstr "" -msgid "If a socket is in the output readable list, you can be as-close-to-certain-as-we-ever-get-in-this-business that a ``recv`` on that socket will return *something*. Same idea for the writable list. You'll be able to send *something*. Maybe not all you want to, but *something* is better than nothing. (Actually, any reasonably healthy socket will return as writable - it just means outbound network buffer space is available.)" +#: ../../howto/sockets.rst:364 +msgid "" +"If a socket is in the output readable list, you can be as-close-to-certain-" +"as-we-ever-get-in-this-business that a ``recv`` on that socket will return " +"*something*. Same idea for the writable list. You'll be able to send " +"*something*. Maybe not all you want to, but *something* is better than " +"nothing. (Actually, any reasonably healthy socket will return as writable - " +"it just means outbound network buffer space is available.)" msgstr "" -msgid "If you have a \"server\" socket, put it in the potential_readers list. If it comes out in the readable list, your ``accept`` will (almost certainly) work. If you have created a new socket to ``connect`` to someone else, put it in the potential_writers list. If it shows up in the writable list, you have a decent chance that it has connected." +#: ../../howto/sockets.rst:371 +msgid "" +"If you have a \"server\" socket, put it in the potential_readers list. If it " +"comes out in the readable list, your ``accept`` will (almost certainly) " +"work. If you have created a new socket to ``connect`` to someone else, put " +"it in the potential_writers list. If it shows up in the writable list, you " +"have a decent chance that it has connected." msgstr "" -msgid "Actually, ``select`` can be handy even with blocking sockets. It's one way of determining whether you will block - the socket returns as readable when there's something in the buffers. However, this still doesn't help with the problem of determining whether the other end is done, or just busy with something else." +#: ../../howto/sockets.rst:377 +msgid "" +"Actually, ``select`` can be handy even with blocking sockets. It's one way " +"of determining whether you will block - the socket returns as readable when " +"there's something in the buffers. However, this still doesn't help with the " +"problem of determining whether the other end is done, or just busy with " +"something else." msgstr "" -msgid "**Portability alert**: On Unix, ``select`` works both with the sockets and files. Don't try this on Windows. On Windows, ``select`` works with sockets only. Also note that in C, many of the more advanced socket options are done differently on Windows. In fact, on Windows I usually use threads (which work very, very well) with my sockets." +#: ../../howto/sockets.rst:382 +msgid "" +"**Portability alert**: On Unix, ``select`` works both with the sockets and " +"files. Don't try this on Windows. On Windows, ``select`` works with sockets " +"only. Also note that in C, many of the more advanced socket options are done " +"differently on Windows. In fact, on Windows I usually use threads (which " +"work very, very well) with my sockets." msgstr "" diff --git a/howto/sorting.po b/howto/sorting.po index 0498c75f1..a10dc943d 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,35 +24,56 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/sorting.rst:4 msgid "Sorting Techniques" msgstr "" +#: ../../howto/sorting.rst:0 msgid "Author" msgstr "" +#: ../../howto/sorting.rst:6 msgid "Andrew Dalke and Raymond Hettinger" msgstr "" -msgid "Python lists have a built-in :meth:`list.sort` method that modifies the list in-place. There is also a :func:`sorted` built-in function that builds a new sorted list from an iterable." +#: ../../howto/sorting.rst:9 +msgid "" +"Python lists have a built-in :meth:`list.sort` method that modifies the list " +"in-place. There is also a :func:`sorted` built-in function that builds a " +"new sorted list from an iterable." msgstr "" -msgid "In this document, we explore the various techniques for sorting data using Python." +#: ../../howto/sorting.rst:13 +msgid "" +"In this document, we explore the various techniques for sorting data using " +"Python." msgstr "" +#: ../../howto/sorting.rst:17 msgid "Sorting Basics" msgstr "" -msgid "A simple ascending sort is very easy: just call the :func:`sorted` function. It returns a new sorted list:" +#: ../../howto/sorting.rst:19 +msgid "" +"A simple ascending sort is very easy: just call the :func:`sorted` function. " +"It returns a new sorted list:" msgstr "" +#: ../../howto/sorting.rst:22 msgid "" ">>> sorted([5, 2, 3, 1, 4])\n" "[1, 2, 3, 4, 5]" msgstr "" -msgid "You can also use the :meth:`list.sort` method. It modifies the list in-place (and returns ``None`` to avoid confusion). Usually it's less convenient than :func:`sorted` - but if you don't need the original list, it's slightly more efficient." +#: ../../howto/sorting.rst:27 +msgid "" +"You can also use the :meth:`list.sort` method. It modifies the list in-place " +"(and returns ``None`` to avoid confusion). Usually it's less convenient " +"than :func:`sorted` - but if you don't need the original list, it's slightly " +"more efficient." msgstr "" +#: ../../howto/sorting.rst:32 msgid "" ">>> a = [5, 2, 3, 1, 4]\n" ">>> a.sort()\n" @@ -60,34 +81,58 @@ msgid "" "[1, 2, 3, 4, 5]" msgstr "" -msgid "Another difference is that the :meth:`list.sort` method is only defined for lists. In contrast, the :func:`sorted` function accepts any iterable." +#: ../../howto/sorting.rst:39 +msgid "" +"Another difference is that the :meth:`list.sort` method is only defined for " +"lists. In contrast, the :func:`sorted` function accepts any iterable." msgstr "" +#: ../../howto/sorting.rst:42 msgid "" ">>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})\n" "[1, 2, 3, 4, 5]" msgstr "" +#: ../../howto/sorting.rst:48 msgid "Key Functions" msgstr "" -msgid "The :meth:`list.sort` method and the functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* parameter to specify a function (or other callable) to be called on each list element prior to making comparisons." +#: ../../howto/sorting.rst:50 +msgid "" +"The :meth:`list.sort` method and the " +"functions :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nsmallest`, " +"and :func:`heapq.nlargest` have a *key* parameter to specify a function (or " +"other callable) to be called on each list element prior to making " +"comparisons." msgstr "" -msgid "For example, here's a case-insensitive string comparison using :meth:`str.casefold`:" +#: ../../howto/sorting.rst:56 +msgid "" +"For example, here's a case-insensitive string comparison " +"using :meth:`str.casefold`:" msgstr "" +#: ../../howto/sorting.rst:59 msgid "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" msgstr "" -msgid "The value of the *key* parameter should be a function (or other callable) that takes a single argument and returns a key to use for sorting purposes. This technique is fast because the key function is called exactly once for each input record." +#: ../../howto/sorting.rst:64 +msgid "" +"The value of the *key* parameter should be a function (or other callable) " +"that takes a single argument and returns a key to use for sorting purposes. " +"This technique is fast because the key function is called exactly once for " +"each input record." msgstr "" -msgid "A common pattern is to sort complex objects using some of the object's indices as keys. For example:" +#: ../../howto/sorting.rst:69 +msgid "" +"A common pattern is to sort complex objects using some of the object's " +"indices as keys. For example:" msgstr "" +#: ../../howto/sorting.rst:72 msgid "" ">>> student_tuples = [\n" "... ('john', 'A', 15),\n" @@ -98,9 +143,12 @@ msgid "" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" -msgid "The same technique works for objects with named attributes. For example:" +#: ../../howto/sorting.rst:82 +msgid "" +"The same technique works for objects with named attributes. For example:" msgstr "" +#: ../../howto/sorting.rst:84 msgid "" ">>> class Student:\n" "... def __init__(self, name, grade, age):\n" @@ -115,22 +163,36 @@ msgid "" "... Student('jane', 'B', 12),\n" "... Student('dave', 'B', 10),\n" "... ]\n" -">>> sorted(student_objects, key=lambda student: student.age) # sort by age\n" +">>> sorted(student_objects, key=lambda student: student.age) # sort by " +"age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" -msgid "Objects with named attributes can be made by a regular class as shown above, or they can be instances of :class:`~dataclasses.dataclass` or a :term:`named tuple`." +#: ../../howto/sorting.rst:102 +msgid "" +"Objects with named attributes can be made by a regular class as shown above, " +"or they can be instances of :class:`~dataclasses.dataclass` or " +"a :term:`named tuple`." msgstr "" +#: ../../howto/sorting.rst:107 msgid "Operator Module Functions and Partial Function Evaluation" msgstr "" -msgid "The :term:`key function` patterns shown above are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and a :func:`~operator.methodcaller` function." +#: ../../howto/sorting.rst:109 +msgid "" +"The :term:`key function` patterns shown above are very common, so Python " +"provides convenience functions to make accessor functions easier and faster. " +"The :mod:`operator` module " +"has :func:`~operator.itemgetter`, :func:`~operator.attrgetter`, and " +"a :func:`~operator.methodcaller` function." msgstr "" +#: ../../howto/sorting.rst:114 msgid "Using those functions, the above examples become simpler and faster:" msgstr "" +#: ../../howto/sorting.rst:116 msgid "" ">>> from operator import itemgetter, attrgetter\n" "\n" @@ -141,9 +203,13 @@ msgid "" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" -msgid "The operator module functions allow multiple levels of sorting. For example, to sort by *grade* then by *age*:" +#: ../../howto/sorting.rst:126 +msgid "" +"The operator module functions allow multiple levels of sorting. For example, " +"to sort by *grade* then by *age*:" msgstr "" +#: ../../howto/sorting.rst:129 msgid "" ">>> sorted(student_tuples, key=itemgetter(1,2))\n" "[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n" @@ -152,9 +218,15 @@ msgid "" "[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]" msgstr "" -msgid "The :mod:`functools` module provides another helpful tool for making key-functions. The :func:`~functools.partial` function can reduce the `arity `_ of a multi-argument function making it suitable for use as a key-function." +#: ../../howto/sorting.rst:137 +msgid "" +"The :mod:`functools` module provides another helpful tool for making key-" +"functions. The :func:`~functools.partial` function can reduce the `arity " +"`_ of a multi-argument function making " +"it suitable for use as a key-function." msgstr "" +#: ../../howto/sorting.rst:142 msgid "" ">>> from functools import partial\n" ">>> from unicodedata import normalize\n" @@ -168,12 +240,18 @@ msgid "" "['Abe', 'Eloise', 'Nubia', 'Núñez', 'Zeke', 'Zoë', 'Åbjørn', 'Élana']" msgstr "" +#: ../../howto/sorting.rst:156 msgid "Ascending and Descending" msgstr "" -msgid "Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with a boolean value. This is used to flag descending sorts. For example, to get the student data in reverse *age* order:" +#: ../../howto/sorting.rst:158 +msgid "" +"Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with " +"a boolean value. This is used to flag descending sorts. For example, to get " +"the student data in reverse *age* order:" msgstr "" +#: ../../howto/sorting.rst:162 msgid "" ">>> sorted(student_tuples, key=itemgetter(2), reverse=True)\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n" @@ -182,33 +260,53 @@ msgid "" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" +#: ../../howto/sorting.rst:171 msgid "Sort Stability and Complex Sorts" msgstr "" -msgid "Sorts are guaranteed to be `stable `_\\. That means that when multiple records have the same key, their original order is preserved." +#: ../../howto/sorting.rst:173 +msgid "" +"Sorts are guaranteed to be `stable `_\\. That means that when multiple records have " +"the same key, their original order is preserved." msgstr "" +#: ../../howto/sorting.rst:177 msgid "" ">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" ">>> sorted(data, key=itemgetter(0))\n" "[('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]" msgstr "" -msgid "Notice how the two records for *blue* retain their original order so that ``('blue', 1)`` is guaranteed to precede ``('blue', 2)``." +#: ../../howto/sorting.rst:183 +msgid "" +"Notice how the two records for *blue* retain their original order so that " +"``('blue', 1)`` is guaranteed to precede ``('blue', 2)``." msgstr "" -msgid "This wonderful property lets you build complex sorts in a series of sorting steps. For example, to sort the student data by descending *grade* and then ascending *age*, do the *age* sort first and then sort again using *grade*:" +#: ../../howto/sorting.rst:186 +msgid "" +"This wonderful property lets you build complex sorts in a series of sorting " +"steps. For example, to sort the student data by descending *grade* and then " +"ascending *age*, do the *age* sort first and then sort again using *grade*:" msgstr "" +#: ../../howto/sorting.rst:190 msgid "" -">>> s = sorted(student_objects, key=attrgetter('age')) # sort on secondary key\n" -">>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on primary key, descending\n" +">>> s = sorted(student_objects, key=attrgetter('age')) # sort on " +"secondary key\n" +">>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on " +"primary key, descending\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" -msgid "This can be abstracted out into a wrapper function that can take a list and tuples of field and order to sort them on multiple passes." +#: ../../howto/sorting.rst:196 +msgid "" +"This can be abstracted out into a wrapper function that can take a list and " +"tuples of field and order to sort them on multiple passes." msgstr "" +#: ../../howto/sorting.rst:199 msgid "" ">>> def multisort(xs, specs):\n" "... for key, reverse in reversed(specs):\n" @@ -219,91 +317,160 @@ msgid "" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" -msgid "The `Timsort `_ algorithm used in Python does multiple sorts efficiently because it can take advantage of any ordering already present in a dataset." +#: ../../howto/sorting.rst:209 +msgid "" +"The `Timsort `_ algorithm used in " +"Python does multiple sorts efficiently because it can take advantage of any " +"ordering already present in a dataset." msgstr "" +#: ../../howto/sorting.rst:214 msgid "Decorate-Sort-Undecorate" msgstr "" +#: ../../howto/sorting.rst:216 msgid "This idiom is called Decorate-Sort-Undecorate after its three steps:" msgstr "" -msgid "First, the initial list is decorated with new values that control the sort order." +#: ../../howto/sorting.rst:218 +msgid "" +"First, the initial list is decorated with new values that control the sort " +"order." msgstr "" +#: ../../howto/sorting.rst:220 msgid "Second, the decorated list is sorted." msgstr "" -msgid "Finally, the decorations are removed, creating a list that contains only the initial values in the new order." +#: ../../howto/sorting.rst:222 +msgid "" +"Finally, the decorations are removed, creating a list that contains only the " +"initial values in the new order." msgstr "" -msgid "For example, to sort the student data by *grade* using the DSU approach:" +#: ../../howto/sorting.rst:225 +msgid "" +"For example, to sort the student data by *grade* using the DSU approach:" msgstr "" +#: ../../howto/sorting.rst:227 msgid "" -">>> decorated = [(student.grade, i, student) for i, student in enumerate(student_objects)]\n" +">>> decorated = [(student.grade, i, student) for i, student in " +"enumerate(student_objects)]\n" ">>> decorated.sort()\n" ">>> [student for grade, i, student in decorated] # undecorate\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" -msgid "This idiom works because tuples are compared lexicographically; the first items are compared; if they are the same then the second items are compared, and so on." +#: ../../howto/sorting.rst:234 +msgid "" +"This idiom works because tuples are compared lexicographically; the first " +"items are compared; if they are the same then the second items are compared, " +"and so on." msgstr "" -msgid "It is not strictly necessary in all cases to include the index *i* in the decorated list, but including it gives two benefits:" +#: ../../howto/sorting.rst:238 +msgid "" +"It is not strictly necessary in all cases to include the index *i* in the " +"decorated list, but including it gives two benefits:" msgstr "" -msgid "The sort is stable -- if two items have the same key, their order will be preserved in the sorted list." +#: ../../howto/sorting.rst:241 +msgid "" +"The sort is stable -- if two items have the same key, their order will be " +"preserved in the sorted list." msgstr "" -msgid "The original items do not have to be comparable because the ordering of the decorated tuples will be determined by at most the first two items. So for example the original list could contain complex numbers which cannot be sorted directly." +#: ../../howto/sorting.rst:244 +msgid "" +"The original items do not have to be comparable because the ordering of the " +"decorated tuples will be determined by at most the first two items. So for " +"example the original list could contain complex numbers which cannot be " +"sorted directly." msgstr "" -msgid "Another name for this idiom is `Schwartzian transform `_\\, after Randal L. Schwartz, who popularized it among Perl programmers." +#: ../../howto/sorting.rst:249 +msgid "" +"Another name for this idiom is `Schwartzian transform `_\\, after Randal L. Schwartz, " +"who popularized it among Perl programmers." msgstr "" -msgid "Now that Python sorting provides key-functions, this technique is not often needed." +#: ../../howto/sorting.rst:253 +msgid "" +"Now that Python sorting provides key-functions, this technique is not often " +"needed." msgstr "" +#: ../../howto/sorting.rst:256 msgid "Comparison Functions" msgstr "" -msgid "Unlike key functions that return an absolute value for sorting, a comparison function computes the relative ordering for two inputs." +#: ../../howto/sorting.rst:258 +msgid "" +"Unlike key functions that return an absolute value for sorting, a comparison " +"function computes the relative ordering for two inputs." msgstr "" -msgid "For example, a `balance scale `_ compares two samples giving a relative ordering: lighter, equal, or heavier. Likewise, a comparison function such as ``cmp(a, b)`` will return a negative value for less-than, zero if the inputs are equal, or a positive value for greater-than." +#: ../../howto/sorting.rst:261 +msgid "" +"For example, a `balance scale `_ compares two samples giving a " +"relative ordering: lighter, equal, or heavier. Likewise, a comparison " +"function such as ``cmp(a, b)`` will return a negative value for less-than, " +"zero if the inputs are equal, or a positive value for greater-than." msgstr "" -msgid "It is common to encounter comparison functions when translating algorithms from other languages. Also, some libraries provide comparison functions as part of their API. For example, :func:`locale.strcoll` is a comparison function." +#: ../../howto/sorting.rst:268 +msgid "" +"It is common to encounter comparison functions when translating algorithms " +"from other languages. Also, some libraries provide comparison functions as " +"part of their API. For example, :func:`locale.strcoll` is a comparison " +"function." msgstr "" -msgid "To accommodate those situations, Python provides :class:`functools.cmp_to_key` to wrap the comparison function to make it usable as a key function::" +#: ../../howto/sorting.rst:272 +msgid "" +"To accommodate those situations, Python " +"provides :class:`functools.cmp_to_key` to wrap the comparison function to " +"make it usable as a key function::" msgstr "" +#: ../../howto/sorting.rst:276 msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" msgstr "" +#: ../../howto/sorting.rst:279 msgid "Strategies For Unorderable Types and Values" msgstr "" -msgid "A number of type and value issues can arise when sorting. Here are some strategies that can help:" +#: ../../howto/sorting.rst:281 +msgid "" +"A number of type and value issues can arise when sorting. Here are some " +"strategies that can help:" msgstr "" +#: ../../howto/sorting.rst:284 msgid "Convert non-comparable input types to strings prior to sorting:" msgstr "" +#: ../../howto/sorting.rst:286 msgid "" ">>> data = ['twelve', '11', 10]\n" ">>> sorted(map(str, data))\n" "['10', '11', 'twelve']" msgstr "" -msgid "This is needed because most cross-type comparisons raise a :exc:`TypeError`." +#: ../../howto/sorting.rst:292 +msgid "" +"This is needed because most cross-type comparisons raise a :exc:`TypeError`." msgstr "" +#: ../../howto/sorting.rst:295 msgid "Remove special values prior to sorting:" msgstr "" +#: ../../howto/sorting.rst:297 msgid "" ">>> from math import isnan\n" ">>> from itertools import filterfalse\n" @@ -312,78 +479,125 @@ msgid "" "[1.1, 2.2, 3.3]" msgstr "" -msgid "This is needed because the `IEEE-754 standard `_ specifies that, \"Every NaN shall compare unordered with everything, including itself.\"" +#: ../../howto/sorting.rst:305 +msgid "" +"This is needed because the `IEEE-754 standard `_ specifies that, \"Every NaN shall compare unordered with " +"everything, including itself.\"" msgstr "" +#: ../../howto/sorting.rst:309 msgid "Likewise, ``None`` can be stripped from datasets as well:" msgstr "" +#: ../../howto/sorting.rst:311 msgid "" ">>> data = [3.3, None, 1.1, 2.2]\n" ">>> sorted(x for x in data if x is not None)\n" "[1.1, 2.2, 3.3]" msgstr "" +#: ../../howto/sorting.rst:317 msgid "This is needed because ``None`` is not comparable to other types." msgstr "" +#: ../../howto/sorting.rst:319 msgid "Convert mapping types into sorted item lists before sorting:" msgstr "" +#: ../../howto/sorting.rst:321 msgid "" ">>> data = [{'a': 1}, {'b': 2}]\n" ">>> sorted(data, key=lambda d: sorted(d.items()))\n" "[{'a': 1}, {'b': 2}]" msgstr "" -msgid "This is needed because dict-to-dict comparisons raise a :exc:`TypeError`." +#: ../../howto/sorting.rst:327 +msgid "" +"This is needed because dict-to-dict comparisons raise a :exc:`TypeError`." msgstr "" +#: ../../howto/sorting.rst:330 msgid "Convert set types into sorted lists before sorting:" msgstr "" +#: ../../howto/sorting.rst:332 msgid "" ">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" ">>> sorted(map(sorted, data))\n" "[['a', 'b', 'c'], ['b', 'c', 'd']]" msgstr "" -msgid "This is needed because the elements contained in set types do not have a deterministic order. For example, ``list({'a', 'b'})`` may produce either ``['a', 'b']`` or ``['b', 'a']``." +#: ../../howto/sorting.rst:338 +msgid "" +"This is needed because the elements contained in set types do not have a " +"deterministic order. For example, ``list({'a', 'b'})`` may produce either " +"``['a', 'b']`` or ``['b', 'a']``." msgstr "" +#: ../../howto/sorting.rst:343 msgid "Odds and Ends" msgstr "" -msgid "For locale aware sorting, use :func:`locale.strxfrm` for a key function or :func:`locale.strcoll` for a comparison function. This is necessary because \"alphabetical\" sort orderings can vary across cultures even if the underlying alphabet is the same." +#: ../../howto/sorting.rst:345 +msgid "" +"For locale aware sorting, use :func:`locale.strxfrm` for a key function " +"or :func:`locale.strcoll` for a comparison function. This is necessary " +"because \"alphabetical\" sort orderings can vary across cultures even if the " +"underlying alphabet is the same." msgstr "" -msgid "The *reverse* parameter still maintains sort stability (so that records with equal keys retain the original order). Interestingly, that effect can be simulated without the parameter by using the builtin :func:`reversed` function twice:" +#: ../../howto/sorting.rst:350 +msgid "" +"The *reverse* parameter still maintains sort stability (so that records with " +"equal keys retain the original order). Interestingly, that effect can be " +"simulated without the parameter by using the builtin :func:`reversed` " +"function twice:" msgstr "" +#: ../../howto/sorting.rst:355 msgid "" ">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" ">>> standard_way = sorted(data, key=itemgetter(0), reverse=True)\n" -">>> double_reversed = list(reversed(sorted(reversed(data), key=itemgetter(0))))\n" +">>> double_reversed = list(reversed(sorted(reversed(data), " +"key=itemgetter(0))))\n" ">>> assert standard_way == double_reversed\n" ">>> standard_way\n" "[('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]" msgstr "" -msgid "The sort routines use ``<`` when making comparisons between two objects. So, it is easy to add a standard sort order to a class by defining an :meth:`~object.__lt__` method:" +#: ../../howto/sorting.rst:364 +msgid "" +"The sort routines use ``<`` when making comparisons between two objects. So, " +"it is easy to add a standard sort order to a class by defining " +"an :meth:`~object.__lt__` method:" msgstr "" +#: ../../howto/sorting.rst:368 msgid "" ">>> Student.__lt__ = lambda self, other: self.age < other.age\n" ">>> sorted(student_objects)\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" -msgid "However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for details on the mechanics). To avoid surprises, :pep:`8` recommends that all six comparison methods be implemented. The :func:`~functools.total_ordering` decorator is provided to make that task easier." +#: ../../howto/sorting.rst:374 +msgid "" +"However, note that ``<`` can fall back to using :meth:`~object.__gt__` " +"if :meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for " +"details on the mechanics). To avoid surprises, :pep:`8` recommends that all " +"six comparison methods be implemented. The :deco:`~functools.total_ordering` " +"decorator is provided to make that task easier." msgstr "" -msgid "Key functions need not depend directly on the objects being sorted. A key function can also access external resources. For instance, if the student grades are stored in a dictionary, they can be used to sort a separate list of student names:" +#: ../../howto/sorting.rst:381 +msgid "" +"Key functions need not depend directly on the objects being sorted. A key " +"function can also access external resources. For instance, if the student " +"grades are stored in a dictionary, they can be used to sort a separate list " +"of student names:" msgstr "" +#: ../../howto/sorting.rst:386 msgid "" ">>> students = ['dave', 'john', 'jane']\n" ">>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}\n" @@ -391,17 +605,36 @@ msgid "" "['jane', 'dave', 'john']" msgstr "" +#: ../../howto/sorting.rst:394 msgid "Partial Sorts" msgstr "" -msgid "Some applications require only some of the data to be ordered. The standard library provides several tools that do less work than a full sort:" +#: ../../howto/sorting.rst:396 +msgid "" +"Some applications require only some of the data to be ordered. The standard " +"library provides several tools that do less work than a full sort:" msgstr "" -msgid ":func:`min` and :func:`max` return the smallest and largest values, respectively. These functions make a single pass over the input data and require almost no auxiliary memory." +#: ../../howto/sorting.rst:399 +msgid "" +":func:`min` and :func:`max` return the smallest and largest values, " +"respectively. These functions make a single pass over the input data and " +"require almost no auxiliary memory." msgstr "" -msgid ":func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest and largest values, respectively. These functions make a single pass over the data keeping only *n* elements in memory at a time. For values of *n* that are small relative to the number of inputs, these functions make far fewer comparisons than a full sort." +#: ../../howto/sorting.rst:403 +msgid "" +":func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest " +"and largest values, respectively. These functions make a single pass over " +"the data keeping only *n* elements in memory at a time. For values of *n* " +"that are small relative to the number of inputs, these functions make far " +"fewer comparisons than a full sort." msgstr "" -msgid ":func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a partially sorted arrangement of data that keeps the smallest element at position ``0``. These functions are suitable for implementing priority queues which are commonly used for task scheduling." +#: ../../howto/sorting.rst:409 +msgid "" +":func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a " +"partially sorted arrangement of data that keeps the smallest element at " +"position ``0``. These functions are suitable for implementing priority " +"queues which are commonly used for task scheduling." msgstr "" diff --git a/howto/timerfd.po b/howto/timerfd.po index 0388535ba..5a8ce946c 100644 --- a/howto/timerfd.po +++ b/howto/timerfd.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-05-11 01:08+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,24 +23,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/timerfd.rst:5 msgid "timer file descriptor HOWTO" msgstr "" +#: ../../howto/timerfd.rst:0 msgid "Release" msgstr "" +#: ../../howto/timerfd.rst:7 msgid "1.13" msgstr "" -msgid "This HOWTO discusses Python's support for the linux timer file descriptor." +#: ../../howto/timerfd.rst:9 +msgid "" +"This HOWTO discusses Python's support for the linux timer file descriptor." msgstr "" +#: ../../howto/timerfd.rst:13 msgid "Examples" msgstr "" -msgid "The following example shows how to use a timer file descriptor to execute a function twice a second:" +#: ../../howto/timerfd.rst:15 +msgid "" +"The following example shows how to use a timer file descriptor to execute a " +"function twice a second:" msgstr "" +#: ../../howto/timerfd.rst:18 msgid "" "# Practical scripts should use really use a non-blocking timer,\n" "# we use a blocking timer here for simplicity.\n" @@ -63,19 +73,28 @@ msgid "" " os.close(fd)" msgstr "" -msgid "To avoid the precision loss caused by the :class:`float` type, timer file descriptors allow specifying initial expiration and interval in integer nanoseconds with ``_ns`` variants of the functions." +#: ../../howto/timerfd.rst:40 +msgid "" +"To avoid the precision loss caused by the :class:`float` type, timer file " +"descriptors allow specifying initial expiration and interval in integer " +"nanoseconds with ``_ns`` variants of the functions." msgstr "" -msgid "This example shows how :func:`~select.epoll` can be used with timer file descriptors to wait until the file descriptor is ready for reading:" +#: ../../howto/timerfd.rst:44 +msgid "" +"This example shows how :func:`~select.epoll` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" msgstr "" +#: ../../howto/timerfd.rst:47 msgid "" "import os, time, select, socket, sys\n" "\n" "# Create an epoll object\n" "ep = select.epoll()\n" "\n" -"# In this example, use loopback address to send \"stop\" command to the server.\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" "#\n" "# $ telnet 127.0.0.1 1234\n" "# Trying 127.0.0.1...\n" @@ -114,22 +133,29 @@ msgid "" " # Wait for the timer to expire for 3 seconds.\n" " # epoll.poll() returns a list of (fd, event) pairs.\n" " # fd is a file descriptor.\n" -" # sock and conn[=returned value of socket.accept()] are socket objects, not file descriptors.\n" -" # So use sock.fileno() and conn.fileno() to get the file descriptors.\n" +" # sock and conn[=returned value of socket.accept()] are socket " +"objects, not file descriptors.\n" +" # So use sock.fileno() and conn.fileno() to get the file " +"descriptors.\n" " events = ep.poll(timeout)\n" "\n" -" # If more than one timer file descriptors are ready for reading at once,\n" +" # If more than one timer file descriptors are ready for reading at " +"once,\n" " # epoll.poll() returns a list of (fd, event) pairs.\n" " #\n" " # In this example settings,\n" -" # 1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, 0.75, 1.0, ...)\n" -" # 2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, 2.0, ...)\n" -" # 3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, 3.0, ...)\n" +" # 1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, " +"0.75, 1.0, ...)\n" +" # 2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, " +"2.0, ...)\n" +" # 3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, " +"3.0, ...)\n" " #\n" " # In 0.25 seconds, only 1st timer fires.\n" " # In 0.5 seconds, 1st timer and 2nd timer fires at once.\n" " # In 0.75 seconds, 1st timer and 3rd timer fires at once.\n" -" # In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at once.\n" +" # In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at " +"once.\n" " #\n" " # If a timer file descriptor is signaled more than once since\n" " # the last os.read() call, os.read() returns the number of signaled\n" @@ -149,7 +175,8 @@ msgid "" " print(f\"Reading data {fd}\")\n" " data = conn.recv(1024)\n" " if data:\n" -" # You should catch UnicodeDecodeError exception for safety.\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" " cmd = data.decode()\n" " if cmd.startswith(\"stop\"):\n" " print(f\"Stopping server\")\n" @@ -164,8 +191,10 @@ msgid "" " conn = None\n" " elif fd in fds:\n" " print(f\"Reading timer {fd}\")\n" -" count = int.from_bytes(os.read(fd, 8), byteorder=sys.byteorder)\n" -" print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n" +" count = int.from_bytes(os.read(fd, 8), " +"byteorder=sys.byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} " +"times\")\n" " else:\n" " print(f\"Unknown file descriptor {fd}\")\n" "finally:\n" @@ -175,13 +204,18 @@ msgid "" " ep.close()" msgstr "" -msgid "This example shows how :func:`~select.select` can be used with timer file descriptors to wait until the file descriptor is ready for reading:" +#: ../../howto/timerfd.rst:153 +msgid "" +"This example shows how :func:`~select.select` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" msgstr "" +#: ../../howto/timerfd.rst:156 msgid "" "import os, time, select, socket, sys\n" "\n" -"# In this example, use loopback address to send \"stop\" command to the server.\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" "#\n" "# $ telnet 127.0.0.1 1234\n" "# Trying 127.0.0.1...\n" @@ -213,7 +247,8 @@ msgid "" " while is_active:\n" " # Wait for the timer to expire for 3 seconds.\n" " # select.select() returns a list of file descriptors or objects.\n" -" rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, timeout)\n" +" rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, " +"timeout)\n" " for fd in rfd:\n" " if fd == sock:\n" " # Check if there is a connection request.\n" @@ -227,7 +262,8 @@ msgid "" " print(f\"Reading data {fd}\")\n" " data = conn.recv(1024)\n" " if data:\n" -" # You should catch UnicodeDecodeError exception for safety.\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" " cmd = data.decode()\n" " if cmd.startswith(\"stop\"):\n" " print(f\"Stopping server\")\n" @@ -242,7 +278,8 @@ msgid "" " conn = None\n" " elif fd in fds:\n" " print(f\"Reading timer {fd}\")\n" -" count = int.from_bytes(os.read(fd, 8), byteorder=sys.byteorder)\n" +" count = int.from_bytes(os.read(fd, 8), " +"byteorder=sys.byteorder)\n" " print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n" " else:\n" " print(f\"Unknown file descriptor {fd}\")\n" diff --git a/howto/unicode.po b/howto/unicode.po index 10f0b7585..8a1c2bcb8 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,39 +24,80 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/unicode.rst:5 msgid "Unicode HOWTO" msgstr "" +#: ../../howto/unicode.rst:0 msgid "Release" msgstr "" +#: ../../howto/unicode.rst:7 msgid "1.12" msgstr "" -msgid "This HOWTO discusses Python's support for the Unicode specification for representing textual data, and explains various problems that people commonly encounter when trying to work with Unicode." +#: ../../howto/unicode.rst:9 +msgid "" +"This HOWTO discusses Python's support for the Unicode specification for " +"representing textual data, and explains various problems that people " +"commonly encounter when trying to work with Unicode." msgstr "" +#: ../../howto/unicode.rst:15 msgid "Introduction to Unicode" msgstr "" +#: ../../howto/unicode.rst:18 msgid "Definitions" msgstr "" -msgid "Today's programs need to be able to handle a wide variety of characters. Applications are often internationalized to display messages and output in a variety of user-selectable languages; the same program might need to output an error message in English, French, Japanese, Hebrew, or Russian. Web content can be written in any of these languages and can also include a variety of emoji symbols. Python's string type uses the Unicode Standard for representing characters, which lets Python programs work with all these different possible characters." +#: ../../howto/unicode.rst:20 +msgid "" +"Today's programs need to be able to handle a wide variety of characters. " +"Applications are often internationalized to display messages and output in a " +"variety of user-selectable languages; the same program might need to output " +"an error message in English, French, Japanese, Hebrew, or Russian. Web " +"content can be written in any of these languages and can also include a " +"variety of emoji symbols. Python's string type uses the Unicode Standard for " +"representing characters, which lets Python programs work with all these " +"different possible characters." msgstr "" -msgid "Unicode (https://www.unicode.org/) is a specification that aims to list every character used by human languages and give each character its own unique code. The Unicode specifications are continually revised and updated to add new languages and symbols." +#: ../../howto/unicode.rst:30 +msgid "" +"Unicode (https://www.unicode.org/) is a specification that aims to list " +"every character used by human languages and give each character its own " +"unique code. The Unicode specifications are continually revised and updated " +"to add new languages and symbols." msgstr "" -msgid "A **character** is the smallest possible component of a text. 'A', 'B', 'C', etc., are all different characters. So are 'È' and 'Í'. Characters vary depending on the language or context you're talking about. For example, there's a character for \"Roman Numeral One\", 'Ⅰ', that's separate from the uppercase letter 'I'. They'll usually look the same, but these are two different characters that have different meanings." +#: ../../howto/unicode.rst:35 +msgid "" +"A **character** is the smallest possible component of a text. 'A', 'B', " +"'C', etc., are all different characters. So are 'È' and 'Í'. Characters " +"vary depending on the language or context you're talking about. For " +"example, there's a character for \"Roman Numeral One\", 'Ⅰ', that's separate " +"from the uppercase letter 'I'. They'll usually look the same, but these are " +"two different characters that have different meanings." msgstr "" -msgid "The Unicode standard describes how characters are represented by **code points**. A code point value is an integer in the range 0 to 0x10FFFF (about 1.1 million values, the `actual number assigned `_ is less than that). In the standard and in this document, a code point is written using the notation ``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal)." +#: ../../howto/unicode.rst:42 +msgid "" +"The Unicode standard describes how characters are represented by **code " +"points**. A code point value is an integer in the range 0 to 0x10FFFF " +"(about 1.1 million values, the `actual number assigned `_ is less than that). In the " +"standard and in this document, a code point is written using the notation " +"``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal)." msgstr "" -msgid "The Unicode standard contains a lot of tables listing characters and their corresponding code points:" +#: ../../howto/unicode.rst:50 +msgid "" +"The Unicode standard contains a lot of tables listing characters and their " +"corresponding code points:" msgstr "" +#: ../../howto/unicode.rst:53 msgid "" "0061 'a'; LATIN SMALL LETTER A\n" "0062 'b'; LATIN SMALL LETTER B\n" @@ -75,105 +116,222 @@ msgid "" "..." msgstr "" -msgid "Strictly, these definitions imply that it's meaningless to say 'this is character ``U+265E``'. ``U+265E`` is a code point, which represents some particular character; in this case, it represents the character 'BLACK CHESS KNIGHT', '♞'. In informal contexts, this distinction between code points and characters will sometimes be forgotten." +#: ../../howto/unicode.rst:71 +msgid "" +"Strictly, these definitions imply that it's meaningless to say 'this is " +"character ``U+265E``'. ``U+265E`` is a code point, which represents some " +"particular character; in this case, it represents the character 'BLACK CHESS " +"KNIGHT', '♞'. In informal contexts, this distinction between code points " +"and characters will sometimes be forgotten." msgstr "" -msgid "A character is represented on a screen or on paper by a set of graphical elements that's called a **glyph**. The glyph for an uppercase A, for example, is two diagonal strokes and a horizontal stroke, though the exact details will depend on the font being used. Most Python code doesn't need to worry about glyphs; figuring out the correct glyph to display is generally the job of a GUI toolkit or a terminal's font renderer." +#: ../../howto/unicode.rst:78 +msgid "" +"A character is represented on a screen or on paper by a set of graphical " +"elements that's called a **glyph**. The glyph for an uppercase A, for " +"example, is two diagonal strokes and a horizontal stroke, though the exact " +"details will depend on the font being used. Most Python code doesn't need " +"to worry about glyphs; figuring out the correct glyph to display is " +"generally the job of a GUI toolkit or a terminal's font renderer." msgstr "" +#: ../../howto/unicode.rst:87 msgid "Encodings" msgstr "" -msgid "To summarize the previous section: a Unicode string is a sequence of code points, which are numbers from 0 through ``0x10FFFF`` (1,114,111 decimal). This sequence of code points needs to be represented in memory as a set of **code units**, and **code units** are then mapped to 8-bit bytes. The rules for translating a Unicode string into a sequence of bytes are called a **character encoding**, or just an **encoding**." +#: ../../howto/unicode.rst:89 +msgid "" +"To summarize the previous section: a Unicode string is a sequence of code " +"points, which are numbers from 0 through ``0x10FFFF`` (1,114,111 decimal). " +"This sequence of code points needs to be represented in memory as a set of " +"**code units**, and **code units** are then mapped to 8-bit bytes. The " +"rules for translating a Unicode string into a sequence of bytes are called a " +"**character encoding**, or just an **encoding**." msgstr "" -msgid "The first encoding you might think of is using 32-bit integers as the code unit, and then using the CPU's representation of 32-bit integers. In this representation, the string \"Python\" might look like this:" +#: ../../howto/unicode.rst:97 +msgid "" +"The first encoding you might think of is using 32-bit integers as the code " +"unit, and then using the CPU's representation of 32-bit integers. In this " +"representation, the string \"Python\" might look like this:" msgstr "" +#: ../../howto/unicode.rst:101 msgid "" " P y t h o n\n" "0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00\n" " 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23" msgstr "" -msgid "This representation is straightforward but using it presents a number of problems." +#: ../../howto/unicode.rst:107 +msgid "" +"This representation is straightforward but using it presents a number of " +"problems." msgstr "" +#: ../../howto/unicode.rst:110 msgid "It's not portable; different processors order the bytes differently." msgstr "" -msgid "It's very wasteful of space. In most texts, the majority of the code points are less than 127, or less than 255, so a lot of space is occupied by ``0x00`` bytes. The above string takes 24 bytes compared to the 6 bytes needed for an ASCII representation. Increased RAM usage doesn't matter too much (desktop computers have gigabytes of RAM, and strings aren't usually that large), but expanding our usage of disk and network bandwidth by a factor of 4 is intolerable." +#: ../../howto/unicode.rst:112 +msgid "" +"It's very wasteful of space. In most texts, the majority of the code points " +"are less than 127, or less than 255, so a lot of space is occupied by " +"``0x00`` bytes. The above string takes 24 bytes compared to the 6 bytes " +"needed for an ASCII representation. Increased RAM usage doesn't matter too " +"much (desktop computers have gigabytes of RAM, and strings aren't usually " +"that large), but expanding our usage of disk and network bandwidth by a " +"factor of 4 is intolerable." msgstr "" -msgid "It's not compatible with existing C functions such as ``strlen()``, so a new family of wide string functions would need to be used." +#: ../../howto/unicode.rst:120 +msgid "" +"It's not compatible with existing C functions such as ``strlen()``, so a new " +"family of wide string functions would need to be used." msgstr "" -msgid "Therefore this encoding isn't used very much, and people instead choose other encodings that are more efficient and convenient, such as UTF-8." +#: ../../howto/unicode.rst:123 +msgid "" +"Therefore this encoding isn't used very much, and people instead choose " +"other encodings that are more efficient and convenient, such as UTF-8." msgstr "" -msgid "UTF-8 is one of the most commonly used encodings, and Python often defaults to using it. UTF stands for \"Unicode Transformation Format\", and the '8' means that 8-bit values are used in the encoding. (There are also UTF-16 and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 uses the following rules:" +#: ../../howto/unicode.rst:126 +msgid "" +"UTF-8 is one of the most commonly used encodings, and Python often defaults " +"to using it. UTF stands for \"Unicode Transformation Format\", and the '8' " +"means that 8-bit values are used in the encoding. (There are also UTF-16 " +"and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 " +"uses the following rules:" msgstr "" -msgid "If the code point is < 128, it's represented by the corresponding byte value." +#: ../../howto/unicode.rst:132 +msgid "" +"If the code point is < 128, it's represented by the corresponding byte value." msgstr "" -msgid "If the code point is >= 128, it's turned into a sequence of two, three, or four bytes, where each byte of the sequence is between 128 and 255." +#: ../../howto/unicode.rst:133 +msgid "" +"If the code point is >= 128, it's turned into a sequence of two, three, or " +"four bytes, where each byte of the sequence is between 128 and 255." msgstr "" +#: ../../howto/unicode.rst:136 msgid "UTF-8 has several convenient properties:" msgstr "" +#: ../../howto/unicode.rst:138 msgid "It can handle any Unicode code point." msgstr "" -msgid "A Unicode string is turned into a sequence of bytes that contains embedded zero bytes only where they represent the null character (U+0000). This means that UTF-8 strings can be processed by C functions such as ``strcpy()`` and sent through protocols that can't handle zero bytes for anything other than end-of-string markers." +#: ../../howto/unicode.rst:139 +msgid "" +"A Unicode string is turned into a sequence of bytes that contains embedded " +"zero bytes only where they represent the null character (U+0000). This means " +"that UTF-8 strings can be processed by C functions such as ``strcpy()`` and " +"sent through protocols that can't handle zero bytes for anything other than " +"end-of-string markers." msgstr "" +#: ../../howto/unicode.rst:144 msgid "A string of ASCII text is also valid UTF-8 text." msgstr "" -msgid "UTF-8 is fairly compact; the majority of commonly used characters can be represented with one or two bytes." +#: ../../howto/unicode.rst:145 +msgid "" +"UTF-8 is fairly compact; the majority of commonly used characters can be " +"represented with one or two bytes." msgstr "" -msgid "If bytes are corrupted or lost, it's possible to determine the start of the next UTF-8-encoded code point and resynchronize. It's also unlikely that random 8-bit data will look like valid UTF-8." +#: ../../howto/unicode.rst:147 +msgid "" +"If bytes are corrupted or lost, it's possible to determine the start of the " +"next UTF-8-encoded code point and resynchronize. It's also unlikely that " +"random 8-bit data will look like valid UTF-8." msgstr "" -msgid "UTF-8 is a byte oriented encoding. The encoding specifies that each character is represented by a specific sequence of one or more bytes. This avoids the byte-ordering issues that can occur with integer and word oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes varies depending on the hardware on which the string was encoded." +#: ../../howto/unicode.rst:150 +msgid "" +"UTF-8 is a byte oriented encoding. The encoding specifies that each " +"character is represented by a specific sequence of one or more bytes. This " +"avoids the byte-ordering issues that can occur with integer and word " +"oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes " +"varies depending on the hardware on which the string was encoded." msgstr "" +#: ../../howto/unicode.rst:158 ../../howto/unicode.rst:516 +#: ../../howto/unicode.rst:737 msgid "References" msgstr "" -msgid "The `Unicode Consortium site `_ has character charts, a glossary, and PDF versions of the Unicode specification. Be prepared for some difficult reading. `A chronology `_ of the origin and development of Unicode is also available on the site." +#: ../../howto/unicode.rst:160 +msgid "" +"The `Unicode Consortium site `_ has character " +"charts, a glossary, and PDF versions of the Unicode specification. Be " +"prepared for some difficult reading. `A chronology `_ of the origin and development of Unicode is also available on " +"the site." msgstr "" -msgid "On the Computerphile Youtube channel, Tom Scott briefly `discusses the history of Unicode and UTF-8 `_ (9 minutes 36 seconds)." +#: ../../howto/unicode.rst:165 +msgid "" +"On the Computerphile Youtube channel, Tom Scott briefly `discusses the " +"history of Unicode and UTF-8 `_ " +"(9 minutes 36 seconds)." msgstr "" -msgid "To help understand the standard, Jukka Korpela has written `an introductory guide `_ to reading the Unicode character tables." +#: ../../howto/unicode.rst:169 +msgid "" +"To help understand the standard, Jukka Korpela has written `an introductory " +"guide `_ to reading the Unicode " +"character tables." msgstr "" -msgid "Another `good introductory article `_ was written by Joel Spolsky. If this introduction didn't make things clear to you, you should try reading this alternate article before continuing." +#: ../../howto/unicode.rst:173 +msgid "" +"Another `good introductory article `_ was " +"written by Joel Spolsky. If this introduction didn't make things clear to " +"you, you should try reading this alternate article before continuing." msgstr "" -msgid "Wikipedia entries are often helpful; see the entries for \"`character encoding `_\" and `UTF-8 `_, for example." +#: ../../howto/unicode.rst:178 +msgid "" +"Wikipedia entries are often helpful; see the entries for \"`character " +"encoding `_\" and `UTF-8 " +"`_, for example." msgstr "" +#: ../../howto/unicode.rst:184 msgid "Python's Unicode Support" msgstr "" -msgid "Now that you've learned the rudiments of Unicode, we can look at Python's Unicode features." +#: ../../howto/unicode.rst:186 +msgid "" +"Now that you've learned the rudiments of Unicode, we can look at Python's " +"Unicode features." msgstr "" +#: ../../howto/unicode.rst:190 msgid "The String Type" msgstr "" -msgid "Since Python 3.0, the language's :class:`str` type contains Unicode characters, meaning any string created using ``\"unicode rocks!\"``, ``'unicode rocks!'``, or the triple-quoted string syntax is stored as Unicode." +#: ../../howto/unicode.rst:192 +msgid "" +"Since Python 3.0, the language's :class:`str` type contains Unicode " +"characters, meaning any string created using ``\"unicode rocks!\"``, " +"``'unicode rocks!'``, or the triple-quoted string syntax is stored as " +"Unicode." msgstr "" -msgid "The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal::" +#: ../../howto/unicode.rst:196 +msgid "" +"The default encoding for Python source code is UTF-8, so you can simply " +"include a Unicode character in a string literal::" msgstr "" +#: ../../howto/unicode.rst:199 msgid "" "try:\n" " with open('/tmp/input.txt', 'r') as f:\n" @@ -183,18 +341,27 @@ msgid "" " print(\"Fichier non trouvé\")" msgstr "" -msgid "Side note: Python 3 also supports using Unicode characters in identifiers::" +#: ../../howto/unicode.rst:206 +msgid "" +"Side note: Python 3 also supports using Unicode characters in identifiers::" msgstr "" +#: ../../howto/unicode.rst:208 msgid "" "répertoire = \"/tmp/records.log\"\n" "with open(répertoire, \"w\") as f:\n" " f.write(\"test\\n\")" msgstr "" -msgid "If you can't enter a particular character in your editor or want to keep the source code ASCII-only for some reason, you can also use escape sequences in string literals. (Depending on your system, you may see the actual capital-delta glyph instead of a \\u escape.) ::" +#: ../../howto/unicode.rst:212 +msgid "" +"If you can't enter a particular character in your editor or want to keep the " +"source code ASCII-only for some reason, you can also use escape sequences in " +"string literals. (Depending on your system, you may see the actual capital-" +"delta glyph instead of a \\u escape.) ::" msgstr "" +#: ../../howto/unicode.rst:217 msgid "" ">>> \"\\N{GREEK CAPITAL LETTER DELTA}\" # Using the character name\n" "'\\u0394'\n" @@ -204,12 +371,25 @@ msgid "" "'\\u0394'" msgstr "" -msgid "In addition, one can create a string using the :func:`~bytes.decode` method of :class:`bytes`. This method takes an *encoding* argument, such as ``UTF-8``, and optionally an *errors* argument." +#: ../../howto/unicode.rst:224 +msgid "" +"In addition, one can create a string using the :func:`~bytes.decode` method " +"of :class:`bytes`. This method takes an *encoding* argument, such as " +"``UTF-8``, and optionally an *errors* argument." msgstr "" -msgid "The *errors* argument specifies the response when the input string can't be converted according to the encoding's rules. Legal values for this argument are ``'strict'`` (raise a :exc:`UnicodeDecodeError` exception), ``'replace'`` (use ``U+FFFD``, ``REPLACEMENT CHARACTER``), ``'ignore'`` (just leave the character out of the Unicode result), or ``'backslashreplace'`` (inserts a ``\\xNN`` escape sequence). The following examples show the differences::" +#: ../../howto/unicode.rst:228 +msgid "" +"The *errors* argument specifies the response when the input string can't be " +"converted according to the encoding's rules. Legal values for this argument " +"are ``'strict'`` (raise a :exc:`UnicodeDecodeError` exception), " +"``'replace'`` (use ``U+FFFD``, ``REPLACEMENT CHARACTER``), ``'ignore'`` " +"(just leave the character out of the Unicode result), or " +"``'backslashreplace'`` (inserts a ``\\xNN`` escape sequence). The following " +"examples show the differences::" msgstr "" +#: ../../howto/unicode.rst:236 msgid "" ">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" @@ -224,12 +404,25 @@ msgid "" "'abc'" msgstr "" -msgid "Encodings are specified as strings containing the encoding's name. Python comes with roughly 100 different encodings; see the Python Library Reference at :ref:`standard-encodings` for a list. Some encodings have multiple names; for example, ``'latin-1'``, ``'iso_8859_1'`` and ``'8859``' are all synonyms for the same encoding." +#: ../../howto/unicode.rst:248 +msgid "" +"Encodings are specified as strings containing the encoding's name. Python " +"comes with roughly 100 different encodings; see the Python Library Reference " +"at :ref:`standard-encodings` for a list. Some encodings have multiple " +"names; for example, ``'latin-1'``, ``'iso_8859_1'`` and ``'8859``' are all " +"synonyms for the same encoding." msgstr "" -msgid "One-character Unicode strings can also be created with the :func:`chr` built-in function, which takes integers and returns a Unicode string of length 1 that contains the corresponding code point. The reverse operation is the built-in :func:`ord` function that takes a one-character Unicode string and returns the code point value::" +#: ../../howto/unicode.rst:254 +msgid "" +"One-character Unicode strings can also be created with the :func:`chr` built-" +"in function, which takes integers and returns a Unicode string of length 1 " +"that contains the corresponding code point. The reverse operation is the " +"built-in :func:`ord` function that takes a one-character Unicode string and " +"returns the code point value::" msgstr "" +#: ../../howto/unicode.rst:260 msgid "" ">>> chr(57344)\n" "'\\ue000'\n" @@ -237,18 +430,33 @@ msgid "" "57344" msgstr "" +#: ../../howto/unicode.rst:266 msgid "Converting to Bytes" msgstr "" -msgid "The opposite method of :meth:`bytes.decode` is :meth:`str.encode`, which returns a :class:`bytes` representation of the Unicode string, encoded in the requested *encoding*." +#: ../../howto/unicode.rst:268 +msgid "" +"The opposite method of :meth:`bytes.decode` is :meth:`str.encode`, which " +"returns a :class:`bytes` representation of the Unicode string, encoded in " +"the requested *encoding*." msgstr "" -msgid "The *errors* parameter is the same as the parameter of the :meth:`~bytes.decode` method but supports a few more possible handlers. As well as ``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case inserts a question mark instead of the unencodable character), there is also ``'xmlcharrefreplace'`` (inserts an XML character reference), ``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and ``namereplace`` (inserts a ``\\N{...}`` escape sequence)." +#: ../../howto/unicode.rst:272 +msgid "" +"The *errors* parameter is the same as the parameter of " +"the :meth:`~bytes.decode` method but supports a few more possible handlers. " +"As well as ``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case " +"inserts a question mark instead of the unencodable character), there is also " +"``'xmlcharrefreplace'`` (inserts an XML character reference), " +"``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and " +"``namereplace`` (inserts a ``\\N{...}`` escape sequence)." msgstr "" +#: ../../howto/unicode.rst:280 msgid "The following example shows the different results::" msgstr "" +#: ../../howto/unicode.rst:282 msgid "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" @@ -270,15 +478,29 @@ msgid "" "b'\\\\N{YI SYLLABLE IT}abcd\\\\u07b4'" msgstr "" -msgid "The low-level routines for registering and accessing the available encodings are found in the :mod:`codecs` module. Implementing new encodings also requires understanding the :mod:`codecs` module. However, the encoding and decoding functions returned by this module are usually more low-level than is comfortable, and writing new encodings is a specialized task, so the module won't be covered in this HOWTO." +#: ../../howto/unicode.rst:301 +msgid "" +"The low-level routines for registering and accessing the available encodings " +"are found in the :mod:`codecs` module. Implementing new encodings also " +"requires understanding the :mod:`codecs` module. However, the encoding and " +"decoding functions returned by this module are usually more low-level than " +"is comfortable, and writing new encodings is a specialized task, so the " +"module won't be covered in this HOWTO." msgstr "" +#: ../../howto/unicode.rst:310 msgid "Unicode Literals in Python Source Code" msgstr "" -msgid "In Python source code, specific Unicode code points can be written using the ``\\u`` escape sequence, which is followed by four hex digits giving the code point. The ``\\U`` escape sequence is similar, but expects eight hex digits, not four::" +#: ../../howto/unicode.rst:312 +msgid "" +"In Python source code, specific Unicode code points can be written using the " +"``\\u`` escape sequence, which is followed by four hex digits giving the " +"code point. The ``\\U`` escape sequence is similar, but expects eight hex " +"digits, not four::" msgstr "" +#: ../../howto/unicode.rst:317 msgid "" ">>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n" "... # ^^^^ two-digit hex escape\n" @@ -288,15 +510,32 @@ msgid "" "[97, 172, 4660, 8364, 32768]" msgstr "" -msgid "Using escape sequences for code points greater than 127 is fine in small doses, but becomes an annoyance if you're using many accented characters, as you would in a program with messages in French or some other accent-using language. You can also assemble strings using the :func:`chr` built-in function, but this is even more tedious." +#: ../../howto/unicode.rst:324 +msgid "" +"Using escape sequences for code points greater than 127 is fine in small " +"doses, but becomes an annoyance if you're using many accented characters, as " +"you would in a program with messages in French or some other accent-using " +"language. You can also assemble strings using the :func:`chr` built-in " +"function, but this is even more tedious." msgstr "" -msgid "Ideally, you'd want to be able to write literals in your language's natural encoding. You could then edit Python source code with your favorite editor which would display the accented characters naturally, and have the right characters used at runtime." +#: ../../howto/unicode.rst:330 +msgid "" +"Ideally, you'd want to be able to write literals in your language's natural " +"encoding. You could then edit Python source code with your favorite editor " +"which would display the accented characters naturally, and have the right " +"characters used at runtime." msgstr "" -msgid "Python supports writing source code in UTF-8 by default, but you can use almost any encoding if you declare the encoding being used. This is done by including a special comment as either the first or second line of the source file::" +#: ../../howto/unicode.rst:335 +msgid "" +"Python supports writing source code in UTF-8 by default, but you can use " +"almost any encoding if you declare the encoding being used. This is done by " +"including a special comment as either the first or second line of the source " +"file::" msgstr "" +#: ../../howto/unicode.rst:339 msgid "" "#!/usr/bin/env python\n" "# -*- coding: latin-1 -*-\n" @@ -305,21 +544,42 @@ msgid "" "print(ord(u[-1]))" msgstr "" -msgid "The syntax is inspired by Emacs's notation for specifying variables local to a file. Emacs supports many different variables, but Python only supports 'coding'. The ``-*-`` symbols indicate to Emacs that the comment is special; they have no significance to Python but are a convention. Python looks for ``coding: name`` or ``coding=name`` in the comment." +#: ../../howto/unicode.rst:345 +msgid "" +"The syntax is inspired by Emacs's notation for specifying variables local to " +"a file. Emacs supports many different variables, but Python only supports " +"'coding'. The ``-*-`` symbols indicate to Emacs that the comment is " +"special; they have no significance to Python but are a convention. Python " +"looks for ``coding: name`` or ``coding=name`` in the comment." msgstr "" -msgid "If you don't include such a comment, the default encoding used will be UTF-8 as already mentioned. See also :pep:`263` for more information." +#: ../../howto/unicode.rst:351 +msgid "" +"If you don't include such a comment, the default encoding used will be UTF-8 " +"as already mentioned. See also :pep:`263` for more information." msgstr "" +#: ../../howto/unicode.rst:358 msgid "Unicode Properties" msgstr "" -msgid "The Unicode specification includes a database of information about code points. For each defined code point, the information includes the character's name, its category, the numeric value if applicable (for characters representing numeric concepts such as the Roman numerals, fractions such as one-third and four-fifths, etc.). There are also display-related properties, such as how to use the code point in bidirectional text." +#: ../../howto/unicode.rst:360 +msgid "" +"The Unicode specification includes a database of information about code " +"points. For each defined code point, the information includes the " +"character's name, its category, the numeric value if applicable (for " +"characters representing numeric concepts such as the Roman numerals, " +"fractions such as one-third and four-fifths, etc.). There are also display-" +"related properties, such as how to use the code point in bidirectional text." msgstr "" -msgid "The following program displays some information about several characters, and prints the numeric value of one particular character::" +#: ../../howto/unicode.rst:368 +msgid "" +"The following program displays some information about several characters, " +"and prints the numeric value of one particular character::" msgstr "" +#: ../../howto/unicode.rst:371 msgid "" "import unicodedata\n" "\n" @@ -333,9 +593,11 @@ msgid "" "print(unicodedata.numeric(u[1]))" msgstr "" +#: ../../howto/unicode.rst:382 msgid "When run, this prints:" msgstr "" +#: ../../howto/unicode.rst:384 msgid "" "0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE\n" "1 0bf2 No TAMIL NUMBER ONE THOUSAND\n" @@ -345,27 +607,60 @@ msgid "" "1000.0" msgstr "" -msgid "The category codes are abbreviations describing the nature of the character. These are grouped into categories such as \"Letter\", \"Number\", \"Punctuation\", or \"Symbol\", which in turn are broken up into subcategories. To take the codes from the above output, ``'Ll'`` means 'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category Values section of the Unicode Character Database documentation `_ for a list of category codes." -msgstr "" - +#: ../../howto/unicode.rst:393 +msgid "" +"The category codes are abbreviations describing the nature of the character. " +"These are grouped into categories such as \"Letter\", \"Number\", " +"\"Punctuation\", or \"Symbol\", which in turn are broken up into " +"subcategories. To take the codes from the above output, ``'Ll'`` means " +"'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, " +"nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category " +"Values section of the Unicode Character Database documentation `_ for a list of " +"category codes." +msgstr "" + +#: ../../howto/unicode.rst:404 msgid "Comparing Strings" msgstr "" -msgid "Unicode adds some complication to comparing strings, because the same set of characters can be represented by different sequences of code points. For example, a letter like 'ê' can be represented as a single code point U+00EA, or as U+0065 U+0302, which is the code point for 'e' followed by a code point for 'COMBINING CIRCUMFLEX ACCENT'. These will produce the same output when printed, but one is a string of length 1 and the other is of length 2." +#: ../../howto/unicode.rst:406 +msgid "" +"Unicode adds some complication to comparing strings, because the same set of " +"characters can be represented by different sequences of code points. For " +"example, a letter like 'ê' can be represented as a single code point U+00EA, " +"or as U+0065 U+0302, which is the code point for 'e' followed by a code " +"point for 'COMBINING CIRCUMFLEX ACCENT'. These will produce the same output " +"when printed, but one is a string of length 1 and the other is of length 2." msgstr "" -msgid "One tool for a case-insensitive comparison is the :meth:`~str.casefold` string method that converts a string to a case-insensitive form following an algorithm described by the Unicode Standard. This algorithm has special handling for characters such as the German letter 'ß' (code point U+00DF), which becomes the pair of lowercase letters 'ss'." +#: ../../howto/unicode.rst:414 +msgid "" +"One tool for a case-insensitive comparison is the :meth:`~str.casefold` " +"string method that converts a string to a case-insensitive form following an " +"algorithm described by the Unicode Standard. This algorithm has special " +"handling for characters such as the German letter 'ß' (code point U+00DF), " +"which becomes the pair of lowercase letters 'ss'." msgstr "" +#: ../../howto/unicode.rst:423 msgid "" ">>> street = 'Gürzenichstraße'\n" ">>> street.casefold()\n" "'gürzenichstrasse'" msgstr "" -msgid "A second tool is the :mod:`unicodedata` module's :func:`~unicodedata.normalize` function that converts strings to one of several normal forms, where letters followed by a combining character are replaced with single characters. :func:`~unicodedata.normalize` can be used to perform string comparisons that won't falsely report inequality if two strings use combining characters differently:" +#: ../../howto/unicode.rst:427 +msgid "" +"A second tool is the :mod:`unicodedata` " +"module's :func:`~unicodedata.normalize` function that converts strings to " +"one of several normal forms, where letters followed by a combining character " +"are replaced with single characters. :func:`~unicodedata.normalize` can be " +"used to perform string comparisons that won't falsely report inequality if " +"two strings use combining characters differently:" msgstr "" +#: ../../howto/unicode.rst:436 msgid "" "import unicodedata\n" "\n" @@ -376,15 +671,18 @@ msgid "" " return NFD(s1) == NFD(s2)\n" "\n" "single_char = 'ê'\n" -"multiple_chars = '\\N{LATIN SMALL LETTER E}\\N{COMBINING CIRCUMFLEX ACCENT}'\n" +"multiple_chars = '\\N{LATIN SMALL LETTER E}\\N{COMBINING CIRCUMFLEX " +"ACCENT}'\n" "print('length of first string=', len(single_char))\n" "print('length of second string=', len(multiple_chars))\n" "print(compare_strs(single_char, multiple_chars))" msgstr "" +#: ../../howto/unicode.rst:450 msgid "When run, this outputs:" msgstr "" +#: ../../howto/unicode.rst:452 msgid "" "$ python compare-strs.py\n" "length of first string= 1\n" @@ -392,12 +690,18 @@ msgid "" "True" msgstr "" -msgid "The first argument to the :func:`~unicodedata.normalize` function is a string giving the desired normalization form, which can be one of 'NFC', 'NFKC', 'NFD', and 'NFKD'." +#: ../../howto/unicode.rst:459 +msgid "" +"The first argument to the :func:`~unicodedata.normalize` function is a " +"string giving the desired normalization form, which can be one of 'NFC', " +"'NFKC', 'NFD', and 'NFKD'." msgstr "" +#: ../../howto/unicode.rst:463 msgid "The Unicode Standard also specifies how to do caseless comparisons::" msgstr "" +#: ../../howto/unicode.rst:465 msgid "" "import unicodedata\n" "\n" @@ -409,23 +713,41 @@ msgid "" "\n" "# Example usage\n" "single_char = 'ê'\n" -"multiple_chars = '\\N{LATIN CAPITAL LETTER E}\\N{COMBINING CIRCUMFLEX ACCENT}'\n" +"multiple_chars = '\\N{LATIN CAPITAL LETTER E}\\N{COMBINING CIRCUMFLEX " +"ACCENT}'\n" "\n" "print(compare_caseless(single_char, multiple_chars))" msgstr "" -msgid "This will print ``True``. (Why is :func:`!NFD` invoked twice? Because there are a few characters that make :meth:`~str.casefold` return a non-normalized string, so the result needs to be normalized again. See section 3.13 of the Unicode Standard for a discussion and an example.)" +#: ../../howto/unicode.rst:479 +msgid "" +"This will print ``True``. (Why is :func:`!NFD` invoked twice? Because " +"there are a few characters that make :meth:`~str.casefold` return a non-" +"normalized string, so the result needs to be normalized again. See section " +"3.13 of the Unicode Standard for a discussion and an example.)" msgstr "" +#: ../../howto/unicode.rst:486 msgid "Unicode Regular Expressions" msgstr "" -msgid "The regular expressions supported by the :mod:`re` module can be provided either as bytes or strings. Some of the special character sequences such as ``\\d`` and ``\\w`` have different meanings depending on whether the pattern is supplied as bytes or a string. For example, ``\\d`` will match the characters ``[0-9]`` in bytes but in strings will match any character that's in the ``'Nd'`` category." +#: ../../howto/unicode.rst:488 +msgid "" +"The regular expressions supported by the :mod:`re` module can be provided " +"either as bytes or strings. Some of the special character sequences such as " +"``\\d`` and ``\\w`` have different meanings depending on whether the pattern " +"is supplied as bytes or a string. For example, ``\\d`` will match the " +"characters ``[0-9]`` in bytes but in strings will match any character that's " +"in the ``'Nd'`` category." msgstr "" -msgid "The string in this example has the number 57 written in both Thai and Arabic numerals::" +#: ../../howto/unicode.rst:495 +msgid "" +"The string in this example has the number 57 written in both Thai and Arabic " +"numerals::" msgstr "" +#: ../../howto/unicode.rst:498 msgid "" "import re\n" "p = re.compile(r'\\d+')\n" @@ -435,63 +757,133 @@ msgid "" "print(repr(m.group()))" msgstr "" -msgid "When executed, ``\\d+`` will match the Thai numerals and print them out. If you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\\d+`` will match the substring \"57\" instead." +#: ../../howto/unicode.rst:505 +msgid "" +"When executed, ``\\d+`` will match the Thai numerals and print them out. If " +"you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\\d+`` will " +"match the substring \"57\" instead." msgstr "" -msgid "Similarly, ``\\w`` matches a wide variety of Unicode characters but only ``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\\s`` will match either Unicode whitespace characters or ``[ \\t\\n\\r\\f\\v]``." +#: ../../howto/unicode.rst:509 +msgid "" +"Similarly, ``\\w`` matches a wide variety of Unicode characters but only " +"``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\\s`` " +"will match either Unicode whitespace characters or ``[ \\t\\n\\r\\f\\v]``." msgstr "" +#: ../../howto/unicode.rst:520 msgid "Some good alternative discussions of Python's Unicode support are:" msgstr "" -msgid "`Processing Text Files in Python 3 `_, by Nick Coghlan." +#: ../../howto/unicode.rst:522 +msgid "" +"`Processing Text Files in Python 3 `_, " +"by Nick Coghlan." msgstr "" -msgid "`Pragmatic Unicode `_, a PyCon 2012 presentation by Ned Batchelder." +#: ../../howto/unicode.rst:523 +msgid "" +"`Pragmatic Unicode `_, a PyCon " +"2012 presentation by Ned Batchelder." msgstr "" -msgid "The :class:`str` type is described in the Python library reference at :ref:`textseq`." +#: ../../howto/unicode.rst:525 +msgid "" +"The :class:`str` type is described in the Python library reference " +"at :ref:`textseq`." msgstr "" +#: ../../howto/unicode.rst:528 msgid "The documentation for the :mod:`unicodedata` module." msgstr "" +#: ../../howto/unicode.rst:530 msgid "The documentation for the :mod:`codecs` module." msgstr "" -msgid "Marc-André Lemburg gave `a presentation titled \"Python and Unicode\" (PDF slides) `_ at EuroPython 2002. The slides are an excellent overview of the design of Python 2's Unicode features (where the Unicode string type is called ``unicode`` and literals start with ``u``)." +#: ../../howto/unicode.rst:532 +msgid "" +"Marc-André Lemburg gave `a presentation titled \"Python and Unicode\" (PDF " +"slides) `_ at " +"EuroPython 2002. The slides are an excellent overview of the design of " +"Python 2's Unicode features (where the Unicode string type is called " +"``unicode`` and literals start with ``u``)." msgstr "" +#: ../../howto/unicode.rst:540 msgid "Reading and Writing Unicode Data" msgstr "" -msgid "Once you've written some code that works with Unicode data, the next problem is input/output. How do you get Unicode strings into your program, and how do you convert Unicode into a form suitable for storage or transmission?" -msgstr "" - -msgid "It's possible that you may not need to do anything depending on your input sources and output destinations; you should check whether the libraries used in your application support Unicode natively. XML parsers often return Unicode data, for example. Many relational databases also support Unicode-valued columns and can return Unicode values from an SQL query." +#: ../../howto/unicode.rst:542 +msgid "" +"Once you've written some code that works with Unicode data, the next problem " +"is input/output. How do you get Unicode strings into your program, and how " +"do you convert Unicode into a form suitable for storage or transmission?" msgstr "" -msgid "Unicode data is usually converted to a particular encoding before it gets written to disk or sent over a socket. It's possible to do all the work yourself: open a file, read an 8-bit bytes object from it, and convert the bytes with ``bytes.decode(encoding)``. However, the manual approach is not recommended." +#: ../../howto/unicode.rst:546 +msgid "" +"It's possible that you may not need to do anything depending on your input " +"sources and output destinations; you should check whether the libraries used " +"in your application support Unicode natively. XML parsers often return " +"Unicode data, for example. Many relational databases also support Unicode-" +"valued columns and can return Unicode values from an SQL query." msgstr "" -msgid "One problem is the multi-byte nature of encodings; one Unicode character can be represented by several bytes. If you want to read the file in arbitrary-sized chunks (say, 1024 or 4096 bytes), you need to write error-handling code to catch the case where only part of the bytes encoding a single Unicode character are read at the end of a chunk. One solution would be to read the entire file into memory and then perform the decoding, but that prevents you from working with files that are extremely large; if you need to read a 2 GiB file, you need 2 GiB of RAM. (More, really, since for at least a moment you'd need to have both the encoded string and its Unicode version in memory.)" +#: ../../howto/unicode.rst:552 +msgid "" +"Unicode data is usually converted to a particular encoding before it gets " +"written to disk or sent over a socket. It's possible to do all the work " +"yourself: open a file, read an 8-bit bytes object from it, and convert the " +"bytes with ``bytes.decode(encoding)``. However, the manual approach is not " +"recommended." msgstr "" -msgid "The solution would be to use the low-level decoding interface to catch the case of partial coding sequences. The work of implementing this has already been done for you: the built-in :func:`open` function can return a file-like object that assumes the file's contents are in a specified encoding and accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s *encoding* and *errors* parameters which are interpreted just like those in :meth:`str.encode` and :meth:`bytes.decode`." +#: ../../howto/unicode.rst:557 +msgid "" +"One problem is the multi-byte nature of encodings; one Unicode character can " +"be represented by several bytes. If you want to read the file in arbitrary-" +"sized chunks (say, 1024 or 4096 bytes), you need to write error-handling " +"code to catch the case where only part of the bytes encoding a single " +"Unicode character are read at the end of a chunk. One solution would be to " +"read the entire file into memory and then perform the decoding, but that " +"prevents you from working with files that are extremely large; if you need " +"to read a 2 GiB file, you need 2 GiB of RAM. (More, really, since for at " +"least a moment you'd need to have both the encoded string and its Unicode " +"version in memory.)" +msgstr "" + +#: ../../howto/unicode.rst:567 +msgid "" +"The solution would be to use the low-level decoding interface to catch the " +"case of partial coding sequences. The work of implementing this has already " +"been done for you: the built-in :func:`open` function can return a file-like " +"object that assumes the file's contents are in a specified encoding and " +"accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` " +"and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s " +"*encoding* and *errors* parameters which are interpreted just like those " +"in :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" +#: ../../howto/unicode.rst:576 msgid "Reading Unicode from a file is therefore simple::" msgstr "" +#: ../../howto/unicode.rst:578 msgid "" "with open('unicode.txt', encoding='utf-8') as f:\n" " for line in f:\n" " print(repr(line))" msgstr "" -msgid "It's also possible to open files in update mode, allowing both reading and writing::" +#: ../../howto/unicode.rst:582 +msgid "" +"It's also possible to open files in update mode, allowing both reading and " +"writing::" msgstr "" +#: ../../howto/unicode.rst:585 msgid "" "with open('test', encoding='utf-8', mode='w+') as f:\n" " f.write('\\u4500 blah blah blah\\n')\n" @@ -499,33 +891,81 @@ msgid "" " print(repr(f.readline()[:1]))" msgstr "" -msgid "The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is often written as the first character of a file in order to assist with autodetection of the file's byte ordering. Some encodings, such as UTF-16, expect a BOM to be present at the start of a file; when such an encoding is used, the BOM will be automatically written as the first character and will be silently dropped when the file is read. There are variants of these encodings, such as 'utf-16-le' and 'utf-16-be' for little-endian and big-endian encodings, that specify one particular byte ordering and don't skip the BOM." -msgstr "" - -msgid "In some areas, it is also convention to use a \"BOM\" at the start of UTF-8 encoded files; the name is misleading since UTF-8 is not byte-order dependent. The mark simply announces that the file is encoded in UTF-8. For reading such files, use the 'utf-8-sig' codec to automatically skip the mark if present." +#: ../../howto/unicode.rst:590 +msgid "" +"The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is " +"often written as the first character of a file in order to assist with " +"autodetection of the file's byte ordering. Some encodings, such as UTF-16, " +"expect a BOM to be present at the start of a file; when such an encoding is " +"used, the BOM will be automatically written as the first character and will " +"be silently dropped when the file is read. There are variants of these " +"encodings, such as 'utf-16-le' and 'utf-16-be' for little-endian and big-" +"endian encodings, that specify one particular byte ordering and don't skip " +"the BOM." +msgstr "" + +#: ../../howto/unicode.rst:599 +msgid "" +"In some areas, it is also convention to use a \"BOM\" at the start of UTF-8 " +"encoded files; the name is misleading since UTF-8 is not byte-order " +"dependent. The mark simply announces that the file is encoded in UTF-8. For " +"reading such files, use the 'utf-8-sig' codec to automatically skip the mark " +"if present." msgstr "" +#: ../../howto/unicode.rst:606 msgid "Unicode filenames" msgstr "" -msgid "Most of the operating systems in common use today support filenames that contain arbitrary Unicode characters. Usually this is implemented by converting the Unicode string into some encoding that varies depending on the system. Today Python is converging on using UTF-8: Python on MacOS has used UTF-8 for several versions, and Python 3.6 switched to using UTF-8 on Windows as well. On Unix systems, there will only be a :term:`filesystem encoding `. if you've set the ``LANG`` or ``LC_CTYPE`` environment variables; if you haven't, the default encoding is again UTF-8." -msgstr "" - -msgid "The :func:`sys.getfilesystemencoding` function returns the encoding to use on your current system, in case you want to do the encoding manually, but there's not much reason to bother. When opening a file for reading or writing, you can usually just provide the Unicode string as the filename, and it will be automatically converted to the right encoding for you::" +#: ../../howto/unicode.rst:608 +msgid "" +"Most of the operating systems in common use today support filenames that " +"contain arbitrary Unicode characters. Usually this is implemented by " +"converting the Unicode string into some encoding that varies depending on " +"the system. Today Python is converging on using UTF-8: Python on MacOS has " +"used UTF-8 for several versions, and Python 3.6 switched to using UTF-8 on " +"Windows as well. On Unix systems, there will only be a :term:`filesystem " +"encoding `. if you've set the " +"``LANG`` or ``LC_CTYPE`` environment variables; if you haven't, the default " +"encoding is again UTF-8." +msgstr "" + +#: ../../howto/unicode.rst:618 +msgid "" +"The :func:`sys.getfilesystemencoding` function returns the encoding to use " +"on your current system, in case you want to do the encoding manually, but " +"there's not much reason to bother. When opening a file for reading or " +"writing, you can usually just provide the Unicode string as the filename, " +"and it will be automatically converted to the right encoding for you::" msgstr "" +#: ../../howto/unicode.rst:624 msgid "" "filename = 'filename\\u4500abc'\n" "with open(filename, 'w') as f:\n" " f.write('blah\\n')" msgstr "" -msgid "Functions in the :mod:`os` module such as :func:`os.stat` will also accept Unicode filenames." -msgstr "" - -msgid "The :func:`os.listdir` function returns filenames, which raises an issue: should it return the Unicode version of filenames, or should it return bytes containing the encoded versions? :func:`os.listdir` can do both, depending on whether you provided the directory path as bytes or a Unicode string. If you pass a Unicode string as the path, filenames will be decoded using the filesystem's encoding and a list of Unicode strings will be returned, while passing a byte path will return the filenames as bytes. For example, assuming the default :term:`filesystem encoding ` is UTF-8, running the following program::" +#: ../../howto/unicode.rst:628 +msgid "" +"Functions in the :mod:`os` module such as :func:`os.stat` will also accept " +"Unicode filenames." msgstr "" +#: ../../howto/unicode.rst:631 +msgid "" +"The :func:`os.listdir` function returns filenames, which raises an issue: " +"should it return the Unicode version of filenames, or should it return bytes " +"containing the encoded versions? :func:`os.listdir` can do both, depending " +"on whether you provided the directory path as bytes or a Unicode string. If " +"you pass a Unicode string as the path, filenames will be decoded using the " +"filesystem's encoding and a list of Unicode strings will be returned, while " +"passing a byte path will return the filenames as bytes. For example, " +"assuming the default :term:`filesystem encoding ` is UTF-8, running the following program::" +msgstr "" + +#: ../../howto/unicode.rst:641 msgid "" "fn = 'filename\\u4500abc'\n" "f = open(fn, 'w')\n" @@ -536,48 +976,90 @@ msgid "" "print(os.listdir('.'))" msgstr "" +#: ../../howto/unicode.rst:649 msgid "will produce the following output:" msgstr "" +#: ../../howto/unicode.rst:651 msgid "" "$ python listdir-test.py\n" "[b'filename\\xe4\\x94\\x80abc', ...]\n" "['filename\\u4500abc', ...]" msgstr "" -msgid "The first list contains UTF-8-encoded filenames, and the second list contains the Unicode versions." +#: ../../howto/unicode.rst:657 +msgid "" +"The first list contains UTF-8-encoded filenames, and the second list " +"contains the Unicode versions." msgstr "" -msgid "Note that on most occasions, you should can just stick with using Unicode with these APIs. The bytes APIs should only be used on systems where undecodable file names can be present; that's pretty much only Unix systems now." +#: ../../howto/unicode.rst:660 +msgid "" +"Note that on most occasions, you should can just stick with using Unicode " +"with these APIs. The bytes APIs should only be used on systems where " +"undecodable file names can be present; that's pretty much only Unix systems " +"now." msgstr "" +#: ../../howto/unicode.rst:667 msgid "Tips for Writing Unicode-aware Programs" msgstr "" -msgid "This section provides some suggestions on writing software that deals with Unicode." +#: ../../howto/unicode.rst:669 +msgid "" +"This section provides some suggestions on writing software that deals with " +"Unicode." msgstr "" +#: ../../howto/unicode.rst:672 msgid "The most important tip is:" msgstr "" -msgid "Software should only work with Unicode strings internally, decoding the input data as soon as possible and encoding the output only at the end." +#: ../../howto/unicode.rst:674 +msgid "" +"Software should only work with Unicode strings internally, decoding the " +"input data as soon as possible and encoding the output only at the end." msgstr "" -msgid "If you attempt to write processing functions that accept both Unicode and byte strings, you will find your program vulnerable to bugs wherever you combine the two different kinds of strings. There is no automatic encoding or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be raised." +#: ../../howto/unicode.rst:677 +msgid "" +"If you attempt to write processing functions that accept both Unicode and " +"byte strings, you will find your program vulnerable to bugs wherever you " +"combine the two different kinds of strings. There is no automatic encoding " +"or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be " +"raised." msgstr "" -msgid "When using data coming from a web browser or some other untrusted source, a common technique is to check for illegal characters in a string before using the string in a generated command line or storing it in a database. If you're doing this, be careful to check the decoded string, not the encoded bytes data; some encodings may have interesting properties, such as not being bijective or not being fully ASCII-compatible. This is especially true if the input data also specifies the encoding, since the attacker can then choose a clever way to hide malicious text in the encoded bytestream." +#: ../../howto/unicode.rst:682 +msgid "" +"When using data coming from a web browser or some other untrusted source, a " +"common technique is to check for illegal characters in a string before using " +"the string in a generated command line or storing it in a database. If " +"you're doing this, be careful to check the decoded string, not the encoded " +"bytes data; some encodings may have interesting properties, such as not " +"being bijective or not being fully ASCII-compatible. This is especially " +"true if the input data also specifies the encoding, since the attacker can " +"then choose a clever way to hide malicious text in the encoded bytestream." msgstr "" +#: ../../howto/unicode.rst:693 msgid "Converting Between File Encodings" msgstr "" -msgid "The :class:`~codecs.StreamRecoder` class can transparently convert between encodings, taking a stream that returns data in encoding #1 and behaving like a stream returning data in encoding #2." +#: ../../howto/unicode.rst:695 +msgid "" +"The :class:`~codecs.StreamRecoder` class can transparently convert between " +"encodings, taking a stream that returns data in encoding #1 and behaving " +"like a stream returning data in encoding #2." msgstr "" -msgid "For example, if you have an input file *f* that's in Latin-1, you can wrap it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::" +#: ../../howto/unicode.rst:699 +msgid "" +"For example, if you have an input file *f* that's in Latin-1, you can wrap " +"it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::" msgstr "" +#: ../../howto/unicode.rst:703 msgid "" "new_f = codecs.StreamRecoder(f,\n" " # en/decoder: used by read() to encode its results and\n" @@ -588,12 +1070,19 @@ msgid "" " codecs.getreader('latin-1'), codecs.getwriter('latin-1') )" msgstr "" +#: ../../howto/unicode.rst:713 msgid "Files in an Unknown Encoding" msgstr "" -msgid "What can you do if you need to make a change to a file, but don't know the file's encoding? If you know the encoding is ASCII-compatible and only want to examine or modify the ASCII parts, you can open the file with the ``surrogateescape`` error handler::" +#: ../../howto/unicode.rst:715 +msgid "" +"What can you do if you need to make a change to a file, but don't know the " +"file's encoding? If you know the encoding is ASCII-compatible and only want " +"to examine or modify the ASCII parts, you can open the file with the " +"``surrogateescape`` error handler::" msgstr "" +#: ../../howto/unicode.rst:720 msgid "" "with open(fname, 'r', encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" " data = f.read()\n" @@ -605,23 +1094,52 @@ msgid "" " f.write(data)" msgstr "" -msgid "The ``surrogateescape`` error handler will decode any non-ASCII bytes as code points in a special range running from U+DC80 to U+DCFF. These code points will then turn back into the same bytes when the ``surrogateescape`` error handler is used to encode the data and write it back out." +#: ../../howto/unicode.rst:729 +msgid "" +"The ``surrogateescape`` error handler will decode any non-ASCII bytes as " +"code points in a special range running from U+DC80 to U+DCFF. These code " +"points will then turn back into the same bytes when the ``surrogateescape`` " +"error handler is used to encode the data and write it back out." msgstr "" -msgid "One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David Beazley, discusses text processing and binary data handling." +#: ../../howto/unicode.rst:739 +msgid "" +"One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " +"Beazley, discusses text processing and binary data handling." msgstr "" -msgid "The `PDF slides for Marc-André Lemburg's presentation \"Writing Unicode-aware Applications in Python\" `_ discuss questions of character encodings as well as how to internationalize and localize an application. These slides cover Python 2.x only." +#: ../../howto/unicode.rst:743 +msgid "" +"The `PDF slides for Marc-André Lemburg's presentation \"Writing Unicode-" +"aware Applications in Python\" `_ discuss questions of " +"character encodings as well as how to internationalize and localize an " +"application. These slides cover Python 2.x only." msgstr "" -msgid "`The Guts of Unicode in Python `_ is a PyCon 2013 talk by Benjamin Peterson that discusses the internal Unicode representation in Python 3.3." +#: ../../howto/unicode.rst:749 +msgid "" +"`The Guts of Unicode in Python `_ is a PyCon 2013 talk by Benjamin Peterson that " +"discusses the internal Unicode representation in Python 3.3." msgstr "" +#: ../../howto/unicode.rst:756 msgid "Acknowledgements" msgstr "" -msgid "The initial draft of this document was written by Andrew Kuchling. It has since been revised further by Alexander Belopolsky, Georg Brandl, Andrew Kuchling, and Ezio Melotti." +#: ../../howto/unicode.rst:758 +msgid "" +"The initial draft of this document was written by Andrew Kuchling. It has " +"since been revised further by Alexander Belopolsky, Georg Brandl, Andrew " +"Kuchling, and Ezio Melotti." msgstr "" -msgid "Thanks to the following people who have noted errors or offered suggestions on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius Gedminas, Kent Johnson, Ken Krugler, Marc-André Lemburg, Martin von Löwis, Terry J. Reedy, Serhiy Storchaka, Eryk Sun, Chad Whitacre, Graham Wideman." +#: ../../howto/unicode.rst:762 +msgid "" +"Thanks to the following people who have noted errors or offered suggestions " +"on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius " +"Gedminas, Kent Johnson, Ken Krugler, Marc-André Lemburg, Martin von Löwis, " +"Terry J. Reedy, Serhiy Storchaka, Eryk Sun, Chad Whitacre, Graham Wideman." msgstr "" diff --git a/howto/urllib2.po b/howto/urllib2.po index d1840f10e..60bc7b857 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:53+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,51 +24,92 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../howto/urllib2.rst:5 msgid "HOWTO Fetch Internet Resources Using The urllib Package" msgstr "" +#: ../../howto/urllib2.rst:0 msgid "Author" msgstr "" +#: ../../howto/urllib2.rst:7 msgid "`Michael Foord `_" msgstr "" +#: ../../howto/urllib2.rst:11 msgid "Introduction" msgstr "" -msgid "You may also find useful the following article on fetching web resources with Python:" +#: ../../howto/urllib2.rst:15 +msgid "" +"You may also find useful the following article on fetching web resources " +"with Python:" msgstr "" -msgid "`Basic Authentication `__" +#: ../../howto/urllib2.rst:18 +msgid "" +"`Basic Authentication `__" msgstr "" +#: ../../howto/urllib2.rst:20 msgid "A tutorial on *Basic Authentication*, with examples in Python." msgstr "" -msgid "**urllib.request** is a Python module for fetching URLs (Uniform Resource Locators). It offers a very simple interface, in the form of the *urlopen* function. This is capable of fetching URLs using a variety of different protocols. It also offers a slightly more complex interface for handling common situations - like basic authentication, cookies, proxies and so on. These are provided by objects called handlers and openers." +#: ../../howto/urllib2.rst:22 +msgid "" +"**urllib.request** is a Python module for fetching URLs (Uniform Resource " +"Locators). It offers a very simple interface, in the form of the *urlopen* " +"function. This is capable of fetching URLs using a variety of different " +"protocols. It also offers a slightly more complex interface for handling " +"common situations - like basic authentication, cookies, proxies and so on. " +"These are provided by objects called handlers and openers." msgstr "" -msgid "urllib.request supports fetching URLs for many \"URL schemes\" (identified by the string before the ``\":\"`` in URL - for example ``\"ftp\"`` is the URL scheme of ``\"ftp://python.org/\"``) using their associated network protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, HTTP." +#: ../../howto/urllib2.rst:29 +msgid "" +"urllib.request supports fetching URLs for many \"URL schemes\" (identified " +"by the string before the ``\":\"`` in URL - for example ``\"ftp\"`` is the " +"URL scheme of ``\"ftp://python.org/\"``) using their associated network " +"protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, " +"HTTP." msgstr "" -msgid "For straightforward situations *urlopen* is very easy to use. But as soon as you encounter errors or non-trivial cases when opening HTTP URLs, you will need some understanding of the HyperText Transfer Protocol. The most comprehensive and authoritative reference to HTTP is :rfc:`2616`. This is a technical document and not intended to be easy to read. This HOWTO aims to illustrate using *urllib*, with enough detail about HTTP to help you through. It is not intended to replace the :mod:`urllib.request` docs, but is supplementary to them." +#: ../../howto/urllib2.rst:34 +msgid "" +"For straightforward situations *urlopen* is very easy to use. But as soon as " +"you encounter errors or non-trivial cases when opening HTTP URLs, you will " +"need some understanding of the HyperText Transfer Protocol. The most " +"comprehensive and authoritative reference to HTTP is :rfc:`2616`. This is a " +"technical document and not intended to be easy to read. This HOWTO aims to " +"illustrate using *urllib*, with enough detail about HTTP to help you " +"through. It is not intended to replace the :mod:`urllib.request` docs, but " +"is supplementary to them." msgstr "" +#: ../../howto/urllib2.rst:44 msgid "Fetching URLs" msgstr "" +#: ../../howto/urllib2.rst:46 msgid "The simplest way to use urllib.request is as follows::" msgstr "" +#: ../../howto/urllib2.rst:48 msgid "" "import urllib.request\n" "with urllib.request.urlopen('http://python.org/') as response:\n" " html = response.read()" msgstr "" -msgid "If you wish to retrieve a resource via URL and store it in a temporary location, you can do so via the :func:`shutil.copyfileobj` and :func:`tempfile.NamedTemporaryFile` functions::" +#: ../../howto/urllib2.rst:52 +msgid "" +"If you wish to retrieve a resource via URL and store it in a temporary " +"location, you can do so via the :func:`shutil.copyfileobj` " +"and :func:`tempfile.NamedTemporaryFile` functions::" msgstr "" +#: ../../howto/urllib2.rst:56 msgid "" "import shutil\n" "import tempfile\n" @@ -82,12 +123,26 @@ msgid "" " pass" msgstr "" -msgid "Many uses of urllib will be that simple (note that instead of an 'http:' URL we could have used a URL starting with 'ftp:', 'file:', etc.). However, it's the purpose of this tutorial to explain the more complicated cases, concentrating on HTTP." +#: ../../howto/urllib2.rst:67 +msgid "" +"Many uses of urllib will be that simple (note that instead of an 'http:' URL " +"we could have used a URL starting with 'ftp:', 'file:', etc.). However, " +"it's the purpose of this tutorial to explain the more complicated cases, " +"concentrating on HTTP." msgstr "" -msgid "HTTP is based on requests and responses - the client makes requests and servers send responses. urllib.request mirrors this with a ``Request`` object which represents the HTTP request you are making. In its simplest form you create a Request object that specifies the URL you want to fetch. Calling ``urlopen`` with this Request object returns a response object for the URL requested. This response is a file-like object, which means you can for example call ``.read()`` on the response::" +#: ../../howto/urllib2.rst:72 +msgid "" +"HTTP is based on requests and responses - the client makes requests and " +"servers send responses. urllib.request mirrors this with a ``Request`` " +"object which represents the HTTP request you are making. In its simplest " +"form you create a Request object that specifies the URL you want to fetch. " +"Calling ``urlopen`` with this Request object returns a response object for " +"the URL requested. This response is a file-like object, which means you can " +"for example call ``.read()`` on the response::" msgstr "" +#: ../../howto/urllib2.rst:80 msgid "" "import urllib.request\n" "\n" @@ -96,21 +151,43 @@ msgid "" " the_page = response.read()" msgstr "" -msgid "Note that urllib.request makes use of the same Request interface to handle all URL schemes. For example, you can make an FTP request like so::" +#: ../../howto/urllib2.rst:86 +msgid "" +"Note that urllib.request makes use of the same Request interface to handle " +"all URL schemes. For example, you can make an FTP request like so::" msgstr "" +#: ../../howto/urllib2.rst:89 msgid "req = urllib.request.Request('ftp://example.com/')" msgstr "" -msgid "In the case of HTTP, there are two extra things that Request objects allow you to do: First, you can pass data to be sent to the server. Second, you can pass extra information (\"metadata\") *about* the data or about the request itself, to the server - this information is sent as HTTP \"headers\". Let's look at each of these in turn." +#: ../../howto/urllib2.rst:91 +msgid "" +"In the case of HTTP, there are two extra things that Request objects allow " +"you to do: First, you can pass data to be sent to the server. Second, you " +"can pass extra information (\"metadata\") *about* the data or about the " +"request itself, to the server - this information is sent as HTTP " +"\"headers\". Let's look at each of these in turn." msgstr "" +#: ../../howto/urllib2.rst:98 msgid "Data" msgstr "" -msgid "Sometimes you want to send data to a URL (often the URL will refer to a CGI (Common Gateway Interface) script or other web application). With HTTP, this is often done using what's known as a **POST** request. This is often what your browser does when you submit a HTML form that you filled in on the web. Not all POSTs have to come from forms: you can use a POST to transmit arbitrary data to your own application. In the common case of HTML forms, the data needs to be encoded in a standard way, and then passed to the Request object as the ``data`` argument. The encoding is done using a function from the :mod:`urllib.parse` library. ::" -msgstr "" - +#: ../../howto/urllib2.rst:100 +msgid "" +"Sometimes you want to send data to a URL (often the URL will refer to a CGI " +"(Common Gateway Interface) script or other web application). With HTTP, this " +"is often done using what's known as a **POST** request. This is often what " +"your browser does when you submit a HTML form that you filled in on the web. " +"Not all POSTs have to come from forms: you can use a POST to transmit " +"arbitrary data to your own application. In the common case of HTML forms, " +"the data needs to be encoded in a standard way, and then passed to the " +"Request object as the ``data`` argument. The encoding is done using a " +"function from the :mod:`urllib.parse` library. ::" +msgstr "" + +#: ../../howto/urllib2.rst:110 msgid "" "import urllib.parse\n" "import urllib.request\n" @@ -127,15 +204,31 @@ msgid "" " the_page = response.read()" msgstr "" -msgid "Note that other encodings are sometimes required (e.g. for file upload from HTML forms - see `HTML Specification, Form Submission `_ for more details)." -msgstr "" - -msgid "If you do not pass the ``data`` argument, urllib uses a **GET** request. One way in which GET and POST requests differ is that POST requests often have \"side-effects\": they change the state of the system in some way (for example by placing an order with the website for a hundredweight of tinned spam to be delivered to your door). Though the HTTP standard makes it clear that POSTs are intended to *always* cause side-effects, and GET requests *never* to cause side-effects, nothing prevents a GET request from having side-effects, nor a POST requests from having no side-effects. Data can also be passed in an HTTP GET request by encoding it in the URL itself." +#: ../../howto/urllib2.rst:124 +msgid "" +"Note that other encodings are sometimes required (e.g. for file upload from " +"HTML forms - see `HTML Specification, Form Submission `_ for more details)." msgstr "" +#: ../../howto/urllib2.rst:129 +msgid "" +"If you do not pass the ``data`` argument, urllib uses a **GET** request. One " +"way in which GET and POST requests differ is that POST requests often have " +"\"side-effects\": they change the state of the system in some way (for " +"example by placing an order with the website for a hundredweight of tinned " +"spam to be delivered to your door). Though the HTTP standard makes it clear " +"that POSTs are intended to *always* cause side-effects, and GET requests " +"*never* to cause side-effects, nothing prevents a GET request from having " +"side-effects, nor a POST requests from having no side-effects. Data can also " +"be passed in an HTTP GET request by encoding it in the URL itself." +msgstr "" + +#: ../../howto/urllib2.rst:139 msgid "This is done as follows::" msgstr "" +#: ../../howto/urllib2.rst:141 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -151,18 +244,36 @@ msgid "" ">>> data = urllib.request.urlopen(full_url)" msgstr "" -msgid "Notice that the full URL is created by adding a ``?`` to the URL, followed by the encoded values." +#: ../../howto/urllib2.rst:154 +msgid "" +"Notice that the full URL is created by adding a ``?`` to the URL, followed " +"by the encoded values." msgstr "" +#: ../../howto/urllib2.rst:158 msgid "Headers" msgstr "" -msgid "We'll discuss here one particular HTTP header, to illustrate how to add headers to your HTTP request." -msgstr "" - -msgid "Some websites [#]_ dislike being browsed by programs, or send different versions to different browsers [#]_. By default urllib identifies itself as ``Python-urllib/x.y`` (where ``x`` and ``y`` are the major and minor version numbers of the Python release, e.g. ``Python-urllib/2.5``), which may confuse the site, or just plain not work. The way a browser identifies itself is through the ``User-Agent`` header [#]_. When you create a Request object you can pass a dictionary of headers in. The following example makes the same request as above, but identifies itself as a version of Internet Explorer [#]_. ::" +#: ../../howto/urllib2.rst:160 +msgid "" +"We'll discuss here one particular HTTP header, to illustrate how to add " +"headers to your HTTP request." msgstr "" +#: ../../howto/urllib2.rst:163 +msgid "" +"Some websites [#]_ dislike being browsed by programs, or send different " +"versions to different browsers [#]_. By default urllib identifies itself as " +"``Python-urllib/x.y`` (where ``x`` and ``y`` are the major and minor version " +"numbers of the Python release, e.g. ``Python-urllib/2.5``), which may " +"confuse the site, or just plain not work. The way a browser identifies " +"itself is through the ``User-Agent`` header [#]_. When you create a Request " +"object you can pass a dictionary of headers in. The following example makes " +"the same request as above, but identifies itself as a version of Internet " +"Explorer [#]_. ::" +msgstr "" + +#: ../../howto/urllib2.rst:174 msgid "" "import urllib.parse\n" "import urllib.request\n" @@ -181,30 +292,51 @@ msgid "" " the_page = response.read()" msgstr "" -msgid "The response also has two useful methods. See the section on `info and geturl`_ which comes after we have a look at what happens when things go wrong." +#: ../../howto/urllib2.rst:190 +msgid "" +"The response also has two useful methods. See the section on `info and " +"geturl`_ which comes after we have a look at what happens when things go " +"wrong." msgstr "" +#: ../../howto/urllib2.rst:195 msgid "Handling Exceptions" msgstr "" -msgid "*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a response (though as usual with Python APIs, built-in exceptions such as :exc:`ValueError`, :exc:`TypeError` etc. may also be raised)." +#: ../../howto/urllib2.rst:197 +msgid "" +"*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a " +"response (though as usual with Python APIs, built-in exceptions such " +"as :exc:`ValueError`, :exc:`TypeError` etc. may also be raised)." msgstr "" -msgid ":exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs." +#: ../../howto/urllib2.rst:201 +msgid "" +":exc:`~urllib.error.HTTPError` is the subclass " +"of :exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs." msgstr "" +#: ../../howto/urllib2.rst:204 msgid "The exception classes are exported from the :mod:`urllib.error` module." msgstr "" +#: ../../howto/urllib2.rst:207 msgid "URLError" msgstr "" -msgid "Often, URLError is raised because there is no network connection (no route to the specified server), or the specified server doesn't exist. In this case, the exception raised will have a 'reason' attribute, which is a tuple containing an error code and a text error message." +#: ../../howto/urllib2.rst:209 +msgid "" +"Often, URLError is raised because there is no network connection (no route " +"to the specified server), or the specified server doesn't exist. In this " +"case, the exception raised will have a 'reason' attribute, which is a tuple " +"containing an error code and a text error message." msgstr "" +#: ../../howto/urllib2.rst:214 msgid "e.g. ::" msgstr "" +#: ../../howto/urllib2.rst:216 msgid "" ">>> req = urllib.request.Request('http://www.pretend_server.org')\n" ">>> try: urllib.request.urlopen(req)\n" @@ -214,52 +346,87 @@ msgid "" "(4, 'getaddrinfo failed')" msgstr "" +#: ../../howto/urllib2.rst:225 msgid "HTTPError" msgstr "" -msgid "Every HTTP response from the server contains a numeric \"status code\". Sometimes the status code indicates that the server is unable to fulfil the request. The default handlers will handle some of these responses for you (for example, if the response is a \"redirection\" that requests the client fetch the document from a different URL, urllib will handle that for you). For those it can't handle, urlopen will raise an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not found), '403' (request forbidden), and '401' (authentication required)." +#: ../../howto/urllib2.rst:227 +msgid "" +"Every HTTP response from the server contains a numeric \"status code\". " +"Sometimes the status code indicates that the server is unable to fulfil the " +"request. The default handlers will handle some of these responses for you " +"(for example, if the response is a \"redirection\" that requests the client " +"fetch the document from a different URL, urllib will handle that for you). " +"For those it can't handle, urlopen will raise " +"an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not " +"found), '403' (request forbidden), and '401' (authentication required)." msgstr "" -msgid "See section 10 of :rfc:`2616` for a reference on all the HTTP error codes." +#: ../../howto/urllib2.rst:235 +msgid "" +"See section 10 of :rfc:`2616` for a reference on all the HTTP error codes." msgstr "" -msgid "The :exc:`~urllib.error.HTTPError` instance raised will have an integer 'code' attribute, which corresponds to the error sent by the server." +#: ../../howto/urllib2.rst:237 +msgid "" +"The :exc:`~urllib.error.HTTPError` instance raised will have an integer " +"'code' attribute, which corresponds to the error sent by the server." msgstr "" +#: ../../howto/urllib2.rst:241 msgid "Error Codes" msgstr "" -msgid "Because the default handlers handle redirects (codes in the 300 range), and codes in the 100--299 range indicate success, you will usually only see error codes in the 400--599 range." +#: ../../howto/urllib2.rst:243 +msgid "" +"Because the default handlers handle redirects (codes in the 300 range), and " +"codes in the 100--299 range indicate success, you will usually only see " +"error codes in the 400--599 range." msgstr "" -msgid ":attr:`http.server.BaseHTTPRequestHandler.responses` is a useful dictionary of response codes that shows all the response codes used by :rfc:`2616`. An excerpt from the dictionary is shown below ::" +#: ../../howto/urllib2.rst:247 +msgid "" +":attr:`http.server.BaseHTTPRequestHandler.responses` is a useful dictionary " +"of response codes that shows all the response codes used by :rfc:`2616`. An " +"excerpt from the dictionary is shown below ::" msgstr "" +#: ../../howto/urllib2.rst:251 msgid "" "responses = {\n" " ...\n" " : ('OK', 'Request fulfilled, document follows'),\n" " ...\n" " : ('Forbidden',\n" -" 'Request forbidden -- authorization will '\n" +" 'Request forbidden -- authorization will " +"'\n" " 'not help'),\n" " : ('Not Found',\n" " 'Nothing matches the given URI'),\n" " ...\n" " : (\"I'm a Teapot\",\n" -" 'Server refuses to brew coffee because '\n" +" 'Server refuses to brew coffee because " +"'\n" " 'it is a teapot'),\n" " ...\n" " : ('Service Unavailable',\n" -" 'The server cannot process the '\n" +" 'The server cannot process the " +"'\n" " 'request due to a high load'),\n" " ...\n" " }" msgstr "" -msgid "When an error is raised the server responds by returning an HTTP error code *and* an error page. You can use the :exc:`~urllib.error.HTTPError` instance as a response on the page returned. This means that as well as the code attribute, it also has read, geturl, and info, methods as returned by the ``urllib.response`` module::" +#: ../../howto/urllib2.rst:271 +msgid "" +"When an error is raised the server responds by returning an HTTP error code " +"*and* an error page. You can use the :exc:`~urllib.error.HTTPError` instance " +"as a response on the page returned. This means that as well as the code " +"attribute, it also has read, geturl, and info, methods as returned by the " +"``urllib.response`` module::" msgstr "" +#: ../../howto/urllib2.rst:276 msgid "" ">>> req = urllib.request.Request('http://www.python.org/fish.html')\n" ">>> try:\n" @@ -270,21 +437,29 @@ msgid "" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage Not Found\\n\n" " ..." msgstr "" +#: ../../howto/urllib2.rst:291 msgid "Wrapping it Up" msgstr "" -msgid "So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:`~urllib.error.URLError` there are two basic approaches. I prefer the second approach." +#: ../../howto/urllib2.rst:293 +msgid "" +"So if you want to be prepared for :exc:`~urllib.error.HTTPError` " +"*or* :exc:`~urllib.error.URLError` there are two basic approaches. I prefer " +"the second approach." msgstr "" +#: ../../howto/urllib2.rst:297 msgid "Number 1" msgstr "" +#: ../../howto/urllib2.rst:302 msgid "" "from urllib.request import Request, urlopen\n" "from urllib.error import URLError, HTTPError\n" @@ -301,12 +476,17 @@ msgid "" " # everything is fine" msgstr "" -msgid "The ``except HTTPError`` *must* come first, otherwise ``except URLError`` will *also* catch an :exc:`~urllib.error.HTTPError`." +#: ../../howto/urllib2.rst:319 +msgid "" +"The ``except HTTPError`` *must* come first, otherwise ``except URLError`` " +"will *also* catch an :exc:`~urllib.error.HTTPError`." msgstr "" +#: ../../howto/urllib2.rst:323 msgid "Number 2" msgstr "" +#: ../../howto/urllib2.rst:327 msgid "" "from urllib.request import Request, urlopen\n" "from urllib.error import URLError\n" @@ -324,69 +504,153 @@ msgid "" " # everything is fine" msgstr "" +#: ../../howto/urllib2.rst:344 msgid "info and geturl" msgstr "" -msgid "The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is defined in the module :mod:`urllib.response`." +#: ../../howto/urllib2.rst:346 +msgid "" +"The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` " +"instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is " +"defined in the module :mod:`urllib.response`." msgstr "" -msgid "**geturl** - this returns the real URL of the page fetched. This is useful because ``urlopen`` (or the opener object used) may have followed a redirect. The URL of the page fetched may not be the same as the URL requested." +#: ../../howto/urllib2.rst:350 +msgid "" +"**geturl** - this returns the real URL of the page fetched. This is useful " +"because ``urlopen`` (or the opener object used) may have followed a " +"redirect. The URL of the page fetched may not be the same as the URL " +"requested." msgstr "" -msgid "**info** - this returns a dictionary-like object that describes the page fetched, particularly the headers sent by the server. It is currently an :class:`http.client.HTTPMessage` instance." +#: ../../howto/urllib2.rst:354 +msgid "" +"**info** - this returns a dictionary-like object that describes the page " +"fetched, particularly the headers sent by the server. It is currently " +"an :class:`http.client.HTTPMessage` instance." msgstr "" -msgid "Typical headers include 'Content-length', 'Content-type', and so on. See the `Quick Reference to HTTP Headers `_ for a useful listing of HTTP headers with brief explanations of their meaning and use." +#: ../../howto/urllib2.rst:358 +msgid "" +"Typical headers include 'Content-length', 'Content-type', and so on. See the " +"`Quick Reference to HTTP Headers `_ for a " +"useful listing of HTTP headers with brief explanations of their meaning and " +"use." msgstr "" +#: ../../howto/urllib2.rst:365 msgid "Openers and Handlers" msgstr "" -msgid "When you fetch a URL you use an opener (an instance of the perhaps confusingly named :class:`urllib.request.OpenerDirector`). Normally we have been using the default opener - via ``urlopen`` - but you can create custom openers. Openers use handlers. All the \"heavy lifting\" is done by the handlers. Each handler knows how to open URLs for a particular URL scheme (http, ftp, etc.), or how to handle an aspect of URL opening, for example HTTP redirections or HTTP cookies." +#: ../../howto/urllib2.rst:367 +msgid "" +"When you fetch a URL you use an opener (an instance of the perhaps " +"confusingly named :class:`urllib.request.OpenerDirector`). Normally we have " +"been using the default opener - via ``urlopen`` - but you can create custom " +"openers. Openers use handlers. All the \"heavy lifting\" is done by the " +"handlers. Each handler knows how to open URLs for a particular URL scheme " +"(http, ftp, etc.), or how to handle an aspect of URL opening, for example " +"HTTP redirections or HTTP cookies." msgstr "" -msgid "You will want to create openers if you want to fetch URLs with specific handlers installed, for example to get an opener that handles cookies, or to get an opener that does not handle redirections." +#: ../../howto/urllib2.rst:375 +msgid "" +"You will want to create openers if you want to fetch URLs with specific " +"handlers installed, for example to get an opener that handles cookies, or to " +"get an opener that does not handle redirections." msgstr "" -msgid "To create an opener, instantiate an ``OpenerDirector``, and then call ``.add_handler(some_handler_instance)`` repeatedly." +#: ../../howto/urllib2.rst:379 +msgid "" +"To create an opener, instantiate an ``OpenerDirector``, and then call " +"``.add_handler(some_handler_instance)`` repeatedly." msgstr "" -msgid "Alternatively, you can use ``build_opener``, which is a convenience function for creating opener objects with a single function call. ``build_opener`` adds several handlers by default, but provides a quick way to add more and/or override the default handlers." +#: ../../howto/urllib2.rst:382 +msgid "" +"Alternatively, you can use ``build_opener``, which is a convenience function " +"for creating opener objects with a single function call. ``build_opener`` " +"adds several handlers by default, but provides a quick way to add more and/" +"or override the default handlers." msgstr "" -msgid "Other sorts of handlers you might want to can handle proxies, authentication, and other common but slightly specialised situations." +#: ../../howto/urllib2.rst:387 +msgid "" +"Other sorts of handlers you might want to can handle proxies, " +"authentication, and other common but slightly specialised situations." msgstr "" -msgid "``install_opener`` can be used to make an ``opener`` object the (global) default opener. This means that calls to ``urlopen`` will use the opener you have installed." +#: ../../howto/urllib2.rst:390 +msgid "" +"``install_opener`` can be used to make an ``opener`` object the (global) " +"default opener. This means that calls to ``urlopen`` will use the opener you " +"have installed." msgstr "" -msgid "Opener objects have an ``open`` method, which can be called directly to fetch urls in the same way as the ``urlopen`` function: there's no need to call ``install_opener``, except as a convenience." +#: ../../howto/urllib2.rst:394 +msgid "" +"Opener objects have an ``open`` method, which can be called directly to " +"fetch urls in the same way as the ``urlopen`` function: there's no need to " +"call ``install_opener``, except as a convenience." msgstr "" +#: ../../howto/urllib2.rst:400 msgid "Basic Authentication" msgstr "" -msgid "To illustrate creating and installing a handler we will use the ``HTTPBasicAuthHandler``. For a more detailed discussion of this subject -- including an explanation of how Basic Authentication works - see the `Basic Authentication Tutorial `__." +#: ../../howto/urllib2.rst:402 +msgid "" +"To illustrate creating and installing a handler we will use the " +"``HTTPBasicAuthHandler``. For a more detailed discussion of this subject -- " +"including an explanation of how Basic Authentication works - see the `Basic " +"Authentication Tutorial `__." msgstr "" -msgid "When authentication is required, the server sends a header (as well as the 401 error code) requesting authentication. This specifies the authentication scheme and a 'realm'. The header looks like: ``WWW-Authenticate: SCHEME realm=\"REALM\"``." +#: ../../howto/urllib2.rst:408 +msgid "" +"When authentication is required, the server sends a header (as well as the " +"401 error code) requesting authentication. This specifies the " +"authentication scheme and a 'realm'. The header looks like: ``WWW-" +"Authenticate: SCHEME realm=\"REALM\"``." msgstr "" +#: ../../howto/urllib2.rst:413 msgid "e.g." msgstr "" +#: ../../howto/urllib2.rst:415 msgid "WWW-Authenticate: Basic realm=\"cPanel Users\"" msgstr "" -msgid "The client should then retry the request with the appropriate name and password for the realm included as a header in the request. This is 'basic authentication'. In order to simplify this process we can create an instance of ``HTTPBasicAuthHandler`` and an opener to use this handler." -msgstr "" - -msgid "The ``HTTPBasicAuthHandler`` uses an object called a password manager to handle the mapping of URLs and realms to passwords and usernames. If you know what the realm is (from the authentication header sent by the server), then you can use a ``HTTPPasswordMgr``. Frequently one doesn't care what the realm is. In that case, it is convenient to use ``HTTPPasswordMgrWithDefaultRealm``. This allows you to specify a default username and password for a URL. This will be supplied in the absence of you providing an alternative combination for a specific realm. We indicate this by providing ``None`` as the realm argument to the ``add_password`` method." +#: ../../howto/urllib2.rst:420 +msgid "" +"The client should then retry the request with the appropriate name and " +"password for the realm included as a header in the request. This is 'basic " +"authentication'. In order to simplify this process we can create an instance " +"of ``HTTPBasicAuthHandler`` and an opener to use this handler." msgstr "" -msgid "The top-level URL is the first URL that requires authentication. URLs \"deeper\" than the URL you pass to .add_password() will also match. ::" +#: ../../howto/urllib2.rst:425 +msgid "" +"The ``HTTPBasicAuthHandler`` uses an object called a password manager to " +"handle the mapping of URLs and realms to passwords and usernames. If you " +"know what the realm is (from the authentication header sent by the server), " +"then you can use a ``HTTPPasswordMgr``. Frequently one doesn't care what the " +"realm is. In that case, it is convenient to use " +"``HTTPPasswordMgrWithDefaultRealm``. This allows you to specify a default " +"username and password for a URL. This will be supplied in the absence of you " +"providing an alternative combination for a specific realm. We indicate this " +"by providing ``None`` as the realm argument to the ``add_password`` method." +msgstr "" + +#: ../../howto/urllib2.rst:435 +msgid "" +"The top-level URL is the first URL that requires authentication. URLs " +"\"deeper\" than the URL you pass to .add_password() will also match. ::" msgstr "" +#: ../../howto/urllib2.rst:438 msgid "" "# create a password manager\n" "password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()\n" @@ -409,39 +673,82 @@ msgid "" "urllib.request.install_opener(opener)" msgstr "" -msgid "In the above example we only supplied our ``HTTPBasicAuthHandler`` to ``build_opener``. By default openers have the handlers for normal situations -- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy` environment variable is set), ``UnknownHandler``, ``HTTPHandler``, ``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, ``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``." +#: ../../howto/urllib2.rst:460 +msgid "" +"In the above example we only supplied our ``HTTPBasicAuthHandler`` to " +"``build_opener``. By default openers have the handlers for normal situations " +"-- ``ProxyHandler`` (if a proxy setting such as an :envvar:`!http_proxy` " +"environment variable is set), ``UnknownHandler``, ``HTTPHandler``, " +"``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, " +"``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``." msgstr "" -msgid "``top_level_url`` is in fact *either* a full URL (including the 'http:' scheme component and the hostname and optionally the port number) e.g. ``\"http://example.com/\"`` *or* an \"authority\" (i.e. the hostname, optionally including the port number) e.g. ``\"example.com\"`` or ``\"example.com:8080\"`` (the latter example includes a port number). The authority, if present, must NOT contain the \"userinfo\" component - for example ``\"joe:password@example.com\"`` is not correct." +#: ../../howto/urllib2.rst:467 +msgid "" +"``top_level_url`` is in fact *either* a full URL (including the 'http:' " +"scheme component and the hostname and optionally the port number) e.g. " +"``\"http://example.com/\"`` *or* an \"authority\" (i.e. the hostname, " +"optionally including the port number) e.g. ``\"example.com\"`` or " +"``\"example.com:8080\"`` (the latter example includes a port number). The " +"authority, if present, must NOT contain the \"userinfo\" component - for " +"example ``\"joe:password@example.com\"`` is not correct." msgstr "" +#: ../../howto/urllib2.rst:477 msgid "Proxies" msgstr "" -msgid "**urllib** will auto-detect your proxy settings and use those. This is through the ``ProxyHandler``, which is part of the normal handler chain when a proxy setting is detected. Normally that's a good thing, but there are occasions when it may not be helpful [#]_. One way to do this is to setup our own ``ProxyHandler``, with no proxies defined. This is done using similar steps to setting up a `Basic Authentication`_ handler: ::" +#: ../../howto/urllib2.rst:479 +msgid "" +"**urllib** will auto-detect your proxy settings and use those. This is " +"through the ``ProxyHandler``, which is part of the normal handler chain when " +"a proxy setting is detected. Normally that's a good thing, but there are " +"occasions when it may not be helpful [#]_. One way to do this is to setup " +"our own ``ProxyHandler``, with no proxies defined. This is done using " +"similar steps to setting up a `Basic Authentication`_ handler: ::" msgstr "" +#: ../../howto/urllib2.rst:486 msgid "" ">>> proxy_support = urllib.request.ProxyHandler({})\n" ">>> opener = urllib.request.build_opener(proxy_support)\n" ">>> urllib.request.install_opener(opener)" msgstr "" -msgid "Currently ``urllib.request`` *does not* support fetching of ``https`` locations through a proxy. However, this can be enabled by extending urllib.request as shown in the recipe [#]_." +#: ../../howto/urllib2.rst:492 +msgid "" +"Currently ``urllib.request`` *does not* support fetching of ``https`` " +"locations through a proxy. However, this can be enabled by extending " +"urllib.request as shown in the recipe [#]_." msgstr "" -msgid "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see the documentation on :func:`~urllib.request.getproxies`." +#: ../../howto/urllib2.rst:498 +msgid "" +"``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " +"the documentation on :func:`~urllib.request.getproxies`." msgstr "" +#: ../../howto/urllib2.rst:503 msgid "Sockets and Layers" msgstr "" -msgid "The Python support for fetching resources from the web is layered. urllib uses the :mod:`http.client` library, which in turn uses the socket library." +#: ../../howto/urllib2.rst:505 +msgid "" +"The Python support for fetching resources from the web is layered. urllib " +"uses the :mod:`http.client` library, which in turn uses the socket library." msgstr "" -msgid "As of Python 2.3 you can specify how long a socket should wait for a response before timing out. This can be useful in applications which have to fetch web pages. By default the socket module has *no timeout* and can hang. Currently, the socket timeout is not exposed at the http.client or urllib.request levels. However, you can set the default timeout globally for all sockets using ::" +#: ../../howto/urllib2.rst:508 +msgid "" +"As of Python 2.3 you can specify how long a socket should wait for a " +"response before timing out. This can be useful in applications which have to " +"fetch web pages. By default the socket module has *no timeout* and can hang. " +"Currently, the socket timeout is not exposed at the http.client or " +"urllib.request levels. However, you can set the default timeout globally for " +"all sockets using ::" msgstr "" +#: ../../howto/urllib2.rst:514 msgid "" "import socket\n" "import urllib.request\n" @@ -456,26 +763,48 @@ msgid "" "response = urllib.request.urlopen(req)" msgstr "" +#: ../../howto/urllib2.rst:531 msgid "Footnotes" msgstr "" +#: ../../howto/urllib2.rst:533 msgid "This document was reviewed and revised by John Lee." msgstr "" +#: ../../howto/urllib2.rst:535 msgid "Google for example." msgstr "" -msgid "Browser sniffing is a very bad practice for website design - building sites using web standards is much more sensible. Unfortunately a lot of sites still send different versions to different browsers." +#: ../../howto/urllib2.rst:536 +msgid "" +"Browser sniffing is a very bad practice for website design - building sites " +"using web standards is much more sensible. Unfortunately a lot of sites " +"still send different versions to different browsers." msgstr "" -msgid "The user agent for MSIE 6 is *'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)'*" +#: ../../howto/urllib2.rst:539 +msgid "" +"The user agent for MSIE 6 is *'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT " +"5.1; SV1; .NET CLR 1.1.4322)'*" msgstr "" -msgid "For details of more HTTP request headers, see `Quick Reference to HTTP Headers`_." +#: ../../howto/urllib2.rst:541 +msgid "" +"For details of more HTTP request headers, see `Quick Reference to HTTP " +"Headers`_." msgstr "" -msgid "In my case I have to use a proxy to access the internet at work. If you attempt to fetch *localhost* URLs through this proxy it blocks them. IE is set to use the proxy, which urllib picks up on. In order to test scripts with a localhost server, I have to prevent urllib from using the proxy." +#: ../../howto/urllib2.rst:543 +msgid "" +"In my case I have to use a proxy to access the internet at work. If you " +"attempt to fetch *localhost* URLs through this proxy it blocks them. IE is " +"set to use the proxy, which urllib picks up on. In order to test scripts " +"with a localhost server, I have to prevent urllib from using the proxy." msgstr "" -msgid "urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe `_." +#: ../../howto/urllib2.rst:548 +msgid "" +"urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe `_." msgstr "" diff --git a/improve-page-nojs.po b/improve-page-nojs.po index 26e55fc50..1d7dbf5d9 100644 --- a/improve-page-nojs.po +++ b/improve-page-nojs.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: invincible627 , 2026\n" "Language-Team: none\n" @@ -21,20 +21,50 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../improve-page-nojs.rst:5 msgid "Improve a documentation page" msgstr "بهبود یک صفحه‌ی سند" -msgid "We are always interested to hear ideas about improvements to the documentation." +#: ../../improve-page-nojs.rst:13 +msgid "" +"We are always interested to hear ideas about improvements to the " +"documentation." msgstr "ما همیشه علاقه‌مند به شنیدن ایده‌ها درباره‌ی بهبود سند هستیم." -msgid "If the bug or suggested improvement concerns the translation of this documentation, open an issue or edit the page in `translation's repository `_ instead." -msgstr "اگر مشکل یا پیشنهاد بهبود مربوط به ترجمه‌ی این مستندات است، یک گزارش مشکل باز کنید یا صفحه را در `مخزن ترجمه `_ ویرایش کنید." +#: ../../improve-page-nojs.rst:17 +msgid "" +"If the bug or suggested improvement concerns the translation of this " +"documentation, open an issue or edit the page in `translation's repository " +"`_ instead." +msgstr "" +"اگر مشکل یا پیشنهاد بهبود مربوط به ترجمه‌ی این مستندات است، یک گزارش مشکل باز " +"کنید یا صفحه را در `مخزن ترجمه `_ ویرایش کنید." +#: ../../improve-page-nojs.rst:21 msgid "You have a few ways to ask questions or suggest changes:" msgstr "شما چند راه برای پرسیدن سؤال یا پیشنهاد تغییرات دارید." -msgid "You can start a discussion about the page on the Python discussion forum. This link will start a topic in the Documentation category: `New Documentation topic `_." -msgstr "می‌توانید یک بحث درباره‌ی صفحه را در انجمن گفتگوی پایتون شروع کنید. این لینک یک موضوع از پیش‌تکمیل‌شده را شروع می‌کند: `سوال درباره‌ی صفحه \"PAGETITLE\" `_." +#: ../../improve-page-nojs.rst:23 +msgid "" +"You can start a discussion about the page on the Python discussion forum. " +"This link will start a topic in the Documentation category: `New " +"Documentation topic `_." +msgstr "" +"می‌توانید یک بحث درباره‌ی صفحه را در انجمن گفتگوی پایتون شروع کنید. این لینک " +"یک موضوع از پیش‌تکمیل‌شده را شروع می‌کند: `سوال درباره‌ی صفحه \"PAGETITLE\" " +"`_." -msgid "You can open an issue on the Python GitHub issue tracker. This link will create a new issue with the \"docs\" label: `New docs issue `_." -msgstr "می‌توانید یک issue در ردیاب issues GitHub پایتون باز کنید. این لینک یک issue جدید از پیش‌تکمیل‌شده ایجاد خواهد کرد: `Docs: مشکل در صفحه \"PAGETITLE\" `_." +#: ../../improve-page-nojs.rst:27 +msgid "" +"You can open an issue on the Python GitHub issue tracker. This link will " +"create a new issue with the \"docs\" label: `New docs issue `_." +msgstr "" +"می‌توانید یک issue در ردیاب issues GitHub پایتون باز کنید. این لینک یک issue " +"جدید از پیش‌تکمیل‌شده ایجاد خواهد کرد: `Docs: مشکل در صفحه \"PAGETITLE\" " +"`_." diff --git a/improve-page.po b/improve-page.po index 53df85a60..0d930d075 100644 --- a/improve-page.po +++ b/improve-page.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: invincible627 , 2026\n" "Language-Team: none\n" @@ -21,26 +21,72 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../improve-page.rst:5 msgid "Improve a documentation page" msgstr "بهبود یک صفحه‌ی سند" -msgid "We are always interested to hear ideas about improvements to the documentation." +#: ../../improve-page.rst:43 +msgid "" +"We are always interested to hear ideas about improvements to the " +"documentation." msgstr "ما همیشه مشتاق شنیدن ایده‌ها و پیشنهادهای شما برای بهبود مستندات هستیم." -msgid "You were reading \"PAGETITLE\" at ``_. The source for that page is on `GitHub `_." -msgstr "شما در حال خواندن «PAGETITLE» در ``_ بودید. منبع آن صفحه در `GitHub `_ است." +#: ../../improve-page.rst:45 +msgid "" +"You were reading \"PAGETITLE\" at ``_. The source for that page is " +"on `GitHub `_." +msgstr "" +"شما در حال خواندن «PAGETITLE» در ``_ بودید. منبع آن صفحه در `GitHub " +"`_ است." -msgid "If the bug or suggested improvement concerns the translation of this documentation, open an issue or edit the page in `translation's repository `_ instead." -msgstr "اگر مشکل یا پیشنهاد بهبود مربوط به ترجمه‌ی این مستندات است، یک گزارش مشکل باز کنید یا صفحه را در `مخزن ترجمه `_ ویرایش کنید." +#: ../../improve-page.rst:50 +msgid "" +"If the bug or suggested improvement concerns the translation of this " +"documentation, open an issue or edit the page in `translation's repository " +"`_ instead." +msgstr "" +"اگر مشکل یا پیشنهاد بهبود مربوط به ترجمه‌ی این مستندات است، یک گزارش مشکل باز " +"کنید یا صفحه را در `مخزن ترجمه `_ ویرایش کنید." +#: ../../improve-page.rst:54 msgid "You have a few ways to ask questions or suggest changes:" msgstr "شما چند راه برای پرسیدن سؤال یا پیشنهاد تغییرات دارید." -msgid "You can start a discussion about the page on the Python discussion forum. This link will start a pre-populated topic: `Question about page \"PAGETITLE\" `_." -msgstr "می‌توانید یک بحث درباره‌ی صفحه را در انجمن گفتگوی پایتون شروع کنید. این لینک یک موضوع از پیش‌تکمیل‌شده را شروع می‌کند: `سوال درباره‌ی صفحه \"PAGETITLE\" `_." +#: ../../improve-page.rst:56 +msgid "" +"You can start a discussion about the page on the Python discussion forum. " +"This link will start a pre-populated topic: `Question about page " +"\"PAGETITLE\" `_." +msgstr "" +"می‌توانید یک بحث درباره‌ی صفحه را در انجمن گفتگوی پایتون شروع کنید. این لینک " +"یک موضوع از پیش‌تکمیل‌شده را شروع می‌کند: `سوال درباره‌ی صفحه \"PAGETITLE\" " +"`_." -msgid "You can open an issue on the Python GitHub issue tracker. This link will create a new pre-populated issue: `Docs: problem with page \"PAGETITLE\" `_." -msgstr "می‌توانید یک issue در ردیاب issues GitHub پایتون باز کنید. این لینک یک issue جدید از پیش‌تکمیل‌شده ایجاد خواهد کرد: `Docs: مشکل در صفحه \"PAGETITLE\" `_." +#: ../../improve-page.rst:60 +msgid "" +"You can open an issue on the Python GitHub issue tracker. This link will " +"create a new pre-populated issue: `Docs: problem with page \"PAGETITLE\" " +"`_." +msgstr "" +"می‌توانید یک issue در ردیاب issues GitHub پایتون باز کنید. این لینک یک issue " +"جدید از پیش‌تکمیل‌شده ایجاد خواهد کرد: `Docs: مشکل در صفحه \"PAGETITLE\" " +"`_." -msgid "You can `edit the page on GitHub `_ to open a pull request and begin the contribution process." -msgstr "می‌توانید صفحه را در `GitHub `_ ویرایش کنید تا یک درخواست ادغام (pull request) باز کنید و فرآیند مشارکت را آغاز نمایید." +#: ../../improve-page.rst:64 +msgid "" +"You can `edit the page on GitHub `_ to open a pull request and begin the " +"contribution process." +msgstr "" +"می‌توانید صفحه را در `GitHub `_ ویرایش کنید تا یک درخواست ادغام (pull request) باز " +"کنید و فرآیند مشارکت را آغاز نمایید." diff --git a/installing/index.po b/installing/index.po index a68e164df..53edc562c 100644 --- a/installing/index.po +++ b/installing/index.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,167 +24,316 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../installing/index.rst:7 msgid "Installing Python modules" msgstr "" -msgid "As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open-source license terms." +#: ../../installing/index.rst:9 +msgid "" +"As a popular open source development project, Python has an active " +"supporting community of contributors and users that also make their software " +"available for other Python developers to use under open-source license terms." msgstr "" -msgid "This allows Python users to share and collaborate effectively, benefiting from the solutions others have already created to common (and sometimes even rare!) problems, as well as potentially contributing their own solutions to the common pool." +#: ../../installing/index.rst:13 +msgid "" +"This allows Python users to share and collaborate effectively, benefiting " +"from the solutions others have already created to common (and sometimes even " +"rare!) problems, as well as potentially contributing their own solutions to " +"the common pool." msgstr "" -msgid "This guide covers the installation part of the process. For a guide to creating and sharing your own Python projects, refer to the `Python packaging user guide`_." +#: ../../installing/index.rst:18 +msgid "" +"This guide covers the installation part of the process. For a guide to " +"creating and sharing your own Python projects, refer to the `Python " +"packaging user guide`_." msgstr "" -msgid "For corporate and other institutional users, be aware that many organisations have their own policies around using and contributing to open source software. Please take such policies into account when making use of the distribution and installation tools provided with Python." +#: ../../installing/index.rst:26 +msgid "" +"For corporate and other institutional users, be aware that many " +"organisations have their own policies around using and contributing to open " +"source software. Please take such policies into account when making use of " +"the distribution and installation tools provided with Python." msgstr "" +#: ../../installing/index.rst:33 msgid "Key terms" msgstr "" -msgid ":program:`pip` is the preferred installer program. It is included by default with the Python binary installers." +#: ../../installing/index.rst:35 +msgid "" +":program:`pip` is the preferred installer program. It is included by default " +"with the Python binary installers." msgstr "" -msgid "A *virtual environment* is a semi-isolated Python environment that allows packages to be installed for use by a particular application, rather than being installed system wide." +#: ../../installing/index.rst:37 +msgid "" +"A *virtual environment* is a semi-isolated Python environment that allows " +"packages to be installed for use by a particular application, rather than " +"being installed system wide." msgstr "" -msgid "``venv`` is the standard tool for creating virtual environments. It defaults to installing :program:`pip` into all created virtual environments." +#: ../../installing/index.rst:40 +msgid "" +"``venv`` is the standard tool for creating virtual environments. It defaults " +"to installing :program:`pip` into all created virtual environments." msgstr "" -msgid "``virtualenv`` is a third-party alternative (and predecessor) to ``venv``." +#: ../../installing/index.rst:42 +msgid "" +"``virtualenv`` is a third-party alternative (and predecessor) to ``venv``." msgstr "" -msgid "The `Python Package Index (PyPI) `__ is a public repository of open source licensed packages made available for use by other Python users." +#: ../../installing/index.rst:44 +msgid "" +"The `Python Package Index (PyPI) `__ is a public " +"repository of open source licensed packages made available for use by other " +"Python users." msgstr "" -msgid "The `Python Packaging Authority `__ is the group of developers and documentation authors responsible for the maintenance and evolution of the standard packaging tools and the associated metadata and file format standards. They maintain a variety of tools, documentation, and issue trackers on `GitHub `__." +#: ../../installing/index.rst:47 +msgid "" +"The `Python Packaging Authority `__ is the group of " +"developers and documentation authors responsible for the maintenance and " +"evolution of the standard packaging tools and the associated metadata and " +"file format standards. They maintain a variety of tools, documentation, and " +"issue trackers on `GitHub `__." msgstr "" -msgid "The use of ``venv`` is now recommended for creating virtual environments." +#: ../../installing/index.rst:54 +msgid "" +"The use of ``venv`` is now recommended for creating virtual environments." msgstr "" -msgid "`Python Packaging User Guide: Creating and using virtual environments `__" +#: ../../installing/index.rst:59 +msgid "" +"`Python Packaging User Guide: Creating and using virtual environments " +"`__" msgstr "" +#: ../../installing/index.rst:64 msgid "Basic usage" msgstr "" -msgid "The standard packaging tools are all designed to be used from the command line." +#: ../../installing/index.rst:66 +msgid "" +"The standard packaging tools are all designed to be used from the command " +"line." msgstr "" -msgid "The following command will install the latest version of a module and its dependencies from PyPI::" +#: ../../installing/index.rst:69 +msgid "" +"The following command will install the latest version of a module and its " +"dependencies from PyPI::" msgstr "" +#: ../../installing/index.rst:72 msgid "python -m pip install SomePackage" msgstr "" -msgid "For POSIX users (including macOS and Linux users), the examples in this guide assume the use of a :term:`virtual environment`." +#: ../../installing/index.rst:76 +msgid "" +"For POSIX users (including macOS and Linux users), the examples in this " +"guide assume the use of a :term:`virtual environment`." msgstr "" -msgid "For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python." +#: ../../installing/index.rst:79 +msgid "" +"For Windows users, the examples in this guide assume that the option to " +"adjust the system PATH environment variable was selected when installing " +"Python." msgstr "" -msgid "It's also possible to specify an exact or minimum version directly on the command line. When using comparator operators such as ``>``, ``<`` or some other special character which get interpreted by shell, the package name and the version should be enclosed within double quotes::" +#: ../../installing/index.rst:83 +msgid "" +"It's also possible to specify an exact or minimum version directly on the " +"command line. When using comparator operators such as ``>``, ``<`` or some " +"other special character which get interpreted by shell, the package name and " +"the version should be enclosed within double quotes::" msgstr "" +#: ../../installing/index.rst:88 msgid "" "python -m pip install SomePackage==1.0.4 # specific version\n" "python -m pip install \"SomePackage>=1.0.4\" # minimum version" msgstr "" -msgid "Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly::" +#: ../../installing/index.rst:91 +msgid "" +"Normally, if a suitable module is already installed, attempting to install " +"it again will have no effect. Upgrading existing modules must be requested " +"explicitly::" msgstr "" +#: ../../installing/index.rst:95 msgid "python -m pip install --upgrade SomePackage" msgstr "" -msgid "More information and resources regarding :program:`pip` and its capabilities can be found in the `Python Packaging User Guide `__." +#: ../../installing/index.rst:97 +msgid "" +"More information and resources regarding :program:`pip` and its capabilities " +"can be found in the `Python Packaging User Guide `__." msgstr "" -msgid "Creation of virtual environments is done through the :mod:`venv` module. Installing packages into an active virtual environment uses the commands shown above." +#: ../../installing/index.rst:100 +msgid "" +"Creation of virtual environments is done through the :mod:`venv` module. " +"Installing packages into an active virtual environment uses the commands " +"shown above." msgstr "" -msgid "`Python Packaging User Guide: Installing Python Distribution Packages `__" +#: ../../installing/index.rst:106 +msgid "" +"`Python Packaging User Guide: Installing Python Distribution Packages " +"`__" msgstr "" +#: ../../installing/index.rst:111 msgid "How do I ...?" msgstr "" +#: ../../installing/index.rst:113 msgid "These are quick answers or links for some common tasks." msgstr "" +#: ../../installing/index.rst:118 msgid "... install packages just for the current user?" msgstr "" -msgid "Passing the ``--user`` option to ``python -m pip install`` will install a package just for the current user, rather than for all users of the system." +#: ../../installing/index.rst:120 +msgid "" +"Passing the ``--user`` option to ``python -m pip install`` will install a " +"package just for the current user, rather than for all users of the system." msgstr "" +#: ../../installing/index.rst:125 msgid "... install scientific Python packages?" msgstr "" -msgid "A number of scientific Python packages have complex binary dependencies, and aren't currently easy to install using :program:`pip` directly. It will often be easier for users to install these packages by `other means `__ rather than attempting to install them with :program:`pip`." +#: ../../installing/index.rst:127 +msgid "" +"A number of scientific Python packages have complex binary dependencies, and " +"aren't currently easy to install using :program:`pip` directly. It will " +"often be easier for users to install these packages by `other means `__ rather than attempting to install them " +"with :program:`pip`." msgstr "" -msgid "`Python Packaging User Guide: Installing Scientific Packages `__" +#: ../../installing/index.rst:135 +msgid "" +"`Python Packaging User Guide: Installing Scientific Packages `__" msgstr "" +#: ../../installing/index.rst:140 msgid "... work with multiple versions of Python installed in parallel?" msgstr "" -msgid "On Linux, macOS, and other POSIX systems, use the versioned Python commands in combination with the ``-m`` switch to run the appropriate copy of :program:`pip`::" +#: ../../installing/index.rst:142 +msgid "" +"On Linux, macOS, and other POSIX systems, use the versioned Python commands " +"in combination with the ``-m`` switch to run the appropriate copy " +"of :program:`pip`::" msgstr "" +#: ../../installing/index.rst:146 msgid "" "python3 -m pip install SomePackage # default Python 3\n" "python3.14 -m pip install SomePackage # specifically Python 3.14" msgstr "" +#: ../../installing/index.rst:149 msgid "Appropriately versioned :program:`pip` commands may also be available." msgstr "" -msgid "On Windows, use the :program:`py` Python launcher in combination with the ``-m`` switch::" +#: ../../installing/index.rst:151 +msgid "" +"On Windows, use the :program:`py` Python launcher in combination with the ``-" +"m`` switch::" msgstr "" +#: ../../installing/index.rst:154 msgid "" "py -3 -m pip install SomePackage # default Python 3\n" "py -3.14 -m pip install SomePackage # specifically Python 3.14" msgstr "" +#: ../../installing/index.rst:166 msgid "Common installation issues" msgstr "" +#: ../../installing/index.rst:169 msgid "Installing into the system Python on Linux" msgstr "" -msgid "On Linux systems, a Python installation will typically be included as part of the distribution. Installing into this Python installation requires root access to the system, and may interfere with the operation of the system package manager and other components of the system if a component is unexpectedly upgraded using :program:`pip`." +#: ../../installing/index.rst:171 +msgid "" +"On Linux systems, a Python installation will typically be included as part " +"of the distribution. Installing into this Python installation requires root " +"access to the system, and may interfere with the operation of the system " +"package manager and other components of the system if a component is " +"unexpectedly upgraded using :program:`pip`." msgstr "" -msgid "On such systems, it is often better to use a virtual environment or a per-user installation when installing packages with :program:`pip`." +#: ../../installing/index.rst:177 +msgid "" +"On such systems, it is often better to use a virtual environment or a per-" +"user installation when installing packages with :program:`pip`." msgstr "" +#: ../../installing/index.rst:182 msgid "Pip not installed" msgstr "" -msgid "It is possible that :program:`pip` does not get installed by default. One potential fix is::" +#: ../../installing/index.rst:184 +msgid "" +"It is possible that :program:`pip` does not get installed by default. One " +"potential fix is::" msgstr "" +#: ../../installing/index.rst:186 msgid "python -m ensurepip --default-pip" msgstr "" -msgid "There are also additional resources for `installing pip `__." +#: ../../installing/index.rst:188 +msgid "" +"There are also additional resources for `installing pip `__." msgstr "" +#: ../../installing/index.rst:193 msgid "Installing binary extensions" msgstr "" -msgid "Python once relied heavily on source-based distribution, with end users being expected to compile extension modules from source as part of the installation process." +#: ../../installing/index.rst:195 +msgid "" +"Python once relied heavily on source-based distribution, with end users " +"being expected to compile extension modules from source as part of the " +"installation process." msgstr "" -msgid "With the introduction of the binary wheel format, and the ability to publish wheels through PyPI, this problem is diminishing, as users are more regularly able to install pre-built extensions rather than needing to build them themselves." +#: ../../installing/index.rst:199 +msgid "" +"With the introduction of the binary wheel format, and the ability to publish " +"wheels through PyPI, this problem is diminishing, as users are more " +"regularly able to install pre-built extensions rather than needing to build " +"them themselves." msgstr "" -msgid "Some of the solutions for installing `scientific software `__ that are not yet available as pre-built wheel files may also help with obtaining other binary extensions without needing to build them locally." +#: ../../installing/index.rst:204 +msgid "" +"Some of the solutions for installing `scientific software `__ that are not yet available as pre-built " +"wheel files may also help with obtaining other binary extensions without " +"needing to build them locally." msgstr "" -msgid "`Python Packaging User Guide: Binary Extensions `__" +#: ../../installing/index.rst:211 +msgid "" +"`Python Packaging User Guide: Binary Extensions `__" msgstr "" diff --git a/library/__future__.po b/library/__future__.po index 1b22d2aef..0fc3542ae 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-20 04:14+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,114 +24,200 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/__future__.rst:2 msgid ":mod:`!__future__` --- Future statement definitions" msgstr ":mod:`!__future__` --- تعاریف دستورات آینده" +#: ../../library/__future__.rst:7 msgid "**Source code:** :source:`Lib/__future__.py`" msgstr "**کد منبع:** :source:`Lib/__future__.py`" -msgid "Imports of the form ``from __future__ import feature`` are called :ref:`future statements `. These are special-cased by the Python compiler to allow the use of new Python features in modules containing the future statement before the release in which the feature becomes standard." -msgstr "ایمپورت‌هایی به شکل ``from __future__ import feature``، :ref:`future statements ` نامیده می‌شوند. این موارد توسط کامپایلر پایتون به‌صورت ویژه درنظر گرفته می‌شوند تا امکان استفاده از ویژگیهای جدید پایتون را در ماژول‌هایی که شامل دستور آینده هستند، قبل از نسخه‌ای که آن ویژگی به‌صورت استاندارد درمی‌آید، فراهم کنند." +#: ../../library/__future__.rst:11 +msgid "" +"Imports of the form ``from __future__ import feature`` are " +"called :ref:`future statements `. These are special-cased by the " +"Python compiler to allow the use of new Python features in modules " +"containing the future statement before the release in which the feature " +"becomes standard." +msgstr "" +"ایمپورت‌هایی به شکل ``from __future__ import feature``، :ref:`future " +"statements ` نامیده می‌شوند. این موارد توسط کامپایلر پایتون به‌صورت " +"ویژه درنظر گرفته می‌شوند تا امکان استفاده از ویژگیهای جدید پایتون را در " +"ماژول‌هایی که شامل دستور آینده هستند، قبل از نسخه‌ای که آن ویژگی به‌صورت " +"استاندارد درمی‌آید، فراهم کنند." -msgid "While these future statements are given additional special meaning by the Python compiler, they are still executed like any other import statement and the :mod:`!__future__` exists and is handled by the import system the same way any other Python module would be. This design serves three purposes:" -msgstr "اگرچه این دستورات آینده‌نگر به‌واسطه کامپایلر پایتون معنای ویژه‌ای پیدا می‌کنند، اما همچنان مانند هر دستور ایمپورت دیگری اجرا می‌شوند. ماژول :mod:`!__future__` وجود دارد و توسط سازوکار ایمپورت، دقیقاً مانند هر ماژول پایتون دیگری مدیریت می‌شود. این طراحی سه هدف را دنبال می‌کند:" +#: ../../library/__future__.rst:16 +msgid "" +"While these future statements are given additional special meaning by the " +"Python compiler, they are still executed like any other import statement and " +"the :mod:`!__future__` exists and is handled by the import system the same " +"way any other Python module would be. This design serves three purposes:" +msgstr "" +"اگرچه این دستورات آینده‌نگر به‌واسطه کامپایلر پایتون معنای ویژه‌ای پیدا می‌کنند، " +"اما همچنان مانند هر دستور ایمپورت دیگری اجرا می‌شوند. ماژول :mod:`!" +"__future__` وجود دارد و توسط سازوکار ایمپورت، دقیقاً مانند هر ماژول پایتون " +"دیگری مدیریت می‌شود. این طراحی سه هدف را دنبال می‌کند:" -msgid "To avoid confusing existing tools that analyze import statements and expect to find the modules they're importing." -msgstr "برای جلوگیری از سردرگمی ابزارهای موجود که دستورات ایمپورت را تحلیل می‌کنند و انتظار دارند که ماژول‌های مورد نظر خود را پیدا کنند." +#: ../../library/__future__.rst:21 +msgid "" +"To avoid confusing existing tools that analyze import statements and expect " +"to find the modules they're importing." +msgstr "" +"برای جلوگیری از سردرگمی ابزارهای موجود که دستورات ایمپورت را تحلیل می‌کنند و " +"انتظار دارند که ماژول‌های مورد نظر خود را پیدا کنند." -msgid "To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and can be inspected programmatically via importing :mod:`!__future__` and examining its contents." -msgstr "برای مستندسازی زمان معرفی تغییرات ناسازگار و زمانی که این تغییرات اجباری خواهند شد --- یا شده‌اند، این نوعی مستندسازی قابل‌اجرا است، و می‌توان آن را به‌صورت برنامه‌نویسی با ایمپورت کردن :mod:`!__future__` و بررسی محتویات آن مشاهده کرد." +#: ../../library/__future__.rst:24 +msgid "" +"To document when incompatible changes were introduced, and when they will be " +"--- or were --- made mandatory. This is a form of executable documentation, " +"and can be inspected programmatically via importing :mod:`!__future__` and " +"examining its contents." +msgstr "" +"برای مستندسازی زمان معرفی تغییرات ناسازگار و زمانی که این تغییرات اجباری " +"خواهند شد --- یا شده‌اند، این نوعی مستندسازی قابل‌اجرا است، و می‌توان آن را " +"به‌صورت برنامه‌نویسی با ایمپورت کردن :mod:`!__future__` و بررسی محتویات آن " +"مشاهده کرد." -msgid "To ensure that :ref:`future statements ` run under releases prior to Python 2.1 at least yield runtime exceptions (the import of :mod:`!__future__` will fail, because there was no module of that name prior to 2.1)." -msgstr "برای اطمینان از اینکه :ref:`future statements ` در نسخه‌های پیش از پایتون 2.1 حداقل استثناهای زمان اجرا ایجاد می‌کنند (ایمپورت کردن :mod:`!__future__` با شکست مواجه خواهد شد، زیرا هیچ ماژولی با آن نام پیش از نسخه‌ی ۲.۱ وجود نداشته است)." +#: ../../library/__future__.rst:29 +msgid "" +"To ensure that :ref:`future statements ` run under releases prior to " +"Python 2.1 at least yield runtime exceptions (the import of :mod:`!" +"__future__` will fail, because there was no module of that name prior to " +"2.1)." +msgstr "" +"برای اطمینان از اینکه :ref:`future statements ` در نسخه‌های پیش از " +"پایتون 2.1 حداقل استثناهای زمان اجرا ایجاد می‌کنند (ایمپورت کردن :mod:`!" +"__future__` با شکست مواجه خواهد شد، زیرا هیچ ماژولی با آن نام پیش از نسخه‌ی " +"۲.۱ وجود نداشته است)." +#: ../../library/__future__.rst:34 msgid "Module Contents" msgstr "محتویات ماژول" -msgid "No feature description will ever be deleted from :mod:`!__future__`. Since its introduction in Python 2.1 the following features have found their way into the language using this mechanism:" -msgstr "هیچ توضیح ویژگی‌ای هرگز از :mod:`!__future__` حذف نخواهد شد. از زمان معرفی آن در پایتون ۲.۱، ویژگی‌های زیر راه خود را به این زبان با استفاده از این مکانیزم پیدا کرده‌اند:" +#: ../../library/__future__.rst:36 +msgid "" +"No feature description will ever be deleted from :mod:`!__future__`. Since " +"its introduction in Python 2.1 the following features have found their way " +"into the language using this mechanism:" +msgstr "" +"هیچ توضیح ویژگی‌ای هرگز از :mod:`!__future__` حذف نخواهد شد. از زمان معرفی آن " +"در پایتون ۲.۱، ویژگی‌های زیر راه خود را به این زبان با استفاده از این مکانیزم " +"پیدا کرده‌اند:" +#: ../../library/__future__.rst:45 msgid "feature" msgstr "ویژگی" +#: ../../library/__future__.rst:46 msgid "optional in" msgstr "اختیاری در" +#: ../../library/__future__.rst:47 msgid "mandatory in" msgstr "اجباری در" +#: ../../library/__future__.rst:48 msgid "effect" msgstr "تأثیر" +#: ../../library/__future__.rst:50 msgid "2.1.0b1" msgstr "2.1.0b1" +#: ../../library/__future__.rst:51 msgid "2.2" msgstr "2.2" +#: ../../library/__future__.rst:52 msgid ":pep:`227`: *Statically Nested Scopes*" msgstr ":pep:`227`: *محدوده‌های تو در تو ایستا*" +#: ../../library/__future__.rst:54 msgid "2.2.0a1" msgstr "2.2.0a1" +#: ../../library/__future__.rst:55 msgid "2.3" msgstr "2.3" +#: ../../library/__future__.rst:56 msgid ":pep:`255`: *Simple Generators*" msgstr ":pep:`255`: *تولیدگرهای ساده*" +#: ../../library/__future__.rst:58 msgid "2.2.0a2" msgstr "2.2.0a2" +#: ../../library/__future__.rst:59 ../../library/__future__.rst:63 +#: ../../library/__future__.rst:71 ../../library/__future__.rst:75 msgid "3.0" msgstr "3.0" +#: ../../library/__future__.rst:60 msgid ":pep:`238`: *Changing the Division Operator*" msgstr ":pep:`238`: *تغییر عملگر تقسیم*" +#: ../../library/__future__.rst:62 ../../library/__future__.rst:66 msgid "2.5.0a1" msgstr "2.5.0a1" +#: ../../library/__future__.rst:64 msgid ":pep:`328`: *Imports: Multi-Line and Absolute/Relative*" msgstr ":pep:`328`: *ایمپورتها: چندخطی و مطلق/نسبی*" +#: ../../library/__future__.rst:67 msgid "2.6" msgstr "2.6" +#: ../../library/__future__.rst:68 msgid ":pep:`343`: *The “with” Statement*" msgstr ":pep:`343`: *دستور “with”*" +#: ../../library/__future__.rst:70 ../../library/__future__.rst:74 msgid "2.6.0a2" msgstr "2.6.0a2" +#: ../../library/__future__.rst:72 msgid ":pep:`3105`: *Make print a function*" msgstr ":pep:`3105`: *تبدیل print به یک تابع*" +#: ../../library/__future__.rst:76 msgid ":pep:`3112`: *Bytes literals in Python 3000*" msgstr ":pep:`3112`: *لیترال‌های بایت در پایتون ۳۰۰۰*" +#: ../../library/__future__.rst:78 msgid "3.5.0b1" msgstr "3.5.0b1" +#: ../../library/__future__.rst:79 msgid "3.7" msgstr "3.7" +#: ../../library/__future__.rst:80 msgid ":pep:`479`: *StopIteration handling inside generators*" msgstr ":pep:`479`: *مدیریت StopIteration درون تولیدگرها*" +#: ../../library/__future__.rst:82 msgid "3.7.0b1" msgstr "3.7.0b1" +#: ../../library/__future__.rst:83 msgid "Never [1]_" msgstr "هرگز [1]_" -msgid ":pep:`563`: *Postponed evaluation of annotations*, :pep:`649`: *Deferred evaluation of annotations using descriptors*" -msgstr ":pep:`563`: *ارزیابی به‌تعویق‌افتادهٔ annotationها*، :pep:`649`: *ارزیابی به‌تعویق‌افتادهٔ annotationها با استفاده از توصیفگرها*" +#: ../../library/__future__.rst:84 +msgid "" +":pep:`563`: *Postponed evaluation of annotations*, :pep:`649`: *Deferred " +"evaluation of annotations using descriptors*" +msgstr "" +":pep:`563`: *ارزیابی به‌تعویق‌افتادهٔ annotationها*، :pep:`649`: *ارزیابی " +"به‌تعویق‌افتادهٔ annotationها با استفاده از توصیفگرها*" +#: ../../library/__future__.rst:93 msgid "Each statement in :file:`__future__.py` is of the form::" msgstr "هر دستور در :file:`__future__.py` به شکل زیر است::" +#: ../../library/__future__.rst:95 msgid "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" @@ -139,14 +225,21 @@ msgstr "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" -msgid "where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both are 5-tuples of the same form as :data:`sys.version_info`::" -msgstr "که در آن، به‌طور معمول، *OptionalRelease* کوچک‌تر از *MandatoryRelease* است، و هر دو تاپل‌های ۵ عضوی به همان شکل :data:`sys.version_info` هستند::" +#: ../../library/__future__.rst:98 +msgid "" +"where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both " +"are 5-tuples of the same form as :data:`sys.version_info`::" +msgstr "" +"که در آن، به‌طور معمول، *OptionalRelease* کوچک‌تر از *MandatoryRelease* است، و " +"هر دو تاپل‌های ۵ عضوی به همان شکل :data:`sys.version_info` هستند::" +#: ../../library/__future__.rst:101 msgid "" "(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int\n" " PY_MINOR_VERSION, # the 1; an int\n" " PY_MICRO_VERSION, # the 0; an int\n" -" PY_RELEASE_LEVEL, # \"alpha\", \"beta\", \"candidate\" or \"final\"; string\n" +" PY_RELEASE_LEVEL, # \"alpha\", \"beta\", \"candidate\" or \"final\"; " +"string\n" " PY_RELEASE_SERIAL # the 3; an int\n" ")" msgstr "" @@ -157,32 +250,78 @@ msgstr "" " PY_RELEASE_SERIAL # عدد 3؛ یک عدد صحیح\n" ")" -msgid "*OptionalRelease* records the first release in which the feature was accepted." -msgstr "*OptionalRelease* اولین نسخه‌ای را ثبت می‌کند که ویژگی در آن پذیرفته شده است." +#: ../../library/__future__.rst:110 +msgid "" +"*OptionalRelease* records the first release in which the feature was " +"accepted." +msgstr "" +"*OptionalRelease* اولین نسخه‌ای را ثبت می‌کند که ویژگی در آن پذیرفته شده است." -msgid "In the case of a *MandatoryRelease* that has not yet occurred, *MandatoryRelease* predicts the release in which the feature will become part of the language." -msgstr "در مورد *MandatoryRelease* که هنوز رخ نداده است، *MandatoryRelease* نسخه‌ای را پیش‌بینی می‌کند که ویژگی در آن بخشی از زبان خواهد شد." +#: ../../library/__future__.rst:114 +msgid "" +"In the case of a *MandatoryRelease* that has not yet occurred, " +"*MandatoryRelease* predicts the release in which the feature will become " +"part of the language." +msgstr "" +"در مورد *MandatoryRelease* که هنوز رخ نداده است، *MandatoryRelease* نسخه‌ای " +"را پیش‌بینی می‌کند که ویژگی در آن بخشی از زبان خواهد شد." -msgid "Else *MandatoryRelease* records when the feature became part of the language; in releases at or after that, modules no longer need a future statement to use the feature in question, but may continue to use such imports." -msgstr "در غیر این صورت، *MandatoryRelease* زمانی را ثبت می‌کند که ویژگی به بخشی از زبان تبدیل شد؛ در نسخه‌های همان یا بعد از آن، ماژول‌ها دیگر برای استفاده از آن ویژگی نیازی به دستور future ندارند، اما می‌توانند به استفاده از چنین ایمپورت‌هایی ادامه دهند." +#: ../../library/__future__.rst:118 +msgid "" +"Else *MandatoryRelease* records when the feature became part of the " +"language; in releases at or after that, modules no longer need a future " +"statement to use the feature in question, but may continue to use such " +"imports." +msgstr "" +"در غیر این صورت، *MandatoryRelease* زمانی را ثبت می‌کند که ویژگی به بخشی از " +"زبان تبدیل شد؛ در نسخه‌های همان یا بعد از آن، ماژول‌ها دیگر برای استفاده از آن " +"ویژگی نیازی به دستور future ندارند، اما می‌توانند به استفاده از چنین " +"ایمپورت‌هایی ادامه دهند." -msgid "*MandatoryRelease* may also be ``None``, meaning that a planned feature got dropped or that it is not yet decided." -msgstr "*MandatoryRelease* همچنین می‌تواند ``None`` باشد، به این معنی که یک ویژگی برنامه‌ریزی‌شده حذف شده است یا اینکه هنوز تصمیمی درباره‌ی آن گرفته نشده است." +#: ../../library/__future__.rst:122 +msgid "" +"*MandatoryRelease* may also be ``None``, meaning that a planned feature got " +"dropped or that it is not yet decided." +msgstr "" +"*MandatoryRelease* همچنین می‌تواند ``None`` باشد، به این معنی که یک ویژگی " +"برنامه‌ریزی‌شده حذف شده است یا اینکه هنوز تصمیمی درباره‌ی آن گرفته نشده است." -msgid "*CompilerFlag* is the (bitfield) flag that should be passed in the fourth argument to the built-in function :func:`compile` to enable the feature in dynamically compiled code. This flag is stored in the :attr:`_Feature.compiler_flag` attribute on :class:`_Feature` instances." -msgstr "*CompilerFlag* پرچم است که باید در آرگومان چهارم به تابع داخلی :func:`compile` ارسال شود تا ویژگی را در کد کامپایل‌شده‌ی پویا فعال کند. این پرچم در ویژگی :attr:`_Feature.compiler_flag` در نمونه‌های :class:`_Feature` ذخیره می‌شود." +#: ../../library/__future__.rst:127 +msgid "" +"*CompilerFlag* is the (bitfield) flag that should be passed in the fourth " +"argument to the built-in function :func:`compile` to enable the feature in " +"dynamically compiled code. This flag is stored in " +"the :attr:`_Feature.compiler_flag` attribute on :class:`_Feature` instances." +msgstr "" +"*CompilerFlag* پرچم است که باید در آرگومان چهارم به تابع " +"داخلی :func:`compile` ارسال شود تا ویژگی را در کد کامپایل‌شده‌ی پویا فعال " +"کند. این پرچم در ویژگی :attr:`_Feature.compiler_flag` در " +"نمونه‌های :class:`_Feature` ذخیره می‌شود." -msgid "``from __future__ import annotations`` was previously scheduled to become mandatory in Python 3.10, but the change was delayed and ultimately canceled. This feature will eventually be deprecated and removed. See :pep:`649` and :pep:`749`." -msgstr "``from __future__ import annotations`` قبلاً قرار بود در پایتون ۳.۱۰ اجباری شود، اما این تغییر به تعویق افتاد و در نهایت لغو شد. این ویژگی در نهایت منسوخ و حذف خواهد شد. برای اطلاعات بیشتر به :pep:`649` و :pep:`749` مراجعه کنید." +#: ../../library/__future__.rst:133 +msgid "" +"``from __future__ import annotations`` was previously scheduled to become " +"mandatory in Python 3.10, but the change was delayed and ultimately " +"canceled. This feature will eventually be deprecated and removed. " +"See :pep:`649` and :pep:`749`." +msgstr "" +"``from __future__ import annotations`` قبلاً قرار بود در پایتون ۳.۱۰ اجباری " +"شود، اما این تغییر به تعویق افتاد و در نهایت لغو شد. این ویژگی در نهایت " +"منسوخ و حذف خواهد شد. برای اطلاعات بیشتر به :pep:`649` و :pep:`749` مراجعه " +"کنید." +#: ../../library/__future__.rst:141 msgid ":ref:`future`" msgstr ":ref:`future`" +#: ../../library/__future__.rst:142 msgid "How the compiler treats future imports." msgstr "نحوه‌ی برخورد کامپایلر با ایمپورت‌های future" +#: ../../library/__future__.rst:144 msgid ":pep:`236` - Back to the __future__" msgstr ":pep:`236` - بازگشت به __future__" +#: ../../library/__future__.rst:145 msgid "The original proposal for the __future__ mechanism." msgstr "پیشنهاد اولیه برای مکانیزم __future__." diff --git a/library/__main__.po b/library/__main__.po index 63508f3a5..be6cbe31a 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-20 04:14+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -22,27 +22,54 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/__main__.rst:2 msgid ":mod:`!__main__` --- Top-level code environment" msgstr "" -msgid "In Python, the special name ``__main__`` is used for two important constructs:" +#: ../../library/__main__.rst:10 +msgid "" +"In Python, the special name ``__main__`` is used for two important " +"constructs:" msgstr "در پایتون، از نام ویژه‌ی ``__main__`` برای دو ساختار مهم استفاده می‌شود:" -msgid "the name of the top-level environment of the program, which can be checked using the ``__name__ == '__main__'`` expression; and" -msgstr "نام محیط سطح بالای برنامه، که می‌توان آن را با استفاده از عبارت ``__name__ == '__main__'`` بررسی کرد؛ و" +#: ../../library/__main__.rst:12 +msgid "" +"the name of the top-level environment of the program, which can be checked " +"using the ``__name__ == '__main__'`` expression; and" +msgstr "" +"نام محیط سطح بالای برنامه، که می‌توان آن را با استفاده از عبارت ``__name__ == " +"'__main__'`` بررسی کرد؛ و" +#: ../../library/__main__.rst:14 msgid "the ``__main__.py`` file in Python packages." msgstr "فایل ``__main__.py`` در بسته‌های پایتون." -msgid "Both of these mechanisms are related to Python modules; how users interact with them and how they interact with each other. They are explained in detail below. If you're new to Python modules, see the tutorial section :ref:`tut-modules` for an introduction." -msgstr "هر دوی این مکانیزم‌ها به ماژول‌های پایتون مربوط می‌شوند: نحوه‌ی تعامل کاربران با آن‌ها و نحوه‌ی تعامل آن‌ها با یکدیگر. این موارد در زیر به‌تفصیل توضیح داده شده‌اند. اگر با ماژول‌های پایتون تازه‌کار هستید، برای آشنایی به بخش آموزش :ref:`tut-modules` مراجعه کنید." +#: ../../library/__main__.rst:16 +msgid "" +"Both of these mechanisms are related to Python modules; how users interact " +"with them and how they interact with each other. They are explained in " +"detail below. If you're new to Python modules, see the tutorial " +"section :ref:`tut-modules` for an introduction." +msgstr "" +"هر دوی این مکانیزم‌ها به ماژول‌های پایتون مربوط می‌شوند: نحوه‌ی تعامل کاربران با " +"آن‌ها و نحوه‌ی تعامل آن‌ها با یکدیگر. این موارد در زیر به‌تفصیل توضیح داده " +"شده‌اند. اگر با ماژول‌های پایتون تازه‌کار هستید، برای آشنایی به بخش " +"آموزش :ref:`tut-modules` مراجعه کنید." +#: ../../library/__main__.rst:25 msgid "``__name__ == '__main__'``" msgstr "``__name__ == '__main__'``" -msgid "When a Python module or package is imported, ``__name__`` is set to the module's name. Usually, this is the name of the Python file itself without the ``.py`` extension::" -msgstr "هنگامی که یک ماژول یا بستهٔ پایتون ایمپورت می‌شود، ``__name__`` به نام ماژول تنظیم می‌شود. معمولاً این همان نام فایل پایتون است بدون پسوند ``.py``::" +#: ../../library/__main__.rst:27 +msgid "" +"When a Python module or package is imported, ``__name__`` is set to the " +"module's name. Usually, this is the name of the Python file itself without " +"the ``.py`` extension::" +msgstr "" +"هنگامی که یک ماژول یا بستهٔ پایتون ایمپورت می‌شود، ``__name__`` به نام ماژول " +"تنظیم می‌شود. معمولاً این همان نام فایل پایتون است بدون پسوند ``.py``::" +#: ../../library/__main__.rst:31 msgid "" ">>> import configparser\n" ">>> configparser.__name__\n" @@ -52,9 +79,15 @@ msgstr "" ">>> configparser.__name__\n" "'configparser'" -msgid "If the file is part of a package, ``__name__`` will also include the parent package's path::" -msgstr "اگر فایل بخشی از یک بسته باشد، ``__name__`` همچنین مسیر بستهٔ والد را شامل خواهد شد::" +#: ../../library/__main__.rst:35 +msgid "" +"If the file is part of a package, ``__name__`` will also include the parent " +"package's path::" +msgstr "" +"اگر فایل بخشی از یک بسته باشد، ``__name__`` همچنین مسیر بستهٔ والد را شامل " +"خواهد شد::" +#: ../../library/__main__.rst:38 msgid "" ">>> from concurrent.futures import process\n" ">>> process.__name__\n" @@ -64,45 +97,68 @@ msgstr "" ">>> process.__name__\n" "'concurrent.futures.process'" -msgid "However, if the module is executed in the top-level code environment, its ``__name__`` is set to the string ``'__main__'``." -msgstr "با این حال، اگر ماژول در محیط کد سطح بالا اجرا شود، ``__name__`` آن به رشته‌ی ``'__main__'`` تنظیم می‌شود." +#: ../../library/__main__.rst:42 +msgid "" +"However, if the module is executed in the top-level code environment, its " +"``__name__`` is set to the string ``'__main__'``." +msgstr "" +"با این حال، اگر ماژول در محیط کد سطح بالا اجرا شود، ``__name__`` آن به رشته‌ی " +"``'__main__'`` تنظیم می‌شود." +#: ../../library/__main__.rst:46 msgid "What is the \"top-level code environment\"?" msgstr "" -msgid "``__main__`` is the name of the environment where top-level code is run. \"Top-level code\" is the first user-specified Python module that starts running. It's \"top-level\" because it imports all other modules that the program needs. Sometimes \"top-level code\" is called an *entry point* to the application." +#: ../../library/__main__.rst:48 +msgid "" +"``__main__`` is the name of the environment where top-level code is run. " +"\"Top-level code\" is the first user-specified Python module that starts " +"running. It's \"top-level\" because it imports all other modules that the " +"program needs. Sometimes \"top-level code\" is called an *entry point* to " +"the application." msgstr "" +#: ../../library/__main__.rst:53 msgid "The top-level code environment can be:" msgstr "" +#: ../../library/__main__.rst:55 msgid "the scope of an interactive prompt::" msgstr "" +#: ../../library/__main__.rst:57 msgid "" ">>> __name__\n" "'__main__'" msgstr "" +#: ../../library/__main__.rst:60 msgid "the Python module passed to the Python interpreter as a file argument:" msgstr "" +#: ../../library/__main__.rst:62 msgid "" "$ python helloworld.py\n" "Hello, world!" msgstr "" -msgid "the Python module or package passed to the Python interpreter with the :option:`-m` argument:" +#: ../../library/__main__.rst:67 +msgid "" +"the Python module or package passed to the Python interpreter with " +"the :option:`-m` argument:" msgstr "" +#: ../../library/__main__.rst:70 msgid "" "$ python -m tarfile\n" "usage: tarfile.py [-h] [-v] (...)" msgstr "" +#: ../../library/__main__.rst:75 msgid "Python code read by the Python interpreter from standard input:" msgstr "" +#: ../../library/__main__.rst:77 msgid "" "$ echo \"import this\" | python\n" "The Zen of Python, by Tim Peters\n" @@ -112,9 +168,12 @@ msgid "" "..." msgstr "" -msgid "Python code passed to the Python interpreter with the :option:`-c` argument:" +#: ../../library/__main__.rst:86 +msgid "" +"Python code passed to the Python interpreter with the :option:`-c` argument:" msgstr "" +#: ../../library/__main__.rst:88 msgid "" "$ python -c \"import this\"\n" "The Zen of Python, by Tim Peters\n" @@ -124,33 +183,60 @@ msgid "" "..." msgstr "" -msgid "In each of these situations, the top-level module's ``__name__`` is set to ``'__main__'``." +#: ../../library/__main__.rst:97 +msgid "" +"In each of these situations, the top-level module's ``__name__`` is set to " +"``'__main__'``." msgstr "" -msgid "As a result, a module can discover whether or not it is running in the top-level environment by checking its own ``__name__``, which allows a common idiom for conditionally executing code when the module is not initialized from an import statement::" +#: ../../library/__main__.rst:100 +msgid "" +"As a result, a module can discover whether or not it is running in the top-" +"level environment by checking its own ``__name__``, which allows a common " +"idiom for conditionally executing code when the module is not initialized " +"from an import statement::" msgstr "" +#: ../../library/__main__.rst:105 msgid "" "if __name__ == '__main__':\n" " # Execute when the module is not initialized from an import statement.\n" " ..." msgstr "" -msgid "For a more detailed look at how ``__name__`` is set in all situations, see the tutorial section :ref:`tut-modules`." +#: ../../library/__main__.rst:111 +msgid "" +"For a more detailed look at how ``__name__`` is set in all situations, see " +"the tutorial section :ref:`tut-modules`." msgstr "" +#: ../../library/__main__.rst:116 ../../library/__main__.rst:239 msgid "Idiomatic Usage" msgstr "" -msgid "Some modules contain code that is intended for script use only, like parsing command-line arguments or fetching data from standard input. If a module like this was imported from a different module, for example to unit test it, the script code would unintentionally execute as well." +#: ../../library/__main__.rst:118 +msgid "" +"Some modules contain code that is intended for script use only, like parsing " +"command-line arguments or fetching data from standard input. If a module " +"like this was imported from a different module, for example to unit test it, " +"the script code would unintentionally execute as well." msgstr "" -msgid "This is where using the ``if __name__ == '__main__'`` code block comes in handy. Code within this block won't run unless the module is executed in the top-level environment." +#: ../../library/__main__.rst:123 +msgid "" +"This is where using the ``if __name__ == '__main__'`` code block comes in " +"handy. Code within this block won't run unless the module is executed in the " +"top-level environment." msgstr "" -msgid "Putting as few statements as possible in the block below ``if __name__ == '__main__'`` can improve code clarity and correctness. Most often, a function named ``main`` encapsulates the program's primary behavior::" +#: ../../library/__main__.rst:127 +msgid "" +"Putting as few statements as possible in the block below ``if __name__ == " +"'__main__'`` can improve code clarity and correctness. Most often, a " +"function named ``main`` encapsulates the program's primary behavior::" msgstr "" +#: ../../library/__main__.rst:131 msgid "" "# echo.py\n" "\n" @@ -173,39 +259,86 @@ msgid "" " sys.exit(main()) # next section explains the use of sys.exit" msgstr "" -msgid "Note that if the module didn't encapsulate code inside the ``main`` function but instead put it directly within the ``if __name__ == '__main__'`` block, the ``phrase`` variable would be global to the entire module. This is error-prone as other functions within the module could be unintentionally using the global variable instead of a local name. A ``main`` function solves this problem." +#: ../../library/__main__.rst:151 +msgid "" +"Note that if the module didn't encapsulate code inside the ``main`` function " +"but instead put it directly within the ``if __name__ == '__main__'`` block, " +"the ``phrase`` variable would be global to the entire module. This is error-" +"prone as other functions within the module could be unintentionally using " +"the global variable instead of a local name. A ``main`` function solves " +"this problem." msgstr "" -msgid "Using a ``main`` function has the added benefit of the ``echo`` function itself being isolated and importable elsewhere. When ``echo.py`` is imported, the ``echo`` and ``main`` functions will be defined, but neither of them will be called, because ``__name__ != '__main__'``." +#: ../../library/__main__.rst:158 +msgid "" +"Using a ``main`` function has the added benefit of the ``echo`` function " +"itself being isolated and importable elsewhere. When ``echo.py`` is " +"imported, the ``echo`` and ``main`` functions will be defined, but neither " +"of them will be called, because ``__name__ != '__main__'``." msgstr "" +#: ../../library/__main__.rst:165 msgid "Packaging Considerations" msgstr "" -msgid "``main`` functions are often used to create command-line tools by specifying them as entry points for console scripts. When this is done, `pip `_ inserts the function call into a template script, where the return value of ``main`` is passed into :func:`sys.exit`. For example::" +#: ../../library/__main__.rst:167 +msgid "" +"``main`` functions are often used to create command-line tools by specifying " +"them as entry points for console scripts. When this is done, `pip `_ inserts the function call into a template script, where the " +"return value of ``main`` is passed into :func:`sys.exit`. For example::" msgstr "" +#: ../../library/__main__.rst:173 msgid "sys.exit(main())" msgstr "" -msgid "Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation is that your function will return some value acceptable as an input to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly returned if your function does not have a return statement)." +#: ../../library/__main__.rst:175 +msgid "" +"Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation " +"is that your function will return some value acceptable as an input " +"to :func:`sys.exit`; typically, an integer or ``None`` (which is implicitly " +"returned if your function does not have a return statement)." msgstr "" -msgid "By proactively following this convention ourselves, our module will have the same behavior when run directly (i.e. ``python echo.py``) as it will have if we later package it as a console script entry-point in a pip-installable package." +#: ../../library/__main__.rst:180 +msgid "" +"By proactively following this convention ourselves, our module will have the " +"same behavior when run directly (i.e. ``python echo.py``) as it will have if " +"we later package it as a console script entry-point in a pip-installable " +"package." msgstr "" -msgid "In particular, be careful about returning strings from your ``main`` function. :func:`sys.exit` will interpret a string argument as a failure message, so your program will have an exit code of ``1``, indicating failure, and the string will be written to :data:`sys.stderr`. The ``echo.py`` example from earlier exemplifies using the ``sys.exit(main())`` convention." +#: ../../library/__main__.rst:185 +msgid "" +"In particular, be careful about returning strings from your ``main`` " +"function. :func:`sys.exit` will interpret a string argument as a failure " +"message, so your program will have an exit code of ``1``, indicating " +"failure, and the string will be written to :data:`sys.stderr`. The " +"``echo.py`` example from earlier exemplifies using the ``sys.exit(main())`` " +"convention." msgstr "" -msgid "`Python Packaging User Guide `_ contains a collection of tutorials and references on how to distribute and install Python packages with modern tools." +#: ../../library/__main__.rst:193 +msgid "" +"`Python Packaging User Guide `_ contains a " +"collection of tutorials and references on how to distribute and install " +"Python packages with modern tools." msgstr "" +#: ../../library/__main__.rst:199 msgid "``__main__.py`` in Python Packages" msgstr "" -msgid "If you are not familiar with Python packages, see section :ref:`tut-packages` of the tutorial. Most commonly, the ``__main__.py`` file is used to provide a command-line interface for a package. Consider the following hypothetical package, \"bandclass\":" +#: ../../library/__main__.rst:201 +msgid "" +"If you are not familiar with Python packages, see section :ref:`tut-" +"packages` of the tutorial. Most commonly, the ``__main__.py`` file is used " +"to provide a command-line interface for a package. Consider the following " +"hypothetical package, \"bandclass\":" msgstr "" +#: ../../library/__main__.rst:206 msgid "" "bandclass\n" " ├── __init__.py\n" @@ -213,15 +346,25 @@ msgid "" " └── student.py" msgstr "" -msgid "``__main__.py`` will be executed when the package itself is invoked directly from the command line using the :option:`-m` flag. For example:" +#: ../../library/__main__.rst:213 +msgid "" +"``__main__.py`` will be executed when the package itself is invoked directly " +"from the command line using the :option:`-m` flag. For example:" msgstr "" +#: ../../library/__main__.rst:216 msgid "$ python -m bandclass" msgstr "" -msgid "This command will cause ``__main__.py`` to run. How you utilize this mechanism will depend on the nature of the package you are writing, but in this hypothetical case, it might make sense to allow the teacher to search for students::" +#: ../../library/__main__.rst:220 +msgid "" +"This command will cause ``__main__.py`` to run. How you utilize this " +"mechanism will depend on the nature of the package you are writing, but in " +"this hypothetical case, it might make sense to allow the teacher to search " +"for students::" msgstr "" +#: ../../library/__main__.rst:225 msgid "" "# bandclass/__main__.py\n" "\n" @@ -232,42 +375,81 @@ msgid "" "print(f'Found student: {search_students(student_name)}')" msgstr "" -msgid "Note that ``from .student import search_students`` is an example of a relative import. This import style can be used when referencing modules within a package. For more details, see :ref:`intra-package-references` in the :ref:`tut-modules` section of the tutorial." +#: ../../library/__main__.rst:233 +msgid "" +"Note that ``from .student import search_students`` is an example of a " +"relative import. This import style can be used when referencing modules " +"within a package. For more details, see :ref:`intra-package-references` in " +"the :ref:`tut-modules` section of the tutorial." msgstr "" -msgid "The content of ``__main__.py`` typically isn't fenced with an ``if __name__ == '__main__'`` block. Instead, those files are kept short and import functions to execute from other modules. Those other modules can then be easily unit-tested and are properly reusable." +#: ../../library/__main__.rst:241 +msgid "" +"The content of ``__main__.py`` typically isn't fenced with an ``if __name__ " +"== '__main__'`` block. Instead, those files are kept short and import " +"functions to execute from other modules. Those other modules can then be " +"easily unit-tested and are properly reusable." msgstr "" -msgid "If used, an ``if __name__ == '__main__'`` block will still work as expected for a ``__main__.py`` file within a package, because its ``__name__`` attribute will include the package's path if imported::" +#: ../../library/__main__.rst:246 +msgid "" +"If used, an ``if __name__ == '__main__'`` block will still work as expected " +"for a ``__main__.py`` file within a package, because its ``__name__`` " +"attribute will include the package's path if imported::" msgstr "" +#: ../../library/__main__.rst:250 msgid "" ">>> import asyncio.__main__\n" ">>> asyncio.__main__.__name__\n" "'asyncio.__main__'" msgstr "" -msgid "This won't work for ``__main__.py`` files in the root directory of a ``.zip`` file though. Hence, for consistency, a minimal ``__main__.py`` without a ``__name__`` check is preferred." +#: ../../library/__main__.rst:254 +msgid "" +"This won't work for ``__main__.py`` files in the root directory of a " +"``.zip`` file though. Hence, for consistency, a minimal ``__main__.py`` " +"without a ``__name__`` check is preferred." msgstr "" -msgid "See :mod:`venv` for an example of a package with a minimal ``__main__.py`` in the standard library. It doesn't contain a ``if __name__ == '__main__'`` block. You can invoke it with ``python -m venv [directory]``." +#: ../../library/__main__.rst:260 +msgid "" +"See :mod:`venv` for an example of a package with a minimal ``__main__.py`` " +"in the standard library. It doesn't contain a ``if __name__ == '__main__'`` " +"block. You can invoke it with ``python -m venv [directory]``." msgstr "" -msgid "See :mod:`runpy` for more details on the :option:`-m` flag to the interpreter executable." +#: ../../library/__main__.rst:264 +msgid "" +"See :mod:`runpy` for more details on the :option:`-m` flag to the " +"interpreter executable." msgstr "" -msgid "See :mod:`zipapp` for how to run applications packaged as *.zip* files. In this case Python looks for a ``__main__.py`` file in the root directory of the archive." +#: ../../library/__main__.rst:267 +msgid "" +"See :mod:`zipapp` for how to run applications packaged as *.zip* files. In " +"this case Python looks for a ``__main__.py`` file in the root directory of " +"the archive." msgstr "" +#: ../../library/__main__.rst:274 msgid "``import __main__``" msgstr "" -msgid "Regardless of which module a Python program was started with, other modules running within that same program can import the top-level environment's scope (:term:`namespace`) by importing the ``__main__`` module. This doesn't import a ``__main__.py`` file but rather whichever module that received the special name ``'__main__'``." +#: ../../library/__main__.rst:276 +msgid "" +"Regardless of which module a Python program was started with, other modules " +"running within that same program can import the top-level environment's " +"scope (:term:`namespace`) by importing the ``__main__`` module. This " +"doesn't import a ``__main__.py`` file but rather whichever module that " +"received the special name ``'__main__'``." msgstr "" +#: ../../library/__main__.rst:282 msgid "Here is an example module that consumes the ``__main__`` namespace::" msgstr "" +#: ../../library/__main__.rst:284 msgid "" "# namely.py\n" "\n" @@ -283,9 +465,11 @@ msgid "" " print(__main__.my_name)" msgstr "" +#: ../../library/__main__.rst:297 msgid "Example usage of this module could be as follows::" msgstr "" +#: ../../library/__main__.rst:299 msgid "" "# start.py\n" "\n" @@ -305,31 +489,57 @@ msgid "" " sys.exit(main())" msgstr "" +#: ../../library/__main__.rst:316 msgid "Now, if we started our program, the result would look like this:" msgstr "" +#: ../../library/__main__.rst:318 msgid "" "$ python start.py\n" "Define the variable `my_name`!" msgstr "" -msgid "The exit code of the program would be 1, indicating an error. Uncommenting the line with ``my_name = \"Dinsdale\"`` fixes the program and now it exits with status code 0, indicating success:" +#: ../../library/__main__.rst:323 +msgid "" +"The exit code of the program would be 1, indicating an error. Uncommenting " +"the line with ``my_name = \"Dinsdale\"`` fixes the program and now it exits " +"with status code 0, indicating success:" msgstr "" +#: ../../library/__main__.rst:327 msgid "" "$ python start.py\n" "Dinsdale" msgstr "" -msgid "Note that importing ``__main__`` doesn't cause any issues with unintentionally running top-level code meant for script use which is put in the ``if __name__ == \"__main__\"`` block of the ``start`` module. Why does this work?" -msgstr "" - -msgid "Python inserts an empty ``__main__`` module in :data:`sys.modules` at interpreter startup, and populates it by running top-level code. In our example this is the ``start`` module which runs line by line and imports ``namely``. In turn, ``namely`` imports ``__main__`` (which is really ``start``). That's an import cycle! Fortunately, since the partially populated ``__main__`` module is present in :data:`sys.modules`, Python passes that to ``namely``. See :ref:`Special considerations for __main__ ` in the import system's reference for details on how this works." +#: ../../library/__main__.rst:332 +msgid "" +"Note that importing ``__main__`` doesn't cause any issues with " +"unintentionally running top-level code meant for script use which is put in " +"the ``if __name__ == \"__main__\"`` block of the ``start`` module. Why does " +"this work?" msgstr "" -msgid "The Python REPL is another example of a \"top-level environment\", so anything defined in the REPL becomes part of the ``__main__`` scope::" +#: ../../library/__main__.rst:336 +msgid "" +"Python inserts an empty ``__main__`` module in :data:`sys.modules` at " +"interpreter startup, and populates it by running top-level code. In our " +"example this is the ``start`` module which runs line by line and imports " +"``namely``. In turn, ``namely`` imports ``__main__`` (which is really " +"``start``). That's an import cycle! Fortunately, since the partially " +"populated ``__main__`` module is present in :data:`sys.modules`, Python " +"passes that to ``namely``. See :ref:`Special considerations for __main__ " +"` in the import system's reference for details on how " +"this works." +msgstr "" + +#: ../../library/__main__.rst:345 +msgid "" +"The Python REPL is another example of a \"top-level environment\", so " +"anything defined in the REPL becomes part of the ``__main__`` scope::" msgstr "" +#: ../../library/__main__.rst:348 msgid "" ">>> import namely\n" ">>> namely.did_user_define_their_name()\n" @@ -345,5 +555,8 @@ msgid "" "Jabberwocky" msgstr "" -msgid "The ``__main__`` scope is used in the implementation of :mod:`pdb` and :mod:`rlcompleter`." +#: ../../library/__main__.rst:361 +msgid "" +"The ``__main__`` scope is used in the implementation of :mod:`pdb` " +"and :mod:`rlcompleter`." msgstr "" diff --git a/library/_thread.po b/library/_thread.po index e42d02634..754d7aff7 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,120 +22,239 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/_thread.rst:2 msgid ":mod:`!_thread` --- Low-level threading API" msgstr "" -msgid "This module provides low-level primitives for working with multiple threads (also called :dfn:`light-weight processes` or :dfn:`tasks`) --- multiple threads of control sharing their global data space. For synchronization, simple locks (also called :dfn:`mutexes` or :dfn:`binary semaphores`) are provided. The :mod:`threading` module provides an easier to use and higher-level threading API built on top of this module." +#: ../../library/_thread.rst:15 +msgid "" +"This module provides low-level primitives for working with multiple threads " +"(also called :dfn:`light-weight processes` or :dfn:`tasks`) --- multiple " +"threads of control sharing their global data space. For synchronization, " +"simple locks (also called :dfn:`mutexes` or :dfn:`binary semaphores`) are " +"provided. The :mod:`threading` module provides an easier to use and higher-" +"level threading API built on top of this module." msgstr "" +#: ../../library/_thread.rst:26 msgid "This module used to be optional, it is now always available." msgstr "" +#: ../../library/_thread.rst:29 msgid "This module defines the following constants and functions:" msgstr "" +#: ../../library/_thread.rst:33 msgid "Raised on thread-specific errors." msgstr "" +#: ../../library/_thread.rst:35 msgid "This is now a synonym of the built-in :exc:`RuntimeError`." msgstr "" -msgid "Start a new thread and return its identifier. The thread executes the function *function* with the argument list *args* (which must be a tuple). The optional *kwargs* argument specifies a dictionary of keyword arguments." +#: ../../library/_thread.rst:41 +msgid "" +"Start a new thread and return its identifier. The thread executes the " +"function *function* with the argument list *args* (which must be a tuple). " +"The optional *kwargs* argument specifies a dictionary of keyword arguments." msgstr "" +#: ../../library/_thread.rst:45 msgid "When the function returns, the thread silently exits." msgstr "" -msgid "When the function terminates with an unhandled exception, :func:`sys.unraisablehook` is called to handle the exception. The *object* attribute of the hook argument is *function*. By default, a stack trace is printed and then the thread exits (but other threads continue to run)." +#: ../../library/_thread.rst:47 +msgid "" +"When the function terminates with an unhandled " +"exception, :func:`sys.unraisablehook` is called to handle the exception. The " +"*object* attribute of the hook argument is *function*. By default, a stack " +"trace is printed and then the thread exits (but other threads continue to " +"run)." msgstr "" -msgid "When the function raises a :exc:`SystemExit` exception, it is silently ignored." +#: ../../library/_thread.rst:52 +msgid "" +"When the function raises a :exc:`SystemExit` exception, it is silently " +"ignored." msgstr "" -msgid "Raises an :ref:`auditing event ` ``_thread.start_new_thread`` with arguments ``function``, ``args``, ``kwargs``." +#: ../../library/_thread.rst:55 +msgid "" +"Raises an :ref:`auditing event ` ``_thread.start_new_thread`` with " +"arguments ``function``, ``args``, ``kwargs``." msgstr "" +#: ../../library/_thread.rst:57 msgid ":func:`sys.unraisablehook` is now used to handle unhandled exceptions." msgstr "" -msgid "Simulate the effect of a signal arriving in the main thread. A thread can use this function to interrupt the main thread, though there is no guarantee that the interruption will happen immediately." +#: ../../library/_thread.rst:63 +msgid "" +"Simulate the effect of a signal arriving in the main thread. A thread can " +"use this function to interrupt the main thread, though there is no guarantee " +"that the interruption will happen immediately." msgstr "" -msgid "If given, *signum* is the number of the signal to simulate. If *signum* is not given, :const:`signal.SIGINT` is simulated." +#: ../../library/_thread.rst:67 +msgid "" +"If given, *signum* is the number of the signal to simulate. If *signum* is " +"not given, :const:`signal.SIGINT` is simulated." msgstr "" -msgid "If the given signal isn't handled by Python (it was set to :const:`signal.SIG_DFL` or :const:`signal.SIG_IGN`), this function does nothing." +#: ../../library/_thread.rst:70 +msgid "" +"If the given signal isn't handled by Python (it was set " +"to :const:`signal.SIG_DFL` or :const:`signal.SIG_IGN`), this function does " +"nothing." msgstr "" +#: ../../library/_thread.rst:74 msgid "The *signum* argument is added to customize the signal number." msgstr "" -msgid "This does not emit the corresponding signal but schedules a call to the associated handler (if it exists). If you want to truly emit the signal, use :func:`signal.raise_signal`." +#: ../../library/_thread.rst:78 +msgid "" +"This does not emit the corresponding signal but schedules a call to the " +"associated handler (if it exists). If you want to truly emit the signal, " +"use :func:`signal.raise_signal`." msgstr "" -msgid "Raise the :exc:`SystemExit` exception. When not caught, this will cause the thread to exit silently." +#: ../../library/_thread.rst:85 +msgid "" +"Raise the :exc:`SystemExit` exception. When not caught, this will cause the " +"thread to exit silently." msgstr "" -msgid "Return a new lock object. Methods of locks are described below. The lock is initially unlocked." +#: ../../library/_thread.rst:99 +msgid "" +"Return a new lock object. Methods of locks are described below. The lock " +"is initially unlocked." msgstr "" -msgid "Return the 'thread identifier' of the current thread. This is a nonzero integer. Its value has no direct meaning; it is intended as a magic cookie to be used e.g. to index a dictionary of thread-specific data. Thread identifiers may be recycled when a thread exits and another thread is created." +#: ../../library/_thread.rst:105 +msgid "" +"Return the 'thread identifier' of the current thread. This is a nonzero " +"integer. Its value has no direct meaning; it is intended as a magic cookie " +"to be used e.g. to index a dictionary of thread-specific data. Thread " +"identifiers may be recycled when a thread exits and another thread is " +"created." msgstr "" -msgid "Return the native integral Thread ID of the current thread assigned by the kernel. This is a non-negative integer. Its value may be used to uniquely identify this particular thread system-wide (until the thread terminates, after which the value may be recycled by the OS)." +#: ../../library/_thread.rst:113 +msgid "" +"Return the native integral Thread ID of the current thread assigned by the " +"kernel. This is a non-negative integer. Its value may be used to uniquely " +"identify this particular thread system-wide (until the thread terminates, " +"after which the value may be recycled by the OS)." msgstr "" +#: ../../library/_thread.rst:118 ../../library/_thread.rst:143 msgid "Availability" msgstr "" +#: ../../library/_thread.rst:122 msgid "Added support for GNU/kFreeBSD." msgstr "" -msgid "Return the thread stack size used when creating new threads. The optional *size* argument specifies the stack size to be used for subsequently created threads, and must be 0 (use platform or configured default) or a positive integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is used. If changing the thread stack size is unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is currently the minimum supported stack size value to guarantee sufficient stack space for the interpreter itself. Note that some platforms may have particular restrictions on values for the stack size, such as requiring a minimum stack size > 32 KiB or requiring allocation in multiples of the system memory page size - platform documentation should be referred to for more information (4 KiB pages are common; using multiples of 4096 for the stack size is the suggested approach in the absence of more specific information)." -msgstr "" - +#: ../../library/_thread.rst:128 +msgid "" +"Return the thread stack size used when creating new threads. The optional " +"*size* argument specifies the stack size to be used for subsequently created " +"threads, and must be 0 (use platform or configured default) or a positive " +"integer value of at least 32,768 (32 KiB). If *size* is not specified, 0 is " +"used. If changing the thread stack size is unsupported, " +"a :exc:`RuntimeError` is raised. If the specified stack size is invalid, " +"a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB is " +"currently the minimum supported stack size value to guarantee sufficient " +"stack space for the interpreter itself. Note that some platforms may have " +"particular restrictions on values for the stack size, such as requiring a " +"minimum stack size > 32 KiB or requiring allocation in multiples of the " +"system memory page size - platform documentation should be referred to for " +"more information (4 KiB pages are common; using multiples of 4096 for the " +"stack size is the suggested approach in the absence of more specific " +"information)." +msgstr "" + +#: ../../library/_thread.rst:145 msgid "Unix platforms with POSIX threads support." msgstr "" -msgid "The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire `. Specifying a timeout greater than this value will raise an :exc:`OverflowError`." +#: ../../library/_thread.rst:150 +msgid "" +"The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire " +"`. Specifying a timeout greater than this value will " +"raise an :exc:`OverflowError`." msgstr "" +#: ../../library/_thread.rst:166 msgid "This is the type of lock objects." msgstr "" +#: ../../library/_thread.rst:168 msgid "Lock objects have the following methods:" msgstr "" -msgid "Without any optional argument, this method acquires the lock unconditionally, if necessary waiting until it is released by another thread (only one thread at a time can acquire a lock --- that's their reason for existence)." +#: ../../library/_thread.rst:172 +msgid "" +"Without any optional argument, this method acquires the lock " +"unconditionally, if necessary waiting until it is released by another thread " +"(only one thread at a time can acquire a lock --- that's their reason for " +"existence)." msgstr "" -msgid "If the *blocking* argument is present, the action depends on its value: if it is false, the lock is only acquired if it can be acquired immediately without waiting, while if it is true, the lock is acquired unconditionally as above." +#: ../../library/_thread.rst:176 +msgid "" +"If the *blocking* argument is present, the action depends on its value: if " +"it is false, the lock is only acquired if it can be acquired immediately " +"without waiting, while if it is true, the lock is acquired unconditionally " +"as above." msgstr "" -msgid "If the floating-point *timeout* argument is present and positive, it specifies the maximum wait time in seconds before returning. A negative *timeout* argument specifies an unbounded wait. You cannot specify a *timeout* if *blocking* is false." +#: ../../library/_thread.rst:181 +msgid "" +"If the floating-point *timeout* argument is present and positive, it " +"specifies the maximum wait time in seconds before returning. A negative " +"*timeout* argument specifies an unbounded wait. You cannot specify a " +"*timeout* if *blocking* is false." msgstr "" -msgid "The return value is ``True`` if the lock is acquired successfully, ``False`` if not." +#: ../../library/_thread.rst:186 +msgid "" +"The return value is ``True`` if the lock is acquired successfully, ``False`` " +"if not." msgstr "" +#: ../../library/_thread.rst:189 msgid "The *timeout* parameter is new." msgstr "" +#: ../../library/_thread.rst:192 msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "" +#: ../../library/_thread.rst:195 msgid "Lock acquires can now be interrupted by signals on Windows." msgstr "" -msgid "Releases the lock. The lock must have been acquired earlier, but not necessarily by the same thread." +#: ../../library/_thread.rst:200 +msgid "" +"Releases the lock. The lock must have been acquired earlier, but not " +"necessarily by the same thread." msgstr "" -msgid "Return the status of the lock: ``True`` if it has been acquired by some thread, ``False`` if not." +#: ../../library/_thread.rst:205 +msgid "" +"Return the status of the lock: ``True`` if it has been acquired by some " +"thread, ``False`` if not." msgstr "" -msgid "In addition to these methods, lock objects can also be used via the :keyword:`with` statement, e.g.::" +#: ../../library/_thread.rst:208 +msgid "" +"In addition to these methods, lock objects can also be used via " +"the :keyword:`with` statement, e.g.::" msgstr "" +#: ../../library/_thread.rst:211 msgid "" "import _thread\n" "\n" @@ -145,41 +264,62 @@ msgid "" " print(\"a_lock is locked while this executes\")" msgstr "" +#: ../../library/_thread.rst:218 msgid "**Caveats:**" msgstr "" -msgid "Interrupts always go to the main thread (the :exc:`KeyboardInterrupt` exception will be received by that thread.)" +#: ../../library/_thread.rst:222 +msgid "" +"Interrupts always go to the main thread (the :exc:`KeyboardInterrupt` " +"exception will be received by that thread.)" msgstr "" -msgid "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is equivalent to calling :func:`_thread.exit`." +#: ../../library/_thread.rst:225 +msgid "" +"Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " +"equivalent to calling :func:`_thread.exit`." msgstr "" -msgid "When the main thread exits, it is system defined whether the other threads survive. On most systems, they are killed without executing :keyword:`try` ... :keyword:`finally` clauses or executing object destructors." +#: ../../library/_thread.rst:228 +msgid "" +"When the main thread exits, it is system defined whether the other threads " +"survive. On most systems, they are killed without " +"executing :keyword:`try` ... :keyword:`finally` clauses or executing object " +"destructors." msgstr "" +#: ../../library/_thread.rst:7 msgid "light-weight processes" msgstr "" +#: ../../library/_thread.rst:7 msgid "processes, light-weight" msgstr "" +#: ../../library/_thread.rst:7 msgid "binary semaphores" msgstr "" +#: ../../library/_thread.rst:7 msgid "semaphores, binary" msgstr "" +#: ../../library/_thread.rst:22 msgid "pthreads" msgstr "" +#: ../../library/_thread.rst:22 msgid "threads" msgstr "" +#: ../../library/_thread.rst:22 msgid "POSIX" msgstr "" +#: ../../library/_thread.rst:220 msgid "module" msgstr "" +#: ../../library/_thread.rst:220 msgid "signal" msgstr "" diff --git a/library/abc.po b/library/abc.po index 35a9e2fc5..5b7c29769 100644 --- a/library/abc.po +++ b/library/abc.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,24 +23,46 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/abc.rst:2 msgid ":mod:`!abc` --- Abstract Base Classes" msgstr "" +#: ../../library/abc.rst:11 msgid "**Source code:** :source:`Lib/abc.py`" msgstr "" -msgid "This module provides the infrastructure for defining :term:`abstract base classes ` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)" +#: ../../library/abc.rst:15 +msgid "" +"This module provides the infrastructure for defining :term:`abstract base " +"classes ` (ABCs) in Python, as outlined in :pep:`3119`; " +"see the PEP for why this was added to Python. (See also :pep:`3141` and " +"the :mod:`numbers` module regarding a type hierarchy for numbers based on " +"ABCs.)" msgstr "" -msgid "The :mod:`collections` module has some concrete classes that derive from ABCs; these can, of course, be further derived. In addition, the :mod:`collections.abc` submodule has some ABCs that can be used to test whether a class or instance provides a particular interface, for example, if it is :term:`hashable` or if it is a :term:`mapping`." +#: ../../library/abc.rst:20 +msgid "" +"The :mod:`collections` module has some concrete classes that derive from " +"ABCs; these can, of course, be further derived. In addition, " +"the :mod:`collections.abc` submodule has some ABCs that can be used to test " +"whether a class or instance provides a particular interface, for example, if " +"it is :term:`hashable` or if it is a :term:`mapping`." msgstr "" -msgid "This module provides the metaclass :class:`ABCMeta` for defining ABCs and a helper class :class:`ABC` to alternatively define ABCs through inheritance:" +#: ../../library/abc.rst:27 +msgid "" +"This module provides the metaclass :class:`ABCMeta` for defining ABCs and a " +"helper class :class:`ABC` to alternatively define ABCs through inheritance:" msgstr "" -msgid "A helper class that has :class:`ABCMeta` as its metaclass. With this class, an abstract base class can be created by simply deriving from :class:`!ABC` avoiding sometimes confusing metaclass usage, for example::" +#: ../../library/abc.rst:32 +msgid "" +"A helper class that has :class:`ABCMeta` as its metaclass. With this class, " +"an abstract base class can be created by simply deriving from :class:`!ABC` " +"avoiding sometimes confusing metaclass usage, for example::" msgstr "" +#: ../../library/abc.rst:36 msgid "" "from abc import ABC\n" "\n" @@ -48,9 +70,16 @@ msgid "" " pass" msgstr "" -msgid "Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore inheriting from :class:`!ABC` requires the usual precautions regarding metaclass usage, as multiple inheritance may lead to metaclass conflicts. One may also define an abstract base class by passing the metaclass keyword and using :class:`!ABCMeta` directly, for example::" +#: ../../library/abc.rst:41 +msgid "" +"Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore " +"inheriting from :class:`!ABC` requires the usual precautions regarding " +"metaclass usage, as multiple inheritance may lead to metaclass conflicts. " +"One may also define an abstract base class by passing the metaclass keyword " +"and using :class:`!ABCMeta` directly, for example::" msgstr "" +#: ../../library/abc.rst:47 msgid "" "from abc import ABCMeta\n" "\n" @@ -58,18 +87,34 @@ msgid "" " pass" msgstr "" +#: ../../library/abc.rst:57 msgid "Metaclass for defining Abstract Base Classes (ABCs)." msgstr "" -msgid "Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as \"virtual subclasses\" -- these and their descendants will be considered subclasses of the registering ABC by the built-in :func:`issubclass` function, but the registering ABC won't show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via :func:`super`). [#]_" +#: ../../library/abc.rst:59 +msgid "" +"Use this metaclass to create an ABC. An ABC can be subclassed directly, and " +"then acts as a mix-in class. You can also register unrelated concrete " +"classes (even built-in classes) and unrelated ABCs as \"virtual subclasses\" " +"-- these and their descendants will be considered subclasses of the " +"registering ABC by the built-in :func:`issubclass` function, but the " +"registering ABC won't show up in their MRO (Method Resolution Order) nor " +"will method implementations defined by the registering ABC be callable (not " +"even via :func:`super`). [#]_" msgstr "" -msgid "Classes created with a metaclass of :class:`!ABCMeta` have the following method:" +#: ../../library/abc.rst:68 +msgid "" +"Classes created with a metaclass of :class:`!ABCMeta` have the following " +"method:" msgstr "" -msgid "Register *subclass* as a \"virtual subclass\" of this ABC. For example::" +#: ../../library/abc.rst:72 +msgid "" +"Register *subclass* as a \"virtual subclass\" of this ABC. For example::" msgstr "" +#: ../../library/abc.rst:75 msgid "" "from abc import ABC\n" "\n" @@ -82,27 +127,48 @@ msgid "" "assert isinstance((), MyABC)" msgstr "" +#: ../../library/abc.rst:85 msgid "Returns the registered subclass, to allow usage as a class decorator." msgstr "" -msgid "To detect calls to :meth:`!register`, you can use the :func:`get_cache_token` function." +#: ../../library/abc.rst:88 +msgid "" +"To detect calls to :meth:`!register`, you can use " +"the :func:`get_cache_token` function." msgstr "" +#: ../../library/abc.rst:92 msgid "You can also override this method in an abstract base class:" msgstr "" +#: ../../library/abc.rst:96 msgid "(Must be defined as a class method.)" msgstr "" -msgid "Check whether *subclass* is considered a subclass of this ABC. This means that you can customize the behavior of :func:`issubclass` further without the need to call :meth:`register` on every class you want to consider a subclass of the ABC. (This class method is called from the :meth:`~type.__subclasscheck__` method of the ABC.)" +#: ../../library/abc.rst:98 +msgid "" +"Check whether *subclass* is considered a subclass of this ABC. This means " +"that you can customize the behavior of :func:`issubclass` further without " +"the need to call :meth:`register` on every class you want to consider a " +"subclass of the ABC. (This class method is called from " +"the :meth:`~type.__subclasscheck__` method of the ABC.)" msgstr "" -msgid "This method should return ``True``, ``False`` or :data:`NotImplemented`. If it returns ``True``, the *subclass* is considered a subclass of this ABC. If it returns ``False``, the *subclass* is not considered a subclass of this ABC, even if it would normally be one. If it returns :data:`!NotImplemented`, the subclass check is continued with the usual mechanism." +#: ../../library/abc.rst:104 +msgid "" +"This method should return ``True``, ``False`` or :data:`NotImplemented`. If " +"it returns ``True``, the *subclass* is considered a subclass of this ABC. If " +"it returns ``False``, the *subclass* is not considered a subclass of this " +"ABC, even if it would normally be one. If it returns :data:`!" +"NotImplemented`, the subclass check is continued with the usual mechanism." msgstr "" -msgid "For a demonstration of these concepts, look at this example ABC definition::" +#: ../../library/abc.rst:114 +msgid "" +"For a demonstration of these concepts, look at this example ABC definition::" msgstr "" +#: ../../library/abc.rst:116 msgid "" "class Foo:\n" " def __getitem__(self, index):\n" @@ -132,30 +198,69 @@ msgid "" "MyIterable.register(Foo)" msgstr "" -msgid "The ABC ``MyIterable`` defines the standard iterable method, :meth:`~object.__iter__`, as an abstract method. The implementation given here can still be called from subclasses. The :meth:`!get_iterator` method is also part of the ``MyIterable`` abstract base class, but it does not have to be overridden in non-abstract derived classes." +#: ../../library/abc.rst:143 +msgid "" +"The ABC ``MyIterable`` defines the standard iterable " +"method, :meth:`~object.__iter__`, as an abstract method. The implementation " +"given here can still be called from subclasses. The :meth:`!get_iterator` " +"method is also part of the ``MyIterable`` abstract base class, but it does " +"not have to be overridden in non-abstract derived classes." msgstr "" -msgid "The :meth:`__subclasshook__` class method defined here says that any class that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` (or in that of one of its base classes, accessed via the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too." +#: ../../library/abc.rst:149 +msgid "" +"The :meth:`__subclasshook__` class method defined here says that any class " +"that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` " +"(or in that of one of its base classes, accessed via " +"the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" -msgid "Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, even though it does not define an :meth:`~object.__iter__` method (it uses the old-style iterable protocol, defined in terms of :meth:`~object.__len__` and :meth:`~object.__getitem__`). Note that this will not make ``get_iterator`` available as a method of ``Foo``, so it is provided separately." +#: ../../library/abc.rst:154 +msgid "" +"Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, " +"even though it does not define an :meth:`~object.__iter__` method (it uses " +"the old-style iterable protocol, defined in terms of :meth:`~object.__len__` " +"and :meth:`~object.__getitem__`). Note that this will not make " +"``get_iterator`` available as a method of ``Foo``, so it is provided " +"separately." msgstr "" +#: ../../library/abc.rst:163 msgid "The :mod:`!abc` module also provides the following decorator:" msgstr "" +#: ../../library/abc.rst:167 msgid "A decorator indicating abstract methods." msgstr "" -msgid "Using this decorator requires that the class's metaclass is :class:`ABCMeta` or is derived from it. A class that has a metaclass derived from :class:`!ABCMeta` cannot be instantiated unless all of its abstract methods and properties are overridden. The abstract methods can be called using any of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used to declare abstract methods for properties and descriptors." +#: ../../library/abc.rst:169 +msgid "" +"Using this decorator requires that the class's metaclass is :class:`ABCMeta` " +"or is derived from it. A class that has a metaclass derived from :class:`!" +"ABCMeta` cannot be instantiated unless all of its abstract methods and " +"properties are overridden. The abstract methods can be called using any of " +"the normal 'super' call mechanisms. :deco:`!abstractmethod` may be used to " +"declare abstract methods for properties and descriptors." msgstr "" -msgid "Dynamically adding abstract methods to a class, or attempting to modify the abstraction status of a method or class once it is created, are only supported using the :func:`update_abstractmethods` function. The :func:`!abstractmethod` only affects subclasses derived using regular inheritance; \"virtual subclasses\" registered with the ABC's :meth:`~ABCMeta.register` method are not affected." +#: ../../library/abc.rst:176 +msgid "" +"Dynamically adding abstract methods to a class, or attempting to modify the " +"abstraction status of a method or class once it is created, are only " +"supported using the :func:`update_abstractmethods` function. The :deco:`!" +"abstractmethod` only affects subclasses derived using regular inheritance; " +"\"virtual subclasses\" registered with the ABC's :meth:`~ABCMeta.register` " +"method are not affected." msgstr "" -msgid "When :func:`!abstractmethod` is applied in combination with other method descriptors, it should be applied as the innermost decorator, as shown in the following usage examples::" +#: ../../library/abc.rst:183 +msgid "" +"When :deco:`!abstractmethod` is applied in combination with other method " +"descriptors, it should be applied as the innermost decorator, as shown in " +"the following usage examples::" msgstr "" +#: ../../library/abc.rst:187 msgid "" "class C(ABC):\n" " @abstractmethod\n" @@ -188,9 +293,16 @@ msgid "" " x = property(_get_x, _set_x)" msgstr "" -msgid "In order to correctly interoperate with the abstract base class machinery, the descriptor must identify itself as abstract using :attr:`!__isabstractmethod__`. In general, this attribute should be ``True`` if any of the methods used to compose the descriptor are abstract. For example, Python's built-in :class:`property` does the equivalent of::" +#: ../../library/abc.rst:217 +msgid "" +"In order to correctly interoperate with the abstract base class machinery, " +"the descriptor must identify itself as abstract using :attr:`!" +"__isabstractmethod__`. In general, this attribute should be ``True`` if any " +"of the methods used to compose the descriptor are abstract. For example, " +"Python's built-in :deco:`property` does the equivalent of::" msgstr "" +#: ../../library/abc.rst:223 msgid "" "class Descriptor:\n" " ...\n" @@ -200,21 +312,38 @@ msgid "" " f in (self._fget, self._fset, self._fdel))" msgstr "" -msgid "Unlike Java abstract methods, these abstract methods may have an implementation. This implementation can be called via the :func:`super` mechanism from the class that overrides it. This could be useful as an end-point for a super-call in a framework that uses cooperative multiple-inheritance." +#: ../../library/abc.rst:232 +msgid "" +"Unlike Java abstract methods, these abstract methods may have an " +"implementation. This implementation can be called via the :func:`super` " +"mechanism from the class that overrides it. This could be useful as an end-" +"point for a super-call in a framework that uses cooperative multiple-" +"inheritance." msgstr "" +#: ../../library/abc.rst:239 msgid "The :mod:`!abc` module also supports the following legacy decorators:" msgstr "" -msgid "It is now possible to use :class:`classmethod` with :func:`abstractmethod`, making this decorator redundant." +#: ../../library/abc.rst:244 +msgid "" +"It is now possible to use :deco:`classmethod` with :deco:`abstractmethod`, " +"making this decorator redundant." msgstr "" -msgid "A subclass of the built-in :func:`classmethod`, indicating an abstract classmethod. Otherwise it is similar to :func:`abstractmethod`." +#: ../../library/abc.rst:248 +msgid "" +"A subclass of the built-in :class:`classmethod`, indicating an abstract " +"classmethod. Otherwise it is similar to :deco:`abstractmethod`." msgstr "" -msgid "This special case is deprecated, as the :func:`classmethod` decorator is now correctly identified as abstract when applied to an abstract method::" +#: ../../library/abc.rst:251 +msgid "" +"This special case is deprecated, as the :deco:`classmethod` decorator is now " +"correctly identified as abstract when applied to an abstract method::" msgstr "" +#: ../../library/abc.rst:255 msgid "" "class C(ABC):\n" " @classmethod\n" @@ -223,15 +352,25 @@ msgid "" " ..." msgstr "" -msgid "It is now possible to use :class:`staticmethod` with :func:`abstractmethod`, making this decorator redundant." +#: ../../library/abc.rst:265 +msgid "" +"It is now possible to use :deco:`staticmethod` with :deco:`abstractmethod`, " +"making this decorator redundant." msgstr "" -msgid "A subclass of the built-in :func:`staticmethod`, indicating an abstract staticmethod. Otherwise it is similar to :func:`abstractmethod`." +#: ../../library/abc.rst:269 +msgid "" +"A subclass of the built-in :class:`staticmethod`, indicating an abstract " +"staticmethod. Otherwise it is similar to :deco:`abstractmethod`." msgstr "" -msgid "This special case is deprecated, as the :func:`staticmethod` decorator is now correctly identified as abstract when applied to an abstract method::" +#: ../../library/abc.rst:272 +msgid "" +"This special case is deprecated, as the :deco:`staticmethod` decorator is " +"now correctly identified as abstract when applied to an abstract method::" msgstr "" +#: ../../library/abc.rst:276 msgid "" "class C(ABC):\n" " @staticmethod\n" @@ -240,15 +379,27 @@ msgid "" " ..." msgstr "" -msgid "It is now possible to use :class:`property`, :meth:`property.getter`, :meth:`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, making this decorator redundant." +#: ../../library/abc.rst:285 +msgid "" +"It is now possible to " +"use :deco:`property`, :deco:`property.getter`, :deco:`property.setter` " +"and :deco:`property.deleter` with :deco:`abstractmethod`, making this " +"decorator redundant." msgstr "" -msgid "A subclass of the built-in :func:`property`, indicating an abstract property." +#: ../../library/abc.rst:290 +msgid "" +"A subclass of the built-in :class:`property`, indicating an abstract " +"property." msgstr "" -msgid "This special case is deprecated, as the :func:`property` decorator is now correctly identified as abstract when applied to an abstract method::" +#: ../../library/abc.rst:293 +msgid "" +"This special case is deprecated, as the :deco:`property` decorator is now " +"correctly identified as abstract when applied to an abstract method::" msgstr "" +#: ../../library/abc.rst:297 msgid "" "class C(ABC):\n" " @property\n" @@ -257,9 +408,14 @@ msgid "" " ..." msgstr "" -msgid "The above example defines a read-only property; you can also define a read-write abstract property by appropriately marking one or more of the underlying methods as abstract::" +#: ../../library/abc.rst:303 +msgid "" +"The above example defines a read-only property; you can also define a read-" +"write abstract property by appropriately marking one or more of the " +"underlying methods as abstract::" msgstr "" +#: ../../library/abc.rst:307 msgid "" "class C(ABC):\n" " @property\n" @@ -272,9 +428,13 @@ msgid "" " ..." msgstr "" -msgid "If only some components are abstract, only those components need to be updated to create a concrete property in a subclass::" +#: ../../library/abc.rst:317 +msgid "" +"If only some components are abstract, only those components need to be " +"updated to create a concrete property in a subclass::" msgstr "" +#: ../../library/abc.rst:320 msgid "" "class D(C):\n" " @C.x.setter\n" @@ -282,29 +442,49 @@ msgid "" " ..." msgstr "" +#: ../../library/abc.rst:326 msgid "The :mod:`!abc` module also provides the following functions:" msgstr "" +#: ../../library/abc.rst:330 msgid "Returns the current abstract base class cache token." msgstr "" -msgid "The token is an opaque object (that supports equality testing) identifying the current version of the abstract base class cache for virtual subclasses. The token changes with every call to :meth:`ABCMeta.register` on any ABC." +#: ../../library/abc.rst:332 +msgid "" +"The token is an opaque object (that supports equality testing) identifying " +"the current version of the abstract base class cache for virtual subclasses. " +"The token changes with every call to :meth:`ABCMeta.register` on any ABC." msgstr "" -msgid "A function to recalculate an abstract class's abstraction status. This function should be called if a class's abstract methods have been implemented or changed after it was created. Usually, this function should be called from within a class decorator." +#: ../../library/abc.rst:340 +msgid "" +"A function to recalculate an abstract class's abstraction status. This " +"function should be called if a class's abstract methods have been " +"implemented or changed after it was created. Usually, this function should " +"be called from within a class decorator." msgstr "" +#: ../../library/abc.rst:345 msgid "Returns *cls*, to allow usage as a class decorator." msgstr "" +#: ../../library/abc.rst:347 msgid "If *cls* is not an instance of :class:`ABCMeta`, does nothing." msgstr "" -msgid "This function assumes that *cls*'s superclasses are already updated. It does not update any subclasses." +#: ../../library/abc.rst:351 +msgid "" +"This function assumes that *cls*'s superclasses are already updated. It does " +"not update any subclasses." msgstr "" +#: ../../library/abc.rst:357 msgid "Footnotes" msgstr "" -msgid "C++ programmers should note that Python's virtual base class concept is not the same as C++'s." +#: ../../library/abc.rst:358 +msgid "" +"C++ programmers should note that Python's virtual base class concept is not " +"the same as C++'s." msgstr "" diff --git a/library/aifc.po b/library/aifc.po index f4fda8721..e29e30a14 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/aifc.rst:2 msgid ":mod:`!aifc` --- Read and write AIFF and AIFC files" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.13 ` after being deprecated in Python 3.11. The removal was decided in :pep:`594`." +#: ../../library/aifc.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.13 ` after being " +"deprecated in Python 3.11. The removal was decided in :pep:`594`." msgstr "" -msgid "The last version of Python that provided the :mod:`!aifc` module was `Python 3.12 `_." +#: ../../library/aifc.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!aifc` module was `Python " +"3.12 `_." msgstr "" diff --git a/library/allos.po b/library/allos.po index 32188ada4..9b023e18b 100644 --- a/library/allos.po +++ b/library/allos.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,8 +21,15 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/allos.rst:5 msgid "Generic Operating System Services" msgstr "" -msgid "The modules described in this chapter provide interfaces to operating system features that are available on (almost) all operating systems, such as files and a clock. The interfaces are generally modeled after the Unix or C interfaces, but they are available on most other systems as well. Here's an overview:" +#: ../../library/allos.rst:7 +msgid "" +"The modules described in this chapter provide interfaces to operating system " +"features that are available on (almost) all operating systems, such as files " +"and a clock. The interfaces are generally modeled after the Unix or C " +"interfaces, but they are available on most other systems as well. Here's an " +"overview:" msgstr "" diff --git a/library/annotationlib.po b/library/annotationlib.po index 4199c1d9e..57c6d6ea5 100644 --- a/library/annotationlib.po +++ b/library/annotationlib.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,66 +19,136 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../library/annotationlib.rst:2 msgid ":mod:`!annotationlib` --- Functionality for introspecting annotations" msgstr "" +#: ../../library/annotationlib.rst:9 msgid "**Source code:** :source:`Lib/annotationlib.py`" msgstr "" -msgid "The :mod:`!annotationlib` module provides tools for introspecting :term:`annotations ` on modules, classes, and functions." +#: ../../library/annotationlib.rst:18 +msgid "" +"The :mod:`!annotationlib` module provides tools for " +"introspecting :term:`annotations ` on modules, classes, and " +"functions." msgstr "" -msgid "Annotations are :ref:`lazily evaluated ` and often contain forward references to objects that are not yet defined when the annotation is created. This module provides a set of low-level tools that can be used to retrieve annotations in a reliable way, even in the presence of forward references and other edge cases." +#: ../../library/annotationlib.rst:21 +msgid "" +"Annotations are :ref:`lazily evaluated ` and often contain " +"forward references to objects that are not yet defined when the annotation " +"is created. This module provides a set of low-level tools that can be used " +"to retrieve annotations in a reliable way, even in the presence of forward " +"references and other edge cases." msgstr "" -msgid "This module supports retrieving annotations in three main formats (see :class:`Format`), each of which works best for different use cases:" +#: ../../library/annotationlib.rst:26 +msgid "" +"This module supports retrieving annotations in three main formats " +"(see :class:`Format`), each of which works best for different use cases:" msgstr "" -msgid ":attr:`~Format.VALUE` evaluates the annotations and returns their value. This is most straightforward to work with, but it may raise errors, for example if the annotations contain references to undefined names." +#: ../../library/annotationlib.rst:29 +msgid "" +":attr:`~Format.VALUE` evaluates the annotations and returns their value. " +"This is most straightforward to work with, but it may raise errors, for " +"example if the annotations contain references to undefined names." msgstr "" -msgid ":attr:`~Format.FORWARDREF` returns :class:`ForwardRef` objects for annotations that cannot be resolved, allowing you to inspect the annotations without evaluating them. This is useful when you need to work with annotations that may contain unresolved forward references." +#: ../../library/annotationlib.rst:32 +msgid "" +":attr:`~Format.FORWARDREF` returns :class:`ForwardRef` objects for " +"annotations that cannot be resolved, allowing you to inspect the annotations " +"without evaluating them. This is useful when you need to work with " +"annotations that may contain unresolved forward references." msgstr "" -msgid ":attr:`~Format.STRING` returns the annotations as a string, similar to how it would appear in the source file. This is useful for documentation generators that want to display annotations in a readable way." +#: ../../library/annotationlib.rst:36 +msgid "" +":attr:`~Format.STRING` returns the annotations as a string, similar to how " +"it would appear in the source file. This is useful for documentation " +"generators that want to display annotations in a readable way." msgstr "" -msgid "The :func:`get_annotations` function is the main entry point for retrieving annotations. Given a function, class, or module, it returns an annotations dictionary in the requested format. This module also provides functionality for working directly with the :term:`annotate function` that is used to evaluate annotations, such as :func:`get_annotate_from_class_namespace` and :func:`call_annotate_function`, as well as the :func:`call_evaluate_function` function for working with :term:`evaluate functions `." +#: ../../library/annotationlib.rst:40 +msgid "" +"The :func:`get_annotations` function is the main entry point for retrieving " +"annotations. Given a function, class, or module, it returns an annotations " +"dictionary in the requested format. This module also provides functionality " +"for working directly with the :term:`annotate function` that is used to " +"evaluate annotations, such as :func:`get_annotate_from_class_namespace` " +"and :func:`call_annotate_function`, as well as " +"the :func:`call_evaluate_function` function for working with :term:`evaluate " +"functions `." msgstr "" -msgid "Most functionality in this module can execute arbitrary code; see :ref:`the security section ` for more information." +#: ../../library/annotationlib.rst:51 +msgid "" +"Most functionality in this module can execute arbitrary code; see :ref:`the " +"security section ` for more information." msgstr "" -msgid ":pep:`649` proposed the current model for how annotations work in Python." +#: ../../library/annotationlib.rst:56 +msgid "" +":pep:`649` proposed the current model for how annotations work in Python." msgstr "" -msgid ":pep:`749` expanded on various aspects of :pep:`649` and introduced the :mod:`!annotationlib` module." +#: ../../library/annotationlib.rst:58 +msgid "" +":pep:`749` expanded on various aspects of :pep:`649` and introduced " +"the :mod:`!annotationlib` module." msgstr "" -msgid ":ref:`annotations-howto` provides best practices for working with annotations." +#: ../../library/annotationlib.rst:61 +msgid "" +":ref:`annotations-howto` provides best practices for working with " +"annotations." msgstr "" -msgid ":pypi:`typing-extensions` provides a backport of :func:`get_annotations` that works on earlier versions of Python." +#: ../../library/annotationlib.rst:64 +msgid "" +":pypi:`typing-extensions` provides a backport of :func:`get_annotations` " +"that works on earlier versions of Python." msgstr "" +#: ../../library/annotationlib.rst:68 msgid "Annotation semantics" msgstr "" -msgid "The way annotations are evaluated has changed over the history of Python 3, and currently still depends on a :ref:`future import `. There have been execution models for annotations:" +#: ../../library/annotationlib.rst:70 +msgid "" +"The way annotations are evaluated has changed over the history of Python 3, " +"and currently still depends on a :ref:`future import `. There have " +"been execution models for annotations:" msgstr "" -msgid "*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` and :pep:`526`): Annotations are evaluated eagerly, as they are encountered in the source code." +#: ../../library/annotationlib.rst:74 +msgid "" +"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` " +"and :pep:`526`): Annotations are evaluated eagerly, as they are encountered " +"in the source code." msgstr "" -msgid "*Stringified annotations* (used with ``from __future__ import annotations`` in Python 3.7 and newer; see :pep:`563`): Annotations are stored as strings only." +#: ../../library/annotationlib.rst:77 +msgid "" +"*Stringified annotations* (used with ``from __future__ import annotations`` " +"in Python 3.7 and newer; see :pep:`563`): Annotations are stored as strings " +"only." msgstr "" -msgid "*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` and :pep:`749`): Annotations are evaluated lazily, only when they are accessed." +#: ../../library/annotationlib.rst:80 +msgid "" +"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` " +"and :pep:`749`): Annotations are evaluated lazily, only when they are " +"accessed." msgstr "" +#: ../../library/annotationlib.rst:83 msgid "As an example, consider the following program::" msgstr "" +#: ../../library/annotationlib.rst:85 msgid "" "def func(a: Cls) -> None:\n" " print(a)\n" @@ -88,78 +158,195 @@ msgid "" "print(func.__annotations__)" msgstr "" +#: ../../library/annotationlib.rst:92 msgid "This will behave as follows:" msgstr "" -msgid "Under stock semantics (Python 3.13 and earlier), it will throw a :exc:`NameError` at the line where ``func`` is defined, because ``Cls`` is an undefined name at that point." -msgstr "" - -msgid "Under stringified annotations (if ``from __future__ import annotations`` is used), it will print ``{'a': 'Cls', 'return': 'None'}``." +#: ../../library/annotationlib.rst:94 +msgid "" +"Under stock semantics (Python 3.13 and earlier), it will throw " +"a :exc:`NameError` at the line where ``func`` is defined, because ``Cls`` is " +"an undefined name at that point." msgstr "" -msgid "Under deferred evaluation (Python 3.14 and later), it will print ``{'a': , 'return': None}``." +#: ../../library/annotationlib.rst:97 +msgid "" +"Under stringified annotations (if ``from __future__ import annotations`` is " +"used), it will print ``{'a': 'Cls', 'return': 'None'}``." msgstr "" -msgid "Stock semantics were used when function annotations were first introduced in Python 3.0 (by :pep:`3107`) because this was the simplest, most obvious way to implement annotations. The same execution model was used when variable annotations were introduced in Python 3.6 (by :pep:`526`). However, stock semantics caused problems when using annotations as type hints, such as a need to refer to names that are not yet defined when the annotation is encountered. In addition, there were performance problems with executing annotations at module import time. Therefore, in Python 3.7, :pep:`563` introduced the ability to store annotations as strings using the ``from __future__ import annotations`` syntax. The plan at the time was to eventually make this behavior the default, but a problem appeared: stringified annotations are more difficult to process for those who introspect annotations at runtime. An alternative proposal, :pep:`649`, introduced the third execution model, deferred evaluation, and was implemented in Python 3.14. Stringified annotations are still used if ``from __future__ import annotations`` is present, but this behavior will eventually be removed." +#: ../../library/annotationlib.rst:99 +msgid "" +"Under deferred evaluation (Python 3.14 and later), it will print ``{'a': " +", 'return': None}``." msgstr "" +#: ../../library/annotationlib.rst:102 +msgid "" +"Stock semantics were used when function annotations were first introduced in " +"Python 3.0 (by :pep:`3107`) because this was the simplest, most obvious way " +"to implement annotations. The same execution model was used when variable " +"annotations were introduced in Python 3.6 (by :pep:`526`). However, stock " +"semantics caused problems when using annotations as type hints, such as a " +"need to refer to names that are not yet defined when the annotation is " +"encountered. In addition, there were performance problems with executing " +"annotations at module import time. Therefore, in Python 3.7, :pep:`563` " +"introduced the ability to store annotations as strings using the ``from " +"__future__ import annotations`` syntax. The plan at the time was to " +"eventually make this behavior the default, but a problem appeared: " +"stringified annotations are more difficult to process for those who " +"introspect annotations at runtime. An alternative proposal, :pep:`649`, " +"introduced the third execution model, deferred evaluation, and was " +"implemented in Python 3.14. Stringified annotations are still used if ``from " +"__future__ import annotations`` is present, but this behavior will " +"eventually be removed." +msgstr "" + +#: ../../library/annotationlib.rst:121 msgid "Classes" msgstr "" -msgid "An :class:`~enum.IntEnum` describing the formats in which annotations can be returned. Members of the enum, or their equivalent integer values, can be passed to :func:`get_annotations` and other functions in this module, as well as to :attr:`~object.__annotate__` functions." +#: ../../library/annotationlib.rst:125 +msgid "" +"An :class:`~enum.IntEnum` describing the formats in which annotations can be " +"returned. Members of the enum, or their equivalent integer values, can be " +"passed to :func:`get_annotations` and other functions in this module, as " +"well as to :attr:`~object.__annotate__` functions." msgstr "" +#: ../../library/annotationlib.rst:133 msgid "Values are the result of evaluating the annotation expressions." msgstr "" -msgid "Special value used to signal that an annotate function is being evaluated in a special environment with fake globals. When passed this value, annotate functions should either return the same value as for the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError` to signal that they do not support execution in this environment. This format is only used internally and should not be passed to the functions in this module." +#: ../../library/annotationlib.rst:138 +msgid "" +"Special value used to signal that an annotate function is being evaluated in " +"a special environment with fake globals. When passed this value, annotate " +"functions should either return the same value as for " +"the :attr:`Format.VALUE` format, or raise :exc:`NotImplementedError` to " +"signal that they do not support execution in this environment. This format " +"is only used internally and should not be passed to the functions in this " +"module." msgstr "" -msgid "Values are real annotation values (as per :attr:`Format.VALUE` format) for defined values, and :class:`ForwardRef` proxies for undefined values. Real objects may contain references to :class:`ForwardRef` proxy objects." +#: ../../library/annotationlib.rst:149 +msgid "" +"Values are real annotation values (as per :attr:`Format.VALUE` format) for " +"defined values, and :class:`ForwardRef` proxies for undefined values. Real " +"objects may contain references to :class:`ForwardRef` proxy objects." msgstr "" -msgid "Values are the text string of the annotation as it appears in the source code, up to modifications including, but not restricted to, whitespace normalizations and constant values optimizations." +#: ../../library/annotationlib.rst:157 +msgid "" +"Values are the text string of the annotation as it appears in the source " +"code, up to modifications including, but not restricted to, whitespace " +"normalizations and constant values optimizations." msgstr "" -msgid "The exact values of these strings may change in future versions of Python." +#: ../../library/annotationlib.rst:161 +msgid "" +"The exact values of these strings may change in future versions of Python." msgstr "" +#: ../../library/annotationlib.rst:167 msgid "A proxy object for forward references in annotations." msgstr "" -msgid "Instances of this class are returned when the :attr:`~Format.FORWARDREF` format is used and annotations contain a name that cannot be resolved. This can happen when a forward reference is used in an annotation, such as when a class is referenced before it is defined." +#: ../../library/annotationlib.rst:169 +msgid "" +"Instances of this class are returned when the :attr:`~Format.FORWARDREF` " +"format is used and annotations contain a name that cannot be resolved. This " +"can happen when a forward reference is used in an annotation, such as when a " +"class is referenced before it is defined." msgstr "" -msgid "A string containing the code that was evaluated to produce the :class:`~ForwardRef`. The string may not be exactly equivalent to the original source." +#: ../../library/annotationlib.rst:176 +msgid "" +"A string containing the code that was evaluated to produce " +"the :class:`~ForwardRef`. The string may not be exactly equivalent to the " +"original source." msgstr "" +#: ../../library/annotationlib.rst:182 msgid "Evaluate the forward reference, returning its value." msgstr "" -msgid "If the *format* argument is :attr:`~Format.VALUE` (the default), this method may throw an exception, such as :exc:`NameError`, if the forward reference refers to a name that cannot be resolved. The arguments to this method can be used to provide bindings for names that would otherwise be undefined. If the *format* argument is :attr:`~Format.FORWARDREF`, the method will never throw an exception, but may return a :class:`~ForwardRef` instance. For example, if the forward reference object contains the code ``list[undefined]``, where ``undefined`` is a name that is not defined, evaluating it with the :attr:`~Format.FORWARDREF` format will return ``list[ForwardRef('undefined')]``. If the *format* argument is :attr:`~Format.STRING`, the method will return :attr:`~ForwardRef.__forward_arg__`." -msgstr "" - -msgid "The *owner* parameter provides the preferred mechanism for passing scope information to this method. The owner of a :class:`~ForwardRef` is the object that contains the annotation from which the :class:`~ForwardRef` derives, such as a module object, type object, or function object." -msgstr "" - -msgid "The *globals*, *locals*, and *type_params* parameters provide a more precise mechanism for influencing the names that are available when the :class:`~ForwardRef` is evaluated. *globals* and *locals* are passed to :func:`eval`, representing the global and local namespaces in which the name is evaluated. The *type_params* parameter is relevant for objects created using the native syntax for :ref:`generic classes ` and :ref:`functions `. It is a tuple of :ref:`type parameters ` that are in scope while the forward reference is being evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved from an annotation found in the class namespace of a generic class ``C``, *type_params* should be set to ``C.__type_params__``." +#: ../../library/annotationlib.rst:184 +msgid "" +"If the *format* argument is :attr:`~Format.VALUE` (the default), this method " +"may throw an exception, such as :exc:`NameError`, if the forward reference " +"refers to a name that cannot be resolved. The arguments to this method can " +"be used to provide bindings for names that would otherwise be undefined. If " +"the *format* argument is :attr:`~Format.FORWARDREF`, the method will never " +"throw an exception, but may return a :class:`~ForwardRef` instance. For " +"example, if the forward reference object contains the code " +"``list[undefined]``, where ``undefined`` is a name that is not defined, " +"evaluating it with the :attr:`~Format.FORWARDREF` format will return " +"``list[ForwardRef('undefined')]``. If the *format* argument " +"is :attr:`~Format.STRING`, the method will " +"return :attr:`~ForwardRef.__forward_arg__`." +msgstr "" + +#: ../../library/annotationlib.rst:196 +msgid "" +"The *owner* parameter provides the preferred mechanism for passing scope " +"information to this method. The owner of a :class:`~ForwardRef` is the " +"object that contains the annotation from which the :class:`~ForwardRef` " +"derives, such as a module object, type object, or function object." msgstr "" -msgid ":class:`~ForwardRef` instances returned by :func:`get_annotations` retain references to information about the scope they originated from, so calling this method with no further arguments may be sufficient to evaluate such objects. :class:`~ForwardRef` instances created by other means may not have any information about their scope, so passing arguments to this method may be necessary to evaluate them successfully." +#: ../../library/annotationlib.rst:201 +msgid "" +"The *globals*, *locals*, and *type_params* parameters provide a more precise " +"mechanism for influencing the names that are available when " +"the :class:`~ForwardRef` is evaluated. *globals* and *locals* are passed " +"to :func:`eval`, representing the global and local namespaces in which the " +"name is evaluated. The *type_params* parameter is relevant for objects " +"created using the native syntax for :ref:`generic classes ` " +"and :ref:`functions `. It is a tuple of :ref:`type " +"parameters ` that are in scope while the forward reference is " +"being evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved " +"from an annotation found in the class namespace of a generic class ``C``, " +"*type_params* should be set to ``C.__type_params__``." +msgstr "" + +#: ../../library/annotationlib.rst:212 +msgid "" +":class:`~ForwardRef` instances returned by :func:`get_annotations` retain " +"references to information about the scope they originated from, so calling " +"this method with no further arguments may be sufficient to evaluate such " +"objects. :class:`~ForwardRef` instances created by other means may not have " +"any information about their scope, so passing arguments to this method may " +"be necessary to evaluate them successfully." msgstr "" -msgid "If no *owner*, *globals*, *locals*, or *type_params* are provided and the :class:`~ForwardRef` does not contain information about its origin, empty globals and locals dictionaries are used." +#: ../../library/annotationlib.rst:219 +msgid "" +"If no *owner*, *globals*, *locals*, or *type_params* are provided and " +"the :class:`~ForwardRef` does not contain information about its origin, " +"empty globals and locals dictionaries are used." msgstr "" +#: ../../library/annotationlib.rst:227 msgid "Functions" msgstr "" -msgid "Convert an annotations dict containing runtime values to a dict containing only strings. If the values are not already strings, they are converted using :func:`type_repr`. This is meant as a helper for user-provided annotate functions that support the :attr:`~Format.STRING` format but do not have access to the code creating the annotations." +#: ../../library/annotationlib.rst:231 +msgid "" +"Convert an annotations dict containing runtime values to a dict containing " +"only strings. If the values are not already strings, they are converted " +"using :func:`type_repr`. This is meant as a helper for user-provided " +"annotate functions that support the :attr:`~Format.STRING` format but do not " +"have access to the code creating the annotations." msgstr "" -msgid "For example, this is used to implement the :attr:`~Format.STRING` for :class:`typing.TypedDict` classes created through the functional syntax:" +#: ../../library/annotationlib.rst:238 +msgid "" +"For example, this is used to implement the :attr:`~Format.STRING` " +"for :class:`typing.TypedDict` classes created through the functional syntax:" msgstr "" +#: ../../library/annotationlib.rst:241 msgid "" ">>> from typing import TypedDict\n" ">>> Movie = TypedDict(\"movie\", {\"name\": str, \"year\": int})\n" @@ -167,48 +354,96 @@ msgid "" "{'name': 'str', 'year': 'int'}" msgstr "" -msgid "Call the :term:`annotate function` *annotate* with the given *format*, a member of the :class:`Format` enum, and return the annotations dictionary produced by the function." +#: ../../library/annotationlib.rst:252 +msgid "" +"Call the :term:`annotate function` *annotate* with the given *format*, a " +"member of the :class:`Format` enum, and return the annotations dictionary " +"produced by the function." msgstr "" -msgid "This helper function is required because annotate functions generated by the compiler for functions, classes, and modules only support the :attr:`~Format.VALUE` format when called directly. To support other formats, this function calls the annotate function in a special environment that allows it to produce annotations in the other formats. This is a useful building block when implementing functionality that needs to partially evaluate annotations while a class is being constructed." +#: ../../library/annotationlib.rst:256 +msgid "" +"This helper function is required because annotate functions generated by the " +"compiler for functions, classes, and modules only support " +"the :attr:`~Format.VALUE` format when called directly. To support other " +"formats, this function calls the annotate function in a special environment " +"that allows it to produce annotations in the other formats. This is a useful " +"building block when implementing functionality that needs to partially " +"evaluate annotations while a class is being constructed." msgstr "" -msgid "*owner* is the object that owns the annotation function, usually a function, class, or module. If provided, it is used in the :attr:`~Format.FORWARDREF` format to produce a :class:`ForwardRef` object that carries more information." +#: ../../library/annotationlib.rst:265 +msgid "" +"*owner* is the object that owns the annotation function, usually a function, " +"class, or module. If provided, it is used in the :attr:`~Format.FORWARDREF` " +"format to produce a :class:`ForwardRef` object that carries more information." msgstr "" -msgid ":PEP:`PEP 649 <649#the-stringizer-and-the-fake-globals-environment>` contains an explanation of the implementation technique used by this function." +#: ../../library/annotationlib.rst:272 +msgid "" +":PEP:`PEP 649 <649#the-stringizer-and-the-fake-globals-environment>` " +"contains an explanation of the implementation technique used by this " +"function." msgstr "" -msgid "Call the :term:`evaluate function` *evaluate* with the given *format*, a member of the :class:`Format` enum, and return the value produced by the function. This is similar to :func:`call_annotate_function`, but the latter always returns a dictionary mapping strings to annotations, while this function returns a single value." +#: ../../library/annotationlib.rst:280 +msgid "" +"Call the :term:`evaluate function` *evaluate* with the given *format*, a " +"member of the :class:`Format` enum, and return the value produced by the " +"function. This is similar to :func:`call_annotate_function`, but the latter " +"always returns a dictionary mapping strings to annotations, while this " +"function returns a single value." msgstr "" -msgid "This is intended for use with the evaluate functions generated for lazily evaluated elements related to type aliases and type parameters:" +#: ../../library/annotationlib.rst:286 +msgid "" +"This is intended for use with the evaluate functions generated for lazily " +"evaluated elements related to type aliases and type parameters:" msgstr "" +#: ../../library/annotationlib.rst:289 msgid ":meth:`typing.TypeAliasType.evaluate_value`, the value of type aliases" msgstr "" +#: ../../library/annotationlib.rst:290 msgid ":meth:`typing.TypeVar.evaluate_bound`, the bound of type variables" msgstr "" -msgid ":meth:`typing.TypeVar.evaluate_constraints`, the constraints of type variables" +#: ../../library/annotationlib.rst:291 +msgid "" +":meth:`typing.TypeVar.evaluate_constraints`, the constraints of type " +"variables" msgstr "" -msgid ":meth:`typing.TypeVar.evaluate_default`, the default value of type variables" +#: ../../library/annotationlib.rst:293 +msgid "" +":meth:`typing.TypeVar.evaluate_default`, the default value of type variables" msgstr "" -msgid ":meth:`typing.ParamSpec.evaluate_default`, the default value of parameter specifications" +#: ../../library/annotationlib.rst:295 +msgid "" +":meth:`typing.ParamSpec.evaluate_default`, the default value of parameter " +"specifications" msgstr "" -msgid ":meth:`typing.TypeVarTuple.evaluate_default`, the default value of type variable tuples" +#: ../../library/annotationlib.rst:297 +msgid "" +":meth:`typing.TypeVarTuple.evaluate_default`, the default value of type " +"variable tuples" msgstr "" -msgid "*owner* is the object that owns the evaluate function, such as the type alias or type variable object." +#: ../../library/annotationlib.rst:300 +msgid "" +"*owner* is the object that owns the evaluate function, such as the type " +"alias or type variable object." msgstr "" -msgid "*format* can be used to control the format in which the value is returned:" +#: ../../library/annotationlib.rst:303 +msgid "" +"*format* can be used to control the format in which the value is returned:" msgstr "" +#: ../../library/annotationlib.rst:305 msgid "" ">>> type Alias = undefined\n" ">>> call_evaluate_function(Alias.evaluate_value, Format.VALUE)\n" @@ -221,75 +456,171 @@ msgid "" "'undefined'" msgstr "" -msgid "Retrieve the :term:`annotate function` from a class namespace dictionary *namespace*. Return :const:`!None` if the namespace does not contain an annotate function. This is primarily useful before the class has been fully created (e.g., in a metaclass); after the class exists, the annotate function can be retrieved with ``cls.__annotate__``. See :ref:`below ` for an example using this function in a metaclass." +#: ../../library/annotationlib.rst:321 +msgid "" +"Retrieve the :term:`annotate function` from a class namespace dictionary " +"*namespace*. Return :const:`!None` if the namespace does not contain an " +"annotate function. This is primarily useful before the class has been fully " +"created (e.g., in a metaclass); after the class exists, the annotate " +"function can be retrieved with ``cls.__annotate__``. See :ref:`below " +"` for an example using this function in a metaclass." msgstr "" +#: ../../library/annotationlib.rst:331 msgid "Compute the annotations dict for an object." msgstr "" -msgid "*obj* may be a callable, class, module, or other object with :attr:`~object.__annotate__` or :attr:`~object.__annotations__` attributes. Passing any other object raises :exc:`TypeError`." +#: ../../library/annotationlib.rst:333 +msgid "" +"*obj* may be a callable, class, module, or other object " +"with :attr:`~object.__annotate__` or :attr:`~object.__annotations__` " +"attributes. Passing any other object raises :exc:`TypeError`." msgstr "" -msgid "The *format* parameter controls the format in which annotations are returned, and must be a member of the :class:`Format` enum or its integer equivalent. The different formats work as follows:" +#: ../../library/annotationlib.rst:337 +msgid "" +"The *format* parameter controls the format in which annotations are " +"returned, and must be a member of the :class:`Format` enum or its integer " +"equivalent. The different formats work as follows:" msgstr "" -msgid "VALUE: :attr:`!object.__annotations__` is tried first; if that does not exist, the :attr:`!object.__annotate__` function is called if it exists." +#: ../../library/annotationlib.rst:341 +msgid "" +"VALUE: :attr:`!object.__annotations__` is tried first; if that does not " +"exist, the :attr:`!object.__annotate__` function is called if it exists." msgstr "" -msgid "FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated successfully, it is used; otherwise, the :attr:`!object.__annotate__` function is called. If it does not exist either, :attr:`!object.__annotations__` is tried again and any error from accessing it is re-raised." +#: ../../library/annotationlib.rst:344 +msgid "" +"FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated " +"successfully, it is used; otherwise, the :attr:`!object.__annotate__` " +"function is called. If it does not exist either, :attr:`!" +"object.__annotations__` is tried again and any error from accessing it is re-" +"raised." msgstr "" -msgid "When calling :attr:`!object.__annotate__` it is first called with :attr:`~Format.FORWARDREF`. If this is not implemented, it will then check if :attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake globals environment. If neither of these formats are supported, it will fall back to using :attr:`~Format.VALUE`. If :attr:`~Format.VALUE` fails, the error from this call will be raised." +#: ../../library/annotationlib.rst:349 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called " +"with :attr:`~Format.FORWARDREF`. If this is not implemented, it will then " +"check if :attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that " +"in the fake globals environment. If neither of these formats are supported, " +"it will fall back to using :attr:`~Format.VALUE`. If :attr:`~Format.VALUE` " +"fails, the error from this call will be raised." msgstr "" -msgid "STRING: If :attr:`!object.__annotate__` exists, it is called first; otherwise, :attr:`!object.__annotations__` is used and stringified using :func:`annotations_to_string`." +#: ../../library/annotationlib.rst:355 +msgid "" +"STRING: If :attr:`!object.__annotate__` exists, it is called first; " +"otherwise, :attr:`!object.__annotations__` is used and stringified " +"using :func:`annotations_to_string`." msgstr "" -msgid "When calling :attr:`!object.__annotate__` it is first called with :attr:`~Format.STRING`. If this is not implemented, it will then check if :attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake globals environment. If neither of these formats are supported, it will fall back to using :attr:`~Format.VALUE` with the result converted using :func:`annotations_to_string`. If :attr:`~Format.VALUE` fails, the error from this call will be raised." +#: ../../library/annotationlib.rst:359 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called " +"with :attr:`~Format.STRING`. If this is not implemented, it will then check " +"if :attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the " +"fake globals environment. If neither of these formats are supported, it will " +"fall back to using :attr:`~Format.VALUE` with the result converted " +"using :func:`annotations_to_string`. If :attr:`~Format.VALUE` fails, the " +"error from this call will be raised." msgstr "" -msgid "Returns a dict. :func:`!get_annotations` returns a new dict every time it's called; calling it twice on the same object will return two different but equivalent dicts." +#: ../../library/annotationlib.rst:366 +msgid "" +"Returns a dict. :func:`!get_annotations` returns a new dict every time it's " +"called; calling it twice on the same object will return two different but " +"equivalent dicts." msgstr "" +#: ../../library/annotationlib.rst:370 msgid "This function handles several details for you:" msgstr "" -msgid "If *eval_str* is true, values of type :class:`!str` will be un-stringized using :func:`eval`. This is intended for use with stringized annotations (``from __future__ import annotations``). It is an error to set *eval_str* to true with formats other than :attr:`Format.VALUE`." +#: ../../library/annotationlib.rst:372 +msgid "" +"If *eval_str* is true, values of type :class:`!str` will be un-stringized " +"using :func:`eval`. This is intended for use with stringized annotations " +"(``from __future__ import annotations``). It is an error to set *eval_str* " +"to true with formats other than :attr:`Format.VALUE`." msgstr "" -msgid "If *obj* doesn't have an annotations dict, returns an empty dict. (Functions and methods always have an annotations dict; classes, modules, and other types of callables may not.)" +#: ../../library/annotationlib.rst:377 +msgid "" +"If *obj* doesn't have an annotations dict, returns an empty dict. (Functions " +"and methods always have an annotations dict; classes, modules, and other " +"types of callables may not.)" msgstr "" -msgid "Ignores inherited annotations on classes, as well as annotations on metaclasses. If a class doesn't have its own annotations dict, returns an empty dict." +#: ../../library/annotationlib.rst:381 +msgid "" +"Ignores inherited annotations on classes, as well as annotations on " +"metaclasses. If a class doesn't have its own annotations dict, returns an " +"empty dict." msgstr "" -msgid "All accesses to object members and dict values are done using ``getattr()`` and ``dict.get()`` for safety." +#: ../../library/annotationlib.rst:384 +msgid "" +"All accesses to object members and dict values are done using ``getattr()`` " +"and ``dict.get()`` for safety." msgstr "" -msgid "*eval_str* controls whether or not values of type :class:`!str` are replaced with the result of calling :func:`eval` on those values:" +#: ../../library/annotationlib.rst:387 +msgid "" +"*eval_str* controls whether or not values of type :class:`!str` are replaced " +"with the result of calling :func:`eval` on those values:" msgstr "" -msgid "If eval_str is true, :func:`eval` is called on values of type :class:`!str`. (Note that :func:`!get_annotations` doesn't catch exceptions; if :func:`eval` raises an exception, it will unwind the stack past the :func:`!get_annotations` call.)" +#: ../../library/annotationlib.rst:390 +msgid "" +"If eval_str is true, :func:`eval` is called on values of type :class:`!str`. " +"(Note that :func:`!get_annotations` doesn't catch exceptions; " +"if :func:`eval` raises an exception, it will unwind the stack past " +"the :func:`!get_annotations` call.)" msgstr "" -msgid "If *eval_str* is false (the default), values of type :class:`!str` are unchanged." +#: ../../library/annotationlib.rst:394 +msgid "" +"If *eval_str* is false (the default), values of type :class:`!str` are " +"unchanged." msgstr "" -msgid "*globals* and *locals* are passed in to :func:`eval`; see the documentation for :func:`eval` for more information. If *globals* or *locals* is :const:`!None`, this function may replace that value with a context-specific default, contingent on ``type(obj)``:" +#: ../../library/annotationlib.rst:397 +msgid "" +"*globals* and *locals* are passed in to :func:`eval`; see the documentation " +"for :func:`eval` for more information. If *globals* or *locals* is :const:`!" +"None`, this function may replace that value with a context-specific default, " +"contingent on ``type(obj)``:" msgstr "" +#: ../../library/annotationlib.rst:402 msgid "If *obj* is a module, *globals* defaults to ``obj.__dict__``." msgstr "" -msgid "If *obj* is a class, *globals* defaults to ``sys.modules[obj.__module__].__dict__`` and *locals* defaults to the *obj* class namespace." +#: ../../library/annotationlib.rst:403 +msgid "" +"If *obj* is a class, *globals* defaults to " +"``sys.modules[obj.__module__].__dict__`` and *locals* defaults to the *obj* " +"class namespace." msgstr "" -msgid "If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ `, although if *obj* is a wrapped function (using :func:`functools.update_wrapper`) or a :class:`functools.partial` object, it is unwrapped until a non-wrapped function is found." +#: ../../library/annotationlib.rst:406 +msgid "" +"If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ " +"`, although if *obj* is a wrapped function " +"(using :func:`functools.update_wrapper`) or a :class:`functools.partial` " +"object, it is unwrapped until a non-wrapped function is found." msgstr "" -msgid "Calling :func:`!get_annotations` is best practice for accessing the annotations dict of any object. See :ref:`annotations-howto` for more information on annotations best practices." +#: ../../library/annotationlib.rst:412 +msgid "" +"Calling :func:`!get_annotations` is best practice for accessing the " +"annotations dict of any object. See :ref:`annotations-howto` for more " +"information on annotations best practices." msgstr "" +#: ../../library/annotationlib.rst:416 msgid "" ">>> def f(a: int, b: str) -> float:\n" "... pass\n" @@ -297,27 +628,59 @@ msgid "" "{'a': , 'b': , 'return': }" msgstr "" -msgid "Convert an arbitrary Python value to a format suitable for use by the :attr:`~Format.STRING` format. This calls :func:`repr` for most objects, but has special handling for some objects, such as type objects." +#: ../../library/annotationlib.rst:427 +msgid "" +"Convert an arbitrary Python value to a format suitable for use by " +"the :attr:`~Format.STRING` format. This calls :func:`repr` for most objects, " +"but has special handling for some objects, such as type objects." msgstr "" -msgid "This is meant as a helper for user-provided annotate functions that support the :attr:`~Format.STRING` format but do not have access to the code creating the annotations. It can also be used to provide a user-friendly string representation for other objects that contain values that are commonly encountered in annotations." +#: ../../library/annotationlib.rst:431 +msgid "" +"This is meant as a helper for user-provided annotate functions that support " +"the :attr:`~Format.STRING` format but do not have access to the code " +"creating the annotations. It can also be used to provide a user-friendly " +"string representation for other objects that contain values that are " +"commonly encountered in annotations." msgstr "" +#: ../../library/annotationlib.rst:441 msgid "Recipes" msgstr "" +#: ../../library/annotationlib.rst:446 msgid "Using annotations in a metaclass" msgstr "" -msgid "A :ref:`metaclass ` may want to inspect or even modify the annotations in a class body during class creation. Doing so requires retrieving annotations from the class namespace dictionary. For classes created with ``from __future__ import annotations``, the annotations will be in the ``__annotations__`` key of the dictionary. For other classes with annotations, :func:`get_annotate_from_class_namespace` can be used to get the annotate function, and :func:`call_annotate_function` can be used to call it and retrieve the annotations. Using the :attr:`~Format.FORWARDREF` format will usually be best, because this allows the annotations to refer to names that cannot yet be resolved when the class is created." -msgstr "" - -msgid "To modify the annotations, it is best to create a wrapper annotate function that calls the original annotate function, makes any necessary adjustments, and returns the result." +#: ../../library/annotationlib.rst:448 +msgid "" +"A :ref:`metaclass ` may want to inspect or even modify the " +"annotations in a class body during class creation. Doing so requires " +"retrieving annotations from the class namespace dictionary. For classes " +"created with ``from __future__ import annotations``, the annotations will be " +"in the ``__annotations__`` key of the dictionary. For other classes with " +"annotations, :func:`get_annotate_from_class_namespace` can be used to get " +"the annotate function, and :func:`call_annotate_function` can be used to " +"call it and retrieve the annotations. Using the :attr:`~Format.FORWARDREF` " +"format will usually be best, because this allows the annotations to refer to " +"names that cannot yet be resolved when the class is created." +msgstr "" + +#: ../../library/annotationlib.rst:459 +msgid "" +"To modify the annotations, it is best to create a wrapper annotate function " +"that calls the original annotate function, makes any necessary adjustments, " +"and returns the result." msgstr "" -msgid "Below is an example of a metaclass that filters out all :class:`typing.ClassVar` annotations from the class and puts them in a separate attribute:" +#: ../../library/annotationlib.rst:463 +msgid "" +"Below is an example of a metaclass that filters out " +"all :class:`typing.ClassVar` annotations from the class and puts them in a " +"separate attribute:" msgstr "" +#: ../../library/annotationlib.rst:466 msgid "" "import annotationlib\n" "import typing\n" @@ -349,8 +712,10 @@ msgid "" " classvars = {key: annotations[key] for key in classvar_keys}\n" "\n" " def wrapped_annotate(format):\n" -" annos = annotationlib.call_annotate_function(annotate, format, owner=typ)\n" -" return {key: value for key, value in annos.items() if key not in classvar_keys}\n" +" annos = annotationlib.call_annotate_function(annotate, format, " +"owner=typ)\n" +" return {key: value for key, value in annos.items() if key not in " +"classvar_keys}\n" "\n" " else: # no annotations\n" " classvars = {}\n" @@ -358,42 +723,80 @@ msgid "" " typ = super().__new__(mcls, name, bases, ns)\n" "\n" " if wrapped_annotate is not None:\n" -" # Wrap the original __annotate__ with a wrapper that removes ClassVars\n" +" # Wrap the original __annotate__ with a wrapper that removes " +"ClassVars\n" " typ.__annotate__ = wrapped_annotate\n" -" typ.classvars = classvars # Store the ClassVars in a separate attribute\n" +" typ.classvars = classvars # Store the ClassVars in a separate " +"attribute\n" " return typ" msgstr "" +#: ../../library/annotationlib.rst:514 msgid "Creating a custom callable annotate function" msgstr "" -msgid "Custom :term:`annotate functions ` may be literal functions like those automatically generated for functions, classes, and modules. Or, they may wish to utilise the encapsulation provided by classes, in which case any :term:`callable` can be used as an :term:`annotate function`." +#: ../../library/annotationlib.rst:516 +msgid "" +"Custom :term:`annotate functions ` may be literal " +"functions like those automatically generated for functions, classes, and " +"modules. Or, they may wish to utilise the encapsulation provided by classes, " +"in which case any :term:`callable` can be used as an :term:`annotate " +"function`." msgstr "" -msgid "To provide the :attr:`~Format.VALUE`, :attr:`~Format.STRING`, or :attr:`~Format.FORWARDREF` formats directly, an :term:`annotate function` must provide the following attribute:" +#: ../../library/annotationlib.rst:521 +msgid "" +"To provide the :attr:`~Format.VALUE`, :attr:`~Format.STRING`, " +"or :attr:`~Format.FORWARDREF` formats directly, an :term:`annotate function` " +"must provide the following attribute:" msgstr "" -msgid "A callable ``__call__`` with signature ``__call__(format, /) -> dict``, that does not raise a :exc:`NotImplementedError` when called with a supported format." +#: ../../library/annotationlib.rst:525 +msgid "" +"A callable ``__call__`` with signature ``__call__(format, /) -> dict``, that " +"does not raise a :exc:`NotImplementedError` when called with a supported " +"format." msgstr "" -msgid "To provide the :attr:`~Format.VALUE_WITH_FAKE_GLOBALS` format, which is used to automatically generate :attr:`~Format.STRING` or :attr:`~Format.FORWARDREF` if they are not supported directly, :term:`annotate functions ` must provide the following attributes:" +#: ../../library/annotationlib.rst:528 +msgid "" +"To provide the :attr:`~Format.VALUE_WITH_FAKE_GLOBALS` format, which is used " +"to automatically generate :attr:`~Format.STRING` " +"or :attr:`~Format.FORWARDREF` if they are not supported " +"directly, :term:`annotate functions ` must provide the " +"following attributes:" msgstr "" -msgid "A callable ``__call__`` with signature ``__call__(format, /) -> dict``, that does not raise a :exc:`NotImplementedError` when called with :attr:`~Format.VALUE_WITH_FAKE_GLOBALS`." +#: ../../library/annotationlib.rst:533 +msgid "" +"A callable ``__call__`` with signature ``__call__(format, /) -> dict``, that " +"does not raise a :exc:`NotImplementedError` when called " +"with :attr:`~Format.VALUE_WITH_FAKE_GLOBALS`." msgstr "" -msgid "A :ref:`code object ` ``__code__`` containing the compiled code for the annotate function." +#: ../../library/annotationlib.rst:536 +msgid "" +"A :ref:`code object ` ``__code__`` containing the compiled " +"code for the annotate function." msgstr "" -msgid "Optional: A tuple of the function's positional defaults ``__kwdefaults__``, if the function represented by ``__code__`` uses any positional defaults." +#: ../../library/annotationlib.rst:538 +msgid "" +"Optional: A tuple of the function's positional defaults ``__kwdefaults__``, " +"if the function represented by ``__code__`` uses any positional defaults." msgstr "" -msgid "Optional: A dict of the function's keyword defaults ``__defaults__``, if the function represented by ``__code__`` uses any keyword defaults." +#: ../../library/annotationlib.rst:540 +msgid "" +"Optional: A dict of the function's keyword defaults ``__defaults__``, if the " +"function represented by ``__code__`` uses any keyword defaults." msgstr "" +#: ../../library/annotationlib.rst:542 msgid "Optional: All other :ref:`function attributes `." msgstr "" +#: ../../library/annotationlib.rst:544 msgid "" "class Annotate:\n" " called_formats = []\n" @@ -418,18 +821,22 @@ msgid "" " __closure__ = None" msgstr "" +#: ../../library/annotationlib.rst:568 msgid "This can then be called with:" msgstr "" +#: ../../library/annotationlib.rst:570 msgid "" ">>> from annotationlib import call_annotate_function, Format\n" ">>> call_annotate_function(Annotate(), format=Format.STRING)\n" "{'x': 'MyType'}" msgstr "" +#: ../../library/annotationlib.rst:576 msgid "Or used as the annotate function for an object:" msgstr "" +#: ../../library/annotationlib.rst:578 msgid "" ">>> from annotationlib import get_annotations, Format\n" ">>> class C:\n" @@ -439,149 +846,236 @@ msgid "" "{'x': 'MyType'}" msgstr "" +#: ../../library/annotationlib.rst:589 msgid "Limitations of the ``STRING`` format" msgstr "" -msgid "The :attr:`~Format.STRING` format is meant to approximate the source code of the annotation, but the implementation strategy used means that it is not always possible to recover the exact source code." +#: ../../library/annotationlib.rst:591 +msgid "" +"The :attr:`~Format.STRING` format is meant to approximate the source code of " +"the annotation, but the implementation strategy used means that it is not " +"always possible to recover the exact source code." msgstr "" -msgid "First, the stringifier of course cannot recover any information that is not present in the compiled code, including comments, whitespace, parenthesization, and operations that get simplified by the compiler." +#: ../../library/annotationlib.rst:595 +msgid "" +"First, the stringifier of course cannot recover any information that is not " +"present in the compiled code, including comments, whitespace, " +"parenthesization, and operations that get simplified by the compiler." msgstr "" -msgid "Second, the stringifier can intercept almost all operations that involve names looked up in some scope, but it cannot intercept operations that operate fully on constants. As a corollary, this also means it is not safe to request the ``STRING`` format on untrusted code: Python is powerful enough that it is possible to achieve arbitrary code execution even with no access to any globals or builtins. For example:" +#: ../../library/annotationlib.rst:599 +msgid "" +"Second, the stringifier can intercept almost all operations that involve " +"names looked up in some scope, but it cannot intercept operations that " +"operate fully on constants. As a corollary, this also means it is not safe " +"to request the ``STRING`` format on untrusted code: Python is powerful " +"enough that it is possible to achieve arbitrary code execution even with no " +"access to any globals or builtins. For example:" msgstr "" +#: ../../library/annotationlib.rst:605 msgid "" -">>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__.__builtins__[\"print\"](\"Hello world\")): pass\n" +">>> def f(x: (1).__class__.__base__.__subclasses__()" +"[-1].__init__.__builtins__[\"print\"](\"Hello world\")): pass\n" "...\n" ">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" "Hello world\n" "{'x': 'None'}" msgstr "" -msgid "This particular example works as of the time of writing, but it relies on implementation details and is not guaranteed to work in the future." +#: ../../library/annotationlib.rst:614 +msgid "" +"This particular example works as of the time of writing, but it relies on " +"implementation details and is not guaranteed to work in the future." msgstr "" -msgid "Among the different kinds of expressions that exist in Python, as represented by the :mod:`ast` module, some expressions are supported, meaning that the ``STRING`` format can generally recover the original source code; others are unsupported, meaning that they may result in incorrect output or an error." +#: ../../library/annotationlib.rst:617 +msgid "" +"Among the different kinds of expressions that exist in Python, as " +"represented by the :mod:`ast` module, some expressions are supported, " +"meaning that the ``STRING`` format can generally recover the original source " +"code; others are unsupported, meaning that they may result in incorrect " +"output or an error." msgstr "" +#: ../../library/annotationlib.rst:622 msgid "The following are supported (sometimes with caveats):" msgstr "" +#: ../../library/annotationlib.rst:624 msgid ":class:`ast.BinOp`" msgstr "" +#: ../../library/annotationlib.rst:625 msgid ":class:`ast.UnaryOp`" msgstr "" -msgid ":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), and :class:`ast.USub` (``-``) are supported" +#: ../../library/annotationlib.rst:627 +msgid "" +":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), " +"and :class:`ast.USub` (``-``) are supported" msgstr "" +#: ../../library/annotationlib.rst:628 msgid ":class:`ast.Not` (``not``) is not supported" msgstr "" +#: ../../library/annotationlib.rst:630 msgid ":class:`ast.Dict` (except when using ``**`` unpacking)" msgstr "" +#: ../../library/annotationlib.rst:631 msgid ":class:`ast.Set`" msgstr "" +#: ../../library/annotationlib.rst:632 msgid ":class:`ast.Compare`" msgstr "" +#: ../../library/annotationlib.rst:634 msgid ":class:`ast.Eq` and :class:`ast.NotEq` are supported" msgstr "" -msgid ":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are supported, but the operand may be flipped" +#: ../../library/annotationlib.rst:635 +msgid "" +":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are " +"supported, but the operand may be flipped" msgstr "" -msgid ":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` are not supported" +#: ../../library/annotationlib.rst:636 +msgid "" +":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` " +"are not supported" msgstr "" +#: ../../library/annotationlib.rst:638 msgid ":class:`ast.Call` (except when using ``**`` unpacking)" msgstr "" -msgid ":class:`ast.Constant` (though not the exact representation of the constant; for example, escape sequences in strings are lost; hexadecimal numbers are converted to decimal)" +#: ../../library/annotationlib.rst:639 +msgid "" +":class:`ast.Constant` (though not the exact representation of the constant; " +"for example, escape sequences in strings are lost; hexadecimal numbers are " +"converted to decimal)" msgstr "" +#: ../../library/annotationlib.rst:641 msgid ":class:`ast.Attribute` (assuming the value is not a constant)" msgstr "" +#: ../../library/annotationlib.rst:642 msgid ":class:`ast.Subscript` (assuming the value is not a constant)" msgstr "" +#: ../../library/annotationlib.rst:643 msgid ":class:`ast.Starred` (``*`` unpacking)" msgstr "" +#: ../../library/annotationlib.rst:644 msgid ":class:`ast.Name`" msgstr "" +#: ../../library/annotationlib.rst:645 msgid ":class:`ast.List`" msgstr "" +#: ../../library/annotationlib.rst:646 msgid ":class:`ast.Tuple`" msgstr "" +#: ../../library/annotationlib.rst:647 msgid ":class:`ast.Slice`" msgstr "" -msgid "The following are unsupported, but throw an informative error when encountered by the stringifier:" +#: ../../library/annotationlib.rst:649 +msgid "" +"The following are unsupported, but throw an informative error when " +"encountered by the stringifier:" msgstr "" -msgid ":class:`ast.FormattedValue` (f-strings; error is not detected if conversion specifiers like ``!r`` are used)" +#: ../../library/annotationlib.rst:652 +msgid "" +":class:`ast.FormattedValue` (f-strings; error is not detected if conversion " +"specifiers like ``!r`` are used)" msgstr "" +#: ../../library/annotationlib.rst:654 msgid ":class:`ast.JoinedStr` (f-strings)" msgstr "" +#: ../../library/annotationlib.rst:656 msgid "The following are unsupported and result in incorrect output:" msgstr "" +#: ../../library/annotationlib.rst:658 msgid ":class:`ast.BoolOp` (``and`` and ``or``)" msgstr "" +#: ../../library/annotationlib.rst:659 msgid ":class:`ast.IfExp`" msgstr "" +#: ../../library/annotationlib.rst:660 msgid ":class:`ast.Lambda`" msgstr "" +#: ../../library/annotationlib.rst:661 msgid ":class:`ast.ListComp`" msgstr "" +#: ../../library/annotationlib.rst:662 msgid ":class:`ast.SetComp`" msgstr "" +#: ../../library/annotationlib.rst:663 msgid ":class:`ast.DictComp`" msgstr "" +#: ../../library/annotationlib.rst:664 msgid ":class:`ast.GeneratorExp`" msgstr "" -msgid "The following are disallowed in annotation scopes and therefore not relevant:" +#: ../../library/annotationlib.rst:666 +msgid "" +"The following are disallowed in annotation scopes and therefore not relevant:" msgstr "" +#: ../../library/annotationlib.rst:668 msgid ":class:`ast.NamedExpr` (``:=``)" msgstr "" +#: ../../library/annotationlib.rst:669 msgid ":class:`ast.Await`" msgstr "" +#: ../../library/annotationlib.rst:670 msgid ":class:`ast.Yield`" msgstr "" +#: ../../library/annotationlib.rst:671 msgid ":class:`ast.YieldFrom`" msgstr "" +#: ../../library/annotationlib.rst:675 msgid "Limitations of the ``FORWARDREF`` format" msgstr "" -msgid "The :attr:`~Format.FORWARDREF` format aims to produce real values as much as possible, with anything that cannot be resolved replaced with :class:`ForwardRef` objects. It is affected by broadly the same Limitations as the :attr:`~Format.STRING` format: annotations that perform operations on literals or that use unsupported expression types may raise exceptions when evaluated using the :attr:`~Format.FORWARDREF` format." +#: ../../library/annotationlib.rst:677 +msgid "" +"The :attr:`~Format.FORWARDREF` format aims to produce real values as much as " +"possible, with anything that cannot be resolved replaced " +"with :class:`ForwardRef` objects. It is affected by broadly the same " +"Limitations as the :attr:`~Format.STRING` format: annotations that perform " +"operations on literals or that use unsupported expression types may raise " +"exceptions when evaluated using the :attr:`~Format.FORWARDREF` format." msgstr "" +#: ../../library/annotationlib.rst:684 msgid "Below are a few examples of the behavior with unsupported expressions:" msgstr "" +#: ../../library/annotationlib.rst:686 msgid "" ">>> from annotationlib import get_annotations, Format\n" ">>> def zerodiv(x: 1 / 0): ...\n" @@ -598,11 +1092,30 @@ msgid "" "{'x': '1'}" msgstr "" +#: ../../library/annotationlib.rst:705 msgid "Security implications of introspecting annotations" msgstr "" -msgid "Much of the functionality in this module involves executing code related to annotations, which can then do arbitrary things. For example, :func:`get_annotations` may call an arbitrary :term:`annotate function`, and :meth:`ForwardRef.evaluate` may call :func:`eval` on an arbitrary string. Code contained in an annotation might make arbitrary system calls, enter an infinite loop, or perform any other operation. This is also true for any access of the :attr:`~object.__annotations__` attribute, and for various functions in the :mod:`typing` module that work with annotations, such as :func:`typing.get_type_hints`." -msgstr "" - -msgid "Any security issue arising from this also applies immediately after importing code that may contain untrusted annotations: importing code can always cause arbitrary operations to be performed. However, it is unsafe to accept strings or other input from an untrusted source and pass them to any of the APIs for introspecting annotations, for example by editing an ``__annotations__`` dictionary or directly creating a :class:`ForwardRef` object." +#: ../../library/annotationlib.rst:707 +msgid "" +"Much of the functionality in this module involves executing code related to " +"annotations, which can then do arbitrary things. For " +"example, :func:`get_annotations` may call an arbitrary :term:`annotate " +"function`, and :meth:`ForwardRef.evaluate` may call :func:`eval` on an " +"arbitrary string. Code contained in an annotation might make arbitrary " +"system calls, enter an infinite loop, or perform any other operation. This " +"is also true for any access of the :attr:`~object.__annotations__` " +"attribute, and for various functions in the :mod:`typing` module that work " +"with annotations, such as :func:`typing.get_type_hints`." +msgstr "" + +#: ../../library/annotationlib.rst:716 +msgid "" +"Any security issue arising from this also applies immediately after " +"importing code that may contain untrusted annotations: importing code can " +"always cause arbitrary operations to be performed. However, it is unsafe to " +"accept strings or other input from an untrusted source and pass them to any " +"of the APIs for introspecting annotations, for example by editing an " +"``__annotations__`` dictionary or directly creating a :class:`ForwardRef` " +"object." msgstr "" diff --git a/library/archiving.po b/library/archiving.po index 99727efd9..6b5a2f765 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,8 +21,14 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/archiving.rst:5 msgid "Data Compression and Archiving" msgstr "" -msgid "The modules described in this chapter support data compression with the zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and tar-format archives. See also :ref:`archiving-operations` provided by the :mod:`shutil` module." +#: ../../library/archiving.rst:7 +msgid "" +"The modules described in this chapter support data compression with the " +"zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and " +"tar-format archives. See also :ref:`archiving-operations` provided by " +"the :mod:`shutil` module." msgstr "" diff --git a/library/argparse.po b/library/argparse.po index 1908bc24e..4a36a5ea8 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,27 +24,59 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid ":mod:`!argparse` --- Parser for command-line options, arguments and subcommands" +#: ../../library/argparse.rst:2 +msgid "" +":mod:`!argparse` --- Parser for command-line options, arguments and " +"subcommands" msgstr "" +#: ../../library/argparse.rst:12 msgid "**Source code:** :source:`Lib/argparse.py`" msgstr "" -msgid "While :mod:`!argparse` is the default recommended standard library module for implementing basic command line applications, authors with more exacting requirements for exactly how their command line applications behave may find it doesn't provide the necessary level of control. Refer to :ref:`choosing-an-argument-parser` for alternatives to consider when ``argparse`` doesn't support behaviors that the application requires (such as entirely disabling support for interspersed options and positional arguments, or accepting option parameter values that start with ``-`` even when they correspond to another defined option)." +#: ../../library/argparse.rst:16 +msgid "" +"While :mod:`!argparse` is the default recommended standard library module " +"for implementing basic command line applications, authors with more exacting " +"requirements for exactly how their command line applications behave may find " +"it doesn't provide the necessary level of control. Refer to :ref:`choosing-" +"an-argument-parser` for alternatives to consider when ``argparse`` doesn't " +"support behaviors that the application requires (such as entirely disabling " +"support for interspersed options and positional arguments, or accepting " +"option parameter values that start with ``-`` even when they correspond to " +"another defined option)." msgstr "" +#: ../../library/argparse.rst:-1 msgid "Tutorial" msgstr "" -msgid "This page contains the API reference information. For a more gentle introduction to Python command-line parsing, have a look at the :ref:`argparse tutorial `." +#: ../../library/argparse.rst:30 +msgid "" +"This page contains the API reference information. For a more gentle " +"introduction to Python command-line parsing, have a look at " +"the :ref:`argparse tutorial `." msgstr "" -msgid "The :mod:`!argparse` module makes it easy to write user-friendly command-line interfaces. The program defines what arguments it requires, and :mod:`!argparse` will figure out how to parse those out of :data:`sys.argv`. The :mod:`!argparse` module also automatically generates help and usage messages. The module will also issue errors when users give the program invalid arguments." +#: ../../library/argparse.rst:34 +msgid "" +"The :mod:`!argparse` module makes it easy to write user-friendly command-" +"line interfaces. The program defines what arguments it requires, and :mod:`!" +"argparse` will figure out how to parse those out of :data:`sys.argv`. " +"The :mod:`!argparse` module also automatically generates help and usage " +"messages. The module will also issue errors when users give the program " +"invalid arguments." msgstr "" -msgid "The :mod:`!argparse` module's support for command-line interfaces is built around an instance of :class:`argparse.ArgumentParser`. It is a container for argument specifications and has options that apply to the parser as whole::" +#: ../../library/argparse.rst:40 +msgid "" +"The :mod:`!argparse` module's support for command-line interfaces is built " +"around an instance of :class:`argparse.ArgumentParser`. It is a container " +"for argument specifications and has options that apply to the parser as " +"whole::" msgstr "" +#: ../../library/argparse.rst:44 msgid "" "parser = argparse.ArgumentParser(\n" " prog='ProgramName',\n" @@ -52,9 +84,14 @@ msgid "" " epilog='Text at the bottom of help')" msgstr "" -msgid "The :meth:`ArgumentParser.add_argument` method attaches individual argument specifications to the parser. It supports positional arguments, options that accept values, and on/off flags::" +#: ../../library/argparse.rst:49 +msgid "" +"The :meth:`ArgumentParser.add_argument` method attaches individual argument " +"specifications to the parser. It supports positional arguments, options " +"that accept values, and on/off flags::" msgstr "" +#: ../../library/argparse.rst:53 msgid "" "parser.add_argument('filename') # positional argument\n" "parser.add_argument('-c', '--count') # option that takes a value\n" @@ -62,101 +99,177 @@ msgid "" " action='store_true') # on/off flag" msgstr "" -msgid "The :meth:`ArgumentParser.parse_args` method runs the parser and places the extracted data in a :class:`argparse.Namespace` object::" +#: ../../library/argparse.rst:58 +msgid "" +"The :meth:`ArgumentParser.parse_args` method runs the parser and places the " +"extracted data in a :class:`argparse.Namespace` object::" msgstr "" +#: ../../library/argparse.rst:61 msgid "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgstr "" -msgid "If you're looking for a guide about how to upgrade :mod:`optparse` code to :mod:`!argparse`, see :ref:`Upgrading Optparse Code `." +#: ../../library/argparse.rst:65 +msgid "" +"If you're looking for a guide about how to upgrade :mod:`optparse` code " +"to :mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" +#: ../../library/argparse.rst:69 msgid "ArgumentParser objects" msgstr "" -msgid "Create a new :class:`ArgumentParser` object. All parameters should be passed as keyword arguments. Each parameter has its own more detailed description below, but in short they are:" +#: ../../library/argparse.rst:79 +msgid "" +"Create a new :class:`ArgumentParser` object. All parameters should be passed " +"as keyword arguments. Each parameter has its own more detailed description " +"below, but in short they are:" msgstr "" -msgid "prog_ - The name of the program (default: generated from the ``__main__`` module attributes and ``sys.argv[0]``)" +#: ../../library/argparse.rst:83 +msgid "" +"prog_ - The name of the program (default: generated from the ``__main__`` " +"module attributes and ``sys.argv[0]``)" msgstr "" -msgid "usage_ - The string describing the program usage (default: generated from arguments added to parser)" +#: ../../library/argparse.rst:86 +msgid "" +"usage_ - The string describing the program usage (default: generated from " +"arguments added to parser)" msgstr "" -msgid "description_ - Text to display before the argument help (by default, no text)" +#: ../../library/argparse.rst:89 +msgid "" +"description_ - Text to display before the argument help (by default, no text)" msgstr "" +#: ../../library/argparse.rst:92 msgid "epilog_ - Text to display after the argument help (by default, no text)" msgstr "" -msgid "parents_ - A list of :class:`ArgumentParser` objects whose arguments should also be included" +#: ../../library/argparse.rst:94 +msgid "" +"parents_ - A list of :class:`ArgumentParser` objects whose arguments should " +"also be included" msgstr "" +#: ../../library/argparse.rst:97 msgid "formatter_class_ - A class for customizing the help output" msgstr "" -msgid "prefix_chars_ - The set of characters that prefix optional arguments (default: '-')" +#: ../../library/argparse.rst:99 +msgid "" +"prefix_chars_ - The set of characters that prefix optional arguments " +"(default: '-')" msgstr "" -msgid "fromfile_prefix_chars_ - The set of characters that prefix files from which additional arguments should be read (default: ``None``)" +#: ../../library/argparse.rst:102 +msgid "" +"fromfile_prefix_chars_ - The set of characters that prefix files from which " +"additional arguments should be read (default: ``None``)" msgstr "" -msgid "argument_default_ - The global default value for arguments (default: ``None``)" +#: ../../library/argparse.rst:105 +msgid "" +"argument_default_ - The global default value for arguments (default: " +"``None``)" msgstr "" -msgid "conflict_handler_ - The strategy for resolving conflicting optionals (usually unnecessary)" +#: ../../library/argparse.rst:108 +msgid "" +"conflict_handler_ - The strategy for resolving conflicting optionals " +"(usually unnecessary)" msgstr "" -msgid "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" +#: ../../library/argparse.rst:111 +msgid "" +"add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -msgid "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is unambiguous (default: ``True``)" +#: ../../library/argparse.rst:113 +msgid "" +"allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " +"unambiguous (default: ``True``)" msgstr "" -msgid "exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits with error info when an error occurs. (default: ``True``)" +#: ../../library/argparse.rst:116 +msgid "" +"exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " +"with error info when an error occurs. (default: ``True``)" msgstr "" -msgid "suggest_on_error_ - Enables suggestions for mistyped argument choices and subparser names (default: ``False``)" +#: ../../library/argparse.rst:119 +msgid "" +"suggest_on_error_ - Enables suggestions for mistyped argument choices and " +"subparser names (default: ``False``)" msgstr "" +#: ../../library/argparse.rst:122 msgid "color_ - Allow color output (default: ``True``)" msgstr "" +#: ../../library/argparse.rst:124 msgid "*allow_abbrev* parameter was added." msgstr "" -msgid "In previous versions, *allow_abbrev* also disabled grouping of short flags such as ``-vv`` to mean ``-v -v``." +#: ../../library/argparse.rst:127 +msgid "" +"In previous versions, *allow_abbrev* also disabled grouping of short flags " +"such as ``-vv`` to mean ``-v -v``." msgstr "" +#: ../../library/argparse.rst:131 msgid "*exit_on_error* parameter was added." msgstr "" +#: ../../library/argparse.rst:134 msgid "*suggest_on_error* and *color* parameters were added." msgstr "" +#: ../../library/argparse.rst:137 ../../library/argparse.rst:695 msgid "The following sections describe how each of these are used." msgstr "" +#: ../../library/argparse.rst:143 msgid "prog" msgstr "" -msgid "By default, :class:`ArgumentParser` calculates the name of the program to display in help messages depending on the way the Python interpreter was run:" +#: ../../library/argparse.rst:146 +msgid "" +"By default, :class:`ArgumentParser` calculates the name of the program to " +"display in help messages depending on the way the Python interpreter was run:" msgstr "" -msgid "The :func:`base name ` of ``sys.argv[0]`` if a file was passed as argument." +#: ../../library/argparse.rst:149 +msgid "" +"The :func:`base name ` of ``sys.argv[0]`` if a file was " +"passed as argument." msgstr "" -msgid "The Python interpreter name followed by ``sys.argv[0]`` if a directory or a zipfile was passed as argument." +#: ../../library/argparse.rst:151 +msgid "" +"The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " +"zipfile was passed as argument." msgstr "" -msgid "The Python interpreter name followed by ``-m`` followed by the module or package name if the :option:`-m` option was used." +#: ../../library/argparse.rst:153 +msgid "" +"The Python interpreter name followed by ``-m`` followed by the module or " +"package name if the :option:`-m` option was used." msgstr "" -msgid "This default is almost always desirable because it will make the help messages match the string that was used to invoke the program on the command line. However, to change this default behavior, another value can be supplied using the ``prog=`` argument to :class:`ArgumentParser`::" +#: ../../library/argparse.rst:156 +msgid "" +"This default is almost always desirable because it will make the help " +"messages match the string that was used to invoke the program on the command " +"line. However, to change this default behavior, another value can be " +"supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" +#: ../../library/argparse.rst:161 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -166,9 +279,14 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -msgid "Note that the program name, whether determined from ``sys.argv[0]``, from the ``__main__`` module attributes or from the ``prog=`` argument, is available to help messages using the ``%(prog)s`` format specifier." +#: ../../library/argparse.rst:168 +msgid "" +"Note that the program name, whether determined from ``sys.argv[0]``, from " +"the ``__main__`` module attributes or from the ``prog=`` argument, is " +"available to help messages using the ``%(prog)s`` format specifier." msgstr "" +#: ../../library/argparse.rst:175 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -180,17 +298,27 @@ msgid "" " --foo FOO foo of the myprogram program" msgstr "" -msgid "The default ``prog`` value now reflects how ``__main__`` was actually executed, rather than always being ``os.path.basename(sys.argv[0])``." +#: ../../library/argparse.rst:184 +msgid "" +"The default ``prog`` value now reflects how ``__main__`` was actually " +"executed, rather than always being ``os.path.basename(sys.argv[0])``." msgstr "" +#: ../../library/argparse.rst:189 msgid "usage" msgstr "" -msgid "By default, :class:`ArgumentParser` calculates the usage message from the arguments it contains. The default message can be overridden with the ``usage=`` keyword argument::" +#: ../../library/argparse.rst:191 +msgid "" +"By default, :class:`ArgumentParser` calculates the usage message from the " +"arguments it contains. The default message can be overridden with the " +"``usage=`` keyword argument::" msgstr "" +#: ../../library/argparse.rst:195 msgid "" -">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]')\n" +">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " +"[options]')\n" ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" ">>> parser.print_help()\n" @@ -204,27 +332,52 @@ msgid "" " --foo [FOO] foo help" msgstr "" -msgid "The ``%(prog)s`` format specifier is available to fill in the program name in your usage messages." +#: ../../library/argparse.rst:208 +msgid "" +"The ``%(prog)s`` format specifier is available to fill in the program name " +"in your usage messages." msgstr "" -msgid "When a custom usage message is specified for the main parser, you may also want to consider passing the ``prog`` argument to :meth:`~ArgumentParser.add_subparsers` or the ``prog`` and the ``usage`` arguments to :meth:`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and usage information across subparsers." +#: ../../library/argparse.rst:211 +msgid "" +"When a custom usage message is specified for the main parser, you may also " +"want to consider passing the ``prog`` argument " +"to :meth:`~ArgumentParser.add_subparsers` or the ``prog`` and the ``usage`` " +"arguments to :meth:`~_SubParsersAction.add_parser`, to ensure consistent " +"command prefixes and usage information across subparsers." msgstr "" +#: ../../library/argparse.rst:221 msgid "description" msgstr "" -msgid "Most calls to the :class:`ArgumentParser` constructor will use the ``description=`` keyword argument. This argument gives a brief description of what the program does and how it works. In help messages, the description is displayed between the command-line usage string and the help messages for the various arguments." +#: ../../library/argparse.rst:223 +msgid "" +"Most calls to the :class:`ArgumentParser` constructor will use the " +"``description=`` keyword argument. This argument gives a brief description " +"of what the program does and how it works. In help messages, the " +"description is displayed between the command-line usage string and the help " +"messages for the various arguments." msgstr "" -msgid "By default, the description will be line-wrapped so that it fits within the given space. To change this behavior, see the formatter_class_ argument." +#: ../../library/argparse.rst:229 +msgid "" +"By default, the description will be line-wrapped so that it fits within the " +"given space. To change this behavior, see the formatter_class_ argument." msgstr "" +#: ../../library/argparse.rst:234 msgid "epilog" msgstr "" -msgid "Some programs like to display additional description of the program after the description of the arguments. Such text can be specified using the ``epilog=`` argument to :class:`ArgumentParser`::" +#: ../../library/argparse.rst:236 +msgid "" +"Some programs like to display additional description of the program after " +"the description of the arguments. Such text can be specified using the " +"``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" +#: ../../library/argparse.rst:240 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -240,15 +393,29 @@ msgid "" "And that's how you'd foo a bar" msgstr "" -msgid "As with the description_ argument, the ``epilog=`` text is by default line-wrapped, but this behavior can be adjusted with the formatter_class_ argument to :class:`ArgumentParser`." +#: ../../library/argparse.rst:253 +msgid "" +"As with the description_ argument, the ``epilog=`` text is by default line-" +"wrapped, but this behavior can be adjusted with the formatter_class_ " +"argument to :class:`ArgumentParser`." msgstr "" +#: ../../library/argparse.rst:259 msgid "parents" msgstr "" -msgid "Sometimes, several parsers share a common set of arguments. Rather than repeating the definitions of these arguments, a single parser with all the shared arguments and passed to ``parents=`` argument to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a list of :class:`ArgumentParser` objects, collects all the positional and optional actions from them, and adds these actions to the :class:`ArgumentParser` object being constructed::" +#: ../../library/argparse.rst:261 +msgid "" +"Sometimes, several parsers share a common set of arguments. Rather than " +"repeating the definitions of these arguments, a single parser with all the " +"shared arguments and passed to ``parents=`` argument " +"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " +"list of :class:`ArgumentParser` objects, collects all the positional and " +"optional actions from them, and adds these actions to " +"the :class:`ArgumentParser` object being constructed::" msgstr "" +#: ../../library/argparse.rst:268 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -264,21 +431,40 @@ msgid "" "Namespace(bar='YYY', parent=None)" msgstr "" -msgid "Note that most parent parsers will specify ``add_help=False``. Otherwise, the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the parent and one in the child) and raise an error." +#: ../../library/argparse.rst:281 +msgid "" +"Note that most parent parsers will specify ``add_help=False``. Otherwise, " +"the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " +"parent and one in the child) and raise an error." msgstr "" -msgid "You must fully initialize the parsers before passing them via ``parents=``. If you change the parent parsers after the child parser, those changes will not be reflected in the child." +#: ../../library/argparse.rst:286 +msgid "" +"You must fully initialize the parsers before passing them via ``parents=``. " +"If you change the parent parsers after the child parser, those changes will " +"not be reflected in the child." msgstr "" +#: ../../library/argparse.rst:294 msgid "formatter_class" msgstr "" -msgid ":class:`ArgumentParser` objects allow the help formatting to be customized by specifying an alternate formatting class. Currently, there are four such classes:" +#: ../../library/argparse.rst:296 +msgid "" +":class:`ArgumentParser` objects allow the help formatting to be customized " +"by specifying an alternate formatting class. Currently, there are four such " +"classes:" msgstr "" -msgid ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give more control over how textual descriptions are displayed. By default, :class:`ArgumentParser` objects line-wrap the description_ and epilog_ texts in command-line help messages::" +#: ../../library/argparse.rst:305 +msgid "" +":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " +"more control over how textual descriptions are displayed. By " +"default, :class:`ArgumentParser` objects line-wrap the description_ and " +"epilog_ texts in command-line help messages::" msgstr "" +#: ../../library/argparse.rst:310 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -297,13 +483,19 @@ msgid "" "options:\n" " -h, --help show this help message and exit\n" "\n" -"likewise for this epilog whose whitespace will be cleaned up and whose words\n" +"likewise for this epilog whose whitespace will be cleaned up and whose " +"words\n" "will be wrapped across a couple lines" msgstr "" -msgid "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` indicates that description_ and epilog_ are already correctly formatted and should not be line-wrapped::" +#: ../../library/argparse.rst:330 +msgid "" +"Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " +"indicates that description_ and epilog_ are already correctly formatted and " +"should not be line-wrapped::" msgstr "" +#: ../../library/argparse.rst:334 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -328,12 +520,21 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -msgid ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text, including argument descriptions. However, multiple newlines are replaced with one. If you wish to preserve multiple blank lines, add spaces between the newlines." +#: ../../library/argparse.rst:356 +msgid "" +":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " +"text, including argument descriptions. However, multiple newlines are " +"replaced with one. If you wish to preserve multiple blank lines, add spaces " +"between the newlines." msgstr "" -msgid ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about default values to each of the argument help messages::" +#: ../../library/argparse.rst:361 +msgid "" +":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " +"default values to each of the argument help messages::" msgstr "" +#: ../../library/argparse.rst:364 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -351,9 +552,14 @@ msgid "" " --foo FOO FOO! (default: 42)" msgstr "" -msgid ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for each argument as the display name for its values (rather than using the dest_ as the regular formatter does)::" +#: ../../library/argparse.rst:379 +msgid "" +":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " +"each argument as the display name for its values (rather than using the " +"dest_ as the regular formatter does)::" msgstr "" +#: ../../library/argparse.rst:383 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -371,12 +577,19 @@ msgid "" " --foo int" msgstr "" +#: ../../library/argparse.rst:400 msgid "prefix_chars" msgstr "" -msgid "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. Parsers that need to support different or additional prefix characters, e.g. for options like ``+f`` or ``/foo``, may specify them using the ``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" +#: ../../library/argparse.rst:402 +msgid "" +"Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " +"Parsers that need to support different or additional prefix characters, e.g. " +"for options like ``+f`` or ``/foo``, may specify them using the " +"``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" +#: ../../library/argparse.rst:408 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -385,15 +598,28 @@ msgid "" "Namespace(bar='Y', f='X')" msgstr "" -msgid "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of characters that does not include ``-`` will cause ``-f/--foo`` options to be disallowed." +#: ../../library/argparse.rst:414 +msgid "" +"The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " +"characters that does not include ``-`` will cause ``-f/--foo`` options to be " +"disallowed." msgstr "" +#: ../../library/argparse.rst:420 msgid "fromfile_prefix_chars" msgstr "" -msgid "Sometimes, when dealing with a particularly long argument list, it may make sense to keep the list of arguments in a file rather than typing it out at the command line. If the ``fromfile_prefix_chars=`` argument is given to the :class:`ArgumentParser` constructor, then arguments that start with any of the specified characters will be treated as files, and will be replaced by the arguments they contain. For example::" +#: ../../library/argparse.rst:422 +msgid "" +"Sometimes, when dealing with a particularly long argument list, it may make " +"sense to keep the list of arguments in a file rather than typing it out at " +"the command line. If the ``fromfile_prefix_chars=`` argument is given to " +"the :class:`ArgumentParser` constructor, then arguments that start with any " +"of the specified characters will be treated as files, and will be replaced " +"by the arguments they contain. For example::" msgstr "" +#: ../../library/argparse.rst:429 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -404,27 +630,61 @@ msgid "" "Namespace(f='bar')" msgstr "" -msgid "Arguments read from a file must be one per line by default (but see also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they were in the same place as the original file referencing argument on the command line. So in the example above, the expression ``['-f', 'foo', '@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-f', 'bar']``." +#: ../../library/argparse.rst:437 +msgid "" +"Arguments read from a file must be one per line by default (but see " +"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " +"they were in the same place as the original file referencing argument on the " +"command line. So in the example above, the expression ``['-f', 'foo', " +"'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" +"f', 'bar']``." msgstr "" -msgid "Each line is treated as a single argument, so an empty line is read as an empty string (``''``)." +#: ../../library/argparse.rst:445 +msgid "" +"Each line is treated as a single argument, so an empty line is read as an " +"empty string (``''``)." msgstr "" -msgid ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` to read the file containing arguments." +#: ../../library/argparse.rst:448 +msgid "" +":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " +"to read the file containing arguments." msgstr "" -msgid "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that arguments will never be treated as file references." +#: ../../library/argparse.rst:451 +msgid "" +"The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " +"arguments will never be treated as file references." msgstr "" -msgid ":class:`ArgumentParser` changed encoding and errors to read arguments files from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to the :term:`filesystem encoding and error handler`. Arguments file should be encoded in UTF-8 instead of ANSI Codepage on Windows." +#: ../../library/argparse.rst:454 +msgid "" +":class:`ArgumentParser` changed encoding and errors to read arguments files " +"from default (e.g. :func:`locale.getpreferredencoding(False) " +"` and ``\"strict\"``) to the :term:`filesystem " +"encoding and error handler`. Arguments file should be encoded in UTF-8 " +"instead of ANSI Codepage on Windows." msgstr "" +#: ../../library/argparse.rst:462 msgid "argument_default" msgstr "" -msgid "Generally, argument defaults are specified either by passing a default to :meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-value pairs. Sometimes however, it may be useful to specify a single parser-wide default for arguments. This can be accomplished by passing the ``argument_default=`` keyword argument to :class:`ArgumentParser`. For example, to globally suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we supply ``argument_default=SUPPRESS``::" +#: ../../library/argparse.rst:464 +msgid "" +"Generally, argument defaults are specified either by passing a default " +"to :meth:`~ArgumentParser.add_argument` or by calling " +"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" +"value pairs. Sometimes however, it may be useful to specify a single parser-" +"wide default for arguments. This can be accomplished by passing the " +"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " +"example, to globally suppress attribute creation " +"on :meth:`~ArgumentParser.parse_args` calls, we supply " +"``argument_default=SUPPRESS``::" msgstr "" +#: ../../library/argparse.rst:473 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -435,15 +695,22 @@ msgid "" "Namespace()" msgstr "" +#: ../../library/argparse.rst:484 msgid "allow_abbrev" msgstr "" -msgid "Normally, when you pass an argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes abbreviations ` of long options." +#: ../../library/argparse.rst:486 +msgid "" +"Normally, when you pass an argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it :ref:`recognizes abbreviations ` of long options." msgstr "" +#: ../../library/argparse.rst:490 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" +#: ../../library/argparse.rst:492 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -453,12 +720,19 @@ msgid "" "PROG: error: unrecognized arguments: --foon" msgstr "" +#: ../../library/argparse.rst:503 msgid "conflict_handler" msgstr "" -msgid ":class:`ArgumentParser` objects do not allow two actions with the same option string. By default, :class:`ArgumentParser` objects raise an exception if an attempt is made to create an argument with an option string that is already in use::" +#: ../../library/argparse.rst:505 +msgid "" +":class:`ArgumentParser` objects do not allow two actions with the same " +"option string. By default, :class:`ArgumentParser` objects raise an " +"exception if an attempt is made to create an argument with an option string " +"that is already in use::" msgstr "" +#: ../../library/argparse.rst:510 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -468,11 +742,18 @@ msgid "" "ArgumentError: argument --foo: conflicting option string(s): --foo" msgstr "" -msgid "Sometimes (e.g. when using parents_) it may be useful to simply override any older arguments with the same option string. To get this behavior, the value ``'resolve'`` can be supplied to the ``conflict_handler=`` argument of :class:`ArgumentParser`::" +#: ../../library/argparse.rst:517 +msgid "" +"Sometimes (e.g. when using parents_) it may be useful to simply override any " +"older arguments with the same option string. To get this behavior, the " +"value ``'resolve'`` can be supplied to the ``conflict_handler=`` argument " +"of :class:`ArgumentParser`::" msgstr "" +#: ../../library/argparse.rst:522 msgid "" -">>> parser = argparse.ArgumentParser(prog='PROG', conflict_handler='resolve')\n" +">>> parser = argparse.ArgumentParser(prog='PROG', " +"conflict_handler='resolve')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" ">>> parser.add_argument('--foo', help='new foo help')\n" ">>> parser.print_help()\n" @@ -484,18 +765,33 @@ msgid "" " --foo FOO new foo help" msgstr "" -msgid "Note that :class:`ArgumentParser` objects only remove an action if all of its option strings are overridden. So, in the example above, the old ``-f/--foo`` action is retained as the ``-f`` action, because only the ``--foo`` option string was overridden." +#: ../../library/argparse.rst:533 +msgid "" +"Note that :class:`ArgumentParser` objects only remove an action if all of " +"its option strings are overridden. So, in the example above, the old ``-f/--" +"foo`` action is retained as the ``-f`` action, because only the ``--foo`` " +"option string was overridden." msgstr "" +#: ../../library/argparse.rst:540 msgid "add_help" msgstr "" -msgid "By default, :class:`ArgumentParser` objects add an option which simply displays the parser's help message. If ``-h`` or ``--help`` is supplied at the command line, the :class:`!ArgumentParser` help will be printed." +#: ../../library/argparse.rst:542 +msgid "" +"By default, :class:`ArgumentParser` objects add an option which simply " +"displays the parser's help message. If ``-h`` or ``--help`` is supplied at " +"the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" -msgid "Occasionally, it may be useful to disable the addition of this help option. This can be achieved by passing ``False`` as the ``add_help=`` argument to :class:`ArgumentParser`::" +#: ../../library/argparse.rst:546 +msgid "" +"Occasionally, it may be useful to disable the addition of this help option. " +"This can be achieved by passing ``False`` as the ``add_help=`` argument " +"to :class:`ArgumentParser`::" msgstr "" +#: ../../library/argparse.rst:550 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -506,9 +802,15 @@ msgid "" " --foo FOO foo help" msgstr "" -msgid "The help option is typically ``-h/--help``. The exception to this is if the ``prefix_chars=`` is specified and does not include ``-``, in which case ``-h`` and ``--help`` are not valid options. In this case, the first character in ``prefix_chars`` is used to prefix the help options::" +#: ../../library/argparse.rst:558 +msgid "" +"The help option is typically ``-h/--help``. The exception to this is if the " +"``prefix_chars=`` is specified and does not include ``-``, in which case ``-" +"h`` and ``--help`` are not valid options. In this case, the first character " +"in ``prefix_chars`` is used to prefix the help options::" msgstr "" +#: ../../library/argparse.rst:564 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -518,19 +820,31 @@ msgid "" " +h, ++help show this help message and exit" msgstr "" +#: ../../library/argparse.rst:573 msgid "exit_on_error" msgstr "" -msgid "Normally, when you pass an invalid argument list to the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will print a *message* to :data:`sys.stderr` and exit with a status code of 2." +#: ../../library/argparse.rst:575 +msgid "" +"Normally, when you pass an invalid argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it will print a *message* to :data:`sys.stderr` and exit with a status code " +"of 2." msgstr "" -msgid "If the user would like to catch errors manually, the feature can be enabled by setting ``exit_on_error`` to ``False``::" +#: ../../library/argparse.rst:579 +msgid "" +"If the user would like to catch errors manually, the feature can be enabled " +"by setting ``exit_on_error`` to ``False``::" msgstr "" +#: ../../library/argparse.rst:582 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" -"_StoreAction(option_strings=['--integers'], dest='integers', nargs=None, const=None, default=None, type=, choices=None, help=None, metavar=None)\n" +"_StoreAction(option_strings=['--integers'], dest='integers', nargs=None, " +"const=None, default=None, type=, choices=None, help=None, " +"metavar=None)\n" ">>> try:\n" "... parser.parse_args('--integers a'.split())\n" "... except argparse.ArgumentError:\n" @@ -539,37 +853,64 @@ msgid "" "Catching an argumentError" msgstr "" +#: ../../library/argparse.rst:595 msgid "suggest_on_error" msgstr "" -msgid "By default, when a user passes an invalid argument choice or subparser name, :class:`ArgumentParser` will exit with error info and list the permissible argument choices (if specified) or subparser names as part of the error message." +#: ../../library/argparse.rst:597 +msgid "" +"By default, when a user passes an invalid argument choice or subparser " +"name, :class:`ArgumentParser` will exit with error info and list the " +"permissible argument choices (if specified) or subparser names as part of " +"the error message." msgstr "" -msgid "If the user would like to enable suggestions for mistyped argument choices and subparser names, the feature can be enabled by setting ``suggest_on_error`` to ``True``. Note that this only applies for arguments when the choices specified are strings::" +#: ../../library/argparse.rst:601 +msgid "" +"If the user would like to enable suggestions for mistyped argument choices " +"and subparser names, the feature can be enabled by setting " +"``suggest_on_error`` to ``True``. Note that this only applies for arguments " +"when the choices specified are strings::" msgstr "" +#: ../../library/argparse.rst:606 msgid "" ">>> parser = argparse.ArgumentParser(suggest_on_error=True)\n" ">>> parser.add_argument('--action', choices=['debug', 'dryrun'])\n" ">>> parser.parse_args(['--action', 'debugg'])\n" "usage: tester.py [-h] [--action {debug,dryrun}]\n" -"tester.py: error: argument --action: invalid choice: 'debugg', maybe you meant 'debug'? (choose from debug, dryrun)" +"tester.py: error: argument --action: invalid choice: 'debugg', maybe you " +"meant 'debug'? (choose from debug, dryrun)" msgstr "" -msgid "If you're writing code that needs to be compatible with older Python versions and want to opportunistically use ``suggest_on_error`` when it's available, you can set it as an attribute after initializing the parser instead of using the keyword argument::" +#: ../../library/argparse.rst:612 +msgid "" +"If you're writing code that needs to be compatible with older Python " +"versions and want to opportunistically use ``suggest_on_error`` when it's " +"available, you can set it as an attribute after initializing the parser " +"instead of using the keyword argument::" msgstr "" +#: ../../library/argparse.rst:617 msgid "" ">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" ">>> parser.suggest_on_error = True" msgstr "" +#: ../../library/argparse.rst:624 msgid "color" msgstr "" -msgid "By default, the help message is printed in color using `ANSI escape sequences `__. If you want plain text help messages, you can disable this :ref:`in your local environment `, or in the argument parser itself by setting ``color`` to ``False``::" +#: ../../library/argparse.rst:626 +msgid "" +"By default, the help message is printed in color using `ANSI escape " +"sequences `__. If you want " +"plain text help messages, you can disable this :ref:`in your local " +"environment `, or in the argument parser itself " +"by setting ``color`` to ``False``::" msgstr "" +#: ../../library/argparse.rst:632 msgid "" ">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" "... color=False)\n" @@ -579,78 +920,132 @@ msgid "" ">>> parser.parse_args(['--help'])" msgstr "" -msgid "Note that when ``color=True``, colored output depends on both environment variables and terminal capabilities. However, if ``color=False``, colored output is always disabled, even if environment variables like ``FORCE_COLOR`` are set." +#: ../../library/argparse.rst:639 +msgid "" +"Note that when ``color=True``, colored output depends on both environment " +"variables and terminal capabilities. However, if ``color=False``, colored " +"output is always disabled, even if environment variables like " +"``FORCE_COLOR`` are set." msgstr "" -msgid "Error messages will include color codes when redirecting stderr to a file. To avoid this, set the |NO_COLOR|_ or :envvar:`PYTHON_COLORS` environment variable (for example, ``NO_COLOR=1 python script.py 2> errors.txt``)." +#: ../../library/argparse.rst:646 +msgid "" +"Error messages will include color codes when redirecting stderr to a file. " +"To avoid this, set the |NO_COLOR|_ or :envvar:`PYTHON_COLORS` environment " +"variable (for example, ``NO_COLOR=1 python script.py 2> errors.txt``)." msgstr "" +#: ../../library/argparse.rst:655 msgid "The add_argument() method" msgstr "" -msgid "Define how a single command-line argument should be parsed. Each parameter has its own more detailed description below, but in short they are:" +#: ../../library/argparse.rst:661 +msgid "" +"Define how a single command-line argument should be parsed. Each parameter " +"has its own more detailed description below, but in short they are:" msgstr "" -msgid "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` or ``'-f', '--foo'``." +#: ../../library/argparse.rst:664 +msgid "" +"`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " +"or ``'-f', '--foo'``." msgstr "" -msgid "action_ - The basic type of action to be taken when this argument is encountered at the command line." +#: ../../library/argparse.rst:667 +msgid "" +"action_ - The basic type of action to be taken when this argument is " +"encountered at the command line." msgstr "" +#: ../../library/argparse.rst:670 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -msgid "const_ - A constant value required by some action_ and nargs_ selections." +#: ../../library/argparse.rst:672 +msgid "" +"const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -msgid "default_ - The value produced if the argument is absent from the command line and if it is absent from the namespace object." +#: ../../library/argparse.rst:674 +msgid "" +"default_ - The value produced if the argument is absent from the command " +"line and if it is absent from the namespace object." msgstr "" -msgid "type_ - The type to which the command-line argument should be converted." +#: ../../library/argparse.rst:677 +msgid "" +"type_ - The type to which the command-line argument should be converted." msgstr "" +#: ../../library/argparse.rst:679 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -msgid "required_ - Whether or not the command-line option may be omitted (optionals only)." +#: ../../library/argparse.rst:681 +msgid "" +"required_ - Whether or not the command-line option may be omitted (optionals " +"only)." msgstr "" +#: ../../library/argparse.rst:684 msgid "help_ - A brief description of what the argument does." msgstr "" +#: ../../library/argparse.rst:686 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -msgid "dest_ - The name of the attribute to be added to the object returned by :meth:`parse_args`." +#: ../../library/argparse.rst:688 +msgid "" +"dest_ - The name of the attribute to be added to the object returned " +"by :meth:`parse_args`." msgstr "" +#: ../../library/argparse.rst:691 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" +#: ../../library/argparse.rst:693 msgid "The method returns an :class:`Action` object representing the argument." msgstr "" +#: ../../library/argparse.rst:701 msgid "name or flags" msgstr "" -msgid "The :meth:`~ArgumentParser.add_argument` method must know whether an optional argument, like ``-f`` or ``--foo``, or a positional argument, like a list of filenames, is expected. The first arguments passed to :meth:`~ArgumentParser.add_argument` must therefore be either a series of flags, or a simple argument name." +#: ../../library/argparse.rst:703 +msgid "" +"The :meth:`~ArgumentParser.add_argument` method must know whether an " +"optional argument, like ``-f`` or ``--foo``, or a positional argument, like " +"a list of filenames, is expected. The first arguments passed " +"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " +"flags, or a simple argument name." msgstr "" +#: ../../library/argparse.rst:709 msgid "For example, an optional argument could be created like::" msgstr "" +#: ../../library/argparse.rst:711 msgid ">>> parser.add_argument('-f', '--foo')" msgstr "" +#: ../../library/argparse.rst:713 msgid "while a positional argument could be created like::" msgstr "" +#: ../../library/argparse.rst:715 msgid ">>> parser.add_argument('bar')" msgstr "" -msgid "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will be identified by the ``-`` prefix, and the remaining arguments will be assumed to be positional::" +#: ../../library/argparse.rst:717 +msgid "" +"When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " +"be identified by the ``-`` prefix, and the remaining arguments will be " +"assumed to be positional::" msgstr "" +#: ../../library/argparse.rst:721 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -664,9 +1059,17 @@ msgid "" "PROG: error: the following arguments are required: bar" msgstr "" -msgid "By default, :mod:`!argparse` automatically handles the internal naming and display names of arguments, simplifying the process without requiring additional configuration. As such, you do not need to specify the dest_ and metavar_ parameters. For optional arguments, the dest_ parameter defaults to the argument name, with underscores ``_`` replacing hyphens ``-``. The metavar_ parameter defaults to the upper-cased name. For example::" +#: ../../library/argparse.rst:732 +msgid "" +"By default, :mod:`!argparse` automatically handles the internal naming and " +"display names of arguments, simplifying the process without requiring " +"additional configuration. As such, you do not need to specify the dest_ and " +"metavar_ parameters. For optional arguments, the dest_ parameter defaults to " +"the argument name, with underscores ``_`` replacing hyphens ``-``. The " +"metavar_ parameter defaults to the upper-cased name. For example::" msgstr "" +#: ../../library/argparse.rst:740 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo-bar')\n" @@ -680,18 +1083,35 @@ msgid "" " --foo-bar FOO-BAR" msgstr "" +#: ../../library/argparse.rst:755 msgid "action" msgstr "" -msgid ":class:`ArgumentParser` objects associate command-line arguments with actions. These actions can do just about anything with the command-line arguments associated with them, though most actions simply add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword argument specifies how the command-line arguments should be handled. The supplied actions are:" +#: ../../library/argparse.rst:757 +msgid "" +":class:`ArgumentParser` objects associate command-line arguments with " +"actions. These actions can do just about anything with the command-line " +"arguments associated with them, though most actions simply add an attribute " +"to the object returned by :meth:`~ArgumentParser.parse_args`. The " +"``action`` keyword argument specifies how the command-line arguments should " +"be handled. The supplied actions are:" msgstr "" -msgid "``'store'`` - This just stores the argument's value. This is the default action." +#: ../../library/argparse.rst:763 +msgid "" +"``'store'`` - This just stores the argument's value. This is the default " +"action." msgstr "" -msgid "``'store_const'`` - This stores the value specified by the const_ keyword argument; note that the const_ keyword argument defaults to ``None``. The ``'store_const'`` action is most commonly used with optional arguments that specify some sort of flag. For example::" +#: ../../library/argparse.rst:766 +msgid "" +"``'store_const'`` - This stores the value specified by the const_ keyword " +"argument; note that the const_ keyword argument defaults to ``None``. The " +"``'store_const'`` action is most commonly used with optional arguments that " +"specify some sort of flag. For example::" msgstr "" +#: ../../library/argparse.rst:771 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -699,9 +1119,14 @@ msgid "" "Namespace(foo=42)" msgstr "" -msgid "``'store_true'`` and ``'store_false'`` - These are special cases of ``'store_const'`` that respectively store the values ``True`` and ``False`` with default values of ``False`` and ``True``::" +#: ../../library/argparse.rst:776 +msgid "" +"``'store_true'`` and ``'store_false'`` - These are special cases of " +"``'store_const'`` that respectively store the values ``True`` and ``False`` " +"with default values of ``False`` and ``True``::" msgstr "" +#: ../../library/argparse.rst:781 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -711,9 +1136,16 @@ msgid "" "Namespace(foo=True, bar=False, baz=True)" msgstr "" -msgid "``'append'`` - This appends each argument value to a list. It is useful for allowing an option to be specified multiple times. If the default value is a non-empty list, the parsed value will start with the default list's elements and any values from the command line will be appended after those default values. Example usage::" +#: ../../library/argparse.rst:788 +msgid "" +"``'append'`` - This appends each argument value to a list. It is useful for " +"allowing an option to be specified multiple times. If the default value is a " +"non-empty list, the parsed value will start with the default list's elements " +"and any values from the command line will be appended after those default " +"values. Example usage::" msgstr "" +#: ../../library/argparse.rst:794 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append', default=['0'])\n" @@ -721,30 +1153,51 @@ msgid "" "Namespace(foo=['0', '1', '2'])" msgstr "" -msgid "``'append_const'`` - This appends the value specified by the const_ keyword argument to a list; note that the const_ keyword argument defaults to ``None``. The ``'append_const'`` action is typically useful when multiple arguments need to store constants to the same list. For example::" +#: ../../library/argparse.rst:799 +msgid "" +"``'append_const'`` - This appends the value specified by the const_ keyword " +"argument to a list; note that the const_ keyword argument defaults to " +"``None``. The ``'append_const'`` action is typically useful when multiple " +"arguments need to store constants to the same list. For example::" msgstr "" +#: ../../library/argparse.rst:805 msgid "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--str', dest='types', action='append_const', const=str)\n" -">>> parser.add_argument('--int', dest='types', action='append_const', const=int)\n" +">>> parser.add_argument('--str', dest='types', action='append_const', " +"const=str)\n" +">>> parser.add_argument('--int', dest='types', action='append_const', " +"const=int)\n" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" msgstr "" -msgid "``'extend'`` - This appends each item from a multi-value argument to a list. The ``'extend'`` action is typically used with the nargs_ keyword argument value ``'+'`` or ``'*'``. Note that when nargs_ is ``None`` (the default) or ``'?'``, each character of the argument string will be appended to the list. Example usage::" +#: ../../library/argparse.rst:811 +msgid "" +"``'extend'`` - This appends each item from a multi-value argument to a list. " +"The ``'extend'`` action is typically used with the nargs_ keyword argument " +"value ``'+'`` or ``'*'``. Note that when nargs_ is ``None`` (the default) or " +"``'?'``, each character of the argument string will be appended to the list. " +"Example usage::" msgstr "" +#: ../../library/argparse.rst:819 msgid "" ">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", type=str)\n" -">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", \"f4\"])\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" msgstr "" -msgid "``'count'`` - This counts the number of times an argument occurs. For example, this is useful for increasing verbosity levels::" +#: ../../library/argparse.rst:826 +msgid "" +"``'count'`` - This counts the number of times an argument occurs. For " +"example, this is useful for increasing verbosity levels::" msgstr "" +#: ../../library/argparse.rst:829 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -752,32 +1205,58 @@ msgid "" "Namespace(verbose=3)" msgstr "" +#: ../../library/argparse.rst:834 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -msgid "``'help'`` - This prints a complete help message for all the options in the current parser and then exits. By default a help action is automatically added to the parser. See :class:`ArgumentParser` for details of how the output is created." +#: ../../library/argparse.rst:836 +msgid "" +"``'help'`` - This prints a complete help message for all the options in the " +"current parser and then exits. By default a help action is automatically " +"added to the parser. See :class:`ArgumentParser` for details of how the " +"output is created." msgstr "" -msgid "``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked::" +#: ../../library/argparse.rst:841 +msgid "" +"``'version'`` - This expects a ``version=`` keyword argument in " +"the :meth:`~ArgumentParser.add_argument` call, and prints version " +"information and exits when invoked::" msgstr "" +#: ../../library/argparse.rst:845 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" -">>> parser.add_argument('--version', action='version', version='%(prog)s 2.0')\n" +">>> parser.add_argument('--version', action='version', version='%(prog)s " +"2.0')\n" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" msgstr "" -msgid "You may also specify an arbitrary action by passing an :class:`Action` subclass (e.g. :class:`BooleanOptionalAction`) or other object that implements the same interface. Only actions that consume command-line arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions with non-zero ``nargs``) can be used with positional arguments." +#: ../../library/argparse.rst:851 +msgid "" +"You may also specify an arbitrary action by passing an :class:`Action` " +"subclass (e.g. :class:`BooleanOptionalAction`) or other object that " +"implements the same interface. Only actions that consume command-line " +"arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions " +"with non-zero ``nargs``) can be used with positional arguments." msgstr "" -msgid "The recommended way to create a custom action is to extend :class:`Action`, overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` and :meth:`!format_usage` methods. You can also register custom actions using the :meth:`~ArgumentParser.register` method and reference them by their registered name." +#: ../../library/argparse.rst:857 +msgid "" +"The recommended way to create a custom action is to extend :class:`Action`, " +"overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " +"and :meth:`!format_usage` methods. You can also register custom actions " +"using the :meth:`~ArgumentParser.register` method and reference them by " +"their registered name." msgstr "" +#: ../../library/argparse.rst:862 msgid "An example of a custom action::" msgstr "" +#: ../../library/argparse.rst:864 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -798,18 +1277,30 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" +#: ../../library/argparse.rst:882 msgid "For more details, see :class:`Action`." msgstr "" +#: ../../library/argparse.rst:888 msgid "nargs" msgstr "" -msgid ":class:`ArgumentParser` objects usually associate a single command-line argument with a single action to be taken. The ``nargs`` keyword argument associates a different number of command-line arguments with a single action. See also :ref:`specifying-ambiguous-arguments`. The supported values are:" +#: ../../library/argparse.rst:890 +msgid "" +":class:`ArgumentParser` objects usually associate a single command-line " +"argument with a single action to be taken. The ``nargs`` keyword argument " +"associates a different number of command-line arguments with a single " +"action. See also :ref:`specifying-ambiguous-arguments`. The supported values " +"are:" msgstr "" -msgid "``N`` (an integer). ``N`` arguments from the command line will be gathered together into a list. For example::" +#: ../../library/argparse.rst:895 +msgid "" +"``N`` (an integer). ``N`` arguments from the command line will be gathered " +"together into a list. For example::" msgstr "" +#: ../../library/argparse.rst:898 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -818,12 +1309,23 @@ msgid "" "Namespace(bar=['c'], foo=['a', 'b'])" msgstr "" -msgid "Note that ``nargs=1`` produces a list of one item. This is different from the default, in which the item is produced by itself." +#: ../../library/argparse.rst:904 +msgid "" +"Note that ``nargs=1`` produces a list of one item. This is different from " +"the default, in which the item is produced by itself." msgstr "" -msgid "``'?'``. One argument will be consumed from the command line if possible, and produced as a single item. If no command-line argument is present, the value from default_ will be produced. Note that for optional arguments, there is an additional case - the option string is present but not followed by a command-line argument. In this case the value from const_ will be produced. Some examples to illustrate this::" +#: ../../library/argparse.rst:909 +msgid "" +"``'?'``. One argument will be consumed from the command line if possible, " +"and produced as a single item. If no command-line argument is present, the " +"value from default_ will be produced. Note that for optional arguments, " +"there is an additional case - the option string is present but not followed " +"by a command-line argument. In this case the value from const_ will be " +"produced. Some examples to illustrate this::" msgstr "" +#: ../../library/argparse.rst:916 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -836,9 +1338,13 @@ msgid "" "Namespace(bar='d', foo='d')" msgstr "" -msgid "One of the more common uses of ``nargs='?'`` is to allow optional input and output files::" +#: ../../library/argparse.rst:926 +msgid "" +"One of the more common uses of ``nargs='?'`` is to allow optional input and " +"output files::" msgstr "" +#: ../../library/argparse.rst:929 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?')\n" @@ -851,9 +1357,15 @@ msgid "" "Namespace(infile=None, outfile=None)" msgstr "" -msgid "``'*'``. All command-line arguments present are gathered into a list. Note that it generally doesn't make much sense to have more than one positional argument with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is possible. For example::" +#: ../../library/argparse.rst:941 +msgid "" +"``'*'``. All command-line arguments present are gathered into a list. Note " +"that it generally doesn't make much sense to have more than one positional " +"argument with ``nargs='*'``, but multiple optional arguments with " +"``nargs='*'`` is possible. For example::" msgstr "" +#: ../../library/argparse.rst:946 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -863,9 +1375,14 @@ msgid "" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" msgstr "" -msgid "``'+'``. Just like ``'*'``, all command-line arguments present are gathered into a list. Additionally, an error message will be generated if there wasn't at least one command-line argument present. For example::" +#: ../../library/argparse.rst:955 +msgid "" +"``'+'``. Just like ``'*'``, all command-line arguments present are gathered " +"into a list. Additionally, an error message will be generated if there " +"wasn't at least one command-line argument present. For example::" msgstr "" +#: ../../library/argparse.rst:959 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -876,30 +1393,69 @@ msgid "" "PROG: error: the following arguments are required: foo" msgstr "" -msgid "If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument will be consumed and a single item (not a list) will be produced. Actions that do not consume command-line arguments (e.g. ``'store_const'``) set ``nargs=0``." +#: ../../library/argparse.rst:967 +msgid "" +"If the ``nargs`` keyword argument is not provided, the number of arguments " +"consumed is determined by the action_. Generally this means a single " +"command-line argument will be consumed and a single item (not a list) will " +"be produced. Actions that do not consume command-line arguments (e.g. " +"``'store_const'``) set ``nargs=0``." msgstr "" +#: ../../library/argparse.rst:977 msgid "const" msgstr "" -msgid "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to hold constant values that are not read from the command line but are required for the various :class:`ArgumentParser` actions. The two most common uses of it are:" +#: ../../library/argparse.rst:979 +msgid "" +"The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " +"hold constant values that are not read from the command line but are " +"required for the various :class:`ArgumentParser` actions. The two most " +"common uses of it are:" msgstr "" -msgid "When :meth:`~ArgumentParser.add_argument` is called with ``action='store_const'`` or ``action='append_const'``. These actions add the ``const`` value to one of the attributes of the object returned by :meth:`~ArgumentParser.parse_args`. See the action_ description for examples. If ``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will receive a default value of ``None``." +#: ../../library/argparse.rst:983 +msgid "" +"When :meth:`~ArgumentParser.add_argument` is called with " +"``action='store_const'`` or ``action='append_const'``. These actions add " +"the ``const`` value to one of the attributes of the object returned " +"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " +"examples. If ``const`` is not provided " +"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " +"``None``." msgstr "" -msgid "When :meth:`~ArgumentParser.add_argument` is called with option strings (like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional argument that can be followed by zero or one command-line arguments. When parsing the command line, if the option string is encountered with no command-line argument following it, the value from ``const`` will be used. See the nargs_ description for examples." +#: ../../library/argparse.rst:991 +msgid "" +"When :meth:`~ArgumentParser.add_argument` is called with option strings " +"(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " +"argument that can be followed by zero or one command-line arguments. When " +"parsing the command line, if the option string is encountered with no " +"command-line argument following it, the value from ``const`` will be used. " +"See the nargs_ description for examples." msgstr "" -msgid "``const=None`` by default, including when ``action='append_const'`` or ``action='store_const'``." +#: ../../library/argparse.rst:998 +msgid "" +"``const=None`` by default, including when ``action='append_const'`` or " +"``action='store_const'``." msgstr "" +#: ../../library/argparse.rst:1005 msgid "default" msgstr "" -msgid "All optional arguments and some positional arguments may be omitted at the command line. The ``default`` keyword argument of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, specifies what value should be used if the command-line argument is not present. For optional arguments, the ``default`` value is used when the option string was not present at the command line::" +#: ../../library/argparse.rst:1007 +msgid "" +"All optional arguments and some positional arguments may be omitted at the " +"command line. The ``default`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " +"specifies what value should be used if the command-line argument is not " +"present. For optional arguments, the ``default`` value is used when the " +"option string was not present at the command line::" msgstr "" +#: ../../library/argparse.rst:1014 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -909,9 +1465,13 @@ msgid "" "Namespace(foo=42)" msgstr "" -msgid "If the target namespace already has an attribute set, the action *default* will not overwrite it::" +#: ../../library/argparse.rst:1021 +msgid "" +"If the target namespace already has an attribute set, the action *default* " +"will not overwrite it::" msgstr "" +#: ../../library/argparse.rst:1024 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -919,9 +1479,16 @@ msgid "" "Namespace(foo=101)" msgstr "" -msgid "If the ``default`` value is a string, the parser parses the value as if it were a command-line argument. In particular, the parser applies any type_ conversion argument, if provided, before setting the attribute on the :class:`Namespace` return value. Otherwise, the parser uses the value as is::" +#: ../../library/argparse.rst:1029 +msgid "" +"If the ``default`` value is a string, the parser parses the value as if it " +"were a command-line argument. In particular, the parser applies any type_ " +"conversion argument, if provided, before setting the attribute on " +"the :class:`Namespace` return value. Otherwise, the parser uses the value " +"as is::" msgstr "" +#: ../../library/argparse.rst:1034 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -930,9 +1497,13 @@ msgid "" "Namespace(length=10, width=10.5)" msgstr "" -msgid "For positional arguments with nargs_ equal to ``?`` or ``*``, the ``default`` value is used when no command-line argument was present::" +#: ../../library/argparse.rst:1040 +msgid "" +"For positional arguments with nargs_ equal to ``?`` or ``*``, the " +"``default`` value is used when no command-line argument was present::" msgstr "" +#: ../../library/argparse.rst:1043 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -942,15 +1513,27 @@ msgid "" "Namespace(foo=42)" msgstr "" -msgid "Because ``nargs='*'`` gathers any supplied values into a list, an absent positional argument yields an empty list (``[]``). Only a non-``None`` *default* overrides this (so ``default=None`` still gives ``[]``)." +#: ../../library/argparse.rst:1050 +msgid "" +"Because ``nargs='*'`` gathers any supplied values into a list, an absent " +"positional argument yields an empty list (``[]``). Only a non-``None`` " +"*default* overrides this (so ``default=None`` still gives ``[]``)." msgstr "" -msgid "For required_ arguments, the ``default`` value is ignored. For example, this applies to positional arguments with nargs_ values other than ``?`` or ``*``, or optional arguments marked as ``required=True``." +#: ../../library/argparse.rst:1054 +msgid "" +"For required_ arguments, the ``default`` value is ignored. For example, this " +"applies to positional arguments with nargs_ values other than ``?`` or " +"``*``, or optional arguments marked as ``required=True``." msgstr "" -msgid "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if the command-line argument was not present::" +#: ../../library/argparse.rst:1058 +msgid "" +"Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " +"the command-line argument was not present::" msgstr "" +#: ../../library/argparse.rst:1061 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -960,21 +1543,39 @@ msgid "" "Namespace(foo='1')" msgstr "" +#: ../../library/argparse.rst:1072 msgid "type" msgstr "" -msgid "By default, the parser reads command-line arguments in as simple strings. However, quite often the command-line string should instead be interpreted as another type, such as a :class:`float` or :class:`int`. The ``type`` keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-checking and type conversions to be performed." +#: ../../library/argparse.rst:1074 +msgid "" +"By default, the parser reads command-line arguments in as simple strings. " +"However, quite often the command-line string should instead be interpreted " +"as another type, such as a :class:`float` or :class:`int`. The ``type`` " +"keyword for :meth:`~ArgumentParser.add_argument` allows any necessary type-" +"checking and type conversions to be performed." msgstr "" -msgid "If the type_ keyword is used with the default_ keyword, the type converter is only applied if the default is a string." +#: ../../library/argparse.rst:1080 +msgid "" +"If the type_ keyword is used with the default_ keyword, the type converter " +"is only applied if the default is a string." msgstr "" -msgid "The argument to ``type`` can be a callable that accepts a single string or the name of a registered type (see :meth:`~ArgumentParser.register`) If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:`ValueError`, the exception is caught and a nicely formatted error message is displayed. Other exception types are not handled." +#: ../../library/argparse.rst:1083 +msgid "" +"The argument to ``type`` can be a callable that accepts a single string or " +"the name of a registered type (see :meth:`~ArgumentParser.register`) If the " +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " +"or :exc:`ValueError`, the exception is caught and a nicely formatted error " +"message is displayed. Other exception types are not handled." msgstr "" +#: ../../library/argparse.rst:1089 msgid "Common built-in types and functions can be used as type converters:" msgstr "" +#: ../../library/argparse.rst:1091 msgid "" "import argparse\n" "import pathlib\n" @@ -987,9 +1588,11 @@ msgid "" "parser.add_argument('datapath', type=pathlib.Path)" msgstr "" +#: ../../library/argparse.rst:1103 msgid "User defined functions can be used as well:" msgstr "" +#: ../../library/argparse.rst:1105 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1000,9 +1603,14 @@ msgid "" "Namespace(short_title='\"the-tale-of-two-citi')" msgstr "" -msgid "The :func:`bool` function is not recommended as a type converter. All it does is convert empty strings to ``False`` and non-empty strings to ``True``. This is usually not what is desired::" +#: ../../library/argparse.rst:1115 +msgid "" +"The :func:`bool` function is not recommended as a type converter. All it " +"does is convert empty strings to ``False`` and non-empty strings to " +"``True``. This is usually not what is desired::" msgstr "" +#: ../../library/argparse.rst:1119 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> _ = parser.add_argument('--verbose', type=bool)\n" @@ -1010,27 +1618,58 @@ msgid "" "Namespace(verbose=True)" msgstr "" -msgid "See :class:`BooleanOptionalAction` or ``action='store_true'`` for common alternatives." +#: ../../library/argparse.rst:1124 +msgid "" +"See :class:`BooleanOptionalAction` or ``action='store_true'`` for common " +"alternatives." msgstr "" -msgid "In general, the ``type`` keyword is a convenience that should only be used for simple conversions that can only raise one of the three supported exceptions. Anything with more interesting error-handling or resource management should be done downstream after the arguments are parsed." +#: ../../library/argparse.rst:1127 +msgid "" +"In general, the ``type`` keyword is a convenience that should only be used " +"for simple conversions that can only raise one of the three supported " +"exceptions. Anything with more interesting error-handling or resource " +"management should be done downstream after the arguments are parsed." msgstr "" -msgid "For example, JSON or YAML conversions have complex error cases that require better reporting than can be given by the ``type`` keyword. A :exc:`~json.JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` exception would not be handled at all." +#: ../../library/argparse.rst:1132 +msgid "" +"For example, JSON or YAML conversions have complex error cases that require " +"better reporting than can be given by the ``type`` keyword. " +"A :exc:`~json.JSONDecodeError` would not be well formatted and " +"a :exc:`FileNotFoundError` exception would not be handled at all." msgstr "" -msgid "Even :class:`~argparse.FileType` has its limitations for use with the ``type`` keyword. If one argument uses :class:`~argparse.FileType` and then a subsequent argument fails, an error is reported but the file is not automatically closed. In this case, it would be better to wait until after the parser has run and then use the :keyword:`with`-statement to manage the files." +#: ../../library/argparse.rst:1137 +msgid "" +"Even :class:`~argparse.FileType` has its limitations for use with the " +"``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " +"a subsequent argument fails, an error is reported but the file is not " +"automatically closed. In this case, it would be better to wait until after " +"the parser has run and then use the :keyword:`with`-statement to manage the " +"files." msgstr "" -msgid "For type checkers that simply check against a fixed set of values, consider using the choices_ keyword instead." +#: ../../library/argparse.rst:1144 +msgid "" +"For type checkers that simply check against a fixed set of values, consider " +"using the choices_ keyword instead." msgstr "" +#: ../../library/argparse.rst:1151 msgid "choices" msgstr "" -msgid "Some command-line arguments should be selected from a restricted set of values. These can be handled by passing a sequence object as the *choices* keyword argument to :meth:`~ArgumentParser.add_argument`. When the command line is parsed, argument values will be checked, and an error message will be displayed if the argument was not one of the acceptable values::" +#: ../../library/argparse.rst:1153 +msgid "" +"Some command-line arguments should be selected from a restricted set of " +"values. These can be handled by passing a sequence object as the *choices* " +"keyword argument to :meth:`~ArgumentParser.add_argument`. When the command " +"line is parsed, argument values will be checked, and an error message will " +"be displayed if the argument was not one of the acceptable values::" msgstr "" +#: ../../library/argparse.rst:1159 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1042,27 +1681,53 @@ msgid "" "'paper', 'scissors')" msgstr "" -msgid "Any sequence can be passed as the *choices* value, so :class:`list` objects, :class:`tuple` objects, and custom sequences are all supported." +#: ../../library/argparse.rst:1168 +msgid "" +"Any sequence can be passed as the *choices* value, so :class:`list` " +"objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -msgid "Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages." +#: ../../library/argparse.rst:1171 +msgid "" +"Use of :class:`enum.Enum` is not recommended because it is difficult to " +"control its appearance in usage, help, and error messages." msgstr "" -msgid "Note that *choices* are checked after any type_ conversions have been performed, so objects in *choices* should match the type_ specified. This can make *choices* appear unfamiliar in usage, help, or error messages." +#: ../../library/argparse.rst:1174 +msgid "" +"Note that *choices* are checked after any type_ conversions have been " +"performed, so objects in *choices* should match the type_ specified. This " +"can make *choices* appear unfamiliar in usage, help, or error messages." msgstr "" -msgid "To keep *choices* user-friendly, consider a custom type wrapper that converts and formats values, or omit type_ and handle conversion in your application code." +#: ../../library/argparse.rst:1179 +msgid "" +"To keep *choices* user-friendly, consider a custom type wrapper that " +"converts and formats values, or omit type_ and handle conversion in your " +"application code." msgstr "" -msgid "Formatted choices override the default *metavar* which is normally derived from *dest*. This is usually what you want because the user never sees the *dest* parameter. If this display isn't desirable (perhaps because there are many choices), just specify an explicit metavar_." +#: ../../library/argparse.rst:1183 +msgid "" +"Formatted choices override the default *metavar* which is normally derived " +"from *dest*. This is usually what you want because the user never sees the " +"*dest* parameter. If this display isn't desirable (perhaps because there " +"are many choices), just specify an explicit metavar_." msgstr "" +#: ../../library/argparse.rst:1192 msgid "required" msgstr "" -msgid "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and ``--bar`` indicate *optional* arguments, which can always be omitted at the command line. To make an option *required*, ``True`` can be specified for the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" +#: ../../library/argparse.rst:1194 +msgid "" +"In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " +"``--bar`` indicate *optional* arguments, which can always be omitted at the " +"command line. To make an option *required*, ``True`` can be specified for " +"the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" +#: ../../library/argparse.rst:1199 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1073,21 +1738,41 @@ msgid "" ": error: the following arguments are required: --foo" msgstr "" -msgid "As the example shows, if an option is marked as ``required``, :meth:`~ArgumentParser.parse_args` will report an error if that option is not present at the command line." +#: ../../library/argparse.rst:1207 +msgid "" +"As the example shows, if an option is marked as " +"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " +"that option is not present at the command line." msgstr "" -msgid "Required options are generally considered bad form because users expect *options* to be *optional*, and thus they should be avoided when possible." +#: ../../library/argparse.rst:1213 +msgid "" +"Required options are generally considered bad form because users expect " +"*options* to be *optional*, and thus they should be avoided when possible." msgstr "" +#: ../../library/argparse.rst:1220 msgid "help" msgstr "" -msgid "The ``help`` value is a string containing a brief description of the argument. When a user requests help (usually by using ``-h`` or ``--help`` at the command line), these ``help`` descriptions will be displayed with each argument." +#: ../../library/argparse.rst:1222 +msgid "" +"The ``help`` value is a string containing a brief description of the " +"argument. When a user requests help (usually by using ``-h`` or ``--help`` " +"at the command line), these ``help`` descriptions will be displayed with " +"each argument." msgstr "" -msgid "The ``help`` strings can include various format specifiers to avoid repetition of things like the program name or the argument default_. The available specifiers include the program name, ``%(prog)s`` and most keyword arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%(type)s``, etc.::" +#: ../../library/argparse.rst:1227 +msgid "" +"The ``help`` strings can include various format specifiers to avoid " +"repetition of things like the program name or the argument default_. The " +"available specifiers include the program name, ``%(prog)s`` and most keyword " +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" +"(type)s``, etc.::" msgstr "" +#: ../../library/argparse.rst:1232 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1102,12 +1787,19 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -msgid "As the help string supports %-formatting, if you want a literal ``%`` to appear in the help string, you must escape it as ``%%``." +#: ../../library/argparse.rst:1244 +msgid "" +"As the help string supports %-formatting, if you want a literal ``%`` to " +"appear in the help string, you must escape it as ``%%``." msgstr "" -msgid ":mod:`!argparse` supports silencing the help entry for certain options, by setting the ``help`` value to ``argparse.SUPPRESS``::" +#: ../../library/argparse.rst:1247 +msgid "" +":mod:`!argparse` supports silencing the help entry for certain options, by " +"setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" +#: ../../library/argparse.rst:1250 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1118,12 +1810,23 @@ msgid "" " -h, --help show this help message and exit" msgstr "" +#: ../../library/argparse.rst:1262 msgid "metavar" msgstr "" -msgid "When :class:`ArgumentParser` generates help messages, it needs some way to refer to each expected argument. By default, :class:`!ArgumentParser` objects use the dest_ value as the \"name\" of each object. By default, for positional argument actions, the dest_ value is used directly, and for optional argument actions, the dest_ value is uppercased. So, a single positional argument with ``dest='bar'`` will be referred to as ``bar``. A single optional argument ``--foo`` that should be followed by a single command-line argument will be referred to as ``FOO``. An example::" +#: ../../library/argparse.rst:1264 +msgid "" +"When :class:`ArgumentParser` generates help messages, it needs some way to " +"refer to each expected argument. By default, :class:`!ArgumentParser` " +"objects use the dest_ value as the \"name\" of each object. By default, for " +"positional argument actions, the dest_ value is used directly, and for " +"optional argument actions, the dest_ value is uppercased. So, a single " +"positional argument with ``dest='bar'`` will be referred to as ``bar``. A " +"single optional argument ``--foo`` that should be followed by a single " +"command-line argument will be referred to as ``FOO``. An example::" msgstr "" +#: ../../library/argparse.rst:1273 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1141,9 +1844,11 @@ msgid "" " --foo FOO" msgstr "" +#: ../../library/argparse.rst:1288 msgid "An alternative name can be specified with ``metavar``::" msgstr "" +#: ../../library/argparse.rst:1290 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -1161,12 +1866,21 @@ msgid "" " --foo YYY" msgstr "" -msgid "Note that ``metavar`` only changes the *displayed* name - the name of the attribute on the :meth:`~ArgumentParser.parse_args` object is still determined by the dest_ value." +#: ../../library/argparse.rst:1305 +msgid "" +"Note that ``metavar`` only changes the *displayed* name - the name of the " +"attribute on the :meth:`~ArgumentParser.parse_args` object is still " +"determined by the dest_ value." msgstr "" -msgid "Different values of ``nargs`` may cause the metavar to be used multiple times. Providing a tuple to ``metavar`` specifies a different display for each of the arguments::" +#: ../../library/argparse.rst:1309 +msgid "" +"Different values of ``nargs`` may cause the metavar to be used multiple " +"times. Providing a tuple to ``metavar`` specifies a different display for " +"each of the arguments::" msgstr "" +#: ../../library/argparse.rst:1313 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -1180,12 +1894,21 @@ msgid "" " --foo bar baz" msgstr "" +#: ../../library/argparse.rst:1328 msgid "dest" msgstr "" -msgid "Most :class:`ArgumentParser` actions add some value as an attribute of the object returned by :meth:`~ArgumentParser.parse_args`. The name of this attribute is determined by the ``dest`` keyword argument of :meth:`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` is normally supplied as the first argument to :meth:`~ArgumentParser.add_argument`::" +#: ../../library/argparse.rst:1330 +msgid "" +"Most :class:`ArgumentParser` actions add some value as an attribute of the " +"object returned by :meth:`~ArgumentParser.parse_args`. The name of this " +"attribute is determined by the ``dest`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " +"``dest`` is normally supplied as the first argument " +"to :meth:`~ArgumentParser.add_argument`::" msgstr "" +#: ../../library/argparse.rst:1337 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -1193,9 +1916,19 @@ msgid "" "Namespace(bar='XXX')" msgstr "" -msgid "For optional argument actions, the value of ``dest`` is normally inferred from the option strings. :class:`ArgumentParser` generates the value of ``dest`` by taking the first long option string and stripping away the initial ``--`` string. If no long option strings were supplied, ``dest`` will be derived from the first short option string by stripping the initial ``-`` character. Any internal ``-`` characters will be converted to ``_`` characters to make sure the string is a valid attribute name. The examples below illustrate this behavior::" +#: ../../library/argparse.rst:1342 +msgid "" +"For optional argument actions, the value of ``dest`` is normally inferred " +"from the option strings. :class:`ArgumentParser` generates the value of " +"``dest`` by taking the first long option string and stripping away the " +"initial ``--`` string. If no long option strings were supplied, ``dest`` " +"will be derived from the first short option string by stripping the initial " +"``-`` character. Any internal ``-`` characters will be converted to ``_`` " +"characters to make sure the string is a valid attribute name. The examples " +"below illustrate this behavior::" msgstr "" +#: ../../library/argparse.rst:1351 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -1206,9 +1939,11 @@ msgid "" "Namespace(foo_bar='1', x='2')" msgstr "" +#: ../../library/argparse.rst:1359 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" +#: ../../library/argparse.rst:1361 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -1216,15 +1951,31 @@ msgid "" "Namespace(bar='XXX')" msgstr "" -msgid "Multiple arguments may share the same ``dest``. By default, the value from the last such argument given on the command line wins. Use ``action='append'`` to collect values from all of them into a list instead. For conflicting *option strings* rather than ``dest`` names, see conflict_handler_." +#: ../../library/argparse.rst:1366 +msgid "" +"Multiple arguments may share the same ``dest``. By default, the value from " +"the last such argument given on the command line wins. Use " +"``action='append'`` to collect values from all of them into a list instead. " +"For conflicting *option strings* rather than ``dest`` names, see " +"conflict_handler_." msgstr "" +#: ../../library/argparse.rst:1374 msgid "deprecated" msgstr "" -msgid "During a project's lifetime, some arguments may need to be removed from the command line. Before removing them, you should inform your users that the arguments are deprecated and will be removed. The ``deprecated`` keyword argument of :meth:`~ArgumentParser.add_argument`, which defaults to ``False``, specifies if the argument is deprecated and will be removed in the future. For arguments, if ``deprecated`` is ``True``, then a warning will be printed to :data:`sys.stderr` when the argument is used::" +#: ../../library/argparse.rst:1376 +msgid "" +"During a project's lifetime, some arguments may need to be removed from the " +"command line. Before removing them, you should inform your users that the " +"arguments are deprecated and will be removed. The ``deprecated`` keyword " +"argument of :meth:`~ArgumentParser.add_argument`, which defaults to " +"``False``, specifies if the argument is deprecated and will be removed in " +"the future. For arguments, if ``deprecated`` is ``True``, then a warning " +"will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" +#: ../../library/argparse.rst:1386 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -1236,42 +1987,92 @@ msgid "" "Namespace(legs=4)" msgstr "" +#: ../../library/argparse.rst:1399 msgid "Action classes" msgstr "" -msgid ":class:`!Action` classes implement the Action API, a callable which returns a callable which processes arguments from the command-line. Any object which follows this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser.add_argument`." +#: ../../library/argparse.rst:1401 +msgid "" +":class:`!Action` classes implement the Action API, a callable which returns " +"a callable which processes arguments from the command-line. Any object which " +"follows this API may be passed as the ``action`` parameter " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" -msgid ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent the information needed to parse a single argument from one or more strings from the command line. The :class:`!Action` class must accept the two positional arguments plus any keyword arguments passed to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." +#: ../../library/argparse.rst:1410 +msgid "" +":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " +"the information needed to parse a single argument from one or more strings " +"from the command line. The :class:`!Action` class must accept the two " +"positional arguments plus any keyword arguments passed " +"to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -msgid "Instances of :class:`!Action` (or return value of any callable to the ``action`` parameter) should have attributes :attr:`!dest`, :attr:`!option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!help`, etc. defined. The easiest way to ensure these attributes are defined is to call :meth:`!Action.__init__`." +#: ../../library/argparse.rst:1416 +msgid "" +"Instances of :class:`!Action` (or return value of any callable to the " +"``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" +"option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!" +"help`, etc. defined. The easiest way to ensure these attributes are defined " +"is to call :meth:`!Action.__init__`." msgstr "" -msgid ":class:`!Action` instances should be callable, so subclasses must override the :meth:`!__call__` method, which should accept four parameters:" +#: ../../library/argparse.rst:1424 +msgid "" +":class:`!Action` instances should be callable, so subclasses must override " +"the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -msgid "*parser* - The :class:`ArgumentParser` object which contains this action." +#: ../../library/argparse.rst:1427 +msgid "" +"*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -msgid "*namespace* - The :class:`Namespace` object that will be returned by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object using :func:`setattr`." +#: ../../library/argparse.rst:1429 +msgid "" +"*namespace* - The :class:`Namespace` object that will be returned " +"by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to " +"this object using :func:`setattr`." msgstr "" -msgid "*values* - The associated command-line arguments, with any type conversions applied. Type conversions are specified with the type_ keyword argument to :meth:`~ArgumentParser.add_argument`." +#: ../../library/argparse.rst:1433 +msgid "" +"*values* - The associated command-line arguments, with any type conversions " +"applied. Type conversions are specified with the type_ keyword argument " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" -msgid "*option_string* - The option string that was used to invoke this action. The ``option_string`` argument is optional, and will be absent if the action is associated with a positional argument." +#: ../../library/argparse.rst:1437 +msgid "" +"*option_string* - The option string that was used to invoke this action. The " +"``option_string`` argument is optional, and will be absent if the action is " +"associated with a positional argument." msgstr "" -msgid "The :meth:`!__call__` method may perform arbitrary actions, but will typically set attributes on the ``namespace`` based on ``dest`` and ``values``." +#: ../../library/argparse.rst:1441 +msgid "" +"The :meth:`!__call__` method may perform arbitrary actions, but will " +"typically set attributes on the ``namespace`` based on ``dest`` and " +"``values``." msgstr "" -msgid ":class:`!Action` subclasses can define a :meth:`!format_usage` method that takes no argument and return a string which will be used when printing the usage of the program. If such method is not provided, a sensible default will be used." +#: ../../library/argparse.rst:1446 +msgid "" +":class:`!Action` subclasses can define a :meth:`!format_usage` method that " +"takes no argument and return a string which will be used when printing the " +"usage of the program. If such method is not provided, a sensible default " +"will be used." msgstr "" -msgid "A subclass of :class:`Action` for handling boolean flags with positive and negative options. Adding a single argument such as ``--foo`` automatically creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and ``False`` respectively::" +#: ../../library/argparse.rst:1452 +msgid "" +"A subclass of :class:`Action` for handling boolean flags with positive and " +"negative options. Adding a single argument such as ``--foo`` automatically " +"creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and " +"``False`` respectively::" msgstr "" +#: ../../library/argparse.rst:1457 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1280,27 +2081,47 @@ msgid "" "Namespace(foo=False)" msgstr "" +#: ../../library/argparse.rst:1467 msgid "The parse_args() method" msgstr "" -msgid "Convert argument strings to objects and assign them as attributes of the namespace. Return the populated namespace." +#: ../../library/argparse.rst:1471 +msgid "" +"Convert argument strings to objects and assign them as attributes of the " +"namespace. Return the populated namespace." msgstr "" -msgid "Previous calls to :meth:`add_argument` determine exactly what objects are created and how they are assigned. See the documentation for :meth:`!add_argument` for details." +#: ../../library/argparse.rst:1474 +msgid "" +"Previous calls to :meth:`add_argument` determine exactly what objects are " +"created and how they are assigned. See the documentation for :meth:`!" +"add_argument` for details." msgstr "" -msgid "args_ - List of strings to parse. The default is taken from :data:`sys.argv`." +#: ../../library/argparse.rst:1478 +msgid "" +"args_ - List of strings to parse. The default is taken " +"from :data:`sys.argv`." msgstr "" -msgid "namespace_ - An object to take the attributes. The default is a new empty :class:`Namespace` object." +#: ../../library/argparse.rst:1481 +msgid "" +"namespace_ - An object to take the attributes. The default is a new " +"empty :class:`Namespace` object." msgstr "" +#: ../../library/argparse.rst:1486 msgid "Option value syntax" msgstr "" -msgid "The :meth:`~ArgumentParser.parse_args` method supports several ways of specifying the value of an option (if it takes one). In the simplest case, the option and its value are passed as two separate arguments::" +#: ../../library/argparse.rst:1488 +msgid "" +"The :meth:`~ArgumentParser.parse_args` method supports several ways of " +"specifying the value of an option (if it takes one). In the simplest case, " +"the option and its value are passed as two separate arguments::" msgstr "" +#: ../../library/argparse.rst:1492 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -1311,25 +2132,38 @@ msgid "" "Namespace(foo='FOO', x=None)" msgstr "" -msgid "For long options (options with names longer than a single character), the option and value can also be passed as a single command-line argument, using ``=`` to separate them::" +#: ../../library/argparse.rst:1500 +msgid "" +"For long options (options with names longer than a single character), the " +"option and value can also be passed as a single command-line argument, using " +"``=`` to separate them::" msgstr "" +#: ../../library/argparse.rst:1504 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" msgstr "" -msgid "For short options (options only one character long), the option and its value can be concatenated::" +#: ../../library/argparse.rst:1507 +msgid "" +"For short options (options only one character long), the option and its " +"value can be concatenated::" msgstr "" +#: ../../library/argparse.rst:1510 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" msgstr "" -msgid "Several short options can be joined together, using only a single ``-`` prefix, as long as only the last option (or none of them) requires a value::" +#: ../../library/argparse.rst:1513 +msgid "" +"Several short options can be joined together, using only a single ``-`` " +"prefix, as long as only the last option (or none of them) requires a value::" msgstr "" +#: ../../library/argparse.rst:1516 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -1339,12 +2173,19 @@ msgid "" "Namespace(x=True, y=True, z='Z')" msgstr "" +#: ../../library/argparse.rst:1525 msgid "Invalid arguments" msgstr "" -msgid "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks for a variety of errors, including ambiguous options, invalid types, invalid options, wrong number of positional arguments, etc. When it encounters such an error, it exits and prints the error along with a usage message::" +#: ../../library/argparse.rst:1527 +msgid "" +"While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " +"for a variety of errors, including ambiguous options, invalid types, invalid " +"options, wrong number of positional arguments, etc. When it encounters such " +"an error, it exits and prints the error along with a usage message::" msgstr "" +#: ../../library/argparse.rst:1532 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -1366,12 +2207,23 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" +#: ../../library/argparse.rst:1553 msgid "Arguments containing ``-``" msgstr "" -msgid "The :meth:`~ArgumentParser.parse_args` method attempts to give errors whenever the user has clearly made a mistake, but some situations are inherently ambiguous. For example, the command-line argument ``-1`` could either be an attempt to specify an option or an attempt to provide a positional argument. The :meth:`~ArgumentParser.parse_args` method is cautious here: positional arguments may only begin with ``-`` if they look like negative numbers and there are no options in the parser that look like negative numbers::" +#: ../../library/argparse.rst:1555 +msgid "" +"The :meth:`~ArgumentParser.parse_args` method attempts to give errors " +"whenever the user has clearly made a mistake, but some situations are " +"inherently ambiguous. For example, the command-line argument ``-1`` could " +"either be an attempt to specify an option or an attempt to provide a " +"positional argument. The :meth:`~ArgumentParser.parse_args` method is " +"cautious here: positional arguments may only begin with ``-`` if they look " +"like negative numbers and there are no options in the parser that look like " +"negative numbers::" msgstr "" +#: ../../library/argparse.rst:1563 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -1404,23 +2256,38 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -msgid "If you have positional arguments that must begin with ``-`` and don't look like negative numbers, you can insert the pseudo-argument ``'--'`` which tells :meth:`~ArgumentParser.parse_args` that everything after that is a positional argument::" +#: ../../library/argparse.rst:1593 +msgid "" +"If you have positional arguments that must begin with ``-`` and don't look " +"like negative numbers, you can insert the pseudo-argument ``'--'`` which " +"tells :meth:`~ArgumentParser.parse_args` that everything after that is a " +"positional argument::" msgstr "" +#: ../../library/argparse.rst:1598 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" msgstr "" -msgid "See also :ref:`the argparse howto on ambiguous arguments ` for more details." +#: ../../library/argparse.rst:1601 +msgid "" +"See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" +#: ../../library/argparse.rst:1607 msgid "Argument abbreviations (prefix matching)" msgstr "" -msgid "The :meth:`~ArgumentParser.parse_args` method :ref:`by default ` allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option)::" +#: ../../library/argparse.rst:1609 +msgid "" +"The :meth:`~ArgumentParser.parse_args` method :ref:`by default " +"` allows long options to be abbreviated to a prefix, if the " +"abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" +#: ../../library/argparse.rst:1613 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -1434,15 +2301,25 @@ msgid "" "PROG: error: ambiguous option: -ba could match -badger, -bacon" msgstr "" -msgid "An error is produced for arguments that could produce more than one options. This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." +#: ../../library/argparse.rst:1624 +msgid "" +"An error is produced for arguments that could produce more than one options. " +"This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" +#: ../../library/argparse.rst:1630 msgid "Beyond ``sys.argv``" msgstr "" -msgid "Sometimes it may be useful to have an :class:`ArgumentParser` parse arguments other than those of :data:`sys.argv`. This can be accomplished by passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is useful for testing at the interactive prompt::" +#: ../../library/argparse.rst:1632 +msgid "" +"Sometimes it may be useful to have an :class:`ArgumentParser` parse " +"arguments other than those of :data:`sys.argv`. This can be accomplished by " +"passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is " +"useful for testing at the interactive prompt::" msgstr "" +#: ../../library/argparse.rst:1637 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -1457,15 +2334,24 @@ msgid "" "Namespace(accumulate=, integers=[1, 2, 3, 4])" msgstr "" +#: ../../library/argparse.rst:1652 msgid "The Namespace object" msgstr "" -msgid "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create an object holding attributes and return it." +#: ../../library/argparse.rst:1656 +msgid "" +"Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " +"an object holding attributes and return it." msgstr "" -msgid "This class is deliberately simple, just an :class:`object` subclass with a readable string representation. If you prefer to have dict-like view of the attributes, you can use the standard Python idiom, :func:`vars`::" +#: ../../library/argparse.rst:1659 +msgid "" +"This class is deliberately simple, just an :class:`object` subclass with a " +"readable string representation. If you prefer to have dict-like view of the " +"attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" +#: ../../library/argparse.rst:1663 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1474,9 +2360,14 @@ msgid "" "{'foo': 'BAR'}" msgstr "" -msgid "It may also be useful to have an :class:`ArgumentParser` assign attributes to an already existing object, rather than a new :class:`Namespace` object. This can be achieved by specifying the ``namespace=`` keyword argument::" +#: ../../library/argparse.rst:1669 +msgid "" +"It may also be useful to have an :class:`ArgumentParser` assign attributes " +"to an already existing object, rather than a new :class:`Namespace` object. " +"This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" +#: ../../library/argparse.rst:1673 msgid "" ">>> class C:\n" "... pass\n" @@ -1489,48 +2380,93 @@ msgid "" "'BAR'" msgstr "" +#: ../../library/argparse.rst:1685 msgid "Other utilities" msgstr "" +#: ../../library/argparse.rst:1688 msgid "Subcommands" msgstr "" -msgid "Many programs split up their functionality into a number of subcommands, for example, the ``svn`` program can invoke subcommands like ``svn checkout``, ``svn update``, and ``svn commit``. Splitting up functionality this way can be a particularly good idea when a program performs several different functions which require different kinds of command-line arguments. :class:`ArgumentParser` supports the creation of such subcommands with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method is normally called with no arguments and returns a special action object. This object has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a command name and any :class:`!ArgumentParser` constructor arguments, and returns an :class:`!ArgumentParser` object that can be modified as usual." +#: ../../library/argparse.rst:1695 +msgid "" +"Many programs split up their functionality into a number of subcommands, for " +"example, the ``svn`` program can invoke subcommands like ``svn checkout``, " +"``svn update``, and ``svn commit``. Splitting up functionality this way can " +"be a particularly good idea when a program performs several different " +"functions which require different kinds of command-line " +"arguments. :class:`ArgumentParser` supports the creation of such subcommands " +"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " +"is normally called with no arguments and returns a special action object. " +"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " +"which takes a command name and any :class:`!ArgumentParser` constructor " +"arguments, and returns an :class:`!ArgumentParser` object that can be " +"modified as usual." msgstr "" +#: ../../library/argparse.rst:1707 msgid "Description of parameters:" msgstr "" -msgid "*title* - title for the sub-parser group in help output; by default \"subcommands\" if description is provided, otherwise uses title for positional arguments" +#: ../../library/argparse.rst:1709 +msgid "" +"*title* - title for the sub-parser group in help output; by default " +"\"subcommands\" if description is provided, otherwise uses title for " +"positional arguments" msgstr "" -msgid "*description* - description for the sub-parser group in help output, by default ``None``" +#: ../../library/argparse.rst:1713 +msgid "" +"*description* - description for the sub-parser group in help output, by " +"default ``None``" msgstr "" -msgid "*prog* - usage information that will be displayed with subcommand help, by default the name of the program and any positional arguments before the subparser argument" +#: ../../library/argparse.rst:1716 +msgid "" +"*prog* - usage information that will be displayed with subcommand help, by " +"default the name of the program and any positional arguments before the " +"subparser argument" msgstr "" -msgid "*parser_class* - class which will be used to create sub-parser instances, by default the class of the current parser (e.g. :class:`ArgumentParser`)" +#: ../../library/argparse.rst:1720 +msgid "" +"*parser_class* - class which will be used to create sub-parser instances, by " +"default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -msgid "action_ - the basic type of action to be taken when this argument is encountered at the command line" +#: ../../library/argparse.rst:1723 +msgid "" +"action_ - the basic type of action to be taken when this argument is " +"encountered at the command line" msgstr "" -msgid "dest_ - name of the attribute under which subcommand name will be stored; by default ``None`` and no value is stored" +#: ../../library/argparse.rst:1726 +msgid "" +"dest_ - name of the attribute under which subcommand name will be stored; by " +"default ``None`` and no value is stored" msgstr "" -msgid "required_ - Whether or not a subcommand must be provided, by default ``False`` (added in 3.7)" +#: ../../library/argparse.rst:1729 +msgid "" +"required_ - Whether or not a subcommand must be provided, by default " +"``False`` (added in 3.7)" msgstr "" +#: ../../library/argparse.rst:1732 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -msgid "metavar_ - string presenting available subcommands in help; by default it is ``None`` and presents subcommands in form {cmd1, cmd2, ..}" +#: ../../library/argparse.rst:1734 +msgid "" +"metavar_ - string presenting available subcommands in help; by default it is " +"``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" +#: ../../library/argparse.rst:1737 msgid "Some example usage::" msgstr "" +#: ../../library/argparse.rst:1739 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1543,7 +2479,8 @@ msgid "" ">>>\n" ">>> # create the parser for the \"b\" command\n" ">>> parser_b = subparsers.add_parser('b', help='b help')\n" -">>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz help')\n" +">>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz " +"help')\n" ">>>\n" ">>> # parse some argument lists\n" ">>> parser.parse_args(['a', '12'])\n" @@ -1552,15 +2489,34 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -msgid "Note that the object returned by :meth:`parse_args` will only contain attributes for the main parser and the subparser that was selected by the command line (and not any other subparsers). So in the example above, when the ``a`` command is specified, only the ``foo`` and ``bar`` attributes are present, and when the ``b`` command is specified, only the ``foo`` and ``baz`` attributes are present." +#: ../../library/argparse.rst:1758 +msgid "" +"Note that the object returned by :meth:`parse_args` will only contain " +"attributes for the main parser and the subparser that was selected by the " +"command line (and not any other subparsers). So in the example above, when " +"the ``a`` command is specified, only the ``foo`` and ``bar`` attributes are " +"present, and when the ``b`` command is specified, only the ``foo`` and " +"``baz`` attributes are present." msgstr "" -msgid "If a subparser defines an argument with the same ``dest`` as the parent parser, the two share a single namespace attribute, so the parent's value won't be retained. Users should give them distinct ``dest`` values to keep both." +#: ../../library/argparse.rst:1765 +msgid "" +"If a subparser defines an argument with the same ``dest`` as the parent " +"parser, the two share a single namespace attribute, so the parent's value " +"won't be retained. Users should give them distinct ``dest`` values to keep " +"both." msgstr "" -msgid "Similarly, when a help message is requested from a subparser, only the help for that particular parser will be printed. The help message will not include parent parser or sibling parser messages. (A help message for each subparser command, however, can be given by supplying the ``help=`` argument to :meth:`~_SubParsersAction.add_parser` as above.)" +#: ../../library/argparse.rst:1770 +msgid "" +"Similarly, when a help message is requested from a subparser, only the help " +"for that particular parser will be printed. The help message will not " +"include parent parser or sibling parser messages. (A help message for each " +"subparser command, however, can be given by supplying the ``help=`` argument " +"to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" +#: ../../library/argparse.rst:1778 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -1591,9 +2547,14 @@ msgid "" " --baz {X,Y,Z} baz help" msgstr "" -msgid "The :meth:`add_subparsers` method also supports ``title`` and ``description`` keyword arguments. When either is present, the subparser's commands will appear in their own group in the help output. For example::" +#: ../../library/argparse.rst:1806 +msgid "" +"The :meth:`add_subparsers` method also supports ``title`` and " +"``description`` keyword arguments. When either is present, the subparser's " +"commands will appear in their own group in the help output. For example::" msgstr "" +#: ../../library/argparse.rst:1810 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -1613,9 +2574,15 @@ msgid "" " {foo,bar} additional help" msgstr "" -msgid "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional *aliases* argument, which allows multiple strings to refer to the same subparser. This example, like ``svn``, aliases ``co`` as a shorthand for ``checkout``::" +#: ../../library/argparse.rst:1827 +msgid "" +"Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " +"*aliases* argument, which allows multiple strings to refer to the same " +"subparser. This example, like ``svn``, aliases ``co`` as a shorthand for " +"``checkout``::" msgstr "" +#: ../../library/argparse.rst:1832 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -1625,12 +2592,21 @@ msgid "" "Namespace(foo='bar')" msgstr "" -msgid ":meth:`~_SubParsersAction.add_parser` supports also an additional *deprecated* argument, which allows to deprecate the subparser." +#: ../../library/argparse.rst:1839 +msgid "" +":meth:`~_SubParsersAction.add_parser` supports also an additional " +"*deprecated* argument, which allows to deprecate the subparser." msgstr "" -msgid "One particularly effective way of handling subcommands is to combine the use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so that each subparser knows which Python function it should execute. For example::" +#: ../../library/argparse.rst:1853 +msgid "" +"One particularly effective way of handling subcommands is to combine the use " +"of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " +"that each subparser knows which Python function it should execute. For " +"example::" msgstr "" +#: ../../library/argparse.rst:1858 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -1665,9 +2641,17 @@ msgid "" "((XYZYX))" msgstr "" -msgid "This way, you can let :meth:`parse_args` do the job of calling the appropriate function after argument parsing is complete. Associating functions with actions like this is typically the easiest way to handle the different actions for each of your subparsers. However, if it is necessary to check the name of the subparser that was invoked, the ``dest`` keyword argument to the :meth:`add_subparsers` call will work::" +#: ../../library/argparse.rst:1890 +msgid "" +"This way, you can let :meth:`parse_args` do the job of calling the " +"appropriate function after argument parsing is complete. Associating " +"functions with actions like this is typically the easiest way to handle the " +"different actions for each of your subparsers. However, if it is necessary " +"to check the name of the subparser that was invoked, the ``dest`` keyword " +"argument to the :meth:`add_subparsers` call will work::" msgstr "" +#: ../../library/argparse.rst:1897 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -1679,29 +2663,48 @@ msgid "" "Namespace(subparser_name='2', y='frobble')" msgstr "" +#: ../../library/argparse.rst:1906 msgid "New *required* keyword-only parameter." msgstr "" -msgid "Subparser's *prog* is no longer affected by a custom usage message in the main parser." +#: ../../library/argparse.rst:1909 +msgid "" +"Subparser's *prog* is no longer affected by a custom usage message in the " +"main parser." msgstr "" +#: ../../library/argparse.rst:1915 msgid "FileType objects" msgstr "" -msgid "The :class:`FileType` factory creates objects that can be passed to the type argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:`FileType` objects as their type will open command-line arguments as files with the requested modes, buffer sizes, encodings and error handling (see the :func:`open` function for more details)::" +#: ../../library/argparse.rst:1919 +msgid "" +"The :class:`FileType` factory creates objects that can be passed to the type " +"argument of :meth:`ArgumentParser.add_argument`. Arguments that " +"have :class:`FileType` objects as their type will open command-line " +"arguments as files with the requested modes, buffer sizes, encodings and " +"error handling (see the :func:`open` function for more details)::" msgstr "" +#: ../../library/argparse.rst:1925 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" -">>> parser.add_argument('out', type=argparse.FileType('w', encoding='UTF-8'))\n" +">>> parser.add_argument('out', type=argparse.FileType('w', " +"encoding='UTF-8'))\n" ">>> parser.parse_args(['--raw', 'raw.dat', 'file.txt'])\n" -"Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=<_io.FileIO name='raw.dat' mode='wb'>)" +"Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " +"raw=<_io.FileIO name='raw.dat' mode='wb'>)" msgstr "" -msgid "FileType objects understand the pseudo-argument ``'-'`` and automatically convert this into :data:`sys.stdin` for readable :class:`FileType` objects and :data:`sys.stdout` for writable :class:`FileType` objects::" +#: ../../library/argparse.rst:1931 +msgid "" +"FileType objects understand the pseudo-argument ``'-'`` and automatically " +"convert this into :data:`sys.stdin` for readable :class:`FileType` objects " +"and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" +#: ../../library/argparse.rst:1935 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -1709,18 +2712,33 @@ msgid "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" msgstr "" -msgid "If one argument uses *FileType* and then a subsequent argument fails, an error is reported but the file is not automatically closed. This can also clobber the output files. In this case, it would be better to wait until after the parser has run and then use the :keyword:`with`-statement to manage the files." +#: ../../library/argparse.rst:1942 +msgid "" +"If one argument uses *FileType* and then a subsequent argument fails, an " +"error is reported but the file is not automatically closed. This can also " +"clobber the output files. In this case, it would be better to wait until " +"after the parser has run and then use the :keyword:`with`-statement to " +"manage the files." msgstr "" +#: ../../library/argparse.rst:1948 msgid "Added the *encoding* and *errors* parameters." msgstr "" +#: ../../library/argparse.rst:1955 msgid "Argument groups" msgstr "" -msgid "By default, :class:`ArgumentParser` groups command-line arguments into \"positional arguments\" and \"options\" when displaying help messages. When there is a better conceptual grouping of arguments than this default one, appropriate groups can be created using the :meth:`!add_argument_group` method::" +#: ../../library/argparse.rst:1960 +msgid "" +"By default, :class:`ArgumentParser` groups command-line arguments into " +"\"positional arguments\" and \"options\" when displaying help messages. When " +"there is a better conceptual grouping of arguments than this default one, " +"appropriate groups can be created using the :meth:`!add_argument_group` " +"method::" msgstr "" +#: ../../library/argparse.rst:1966 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -1734,9 +2752,18 @@ msgid "" " --foo FOO foo help" msgstr "" -msgid "The :meth:`add_argument_group` method returns an argument group object which has an :meth:`~ArgumentParser.add_argument` method just like a regular :class:`ArgumentParser`. When an argument is added to the group, the parser treats it just like a normal argument, but displays the argument in a separate group for help messages. The :meth:`!add_argument_group` method accepts *title* and *description* arguments which can be used to customize this display::" +#: ../../library/argparse.rst:1977 +msgid "" +"The :meth:`add_argument_group` method returns an argument group object which " +"has an :meth:`~ArgumentParser.add_argument` method just like a " +"regular :class:`ArgumentParser`. When an argument is added to the group, " +"the parser treats it just like a normal argument, but displays the argument " +"in a separate group for help messages. The :meth:`!add_argument_group` " +"method accepts *title* and *description* arguments which can be used to " +"customize this display::" msgstr "" +#: ../../library/argparse.rst:1985 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -1757,27 +2784,50 @@ msgid "" " --bar BAR bar help" msgstr "" -msgid "The optional, keyword-only parameters argument_default_ and conflict_handler_ allow for finer-grained control of the behavior of the argument group. These parameters have the same meaning as in the :class:`ArgumentParser` constructor, but apply specifically to the argument group rather than the entire parser." +#: ../../library/argparse.rst:2003 +msgid "" +"The optional, keyword-only parameters argument_default_ and " +"conflict_handler_ allow for finer-grained control of the behavior of the " +"argument group. These parameters have the same meaning as in " +"the :class:`ArgumentParser` constructor, but apply specifically to the " +"argument group rather than the entire parser." msgstr "" -msgid "Note that any arguments not in your user-defined groups will end up back in the usual \"positional arguments\" and \"optional arguments\" sections." +#: ../../library/argparse.rst:2008 +msgid "" +"Note that any arguments not in your user-defined groups will end up back in " +"the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -msgid "Within each argument group, arguments are displayed in help output in the order in which they are added." +#: ../../library/argparse.rst:2011 +msgid "" +"Within each argument group, arguments are displayed in help output in the " +"order in which they are added." msgstr "" -msgid "Calling :meth:`add_argument_group` on an argument group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance." +#: ../../library/argparse.rst:2014 +msgid "" +"Calling :meth:`add_argument_group` on an argument group now raises an " +"exception. This nesting was never supported, often failed to work correctly, " +"and was unintentionally exposed through inheritance." msgstr "" +#: ../../library/argparse.rst:2019 msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." msgstr "" +#: ../../library/argparse.rst:2025 msgid "Mutual exclusion" msgstr "" -msgid "Create a mutually exclusive group. :mod:`!argparse` will make sure that only one of the arguments in the mutually exclusive group was present on the command line::" +#: ../../library/argparse.rst:2029 +msgid "" +"Create a mutually exclusive group. :mod:`!argparse` will make sure that only " +"one of the arguments in the mutually exclusive group was present on the " +"command line::" msgstr "" +#: ../../library/argparse.rst:2033 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -1792,9 +2842,14 @@ msgid "" "PROG: error: argument --bar: not allowed with argument --foo" msgstr "" -msgid "The :meth:`add_mutually_exclusive_group` method also accepts a *required* argument, to indicate that at least one of the mutually exclusive arguments is required::" +#: ../../library/argparse.rst:2045 +msgid "" +"The :meth:`add_mutually_exclusive_group` method also accepts a *required* " +"argument, to indicate that at least one of the mutually exclusive arguments " +"is required::" msgstr "" +#: ../../library/argparse.rst:2049 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -1805,9 +2860,16 @@ msgid "" "PROG: error: one of the arguments --foo --bar is required" msgstr "" -msgid "Note that currently mutually exclusive argument groups do not support the *title* and *description* arguments of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive group can be added to an argument group that has a title and description. For example::" +#: ../../library/argparse.rst:2057 +msgid "" +"Note that currently mutually exclusive argument groups do not support the " +"*title* and *description* arguments " +"of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive " +"group can be added to an argument group that has a title and description. " +"For example::" msgstr "" +#: ../../library/argparse.rst:2063 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -1827,15 +2889,28 @@ msgid "" " --bar BAR bar help" msgstr "" -msgid "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` on a mutually exclusive group now raises an exception. This nesting was never supported, often failed to work correctly, and was unintentionally exposed through inheritance." +#: ../../library/argparse.rst:2080 +msgid "" +"Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " +"on a mutually exclusive group now raises an exception. This nesting was " +"never supported, often failed to work correctly, and was unintentionally " +"exposed through inheritance." msgstr "" +#: ../../library/argparse.rst:2088 msgid "Parser defaults" msgstr "" -msgid "Most of the time, the attributes of the object returned by :meth:`parse_args` will be fully determined by inspecting the command-line arguments and the argument actions. :meth:`set_defaults` allows some additional attributes that are determined without any inspection of the command line to be added::" +#: ../../library/argparse.rst:2092 +msgid "" +"Most of the time, the attributes of the object returned " +"by :meth:`parse_args` will be fully determined by inspecting the command-" +"line arguments and the argument actions. :meth:`set_defaults` allows some " +"additional attributes that are determined without any inspection of the " +"command line to be added::" msgstr "" +#: ../../library/argparse.rst:2098 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -1844,9 +2919,15 @@ msgid "" "Namespace(bar=42, baz='badger', foo=736)" msgstr "" -msgid "Note that defaults can be set at both the parser level using :meth:`set_defaults` and at the argument level using :meth:`add_argument`. If both are called for the same argument, the last default set for an argument is used::" +#: ../../library/argparse.rst:2104 +msgid "" +"Note that defaults can be set at both the parser level " +"using :meth:`set_defaults` and at the argument level " +"using :meth:`add_argument`. If both are called for the same argument, the " +"last default set for an argument is used::" msgstr "" +#: ../../library/argparse.rst:2108 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -1855,12 +2936,21 @@ msgid "" "Namespace(foo='spam')" msgstr "" -msgid "Parser-level defaults can be particularly useful when working with multiple parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an example of this type." +#: ../../library/argparse.rst:2114 +msgid "" +"Parser-level defaults can be particularly useful when working with multiple " +"parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " +"example of this type." msgstr "" -msgid "Get the default value for a namespace attribute, as set by either :meth:`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" +#: ../../library/argparse.rst:2120 +msgid "" +"Get the default value for a namespace attribute, as set by " +"either :meth:`~ArgumentParser.add_argument` or " +"by :meth:`~ArgumentParser.set_defaults`::" msgstr "" +#: ../../library/argparse.rst:2124 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -1868,36 +2958,70 @@ msgid "" "'badger'" msgstr "" +#: ../../library/argparse.rst:2131 msgid "Printing help" msgstr "" -msgid "In most typical applications, :meth:`~ArgumentParser.parse_args` will take care of formatting and printing any usage or error messages. However, several formatting methods are available:" +#: ../../library/argparse.rst:2133 +msgid "" +"In most typical applications, :meth:`~ArgumentParser.parse_args` will take " +"care of formatting and printing any usage or error messages. However, " +"several formatting methods are available:" msgstr "" -msgid "Print a brief description of how the :class:`ArgumentParser` should be invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is assumed." +#: ../../library/argparse.rst:2139 +msgid "" +"Print a brief description of how the :class:`ArgumentParser` should be " +"invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " +"assumed." msgstr "" -msgid "Print a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`. If *file* is ``None``, :data:`sys.stdout` is assumed." +#: ../../library/argparse.rst:2145 +msgid "" +"Print a help message, including the program usage and information about the " +"arguments registered with the :class:`ArgumentParser`. If *file* is " +"``None``, :data:`sys.stdout` is assumed." msgstr "" -msgid "There are also variants of these methods that simply return a string instead of printing it:" +#: ../../library/argparse.rst:2149 +msgid "" +"There are also variants of these methods that simply return a string instead " +"of printing it:" msgstr "" -msgid "Return a string containing a brief description of how the :class:`ArgumentParser` should be invoked on the command line." +#: ../../library/argparse.rst:2154 +msgid "" +"Return a string containing a brief description of how " +"the :class:`ArgumentParser` should be invoked on the command line." msgstr "" -msgid "Return a string containing a help message, including the program usage and information about the arguments registered with the :class:`ArgumentParser`." +#: ../../library/argparse.rst:2159 +msgid "" +"Return a string containing a help message, including the program usage and " +"information about the arguments registered with the :class:`ArgumentParser`." msgstr "" +#: ../../library/argparse.rst:2164 msgid "Partial parsing" msgstr "" -msgid "Sometimes a script only needs to handle a specific set of command-line arguments, leaving any unrecognized arguments for another script or program. In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be useful." +#: ../../library/argparse.rst:2168 +msgid "" +"Sometimes a script only needs to handle a specific set of command-line " +"arguments, leaving any unrecognized arguments for another script or program. " +"In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be " +"useful." msgstr "" -msgid "This method works similarly to :meth:`~ArgumentParser.parse_args`, but it does not raise an error for extra, unrecognized arguments. Instead, it parses the known arguments and returns a two item tuple that contains the populated namespace and the list of any unrecognized arguments." +#: ../../library/argparse.rst:2173 +msgid "" +"This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " +"does not raise an error for extra, unrecognized arguments. Instead, it " +"parses the known arguments and returns a two item tuple that contains the " +"populated namespace and the list of any unrecognized arguments." msgstr "" +#: ../../library/argparse.rst:2180 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1906,36 +3030,64 @@ msgid "" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" msgstr "" -msgid ":ref:`Prefix matching ` rules apply to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an option even if it's just a prefix of one of its known options, instead of leaving it in the remaining arguments list." +#: ../../library/argparse.rst:2187 +msgid "" +":ref:`Prefix matching ` rules apply " +"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " +"option even if it's just a prefix of one of its known options, instead of " +"leaving it in the remaining arguments list." msgstr "" +#: ../../library/argparse.rst:2194 msgid "Customizing file parsing" msgstr "" -msgid "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword argument to the :class:`ArgumentParser` constructor) are read one argument per line. :meth:`convert_arg_line_to_args` can be overridden for fancier reading." +#: ../../library/argparse.rst:2198 +msgid "" +"Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " +"argument to the :class:`ArgumentParser` constructor) are read one argument " +"per line. :meth:`convert_arg_line_to_args` can be overridden for fancier " +"reading." msgstr "" -msgid "This method takes a single argument *arg_line* which is a string read from the argument file. It returns a list of arguments parsed from this string. The method is called once per line read from the argument file, in order." +#: ../../library/argparse.rst:2203 +msgid "" +"This method takes a single argument *arg_line* which is a string read from " +"the argument file. It returns a list of arguments parsed from this string. " +"The method is called once per line read from the argument file, in order." msgstr "" -msgid "A useful override of this method is one that treats each space-separated word as an argument. The following example demonstrates how to do this::" +#: ../../library/argparse.rst:2207 +msgid "" +"A useful override of this method is one that treats each space-separated " +"word as an argument. The following example demonstrates how to do this::" msgstr "" +#: ../../library/argparse.rst:2210 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" msgstr "" -msgid "Note that with this override an argument can no longer contain spaces, since each space-separated word becomes a separate argument." +#: ../../library/argparse.rst:2214 +msgid "" +"Note that with this override an argument can no longer contain spaces, since " +"each space-separated word becomes a separate argument." msgstr "" +#: ../../library/argparse.rst:2219 msgid "Exiting methods" msgstr "" -msgid "This method terminates the program, exiting with the specified *status* and, if given, it prints a *message* to :data:`sys.stderr` before that. The user can override this method to handle these steps differently::" +#: ../../library/argparse.rst:2223 +msgid "" +"This method terminates the program, exiting with the specified *status* and, " +"if given, it prints a *message* to :data:`sys.stderr` before that. The user " +"can override this method to handle these steps differently::" msgstr "" +#: ../../library/argparse.rst:2227 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -1944,21 +3096,42 @@ msgid "" " exit(status)" msgstr "" -msgid "This method prints a usage message, including the *message*, to :data:`sys.stderr` and terminates the program with a status code of 2." +#: ../../library/argparse.rst:2235 +msgid "" +"This method prints a usage message, including the *message*, " +"to :data:`sys.stderr` and terminates the program with a status code of 2." msgstr "" +#: ../../library/argparse.rst:2240 msgid "Intermixed parsing" msgstr "" -msgid "A number of Unix commands allow the user to intermix optional arguments with positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` and :meth:`~ArgumentParser.parse_known_intermixed_args` methods support this parsing style." +#: ../../library/argparse.rst:2245 +msgid "" +"A number of Unix commands allow the user to intermix optional arguments with " +"positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " +"and :meth:`~ArgumentParser.parse_known_intermixed_args` methods support this " +"parsing style." msgstr "" -msgid "These parsers do not support all the :mod:`!argparse` features, and will raise exceptions if unsupported features are used. In particular, subparsers, and mutually exclusive groups that include both optionals and positionals are not supported." +#: ../../library/argparse.rst:2250 +msgid "" +"These parsers do not support all the :mod:`!argparse` features, and will " +"raise exceptions if unsupported features are used. In particular, " +"subparsers, and mutually exclusive groups that include both optionals and " +"positionals are not supported." msgstr "" -msgid "The following example shows the difference between :meth:`~ArgumentParser.parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns ``['2', '3']`` as unparsed arguments, while the latter collects all the positionals into ``rest``. ::" +#: ../../library/argparse.rst:2255 +msgid "" +"The following example shows the difference " +"between :meth:`~ArgumentParser.parse_known_args` " +"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " +"``['2', '3']`` as unparsed arguments, while the latter collects all the " +"positionals into ``rest``. ::" msgstr "" +#: ../../library/argparse.rst:2261 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1970,27 +3143,48 @@ msgid "" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" msgstr "" -msgid ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple containing the populated namespace and the list of remaining argument strings. :meth:`~ArgumentParser.parse_intermixed_args` raises an error if there are any remaining unparsed argument strings." +#: ../../library/argparse.rst:2270 +msgid "" +":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " +"containing the populated namespace and the list of remaining argument " +"strings. :meth:`~ArgumentParser.parse_intermixed_args` raises an error if " +"there are any remaining unparsed argument strings." msgstr "" +#: ../../library/argparse.rst:2279 msgid "Registering custom types or actions" msgstr "" -msgid "Sometimes it's desirable to use a custom string in error messages to provide more user-friendly output. In these cases, :meth:`!register` can be used to register custom actions or types with a parser and allow you to reference the type by their registered name instead of their callable name." +#: ../../library/argparse.rst:2283 +msgid "" +"Sometimes it's desirable to use a custom string in error messages to provide " +"more user-friendly output. In these cases, :meth:`!register` can be used to " +"register custom actions or types with a parser and allow you to reference " +"the type by their registered name instead of their callable name." msgstr "" -msgid "The :meth:`!register` method accepts three arguments - a *registry_name*, specifying the internal registry where the object will be stored (e.g., ``action``, ``type``), *value*, which is the key under which the object will be registered, and object, the callable to be registered." +#: ../../library/argparse.rst:2288 +msgid "" +"The :meth:`!register` method accepts three arguments - a *registry_name*, " +"specifying the internal registry where the object will be stored (e.g., " +"``action``, ``type``), *value*, which is the key under which the object will " +"be registered, and object, the callable to be registered." msgstr "" -msgid "The following example shows how to register a custom type with a parser::" +#: ../../library/argparse.rst:2293 +msgid "" +"The following example shows how to register a custom type with a parser::" msgstr "" +#: ../../library/argparse.rst:2295 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))\n" ">>> parser.add_argument('--foo', type='hexadecimal integer')\n" -"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, default=None, type='hexadecimal integer', choices=None, required=False, help=None, metavar=None, deprecated=False)\n" +"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, " +"default=None, type='hexadecimal integer', choices=None, required=False, " +"help=None, metavar=None, deprecated=False)\n" ">>> parser.parse_args(['--foo', '0xFA'])\n" "Namespace(foo=250)\n" ">>> parser.parse_args(['--foo', '1.2'])\n" @@ -1998,29 +3192,42 @@ msgid "" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" +#: ../../library/argparse.rst:2307 msgid "Exceptions" msgstr "" +#: ../../library/argparse.rst:2311 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -msgid "The string value of this exception is the message, augmented with information about the argument that caused it." +#: ../../library/argparse.rst:2313 +msgid "" +"The string value of this exception is the message, augmented with " +"information about the argument that caused it." msgstr "" -msgid "Raised when something goes wrong converting a command line string to a type." +#: ../../library/argparse.rst:2318 +msgid "" +"Raised when something goes wrong converting a command line string to a type." msgstr "" +#: ../../library/argparse.rst:2322 msgid "Guides and Tutorials" msgstr "" +#: ../../library/argparse.rst:907 msgid "? (question mark)" msgstr "" +#: ../../library/argparse.rst:907 ../../library/argparse.rst:939 +#: ../../library/argparse.rst:953 msgid "in argparse module" msgstr "" +#: ../../library/argparse.rst:939 msgid "* (asterisk)" msgstr "" +#: ../../library/argparse.rst:953 msgid "+ (plus)" msgstr "" diff --git a/library/array.po b/library/array.po index 5d3036113..12545779e 100644 --- a/library/array.po +++ b/library/array.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,255 +25,442 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/array.rst:2 msgid ":mod:`!array` --- Efficient arrays of numeric values" msgstr "" -msgid "This module defines an object type which can compactly represent an array of basic values: characters, integers, floating-point numbers. Arrays are mutable :term:`sequence` types and behave very much like lists, except that the type of objects stored in them is constrained. The type is specified at object creation time by using a :dfn:`type code`, which is a single character. The following type codes are defined:" +#: ../../library/array.rst:11 +msgid "" +"This module defines an object type which can compactly represent an array of " +"basic values: characters, integers, floating-point numbers. Arrays are " +"mutable :term:`sequence` types and behave very much like lists, except that " +"the type of objects stored in them is constrained. The type is specified at " +"object creation time by using a :dfn:`type code`, which is a single " +"character. The following type codes are defined:" msgstr "" +#: ../../library/array.rst:19 msgid "Type code" msgstr "" +#: ../../library/array.rst:19 msgid "C Type" msgstr "" +#: ../../library/array.rst:19 msgid "Python Type" msgstr "" +#: ../../library/array.rst:19 msgid "Minimum size in bytes" msgstr "" +#: ../../library/array.rst:19 msgid "Notes" msgstr "" +#: ../../library/array.rst:21 msgid "``'b'``" msgstr "" +#: ../../library/array.rst:21 msgid "signed char" msgstr "" +#: ../../library/array.rst:21 ../../library/array.rst:23 +#: ../../library/array.rst:29 ../../library/array.rst:31 +#: ../../library/array.rst:33 ../../library/array.rst:35 +#: ../../library/array.rst:37 ../../library/array.rst:39 +#: ../../library/array.rst:41 ../../library/array.rst:43 msgid "int" msgstr "" +#: ../../library/array.rst:21 ../../library/array.rst:23 msgid "1" msgstr "" +#: ../../library/array.rst:23 msgid "``'B'``" msgstr "" +#: ../../library/array.rst:23 msgid "unsigned char" msgstr "" +#: ../../library/array.rst:25 msgid "``'u'``" msgstr "" +#: ../../library/array.rst:25 msgid "wchar_t" msgstr "" +#: ../../library/array.rst:25 ../../library/array.rst:27 msgid "Unicode character" msgstr "" +#: ../../library/array.rst:25 ../../library/array.rst:29 +#: ../../library/array.rst:31 ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "2" msgstr "" +#: ../../library/array.rst:25 msgid "\\(1)" msgstr "" +#: ../../library/array.rst:27 msgid "``'w'``" msgstr "" +#: ../../library/array.rst:27 msgid "Py_UCS4" msgstr "" +#: ../../library/array.rst:27 ../../library/array.rst:37 +#: ../../library/array.rst:39 ../../library/array.rst:45 msgid "4" msgstr "" +#: ../../library/array.rst:27 msgid "\\(2)" msgstr "" +#: ../../library/array.rst:29 msgid "``'h'``" msgstr "" +#: ../../library/array.rst:29 msgid "signed short" msgstr "" +#: ../../library/array.rst:31 msgid "``'H'``" msgstr "" +#: ../../library/array.rst:31 msgid "unsigned short" msgstr "" +#: ../../library/array.rst:33 msgid "``'i'``" msgstr "" +#: ../../library/array.rst:33 msgid "signed int" msgstr "" +#: ../../library/array.rst:35 msgid "``'I'``" msgstr "" +#: ../../library/array.rst:35 msgid "unsigned int" msgstr "" +#: ../../library/array.rst:37 msgid "``'l'``" msgstr "" +#: ../../library/array.rst:37 msgid "signed long" msgstr "" +#: ../../library/array.rst:39 msgid "``'L'``" msgstr "" +#: ../../library/array.rst:39 msgid "unsigned long" msgstr "" +#: ../../library/array.rst:41 msgid "``'q'``" msgstr "" +#: ../../library/array.rst:41 msgid "signed long long" msgstr "" +#: ../../library/array.rst:41 ../../library/array.rst:43 +#: ../../library/array.rst:47 msgid "8" msgstr "" +#: ../../library/array.rst:43 msgid "``'Q'``" msgstr "" +#: ../../library/array.rst:43 msgid "unsigned long long" msgstr "" +#: ../../library/array.rst:45 msgid "``'f'``" msgstr "" +#: ../../library/array.rst:45 ../../library/array.rst:47 msgid "float" msgstr "" +#: ../../library/array.rst:47 msgid "``'d'``" msgstr "" +#: ../../library/array.rst:47 msgid "double" msgstr "" +#: ../../library/array.rst:50 msgid "Notes:" msgstr "" +#: ../../library/array.rst:53 msgid "It can be 16 bits or 32 bits depending on the platform." msgstr "" -msgid "``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated ``Py_UNICODE``. This change doesn't affect its behavior because ``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3." +#: ../../library/array.rst:55 +msgid "" +"``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated " +"``Py_UNICODE``. This change doesn't affect its behavior because " +"``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3." msgstr "" +#: ../../library/array.rst:60 msgid "Please migrate to ``'w'`` typecode." msgstr "" -msgid "The :ref:`ctypes ` and :ref:`struct ` modules, as well as third-party modules like `numpy `__, use similar -- but slightly different -- type codes." +#: ../../library/array.rst:68 +msgid "" +"The :ref:`ctypes ` and :ref:`struct ` modules, as well as third-party modules like `numpy `__, use similar -- but " +"slightly different -- type codes." msgstr "" -msgid "The actual representation of values is determined by the machine architecture (strictly speaking, by the C implementation). The actual size can be accessed through the :attr:`array.itemsize` attribute." +#: ../../library/array.rst:74 +msgid "" +"The actual representation of values is determined by the machine " +"architecture (strictly speaking, by the C implementation). The actual size " +"can be accessed through the :attr:`array.itemsize` attribute." msgstr "" +#: ../../library/array.rst:78 msgid "The module defines the following item:" msgstr "" +#: ../../library/array.rst:83 msgid "A string with all available type codes." msgstr "" +#: ../../library/array.rst:86 msgid "The module defines the following type:" msgstr "" -msgid "A new array whose items are restricted by *typecode*, and initialized from the optional *initializer* value, which must be a :class:`bytes` or :class:`bytearray` object, a Unicode string, or iterable over elements of the appropriate type." +#: ../../library/array.rst:91 +msgid "" +"A new array whose items are restricted by *typecode*, and initialized from " +"the optional *initializer* value, which must be a :class:`bytes` " +"or :class:`bytearray` object, a Unicode string, or iterable over elements of " +"the appropriate type." msgstr "" -msgid "If given a :class:`bytes` or :class:`bytearray` object, the initializer is passed to the new array's :meth:`frombytes` method; if given a Unicode string, the initializer is passed to the :meth:`fromunicode` method; otherwise, the initializer's iterator is passed to the :meth:`extend` method to add initial items to the array." +#: ../../library/array.rst:96 +msgid "" +"If given a :class:`bytes` or :class:`bytearray` object, the initializer is " +"passed to the new array's :meth:`frombytes` method; if given a Unicode " +"string, the initializer is passed to the :meth:`fromunicode` method; " +"otherwise, the initializer's iterator is passed to the :meth:`extend` method " +"to add initial items to the array." msgstr "" -msgid "Array objects support the ordinary :ref:`mutable ` :term:`sequence` operations of indexing, slicing, concatenation, and multiplication. When using slice assignment, the assigned value must be an array object with the same type code; in all other cases, :exc:`TypeError` is raised. Array objects also implement the buffer interface, and may be used wherever :term:`bytes-like objects ` are supported." +#: ../../library/array.rst:103 +msgid "" +"Array objects support the ordinary :ref:`mutable ` :term:`sequence` operations of indexing, slicing, concatenation, " +"and multiplication. When using slice assignment, the assigned value must be " +"an array object with the same type code; in all other " +"cases, :exc:`TypeError` is raised. Array objects also implement the buffer " +"interface, and may be used wherever :term:`bytes-like objects ` are supported." msgstr "" +#: ../../library/array.rst:109 msgid "Arrays are :ref:`generic ` over the type of their contents." msgstr "" -msgid "Raises an :ref:`auditing event ` ``array.__new__`` with arguments ``typecode``, ``initializer``." +#: ../../library/array.rst:111 +msgid "" +"Raises an :ref:`auditing event ` ``array.__new__`` with arguments " +"``typecode``, ``initializer``." msgstr "" +#: ../../library/array.rst:116 msgid "The typecode character used to create the array." msgstr "" +#: ../../library/array.rst:121 msgid "The length in bytes of one array item in the internal representation." msgstr "" +#: ../../library/array.rst:126 msgid "Append a new item with the specified value to the end of the array." msgstr "" -msgid "Return a tuple ``(address, length)`` giving the current memory address and the length in elements of the buffer used to hold array's contents. The size of the memory buffer in bytes can be computed as ``array.buffer_info()[1] * array.itemsize``. This is occasionally useful when working with low-level (and inherently unsafe) I/O interfaces that require memory addresses, such as certain :c:func:`!ioctl` operations. The returned numbers are valid as long as the array exists and no length-changing operations are applied to it." +#: ../../library/array.rst:131 +msgid "" +"Return a tuple ``(address, length)`` giving the current memory address and " +"the length in elements of the buffer used to hold array's contents. The " +"size of the memory buffer in bytes can be computed as ``array.buffer_info()" +"[1] * array.itemsize``. This is occasionally useful when working with low-" +"level (and inherently unsafe) I/O interfaces that require memory addresses, " +"such as certain :c:func:`!ioctl` operations. The returned numbers are valid " +"as long as the array exists and no length-changing operations are applied to " +"it." msgstr "" -msgid "When using array objects from code written in C or C++ (the only way to effectively make use of this information), it makes more sense to use the buffer interface supported by array objects. This method is maintained for backward compatibility and should be avoided in new code. The buffer interface is documented in :ref:`bufferobjects`." +#: ../../library/array.rst:141 +msgid "" +"When using array objects from code written in C or C++ (the only way to " +"effectively make use of this information), it makes more sense to use the " +"buffer interface supported by array objects. This method is maintained for " +"backward compatibility and should be avoided in new code. The buffer " +"interface is documented in :ref:`bufferobjects`." msgstr "" -msgid "\"Byteswap\" all items of the array. This is only supported for values which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:`RuntimeError` is raised. It is useful when reading data from a file written on a machine with a different byte order." +#: ../../library/array.rst:150 +msgid "" +"\"Byteswap\" all items of the array. This is only supported for values " +"which are 1, 2, 4, or 8 bytes in size; for other types of " +"values, :exc:`RuntimeError` is raised. It is useful when reading data from " +"a file written on a machine with a different byte order." msgstr "" +#: ../../library/array.rst:158 msgid "Return the number of occurrences of *value* in the array." msgstr "" -msgid "Append items from *iterable* to the end of the array. If *iterable* is another array, it must have *exactly* the same type code; if not, :exc:`TypeError` will be raised. If *iterable* is not an array, it must be iterable and its elements must be the right type to be appended to the array." +#: ../../library/array.rst:163 +msgid "" +"Append items from *iterable* to the end of the array. If *iterable* is " +"another array, it must have *exactly* the same type code; if " +"not, :exc:`TypeError` will be raised. If *iterable* is not an array, it " +"must be iterable and its elements must be the right type to be appended to " +"the array." msgstr "" -msgid "Appends items from the :term:`bytes-like object`, interpreting its content as an array of machine values (as if it had been read from a file using the :meth:`fromfile` method)." +#: ../../library/array.rst:171 +msgid "" +"Appends items from the :term:`bytes-like object`, interpreting its content " +"as an array of machine values (as if it had been read from a file using " +"the :meth:`fromfile` method)." msgstr "" +#: ../../library/array.rst:175 msgid ":meth:`!fromstring` is renamed to :meth:`frombytes` for clarity." msgstr "" -msgid "Read *n* items (as machine values) from the :term:`file object` *f* and append them to the end of the array. If less than *n* items are available, :exc:`EOFError` is raised, but the items that were available are still inserted into the array." +#: ../../library/array.rst:181 +msgid "" +"Read *n* items (as machine values) from the :term:`file object` *f* and " +"append them to the end of the array. If less than *n* items are " +"available, :exc:`EOFError` is raised, but the items that were available are " +"still inserted into the array." msgstr "" -msgid "Append items from the list. This is equivalent to ``for x in list: a.append(x)`` except that if there is a type error, the array is unchanged." +#: ../../library/array.rst:189 +msgid "" +"Append items from the list. This is equivalent to ``for x in list: " +"a.append(x)`` except that if there is a type error, the array is unchanged." msgstr "" -msgid "Extends this array with data from the given Unicode string. The array must have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of some other type." +#: ../../library/array.rst:195 +msgid "" +"Extends this array with data from the given Unicode string. The array must " +"have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " +"Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " +"an array of some other type." msgstr "" -msgid "Return the smallest *i* such that *i* is the index of the first occurrence of *value* in the array. The optional arguments *start* and *stop* can be specified to search for *value* within a subsection of the array. Raise :exc:`ValueError` if *value* is not found." +#: ../../library/array.rst:203 +msgid "" +"Return the smallest *i* such that *i* is the index of the first occurrence " +"of *value* in the array. The optional arguments *start* and *stop* can be " +"specified to search for *value* within a subsection of the array. " +"Raise :exc:`ValueError` if *value* is not found." msgstr "" +#: ../../library/array.rst:208 msgid "Added optional *start* and *stop* parameters." msgstr "" -msgid "Insert a new item *value* in the array before position *index*. Negative values are treated as being relative to the end of the array." +#: ../../library/array.rst:214 +msgid "" +"Insert a new item *value* in the array before position *index*. Negative " +"values are treated as being relative to the end of the array." msgstr "" -msgid "Removes the item with the index *i* from the array and returns it. The optional argument defaults to ``-1``, so that by default the last item is removed and returned." +#: ../../library/array.rst:220 +msgid "" +"Removes the item with the index *i* from the array and returns it. The " +"optional argument defaults to ``-1``, so that by default the last item is " +"removed and returned." msgstr "" +#: ../../library/array.rst:227 msgid "Remove the first occurrence of *value* from the array." msgstr "" +#: ../../library/array.rst:232 msgid "Remove all elements from the array." msgstr "" +#: ../../library/array.rst:239 msgid "Reverse the order of the items in the array." msgstr "" -msgid "Convert the array to an array of machine values and return the bytes representation (the same sequence of bytes that would be written to a file by the :meth:`tofile` method.)" +#: ../../library/array.rst:244 +msgid "" +"Convert the array to an array of machine values and return the bytes " +"representation (the same sequence of bytes that would be written to a file " +"by the :meth:`tofile` method.)" msgstr "" +#: ../../library/array.rst:248 msgid ":meth:`!tostring` is renamed to :meth:`tobytes` for clarity." msgstr "" +#: ../../library/array.rst:254 msgid "Write all items (as machine values) to the :term:`file object` *f*." msgstr "" +#: ../../library/array.rst:259 msgid "Convert the array to an ordinary list with the same items." msgstr "" -msgid "Convert the array to a Unicode string. The array must have a type ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of some other type." -msgstr "" - -msgid "The string representation of array objects has the form ``array(typecode, initializer)``. The *initializer* is omitted if the array is empty, otherwise it is a Unicode string if the *typecode* is ``'u'`` or ``'w'``, otherwise it is a list of numbers. The string representation is guaranteed to be able to be converted back to an array with the same type and value using :func:`eval`, so long as the :class:`~array.array` class has been imported using ``from array import array``. Variables ``inf`` and ``nan`` must also be defined if it contains corresponding floating-point values. Examples::" +#: ../../library/array.rst:264 +msgid "" +"Convert the array to a Unicode string. The array must have a type ``'u'`` " +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use " +"``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of " +"some other type." msgstr "" +#: ../../library/array.rst:269 +msgid "" +"The string representation of array objects has the form ``array(typecode, " +"initializer)``. The *initializer* is omitted if the array is empty, " +"otherwise it is a Unicode string if the *typecode* is ``'u'`` or ``'w'``, " +"otherwise it is a list of numbers. The string representation is guaranteed " +"to be able to be converted back to an array with the same type and value " +"using :func:`eval`, so long as the :class:`~array.array` class has been " +"imported using ``from array import array``. Variables ``inf`` and ``nan`` " +"must also be defined if it contains corresponding floating-point values. " +"Examples::" +msgstr "" + +#: ../../library/array.rst:281 msgid "" "array('l')\n" "array('w', 'hello \\u2641')\n" @@ -281,17 +468,22 @@ msgid "" "array('d', [1.0, 2.0, 3.14, -inf, nan])" msgstr "" +#: ../../library/array.rst:289 msgid "Module :mod:`struct`" msgstr "" +#: ../../library/array.rst:290 msgid "Packing and unpacking of heterogeneous binary data." msgstr "" +#: ../../library/array.rst:292 msgid "`NumPy `_" msgstr "" +#: ../../library/array.rst:293 msgid "The NumPy package defines another array type." msgstr "" +#: ../../library/array.rst:7 msgid "arrays" msgstr "" diff --git a/library/ast.po b/library/ast.po index 17c5727f9..740de4636 100644 --- a/library/ast.po +++ b/library/ast.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,112 +23,413 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/ast.rst:2 msgid ":mod:`!ast` --- Abstract syntax trees" msgstr "" +#: ../../library/ast.rst:14 msgid "**Source code:** :source:`Lib/ast.py`" msgstr "" -msgid "The :mod:`!ast` module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like." +#: ../../library/ast.rst:18 +msgid "" +"The :mod:`!ast` module helps Python applications to process trees of the " +"Python abstract syntax grammar. The abstract syntax itself might change " +"with each Python release; this module helps to find out programmatically " +"what the current grammar looks like." msgstr "" -msgid "An abstract syntax tree can be generated by passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using the :func:`parse` helper provided in this module. The result will be a tree of objects whose classes all inherit from :class:`ast.AST`. An abstract syntax tree can be compiled into a Python code object using the built-in :func:`compile` function." +#: ../../library/ast.rst:23 +msgid "" +"An abstract syntax tree can be generated by " +"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " +"function, or using the :func:`parse` helper provided in this module. The " +"result will be a tree of objects whose classes all inherit " +"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " +"Python code object using the built-in :func:`compile` function." msgstr "" +#: ../../library/ast.rst:33 msgid "Abstract grammar" msgstr "" +#: ../../library/ast.rst:35 msgid "The abstract grammar is currently defined as follows:" msgstr "" +#: ../../library/ast.rst:37 +msgid "" +"-- ASDL's 4 builtin types are:\n" +"-- identifier, int, string, constant\n" +"\n" +"module Python\n" +"{\n" +" mod = Module(stmt* body, type_ignore* type_ignores)\n" +" | Interactive(stmt* body)\n" +" | Expression(expr body)\n" +" | FunctionType(expr* argtypes, expr returns)\n" +"\n" +" stmt = FunctionDef(identifier name, arguments args,\n" +" stmt* body, expr* decorator_list, expr? returns,\n" +" string? type_comment, type_param* type_params)\n" +" | AsyncFunctionDef(identifier name, arguments args,\n" +" stmt* body, expr* decorator_list, expr? " +"returns,\n" +" string? type_comment, type_param* type_params)\n" +"\n" +" | ClassDef(identifier name,\n" +" expr* bases,\n" +" keyword* keywords,\n" +" stmt* body,\n" +" expr* decorator_list,\n" +" type_param* type_params)\n" +" | Return(expr? value)\n" +"\n" +" | Delete(expr* targets)\n" +" | Assign(expr* targets, expr value, string? type_comment)\n" +" | TypeAlias(expr name, type_param* type_params, expr value)\n" +" | AugAssign(expr target, operator op, expr value)\n" +" -- 'simple' indicates that we annotate simple name without parens\n" +" | AnnAssign(expr target, expr annotation, expr? value, int " +"simple)\n" +"\n" +" -- use 'orelse' because else is a keyword in target languages\n" +" | For(expr target, expr iter, stmt* body, stmt* orelse, string? " +"type_comment)\n" +" | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, " +"string? type_comment)\n" +" | While(expr test, stmt* body, stmt* orelse)\n" +" | If(expr test, stmt* body, stmt* orelse)\n" +" | With(withitem* items, stmt* body, string? type_comment)\n" +" | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" +"\n" +" | Match(expr subject, match_case* cases)\n" +"\n" +" | Raise(expr? exc, expr? cause)\n" +" | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* " +"finalbody)\n" +" | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* " +"finalbody)\n" +" | Assert(expr test, expr? msg)\n" +"\n" +" | Import(alias* names)\n" +" | ImportFrom(identifier? module, alias* names, int? level)\n" +"\n" +" | Global(identifier* names)\n" +" | Nonlocal(identifier* names)\n" +" | Expr(expr value)\n" +" | Pass | Break | Continue\n" +"\n" +" -- col_offset is the byte offset in the utf8 string the parser " +"uses\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" -- BoolOp() can use left & right?\n" +" expr = BoolOp(boolop op, expr* values)\n" +" | NamedExpr(expr target, expr value)\n" +" | BinOp(expr left, operator op, expr right)\n" +" | UnaryOp(unaryop op, expr operand)\n" +" | Lambda(arguments args, expr body)\n" +" | IfExp(expr test, expr body, expr orelse)\n" +" | Dict(expr?* keys, expr* values)\n" +" | Set(expr* elts)\n" +" | ListComp(expr elt, comprehension* generators)\n" +" | SetComp(expr elt, comprehension* generators)\n" +" | DictComp(expr key, expr value, comprehension* generators)\n" +" | GeneratorExp(expr elt, comprehension* generators)\n" +" -- the grammar constrains where yield expressions can occur\n" +" | Await(expr value)\n" +" | Yield(expr? value)\n" +" | YieldFrom(expr value)\n" +" -- need sequences for compare to distinguish between\n" +" -- x < 4 < 3 and (x < 4) < 3\n" +" | Compare(expr left, cmpop* ops, expr* comparators)\n" +" | Call(expr func, expr* args, keyword* keywords)\n" +" | FormattedValue(expr value, int conversion, expr? format_spec)\n" +" | Interpolation(expr value, constant str, int conversion, expr? " +"format_spec)\n" +" | JoinedStr(expr* values)\n" +" | TemplateStr(expr* values)\n" +" | Constant(constant value, string? kind)\n" +"\n" +" -- the following expression can appear in assignment context\n" +" | Attribute(expr value, identifier attr, expr_context ctx)\n" +" | Subscript(expr value, expr slice, expr_context ctx)\n" +" | Starred(expr value, expr_context ctx)\n" +" | Name(identifier id, expr_context ctx)\n" +" | List(expr* elts, expr_context ctx)\n" +" | Tuple(expr* elts, expr_context ctx)\n" +"\n" +" -- can appear only in Subscript\n" +" | Slice(expr? lower, expr? upper, expr? step)\n" +"\n" +" -- col_offset is the byte offset in the utf8 string the parser " +"uses\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" expr_context = Load | Store | Del\n" +"\n" +" boolop = And | Or\n" +"\n" +" operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift\n" +" | RShift | BitOr | BitXor | BitAnd | FloorDiv\n" +"\n" +" unaryop = Invert | Not | UAdd | USub\n" +"\n" +" cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn\n" +"\n" +" comprehension = (expr target, expr iter, expr* ifs, int is_async)\n" +"\n" +" excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)\n" +" attributes (int lineno, int col_offset, int? end_lineno, " +"int? end_col_offset)\n" +"\n" +" arguments = (arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs,\n" +" expr?* kw_defaults, arg? kwarg, expr* defaults)\n" +"\n" +" arg = (identifier arg, expr? annotation, string? type_comment)\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" -- keyword arguments supplied to call (NULL identifier for **kwargs)\n" +" keyword = (identifier? arg, expr value)\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" -- import name with optional 'as' alias.\n" +" alias = (identifier name, identifier? asname)\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" withitem = (expr context_expr, expr? optional_vars)\n" +"\n" +" match_case = (pattern pattern, expr? guard, stmt* body)\n" +"\n" +" pattern = MatchValue(expr value)\n" +" | MatchSingleton(constant value)\n" +" | MatchSequence(pattern* patterns)\n" +" | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n" +" | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, " +"pattern* kwd_patterns)\n" +"\n" +" | MatchStar(identifier? name)\n" +" -- The optional \"rest\" MatchMapping parameter handles " +"capturing extra mapping keys\n" +"\n" +" | MatchAs(pattern? pattern, identifier? name)\n" +" | MatchOr(pattern* patterns)\n" +"\n" +" attributes (int lineno, int col_offset, int end_lineno, int " +"end_col_offset)\n" +"\n" +" type_ignore = TypeIgnore(int lineno, string tag)\n" +"\n" +" type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n" +" | ParamSpec(identifier name, expr? default_value)\n" +" | TypeVarTuple(identifier name, expr? default_value)\n" +" attributes (int lineno, int col_offset, int end_lineno, int " +"end_col_offset)\n" +"}\n" +msgstr "" + +#: ../../library/ast.rst:42 msgid "Node classes" msgstr "" -msgid "This is the base of all AST node classes. The actual node classes are derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:`above `. They are defined in the :mod:`!_ast` C module and re-exported in :mod:`!ast`." +#: ../../library/ast.rst:46 +msgid "" +"This is the base of all AST node classes. The actual node classes are " +"derived from the :file:`Parser/Python.asdl` file, which is " +"reproduced :ref:`above `. They are defined in the :mod:`!" +"_ast` C module and re-exported in :mod:`!ast`." msgstr "" -msgid "There is one class defined for each left-hand side symbol in the abstract grammar (for example, :class:`ast.stmt` or :class:`ast.expr`). In addition, there is one class defined for each constructor on the right-hand side; these classes inherit from the classes for the left-hand side trees. For example, :class:`ast.BinOp` inherits from :class:`ast.expr`. For production rules with alternatives (aka \"sums\"), the left-hand side class is abstract: only instances of specific constructor nodes are ever created." +#: ../../library/ast.rst:51 +msgid "" +"There is one class defined for each left-hand side symbol in the abstract " +"grammar (for example, :class:`ast.stmt` or :class:`ast.expr`). In addition, " +"there is one class defined for each constructor on the right-hand side; " +"these classes inherit from the classes for the left-hand side trees. For " +"example, :class:`ast.BinOp` inherits from :class:`ast.expr`. For production " +"rules with alternatives (aka \"sums\"), the left-hand side class is " +"abstract: only instances of specific constructor nodes are ever created." msgstr "" -msgid "Each concrete class has an attribute :attr:`!_fields` which gives the names of all child nodes." +#: ../../library/ast.rst:64 +msgid "" +"Each concrete class has an attribute :attr:`!_fields` which gives the names " +"of all child nodes." msgstr "" -msgid "Each instance of a concrete class has one attribute for each child node, of the type as defined in the grammar. For example, :class:`ast.BinOp` instances have an attribute :attr:`left` of type :class:`ast.expr`." +#: ../../library/ast.rst:67 +msgid "" +"Each instance of a concrete class has one attribute for each child node, of " +"the type as defined in the grammar. For example, :class:`ast.BinOp` " +"instances have an attribute :attr:`left` of type :class:`ast.expr`." msgstr "" -msgid "If these attributes are marked as optional in the grammar (using a question mark), the value might be ``None``. If the attributes can have zero-or-more values (marked with an asterisk), the values are represented as Python lists. All possible attributes must be present and have valid values when compiling an AST with :func:`compile`." +#: ../../library/ast.rst:71 +msgid "" +"If these attributes are marked as optional in the grammar (using a question " +"mark), the value might be ``None``. If the attributes can have zero-or-more " +"values (marked with an asterisk), the values are represented as Python " +"lists. All possible attributes must be present and have valid values when " +"compiling an AST with :func:`compile`." msgstr "" -msgid "The :attr:`!_field_types` attribute on each concrete class is a dictionary mapping field names (as also listed in :attr:`_fields`) to their types." +#: ../../library/ast.rst:79 +msgid "" +"The :attr:`!_field_types` attribute on each concrete class is a dictionary " +"mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" +#: ../../library/ast.rst:82 msgid "" ">>> ast.TypeVar._field_types\n" -"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr | None}" +"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" msgstr "" -msgid "Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and last line numbers of source text span (1-indexed so the first line is line 1) and the :attr:`col_offset` and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the first and last tokens that generated the node. The UTF-8 offset is recorded because the parser uses UTF-8 internally." +#: ../../library/ast.rst:94 +msgid "" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " +"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " +"and :attr:`end_col_offset` attributes. The :attr:`lineno` " +"and :attr:`end_lineno` are the first and last line numbers of source text " +"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " +"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " +"first and last tokens that generated the node. The UTF-8 offset is recorded " +"because the parser uses UTF-8 internally." msgstr "" -msgid "Note that the end positions are not required by the compiler and are therefore optional. The end offset is *after* the last symbol, for example one can get the source segment of a one-line expression node using ``source_line[node.col_offset : node.end_col_offset]``." +#: ../../library/ast.rst:103 +msgid "" +"Note that the end positions are not required by the compiler and are " +"therefore optional. The end offset is *after* the last symbol, for example " +"one can get the source segment of a one-line expression node using " +"``source_line[node.col_offset : node.end_col_offset]``." msgstr "" -msgid "The constructor of a class :class:`ast.T` parses its arguments as follows:" +#: ../../library/ast.rst:108 +msgid "" +"The constructor of a class :class:`ast.T` parses its arguments as follows:" msgstr "" -msgid "If there are positional arguments, there must be as many as there are items in :attr:`T._fields`; they will be assigned as attributes of these names." +#: ../../library/ast.rst:110 +msgid "" +"If there are positional arguments, there must be as many as there are items " +"in :attr:`T._fields`; they will be assigned as attributes of these names." msgstr "" -msgid "If there are keyword arguments, they will set the attributes of the same names to the given values." +#: ../../library/ast.rst:112 +msgid "" +"If there are keyword arguments, they will set the attributes of the same " +"names to the given values." msgstr "" -msgid "For example, to create and populate an :class:`ast.UnaryOp` node, you could use ::" +#: ../../library/ast.rst:115 +msgid "" +"For example, to create and populate an :class:`ast.UnaryOp` node, you could " +"use ::" msgstr "" +#: ../../library/ast.rst:118 msgid "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" msgstr "" -msgid "If a field that is optional in the grammar is omitted from the constructor, it defaults to ``None``. If a list field is omitted, it defaults to the empty list. If a field of type :class:`!ast.expr_context` is omitted, it defaults to :class:`Load() `. If any other field is omitted, a :exc:`DeprecationWarning` is raised and the AST node will not have this field. In Python 3.15, this condition will raise an error." +#: ../../library/ast.rst:121 +msgid "" +"If a field that is optional in the grammar is omitted from the constructor, " +"it defaults to ``None``. If a list field is omitted, it defaults to the " +"empty list. If a field of type :class:`!ast.expr_context` is omitted, it " +"defaults to :class:`Load() `. If any other field is omitted, " +"a :exc:`DeprecationWarning` is raised and the AST node will not have this " +"field. In Python 3.15, this condition will raise an error." msgstr "" +#: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." msgstr "" -msgid "Simple indices are represented by their value, extended slices are represented as tuples." +#: ../../library/ast.rst:134 +msgid "" +"Simple indices are represented by their value, extended slices are " +"represented as tuples." msgstr "" -msgid "AST node constructors were changed to provide sensible defaults for omitted fields: optional fields now default to ``None``, list fields default to an empty list, and fields of type :class:`!ast.expr_context` default to :class:`Load() `. Previously, omitted attributes would not exist on constructed nodes (accessing them raised :exc:`AttributeError`)." +#: ../../library/ast.rst:139 +msgid "" +"AST node constructors were changed to provide sensible defaults for omitted " +"fields: optional fields now default to ``None``, list fields default to an " +"empty list, and fields of type :class:`!ast.expr_context` default " +"to :class:`Load() `. Previously, omitted attributes would not " +"exist on constructed nodes (accessing them raised :exc:`AttributeError`)." msgstr "" -msgid "The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the values of the node fields." +#: ../../library/ast.rst:147 +msgid "" +"The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the " +"values of the node fields." msgstr "" -msgid "Previous versions of Python provided the AST classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis`, which were deprecated in Python 3.8. These classes were removed in Python 3.14, and their functionality has been replaced with :class:`ast.Constant`." +#: ../../library/ast.rst:152 +msgid "" +"Previous versions of Python provided the AST classes :class:`!" +"ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :class:`!ast.NameConstant` " +"and :class:`!ast.Ellipsis`, which were deprecated in Python 3.8. These " +"classes were removed in Python 3.14, and their functionality has been " +"replaced with :class:`ast.Constant`." msgstr "" -msgid "Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still available, but they will be removed in future Python releases. In the meantime, instantiating them will return an instance of a different class." +#: ../../library/ast.rst:160 +msgid "" +"Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still " +"available, but they will be removed in future Python releases. In the " +"meantime, instantiating them will return an instance of a different class." msgstr "" -msgid "Previous versions of Python allowed the creation of AST nodes that were missing required fields. Similarly, AST node constructors allowed arbitrary keyword arguments that were set as attributes of the AST node, even if they did not match any of the fields of the AST node. This behavior is deprecated and will be removed in Python 3.15." +#: ../../library/ast.rst:167 +msgid "" +"Previous versions of Python allowed the creation of AST nodes that were " +"missing required fields. Similarly, AST node constructors allowed arbitrary " +"keyword arguments that were set as attributes of the AST node, even if they " +"did not match any of the fields of the AST node. This behavior is deprecated " +"and will be removed in Python 3.15." msgstr "" -msgid "The descriptions of the specific node classes displayed here were initially adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." +#: ../../library/ast.rst:174 +msgid "" +"The descriptions of the specific node classes displayed here were initially " +"adapted from the fantastic `Green Tree Snakes `__ project and all its " +"contributors." msgstr "" +#: ../../library/ast.rst:183 msgid "Root nodes" msgstr "" -msgid "A Python module, as with :ref:`file input `. Node type generated by :func:`ast.parse` in the default ``\"exec\"`` *mode*." +#: ../../library/ast.rst:187 +msgid "" +"A Python module, as with :ref:`file input `. Node type generated " +"by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" +#: ../../library/ast.rst:190 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." msgstr "" -msgid "``type_ignores`` is a :class:`list` of the module's type ignore comments; see :func:`ast.parse` for more details." +#: ../../library/ast.rst:192 +msgid "" +"``type_ignores`` is a :class:`list` of the module's type ignore comments; " +"see :func:`ast.parse` for more details." msgstr "" +#: ../../library/ast.rst:195 msgid "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -139,24 +440,36 @@ msgid "" " value=Constant(value=1))])" msgstr "" -msgid "A single Python :ref:`expression input `. Node type generated by :func:`ast.parse` when *mode* is ``\"eval\"``." +#: ../../library/ast.rst:208 +msgid "" +"A single Python :ref:`expression input `. Node type " +"generated by :func:`ast.parse` when *mode* is ``\"eval\"``." msgstr "" -msgid "``body`` is a single node, one of the :ref:`expression types `." +#: ../../library/ast.rst:211 +msgid "" +"``body`` is a single node, one of the :ref:`expression types `." msgstr "" +#: ../../library/ast.rst:214 msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" " body=Constant(value=123))" msgstr "" -msgid "A single :ref:`interactive input `, like in :ref:`tut-interac`. Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." +#: ../../library/ast.rst:223 +msgid "" +"A single :ref:`interactive input `, like in :ref:`tut-interac`. " +"Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." msgstr "" +#: ../../library/ast.rst:226 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" +#: ../../library/ast.rst:228 msgid "" ">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" "Interactive(\n" @@ -171,26 +484,37 @@ msgid "" " value=Constant(value=2))])" msgstr "" -msgid "A representation of an old-style type comments for functions, as Python versions prior to 3.5 didn't support :pep:`484` annotations. Node type generated by :func:`ast.parse` when *mode* is ``\"func_type\"``." +#: ../../library/ast.rst:245 +msgid "" +"A representation of an old-style type comments for functions, as Python " +"versions prior to 3.5 didn't support :pep:`484` annotations. Node type " +"generated by :func:`ast.parse` when *mode* is ``\"func_type\"``." msgstr "" +#: ../../library/ast.rst:249 msgid "Such type comments would look like this::" msgstr "" +#: ../../library/ast.rst:251 msgid "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" " return a + b" msgstr "" -msgid "``argtypes`` is a :class:`list` of :ref:`expression nodes `." +#: ../../library/ast.rst:255 +msgid "" +"``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" +#: ../../library/ast.rst:257 msgid "``returns`` is a single :ref:`expression node `." msgstr "" +#: ../../library/ast.rst:259 msgid "" -">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), indent=4))\n" +">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), " +"indent=4))\n" "FunctionType(\n" " argtypes=[\n" " Name(id='int', ctx=Load()),\n" @@ -201,15 +525,27 @@ msgid "" " ctx=Load()))" msgstr "" +#: ../../library/ast.rst:275 msgid "Literals" msgstr "" -msgid "A constant value. The ``value`` attribute of the ``Constant`` literal contains the Python object it represents. The values represented can be instances of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :class:`complex`, and :class:`bool`, and the constants :data:`None` and :data:`Ellipsis`." +#: ../../library/ast.rst:279 +msgid "" +"A constant value. The ``value`` attribute of the ``Constant`` literal " +"contains the Python object it represents. The values represented can be " +"instances " +"of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :class:`complex`, " +"and :class:`bool`, and the constants :data:`None` and :data:`Ellipsis`." msgstr "" -msgid "The ``kind`` attribute is an optional string. For string literals with a ``u`` prefix, ``kind`` is set to ``'u'``. For all other constants, ``kind`` is ``None``." +#: ../../library/ast.rst:284 +msgid "" +"The ``kind`` attribute is an optional string. For string literals with a " +"``u`` prefix, ``kind`` is set to ``'u'``. For all other constants, ``kind`` " +"is ``None``." msgstr "" +#: ../../library/ast.rst:288 msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" @@ -219,35 +555,56 @@ msgid "" " body=Constant(value='hello', kind='u'))" msgstr "" -msgid "Node representing a single formatting field in an f-string. If the string contains a single formatting field and nothing else the node can be isolated otherwise it appears in :class:`JoinedStr`." +#: ../../library/ast.rst:300 +msgid "" +"Node representing a single formatting field in an f-string. If the string " +"contains a single formatting field and nothing else the node can be isolated " +"otherwise it appears in :class:`JoinedStr`." msgstr "" -msgid "``value`` is any expression node (such as a literal, a variable, or a function call)." +#: ../../library/ast.rst:304 +msgid "" +"``value`` is any expression node (such as a literal, a variable, or a " +"function call)." msgstr "" +#: ../../library/ast.rst:306 ../../library/ast.rst:388 msgid "``conversion`` is an integer:" msgstr "" +#: ../../library/ast.rst:308 msgid "-1: no formatting" msgstr "" +#: ../../library/ast.rst:309 msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` formatting" msgstr "" +#: ../../library/ast.rst:310 msgid "114 (``ord('r')``): ``!r`` :func:`repr` formatting" msgstr "" +#: ../../library/ast.rst:311 msgid "115 (``ord('s')``): ``!s`` :func:`string ` formatting" msgstr "" -msgid "``format_spec`` is a :class:`JoinedStr` node representing the formatting of the value, or ``None`` if no format was specified. Both ``conversion`` and ``format_spec`` can be set at the same time." +#: ../../library/ast.rst:313 +msgid "" +"``format_spec`` is a :class:`JoinedStr` node representing the formatting of " +"the value, or ``None`` if no format was specified. Both ``conversion`` and " +"``format_spec`` can be set at the same time." msgstr "" -msgid "An f-string, comprising a series of :class:`FormattedValue` and :class:`Constant` nodes." +#: ../../library/ast.rst:320 +msgid "" +"An f-string, comprising a series of :class:`FormattedValue` " +"and :class:`Constant` nodes." msgstr "" +#: ../../library/ast.rst:323 msgid "" -">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), indent=4))\n" +">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " +"indent=4))\n" "Expression(\n" " body=JoinedStr(\n" " values=[\n" @@ -267,9 +624,14 @@ msgid "" " Constant(value='.3')]))]))" msgstr "" -msgid "Node representing a template string literal, comprising a series of :class:`Interpolation` and :class:`Constant` nodes. These nodes may be any order, and do not need to be interleaved." +#: ../../library/ast.rst:349 +msgid "" +"Node representing a template string literal, comprising a series " +"of :class:`Interpolation` and :class:`Constant` nodes. These nodes may be " +"any order, and do not need to be interleaved." msgstr "" +#: ../../library/ast.rst:353 msgid "" ">>> expr = ast.parse('t\"{name} finished {place:ordinal}\"', mode='eval')\n" ">>> print(ast.dump(expr, indent=4))\n" @@ -290,39 +652,65 @@ msgid "" " Constant(value='ordinal')]))]))" msgstr "" -msgid "Node representing a single interpolation field in a template string literal." +#: ../../library/ast.rst:377 +msgid "" +"Node representing a single interpolation field in a template string literal." msgstr "" -msgid "``value`` is any expression node (such as a literal, a variable, or a function call). This has the same meaning as ``FormattedValue.value``." +#: ../../library/ast.rst:379 +msgid "" +"``value`` is any expression node (such as a literal, a variable, or a " +"function call). This has the same meaning as ``FormattedValue.value``." msgstr "" -msgid "``str`` is a constant containing the text of the interpolation expression." +#: ../../library/ast.rst:382 +msgid "" +"``str`` is a constant containing the text of the interpolation expression." msgstr "" -msgid "If ``str`` is set to ``None``, then ``value`` is used to generate code when calling :func:`ast.unparse`. This no longer guarantees that the generated code is identical to the original and is intended for code generation." +#: ../../library/ast.rst:384 +msgid "" +"If ``str`` is set to ``None``, then ``value`` is used to generate code when " +"calling :func:`ast.unparse`. This no longer guarantees that the generated " +"code is identical to the original and is intended for code generation." msgstr "" +#: ../../library/ast.rst:390 msgid "-1: no conversion" msgstr "" +#: ../../library/ast.rst:391 msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" msgstr "" +#: ../../library/ast.rst:392 msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" msgstr "" +#: ../../library/ast.rst:393 msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" msgstr "" +#: ../../library/ast.rst:395 msgid "This has the same meaning as ``FormattedValue.conversion``." msgstr "" -msgid "``format_spec`` is a :class:`JoinedStr` node representing the formatting of the value, or ``None`` if no format was specified. Both ``conversion`` and ``format_spec`` can be set at the same time. This has the same meaning as ``FormattedValue.format_spec``." +#: ../../library/ast.rst:396 +msgid "" +"``format_spec`` is a :class:`JoinedStr` node representing the formatting of " +"the value, or ``None`` if no format was specified. Both ``conversion`` and " +"``format_spec`` can be set at the same time. This has the same meaning as " +"``FormattedValue.format_spec``." msgstr "" -msgid "A list or tuple. ``elts`` holds a list of nodes representing the elements. ``ctx`` is :class:`Store` if the container is an assignment target (i.e. ``(x,y)=something``), and :class:`Load` otherwise." +#: ../../library/ast.rst:405 +msgid "" +"A list or tuple. ``elts`` holds a list of nodes representing the elements. " +"``ctx`` is :class:`Store` if the container is an assignment target (i.e. " +"``(x,y)=something``), and :class:`Load` otherwise." msgstr "" +#: ../../library/ast.rst:409 msgid "" ">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -342,9 +730,11 @@ msgid "" " ctx=Load()))" msgstr "" +#: ../../library/ast.rst:431 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "" +#: ../../library/ast.rst:433 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -355,12 +745,21 @@ msgid "" " Constant(value=3)]))" msgstr "" -msgid "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the keys and the values respectively, in matching order (what would be returned when calling :code:`dictionary.keys()` and :code:`dictionary.values()`)." +#: ../../library/ast.rst:446 +msgid "" +"A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " +"keys and the values respectively, in matching order (what would be returned " +"when calling :code:`dictionary.keys()` and :code:`dictionary.values()`)." msgstr "" -msgid "When doing dictionary unpacking using dictionary literals the expression to be expanded goes in the ``values`` list, with a ``None`` at the corresponding position in ``keys``." +#: ../../library/ast.rst:450 +msgid "" +"When doing dictionary unpacking using dictionary literals the expression to " +"be expanded goes in the ``values`` list, with a ``None`` at the " +"corresponding position in ``keys``." msgstr "" +#: ../../library/ast.rst:454 msgid "" ">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" "Expression(\n" @@ -373,15 +772,24 @@ msgid "" " Name(id='d', ctx=Load())]))" msgstr "" +#: ../../library/ast.rst:468 msgid "Variables" msgstr "" -msgid "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of the following types." +#: ../../library/ast.rst:472 +msgid "" +"A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " +"the following types." msgstr "" -msgid "Variable references can be used to load the value of a variable, to assign a new value to it, or to delete it. Variable references are given a context to distinguish these cases." +#: ../../library/ast.rst:480 +msgid "" +"Variable references can be used to load the value of a variable, to assign a " +"new value to it, or to delete it. Variable references are given a context to " +"distinguish these cases." msgstr "" +#: ../../library/ast.rst:484 msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" @@ -405,9 +813,14 @@ msgid "" " Name(id='a', ctx=Del())])])" msgstr "" -msgid "A ``*var`` variable reference. ``value`` holds the variable, typically a :class:`Name` node. This type must be used when building a :class:`Call` node with ``*args``." +#: ../../library/ast.rst:510 +msgid "" +"A ``*var`` variable reference. ``value`` holds the variable, typically " +"a :class:`Name` node. This type must be used when building a :class:`Call` " +"node with ``*args``." msgstr "" +#: ../../library/ast.rst:514 msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -424,12 +837,20 @@ msgid "" " value=Name(id='it', ctx=Load()))])" msgstr "" +#: ../../library/ast.rst:534 msgid "Expressions" msgstr "" -msgid "When an expression, such as a function call, appears as a statement by itself with its return value not used or stored, it is wrapped in this container. ``value`` holds one of the other nodes in this section, a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:`YieldFrom` node." +#: ../../library/ast.rst:538 +msgid "" +"When an expression, such as a function call, appears as a statement by " +"itself with its return value not used or stored, it is wrapped in this " +"container. ``value`` holds one of the other nodes in this section, " +"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " +"or :class:`YieldFrom` node." msgstr "" +#: ../../library/ast.rst:543 msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -440,12 +861,19 @@ msgid "" " operand=Name(id='a', ctx=Load())))])" msgstr "" -msgid "A unary operation. ``op`` is the operator, and ``operand`` any expression node." +#: ../../library/ast.rst:556 +msgid "" +"A unary operation. ``op`` is the operator, and ``operand`` any expression " +"node." msgstr "" -msgid "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` is the ``~`` operator." +#: ../../library/ast.rst:565 +msgid "" +"Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " +"is the ``~`` operator." msgstr "" +#: ../../library/ast.rst:568 msgid "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" @@ -454,9 +882,13 @@ msgid "" " operand=Name(id='x', ctx=Load())))" msgstr "" -msgid "A binary operation (like addition or division). ``op`` is the operator, and ``left`` and ``right`` are any expression nodes." +#: ../../library/ast.rst:579 +msgid "" +"A binary operation (like addition or division). ``op`` is the operator, and " +"``left`` and ``right`` are any expression nodes." msgstr "" +#: ../../library/ast.rst:582 msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" @@ -466,15 +898,23 @@ msgid "" " right=Name(id='y', ctx=Load())))" msgstr "" +#: ../../library/ast.rst:606 msgid "Binary operator tokens." msgstr "" -msgid "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. ``values`` are the values involved. Consecutive operations with the same operator, such as ``a or b or c``, are collapsed into one node with several values." +#: ../../library/ast.rst:611 +msgid "" +"A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " +"``values`` are the values involved. Consecutive operations with the same " +"operator, such as ``a or b or c``, are collapsed into one node with several " +"values." msgstr "" +#: ../../library/ast.rst:616 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "" +#: ../../library/ast.rst:618 msgid "" ">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" "Expression(\n" @@ -485,12 +925,18 @@ msgid "" " Name(id='y', ctx=Load())]))" msgstr "" +#: ../../library/ast.rst:632 msgid "Boolean operator tokens." msgstr "" -msgid "A comparison of two or more values. ``left`` is the first value in the comparison, ``ops`` the list of operators, and ``comparators`` the list of values after the first element in the comparison." +#: ../../library/ast.rst:637 +msgid "" +"A comparison of two or more values. ``left`` is the first value in the " +"comparison, ``ops`` the list of operators, and ``comparators`` the list of " +"values after the first element in the comparison." msgstr "" +#: ../../library/ast.rst:641 msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" @@ -504,23 +950,36 @@ msgid "" " Constant(value=10)]))" msgstr "" +#: ../../library/ast.rst:666 msgid "Comparison operator tokens." msgstr "" -msgid "A function call. ``func`` is the function, which will often be a :class:`Name` or :class:`Attribute` object. Of the arguments:" +#: ../../library/ast.rst:671 +msgid "" +"A function call. ``func`` is the function, which will often be " +"a :class:`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" +#: ../../library/ast.rst:674 msgid "``args`` holds a list of the arguments passed by position." msgstr "" -msgid "``keywords`` holds a list of :class:`.keyword` objects representing arguments passed by keyword." +#: ../../library/ast.rst:675 +msgid "" +"``keywords`` holds a list of :class:`.keyword` objects representing " +"arguments passed by keyword." msgstr "" -msgid "The ``args`` and ``keywords`` arguments are optional and default to empty lists." +#: ../../library/ast.rst:678 +msgid "" +"The ``args`` and ``keywords`` arguments are optional and default to empty " +"lists." msgstr "" +#: ../../library/ast.rst:680 msgid "" -">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), indent=4))\n" +">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " +"indent=4))\n" "Expression(\n" " body=Call(\n" " func=Name(id='func', ctx=Load()),\n" @@ -537,12 +996,19 @@ msgid "" " value=Name(id='e', ctx=Load()))]))" msgstr "" -msgid "A keyword argument to a function call or class definition. ``arg`` is a raw string of the parameter name, ``value`` is a node to pass in." +#: ../../library/ast.rst:701 +msgid "" +"A keyword argument to a function call or class definition. ``arg`` is a raw " +"string of the parameter name, ``value`` is a node to pass in." msgstr "" -msgid "An expression such as ``a if b else c``. Each field holds a single node, so in the following example, all three are :class:`Name` nodes." +#: ../../library/ast.rst:707 +msgid "" +"An expression such as ``a if b else c``. Each field holds a single node, so " +"in the following example, all three are :class:`Name` nodes." msgstr "" +#: ../../library/ast.rst:710 msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" @@ -552,9 +1018,15 @@ msgid "" " orelse=Name(id='c', ctx=Load())))" msgstr "" -msgid "Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how the attribute is acted on." +#: ../../library/ast.rst:722 +msgid "" +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " +"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " +"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " +"how the attribute is acted on." msgstr "" +#: ../../library/ast.rst:727 msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" @@ -564,9 +1036,15 @@ msgid "" " ctx=Load()))" msgstr "" -msgid "A named expression. This AST node is produced by the assignment expressions operator (also known as the walrus operator). As opposed to the :class:`Assign` node in which the first argument can be multiple nodes, in this case both ``target`` and ``value`` must be single nodes." +#: ../../library/ast.rst:739 +msgid "" +"A named expression. This AST node is produced by the assignment expressions " +"operator (also known as the walrus operator). As opposed to " +"the :class:`Assign` node in which the first argument can be multiple nodes, " +"in this case both ``target`` and ``value`` must be single nodes." msgstr "" +#: ../../library/ast.rst:744 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -575,12 +1053,20 @@ msgid "" " value=Constant(value=4)))" msgstr "" +#: ../../library/ast.rst:755 msgid "Subscripting" msgstr "" -msgid "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually sequence or mapping). ``slice`` is an index, slice or key. It can be a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to the action performed with the subscript." +#: ../../library/ast.rst:759 +msgid "" +"A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " +"sequence or mapping). ``slice`` is an index, slice or key. It can be " +"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " +"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " +"performed with the subscript." msgstr "" +#: ../../library/ast.rst:765 msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -596,9 +1082,14 @@ msgid "" " ctx=Load()))" msgstr "" -msgid "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can occur only inside the *slice* field of :class:`Subscript`, either directly or as an element of :class:`Tuple`." +#: ../../library/ast.rst:783 +msgid "" +"Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " +"occur only inside the *slice* field of :class:`Subscript`, either directly " +"or as an element of :class:`Tuple`." msgstr "" +#: ../../library/ast.rst:787 msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" @@ -610,15 +1101,22 @@ msgid "" " ctx=Load()))" msgstr "" +#: ../../library/ast.rst:800 msgid "Comprehensions" msgstr "" -msgid "List and set comprehensions, generator expressions, and dictionary comprehensions. ``elt`` (or ``key`` and ``value``) is a single node representing the part that will be evaluated for each item." +#: ../../library/ast.rst:807 +msgid "" +"List and set comprehensions, generator expressions, and dictionary " +"comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " +"representing the part that will be evaluated for each item." msgstr "" +#: ../../library/ast.rst:811 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "" +#: ../../library/ast.rst:813 msgid "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" @@ -662,14 +1160,24 @@ msgid "" " is_async=0)]))" msgstr "" -msgid "One ``for`` clause in a comprehension. ``target`` is the reference to use for each element - typically a :class:`Name` or :class:`Tuple` node. ``iter`` is the object to iterate over. ``ifs`` is a list of test expressions: each ``for`` clause can have multiple ``ifs``." +#: ../../library/ast.rst:859 +msgid "" +"One ``for`` clause in a comprehension. ``target`` is the reference to use " +"for each element - typically a :class:`Name` or :class:`Tuple` node. " +"``iter`` is the object to iterate over. ``ifs`` is a list of test " +"expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -msgid "``is_async`` indicates a comprehension is asynchronous (using an ``async for`` instead of ``for``). The value is an integer (0 or 1)." +#: ../../library/ast.rst:864 +msgid "" +"``is_async`` indicates a comprehension is asynchronous (using an ``async " +"for`` instead of ``for``). The value is an integer (0 or 1)." msgstr "" +#: ../../library/ast.rst:867 msgid "" -">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', mode='eval'),\n" +">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " +"mode='eval'),\n" "... indent=4)) # Multiple comprehensions in one.\n" "Expression(\n" " body=ListComp(\n" @@ -687,7 +1195,8 @@ msgid "" " iter=Name(id='line', ctx=Load()),\n" " is_async=0)]))\n" "\n" -">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', mode='eval'),\n" +">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', " +"mode='eval'),\n" "... indent=4)) # generator comprehension\n" "Expression(\n" " body=GeneratorExp(\n" @@ -726,18 +1235,30 @@ msgid "" " is_async=1)]))" msgstr "" +#: ../../library/ast.rst:929 msgid "Statements" msgstr "" -msgid "An assignment. ``targets`` is a list of nodes, and ``value`` is a single node." +#: ../../library/ast.rst:933 +msgid "" +"An assignment. ``targets`` is a list of nodes, and ``value`` is a single " +"node." msgstr "" -msgid "Multiple nodes in ``targets`` represents assigning the same value to each. Unpacking is represented by putting a :class:`Tuple` or :class:`List` within ``targets``." +#: ../../library/ast.rst:935 +msgid "" +"Multiple nodes in ``targets`` represents assigning the same value to each. " +"Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " +"``targets``." msgstr "" -msgid "``type_comment`` is an optional string with the type annotation as a comment." +#: ../../library/ast.rst:941 ../../library/ast.rst:1236 +#: ../../library/ast.rst:1430 ../../library/ast.rst:1996 +msgid "" +"``type_comment`` is an optional string with the type annotation as a comment." msgstr "" +#: ../../library/ast.rst:943 msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -761,12 +1282,24 @@ msgid "" " value=Name(id='c', ctx=Load()))])" msgstr "" -msgid "An assignment with a type annotation. ``target`` is a single node and can be a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. ``annotation`` is the annotation, such as a :class:`Constant` or :class:`Name` node. ``value`` is a single optional node." +#: ../../library/ast.rst:969 +msgid "" +"An assignment with a type annotation. ``target`` is a single node and can be " +"a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " +"``annotation`` is the annotation, such as a :class:`Constant` " +"or :class:`Name` node. ``value`` is a single optional node." msgstr "" -msgid "``simple`` is always either 0 (indicating a \"complex\" target) or 1 (indicating a \"simple\" target). A \"simple\" target consists solely of a :class:`Name` node that does not appear between parentheses; all other targets are considered complex. Only simple targets appear in the :attr:`~object.__annotations__` dictionary of modules and classes." +#: ../../library/ast.rst:974 +msgid "" +"``simple`` is always either 0 (indicating a \"complex\" target) or 1 " +"(indicating a \"simple\" target). A \"simple\" target consists solely of " +"a :class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in " +"the :attr:`~object.__annotations__` dictionary of modules and classes." msgstr "" +#: ../../library/ast.rst:980 msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -776,7 +1309,8 @@ msgid "" " annotation=Name(id='int', ctx=Load()),\n" " simple=1)])\n" "\n" -">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with parenthesis\n" +">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with " +"parenthesis\n" "Module(\n" " body=[\n" " AnnAssign(\n" @@ -796,7 +1330,8 @@ msgid "" " annotation=Name(id='int', ctx=Load()),\n" " simple=0)])\n" "\n" -">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation\n" +">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript " +"annotation\n" "Module(\n" " body=[\n" " AnnAssign(\n" @@ -808,12 +1343,21 @@ msgid "" " simple=0)])" msgstr "" -msgid "Augmented assignment, such as ``a += 1``. In the following example, ``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` context), ``op`` is :class:`Add`, and ``value`` is a :class:`Constant` with value for 1." +#: ../../library/ast.rst:1024 +msgid "" +"Augmented assignment, such as ``a += 1``. In the following example, " +"``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " +"context), ``op`` is :class:`Add`, and ``value`` is a :class:`Constant` with " +"value for 1." msgstr "" -msgid "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, unlike the targets of :class:`Assign`." +#: ../../library/ast.rst:1029 +msgid "" +"The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " +"unlike the targets of :class:`Assign`." msgstr "" +#: ../../library/ast.rst:1032 msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -824,9 +1368,14 @@ msgid "" " value=Constant(value=2))])" msgstr "" -msgid "A ``raise`` statement. ``exc`` is the exception object to be raised, normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone ``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." +#: ../../library/ast.rst:1045 +msgid "" +"A ``raise`` statement. ``exc`` is the exception object to be raised, " +"normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " +"``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" +#: ../../library/ast.rst:1049 msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" @@ -836,9 +1385,13 @@ msgid "" " cause=Name(id='y', ctx=Load()))])" msgstr "" -msgid "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. ``msg`` holds the failure message." +#: ../../library/ast.rst:1061 +msgid "" +"An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " +"``msg`` holds the failure message." msgstr "" +#: ../../library/ast.rst:1064 msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" @@ -848,9 +1401,13 @@ msgid "" " msg=Name(id='y', ctx=Load()))])" msgstr "" -msgid "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +#: ../../library/ast.rst:1076 +msgid "" +"Represents a ``del`` statement. ``targets`` is a list of nodes, such " +"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" +#: ../../library/ast.rst:1079 msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -862,9 +1419,11 @@ msgid "" " Name(id='z', ctx=Del())])])" msgstr "" +#: ../../library/ast.rst:1093 msgid "A ``pass`` statement." msgstr "" +#: ../../library/ast.rst:1095 msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" @@ -872,9 +1431,15 @@ msgid "" " Pass()])" msgstr "" -msgid "A :ref:`type alias ` created through the :keyword:`type` statement. ``name`` is the name of the alias, ``type_params`` is a list of :ref:`type parameters `, and ``value`` is the value of the type alias." +#: ../../library/ast.rst:1105 +msgid "" +"A :ref:`type alias ` created through the :keyword:`type` " +"statement. ``name`` is the name of the alias, ``type_params`` is a list " +"of :ref:`type parameters `, and ``value`` is the value of " +"the type alias." msgstr "" +#: ../../library/ast.rst:1110 msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" @@ -884,15 +1449,21 @@ msgid "" " value=Name(id='int', ctx=Load()))])" msgstr "" -msgid "Other statements which are only applicable inside functions or loops are described in other sections." +#: ../../library/ast.rst:1121 +msgid "" +"Other statements which are only applicable inside functions or loops are " +"described in other sections." msgstr "" +#: ../../library/ast.rst:1125 msgid "Imports" msgstr "" +#: ../../library/ast.rst:1129 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "" +#: ../../library/ast.rst:1131 msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -904,9 +1475,15 @@ msgid "" " alias(name='z')])])" msgstr "" -msgid "Represents ``from x import y``. ``module`` is a raw string of the 'from' name, without any leading dots, or ``None`` for statements such as ``from . import foo``. ``level`` is an integer holding the level of the relative import (0 means absolute import)." +#: ../../library/ast.rst:1145 +msgid "" +"Represents ``from x import y``. ``module`` is a raw string of the 'from' " +"name, without any leading dots, or ``None`` for statements such as ``from . " +"import foo``. ``level`` is an integer holding the level of the relative " +"import (0 means absolute import)." msgstr "" +#: ../../library/ast.rst:1150 msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -920,9 +1497,13 @@ msgid "" " level=0)])" msgstr "" -msgid "Both parameters are raw strings of the names. ``asname`` can be ``None`` if the regular name is to be used." +#: ../../library/ast.rst:1166 +msgid "" +"Both parameters are raw strings of the names. ``asname`` can be ``None`` if " +"the regular name is to be used." msgstr "" +#: ../../library/ast.rst:1169 msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -935,18 +1516,30 @@ msgid "" " level=2)])" msgstr "" +#: ../../library/ast.rst:1182 msgid "Control flow" msgstr "" -msgid "Optional clauses such as ``else`` are stored as an empty list if they're not present." +#: ../../library/ast.rst:1185 +msgid "" +"Optional clauses such as ``else`` are stored as an empty list if they're not " +"present." msgstr "" -msgid "An ``if`` statement. ``test`` holds a single node, such as a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +#: ../../library/ast.rst:1190 +msgid "" +"An ``if`` statement. ``test`` holds a single node, such as " +"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" -msgid "``elif`` clauses don't have a special representation in the AST, but rather appear as extra :class:`If` nodes within the ``orelse`` section of the previous one." +#: ../../library/ast.rst:1193 +msgid "" +"``elif`` clauses don't have a special representation in the AST, but rather " +"appear as extra :class:`If` nodes within the ``orelse`` section of the " +"previous one." msgstr "" +#: ../../library/ast.rst:1197 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -974,9 +1567,17 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :class:`Subscript` node. ``iter`` holds the item to be looped over, again as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. Those in ``orelse`` are executed if the loop finishes normally, rather than via a ``break`` statement." +#: ../../library/ast.rst:1227 +msgid "" +"A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " +"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " +"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"Those in ``orelse`` are executed if the loop finishes normally, rather than " +"via a ``break`` statement." msgstr "" +#: ../../library/ast.rst:1238 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -997,9 +1598,13 @@ msgid "" " value=Constant(value=Ellipsis))])])" msgstr "" -msgid "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` node." +#: ../../library/ast.rst:1261 +msgid "" +"A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " +"node." msgstr "" +#: ../../library/ast.rst:1264 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -1019,9 +1624,11 @@ msgid "" " value=Constant(value=Ellipsis))])])" msgstr "" +#: ../../library/ast.rst:1287 msgid "The ``break`` and ``continue`` statements." msgstr "" +#: ../../library/ast.rst:1289 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -1050,9 +1657,13 @@ msgid "" " Continue()])])])" msgstr "" -msgid "``try`` blocks. All attributes are list of nodes to execute, except for ``handlers``, which is a list of :class:`ExceptHandler` nodes." +#: ../../library/ast.rst:1320 +msgid "" +"``try`` blocks. All attributes are list of nodes to execute, except for " +"``handlers``, which is a list of :class:`ExceptHandler` nodes." msgstr "" +#: ../../library/ast.rst:1323 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -1092,9 +1703,14 @@ msgid "" " value=Constant(value=Ellipsis))])])" msgstr "" -msgid "``try`` blocks which are followed by ``except*`` clauses. The attributes are the same as for :class:`Try` but the :class:`ExceptHandler` nodes in ``handlers`` are interpreted as ``except*`` blocks rather then ``except``." +#: ../../library/ast.rst:1365 +msgid "" +"``try`` blocks which are followed by ``except*`` clauses. The attributes are " +"the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " +"``handlers`` are interpreted as ``except*`` blocks rather than ``except``." msgstr "" +#: ../../library/ast.rst:1369 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -1116,9 +1732,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A single ``except`` clause. ``type`` is the exception type it will match, typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` clause). ``name`` is a raw string for the name to hold the exception, or ``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." +#: ../../library/ast.rst:1394 +msgid "" +"A single ``except`` clause. ``type`` is the exception type it will match, " +"typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " +"clause). ``name`` is a raw string for the name to hold the exception, or " +"``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" +#: ../../library/ast.rst:1399 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -1142,12 +1764,22 @@ msgid "" " Pass()])])])" msgstr "" -msgid "A ``with`` block. ``items`` is a list of :class:`withitem` nodes representing the context managers, and ``body`` is the indented block inside the context." +#: ../../library/ast.rst:1425 +msgid "" +"A ``with`` block. ``items`` is a list of :class:`withitem` nodes " +"representing the context managers, and ``body`` is the indented block inside " +"the context." msgstr "" -msgid "A single context manager in a ``with`` block. ``context_expr`` is the context manager, often a :class:`Call` node. ``optional_vars`` is a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` if that isn't used." +#: ../../library/ast.rst:1435 +msgid "" +"A single context manager in a ``with`` block. ``context_expr`` is the " +"context manager, often a :class:`Call` node. ``optional_vars`` is " +"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " +"``None`` if that isn't used." msgstr "" +#: ../../library/ast.rst:1440 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -1172,21 +1804,38 @@ msgid "" " Name(id='d', ctx=Load())]))])])" msgstr "" +#: ../../library/ast.rst:1466 msgid "Pattern matching" msgstr "" -msgid "A ``match`` statement. ``subject`` holds the subject of the match (the object that is being matched against the cases) and ``cases`` contains an iterable of :class:`match_case` nodes with the different cases." +#: ../../library/ast.rst:1471 +msgid "" +"A ``match`` statement. ``subject`` holds the subject of the match (the " +"object that is being matched against the cases) and ``cases`` contains an " +"iterable of :class:`match_case` nodes with the different cases." msgstr "" -msgid "A single case pattern in a ``match`` statement. ``pattern`` contains the match pattern that the subject will be matched against. Note that the :class:`AST` nodes produced for patterns differ from those produced for expressions, even when they share the same syntax." +#: ../../library/ast.rst:1479 +msgid "" +"A single case pattern in a ``match`` statement. ``pattern`` contains the " +"match pattern that the subject will be matched against. Note that " +"the :class:`AST` nodes produced for patterns differ from those produced for " +"expressions, even when they share the same syntax." msgstr "" -msgid "The ``guard`` attribute contains an expression that will be evaluated if the pattern matches the subject." +#: ../../library/ast.rst:1484 +msgid "" +"The ``guard`` attribute contains an expression that will be evaluated if the " +"pattern matches the subject." msgstr "" -msgid "``body`` contains a list of nodes to execute if the pattern matches and the result of evaluating the guard expression is true." +#: ../../library/ast.rst:1487 +msgid "" +"``body`` contains a list of nodes to execute if the pattern matches and the " +"result of evaluating the guard expression is true." msgstr "" +#: ../../library/ast.rst:1490 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1221,9 +1870,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match literal or value pattern that compares by equality. ``value`` is an expression node. Permitted value nodes are restricted as described in the match statement documentation. This pattern succeeds if the match subject is equal to the evaluated value." +#: ../../library/ast.rst:1528 +msgid "" +"A match literal or value pattern that compares by equality. ``value`` is an " +"expression node. Permitted value nodes are restricted as described in the " +"match statement documentation. This pattern succeeds if the match subject is " +"equal to the evaluated value." msgstr "" +#: ../../library/ast.rst:1533 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1243,9 +1898,14 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match literal pattern that compares by identity. ``value`` is the singleton to be compared against: ``None``, ``True``, or ``False``. This pattern succeeds if the match subject is the given constant." +#: ../../library/ast.rst:1556 +msgid "" +"A match literal pattern that compares by identity. ``value`` is the " +"singleton to be compared against: ``None``, ``True``, or ``False``. This " +"pattern succeeds if the match subject is the given constant." msgstr "" +#: ../../library/ast.rst:1560 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1264,9 +1924,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match sequence pattern. ``patterns`` contains the patterns to be matched against the subject elements if the subject is a sequence. Matches a variable length sequence if one of the subpatterns is a ``MatchStar`` node, otherwise matches a fixed length sequence." +#: ../../library/ast.rst:1582 +msgid "" +"A match sequence pattern. ``patterns`` contains the patterns to be matched " +"against the subject elements if the subject is a sequence. Matches a " +"variable length sequence if one of the subpatterns is a ``MatchStar`` node, " +"otherwise matches a fixed length sequence." msgstr "" +#: ../../library/ast.rst:1587 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1290,9 +1956,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "Matches the rest of the sequence in a variable length match sequence pattern. If ``name`` is not ``None``, a list containing the remaining sequence elements is bound to that name if the overall sequence pattern is successful." +#: ../../library/ast.rst:1614 +msgid "" +"Matches the rest of the sequence in a variable length match sequence " +"pattern. If ``name`` is not ``None``, a list containing the remaining " +"sequence elements is bound to that name if the overall sequence pattern is " +"successful." msgstr "" +#: ../../library/ast.rst:1618 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1326,12 +1998,25 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match mapping pattern. ``keys`` is a sequence of expression nodes. ``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an optional name that can be specified to capture the remaining mapping elements. Permitted key expressions are restricted as described in the match statement documentation." +#: ../../library/ast.rst:1655 +msgid "" +"A match mapping pattern. ``keys`` is a sequence of expression nodes. " +"``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " +"optional name that can be specified to capture the remaining mapping " +"elements. Permitted key expressions are restricted as described in the match " +"statement documentation." msgstr "" -msgid "This pattern succeeds if the subject is a mapping, all evaluated key expressions are present in the mapping, and the value corresponding to each key matches the corresponding subpattern. If ``rest`` is not ``None``, a dict containing the remaining mapping elements is bound to that name if the overall mapping pattern is successful." +#: ../../library/ast.rst:1661 +msgid "" +"This pattern succeeds if the subject is a mapping, all evaluated key " +"expressions are present in the mapping, and the value corresponding to each " +"key matches the corresponding subpattern. If ``rest`` is not ``None``, a " +"dict containing the remaining mapping elements is bound to that name if the " +"overall mapping pattern is successful." msgstr "" +#: ../../library/ast.rst:1667 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1363,15 +2048,32 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match class pattern. ``cls`` is an expression giving the nominal class to be matched. ``patterns`` is a sequence of pattern nodes to be matched against the class defined sequence of pattern matching attributes. ``kwd_attrs`` is a sequence of additional attributes to be matched (specified as keyword arguments in the class pattern), ``kwd_patterns`` are the corresponding patterns (specified as keyword values in the class pattern)." +#: ../../library/ast.rst:1702 +msgid "" +"A match class pattern. ``cls`` is an expression giving the nominal class to " +"be matched. ``patterns`` is a sequence of pattern nodes to be matched " +"against the class defined sequence of pattern matching attributes. " +"``kwd_attrs`` is a sequence of additional attributes to be matched " +"(specified as keyword arguments in the class pattern), ``kwd_patterns`` are " +"the corresponding patterns (specified as keyword values in the class " +"pattern)." msgstr "" -msgid "This pattern succeeds if the subject is an instance of the nominated class, all positional patterns match the corresponding class-defined attributes, and any specified keyword attributes match their corresponding pattern." +#: ../../library/ast.rst:1709 +msgid "" +"This pattern succeeds if the subject is an instance of the nominated class, " +"all positional patterns match the corresponding class-defined attributes, " +"and any specified keyword attributes match their corresponding pattern." msgstr "" -msgid "Note: classes may define a property that returns self in order to match a pattern node against the instance being matched. Several builtin types are also matched that way, as described in the match statement documentation." +#: ../../library/ast.rst:1713 +msgid "" +"Note: classes may define a property that returns self in order to match a " +"pattern node against the instance being matched. Several builtin types are " +"also matched that way, as described in the match statement documentation." msgstr "" +#: ../../library/ast.rst:1717 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1415,12 +2117,22 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` contains the match pattern that the subject will be matched against. If the pattern is ``None``, the node represents a capture pattern (i.e a bare name) and will always succeed." +#: ../../library/ast.rst:1764 +msgid "" +"A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " +"contains the match pattern that the subject will be matched against. If the " +"pattern is ``None``, the node represents a capture pattern (i.e a bare name) " +"and will always succeed." msgstr "" -msgid "The ``name`` attribute contains the name that will be bound if the pattern is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` and the node represents the wildcard pattern." +#: ../../library/ast.rst:1769 +msgid "" +"The ``name`` attribute contains the name that will be bound if the pattern " +"is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " +"and the node represents the wildcard pattern." msgstr "" +#: ../../library/ast.rst:1773 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1450,9 +2162,16 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -msgid "A match \"or-pattern\". An or-pattern matches each of its subpatterns in turn to the subject, until one succeeds. The or-pattern is then deemed to succeed. If none of the subpatterns succeed the or-pattern fails. The ``patterns`` attribute contains a list of match pattern nodes that will be matched against the subject." +#: ../../library/ast.rst:1806 +msgid "" +"A match \"or-pattern\". An or-pattern matches each of its subpatterns in " +"turn to the subject, until one succeeds. The or-pattern is then deemed to " +"succeed. If none of the subpatterns succeed the or-pattern fails. The " +"``patterns`` attribute contains a list of match pattern nodes that will be " +"matched against the subject." msgstr "" +#: ../../library/ast.rst:1812 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -1476,14 +2195,20 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" +#: ../../library/ast.rst:1839 msgid "Type annotations" msgstr "" -msgid "A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag specified by the form ``# type: ignore ``." +#: ../../library/ast.rst:1843 +msgid "" +"A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " +"specified by the form ``# type: ignore ``." msgstr "" +#: ../../library/ast.rst:1846 msgid "" -">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4))\n" +">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " +"indent=4))\n" "Module(\n" " body=[\n" " Assign(\n" @@ -1492,7 +2217,8 @@ msgid "" " value=Constant(value=1))],\n" " type_ignores=[\n" " TypeIgnore(lineno=1, tag='')])\n" -">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', type_comments=True), indent=4))\n" +">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', " +"type_comments=True), indent=4))\n" "Module(\n" " body=[\n" " AnnAssign(\n" @@ -1504,20 +2230,36 @@ msgid "" " TypeIgnore(lineno=1, tag='[assignment]')])" msgstr "" -msgid ":class:`!TypeIgnore` nodes are not generated when the *type_comments* parameter is set to ``False`` (default). See :func:`ast.parse` for more details." +#: ../../library/ast.rst:1869 +msgid "" +":class:`!TypeIgnore` nodes are not generated when the *type_comments* " +"parameter is set to ``False`` (default). See :func:`ast.parse` for more " +"details." msgstr "" +#: ../../library/ast.rst:1877 msgid "Type parameters" msgstr "" -msgid ":ref:`Type parameters ` can exist on classes, functions, and type aliases." +#: ../../library/ast.rst:1879 +msgid "" +":ref:`Type parameters ` can exist on classes, functions, and " +"type aliases." msgstr "" -msgid "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. ``bound`` is the bound or constraints, if any. If ``bound`` is a :class:`Tuple`, it represents constraints; otherwise it represents the bound. ``default_value`` is the default value; if the :class:`!TypeVar` has no default, this attribute will be set to ``None``." +#: ../../library/ast.rst:1884 +msgid "" +"A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " +"``bound`` is the bound or constraints, if any. If ``bound`` is " +"a :class:`Tuple`, it represents constraints; otherwise it represents the " +"bound. ``default_value`` is the default value; if the :class:`!TypeVar` has " +"no default, this attribute will be set to ``None``." msgstr "" +#: ../../library/ast.rst:1890 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -1533,14 +2275,22 @@ msgid "" " ctx=Load()))])" msgstr "" +#: ../../library/ast.rst:1909 ../../library/ast.rst:1944 +#: ../../library/ast.rst:1976 msgid "Added the *default_value* parameter." msgstr "" -msgid "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter specification. ``default_value`` is the default value; if the :class:`!ParamSpec` has no default, this attribute will be set to ``None``." +#: ../../library/ast.rst:1914 +msgid "" +"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " +"specification. ``default_value`` is the default value; if the :class:`!" +"ParamSpec` has no default, this attribute will be set to ``None``." msgstr "" +#: ../../library/ast.rst:1918 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, int]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " +"int]\"), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -1563,11 +2313,17 @@ msgid "" " ctx=Load()))])" msgstr "" -msgid "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` has no default, this attribute will be set to ``None``." +#: ../../library/ast.rst:1949 +msgid "" +"A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " +"tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " +"has no default, this attribute will be set to ``None``." msgstr "" +#: ../../library/ast.rst:1953 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -1587,36 +2343,52 @@ msgid "" " ctx=Load()))])" msgstr "" +#: ../../library/ast.rst:1980 msgid "Function and class definitions" msgstr "" +#: ../../library/ast.rst:1984 msgid "A function definition." msgstr "" +#: ../../library/ast.rst:1986 msgid "``name`` is a raw string of the function name." msgstr "" +#: ../../library/ast.rst:1987 msgid "``args`` is an :class:`arguments` node." msgstr "" +#: ../../library/ast.rst:1988 msgid "``body`` is the list of nodes inside the function." msgstr "" -msgid "``decorator_list`` is the list of decorators to be applied, stored outermost first (i.e. the first in the list will be applied last)." +#: ../../library/ast.rst:1989 +msgid "" +"``decorator_list`` is the list of decorators to be applied, stored outermost " +"first (i.e. the first in the list will be applied last)." msgstr "" +#: ../../library/ast.rst:1991 msgid "``returns`` is the return annotation." msgstr "" +#: ../../library/ast.rst:1992 ../../library/ast.rst:2155 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "" +#: ../../library/ast.rst:1998 ../../library/ast.rst:2182 +#: ../../library/ast.rst:2193 msgid "Added ``type_params``." msgstr "" -msgid "``lambda`` is a minimal function definition that can be used inside an expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." +#: ../../library/ast.rst:2004 +msgid "" +"``lambda`` is a minimal function definition that can be used inside an " +"expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." msgstr "" +#: ../../library/ast.rst:2007 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -1630,32 +2402,52 @@ msgid "" " body=Constant(value=Ellipsis)))])" msgstr "" +#: ../../library/ast.rst:2023 msgid "The arguments for a function." msgstr "" -msgid "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." +#: ../../library/ast.rst:2025 +msgid "" +"``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" -msgid "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the ``*args, **kwargs`` parameters." +#: ../../library/ast.rst:2026 +msgid "" +"``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " +"``*args, **kwargs`` parameters." msgstr "" -msgid "``kw_defaults`` is a list of default values for keyword-only arguments. If one is ``None``, the corresponding argument is required." +#: ../../library/ast.rst:2028 +msgid "" +"``kw_defaults`` is a list of default values for keyword-only arguments. If " +"one is ``None``, the corresponding argument is required." msgstr "" -msgid "``defaults`` is a list of default values for arguments that can be passed positionally. If there are fewer defaults, they correspond to the last n arguments." +#: ../../library/ast.rst:2030 +msgid "" +"``defaults`` is a list of default values for arguments that can be passed " +"positionally. If there are fewer defaults, they correspond to the last n " +"arguments." msgstr "" -msgid "A single argument in a list. ``arg`` is a raw string of the argument name; ``annotation`` is its annotation, such as a :class:`Name` node." +#: ../../library/ast.rst:2037 +msgid "" +"A single argument in a list. ``arg`` is a raw string of the argument name; " +"``annotation`` is its annotation, such as a :class:`Name` node." msgstr "" -msgid "``type_comment`` is an optional string with the type annotation as a comment" +#: ../../library/ast.rst:2042 +msgid "" +"``type_comment`` is an optional string with the type annotation as a comment" msgstr "" +#: ../../library/ast.rst:2044 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" "... @decorator2\n" -"... def f(a: 'annotation', b=1, c=2, *d, e, f=3, **g) -> 'return annotation':\n" +"... def f(a: 'annotation', b=1, c=2, *d, e, f=3, **g) -> 'return " +"annotation':\n" "... pass\n" "... \"\"\"), indent=4))\n" "Module(\n" @@ -1688,9 +2480,11 @@ msgid "" " returns=Constant(value='return annotation'))])" msgstr "" +#: ../../library/ast.rst:2084 msgid "A ``return`` statement." msgstr "" +#: ../../library/ast.rst:2086 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -1699,9 +2493,14 @@ msgid "" " value=Constant(value=4))])" msgstr "" -msgid "A ``yield`` or ``yield from`` expression. Because these are expressions, they must be wrapped in an :class:`Expr` node if the value sent back is not used." +#: ../../library/ast.rst:2098 +msgid "" +"A ``yield`` or ``yield from`` expression. Because these are expressions, " +"they must be wrapped in an :class:`Expr` node if the value sent back is not " +"used." msgstr "" +#: ../../library/ast.rst:2101 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -1718,9 +2517,12 @@ msgid "" " value=Name(id='x', ctx=Load())))])" msgstr "" -msgid "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." +#: ../../library/ast.rst:2121 +msgid "" +"``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "" +#: ../../library/ast.rst:2123 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -1741,24 +2543,36 @@ msgid "" " 'z'])])" msgstr "" +#: ../../library/ast.rst:2146 msgid "A class definition." msgstr "" +#: ../../library/ast.rst:2148 msgid "``name`` is a raw string for the class name" msgstr "" +#: ../../library/ast.rst:2149 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "" -msgid "``keywords`` is a list of :class:`.keyword` nodes, principally for 'metaclass'. Other keywords will be passed to the metaclass, as per :pep:`3115`." +#: ../../library/ast.rst:2150 +msgid "" +"``keywords`` is a list of :class:`.keyword` nodes, principally for " +"'metaclass'. Other keywords will be passed to the metaclass, as " +"per :pep:`3115`." msgstr "" -msgid "``body`` is a list of nodes representing the code within the class definition." +#: ../../library/ast.rst:2152 +msgid "" +"``body`` is a list of nodes representing the code within the class " +"definition." msgstr "" +#: ../../library/ast.rst:2154 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "" +#: ../../library/ast.rst:2157 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -1784,15 +2598,23 @@ msgid "" " Name(id='decorator2', ctx=Load())])])" msgstr "" +#: ../../library/ast.rst:2186 msgid "Async and await" msgstr "" -msgid "An ``async def`` function definition. Has the same fields as :class:`FunctionDef`." +#: ../../library/ast.rst:2190 +msgid "" +"An ``async def`` function definition. Has the same fields " +"as :class:`FunctionDef`." msgstr "" -msgid "An ``await`` expression. ``value`` is what it waits for. Only valid in the body of an :class:`AsyncFunctionDef`." +#: ../../library/ast.rst:2199 +msgid "" +"An ``await`` expression. ``value`` is what it waits for. Only valid in the " +"body of an :class:`AsyncFunctionDef`." msgstr "" +#: ../../library/ast.rst:2202 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -1810,144 +2632,323 @@ msgid "" " func=Name(id='other_func', ctx=Load()))))])])" msgstr "" -msgid "``async for`` loops and ``async with`` context managers. They have the same fields as :class:`For` and :class:`With`, respectively. Only valid in the body of an :class:`AsyncFunctionDef`." +#: ../../library/ast.rst:2223 +msgid "" +"``async for`` loops and ``async with`` context managers. They have the same " +"fields as :class:`For` and :class:`With`, respectively. Only valid in the " +"body of an :class:`AsyncFunctionDef`." msgstr "" -msgid "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` and :class:`ast.expr_context`) on the returned tree will be singletons. Changes to one will be reflected in all other occurrences of the same value (for example, :class:`ast.Add`)." +#: ../../library/ast.rst:2228 +msgid "" +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " +"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " +"and :class:`ast.expr_context`) on the returned tree will be singletons. " +"Changes to one will be reflected in all other occurrences of the same value " +"(for example, :class:`ast.Add`)." msgstr "" +#: ../../library/ast.rst:2236 msgid ":mod:`!ast` helpers" msgstr "" -msgid "Apart from the node classes, the :mod:`!ast` module defines these utility functions and classes for traversing abstract syntax trees:" +#: ../../library/ast.rst:2238 +msgid "" +"Apart from the node classes, the :mod:`!ast` module defines these utility " +"functions and classes for traversing abstract syntax trees:" msgstr "" -msgid "Parse the source into an AST node. Equivalent to ``compile(source, filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where ``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast.PyCF_OPTIMIZED_AST`` otherwise." +#: ../../library/ast.rst:2243 +msgid "" +"Parse the source into an AST node. Equivalent to ``compile(source, " +"filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " +"``ast.PyCF_OPTIMIZED_AST`` otherwise." msgstr "" -msgid "If ``type_comments=True`` is given, the parser is modified to check and return type comments as specified by :pep:`484` and :pep:`526`. This is equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :func:`compile`. This will report syntax errors for misplaced type comments. Without this flag, type comments will be ignored, and the ``type_comment`` field on selected AST nodes will always be ``None``. In addition, the locations of ``# type: ignore`` comments will be returned as the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an empty list)." +#: ../../library/ast.rst:2248 +msgid "" +"If ``type_comments=True`` is given, the parser is modified to check and " +"return type comments as specified by :pep:`484` and :pep:`526`. This is " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " +"to :func:`compile`. This will report syntax errors for misplaced type " +"comments. Without this flag, type comments will be ignored, and the " +"``type_comment`` field on selected AST nodes will always be ``None``. In " +"addition, the locations of ``# type: ignore`` comments will be returned as " +"the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " +"empty list)." msgstr "" -msgid "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> List[str]``." +#: ../../library/ast.rst:2258 +msgid "" +"In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " +"correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " +"List[str]``." msgstr "" -msgid "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a \"best-effort\" attempt to parse using that Python version's grammar. For example, setting ``feature_version=(3, 9)`` will attempt to disallow parsing of :keyword:`match` statements. Currently ``major`` must equal to ``3``. The lowest supported version is ``(3, 7)`` (and this may increase in future Python versions); the highest is ``sys.version_info[0:2]``. \"Best-effort\" attempt means there is no guarantee that the parse (or success of the parse) is the same as when run on the Python version corresponding to ``feature_version``." +#: ../../library/ast.rst:2262 +msgid "" +"Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " +"\"best-effort\" attempt to parse using that Python version's grammar. For " +"example, setting ``feature_version=(3, 9)`` will attempt to disallow parsing " +"of :keyword:`match` statements. Currently ``major`` must equal to ``3``. The " +"lowest supported version is ``(3, 7)`` (and this may increase in future " +"Python versions); the highest is ``sys.version_info[0:2]``. \"Best-effort\" " +"attempt means there is no guarantee that the parse (or success of the parse) " +"is the same as when run on the Python version corresponding to " +"``feature_version``." msgstr "" -msgid "If source contains a null character (``\\0``), :exc:`ValueError` is raised." +#: ../../library/ast.rst:2272 +msgid "" +"If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "" -msgid "Note that successfully parsing source code into an AST object doesn't guarantee that the source code provided is valid Python code that can be executed as the compilation step can raise further :exc:`SyntaxError` exceptions. For instance, the source ``return 42`` generates a valid AST node for a return statement, but it cannot be compiled alone (it needs to be inside a function node)." +#: ../../library/ast.rst:2275 +msgid "" +"Note that successfully parsing source code into an AST object doesn't " +"guarantee that the source code provided is valid Python code that can be " +"executed as the compilation step can raise further :exc:`SyntaxError` " +"exceptions. For instance, the source ``return 42`` generates a valid AST " +"node for a return statement, but it cannot be compiled alone (it needs to be " +"inside a function node)." msgstr "" -msgid "In particular, :func:`ast.parse` won't do any scoping checks, which the compilation step does." +#: ../../library/ast.rst:2282 +msgid "" +"In particular, :func:`ast.parse` won't do any scoping checks, which the " +"compilation step does." msgstr "" -msgid "It is possible to crash the Python interpreter with a sufficiently large/complex string due to stack depth limitations in Python's AST compiler." +#: ../../library/ast.rst:2286 +msgid "" +"It is possible to crash the Python interpreter with a sufficiently large/" +"complex string due to stack depth limitations in Python's AST compiler." msgstr "" +#: ../../library/ast.rst:2290 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "" -msgid "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The ``optimize`` argument was added." +#: ../../library/ast.rst:2293 +msgid "" +"The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " +"``optimize`` argument was added." msgstr "" -msgid "Unparse an :class:`ast.AST` object and generate a string with code that would produce an equivalent :class:`ast.AST` object if parsed back with :func:`ast.parse`." +#: ../../library/ast.rst:2300 +msgid "" +"Unparse an :class:`ast.AST` object and generate a string with code that " +"would produce an equivalent :class:`ast.AST` object if parsed back " +"with :func:`ast.parse`." msgstr "" -msgid "The produced code string will not necessarily be equal to the original code that generated the :class:`ast.AST` object (without any compiler optimizations, such as constant tuples/frozensets)." +#: ../../library/ast.rst:2305 +msgid "" +"The produced code string will not necessarily be equal to the original code " +"that generated the :class:`ast.AST` object (without any compiler " +"optimizations, such as constant tuples/frozensets)." msgstr "" -msgid "Trying to unparse a highly complex expression would result with :exc:`RecursionError`." +#: ../../library/ast.rst:2310 +msgid "" +"Trying to unparse a highly complex expression would result " +"with :exc:`RecursionError`." msgstr "" -msgid "Evaluate an expression node or a string containing only a Python literal or container display. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, ``None`` and ``Ellipsis``." +#: ../../library/ast.rst:2318 +msgid "" +"Evaluate an expression node or a string containing only a Python literal or " +"container display. The string or node provided may only consist of the " +"following Python literal structures: strings, bytes, numbers, tuples, lists, " +"dicts, sets, booleans, ``None`` and ``Ellipsis``." msgstr "" -msgid "This can be used for evaluating strings containing Python values without the need to parse the values oneself. It is not capable of evaluating arbitrarily complex expressions, for example involving operators or indexing." +#: ../../library/ast.rst:2323 +msgid "" +"This can be used for evaluating strings containing Python values without the " +"need to parse the values oneself. It is not capable of evaluating " +"arbitrarily complex expressions, for example involving operators or indexing." msgstr "" -msgid "This function had been documented as \"safe\" in the past without defining what that meant. That was misleading. This is specifically designed not to execute Python code, unlike the more general :func:`eval`. There is no namespace, no name lookups, or ability to call out. But it is not free from attack: A relatively small input can lead to memory exhaustion or to C stack exhaustion, crashing the process. There is also the possibility for excessive CPU consumption denial of service on some inputs. Calling it on untrusted data is thus not recommended." +#: ../../library/ast.rst:2328 +msgid "" +"This function had been documented as \"safe\" in the past without defining " +"what that meant. That was misleading. This is specifically designed not to " +"execute Python code, unlike the more general :func:`eval`. There is no " +"namespace, no name lookups, or ability to call out. But it is not free from " +"attack: A relatively small input can lead to memory exhaustion or to C stack " +"exhaustion, crashing the process. There is also the possibility for " +"excessive CPU consumption denial of service on some inputs. Calling it on " +"untrusted data is thus not recommended." msgstr "" -msgid "It is possible to crash the Python interpreter due to stack depth limitations in Python's AST compiler." +#: ../../library/ast.rst:2338 +msgid "" +"It is possible to crash the Python interpreter due to stack depth " +"limitations in Python's AST compiler." msgstr "" -msgid "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` and :exc:`RecursionError` depending on the malformed input." +#: ../../library/ast.rst:2341 +msgid "" +"It can " +"raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` " +"and :exc:`RecursionError` depending on the malformed input." msgstr "" +#: ../../library/ast.rst:2345 msgid "Now allows bytes and set literals." msgstr "" +#: ../../library/ast.rst:2348 msgid "Now supports creating empty sets with ``'set()'``." msgstr "" +#: ../../library/ast.rst:2351 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "" -msgid "Return the docstring of the given *node* (which must be a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is true, clean up the docstring's indentation with :func:`inspect.cleandoc`." +#: ../../library/ast.rst:2357 +msgid "" +"Return the docstring of the given *node* (which must be " +"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " +"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " +"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" +#: ../../library/ast.rst:2363 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "" -msgid "Get source code segment of the *source* that generated *node*. If some location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." +#: ../../library/ast.rst:2369 +msgid "" +"Get source code segment of the *source* that generated *node*. If some " +"location information " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, " +"or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." msgstr "" -msgid "If *padded* is ``True``, the first line of a multi-line statement will be padded with spaces to match its original position." +#: ../../library/ast.rst:2373 +msgid "" +"If *padded* is ``True``, the first line of a multi-line statement will be " +"padded with spaces to match its original position." msgstr "" -msgid "When you compile a node tree with :func:`compile`, the compiler expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every node that supports them. This is rather tedious to fill in for generated nodes, so this helper adds these attributes recursively where not already set, by setting them to the values of the parent node. It works recursively starting at *node*." +#: ../../library/ast.rst:2381 +msgid "" +"When you compile a node tree with :func:`compile`, the compiler " +"expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes " +"for every node that supports them. This is rather tedious to fill in for " +"generated nodes, so this helper adds these attributes recursively where not " +"already set, by setting them to the values of the parent node. It works " +"recursively starting at *node*." msgstr "" -msgid "Increment the line number and end line number of each node in the tree starting at *node* by *n*. This is useful to \"move code\" to a different location in a file." +#: ../../library/ast.rst:2390 +msgid "" +"Increment the line number and end line number of each node in the tree " +"starting at *node* by *n*. This is useful to \"move code\" to a different " +"location in a file." msgstr "" -msgid "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if possible, and return *new_node*." +#: ../../library/ast.rst:2397 +msgid "" +"Copy source location " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, " +"and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if " +"possible, and return *new_node*." msgstr "" -msgid "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` that is present on *node*." +#: ../../library/ast.rst:2404 +msgid "" +"Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " +"that is present on *node*." msgstr "" -msgid "Yield all direct child nodes of *node*, that is, all fields that are nodes and all items of fields that are lists of nodes." +#: ../../library/ast.rst:2410 +msgid "" +"Yield all direct child nodes of *node*, that is, all fields that are nodes " +"and all items of fields that are lists of nodes." msgstr "" -msgid "Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context." +#: ../../library/ast.rst:2416 +msgid "" +"Recursively yield all descendant nodes in the tree starting at *node* " +"(including *node* itself), in no specified order. This is useful if you " +"only want to modify nodes in place and don't care about the context." msgstr "" -msgid "A node visitor base class that walks the abstract syntax tree and calls a visitor function for every node found. This function may return a value which is forwarded by the :meth:`visit` method." +#: ../../library/ast.rst:2423 +msgid "" +"A node visitor base class that walks the abstract syntax tree and calls a " +"visitor function for every node found. This function may return a value " +"which is forwarded by the :meth:`visit` method." msgstr "" -msgid "This class is meant to be subclassed, with the subclass adding visitor methods." +#: ../../library/ast.rst:2427 +msgid "" +"This class is meant to be subclassed, with the subclass adding visitor " +"methods." msgstr "" -msgid "Visit a node. The default implementation calls the method called :samp:`self.visit_{classname}` where *classname* is the name of the node class, or :meth:`generic_visit` if that method doesn't exist." +#: ../../library/ast.rst:2432 +msgid "" +"Visit a node. The default implementation calls the method " +"called :samp:`self.visit_{classname}` where *classname* is the name of the " +"node class, or :meth:`generic_visit` if that method doesn't exist." msgstr "" +#: ../../library/ast.rst:2438 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "" -msgid "Note that child nodes of nodes that have a custom visitor method won't be visited unless the visitor calls :meth:`generic_visit` or visits them itself." +#: ../../library/ast.rst:2440 +msgid "" +"Note that child nodes of nodes that have a custom visitor method won't be " +"visited unless the visitor calls :meth:`generic_visit` or visits them itself." msgstr "" +#: ../../library/ast.rst:2446 msgid "Handles all constant nodes." msgstr "" -msgid "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes during traversal. For this a special visitor exists (:class:`NodeTransformer`) that allows modifications." +#: ../../library/ast.rst:2448 +msgid "" +"Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " +"during traversal. For this a special visitor exists " +"(:class:`NodeTransformer`) that allows modifications." msgstr "" -msgid "Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` will not be called in Python 3.14+. Add the :meth:`visit_Constant` method instead to handle all constant nodes." +#: ../../library/ast.rst:2454 +msgid "" +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" +"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` will " +"not be called in Python 3.14+. Add the :meth:`visit_Constant` method " +"instead to handle all constant nodes." msgstr "" -msgid "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and allows modification of nodes." +#: ../../library/ast.rst:2462 +msgid "" +"A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " +"allows modification of nodes." msgstr "" -msgid "The :class:`NodeTransformer` will walk the AST and use the return value of the visitor methods to replace or remove the old node. If the return value of the visitor method is ``None``, the node will be removed from its location, otherwise it is replaced with the return value. The return value may be the original node in which case no replacement takes place." +#: ../../library/ast.rst:2465 +msgid "" +"The :class:`NodeTransformer` will walk the AST and use the return value of " +"the visitor methods to replace or remove the old node. If the return value " +"of the visitor method is ``None``, the node will be removed from its " +"location, otherwise it is replaced with the return value. The return value " +"may be the original node in which case no replacement takes place." msgstr "" -msgid "Here is an example transformer that rewrites all occurrences of name lookups (``foo``) to ``data['foo']``::" +#: ../../library/ast.rst:2471 +msgid "" +"Here is an example transformer that rewrites all occurrences of name lookups " +"(``foo``) to ``data['foo']``::" msgstr "" +#: ../../library/ast.rst:2474 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -1959,41 +2960,78 @@ msgid "" " )" msgstr "" -msgid "Keep in mind that if the node you're operating on has child nodes you must either transform the child nodes yourself or call the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." +#: ../../library/ast.rst:2483 +msgid "" +"Keep in mind that if the node you're operating on has child nodes you must " +"either transform the child nodes yourself or call " +"the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." msgstr "" -msgid "For nodes that were part of a collection of statements (that applies to all statement nodes), the visitor may also return a list of nodes rather than just a single node." +#: ../../library/ast.rst:2487 +msgid "" +"For nodes that were part of a collection of statements (that applies to all " +"statement nodes), the visitor may also return a list of nodes rather than " +"just a single node." msgstr "" -msgid "If :class:`NodeTransformer` introduces new nodes (that weren't part of original tree) without giving them location information (such as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called with the new sub-tree to recalculate the location information::" +#: ../../library/ast.rst:2491 +msgid "" +"If :class:`NodeTransformer` introduces new nodes (that weren't part of " +"original tree) without giving them location information (such " +"as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called " +"with the new sub-tree to recalculate the location information::" msgstr "" +#: ../../library/ast.rst:2496 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" msgstr "" +#: ../../library/ast.rst:2499 msgid "Usually you use the transformer like this::" msgstr "" +#: ../../library/ast.rst:2501 msgid "node = YourTransformer().visit(node)" msgstr "" -msgid "Return a formatted dump of the tree in *node*. This is mainly useful for debugging purposes. If *annotate_fields* is true (by default), the returned string will show the names and the values for fields. If *annotate_fields* is false, the result string will be more compact by omitting unambiguous field names. Attributes such as line numbers and column offsets are not dumped by default. If this is wanted, *include_attributes* can be set to true." +#: ../../library/ast.rst:2506 +msgid "" +"Return a formatted dump of the tree in *node*. This is mainly useful for " +"debugging purposes. If *annotate_fields* is true (by default), the returned " +"string will show the names and the values for fields. If *annotate_fields* " +"is false, the result string will be more compact by omitting unambiguous " +"field names. Attributes such as line numbers and column offsets are not " +"dumped by default. If this is wanted, *include_attributes* can be set to " +"true." msgstr "" -msgid "If *indent* is a non-negative integer or string, then the tree will be pretty-printed with that indent level. An indent level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the default) selects the single line representation. Using a positive integer indent indents that many spaces per level. If *indent* is a string (such as ``\"\\t\"``), that string is used to indent each level." +#: ../../library/ast.rst:2514 +msgid "" +"If *indent* is a non-negative integer or string, then the tree will be " +"pretty-printed with that indent level. An indent level of 0, negative, or " +"``\"\"`` will only insert newlines. ``None`` (the default) selects the " +"single line representation. Using a positive integer indent indents that " +"many spaces per level. If *indent* is a string (such as ``\"\\t\"``), that " +"string is used to indent each level." msgstr "" -msgid "If *show_empty* is false (the default), optional empty lists will be omitted from the output. Optional ``None`` values are always omitted." +#: ../../library/ast.rst:2521 +msgid "" +"If *show_empty* is false (the default), optional empty lists will be omitted " +"from the output. Optional ``None`` values are always omitted." msgstr "" +#: ../../library/ast.rst:2525 msgid "Added the *indent* option." msgstr "" +#: ../../library/ast.rst:2528 msgid "Added the *show_empty* option." msgstr "" +#: ../../library/ast.rst:2531 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -2021,89 +3059,159 @@ msgid "" " type_ignores=[])" msgstr "" +#: ../../library/ast.rst:2561 msgid "Recursively compares two ASTs." msgstr "" -msgid "*compare_attributes* affects whether AST attributes are considered in the comparison. If *compare_attributes* is ``False`` (default), then attributes are ignored. Otherwise they must all be equal. This option is useful to check whether the ASTs are structurally equal but differ in whitespace or similar details. Attributes include line numbers and column offsets." +#: ../../library/ast.rst:2563 +msgid "" +"*compare_attributes* affects whether AST attributes are considered in the " +"comparison. If *compare_attributes* is ``False`` (default), then attributes " +"are ignored. Otherwise they must all be equal. This option is useful to " +"check whether the ASTs are structurally equal but differ in whitespace or " +"similar details. Attributes include line numbers and column offsets." msgstr "" +#: ../../library/ast.rst:2576 msgid "Compiler flags" msgstr "" -msgid "The following flags may be passed to :func:`compile` in order to change effects on the compilation of a program:" +#: ../../library/ast.rst:2578 +msgid "" +"The following flags may be passed to :func:`compile` in order to change " +"effects on the compilation of a program:" msgstr "" -msgid "Enables support for top-level ``await``, ``async for``, ``async with`` and async comprehensions." +#: ../../library/ast.rst:2583 +msgid "" +"Enables support for top-level ``await``, ``async for``, ``async with`` and " +"async comprehensions." msgstr "" -msgid "Generates and returns an abstract syntax tree instead of returning a compiled code object." +#: ../../library/ast.rst:2590 +msgid "" +"Generates and returns an abstract syntax tree instead of returning a " +"compiled code object." msgstr "" -msgid "The returned AST is optimized according to the *optimize* argument in :func:`compile` or :func:`ast.parse`." +#: ../../library/ast.rst:2595 +msgid "" +"The returned AST is optimized according to the *optimize* argument " +"in :func:`compile` or :func:`ast.parse`." msgstr "" -msgid "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: ``, ``# type: ignore ``)." +#: ../../library/ast.rst:2602 +msgid "" +"Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " +"``, ``# type: ignore ``)." msgstr "" +#: ../../library/ast.rst:2611 msgid "Command-line usage" msgstr "" -msgid "The :mod:`!ast` module can be executed as a script from the command line. It is as simple as:" +#: ../../library/ast.rst:2615 +msgid "" +"The :mod:`!ast` module can be executed as a script from the command line. It " +"is as simple as:" msgstr "" +#: ../../library/ast.rst:2618 msgid "python -m ast [-m ] [-a] [infile]" msgstr "" +#: ../../library/ast.rst:2622 msgid "The following options are accepted:" msgstr "" +#: ../../library/ast.rst:2628 msgid "Show the help message and exit." msgstr "" -msgid "Specify what kind of code must be compiled, like the *mode* argument in :func:`parse`." +#: ../../library/ast.rst:2633 +msgid "" +"Specify what kind of code must be compiled, like the *mode* argument " +"in :func:`parse`." msgstr "" +#: ../../library/ast.rst:2638 msgid "Don't parse type comments." msgstr "" +#: ../../library/ast.rst:2642 msgid "Include attributes such as line numbers and column offsets." msgstr "" +#: ../../library/ast.rst:2647 msgid "Indentation of nodes in AST (number of spaces)." msgstr "" -msgid "Python version in the format 3.x (for example, 3.10). Defaults to the current version of the interpreter." +#: ../../library/ast.rst:2651 +msgid "" +"Python version in the format 3.x (for example, 3.10). Defaults to the " +"current version of the interpreter." msgstr "" +#: ../../library/ast.rst:2659 msgid "Optimization level for parser. Defaults to no optimization." msgstr "" -msgid "Show empty lists and fields that are ``None``. Defaults to not showing empty objects." +#: ../../library/ast.rst:2665 +msgid "" +"Show empty lists and fields that are ``None``. Defaults to not showing empty " +"objects." msgstr "" -msgid "If :file:`infile` is specified its contents are parsed to AST and dumped to stdout. Otherwise, the content is read from stdin." +#: ../../library/ast.rst:2671 +msgid "" +"If :file:`infile` is specified its contents are parsed to AST and dumped to " +"stdout. Otherwise, the content is read from stdin." msgstr "" -msgid "`Green Tree Snakes `_, an external documentation resource, has good details on working with Python ASTs." +#: ../../library/ast.rst:2677 +msgid "" +"`Green Tree Snakes `_, an external " +"documentation resource, has good details on working with Python ASTs." msgstr "" -msgid "`ASTTokens `_ annotates Python ASTs with the positions of tokens and text in the source code that generated them. This is helpful for tools that make source code transformations." +#: ../../library/ast.rst:2680 +msgid "" +"`ASTTokens `_ " +"annotates Python ASTs with the positions of tokens and text in the source " +"code that generated them. This is helpful for tools that make source code " +"transformations." msgstr "" -msgid "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs by inserting two-way links between tokens and ast nodes." +#: ../../library/ast.rst:2685 +msgid "" +"`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " +"by inserting two-way links between tokens and ast nodes." msgstr "" -msgid "`LibCST `_ parses code as a Concrete Syntax Tree that looks like an ast tree and keeps all formatting details. It's useful for building automated refactoring (codemod) applications and linters." +#: ../../library/ast.rst:2690 +msgid "" +"`LibCST `_ parses code as a Concrete Syntax " +"Tree that looks like an ast tree and keeps all formatting details. It's " +"useful for building automated refactoring (codemod) applications and linters." msgstr "" -msgid "`Parso `_ is a Python parser that supports error recovery and round-trip parsing for different Python versions (in multiple Python versions). Parso is also able to list multiple syntax errors in your Python file." +#: ../../library/ast.rst:2695 +msgid "" +"`Parso `_ is a Python parser that supports " +"error recovery and round-trip parsing for different Python versions (in " +"multiple Python versions). Parso is also able to list multiple syntax errors " +"in your Python file." msgstr "" +#: ../../library/ast.rst:59 msgid "? (question mark)" msgstr "" +#: ../../library/ast.rst:59 ../../library/ast.rst:60 msgid "in AST grammar" msgstr "" +#: ../../library/ast.rst:60 msgid "* (asterisk)" msgstr "" diff --git a/library/asynchat.po b/library/asynchat.po index 69a1df20d..9ccf95644 100644 --- a/library/asynchat.po +++ b/library/asynchat.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,23 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asynchat.rst:2 msgid ":mod:`!asynchat` --- Asynchronous socket command/response handler" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 ` after being deprecated in Python 3.6. The removal was decided in :pep:`594`." +#: ../../library/asynchat.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.12 ` after being " +"deprecated in Python 3.6. The removal was decided in :pep:`594`." msgstr "" +#: ../../library/asynchat.rst:14 msgid "Applications should use the :mod:`asyncio` module instead." msgstr "" -msgid "The last version of Python that provided the :mod:`!asynchat` module was `Python 3.11 `_." +#: ../../library/asynchat.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!asynchat` module was " +"`Python 3.11 `_." msgstr "" diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index e17c07634..bc14cc235 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,302 +24,425 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-api-index.rst:6 msgid "High-level API Index" msgstr "" +#: ../../library/asyncio-api-index.rst:8 msgid "This page lists all high-level async/await enabled asyncio APIs." msgstr "" +#: ../../library/asyncio-api-index.rst:12 msgid "Tasks" msgstr "" -msgid "Utilities to run asyncio programs, create Tasks, and await on multiple things with timeouts." +#: ../../library/asyncio-api-index.rst:14 +msgid "" +"Utilities to run asyncio programs, create Tasks, and await on multiple " +"things with timeouts." msgstr "" +#: ../../library/asyncio-api-index.rst:21 msgid ":func:`run`" msgstr "" +#: ../../library/asyncio-api-index.rst:22 msgid "Create event loop, run a coroutine, close the loop." msgstr "" +#: ../../library/asyncio-api-index.rst:24 msgid ":class:`Runner`" msgstr "" +#: ../../library/asyncio-api-index.rst:25 msgid "A context manager that simplifies multiple async function calls." msgstr "" +#: ../../library/asyncio-api-index.rst:27 msgid ":class:`Task`" msgstr "" +#: ../../library/asyncio-api-index.rst:28 msgid "Task object." msgstr "" +#: ../../library/asyncio-api-index.rst:30 msgid ":class:`TaskGroup`" msgstr "" -msgid "A context manager that holds a group of tasks. Provides a convenient and reliable way to wait for all tasks in the group to finish." +#: ../../library/asyncio-api-index.rst:31 +msgid "" +"A context manager that holds a group of tasks. Provides a convenient and " +"reliable way to wait for all tasks in the group to finish." msgstr "" +#: ../../library/asyncio-api-index.rst:35 msgid ":func:`create_task`" msgstr "" +#: ../../library/asyncio-api-index.rst:36 msgid "Start an asyncio Task, then returns it." msgstr "" +#: ../../library/asyncio-api-index.rst:38 msgid ":func:`current_task`" msgstr "" +#: ../../library/asyncio-api-index.rst:39 msgid "Return the current Task." msgstr "" +#: ../../library/asyncio-api-index.rst:41 msgid ":func:`all_tasks`" msgstr "" +#: ../../library/asyncio-api-index.rst:42 msgid "Return all tasks that are not yet finished for an event loop." msgstr "" +#: ../../library/asyncio-api-index.rst:44 msgid "``await`` :func:`sleep`" msgstr "" +#: ../../library/asyncio-api-index.rst:45 msgid "Sleep for a number of seconds." msgstr "" +#: ../../library/asyncio-api-index.rst:47 msgid "``await`` :func:`gather`" msgstr "" +#: ../../library/asyncio-api-index.rst:48 msgid "Schedule and wait for things concurrently." msgstr "" +#: ../../library/asyncio-api-index.rst:50 msgid "``await`` :func:`wait_for`" msgstr "" +#: ../../library/asyncio-api-index.rst:51 msgid "Run with a timeout." msgstr "" +#: ../../library/asyncio-api-index.rst:53 msgid "``await`` :func:`shield`" msgstr "" +#: ../../library/asyncio-api-index.rst:54 msgid "Shield from cancellation." msgstr "" +#: ../../library/asyncio-api-index.rst:56 msgid "``await`` :func:`wait`" msgstr "" +#: ../../library/asyncio-api-index.rst:57 msgid "Monitor for completion." msgstr "" +#: ../../library/asyncio-api-index.rst:59 msgid ":func:`timeout`" msgstr "" +#: ../../library/asyncio-api-index.rst:60 msgid "Run with a timeout. Useful in cases when ``wait_for`` is not suitable." msgstr "" +#: ../../library/asyncio-api-index.rst:62 msgid ":func:`to_thread`" msgstr "" +#: ../../library/asyncio-api-index.rst:63 msgid "Asynchronously run a function in a separate OS thread." msgstr "" +#: ../../library/asyncio-api-index.rst:65 msgid ":func:`run_coroutine_threadsafe`" msgstr "" +#: ../../library/asyncio-api-index.rst:66 msgid "Schedule a coroutine from another OS thread." msgstr "" +#: ../../library/asyncio-api-index.rst:68 msgid "``for in`` :func:`as_completed`" msgstr "" +#: ../../library/asyncio-api-index.rst:69 msgid "Monitor for completion with a ``for`` loop." msgstr "" +#: ../../library/asyncio-api-index.rst:73 +#: ../../library/asyncio-api-index.rst:109 +#: ../../library/asyncio-api-index.rst:133 +#: ../../library/asyncio-api-index.rst:169 +#: ../../library/asyncio-api-index.rst:205 +#: ../../library/asyncio-api-index.rst:230 msgid "Examples" msgstr "" -msgid ":ref:`Using asyncio.gather() to run things in parallel `." +#: ../../library/asyncio-api-index.rst:74 +msgid "" +":ref:`Using asyncio.gather() to run things in parallel " +"`." msgstr "" -msgid ":ref:`Using asyncio.wait_for() to enforce a timeout `." +#: ../../library/asyncio-api-index.rst:77 +msgid "" +":ref:`Using asyncio.wait_for() to enforce a timeout " +"`." msgstr "" +#: ../../library/asyncio-api-index.rst:80 msgid ":ref:`Cancellation `." msgstr "" +#: ../../library/asyncio-api-index.rst:82 msgid ":ref:`Using asyncio.sleep() `." msgstr "" +#: ../../library/asyncio-api-index.rst:84 msgid "See also the main :ref:`Tasks documentation page `." msgstr "" +#: ../../library/asyncio-api-index.rst:88 msgid "Queues" msgstr "" -msgid "Queues should be used to distribute work amongst multiple asyncio Tasks, implement connection pools, and pub/sub patterns." +#: ../../library/asyncio-api-index.rst:90 +msgid "" +"Queues should be used to distribute work amongst multiple asyncio Tasks, " +"implement connection pools, and pub/sub patterns." msgstr "" +#: ../../library/asyncio-api-index.rst:98 msgid ":class:`Queue`" msgstr "" +#: ../../library/asyncio-api-index.rst:99 msgid "A FIFO queue." msgstr "" +#: ../../library/asyncio-api-index.rst:101 msgid ":class:`PriorityQueue`" msgstr "" +#: ../../library/asyncio-api-index.rst:102 msgid "A priority queue." msgstr "" +#: ../../library/asyncio-api-index.rst:104 msgid ":class:`LifoQueue`" msgstr "" +#: ../../library/asyncio-api-index.rst:105 msgid "A LIFO queue." msgstr "" -msgid ":ref:`Using asyncio.Queue to distribute workload between several Tasks `." +#: ../../library/asyncio-api-index.rst:110 +msgid "" +":ref:`Using asyncio.Queue to distribute workload between several Tasks " +"`." msgstr "" +#: ../../library/asyncio-api-index.rst:113 msgid "See also the :ref:`Queues documentation page `." msgstr "" +#: ../../library/asyncio-api-index.rst:117 msgid "Subprocesses" msgstr "" +#: ../../library/asyncio-api-index.rst:119 msgid "Utilities to spawn subprocesses and run shell commands." msgstr "" +#: ../../library/asyncio-api-index.rst:125 msgid "``await`` :func:`create_subprocess_exec`" msgstr "" +#: ../../library/asyncio-api-index.rst:126 msgid "Create a subprocess." msgstr "" +#: ../../library/asyncio-api-index.rst:128 msgid "``await`` :func:`create_subprocess_shell`" msgstr "" +#: ../../library/asyncio-api-index.rst:129 msgid "Run a shell command." msgstr "" +#: ../../library/asyncio-api-index.rst:134 msgid ":ref:`Executing a shell command `." msgstr "" +#: ../../library/asyncio-api-index.rst:136 msgid "See also the :ref:`subprocess APIs ` documentation." msgstr "" +#: ../../library/asyncio-api-index.rst:141 msgid "Streams" msgstr "" +#: ../../library/asyncio-api-index.rst:143 msgid "High-level APIs to work with network IO." msgstr "" +#: ../../library/asyncio-api-index.rst:149 msgid "``await`` :func:`open_connection`" msgstr "" +#: ../../library/asyncio-api-index.rst:150 msgid "Establish a TCP connection." msgstr "" +#: ../../library/asyncio-api-index.rst:152 msgid "``await`` :func:`open_unix_connection`" msgstr "" +#: ../../library/asyncio-api-index.rst:153 msgid "Establish a Unix socket connection." msgstr "" +#: ../../library/asyncio-api-index.rst:155 msgid "``await`` :func:`start_server`" msgstr "" +#: ../../library/asyncio-api-index.rst:156 msgid "Start a TCP server." msgstr "" +#: ../../library/asyncio-api-index.rst:158 msgid "``await`` :func:`start_unix_server`" msgstr "" +#: ../../library/asyncio-api-index.rst:159 msgid "Start a Unix socket server." msgstr "" +#: ../../library/asyncio-api-index.rst:161 msgid ":class:`StreamReader`" msgstr "" +#: ../../library/asyncio-api-index.rst:162 msgid "High-level async/await object to receive network data." msgstr "" +#: ../../library/asyncio-api-index.rst:164 msgid ":class:`StreamWriter`" msgstr "" +#: ../../library/asyncio-api-index.rst:165 msgid "High-level async/await object to send network data." msgstr "" +#: ../../library/asyncio-api-index.rst:170 msgid ":ref:`Example TCP client `." msgstr "" +#: ../../library/asyncio-api-index.rst:172 msgid "See also the :ref:`streams APIs ` documentation." msgstr "" +#: ../../library/asyncio-api-index.rst:177 msgid "Synchronization" msgstr "" +#: ../../library/asyncio-api-index.rst:179 msgid "Threading-like synchronization primitives that can be used in Tasks." msgstr "" +#: ../../library/asyncio-api-index.rst:185 msgid ":class:`Lock`" msgstr "" +#: ../../library/asyncio-api-index.rst:186 msgid "A mutex lock." msgstr "" +#: ../../library/asyncio-api-index.rst:188 msgid ":class:`Event`" msgstr "" +#: ../../library/asyncio-api-index.rst:189 msgid "An event object." msgstr "" +#: ../../library/asyncio-api-index.rst:191 msgid ":class:`Condition`" msgstr "" +#: ../../library/asyncio-api-index.rst:192 msgid "A condition object." msgstr "" +#: ../../library/asyncio-api-index.rst:194 msgid ":class:`Semaphore`" msgstr "" +#: ../../library/asyncio-api-index.rst:195 msgid "A semaphore." msgstr "" +#: ../../library/asyncio-api-index.rst:197 msgid ":class:`BoundedSemaphore`" msgstr "" +#: ../../library/asyncio-api-index.rst:198 msgid "A bounded semaphore." msgstr "" +#: ../../library/asyncio-api-index.rst:200 msgid ":class:`Barrier`" msgstr "" +#: ../../library/asyncio-api-index.rst:201 msgid "A barrier object." msgstr "" +#: ../../library/asyncio-api-index.rst:206 msgid ":ref:`Using asyncio.Event `." msgstr "" +#: ../../library/asyncio-api-index.rst:208 msgid ":ref:`Using asyncio.Barrier `." msgstr "" -msgid "See also the documentation of asyncio :ref:`synchronization primitives `." +#: ../../library/asyncio-api-index.rst:210 +msgid "" +"See also the documentation of asyncio :ref:`synchronization primitives " +"`." msgstr "" +#: ../../library/asyncio-api-index.rst:215 msgid "Exceptions" msgstr "" +#: ../../library/asyncio-api-index.rst:222 msgid ":exc:`asyncio.CancelledError`" msgstr "" +#: ../../library/asyncio-api-index.rst:223 msgid "Raised when a Task is cancelled. See also :meth:`Task.cancel`." msgstr "" +#: ../../library/asyncio-api-index.rst:225 msgid ":exc:`asyncio.BrokenBarrierError`" msgstr "" +#: ../../library/asyncio-api-index.rst:226 msgid "Raised when a Barrier is broken. See also :meth:`Barrier.wait`." msgstr "" -msgid ":ref:`Handling CancelledError to run code on cancellation request `." +#: ../../library/asyncio-api-index.rst:231 +msgid "" +":ref:`Handling CancelledError to run code on cancellation request " +"`." msgstr "" -msgid "See also the full list of :ref:`asyncio-specific exceptions `." +#: ../../library/asyncio-api-index.rst:234 +msgid "" +"See also the full list of :ref:`asyncio-specific exceptions `." msgstr "" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index c31574dff..ecb535ea2 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,81 +23,140 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-dev.rst:7 msgid "Developing with asyncio" msgstr "" -msgid "Asynchronous programming is different from classic \"sequential\" programming." +#: ../../library/asyncio-dev.rst:9 +msgid "" +"Asynchronous programming is different from classic \"sequential\" " +"programming." msgstr "" -msgid "This page lists common mistakes and traps and explains how to avoid them." +#: ../../library/asyncio-dev.rst:12 +msgid "" +"This page lists common mistakes and traps and explains how to avoid them." msgstr "" +#: ../../library/asyncio-dev.rst:19 msgid "Debug Mode" msgstr "" -msgid "By default asyncio runs in production mode. In order to ease the development asyncio has a *debug mode*." +#: ../../library/asyncio-dev.rst:21 +msgid "" +"By default asyncio runs in production mode. In order to ease the " +"development asyncio has a *debug mode*." msgstr "" +#: ../../library/asyncio-dev.rst:24 msgid "There are several ways to enable asyncio debug mode:" msgstr "" +#: ../../library/asyncio-dev.rst:26 msgid "Setting the :envvar:`PYTHONASYNCIODEBUG` environment variable to ``1``." msgstr "" +#: ../../library/asyncio-dev.rst:28 msgid "Using the :ref:`Python Development Mode `." msgstr "" +#: ../../library/asyncio-dev.rst:30 msgid "Passing ``debug=True`` to :func:`asyncio.run`." msgstr "" +#: ../../library/asyncio-dev.rst:32 msgid "Calling :meth:`loop.set_debug`." msgstr "" +#: ../../library/asyncio-dev.rst:34 msgid "In addition to enabling the debug mode, consider also:" msgstr "" -msgid "setting the log level of the :ref:`asyncio logger ` to :py:const:`logging.DEBUG`, for example the following snippet of code can be run at startup of the application::" +#: ../../library/asyncio-dev.rst:36 +msgid "" +"setting the log level of the :ref:`asyncio logger ` " +"to :py:const:`logging.DEBUG`, for example the following snippet of code can " +"be run at startup of the application::" msgstr "" +#: ../../library/asyncio-dev.rst:40 msgid "logging.basicConfig(level=logging.DEBUG)" msgstr "" -msgid "configuring the :mod:`warnings` module to display :exc:`ResourceWarning` warnings. One way of doing that is by using the :option:`-W` ``default`` command line option." +#: ../../library/asyncio-dev.rst:42 +msgid "" +"configuring the :mod:`warnings` module to display :exc:`ResourceWarning` " +"warnings. One way of doing that is by using the :option:`-W` ``default`` " +"command line option." msgstr "" +#: ../../library/asyncio-dev.rst:47 msgid "When the debug mode is enabled:" msgstr "" -msgid "Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:`loop.call_at` methods) raise an exception if they are called from a wrong thread." +#: ../../library/asyncio-dev.rst:49 +msgid "" +"Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` " +"and :meth:`loop.call_at` methods) raise an exception if they are called from " +"a wrong thread." msgstr "" -msgid "The execution time of the I/O selector is logged if it takes too long to perform an I/O operation." +#: ../../library/asyncio-dev.rst:53 +msgid "" +"The execution time of the I/O selector is logged if it takes too long to " +"perform an I/O operation." msgstr "" -msgid "Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop.slow_callback_duration` attribute can be used to set the minimum execution duration in seconds that is considered \"slow\"." +#: ../../library/asyncio-dev.rst:56 +msgid "" +"Callbacks taking longer than 100 milliseconds are logged. " +"The :attr:`loop.slow_callback_duration` attribute can be used to set the " +"minimum execution duration in seconds that is considered \"slow\"." msgstr "" +#: ../../library/asyncio-dev.rst:64 msgid "Concurrency and Multithreading" msgstr "" -msgid "An event loop runs in a thread (typically the main thread) and executes all callbacks and Tasks in its thread. While a Task is running in the event loop, no other Tasks can run in the same thread. When a Task executes an ``await`` expression, the running Task gets suspended, and the event loop executes the next Task." +#: ../../library/asyncio-dev.rst:66 +msgid "" +"An event loop runs in a thread (typically the main thread) and executes all " +"callbacks and Tasks in its thread. While a Task is running in the event " +"loop, no other Tasks can run in the same thread. When a Task executes an " +"``await`` expression, the running Task gets suspended, and the event loop " +"executes the next Task." msgstr "" -msgid "To schedule a :term:`callback` from another OS thread, the :meth:`loop.call_soon_threadsafe` method should be used. Example::" +#: ../../library/asyncio-dev.rst:72 +msgid "" +"To schedule a :term:`callback` from another OS thread, " +"the :meth:`loop.call_soon_threadsafe` method should be used. Example::" msgstr "" +#: ../../library/asyncio-dev.rst:75 msgid "loop.call_soon_threadsafe(callback, *args)" msgstr "" -msgid "Almost all asyncio objects are not thread safe, which is typically not a problem unless there is code that works with them from outside of a Task or a callback. If there's a need for such code to call a low-level asyncio API, the :meth:`loop.call_soon_threadsafe` method should be used, e.g.::" +#: ../../library/asyncio-dev.rst:77 +msgid "" +"Almost all asyncio objects are not thread safe, which is typically not a " +"problem unless there is code that works with them from outside of a Task or " +"a callback. If there's a need for such code to call a low-level asyncio " +"API, the :meth:`loop.call_soon_threadsafe` method should be used, e.g.::" msgstr "" +#: ../../library/asyncio-dev.rst:83 msgid "loop.call_soon_threadsafe(fut.cancel)" msgstr "" -msgid "To schedule a coroutine object from a different OS thread, the :func:`run_coroutine_threadsafe` function should be used. It returns a :class:`concurrent.futures.Future` to access the result::" +#: ../../library/asyncio-dev.rst:85 +msgid "" +"To schedule a coroutine object from a different OS thread, " +"the :func:`run_coroutine_threadsafe` function should be used. It returns " +"a :class:`concurrent.futures.Future` to access the result::" msgstr "" +#: ../../library/asyncio-dev.rst:89 msgid "" "async def coro_func():\n" " return await asyncio.sleep(1, 42)\n" @@ -109,45 +168,90 @@ msgid "" "result = future.result()" msgstr "" +#: ../../library/asyncio-dev.rst:98 msgid "To handle signals the event loop must be run in the main thread." msgstr "" -msgid "The :meth:`loop.run_in_executor` method can be used with a :class:`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures.InterpreterPoolExecutor` to execute blocking code in a different OS thread without blocking the OS thread that the event loop runs in." -msgstr "" - -msgid "There is currently no way to schedule coroutines or callbacks directly from a different process (such as one started with :mod:`multiprocessing`). The :ref:`asyncio-event-loop-methods` section lists APIs that can read from pipes and watch file descriptors without blocking the event loop. In addition, asyncio's :ref:`Subprocess ` APIs provide a way to start a process and communicate with it from the event loop. Lastly, the aforementioned :meth:`loop.run_in_executor` method can also be used with a :class:`concurrent.futures.ProcessPoolExecutor` to execute code in a different process." +#: ../../library/asyncio-dev.rst:101 +msgid "" +"The :meth:`loop.run_in_executor` method can be used with " +"a :class:`concurrent.futures.ThreadPoolExecutor` " +"or :class:`~concurrent.futures.InterpreterPoolExecutor` to execute blocking " +"code in a different OS thread without blocking the OS thread that the event " +"loop runs in." msgstr "" +#: ../../library/asyncio-dev.rst:107 +msgid "" +"There is currently no way to schedule coroutines or callbacks directly from " +"a different process (such as one started with :mod:`multiprocessing`). " +"The :ref:`asyncio-event-loop-methods` section lists APIs that can read from " +"pipes and watch file descriptors without blocking the event loop. In " +"addition, asyncio's :ref:`Subprocess ` APIs provide a " +"way to start a process and communicate with it from the event loop. Lastly, " +"the aforementioned :meth:`loop.run_in_executor` method can also be used with " +"a :class:`concurrent.futures.ProcessPoolExecutor` to execute code in a " +"different process." +msgstr "" + +#: ../../library/asyncio-dev.rst:121 msgid "Running Blocking Code" msgstr "" -msgid "Blocking (CPU-bound) code should not be called directly. For example, if a function performs a CPU-intensive calculation for 1 second, all concurrent asyncio Tasks and IO operations would be delayed by 1 second." +#: ../../library/asyncio-dev.rst:123 +msgid "" +"Blocking (CPU-bound) code should not be called directly. For example, if a " +"function performs a CPU-intensive calculation for 1 second, all concurrent " +"asyncio Tasks and IO operations would be delayed by 1 second." msgstr "" -msgid "An executor can be used to run a task in a different thread, including in a different interpreter, or even in a different process to avoid blocking the OS thread with the event loop. See the :meth:`loop.run_in_executor` method for more details." +#: ../../library/asyncio-dev.rst:128 +msgid "" +"An executor can be used to run a task in a different thread, including in a " +"different interpreter, or even in a different process to avoid blocking the " +"OS thread with the event loop. See the :meth:`loop.run_in_executor` method " +"for more details." msgstr "" +#: ../../library/asyncio-dev.rst:138 msgid "Logging" msgstr "" -msgid "asyncio uses the :mod:`logging` module and all logging is performed via the ``\"asyncio\"`` logger." +#: ../../library/asyncio-dev.rst:140 +msgid "" +"asyncio uses the :mod:`logging` module and all logging is performed via the " +"``\"asyncio\"`` logger." msgstr "" -msgid "The default log level is :py:const:`logging.INFO`, which can be easily adjusted::" +#: ../../library/asyncio-dev.rst:143 +msgid "" +"The default log level is :py:const:`logging.INFO`, which can be easily " +"adjusted::" msgstr "" +#: ../../library/asyncio-dev.rst:146 msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" msgstr "" -msgid "Network logging can block the event loop. It is recommended to use a separate thread for handling logs or use non-blocking IO. For example, see :ref:`blocking-handlers`." +#: ../../library/asyncio-dev.rst:149 +msgid "" +"Network logging can block the event loop. It is recommended to use a " +"separate thread for handling logs or use non-blocking IO. For example, " +"see :ref:`blocking-handlers`." msgstr "" +#: ../../library/asyncio-dev.rst:157 msgid "Detect never-awaited coroutines" msgstr "" -msgid "When a coroutine function is called, but not awaited (e.g. ``coro()`` instead of ``await coro()``) or the coroutine is not scheduled with :meth:`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::" +#: ../../library/asyncio-dev.rst:159 +msgid "" +"When a coroutine function is called, but not awaited (e.g. ``coro()`` " +"instead of ``await coro()``) or the coroutine is not scheduled " +"with :meth:`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::" msgstr "" +#: ../../library/asyncio-dev.rst:164 msgid "" "import asyncio\n" "\n" @@ -160,17 +264,22 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-dev.rst:174 ../../library/asyncio-dev.rst:219 +#: ../../library/asyncio-dev.rst:393 ../../library/asyncio-dev.rst:450 msgid "Output::" msgstr "" +#: ../../library/asyncio-dev.rst:176 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" " test()" msgstr "" +#: ../../library/asyncio-dev.rst:179 ../../library/asyncio-dev.rst:235 msgid "Output in debug mode::" msgstr "" +#: ../../library/asyncio-dev.rst:181 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" "Coroutine created at (most recent call last)\n" @@ -184,23 +293,35 @@ msgid "" " test()" msgstr "" -msgid "The usual fix is to either await the coroutine or call the :meth:`asyncio.create_task` function::" +#: ../../library/asyncio-dev.rst:192 +msgid "" +"The usual fix is to either await the coroutine or call " +"the :meth:`asyncio.create_task` function::" msgstr "" +#: ../../library/asyncio-dev.rst:195 msgid "" "async def main():\n" " await test()" msgstr "" +#: ../../library/asyncio-dev.rst:200 msgid "Detect never-retrieved exceptions" msgstr "" -msgid "If a :meth:`Future.set_exception` is called but the Future object is never awaited on, the exception would never be propagated to the user code. In this case, asyncio would emit a log message when the Future object is garbage collected." +#: ../../library/asyncio-dev.rst:202 +msgid "" +"If a :meth:`Future.set_exception` is called but the Future object is never " +"awaited on, the exception would never be propagated to the user code. In " +"this case, asyncio would emit a log message when the Future object is " +"garbage collected." msgstr "" +#: ../../library/asyncio-dev.rst:207 msgid "Example of an unhandled exception::" msgstr "" +#: ../../library/asyncio-dev.rst:209 msgid "" "import asyncio\n" "\n" @@ -213,6 +334,7 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-dev.rst:221 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -224,12 +346,17 @@ msgid "" "Exception: not consumed" msgstr "" -msgid ":ref:`Enable the debug mode ` to get the traceback where the task was created::" +#: ../../library/asyncio-dev.rst:230 +msgid "" +":ref:`Enable the debug mode ` to get the traceback where " +"the task was created::" msgstr "" +#: ../../library/asyncio-dev.rst:233 msgid "asyncio.run(main(), debug=True)" msgstr "" +#: ../../library/asyncio-dev.rst:237 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -247,21 +374,39 @@ msgid "" "Exception: not consumed" msgstr "" +#: ../../library/asyncio-dev.rst:254 msgid "Asynchronous generators best practices" msgstr "" -msgid "Writing correct and efficient asyncio code requires awareness of certain pitfalls. This section outlines essential best practices that can save you hours of debugging." +#: ../../library/asyncio-dev.rst:256 +msgid "" +"Writing correct and efficient asyncio code requires awareness of certain " +"pitfalls. This section outlines essential best practices that can save you " +"hours of debugging." msgstr "" +#: ../../library/asyncio-dev.rst:261 msgid "Close asynchronous generators explicitly" msgstr "" -msgid "It is recommended to manually close the :term:`asynchronous generator `. If a generator exits early - for example, due to an exception raised in the body of an ``async for`` loop - its asynchronous cleanup code may run in an unexpected context. This can occur after the tasks it depends on have completed, or during the event loop shutdown when the async-generator's garbage collection hook is called." +#: ../../library/asyncio-dev.rst:263 +msgid "" +"It is recommended to manually close the :term:`asynchronous generator " +"`. If a generator exits early - for " +"example, due to an exception raised in the body of an ``async for`` loop - " +"its asynchronous cleanup code may run in an unexpected context. This can " +"occur after the tasks it depends on have completed, or during the event loop " +"shutdown when the async-generator's garbage collection hook is called." msgstr "" -msgid "To avoid this, explicitly close the generator by calling its :meth:`~agen.aclose` method, or use the :func:`contextlib.aclosing` context manager::" +#: ../../library/asyncio-dev.rst:271 +msgid "" +"To avoid this, explicitly close the generator by calling " +"its :meth:`~agen.aclose` method, or use the :func:`contextlib.aclosing` " +"context manager::" msgstr "" +#: ../../library/asyncio-dev.rst:275 msgid "" "import asyncio\n" "import contextlib\n" @@ -278,9 +423,14 @@ msgid "" "asyncio.run(func())" msgstr "" -msgid "As noted above, the cleanup code for these asynchronous generators is deferred. The following example demonstrates that the finalization of an asynchronous generator can occur in an unexpected order::" +#: ../../library/asyncio-dev.rst:289 +msgid "" +"As noted above, the cleanup code for these asynchronous generators is " +"deferred. The following example demonstrates that the finalization of an " +"asynchronous generator can occur in an unexpected order::" msgstr "" +#: ../../library/asyncio-dev.rst:293 msgid "" "import asyncio\n" "work_done = False\n" @@ -309,12 +459,15 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-dev.rst:319 msgid "For this example, we get the following output::" msgstr "" +#: ../../library/asyncio-dev.rst:321 msgid "" "unhandled exception during asyncio.run() shutdown\n" -"task: ()> exception=AssertionError()>\n" +"task: ()> exception=AssertionError()>\n" "Traceback (most recent call last):\n" " File \"example.py\", line 6, in cursor\n" " yield 1\n" @@ -329,12 +482,19 @@ msgid "" "AssertionError" msgstr "" -msgid "The ``cursor()`` asynchronous generator was finalized before the ``rows`` generator - an unexpected behavior." +#: ../../library/asyncio-dev.rst:336 +msgid "" +"The ``cursor()`` asynchronous generator was finalized before the ``rows`` " +"generator - an unexpected behavior." msgstr "" -msgid "The example can be fixed by explicitly closing the ``cursor`` and ``rows`` async-generators::" +#: ../../library/asyncio-dev.rst:339 +msgid "" +"The example can be fixed by explicitly closing the ``cursor`` and ``rows`` " +"async-generators::" msgstr "" +#: ../../library/asyncio-dev.rst:342 msgid "" "async def main():\n" " async with contextlib.aclosing(cursor()) as cursor_gen:\n" @@ -345,27 +505,52 @@ msgid "" " break" msgstr "" +#: ../../library/asyncio-dev.rst:352 msgid "Create asynchronous generators only when the event loop is running" msgstr "" -msgid "It is recommended to create :term:`asynchronous generators ` only after the event loop has been created." +#: ../../library/asyncio-dev.rst:354 +msgid "" +"It is recommended to create :term:`asynchronous generators ` only after the event loop has been created." msgstr "" -msgid "To ensure that asynchronous generators close reliably, the event loop uses the :func:`sys.set_asyncgen_hooks` function to register callback functions. These callbacks update the list of running asynchronous generators to keep it in a consistent state." +#: ../../library/asyncio-dev.rst:358 +msgid "" +"To ensure that asynchronous generators close reliably, the event loop uses " +"the :func:`sys.set_asyncgen_hooks` function to register callback functions. " +"These callbacks update the list of running asynchronous generators to keep " +"it in a consistent state." msgstr "" -msgid "When the :meth:`loop.shutdown_asyncgens() ` function is called, the running generators are stopped gracefully and the list is cleared." +#: ../../library/asyncio-dev.rst:363 +msgid "" +"When the :meth:`loop.shutdown_asyncgens() ` " +"function is called, the running generators are stopped gracefully and the " +"list is cleared." msgstr "" -msgid "The asynchronous generator invokes the corresponding system hook during its first iteration. At the same time, the generator records that the hook has been called and does not call it again." +#: ../../library/asyncio-dev.rst:367 +msgid "" +"The asynchronous generator invokes the corresponding system hook during its " +"first iteration. At the same time, the generator records that the hook has " +"been called and does not call it again." msgstr "" -msgid "Therefore, if iteration begins before the event loop is created, the event loop will not be able to add the generator to its list of active generators because the hooks are set after the generator attempts to call them. Consequently, the event loop will not be able to terminate the generator if necessary." +#: ../../library/asyncio-dev.rst:371 +msgid "" +"Therefore, if iteration begins before the event loop is created, the event " +"loop will not be able to add the generator to its list of active generators " +"because the hooks are set after the generator attempts to call them. " +"Consequently, the event loop will not be able to terminate the generator if " +"necessary." msgstr "" +#: ../../library/asyncio-dev.rst:377 msgid "Consider the following example::" msgstr "" +#: ../../library/asyncio-dev.rst:379 msgid "" "import asyncio\n" "\n" @@ -382,9 +567,11 @@ msgid "" " del agen" msgstr "" +#: ../../library/asyncio-dev.rst:395 msgid "" "10\n" -"Exception ignored while closing generator :\n" +"Exception ignored while closing generator :\n" "Traceback (most recent call last):\n" " File \"example.py\", line 13, in \n" " del agen\n" @@ -392,9 +579,11 @@ msgid "" "RuntimeError: async generator ignored GeneratorExit" msgstr "" +#: ../../library/asyncio-dev.rst:403 msgid "This example can be fixed as follows::" msgstr "" +#: ../../library/asyncio-dev.rst:405 msgid "" "import asyncio\n" "\n" @@ -412,15 +601,23 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-dev.rst:422 msgid "Avoid concurrent iteration and closure of the same generator" msgstr "" -msgid "Async generators may be reentered while another :meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` call is in progress. This may lead to an inconsistent state of the async generator and can cause errors." +#: ../../library/asyncio-dev.rst:424 +msgid "" +"Async generators may be reentered while " +"another :meth:`~agen.__anext__` / :meth:`~agen.athrow` / :meth:`~agen.aclose` " +"call is in progress. This may lead to an inconsistent state of the async " +"generator and can cause errors." msgstr "" +#: ../../library/asyncio-dev.rst:429 msgid "Let's consider the following example::" msgstr "" +#: ../../library/asyncio-dev.rst:431 msgid "" "import asyncio\n" "\n" @@ -442,6 +639,7 @@ msgid "" "asyncio.run(amain())" msgstr "" +#: ../../library/asyncio-dev.rst:452 msgid "" "received A\n" "Traceback (most recent call last):\n" @@ -462,5 +660,8 @@ msgid "" "RuntimeError: anext(): asynchronous generator is already running" msgstr "" -msgid "Therefore, it is recommended to avoid using asynchronous generators in parallel tasks or across multiple event loops." +#: ../../library/asyncio-dev.rst:471 +msgid "" +"Therefore, it is recommended to avoid using asynchronous generators in " +"parallel tasks or across multiple event loops." msgstr "" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index a574a3993..cf6b0cac5 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,144 +24,255 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-eventloop.rst:8 msgid "Event loop" msgstr "" -msgid "**Source code:** :source:`Lib/asyncio/events.py`, :source:`Lib/asyncio/base_events.py`" +#: ../../library/asyncio-eventloop.rst:10 +msgid "" +"**Source code:** :source:`Lib/asyncio/events.py`, :source:`Lib/asyncio/" +"base_events.py`" msgstr "" +#: ../../library/asyncio-eventloop.rst:16 msgid "Preface" msgstr "" -msgid "The event loop is the core of every asyncio application. Event loops run asynchronous tasks and callbacks, perform network IO operations, and run subprocesses." +#: ../../library/asyncio-eventloop.rst:17 +msgid "" +"The event loop is the core of every asyncio application. Event loops run " +"asynchronous tasks and callbacks, perform network IO operations, and run " +"subprocesses." msgstr "" -msgid "Application developers should typically use the high-level asyncio functions, such as :func:`asyncio.run`, and should rarely need to reference the loop object or call its methods. This section is intended mostly for authors of lower-level code, libraries, and frameworks, who need finer control over the event loop behavior." +#: ../../library/asyncio-eventloop.rst:21 +msgid "" +"Application developers should typically use the high-level asyncio " +"functions, such as :func:`asyncio.run`, and should rarely need to reference " +"the loop object or call its methods. This section is intended mostly for " +"authors of lower-level code, libraries, and frameworks, who need finer " +"control over the event loop behavior." msgstr "" +#: ../../library/asyncio-eventloop.rst:28 msgid "Obtaining the Event Loop" msgstr "" -msgid "The following low-level functions can be used to get, set, or create an event loop:" +#: ../../library/asyncio-eventloop.rst:29 +msgid "" +"The following low-level functions can be used to get, set, or create an " +"event loop:" msgstr "" +#: ../../library/asyncio-eventloop.rst:34 msgid "Return the running event loop in the current OS thread." msgstr "" +#: ../../library/asyncio-eventloop.rst:36 msgid "Raise a :exc:`RuntimeError` if there is no running event loop." msgstr "" +#: ../../library/asyncio-eventloop.rst:38 msgid "This function can only be called from a coroutine or a callback." msgstr "" +#: ../../library/asyncio-eventloop.rst:44 msgid "Get the current event loop." msgstr "" -msgid "When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop." +#: ../../library/asyncio-eventloop.rst:46 +msgid "" +"When called from a coroutine or a callback (e.g. scheduled with call_soon or " +"similar API), this function will always return the running event loop." msgstr "" -msgid "If there is no running event loop set, the function will return the result of the ``get_event_loop_policy().get_event_loop()`` call." +#: ../../library/asyncio-eventloop.rst:50 +msgid "" +"If there is no running event loop set, the function will return the result " +"of the ``get_event_loop_policy().get_event_loop()`` call." msgstr "" -msgid "Because this function has rather complex behavior (especially when custom event loop policies are in use), using the :func:`get_running_loop` function is preferred to :func:`get_event_loop` in coroutines and callbacks." +#: ../../library/asyncio-eventloop.rst:53 +msgid "" +"Because this function has rather complex behavior (especially when custom " +"event loop policies are in use), using the :func:`get_running_loop` function " +"is preferred to :func:`get_event_loop` in coroutines and callbacks." msgstr "" -msgid "As noted above, consider using the higher-level :func:`asyncio.run` function, instead of using these lower level functions to manually create and close an event loop." +#: ../../library/asyncio-eventloop.rst:58 +msgid "" +"As noted above, consider using the higher-level :func:`asyncio.run` " +"function, instead of using these lower level functions to manually create " +"and close an event loop." msgstr "" +#: ../../library/asyncio-eventloop.rst:62 msgid "Raises a :exc:`RuntimeError` if there is no current event loop." msgstr "" -msgid "The :mod:`!asyncio` policy system is deprecated and will be removed in Python 3.16; from there on, this function will return the current running event loop if present else it will return the loop set by :func:`set_event_loop`." +#: ../../library/asyncio-eventloop.rst:67 +msgid "" +"The :mod:`!asyncio` policy system is deprecated and will be removed in " +"Python 3.16; from there on, this function will return the current running " +"event loop if present else it will return the loop set " +"by :func:`set_event_loop`." msgstr "" +#: ../../library/asyncio-eventloop.rst:74 msgid "Set *loop* as the current event loop for the current OS thread." msgstr "" +#: ../../library/asyncio-eventloop.rst:78 msgid "Create and return a new event loop object." msgstr "" -msgid "Note that the behaviour of :func:`get_event_loop`, :func:`set_event_loop`, and :func:`new_event_loop` functions can be altered by :ref:`setting a custom event loop policy `." +#: ../../library/asyncio-eventloop.rst:80 +msgid "" +"Note that the behaviour of :func:`get_event_loop`, :func:`set_event_loop`, " +"and :func:`new_event_loop` functions can be altered by :ref:`setting a " +"custom event loop policy `." msgstr "" +#: ../../library/asyncio-eventloop.rst:86 msgid "Contents" msgstr "" +#: ../../library/asyncio-eventloop.rst:87 msgid "This documentation page contains the following sections:" msgstr "" -msgid "The `Event Loop Methods`_ section is the reference documentation of the event loop APIs;" +#: ../../library/asyncio-eventloop.rst:89 +msgid "" +"The `Event Loop Methods`_ section is the reference documentation of the " +"event loop APIs;" msgstr "" -msgid "The `Callback Handles`_ section documents the :class:`Handle` and :class:`TimerHandle` instances which are returned from scheduling methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" +#: ../../library/asyncio-eventloop.rst:92 +msgid "" +"The `Callback Handles`_ section documents the :class:`Handle` " +"and :class:`TimerHandle` instances which are returned from scheduling " +"methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -msgid "The `Server Objects`_ section documents types returned from event loop methods like :meth:`loop.create_server`;" +#: ../../library/asyncio-eventloop.rst:96 +msgid "" +"The `Server Objects`_ section documents types returned from event loop " +"methods like :meth:`loop.create_server`;" msgstr "" -msgid "The `Event Loop Implementations`_ section documents the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" +#: ../../library/asyncio-eventloop.rst:99 +msgid "" +"The `Event Loop Implementations`_ section documents " +"the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -msgid "The `Examples`_ section showcases how to work with some event loop APIs." +#: ../../library/asyncio-eventloop.rst:102 +msgid "" +"The `Examples`_ section showcases how to work with some event loop APIs." msgstr "" +#: ../../library/asyncio-eventloop.rst:109 msgid "Event loop methods" msgstr "" +#: ../../library/asyncio-eventloop.rst:111 msgid "Event loops have **low-level** APIs for the following:" msgstr "" +#: ../../library/asyncio-eventloop.rst:119 msgid "Running and stopping the loop" msgstr "" +#: ../../library/asyncio-eventloop.rst:123 msgid "Run until the *future* (an instance of :class:`Future`) has completed." msgstr "" -msgid "If the argument is a :ref:`coroutine object ` it is implicitly scheduled to run as a :class:`asyncio.Task`." +#: ../../library/asyncio-eventloop.rst:126 +msgid "" +"If the argument is a :ref:`coroutine object ` it is implicitly " +"scheduled to run as a :class:`asyncio.Task`." msgstr "" +#: ../../library/asyncio-eventloop.rst:129 msgid "Return the Future's result or raise its exception." msgstr "" +#: ../../library/asyncio-eventloop.rst:133 msgid "Run the event loop until :meth:`stop` is called." msgstr "" -msgid "If :meth:`stop` is called before :meth:`run_forever` is called, the loop will poll the I/O selector once with a timeout of zero, run all callbacks scheduled in response to I/O events (and those that were already scheduled), and then exit." +#: ../../library/asyncio-eventloop.rst:135 +msgid "" +"If :meth:`stop` is called before :meth:`run_forever` is called, the loop " +"will poll the I/O selector once with a timeout of zero, run all callbacks " +"scheduled in response to I/O events (and those that were already scheduled), " +"and then exit." msgstr "" -msgid "If :meth:`stop` is called while :meth:`run_forever` is running, the loop will run the current batch of callbacks and then exit. Note that new callbacks scheduled by callbacks will not run in this case; instead, they will run the next time :meth:`run_forever` or :meth:`run_until_complete` is called." +#: ../../library/asyncio-eventloop.rst:140 +msgid "" +"If :meth:`stop` is called while :meth:`run_forever` is running, the loop " +"will run the current batch of callbacks and then exit. Note that new " +"callbacks scheduled by callbacks will not run in this case; instead, they " +"will run the next time :meth:`run_forever` or :meth:`run_until_complete` is " +"called." msgstr "" +#: ../../library/asyncio-eventloop.rst:148 msgid "Stop the event loop." msgstr "" +#: ../../library/asyncio-eventloop.rst:152 msgid "Return ``True`` if the event loop is currently running." msgstr "" +#: ../../library/asyncio-eventloop.rst:156 msgid "Return ``True`` if the event loop was closed." msgstr "" +#: ../../library/asyncio-eventloop.rst:160 msgid "Close the event loop." msgstr "" -msgid "The loop must not be running when this function is called. Any pending callbacks will be discarded." +#: ../../library/asyncio-eventloop.rst:162 +msgid "" +"The loop must not be running when this function is called. Any pending " +"callbacks will be discarded." msgstr "" -msgid "This method clears all queues and shuts down the executor, but does not wait for the executor to finish." +#: ../../library/asyncio-eventloop.rst:165 +msgid "" +"This method clears all queues and shuts down the executor, but does not wait " +"for the executor to finish." msgstr "" -msgid "This method is idempotent and irreversible. No other methods should be called after the event loop is closed." +#: ../../library/asyncio-eventloop.rst:168 +msgid "" +"This method is idempotent and irreversible. No other methods should be " +"called after the event loop is closed." msgstr "" -msgid "Schedule all currently open :term:`asynchronous generator` objects to close with an :meth:`~agen.aclose` call. After calling this method, the event loop will issue a warning if a new asynchronous generator is iterated. This should be used to reliably finalize all scheduled asynchronous generators." +#: ../../library/asyncio-eventloop.rst:174 +msgid "" +"Schedule all currently open :term:`asynchronous generator` objects to close " +"with an :meth:`~agen.aclose` call. After calling this method, the event " +"loop will issue a warning if a new asynchronous generator is iterated. This " +"should be used to reliably finalize all scheduled asynchronous generators." msgstr "" -msgid "Note that there is no need to call this function when :func:`asyncio.run` is used." +#: ../../library/asyncio-eventloop.rst:180 +msgid "" +"Note that there is no need to call this function when :func:`asyncio.run` is " +"used." msgstr "" +#: ../../library/asyncio-eventloop.rst:183 +#: ../../library/asyncio-eventloop.rst:1397 +#: ../../library/asyncio-eventloop.rst:1859 msgid "Example::" msgstr "" +#: ../../library/asyncio-eventloop.rst:185 msgid "" "try:\n" " loop.run_forever()\n" @@ -170,702 +281,1474 @@ msgid "" " loop.close()" msgstr "" -msgid "Schedule the closure of the default executor and wait for it to join all of the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once this method has been called, using the default executor with :meth:`loop.run_in_executor` will raise a :exc:`RuntimeError`." +#: ../../library/asyncio-eventloop.rst:196 +msgid "" +"Schedule the closure of the default executor and wait for it to join all of " +"the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " +"this method has been called, using the default executor " +"with :meth:`loop.run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" -msgid "The *timeout* parameter specifies the amount of time (in :class:`float` seconds) the executor will be given to finish joining. With the default, ``None``, the executor is allowed an unlimited amount of time." +#: ../../library/asyncio-eventloop.rst:202 +msgid "" +"The *timeout* parameter specifies the amount of time (in :class:`float` " +"seconds) the executor will be given to finish joining. With the default, " +"``None``, the executor is allowed an unlimited amount of time." msgstr "" -msgid "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the default executor is terminated without waiting for its threads to finish joining." +#: ../../library/asyncio-eventloop.rst:207 +msgid "" +"If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " +"default executor is terminated without waiting for its threads to finish " +"joining." msgstr "" -msgid "Do not call this method when using :func:`asyncio.run`, as the latter handles default executor shutdown automatically." +#: ../../library/asyncio-eventloop.rst:213 +msgid "" +"Do not call this method when using :func:`asyncio.run`, as the latter " +"handles default executor shutdown automatically." msgstr "" +#: ../../library/asyncio-eventloop.rst:218 msgid "Added the *timeout* parameter." msgstr "" +#: ../../library/asyncio-eventloop.rst:222 msgid "Scheduling callbacks" msgstr "" -msgid "Schedule the *callback* :term:`callback` to be called with *args* arguments at the next iteration of the event loop." +#: ../../library/asyncio-eventloop.rst:226 +msgid "" +"Schedule the *callback* :term:`callback` to be called with *args* arguments " +"at the next iteration of the event loop." msgstr "" -msgid "Return an instance of :class:`asyncio.Handle`, which can be used later to cancel the callback." +#: ../../library/asyncio-eventloop.rst:229 +msgid "" +"Return an instance of :class:`asyncio.Handle`, which can be used later to " +"cancel the callback." msgstr "" -msgid "Callbacks are called in the order in which they are registered. Each callback will be called exactly once." +#: ../../library/asyncio-eventloop.rst:232 +msgid "" +"Callbacks are called in the order in which they are registered. Each " +"callback will be called exactly once." msgstr "" -msgid "The optional keyword-only *context* argument specifies a custom :class:`contextvars.Context` for the *callback* to run in. Callbacks use the current context when no *context* is provided." +#: ../../library/asyncio-eventloop.rst:235 +msgid "" +"The optional keyword-only *context* argument specifies a " +"custom :class:`contextvars.Context` for the *callback* to run in. Callbacks " +"use the current context when no *context* is provided." msgstr "" +#: ../../library/asyncio-eventloop.rst:239 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "" -msgid "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from another thread, this function *must* be used, since :meth:`call_soon` is not thread-safe." +#: ../../library/asyncio-eventloop.rst:243 +msgid "" +"A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " +"another thread, this function *must* be used, since :meth:`call_soon` is not " +"thread-safe." msgstr "" -msgid "This function is safe to be called from a reentrant context or signal handler, however, it is not safe or fruitful to use the returned handle in such contexts." +#: ../../library/asyncio-eventloop.rst:247 +msgid "" +"This function is safe to be called from a reentrant context or signal " +"handler, however, it is not safe or fruitful to use the returned handle in " +"such contexts." msgstr "" -msgid "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can happen on a secondary thread when the main application is shutting down." +#: ../../library/asyncio-eventloop.rst:250 +msgid "" +"Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " +"happen on a secondary thread when the main application is shutting down." msgstr "" -msgid "See the :ref:`concurrency and multithreading ` section of the documentation." +#: ../../library/asyncio-eventloop.rst:254 +msgid "" +"See the :ref:`concurrency and multithreading ` " +"section of the documentation." msgstr "" -msgid "The *context* keyword-only parameter was added. See :pep:`567` for more details." +#: ../../library/asyncio-eventloop.rst:257 +#: ../../library/asyncio-eventloop.rst:314 +#: ../../library/asyncio-eventloop.rst:340 +msgid "" +"The *context* keyword-only parameter was added. See :pep:`567` for more " +"details." msgstr "" -msgid "Most :mod:`asyncio` scheduling functions don't allow passing keyword arguments. To do that, use :func:`functools.partial`::" +#: ../../library/asyncio-eventloop.rst:265 +msgid "" +"Most :mod:`asyncio` scheduling functions don't allow passing keyword " +"arguments. To do that, use :func:`functools.partial`::" msgstr "" +#: ../../library/asyncio-eventloop.rst:268 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" msgstr "" -msgid "Using partial objects is usually more convenient than using lambdas, as asyncio can render partial objects better in debug and error messages." +#: ../../library/asyncio-eventloop.rst:272 +msgid "" +"Using partial objects is usually more convenient than using lambdas, as " +"asyncio can render partial objects better in debug and error messages." msgstr "" +#: ../../library/asyncio-eventloop.rst:280 msgid "Scheduling delayed callbacks" msgstr "" -msgid "Event loop provides mechanisms to schedule callback functions to be called at some point in the future. Event loop uses monotonic clocks to track time." +#: ../../library/asyncio-eventloop.rst:282 +msgid "" +"Event loop provides mechanisms to schedule callback functions to be called " +"at some point in the future. Event loop uses monotonic clocks to track time." msgstr "" -msgid "Schedule *callback* to be called after the given *delay* number of seconds (can be either an int or a float)." +#: ../../library/asyncio-eventloop.rst:289 +msgid "" +"Schedule *callback* to be called after the given *delay* number of seconds " +"(can be either an int or a float)." msgstr "" -msgid "An instance of :class:`asyncio.TimerHandle` is returned which can be used to cancel the callback." +#: ../../library/asyncio-eventloop.rst:292 +#: ../../library/asyncio-eventloop.rst:331 +msgid "" +"An instance of :class:`asyncio.TimerHandle` is returned which can be used to " +"cancel the callback." msgstr "" -msgid "*callback* will be called exactly once. If two callbacks are scheduled for exactly the same time, the order in which they are called is undefined." +#: ../../library/asyncio-eventloop.rst:295 +msgid "" +"*callback* will be called exactly once. If two callbacks are scheduled for " +"exactly the same time, the order in which they are called is undefined." msgstr "" -msgid "The optional positional *args* will be passed to the callback when it is called. Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." +#: ../../library/asyncio-eventloop.rst:299 +msgid "" +"The optional positional *args* will be passed to the callback when it is " +"called. Use :func:`functools.partial` :ref:`to pass keyword arguments " +"` to *callback*." msgstr "" -msgid "An optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the *callback* to run in. The current context is used when no *context* is provided." +#: ../../library/asyncio-eventloop.rst:304 +msgid "" +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" -msgid "For performance, callbacks scheduled with :meth:`loop.call_later` may run up to one clock-resolution early (see ``time.get_clock_info('monotonic').resolution``)." +#: ../../library/asyncio-eventloop.rst:310 +msgid "" +"For performance, callbacks scheduled with :meth:`loop.call_later` may run up " +"to one clock-resolution early (see " +"``time.get_clock_info('monotonic').resolution``)." msgstr "" -msgid "In Python 3.7 and earlier with the default event loop implementation, the *delay* could not exceed one day. This has been fixed in Python 3.8." +#: ../../library/asyncio-eventloop.rst:318 +msgid "" +"In Python 3.7 and earlier with the default event loop implementation, the " +"*delay* could not exceed one day. This has been fixed in Python 3.8." msgstr "" -msgid "Schedule *callback* to be called at the given absolute timestamp *when* (an int or a float), using the same time reference as :meth:`loop.time`." +#: ../../library/asyncio-eventloop.rst:325 +msgid "" +"Schedule *callback* to be called at the given absolute timestamp *when* (an " +"int or a float), using the same time reference as :meth:`loop.time`." msgstr "" +#: ../../library/asyncio-eventloop.rst:329 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "" -msgid "For performance, callbacks scheduled with :meth:`loop.call_at` may run up to one clock-resolution early (see ``time.get_clock_info('monotonic').resolution``)." +#: ../../library/asyncio-eventloop.rst:336 +msgid "" +"For performance, callbacks scheduled with :meth:`loop.call_at` may run up to " +"one clock-resolution early (see " +"``time.get_clock_info('monotonic').resolution``)." msgstr "" -msgid "In Python 3.7 and earlier with the default event loop implementation, the difference between *when* and the current time could not exceed one day. This has been fixed in Python 3.8." +#: ../../library/asyncio-eventloop.rst:344 +msgid "" +"In Python 3.7 and earlier with the default event loop implementation, the " +"difference between *when* and the current time could not exceed one day. " +"This has been fixed in Python 3.8." msgstr "" -msgid "Return the current time, as a :class:`float` value, according to the event loop's internal monotonic clock." +#: ../../library/asyncio-eventloop.rst:351 +msgid "" +"Return the current time, as a :class:`float` value, according to the event " +"loop's internal monotonic clock." msgstr "" -msgid "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) should not exceed one day. This has been fixed in Python 3.8." +#: ../../library/asyncio-eventloop.rst:355 +msgid "" +"In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " +"should not exceed one day. This has been fixed in Python 3.8." msgstr "" +#: ../../library/asyncio-eventloop.rst:361 msgid "The :func:`asyncio.sleep` function." msgstr "" +#: ../../library/asyncio-eventloop.rst:365 msgid "Creating futures and tasks" msgstr "" +#: ../../library/asyncio-eventloop.rst:369 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "" -msgid "This is the preferred way to create Futures in asyncio. This lets third-party event loops provide alternative implementations of the Future object (with better performance or instrumentation)." +#: ../../library/asyncio-eventloop.rst:371 +msgid "" +"This is the preferred way to create Futures in asyncio. This lets third-" +"party event loops provide alternative implementations of the Future object " +"(with better performance or instrumentation)." msgstr "" -msgid "Schedule the execution of :ref:`coroutine ` *coro*. Return a :class:`Task` object." +#: ../../library/asyncio-eventloop.rst:379 +msgid "" +"Schedule the execution of :ref:`coroutine ` *coro*. Return " +"a :class:`Task` object." msgstr "" -msgid "Third-party event loops can use their own subclass of :class:`Task` for interoperability. In this case, the result type is a subclass of :class:`Task`." +#: ../../library/asyncio-eventloop.rst:382 +msgid "" +"Third-party event loops can use their own subclass of :class:`Task` for " +"interoperability. In this case, the result type is a subclass " +"of :class:`Task`." msgstr "" -msgid "The full function signature is largely the same as that of the :class:`Task` constructor (or factory) - all of the keyword arguments to this function are passed through to that interface." +#: ../../library/asyncio-eventloop.rst:386 +msgid "" +"The full function signature is largely the same as that of the :class:`Task` " +"constructor (or factory) - all of the keyword arguments to this function are " +"passed through to that interface." msgstr "" -msgid "If the *name* argument is provided and not ``None``, it is set as the name of the task using :meth:`Task.set_name`." +#: ../../library/asyncio-eventloop.rst:390 +msgid "" +"If the *name* argument is provided and not ``None``, it is set as the name " +"of the task using :meth:`Task.set_name`." msgstr "" -msgid "An optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the *coro* to run in. The current context copy is created when no *context* is provided." +#: ../../library/asyncio-eventloop.rst:393 +msgid "" +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" -msgid "An optional keyword-only *eager_start* argument allows specifying if the task should execute eagerly during the call to create_task, or be scheduled later. If *eager_start* is not passed the mode set by :meth:`loop.set_task_factory` will be used." +#: ../../library/asyncio-eventloop.rst:397 +msgid "" +"An optional keyword-only *eager_start* argument allows specifying if the " +"task should execute eagerly during the call to create_task, or be scheduled " +"later. If *eager_start* is not passed the mode set " +"by :meth:`loop.set_task_factory` will be used." msgstr "" +#: ../../library/asyncio-eventloop.rst:402 msgid "Added the *name* parameter." msgstr "" +#: ../../library/asyncio-eventloop.rst:405 msgid "Added the *context* parameter." msgstr "" -msgid "Added ``kwargs`` which passes on arbitrary extra parameters, including ``name`` and ``context``." +#: ../../library/asyncio-eventloop.rst:408 +msgid "" +"Added ``kwargs`` which passes on arbitrary extra parameters, including " +"``name`` and ``context``." msgstr "" -msgid "Rolled back the change that passes on *name* and *context* (if it is None), while still passing on other arbitrary keyword arguments (to avoid breaking backwards compatibility with 3.13.3)." +#: ../../library/asyncio-eventloop.rst:411 +msgid "" +"Rolled back the change that passes on *name* and *context* (if it is None), " +"while still passing on other arbitrary keyword arguments (to avoid breaking " +"backwards compatibility with 3.13.3)." msgstr "" -msgid "All *kwargs* are now passed on. The *eager_start* parameter works with eager task factories." +#: ../../library/asyncio-eventloop.rst:415 +msgid "" +"All *kwargs* are now passed on. The *eager_start* parameter works with eager " +"task factories." msgstr "" +#: ../../library/asyncio-eventloop.rst:420 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "" -msgid "If *factory* is ``None`` the default task factory will be set. Otherwise, *factory* must be a *callable* with the signature matching ``(loop, coro, **kwargs)``, where *loop* is a reference to the active event loop, and *coro* is a coroutine object. The callable must pass on all *kwargs*, and return a :class:`asyncio.Task`-compatible object." +#: ../../library/asyncio-eventloop.rst:423 +msgid "" +"If *factory* is ``None`` the default task factory will be set. Otherwise, " +"*factory* must be a *callable* with the signature matching ``(loop, coro, " +"**kwargs)``, where *loop* is a reference to the active event loop, and " +"*coro* is a coroutine object. The callable must pass on all *kwargs*, and " +"return a :class:`asyncio.Task`-compatible object." msgstr "" +#: ../../library/asyncio-eventloop.rst:429 msgid "Required that all *kwargs* are passed on to :class:`asyncio.Task`." msgstr "" -msgid "*name* is no longer passed to task factories. *context* is no longer passed to task factories if it is ``None``." +#: ../../library/asyncio-eventloop.rst:432 +msgid "" +"*name* is no longer passed to task factories. *context* is no longer passed " +"to task factories if it is ``None``." msgstr "" -msgid "*name* and *context* are now unconditionally passed on to task factories again." +#: ../../library/asyncio-eventloop.rst:436 +msgid "" +"*name* and *context* are now unconditionally passed on to task factories " +"again." msgstr "" +#: ../../library/asyncio-eventloop.rst:441 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "" +#: ../../library/asyncio-eventloop.rst:445 msgid "Opening network connections" msgstr "" -msgid "Open a streaming transport connection to a given address specified by *host* and *port*." +#: ../../library/asyncio-eventloop.rst:457 +msgid "" +"Open a streaming transport connection to a given address specified by *host* " +"and *port*." msgstr "" -msgid "The socket family can be either :py:const:`~socket.AF_INET` or :py:const:`~socket.AF_INET6` depending on *host* (or the *family* argument, if provided)." +#: ../../library/asyncio-eventloop.rst:460 +msgid "" +"The socket family can be either :py:const:`~socket.AF_INET` " +"or :py:const:`~socket.AF_INET6` depending on *host* (or the *family* " +"argument, if provided)." msgstr "" +#: ../../library/asyncio-eventloop.rst:464 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "" -msgid "*protocol_factory* must be a callable returning an :ref:`asyncio protocol ` implementation." +#: ../../library/asyncio-eventloop.rst:466 +#: ../../library/asyncio-eventloop.rst:1274 +#: ../../library/asyncio-eventloop.rst:1293 +msgid "" +"*protocol_factory* must be a callable returning an :ref:`asyncio protocol " +"` implementation." msgstr "" -msgid "This method will try to establish the connection in the background. When successful, it returns a ``(transport, protocol)`` pair." +#: ../../library/asyncio-eventloop.rst:469 +msgid "" +"This method will try to establish the connection in the background. When " +"successful, it returns a ``(transport, protocol)`` pair." msgstr "" +#: ../../library/asyncio-eventloop.rst:472 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "" -msgid "The connection is established and a :ref:`transport ` is created for it." +#: ../../library/asyncio-eventloop.rst:474 +msgid "" +"The connection is established and a :ref:`transport ` is " +"created for it." msgstr "" -msgid "*protocol_factory* is called without arguments and is expected to return a :ref:`protocol ` instance." +#: ../../library/asyncio-eventloop.rst:477 +msgid "" +"*protocol_factory* is called without arguments and is expected to return " +"a :ref:`protocol ` instance." msgstr "" -msgid "The protocol instance is coupled with the transport by calling its :meth:`~BaseProtocol.connection_made` method." +#: ../../library/asyncio-eventloop.rst:480 +msgid "" +"The protocol instance is coupled with the transport by calling " +"its :meth:`~BaseProtocol.connection_made` method." msgstr "" +#: ../../library/asyncio-eventloop.rst:483 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "" -msgid "The created transport is an implementation-dependent bidirectional stream." +#: ../../library/asyncio-eventloop.rst:485 +msgid "" +"The created transport is an implementation-dependent bidirectional stream." msgstr "" +#: ../../library/asyncio-eventloop.rst:488 +#: ../../library/asyncio-eventloop.rst:621 msgid "Other arguments:" msgstr "" -msgid "*ssl*: if given and not false, a SSL/TLS transport is created (by default a plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` object, this context is used to create the transport; if *ssl* is :const:`True`, a default context returned from :func:`ssl.create_default_context` is used." +#: ../../library/asyncio-eventloop.rst:490 +msgid "" +"*ssl*: if given and not false, a SSL/TLS transport is created (by default a " +"plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " +"object, this context is used to create the transport; if *ssl* " +"is :const:`True`, a default context returned " +"from :func:`ssl.create_default_context` is used." msgstr "" +#: ../../library/asyncio-eventloop.rst:496 msgid ":ref:`SSL/TLS security considerations `" msgstr "" -msgid "*server_hostname* sets or overrides the hostname that the target server's certificate will be matched against. Should only be passed if *ssl* is not ``None``. By default the value of the *host* argument is used. If *host* is empty, there is no default and you must pass a value for *server_hostname*. If *server_hostname* is an empty string, hostname matching is disabled (which is a serious security risk, allowing for potential man-in-the-middle attacks)." +#: ../../library/asyncio-eventloop.rst:498 +msgid "" +"*server_hostname* sets or overrides the hostname that the target server's " +"certificate will be matched against. Should only be passed if *ssl* is not " +"``None``. By default the value of the *host* argument is used. If *host* " +"is empty, there is no default and you must pass a value for " +"*server_hostname*. If *server_hostname* is an empty string, hostname " +"matching is disabled (which is a serious security risk, allowing for " +"potential man-in-the-middle attacks)." msgstr "" -msgid "*family*, *proto*, *flags* are the optional address family, protocol and flags to be passed through to getaddrinfo() for *host* resolution. If given, these should all be integers from the corresponding :mod:`socket` module constants." +#: ../../library/asyncio-eventloop.rst:506 +msgid "" +"*family*, *proto*, *flags* are the optional address family, protocol and " +"flags to be passed through to getaddrinfo() for *host* resolution. If given, " +"these should all be integers from the corresponding :mod:`socket` module " +"constants." msgstr "" -msgid "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this connection. It should be a floating-point number representing the amount of time in seconds to wait for a connection attempt to complete, before starting the next attempt in parallel. This is the \"Connection Attempt Delay\" as defined in :rfc:`8305`. A sensible default value recommended by the RFC is ``0.25`` (250 milliseconds)." +#: ../../library/asyncio-eventloop.rst:511 +msgid "" +"*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " +"connection. It should be a floating-point number representing the amount of " +"time in seconds to wait for a connection attempt to complete, before " +"starting the next attempt in parallel. This is the \"Connection Attempt " +"Delay\" as defined in :rfc:`8305`. A sensible default value recommended by " +"the RFC is ``0.25`` (250 milliseconds)." msgstr "" -msgid "*interleave* controls address reordering when a host name resolves to multiple IP addresses. If ``0`` or unspecified, no reordering is done, and addresses are tried in the order returned by :meth:`getaddrinfo`. If a positive integer is specified, the addresses are interleaved by address family, and the given integer is interpreted as \"First Address Family Count\" as defined in :rfc:`8305`. The default is ``0`` if *happy_eyeballs_delay* is not specified, and ``1`` if it is." +#: ../../library/asyncio-eventloop.rst:519 +msgid "" +"*interleave* controls address reordering when a host name resolves to " +"multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " +"addresses are tried in the order returned by :meth:`getaddrinfo`. If a " +"positive integer is specified, the addresses are interleaved by address " +"family, and the given integer is interpreted as \"First Address Family " +"Count\" as defined in :rfc:`8305`. The default is ``0`` if " +"*happy_eyeballs_delay* is not specified, and ``1`` if it is." msgstr "" -msgid "*sock*, if given, should be an existing, already connected :class:`socket.socket` object to be used by the transport. If *sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, *happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." +#: ../../library/asyncio-eventloop.rst:528 +msgid "" +"*sock*, if given, should be an existing, already " +"connected :class:`socket.socket` object to be used by the transport. If " +"*sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, " +"*happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." msgstr "" -msgid "The *sock* argument transfers ownership of the socket to the transport created. To close the socket, call the transport's :meth:`~asyncio.BaseTransport.close` method." +#: ../../library/asyncio-eventloop.rst:536 +#: ../../library/asyncio-eventloop.rst:658 +#: ../../library/asyncio-eventloop.rst:906 +msgid "" +"The *sock* argument transfers ownership of the socket to the transport " +"created. To close the socket, call the " +"transport's :meth:`~asyncio.BaseTransport.close` method." msgstr "" -msgid "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind the socket locally. The *local_host* and *local_port* are looked up using ``getaddrinfo()``, similarly to *host* and *port*." +#: ../../library/asyncio-eventloop.rst:540 +msgid "" +"*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " +"the socket locally. The *local_host* and *local_port* are looked up using " +"``getaddrinfo()``, similarly to *host* and *port*." msgstr "" -msgid "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to wait for the TLS handshake to complete before aborting the connection. ``60.0`` seconds if ``None`` (default)." +#: ../../library/asyncio-eventloop.rst:544 +#: ../../library/asyncio-eventloop.rst:1002 +msgid "" +"*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " +"wait for the TLS handshake to complete before aborting the connection. " +"``60.0`` seconds if ``None`` (default)." msgstr "" -msgid "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown to complete before aborting the connection. ``30.0`` seconds if ``None`` (default)." +#: ../../library/asyncio-eventloop.rst:548 +#: ../../library/asyncio-eventloop.rst:813 +#: ../../library/asyncio-eventloop.rst:917 +#: ../../library/asyncio-eventloop.rst:1006 +msgid "" +"*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " +"to complete before aborting the connection. ``30.0`` seconds if ``None`` " +"(default)." msgstr "" -msgid "*all_errors* determines what exceptions are raised when a connection cannot be created. By default, only a single ``Exception`` is raised: the first exception if there is only one or all errors have same message, or a single ``OSError`` with the error messages combined. When ``all_errors`` is ``True``, an ``ExceptionGroup`` will be raised containing all exceptions (even if there is only one)." +#: ../../library/asyncio-eventloop.rst:552 +msgid "" +"*all_errors* determines what exceptions are raised when a connection cannot " +"be created. By default, only a single ``Exception`` is raised: the first " +"exception if there is only one or all errors have same message, or a single " +"``OSError`` with the error messages combined. When ``all_errors`` is " +"``True``, an ``ExceptionGroup`` will be raised containing all exceptions " +"(even if there is only one)." msgstr "" +#: ../../library/asyncio-eventloop.rst:562 +#: ../../library/asyncio-eventloop.rst:825 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "" -msgid "The socket option :ref:`socket.TCP_NODELAY ` is set by default for all TCP connections." +#: ../../library/asyncio-eventloop.rst:566 +msgid "" +"The socket option :ref:`socket.TCP_NODELAY ` is set " +"by default for all TCP connections." msgstr "" +#: ../../library/asyncio-eventloop.rst:571 +#: ../../library/asyncio-eventloop.rst:927 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "" +#: ../../library/asyncio-eventloop.rst:575 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "" -msgid "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's IPv4 path and protocol are working, but the server's IPv6 path and protocol are not working, a dual-stack client application experiences significant connection delay compared to an IPv4-only client. This is undesirable because it causes the dual-stack client to have a worse user experience. This document specifies requirements for algorithms that reduce this user-visible delay and provides an algorithm." +#: ../../library/asyncio-eventloop.rst:577 +msgid "" +"Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " +"IPv4 path and protocol are working, but the server's IPv6 path and protocol " +"are not working, a dual-stack client application experiences significant " +"connection delay compared to an IPv4-only client. This is undesirable " +"because it causes the dual-stack client to have a worse user experience. " +"This document specifies requirements for algorithms that reduce this user-" +"visible delay and provides an algorithm." msgstr "" +#: ../../library/asyncio-eventloop.rst:586 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "" +#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:722 +#: ../../library/asyncio-eventloop.rst:839 +#: ../../library/asyncio-eventloop.rst:879 +#: ../../library/asyncio-eventloop.rst:931 +#: ../../library/asyncio-eventloop.rst:1014 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "" +#: ../../library/asyncio-eventloop.rst:592 msgid "*all_errors* was added." msgstr "" -msgid "The :func:`open_connection` function is a high-level alternative API. It returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be used directly in async/await code." +#: ../../library/asyncio-eventloop.rst:597 +msgid "" +"The :func:`open_connection` function is a high-level alternative API. It " +"returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " +"used directly in async/await code." msgstr "" +#: ../../library/asyncio-eventloop.rst:608 msgid "Create a datagram connection." msgstr "" -msgid "The socket family can be either :py:const:`~socket.AF_INET`, :py:const:`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or the *family* argument, if provided)." +#: ../../library/asyncio-eventloop.rst:610 +msgid "" +"The socket family can be " +"either :py:const:`~socket.AF_INET`, :py:const:`~socket.AF_INET6`, " +"or :py:const:`~socket.AF_UNIX`, depending on *host* (or the *family* " +"argument, if provided)." msgstr "" +#: ../../library/asyncio-eventloop.rst:614 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "" -msgid "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." +#: ../../library/asyncio-eventloop.rst:616 +#: ../../library/asyncio-eventloop.rst:749 +#: ../../library/asyncio-eventloop.rst:898 +msgid "" +"*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." msgstr "" +#: ../../library/asyncio-eventloop.rst:619 +#: ../../library/asyncio-eventloop.rst:704 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "" -msgid "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind the socket locally. The *local_host* and *local_port* are looked up using :meth:`getaddrinfo`." +#: ../../library/asyncio-eventloop.rst:623 +msgid "" +"*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " +"the socket locally. The *local_host* and *local_port* are looked up " +"using :meth:`getaddrinfo`." msgstr "" -msgid "On Windows, when using the proactor event loop with ``local_addr=None``, an :exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised when running it." +#: ../../library/asyncio-eventloop.rst:629 +msgid "" +"On Windows, when using the proactor event loop with ``local_addr=None``, " +"an :exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised when running " +"it." msgstr "" -msgid "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to connect the socket to a remote address. The *remote_host* and *remote_port* are looked up using :meth:`getaddrinfo`." +#: ../../library/asyncio-eventloop.rst:633 +msgid "" +"*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " +"connect the socket to a remote address. The *remote_host* and *remote_port* " +"are looked up using :meth:`getaddrinfo`." msgstr "" -msgid "*family*, *proto*, *flags* are the optional address family, protocol and flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If given, these should all be integers from the corresponding :mod:`socket` module constants." +#: ../../library/asyncio-eventloop.rst:637 +msgid "" +"*family*, *proto*, *flags* are the optional address family, protocol and " +"flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " +"given, these should all be integers from the corresponding :mod:`socket` " +"module constants." msgstr "" -msgid "*reuse_port* tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows and some Unixes. If the :ref:`socket.SO_REUSEPORT ` constant is not defined then this capability is unsupported." +#: ../../library/asyncio-eventloop.rst:642 +msgid "" +"*reuse_port* tells the kernel to allow this endpoint to be bound to the same " +"port as other existing endpoints are bound to, so long as they all set this " +"flag when being created. This option is not supported on Windows and some " +"Unixes. If the :ref:`socket.SO_REUSEPORT ` constant " +"is not defined then this capability is unsupported." msgstr "" -msgid "*allow_broadcast* tells the kernel to allow this endpoint to send messages to the broadcast address." +#: ../../library/asyncio-eventloop.rst:648 +msgid "" +"*allow_broadcast* tells the kernel to allow this endpoint to send messages " +"to the broadcast address." msgstr "" -msgid "*sock* can optionally be specified in order to use a preexisting, already connected, :class:`socket.socket` object to be used by the transport. If specified, *local_addr* and *remote_addr* should be omitted (must be :const:`None`)." +#: ../../library/asyncio-eventloop.rst:651 +msgid "" +"*sock* can optionally be specified in order to use a preexisting, already " +"connected, :class:`socket.socket` object to be used by the transport. If " +"specified, *local_addr* and *remote_addr* should be omitted (must " +"be :const:`None`)." msgstr "" -msgid "See :ref:`UDP echo client protocol ` and :ref:`UDP echo server protocol ` examples." +#: ../../library/asyncio-eventloop.rst:662 +msgid "" +"See :ref:`UDP echo client protocol ` " +"and :ref:`UDP echo server protocol ` " +"examples." msgstr "" -msgid "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, *allow_broadcast*, and *sock* parameters were added." +#: ../../library/asyncio-eventloop.rst:665 +msgid "" +"The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " +"*allow_broadcast*, and *sock* parameters were added." msgstr "" +#: ../../library/asyncio-eventloop.rst:669 msgid "Added support for Windows." msgstr "" -msgid "The *reuse_address* parameter is no longer supported, as using :ref:`socket.SO_REUSEADDR ` poses a significant security concern for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." +#: ../../library/asyncio-eventloop.rst:672 +msgid "" +"The *reuse_address* parameter is no longer supported, as " +"using :ref:`socket.SO_REUSEADDR ` poses a significant " +"security concern for UDP. Explicitly passing ``reuse_address=True`` will " +"raise an exception." msgstr "" -msgid "When multiple processes with differing UIDs assign sockets to an identical UDP socket address with ``SO_REUSEADDR``, incoming packets can become randomly distributed among the sockets." +#: ../../library/asyncio-eventloop.rst:678 +msgid "" +"When multiple processes with differing UIDs assign sockets to an identical " +"UDP socket address with ``SO_REUSEADDR``, incoming packets can become " +"randomly distributed among the sockets." msgstr "" -msgid "For supported platforms, *reuse_port* can be used as a replacement for similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is used instead, which specifically prevents processes with differing UIDs from assigning sockets to the same socket address." +#: ../../library/asyncio-eventloop.rst:682 +msgid "" +"For supported platforms, *reuse_port* can be used as a replacement for " +"similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is used instead, which specifically prevents processes with " +"differing UIDs from assigning sockets to the same socket address." msgstr "" -msgid "The *reuse_address* parameter, disabled since Python 3.8.1, 3.7.6 and 3.6.10, has been entirely removed." +#: ../../library/asyncio-eventloop.rst:689 +msgid "" +"The *reuse_address* parameter, disabled since Python 3.8.1, 3.7.6 and " +"3.6.10, has been entirely removed." msgstr "" +#: ../../library/asyncio-eventloop.rst:699 msgid "Create a Unix connection." msgstr "" -msgid "The socket family will be :py:const:`~socket.AF_UNIX`; socket type will be :py:const:`~socket.SOCK_STREAM`." +#: ../../library/asyncio-eventloop.rst:701 +msgid "" +"The socket family will be :py:const:`~socket.AF_UNIX`; socket type will " +"be :py:const:`~socket.SOCK_STREAM`." msgstr "" -msgid "*path* is the name of a Unix domain socket and is required, unless a *sock* parameter is specified. Abstract Unix sockets, :class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths are supported." +#: ../../library/asyncio-eventloop.rst:706 +msgid "" +"*path* is the name of a Unix domain socket and is required, unless a *sock* " +"parameter is specified. Abstract Unix " +"sockets, :class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths are " +"supported." msgstr "" -msgid "See the documentation of the :meth:`loop.create_connection` method for information about arguments to this method." +#: ../../library/asyncio-eventloop.rst:711 +msgid "" +"See the documentation of the :meth:`loop.create_connection` method for " +"information about arguments to this method." msgstr "" +#: ../../library/asyncio-eventloop.rst:714 +#: ../../library/asyncio-eventloop.rst:870 +#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1935 +#: ../../library/asyncio-eventloop.rst:1942 msgid "Availability" msgstr "" -msgid "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be a :term:`path-like object`." +#: ../../library/asyncio-eventloop.rst:716 +msgid "" +"Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " +"a :term:`path-like object`." msgstr "" +#: ../../library/asyncio-eventloop.rst:726 msgid "Creating network servers" msgstr "" -msgid "Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on *port* of the *host* address." +#: ../../library/asyncio-eventloop.rst:742 +msgid "" +"Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on " +"*port* of the *host* address." msgstr "" +#: ../../library/asyncio-eventloop.rst:745 msgid "Returns a :class:`Server` object." msgstr "" +#: ../../library/asyncio-eventloop.rst:747 msgid "Arguments:" msgstr "" -msgid "The *host* parameter can be set to several types which determine where the server would be listening:" +#: ../../library/asyncio-eventloop.rst:752 +msgid "" +"The *host* parameter can be set to several types which determine where the " +"server would be listening:" msgstr "" -msgid "If *host* is a string, the TCP server is bound to a single network interface specified by *host*." +#: ../../library/asyncio-eventloop.rst:755 +msgid "" +"If *host* is a string, the TCP server is bound to a single network interface " +"specified by *host*." msgstr "" -msgid "If *host* is a sequence of strings, the TCP server is bound to all network interfaces specified by the sequence." +#: ../../library/asyncio-eventloop.rst:758 +msgid "" +"If *host* is a sequence of strings, the TCP server is bound to all network " +"interfaces specified by the sequence." msgstr "" -msgid "If *host* is an empty string or ``None``, all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6)." +#: ../../library/asyncio-eventloop.rst:761 +msgid "" +"If *host* is an empty string or ``None``, all interfaces are assumed and a " +"list of multiple sockets will be returned (most likely one for IPv4 and " +"another one for IPv6)." msgstr "" -msgid "The *port* parameter can be set to specify which port the server should listen on. If ``0`` or ``None`` (the default), a random unused port will be selected (note that if *host* resolves to multiple network interfaces, a different random port will be selected for each interface)." +#: ../../library/asyncio-eventloop.rst:765 +msgid "" +"The *port* parameter can be set to specify which port the server should " +"listen on. If ``0`` or ``None`` (the default), a random unused port will be " +"selected (note that if *host* resolves to multiple network interfaces, a " +"different random port will be selected for each interface)." msgstr "" -msgid "*family* can be set to either :const:`socket.AF_INET` or :const:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* will be determined from host name (defaults to :const:`~socket.AF_UNSPEC`)." +#: ../../library/asyncio-eventloop.rst:770 +msgid "" +"*family* can be set to either :const:`socket.AF_INET` " +"or :const:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6. If not " +"set, the *family* will be determined from host name (defaults " +"to :const:`~socket.AF_UNSPEC`)." msgstr "" +#: ../../library/asyncio-eventloop.rst:775 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." msgstr "" -msgid "*sock* can optionally be specified in order to use a preexisting socket object. If specified, *host* and *port* must not be specified." +#: ../../library/asyncio-eventloop.rst:777 +msgid "" +"*sock* can optionally be specified in order to use a preexisting socket " +"object. If specified, *host* and *port* must not be specified." msgstr "" -msgid "The *sock* argument transfers ownership of the socket to the server created. To close the socket, call the server's :meth:`~asyncio.Server.close` method." +#: ../../library/asyncio-eventloop.rst:782 +msgid "" +"The *sock* argument transfers ownership of the socket to the server created. " +"To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -msgid "*backlog* is the maximum number of queued connections passed to :meth:`~socket.socket.listen` (defaults to 100)." +#: ../../library/asyncio-eventloop.rst:786 +msgid "" +"*backlog* is the maximum number of queued connections passed " +"to :meth:`~socket.socket.listen` (defaults to 100)." msgstr "" -msgid "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over the accepted connections." +#: ../../library/asyncio-eventloop.rst:789 +msgid "" +"*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " +"the accepted connections." msgstr "" -msgid "*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` state, without waiting for its natural timeout to expire. If not specified will automatically be set to ``True`` on Unix." +#: ../../library/asyncio-eventloop.rst:792 +msgid "" +"*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` " +"state, without waiting for its natural timeout to expire. If not specified " +"will automatically be set to ``True`` on Unix." msgstr "" -msgid "*reuse_port* tells the kernel to allow this endpoint to be bound to the same port as other existing endpoints are bound to, so long as they all set this flag when being created. This option is not supported on Windows." +#: ../../library/asyncio-eventloop.rst:797 +msgid "" +"*reuse_port* tells the kernel to allow this endpoint to be bound to the same " +"port as other existing endpoints are bound to, so long as they all set this " +"flag when being created. This option is not supported on Windows." msgstr "" -msgid "*keep_alive* set to ``True`` keeps connections active by enabling the periodic transmission of messages." +#: ../../library/asyncio-eventloop.rst:802 +msgid "" +"*keep_alive* set to ``True`` keeps connections active by enabling the " +"periodic transmission of messages." msgstr "" +#: ../../library/asyncio-eventloop.rst:807 msgid "Added the *keep_alive* parameter." msgstr "" -msgid "*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait for the TLS handshake to complete before aborting the connection. ``60.0`` seconds if ``None`` (default)." +#: ../../library/asyncio-eventloop.rst:809 +msgid "" +"*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait " +"for the TLS handshake to complete before aborting the connection. ``60.0`` " +"seconds if ``None`` (default)." msgstr "" -msgid "*start_serving* set to ``True`` (the default) causes the created server to start accepting connections immediately. When set to ``False``, the user should await on :meth:`Server.start_serving` or :meth:`Server.serve_forever` to make the server to start accepting connections." +#: ../../library/asyncio-eventloop.rst:817 +msgid "" +"*start_serving* set to ``True`` (the default) causes the created server to " +"start accepting connections immediately. When set to ``False``, the user " +"should await on :meth:`Server.start_serving` or :meth:`Server.serve_forever` " +"to make the server to start accepting connections." msgstr "" +#: ../../library/asyncio-eventloop.rst:829 msgid "The *host* parameter can be a sequence of strings." msgstr "" -msgid "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket option :ref:`socket.TCP_NODELAY ` is set by default for all TCP connections." +#: ../../library/asyncio-eventloop.rst:833 +msgid "" +"Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " +"option :ref:`socket.TCP_NODELAY ` is set by default " +"for all TCP connections." msgstr "" -msgid "The :func:`start_server` function is a higher-level alternative API that returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can be used in an async/await code." +#: ../../library/asyncio-eventloop.rst:843 +msgid "" +"The :func:`start_server` function is a higher-level alternative API that " +"returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " +"be used in an async/await code." msgstr "" -msgid "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket.AF_UNIX` socket family." +#: ../../library/asyncio-eventloop.rst:855 +msgid "" +"Similar to :meth:`loop.create_server` but works with " +"the :py:const:`~socket.AF_UNIX` socket family." msgstr "" -msgid "*path* is the name of a Unix domain socket, and is required, unless a *sock* argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths are supported." +#: ../../library/asyncio-eventloop.rst:858 +msgid "" +"*path* is the name of a Unix domain socket, and is required, unless a *sock* " +"argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " +"and :class:`~pathlib.Path` paths are supported." msgstr "" -msgid "If *cleanup_socket* is true then the Unix socket will automatically be removed from the filesystem when the server is closed, unless the socket has been replaced after the server has been created." +#: ../../library/asyncio-eventloop.rst:863 +msgid "" +"If *cleanup_socket* is true then the Unix socket will automatically be " +"removed from the filesystem when the server is closed, unless the socket has " +"been replaced after the server has been created." msgstr "" -msgid "See the documentation of the :meth:`loop.create_server` method for information about arguments to this method." +#: ../../library/asyncio-eventloop.rst:867 +msgid "" +"See the documentation of the :meth:`loop.create_server` method for " +"information about arguments to this method." msgstr "" -msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* parameter can now be a :class:`~pathlib.Path` object." +#: ../../library/asyncio-eventloop.rst:874 +msgid "" +"Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " +"parameter can now be a :class:`~pathlib.Path` object." msgstr "" +#: ../../library/asyncio-eventloop.rst:883 msgid "Added the *cleanup_socket* parameter." msgstr "" +#: ../../library/asyncio-eventloop.rst:891 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "" -msgid "This method can be used by servers that accept connections outside of asyncio but that use asyncio to handle them." +#: ../../library/asyncio-eventloop.rst:893 +msgid "" +"This method can be used by servers that accept connections outside of " +"asyncio but that use asyncio to handle them." msgstr "" +#: ../../library/asyncio-eventloop.rst:896 +#: ../../library/asyncio-eventloop.rst:988 msgid "Parameters:" msgstr "" -msgid "*sock* is a preexisting socket object returned from :meth:`socket.accept `." +#: ../../library/asyncio-eventloop.rst:901 +msgid "" +"*sock* is a preexisting socket object returned from :meth:`socket.accept " +"`." msgstr "" -msgid "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the accepted connections." +#: ../../library/asyncio-eventloop.rst:910 +msgid "" +"*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " +"accepted connections." msgstr "" -msgid "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to wait for the SSL handshake to complete before aborting the connection. ``60.0`` seconds if ``None`` (default)." +#: ../../library/asyncio-eventloop.rst:913 +msgid "" +"*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " +"wait for the SSL handshake to complete before aborting the connection. " +"``60.0`` seconds if ``None`` (default)." msgstr "" +#: ../../library/asyncio-eventloop.rst:921 msgid "Returns a ``(transport, protocol)`` pair." msgstr "" +#: ../../library/asyncio-eventloop.rst:935 msgid "Transferring files" msgstr "" -msgid "Send a *file* over a *transport*. Return the total number of bytes sent." +#: ../../library/asyncio-eventloop.rst:941 +msgid "" +"Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "" +#: ../../library/asyncio-eventloop.rst:944 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "" +#: ../../library/asyncio-eventloop.rst:946 msgid "*file* must be a regular file object opened in binary mode." msgstr "" -msgid "*offset* tells from where to start reading the file. If specified, *count* is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is always updated, even when this method raises an error, and :meth:`file.tell() ` can be used to obtain the actual number of bytes sent." +#: ../../library/asyncio-eventloop.rst:948 +#: ../../library/asyncio-eventloop.rst:1218 +msgid "" +"*offset* tells from where to start reading the file. If specified, *count* " +"is the total number of bytes to transmit as opposed to sending the file " +"until EOF is reached. File position is always updated, even when this method " +"raises an error, and :meth:`file.tell() ` can be used to " +"obtain the actual number of bytes sent." msgstr "" -msgid "*fallback* set to ``True`` makes asyncio to manually read and send the file when the platform does not support the sendfile system call (e.g. Windows or SSL socket on Unix)." +#: ../../library/asyncio-eventloop.rst:955 +msgid "" +"*fallback* set to ``True`` makes asyncio to manually read and send the file " +"when the platform does not support the sendfile system call (e.g. Windows or " +"SSL socket on Unix)." msgstr "" -msgid "Raise :exc:`SendfileNotAvailableError` if the system does not support the *sendfile* syscall and *fallback* is ``False``." +#: ../../library/asyncio-eventloop.rst:959 +msgid "" +"Raise :exc:`SendfileNotAvailableError` if the system does not support the " +"*sendfile* syscall and *fallback* is ``False``." msgstr "" +#: ../../library/asyncio-eventloop.rst:966 msgid "TLS upgrade" msgstr "" +#: ../../library/asyncio-eventloop.rst:974 msgid "Upgrade an existing transport-based connection to TLS." msgstr "" -msgid "Create a TLS coder/decoder instance and insert it between the *transport* and the *protocol*. The coder/decoder implements both *transport*-facing protocol and *protocol*-facing transport." +#: ../../library/asyncio-eventloop.rst:976 +msgid "" +"Create a TLS coder/decoder instance and insert it between the *transport* " +"and the *protocol*. The coder/decoder implements both *transport*-facing " +"protocol and *protocol*-facing transport." msgstr "" -msgid "Return the created two-interface instance. After *await*, the *protocol* must stop using the original *transport* and communicate with the returned object only because the coder caches *protocol*-side data and sporadically exchanges extra TLS session packets with *transport*." +#: ../../library/asyncio-eventloop.rst:980 +msgid "" +"Return the created two-interface instance. After *await*, the *protocol* " +"must stop using the original *transport* and communicate with the returned " +"object only because the coder caches *protocol*-side data and sporadically " +"exchanges extra TLS session packets with *transport*." msgstr "" -msgid "In some situations (e.g. when the passed transport is already closing) this may return ``None``." +#: ../../library/asyncio-eventloop.rst:985 +msgid "" +"In some situations (e.g. when the passed transport is already closing) this " +"may return ``None``." msgstr "" -msgid "*transport* and *protocol* instances that methods like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." +#: ../../library/asyncio-eventloop.rst:990 +msgid "" +"*transport* and *protocol* instances that methods " +"like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." msgstr "" +#: ../../library/asyncio-eventloop.rst:994 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -msgid "*server_side* pass ``True`` when a server-side connection is being upgraded (like the one created by :meth:`~loop.create_server`)." +#: ../../library/asyncio-eventloop.rst:996 +msgid "" +"*server_side* pass ``True`` when a server-side connection is being upgraded " +"(like the one created by :meth:`~loop.create_server`)." msgstr "" -msgid "*server_hostname*: sets or overrides the host name that the target server's certificate will be matched against." +#: ../../library/asyncio-eventloop.rst:999 +msgid "" +"*server_hostname*: sets or overrides the host name that the target server's " +"certificate will be matched against." msgstr "" +#: ../../library/asyncio-eventloop.rst:1019 msgid "Watching file descriptors" msgstr "" -msgid "Start monitoring the *fd* file descriptor for read availability and invoke *callback* with the specified arguments once *fd* is available for reading." +#: ../../library/asyncio-eventloop.rst:1023 +msgid "" +"Start monitoring the *fd* file descriptor for read availability and invoke " +"*callback* with the specified arguments once *fd* is available for reading." msgstr "" -msgid "Any preexisting callback registered for *fd* is cancelled and replaced by *callback*." +#: ../../library/asyncio-eventloop.rst:1027 +#: ../../library/asyncio-eventloop.rst:1041 +msgid "" +"Any preexisting callback registered for *fd* is cancelled and replaced by " +"*callback*." msgstr "" -msgid "Stop monitoring the *fd* file descriptor for read availability. Returns ``True`` if *fd* was previously being monitored for reads." +#: ../../library/asyncio-eventloop.rst:1032 +msgid "" +"Stop monitoring the *fd* file descriptor for read availability. Returns " +"``True`` if *fd* was previously being monitored for reads." msgstr "" -msgid "Start monitoring the *fd* file descriptor for write availability and invoke *callback* with the specified arguments *args* once *fd* is available for writing." +#: ../../library/asyncio-eventloop.rst:1037 +msgid "" +"Start monitoring the *fd* file descriptor for write availability and invoke " +"*callback* with the specified arguments *args* once *fd* is available for " +"writing." msgstr "" -msgid "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." +#: ../../library/asyncio-eventloop.rst:1044 +#: ../../library/asyncio-eventloop.rst:1363 +msgid "" +"Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." msgstr "" -msgid "Stop monitoring the *fd* file descriptor for write availability. Returns ``True`` if *fd* was previously being monitored for writes." +#: ../../library/asyncio-eventloop.rst:1049 +msgid "" +"Stop monitoring the *fd* file descriptor for write availability. Returns " +"``True`` if *fd* was previously being monitored for writes." msgstr "" -msgid "See also :ref:`Platform Support ` section for some limitations of these methods." +#: ../../library/asyncio-eventloop.rst:1052 +msgid "" +"See also :ref:`Platform Support ` section for some " +"limitations of these methods." msgstr "" +#: ../../library/asyncio-eventloop.rst:1057 msgid "Working with socket objects directly" msgstr "" -msgid "In general, protocol implementations that use transport-based APIs such as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster than implementations that work with sockets directly. However, there are some use cases when performance is not critical, and working with :class:`~socket.socket` objects directly is more convenient." +#: ../../library/asyncio-eventloop.rst:1059 +msgid "" +"In general, protocol implementations that use transport-based APIs such " +"as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster " +"than implementations that work with sockets directly. However, there are " +"some use cases when performance is not critical, and working " +"with :class:`~socket.socket` objects directly is more convenient." msgstr "" -msgid "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket.recv() `." +#: ../../library/asyncio-eventloop.rst:1069 +msgid "" +"Receive up to *nbytes* from *sock*. Asynchronous version " +"of :meth:`socket.recv() `." msgstr "" +#: ../../library/asyncio-eventloop.rst:1072 msgid "Return the received data as a bytes object." msgstr "" +#: ../../library/asyncio-eventloop.rst:1074 +#: ../../library/asyncio-eventloop.rst:1089 +#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:1114 +#: ../../library/asyncio-eventloop.rst:1130 +#: ../../library/asyncio-eventloop.rst:1146 +#: ../../library/asyncio-eventloop.rst:1157 +#: ../../library/asyncio-eventloop.rst:1193 +#: ../../library/asyncio-eventloop.rst:1232 msgid "*sock* must be a non-blocking socket." msgstr "" -msgid "Even though this method was always documented as a coroutine method, releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this is an ``async def`` method." +#: ../../library/asyncio-eventloop.rst:1076 +msgid "" +"Even though this method was always documented as a coroutine method, " +"releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " +"is an ``async def`` method." msgstr "" -msgid "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :meth:`socket.recv_into() ` method." +#: ../../library/asyncio-eventloop.rst:1084 +msgid "" +"Receive data from *sock* into the *buf* buffer. Modeled after the " +"blocking :meth:`socket.recv_into() ` method." msgstr "" +#: ../../library/asyncio-eventloop.rst:1087 msgid "Return the number of bytes written to the buffer." msgstr "" -msgid "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :meth:`socket.recvfrom() `." +#: ../../library/asyncio-eventloop.rst:1096 +msgid "" +"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version " +"of :meth:`socket.recvfrom() `." msgstr "" +#: ../../library/asyncio-eventloop.rst:1099 msgid "Return a tuple of (received data, remote address)." msgstr "" -msgid "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous version of :meth:`socket.recvfrom_into() `." +#: ../../library/asyncio-eventloop.rst:1108 +msgid "" +"Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " +"version of :meth:`socket.recvfrom_into() `." msgstr "" +#: ../../library/asyncio-eventloop.rst:1112 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "" -msgid "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket.sendall() `." +#: ../../library/asyncio-eventloop.rst:1121 +msgid "" +"Send *data* to the *sock* socket. Asynchronous version " +"of :meth:`socket.sendall() `." msgstr "" -msgid "This method continues to send to the socket until either all data in *data* has been sent or an error occurs. ``None`` is returned on success. On error, an exception is raised. Additionally, there is no way to determine how much data, if any, was successfully processed by the receiving end of the connection." +#: ../../library/asyncio-eventloop.rst:1124 +msgid "" +"This method continues to send to the socket until either all data in *data* " +"has been sent or an error occurs. ``None`` is returned on success. On " +"error, an exception is raised. Additionally, there is no way to determine " +"how much data, if any, was successfully processed by the receiving end of " +"the connection." msgstr "" -msgid "Even though the method was always documented as a coroutine method, before Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an ``async def`` method." +#: ../../library/asyncio-eventloop.rst:1132 +#: ../../library/asyncio-eventloop.rst:1195 +msgid "" +"Even though the method was always documented as a coroutine method, before " +"Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " +"``async def`` method." msgstr "" -msgid "Send a datagram from *sock* to *address*. Asynchronous version of :meth:`socket.sendto() `." +#: ../../library/asyncio-eventloop.rst:1140 +msgid "" +"Send a datagram from *sock* to *address*. Asynchronous version " +"of :meth:`socket.sendto() `." msgstr "" +#: ../../library/asyncio-eventloop.rst:1144 msgid "Return the number of bytes sent." msgstr "" +#: ../../library/asyncio-eventloop.rst:1153 msgid "Connect *sock* to a remote socket at *address*." msgstr "" -msgid "Asynchronous version of :meth:`socket.connect() `." +#: ../../library/asyncio-eventloop.rst:1155 +msgid "" +"Asynchronous version of :meth:`socket.connect() `." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1159 +msgid "" +"With :class:`SelectorEventLoop`, *address* does not need to be resolved: " +"for :const:`~socket.AF_INET` and :const:`~socket.AF_INET6` sockets, " +"``sock_connect`` first checks whether *address* is already resolved by " +"calling :func:`socket.inet_pton`, and uses :meth:`loop.getaddrinfo` to " +"resolve it if it is not." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1165 +msgid "" +":class:`ProactorEventLoop`, the default event loop on Windows, does not " +"resolve *address*. The host must already be a numeric IP address; passing a " +"host name raises :exc:`OSError`. Resolve the address " +"with :meth:`loop.getaddrinfo` first, or use :meth:`loop.create_connection`, " +"which resolves the address on every platform." msgstr "" -msgid "``address`` no longer needs to be resolved. ``sock_connect`` will try to check if the *address* is already resolved by calling :func:`socket.inet_pton`. If not, :meth:`loop.getaddrinfo` will be used to resolve the *address*." +#: ../../library/asyncio-eventloop.rst:1171 +msgid "" +"With :class:`SelectorEventLoop`, ``address`` no longer needs to be resolved." msgstr "" -msgid ":meth:`loop.create_connection` and :func:`asyncio.open_connection() `." +#: ../../library/asyncio-eventloop.rst:1177 +msgid "" +":meth:`loop.create_connection` and :func:`asyncio.open_connection() " +"`." msgstr "" -msgid "Accept a connection. Modeled after the blocking :meth:`socket.accept() ` method." +#: ../../library/asyncio-eventloop.rst:1184 +msgid "" +"Accept a connection. Modeled after the blocking :meth:`socket.accept() " +"` method." msgstr "" -msgid "The socket must be bound to an address and listening for connections. The return value is a pair ``(conn, address)`` where *conn* is a *new* socket object usable to send and receive data on the connection, and *address* is the address bound to the socket on the other end of the connection." +#: ../../library/asyncio-eventloop.rst:1187 +msgid "" +"The socket must be bound to an address and listening for connections. The " +"return value is a pair ``(conn, address)`` where *conn* is a *new* socket " +"object usable to send and receive data on the connection, and *address* is " +"the address bound to the socket on the other end of the connection." msgstr "" +#: ../../library/asyncio-eventloop.rst:1202 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr "" -msgid "Send a file using high-performance :mod:`os.sendfile` if possible. Return the total number of bytes sent." +#: ../../library/asyncio-eventloop.rst:1208 +msgid "" +"Send a file using high-performance :mod:`os.sendfile` if possible. Return " +"the total number of bytes sent." msgstr "" -msgid "Asynchronous version of :meth:`socket.sendfile() `." +#: ../../library/asyncio-eventloop.rst:1211 +msgid "" +"Asynchronous version of :meth:`socket.sendfile() `." msgstr "" -msgid "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." +#: ../../library/asyncio-eventloop.rst:1213 +msgid "" +"*sock* must be a non-" +"blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1216 msgid "*file* must be a regular file object open in binary mode." msgstr "" -msgid "*fallback*, when set to ``True``, makes asyncio manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix)." +#: ../../library/asyncio-eventloop.rst:1225 +msgid "" +"*fallback*, when set to ``True``, makes asyncio manually read and send the " +"file when the platform does not support the sendfile syscall (e.g. Windows " +"or SSL socket on Unix)." msgstr "" -msgid "Raise :exc:`SendfileNotAvailableError` if the system does not support *sendfile* syscall and *fallback* is ``False``." +#: ../../library/asyncio-eventloop.rst:1229 +msgid "" +"Raise :exc:`SendfileNotAvailableError` if the system does not support " +"*sendfile* syscall and *fallback* is ``False``." msgstr "" +#: ../../library/asyncio-eventloop.rst:1238 msgid "DNS" msgstr "" +#: ../../library/asyncio-eventloop.rst:1244 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1249 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr "" -msgid "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous versions through the loop's default thread pool executor. When this executor is saturated, these methods may experience delays, which higher-level networking libraries may report as increased timeouts. To mitigate this, consider using a custom executor for other user tasks, or setting a default executor with a larger number of workers." +#: ../../library/asyncio-eventloop.rst:1252 +msgid "" +"Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " +"versions through the loop's default thread pool executor. When this executor " +"is saturated, these methods may experience delays, which higher-level " +"networking libraries may report as increased timeouts. To mitigate this, " +"consider using a custom executor for other user tasks, or setting a default " +"executor with a larger number of workers." msgstr "" -msgid "Both *getaddrinfo* and *getnameinfo* methods were always documented to return a coroutine, but prior to Python 3.7 they were, in fact, returning :class:`asyncio.Future` objects. Starting with Python 3.7 both methods are coroutines." +#: ../../library/asyncio-eventloop.rst:1259 +msgid "" +"Both *getaddrinfo* and *getnameinfo* methods were always documented to " +"return a coroutine, but prior to Python 3.7 they were, in fact, " +"returning :class:`asyncio.Future` objects. Starting with Python 3.7 both " +"methods are coroutines." msgstr "" +#: ../../library/asyncio-eventloop.rst:1267 msgid "Working with pipes" msgstr "" +#: ../../library/asyncio-eventloop.rst:1272 msgid "Register the read end of *pipe* in the event loop." msgstr "" -msgid "*pipe* is a :term:`file-like object `." +#: ../../library/asyncio-eventloop.rst:1277 +#: ../../library/asyncio-eventloop.rst:1296 +msgid "" +"*pipe* is a :term:`file-like object `. See :ref:`Supported " +"pipe objects ` for the objects supported as *pipe*." msgstr "" -msgid "Return pair ``(transport, protocol)``, where *transport* supports the :class:`ReadTransport` interface and *protocol* is an object instantiated by the *protocol_factory*." +#: ../../library/asyncio-eventloop.rst:1281 +msgid "" +"Return pair ``(transport, protocol)``, where *transport* supports " +"the :class:`ReadTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -msgid "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-blocking mode." +#: ../../library/asyncio-eventloop.rst:1285 +#: ../../library/asyncio-eventloop.rst:1304 +msgid "" +"With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" +"blocking mode." msgstr "" +#: ../../library/asyncio-eventloop.rst:1291 msgid "Register the write end of *pipe* in the event loop." msgstr "" -msgid "*pipe* is :term:`file-like object `." +#: ../../library/asyncio-eventloop.rst:1300 +msgid "" +"Return pair ``(transport, protocol)``, where *transport* " +"supports :class:`WriteTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1310 +msgid "Supported pipe objects" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1311 +msgid "" +"These methods only work with objects the operating system can poll for " +"readiness or perform overlapped I/O on. Regular files on disk are **not** " +"supported on any platform. There is no asynchronous file I/O in asyncio; " +"use :meth:`loop.run_in_executor` to read and write regular files without " +"blocking the event loop." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1317 +msgid "" +"On Unix, with :class:`SelectorEventLoop`, *pipe* must wrap one of the " +"following:" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1320 +msgid "" +"a pipe, such as an end of an :func:`os.pipe` pair or a FIFO created " +"with :func:`os.mkfifo`;" msgstr "" -msgid "Return pair ``(transport, protocol)``, where *transport* supports :class:`WriteTransport` interface and *protocol* is an object instantiated by the *protocol_factory*." +#: ../../library/asyncio-eventloop.rst:1322 +msgid "a socket;" msgstr "" -msgid ":class:`SelectorEventLoop` does not support the above methods on Windows. Use :class:`ProactorEventLoop` instead for Windows." +#: ../../library/asyncio-eventloop.rst:1323 +msgid "a character device, such as a terminal." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1325 +msgid "" +"On Windows, where only :class:`ProactorEventLoop` implements these methods, " +"*pipe* must wrap a handle opened for overlapped I/O (that is, created with " +"the ``FILE_FLAG_OVERLAPPED`` flag), since the handle has to be associated " +"with an I/O completion port. Handles that were not opened for overlapped I/" +"O are rejected. In particular, the standard streams " +"(:data:`sys.stdin`, :data:`sys.stdout` and :data:`sys.stderr`), console " +"handles, and the pipes created by :func:`os.pipe` are **not** opened for " +"overlapped I/O and therefore cannot be used with these methods." msgstr "" -msgid "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." +#: ../../library/asyncio-eventloop.rst:1336 +msgid "" +":class:`SelectorEventLoop` does not support the above methods on Windows. " +"Use :class:`ProactorEventLoop` instead for Windows." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1341 +msgid "" +"The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr "" +#: ../../library/asyncio-eventloop.rst:1346 msgid "Unix signals" msgstr "" -msgid "Set *callback* as the handler for the *signum* signal, passing *args* as positional arguments." +#: ../../library/asyncio-eventloop.rst:1352 +msgid "" +"Set *callback* as the handler for the *signum* signal, passing *args* as " +"positional arguments." msgstr "" -msgid "The callback will be invoked by *loop*, along with other queued callbacks and runnable coroutines of that event loop. Unlike signal handlers registered using :func:`signal.signal`, a callback registered with this function is allowed to interact with the event loop." +#: ../../library/asyncio-eventloop.rst:1355 +msgid "" +"The callback will be invoked by *loop*, along with other queued callbacks " +"and runnable coroutines of that event loop. Unlike signal handlers " +"registered using :func:`signal.signal`, a callback registered with this " +"function is allowed to interact with the event loop." msgstr "" -msgid "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. Raise :exc:`RuntimeError` if there is a problem setting up the handler." +#: ../../library/asyncio-eventloop.rst:1360 +msgid "" +"Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " +"Raise :exc:`RuntimeError` if there is a problem setting up the handler." msgstr "" -msgid "Like :func:`signal.signal`, this function must be invoked in the main thread." +#: ../../library/asyncio-eventloop.rst:1366 +msgid "" +"Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "" +#: ../../library/asyncio-eventloop.rst:1371 msgid "Remove the handler for the *sig* signal." msgstr "" -msgid "Return ``True`` if the signal handler was removed, or ``False`` if no handler was set for the given signal." +#: ../../library/asyncio-eventloop.rst:1373 +msgid "" +"Return ``True`` if the signal handler was removed, or ``False`` if no " +"handler was set for the given signal." msgstr "" +#: ../../library/asyncio-eventloop.rst:1380 msgid "The :mod:`signal` module." msgstr "" +#: ../../library/asyncio-eventloop.rst:1384 msgid "Executing code in thread or process pools" msgstr "" -msgid "Arrange for *func* to be called in the specified executor passing *args* as positional arguments." +#: ../../library/asyncio-eventloop.rst:1388 +msgid "" +"Arrange for *func* to be called in the specified executor passing *args* as " +"positional arguments." msgstr "" -msgid "The *executor* argument should be an :class:`concurrent.futures.Executor` instance. The default executor is used if *executor* is ``None``. The default executor can be set by :meth:`loop.set_default_executor`, otherwise, a :class:`concurrent.futures.ThreadPoolExecutor` will be lazy-initialized and used by :func:`run_in_executor` if needed." +#: ../../library/asyncio-eventloop.rst:1391 +msgid "" +"The *executor* argument should be an :class:`concurrent.futures.Executor` " +"instance. The default executor is used if *executor* is ``None``. The " +"default executor can be set by :meth:`loop.set_default_executor`, otherwise, " +"a :class:`concurrent.futures.ThreadPoolExecutor` will be lazy-initialized " +"and used by :func:`run_in_executor` if needed." msgstr "" +#: ../../library/asyncio-eventloop.rst:1399 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -914,258 +1797,476 @@ msgid "" " asyncio.run(main())" msgstr "" -msgid "Note that the entry point guard (``if __name__ == '__main__'``) is required for option 3 due to the peculiarities of :mod:`multiprocessing`, which is used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe importing of main module `." +#: ../../library/asyncio-eventloop.rst:1445 +msgid "" +"Note that the entry point guard (``if __name__ == '__main__'``) is required " +"for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " +"used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe " +"importing of main module `." msgstr "" +#: ../../library/asyncio-eventloop.rst:1450 msgid "This method returns a :class:`asyncio.Future` object." msgstr "" -msgid "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." +#: ../../library/asyncio-eventloop.rst:1452 +msgid "" +"Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." msgstr "" -msgid ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the thread pool executor it creates, instead leaving it up to the thread pool executor (:class:`~concurrent.futures.ThreadPoolExecutor`) to set the default." +#: ../../library/asyncio-eventloop.rst:1455 +msgid "" +":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " +"thread pool executor it creates, instead leaving it up to the thread pool " +"executor (:class:`~concurrent.futures.ThreadPoolExecutor`) to set the " +"default." msgstr "" -msgid "Set *executor* as the default executor used by :meth:`run_in_executor`. *executor* must be an instance of :class:`~concurrent.futures.ThreadPoolExecutor`, which includes :class:`~concurrent.futures.InterpreterPoolExecutor`." +#: ../../library/asyncio-eventloop.rst:1464 +msgid "" +"Set *executor* as the default executor used by :meth:`run_in_executor`. " +"*executor* must be an instance " +"of :class:`~concurrent.futures.ThreadPoolExecutor`, which " +"includes :class:`~concurrent.futures.InterpreterPoolExecutor`." msgstr "" -msgid "*executor* must be an instance of :class:`~concurrent.futures.ThreadPoolExecutor`." +#: ../../library/asyncio-eventloop.rst:1469 +msgid "" +"*executor* must be an instance " +"of :class:`~concurrent.futures.ThreadPoolExecutor`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1475 msgid "Error handling API" msgstr "" +#: ../../library/asyncio-eventloop.rst:1477 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "" +#: ../../library/asyncio-eventloop.rst:1481 msgid "Set *handler* as the new event loop exception handler." msgstr "" -msgid "If *handler* is ``None``, the default exception handler will be set. Otherwise, *handler* must be a callable with the signature matching ``(loop, context)``, where ``loop`` is a reference to the active event loop, and ``context`` is a ``dict`` object containing the details of the exception (see :meth:`call_exception_handler` documentation for details about context)." +#: ../../library/asyncio-eventloop.rst:1483 +msgid "" +"If *handler* is ``None``, the default exception handler will be set. " +"Otherwise, *handler* must be a callable with the signature matching ``(loop, " +"context)``, where ``loop`` is a reference to the active event loop, and " +"``context`` is a ``dict`` object containing the details of the exception " +"(see :meth:`call_exception_handler` documentation for details about context)." msgstr "" -msgid "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that task or callback handle." +#: ../../library/asyncio-eventloop.rst:1491 +msgid "" +"If the handler is called on behalf of a :class:`~asyncio.Task` " +"or :class:`~asyncio.Handle`, it is run in the :class:`contextvars.Context` " +"of that task or callback handle." msgstr "" -msgid "The handler may be called in the :class:`~contextvars.Context` of the task or handle where the exception originated." +#: ../../library/asyncio-eventloop.rst:1497 +msgid "" +"The handler may be called in the :class:`~contextvars.Context` of the task " +"or handle where the exception originated." msgstr "" -msgid "Return the current exception handler, or ``None`` if no custom exception handler was set." +#: ../../library/asyncio-eventloop.rst:1502 +msgid "" +"Return the current exception handler, or ``None`` if no custom exception " +"handler was set." msgstr "" +#: ../../library/asyncio-eventloop.rst:1509 msgid "Default exception handler." msgstr "" -msgid "This is called when an exception occurs and no exception handler is set. This can be called by a custom exception handler that wants to defer to the default handler behavior." +#: ../../library/asyncio-eventloop.rst:1511 +msgid "" +"This is called when an exception occurs and no exception handler is set. " +"This can be called by a custom exception handler that wants to defer to the " +"default handler behavior." msgstr "" -msgid "*context* parameter has the same meaning as in :meth:`call_exception_handler`." +#: ../../library/asyncio-eventloop.rst:1515 +msgid "" +"*context* parameter has the same meaning as " +"in :meth:`call_exception_handler`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1520 msgid "Call the current event loop exception handler." msgstr "" -msgid "*context* is a ``dict`` object containing the following keys (new keys may be introduced in future Python versions):" +#: ../../library/asyncio-eventloop.rst:1522 +msgid "" +"*context* is a ``dict`` object containing the following keys (new keys may " +"be introduced in future Python versions):" msgstr "" +#: ../../library/asyncio-eventloop.rst:1525 msgid "'message': Error message;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1526 msgid "'exception' (optional): Exception object;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1527 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1528 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1529 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1530 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1531 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1532 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1533 msgid "'source_traceback' (optional): Traceback of the source;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1534 msgid "'handle_traceback' (optional): Traceback of the handle;" msgstr "" +#: ../../library/asyncio-eventloop.rst:1535 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "" +#: ../../library/asyncio-eventloop.rst:1536 msgid "the exception." msgstr "" -msgid "This method should not be overloaded in subclassed event loops. For custom exception handling, use the :meth:`set_exception_handler` method." +#: ../../library/asyncio-eventloop.rst:1540 +msgid "" +"This method should not be overloaded in subclassed event loops. For custom " +"exception handling, use the :meth:`set_exception_handler` method." msgstr "" +#: ../../library/asyncio-eventloop.rst:1545 msgid "Enabling debug mode" msgstr "" +#: ../../library/asyncio-eventloop.rst:1549 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "" -msgid "The default value is ``True`` if the environment variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." +#: ../../library/asyncio-eventloop.rst:1551 +msgid "" +"The default value is ``True`` if the environment " +"variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, " +"``False`` otherwise." msgstr "" +#: ../../library/asyncio-eventloop.rst:1557 msgid "Set the debug mode of the event loop." msgstr "" -msgid "The new :ref:`Python Development Mode ` can now also be used to enable the debug mode." +#: ../../library/asyncio-eventloop.rst:1561 +msgid "" +"The new :ref:`Python Development Mode ` can now also be used to " +"enable the debug mode." msgstr "" -msgid "This attribute can be used to set the minimum execution duration in seconds that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks are logged." +#: ../../library/asyncio-eventloop.rst:1566 +msgid "" +"This attribute can be used to set the minimum execution duration in seconds " +"that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " +"are logged." msgstr "" +#: ../../library/asyncio-eventloop.rst:1570 msgid "Default value is 100 milliseconds." msgstr "" +#: ../../library/asyncio-eventloop.rst:1574 msgid "The :ref:`debug mode of asyncio `." msgstr "" +#: ../../library/asyncio-eventloop.rst:1578 msgid "Running subprocesses" msgstr "" -msgid "Methods described in this subsections are low-level. In regular async/await code consider using the high-level :func:`asyncio.create_subprocess_shell` and :func:`asyncio.create_subprocess_exec` convenience functions instead." +#: ../../library/asyncio-eventloop.rst:1580 +msgid "" +"Methods described in this subsections are low-level. In regular async/await " +"code consider using the high-level :func:`asyncio.create_subprocess_shell` " +"and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -msgid "On Windows, the default event loop :class:`ProactorEventLoop` supports subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:`Subprocess Support on Windows ` for details." +#: ../../library/asyncio-eventloop.rst:1587 +msgid "" +"On Windows, the default event loop :class:`ProactorEventLoop` supports " +"subprocesses, whereas :class:`SelectorEventLoop` does not. " +"See :ref:`Subprocess Support on Windows ` for " +"details." msgstr "" -msgid "Create a subprocess from one or more string arguments specified by *args*." +#: ../../library/asyncio-eventloop.rst:1599 +msgid "" +"Create a subprocess from one or more string arguments specified by *args*." msgstr "" +#: ../../library/asyncio-eventloop.rst:1602 msgid "*args* must be a list of strings represented by:" msgstr "" +#: ../../library/asyncio-eventloop.rst:1604 msgid ":class:`str`;" msgstr "" -msgid "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." +#: ../../library/asyncio-eventloop.rst:1605 +msgid "" +"or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "" -msgid "The first string specifies the program executable, and the remaining strings specify the arguments. Together, string arguments form the ``argv`` of the program." +#: ../../library/asyncio-eventloop.rst:1608 +msgid "" +"The first string specifies the program executable, and the remaining strings " +"specify the arguments. Together, string arguments form the ``argv`` of the " +"program." msgstr "" -msgid "This is similar to the standard library :class:`subprocess.Popen` class called with ``shell=False`` and the list of strings passed as the first argument; however, where :class:`~subprocess.Popen` takes a single argument which is list of strings, *subprocess_exec* takes multiple string arguments." +#: ../../library/asyncio-eventloop.rst:1612 +msgid "" +"This is similar to the standard library :class:`subprocess.Popen` class " +"called with ``shell=False`` and the list of strings passed as the first " +"argument; however, where :class:`~subprocess.Popen` takes a single argument " +"which is list of strings, *subprocess_exec* takes multiple string arguments." msgstr "" -msgid "The *protocol_factory* must be a callable returning a subclass of the :class:`asyncio.SubprocessProtocol` class." +#: ../../library/asyncio-eventloop.rst:1618 +msgid "" +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`asyncio.SubprocessProtocol` class." msgstr "" +#: ../../library/asyncio-eventloop.rst:1621 msgid "Other parameters:" msgstr "" +#: ../../library/asyncio-eventloop.rst:1623 msgid "*stdin* can be any of these:" msgstr "" +#: ../../library/asyncio-eventloop.rst:1625 +#: ../../library/asyncio-eventloop.rst:1636 +#: ../../library/asyncio-eventloop.rst:1646 msgid "a file-like object" msgstr "" -msgid "an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe`" +#: ../../library/asyncio-eventloop.rst:1626 +msgid "" +"an existing file descriptor (a positive integer), for example those created " +"with :meth:`os.pipe`" msgstr "" -msgid "the :const:`subprocess.PIPE` constant (default) which will create a new pipe and connect it," +#: ../../library/asyncio-eventloop.rst:1627 +#: ../../library/asyncio-eventloop.rst:1637 +#: ../../library/asyncio-eventloop.rst:1647 +msgid "" +"the :const:`subprocess.PIPE` constant (default) which will create a new pipe " +"and connect it," msgstr "" -msgid "the value ``None`` which will make the subprocess inherit the file descriptor from this process" +#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1639 +#: ../../library/asyncio-eventloop.rst:1649 +msgid "" +"the value ``None`` which will make the subprocess inherit the file " +"descriptor from this process" msgstr "" -msgid "the :const:`subprocess.DEVNULL` constant which indicates that the special :data:`os.devnull` file will be used" +#: ../../library/asyncio-eventloop.rst:1631 +#: ../../library/asyncio-eventloop.rst:1641 +#: ../../library/asyncio-eventloop.rst:1651 +msgid "" +"the :const:`subprocess.DEVNULL` constant which indicates that the " +"special :data:`os.devnull` file will be used" msgstr "" +#: ../../library/asyncio-eventloop.rst:1634 msgid "*stdout* can be any of these:" msgstr "" +#: ../../library/asyncio-eventloop.rst:1644 msgid "*stderr* can be any of these:" msgstr "" -msgid "the :const:`subprocess.STDOUT` constant which will connect the standard error stream to the process' standard output stream" +#: ../../library/asyncio-eventloop.rst:1653 +msgid "" +"the :const:`subprocess.STDOUT` constant which will connect the standard " +"error stream to the process' standard output stream" msgstr "" -msgid "All other keyword arguments are passed to :class:`subprocess.Popen` without interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, *encoding* and *errors*, which should not be specified at all." +#: ../../library/asyncio-eventloop.rst:1656 +msgid "" +"All other keyword arguments are passed to :class:`subprocess.Popen` without " +"interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " +"*encoding* and *errors*, which should not be specified at all." msgstr "" -msgid "The ``asyncio`` subprocess API does not support decoding the streams as text. :func:`bytes.decode` can be used to convert the bytes returned from the stream to text." +#: ../../library/asyncio-eventloop.rst:1661 +msgid "" +"The ``asyncio`` subprocess API does not support decoding the streams as " +"text. :func:`bytes.decode` can be used to convert the bytes returned from " +"the stream to text." msgstr "" -msgid "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a pipe, then the other side of this pipe should be registered with :meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use with the event loop." +#: ../../library/asyncio-eventloop.rst:1665 +msgid "" +"If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " +"pipe, then the other side of this pipe should be registered " +"with :meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for " +"use with the event loop." msgstr "" -msgid "See the constructor of the :class:`subprocess.Popen` class for documentation on other arguments." +#: ../../library/asyncio-eventloop.rst:1670 +msgid "" +"See the constructor of the :class:`subprocess.Popen` class for documentation " +"on other arguments." msgstr "" -msgid "Returns a pair of ``(transport, protocol)``, where *transport* conforms to the :class:`asyncio.SubprocessTransport` base class and *protocol* is an object instantiated by the *protocol_factory*." +#: ../../library/asyncio-eventloop.rst:1673 +msgid "" +"Returns a pair of ``(transport, protocol)``, where *transport* conforms to " +"the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " +"object instantiated by the *protocol_factory*." msgstr "" -msgid "If the transport is closed or is garbage collected, the child process is killed if it is still running." +#: ../../library/asyncio-eventloop.rst:1677 +#: ../../library/asyncio-eventloop.rst:1703 +msgid "" +"If the transport is closed or is garbage collected, the child process is " +"killed if it is still running." msgstr "" -msgid "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." +#: ../../library/asyncio-eventloop.rst:1685 +msgid "" +"Create a subprocess from *cmd*, which can be a :class:`str` or " +"a :class:`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -msgid "This is similar to the standard library :class:`subprocess.Popen` class called with ``shell=True``." +#: ../../library/asyncio-eventloop.rst:1690 +msgid "" +"This is similar to the standard library :class:`subprocess.Popen` class " +"called with ``shell=True``." msgstr "" -msgid "The *protocol_factory* must be a callable returning a subclass of the :class:`SubprocessProtocol` class." +#: ../../library/asyncio-eventloop.rst:1693 +msgid "" +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`SubprocessProtocol` class." msgstr "" -msgid "See :meth:`~loop.subprocess_exec` for more details about the remaining arguments." +#: ../../library/asyncio-eventloop.rst:1696 +msgid "" +"See :meth:`~loop.subprocess_exec` for more details about the remaining " +"arguments." msgstr "" -msgid "Returns a pair of ``(transport, protocol)``, where *transport* conforms to the :class:`SubprocessTransport` base class and *protocol* is an object instantiated by the *protocol_factory*." +#: ../../library/asyncio-eventloop.rst:1699 +msgid "" +"Returns a pair of ``(transport, protocol)``, where *transport* conforms to " +"the :class:`SubprocessTransport` base class and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -msgid "It is the application's responsibility to ensure that all whitespace and special characters are quoted appropriately to avoid `shell injection `_ vulnerabilities. The :func:`shlex.quote` function can be used to properly escape whitespace and special characters in strings that are going to be used to construct shell commands." +#: ../../library/asyncio-eventloop.rst:1707 +msgid "" +"It is the application's responsibility to ensure that all whitespace and " +"special characters are quoted appropriately to avoid `shell injection " +"`_ " +"vulnerabilities. The :func:`shlex.quote` function can be used to properly " +"escape whitespace and special characters in strings that are going to be " +"used to construct shell commands." msgstr "" +#: ../../library/asyncio-eventloop.rst:1716 msgid "Callback handles" msgstr "" -msgid "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." +#: ../../library/asyncio-eventloop.rst:1720 +msgid "" +"A callback wrapper object returned " +"by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." msgstr "" -msgid "Return the :class:`contextvars.Context` object associated with the handle." +#: ../../library/asyncio-eventloop.rst:1725 +msgid "" +"Return the :class:`contextvars.Context` object associated with the handle." msgstr "" -msgid "Cancel the callback. If the callback has already been canceled or executed, this method has no effect." +#: ../../library/asyncio-eventloop.rst:1732 +msgid "" +"Cancel the callback. If the callback has already been canceled or executed, " +"this method has no effect." msgstr "" +#: ../../library/asyncio-eventloop.rst:1737 msgid "Return ``True`` if the callback was cancelled." msgstr "" -msgid "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:`loop.call_at`." +#: ../../library/asyncio-eventloop.rst:1743 +msgid "" +"A callback wrapper object returned by :meth:`loop.call_later`, " +"and :meth:`loop.call_at`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1746 msgid "This class is a subclass of :class:`Handle`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1750 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "" -msgid "The time is an absolute timestamp, using the same time reference as :meth:`loop.time`." +#: ../../library/asyncio-eventloop.rst:1752 +msgid "" +"The time is an absolute timestamp, using the same time reference " +"as :meth:`loop.time`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1759 msgid "Server objects" msgstr "" -msgid "Server objects are created by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, and :func:`start_unix_server` functions." +#: ../../library/asyncio-eventloop.rst:1761 +msgid "" +"Server objects are created " +"by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, " +"and :func:`start_unix_server` functions." msgstr "" +#: ../../library/asyncio-eventloop.rst:1765 msgid "Do not instantiate the :class:`Server` class directly." msgstr "" -msgid "*Server* objects are asynchronous context managers. When used in an ``async with`` statement, it's guaranteed that the Server object is closed and not accepting new connections when the ``async with`` statement is completed::" +#: ../../library/asyncio-eventloop.rst:1769 +msgid "" +"*Server* objects are asynchronous context managers. When used in an ``async " +"with`` statement, it's guaranteed that the Server object is closed and not " +"accepting new connections when the ``async with`` statement is completed::" msgstr "" +#: ../../library/asyncio-eventloop.rst:1774 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -1175,57 +2276,102 @@ msgid "" "# At this point, srv is closed and no longer accepts new connections." msgstr "" +#: ../../library/asyncio-eventloop.rst:1782 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "" -msgid "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, 3.10.3 and 3.11." +#: ../../library/asyncio-eventloop.rst:1785 +msgid "" +"This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " +"3.10.3 and 3.11." msgstr "" -msgid "Stop serving: close listening sockets and set the :attr:`sockets` attribute to ``None``." +#: ../../library/asyncio-eventloop.rst:1790 +msgid "" +"Stop serving: close listening sockets and set the :attr:`sockets` attribute " +"to ``None``." msgstr "" -msgid "The sockets that represent existing incoming client connections are left open." +#: ../../library/asyncio-eventloop.rst:1793 +msgid "" +"The sockets that represent existing incoming client connections are left " +"open." msgstr "" -msgid "The server is closed asynchronously; use the :meth:`wait_closed` coroutine to wait until the server is closed (and no more connections are active)." +#: ../../library/asyncio-eventloop.rst:1796 +msgid "" +"The server is closed asynchronously; use the :meth:`wait_closed` coroutine " +"to wait until the server is closed (and no more connections are active)." msgstr "" +#: ../../library/asyncio-eventloop.rst:1802 msgid "Close all existing incoming client connections." msgstr "" -msgid "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." +#: ../../library/asyncio-eventloop.rst:1804 +msgid "" +"Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "" -msgid ":meth:`close` should be called before :meth:`close_clients` when closing the server to avoid races with new clients connecting." +#: ../../library/asyncio-eventloop.rst:1807 +msgid "" +":meth:`close` should be called before :meth:`close_clients` when closing the " +"server to avoid races with new clients connecting." msgstr "" -msgid "Close all existing incoming client connections immediately, without waiting for pending operations to complete." +#: ../../library/asyncio-eventloop.rst:1814 +msgid "" +"Close all existing incoming client connections immediately, without waiting " +"for pending operations to complete." msgstr "" -msgid "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." +#: ../../library/asyncio-eventloop.rst:1817 +msgid "" +"Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "" -msgid ":meth:`close` should be called before :meth:`abort_clients` when closing the server to avoid races with new clients connecting." +#: ../../library/asyncio-eventloop.rst:1820 +msgid "" +":meth:`close` should be called before :meth:`abort_clients` when closing the " +"server to avoid races with new clients connecting." msgstr "" +#: ../../library/asyncio-eventloop.rst:1827 msgid "Return the event loop associated with the server object." msgstr "" +#: ../../library/asyncio-eventloop.rst:1834 msgid "Start accepting connections." msgstr "" -msgid "This method is idempotent, so it can be called when the server is already serving." +#: ../../library/asyncio-eventloop.rst:1836 +msgid "" +"This method is idempotent, so it can be called when the server is already " +"serving." msgstr "" -msgid "The *start_serving* keyword-only parameter to :meth:`loop.create_server` and :meth:`asyncio.start_server` allows creating a Server object that is not accepting connections initially. In this case ``Server.start_serving()``, or :meth:`Server.serve_forever` can be used to make the Server start accepting connections." +#: ../../library/asyncio-eventloop.rst:1839 +msgid "" +"The *start_serving* keyword-only parameter to :meth:`loop.create_server` " +"and :meth:`asyncio.start_server` allows creating a Server object that is not " +"accepting connections initially. In this case ``Server.start_serving()``, " +"or :meth:`Server.serve_forever` can be used to make the Server start " +"accepting connections." msgstr "" -msgid "Start accepting connections until the coroutine is cancelled. Cancellation of ``serve_forever`` task causes the server to be closed." +#: ../../library/asyncio-eventloop.rst:1851 +msgid "" +"Start accepting connections until the coroutine is cancelled. Cancellation " +"of ``serve_forever`` task causes the server to be closed." msgstr "" -msgid "This method can be called if the server is already accepting connections. Only one ``serve_forever`` task can exist per one *Server* object." +#: ../../library/asyncio-eventloop.rst:1855 +msgid "" +"This method can be called if the server is already accepting connections. " +"Only one ``serve_forever`` task can exist per one *Server* object." msgstr "" +#: ../../library/asyncio-eventloop.rst:1861 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -1240,33 +2386,63 @@ msgid "" "asyncio.run(main('127.0.0.1', 0))" msgstr "" +#: ../../library/asyncio-eventloop.rst:1877 msgid "Return ``True`` if the server is accepting new connections." msgstr "" -msgid "Wait until the :meth:`close` method completes and all active connections have finished." +#: ../../library/asyncio-eventloop.rst:1884 +msgid "" +"Wait until the :meth:`close` method completes and all active connections " +"have finished." msgstr "" -msgid "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the server is listening on." +#: ../../library/asyncio-eventloop.rst:1887 +msgid "" +"``wait_closed()`` now waits until the server is closed and all active " +"connections have finished. Previously, it returned immediately if the " +"server was already closed, even if connections were still active." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1895 +msgid "" +"List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " +"server is listening on." msgstr "" -msgid "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of server sockets directly. In 3.7 a copy of that list is returned." +#: ../../library/asyncio-eventloop.rst:1898 +msgid "" +"Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " +"server sockets directly. In 3.7 a copy of that list is returned." msgstr "" +#: ../../library/asyncio-eventloop.rst:1908 msgid "Event loop implementations" msgstr "" -msgid "asyncio ships with two different event loop implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." +#: ../../library/asyncio-eventloop.rst:1910 +msgid "" +"asyncio ships with two different event loop " +"implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1913 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "" -msgid "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` module." +#: ../../library/asyncio-eventloop.rst:1918 +msgid "" +"A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " +"module." msgstr "" -msgid "Uses the most efficient *selector* available for the given platform. It is also possible to manually configure the exact selector implementation to be used::" +#: ../../library/asyncio-eventloop.rst:1921 +msgid "" +"Uses the most efficient *selector* available for the given platform. It is " +"also possible to manually configure the exact selector implementation to be " +"used::" msgstr "" +#: ../../library/asyncio-eventloop.rst:1925 msgid "" "import asyncio\n" "import selectors\n" @@ -1274,40 +2450,69 @@ msgid "" "async def main():\n" " ...\n" "\n" -"loop_factory = lambda: asyncio.SelectorEventLoop(selectors.SelectSelector())\n" +"loop_factory = lambda: " +"asyncio.SelectorEventLoop(selectors.SelectSelector())\n" "asyncio.run(main(), loop_factory=loop_factory)" msgstr "" -msgid "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O Completion Ports\" (IOCP)." +#: ../../library/asyncio-eventloop.rst:1940 +msgid "" +"A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " +"Completion Ports\" (IOCP)." msgstr "" -msgid "`MSDN documentation on I/O Completion Ports `_." +#: ../../library/asyncio-eventloop.rst:1946 +msgid "" +"`MSDN documentation on I/O Completion Ports `_." msgstr "" -msgid "An alias to the most efficient available subclass of :class:`AbstractEventLoop` for the given platform." +#: ../../library/asyncio-eventloop.rst:1951 +msgid "" +"An alias to the most efficient available subclass " +"of :class:`AbstractEventLoop` for the given platform." msgstr "" -msgid "It is an alias to :class:`SelectorEventLoop` on Unix and :class:`ProactorEventLoop` on Windows." +#: ../../library/asyncio-eventloop.rst:1954 +msgid "" +"It is an alias to :class:`SelectorEventLoop` on Unix " +"and :class:`ProactorEventLoop` on Windows." msgstr "" +#: ../../library/asyncio-eventloop.rst:1960 msgid "Abstract base class for asyncio-compliant event loops." msgstr "" -msgid "The :ref:`asyncio-event-loop-methods` section lists all methods that an alternative implementation of ``AbstractEventLoop`` should have defined." +#: ../../library/asyncio-eventloop.rst:1962 +msgid "" +"The :ref:`asyncio-event-loop-methods` section lists all methods that an " +"alternative implementation of ``AbstractEventLoop`` should have defined." msgstr "" +#: ../../library/asyncio-eventloop.rst:1968 msgid "Examples" msgstr "" -msgid "Note that all examples in this section **purposefully** show how to use the low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be written this way; consider using the high-level functions like :func:`asyncio.run`." +#: ../../library/asyncio-eventloop.rst:1970 +msgid "" +"Note that all examples in this section **purposefully** show how to use the " +"low-level event loop APIs, such as :meth:`loop.run_forever` " +"and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be " +"written this way; consider using the high-level functions " +"like :func:`asyncio.run`." msgstr "" +#: ../../library/asyncio-eventloop.rst:1980 msgid "Hello World with call_soon()" msgstr "" -msgid "An example using the :meth:`loop.call_soon` method to schedule a callback. The callback displays ``\"Hello World\"`` and then stops the event loop::" +#: ../../library/asyncio-eventloop.rst:1982 +msgid "" +"An example using the :meth:`loop.call_soon` method to schedule a callback. " +"The callback displays ``\"Hello World\"`` and then stops the event loop::" msgstr "" +#: ../../library/asyncio-eventloop.rst:1986 msgid "" "import asyncio\n" "\n" @@ -1328,15 +2533,24 @@ msgid "" " loop.close()" msgstr "" -msgid "A similar :ref:`Hello World ` example created with a coroutine and the :func:`run` function." +#: ../../library/asyncio-eventloop.rst:2006 +msgid "" +"A similar :ref:`Hello World ` example created with a coroutine " +"and the :func:`run` function." msgstr "" +#: ../../library/asyncio-eventloop.rst:2013 msgid "Display the current date with call_later()" msgstr "" -msgid "An example of a callback displaying the current date every second. The callback uses the :meth:`loop.call_later` method to reschedule itself after 5 seconds, and then stops the event loop::" +#: ../../library/asyncio-eventloop.rst:2015 +msgid "" +"An example of a callback displaying the current date every second. The " +"callback uses the :meth:`loop.call_later` method to reschedule itself after " +"5 seconds, and then stops the event loop::" msgstr "" +#: ../../library/asyncio-eventloop.rst:2019 msgid "" "import asyncio\n" "import datetime as dt\n" @@ -1361,15 +2575,23 @@ msgid "" " loop.close()" msgstr "" -msgid "A similar :ref:`current date ` example created with a coroutine and the :func:`run` function." +#: ../../library/asyncio-eventloop.rst:2043 +msgid "" +"A similar :ref:`current date ` example created with a " +"coroutine and the :func:`run` function." msgstr "" +#: ../../library/asyncio-eventloop.rst:2050 msgid "Watch a file descriptor for read events" msgstr "" -msgid "Wait until a file descriptor received some data using the :meth:`loop.add_reader` method and then close the event loop::" +#: ../../library/asyncio-eventloop.rst:2052 +msgid "" +"Wait until a file descriptor received some data using " +"the :meth:`loop.add_reader` method and then close the event loop::" msgstr "" +#: ../../library/asyncio-eventloop.rst:2055 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -1405,21 +2627,34 @@ msgid "" " loop.close()" msgstr "" -msgid "A similar :ref:`example ` using transports, protocols, and the :meth:`loop.create_connection` method." +#: ../../library/asyncio-eventloop.rst:2090 +msgid "" +"A similar :ref:`example ` using " +"transports, protocols, and the :meth:`loop.create_connection` method." msgstr "" -msgid "Another similar :ref:`example ` using the high-level :func:`asyncio.open_connection` function and streams." +#: ../../library/asyncio-eventloop.rst:2094 +msgid "" +"Another similar :ref:`example ` " +"using the high-level :func:`asyncio.open_connection` function and streams." msgstr "" +#: ../../library/asyncio-eventloop.rst:2102 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "" +#: ../../library/asyncio-eventloop.rst:2104 msgid "(This ``signal`` example only works on Unix.)" msgstr "" -msgid "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal.SIGTERM` using the :meth:`loop.add_signal_handler` method::" +#: ../../library/asyncio-eventloop.rst:2106 +msgid "" +"Register handlers for signals :const:`~signal.SIGINT` " +"and :const:`~signal.SIGTERM` using the :meth:`loop.add_signal_handler` " +"method::" msgstr "" +#: ../../library/asyncio-eventloop.rst:2109 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index 19f19b02b..bc46c0549 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:54+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,59 +23,87 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-exceptions.rst:8 msgid "Exceptions" msgstr "" +#: ../../library/asyncio-exceptions.rst:10 msgid "**Source code:** :source:`Lib/asyncio/exceptions.py`" msgstr "" -msgid "A deprecated alias of :exc:`TimeoutError`, raised when the operation has exceeded the given deadline." +#: ../../library/asyncio-exceptions.rst:16 +msgid "" +"A deprecated alias of :exc:`TimeoutError`, raised when the operation has " +"exceeded the given deadline." msgstr "" +#: ../../library/asyncio-exceptions.rst:21 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" +#: ../../library/asyncio-exceptions.rst:26 msgid "The operation has been cancelled." msgstr "" -msgid "This exception can be caught to perform custom operations when asyncio Tasks are cancelled. In almost all situations the exception must be re-raised." +#: ../../library/asyncio-exceptions.rst:28 +msgid "" +"This exception can be caught to perform custom operations when asyncio Tasks " +"are cancelled. In almost all situations the exception must be re-raised." msgstr "" -msgid ":exc:`CancelledError` is now a subclass of :class:`BaseException` rather than :class:`Exception`." +#: ../../library/asyncio-exceptions.rst:34 +msgid "" +":exc:`CancelledError` is now a subclass of :class:`BaseException` rather " +"than :class:`Exception`." msgstr "" +#: ../../library/asyncio-exceptions.rst:39 msgid "Invalid internal state of :class:`Task` or :class:`Future`." msgstr "" -msgid "Can be raised in situations like setting a result value for a *Future* object that already has a result value set." +#: ../../library/asyncio-exceptions.rst:41 +msgid "" +"Can be raised in situations like setting a result value for a *Future* " +"object that already has a result value set." msgstr "" -msgid "The \"sendfile\" syscall is not available for the given socket or file type." +#: ../../library/asyncio-exceptions.rst:47 +msgid "" +"The \"sendfile\" syscall is not available for the given socket or file type." msgstr "" +#: ../../library/asyncio-exceptions.rst:50 msgid "A subclass of :exc:`RuntimeError`." msgstr "" +#: ../../library/asyncio-exceptions.rst:55 msgid "The requested read operation did not complete fully." msgstr "" +#: ../../library/asyncio-exceptions.rst:57 msgid "Raised by the :ref:`asyncio stream APIs`." msgstr "" +#: ../../library/asyncio-exceptions.rst:59 msgid "This exception is a subclass of :exc:`EOFError`." msgstr "" +#: ../../library/asyncio-exceptions.rst:63 msgid "The total number (:class:`int`) of expected bytes." msgstr "" +#: ../../library/asyncio-exceptions.rst:67 msgid "A string of :class:`bytes` read before the end of stream was reached." msgstr "" +#: ../../library/asyncio-exceptions.rst:72 msgid "Reached the buffer size limit while looking for a separator." msgstr "" +#: ../../library/asyncio-exceptions.rst:74 msgid "Raised by the :ref:`asyncio stream APIs `." msgstr "" +#: ../../library/asyncio-exceptions.rst:78 msgid "The total number of to be consumed bytes." msgstr "" diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index 5ec7c7600..a850f5e0d 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2022-11-05 19:48+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,83 +21,140 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-extending.rst:6 msgid "Extending" msgstr "" -msgid "The main direction for :mod:`asyncio` extending is writing custom *event loop* classes. Asyncio has helpers that could be used to simplify this task." +#: ../../library/asyncio-extending.rst:8 +msgid "" +"The main direction for :mod:`asyncio` extending is writing custom *event " +"loop* classes. Asyncio has helpers that could be used to simplify this task." msgstr "" -msgid "Third-parties should reuse existing asyncio code with caution, a new Python version is free to break backward compatibility in *internal* part of API." +#: ../../library/asyncio-extending.rst:13 +msgid "" +"Third-parties should reuse existing asyncio code with caution, a new Python " +"version is free to break backward compatibility in *internal* part of API." msgstr "" +#: ../../library/asyncio-extending.rst:19 msgid "Writing a Custom Event Loop" msgstr "" -msgid ":class:`asyncio.AbstractEventLoop` declares very many methods. Implementing all them from scratch is a tedious job." +#: ../../library/asyncio-extending.rst:21 +msgid "" +":class:`asyncio.AbstractEventLoop` declares very many methods. Implementing " +"all them from scratch is a tedious job." msgstr "" -msgid "A loop can get many common methods implementation for free by inheriting from :class:`asyncio.BaseEventLoop`." +#: ../../library/asyncio-extending.rst:24 +msgid "" +"A loop can get many common methods implementation for free by inheriting " +"from :class:`asyncio.BaseEventLoop`." msgstr "" -msgid "In turn, the successor should implement a bunch of *private* methods declared but not implemented in :class:`asyncio.BaseEventLoop`." +#: ../../library/asyncio-extending.rst:27 +msgid "" +"In turn, the successor should implement a bunch of *private* methods " +"declared but not implemented in :class:`asyncio.BaseEventLoop`." msgstr "" -msgid "For example, ``loop.create_connection()`` checks arguments, resolves DNS addresses, and calls ``loop._make_socket_transport()`` that should be implemented by inherited class. The ``_make_socket_transport()`` method is not documented and is considered as an *internal* API." +#: ../../library/asyncio-extending.rst:30 +msgid "" +"For example, ``loop.create_connection()`` checks arguments, resolves DNS " +"addresses, and calls ``loop._make_socket_transport()`` that should be " +"implemented by inherited class. The ``_make_socket_transport()`` method is " +"not documented and is considered as an *internal* API." msgstr "" +#: ../../library/asyncio-extending.rst:38 msgid "Future and Task private constructors" msgstr "" -msgid ":class:`asyncio.Future` and :class:`asyncio.Task` should be never created directly, please use corresponding :meth:`loop.create_future` and :meth:`loop.create_task`, or :func:`asyncio.create_task` factories instead." +#: ../../library/asyncio-extending.rst:40 +msgid "" +":class:`asyncio.Future` and :class:`asyncio.Task` should be never created " +"directly, please use corresponding :meth:`loop.create_future` " +"and :meth:`loop.create_task`, or :func:`asyncio.create_task` factories " +"instead." msgstr "" -msgid "However, third-party *event loops* may *reuse* built-in future and task implementations for the sake of getting a complex and highly optimized code for free." +#: ../../library/asyncio-extending.rst:44 +msgid "" +"However, third-party *event loops* may *reuse* built-in future and task " +"implementations for the sake of getting a complex and highly optimized code " +"for free." msgstr "" +#: ../../library/asyncio-extending.rst:47 msgid "For this purpose the following, *private* constructors are listed:" msgstr "" +#: ../../library/asyncio-extending.rst:51 msgid "Create a built-in future instance." msgstr "" +#: ../../library/asyncio-extending.rst:53 msgid "*loop* is an optional event loop instance." msgstr "" +#: ../../library/asyncio-extending.rst:57 msgid "Create a built-in task instance." msgstr "" -msgid "*loop* is an optional event loop instance. The rest of arguments are described in :meth:`loop.create_task` description." +#: ../../library/asyncio-extending.rst:59 +msgid "" +"*loop* is an optional event loop instance. The rest of arguments are " +"described in :meth:`loop.create_task` description." msgstr "" +#: ../../library/asyncio-extending.rst:64 msgid "*context* argument is added." msgstr "" +#: ../../library/asyncio-extending.rst:69 msgid "Task lifetime support" msgstr "" -msgid "A third party task implementation should call the following functions to keep a task visible by :func:`asyncio.all_tasks` and :func:`asyncio.current_task`:" +#: ../../library/asyncio-extending.rst:71 +msgid "" +"A third party task implementation should call the following functions to " +"keep a task visible by :func:`asyncio.all_tasks` " +"and :func:`asyncio.current_task`:" msgstr "" +#: ../../library/asyncio-extending.rst:76 msgid "Register a new *task* as managed by *asyncio*." msgstr "" +#: ../../library/asyncio-extending.rst:78 msgid "Call the function from a task constructor." msgstr "" +#: ../../library/asyncio-extending.rst:82 msgid "Unregister a *task* from *asyncio* internal structures." msgstr "" +#: ../../library/asyncio-extending.rst:84 msgid "The function should be called when a task is about to finish." msgstr "" +#: ../../library/asyncio-extending.rst:88 msgid "Switch the current task to the *task* argument." msgstr "" -msgid "Call the function just before executing a portion of embedded *coroutine* (:meth:`coroutine.send` or :meth:`coroutine.throw`)." +#: ../../library/asyncio-extending.rst:90 +msgid "" +"Call the function just before executing a portion of embedded *coroutine* " +"(:meth:`coroutine.send` or :meth:`coroutine.throw`)." msgstr "" +#: ../../library/asyncio-extending.rst:95 msgid "Switch the current task back from *task* to ``None``." msgstr "" -msgid "Call the function just after :meth:`coroutine.send` or :meth:`coroutine.throw` execution." +#: ../../library/asyncio-extending.rst:97 +msgid "" +"Call the function just after :meth:`coroutine.send` " +"or :meth:`coroutine.throw` execution." msgstr "" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index 603c76d37..e831f738a 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,185 +23,317 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-future.rst:8 msgid "Futures" msgstr "" -msgid "**Source code:** :source:`Lib/asyncio/futures.py`, :source:`Lib/asyncio/base_futures.py`" +#: ../../library/asyncio-future.rst:10 +msgid "" +"**Source code:** :source:`Lib/asyncio/futures.py`, :source:`Lib/asyncio/" +"base_futures.py`" msgstr "" -msgid "*Future* objects are used to bridge **low-level callback-based code** with high-level async/await code." +#: ../../library/asyncio-future.rst:15 +msgid "" +"*Future* objects are used to bridge **low-level callback-based code** with " +"high-level async/await code." msgstr "" +#: ../../library/asyncio-future.rst:20 msgid "Future Functions" msgstr "" +#: ../../library/asyncio-future.rst:24 msgid "Return ``True`` if *obj* is either of:" msgstr "" +#: ../../library/asyncio-future.rst:26 msgid "an instance of :class:`asyncio.Future`," msgstr "" +#: ../../library/asyncio-future.rst:27 msgid "an instance of :class:`asyncio.Task`," msgstr "" +#: ../../library/asyncio-future.rst:28 msgid "a Future-like object with a ``_asyncio_future_blocking`` attribute." msgstr "" +#: ../../library/asyncio-future.rst:36 msgid "Return:" msgstr "" -msgid "*obj* argument as is, if *obj* is a :class:`Future`, a :class:`Task`, or a Future-like object (:func:`isfuture` is used for the test.)" +#: ../../library/asyncio-future.rst:38 +msgid "" +"*obj* argument as is, if *obj* is a :class:`Future`, a :class:`Task`, or a " +"Future-like object (:func:`isfuture` is used for the test.)" msgstr "" -msgid "a :class:`Task` object wrapping *obj*, if *obj* is a coroutine (:func:`iscoroutine` is used for the test); in this case the coroutine will be scheduled by ``ensure_future()``." +#: ../../library/asyncio-future.rst:42 +msgid "" +"a :class:`Task` object wrapping *obj*, if *obj* is a coroutine " +"(:func:`iscoroutine` is used for the test); in this case the coroutine will " +"be scheduled by ``ensure_future()``." msgstr "" -msgid "a :class:`Task` object that would await on *obj*, if *obj* is an awaitable (:func:`inspect.isawaitable` is used for the test.)" +#: ../../library/asyncio-future.rst:47 +msgid "" +"a :class:`Task` object that would await on *obj*, if *obj* is an awaitable " +"(:func:`inspect.isawaitable` is used for the test.)" msgstr "" +#: ../../library/asyncio-future.rst:50 msgid "If *obj* is neither of the above a :exc:`TypeError` is raised." msgstr "" -msgid "Save a reference to the result of this function, to avoid a task disappearing mid-execution." +#: ../../library/asyncio-future.rst:54 +msgid "" +"Save a reference to the result of this function, to avoid a task " +"disappearing mid-execution." msgstr "" -msgid "See also the :func:`create_task` function which is the preferred way for creating new tasks or use :class:`asyncio.TaskGroup` which keeps reference to the task internally." +#: ../../library/asyncio-future.rst:57 +msgid "" +"See also the :func:`create_task` function which is the preferred way for " +"creating new tasks or use :class:`asyncio.TaskGroup` which keeps reference " +"to the task internally." msgstr "" +#: ../../library/asyncio-future.rst:61 msgid "The function accepts any :term:`awaitable` object." msgstr "" -msgid "Deprecation warning is emitted if *obj* is not a Future-like object and *loop* is not specified and there is no running event loop." +#: ../../library/asyncio-future.rst:64 +msgid "" +"Deprecation warning is emitted if *obj* is not a Future-like object and " +"*loop* is not specified and there is no running event loop." msgstr "" -msgid "Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio.Future` object." +#: ../../library/asyncio-future.rst:71 +msgid "" +"Wrap a :class:`concurrent.futures.Future` object in " +"a :class:`asyncio.Future` object." msgstr "" -msgid "Deprecation warning is emitted if *future* is not a Future-like object and *loop* is not specified and there is no running event loop." +#: ../../library/asyncio-future.rst:74 +msgid "" +"Deprecation warning is emitted if *future* is not a Future-like object and " +"*loop* is not specified and there is no running event loop." msgstr "" +#: ../../library/asyncio-future.rst:81 msgid "Future Object" msgstr "" -msgid "A Future represents an eventual result of an asynchronous operation. Not thread-safe." +#: ../../library/asyncio-future.rst:85 +msgid "" +"A Future represents an eventual result of an asynchronous operation. Not " +"thread-safe." msgstr "" -msgid "Future is an :term:`awaitable` object. Coroutines can await on Future objects until they either have a result or an exception set, or until they are cancelled. A Future can be awaited multiple times and the result is same." +#: ../../library/asyncio-future.rst:88 +msgid "" +"Future is an :term:`awaitable` object. Coroutines can await on Future " +"objects until they either have a result or an exception set, or until they " +"are cancelled. A Future can be awaited multiple times and the result is same." msgstr "" -msgid "Typically Futures are used to enable low-level callback-based code (e.g. in protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." +#: ../../library/asyncio-future.rst:93 +msgid "" +"Typically Futures are used to enable low-level callback-based code (e.g. in " +"protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." msgstr "" -msgid "The rule of thumb is to never expose Future objects in user-facing APIs, and the recommended way to create a Future object is to call :meth:`loop.create_future`. This way alternative event loop implementations can inject their own optimized implementations of a Future object." +#: ../../library/asyncio-future.rst:98 +msgid "" +"The rule of thumb is to never expose Future objects in user-facing APIs, and " +"the recommended way to create a Future object is to " +"call :meth:`loop.create_future`. This way alternative event loop " +"implementations can inject their own optimized implementations of a Future " +"object." msgstr "" +#: ../../library/asyncio-future.rst:104 msgid "Futures are :ref:`generic ` over the type of their results." msgstr "" +#: ../../library/asyncio-future.rst:106 msgid "Added support for the :mod:`contextvars` module." msgstr "" -msgid "Deprecation warning is emitted if *loop* is not specified and there is no running event loop." +#: ../../library/asyncio-future.rst:109 +msgid "" +"Deprecation warning is emitted if *loop* is not specified and there is no " +"running event loop." msgstr "" +#: ../../library/asyncio-future.rst:115 msgid "Return the result of the Future." msgstr "" -msgid "If the Future is *done* and has a result set by the :meth:`set_result` method, the result value is returned." +#: ../../library/asyncio-future.rst:117 +msgid "" +"If the Future is *done* and has a result set by the :meth:`set_result` " +"method, the result value is returned." msgstr "" -msgid "If the Future is *done* and has an exception set by the :meth:`set_exception` method, this method raises the exception." +#: ../../library/asyncio-future.rst:120 +msgid "" +"If the Future is *done* and has an exception set by " +"the :meth:`set_exception` method, this method raises the exception." msgstr "" -msgid "If the Future has been *cancelled*, this method raises a :exc:`CancelledError` exception." +#: ../../library/asyncio-future.rst:123 ../../library/asyncio-future.rst:215 +msgid "" +"If the Future has been *cancelled*, this method raises " +"a :exc:`CancelledError` exception." msgstr "" -msgid "If the Future's result isn't yet available, this method raises an :exc:`InvalidStateError` exception." +#: ../../library/asyncio-future.rst:126 +msgid "" +"If the Future's result isn't yet available, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" +#: ../../library/asyncio-future.rst:131 msgid "Mark the Future as *done* and set its result." msgstr "" -msgid "Raises an :exc:`InvalidStateError` error if the Future is already *done*." +#: ../../library/asyncio-future.rst:133 ../../library/asyncio-future.rst:140 +msgid "" +"Raises an :exc:`InvalidStateError` error if the Future is already *done*." msgstr "" +#: ../../library/asyncio-future.rst:138 msgid "Mark the Future as *done* and set an exception." msgstr "" +#: ../../library/asyncio-future.rst:145 msgid "Return ``True`` if the Future is *done*." msgstr "" -msgid "A Future is *done* if it was *cancelled* or if it has a result or an exception set with :meth:`set_result` or :meth:`set_exception` calls." +#: ../../library/asyncio-future.rst:147 +msgid "" +"A Future is *done* if it was *cancelled* or if it has a result or an " +"exception set with :meth:`set_result` or :meth:`set_exception` calls." msgstr "" +#: ../../library/asyncio-future.rst:153 msgid "Return ``True`` if the Future was *cancelled*." msgstr "" -msgid "The method is usually used to check if a Future is not *cancelled* before setting a result or an exception for it::" +#: ../../library/asyncio-future.rst:155 +msgid "" +"The method is usually used to check if a Future is not *cancelled* before " +"setting a result or an exception for it::" msgstr "" +#: ../../library/asyncio-future.rst:158 msgid "" "if not fut.cancelled():\n" " fut.set_result(42)" msgstr "" +#: ../../library/asyncio-future.rst:163 msgid "Add a callback to be run when the Future is *done*." msgstr "" +#: ../../library/asyncio-future.rst:165 msgid "The *callback* is called with the Future object as its only argument." msgstr "" -msgid "If the Future is already *done* when this method is called, the callback is scheduled with :meth:`loop.call_soon`." +#: ../../library/asyncio-future.rst:168 +msgid "" +"If the Future is already *done* when this method is called, the callback is " +"scheduled with :meth:`loop.call_soon`." msgstr "" -msgid "An optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the *callback* to run in. The current context is used when no *context* is provided." +#: ../../library/asyncio-future.rst:171 +msgid "" +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" -msgid ":func:`functools.partial` can be used to pass parameters to the callback, e.g.::" +#: ../../library/asyncio-future.rst:175 +msgid "" +":func:`functools.partial` can be used to pass parameters to the callback, " +"e.g.::" msgstr "" +#: ../../library/asyncio-future.rst:178 msgid "" "# Call 'print(\"Future:\", fut)' when \"fut\" is done.\n" "fut.add_done_callback(\n" " functools.partial(print, \"Future:\"))" msgstr "" -msgid "The *context* keyword-only parameter was added. See :pep:`567` for more details." +#: ../../library/asyncio-future.rst:182 +msgid "" +"The *context* keyword-only parameter was added. See :pep:`567` for more " +"details." msgstr "" +#: ../../library/asyncio-future.rst:188 msgid "Remove *callback* from the callbacks list." msgstr "" -msgid "Returns the number of callbacks removed, which is typically 1, unless a callback was added more than once." +#: ../../library/asyncio-future.rst:190 +msgid "" +"Returns the number of callbacks removed, which is typically 1, unless a " +"callback was added more than once." msgstr "" +#: ../../library/asyncio-future.rst:195 msgid "Cancel the Future and schedule callbacks." msgstr "" -msgid "If the Future is already *done* or *cancelled*, return ``False``. Otherwise, change the Future's state to *cancelled*, schedule the callbacks, and return ``True``." +#: ../../library/asyncio-future.rst:197 +msgid "" +"If the Future is already *done* or *cancelled*, return ``False``. Otherwise, " +"change the Future's state to *cancelled*, schedule the callbacks, and return " +"``True``." msgstr "" -msgid "The optional string argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future is awaited." +#: ../../library/asyncio-future.rst:201 +msgid "" +"The optional string argument *msg* is passed as the argument to " +"the :exc:`CancelledError` exception raised when a cancelled Future is " +"awaited." msgstr "" +#: ../../library/asyncio-future.rst:205 msgid "Added the *msg* parameter." msgstr "" +#: ../../library/asyncio-future.rst:210 msgid "Return the exception that was set on this Future." msgstr "" -msgid "The exception (or ``None`` if no exception was set) is returned only if the Future is *done*." +#: ../../library/asyncio-future.rst:212 +msgid "" +"The exception (or ``None`` if no exception was set) is returned only if the " +"Future is *done*." msgstr "" -msgid "If the Future isn't *done* yet, this method raises an :exc:`InvalidStateError` exception." +#: ../../library/asyncio-future.rst:218 +msgid "" +"If the Future isn't *done* yet, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" +#: ../../library/asyncio-future.rst:223 msgid "Return the event loop the Future object is bound to." msgstr "" -msgid "This example creates a Future object, creates and schedules an asynchronous Task to set result for the Future, and waits until the Future has a result::" +#: ../../library/asyncio-future.rst:230 +msgid "" +"This example creates a Future object, creates and schedules an asynchronous " +"Task to set result for the Future, and waits until the Future has a result::" msgstr "" +#: ../../library/asyncio-future.rst:234 msgid "" "async def set_after(fut, delay, value):\n" " # Sleep for *delay* seconds.\n" @@ -232,23 +364,44 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "The Future object was designed to mimic :class:`concurrent.futures.Future`. Key differences include:" +#: ../../library/asyncio-future.rst:265 +msgid "" +"The Future object was designed to mimic :class:`concurrent.futures.Future`. " +"Key differences include:" msgstr "" -msgid "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot be awaited." +#: ../../library/asyncio-future.rst:268 +msgid "" +"unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " +"be awaited." msgstr "" -msgid ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not accept the *timeout* argument." +#: ../../library/asyncio-future.rst:271 +msgid "" +":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " +"accept the *timeout* argument." msgstr "" -msgid ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :exc:`InvalidStateError` exception when the Future is not *done*." +#: ../../library/asyncio-future.rst:274 +msgid "" +":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise " +"an :exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" -msgid "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not called immediately. They are scheduled with :meth:`loop.call_soon` instead." +#: ../../library/asyncio-future.rst:278 +msgid "" +"Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " +"called immediately. They are scheduled with :meth:`loop.call_soon` instead." msgstr "" -msgid "asyncio Future is not compatible with the :func:`concurrent.futures.wait` and :func:`concurrent.futures.as_completed` functions." +#: ../../library/asyncio-future.rst:282 +msgid "" +"asyncio Future is not compatible with the :func:`concurrent.futures.wait` " +"and :func:`concurrent.futures.as_completed` functions." msgstr "" -msgid ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :meth:`concurrent.futures.Future.cancel` does not." +#: ../../library/asyncio-future.rst:286 +msgid "" +":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, " +"but :meth:`concurrent.futures.Future.cancel` does not." msgstr "" diff --git a/library/asyncio-graph.po b/library/asyncio-graph.po index fc06b6112..d869e4bd8 100644 --- a/library/asyncio-graph.po +++ b/library/asyncio-graph.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,39 +19,82 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -msgid "Call Graph Introspection" +#: ../../library/asyncio-graph.rst:8 +msgid "Call graph introspection" msgstr "" +#: ../../library/asyncio-graph.rst:10 msgid "**Source code:** :source:`Lib/asyncio/graph.py`" msgstr "" -msgid "asyncio has powerful runtime call graph introspection utilities to trace the entire call graph of a running *coroutine* or *task*, or a suspended *future*. These utilities and the underlying machinery can be used from within a Python program or by external profilers and debuggers." +#: ../../library/asyncio-graph.rst:14 +msgid "" +"asyncio has powerful runtime call graph introspection utilities to trace the " +"entire call graph of a running *coroutine* or *task*, or a suspended " +"*future*. These utilities and the underlying machinery can be used from " +"within a Python program or by external profilers and debuggers." +msgstr "" + +#: ../../library/asyncio-graph.rst:22 +msgid ":ref:`asyncio-introspection-tools`" +msgstr "" + +#: ../../library/asyncio-graph.rst:23 +msgid "" +"Command-line tools for inspecting tasks in another running Python process." msgstr "" -msgid "Print the async call graph for the current task or the provided :class:`Task` or :class:`Future`." +#: ../../library/asyncio-graph.rst:31 +msgid "" +"Print the async call graph for the current task or the " +"provided :class:`Task` or :class:`Future`." msgstr "" -msgid "This function prints entries starting from the top frame and going down towards the invocation point." +#: ../../library/asyncio-graph.rst:34 +msgid "" +"This function prints entries starting from the top frame and going down " +"towards the invocation point." msgstr "" -msgid "The function receives an optional *future* argument. If not passed, the current running task will be used." +#: ../../library/asyncio-graph.rst:37 +msgid "" +"The function receives an optional *future* argument. If not passed, the " +"current running task will be used." msgstr "" -msgid "If the function is called on *the current task*, the optional keyword-only *depth* argument can be used to skip the specified number of frames from top of the stack." +#: ../../library/asyncio-graph.rst:40 ../../library/asyncio-graph.rst:99 +msgid "" +"If the function is called on *the current task*, the optional keyword-only " +"*depth* argument can be used to skip the specified number of frames from top " +"of the stack." msgstr "" -msgid "If the optional keyword-only *limit* argument is provided, each call stack in the resulting graph is truncated to include at most ``abs(limit)`` entries. If *limit* is positive, the entries left are the closest to the invocation point. If *limit* is negative, the topmost entries are left. If *limit* is omitted or ``None``, all entries are present. If *limit* is ``0``, the call stack is not printed at all, only \"awaited by\" information is printed." +#: ../../library/asyncio-graph.rst:44 +msgid "" +"If the optional keyword-only *limit* argument is provided, each call stack " +"in the resulting graph is truncated to include at most ``abs(limit)`` " +"entries. If *limit* is positive, the entries left are the closest to the " +"invocation point. If *limit* is negative, the topmost entries are left. If " +"*limit* is omitted or ``None``, all entries are present. If *limit* is " +"``0``, the call stack is not printed at all, only \"awaited by\" information " +"is printed." msgstr "" -msgid "If *file* is omitted or ``None``, the function will print to :data:`sys.stdout`." +#: ../../library/asyncio-graph.rst:52 +msgid "" +"If *file* is omitted or ``None``, the function will print " +"to :data:`sys.stdout`." msgstr "" +#: ../../library/asyncio-graph.rst:55 msgid "**Example:**" msgstr "" +#: ../../library/asyncio-graph.rst:57 msgid "The following Python code:" msgstr "" +#: ../../library/asyncio-graph.rst:59 msgid "" "import asyncio\n" "\n" @@ -65,9 +108,11 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-graph.rst:72 msgid "will print::" msgstr "" +#: ../../library/asyncio-graph.rst:74 msgid "" "* Task(name='test', id=0x1039f0fe0)\n" "+ Call stack:\n" @@ -79,50 +124,90 @@ msgid "" " | File 't2.py', line 7, in async main()" msgstr "" -msgid "Like :func:`print_call_graph`, but returns a string. If *future* is ``None`` and there's no current task, the function returns an empty string." +#: ../../library/asyncio-graph.rst:85 +msgid "" +"Like :func:`print_call_graph`, but returns a string. If *future* is ``None`` " +"and there's no current task, the function returns an empty string." msgstr "" -msgid "Capture the async call graph for the current task or the provided :class:`Task` or :class:`Future`." +#: ../../library/asyncio-graph.rst:92 +msgid "" +"Capture the async call graph for the current task or the " +"provided :class:`Task` or :class:`Future`." msgstr "" -msgid "The function receives an optional *future* argument. If not passed, the current running task will be used. If there's no current task, the function returns ``None``." +#: ../../library/asyncio-graph.rst:95 +msgid "" +"The function receives an optional *future* argument. If not passed, the " +"current running task will be used. If there's no current task, the function " +"returns ``None``." msgstr "" +#: ../../library/asyncio-graph.rst:103 msgid "Returns a ``FutureCallGraph`` data class object:" msgstr "" +#: ../../library/asyncio-graph.rst:105 msgid "``FutureCallGraph(future, call_stack, awaited_by)``" msgstr "" -msgid "Where *future* is a reference to a :class:`Future` or a :class:`Task` (or their subclasses.)" +#: ../../library/asyncio-graph.rst:107 +msgid "" +"Where *future* is a reference to a :class:`Future` or a :class:`Task` (or " +"their subclasses.)" msgstr "" +#: ../../library/asyncio-graph.rst:110 msgid "``call_stack`` is a tuple of ``FrameCallGraphEntry`` objects." msgstr "" +#: ../../library/asyncio-graph.rst:112 msgid "``awaited_by`` is a tuple of ``FutureCallGraph`` objects." msgstr "" +#: ../../library/asyncio-graph.rst:114 msgid "``FrameCallGraphEntry(frame)``" msgstr "" -msgid "Where *frame* is a frame object of a regular Python function in the call stack." +#: ../../library/asyncio-graph.rst:116 +msgid "" +"Where *frame* is a frame object of a regular Python function in the call " +"stack." msgstr "" +#: ../../library/asyncio-graph.rst:121 msgid "Low level utility functions" msgstr "" -msgid "To introspect an async call graph asyncio requires cooperation from control flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an intermediate :class:`Future` object with low-level APIs like :meth:`Future.add_done_callback() ` is involved, the following two functions should be used to inform asyncio about how exactly such intermediate future objects are connected with the tasks they wrap or control." +#: ../../library/asyncio-graph.rst:123 +msgid "" +"To introspect an async call graph asyncio requires cooperation from control " +"flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an " +"intermediate :class:`Future` object with low-level APIs " +"like :meth:`Future.add_done_callback() ` " +"is involved, the following two functions should be used to inform asyncio " +"about how exactly such intermediate future objects are connected with the " +"tasks they wrap or control." msgstr "" +#: ../../library/asyncio-graph.rst:134 msgid "Record that *future* is awaited on by *waiter*." msgstr "" -msgid "Both *future* and *waiter* must be instances of :class:`Future` or :class:`Task` or their subclasses, otherwise the call would have no effect." +#: ../../library/asyncio-graph.rst:136 ../../library/asyncio-graph.rst:149 +msgid "" +"Both *future* and *waiter* must be instances of :class:`Future` " +"or :class:`Task` or their subclasses, otherwise the call would have no " +"effect." msgstr "" -msgid "A call to ``future_add_to_awaited_by()`` must be followed by an eventual call to the :func:`future_discard_from_awaited_by` function with the same arguments." +#: ../../library/asyncio-graph.rst:140 +msgid "" +"A call to ``future_add_to_awaited_by()`` must be followed by an eventual " +"call to the :func:`future_discard_from_awaited_by` function with the same " +"arguments." msgstr "" +#: ../../library/asyncio-graph.rst:147 msgid "Record that *future* is no longer awaited on by *waiter*." msgstr "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 33c7b965a..db3852ed2 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,716 +24,1004 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-llapi-index.rst:6 msgid "Low-level API Index" msgstr "" +#: ../../library/asyncio-llapi-index.rst:8 msgid "This page lists all low-level asyncio APIs." msgstr "" +#: ../../library/asyncio-llapi-index.rst:12 msgid "Obtaining the Event Loop" msgstr "" +#: ../../library/asyncio-llapi-index.rst:18 msgid ":func:`asyncio.get_running_loop`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:19 msgid "The **preferred** function to get the running event loop." msgstr "" +#: ../../library/asyncio-llapi-index.rst:21 msgid ":func:`asyncio.get_event_loop`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:22 msgid "Get an event loop instance (running or current via the current policy)." msgstr "" +#: ../../library/asyncio-llapi-index.rst:24 msgid ":func:`asyncio.set_event_loop`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:25 msgid "Set the event loop as current via the current policy." msgstr "" +#: ../../library/asyncio-llapi-index.rst:27 msgid ":func:`asyncio.new_event_loop`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:28 msgid "Create a new event loop." msgstr "" +#: ../../library/asyncio-llapi-index.rst:32 +#: ../../library/asyncio-llapi-index.rst:269 msgid "Examples" msgstr "" +#: ../../library/asyncio-llapi-index.rst:33 msgid ":ref:`Using asyncio.get_running_loop() `." msgstr "" +#: ../../library/asyncio-llapi-index.rst:37 msgid "Event Loop Methods" msgstr "" -msgid "See also the main documentation section about the :ref:`asyncio-event-loop-methods`." +#: ../../library/asyncio-llapi-index.rst:39 +msgid "" +"See also the main documentation section about the :ref:`asyncio-event-loop-" +"methods`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:42 msgid "Lifecycle" msgstr "" +#: ../../library/asyncio-llapi-index.rst:47 msgid ":meth:`loop.run_until_complete`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:48 msgid "Run a Future/Task/awaitable until complete." msgstr "" +#: ../../library/asyncio-llapi-index.rst:50 msgid ":meth:`loop.run_forever`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:51 msgid "Run the event loop forever." msgstr "" +#: ../../library/asyncio-llapi-index.rst:53 msgid ":meth:`loop.stop`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:54 msgid "Stop the event loop." msgstr "" +#: ../../library/asyncio-llapi-index.rst:56 msgid ":meth:`loop.close`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:57 msgid "Close the event loop." msgstr "" +#: ../../library/asyncio-llapi-index.rst:59 msgid ":meth:`loop.is_running`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:60 msgid "Return ``True`` if the event loop is running." msgstr "" +#: ../../library/asyncio-llapi-index.rst:62 msgid ":meth:`loop.is_closed`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:63 msgid "Return ``True`` if the event loop is closed." msgstr "" +#: ../../library/asyncio-llapi-index.rst:65 msgid "``await`` :meth:`loop.shutdown_asyncgens`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:66 msgid "Close asynchronous generators." msgstr "" +#: ../../library/asyncio-llapi-index.rst:69 msgid "Debugging" msgstr "" +#: ../../library/asyncio-llapi-index.rst:74 msgid ":meth:`loop.set_debug`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:75 msgid "Enable or disable the debug mode." msgstr "" +#: ../../library/asyncio-llapi-index.rst:77 msgid ":meth:`loop.get_debug`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:78 msgid "Get the current debug mode." msgstr "" +#: ../../library/asyncio-llapi-index.rst:81 msgid "Scheduling Callbacks" msgstr "" +#: ../../library/asyncio-llapi-index.rst:86 msgid ":meth:`loop.call_soon`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:87 msgid "Invoke a callback soon." msgstr "" +#: ../../library/asyncio-llapi-index.rst:89 msgid ":meth:`loop.call_soon_threadsafe`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:90 msgid "A thread-safe variant of :meth:`loop.call_soon`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:92 msgid ":meth:`loop.call_later`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:93 msgid "Invoke a callback *after* the given time." msgstr "" +#: ../../library/asyncio-llapi-index.rst:95 msgid ":meth:`loop.call_at`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:96 msgid "Invoke a callback *at* the given time." msgstr "" +#: ../../library/asyncio-llapi-index.rst:99 msgid "Thread/Interpreter/Process Pool" msgstr "" +#: ../../library/asyncio-llapi-index.rst:104 msgid "``await`` :meth:`loop.run_in_executor`" msgstr "" -msgid "Run a CPU-bound or other blocking function in a :mod:`concurrent.futures` executor." +#: ../../library/asyncio-llapi-index.rst:105 +msgid "" +"Run a CPU-bound or other blocking function in a :mod:`concurrent.futures` " +"executor." msgstr "" +#: ../../library/asyncio-llapi-index.rst:108 msgid ":meth:`loop.set_default_executor`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:109 msgid "Set the default executor for :meth:`loop.run_in_executor`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:112 msgid "Tasks and Futures" msgstr "" +#: ../../library/asyncio-llapi-index.rst:117 msgid ":meth:`loop.create_future`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:118 msgid "Create a :class:`Future` object." msgstr "" +#: ../../library/asyncio-llapi-index.rst:120 msgid ":meth:`loop.create_task`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:121 msgid "Schedule coroutine as a :class:`Task`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:123 msgid ":meth:`loop.set_task_factory`" msgstr "" -msgid "Set a factory used by :meth:`loop.create_task` to create :class:`Tasks `." +#: ../../library/asyncio-llapi-index.rst:124 +msgid "" +"Set a factory used by :meth:`loop.create_task` to create :class:`Tasks " +"`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:127 msgid ":meth:`loop.get_task_factory`" msgstr "" -msgid "Get the factory :meth:`loop.create_task` uses to create :class:`Tasks `." +#: ../../library/asyncio-llapi-index.rst:128 +msgid "" +"Get the factory :meth:`loop.create_task` uses to create :class:`Tasks " +"`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:132 msgid "DNS" msgstr "" +#: ../../library/asyncio-llapi-index.rst:137 msgid "``await`` :meth:`loop.getaddrinfo`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:138 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:140 msgid "``await`` :meth:`loop.getnameinfo`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:141 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:144 msgid "Networking and IPC" msgstr "" +#: ../../library/asyncio-llapi-index.rst:149 msgid "``await`` :meth:`loop.create_connection`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:150 msgid "Open a TCP connection." msgstr "" +#: ../../library/asyncio-llapi-index.rst:152 msgid "``await`` :meth:`loop.create_server`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:153 msgid "Create a TCP server." msgstr "" +#: ../../library/asyncio-llapi-index.rst:155 msgid "``await`` :meth:`loop.create_unix_connection`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:156 msgid "Open a Unix socket connection." msgstr "" +#: ../../library/asyncio-llapi-index.rst:158 msgid "``await`` :meth:`loop.create_unix_server`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:159 msgid "Create a Unix socket server." msgstr "" +#: ../../library/asyncio-llapi-index.rst:161 msgid "``await`` :meth:`loop.connect_accepted_socket`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:162 msgid "Wrap a :class:`~socket.socket` into a ``(transport, protocol)`` pair." msgstr "" +#: ../../library/asyncio-llapi-index.rst:165 msgid "``await`` :meth:`loop.create_datagram_endpoint`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:166 msgid "Open a datagram (UDP) connection." msgstr "" +#: ../../library/asyncio-llapi-index.rst:168 msgid "``await`` :meth:`loop.sendfile`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:169 msgid "Send a file over a transport." msgstr "" +#: ../../library/asyncio-llapi-index.rst:171 msgid "``await`` :meth:`loop.start_tls`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:172 msgid "Upgrade an existing connection to TLS." msgstr "" +#: ../../library/asyncio-llapi-index.rst:174 msgid "``await`` :meth:`loop.connect_read_pipe`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:175 msgid "Wrap a read end of a pipe into a ``(transport, protocol)`` pair." msgstr "" +#: ../../library/asyncio-llapi-index.rst:177 msgid "``await`` :meth:`loop.connect_write_pipe`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:178 msgid "Wrap a write end of a pipe into a ``(transport, protocol)`` pair." msgstr "" +#: ../../library/asyncio-llapi-index.rst:181 msgid "Sockets" msgstr "" +#: ../../library/asyncio-llapi-index.rst:186 msgid "``await`` :meth:`loop.sock_recv`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:187 msgid "Receive data from the :class:`~socket.socket`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:189 msgid "``await`` :meth:`loop.sock_recv_into`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:190 msgid "Receive data from the :class:`~socket.socket` into a buffer." msgstr "" +#: ../../library/asyncio-llapi-index.rst:192 msgid "``await`` :meth:`loop.sock_recvfrom`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:193 msgid "Receive a datagram from the :class:`~socket.socket`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:195 msgid "``await`` :meth:`loop.sock_recvfrom_into`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:196 msgid "Receive a datagram from the :class:`~socket.socket` into a buffer." msgstr "" +#: ../../library/asyncio-llapi-index.rst:198 msgid "``await`` :meth:`loop.sock_sendall`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:199 msgid "Send data to the :class:`~socket.socket`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:201 msgid "``await`` :meth:`loop.sock_sendto`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:202 msgid "Send a datagram via the :class:`~socket.socket` to the given address." msgstr "" +#: ../../library/asyncio-llapi-index.rst:204 msgid "``await`` :meth:`loop.sock_connect`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:205 msgid "Connect the :class:`~socket.socket`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:207 msgid "``await`` :meth:`loop.sock_accept`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:208 msgid "Accept a :class:`~socket.socket` connection." msgstr "" +#: ../../library/asyncio-llapi-index.rst:210 msgid "``await`` :meth:`loop.sock_sendfile`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:211 msgid "Send a file over the :class:`~socket.socket`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:213 msgid ":meth:`loop.add_reader`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:214 msgid "Start watching a file descriptor for read availability." msgstr "" +#: ../../library/asyncio-llapi-index.rst:216 msgid ":meth:`loop.remove_reader`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:217 msgid "Stop watching a file descriptor for read availability." msgstr "" +#: ../../library/asyncio-llapi-index.rst:219 msgid ":meth:`loop.add_writer`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:220 msgid "Start watching a file descriptor for write availability." msgstr "" +#: ../../library/asyncio-llapi-index.rst:222 msgid ":meth:`loop.remove_writer`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:223 msgid "Stop watching a file descriptor for write availability." msgstr "" +#: ../../library/asyncio-llapi-index.rst:226 msgid "Unix Signals" msgstr "" +#: ../../library/asyncio-llapi-index.rst:231 msgid ":meth:`loop.add_signal_handler`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:232 msgid "Add a handler for a :mod:`signal`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:234 msgid ":meth:`loop.remove_signal_handler`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:235 msgid "Remove a handler for a :mod:`signal`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:238 msgid "Subprocesses" msgstr "" +#: ../../library/asyncio-llapi-index.rst:243 msgid ":meth:`loop.subprocess_exec`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:244 msgid "Spawn a subprocess." msgstr "" +#: ../../library/asyncio-llapi-index.rst:246 msgid ":meth:`loop.subprocess_shell`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:247 msgid "Spawn a subprocess from a shell command." msgstr "" +#: ../../library/asyncio-llapi-index.rst:250 msgid "Error Handling" msgstr "" +#: ../../library/asyncio-llapi-index.rst:255 msgid ":meth:`loop.call_exception_handler`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:256 msgid "Call the exception handler." msgstr "" +#: ../../library/asyncio-llapi-index.rst:258 msgid ":meth:`loop.set_exception_handler`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:259 msgid "Set a new exception handler." msgstr "" +#: ../../library/asyncio-llapi-index.rst:261 msgid ":meth:`loop.get_exception_handler`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:262 msgid "Get the current exception handler." msgstr "" +#: ../../library/asyncio-llapi-index.rst:264 msgid ":meth:`loop.default_exception_handler`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:265 msgid "The default exception handler implementation." msgstr "" -msgid ":ref:`Using asyncio.new_event_loop() and loop.run_forever() `." +#: ../../library/asyncio-llapi-index.rst:270 +msgid "" +":ref:`Using asyncio.new_event_loop() and loop.run_forever() " +"`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:273 msgid ":ref:`Using loop.call_later() `." msgstr "" -msgid "Using ``loop.create_connection()`` to implement :ref:`an echo-client `." +#: ../../library/asyncio-llapi-index.rst:275 +msgid "" +"Using ``loop.create_connection()`` to implement :ref:`an echo-client " +"`." msgstr "" -msgid "Using ``loop.create_connection()`` to :ref:`connect a socket `." +#: ../../library/asyncio-llapi-index.rst:278 +msgid "" +"Using ``loop.create_connection()`` to :ref:`connect a socket " +"`." msgstr "" -msgid ":ref:`Using add_reader() to watch an FD for read events `." +#: ../../library/asyncio-llapi-index.rst:281 +msgid "" +":ref:`Using add_reader() to watch an FD for read events " +"`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:284 msgid ":ref:`Using loop.add_signal_handler() `." msgstr "" +#: ../../library/asyncio-llapi-index.rst:286 msgid ":ref:`Using loop.subprocess_exec() `." msgstr "" +#: ../../library/asyncio-llapi-index.rst:290 msgid "Transports" msgstr "" +#: ../../library/asyncio-llapi-index.rst:292 msgid "All transports implement the following methods:" msgstr "" +#: ../../library/asyncio-llapi-index.rst:298 msgid ":meth:`transport.close() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:299 msgid "Close the transport." msgstr "" +#: ../../library/asyncio-llapi-index.rst:301 msgid ":meth:`transport.is_closing() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:302 msgid "Return ``True`` if the transport is closing or is closed." msgstr "" +#: ../../library/asyncio-llapi-index.rst:304 msgid ":meth:`transport.get_extra_info() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:305 msgid "Request for information about the transport." msgstr "" +#: ../../library/asyncio-llapi-index.rst:307 msgid ":meth:`transport.set_protocol() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:308 msgid "Set a new protocol." msgstr "" +#: ../../library/asyncio-llapi-index.rst:310 msgid ":meth:`transport.get_protocol() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:311 msgid "Return the current protocol." msgstr "" -msgid "Transports that can receive data (TCP and Unix connections, pipes, etc). Returned from methods like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_read_pipe`, etc:" +#: ../../library/asyncio-llapi-index.rst:314 +msgid "" +"Transports that can receive data (TCP and Unix connections, pipes, etc). " +"Returned from methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_read_pipe`, " +"etc:" msgstr "" +#: ../../library/asyncio-llapi-index.rst:319 msgid "Read Transports" msgstr "" +#: ../../library/asyncio-llapi-index.rst:324 msgid ":meth:`transport.is_reading() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:325 msgid "Return ``True`` if the transport is receiving." msgstr "" +#: ../../library/asyncio-llapi-index.rst:327 msgid ":meth:`transport.pause_reading() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:328 msgid "Pause receiving." msgstr "" +#: ../../library/asyncio-llapi-index.rst:330 msgid ":meth:`transport.resume_reading() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:331 msgid "Resume receiving." msgstr "" -msgid "Transports that can Send data (TCP and Unix connections, pipes, etc). Returned from methods like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_write_pipe`, etc:" +#: ../../library/asyncio-llapi-index.rst:334 +msgid "" +"Transports that can Send data (TCP and Unix connections, pipes, etc). " +"Returned from methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_write_pipe`, " +"etc:" msgstr "" +#: ../../library/asyncio-llapi-index.rst:339 msgid "Write Transports" msgstr "" +#: ../../library/asyncio-llapi-index.rst:344 msgid ":meth:`transport.write() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:345 msgid "Write data to the transport." msgstr "" +#: ../../library/asyncio-llapi-index.rst:347 msgid ":meth:`transport.writelines() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:348 msgid "Write buffers to the transport." msgstr "" +#: ../../library/asyncio-llapi-index.rst:350 msgid ":meth:`transport.can_write_eof() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:351 msgid "Return :const:`True` if the transport supports sending EOF." msgstr "" +#: ../../library/asyncio-llapi-index.rst:353 msgid ":meth:`transport.write_eof() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:354 msgid "Close and send EOF after flushing buffered data." msgstr "" +#: ../../library/asyncio-llapi-index.rst:356 msgid ":meth:`transport.abort() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:357 +#: ../../library/asyncio-llapi-index.rst:383 msgid "Close the transport immediately." msgstr "" -msgid ":meth:`transport.get_write_buffer_size() `" +#: ../../library/asyncio-llapi-index.rst:359 +msgid "" +":meth:`transport.get_write_buffer_size() " +"`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:361 msgid "Return the current size of the output buffer." msgstr "" -msgid ":meth:`transport.get_write_buffer_limits() `" +#: ../../library/asyncio-llapi-index.rst:363 +msgid "" +":meth:`transport.get_write_buffer_limits() " +"`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:365 msgid "Return high and low water marks for write flow control." msgstr "" -msgid ":meth:`transport.set_write_buffer_limits() `" +#: ../../library/asyncio-llapi-index.rst:367 +msgid "" +":meth:`transport.set_write_buffer_limits() " +"`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:369 msgid "Set new high and low water marks for write flow control." msgstr "" +#: ../../library/asyncio-llapi-index.rst:372 msgid "Transports returned by :meth:`loop.create_datagram_endpoint`:" msgstr "" +#: ../../library/asyncio-llapi-index.rst:374 msgid "Datagram Transports" msgstr "" +#: ../../library/asyncio-llapi-index.rst:379 msgid ":meth:`transport.sendto() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:380 msgid "Send data to the remote peer." msgstr "" +#: ../../library/asyncio-llapi-index.rst:382 msgid ":meth:`transport.abort() `" msgstr "" -msgid "Low-level transport abstraction over subprocesses. Returned by :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell`:" +#: ../../library/asyncio-llapi-index.rst:386 +msgid "" +"Low-level transport abstraction over subprocesses. Returned " +"by :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell`:" msgstr "" +#: ../../library/asyncio-llapi-index.rst:390 msgid "Subprocess Transports" msgstr "" +#: ../../library/asyncio-llapi-index.rst:395 msgid ":meth:`transport.get_pid() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:396 msgid "Return the subprocess process id." msgstr "" -msgid ":meth:`transport.get_pipe_transport() `" +#: ../../library/asyncio-llapi-index.rst:398 +msgid "" +":meth:`transport.get_pipe_transport() " +"`" msgstr "" -msgid "Return the transport for the requested communication pipe (*stdin*, *stdout*, or *stderr*)." +#: ../../library/asyncio-llapi-index.rst:400 +msgid "" +"Return the transport for the requested communication pipe (*stdin*, " +"*stdout*, or *stderr*)." msgstr "" +#: ../../library/asyncio-llapi-index.rst:403 msgid ":meth:`transport.get_returncode() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:404 msgid "Return the subprocess return code." msgstr "" +#: ../../library/asyncio-llapi-index.rst:406 msgid ":meth:`transport.kill() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:407 msgid "Kill the subprocess." msgstr "" +#: ../../library/asyncio-llapi-index.rst:409 msgid ":meth:`transport.send_signal() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:410 msgid "Send a signal to the subprocess." msgstr "" +#: ../../library/asyncio-llapi-index.rst:412 msgid ":meth:`transport.terminate() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:413 msgid "Stop the subprocess." msgstr "" +#: ../../library/asyncio-llapi-index.rst:415 msgid ":meth:`transport.close() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:416 msgid "Kill the subprocess and close all pipes." msgstr "" +#: ../../library/asyncio-llapi-index.rst:420 msgid "Protocols" msgstr "" +#: ../../library/asyncio-llapi-index.rst:422 msgid "Protocol classes can implement the following **callback methods**:" msgstr "" +#: ../../library/asyncio-llapi-index.rst:428 msgid "``callback`` :meth:`connection_made() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:429 msgid "Called when a connection is made." msgstr "" +#: ../../library/asyncio-llapi-index.rst:431 msgid "``callback`` :meth:`connection_lost() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:432 msgid "Called when the connection is lost or closed." msgstr "" +#: ../../library/asyncio-llapi-index.rst:434 msgid "``callback`` :meth:`pause_writing() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:435 msgid "Called when the transport's buffer goes over the high water mark." msgstr "" +#: ../../library/asyncio-llapi-index.rst:437 msgid "``callback`` :meth:`resume_writing() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:438 msgid "Called when the transport's buffer drains below the low water mark." msgstr "" +#: ../../library/asyncio-llapi-index.rst:441 msgid "Streaming Protocols (TCP, Unix Sockets, Pipes)" msgstr "" +#: ../../library/asyncio-llapi-index.rst:446 msgid "``callback`` :meth:`data_received() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:447 msgid "Called when some data is received." msgstr "" +#: ../../library/asyncio-llapi-index.rst:449 msgid "``callback`` :meth:`eof_received() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:450 +#: ../../library/asyncio-llapi-index.rst:465 msgid "Called when an EOF is received." msgstr "" +#: ../../library/asyncio-llapi-index.rst:453 msgid "Buffered Streaming Protocols" msgstr "" +#: ../../library/asyncio-llapi-index.rst:458 msgid "``callback`` :meth:`get_buffer() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:459 msgid "Called to allocate a new receive buffer." msgstr "" +#: ../../library/asyncio-llapi-index.rst:461 msgid "``callback`` :meth:`buffer_updated() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:462 msgid "Called when the buffer was updated with the received data." msgstr "" +#: ../../library/asyncio-llapi-index.rst:464 msgid "``callback`` :meth:`eof_received() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:468 msgid "Datagram Protocols" msgstr "" -msgid "``callback`` :meth:`datagram_received() `" +#: ../../library/asyncio-llapi-index.rst:473 +msgid "" +"``callback`` :meth:`datagram_received() `" msgstr "" +#: ../../library/asyncio-llapi-index.rst:475 msgid "Called when a datagram is received." msgstr "" +#: ../../library/asyncio-llapi-index.rst:477 msgid "``callback`` :meth:`error_received() `" msgstr "" -msgid "Called when a previous send or receive operation raises an :class:`OSError`." +#: ../../library/asyncio-llapi-index.rst:478 +msgid "" +"Called when a previous send or receive operation raises an :class:`OSError`." msgstr "" +#: ../../library/asyncio-llapi-index.rst:482 msgid "Subprocess Protocols" msgstr "" +#: ../../library/asyncio-llapi-index.rst:487 msgid "``callback`` :meth:`~SubprocessProtocol.pipe_data_received`" msgstr "" -msgid "Called when the child process writes data into its *stdout* or *stderr* pipe." +#: ../../library/asyncio-llapi-index.rst:488 +msgid "" +"Called when the child process writes data into its *stdout* or *stderr* pipe." msgstr "" +#: ../../library/asyncio-llapi-index.rst:491 msgid "``callback`` :meth:`~SubprocessProtocol.pipe_connection_lost`" msgstr "" -msgid "Called when one of the pipes communicating with the child process is closed." +#: ../../library/asyncio-llapi-index.rst:492 +msgid "" +"Called when one of the pipes communicating with the child process is closed." msgstr "" -msgid "``callback`` :meth:`process_exited() `" +#: ../../library/asyncio-llapi-index.rst:495 +msgid "" +"``callback`` :meth:`process_exited() `" msgstr "" -msgid "Called when the child process has exited. It can be called before :meth:`~SubprocessProtocol.pipe_data_received` and :meth:`~SubprocessProtocol.pipe_connection_lost` methods." +#: ../../library/asyncio-llapi-index.rst:497 +msgid "" +"Called when the child process has exited. It can be called " +"before :meth:`~SubprocessProtocol.pipe_data_received` " +"and :meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" +#: ../../library/asyncio-llapi-index.rst:503 msgid "Event Loop Policies" msgstr "" -msgid "Policies is a low-level mechanism to alter the behavior of functions like :func:`asyncio.get_event_loop`. See also the main :ref:`policies section ` for more details." +#: ../../library/asyncio-llapi-index.rst:505 +msgid "" +"Policies is a low-level mechanism to alter the behavior of functions " +"like :func:`asyncio.get_event_loop`. See also the main :ref:`policies " +"section ` for more details." msgstr "" +#: ../../library/asyncio-llapi-index.rst:511 msgid "Accessing Policies" msgstr "" +#: ../../library/asyncio-llapi-index.rst:516 msgid ":meth:`asyncio.get_event_loop_policy`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:517 msgid "Return the current process-wide policy." msgstr "" +#: ../../library/asyncio-llapi-index.rst:519 msgid ":meth:`asyncio.set_event_loop_policy`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:520 msgid "Set a new process-wide policy." msgstr "" +#: ../../library/asyncio-llapi-index.rst:522 msgid ":class:`AbstractEventLoopPolicy`" msgstr "" +#: ../../library/asyncio-llapi-index.rst:523 msgid "Base class for policy objects." msgstr "" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index 63ce1e0ee..22a1948ca 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,78 +23,151 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-platforms.rst:9 msgid "Platform Support" msgstr "" -msgid "The :mod:`asyncio` module is designed to be portable, but some platforms have subtle differences and limitations due to the platforms' underlying architecture and capabilities." +#: ../../library/asyncio-platforms.rst:11 +msgid "" +"The :mod:`asyncio` module is designed to be portable, but some platforms " +"have subtle differences and limitations due to the platforms' underlying " +"architecture and capabilities." msgstr "" +#: ../../library/asyncio-platforms.rst:17 msgid "All Platforms" msgstr "" -msgid ":meth:`loop.add_reader` and :meth:`loop.add_writer` cannot be used to monitor file I/O." +#: ../../library/asyncio-platforms.rst:19 +msgid "" +":meth:`loop.add_reader` and :meth:`loop.add_writer` cannot be used to " +"monitor file I/O." +msgstr "" + +#: ../../library/asyncio-platforms.rst:22 +msgid "" +":meth:`loop.connect_read_pipe` and :meth:`loop.connect_write_pipe` cannot be " +"used with regular files. See :ref:`Supported pipe objects ` for the objects that are accepted on each platform." msgstr "" +#: ../../library/asyncio-platforms.rst:29 msgid "Windows" msgstr "" -msgid "**Source code:** :source:`Lib/asyncio/proactor_events.py`, :source:`Lib/asyncio/windows_events.py`, :source:`Lib/asyncio/windows_utils.py`" +#: ../../library/asyncio-platforms.rst:31 +msgid "" +"**Source code:** :source:`Lib/asyncio/proactor_events.py`, :source:`Lib/" +"asyncio/windows_events.py`, :source:`Lib/asyncio/windows_utils.py`" msgstr "" +#: ../../library/asyncio-platforms.rst:39 msgid "On Windows, :class:`ProactorEventLoop` is now the default event loop." msgstr "" +#: ../../library/asyncio-platforms.rst:41 msgid "All event loops on Windows do not support the following methods:" msgstr "" -msgid ":meth:`loop.create_unix_connection` and :meth:`loop.create_unix_server` are not supported. The :const:`socket.AF_UNIX` socket family is specific to Unix." +#: ../../library/asyncio-platforms.rst:43 +msgid "" +":meth:`loop.create_unix_connection` and :meth:`loop.create_unix_server` are " +"not supported. The :const:`socket.AF_UNIX` socket family is specific to Unix." msgstr "" -msgid ":meth:`loop.add_signal_handler` and :meth:`loop.remove_signal_handler` are not supported." +#: ../../library/asyncio-platforms.rst:47 +msgid "" +":meth:`loop.add_signal_handler` and :meth:`loop.remove_signal_handler` are " +"not supported." msgstr "" +#: ../../library/asyncio-platforms.rst:50 msgid ":class:`SelectorEventLoop` has the following limitations:" msgstr "" -msgid ":class:`~selectors.SelectSelector` is used to wait on socket events: it supports sockets and is limited to 512 sockets." +#: ../../library/asyncio-platforms.rst:52 +msgid "" +":class:`~selectors.SelectSelector` is used to wait on socket events: it " +"supports sockets and is limited to 512 sockets." msgstr "" -msgid ":meth:`loop.add_reader` and :meth:`loop.add_writer` only accept socket handles (e.g. pipe file descriptors are not supported)." +#: ../../library/asyncio-platforms.rst:55 +msgid "" +":meth:`loop.add_reader` and :meth:`loop.add_writer` only accept socket " +"handles (e.g. pipe file descriptors are not supported)." msgstr "" -msgid "Pipes are not supported, so the :meth:`loop.connect_read_pipe` and :meth:`loop.connect_write_pipe` methods are not implemented." +#: ../../library/asyncio-platforms.rst:58 +msgid "" +"Pipes are not supported, so the :meth:`loop.connect_read_pipe` " +"and :meth:`loop.connect_write_pipe` methods are not implemented." msgstr "" -msgid ":ref:`Subprocesses ` are not supported, i.e. :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods are not implemented." +#: ../../library/asyncio-platforms.rst:61 +msgid "" +":ref:`Subprocesses ` are not supported, " +"i.e. :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods " +"are not implemented." msgstr "" +#: ../../library/asyncio-platforms.rst:65 msgid ":class:`ProactorEventLoop` has the following limitations:" msgstr "" -msgid "The :meth:`loop.add_reader` and :meth:`loop.add_writer` methods are not supported." +#: ../../library/asyncio-platforms.rst:67 +msgid "" +"The :meth:`loop.add_reader` and :meth:`loop.add_writer` methods are not " +"supported." msgstr "" -msgid "The resolution of the monotonic clock on Windows is usually around 15.6 milliseconds. The best resolution is 0.5 milliseconds. The resolution depends on the hardware (availability of `HPET `_) and on the Windows configuration." +#: ../../library/asyncio-platforms.rst:70 +msgid "" +":meth:`loop.connect_read_pipe` and :meth:`loop.connect_write_pipe` only " +"accept a handle opened for overlapped I/O. See :ref:`Supported pipe objects " +"` for which objects are supported." msgstr "" +#: ../../library/asyncio-platforms.rst:74 +msgid "" +"The resolution of the monotonic clock on Windows is usually around 15.6 " +"milliseconds. The best resolution is 0.5 milliseconds. The resolution " +"depends on the hardware (availability of `HPET `_) and on the Windows configuration." +msgstr "" + +#: ../../library/asyncio-platforms.rst:84 msgid "Subprocess Support on Windows" msgstr "" -msgid "On Windows, the default event loop :class:`ProactorEventLoop` supports subprocesses, whereas :class:`SelectorEventLoop` does not." +#: ../../library/asyncio-platforms.rst:86 +msgid "" +"On Windows, the default event loop :class:`ProactorEventLoop` supports " +"subprocesses, whereas :class:`SelectorEventLoop` does not." msgstr "" +#: ../../library/asyncio-platforms.rst:91 msgid "macOS" msgstr "" +#: ../../library/asyncio-platforms.rst:93 msgid "Modern macOS versions are fully supported." msgstr "" +#: ../../library/asyncio-platforms.rst:96 msgid "macOS <= 10.8" msgstr "" -msgid "On macOS 10.6, 10.7 and 10.8, the default event loop uses :class:`selectors.KqueueSelector`, which does not support character devices on these versions. The :class:`SelectorEventLoop` can be manually configured to use :class:`~selectors.SelectSelector` or :class:`~selectors.PollSelector` to support character devices on these older versions of macOS. Example::" +#: ../../library/asyncio-platforms.rst:97 +msgid "" +"On macOS 10.6, 10.7 and 10.8, the default event loop " +"uses :class:`selectors.KqueueSelector`, which does not support character " +"devices on these versions. The :class:`SelectorEventLoop` can be manually " +"configured to use :class:`~selectors.SelectSelector` " +"or :class:`~selectors.PollSelector` to support character devices on these " +"older versions of macOS. Example::" msgstr "" +#: ../../library/asyncio-platforms.rst:104 msgid "" "import asyncio\n" "import selectors\n" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 460b923ec..ac7a3abdf 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,111 +23,194 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-policy.rst:8 msgid "Policies" msgstr "" -msgid "Policies are deprecated and will be removed in Python 3.16. Users are encouraged to use the :func:`asyncio.run` function or the :class:`asyncio.Runner` with *loop_factory* to use the desired loop implementation." +#: ../../library/asyncio-policy.rst:12 +msgid "" +"Policies are deprecated and will be removed in Python 3.16. Users are " +"encouraged to use the :func:`asyncio.run` function or " +"the :class:`asyncio.Runner` with *loop_factory* to use the desired loop " +"implementation." msgstr "" -msgid "An event loop policy is a global object used to get and set the current :ref:`event loop `, as well as create new event loops. The default policy can be :ref:`replaced ` with :ref:`built-in alternatives ` to use different event loop implementations, or substituted by a :ref:`custom policy ` that can override these behaviors." +#: ../../library/asyncio-policy.rst:18 +msgid "" +"An event loop policy is a global object used to get and set the " +"current :ref:`event loop `, as well as create new event " +"loops. The default policy can be :ref:`replaced ` " +"with :ref:`built-in alternatives ` to use different " +"event loop implementations, or substituted by a :ref:`custom policy ` that can override these behaviors." msgstr "" -msgid "The :ref:`policy object ` gets and sets a separate event loop per *context*. This is per-thread by default, though custom policies could define *context* differently." +#: ../../library/asyncio-policy.rst:27 +msgid "" +"The :ref:`policy object ` gets and sets a separate " +"event loop per *context*. This is per-thread by default, though custom " +"policies could define *context* differently." msgstr "" -msgid "Custom event loop policies can control the behavior of :func:`get_event_loop`, :func:`set_event_loop`, and :func:`new_event_loop`." +#: ../../library/asyncio-policy.rst:32 +msgid "" +"Custom event loop policies can control the behavior " +"of :func:`get_event_loop`, :func:`set_event_loop`, " +"and :func:`new_event_loop`." msgstr "" -msgid "Policy objects should implement the APIs defined in the :class:`AbstractEventLoopPolicy` abstract base class." +#: ../../library/asyncio-policy.rst:35 +msgid "" +"Policy objects should implement the APIs defined in " +"the :class:`AbstractEventLoopPolicy` abstract base class." msgstr "" +#: ../../library/asyncio-policy.rst:42 msgid "Getting and Setting the Policy" msgstr "" -msgid "The following functions can be used to get and set the policy for the current process:" +#: ../../library/asyncio-policy.rst:44 +msgid "" +"The following functions can be used to get and set the policy for the " +"current process:" msgstr "" +#: ../../library/asyncio-policy.rst:49 msgid "Return the current process-wide policy." msgstr "" -msgid "The :func:`get_event_loop_policy` function is deprecated and will be removed in Python 3.16." +#: ../../library/asyncio-policy.rst:51 +msgid "" +"The :func:`get_event_loop_policy` function is deprecated and will be removed " +"in Python 3.16." msgstr "" +#: ../../library/asyncio-policy.rst:57 msgid "Set the current process-wide policy to *policy*." msgstr "" +#: ../../library/asyncio-policy.rst:59 msgid "If *policy* is set to ``None``, the default policy is restored." msgstr "" -msgid "The :func:`set_event_loop_policy` function is deprecated and will be removed in Python 3.16." +#: ../../library/asyncio-policy.rst:61 +msgid "" +"The :func:`set_event_loop_policy` function is deprecated and will be removed " +"in Python 3.16." msgstr "" +#: ../../library/asyncio-policy.rst:69 msgid "Policy Objects" msgstr "" +#: ../../library/asyncio-policy.rst:71 msgid "The abstract event loop policy base class is defined as follows:" msgstr "" +#: ../../library/asyncio-policy.rst:75 msgid "An abstract base class for asyncio policies." msgstr "" +#: ../../library/asyncio-policy.rst:79 msgid "Get the event loop for the current context." msgstr "" -msgid "Return an event loop object implementing the :class:`AbstractEventLoop` interface." +#: ../../library/asyncio-policy.rst:81 +msgid "" +"Return an event loop object implementing the :class:`AbstractEventLoop` " +"interface." msgstr "" +#: ../../library/asyncio-policy.rst:84 ../../library/asyncio-policy.rst:96 msgid "This method should never return ``None``." msgstr "" +#: ../../library/asyncio-policy.rst:90 msgid "Set the event loop for the current context to *loop*." msgstr "" +#: ../../library/asyncio-policy.rst:94 msgid "Create and return a new event loop object." msgstr "" -msgid "The :class:`AbstractEventLoopPolicy` class is deprecated and will be removed in Python 3.16." +#: ../../library/asyncio-policy.rst:98 +msgid "" +"The :class:`AbstractEventLoopPolicy` class is deprecated and will be removed " +"in Python 3.16." msgstr "" +#: ../../library/asyncio-policy.rst:105 msgid "asyncio ships with the following built-in policies:" msgstr "" -msgid "The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix and :class:`ProactorEventLoop` on Windows." +#: ../../library/asyncio-policy.rst:110 +msgid "" +"The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix " +"and :class:`ProactorEventLoop` on Windows." msgstr "" -msgid "There is no need to install the default policy manually. asyncio is configured to use the default policy automatically." +#: ../../library/asyncio-policy.rst:113 +msgid "" +"There is no need to install the default policy manually. asyncio is " +"configured to use the default policy automatically." msgstr "" +#: ../../library/asyncio-policy.rst:118 msgid "On Windows, :class:`ProactorEventLoop` is now used by default." msgstr "" -msgid "The :meth:`get_event_loop` method of the default asyncio policy now raises a :exc:`RuntimeError` if there is no set event loop." +#: ../../library/asyncio-policy.rst:120 +msgid "" +"The :meth:`get_event_loop` method of the default asyncio policy now raises " +"a :exc:`RuntimeError` if there is no set event loop." msgstr "" -msgid "The :class:`DefaultEventLoopPolicy` class is deprecated and will be removed in Python 3.16." +#: ../../library/asyncio-policy.rst:124 +msgid "" +"The :class:`DefaultEventLoopPolicy` class is deprecated and will be removed " +"in Python 3.16." msgstr "" -msgid "An alternative event loop policy that uses the :class:`SelectorEventLoop` event loop implementation." +#: ../../library/asyncio-policy.rst:131 +msgid "" +"An alternative event loop policy that uses the :class:`SelectorEventLoop` " +"event loop implementation." msgstr "" +#: ../../library/asyncio-policy.rst:134 ../../library/asyncio-policy.rst:146 msgid "Availability" msgstr "" -msgid "The :class:`WindowsSelectorEventLoopPolicy` class is deprecated and will be removed in Python 3.16." +#: ../../library/asyncio-policy.rst:136 +msgid "" +"The :class:`WindowsSelectorEventLoopPolicy` class is deprecated and will be " +"removed in Python 3.16." msgstr "" -msgid "An alternative event loop policy that uses the :class:`ProactorEventLoop` event loop implementation." +#: ../../library/asyncio-policy.rst:143 +msgid "" +"An alternative event loop policy that uses the :class:`ProactorEventLoop` " +"event loop implementation." msgstr "" -msgid "The :class:`WindowsProactorEventLoopPolicy` class is deprecated and will be removed in Python 3.16." +#: ../../library/asyncio-policy.rst:148 +msgid "" +"The :class:`WindowsProactorEventLoopPolicy` class is deprecated and will be " +"removed in Python 3.16." msgstr "" +#: ../../library/asyncio-policy.rst:156 msgid "Custom Policies" msgstr "" -msgid "To implement a new event loop policy, it is recommended to subclass :class:`DefaultEventLoopPolicy` and override the methods for which custom behavior is wanted, e.g.::" +#: ../../library/asyncio-policy.rst:158 +msgid "" +"To implement a new event loop policy, it is recommended to " +"subclass :class:`DefaultEventLoopPolicy` and override the methods for which " +"custom behavior is wanted, e.g.::" msgstr "" +#: ../../library/asyncio-policy.rst:162 msgid "" "class MyEventLoopPolicy(asyncio.DefaultEventLoopPolicy):\n" "\n" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 5c016a68b..1db9d4cac 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,429 +24,787 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-protocol.rst:9 msgid "Transports and Protocols" msgstr "" +#: ../../library/asyncio-protocol.rst:12 msgid "Preface" msgstr "" -msgid "Transports and Protocols are used by the **low-level** event loop APIs such as :meth:`loop.create_connection`. They use callback-based programming style and enable high-performance implementations of network or IPC protocols (e.g. HTTP)." +#: ../../library/asyncio-protocol.rst:13 +msgid "" +"Transports and Protocols are used by the **low-level** event loop APIs such " +"as :meth:`loop.create_connection`. They use callback-based programming " +"style and enable high-performance implementations of network or IPC " +"protocols (e.g. HTTP)." msgstr "" -msgid "Essentially, transports and protocols should only be used in libraries and frameworks and never in high-level asyncio applications." +#: ../../library/asyncio-protocol.rst:18 +msgid "" +"Essentially, transports and protocols should only be used in libraries and " +"frameworks and never in high-level asyncio applications." msgstr "" +#: ../../library/asyncio-protocol.rst:22 msgid "This documentation page covers both `Transports`_ and `Protocols`_." msgstr "" +#: ../../library/asyncio-protocol.rst:25 msgid "Introduction" msgstr "" -msgid "At the highest level, the transport is concerned with *how* bytes are transmitted, while the protocol determines *which* bytes to transmit (and to some extent when)." +#: ../../library/asyncio-protocol.rst:26 +msgid "" +"At the highest level, the transport is concerned with *how* bytes are " +"transmitted, while the protocol determines *which* bytes to transmit (and to " +"some extent when)." msgstr "" -msgid "A different way of saying the same thing: a transport is an abstraction for a socket (or similar I/O endpoint) while a protocol is an abstraction for an application, from the transport's point of view." +#: ../../library/asyncio-protocol.rst:30 +msgid "" +"A different way of saying the same thing: a transport is an abstraction for " +"a socket (or similar I/O endpoint) while a protocol is an abstraction for an " +"application, from the transport's point of view." msgstr "" -msgid "Yet another view is the transport and protocol interfaces together define an abstract interface for using network I/O and interprocess I/O." +#: ../../library/asyncio-protocol.rst:35 +msgid "" +"Yet another view is the transport and protocol interfaces together define an " +"abstract interface for using network I/O and interprocess I/O." msgstr "" -msgid "There is always a 1:1 relationship between transport and protocol objects: the protocol calls transport methods to send data, while the transport calls protocol methods to pass it data that has been received." +#: ../../library/asyncio-protocol.rst:39 +msgid "" +"There is always a 1:1 relationship between transport and protocol objects: " +"the protocol calls transport methods to send data, while the transport calls " +"protocol methods to pass it data that has been received." msgstr "" -msgid "Most of connection oriented event loop methods (such as :meth:`loop.create_connection`) usually accept a *protocol_factory* argument used to create a *Protocol* object for an accepted connection, represented by a *Transport* object. Such methods usually return a tuple of ``(transport, protocol)``." +#: ../../library/asyncio-protocol.rst:44 +msgid "" +"Most of connection oriented event loop methods (such " +"as :meth:`loop.create_connection`) usually accept a *protocol_factory* " +"argument used to create a *Protocol* object for an accepted connection, " +"represented by a *Transport* object. Such methods usually return a tuple of " +"``(transport, protocol)``." msgstr "" +#: ../../library/asyncio-protocol.rst:51 msgid "Contents" msgstr "" +#: ../../library/asyncio-protocol.rst:52 msgid "This documentation page contains the following sections:" msgstr "" -msgid "The `Transports`_ section documents asyncio :class:`BaseTransport`, :class:`ReadTransport`, :class:`WriteTransport`, :class:`Transport`, :class:`DatagramTransport`, and :class:`SubprocessTransport` classes." +#: ../../library/asyncio-protocol.rst:54 +msgid "" +"The `Transports`_ section documents " +"asyncio :class:`BaseTransport`, :class:`ReadTransport`, :class:`WriteTransport`, :class:`Transport`, :class:`DatagramTransport`, " +"and :class:`SubprocessTransport` classes." msgstr "" -msgid "The `Protocols`_ section documents asyncio :class:`BaseProtocol`, :class:`Protocol`, :class:`BufferedProtocol`, :class:`DatagramProtocol`, and :class:`SubprocessProtocol` classes." +#: ../../library/asyncio-protocol.rst:59 +msgid "" +"The `Protocols`_ section documents " +"asyncio :class:`BaseProtocol`, :class:`Protocol`, :class:`BufferedProtocol`, :class:`DatagramProtocol`, " +"and :class:`SubprocessProtocol` classes." msgstr "" -msgid "The `Examples`_ section showcases how to work with transports, protocols, and low-level event loop APIs." +#: ../../library/asyncio-protocol.rst:63 +msgid "" +"The `Examples`_ section showcases how to work with transports, protocols, " +"and low-level event loop APIs." msgstr "" +#: ../../library/asyncio-protocol.rst:70 msgid "Transports" msgstr "" +#: ../../library/asyncio-protocol.rst:72 msgid "**Source code:** :source:`Lib/asyncio/transports.py`" msgstr "" -msgid "Transports are classes provided by :mod:`asyncio` in order to abstract various kinds of communication channels." +#: ../../library/asyncio-protocol.rst:76 +msgid "" +"Transports are classes provided by :mod:`asyncio` in order to abstract " +"various kinds of communication channels." msgstr "" -msgid "Transport objects are always instantiated by an :ref:`asyncio event loop `." +#: ../../library/asyncio-protocol.rst:79 +msgid "" +"Transport objects are always instantiated by an :ref:`asyncio event loop " +"`." msgstr "" -msgid "asyncio implements transports for TCP, UDP, SSL, and subprocess pipes. The methods available on a transport depend on the transport's kind." +#: ../../library/asyncio-protocol.rst:82 +msgid "" +"asyncio implements transports for TCP, UDP, SSL, and subprocess pipes. The " +"methods available on a transport depend on the transport's kind." msgstr "" -msgid "The transport classes are :ref:`not thread safe `." +#: ../../library/asyncio-protocol.rst:85 +msgid "" +"The transport classes are :ref:`not thread safe `." msgstr "" +#: ../../library/asyncio-protocol.rst:89 msgid "Transports Hierarchy" msgstr "" -msgid "Base class for all transports. Contains methods that all asyncio transports share." +#: ../../library/asyncio-protocol.rst:93 +msgid "" +"Base class for all transports. Contains methods that all asyncio transports " +"share." msgstr "" +#: ../../library/asyncio-protocol.rst:98 msgid "A base transport for write-only connections." msgstr "" -msgid "Instances of the *WriteTransport* class are returned from the :meth:`loop.connect_write_pipe` event loop method and are also used by subprocess-related methods like :meth:`loop.subprocess_exec`." +#: ../../library/asyncio-protocol.rst:100 +msgid "" +"Instances of the *WriteTransport* class are returned from " +"the :meth:`loop.connect_write_pipe` event loop method and are also used by " +"subprocess-related methods like :meth:`loop.subprocess_exec`." msgstr "" +#: ../../library/asyncio-protocol.rst:107 msgid "A base transport for read-only connections." msgstr "" -msgid "Instances of the *ReadTransport* class are returned from the :meth:`loop.connect_read_pipe` event loop method and are also used by subprocess-related methods like :meth:`loop.subprocess_exec`." +#: ../../library/asyncio-protocol.rst:109 +msgid "" +"Instances of the *ReadTransport* class are returned from " +"the :meth:`loop.connect_read_pipe` event loop method and are also used by " +"subprocess-related methods like :meth:`loop.subprocess_exec`." msgstr "" -msgid "Interface representing a bidirectional transport, such as a TCP connection." +#: ../../library/asyncio-protocol.rst:116 +msgid "" +"Interface representing a bidirectional transport, such as a TCP connection." msgstr "" -msgid "The user does not instantiate a transport directly; they call a utility function, passing it a protocol factory and other information necessary to create the transport and protocol." +#: ../../library/asyncio-protocol.rst:119 +msgid "" +"The user does not instantiate a transport directly; they call a utility " +"function, passing it a protocol factory and other information necessary to " +"create the transport and protocol." msgstr "" -msgid "Instances of the *Transport* class are returned from or used by event loop methods like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.create_server`, :meth:`loop.sendfile`, etc." +#: ../../library/asyncio-protocol.rst:123 +msgid "" +"Instances of the *Transport* class are returned from or used by event loop " +"methods " +"like :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.create_server`, :meth:`loop.sendfile`, " +"etc." msgstr "" +#: ../../library/asyncio-protocol.rst:131 msgid "A transport for datagram (UDP) connections." msgstr "" -msgid "Instances of the *DatagramTransport* class are returned from the :meth:`loop.create_datagram_endpoint` event loop method." +#: ../../library/asyncio-protocol.rst:133 +msgid "" +"Instances of the *DatagramTransport* class are returned from " +"the :meth:`loop.create_datagram_endpoint` event loop method." msgstr "" -msgid "An abstraction to represent a connection between a parent and its child OS process." +#: ../../library/asyncio-protocol.rst:139 +msgid "" +"An abstraction to represent a connection between a parent and its child OS " +"process." msgstr "" -msgid "Instances of the *SubprocessTransport* class are returned from event loop methods :meth:`loop.subprocess_shell` and :meth:`loop.subprocess_exec`." +#: ../../library/asyncio-protocol.rst:142 +msgid "" +"Instances of the *SubprocessTransport* class are returned from event loop " +"methods :meth:`loop.subprocess_shell` and :meth:`loop.subprocess_exec`." msgstr "" +#: ../../library/asyncio-protocol.rst:148 msgid "Base Transport" msgstr "" +#: ../../library/asyncio-protocol.rst:152 msgid "Close the transport." msgstr "" -msgid "If the transport has a buffer for outgoing data, buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol's :meth:`protocol.connection_lost() ` method will be called with :const:`None` as its argument. The transport should not be used once it is closed." +#: ../../library/asyncio-protocol.rst:154 +msgid "" +"If the transport has a buffer for outgoing data, buffered data will be " +"flushed asynchronously. No more data will be received. After all buffered " +"data is flushed, the protocol's :meth:`protocol.connection_lost() " +"` method will be called with :const:`None` as " +"its argument. The transport should not be used once it is closed." msgstr "" +#: ../../library/asyncio-protocol.rst:164 msgid "Return ``True`` if the transport is closing or is closed." msgstr "" +#: ../../library/asyncio-protocol.rst:168 msgid "Return information about the transport or underlying resources it uses." msgstr "" -msgid "*name* is a string representing the piece of transport-specific information to get." +#: ../../library/asyncio-protocol.rst:171 +msgid "" +"*name* is a string representing the piece of transport-specific information " +"to get." msgstr "" -msgid "*default* is the value to return if the information is not available, or if the transport does not support querying it with the given third-party event loop implementation or on the current platform." +#: ../../library/asyncio-protocol.rst:174 +msgid "" +"*default* is the value to return if the information is not available, or if " +"the transport does not support querying it with the given third-party event " +"loop implementation or on the current platform." msgstr "" -msgid "For example, the following code attempts to get the underlying socket object of the transport::" +#: ../../library/asyncio-protocol.rst:179 +msgid "" +"For example, the following code attempts to get the underlying socket object " +"of the transport::" msgstr "" +#: ../../library/asyncio-protocol.rst:182 msgid "" "sock = transport.get_extra_info('socket')\n" "if sock is not None:\n" " print(sock.getsockopt(...))" msgstr "" +#: ../../library/asyncio-protocol.rst:186 msgid "Categories of information that can be queried on some transports:" msgstr "" +#: ../../library/asyncio-protocol.rst:188 msgid "socket:" msgstr "" -msgid "``'peername'``: the remote address to which the socket is connected, result of :meth:`socket.socket.getpeername` (``None`` on error)" +#: ../../library/asyncio-protocol.rst:190 +msgid "" +"``'peername'``: the remote address to which the socket is connected, result " +"of :meth:`socket.socket.getpeername` (``None`` on error)" msgstr "" +#: ../../library/asyncio-protocol.rst:194 msgid "``'socket'``: :class:`socket.socket` instance" msgstr "" -msgid "``'sockname'``: the socket's own address, result of :meth:`socket.socket.getsockname`" +#: ../../library/asyncio-protocol.rst:196 +msgid "" +"``'sockname'``: the socket's own address, result " +"of :meth:`socket.socket.getsockname`" msgstr "" +#: ../../library/asyncio-protocol.rst:199 msgid "SSL socket:" msgstr "" -msgid "``'compression'``: the compression algorithm being used as a string, or ``None`` if the connection isn't compressed; result of :meth:`ssl.SSLSocket.compression`" +#: ../../library/asyncio-protocol.rst:201 +msgid "" +"``'compression'``: the compression algorithm being used as a string, or " +"``None`` if the connection isn't compressed; result " +"of :meth:`ssl.SSLSocket.compression`" msgstr "" -msgid "``'cipher'``: a three-value tuple containing the name of the cipher being used, the version of the SSL protocol that defines its use, and the number of secret bits being used; result of :meth:`ssl.SSLSocket.cipher`" +#: ../../library/asyncio-protocol.rst:205 +msgid "" +"``'cipher'``: a three-value tuple containing the name of the cipher being " +"used, the version of the SSL protocol that defines its use, and the number " +"of secret bits being used; result of :meth:`ssl.SSLSocket.cipher`" msgstr "" -msgid "``'peercert'``: peer certificate; result of :meth:`ssl.SSLSocket.getpeercert`" +#: ../../library/asyncio-protocol.rst:210 +msgid "" +"``'peercert'``: peer certificate; result of :meth:`ssl.SSLSocket.getpeercert`" msgstr "" +#: ../../library/asyncio-protocol.rst:213 msgid "``'sslcontext'``: :class:`ssl.SSLContext` instance" msgstr "" -msgid "``'ssl_object'``: :class:`ssl.SSLObject` or :class:`ssl.SSLSocket` instance" +#: ../../library/asyncio-protocol.rst:215 +msgid "" +"``'ssl_object'``: :class:`ssl.SSLObject` or :class:`ssl.SSLSocket` instance" msgstr "" +#: ../../library/asyncio-protocol.rst:218 msgid "pipe:" msgstr "" +#: ../../library/asyncio-protocol.rst:220 msgid "``'pipe'``: pipe object" msgstr "" +#: ../../library/asyncio-protocol.rst:222 msgid "subprocess:" msgstr "" +#: ../../library/asyncio-protocol.rst:224 msgid "``'subprocess'``: :class:`subprocess.Popen` instance" msgstr "" +#: ../../library/asyncio-protocol.rst:228 msgid "Set a new protocol." msgstr "" -msgid "Switching protocol should only be done when both protocols are documented to support the switch." +#: ../../library/asyncio-protocol.rst:230 +msgid "" +"Switching protocol should only be done when both protocols are documented to " +"support the switch." msgstr "" +#: ../../library/asyncio-protocol.rst:235 msgid "Return the current protocol." msgstr "" +#: ../../library/asyncio-protocol.rst:239 msgid "Read-only Transports" msgstr "" +#: ../../library/asyncio-protocol.rst:243 msgid "Return ``True`` if the transport is receiving new data." msgstr "" -msgid "Pause the receiving end of the transport. No data will be passed to the protocol's :meth:`protocol.data_received() ` method until :meth:`resume_reading` is called." +#: ../../library/asyncio-protocol.rst:249 +msgid "" +"Pause the receiving end of the transport. No data will be passed to the " +"protocol's :meth:`protocol.data_received() ` method " +"until :meth:`resume_reading` is called." msgstr "" -msgid "The method is idempotent, i.e. it can be called when the transport is already paused or closed." +#: ../../library/asyncio-protocol.rst:253 +msgid "" +"The method is idempotent, i.e. it can be called when the transport is " +"already paused or closed." msgstr "" -msgid "Resume the receiving end. The protocol's :meth:`protocol.data_received() ` method will be called once again if some data is available for reading." +#: ../../library/asyncio-protocol.rst:259 +msgid "" +"Resume the receiving end. The protocol's :meth:`protocol.data_received() " +"` method will be called once again if some data is " +"available for reading." msgstr "" -msgid "The method is idempotent, i.e. it can be called when the transport is already reading." +#: ../../library/asyncio-protocol.rst:263 +msgid "" +"The method is idempotent, i.e. it can be called when the transport is " +"already reading." msgstr "" +#: ../../library/asyncio-protocol.rst:269 msgid "Write-only Transports" msgstr "" -msgid "Close the transport immediately, without waiting for pending operations to complete. Buffered data will be lost. No more data will be received. The protocol's :meth:`protocol.connection_lost() ` method will eventually be called with :const:`None` as its argument." +#: ../../library/asyncio-protocol.rst:273 +msgid "" +"Close the transport immediately, without waiting for pending operations to " +"complete. Buffered data will be lost. No more data will be received. The " +"protocol's :meth:`protocol.connection_lost() ` " +"method will eventually be called with :const:`None` as its argument." msgstr "" -msgid "Return :const:`True` if the transport supports :meth:`~WriteTransport.write_eof`, :const:`False` if not." +#: ../../library/asyncio-protocol.rst:281 +msgid "" +"Return :const:`True` if the transport " +"supports :meth:`~WriteTransport.write_eof`, :const:`False` if not." msgstr "" +#: ../../library/asyncio-protocol.rst:286 msgid "Return the current size of the output buffer used by the transport." msgstr "" -msgid "Get the *high* and *low* watermarks for write flow control. Return a tuple ``(low, high)`` where *low* and *high* are positive number of bytes." +#: ../../library/asyncio-protocol.rst:290 +msgid "" +"Get the *high* and *low* watermarks for write flow control. Return a tuple " +"``(low, high)`` where *low* and *high* are positive number of bytes." msgstr "" +#: ../../library/asyncio-protocol.rst:294 msgid "Use :meth:`set_write_buffer_limits` to set the limits." msgstr "" +#: ../../library/asyncio-protocol.rst:300 msgid "Set the *high* and *low* watermarks for write flow control." msgstr "" -msgid "These two values (measured in number of bytes) control when the protocol's :meth:`protocol.pause_writing() ` and :meth:`protocol.resume_writing() ` methods are called. If specified, the low watermark must be less than or equal to the high watermark. Neither *high* nor *low* can be negative." +#: ../../library/asyncio-protocol.rst:302 +msgid "" +"These two values (measured in number of bytes) control when the " +"protocol's :meth:`protocol.pause_writing() ` " +"and :meth:`protocol.resume_writing() ` methods " +"are called. If specified, the low watermark must be less than or equal to " +"the high watermark. Neither *high* nor *low* can be negative." msgstr "" -msgid ":meth:`~BaseProtocol.pause_writing` is called when the buffer size becomes greater than or equal to the *high* value. If writing has been paused, :meth:`~BaseProtocol.resume_writing` is called when the buffer size becomes less than or equal to the *low* value." +#: ../../library/asyncio-protocol.rst:310 +msgid "" +":meth:`~BaseProtocol.pause_writing` is called when the buffer size becomes " +"greater than or equal to the *high* value. If writing has been " +"paused, :meth:`~BaseProtocol.resume_writing` is called when the buffer size " +"becomes less than or equal to the *low* value." msgstr "" -msgid "The defaults are implementation-specific. If only the high watermark is given, the low watermark defaults to an implementation-specific value less than or equal to the high watermark. Setting *high* to zero forces *low* to zero as well, and causes :meth:`~BaseProtocol.pause_writing` to be called whenever the buffer becomes non-empty. Setting *low* to zero causes :meth:`~BaseProtocol.resume_writing` to be called only once the buffer is empty. Use of zero for either limit is generally sub-optimal as it reduces opportunities for doing I/O and computation concurrently." +#: ../../library/asyncio-protocol.rst:315 +msgid "" +"The defaults are implementation-specific. If only the high watermark is " +"given, the low watermark defaults to an implementation-specific value less " +"than or equal to the high watermark. Setting *high* to zero forces *low* to " +"zero as well, and causes :meth:`~BaseProtocol.pause_writing` to be called " +"whenever the buffer becomes non-empty. Setting *low* to zero " +"causes :meth:`~BaseProtocol.resume_writing` to be called only once the " +"buffer is empty. Use of zero for either limit is generally sub-optimal as it " +"reduces opportunities for doing I/O and computation concurrently." msgstr "" +#: ../../library/asyncio-protocol.rst:326 msgid "Use :meth:`~WriteTransport.get_write_buffer_limits` to get the limits." msgstr "" +#: ../../library/asyncio-protocol.rst:331 msgid "Write some *data* bytes to the transport." msgstr "" -msgid "This method does not block; it buffers the data and arranges for it to be sent out asynchronously." +#: ../../library/asyncio-protocol.rst:333 +#: ../../library/asyncio-protocol.rst:362 +msgid "" +"This method does not block; it buffers the data and arranges for it to be " +"sent out asynchronously." msgstr "" -msgid "Write a list (or any iterable) of data bytes to the transport. This is functionally equivalent to calling :meth:`write` on each element yielded by the iterable, but may be implemented more efficiently." +#: ../../library/asyncio-protocol.rst:338 +msgid "" +"Write a list (or any iterable) of data bytes to the transport. This is " +"functionally equivalent to calling :meth:`write` on each element yielded by " +"the iterable, but may be implemented more efficiently." msgstr "" -msgid "Close the write end of the transport after flushing all buffered data. Data may still be received." +#: ../../library/asyncio-protocol.rst:345 +msgid "" +"Close the write end of the transport after flushing all buffered data. Data " +"may still be received." msgstr "" -msgid "This method can raise :exc:`NotImplementedError` if the transport (e.g. SSL) doesn't support half-closed connections." +#: ../../library/asyncio-protocol.rst:348 +msgid "" +"This method can raise :exc:`NotImplementedError` if the transport (e.g. SSL) " +"doesn't support half-closed connections." msgstr "" +#: ../../library/asyncio-protocol.rst:353 msgid "Datagram Transports" msgstr "" -msgid "Send the *data* bytes to the remote peer given by *addr* (a transport-dependent target address). If *addr* is :const:`None`, the data is sent to the target address given on transport creation." +#: ../../library/asyncio-protocol.rst:357 +msgid "" +"Send the *data* bytes to the remote peer given by *addr* (a transport-" +"dependent target address). If *addr* is :const:`None`, the data is sent to " +"the target address given on transport creation." msgstr "" -msgid "This method can be called with an empty bytes object to send a zero-length datagram. The buffer size calculation used for flow control is also updated to account for the datagram header." +#: ../../library/asyncio-protocol.rst:365 +msgid "" +"This method can be called with an empty bytes object to send a zero-length " +"datagram. The buffer size calculation used for flow control is also updated " +"to account for the datagram header." msgstr "" -msgid "Close the transport immediately, without waiting for pending operations to complete. Buffered data will be lost. No more data will be received. The protocol's :meth:`protocol.connection_lost() ` method will eventually be called with :const:`None` as its argument." +#: ../../library/asyncio-protocol.rst:372 +msgid "" +"Close the transport immediately, without waiting for pending operations to " +"complete. Buffered data will be lost. No more data will be received. The " +"protocol's :meth:`protocol.connection_lost() ` " +"method will eventually be called with :const:`None` as its argument." msgstr "" +#: ../../library/asyncio-protocol.rst:382 msgid "Subprocess Transports" msgstr "" +#: ../../library/asyncio-protocol.rst:386 msgid "Return the subprocess process id as an integer." msgstr "" -msgid "Return the transport for the communication pipe corresponding to the integer file descriptor *fd*:" +#: ../../library/asyncio-protocol.rst:390 +msgid "" +"Return the transport for the communication pipe corresponding to the integer " +"file descriptor *fd*:" msgstr "" -msgid "``0``: writable streaming transport of the standard input (*stdin*), or :const:`None` if the subprocess was not created with ``stdin=PIPE``" +#: ../../library/asyncio-protocol.rst:393 +msgid "" +"``0``: writable streaming transport of the standard input (*stdin*), " +"or :const:`None` if the subprocess was not created with ``stdin=PIPE``" msgstr "" -msgid "``1``: readable streaming transport of the standard output (*stdout*), or :const:`None` if the subprocess was not created with ``stdout=PIPE``" +#: ../../library/asyncio-protocol.rst:395 +msgid "" +"``1``: readable streaming transport of the standard output (*stdout*), " +"or :const:`None` if the subprocess was not created with ``stdout=PIPE``" msgstr "" -msgid "``2``: readable streaming transport of the standard error (*stderr*), or :const:`None` if the subprocess was not created with ``stderr=PIPE``" +#: ../../library/asyncio-protocol.rst:397 +msgid "" +"``2``: readable streaming transport of the standard error (*stderr*), " +"or :const:`None` if the subprocess was not created with ``stderr=PIPE``" msgstr "" +#: ../../library/asyncio-protocol.rst:399 msgid "other *fd*: :const:`None`" msgstr "" -msgid "Return the subprocess return code as an integer or :const:`None` if it hasn't returned, which is similar to the :attr:`subprocess.Popen.returncode` attribute." +#: ../../library/asyncio-protocol.rst:403 +msgid "" +"Return the subprocess return code as an integer or :const:`None` if it " +"hasn't returned, which is similar to the :attr:`subprocess.Popen.returncode` " +"attribute." msgstr "" +#: ../../library/asyncio-protocol.rst:409 msgid "Kill the subprocess." msgstr "" -msgid "On POSIX systems, the function sends SIGKILL to the subprocess. On Windows, this method is an alias for :meth:`terminate`." +#: ../../library/asyncio-protocol.rst:411 +msgid "" +"On POSIX systems, the function sends SIGKILL to the subprocess. On Windows, " +"this method is an alias for :meth:`terminate`." msgstr "" +#: ../../library/asyncio-protocol.rst:414 msgid "See also :meth:`subprocess.Popen.kill`." msgstr "" -msgid "Send the *signal* number to the subprocess, as in :meth:`subprocess.Popen.send_signal`." +#: ../../library/asyncio-protocol.rst:418 +msgid "" +"Send the *signal* number to the subprocess, as " +"in :meth:`subprocess.Popen.send_signal`." msgstr "" +#: ../../library/asyncio-protocol.rst:423 msgid "Stop the subprocess." msgstr "" -msgid "On POSIX systems, this method sends :py:const:`~signal.SIGTERM` to the subprocess. On Windows, the Windows API function :c:func:`!TerminateProcess` is called to stop the subprocess." +#: ../../library/asyncio-protocol.rst:425 +msgid "" +"On POSIX systems, this method sends :py:const:`~signal.SIGTERM` to the " +"subprocess. On Windows, the Windows API function :c:func:`!TerminateProcess` " +"is called to stop the subprocess." msgstr "" +#: ../../library/asyncio-protocol.rst:429 msgid "See also :meth:`subprocess.Popen.terminate`." msgstr "" +#: ../../library/asyncio-protocol.rst:433 msgid "Kill the subprocess by calling the :meth:`kill` method." msgstr "" -msgid "If the subprocess hasn't returned yet, and close transports of *stdin*, *stdout*, and *stderr* pipes." +#: ../../library/asyncio-protocol.rst:435 +msgid "" +"If the subprocess hasn't returned yet, and close transports of *stdin*, " +"*stdout*, and *stderr* pipes." msgstr "" +#: ../../library/asyncio-protocol.rst:442 msgid "Protocols" msgstr "" +#: ../../library/asyncio-protocol.rst:444 msgid "**Source code:** :source:`Lib/asyncio/protocols.py`" msgstr "" -msgid "asyncio provides a set of abstract base classes that should be used to implement network protocols. Those classes are meant to be used together with :ref:`transports `." +#: ../../library/asyncio-protocol.rst:448 +msgid "" +"asyncio provides a set of abstract base classes that should be used to " +"implement network protocols. Those classes are meant to be used together " +"with :ref:`transports `." msgstr "" -msgid "Subclasses of abstract base protocol classes may implement some or all methods. All these methods are callbacks: they are called by transports on certain events, for example when some data is received. A base protocol method should be called by the corresponding transport." +#: ../../library/asyncio-protocol.rst:452 +msgid "" +"Subclasses of abstract base protocol classes may implement some or all " +"methods. All these methods are callbacks: they are called by transports on " +"certain events, for example when some data is received. A base protocol " +"method should be called by the corresponding transport." msgstr "" +#: ../../library/asyncio-protocol.rst:459 msgid "Base Protocols" msgstr "" +#: ../../library/asyncio-protocol.rst:463 msgid "Base protocol with methods that all protocols share." msgstr "" -msgid "The base class for implementing streaming protocols (TCP, Unix sockets, etc)." +#: ../../library/asyncio-protocol.rst:467 +msgid "" +"The base class for implementing streaming protocols (TCP, Unix sockets, etc)." msgstr "" -msgid "A base class for implementing streaming protocols with manual control of the receive buffer." +#: ../../library/asyncio-protocol.rst:472 +msgid "" +"A base class for implementing streaming protocols with manual control of the " +"receive buffer." msgstr "" +#: ../../library/asyncio-protocol.rst:477 msgid "The base class for implementing datagram (UDP) protocols." msgstr "" -msgid "The base class for implementing protocols communicating with child processes (unidirectional pipes)." +#: ../../library/asyncio-protocol.rst:481 +msgid "" +"The base class for implementing protocols communicating with child processes " +"(unidirectional pipes)." msgstr "" +#: ../../library/asyncio-protocol.rst:486 msgid "Base Protocol" msgstr "" +#: ../../library/asyncio-protocol.rst:488 msgid "All asyncio protocols can implement Base Protocol callbacks." msgstr "" +#: ../../library/asyncio-protocol.rst:491 msgid "Connection Callbacks" msgstr "" -msgid "Connection callbacks are called on all protocols, exactly once per a successful connection. All other protocol callbacks can only be called between those two methods." +#: ../../library/asyncio-protocol.rst:492 +msgid "" +"Connection callbacks are called on all protocols, exactly once per a " +"successful connection. All other protocol callbacks can only be called " +"between those two methods." msgstr "" +#: ../../library/asyncio-protocol.rst:498 msgid "Called when a connection is made." msgstr "" -msgid "The *transport* argument is the transport representing the connection. The protocol is responsible for storing the reference to its transport." +#: ../../library/asyncio-protocol.rst:500 +msgid "" +"The *transport* argument is the transport representing the connection. The " +"protocol is responsible for storing the reference to its transport." msgstr "" +#: ../../library/asyncio-protocol.rst:506 msgid "Called when the connection is lost or closed." msgstr "" -msgid "The argument is either an exception object or :const:`None`. The latter means a regular EOF is received, or the connection was aborted or closed by this side of the connection." +#: ../../library/asyncio-protocol.rst:508 +msgid "" +"The argument is either an exception object or :const:`None`. The latter " +"means a regular EOF is received, or the connection was aborted or closed by " +"this side of the connection." msgstr "" +#: ../../library/asyncio-protocol.rst:514 msgid "Flow Control Callbacks" msgstr "" -msgid "Flow control callbacks can be called by transports to pause or resume writing performed by the protocol." +#: ../../library/asyncio-protocol.rst:515 +msgid "" +"Flow control callbacks can be called by transports to pause or resume " +"writing performed by the protocol." msgstr "" -msgid "See the documentation of the :meth:`~WriteTransport.set_write_buffer_limits` method for more details." +#: ../../library/asyncio-protocol.rst:518 +msgid "" +"See the documentation of the :meth:`~WriteTransport.set_write_buffer_limits` " +"method for more details." msgstr "" +#: ../../library/asyncio-protocol.rst:523 msgid "Called when the transport's buffer goes over the high watermark." msgstr "" +#: ../../library/asyncio-protocol.rst:527 msgid "Called when the transport's buffer drains below the low watermark." msgstr "" -msgid "If the buffer size equals the high watermark, :meth:`~BaseProtocol.pause_writing` is not called: the buffer size must go strictly over." +#: ../../library/asyncio-protocol.rst:529 +msgid "" +"If the buffer size equals the high " +"watermark, :meth:`~BaseProtocol.pause_writing` is not called: the buffer " +"size must go strictly over." msgstr "" -msgid "Conversely, :meth:`~BaseProtocol.resume_writing` is called when the buffer size is equal or lower than the low watermark. These end conditions are important to ensure that things go as expected when either mark is zero." +#: ../../library/asyncio-protocol.rst:533 +msgid "" +"Conversely, :meth:`~BaseProtocol.resume_writing` is called when the buffer " +"size is equal or lower than the low watermark. These end conditions are " +"important to ensure that things go as expected when either mark is zero." msgstr "" +#: ../../library/asyncio-protocol.rst:540 msgid "Streaming Protocols" msgstr "" -msgid "Event methods, such as :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_accepted_socket`, :meth:`loop.connect_read_pipe`, and :meth:`loop.connect_write_pipe` accept factories that return streaming protocols." +#: ../../library/asyncio-protocol.rst:542 +msgid "" +"Event methods, such " +"as :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :meth:`loop.create_connection`, :meth:`loop.create_unix_connection`, :meth:`loop.connect_accepted_socket`, :meth:`loop.connect_read_pipe`, " +"and :meth:`loop.connect_write_pipe` accept factories that return streaming " +"protocols." msgstr "" -msgid "Called when some data is received. *data* is a non-empty bytes object containing the incoming data." +#: ../../library/asyncio-protocol.rst:550 +msgid "" +"Called when some data is received. *data* is a non-empty bytes object " +"containing the incoming data." msgstr "" -msgid "Whether the data is buffered, chunked or reassembled depends on the transport. In general, you shouldn't rely on specific semantics and instead make your parsing generic and flexible. However, data is always received in the correct order." +#: ../../library/asyncio-protocol.rst:553 +msgid "" +"Whether the data is buffered, chunked or reassembled depends on the " +"transport. In general, you shouldn't rely on specific semantics and instead " +"make your parsing generic and flexible. However, data is always received in " +"the correct order." msgstr "" -msgid "The method can be called an arbitrary number of times while a connection is open." +#: ../../library/asyncio-protocol.rst:558 +msgid "" +"The method can be called an arbitrary number of times while a connection is " +"open." msgstr "" -msgid "However, :meth:`protocol.eof_received() ` is called at most once. Once ``eof_received()`` is called, ``data_received()`` is not called anymore." +#: ../../library/asyncio-protocol.rst:561 +msgid "" +"However, :meth:`protocol.eof_received() ` is called " +"at most once. Once ``eof_received()`` is called, ``data_received()`` is not " +"called anymore." msgstr "" -msgid "Called when the other end signals it won't send any more data (for example by calling :meth:`transport.write_eof() `, if the other end also uses asyncio)." +#: ../../library/asyncio-protocol.rst:567 +msgid "" +"Called when the other end signals it won't send any more data (for example " +"by calling :meth:`transport.write_eof() `, if the " +"other end also uses asyncio)." msgstr "" -msgid "This method may return a false value (including ``None``), in which case the transport will close itself. Conversely, if this method returns a true value, the protocol used determines whether to close the transport. Since the default implementation returns ``None``, it implicitly closes the connection." +#: ../../library/asyncio-protocol.rst:572 +msgid "" +"This method may return a false value (including ``None``), in which case the " +"transport will close itself. Conversely, if this method returns a true " +"value, the protocol used determines whether to close the transport. Since " +"the default implementation returns ``None``, it implicitly closes the " +"connection." msgstr "" -msgid "Some transports, including SSL, don't support half-closed connections, in which case returning true from this method will result in the connection being closed." +#: ../../library/asyncio-protocol.rst:578 +msgid "" +"Some transports, including SSL, don't support half-closed connections, in " +"which case returning true from this method will result in the connection " +"being closed." msgstr "" +#: ../../library/asyncio-protocol.rst:583 +#: ../../library/asyncio-protocol.rst:641 msgid "State machine:" msgstr "" +#: ../../library/asyncio-protocol.rst:585 msgid "" "start -> connection_made\n" " [-> data_received]*\n" @@ -454,39 +812,73 @@ msgid "" "-> connection_lost -> end" msgstr "" +#: ../../library/asyncio-protocol.rst:594 msgid "Buffered Streaming Protocols" msgstr "" -msgid "Buffered Protocols can be used with any event loop method that supports `Streaming Protocols`_." +#: ../../library/asyncio-protocol.rst:598 +msgid "" +"Buffered Protocols can be used with any event loop method that supports " +"`Streaming Protocols`_." msgstr "" -msgid "``BufferedProtocol`` implementations allow explicit manual allocation and control of the receive buffer. Event loops can then use the buffer provided by the protocol to avoid unnecessary data copies. This can result in noticeable performance improvement for protocols that receive big amounts of data. Sophisticated protocol implementations can significantly reduce the number of buffer allocations." +#: ../../library/asyncio-protocol.rst:601 +msgid "" +"``BufferedProtocol`` implementations allow explicit manual allocation and " +"control of the receive buffer. Event loops can then use the buffer provided " +"by the protocol to avoid unnecessary data copies. This can result in " +"noticeable performance improvement for protocols that receive big amounts of " +"data. Sophisticated protocol implementations can significantly reduce the " +"number of buffer allocations." msgstr "" -msgid "The following callbacks are called on :class:`BufferedProtocol` instances:" +#: ../../library/asyncio-protocol.rst:608 +msgid "" +"The following callbacks are called on :class:`BufferedProtocol` instances:" msgstr "" +#: ../../library/asyncio-protocol.rst:613 msgid "Called to allocate a new receive buffer." msgstr "" -msgid "*sizehint* is the recommended minimum size for the returned buffer. It is acceptable to return smaller or larger buffers than what *sizehint* suggests. When set to -1, the buffer size can be arbitrary. It is an error to return a buffer with a zero size." +#: ../../library/asyncio-protocol.rst:615 +msgid "" +"*sizehint* is the recommended minimum size for the returned buffer. It is " +"acceptable to return smaller or larger buffers than what *sizehint* " +"suggests. When set to -1, the buffer size can be arbitrary. It is an error " +"to return a buffer with a zero size." msgstr "" -msgid "``get_buffer()`` must return an object implementing the :ref:`buffer protocol `." +#: ../../library/asyncio-protocol.rst:620 +msgid "" +"``get_buffer()`` must return an object implementing the :ref:`buffer " +"protocol `." msgstr "" +#: ../../library/asyncio-protocol.rst:625 msgid "Called when the buffer was updated with the received data." msgstr "" +#: ../../library/asyncio-protocol.rst:627 msgid "*nbytes* is the total number of bytes that were written to the buffer." msgstr "" -msgid "See the documentation of the :meth:`protocol.eof_received() ` method." +#: ../../library/asyncio-protocol.rst:631 +msgid "" +"See the documentation of the :meth:`protocol.eof_received() " +"` method." msgstr "" -msgid ":meth:`~BufferedProtocol.get_buffer` can be called an arbitrary number of times during a connection. However, :meth:`protocol.eof_received() ` is called at most once and, if called, :meth:`~BufferedProtocol.get_buffer` and :meth:`~BufferedProtocol.buffer_updated` won't be called after it." +#: ../../library/asyncio-protocol.rst:635 +msgid "" +":meth:`~BufferedProtocol.get_buffer` can be called an arbitrary number of " +"times during a connection. However, :meth:`protocol.eof_received() " +"` is called at most once and, if " +"called, :meth:`~BufferedProtocol.get_buffer` " +"and :meth:`~BufferedProtocol.buffer_updated` won't be called after it." msgstr "" +#: ../../library/asyncio-protocol.rst:643 msgid "" "start -> connection_made\n" " [-> get_buffer\n" @@ -496,63 +888,109 @@ msgid "" "-> connection_lost -> end" msgstr "" +#: ../../library/asyncio-protocol.rst:654 msgid "Datagram Protocols" msgstr "" -msgid "Datagram Protocol instances should be constructed by protocol factories passed to the :meth:`loop.create_datagram_endpoint` method." +#: ../../library/asyncio-protocol.rst:656 +msgid "" +"Datagram Protocol instances should be constructed by protocol factories " +"passed to the :meth:`loop.create_datagram_endpoint` method." msgstr "" -msgid "Called when a datagram is received. *data* is a bytes object containing the incoming data. *addr* is the address of the peer sending the data; the exact format depends on the transport." +#: ../../library/asyncio-protocol.rst:661 +msgid "" +"Called when a datagram is received. *data* is a bytes object containing the " +"incoming data. *addr* is the address of the peer sending the data; the " +"exact format depends on the transport." msgstr "" -msgid "Called when a previous send or receive operation raises an :class:`OSError`. *exc* is the :class:`OSError` instance." +#: ../../library/asyncio-protocol.rst:667 +msgid "" +"Called when a previous send or receive operation raises " +"an :class:`OSError`. *exc* is the :class:`OSError` instance." msgstr "" -msgid "This method is called in rare conditions, when the transport (e.g. UDP) detects that a datagram could not be delivered to its recipient. In many conditions though, undeliverable datagrams will be silently dropped." +#: ../../library/asyncio-protocol.rst:670 +msgid "" +"This method is called in rare conditions, when the transport (e.g. UDP) " +"detects that a datagram could not be delivered to its recipient. In many " +"conditions though, undeliverable datagrams will be silently dropped." msgstr "" -msgid "On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for datagram protocols, because there is no reliable way to detect send failures caused by writing too many packets." +#: ../../library/asyncio-protocol.rst:677 +msgid "" +"On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for " +"datagram protocols, because there is no reliable way to detect send failures " +"caused by writing too many packets." msgstr "" -msgid "The socket always appears 'ready' and excess packets are dropped. An :class:`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may not be raised; if it is raised, it will be reported to :meth:`DatagramProtocol.error_received` but otherwise ignored." +#: ../../library/asyncio-protocol.rst:681 +msgid "" +"The socket always appears 'ready' and excess packets are dropped. " +"An :class:`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may " +"not be raised; if it is raised, it will be reported " +"to :meth:`DatagramProtocol.error_received` but otherwise ignored." msgstr "" +#: ../../library/asyncio-protocol.rst:690 msgid "Subprocess Protocols" msgstr "" -msgid "Subprocess Protocol instances should be constructed by protocol factories passed to the :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." +#: ../../library/asyncio-protocol.rst:692 +msgid "" +"Subprocess Protocol instances should be constructed by protocol factories " +"passed to the :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` " +"methods." msgstr "" -msgid "Called when the child process writes data into its stdout or stderr pipe." +#: ../../library/asyncio-protocol.rst:698 +msgid "" +"Called when the child process writes data into its stdout or stderr pipe." msgstr "" +#: ../../library/asyncio-protocol.rst:701 msgid "*fd* is the integer file descriptor of the pipe." msgstr "" +#: ../../library/asyncio-protocol.rst:703 msgid "*data* is a non-empty bytes object containing the received data." msgstr "" -msgid "Called when one of the pipes communicating with the child process is closed." +#: ../../library/asyncio-protocol.rst:707 +msgid "" +"Called when one of the pipes communicating with the child process is closed." msgstr "" +#: ../../library/asyncio-protocol.rst:710 msgid "*fd* is the integer file descriptor that was closed." msgstr "" +#: ../../library/asyncio-protocol.rst:714 msgid "Called when the child process has exited." msgstr "" -msgid "It can be called before :meth:`~SubprocessProtocol.pipe_data_received` and :meth:`~SubprocessProtocol.pipe_connection_lost` methods." +#: ../../library/asyncio-protocol.rst:716 +msgid "" +"It can be called before :meth:`~SubprocessProtocol.pipe_data_received` " +"and :meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" +#: ../../library/asyncio-protocol.rst:721 msgid "Examples" msgstr "" +#: ../../library/asyncio-protocol.rst:726 msgid "TCP Echo Server" msgstr "" -msgid "Create a TCP echo server using the :meth:`loop.create_server` method, send back received data, and close the connection::" +#: ../../library/asyncio-protocol.rst:728 +msgid "" +"Create a TCP echo server using the :meth:`loop.create_server` method, send " +"back received data, and close the connection::" msgstr "" +#: ../../library/asyncio-protocol.rst:731 msgid "" "import asyncio\n" "\n" @@ -590,15 +1028,23 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "The :ref:`TCP echo server using streams ` example uses the high-level :func:`asyncio.start_server` function." +#: ../../library/asyncio-protocol.rst:769 +msgid "" +"The :ref:`TCP echo server using streams ` " +"example uses the high-level :func:`asyncio.start_server` function." msgstr "" +#: ../../library/asyncio-protocol.rst:775 msgid "TCP Echo Client" msgstr "" -msgid "A TCP echo client using the :meth:`loop.create_connection` method, sends data, and waits until the connection is closed::" +#: ../../library/asyncio-protocol.rst:777 +msgid "" +"A TCP echo client using the :meth:`loop.create_connection` method, sends " +"data, and waits until the connection is closed::" msgstr "" +#: ../../library/asyncio-protocol.rst:780 msgid "" "import asyncio\n" "\n" @@ -643,15 +1089,23 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "The :ref:`TCP echo client using streams ` example uses the high-level :func:`asyncio.open_connection` function." +#: ../../library/asyncio-protocol.rst:825 +msgid "" +"The :ref:`TCP echo client using streams ` " +"example uses the high-level :func:`asyncio.open_connection` function." msgstr "" +#: ../../library/asyncio-protocol.rst:832 msgid "UDP Echo Server" msgstr "" -msgid "A UDP echo server, using the :meth:`loop.create_datagram_endpoint` method, sends back received data::" +#: ../../library/asyncio-protocol.rst:834 +msgid "" +"A UDP echo server, using the :meth:`loop.create_datagram_endpoint` method, " +"sends back received data::" msgstr "" +#: ../../library/asyncio-protocol.rst:837 msgid "" "import asyncio\n" "\n" @@ -689,12 +1143,17 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-protocol.rst:876 msgid "UDP Echo Client" msgstr "" -msgid "A UDP echo client, using the :meth:`loop.create_datagram_endpoint` method, sends data and closes the transport when it receives the answer::" +#: ../../library/asyncio-protocol.rst:878 +msgid "" +"A UDP echo client, using the :meth:`loop.create_datagram_endpoint` method, " +"sends data and closes the transport when it receives the answer::" msgstr "" +#: ../../library/asyncio-protocol.rst:881 msgid "" "import asyncio\n" "\n" @@ -745,12 +1204,17 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-protocol.rst:933 msgid "Connecting Existing Sockets" msgstr "" -msgid "Wait until a socket receives data using the :meth:`loop.create_connection` method with a protocol::" +#: ../../library/asyncio-protocol.rst:935 +msgid "" +"Wait until a socket receives data using the :meth:`loop.create_connection` " +"method with a protocol::" msgstr "" +#: ../../library/asyncio-protocol.rst:938 msgid "" "import asyncio\n" "import socket\n" @@ -802,21 +1266,35 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "The :ref:`watch a file descriptor for read events ` example uses the low-level :meth:`loop.add_reader` method to register an FD." +#: ../../library/asyncio-protocol.rst:989 +msgid "" +"The :ref:`watch a file descriptor for read events " +"` example uses the low-" +"level :meth:`loop.add_reader` method to register an FD." msgstr "" -msgid "The :ref:`register an open socket to wait for data using streams ` example uses high-level streams created by the :func:`open_connection` function in a coroutine." +#: ../../library/asyncio-protocol.rst:993 +msgid "" +"The :ref:`register an open socket to wait for data using streams " +"` example uses high-level streams " +"created by the :func:`open_connection` function in a coroutine." msgstr "" +#: ../../library/asyncio-protocol.rst:1000 msgid "loop.subprocess_exec() and SubprocessProtocol" msgstr "" -msgid "An example of a subprocess protocol used to get the output of a subprocess and to wait for the subprocess exit." +#: ../../library/asyncio-protocol.rst:1002 +msgid "" +"An example of a subprocess protocol used to get the output of a subprocess " +"and to wait for the subprocess exit." msgstr "" +#: ../../library/asyncio-protocol.rst:1005 msgid "The subprocess is created by the :meth:`loop.subprocess_exec` method::" msgstr "" +#: ../../library/asyncio-protocol.rst:1007 msgid "" "import asyncio\n" "import sys\n" @@ -877,5 +1355,8 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -msgid "See also the :ref:`same example ` written using high-level APIs." +#: ../../library/asyncio-protocol.rst:1065 +msgid "" +"See also the :ref:`same example ` " +"written using high-level APIs." msgstr "" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index e3d85c036..e11d42fbd 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,147 +24,263 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-queue.rst:7 msgid "Queues" msgstr "" +#: ../../library/asyncio-queue.rst:9 msgid "**Source code:** :source:`Lib/asyncio/queues.py`" msgstr "" -msgid "asyncio queues are designed to be similar to classes of the :mod:`queue` module. Although asyncio queues are not thread-safe, they are designed to be used specifically in async/await code." +#: ../../library/asyncio-queue.rst:13 +msgid "" +"asyncio queues are designed to be similar to classes of the :mod:`queue` " +"module. Although asyncio queues are not thread-safe, they are designed to " +"be used specifically in async/await code." msgstr "" -msgid "Note that methods of asyncio queues don't have a *timeout* parameter; use :func:`asyncio.wait_for` function to do queue operations with a timeout." +#: ../../library/asyncio-queue.rst:17 +msgid "" +"Note that methods of asyncio queues don't have a *timeout* parameter; " +"use :func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" +#: ../../library/asyncio-queue.rst:21 msgid "See also the `Examples`_ section below." msgstr "" +#: ../../library/asyncio-queue.rst:24 msgid "Queue" msgstr "" +#: ../../library/asyncio-queue.rst:28 msgid "A first in, first out (FIFO) queue." msgstr "" -msgid "If *maxsize* is less than or equal to zero, the queue size is infinite. If it is an integer greater than ``0``, then ``await put()`` blocks when the queue reaches *maxsize* until an item is removed by :meth:`get`." +#: ../../library/asyncio-queue.rst:30 +msgid "" +"If *maxsize* is less than or equal to zero, the queue size is infinite. If " +"it is an integer greater than ``0``, then ``await put()`` blocks when the " +"queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" -msgid "Unlike the standard library threading :mod:`queue`, the size of the queue is always known and can be returned by calling the :meth:`qsize` method." +#: ../../library/asyncio-queue.rst:35 +msgid "" +"Unlike the standard library threading :mod:`queue`, the size of the queue is " +"always known and can be returned by calling the :meth:`qsize` method." msgstr "" +#: ../../library/asyncio-queue.rst:39 msgid "Removed the *loop* parameter." msgstr "" +#: ../../library/asyncio-queue.rst:43 msgid "This class is :ref:`not thread safe `." msgstr "" +#: ../../library/asyncio-queue.rst:47 msgid "Number of items allowed in the queue." msgstr "" +#: ../../library/asyncio-queue.rst:51 msgid "Return ``True`` if the queue is empty, ``False`` otherwise." msgstr "" +#: ../../library/asyncio-queue.rst:55 msgid "Return ``True`` if there are :attr:`maxsize` items in the queue." msgstr "" -msgid "If the queue was initialized with ``maxsize=0`` (the default), then :meth:`full` never returns ``True``." +#: ../../library/asyncio-queue.rst:57 +msgid "" +"If the queue was initialized with ``maxsize=0`` (the default), " +"then :meth:`full` never returns ``True``." +msgstr "" + +#: ../../library/asyncio-queue.rst:63 +msgid "" +"Remove and return an item from the queue. If queue is empty, wait until an " +"item is available." msgstr "" -msgid "Remove and return an item from the queue. If queue is empty, wait until an item is available." +#: ../../library/asyncio-queue.rst:66 +msgid "" +"Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " +"if the queue has been shut down immediately." msgstr "" -msgid "Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or if the queue has been shut down immediately." +#: ../../library/asyncio-queue.rst:71 +msgid "" +"Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "" -msgid "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." +#: ../../library/asyncio-queue.rst:74 +msgid "" +"Raises :exc:`QueueShutDown` if the queue has been shut down and is empty." msgstr "" +#: ../../library/asyncio-queue.rst:79 msgid "Block until all items in the queue have been received and processed." msgstr "" -msgid "The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer coroutine calls :meth:`task_done` to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, :meth:`join` unblocks." +#: ../../library/asyncio-queue.rst:81 +msgid "" +"The count of unfinished tasks goes up whenever an item is added to the " +"queue. The count goes down whenever a consumer coroutine " +"calls :meth:`task_done` to indicate that the item was retrieved and all work " +"on it is complete. When the count of unfinished tasks drops to " +"zero, :meth:`join` unblocks." msgstr "" -msgid "Put an item into the queue. If the queue is full, wait until a free slot is available before adding the item." +#: ../../library/asyncio-queue.rst:90 +msgid "" +"Put an item into the queue. If the queue is full, wait until a free slot is " +"available before adding the item." msgstr "" +#: ../../library/asyncio-queue.rst:93 ../../library/asyncio-queue.rst:101 msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." msgstr "" +#: ../../library/asyncio-queue.rst:97 msgid "Put an item into the queue without blocking." msgstr "" +#: ../../library/asyncio-queue.rst:99 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "" +#: ../../library/asyncio-queue.rst:105 msgid "Return the number of items in the queue." msgstr "" +#: ../../library/asyncio-queue.rst:109 msgid "Put a :class:`Queue` instance into a shutdown mode." msgstr "" -msgid "The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` will be unblocked and will raise :exc:`QueueShutDown` in the formerly awaiting task." +#: ../../library/asyncio-queue.rst:111 +msgid "" +"The queue can no longer grow. Future calls to :meth:`~Queue.put` " +"raise :exc:`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` " +"will be unblocked and will raise :exc:`QueueShutDown` in the formerly " +"awaiting task." msgstr "" -msgid "If *immediate* is false (the default), the queue can be wound down normally with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +#: ../../library/asyncio-queue.rst:116 +msgid "" +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." msgstr "" -msgid "And if :meth:`~Queue.task_done` is called for each remaining task, a pending :meth:`~Queue.join` will be unblocked normally." +#: ../../library/asyncio-queue.rst:120 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." msgstr "" -msgid "Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:`QueueShutDown`." +#: ../../library/asyncio-queue.rst:123 +msgid "" +"Once the queue is empty, future calls to :meth:`~Queue.get` will " +"raise :exc:`QueueShutDown`." msgstr "" -msgid "If *immediate* is true, the queue is terminated immediately. The queue is drained to be completely empty and the count of unfinished tasks is reduced by the number of tasks drained. If unfinished tasks is zero, callers of :meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue.get` are unblocked and will raise :exc:`QueueShutDown` because the queue is empty." +#: ../../library/asyncio-queue.rst:126 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty and the count of unfinished tasks is reduced " +"by the number of tasks drained. If unfinished tasks is zero, callers " +"of :meth:`~Queue.join` are unblocked. Also, blocked callers " +"of :meth:`~Queue.get` are unblocked and will raise :exc:`QueueShutDown` " +"because the queue is empty." msgstr "" -msgid "Use caution when using :meth:`~Queue.join` with *immediate* set to true. This unblocks the join even when no work has been done on the tasks, violating the usual invariant for joining a queue." +#: ../../library/asyncio-queue.rst:134 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." msgstr "" +#: ../../library/asyncio-queue.rst:142 msgid "Indicate that a formerly enqueued work item is complete." msgstr "" -msgid "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work item, a subsequent call to :meth:`task_done` tells the queue that the processing on the work item is complete." +#: ../../library/asyncio-queue.rst:144 +msgid "" +"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " +"item, a subsequent call to :meth:`task_done` tells the queue that the " +"processing on the work item is complete." msgstr "" -msgid "If a :meth:`join` is currently blocking, it will resume when all items have been processed (meaning that a :meth:`task_done` call was received for every item that had been :meth:`~Queue.put` into the queue)." +#: ../../library/asyncio-queue.rst:148 +msgid "" +"If a :meth:`join` is currently blocking, it will resume when all items have " +"been processed (meaning that a :meth:`task_done` call was received for every " +"item that had been :meth:`~Queue.put` into the queue)." msgstr "" -msgid "Raises :exc:`ValueError` if called more times than there were items placed in the queue." +#: ../../library/asyncio-queue.rst:153 +msgid "" +"Raises :exc:`ValueError` if called more times than there were items placed " +"in the queue." msgstr "" +#: ../../library/asyncio-queue.rst:158 msgid "Priority Queue" msgstr "" -msgid "A variant of :class:`Queue`; retrieves entries in priority order (lowest first)." +#: ../../library/asyncio-queue.rst:162 +msgid "" +"A variant of :class:`Queue`; retrieves entries in priority order (lowest " +"first)." msgstr "" +#: ../../library/asyncio-queue.rst:165 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "" +#: ../../library/asyncio-queue.rst:170 msgid "LIFO Queue" msgstr "" -msgid "A variant of :class:`Queue` that retrieves most recently added entries first (last in, first out)." +#: ../../library/asyncio-queue.rst:174 +msgid "" +"A variant of :class:`Queue` that retrieves most recently added entries first " +"(last in, first out)." msgstr "" +#: ../../library/asyncio-queue.rst:179 msgid "Exceptions" msgstr "" -msgid "This exception is raised when the :meth:`~Queue.get_nowait` method is called on an empty queue." +#: ../../library/asyncio-queue.rst:183 +msgid "" +"This exception is raised when the :meth:`~Queue.get_nowait` method is called " +"on an empty queue." msgstr "" -msgid "Exception raised when the :meth:`~Queue.put_nowait` method is called on a queue that has reached its *maxsize*." +#: ../../library/asyncio-queue.rst:189 +msgid "" +"Exception raised when the :meth:`~Queue.put_nowait` method is called on a " +"queue that has reached its *maxsize*." msgstr "" -msgid "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on a queue which has been shut down." +#: ../../library/asyncio-queue.rst:195 +msgid "" +"Exception raised " +"when :meth:`~Queue.put`, :meth:`~Queue.put_nowait`, :meth:`~Queue.get` " +"or :meth:`~Queue.get_nowait` is called on a queue which has been shut down." msgstr "" +#: ../../library/asyncio-queue.rst:203 msgid "Examples" msgstr "" -msgid "Queues can be used to distribute workload between several concurrent tasks::" +#: ../../library/asyncio-queue.rst:207 +msgid "" +"Queues can be used to distribute workload between several concurrent tasks::" msgstr "" +#: ../../library/asyncio-queue.rst:210 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 7c439a44a..85008a314 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2022-11-05 19:48+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,45 +23,79 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-runner.rst:6 msgid "Runners" msgstr "" +#: ../../library/asyncio-runner.rst:8 msgid "**Source code:** :source:`Lib/asyncio/runners.py`" msgstr "" -msgid "This section outlines high-level asyncio primitives to run asyncio code." +#: ../../library/asyncio-runner.rst:11 +msgid "" +"This section outlines high-level asyncio primitives to run asyncio code." msgstr "" -msgid "They are built on top of an :ref:`event loop ` with the aim to simplify async code usage for common wide-spread scenarios." +#: ../../library/asyncio-runner.rst:13 +msgid "" +"They are built on top of an :ref:`event loop ` with the " +"aim to simplify async code usage for common wide-spread scenarios." msgstr "" +#: ../../library/asyncio-runner.rst:23 msgid "Running an asyncio Program" msgstr "" +#: ../../library/asyncio-runner.rst:27 msgid "Execute *coro* in an asyncio event loop and return the result." msgstr "" +#: ../../library/asyncio-runner.rst:29 ../../library/asyncio-runner.rst:121 msgid "The argument can be any awaitable object." msgstr "" -msgid "This function runs the awaitable, taking care of managing the asyncio event loop, *finalizing asynchronous generators*, and closing the executor." +#: ../../library/asyncio-runner.rst:31 +msgid "" +"This function runs the awaitable, taking care of managing the asyncio event " +"loop, *finalizing asynchronous generators*, and closing the executor." msgstr "" -msgid "This function cannot be called when another asyncio event loop is running in the same thread." +#: ../../library/asyncio-runner.rst:35 ../../library/asyncio-runner.rst:131 +msgid "" +"This function cannot be called when another asyncio event loop is running in " +"the same thread." msgstr "" -msgid "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` disables debug mode explicitly. ``None`` is used to respect the global :ref:`asyncio-debug-mode` settings." +#: ../../library/asyncio-runner.rst:38 ../../library/asyncio-runner.rst:97 +msgid "" +"If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " +"disables debug mode explicitly. ``None`` is used to respect the " +"global :ref:`asyncio-debug-mode` settings." msgstr "" -msgid "If *loop_factory* is not ``None``, it is used to create a new event loop; otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the end. This function should be used as a main entry point for asyncio programs, and should ideally only be called once. It is recommended to use *loop_factory* to configure the event loop instead of policies. Passing :class:`asyncio.EventLoop` allows running asyncio without the policy system." +#: ../../library/asyncio-runner.rst:42 +msgid "" +"If *loop_factory* is not ``None``, it is used to create a new event loop; " +"otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " +"end. This function should be used as a main entry point for asyncio " +"programs, and should ideally only be called once. It is recommended to use " +"*loop_factory* to configure the event loop instead of policies. " +"Passing :class:`asyncio.EventLoop` allows running asyncio without the policy " +"system." msgstr "" -msgid "The executor is given a timeout duration of 5 minutes to shutdown. If the executor hasn't finished within that duration, a warning is emitted and the executor is closed." +#: ../../library/asyncio-runner.rst:50 +msgid "" +"The executor is given a timeout duration of 5 minutes to shutdown. If the " +"executor hasn't finished within that duration, a warning is emitted and the " +"executor is closed." msgstr "" +#: ../../library/asyncio-runner.rst:54 msgid "Example::" msgstr "" +#: ../../library/asyncio-runner.rst:56 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -70,36 +104,61 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-runner.rst:64 msgid "Updated to use :meth:`loop.shutdown_default_executor`." msgstr "" -msgid "*debug* is ``None`` by default to respect the global debug mode settings." +#: ../../library/asyncio-runner.rst:69 +msgid "" +"*debug* is ``None`` by default to respect the global debug mode settings." msgstr "" +#: ../../library/asyncio-runner.rst:73 msgid "Added *loop_factory* parameter." msgstr "" +#: ../../library/asyncio-runner.rst:77 ../../library/asyncio-runner.rst:136 msgid "*coro* can be any awaitable object." msgstr "" -msgid "The :mod:`!asyncio` policy system is deprecated and will be removed in Python 3.16; from there on, an explicit *loop_factory* is needed to configure the event loop." +#: ../../library/asyncio-runner.rst:81 +msgid "" +"The :mod:`!asyncio` policy system is deprecated and will be removed in " +"Python 3.16; from there on, an explicit *loop_factory* is needed to " +"configure the event loop." msgstr "" +#: ../../library/asyncio-runner.rst:87 msgid "Runner context manager" msgstr "" -msgid "A context manager that simplifies *multiple* async function calls in the same context." +#: ../../library/asyncio-runner.rst:91 +msgid "" +"A context manager that simplifies *multiple* async function calls in the " +"same context." msgstr "" -msgid "Sometimes several top-level async functions should be called in the same :ref:`event loop ` and :class:`contextvars.Context`." +#: ../../library/asyncio-runner.rst:94 +msgid "" +"Sometimes several top-level async functions should be called in the " +"same :ref:`event loop ` and :class:`contextvars.Context`." msgstr "" -msgid "*loop_factory* could be used for overriding the loop creation. It is the responsibility of the *loop_factory* to set the created loop as the current one. By default :func:`asyncio.new_event_loop` is used and set as current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." +#: ../../library/asyncio-runner.rst:101 +msgid "" +"*loop_factory* could be used for overriding the loop creation. It is the " +"responsibility of the *loop_factory* to set the created loop as the current " +"one. By default :func:`asyncio.new_event_loop` is used and set as current " +"event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." msgstr "" -msgid "Basically, :func:`asyncio.run` example can be rewritten with the runner usage::" +#: ../../library/asyncio-runner.rst:106 +msgid "" +"Basically, :func:`asyncio.run` example can be rewritten with the runner " +"usage::" msgstr "" +#: ../../library/asyncio-runner.rst:108 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -109,50 +168,96 @@ msgid "" " runner.run(main())" msgstr "" +#: ../../library/asyncio-runner.rst:119 msgid "Execute *coro* in the embedded event loop." msgstr "" +#: ../../library/asyncio-runner.rst:123 msgid "If the argument is a coroutine, it is wrapped in a Task." msgstr "" -msgid "An optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the code to run in. The runner's default context is used if context is ``None``." +#: ../../library/asyncio-runner.rst:125 +msgid "" +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the code to run in. The runner's " +"default context is used if context is ``None``." msgstr "" +#: ../../library/asyncio-runner.rst:129 msgid "Returns the awaitable's result or raises an exception." msgstr "" +#: ../../library/asyncio-runner.rst:140 msgid "Close the runner." msgstr "" -msgid "Finalize asynchronous generators, shutdown default executor, close the event loop and release embedded :class:`contextvars.Context`." +#: ../../library/asyncio-runner.rst:142 +msgid "" +"Finalize asynchronous generators, shutdown default executor, close the event " +"loop and release embedded :class:`contextvars.Context`." msgstr "" +#: ../../library/asyncio-runner.rst:147 msgid "Return the event loop associated with the runner instance." msgstr "" -msgid ":class:`Runner` uses the lazy initialization strategy, its constructor doesn't initialize underlying low-level structures." +#: ../../library/asyncio-runner.rst:151 +msgid "" +":class:`Runner` uses the lazy initialization strategy, its constructor " +"doesn't initialize underlying low-level structures." msgstr "" -msgid "Embedded *loop* and *context* are created at the :keyword:`with` body entering or the first call of :meth:`run` or :meth:`get_loop`." +#: ../../library/asyncio-runner.rst:154 +msgid "" +"Embedded *loop* and *context* are created at the :keyword:`with` body " +"entering or the first call of :meth:`run` or :meth:`get_loop`." msgstr "" +#: ../../library/asyncio-runner.rst:159 msgid "Handling Keyboard Interruption" msgstr "" -msgid "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:`KeyboardInterrupt` exception is raised in the main thread by default. However this doesn't work with :mod:`asyncio` because it can interrupt asyncio internals and can hang the program from exiting." +#: ../../library/asyncio-runner.rst:163 +msgid "" +"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-" +"C`, :exc:`KeyboardInterrupt` exception is raised in the main thread by " +"default. However this doesn't work with :mod:`asyncio` because it can " +"interrupt asyncio internals and can hang the program from exiting." msgstr "" -msgid "To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as follows:" +#: ../../library/asyncio-runner.rst:168 +msgid "" +"To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " +"follows:" msgstr "" -msgid ":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler before any user code is executed and removes it when exiting from the function." +#: ../../library/asyncio-runner.rst:170 +msgid "" +":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " +"before any user code is executed and removes it when exiting from the " +"function." msgstr "" -msgid "The :class:`~asyncio.Runner` creates the main task for the passed coroutine for its execution." +#: ../../library/asyncio-runner.rst:172 +msgid "" +"The :class:`~asyncio.Runner` creates the main task for the passed coroutine " +"for its execution." msgstr "" -msgid "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal handler cancels the main task by calling :meth:`asyncio.Task.cancel` which raises :exc:`asyncio.CancelledError` inside the main task. This causes the Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be used for resource cleanup. After the main task is cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`." +#: ../../library/asyncio-runner.rst:174 +msgid "" +"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " +"handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " +"raises :exc:`asyncio.CancelledError` inside the main task. This causes the " +"Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be " +"used for resource cleanup. After the main task is " +"cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" -msgid "A user could write a tight loop which cannot be interrupted by :meth:`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` immediately raises the :exc:`KeyboardInterrupt` without cancelling the main task." +#: ../../library/asyncio-runner.rst:180 +msgid "" +"A user could write a tight loop which cannot be interrupted " +"by :meth:`asyncio.Task.cancel`, in which case the second " +"following :kbd:`Ctrl-C` immediately raises the :exc:`KeyboardInterrupt` " +"without cancelling the main task." msgstr "" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 8603cef1a..325cbed56 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,18 +24,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-stream.rst:7 msgid "Streams" msgstr "" +#: ../../library/asyncio-stream.rst:9 msgid "**Source code:** :source:`Lib/asyncio/streams.py`" msgstr "" -msgid "Streams are high-level async/await-ready primitives to work with network connections. Streams allow sending and receiving data without using callbacks or low-level protocols and transports." +#: ../../library/asyncio-stream.rst:13 +msgid "" +"Streams are high-level async/await-ready primitives to work with network " +"connections. Streams allow sending and receiving data without using " +"callbacks or low-level protocols and transports." msgstr "" +#: ../../library/asyncio-stream.rst:19 msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "" +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:451 msgid "" "import asyncio\n" "\n" @@ -57,269 +65,469 @@ msgid "" "asyncio.run(tcp_echo_client('Hello World!'))" msgstr "" +#: ../../library/asyncio-stream.rst:42 msgid "See also the `Examples`_ section below." msgstr "" +#: ../../library/asyncio-stream.rst:46 msgid "Stream Functions" msgstr "" -msgid "The following top-level asyncio functions can be used to create and work with streams:" +#: ../../library/asyncio-stream.rst:47 +msgid "" +"The following top-level asyncio functions can be used to create and work " +"with streams:" msgstr "" -msgid "Establish a network connection and return a pair of ``(reader, writer)`` objects." +#: ../../library/asyncio-stream.rst:59 +msgid "" +"Establish a network connection and return a pair of ``(reader, writer)`` " +"objects." msgstr "" -msgid "The returned *reader* and *writer* objects are instances of :class:`StreamReader` and :class:`StreamWriter` classes." +#: ../../library/asyncio-stream.rst:62 +msgid "" +"The returned *reader* and *writer* objects are instances " +"of :class:`StreamReader` and :class:`StreamWriter` classes." msgstr "" -msgid "*limit* determines the buffer size limit used by the returned :class:`StreamReader` instance. By default the *limit* is set to 64 KiB." +#: ../../library/asyncio-stream.rst:65 ../../library/asyncio-stream.rst:112 +msgid "" +"*limit* determines the buffer size limit used by the " +"returned :class:`StreamReader` instance. By default the *limit* is set to " +"64 KiB." msgstr "" -msgid "The rest of the arguments are passed directly to :meth:`loop.create_connection`." +#: ../../library/asyncio-stream.rst:69 +msgid "" +"The rest of the arguments are passed directly " +"to :meth:`loop.create_connection`." msgstr "" -msgid "The *sock* argument transfers ownership of the socket to the :class:`StreamWriter` created. To close the socket, call its :meth:`~asyncio.StreamWriter.close` method." +#: ../../library/asyncio-stream.rst:74 ../../library/asyncio-stream.rst:154 +msgid "" +"The *sock* argument transfers ownership of the socket to " +"the :class:`StreamWriter` created. To close the socket, call " +"its :meth:`~asyncio.StreamWriter.close` method." msgstr "" +#: ../../library/asyncio-stream.rst:78 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "" +#: ../../library/asyncio-stream.rst:81 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "" +#: ../../library/asyncio-stream.rst:84 ../../library/asyncio-stream.rst:128 +#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:199 msgid "Removed the *loop* parameter." msgstr "" +#: ../../library/asyncio-stream.rst:87 ../../library/asyncio-stream.rst:131 +#: ../../library/asyncio-stream.rst:167 ../../library/asyncio-stream.rst:202 +#: ../../library/asyncio-stream.rst:418 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "" +#: ../../library/asyncio-stream.rst:101 msgid "Start a socket server." msgstr "" -msgid "The *client_connected_cb* callback is called whenever a new client connection is established. It receives a ``(reader, writer)`` pair as two arguments, instances of the :class:`StreamReader` and :class:`StreamWriter` classes." +#: ../../library/asyncio-stream.rst:103 +msgid "" +"The *client_connected_cb* callback is called whenever a new client " +"connection is established. It receives a ``(reader, writer)`` pair as two " +"arguments, instances of the :class:`StreamReader` and :class:`StreamWriter` " +"classes." msgstr "" -msgid "*client_connected_cb* can be a plain callable or a :ref:`coroutine function `; if it is a coroutine function, it will be automatically scheduled as a :class:`Task`." +#: ../../library/asyncio-stream.rst:108 +msgid "" +"*client_connected_cb* can be a plain callable or a :ref:`coroutine function " +"`; if it is a coroutine function, it will be automatically " +"scheduled as a :class:`Task`." msgstr "" -msgid "The rest of the arguments are passed directly to :meth:`loop.create_server`." +#: ../../library/asyncio-stream.rst:116 +msgid "" +"The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "" -msgid "The *sock* argument transfers ownership of the socket to the server created. To close the socket, call the server's :meth:`~asyncio.Server.close` method." +#: ../../library/asyncio-stream.rst:121 ../../library/asyncio-stream.rst:189 +msgid "" +"The *sock* argument transfers ownership of the socket to the server created. " +"To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" +#: ../../library/asyncio-stream.rst:125 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "" +#: ../../library/asyncio-stream.rst:134 msgid "Added the *keep_alive* parameter." msgstr "" +#: ../../library/asyncio-stream.rst:139 msgid "Unix Sockets" msgstr "" -msgid "Establish a Unix socket connection and return a pair of ``(reader, writer)``." +#: ../../library/asyncio-stream.rst:145 +msgid "" +"Establish a Unix socket connection and return a pair of ``(reader, writer)``." msgstr "" +#: ../../library/asyncio-stream.rst:148 msgid "Similar to :func:`open_connection` but operates on Unix sockets." msgstr "" +#: ../../library/asyncio-stream.rst:150 msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "" +#: ../../library/asyncio-stream.rst:158 ../../library/asyncio-stream.rst:193 msgid "Availability" msgstr "" -msgid "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be a :term:`path-like object`" +#: ../../library/asyncio-stream.rst:160 +msgid "" +"Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " +"a :term:`path-like object`" msgstr "" +#: ../../library/asyncio-stream.rst:177 msgid "Start a Unix socket server." msgstr "" +#: ../../library/asyncio-stream.rst:179 msgid "Similar to :func:`start_server` but works with Unix sockets." msgstr "" -msgid "If *cleanup_socket* is true then the Unix socket will automatically be removed from the filesystem when the server is closed, unless the socket has been replaced after the server has been created." +#: ../../library/asyncio-stream.rst:181 +msgid "" +"If *cleanup_socket* is true then the Unix socket will automatically be " +"removed from the filesystem when the server is closed, unless the socket has " +"been replaced after the server has been created." msgstr "" +#: ../../library/asyncio-stream.rst:185 msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr "" -msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* parameter can now be a :term:`path-like object`." +#: ../../library/asyncio-stream.rst:195 +msgid "" +"Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " +"parameter can now be a :term:`path-like object`." msgstr "" +#: ../../library/asyncio-stream.rst:205 msgid "Added the *cleanup_socket* parameter." msgstr "" +#: ../../library/asyncio-stream.rst:210 msgid "StreamReader" msgstr "" -msgid "Represents a reader object that provides APIs to read data from the IO stream. As an :term:`asynchronous iterable`, the object supports the :keyword:`async for` statement." +#: ../../library/asyncio-stream.rst:214 +msgid "" +"Represents a reader object that provides APIs to read data from the IO " +"stream. As an :term:`asynchronous iterable`, the object supports " +"the :keyword:`async for` statement." msgstr "" -msgid "It is not recommended to instantiate *StreamReader* objects directly; use :func:`open_connection` and :func:`start_server` instead." +#: ../../library/asyncio-stream.rst:218 +msgid "" +"It is not recommended to instantiate *StreamReader* objects directly; " +"use :func:`open_connection` and :func:`start_server` instead." msgstr "" +#: ../../library/asyncio-stream.rst:224 msgid "Acknowledge the EOF." msgstr "" +#: ../../library/asyncio-stream.rst:229 msgid "Read up to *n* bytes from the stream." msgstr "" -msgid "If *n* is not provided or set to ``-1``, read until EOF, then return all read :class:`bytes`. If EOF was received and the internal buffer is empty, return an empty ``bytes`` object." +#: ../../library/asyncio-stream.rst:231 +msgid "" +"If *n* is not provided or set to ``-1``, read until EOF, then return all " +"read :class:`bytes`. If EOF was received and the internal buffer is empty, " +"return an empty ``bytes`` object." msgstr "" +#: ../../library/asyncio-stream.rst:236 msgid "If *n* is ``0``, return an empty ``bytes`` object immediately." msgstr "" -msgid "If *n* is positive, return at most *n* available ``bytes`` as soon as at least 1 byte is available in the internal buffer. If EOF is received before any byte is read, return an empty ``bytes`` object." +#: ../../library/asyncio-stream.rst:238 +msgid "" +"If *n* is positive, return at most *n* available ``bytes`` as soon as at " +"least 1 byte is available in the internal buffer. If EOF is received before " +"any byte is read, return an empty ``bytes`` object." msgstr "" -msgid "Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." +#: ../../library/asyncio-stream.rst:246 +msgid "" +"Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." msgstr "" -msgid "If EOF is received and ``\\n`` was not found, the method returns partially read data." +#: ../../library/asyncio-stream.rst:249 +msgid "" +"If EOF is received and ``\\n`` was not found, the method returns partially " +"read data." msgstr "" -msgid "If EOF is received and the internal buffer is empty, return an empty ``bytes`` object." +#: ../../library/asyncio-stream.rst:252 +msgid "" +"If EOF is received and the internal buffer is empty, return an empty " +"``bytes`` object." msgstr "" +#: ../../library/asyncio-stream.rst:258 msgid "Read exactly *n* bytes." msgstr "" -msgid "Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be read. Use the :attr:`IncompleteReadError.partial` attribute to get the partially read data." +#: ../../library/asyncio-stream.rst:260 +msgid "" +"Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be " +"read. Use the :attr:`IncompleteReadError.partial` attribute to get the " +"partially read data." msgstr "" +#: ../../library/asyncio-stream.rst:267 msgid "Read data from the stream until *separator* is found." msgstr "" -msgid "On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end." +#: ../../library/asyncio-stream.rst:269 +msgid "" +"On success, the data and separator will be removed from the internal buffer " +"(consumed). Returned data will include the separator at the end." msgstr "" -msgid "If the amount of data read exceeds the configured stream limit, a :exc:`LimitOverrunError` exception is raised, and the data is left in the internal buffer and can be read again." +#: ../../library/asyncio-stream.rst:273 +msgid "" +"If the amount of data read exceeds the configured stream limit, " +"a :exc:`LimitOverrunError` exception is raised, and the data is left in the " +"internal buffer and can be read again." msgstr "" -msgid "If EOF is reached before the complete separator is found, an :exc:`IncompleteReadError` exception is raised, and the internal buffer is reset. The :attr:`IncompleteReadError.partial` attribute may contain a portion of the separator." +#: ../../library/asyncio-stream.rst:277 +msgid "" +"If EOF is reached before the complete separator is found, " +"an :exc:`IncompleteReadError` exception is raised, and the internal buffer " +"is reset. The :attr:`IncompleteReadError.partial` attribute may contain a " +"portion of the separator." msgstr "" -msgid "The *separator* may also be a tuple of separators. In this case the return value will be the shortest possible that has any separator as the suffix. For the purposes of :exc:`LimitOverrunError`, the shortest possible separator is considered to be the one that matched." +#: ../../library/asyncio-stream.rst:282 +msgid "" +"The *separator* may also be a tuple of separators. In this case the return " +"value will be the shortest possible that has any separator as the suffix. " +"For the purposes of :exc:`LimitOverrunError`, the shortest possible " +"separator is considered to be the one that matched." msgstr "" +#: ../../library/asyncio-stream.rst:292 msgid "The *separator* parameter may now be a :class:`tuple` of separators." msgstr "" +#: ../../library/asyncio-stream.rst:297 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "" +#: ../../library/asyncio-stream.rst:302 msgid "StreamWriter" msgstr "" -msgid "Represents a writer object that provides APIs to write data to the IO stream." +#: ../../library/asyncio-stream.rst:306 +msgid "" +"Represents a writer object that provides APIs to write data to the IO stream." msgstr "" -msgid "It is not recommended to instantiate *StreamWriter* objects directly; use :func:`open_connection` and :func:`start_server` instead." +#: ../../library/asyncio-stream.rst:309 +msgid "" +"It is not recommended to instantiate *StreamWriter* objects directly; " +"use :func:`open_connection` and :func:`start_server` instead." msgstr "" -msgid "The method attempts to write the *data* to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent." +#: ../../library/asyncio-stream.rst:315 +msgid "" +"The method attempts to write the *data* to the underlying socket " +"immediately. If that fails, the data is queued in an internal write buffer " +"until it can be sent." msgstr "" -msgid "The *data* buffer should be a bytes, bytearray, or C-contiguous one-dimensional memoryview object." +#: ../../library/asyncio-stream.rst:319 +msgid "" +"The *data* buffer should be a bytes, bytearray, or C-contiguous one-" +"dimensional memoryview object." msgstr "" +#: ../../library/asyncio-stream.rst:322 ../../library/asyncio-stream.rst:335 msgid "The method should be used along with the ``drain()`` method::" msgstr "" +#: ../../library/asyncio-stream.rst:324 msgid "" "stream.write(data)\n" "await stream.drain()" msgstr "" -msgid "The method writes a list (or any iterable) of bytes to the underlying socket immediately. If that fails, the data is queued in an internal write buffer until it can be sent." +#: ../../library/asyncio-stream.rst:330 +msgid "" +"The method writes a list (or any iterable) of bytes to the underlying socket " +"immediately. If that fails, the data is queued in an internal write buffer " +"until it can be sent." msgstr "" +#: ../../library/asyncio-stream.rst:337 msgid "" "stream.writelines(lines)\n" "await stream.drain()" msgstr "" +#: ../../library/asyncio-stream.rst:342 msgid "The method closes the stream and the underlying socket." msgstr "" -msgid "The method should be used, though not mandatory, along with the ``wait_closed()`` method::" +#: ../../library/asyncio-stream.rst:344 +msgid "" +"The method should be used, though not mandatory, along with the " +"``wait_closed()`` method::" msgstr "" +#: ../../library/asyncio-stream.rst:347 msgid "" "stream.close()\n" "await stream.wait_closed()" msgstr "" -msgid "Return ``True`` if the underlying transport supports the :meth:`write_eof` method, ``False`` otherwise." +#: ../../library/asyncio-stream.rst:352 +msgid "" +"Return ``True`` if the underlying transport supports the :meth:`write_eof` " +"method, ``False`` otherwise." msgstr "" -msgid "Close the write end of the stream after the buffered write data is flushed." +#: ../../library/asyncio-stream.rst:357 +msgid "" +"Close the write end of the stream after the buffered write data is flushed." msgstr "" +#: ../../library/asyncio-stream.rst:362 msgid "Return the underlying asyncio transport." msgstr "" -msgid "Access optional transport information; see :meth:`BaseTransport.get_extra_info` for details." +#: ../../library/asyncio-stream.rst:366 +msgid "" +"Access optional transport information; " +"see :meth:`BaseTransport.get_extra_info` for details." msgstr "" +#: ../../library/asyncio-stream.rst:372 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "" +#: ../../library/asyncio-stream.rst:375 msgid "" "writer.write(data)\n" "await writer.drain()" msgstr "" -msgid "This is a flow control method that interacts with the underlying IO write buffer. When the size of the buffer reaches the high watermark, *drain()* blocks until the size of the buffer is drained down to the low watermark and writing can be resumed. When there is nothing to wait for, the :meth:`drain` returns immediately." +#: ../../library/asyncio-stream.rst:378 +msgid "" +"This is a flow control method that interacts with the underlying IO write " +"buffer. When the size of the buffer reaches the high watermark, *drain()* " +"blocks until the size of the buffer is drained down to the low watermark and " +"writing can be resumed. When there is nothing to wait for, " +"the :meth:`drain` returns immediately." msgstr "" +#: ../../library/asyncio-stream.rst:387 +msgid "" +"When the write buffer is below the high watermark, :meth:`drain` returns " +"immediately without yielding to the event loop. As a result, code which " +"repeatedly calls ``write()`` followed by ``await drain()`` may prevent other " +"tasks from running. To prevent blocking behavior, yield to the event loop " +"explicitly with ``await asyncio.sleep(0)`` (see :func:`asyncio.sleep`)." +msgstr "" + +#: ../../library/asyncio-stream.rst:399 msgid "Upgrade an existing stream-based connection to TLS." msgstr "" +#: ../../library/asyncio-stream.rst:401 msgid "Parameters:" msgstr "" +#: ../../library/asyncio-stream.rst:403 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -msgid "*server_hostname*: sets or overrides the host name that the target server's certificate will be matched against." +#: ../../library/asyncio-stream.rst:405 +msgid "" +"*server_hostname*: sets or overrides the host name that the target server's " +"certificate will be matched against." msgstr "" -msgid "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake to complete before aborting the connection. ``60.0`` seconds if ``None`` (default)." +#: ../../library/asyncio-stream.rst:408 +msgid "" +"*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " +"to complete before aborting the connection. ``60.0`` seconds if ``None`` " +"(default)." msgstr "" -msgid "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown to complete before aborting the connection. ``30.0`` seconds if ``None`` (default)." +#: ../../library/asyncio-stream.rst:412 +msgid "" +"*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " +"to complete before aborting the connection. ``30.0`` seconds if ``None`` " +"(default)." msgstr "" -msgid "Return ``True`` if the stream is closed or in the process of being closed." +#: ../../library/asyncio-stream.rst:424 +msgid "" +"Return ``True`` if the stream is closed or in the process of being closed." msgstr "" +#: ../../library/asyncio-stream.rst:432 msgid "Wait until the stream is closed." msgstr "" -msgid "Should be called after :meth:`close` to wait until the underlying connection is closed, ensuring that all data has been flushed before e.g. exiting the program." +#: ../../library/asyncio-stream.rst:434 +msgid "" +"Should be called after :meth:`close` to wait until the underlying connection " +"is closed, ensuring that all data has been flushed before e.g. exiting the " +"program." msgstr "" +#: ../../library/asyncio-stream.rst:442 msgid "Examples" msgstr "" +#: ../../library/asyncio-stream.rst:447 msgid "TCP echo client using streams" msgstr "" +#: ../../library/asyncio-stream.rst:449 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "" -msgid "The :ref:`TCP echo client protocol ` example uses the low-level :meth:`loop.create_connection` method." +#: ../../library/asyncio-stream.rst:473 +msgid "" +"The :ref:`TCP echo client protocol " +"` example uses the low-" +"level :meth:`loop.create_connection` method." msgstr "" +#: ../../library/asyncio-stream.rst:480 msgid "TCP echo server using streams" msgstr "" +#: ../../library/asyncio-stream.rst:482 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "" +#: ../../library/asyncio-stream.rst:484 msgid "" "import asyncio\n" "\n" @@ -351,15 +559,23 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "The :ref:`TCP echo server protocol ` example uses the :meth:`loop.create_server` method." +#: ../../library/asyncio-stream.rst:516 +msgid "" +"The :ref:`TCP echo server protocol " +"` example uses " +"the :meth:`loop.create_server` method." msgstr "" +#: ../../library/asyncio-stream.rst:521 msgid "Get HTTP headers" msgstr "" -msgid "Simple example querying HTTP headers of the URL passed on the command line::" +#: ../../library/asyncio-stream.rst:523 +msgid "" +"Simple example querying HTTP headers of the URL passed on the command line::" msgstr "" +#: ../../library/asyncio-stream.rst:525 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -398,24 +614,33 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" +#: ../../library/asyncio-stream.rst:562 msgid "Usage::" msgstr "" +#: ../../library/asyncio-stream.rst:564 msgid "python example.py http://example.com/path/page.html" msgstr "" +#: ../../library/asyncio-stream.rst:566 msgid "or with HTTPS::" msgstr "" +#: ../../library/asyncio-stream.rst:568 msgid "python example.py https://example.com/path/page.html" msgstr "" +#: ../../library/asyncio-stream.rst:574 msgid "Register an open socket to wait for data using streams" msgstr "" -msgid "Coroutine waiting until a socket receives data using the :func:`open_connection` function::" +#: ../../library/asyncio-stream.rst:576 +msgid "" +"Coroutine waiting until a socket receives data using " +"the :func:`open_connection` function::" msgstr "" +#: ../../library/asyncio-stream.rst:579 msgid "" "import asyncio\n" "import socket\n" @@ -448,8 +673,16 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -msgid "The :ref:`register an open socket to wait for data using a protocol ` example uses a low-level protocol and the :meth:`loop.create_connection` method." +#: ../../library/asyncio-stream.rst:611 +msgid "" +"The :ref:`register an open socket to wait for data using a protocol " +"` example uses a low-level protocol and " +"the :meth:`loop.create_connection` method." msgstr "" -msgid "The :ref:`watch a file descriptor for read events ` example uses the low-level :meth:`loop.add_reader` method to watch a file descriptor." +#: ../../library/asyncio-stream.rst:615 +msgid "" +"The :ref:`watch a file descriptor for read events " +"` example uses the low-" +"level :meth:`loop.add_reader` method to watch a file descriptor." msgstr "" diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index c86da07be..47d340522 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,18 +25,29 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-subprocess.rst:7 msgid "Subprocesses" msgstr "" -msgid "**Source code:** :source:`Lib/asyncio/subprocess.py`, :source:`Lib/asyncio/base_subprocess.py`" +#: ../../library/asyncio-subprocess.rst:9 +msgid "" +"**Source code:** :source:`Lib/asyncio/subprocess.py`, :source:`Lib/asyncio/" +"base_subprocess.py`" msgstr "" -msgid "This section describes high-level async/await asyncio APIs to create and manage subprocesses." +#: ../../library/asyncio-subprocess.rst:14 +msgid "" +"This section describes high-level async/await asyncio APIs to create and " +"manage subprocesses." msgstr "" -msgid "Here's an example of how asyncio can run a shell command and obtain its result::" +#: ../../library/asyncio-subprocess.rst:19 +msgid "" +"Here's an example of how asyncio can run a shell command and obtain its " +"result::" msgstr "" +#: ../../library/asyncio-subprocess.rst:22 msgid "" "import asyncio\n" "\n" @@ -57,18 +68,26 @@ msgid "" "asyncio.run(run('ls /zzz'))" msgstr "" +#: ../../library/asyncio-subprocess.rst:40 msgid "will print::" msgstr "" +#: ../../library/asyncio-subprocess.rst:42 msgid "" "['ls /zzz' exited with 1]\n" "[stderr]\n" "ls: /zzz: No such file or directory" msgstr "" -msgid "Because all asyncio subprocess functions are asynchronous and asyncio provides many tools to work with such functions, it is easy to execute and monitor multiple subprocesses in parallel. It is indeed trivial to modify the above example to run several commands simultaneously::" +#: ../../library/asyncio-subprocess.rst:46 +msgid "" +"Because all asyncio subprocess functions are asynchronous and asyncio " +"provides many tools to work with such functions, it is easy to execute and " +"monitor multiple subprocesses in parallel. It is indeed trivial to modify " +"the above example to run several commands simultaneously::" msgstr "" +#: ../../library/asyncio-subprocess.rst:51 msgid "" "async def main():\n" " await asyncio.gather(\n" @@ -78,213 +97,396 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-subprocess.rst:58 msgid "See also the `Examples`_ subsection." msgstr "" +#: ../../library/asyncio-subprocess.rst:62 msgid "Creating Subprocesses" msgstr "" +#: ../../library/asyncio-subprocess.rst:68 msgid "Create a subprocess." msgstr "" -msgid "The *limit* argument sets the buffer limit for :class:`StreamReader` wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio.subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments)." +#: ../../library/asyncio-subprocess.rst:70 +#: ../../library/asyncio-subprocess.rst:92 +msgid "" +"The *limit* argument sets the buffer limit for :class:`StreamReader` " +"wrappers for :attr:`~asyncio.subprocess.Process.stdout` " +"and :attr:`~asyncio.subprocess.Process.stderr` (if :const:`subprocess.PIPE` " +"is passed to *stdout* and *stderr* arguments)." msgstr "" +#: ../../library/asyncio-subprocess.rst:74 +#: ../../library/asyncio-subprocess.rst:96 msgid "Return a :class:`~asyncio.subprocess.Process` instance." msgstr "" -msgid "See the documentation of :meth:`loop.subprocess_exec` for other parameters." +#: ../../library/asyncio-subprocess.rst:76 +msgid "" +"See the documentation of :meth:`loop.subprocess_exec` for other parameters." msgstr "" -msgid "If the process object is garbage collected while the process is still running, the child process will be killed." +#: ../../library/asyncio-subprocess.rst:79 +#: ../../library/asyncio-subprocess.rst:101 +msgid "" +"If the process object is garbage collected while the process is still " +"running, the child process will be killed." msgstr "" +#: ../../library/asyncio-subprocess.rst:82 +#: ../../library/asyncio-subprocess.rst:113 msgid "Removed the *loop* parameter." msgstr "" +#: ../../library/asyncio-subprocess.rst:90 msgid "Run the *cmd* shell command." msgstr "" -msgid "See the documentation of :meth:`loop.subprocess_shell` for other parameters." +#: ../../library/asyncio-subprocess.rst:98 +msgid "" +"See the documentation of :meth:`loop.subprocess_shell` for other parameters." msgstr "" -msgid "It is the application's responsibility to ensure that all whitespace and special characters are quoted appropriately to avoid `shell injection `_ vulnerabilities. The :func:`shlex.quote` function can be used to properly escape whitespace and special shell characters in strings that are going to be used to construct shell commands." +#: ../../library/asyncio-subprocess.rst:106 +msgid "" +"It is the application's responsibility to ensure that all whitespace and " +"special characters are quoted appropriately to avoid `shell injection " +"`_ " +"vulnerabilities. The :func:`shlex.quote` function can be used to properly " +"escape whitespace and special shell characters in strings that are going to " +"be used to construct shell commands." msgstr "" -msgid "Subprocesses are available for Windows if a :class:`ProactorEventLoop` is used. See :ref:`Subprocess Support on Windows ` for details." +#: ../../library/asyncio-subprocess.rst:118 +msgid "" +"Subprocesses are available for Windows if a :class:`ProactorEventLoop` is " +"used. See :ref:`Subprocess Support on Windows ` " +"for details." msgstr "" -msgid "asyncio also has the following *low-level* APIs to work with subprocesses: :meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop.connect_read_pipe`, :meth:`loop.connect_write_pipe`, as well as the :ref:`Subprocess Transports ` and :ref:`Subprocess Protocols `." +#: ../../library/asyncio-subprocess.rst:124 +msgid "" +"asyncio also has the following *low-level* APIs to work with " +"subprocesses: :meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop.connect_read_pipe`, :meth:`loop.connect_write_pipe`, " +"as well as the :ref:`Subprocess Transports ` " +"and :ref:`Subprocess Protocols `." msgstr "" +#: ../../library/asyncio-subprocess.rst:132 msgid "Constants" msgstr "" +#: ../../library/asyncio-subprocess.rst:137 msgid "Can be passed to the *stdin*, *stdout* or *stderr* parameters." msgstr "" -msgid "If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`~asyncio.StreamWriter` instance." +#: ../../library/asyncio-subprocess.rst:139 +msgid "" +"If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin " +"` attribute will point to " +"a :class:`~asyncio.StreamWriter` instance." msgstr "" -msgid "If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process.stdout ` and :attr:`Process.stderr ` attributes will point to :class:`~asyncio.StreamReader` instances." +#: ../../library/asyncio-subprocess.rst:143 +msgid "" +"If *PIPE* is passed to *stdout* or *stderr* arguments, " +"the :attr:`Process.stdout ` " +"and :attr:`Process.stderr ` attributes " +"will point to :class:`~asyncio.StreamReader` instances." msgstr "" -msgid "Special value that can be used as the *stderr* argument and indicates that standard error should be redirected into standard output." +#: ../../library/asyncio-subprocess.rst:151 +msgid "" +"Special value that can be used as the *stderr* argument and indicates that " +"standard error should be redirected into standard output." msgstr "" -msgid "Special value that can be used as the *stdin*, *stdout* or *stderr* argument to process creation functions. It indicates that the special file :data:`os.devnull` will be used for the corresponding subprocess stream." +#: ../../library/asyncio-subprocess.rst:157 +msgid "" +"Special value that can be used as the *stdin*, *stdout* or *stderr* argument " +"to process creation functions. It indicates that the special " +"file :data:`os.devnull` will be used for the corresponding subprocess stream." msgstr "" +#: ../../library/asyncio-subprocess.rst:163 msgid "Interacting with Subprocesses" msgstr "" -msgid "Both :func:`create_subprocess_exec` and :func:`create_subprocess_shell` functions return instances of the *Process* class. *Process* is a high-level wrapper that allows communicating with subprocesses and watching for their completion." +#: ../../library/asyncio-subprocess.rst:165 +msgid "" +"Both :func:`create_subprocess_exec` and :func:`create_subprocess_shell` " +"functions return instances of the *Process* class. *Process* is a high-" +"level wrapper that allows communicating with subprocesses and watching for " +"their completion." msgstr "" -msgid "An object that wraps OS processes created by the :func:`~asyncio.create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` functions." +#: ../../library/asyncio-subprocess.rst:173 +msgid "" +"An object that wraps OS processes created by " +"the :func:`~asyncio.create_subprocess_exec` " +"and :func:`~asyncio.create_subprocess_shell` functions." msgstr "" -msgid "This class is designed to have a similar API to the :class:`subprocess.Popen` class, but there are some notable differences:" +#: ../../library/asyncio-subprocess.rst:177 +msgid "" +"This class is designed to have a similar API to " +"the :class:`subprocess.Popen` class, but there are some notable differences:" msgstr "" -msgid "unlike Popen, Process instances do not have an equivalent to the :meth:`~subprocess.Popen.poll` method;" +#: ../../library/asyncio-subprocess.rst:181 +msgid "" +"unlike Popen, Process instances do not have an equivalent to " +"the :meth:`~subprocess.Popen.poll` method;" msgstr "" -msgid "the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio.subprocess.Process.wait` methods don't have a *timeout* parameter: use the :func:`~asyncio.wait_for` function;" +#: ../../library/asyncio-subprocess.rst:184 +msgid "" +"the :meth:`~asyncio.subprocess.Process.communicate` " +"and :meth:`~asyncio.subprocess.Process.wait` methods don't have a *timeout* " +"parameter: use the :func:`~asyncio.wait_for` function;" msgstr "" -msgid "the :meth:`Process.wait() ` method is asynchronous, whereas :meth:`subprocess.Popen.wait` method is implemented as a blocking busy loop;" +#: ../../library/asyncio-subprocess.rst:188 +msgid "" +"the :meth:`Process.wait() ` method is " +"asynchronous, whereas :meth:`subprocess.Popen.wait` method is implemented as " +"a blocking busy loop;" msgstr "" +#: ../../library/asyncio-subprocess.rst:192 msgid "the *universal_newlines* parameter is not supported." msgstr "" +#: ../../library/asyncio-subprocess.rst:194 msgid "This class is :ref:`not thread safe `." msgstr "" -msgid "See also the :ref:`Subprocess and Threads ` section." +#: ../../library/asyncio-subprocess.rst:196 +msgid "" +"See also the :ref:`Subprocess and Threads ` " +"section." msgstr "" +#: ../../library/asyncio-subprocess.rst:202 msgid "Wait for the child process to terminate." msgstr "" +#: ../../library/asyncio-subprocess.rst:204 msgid "Set and return the :attr:`returncode` attribute." msgstr "" -msgid "This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and the child process generates so much output that it blocks waiting for the OS pipe buffer to accept more data. Use the :meth:`communicate` method when using pipes to avoid this condition." +#: ../../library/asyncio-subprocess.rst:208 +msgid "" +"This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and " +"the child process generates so much output that it blocks waiting for the OS " +"pipe buffer to accept more data. Use the :meth:`communicate` method when " +"using pipes to avoid this condition." msgstr "" +#: ../../library/asyncio-subprocess.rst:217 msgid "Interact with process:" msgstr "" +#: ../../library/asyncio-subprocess.rst:219 msgid "send data to *stdin* (if *input* is not ``None``);" msgstr "" +#: ../../library/asyncio-subprocess.rst:220 msgid "closes *stdin*;" msgstr "" +#: ../../library/asyncio-subprocess.rst:221 msgid "read data from *stdout* and *stderr*, until EOF is reached;" msgstr "" +#: ../../library/asyncio-subprocess.rst:222 msgid "wait for process to terminate." msgstr "" -msgid "The optional *input* argument is the data (:class:`bytes` object) that will be sent to the child process." +#: ../../library/asyncio-subprocess.rst:224 +msgid "" +"The optional *input* argument is the data (:class:`bytes` object) that will " +"be sent to the child process." msgstr "" +#: ../../library/asyncio-subprocess.rst:227 msgid "Return a tuple ``(stdout_data, stderr_data)``." msgstr "" -msgid "If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is raised when writing *input* into *stdin*, the exception is ignored. This condition occurs when the process exits before all data are written into *stdin*." +#: ../../library/asyncio-subprocess.rst:229 +msgid "" +"If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is " +"raised when writing *input* into *stdin*, the exception is ignored. This " +"condition occurs when the process exits before all data are written into " +"*stdin*." msgstr "" -msgid "If it is desired to send data to the process' *stdin*, the process needs to be created with ``stdin=PIPE``. Similarly, to get anything other than ``None`` in the result tuple, the process has to be created with ``stdout=PIPE`` and/or ``stderr=PIPE`` arguments." +#: ../../library/asyncio-subprocess.rst:234 +msgid "" +"If it is desired to send data to the process' *stdin*, the process needs to " +"be created with ``stdin=PIPE``. Similarly, to get anything other than " +"``None`` in the result tuple, the process has to be created with " +"``stdout=PIPE`` and/or ``stderr=PIPE`` arguments." msgstr "" -msgid "Note, that the data read is buffered in memory, so do not use this method if the data size is large or unlimited." +#: ../../library/asyncio-subprocess.rst:240 +msgid "" +"Note, that the data read is buffered in memory, so do not use this method if " +"the data size is large or unlimited." msgstr "" +#: ../../library/asyncio-subprocess.rst:245 msgid "*stdin* gets closed when ``input=None`` too." msgstr "" +#: ../../library/asyncio-subprocess.rst:249 msgid "Sends the signal *signal* to the child process." msgstr "" -msgid "On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. ``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." +#: ../../library/asyncio-subprocess.rst:253 +msgid "" +"On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. " +"``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started " +"with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" +#: ../../library/asyncio-subprocess.rst:260 msgid "Stop the child process." msgstr "" -msgid "On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child process." +#: ../../library/asyncio-subprocess.rst:262 +msgid "" +"On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child " +"process." msgstr "" -msgid "On Windows the Win32 API function :c:func:`!TerminateProcess` is called to stop the child process." +#: ../../library/asyncio-subprocess.rst:265 +msgid "" +"On Windows the Win32 API function :c:func:`!TerminateProcess` is called to " +"stop the child process." msgstr "" +#: ../../library/asyncio-subprocess.rst:270 msgid "Kill the child process." msgstr "" -msgid "On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child process." +#: ../../library/asyncio-subprocess.rst:272 +msgid "" +"On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child " +"process." msgstr "" +#: ../../library/asyncio-subprocess.rst:275 msgid "On Windows this method is an alias for :meth:`terminate`." msgstr "" -msgid "Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the process was created with ``stdin=None``." +#: ../../library/asyncio-subprocess.rst:279 +msgid "" +"Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the " +"process was created with ``stdin=None``." msgstr "" -msgid "Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the process was created with ``stdout=None``." +#: ../../library/asyncio-subprocess.rst:284 +msgid "" +"Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stdout=None``." msgstr "" -msgid "Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the process was created with ``stderr=None``." +#: ../../library/asyncio-subprocess.rst:289 +msgid "" +"Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stderr=None``." msgstr "" -msgid "Use the :meth:`communicate` method rather than :attr:`process.stdin.write() `, :attr:`await process.stdout.read() ` or :attr:`await process.stderr.read() `. This avoids deadlocks due to streams pausing reading or writing and blocking the child process." +#: ../../library/asyncio-subprocess.rst:294 +msgid "" +"Use the :meth:`communicate` method rather than :attr:`process.stdin.write() " +"`, :attr:`await process.stdout.read() ` or :attr:`await " +"process.stderr.read() `. This avoids deadlocks due to streams " +"pausing reading or writing and blocking the child process." msgstr "" +#: ../../library/asyncio-subprocess.rst:303 msgid "Process identification number (PID)." msgstr "" -msgid "Note that for processes created by the :func:`~asyncio.create_subprocess_shell` function, this attribute is the PID of the spawned shell." +#: ../../library/asyncio-subprocess.rst:305 +msgid "" +"Note that for processes created by " +"the :func:`~asyncio.create_subprocess_shell` function, this attribute is the " +"PID of the spawned shell." msgstr "" +#: ../../library/asyncio-subprocess.rst:310 msgid "Return code of the process when it exits." msgstr "" +#: ../../library/asyncio-subprocess.rst:312 msgid "A ``None`` value indicates that the process has not terminated yet." msgstr "" -msgid "For processes created with :func:`~asyncio.create_subprocess_exec`, a negative value ``-N`` indicates that the child was terminated by signal ``N`` (POSIX only)." +#: ../../library/asyncio-subprocess.rst:314 +msgid "" +"For processes created with :func:`~asyncio.create_subprocess_exec`, a " +"negative value ``-N`` indicates that the child was terminated by signal " +"``N`` (POSIX only)." msgstr "" -msgid "For processes created with :func:`~asyncio.create_subprocess_shell`, the return code reflects the exit status of the shell itself (e.g. ``/bin/sh``), which may map signals to codes such as ``128+N``. See the documentation of the shell (for example, the Bash manual's Exit Status) for details." +#: ../../library/asyncio-subprocess.rst:318 +msgid "" +"For processes created with :func:`~asyncio.create_subprocess_shell`, the " +"return code reflects the exit status of the shell itself (e.g. ``/bin/sh``), " +"which may map signals to codes such as ``128+N``. See the documentation of " +"the shell (for example, the Bash manual's Exit Status) for details." msgstr "" +#: ../../library/asyncio-subprocess.rst:329 msgid "Subprocess and Threads" msgstr "" -msgid "Standard asyncio event loop supports running subprocesses from different threads by default." +#: ../../library/asyncio-subprocess.rst:331 +msgid "" +"Standard asyncio event loop supports running subprocesses from different " +"threads by default." msgstr "" -msgid "On Windows subprocesses are provided by :class:`ProactorEventLoop` only (default), :class:`SelectorEventLoop` has no subprocess support." +#: ../../library/asyncio-subprocess.rst:334 +msgid "" +"On Windows subprocesses are provided by :class:`ProactorEventLoop` only " +"(default), :class:`SelectorEventLoop` has no subprocess support." msgstr "" -msgid "Note that alternative event loop implementations might have own limitations; please refer to their documentation." +#: ../../library/asyncio-subprocess.rst:337 +msgid "" +"Note that alternative event loop implementations might have own limitations; " +"please refer to their documentation." msgstr "" -msgid "The :ref:`Concurrency and multithreading in asyncio ` section." +#: ../../library/asyncio-subprocess.rst:342 +msgid "" +"The :ref:`Concurrency and multithreading in asyncio ` section." msgstr "" +#: ../../library/asyncio-subprocess.rst:347 msgid "Examples" msgstr "" -msgid "An example using the :class:`~asyncio.subprocess.Process` class to control a subprocess and the :class:`StreamReader` class to read from its standard output." +#: ../../library/asyncio-subprocess.rst:349 +msgid "" +"An example using the :class:`~asyncio.subprocess.Process` class to control a " +"subprocess and the :class:`StreamReader` class to read from its standard " +"output." msgstr "" -msgid "The subprocess is created by the :func:`create_subprocess_exec` function::" +#: ../../library/asyncio-subprocess.rst:355 +msgid "" +"The subprocess is created by the :func:`create_subprocess_exec` function::" msgstr "" +#: ../../library/asyncio-subprocess.rst:358 msgid "" "import asyncio\n" "import sys\n" @@ -310,5 +512,8 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -msgid "See also the :ref:`same example ` written using low-level APIs." +#: ../../library/asyncio-subprocess.rst:382 +msgid "" +"See also the :ref:`same example ` written " +"using low-level APIs." msgstr "" diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index bb1a3c9e7..c5357795e 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,54 +23,80 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-sync.rst:7 msgid "Synchronization Primitives" msgstr "" +#: ../../library/asyncio-sync.rst:9 msgid "**Source code:** :source:`Lib/asyncio/locks.py`" msgstr "" -msgid "asyncio synchronization primitives are designed to be similar to those of the :mod:`threading` module with two important caveats:" +#: ../../library/asyncio-sync.rst:13 +msgid "" +"asyncio synchronization primitives are designed to be similar to those of " +"the :mod:`threading` module with two important caveats:" msgstr "" -msgid "asyncio primitives are not thread-safe, therefore they should not be used for OS thread synchronization (use :mod:`threading` for that);" +#: ../../library/asyncio-sync.rst:16 +msgid "" +"asyncio primitives are not thread-safe, therefore they should not be used " +"for OS thread synchronization (use :mod:`threading` for that);" msgstr "" -msgid "methods of these synchronization primitives do not accept the *timeout* argument; use the :func:`asyncio.wait_for` function to perform operations with timeouts." +#: ../../library/asyncio-sync.rst:20 +msgid "" +"methods of these synchronization primitives do not accept the *timeout* " +"argument; use the :func:`asyncio.wait_for` function to perform operations " +"with timeouts." msgstr "" +#: ../../library/asyncio-sync.rst:24 msgid "asyncio has the following basic synchronization primitives:" msgstr "" +#: ../../library/asyncio-sync.rst:26 msgid ":class:`Lock`" msgstr "" +#: ../../library/asyncio-sync.rst:27 msgid ":class:`Event`" msgstr "" +#: ../../library/asyncio-sync.rst:28 msgid ":class:`Condition`" msgstr "" +#: ../../library/asyncio-sync.rst:29 msgid ":class:`Semaphore`" msgstr "" +#: ../../library/asyncio-sync.rst:30 msgid ":class:`BoundedSemaphore`" msgstr "" +#: ../../library/asyncio-sync.rst:31 msgid ":class:`Barrier`" msgstr "" +#: ../../library/asyncio-sync.rst:38 msgid "Lock" msgstr "" +#: ../../library/asyncio-sync.rst:42 msgid "Implements a mutex lock for asyncio tasks. Not thread-safe." msgstr "" -msgid "An asyncio lock can be used to guarantee exclusive access to a shared resource." +#: ../../library/asyncio-sync.rst:44 +msgid "" +"An asyncio lock can be used to guarantee exclusive access to a shared " +"resource." msgstr "" +#: ../../library/asyncio-sync.rst:47 msgid "The preferred way to use a Lock is an :keyword:`async with` statement::" msgstr "" +#: ../../library/asyncio-sync.rst:50 msgid "" "lock = asyncio.Lock()\n" "\n" @@ -79,9 +105,12 @@ msgid "" " # access shared state" msgstr "" +#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:309 msgid "which is equivalent to::" msgstr "" +#: ../../library/asyncio-sync.rst:58 msgid "" "lock = asyncio.Lock()\n" "\n" @@ -93,48 +122,77 @@ msgid "" " lock.release()" msgstr "" +#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:113 +#: ../../library/asyncio-sync.rst:189 ../../library/asyncio-sync.rst:297 +#: ../../library/asyncio-sync.rst:353 msgid "Removed the *loop* parameter." msgstr "" +#: ../../library/asyncio-sync.rst:73 msgid "Acquire the lock." msgstr "" -msgid "This method waits until the lock is *unlocked*, sets it to *locked* and returns ``True``." +#: ../../library/asyncio-sync.rst:75 +msgid "" +"This method waits until the lock is *unlocked*, sets it to *locked* and " +"returns ``True``." msgstr "" -msgid "When more than one coroutine is blocked in :meth:`acquire` waiting for the lock to be unlocked, only one coroutine eventually proceeds." +#: ../../library/asyncio-sync.rst:78 +msgid "" +"When more than one coroutine is blocked in :meth:`acquire` waiting for the " +"lock to be unlocked, only one coroutine eventually proceeds." msgstr "" -msgid "Acquiring a lock is *fair*: the coroutine that proceeds will be the first coroutine that started waiting on the lock." +#: ../../library/asyncio-sync.rst:82 +msgid "" +"Acquiring a lock is *fair*: the coroutine that proceeds will be the first " +"coroutine that started waiting on the lock." msgstr "" +#: ../../library/asyncio-sync.rst:87 msgid "Release the lock." msgstr "" +#: ../../library/asyncio-sync.rst:89 msgid "When the lock is *locked*, reset it to *unlocked* and return." msgstr "" +#: ../../library/asyncio-sync.rst:91 msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised." msgstr "" +#: ../../library/asyncio-sync.rst:95 msgid "Return ``True`` if the lock is *locked*." msgstr "" +#: ../../library/asyncio-sync.rst:99 msgid "Event" msgstr "" +#: ../../library/asyncio-sync.rst:103 msgid "An event object. Not thread-safe." msgstr "" -msgid "An asyncio event can be used to notify multiple asyncio tasks that some event has happened." +#: ../../library/asyncio-sync.rst:105 +msgid "" +"An asyncio event can be used to notify multiple asyncio tasks that some " +"event has happened." msgstr "" -msgid "An Event object manages an internal flag that can be set to *true* with the :meth:`~Event.set` method and reset to *false* with the :meth:`clear` method. The :meth:`~Event.wait` method blocks until the flag is set to *true*. The flag is set to *false* initially." +#: ../../library/asyncio-sync.rst:108 +msgid "" +"An Event object manages an internal flag that can be set to *true* with " +"the :meth:`~Event.set` method and reset to *false* with the :meth:`clear` " +"method. The :meth:`~Event.wait` method blocks until the flag is set to " +"*true*. The flag is set to *false* initially." msgstr "" +#: ../../library/asyncio-sync.rst:118 ../../library/asyncio-sync.rst:377 msgid "Example::" msgstr "" +#: ../../library/asyncio-sync.rst:120 msgid "" "async def waiter(event):\n" " print('waiting for it ...')\n" @@ -158,45 +216,73 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-sync.rst:144 msgid "Wait until the event is set." msgstr "" -msgid "If the event is set, return ``True`` immediately. Otherwise block until another task calls :meth:`~Event.set`." +#: ../../library/asyncio-sync.rst:146 +msgid "" +"If the event is set, return ``True`` immediately. Otherwise block until " +"another task calls :meth:`~Event.set`." msgstr "" +#: ../../library/asyncio-sync.rst:151 msgid "Set the event." msgstr "" +#: ../../library/asyncio-sync.rst:153 msgid "All tasks waiting for event to be set will be immediately awakened." msgstr "" +#: ../../library/asyncio-sync.rst:158 msgid "Clear (unset) the event." msgstr "" -msgid "Subsequent tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event.set` method is called again." +#: ../../library/asyncio-sync.rst:160 +msgid "" +"Subsequent tasks awaiting on :meth:`~Event.wait` will now block until " +"the :meth:`~Event.set` method is called again." msgstr "" +#: ../../library/asyncio-sync.rst:165 msgid "Return ``True`` if the event is set." msgstr "" +#: ../../library/asyncio-sync.rst:169 msgid "Condition" msgstr "" +#: ../../library/asyncio-sync.rst:173 msgid "A Condition object. Not thread-safe." msgstr "" -msgid "An asyncio condition primitive can be used by a task to wait for some event to happen and then get exclusive access to a shared resource." +#: ../../library/asyncio-sync.rst:175 +msgid "" +"An asyncio condition primitive can be used by a task to wait for some event " +"to happen and then get exclusive access to a shared resource." msgstr "" -msgid "In essence, a Condition object combines the functionality of an :class:`Event` and a :class:`Lock`. It is possible to have multiple Condition objects share one Lock, which allows coordinating exclusive access to a shared resource between different tasks interested in particular states of that shared resource." +#: ../../library/asyncio-sync.rst:179 +msgid "" +"In essence, a Condition object combines the functionality of " +"an :class:`Event` and a :class:`Lock`. It is possible to have multiple " +"Condition objects share one Lock, which allows coordinating exclusive access " +"to a shared resource between different tasks interested in particular states " +"of that shared resource." msgstr "" -msgid "The optional *lock* argument must be a :class:`Lock` object or ``None``. In the latter case a new Lock object is created automatically." +#: ../../library/asyncio-sync.rst:185 +msgid "" +"The optional *lock* argument must be a :class:`Lock` object or ``None``. In " +"the latter case a new Lock object is created automatically." msgstr "" -msgid "The preferred way to use a Condition is an :keyword:`async with` statement::" +#: ../../library/asyncio-sync.rst:192 +msgid "" +"The preferred way to use a Condition is an :keyword:`async with` statement::" msgstr "" +#: ../../library/asyncio-sync.rst:195 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -205,6 +291,7 @@ msgid "" " await cond.wait()" msgstr "" +#: ../../library/asyncio-sync.rst:203 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -216,66 +303,114 @@ msgid "" " cond.release()" msgstr "" +#: ../../library/asyncio-sync.rst:215 msgid "Acquire the underlying lock." msgstr "" -msgid "This method waits until the underlying lock is *unlocked*, sets it to *locked* and returns ``True``." +#: ../../library/asyncio-sync.rst:217 +msgid "" +"This method waits until the underlying lock is *unlocked*, sets it to " +"*locked* and returns ``True``." msgstr "" -msgid "Wake up *n* tasks (1 by default) waiting on this condition. If fewer than *n* tasks are waiting they are all awakened." +#: ../../library/asyncio-sync.rst:222 +msgid "" +"Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " +"*n* tasks are waiting they are all awakened." msgstr "" -msgid "The lock must be acquired before this method is called and released shortly after. If called with an *unlocked* lock a :exc:`RuntimeError` error is raised." +#: ../../library/asyncio-sync.rst:225 ../../library/asyncio-sync.rst:240 +msgid "" +"The lock must be acquired before this method is called and released shortly " +"after. If called with an *unlocked* lock a :exc:`RuntimeError` error is " +"raised." msgstr "" +#: ../../library/asyncio-sync.rst:231 msgid "Return ``True`` if the underlying lock is acquired." msgstr "" +#: ../../library/asyncio-sync.rst:235 msgid "Wake up all tasks waiting on this condition." msgstr "" +#: ../../library/asyncio-sync.rst:237 msgid "This method acts like :meth:`notify`, but wakes up all waiting tasks." msgstr "" +#: ../../library/asyncio-sync.rst:246 msgid "Release the underlying lock." msgstr "" +#: ../../library/asyncio-sync.rst:248 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "" +#: ../../library/asyncio-sync.rst:254 msgid "Wait until notified." msgstr "" -msgid "If the calling task has not acquired the lock when this method is called, a :exc:`RuntimeError` is raised." +#: ../../library/asyncio-sync.rst:256 +msgid "" +"If the calling task has not acquired the lock when this method is called, " +"a :exc:`RuntimeError` is raised." msgstr "" -msgid "This method releases the underlying lock, and then blocks until it is awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the Condition re-acquires its lock and this method returns ``True``." +#: ../../library/asyncio-sync.rst:259 +msgid "" +"This method releases the underlying lock, and then blocks until it is " +"awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " +"Condition re-acquires its lock and this method returns ``True``." msgstr "" -msgid "Note that a task *may* return from this call spuriously, which is why the caller should always re-check the state and be prepared to :meth:`~Condition.wait` again. For this reason, you may prefer to use :meth:`~Condition.wait_for` instead." +#: ../../library/asyncio-sync.rst:264 +msgid "" +"Note that a task *may* return from this call spuriously, which is why the " +"caller should always re-check the state and be prepared " +"to :meth:`~Condition.wait` again. For this reason, you may prefer to " +"use :meth:`~Condition.wait_for` instead." msgstr "" +#: ../../library/asyncio-sync.rst:272 msgid "Wait until a predicate becomes *true*." msgstr "" -msgid "The predicate must be a callable which result will be interpreted as a boolean value. The method will repeatedly :meth:`~Condition.wait` until the predicate evaluates to *true*. The final value is the return value." +#: ../../library/asyncio-sync.rst:274 +msgid "" +"The predicate must be a callable which result will be interpreted as a " +"boolean value. The method will repeatedly :meth:`~Condition.wait` until the " +"predicate evaluates to *true*. The final value is the return value." msgstr "" +#: ../../library/asyncio-sync.rst:281 msgid "Semaphore" msgstr "" +#: ../../library/asyncio-sync.rst:285 msgid "A Semaphore object. Not thread-safe." msgstr "" -msgid "A semaphore manages an internal counter which is decremented by each :meth:`acquire` call and incremented by each :meth:`release` call. The counter can never go below zero; when :meth:`acquire` finds that it is zero, it blocks, waiting until some task calls :meth:`release`." +#: ../../library/asyncio-sync.rst:287 +msgid "" +"A semaphore manages an internal counter which is decremented by " +"each :meth:`acquire` call and incremented by each :meth:`release` call. The " +"counter can never go below zero; when :meth:`acquire` finds that it is zero, " +"it blocks, waiting until some task calls :meth:`release`." msgstr "" -msgid "The optional *value* argument gives the initial value for the internal counter (``1`` by default). If the given value is less than ``0`` a :exc:`ValueError` is raised." +#: ../../library/asyncio-sync.rst:293 +msgid "" +"The optional *value* argument gives the initial value for the internal " +"counter (``1`` by default). If the given value is less than ``0`` " +"a :exc:`ValueError` is raised." msgstr "" -msgid "The preferred way to use a Semaphore is an :keyword:`async with` statement::" +#: ../../library/asyncio-sync.rst:300 +msgid "" +"The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "" +#: ../../library/asyncio-sync.rst:303 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -284,6 +419,7 @@ msgid "" " # work with shared resource" msgstr "" +#: ../../library/asyncio-sync.rst:311 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -295,45 +431,76 @@ msgid "" " sem.release()" msgstr "" +#: ../../library/asyncio-sync.rst:323 msgid "Acquire a semaphore." msgstr "" -msgid "If the internal counter is greater than zero, decrement it by one and return ``True`` immediately. If it is zero, wait until a :meth:`release` is called and return ``True``." +#: ../../library/asyncio-sync.rst:325 +msgid "" +"If the internal counter is greater than zero, decrement it by one and return " +"``True`` immediately. If it is zero, wait until a :meth:`release` is called " +"and return ``True``." msgstr "" +#: ../../library/asyncio-sync.rst:331 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "" -msgid "Release a semaphore, incrementing the internal counter by one. Can wake up a task waiting to acquire the semaphore." +#: ../../library/asyncio-sync.rst:335 +msgid "" +"Release a semaphore, incrementing the internal counter by one. Can wake up a " +"task waiting to acquire the semaphore." msgstr "" -msgid "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more ``release()`` calls than ``acquire()`` calls." +#: ../../library/asyncio-sync.rst:338 +msgid "" +"Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " +"``release()`` calls than ``acquire()`` calls." msgstr "" +#: ../../library/asyncio-sync.rst:343 msgid "BoundedSemaphore" msgstr "" +#: ../../library/asyncio-sync.rst:347 msgid "A bounded semaphore object. Not thread-safe." msgstr "" -msgid "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:`ValueError` in :meth:`~Semaphore.release` if it increases the internal counter above the initial *value*." +#: ../../library/asyncio-sync.rst:349 +msgid "" +"Bounded Semaphore is a version of :class:`Semaphore` that raises " +"a :exc:`ValueError` in :meth:`~Semaphore.release` if it increases the " +"internal counter above the initial *value*." msgstr "" +#: ../../library/asyncio-sync.rst:358 msgid "Barrier" msgstr "" +#: ../../library/asyncio-sync.rst:362 msgid "A barrier object. Not thread-safe." msgstr "" -msgid "A barrier is a simple synchronization primitive that allows to block until *parties* number of tasks are waiting on it. Tasks can wait on the :meth:`~Barrier.wait` method and would be blocked until the specified number of tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the waiting tasks would unblock simultaneously." +#: ../../library/asyncio-sync.rst:364 +msgid "" +"A barrier is a simple synchronization primitive that allows to block until " +"*parties* number of tasks are waiting on it. Tasks can wait on " +"the :meth:`~Barrier.wait` method and would be blocked until the specified " +"number of tasks end up waiting on :meth:`~Barrier.wait`. At that point all " +"of the waiting tasks would unblock simultaneously." msgstr "" -msgid ":keyword:`async with` can be used as an alternative to awaiting on :meth:`~Barrier.wait`." +#: ../../library/asyncio-sync.rst:370 +msgid "" +":keyword:`async with` can be used as an alternative to awaiting " +"on :meth:`~Barrier.wait`." msgstr "" +#: ../../library/asyncio-sync.rst:373 msgid "The barrier can be reused any number of times." msgstr "" +#: ../../library/asyncio-sync.rst:379 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -357,9 +524,11 @@ msgid "" "asyncio.run(example_barrier())" msgstr "" +#: ../../library/asyncio-sync.rst:400 msgid "Result of this example is::" msgstr "" +#: ../../library/asyncio-sync.rst:402 msgid "" "\n" "\n" @@ -367,15 +536,27 @@ msgid "" "" msgstr "" -msgid "Pass the barrier. When all the tasks party to the barrier have called this function, they are all unblocked simultaneously." +#: ../../library/asyncio-sync.rst:412 +msgid "" +"Pass the barrier. When all the tasks party to the barrier have called this " +"function, they are all unblocked simultaneously." msgstr "" -msgid "When a waiting or blocked task in the barrier is cancelled, this task exits the barrier which stays in the same state. If the state of the barrier is \"filling\", the number of waiting task decreases by 1." +#: ../../library/asyncio-sync.rst:415 +msgid "" +"When a waiting or blocked task in the barrier is cancelled, this task exits " +"the barrier which stays in the same state. If the state of the barrier is " +"\"filling\", the number of waiting task decreases by 1." msgstr "" -msgid "The return value is an integer in the range of 0 to ``parties-1``, different for each task. This can be used to select a task to do some special housekeeping, e.g.::" +#: ../../library/asyncio-sync.rst:420 +msgid "" +"The return value is an integer in the range of 0 to ``parties-1``, different " +"for each task. This can be used to select a task to do some special " +"housekeeping, e.g.::" msgstr "" +#: ../../library/asyncio-sync.rst:424 msgid "" "...\n" "async with barrier as position:\n" @@ -384,29 +565,54 @@ msgid "" " print('End of *draining phase*')" msgstr "" -msgid "This method may raise a :class:`BrokenBarrierError` exception if the barrier is broken or reset while a task is waiting. It could raise a :exc:`CancelledError` if a task is cancelled." +#: ../../library/asyncio-sync.rst:430 +msgid "" +"This method may raise a :class:`BrokenBarrierError` exception if the barrier " +"is broken or reset while a task is waiting. It could raise " +"a :exc:`CancelledError` if a task is cancelled." msgstr "" -msgid "Return the barrier to the default, empty state. Any tasks waiting on it will receive the :class:`BrokenBarrierError` exception." +#: ../../library/asyncio-sync.rst:437 +msgid "" +"Return the barrier to the default, empty state. Any tasks waiting on it " +"will receive the :class:`BrokenBarrierError` exception." msgstr "" -msgid "If a barrier is broken it may be better to just leave it and create a new one." +#: ../../library/asyncio-sync.rst:440 +msgid "" +"If a barrier is broken it may be better to just leave it and create a new " +"one." msgstr "" -msgid "Put the barrier into a broken state. This causes any active or future calls to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use this for example if one of the tasks needs to abort, to avoid infinite waiting tasks." +#: ../../library/asyncio-sync.rst:445 +msgid "" +"Put the barrier into a broken state. This causes any active or future calls " +"to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " +"this for example if one of the tasks needs to abort, to avoid infinite " +"waiting tasks." msgstr "" +#: ../../library/asyncio-sync.rst:452 msgid "The number of tasks required to pass the barrier." msgstr "" +#: ../../library/asyncio-sync.rst:456 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" +#: ../../library/asyncio-sync.rst:460 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -msgid "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:`Barrier` object is reset or broken." +#: ../../library/asyncio-sync.rst:465 +msgid "" +"This exception, a subclass of :exc:`RuntimeError`, is raised when " +"the :class:`Barrier` object is reset or broken." msgstr "" -msgid "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:`with` statement (``with await lock``, ``with (yield from lock)``) was removed. Use ``async with lock`` instead." +#: ../../library/asyncio-sync.rst:473 +msgid "" +"Acquiring a lock using ``await lock`` or ``yield from lock`` and/" +"or :keyword:`with` statement (``with await lock``, ``with (yield from " +"lock)``) was removed. Use ``async with lock`` instead." msgstr "" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index cf782bf92..2bc566682 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,21 +23,32 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio-task.rst:6 msgid "Coroutines and tasks" msgstr "" -msgid "This section outlines high-level asyncio APIs to work with coroutines and Tasks." +#: ../../library/asyncio-task.rst:8 +msgid "" +"This section outlines high-level asyncio APIs to work with coroutines and " +"Tasks." msgstr "" +#: ../../library/asyncio-task.rst:19 ../../library/asyncio-task.rst:148 msgid "Coroutines" msgstr "" +#: ../../library/asyncio-task.rst:21 msgid "**Source code:** :source:`Lib/asyncio/coroutines.py`" msgstr "" -msgid ":term:`Coroutines ` declared with the async/await syntax is the preferred way of writing asyncio applications. For example, the following snippet of code prints \"hello\", waits 1 second, and then prints \"world\"::" +#: ../../library/asyncio-task.rst:25 +msgid "" +":term:`Coroutines ` declared with the async/await syntax is the " +"preferred way of writing asyncio applications. For example, the following " +"snippet of code prints \"hello\", waits 1 second, and then prints \"world\"::" msgstr "" +#: ../../library/asyncio-task.rst:30 msgid "" ">>> import asyncio\n" "\n" @@ -51,23 +62,35 @@ msgid "" "world" msgstr "" -msgid "Note that simply calling a coroutine will not schedule it to be executed::" +#: ../../library/asyncio-task.rst:41 +msgid "" +"Note that simply calling a coroutine will not schedule it to be executed::" msgstr "" +#: ../../library/asyncio-task.rst:44 msgid "" ">>> main()\n" "" msgstr "" +#: ../../library/asyncio-task.rst:47 msgid "To actually run a coroutine, asyncio provides the following mechanisms:" msgstr "" -msgid "The :func:`asyncio.run` function to run the top-level entry point \"main()\" function (see the above example.)" +#: ../../library/asyncio-task.rst:49 +msgid "" +"The :func:`asyncio.run` function to run the top-level entry point \"main()\" " +"function (see the above example.)" msgstr "" -msgid "Awaiting on a coroutine. The following snippet of code will print \"hello\" after waiting for 1 second, and then print \"world\" after waiting for *another* 2 seconds::" +#: ../../library/asyncio-task.rst:52 +msgid "" +"Awaiting on a coroutine. The following snippet of code will print \"hello\" " +"after waiting for 1 second, and then print \"world\" after waiting for " +"*another* 2 seconds::" msgstr "" +#: ../../library/asyncio-task.rst:56 msgid "" "import asyncio\n" "import time\n" @@ -87,9 +110,11 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-task.rst:73 msgid "Expected output::" msgstr "" +#: ../../library/asyncio-task.rst:75 msgid "" "started at 17:13:52\n" "hello\n" @@ -97,12 +122,19 @@ msgid "" "finished at 17:13:55" msgstr "" -msgid "The :func:`asyncio.create_task` function to run coroutines concurrently as asyncio :class:`Tasks `." +#: ../../library/asyncio-task.rst:80 +msgid "" +"The :func:`asyncio.create_task` function to run coroutines concurrently as " +"asyncio :class:`Tasks `." msgstr "" -msgid "Let's modify the above example and run two ``say_after`` coroutines *concurrently*::" +#: ../../library/asyncio-task.rst:83 +msgid "" +"Let's modify the above example and run two ``say_after`` coroutines " +"*concurrently*::" msgstr "" +#: ../../library/asyncio-task.rst:86 msgid "" "async def main():\n" " task1 = asyncio.create_task(\n" @@ -121,9 +153,13 @@ msgid "" " print(f\"finished at {time.strftime('%X')}\")" msgstr "" -msgid "Note that expected output now shows that the snippet runs 1 second faster than before::" +#: ../../library/asyncio-task.rst:102 +msgid "" +"Note that expected output now shows that the snippet runs 1 second faster " +"than before::" msgstr "" +#: ../../library/asyncio-task.rst:105 msgid "" "started at 17:14:32\n" "hello\n" @@ -131,9 +167,13 @@ msgid "" "finished at 17:14:34" msgstr "" -msgid "The :class:`asyncio.TaskGroup` class provides a more modern alternative to :func:`create_task`. Using this API, the last example becomes::" +#: ../../library/asyncio-task.rst:110 +msgid "" +"The :class:`asyncio.TaskGroup` class provides a more modern alternative " +"to :func:`create_task`. Using this API, the last example becomes::" msgstr "" +#: ../../library/asyncio-task.rst:114 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" @@ -150,24 +190,38 @@ msgid "" " print(f\"finished at {time.strftime('%X')}\")" msgstr "" +#: ../../library/asyncio-task.rst:128 msgid "The timing and output should be the same as for the previous version." msgstr "" +#: ../../library/asyncio-task.rst:130 msgid ":class:`asyncio.TaskGroup`." msgstr "" +#: ../../library/asyncio-task.rst:137 msgid "Awaitables" msgstr "" -msgid "We say that an object is an **awaitable** object if it can be used in an :keyword:`await` expression. Many asyncio APIs are designed to accept awaitables." +#: ../../library/asyncio-task.rst:139 +msgid "" +"We say that an object is an **awaitable** object if it can be used in " +"an :keyword:`await` expression. Many asyncio APIs are designed to accept " +"awaitables." msgstr "" -msgid "There are three main types of *awaitable* objects: **coroutines**, **Tasks**, and **Futures**." +#: ../../library/asyncio-task.rst:143 +msgid "" +"There are three main types of *awaitable* objects: **coroutines**, " +"**Tasks**, and **Futures**." msgstr "" -msgid "Python coroutines are *awaitables* and therefore can be awaited from other coroutines::" +#: ../../library/asyncio-task.rst:149 +msgid "" +"Python coroutines are *awaitables* and therefore can be awaited from other " +"coroutines::" msgstr "" +#: ../../library/asyncio-task.rst:152 msgid "" "import asyncio\n" "\n" @@ -186,24 +240,37 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "In this documentation the term \"coroutine\" can be used for two closely related concepts:" +#: ../../library/asyncio-task.rst:170 +msgid "" +"In this documentation the term \"coroutine\" can be used for two closely " +"related concepts:" msgstr "" +#: ../../library/asyncio-task.rst:173 msgid "a *coroutine function*: an :keyword:`async def` function;" msgstr "" -msgid "a *coroutine object*: an object returned by calling a *coroutine function*." +#: ../../library/asyncio-task.rst:175 +msgid "" +"a *coroutine object*: an object returned by calling a *coroutine function*." msgstr "" +#: ../../library/asyncio-task.rst:180 msgid "Tasks" msgstr "" +#: ../../library/asyncio-task.rst:181 msgid "*Tasks* are used to schedule coroutines *concurrently*." msgstr "" -msgid "When a coroutine is wrapped into a *Task* with functions like :func:`asyncio.create_task` the coroutine is automatically scheduled to run soon::" +#: ../../library/asyncio-task.rst:183 +msgid "" +"When a coroutine is wrapped into a *Task* with functions " +"like :func:`asyncio.create_task` the coroutine is automatically scheduled to " +"run soon::" msgstr "" +#: ../../library/asyncio-task.rst:187 msgid "" "import asyncio\n" "\n" @@ -222,24 +289,41 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-task.rst:205 msgid "Futures" msgstr "" -msgid "A :class:`Future` is a special **low-level** awaitable object that represents an **eventual result** of an asynchronous operation." +#: ../../library/asyncio-task.rst:206 +msgid "" +"A :class:`Future` is a special **low-level** awaitable object that " +"represents an **eventual result** of an asynchronous operation." msgstr "" -msgid "When a Future object is *awaited* it means that the coroutine will wait until the Future is resolved in some other place." +#: ../../library/asyncio-task.rst:209 +msgid "" +"When a Future object is *awaited* it means that the coroutine will wait " +"until the Future is resolved in some other place." msgstr "" -msgid "Future objects in asyncio are needed to allow callback-based code to be used with async/await." +#: ../../library/asyncio-task.rst:212 +msgid "" +"Future objects in asyncio are needed to allow callback-based code to be used " +"with async/await." msgstr "" -msgid "Normally **there is no need** to create Future objects at the application level code." +#: ../../library/asyncio-task.rst:215 +msgid "" +"Normally **there is no need** to create Future objects at the application " +"level code." msgstr "" -msgid "Future objects, sometimes exposed by libraries and some asyncio APIs, can be awaited::" +#: ../../library/asyncio-task.rst:218 +msgid "" +"Future objects, sometimes exposed by libraries and some asyncio APIs, can be " +"awaited::" msgstr "" +#: ../../library/asyncio-task.rst:221 msgid "" "async def main():\n" " await function_that_returns_a_future_object()\n" @@ -251,36 +335,72 @@ msgid "" " )" msgstr "" -msgid "A good example of a low-level function that returns a Future object is :meth:`loop.run_in_executor`." +#: ../../library/asyncio-task.rst:230 +msgid "" +"A good example of a low-level function that returns a Future object " +"is :meth:`loop.run_in_executor`." msgstr "" +#: ../../library/asyncio-task.rst:235 msgid "Creating tasks" msgstr "" +#: ../../library/asyncio-task.rst:237 msgid "**Source code:** :source:`Lib/asyncio/tasks.py`" msgstr "" -msgid "Wrap the *coro* :ref:`coroutine ` into a :class:`Task` and schedule its execution. Return the Task object." +#: ../../library/asyncio-task.rst:243 +msgid "" +"Wrap the *coro* :ref:`coroutine ` into a :class:`Task` and " +"schedule its execution. Return the Task object." msgstr "" -msgid "The full function signature is largely the same as that of the :class:`Task` constructor (or factory) - all of the keyword arguments to this function are passed through to that interface." +#: ../../library/asyncio-task.rst:246 +msgid "" +"The full function signature is largely the same as that of the :class:`Task` " +"constructor (or factory) - all of the keyword arguments to this function are " +"passed through to that interface." msgstr "" -msgid "An optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the *coro* to run in. The current context copy is created when no *context* is provided." +#: ../../library/asyncio-task.rst:250 +msgid "" +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" -msgid "An optional keyword-only *eager_start* argument allows specifying if the task should execute eagerly during the call to create_task, or be scheduled later. If *eager_start* is not passed the mode set by :meth:`loop.set_task_factory` will be used." +#: ../../library/asyncio-task.rst:254 +msgid "" +"An optional keyword-only *eager_start* argument allows specifying if the " +"task should execute eagerly during the call to create_task, or be scheduled " +"later. If *eager_start* is not passed the mode set " +"by :meth:`loop.set_task_factory` will be used." msgstr "" -msgid "The task is executed in the loop returned by :func:`get_running_loop`, :exc:`RuntimeError` is raised if there is no running loop in current thread." +#: ../../library/asyncio-task.rst:259 +msgid "" +"The task is executed in the loop returned " +"by :func:`get_running_loop`, :exc:`RuntimeError` is raised if there is no " +"running loop in current thread." msgstr "" -msgid ":meth:`asyncio.TaskGroup.create_task` is a new alternative leveraging structural concurrency; it allows for waiting for a group of related tasks with strong safety guarantees." +#: ../../library/asyncio-task.rst:265 +msgid "" +":meth:`asyncio.TaskGroup.create_task` is a new alternative leveraging " +"structural concurrency; it allows for waiting for a group of related tasks " +"with strong safety guarantees." msgstr "" -msgid "Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done. For reliable \"fire-and-forget\" background tasks, gather them in a collection::" +#: ../../library/asyncio-task.rst:271 +msgid "" +"Save a reference to the result of this function, to avoid a task " +"disappearing mid-execution. The event loop only keeps weak references to " +"tasks. A task that isn't referenced elsewhere may get garbage collected at " +"any time, even before it's done. For reliable \"fire-and-forget\" background " +"tasks, gather them in a collection::" msgstr "" +#: ../../library/asyncio-task.rst:278 msgid "" "background_tasks = set()\n" "\n" @@ -296,89 +416,194 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" +#: ../../library/asyncio-task.rst:293 ../../library/asyncio-task.rst:1264 msgid "Added the *name* parameter." msgstr "" +#: ../../library/asyncio-task.rst:296 ../../library/asyncio-task.rst:1271 msgid "Added the *context* parameter." msgstr "" +#: ../../library/asyncio-task.rst:299 msgid "Added the *eager_start* parameter by passing on all *kwargs*." msgstr "" +#: ../../library/asyncio-task.rst:304 msgid "Task cancellation" msgstr "" -msgid "Tasks can easily and safely be cancelled. When a task is cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the next opportunity." +#: ../../library/asyncio-task.rst:306 +msgid "" +"Tasks can easily and safely be cancelled. When a task is " +"cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the " +"next opportunity." msgstr "" -msgid "It is recommended that coroutines use ``try/finally`` blocks to robustly perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly caught, it should generally be propagated when clean-up is complete. :exc:`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most code will not need to be aware of it." +#: ../../library/asyncio-task.rst:310 +msgid "" +"It is recommended that coroutines use ``try/finally`` blocks to robustly " +"perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " +"caught, it should generally be propagated when clean-up is " +"complete. :exc:`asyncio.CancelledError` directly " +"subclasses :exc:`BaseException` so most code will not need to be aware of it." msgstr "" -msgid "The asyncio components that enable structured concurrency, like :class:`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using cancellation internally and might misbehave if a coroutine swallows :exc:`asyncio.CancelledError`. Similarly, user code should not generally call :meth:`uncancel `. However, in cases when suppressing :exc:`asyncio.CancelledError` is truly desired, it is necessary to also call ``uncancel()`` to completely remove the cancellation state." +#: ../../library/asyncio-task.rst:316 +msgid "" +"The asyncio components that enable structured concurrency, " +"like :class:`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented " +"using cancellation internally and might misbehave if a coroutine " +"swallows :exc:`asyncio.CancelledError`. Similarly, user code should not " +"generally call :meth:`uncancel `. However, in cases " +"when suppressing :exc:`asyncio.CancelledError` is truly desired, it is " +"necessary to also call ``uncancel()`` to completely remove the cancellation " +"state." msgstr "" +#: ../../library/asyncio-task.rst:328 msgid "Task groups" msgstr "" -msgid "Task groups combine a task creation API with a convenient and reliable way to wait for all tasks in the group to finish." +#: ../../library/asyncio-task.rst:330 +msgid "" +"Task groups combine a task creation API with a convenient and reliable way " +"to wait for all tasks in the group to finish." msgstr "" -msgid "An :ref:`asynchronous context manager ` holding a group of tasks. Tasks can be added to the group using :meth:`create_task`. All tasks are awaited when the context manager exits." +#: ../../library/asyncio-task.rst:335 +msgid "" +"An :ref:`asynchronous context manager ` holding a " +"group of tasks. Tasks can be added to the group using :meth:`create_task`. " +"All tasks are awaited when the context manager exits." msgstr "" -msgid "Create a task in this task group. The signature matches that of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, already finished, or in the process of shutting down), we will close the given ``coro``." +#: ../../library/asyncio-task.rst:344 +msgid "" +"Create a task in this task group. The signature matches that " +"of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet " +"entered, already finished, or in the process of shutting down), we will " +"close the given ``coro``." msgstr "" +#: ../../library/asyncio-task.rst:352 msgid "Close the given coroutine if the task group is not active." msgstr "" +#: ../../library/asyncio-task.rst:356 msgid "Passes on all *kwargs* to :meth:`loop.create_task`" msgstr "" +#: ../../library/asyncio-task.rst:358 ../../library/asyncio-task.rst:564 +#: ../../library/asyncio-task.rst:737 ../../library/asyncio-task.rst:798 +#: ../../library/asyncio-task.rst:824 ../../library/asyncio-task.rst:865 msgid "Example::" msgstr "" +#: ../../library/asyncio-task.rst:360 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" " task1 = tg.create_task(some_coro(...))\n" " task2 = tg.create_task(another_coro(...))\n" -" print(f\"Both tasks have completed now: {task1.result()}, {task2.result()}\")" -msgstr "" - -msgid "The ``async with`` statement will wait for all tasks in the group to finish. While waiting, new tasks may still be added to the group (for example, by passing ``tg`` into one of the coroutines and calling ``tg.create_task()`` in that coroutine). Once the last task has finished and the ``async with`` block is exited, no new tasks may be added to the group." +" print(f\"Both tasks have completed now: {task1.result()}, " +"{task2.result()}\")" msgstr "" -msgid "The first time any of the tasks belonging to the group fails with an exception other than :exc:`asyncio.CancelledError`, the remaining tasks in the group are cancelled. No further tasks can then be added to the group. At this point, if the body of the ``async with`` statement is still active (i.e., :meth:`~object.__aexit__` hasn't been called yet), the task directly containing the ``async with`` statement is also cancelled. The resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not bubble out of the containing ``async with`` statement." +#: ../../library/asyncio-task.rst:366 +msgid "" +"The ``async with`` statement will wait for all tasks in the group to finish. " +"While waiting, new tasks may still be added to the group (for example, by " +"passing ``tg`` into one of the coroutines and calling ``tg.create_task()`` " +"in that coroutine). Once the last task has finished and the ``async with`` " +"block is exited, no new tasks may be added to the group." msgstr "" -msgid "Once all tasks have finished, if any tasks have failed with an exception other than :exc:`asyncio.CancelledError`, those exceptions are combined in an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see their documentation) which is then raised." +#: ../../library/asyncio-task.rst:373 +msgid "" +"The first time any of the tasks belonging to the group fails with an " +"exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " +"the group are cancelled. No further tasks can then be added to the group. At " +"this point, if the body of the ``async with`` statement is still active " +"(i.e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " +"containing the ``async with`` statement is also cancelled. The " +"resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it " +"will not bubble out of the containing ``async with`` statement." msgstr "" -msgid "Two base exceptions are treated specially: If any task fails with :exc:`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the remaining tasks and waits for them, but then the initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`." +#: ../../library/asyncio-task.rst:383 +msgid "" +"Once all tasks have finished, if any tasks have failed with an exception " +"other than :exc:`asyncio.CancelledError`, those exceptions are combined in " +"an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see " +"their documentation) which is then raised." msgstr "" -msgid "If the body of the ``async with`` statement exits with an exception (so :meth:`~object.__aexit__` is called with an exception set), this is treated the same as if one of the tasks failed: the remaining tasks are cancelled and then waited for, and non-cancellation exceptions are grouped into an exception group and raised. The exception passed into :meth:`~object.__aexit__`, unless it is :exc:`asyncio.CancelledError`, is also included in the exception group. The same special case is made for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." +#: ../../library/asyncio-task.rst:390 +msgid "" +"Two base exceptions are treated specially: If any task fails " +"with :exc:`KeyboardInterrupt` or :exc:`SystemExit`, the task group still " +"cancels the remaining tasks and waits for them, but then the " +"initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead " +"of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" -msgid "Task groups are careful not to mix up the internal cancellation used to \"wake up\" their :meth:`~object.__aexit__` with cancellation requests for the task in which they are running made by other parties. In particular, when one task group is syntactically nested in another, and both experience an exception in one of their child tasks simultaneously, the inner task group will process its exceptions, and then the outer task group will receive another cancellation and process its own exceptions." +#: ../../library/asyncio-task.rst:396 +msgid "" +"If the body of the ``async with`` statement exits with an exception " +"(so :meth:`~object.__aexit__` is called with an exception set), this is " +"treated the same as if one of the tasks failed: the remaining tasks are " +"cancelled and then waited for, and non-cancellation exceptions are grouped " +"into an exception group and raised. The exception passed " +"into :meth:`~object.__aexit__`, unless it is :exc:`asyncio.CancelledError`, " +"is also included in the exception group. The same special case is made " +"for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous " +"paragraph." +msgstr "" + +#: ../../library/asyncio-task.rst:408 +msgid "" +"Task groups are careful not to mix up the internal cancellation used to " +"\"wake up\" their :meth:`~object.__aexit__` with cancellation requests for " +"the task in which they are running made by other parties. In particular, " +"when one task group is syntactically nested in another, and both experience " +"an exception in one of their child tasks simultaneously, the inner task " +"group will process its exceptions, and then the outer task group will " +"receive another cancellation and process its own exceptions." msgstr "" -msgid "In the case where a task group is cancelled externally and also must raise an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio.Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, so the cancellation is not lost." +#: ../../library/asyncio-task.rst:416 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will call the parent " +"task's :meth:`~asyncio.Task.cancel` method. This ensures that " +"a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, " +"so the cancellation is not lost." msgstr "" -msgid "Task groups preserve the cancellation count reported by :meth:`asyncio.Task.cancelling`." +#: ../../library/asyncio-task.rst:422 +msgid "" +"Task groups preserve the cancellation count reported " +"by :meth:`asyncio.Task.cancelling`." msgstr "" -msgid "Improved handling of simultaneous internal and external cancellations and correct preservation of cancellation counts." +#: ../../library/asyncio-task.rst:427 +msgid "" +"Improved handling of simultaneous internal and external cancellations and " +"correct preservation of cancellation counts." msgstr "" +#: ../../library/asyncio-task.rst:431 msgid "Terminating a task group" msgstr "" -msgid "While terminating a task group is not natively supported by the standard library, termination can be achieved by adding an exception-raising task to the task group and ignoring the raised exception:" +#: ../../library/asyncio-task.rst:433 +msgid "" +"While terminating a task group is not natively supported by the standard " +"library, termination can be achieved by adding an exception-raising task to " +"the task group and ignoring the raised exception:" msgstr "" +#: ../../library/asyncio-task.rst:437 msgid "" "import asyncio\n" "from asyncio import TaskGroup\n" @@ -411,33 +636,49 @@ msgid "" "asyncio.run(main())" msgstr "" +#: ../../library/asyncio-task.rst:469 msgid "Expected output:" msgstr "" +#: ../../library/asyncio-task.rst:471 msgid "" "Task 1: start\n" "Task 2: start\n" "Task 1: done" msgstr "" +#: ../../library/asyncio-task.rst:478 msgid "Sleeping" msgstr "" +#: ../../library/asyncio-task.rst:483 msgid "Block for *delay* seconds." msgstr "" -msgid "If *result* is provided, it is returned to the caller when the coroutine completes." +#: ../../library/asyncio-task.rst:485 +msgid "" +"If *result* is provided, it is returned to the caller when the coroutine " +"completes." msgstr "" -msgid "``sleep()`` always suspends the current task, allowing other tasks to run." +#: ../../library/asyncio-task.rst:488 +msgid "" +"``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -msgid "Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call." +#: ../../library/asyncio-task.rst:491 +msgid "" +"Setting the delay to 0 provides an optimized path to allow other tasks to " +"run. This can be used by long-running functions to avoid blocking the event " +"loop for the full duration of the function call." msgstr "" -msgid "Example of coroutine displaying the current date every second for 5 seconds::" +#: ../../library/asyncio-task.rst:497 +msgid "" +"Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" +#: ../../library/asyncio-task.rst:500 msgid "" "import asyncio\n" "import datetime as dt\n" @@ -454,46 +695,86 @@ msgid "" "asyncio.run(display_date())" msgstr "" +#: ../../library/asyncio-task.rst:515 ../../library/asyncio-task.rst:613 +#: ../../library/asyncio-task.rst:712 ../../library/asyncio-task.rst:890 +#: ../../library/asyncio-task.rst:948 ../../library/asyncio-task.rst:1009 msgid "Removed the *loop* parameter." msgstr "" +#: ../../library/asyncio-task.rst:518 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" +#: ../../library/asyncio-task.rst:523 msgid "Running tasks concurrently" msgstr "" -msgid "Run :ref:`awaitable objects ` in the *aws* sequence *concurrently*." +#: ../../library/asyncio-task.rst:527 +msgid "" +"Run :ref:`awaitable objects ` in the *aws* sequence " +"*concurrently*." msgstr "" -msgid "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a Task." +#: ../../library/asyncio-task.rst:530 +msgid "" +"If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " +"Task." msgstr "" -msgid "If all awaitables are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in *aws*." +#: ../../library/asyncio-task.rst:533 +msgid "" +"If all awaitables are completed successfully, the result is an aggregate " +"list of returned values. The order of result values corresponds to the " +"order of awaitables in *aws*." msgstr "" -msgid "If *return_exceptions* is ``False`` (default), the first raised exception is immediately propagated to the task that awaits on ``gather()``. Other awaitables in the *aws* sequence **won't be cancelled** and will continue to run." +#: ../../library/asyncio-task.rst:537 +msgid "" +"If *return_exceptions* is ``False`` (default), the first raised exception is " +"immediately propagated to the task that awaits on ``gather()``. Other " +"awaitables in the *aws* sequence **won't be cancelled** and will continue to " +"run." msgstr "" -msgid "If *return_exceptions* is ``True``, exceptions are treated the same as successful results, and aggregated in the result list." +#: ../../library/asyncio-task.rst:542 +msgid "" +"If *return_exceptions* is ``True``, exceptions are treated the same as " +"successful results, and aggregated in the result list." msgstr "" -msgid "If ``gather()`` is *cancelled*, all submitted awaitables (that have not completed yet) are also *cancelled*." +#: ../../library/asyncio-task.rst:545 +msgid "" +"If ``gather()`` is *cancelled*, all submitted awaitables (that have not " +"completed yet) are also *cancelled*." msgstr "" -msgid "If any Task or Future from the *aws* sequence is *cancelled*, it is treated as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** cancelled in this case. This is to prevent the cancellation of one submitted Task/Future to cause other Tasks/Futures to be cancelled." +#: ../../library/asyncio-task.rst:548 +msgid "" +"If any Task or Future from the *aws* sequence is *cancelled*, it is treated " +"as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " +"cancelled in this case. This is to prevent the cancellation of one " +"submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -msgid "A new alternative to create and run tasks concurrently and wait for their completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger safety guarantees than *gather* for scheduling a nesting of subtasks: if a task (or a subtask, a task scheduled by a task) raises an exception, *TaskGroup* will, while *gather* will not, cancel the remaining scheduled tasks." +#: ../../library/asyncio-task.rst:555 +msgid "" +"A new alternative to create and run tasks concurrently and wait for their " +"completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " +"safety guarantees than *gather* for scheduling a nesting of subtasks: if a " +"task (or a subtask, a task scheduled by a task) raises an exception, " +"*TaskGroup* will, while *gather* will not, cancel the remaining scheduled " +"tasks." msgstr "" +#: ../../library/asyncio-task.rst:566 msgid "" "import asyncio\n" "\n" "async def factorial(name, number):\n" " f = 1\n" " for i in range(2, number + 1):\n" -" print(f\"Task {name}: Compute factorial({number}), currently i={i}...\")\n" +" print(f\"Task {name}: Compute factorial({number}), currently i={i}..." +"\")\n" " await asyncio.sleep(1)\n" " f *= i\n" " print(f\"Task {name}: factorial({number}) = {f}\")\n" @@ -524,71 +805,137 @@ msgid "" "# [2, 6, 24]" msgstr "" -msgid "If *return_exceptions* is false, cancelling gather() after it has been marked done won't cancel any submitted awaitables. For instance, gather can be marked done after propagating an exception to the caller, therefore, calling ``gather.cancel()`` after catching an exception (raised by one of the awaitables) from gather won't cancel any other awaitables." +#: ../../library/asyncio-task.rst:602 +msgid "" +"If *return_exceptions* is false, cancelling gather() after it has been " +"marked done won't cancel any submitted awaitables. For instance, gather can " +"be marked done after propagating an exception to the caller, therefore, " +"calling ``gather.cancel()`` after catching an exception (raised by one of " +"the awaitables) from gather won't cancel any other awaitables." msgstr "" -msgid "If the *gather* itself is cancelled, the cancellation is propagated regardless of *return_exceptions*." +#: ../../library/asyncio-task.rst:609 +msgid "" +"If the *gather* itself is cancelled, the cancellation is propagated " +"regardless of *return_exceptions*." msgstr "" -msgid "Deprecation warning is emitted if no positional arguments are provided or not all positional arguments are Future-like objects and there is no running event loop." +#: ../../library/asyncio-task.rst:616 +msgid "" +"Deprecation warning is emitted if no positional arguments are provided or " +"not all positional arguments are Future-like objects and there is no running " +"event loop." msgstr "" +#: ../../library/asyncio-task.rst:625 msgid "Eager task factory" msgstr "" +#: ../../library/asyncio-task.rst:629 msgid "A task factory for eager task execution." msgstr "" -msgid "When using this factory (via :meth:`loop.set_task_factory(asyncio.eager_task_factory) `), coroutines begin execution synchronously during :class:`Task` construction. Tasks are only scheduled on the event loop if they block. This can be a performance improvement as the overhead of loop scheduling is avoided for coroutines that complete synchronously." +#: ../../library/asyncio-task.rst:631 +msgid "" +"When using this factory " +"(via :meth:`loop.set_task_factory(asyncio.eager_task_factory) " +"`), coroutines begin execution synchronously " +"during :class:`Task` construction. Tasks are only scheduled on the event " +"loop if they block. This can be a performance improvement as the overhead of " +"loop scheduling is avoided for coroutines that complete synchronously." msgstr "" -msgid "A common example where this is beneficial is coroutines which employ caching or memoization to avoid actual I/O when possible." +#: ../../library/asyncio-task.rst:637 +msgid "" +"A common example where this is beneficial is coroutines which employ caching " +"or memoization to avoid actual I/O when possible." msgstr "" -msgid "Immediate execution of the coroutine is a semantic change. If the coroutine returns or raises, the task is never scheduled to the event loop. If the coroutine execution blocks, the task is scheduled to the event loop. This change may introduce behavior changes to existing applications. For example, the application's task execution order is likely to change." +#: ../../library/asyncio-task.rst:642 +msgid "" +"Immediate execution of the coroutine is a semantic change. If the coroutine " +"returns or raises, the task is never scheduled to the event loop. If the " +"coroutine execution blocks, the task is scheduled to the event loop. This " +"change may introduce behavior changes to existing applications. For example, " +"the application's task execution order is likely to change." msgstr "" -msgid "Create an eager task factory, similar to :func:`eager_task_factory`, using the provided *custom_task_constructor* when creating a new task instead of the default :class:`Task`." +#: ../../library/asyncio-task.rst:653 +msgid "" +"Create an eager task factory, similar to :func:`eager_task_factory`, using " +"the provided *custom_task_constructor* when creating a new task instead of " +"the default :class:`Task`." msgstr "" -msgid "*custom_task_constructor* must be a *callable* with the signature matching the signature of :class:`Task.__init__ `. The callable must return a :class:`asyncio.Task`-compatible object." +#: ../../library/asyncio-task.rst:657 +msgid "" +"*custom_task_constructor* must be a *callable* with the signature matching " +"the signature of :class:`Task.__init__ `. The callable must return " +"a :class:`asyncio.Task`-compatible object." msgstr "" -msgid "This function returns a *callable* intended to be used as a task factory of an event loop via :meth:`loop.set_task_factory(factory) `)." +#: ../../library/asyncio-task.rst:661 +msgid "" +"This function returns a *callable* intended to be used as a task factory of " +"an event loop via :meth:`loop.set_task_factory(factory) " +"`)." msgstr "" +#: ../../library/asyncio-task.rst:668 msgid "Shielding from cancellation" msgstr "" -msgid "Protect an :ref:`awaitable object ` from being :meth:`cancelled `." +#: ../../library/asyncio-task.rst:672 +msgid "" +"Protect an :ref:`awaitable object ` from " +"being :meth:`cancelled `." msgstr "" +#: ../../library/asyncio-task.rst:675 ../../library/asyncio-task.rst:845 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" +#: ../../library/asyncio-task.rst:677 msgid "The statement::" msgstr "" +#: ../../library/asyncio-task.rst:679 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" msgstr "" +#: ../../library/asyncio-task.rst:682 msgid "is equivalent to::" msgstr "" +#: ../../library/asyncio-task.rst:684 msgid "res = await something()" msgstr "" -msgid "*except* that if the coroutine containing it is cancelled, the Task running in ``something()`` is not cancelled. From the point of view of ``something()``, the cancellation did not happen. Although its caller is still cancelled, so the \"await\" expression still raises a :exc:`CancelledError`." +#: ../../library/asyncio-task.rst:686 +msgid "" +"*except* that if the coroutine containing it is cancelled, the Task running " +"in ``something()`` is not cancelled. From the point of view of " +"``something()``, the cancellation did not happen. Although its caller is " +"still cancelled, so the \"await\" expression still raises " +"a :exc:`CancelledError`." msgstr "" -msgid "If ``something()`` is cancelled by other means (i.e. from within itself) that would also cancel ``shield()``." +#: ../../library/asyncio-task.rst:692 +msgid "" +"If ``something()`` is cancelled by other means (i.e. from within itself) " +"that would also cancel ``shield()``." msgstr "" -msgid "If it is desired to completely ignore cancellation (not recommended) the ``shield()`` function should be combined with a try/except clause, as follows::" +#: ../../library/asyncio-task.rst:695 +msgid "" +"If it is desired to completely ignore cancellation (not recommended) the " +"``shield()`` function should be combined with a try/except clause, as " +"follows::" msgstr "" +#: ../../library/asyncio-task.rst:699 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -597,39 +944,70 @@ msgid "" " res = None" msgstr "" -msgid "Save a reference to tasks passed to this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn't referenced elsewhere may get garbage collected at any time, even before it's done." +#: ../../library/asyncio-task.rst:707 +msgid "" +"Save a reference to tasks passed to this function, to avoid a task " +"disappearing mid-execution. The event loop only keeps weak references to " +"tasks. A task that isn't referenced elsewhere may get garbage collected at " +"any time, even before it's done." msgstr "" -msgid "Deprecation warning is emitted if *aw* is not Future-like object and there is no running event loop." +#: ../../library/asyncio-task.rst:715 +msgid "" +"Deprecation warning is emitted if *aw* is not Future-like object and there " +"is no running event loop." msgstr "" +#: ../../library/asyncio-task.rst:721 msgid "Timeouts" msgstr "" -msgid "Return an :ref:`asynchronous context manager ` that can be used to limit the amount of time spent waiting on something." +#: ../../library/asyncio-task.rst:725 +msgid "" +"Return an :ref:`asynchronous context manager ` that " +"can be used to limit the amount of time spent waiting on something." msgstr "" -msgid "*delay* can either be ``None``, or a float/int number of seconds to wait. If *delay* is ``None``, no time limit will be applied; this can be useful if the delay is unknown when the context manager is created." +#: ../../library/asyncio-task.rst:729 +msgid "" +"*delay* can either be ``None``, or a float/int number of seconds to wait. If " +"*delay* is ``None``, no time limit will be applied; this can be useful if " +"the delay is unknown when the context manager is created." msgstr "" -msgid "In either case, the context manager can be rescheduled after creation using :meth:`Timeout.reschedule`." +#: ../../library/asyncio-task.rst:734 +msgid "" +"In either case, the context manager can be rescheduled after creation " +"using :meth:`Timeout.reschedule`." msgstr "" +#: ../../library/asyncio-task.rst:739 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" " await long_running_task()" msgstr "" -msgid "If ``long_running_task`` takes more than 10 seconds to complete, the context manager will cancel the current task and handle the resulting :exc:`asyncio.CancelledError` internally, transforming it into a :exc:`TimeoutError` which can be caught and handled." +#: ../../library/asyncio-task.rst:743 +msgid "" +"If ``long_running_task`` takes more than 10 seconds to complete, the context " +"manager will cancel the current task and handle the " +"resulting :exc:`asyncio.CancelledError` internally, transforming it into " +"a :exc:`TimeoutError` which can be caught and handled." msgstr "" -msgid "The :func:`asyncio.timeout` context manager is what transforms the :exc:`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:`TimeoutError` can only be caught *outside* of the context manager." +#: ../../library/asyncio-task.rst:750 +msgid "" +"The :func:`asyncio.timeout` context manager is what transforms " +"the :exc:`asyncio.CancelledError` into a :exc:`TimeoutError`, which means " +"the :exc:`TimeoutError` can only be caught *outside* of the context manager." msgstr "" +#: ../../library/asyncio-task.rst:755 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" +#: ../../library/asyncio-task.rst:757 msgid "" "async def main():\n" " try:\n" @@ -641,33 +1019,54 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -msgid "The context manager produced by :func:`asyncio.timeout` can be rescheduled to a different deadline and inspected." +#: ../../library/asyncio-task.rst:766 +msgid "" +"The context manager produced by :func:`asyncio.timeout` can be rescheduled " +"to a different deadline and inspected." msgstr "" -msgid "An :ref:`asynchronous context manager ` for cancelling overdue coroutines." +#: ../../library/asyncio-task.rst:771 +msgid "" +"An :ref:`asynchronous context manager ` for " +"cancelling overdue coroutines." msgstr "" -msgid "Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at` rather than instantiating :class:`!Timeout` directly." +#: ../../library/asyncio-task.rst:774 +msgid "" +"Prefer using :func:`asyncio.timeout` or :func:`asyncio.timeout_at` rather " +"than instantiating :class:`!Timeout` directly." msgstr "" -msgid "``when`` should be an absolute time at which the context should time out, as measured by the event loop's clock:" +#: ../../library/asyncio-task.rst:777 +msgid "" +"``when`` should be an absolute time at which the context should time out, as " +"measured by the event loop's clock:" msgstr "" +#: ../../library/asyncio-task.rst:780 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -msgid "If ``when < loop.time()``, the timeout will trigger on the next iteration of the event loop." +#: ../../library/asyncio-task.rst:781 +msgid "" +"If ``when < loop.time()``, the timeout will trigger on the next iteration of " +"the event loop." msgstr "" -msgid "Return the current deadline, or ``None`` if the current deadline is not set." +#: ../../library/asyncio-task.rst:786 +msgid "" +"Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" +#: ../../library/asyncio-task.rst:791 msgid "Reschedule the timeout." msgstr "" +#: ../../library/asyncio-task.rst:795 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" +#: ../../library/asyncio-task.rst:800 msgid "" "async def main():\n" " try:\n" @@ -685,12 +1084,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" +#: ../../library/asyncio-task.rst:815 msgid "Timeout context managers can be safely nested." msgstr "" -msgid "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to stop waiting, or ``None``." +#: ../../library/asyncio-task.rst:821 +msgid "" +"Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " +"stop waiting, or ``None``." msgstr "" +#: ../../library/asyncio-task.rst:826 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -704,24 +1108,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -msgid "Wait for the *aw* :ref:`awaitable ` to complete with a timeout." +#: ../../library/asyncio-task.rst:842 +msgid "" +"Wait for the *aw* :ref:`awaitable ` to complete with a " +"timeout." msgstr "" -msgid "*timeout* can either be ``None`` or a float or int number of seconds to wait for. If *timeout* is ``None``, block until the future completes." +#: ../../library/asyncio-task.rst:847 +msgid "" +"*timeout* can either be ``None`` or a float or int number of seconds to wait " +"for. If *timeout* is ``None``, block until the future completes." msgstr "" -msgid "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." +#: ../../library/asyncio-task.rst:851 +msgid "" +"If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -msgid "To avoid the task :meth:`cancellation `, wrap it in :func:`shield`." +#: ../../library/asyncio-task.rst:854 +msgid "" +"To avoid the task :meth:`cancellation `, wrap it " +"in :func:`shield`." msgstr "" -msgid "The function will wait until the future is actually cancelled, so the total wait time may exceed the *timeout*. If an exception happens during cancellation, it is propagated." +#: ../../library/asyncio-task.rst:857 +msgid "" +"The function will wait until the future is actually cancelled, so the total " +"wait time may exceed the *timeout*. If an exception happens during " +"cancellation, it is propagated." msgstr "" +#: ../../library/asyncio-task.rst:861 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" +#: ../../library/asyncio-task.rst:867 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -742,69 +1163,122 @@ msgid "" "# timeout!" msgstr "" -msgid "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be cancelled. Previously, it raised :exc:`TimeoutError` immediately." +#: ../../library/asyncio-task.rst:885 +msgid "" +"When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " +"cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" +#: ../../library/asyncio-task.rst:893 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "" +#: ../../library/asyncio-task.rst:898 msgid "Waiting primitives" msgstr "" -msgid "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the *aws* iterable concurrently and block until the condition specified by *return_when*." +#: ../../library/asyncio-task.rst:903 +msgid "" +"Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " +"*aws* iterable concurrently and block until the condition specified by " +"*return_when*." msgstr "" +#: ../../library/asyncio-task.rst:907 msgid "The *aws* iterable must not be empty." msgstr "" +#: ../../library/asyncio-task.rst:909 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" +#: ../../library/asyncio-task.rst:911 msgid "Usage::" msgstr "" +#: ../../library/asyncio-task.rst:913 msgid "done, pending = await asyncio.wait(aws)" msgstr "" -msgid "*timeout* (a float or int), if specified, can be used to control the maximum number of seconds to wait before returning." +#: ../../library/asyncio-task.rst:915 +msgid "" +"*timeout* (a float or int), if specified, can be used to control the maximum " +"number of seconds to wait before returning." msgstr "" -msgid "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks that aren't done when the timeout occurs are simply returned in the second set." +#: ../../library/asyncio-task.rst:918 +msgid "" +"Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " +"that aren't done when the timeout occurs are simply returned in the second " +"set." msgstr "" -msgid "*return_when* indicates when this function should return. It must be one of the following constants:" +#: ../../library/asyncio-task.rst:922 +msgid "" +"*return_when* indicates when this function should return. It must be one of " +"the following constants:" msgstr "" +#: ../../library/asyncio-task.rst:928 msgid "Constant" msgstr "" +#: ../../library/asyncio-task.rst:929 msgid "Description" msgstr "" +#: ../../library/asyncio-task.rst:932 msgid "The function will return when any future finishes or is cancelled." msgstr "" -msgid "The function will return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to :const:`ALL_COMPLETED`." +#: ../../library/asyncio-task.rst:935 +msgid "" +"The function will return when any future finishes by raising an exception. " +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" +#: ../../library/asyncio-task.rst:940 msgid "The function will return when all futures finish or are cancelled." msgstr "" -msgid "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures when a timeout occurs." +#: ../../library/asyncio-task.rst:942 +msgid "" +"Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " +"when a timeout occurs." +msgstr "" + +#: ../../library/asyncio-task.rst:945 +msgid "" +"If ``wait()`` is cancelled, the futures in *aws* are not cancelled and " +"continue to run." msgstr "" +#: ../../library/asyncio-task.rst:951 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" +#: ../../library/asyncio-task.rst:954 ../../library/asyncio-task.rst:1016 msgid "Added support for generators yielding tasks." msgstr "" -msgid "Run :ref:`awaitable objects ` in the *aws* iterable concurrently. The returned object can be iterated to obtain the results of the awaitables as they finish." +#: ../../library/asyncio-task.rst:960 +msgid "" +"Run :ref:`awaitable objects ` in the *aws* iterable " +"concurrently. The returned object can be iterated to obtain the results of " +"the awaitables as they finish." msgstr "" -msgid "The object returned by ``as_completed()`` can be iterated as an :term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous iteration is used, the originally-supplied awaitables are yielded if they are tasks or futures. This makes it easy to correlate previously-scheduled tasks with their results. Example::" +#: ../../library/asyncio-task.rst:964 +msgid "" +"The object returned by ``as_completed()`` can be iterated as " +"an :term:`asynchronous iterator` or a plain :term:`iterator`. When " +"asynchronous iteration is used, the originally-supplied awaitables are " +"yielded if they are tasks or futures. This makes it easy to correlate " +"previously-scheduled tasks with their results. Example::" msgstr "" +#: ../../library/asyncio-task.rst:970 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -821,12 +1295,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -msgid "During asynchronous iteration, implicitly-created tasks will be yielded for supplied awaitables that aren't tasks or futures." +#: ../../library/asyncio-task.rst:984 +msgid "" +"During asynchronous iteration, implicitly-created tasks will be yielded for " +"supplied awaitables that aren't tasks or futures." msgstr "" -msgid "When used as a plain iterator, each iteration yields a new coroutine that returns the result or raises the exception of the next completed awaitable. This pattern is compatible with Python versions older than 3.13::" +#: ../../library/asyncio-task.rst:987 +msgid "" +"When used as a plain iterator, each iteration yields a new coroutine that " +"returns the result or raises the exception of the next completed awaitable. " +"This pattern is compatible with Python versions older than 3.13::" msgstr "" +#: ../../library/asyncio-task.rst:991 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -839,30 +1321,61 @@ msgid "" " reader, writer = await next_connect" msgstr "" -msgid "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables are done. This is raised by the ``async for`` loop during asynchronous iteration or by the coroutines yielded during plain iteration." +#: ../../library/asyncio-task.rst:1001 +msgid "" +"A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " +"are done. This is raised by the ``async for`` loop during asynchronous " +"iteration or by the coroutines yielded during plain iteration." +msgstr "" + +#: ../../library/asyncio-task.rst:1005 +msgid "" +"``as_completed()`` does not cancel the tasks running the supplied " +"awaitables: if a timeout occurs or the iteration is cancelled, the remaining " +"tasks continue to run." msgstr "" -msgid "Deprecation warning is emitted if not all awaitable objects in the *aws* iterable are Future-like objects and there is no running event loop." +#: ../../library/asyncio-task.rst:1012 +msgid "" +"Deprecation warning is emitted if not all awaitable objects in the *aws* " +"iterable are Future-like objects and there is no running event loop." msgstr "" -msgid "The result can now be used as either an :term:`asynchronous iterator` or as a plain :term:`iterator` (previously it was only a plain iterator)." +#: ../../library/asyncio-task.rst:1019 +msgid "" +"The result can now be used as either an :term:`asynchronous iterator` or as " +"a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" +#: ../../library/asyncio-task.rst:1025 msgid "Running in threads" msgstr "" +#: ../../library/asyncio-task.rst:1030 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -msgid "Any \\*args and \\*\\*kwargs supplied for this function are directly passed to *func*. Also, the current :class:`contextvars.Context` is propagated, allowing context variables from the event loop thread to be accessed in the separate thread." +#: ../../library/asyncio-task.rst:1032 +msgid "" +"Any \\*args and \\*\\*kwargs supplied for this function are directly passed " +"to *func*. Also, the current :class:`contextvars.Context` is propagated, " +"allowing context variables from the event loop thread to be accessed in the " +"separate thread." msgstr "" -msgid "Return a coroutine that can be awaited to get the eventual result of *func*." +#: ../../library/asyncio-task.rst:1037 +msgid "" +"Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -msgid "This coroutine function is primarily intended to be used for executing IO-bound functions/methods that would otherwise block the event loop if they were run in the main thread. For example::" +#: ../../library/asyncio-task.rst:1039 +msgid "" +"This coroutine function is primarily intended to be used for executing IO-" +"bound functions/methods that would otherwise block the event loop if they " +"were run in the main thread. For example::" msgstr "" +#: ../../library/asyncio-task.rst:1043 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -891,28 +1404,48 @@ msgid "" "# finished main at 19:50:54" msgstr "" -msgid "Directly calling ``blocking_io()`` in any coroutine would block the event loop for its duration, resulting in an additional 1 second of run time. Instead, by using ``asyncio.to_thread()``, we can run it in a separate thread without blocking the event loop." +#: ../../library/asyncio-task.rst:1069 +msgid "" +"Directly calling ``blocking_io()`` in any coroutine would block the event " +"loop for its duration, resulting in an additional 1 second of run time. " +"Instead, by using ``asyncio.to_thread()``, we can run it in a separate " +"thread without blocking the event loop." msgstr "" -msgid "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used to make IO-bound functions non-blocking. However, for extension modules that release the GIL or alternative Python implementations that don't have one, ``asyncio.to_thread()`` can also be used for CPU-bound functions." +#: ../../library/asyncio-task.rst:1076 +msgid "" +"Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " +"to make IO-bound functions non-blocking. However, for extension modules that " +"release the GIL or alternative Python implementations that don't have one, " +"``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" +#: ../../library/asyncio-task.rst:1085 msgid "Scheduling from other threads" msgstr "" +#: ../../library/asyncio-task.rst:1089 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -msgid "Return a :class:`concurrent.futures.Future` to wait for the result from another OS thread." +#: ../../library/asyncio-task.rst:1091 +msgid "" +"Return a :class:`concurrent.futures.Future` to wait for the result from " +"another OS thread." msgstr "" -msgid "This function is meant to be called from a different OS thread than the one where the event loop is running. Example::" +#: ../../library/asyncio-task.rst:1094 +msgid "" +"This function is meant to be called from a different OS thread than the one " +"where the event loop is running. Example::" msgstr "" +#: ../../library/asyncio-task.rst:1097 msgid "" "def in_thread(loop: asyncio.AbstractEventLoop) -> None:\n" " # Run some blocking IO\n" -" pathlib.Path(\"example.txt\").write_text(\"hello world\", encoding=\"utf8\")\n" +" pathlib.Path(\"example.txt\").write_text(\"hello world\", " +"encoding=\"utf8\")\n" "\n" " # Create a coroutine\n" " coro = asyncio.sleep(1, result=3)\n" @@ -931,9 +1464,11 @@ msgid "" " await asyncio.to_thread(in_thread, loop)" msgstr "" +#: ../../library/asyncio-task.rst:1117 msgid "It's also possible to run the other way around. Example::" msgstr "" +#: ../../library/asyncio-task.rst:1119 msgid "" "@contextlib.contextmanager\n" "def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:\n" @@ -946,7 +1481,8 @@ msgid "" "\n" " with concurrent.futures.ThreadPoolExecutor(1) as tpe:\n" " complete_fut = tpe.submit(asyncio.run, main())\n" -" for fut in concurrent.futures.as_completed((loop_fut, complete_fut)):\n" +" for fut in concurrent.futures.as_completed((loop_fut, " +"complete_fut)):\n" " if fut is loop_fut:\n" " loop = loop_fut.result()\n" " try:\n" @@ -968,9 +1504,13 @@ msgid "" " assert future.result(timeout=2) == 3" msgstr "" -msgid "If an exception is raised in the coroutine, the returned Future will be notified. It can also be used to cancel the task in the event loop::" +#: ../../library/asyncio-task.rst:1151 +msgid "" +"If an exception is raised in the coroutine, the returned Future will be " +"notified. It can also be used to cancel the task in the event loop::" msgstr "" +#: ../../library/asyncio-task.rst:1155 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -983,189 +1523,346 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -msgid "See the :ref:`concurrency and multithreading ` section of the documentation." +#: ../../library/asyncio-task.rst:1165 +msgid "" +"See the :ref:`concurrency and multithreading ` " +"section of the documentation." msgstr "" -msgid "Unlike other asyncio functions this function requires the *loop* argument to be passed explicitly." +#: ../../library/asyncio-task.rst:1168 +msgid "" +"Unlike other asyncio functions this function requires the *loop* argument to " +"be passed explicitly." msgstr "" +#: ../../library/asyncio-task.rst:1175 msgid "Introspection" msgstr "" -msgid "Return the currently running :class:`Task` instance, or ``None`` if no task is running." +#: ../../library/asyncio-task.rst:1180 +msgid "" +"Return the currently running :class:`Task` instance, or ``None`` if no task " +"is running." msgstr "" -msgid "If *loop* is ``None`` :func:`get_running_loop` is used to get the current loop." +#: ../../library/asyncio-task.rst:1183 +msgid "" +"If *loop* is ``None`` :func:`get_running_loop` is used to get the current " +"loop." msgstr "" +#: ../../library/asyncio-task.rst:1191 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -msgid "If *loop* is ``None``, :func:`get_running_loop` is used for getting current loop." +#: ../../library/asyncio-task.rst:1194 +msgid "" +"If *loop* is ``None``, :func:`get_running_loop` is used for getting current " +"loop." msgstr "" +#: ../../library/asyncio-task.rst:1202 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" +#: ../../library/asyncio-task.rst:1209 msgid "Task object" msgstr "" -msgid "A :class:`Future-like ` object that runs a Python :ref:`coroutine `. Not thread-safe." +#: ../../library/asyncio-task.rst:1213 +msgid "" +"A :class:`Future-like ` object that runs a Python :ref:`coroutine " +"`. Not thread-safe." msgstr "" -msgid "Tasks are used to run coroutines in event loops. If a coroutine awaits on a Future, the Task suspends the execution of the coroutine and waits for the completion of the Future. When the Future is *done*, the execution of the wrapped coroutine resumes." +#: ../../library/asyncio-task.rst:1216 +msgid "" +"Tasks are used to run coroutines in event loops. If a coroutine awaits on a " +"Future, the Task suspends the execution of the coroutine and waits for the " +"completion of the Future. When the Future is *done*, the execution of the " +"wrapped coroutine resumes." msgstr "" -msgid "Event loops use cooperative scheduling: an event loop runs one Task at a time. While a Task awaits for the completion of a Future, the event loop runs other Tasks, callbacks, or performs IO operations." +#: ../../library/asyncio-task.rst:1222 +msgid "" +"Event loops use cooperative scheduling: an event loop runs one Task at a " +"time. While a Task awaits for the completion of a Future, the event loop " +"runs other Tasks, callbacks, or performs IO operations." msgstr "" -msgid "Use the high-level :func:`asyncio.create_task` function to create Tasks, or the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. Manual instantiation of Tasks is discouraged." +#: ../../library/asyncio-task.rst:1227 +msgid "" +"Use the high-level :func:`asyncio.create_task` function to create Tasks, or " +"the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " +"Manual instantiation of Tasks is discouraged." msgstr "" -msgid "To cancel a running Task use the :meth:`cancel` method. Calling it will cause the Task to throw a :exc:`CancelledError` exception into the wrapped coroutine. If a coroutine is awaiting on a Future object during cancellation, the Future object will be cancelled." +#: ../../library/asyncio-task.rst:1232 +msgid "" +"To cancel a running Task use the :meth:`cancel` method. Calling it will " +"cause the Task to throw a :exc:`CancelledError` exception into the wrapped " +"coroutine. If a coroutine is awaiting on a Future object during " +"cancellation, the Future object will be cancelled." msgstr "" -msgid ":meth:`cancelled` can be used to check if the Task was cancelled. The method returns ``True`` if the wrapped coroutine did not suppress the :exc:`CancelledError` exception and was actually cancelled." +#: ../../library/asyncio-task.rst:1237 +msgid "" +":meth:`cancelled` can be used to check if the Task was cancelled. The method " +"returns ``True`` if the wrapped coroutine did not suppress " +"the :exc:`CancelledError` exception and was actually cancelled." msgstr "" -msgid ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :meth:`Future.set_result` and :meth:`Future.set_exception`." +#: ../../library/asyncio-task.rst:1242 +msgid "" +":class:`asyncio.Task` inherits from :class:`Future` all of its APIs " +"except :meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -msgid "An optional keyword-only *context* argument allows specifying a custom :class:`contextvars.Context` for the *coro* to run in. If no *context* is provided, the Task copies the current context and later runs its coroutine in the copied context." +#: ../../library/asyncio-task.rst:1246 +msgid "" +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. If no " +"*context* is provided, the Task copies the current context and later runs " +"its coroutine in the copied context." msgstr "" -msgid "An optional keyword-only *eager_start* argument allows eagerly starting the execution of the :class:`asyncio.Task` at task creation time. If set to ``True`` and the event loop is running, the task will start executing the coroutine immediately, until the first time the coroutine blocks. If the coroutine returns or raises without blocking, the task will be finished eagerly and will skip scheduling to the event loop." +#: ../../library/asyncio-task.rst:1251 +msgid "" +"An optional keyword-only *eager_start* argument allows eagerly starting the " +"execution of the :class:`asyncio.Task` at task creation time. If set to " +"``True`` and the event loop is running, the task will start executing the " +"coroutine immediately, until the first time the coroutine blocks. If the " +"coroutine returns or raises without blocking, the task will be finished " +"eagerly and will skip scheduling to the event loop." msgstr "" -msgid "Tasks are :ref:`generic ` over the return type of their wrapped coroutines." +#: ../../library/asyncio-task.rst:1258 +msgid "" +"Tasks are :ref:`generic ` over the return type of their wrapped " +"coroutines." msgstr "" +#: ../../library/asyncio-task.rst:1261 msgid "Added support for the :mod:`contextvars` module." msgstr "" -msgid "Deprecation warning is emitted if *loop* is not specified and there is no running event loop." +#: ../../library/asyncio-task.rst:1267 +msgid "" +"Deprecation warning is emitted if *loop* is not specified and there is no " +"running event loop." msgstr "" +#: ../../library/asyncio-task.rst:1274 msgid "Added the *eager_start* parameter." msgstr "" +#: ../../library/asyncio-task.rst:1279 msgid "Return ``True`` if the Task is *done*." msgstr "" -msgid "A Task is *done* when the wrapped coroutine either returned a value, raised an exception, or the Task was cancelled." +#: ../../library/asyncio-task.rst:1281 +msgid "" +"A Task is *done* when the wrapped coroutine either returned a value, raised " +"an exception, or the Task was cancelled." msgstr "" +#: ../../library/asyncio-task.rst:1286 msgid "Return the result of the Task." msgstr "" -msgid "If the Task is *done*, the result of the wrapped coroutine is returned (or if the coroutine raised an exception, that exception is re-raised.)" +#: ../../library/asyncio-task.rst:1288 +msgid "" +"If the Task is *done*, the result of the wrapped coroutine is returned (or " +"if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -msgid "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` exception." +#: ../../library/asyncio-task.rst:1292 ../../library/asyncio-task.rst:1306 +msgid "" +"If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " +"exception." msgstr "" -msgid "If the Task's result isn't yet available, this method raises an :exc:`InvalidStateError` exception." +#: ../../library/asyncio-task.rst:1295 +msgid "" +"If the Task's result isn't yet available, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" +#: ../../library/asyncio-task.rst:1300 msgid "Return the exception of the Task." msgstr "" -msgid "If the wrapped coroutine raised an exception that exception is returned. If the wrapped coroutine returned normally this method returns ``None``." +#: ../../library/asyncio-task.rst:1302 +msgid "" +"If the wrapped coroutine raised an exception that exception is returned. If " +"the wrapped coroutine returned normally this method returns ``None``." msgstr "" -msgid "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` exception." +#: ../../library/asyncio-task.rst:1309 +msgid "" +"If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " +"exception." msgstr "" +#: ../../library/asyncio-task.rst:1314 msgid "Add a callback to be run when the Task is *done*." msgstr "" +#: ../../library/asyncio-task.rst:1316 ../../library/asyncio-task.rst:1325 msgid "This method should only be used in low-level callback-based code." msgstr "" -msgid "See the documentation of :meth:`Future.add_done_callback` for more details." +#: ../../library/asyncio-task.rst:1318 +msgid "" +"See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" +#: ../../library/asyncio-task.rst:1323 msgid "Remove *callback* from the callbacks list." msgstr "" -msgid "See the documentation of :meth:`Future.remove_done_callback` for more details." +#: ../../library/asyncio-task.rst:1327 +msgid "" +"See the documentation of :meth:`Future.remove_done_callback` for more " +"details." msgstr "" +#: ../../library/asyncio-task.rst:1332 msgid "Return the list of stack frames for this Task." msgstr "" -msgid "If the wrapped coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames." +#: ../../library/asyncio-task.rst:1334 +msgid "" +"If the wrapped coroutine is not done, this returns the stack where it is " +"suspended. If the coroutine has completed successfully or was cancelled, " +"this returns an empty list. If the coroutine was terminated by an exception, " +"this returns the list of traceback frames." msgstr "" +#: ../../library/asyncio-task.rst:1340 msgid "The frames are always ordered from oldest to newest." msgstr "" +#: ../../library/asyncio-task.rst:1342 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -msgid "The optional *limit* argument sets the maximum number of frames to return; by default all available frames are returned. The ordering of the returned list differs depending on whether a stack or a traceback is returned: the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.)" +#: ../../library/asyncio-task.rst:1344 +msgid "" +"The optional *limit* argument sets the maximum number of frames to return; " +"by default all available frames are returned. The ordering of the returned " +"list differs depending on whether a stack or a traceback is returned: the " +"newest frames of a stack are returned, but the oldest frames of a traceback " +"are returned. (This matches the behavior of the traceback module.)" msgstr "" +#: ../../library/asyncio-task.rst:1353 msgid "Print the stack or traceback for this Task." msgstr "" -msgid "This produces output similar to that of the traceback module for the frames retrieved by :meth:`get_stack`." +#: ../../library/asyncio-task.rst:1355 +msgid "" +"This produces output similar to that of the traceback module for the frames " +"retrieved by :meth:`get_stack`." msgstr "" +#: ../../library/asyncio-task.rst:1358 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -msgid "The *file* argument is an I/O stream to which the output is written; by default output is written to :data:`sys.stdout`." +#: ../../library/asyncio-task.rst:1360 +msgid "" +"The *file* argument is an I/O stream to which the output is written; by " +"default output is written to :data:`sys.stdout`." msgstr "" +#: ../../library/asyncio-task.rst:1365 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -msgid "This will return ``None`` for Tasks which have already completed eagerly. See the :ref:`Eager Task Factory `." +#: ../../library/asyncio-task.rst:1369 +msgid "" +"This will return ``None`` for Tasks which have already completed eagerly. " +"See the :ref:`Eager Task Factory `." msgstr "" +#: ../../library/asyncio-task.rst:1376 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -msgid "Return the :class:`contextvars.Context` object associated with the task." +#: ../../library/asyncio-task.rst:1380 +msgid "" +"Return the :class:`contextvars.Context` object associated with the task." msgstr "" +#: ../../library/asyncio-task.rst:1387 msgid "Return the name of the Task." msgstr "" -msgid "If no name has been explicitly assigned to the Task, the default asyncio Task implementation generates a default name during instantiation." +#: ../../library/asyncio-task.rst:1389 +msgid "" +"If no name has been explicitly assigned to the Task, the default asyncio " +"Task implementation generates a default name during instantiation." msgstr "" +#: ../../library/asyncio-task.rst:1397 msgid "Set the name of the Task." msgstr "" -msgid "The *value* argument can be any object, which is then converted to a string." +#: ../../library/asyncio-task.rst:1399 +msgid "" +"The *value* argument can be any object, which is then converted to a string." msgstr "" -msgid "In the default Task implementation, the name will be visible in the :func:`repr` output of a task object." +#: ../../library/asyncio-task.rst:1402 +msgid "" +"In the default Task implementation, the name will be visible in " +"the :func:`repr` output of a task object." msgstr "" +#: ../../library/asyncio-task.rst:1409 msgid "Request the Task to be cancelled." msgstr "" -msgid "If the Task is already *done* or *cancelled*, return ``False``, otherwise, return ``True``." +#: ../../library/asyncio-task.rst:1411 +msgid "" +"If the Task is already *done* or *cancelled*, return ``False``, otherwise, " +"return ``True``." msgstr "" -msgid "The method arranges for a :exc:`CancelledError` exception to be thrown into the wrapped coroutine on the next cycle of the event loop." +#: ../../library/asyncio-task.rst:1414 +msgid "" +"The method arranges for a :exc:`CancelledError` exception to be thrown into " +"the wrapped coroutine on the next cycle of the event loop." msgstr "" -msgid "The coroutine then has a chance to clean up or even deny the request by suppressing the exception with a :keyword:`try` ... ... ``except CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will be cancelled, although suppressing cancellation completely is not common and is actively discouraged. Should the coroutine nevertheless decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` in addition to catching the exception." +#: ../../library/asyncio-task.rst:1417 +msgid "" +"The coroutine then has a chance to clean up or even deny the request by " +"suppressing the exception with a :keyword:`try` ... ... ``except " +"CancelledError`` ... :keyword:`finally` block. Therefore, " +"unlike :meth:`Future.cancel`, :meth:`Task.cancel` does not guarantee that " +"the Task will be cancelled, although suppressing cancellation completely is " +"not common and is actively discouraged. Should the coroutine nevertheless " +"decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` " +"in addition to catching the exception." msgstr "" +#: ../../library/asyncio-task.rst:1427 msgid "Added the *msg* parameter." msgstr "" +#: ../../library/asyncio-task.rst:1430 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -msgid "The following example illustrates how coroutines can intercept the cancellation request::" +#: ../../library/asyncio-task.rst:1435 +msgid "" +"The following example illustrates how coroutines can intercept the " +"cancellation request::" msgstr "" +#: ../../library/asyncio-task.rst:1438 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1202,24 +1899,41 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" +#: ../../library/asyncio-task.rst:1474 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -msgid "The Task is *cancelled* when the cancellation was requested with :meth:`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` exception thrown into it." +#: ../../library/asyncio-task.rst:1476 +msgid "" +"The Task is *cancelled* when the cancellation was requested " +"with :meth:`cancel` and the wrapped coroutine propagated " +"the :exc:`CancelledError` exception thrown into it." msgstr "" +#: ../../library/asyncio-task.rst:1482 msgid "Decrement the count of cancellation requests to this Task." msgstr "" +#: ../../library/asyncio-task.rst:1484 msgid "Returns the remaining number of cancellation requests." msgstr "" -msgid "Note that once execution of a cancelled task completed, further calls to :meth:`uncancel` are ineffective." +#: ../../library/asyncio-task.rst:1486 +msgid "" +"Note that once execution of a cancelled task completed, further calls " +"to :meth:`uncancel` are ineffective." msgstr "" -msgid "This method is used by asyncio's internals and isn't expected to be used by end-user code. In particular, if a Task gets successfully uncancelled, this allows for elements of structured concurrency like :ref:`taskgroups` and :func:`asyncio.timeout` to continue running, isolating cancellation to the respective structured block. For example::" +#: ../../library/asyncio-task.rst:1491 +msgid "" +"This method is used by asyncio's internals and isn't expected to be used by " +"end-user code. In particular, if a Task gets successfully uncancelled, this " +"allows for elements of structured concurrency like :ref:`taskgroups` " +"and :func:`asyncio.timeout` to continue running, isolating cancellation to " +"the respective structured block. For example::" msgstr "" +#: ../../library/asyncio-task.rst:1498 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1233,23 +1947,52 @@ msgid "" " await unrelated_code()" msgstr "" -msgid "While the block with ``make_request()`` and ``make_another_request()`` might get cancelled due to the timeout, ``unrelated_code()`` should continue running even in case of the timeout. This is implemented with :meth:`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a similar fashion." +#: ../../library/asyncio-task.rst:1509 +msgid "" +"While the block with ``make_request()`` and ``make_another_request()`` might " +"get cancelled due to the timeout, ``unrelated_code()`` should continue " +"running even in case of the timeout. This is implemented " +"with :meth:`uncancel`. :class:`TaskGroup` context managers " +"use :func:`uncancel` in a similar fashion." msgstr "" -msgid "If end-user code is, for some reason, suppressing cancellation by catching :exc:`CancelledError`, it needs to call this method to remove the cancellation state." +#: ../../library/asyncio-task.rst:1515 +msgid "" +"If end-user code is, for some reason, suppressing cancellation by " +"catching :exc:`CancelledError`, it needs to call this method to remove the " +"cancellation state." msgstr "" -msgid "When this method decrements the cancellation count to zero, the method checks if a previous :meth:`cancel` call had arranged for :exc:`CancelledError` to be thrown into the task. If it hasn't been thrown yet, that arrangement will be rescinded (by resetting the internal ``_must_cancel`` flag)." +#: ../../library/asyncio-task.rst:1519 +msgid "" +"When this method decrements the cancellation count to zero, the method " +"checks if a previous :meth:`cancel` call had arranged " +"for :exc:`CancelledError` to be thrown into the task. If it hasn't been " +"thrown yet, that arrangement will be rescinded (by resetting the internal " +"``_must_cancel`` flag)." msgstr "" +#: ../../library/asyncio-task.rst:1525 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -msgid "Return the number of pending cancellation requests to this Task, i.e., the number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." +#: ../../library/asyncio-task.rst:1530 +msgid "" +"Return the number of pending cancellation requests to this Task, i.e., the " +"number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -msgid "Note that if this number is greater than zero but the Task is still executing, :meth:`cancelled` will still return ``False``. This is because this number can be lowered by calling :meth:`uncancel`, which can lead to the task not being cancelled after all if the cancellation requests go down to zero." +#: ../../library/asyncio-task.rst:1534 +msgid "" +"Note that if this number is greater than zero but the Task is still " +"executing, :meth:`cancelled` will still return ``False``. This is because " +"this number can be lowered by calling :meth:`uncancel`, which can lead to " +"the task not being cancelled after all if the cancellation requests go down " +"to zero." msgstr "" -msgid "This method is used by asyncio's internals and isn't expected to be used by end-user code. See :meth:`uncancel` for more details." +#: ../../library/asyncio-task.rst:1540 +msgid "" +"This method is used by asyncio's internals and isn't expected to be used by " +"end-user code. See :meth:`uncancel` for more details." msgstr "" diff --git a/library/asyncio-threading.po b/library/asyncio-threading.po new file mode 100644 index 000000000..a2314d9c6 --- /dev/null +++ b/library/asyncio-threading.po @@ -0,0 +1,211 @@ +# Persian translations for Python package. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# Automatically generated, 2026. +# +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" +"PO-Revision-Date: 2026-08-25 20:39+0330\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fa\n" + +#: ../../library/asyncio-threading.rst:6 +msgid "asyncio and free-threaded Python" +msgstr "" + +#: ../../library/asyncio-threading.rst:8 +msgid "" +"asyncio uses an event loop as a scheduler to enable highly efficient " +"concurrency by switching between tasks to allow non-blocking I/O operations. " +"This results in better performance for I/O-bound use cases. It also allows " +"off-loading CPU-bound work to a thread or process pool, but that is still " +"limited by the :term:`global interpreter lock` in CPython." +msgstr "" + +#: ../../library/asyncio-threading.rst:15 +msgid "" +"However, in :ref:`free-threaded Python `, the " +"GIL is disabled and Python can run true multi-threaded code. This means that " +"asyncio can now take advantage of multiple CPU cores without the limitations " +"imposed by the GIL." +msgstr "" + +#: ../../library/asyncio-threading.rst:20 +msgid "" +"Since Python 3.14, asyncio has first-class support for free-threaded Python, " +"and the implementation of asyncio is safe to use in a multi-threaded " +"environment." +msgstr "" + +#: ../../library/asyncio-threading.rst:24 +msgid "" +"A single event loop on one core can handle many connections concurrently, " +"but the Python code that runs to handle each one still executes serially. " +"Once requests involve a non-trivial amount of per-request computation, that " +"handling becomes the bottleneck, and a single core can no longer keep up. " +"Combining asyncio with threads is most useful here: by running an event loop " +"per thread, the handling of different requests can run in parallel across " +"multiple CPU cores. It is also useful when you need to run blocking or CPU-" +"bound code from an asyncio application." +msgstr "" + +#: ../../library/asyncio-threading.rst:37 +msgid "" +"`Scaling asyncio on Free-Threaded Python `__, a blog post by Kumar Aditya " +"which explains the internal changes that make asyncio safe and efficient " +"under free-threaded Python, together with benchmarks of the resulting " +"improvements." +msgstr "" + +#: ../../library/asyncio-threading.rst:45 +msgid "Thread safety considerations" +msgstr "" + +#: ../../library/asyncio-threading.rst:47 +msgid "" +"While asyncio is designed to be thread-safe in a free-threaded Python " +"environment, there are still some considerations to keep in mind when using " +"asyncio with threads:" +msgstr "" + +#: ../../library/asyncio-threading.rst:51 +msgid "" +"**Event loop**: Each thread should have its own event loop which should not " +"be shared across threads. This ensures that the event loop can manage its " +"own tasks and callbacks without interference from other threads." +msgstr "" + +#: ../../library/asyncio-threading.rst:56 +msgid "" +"**Task management**: Tasks and futures created in one thread should not be " +"awaited or manipulated from another thread." +msgstr "" + +#: ../../library/asyncio-threading.rst:59 +msgid "" +"**Thread-safe APIs**: When interacting with asyncio from multiple threads, " +"it's important to use thread-safe APIs provided by asyncio, such " +"as :func:`asyncio.run_coroutine_threadsafe` for submitting coroutines to an " +"event loop from another thread. If you need to call a callback from a " +"different thread, you can use :meth:`loop.call_soon_threadsafe` to schedule " +"it safely." +msgstr "" + +#: ../../library/asyncio-threading.rst:66 +msgid "" +"**Synchronization**: The synchronization primitives provided by asyncio " +"(like :class:`asyncio.Lock` and :class:`asyncio.Event`) are not designed to " +"be used across threads. If you need to synchronize between threads, you " +"should use the synchronization primitives from the :mod:`threading` module " +"instead." +msgstr "" + +#: ../../library/asyncio-threading.rst:74 +msgid "Using asyncio with threads" +msgstr "" + +#: ../../library/asyncio-threading.rst:76 +msgid "" +"asyncio supports running one event loop per thread, which allows you to take " +"advantage of multiple CPU cores in a free-threaded Python environment. Each " +"thread can run its own event loop, and tasks can be scheduled on those loops " +"independently." +msgstr "" + +#: ../../library/asyncio-threading.rst:81 +msgid "Here's an example of how to use asyncio with threads::" +msgstr "" + +#: ../../library/asyncio-threading.rst:83 +msgid "" +"import asyncio\n" +"import threading\n" +"\n" +"async def worker(name: str) -> None:\n" +" print(f\"Worker {name} starting\")\n" +" await asyncio.sleep(1)\n" +" print(f\"Worker {name} done\")\n" +"\n" +"def run_loop(name: str) -> None:\n" +" asyncio.run(worker(name))\n" +"\n" +"threads = [\n" +" threading.Thread(target=run_loop, args=(f\"T{i}\",))\n" +" for i in range(4)\n" +"]\n" +"for t in threads:\n" +" t.start()\n" +"for t in threads:\n" +" t.join()" +msgstr "" + +#: ../../library/asyncio-threading.rst:103 +msgid "" +"In this example, each thread creates its own event loop " +"with :func:`asyncio.run` and runs a coroutine on it. The threads execute " +"concurrently, and in a free-threaded build they can run on separate CPU " +"cores in parallel." +msgstr "" + +#: ../../library/asyncio-threading.rst:110 +msgid "Producer/consumer across threads" +msgstr "" + +#: ../../library/asyncio-threading.rst:112 +msgid "" +"When a regular (non-asyncio) thread needs to hand work to an asyncio event " +"loop running in another thread, use a thread-safe primitive such " +"as :class:`queue.Queue` rather than :class:`asyncio.Queue`, which is only " +"safe within a single event loop.::" +msgstr "" + +#: ../../library/asyncio-threading.rst:117 +msgid "" +"import asyncio\n" +"import queue\n" +"import threading\n" +"\n" +"def producer(q: queue.Queue[int]) -> None:\n" +" for i in range(5):\n" +" print(f\"Producing {i}\")\n" +" q.put(i)\n" +" q.shutdown()\n" +"\n" +"async def consumer(q: queue.Queue[int]) -> None:\n" +" while True:\n" +" try:\n" +" item = q.get_nowait()\n" +" except queue.Empty:\n" +" await asyncio.sleep(0.1)\n" +" continue\n" +" except queue.ShutDown:\n" +" break\n" +" print(f\"Consumed {item}\")\n" +" await asyncio.sleep(item)\n" +"\n" +"q: queue.Queue[int] = queue.Queue()\n" +"consumer_thread = threading.Thread(\n" +" target=lambda: asyncio.run(consumer(q))\n" +")\n" +"consumer_thread.start()\n" +"producer(q)\n" +"consumer_thread.join()" +msgstr "" + +#: ../../library/asyncio-threading.rst:147 +msgid "" +"The producer runs on the main thread while the consumer runs inside an event " +"loop on its own thread, yet they communicate safely through ``queue.Queue``. " +"When the queue is empty the consumer sleeps briefly and tries again. When " +"the producer is done it calls :meth:`~queue.Queue.shutdown`, which causes " +"subsequent :meth:`~queue.Queue.get_nowait` calls to " +"raise :exc:`queue.ShutDown` so the consumer can exit cleanly." +msgstr "" diff --git a/library/asyncio-tools.po b/library/asyncio-tools.po new file mode 100644 index 000000000..98a97173f --- /dev/null +++ b/library/asyncio-tools.po @@ -0,0 +1,222 @@ +# Persian translations for Python package. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# Automatically generated, 2026. +# +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" +"PO-Revision-Date: 2026-08-25 20:39+0330\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fa\n" + +#: ../../library/asyncio-tools.rst:7 +msgid "Command-line introspection tools" +msgstr "" + +#: ../../library/asyncio-tools.rst:9 +msgid "**Source code:** :source:`Lib/asyncio/tools.py`" +msgstr "" + +#: ../../library/asyncio-tools.rst:13 +msgid "" +"The :mod:`!asyncio` module can be invoked as a script via ``python -m " +"asyncio`` to inspect the task graph of another running Python process " +"without modifying it or restarting it. The :mod:`!asyncio.tools` submodule " +"implements this interface." +msgstr "" + +#: ../../library/asyncio-tools.rst:18 +msgid "The following commands inspect the process identified by ``PID``:" +msgstr "" + +#: ../../library/asyncio-tools.rst:20 +msgid "" +"$ python -m asyncio pstree PID\n" +"$ python -m asyncio ps PID" +msgstr "" + +#: ../../library/asyncio-tools.rst:25 +msgid "" +"The commands read the target process state without executing any code in it. " +"They are only available on supported platforms and may require permission to " +"inspect another process. See the :ref:`permission requirements ` for details." +msgstr "" + +#: ../../library/asyncio-tools.rst:31 +msgid ":ref:`asyncio-graph`" +msgstr "" + +#: ../../library/asyncio-tools.rst:32 +msgid "" +"Programmatic APIs for inspecting the async call graph of a task or future in " +"the current process." +msgstr "" + +#: ../../library/asyncio-tools.rst:35 +msgid "" +"The command examples below use this program, which creates a task hierarchy " +"suitable for inspection and prints its process ID:" +msgstr "" + +#: ../../library/asyncio-tools.rst:38 +msgid "example.py" +msgstr "" + +#: ../../library/asyncio-tools.rst:38 +msgid "" +"import asyncio\n" +"import os\n" +"\n" +"async def play(track):\n" +" await asyncio.sleep(3600)\n" +" print(f\"🎵 Finished: {track}\")\n" +"\n" +"async def album(name, tracks):\n" +" async with asyncio.TaskGroup() as tg:\n" +" for track in tracks:\n" +" tg.create_task(play(track), name=track)\n" +"\n" +"async def main():\n" +" print(f\"PID: {os.getpid()}\")\n" +" async with asyncio.TaskGroup() as tg:\n" +" tg.create_task(\n" +" album(\"Sundowning\", [\"TNDNBTG\", \"Levitate\"]),\n" +" name=\"Sundowning\",\n" +" )\n" +" tg.create_task(\n" +" album(\"TMBTE\", [\"DYWTYLM\", \"Aqua Regia\"]),\n" +" name=\"TMBTE\",\n" +" )\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: ../../library/asyncio-tools.rst:67 +msgid "Run the program in one terminal and leave it running:" +msgstr "" + +#: ../../library/asyncio-tools.rst:69 +msgid "" +"$ python example.py\n" +"PID: 12345" +msgstr "" + +#: ../../library/asyncio-tools.rst:74 +msgid "" +"Then pass the printed process ID to the commands from another terminal. " +"Thread IDs, task IDs, file paths, and line numbers vary between runs and " +"source layouts." +msgstr "" + +#: ../../library/asyncio-tools.rst:81 +msgid "Command-line options" +msgstr "" + +#: ../../library/asyncio-tools.rst:85 +msgid "" +"Display task and coroutine relationships as a tree. Each task is shown with " +"its full coroutine stack, nested under the task (if any) that is awaiting " +"it. This subcommand is useful for quickly identifying which branch of a " +"task hierarchy is blocked and where in its coroutine stack execution has " +"paused:" +msgstr "" + +#: ../../library/asyncio-tools.rst:91 +msgid "" +"$ python -m asyncio pstree 12345\n" +"└── (T) Task-1\n" +" └── main example.py:12\n" +" └── TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:75\n" +" └── TaskGroup._aexit Lib/asyncio/taskgroups.py:124\n" +" ├── (T) Sundowning\n" +" │ └── album example.py:7\n" +" │ └── TaskGroup.__aexit__ Lib/asyncio/" +"taskgroups.py:75\n" +" │ └── TaskGroup._aexit Lib/asyncio/" +"taskgroups.py:124\n" +" │ ├── (T) TNDNBTG\n" +" │ │ └── play example.py:4\n" +" │ │ └── sleep Lib/asyncio/tasks.py:702\n" +" │ └── (T) Levitate\n" +" │ └── play example.py:4\n" +" │ └── sleep Lib/asyncio/tasks.py:702\n" +" └── (T) TMBTE\n" +" └── album example.py:7\n" +" └── TaskGroup.__aexit__ Lib/asyncio/" +"taskgroups.py:75\n" +" └── TaskGroup._aexit Lib/asyncio/" +"taskgroups.py:124\n" +" ├── (T) DYWTYLM\n" +" │ └── play example.py:4\n" +" │ └── sleep Lib/asyncio/tasks.py:702\n" +" └── (T) Aqua Regia\n" +" └── play example.py:4\n" +" └── sleep Lib/asyncio/tasks.py:702" +msgstr "" + +#: ../../library/asyncio-tools.rst:119 +msgid "" +"If the await graph contains a cycle, ``pstree`` reports an error instead of " +"printing a tree. A cycle in the await graph is unusual and typically " +"indicates a programming error:" +msgstr "" + +#: ../../library/asyncio-tools.rst:123 +msgid "" +"$ python -m asyncio pstree 12345\n" +"ERROR: await-graph contains cycles - cannot print a tree!\n" +"\n" +"cycle: Task-2 → Task-3 → Task-2" +msgstr "" + +#: ../../library/asyncio-tools.rst:132 +msgid "" +"Display a flat table of all pending tasks in the process *PID*. Each row " +"shows the event-loop thread ID, task ID and name, coroutine stack, and the " +"awaiting task's stack, name, and ID, if any." +msgstr "" + +#: ../../library/asyncio-tools.rst:136 +msgid "" +"This subcommand prints all tasks regardless of whether the await graph " +"contains cycles:" +msgstr "" + +#: ../../library/asyncio-tools.rst:139 +msgid "" +"$ python -m asyncio ps 12345\n" +"tid task id task name coroutine " +"stack awaiter " +"chain awaiter name awaiter id\n" +"------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +"18445801 0x10a456060 Task-1 TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> " +"main " +"0x0\n" +"18445801 0x10a439f60 Sundowning TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> " +"main Task-1 0x10a456060\n" +"18445801 0x10a439d70 TMBTE TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> " +"main Task-1 0x10a456060\n" +"18445801 0x10a2a3a80 TNDNBTG sleep -> " +"play TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album Sundowning 0x10a439f60\n" +"18445801 0x10a2a38a0 Levitate sleep -> " +"play TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album Sundowning 0x10a439f60\n" +"18445801 0x10a2d7150 DYWTYLM sleep -> " +"play TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album TMBTE 0x10a439d70\n" +"18445801 0x10a6bdaa0 Aqua Regia sleep -> " +"play TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album TMBTE 0x10a439d70" +msgstr "" diff --git a/library/asyncio.po b/library/asyncio.po index eadbf72a0..402c38946 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,21 +23,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncio.rst:107 msgid "High-level APIs" msgstr "" +#: ../../library/asyncio.rst:119 +msgid "Introspection APIs" +msgstr "" + +#: ../../library/asyncio.rst:126 msgid "Low-level APIs" msgstr "" +#: ../../library/asyncio.rst:137 msgid "Guides and Tutorials" msgstr "" +#: ../../library/asyncio.rst:2 msgid ":mod:`!asyncio` --- Asynchronous I/O" msgstr "" +#: ../../library/asyncio.rst:-1 msgid "Hello World!" msgstr "" +#: ../../library/asyncio.rst:13 msgid "" "import asyncio\n" "\n" @@ -49,87 +59,159 @@ msgid "" "asyncio.run(main())" msgstr "" -msgid "asyncio is a library to write **concurrent** code using the **async/await** syntax." +#: ../../library/asyncio.rst:22 +msgid "" +"asyncio is a library to write **concurrent** code using the **async/await** " +"syntax." msgstr "" -msgid "asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers, database connection libraries, distributed task queues, etc." +#: ../../library/asyncio.rst:25 +msgid "" +"asyncio is used as a foundation for multiple Python asynchronous frameworks " +"that provide high-performance network and web-servers, database connection " +"libraries, distributed task queues, etc." msgstr "" -msgid "asyncio is often a perfect fit for IO-bound and high-level **structured** network code." +#: ../../library/asyncio.rst:29 +msgid "" +"asyncio is often a perfect fit for IO-bound and high-level **structured** " +"network code." msgstr "" +#: ../../library/asyncio.rst:34 msgid ":ref:`a-conceptual-overview-of-asyncio`" msgstr "" +#: ../../library/asyncio.rst:35 msgid "Explanation of the fundamentals of asyncio." msgstr "" +#: ../../library/asyncio.rst:37 msgid "asyncio provides a set of **high-level** APIs to:" msgstr "" -msgid ":ref:`run Python coroutines ` concurrently and have full control over their execution;" +#: ../../library/asyncio.rst:39 +msgid "" +":ref:`run Python coroutines ` concurrently and have full control " +"over their execution;" msgstr "" +#: ../../library/asyncio.rst:42 msgid "perform :ref:`network IO and IPC `;" msgstr "" +#: ../../library/asyncio.rst:44 msgid "control :ref:`subprocesses `;" msgstr "" +#: ../../library/asyncio.rst:46 msgid "distribute tasks via :ref:`queues `;" msgstr "" +#: ../../library/asyncio.rst:48 msgid ":ref:`synchronize ` concurrent code;" msgstr "" -msgid "Additionally, there are **low-level** APIs for *library and framework developers* to:" +#: ../../library/asyncio.rst:50 +msgid "For **introspection**, asyncio provides APIs and tools for:" msgstr "" -msgid "create and manage :ref:`event loops `, which provide asynchronous APIs for :ref:`networking `, running :ref:`subprocesses `, handling :ref:`OS signals `, etc;" +#: ../../library/asyncio.rst:52 +msgid "" +"inspecting the :ref:`async call graph ` of tasks and futures;" +msgstr "" + +#: ../../library/asyncio.rst:54 +msgid "" +"inspecting tasks in another running Python process with :ref:`command-line " +"tools `;" msgstr "" -msgid "implement efficient protocols using :ref:`transports `;" +#: ../../library/asyncio.rst:57 +msgid "" +"Additionally, there are **low-level** APIs for *library and framework " +"developers* to:" msgstr "" -msgid ":ref:`bridge ` callback-based libraries and code with async/await syntax." +#: ../../library/asyncio.rst:60 +msgid "" +"create and manage :ref:`event loops `, which provide " +"asynchronous APIs for :ref:`networking `, " +"running :ref:`subprocesses `, handling :ref:`OS " +"signals `, etc;" msgstr "" +#: ../../library/asyncio.rst:65 +msgid "" +"implement efficient protocols using :ref:`transports `;" +msgstr "" + +#: ../../library/asyncio.rst:68 +msgid "" +":ref:`bridge ` callback-based libraries and code with async/" +"await syntax." +msgstr "" + +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/asyncio.rst:76 msgid "asyncio REPL" msgstr "" -msgid "You can experiment with an ``asyncio`` concurrent context in the :term:`REPL`:" +#: ../../library/asyncio.rst:77 +msgid "" +"You can experiment with an ``asyncio`` concurrent context in " +"the :term:`REPL`:" msgstr "" +#: ../../library/asyncio.rst:79 msgid "" "$ python -m asyncio\n" "asyncio REPL ...\n" "Use \"await\" directly instead of \"asyncio.run()\".\n" -"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" ">>> import asyncio\n" ">>> await asyncio.sleep(10, result='hello')\n" "'hello'" msgstr "" -msgid "This REPL provides limited compatibility with :envvar:`PYTHON_BASIC_REPL`. It is recommended that the default REPL is used for full functionality and the latest features." +#: ../../library/asyncio.rst:89 +msgid "" +"This REPL provides limited compatibility with :envvar:`PYTHON_BASIC_REPL`. " +"It is recommended that the default REPL is used for full functionality and " +"the latest features." msgstr "" -msgid "Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no arguments." +#: ../../library/asyncio.rst:93 +msgid "" +"Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no " +"arguments." msgstr "" +#: ../../library/asyncio.rst:95 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -msgid "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also executed. Emits audit events." +#: ../../library/asyncio.rst:98 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." msgstr "" +#: ../../library/asyncio.rst:106 msgid "Reference" msgstr "" +#: ../../library/asyncio.rst:147 msgid "The source code for asyncio can be found in :source:`Lib/asyncio/`." msgstr "" diff --git a/library/asyncore.po b/library/asyncore.po index e9d3b74d2..23842f142 100644 --- a/library/asyncore.po +++ b/library/asyncore.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,23 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/asyncore.rst:2 msgid ":mod:`!asyncore` --- Asynchronous socket handler" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 ` after being deprecated in Python 3.6. The removal was decided in :pep:`594`." +#: ../../library/asyncore.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.12 ` after being " +"deprecated in Python 3.6. The removal was decided in :pep:`594`." msgstr "" +#: ../../library/asyncore.rst:14 msgid "Applications should use the :mod:`asyncio` module instead." msgstr "" -msgid "The last version of Python that provided the :mod:`!asyncore` module was `Python 3.11 `_." +#: ../../library/asyncore.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!asyncore` module was " +"`Python 3.11 `_." msgstr "" diff --git a/library/atexit.po b/library/atexit.po index 3f2c0e81a..720f9e8b3 100644 --- a/library/atexit.po +++ b/library/atexit.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,54 +21,118 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/atexit.rst:2 msgid ":mod:`!atexit` --- Exit handlers" msgstr "" -msgid "The :mod:`!atexit` module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination. :mod:`!atexit` runs these functions in the *reverse* order in which they were registered; if you register ``A``, ``B``, and ``C``, at interpreter termination time they will be run in the order ``C``, ``B``, ``A``." +#: ../../library/atexit.rst:12 +msgid "" +"The :mod:`!atexit` module defines functions to register and unregister " +"cleanup functions. Functions thus registered are automatically executed " +"upon normal interpreter termination. :mod:`!atexit` runs these functions in " +"the *reverse* order in which they were registered; if you register ``A``, " +"``B``, and ``C``, at interpreter termination time they will be run in the " +"order ``C``, ``B``, ``A``." msgstr "" -msgid "**Note:** The functions registered via this module are not called when the program is killed by a signal not handled by Python, when a Python fatal internal error is detected, or when :func:`os._exit` is called." +#: ../../library/atexit.rst:19 +msgid "" +"**Note:** The functions registered via this module are not called when the " +"program is killed by a signal not handled by Python, when a Python fatal " +"internal error is detected, or when :func:`os._exit` is called." msgstr "" -msgid "**Note:** The effect of registering or unregistering functions from within a cleanup function is undefined." +#: ../../library/atexit.rst:23 +msgid "" +"**Note:** The effect of registering or unregistering functions from within a " +"cleanup function is undefined." msgstr "" -msgid "When used with C-API subinterpreters, registered functions are local to the interpreter they were registered in." +#: ../../library/atexit.rst:26 +msgid "" +"When used with C-API subinterpreters, registered functions are local to the " +"interpreter they were registered in." msgstr "" -msgid "Register *func* as a function to be executed at termination. Any optional arguments that are to be passed to *func* must be passed as arguments to :func:`register`. It is possible to register the same function and arguments more than once." +#: ../../library/atexit.rst:32 +msgid "" +"Register *func* as a function to be executed at termination. Any optional " +"arguments that are to be passed to *func* must be passed as arguments " +"to :func:`register`. It is possible to register the same function and " +"arguments more than once." msgstr "" -msgid "At normal program termination (for instance, if :func:`sys.exit` is called or the main module's execution completes), all functions registered are called in last in, first out order. The assumption is that lower level modules will normally be imported before higher level modules and thus must be cleaned up later." +#: ../../library/atexit.rst:37 +msgid "" +"At normal program termination (for instance, if :func:`sys.exit` is called " +"or the main module's execution completes), all functions registered are " +"called in last in, first out order. The assumption is that lower level " +"modules will normally be imported before higher level modules and thus must " +"be cleaned up later." msgstr "" -msgid "If an exception is raised during execution of the exit handlers, a traceback is printed (unless :exc:`SystemExit` is raised) and the exception information is saved. After all exit handlers have had a chance to run, the last exception to be raised is re-raised." +#: ../../library/atexit.rst:43 +msgid "" +"If an exception is raised during execution of the exit handlers, a traceback " +"is printed (unless :exc:`SystemExit` is raised) and the exception " +"information is saved. After all exit handlers have had a chance to run, the " +"last exception to be raised is re-raised." msgstr "" -msgid "This function returns *func*, which makes it possible to use it as a decorator." +#: ../../library/atexit.rst:48 +msgid "" +"This function returns *func*, which makes it possible to use it as a " +"decorator." msgstr "" -msgid "Starting new threads or calling :func:`os.fork` from a registered function can lead to race condition between the main Python runtime thread freeing thread states while internal :mod:`threading` routines or the new process try to use that state. This can lead to crashes rather than clean shutdown." +#: ../../library/atexit.rst:52 +msgid "" +"Starting new threads or calling :func:`os.fork` from a registered function " +"can lead to race condition between the main Python runtime thread freeing " +"thread states while internal :mod:`threading` routines or the new process " +"try to use that state. This can lead to crashes rather than clean shutdown." msgstr "" -msgid "Attempts to start a new thread or :func:`os.fork` a new process in a registered function now leads to :exc:`RuntimeError`." +#: ../../library/atexit.rst:58 +msgid "" +"Attempts to start a new thread or :func:`os.fork` a new process in a " +"registered function now leads to :exc:`RuntimeError`." msgstr "" -msgid "Remove *func* from the list of functions to be run at interpreter shutdown. :func:`unregister` silently does nothing if *func* was not previously registered. If *func* has been registered more than once, every occurrence of that function in the :mod:`!atexit` call stack will be removed. Equality comparisons (``==``) are used internally during unregistration, so function references do not need to have matching identities." +#: ../../library/atexit.rst:64 +msgid "" +"Remove *func* from the list of functions to be run at interpreter " +"shutdown. :func:`unregister` silently does nothing if *func* was not " +"previously registered. If *func* has been registered more than once, every " +"occurrence of that function in the :mod:`!atexit` call stack will be " +"removed. Equality comparisons (``==``) are used internally during " +"unregistration, so function references do not need to have matching " +"identities." msgstr "" +#: ../../library/atexit.rst:74 msgid "Module :mod:`readline`" msgstr "" -msgid "Useful example of :mod:`!atexit` to read and write :mod:`readline` history files." +#: ../../library/atexit.rst:75 +msgid "" +"Useful example of :mod:`!atexit` to read and write :mod:`readline` history " +"files." msgstr "" +#: ../../library/atexit.rst:82 msgid ":mod:`!atexit` Example" msgstr "" -msgid "The following simple example demonstrates how a module can initialize a counter from a file when it is imported and save the counter's updated value automatically when the program terminates without relying on the application making an explicit call into this module at termination. ::" +#: ../../library/atexit.rst:84 +msgid "" +"The following simple example demonstrates how a module can initialize a " +"counter from a file when it is imported and save the counter's updated value " +"automatically when the program terminates without relying on the application " +"making an explicit call into this module at termination. ::" msgstr "" +#: ../../library/atexit.rst:89 msgid "" "try:\n" " with open('counterfile') as infile:\n" @@ -89,9 +153,13 @@ msgid "" "atexit.register(savecounter)" msgstr "" -msgid "Positional and keyword arguments may also be passed to :func:`register` to be passed along to the registered function when it is called::" +#: ../../library/atexit.rst:107 +msgid "" +"Positional and keyword arguments may also be passed to :func:`register` to " +"be passed along to the registered function when it is called::" msgstr "" +#: ../../library/atexit.rst:110 msgid "" "def goodbye(name, adjective):\n" " print('Goodbye %s, it was %s to meet you.' % (name, adjective))\n" @@ -103,9 +171,11 @@ msgid "" "atexit.register(goodbye, adjective='nice', name='Donny')" msgstr "" +#: ../../library/atexit.rst:119 msgid "Usage as a :term:`decorator`::" msgstr "" +#: ../../library/atexit.rst:121 msgid "" "import atexit\n" "\n" @@ -114,5 +184,6 @@ msgid "" " print('You are now leaving the Python sector.')" msgstr "" +#: ../../library/atexit.rst:127 msgid "This only works with functions that can be called without arguments." msgstr "" diff --git a/library/audioop.po b/library/audioop.po index b65273f79..acbe62ba4 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/audioop.rst:2 msgid ":mod:`!audioop` --- Manipulate raw audio data" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.13 ` after being deprecated in Python 3.11. The removal was decided in :pep:`594`." +#: ../../library/audioop.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.13 ` after being " +"deprecated in Python 3.11. The removal was decided in :pep:`594`." msgstr "" -msgid "The last version of Python that provided the :mod:`!audioop` module was `Python 3.12 `_." +#: ../../library/audioop.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!audioop` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/audit_events.po b/library/audit_events.po index 96b96a8ba..237debd8b 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,80 +23,118 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/audit_events.rst:6 msgid "Audit events table" msgstr "" -msgid "This table contains all events raised by :func:`sys.audit` or :c:func:`PySys_Audit` calls throughout the CPython runtime and the standard library. These calls were added in 3.8 or later (see :pep:`578`)." +#: ../../library/audit_events.rst:8 +msgid "" +"This table contains all events raised by :func:`sys.audit` " +"or :c:func:`PySys_Audit` calls throughout the CPython runtime and the " +"standard library. These calls were added in 3.8 or later (see :pep:`578`)." msgstr "" -msgid "See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for information on handling these events." +#: ../../library/audit_events.rst:12 +msgid "" +"See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for " +"information on handling these events." msgstr "" -msgid "This table is generated from the CPython documentation, and may not represent events raised by other implementations. See your runtime specific documentation for actual events raised." +#: ../../library/audit_events.rst:17 +msgid "" +"This table is generated from the CPython documentation, and may not " +"represent events raised by other implementations. See your runtime specific " +"documentation for actual events raised." msgstr "" -msgid "The following events are raised internally and do not correspond to any public API of CPython:" +#: ../../library/audit_events.rst:23 +msgid "" +"The following events are raised internally and do not correspond to any " +"public API of CPython:" msgstr "" +#: ../../library/audit_events.rst:27 msgid "Audit event" msgstr "" +#: ../../library/audit_events.rst:27 msgid "Arguments" msgstr "" +#: ../../library/audit_events.rst:29 msgid "_winapi.CreateFile" msgstr "" -msgid "``file_name``, ``desired_access``, ``share_mode``, ``creation_disposition``, ``flags_and_attributes``" +#: ../../library/audit_events.rst:29 +msgid "" +"``file_name``, ``desired_access``, ``share_mode``, ``creation_disposition``, " +"``flags_and_attributes``" msgstr "" +#: ../../library/audit_events.rst:33 msgid "_winapi.CreateJunction" msgstr "" +#: ../../library/audit_events.rst:33 msgid "``src_path``, ``dst_path``" msgstr "" +#: ../../library/audit_events.rst:35 msgid "_winapi.CreateNamedPipe" msgstr "" +#: ../../library/audit_events.rst:35 msgid "``name``, ``open_mode``, ``pipe_mode``" msgstr "" +#: ../../library/audit_events.rst:37 msgid "_winapi.CreatePipe" msgstr "" +#: ../../library/audit_events.rst:39 msgid "_winapi.CreateProcess" msgstr "" +#: ../../library/audit_events.rst:39 msgid "``application_name``, ``command_line``, ``current_directory``" msgstr "" +#: ../../library/audit_events.rst:42 msgid "_winapi.OpenProcess" msgstr "" +#: ../../library/audit_events.rst:42 msgid "``process_id``, ``desired_access``" msgstr "" +#: ../../library/audit_events.rst:44 msgid "_winapi.TerminateProcess" msgstr "" +#: ../../library/audit_events.rst:44 msgid "``handle``, ``exit_code``" msgstr "" +#: ../../library/audit_events.rst:46 msgid "_posixsubprocess.fork_exec" msgstr "" +#: ../../library/audit_events.rst:46 msgid "``exec_list``, ``args``, ``env``" msgstr "" +#: ../../library/audit_events.rst:48 msgid "ctypes.PyObj_FromPtr" msgstr "" +#: ../../library/audit_events.rst:48 msgid "``obj``" msgstr "" +#: ../../library/audit_events.rst:51 msgid "The ``_posixsubprocess.fork_exec`` internal audit event." msgstr "" +#: ../../library/audit_events.rst:3 msgid "audit events" msgstr "" diff --git a/library/base64.po b/library/base64.po index f52a2c389..ee4ffe51b 100644 --- a/library/base64.po +++ b/library/base64.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,236 +23,491 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/base64.rst:2 msgid ":mod:`!base64` --- Base16, Base32, Base64, Base85 Data Encodings" msgstr "" +#: ../../library/base64.rst:8 msgid "**Source code:** :source:`Lib/base64.py`" msgstr "" -msgid "This module provides functions for encoding binary data to printable ASCII characters and decoding such encodings back to binary data. This includes the :ref:`encodings specified in ` :rfc:`4648` (Base64, Base32 and Base16), the :ref:`Base85 encoding ` specified in `PDF 2.0 `_, and non-standard variants of Base85 used elsewhere." +#: ../../library/base64.rst:16 +msgid "" +"This module provides functions for encoding binary data to printable ASCII " +"characters and decoding such encodings back to binary data. This includes " +"the :ref:`encodings specified in ` :rfc:`4648` (Base64, " +"Base32 and Base16), the :ref:`Base85 encoding ` specified in " +"`PDF 2.0 `_, and non-standard " +"variants of Base85 used elsewhere." msgstr "" -msgid "There are two interfaces provided by this module. The modern interface supports encoding :term:`bytes-like objects ` to ASCII :class:`bytes`, and decoding :term:`bytes-like objects ` or strings containing ASCII to :class:`bytes`. Both base-64 alphabets defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are supported." +#: ../../library/base64.rst:24 +msgid "" +"There are two interfaces provided by this module. The modern interface " +"supports encoding :term:`bytes-like objects ` to " +"ASCII :class:`bytes`, and decoding :term:`bytes-like objects ` or strings containing ASCII to :class:`bytes`. Both base-64 " +"alphabets defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are " +"supported." msgstr "" -msgid "The :ref:`legacy interface ` does not support decoding from strings, but it does provide functions for encoding and decoding to and from :term:`file objects `. It only supports the Base64 standard alphabet, and it adds newlines every 76 characters as per :rfc:`2045`. Note that if you are looking for :rfc:`2045` support you probably want to be looking at the :mod:`email` package instead." +#: ../../library/base64.rst:30 +msgid "" +"The :ref:`legacy interface ` does not support decoding from " +"strings, but it does provide functions for encoding and decoding to and " +"from :term:`file objects `. It only supports the Base64 " +"standard alphabet, and it adds newlines every 76 characters as " +"per :rfc:`2045`. Note that if you are looking for :rfc:`2045` support you " +"probably want to be looking at the :mod:`email` package instead." msgstr "" -msgid "ASCII-only Unicode strings are now accepted by the decoding functions of the modern interface." +#: ../../library/base64.rst:38 +msgid "" +"ASCII-only Unicode strings are now accepted by the decoding functions of the " +"modern interface." msgstr "" -msgid "Any :term:`bytes-like objects ` are now accepted by all encoding and decoding functions in this module. Ascii85/Base85 support added." +#: ../../library/base64.rst:42 +msgid "" +"Any :term:`bytes-like objects ` are now accepted by all " +"encoding and decoding functions in this module. Ascii85/Base85 support " +"added." msgstr "" +#: ../../library/base64.rst:50 msgid "RFC 4648 Encodings" msgstr "" -msgid "The :rfc:`4648` encodings are suitable for encoding binary data so that it can be safely sent by email, used as parts of URLs, or included as part of an HTTP POST request." +#: ../../library/base64.rst:52 +msgid "" +"The :rfc:`4648` encodings are suitable for encoding binary data so that it " +"can be safely sent by email, used as parts of URLs, or included as part of " +"an HTTP POST request." msgstr "" -msgid "Encode the :term:`bytes-like object` *s* using Base64 and return the encoded :class:`bytes`." +#: ../../library/base64.rst:58 +msgid "" +"Encode the :term:`bytes-like object` *s* using Base64 and return the " +"encoded :class:`bytes`." msgstr "" -msgid "Optional *altchars* must be a :term:`bytes-like object` of length 2 which specifies an alternative alphabet for the ``+`` and ``/`` characters. This allows an application to e.g. generate URL or filesystem safe Base64 strings. The default is ``None``, for which the standard Base64 alphabet is used." +#: ../../library/base64.rst:61 +msgid "" +"Optional *altchars* must be a :term:`bytes-like object` of length 2 which " +"specifies an alternative alphabet for the ``+`` and ``/`` characters. This " +"allows an application to e.g. generate URL or filesystem safe Base64 " +"strings. The default is ``None``, for which the standard Base64 alphabet is " +"used." msgstr "" -msgid "May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2. Raises a :exc:`TypeError` if *altchars* is not a :term:`bytes-like object`." +#: ../../library/base64.rst:66 +msgid "" +"May assert or raise a :exc:`ValueError` if the length of *altchars* is not " +"2. Raises a :exc:`TypeError` if *altchars* is not a :term:`bytes-like " +"object`." msgstr "" -msgid "Decode the Base64 encoded :term:`bytes-like object` or ASCII string *s* and return the decoded :class:`bytes`." +#: ../../library/base64.rst:72 +msgid "" +"Decode the Base64 encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`." msgstr "" -msgid "Optional *altchars* must be a :term:`bytes-like object` or ASCII string of length 2 which specifies the alternative alphabet used instead of the ``+`` and ``/`` characters." +#: ../../library/base64.rst:75 +msgid "" +"Optional *altchars* must be a :term:`bytes-like object` or ASCII string of " +"length 2 which specifies the alternative alphabet used instead of the ``+`` " +"and ``/`` characters." msgstr "" -msgid "A :exc:`binascii.Error` exception is raised if *s* is incorrectly padded." +#: ../../library/base64.rst:79 +msgid "" +"A :exc:`binascii.Error` exception is raised if *s* is incorrectly padded." msgstr "" -msgid "If *validate* is ``False`` (the default), characters that are neither in the normal base-64 alphabet nor the alternative alphabet are discarded prior to the padding check. If *validate* is ``True``, these non-alphabet characters in the input result in a :exc:`binascii.Error`." +#: ../../library/base64.rst:82 +msgid "" +"If *validate* is ``False`` (the default), characters that are neither in the " +"normal base-64 alphabet nor the alternative alphabet are discarded prior to " +"the padding check. If *validate* is ``True``, these non-alphabet characters " +"in the input result in a :exc:`binascii.Error`." msgstr "" -msgid "For more information about the strict base64 check, see :func:`binascii.a2b_base64`" +#: ../../library/base64.rst:88 +msgid "" +"For more information about the strict base64 check, " +"see :func:`binascii.a2b_base64`" msgstr "" -msgid "May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2." +#: ../../library/base64.rst:90 +msgid "" +"May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2." msgstr "" -msgid "Encode :term:`bytes-like object` *s* using the standard Base64 alphabet and return the encoded :class:`bytes`." +#: ../../library/base64.rst:94 +msgid "" +"Encode :term:`bytes-like object` *s* using the standard Base64 alphabet and " +"return the encoded :class:`bytes`." msgstr "" -msgid "Decode :term:`bytes-like object` or ASCII string *s* using the standard Base64 alphabet and return the decoded :class:`bytes`." +#: ../../library/base64.rst:100 +msgid "" +"Decode :term:`bytes-like object` or ASCII string *s* using the standard " +"Base64 alphabet and return the decoded :class:`bytes`." msgstr "" -msgid "Encode :term:`bytes-like object` *s* using the URL- and filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet, and return the encoded :class:`bytes`. The result can still contain ``=``." +#: ../../library/base64.rst:106 +msgid "" +"Encode :term:`bytes-like object` *s* using the URL- and filesystem-safe " +"alphabet, which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/" +"`` in the standard Base64 alphabet, and return the encoded :class:`bytes`. " +"The result can still contain ``=``." msgstr "" -msgid "Decode :term:`bytes-like object` or ASCII string *s* using the URL- and filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/`` in the standard Base64 alphabet, and return the decoded :class:`bytes`." +#: ../../library/base64.rst:115 +msgid "" +"Decode :term:`bytes-like object` or ASCII string *s* using the URL- and " +"filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` " +"instead of ``/`` in the standard Base64 alphabet, and return the " +"decoded :class:`bytes`." msgstr "" -msgid "Encode the :term:`bytes-like object` *s* using Base32 and return the encoded :class:`bytes`." +#: ../../library/base64.rst:124 +msgid "" +"Encode the :term:`bytes-like object` *s* using Base32 and return the " +"encoded :class:`bytes`." msgstr "" -msgid "Decode the Base32 encoded :term:`bytes-like object` or ASCII string *s* and return the decoded :class:`bytes`." +#: ../../library/base64.rst:130 +msgid "" +"Decode the Base32 encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`." msgstr "" -msgid "Optional *casefold* is a flag specifying whether a lowercase alphabet is acceptable as input. For security purposes, the default is ``False``." +#: ../../library/base64.rst:133 ../../library/base64.rst:181 +msgid "" +"Optional *casefold* is a flag specifying whether a lowercase alphabet is " +"acceptable as input. For security purposes, the default is ``False``." msgstr "" -msgid ":rfc:`4648` allows for optional mapping of the digit 0 (zero) to the letter O (oh), and for optional mapping of the digit 1 (one) to either the letter I (eye) or letter L (el). The optional argument *map01* when not ``None``, specifies which letter the digit 1 should be mapped to (when *map01* is not ``None``, the digit 0 is always mapped to the letter O). For security purposes the default is ``None``, so that 0 and 1 are not allowed in the input." +#: ../../library/base64.rst:137 +msgid "" +":rfc:`4648` allows for optional mapping of the digit 0 (zero) to the letter " +"O (oh), and for optional mapping of the digit 1 (one) to either the letter I " +"(eye) or letter L (el). The optional argument *map01* when not ``None``, " +"specifies which letter the digit 1 should be mapped to (when *map01* is not " +"``None``, the digit 0 is always mapped to the letter O). For security " +"purposes the default is ``None``, so that 0 and 1 are not allowed in the " +"input." msgstr "" -msgid "A :exc:`binascii.Error` is raised if *s* is incorrectly padded or if there are non-alphabet characters present in the input." +#: ../../library/base64.rst:144 ../../library/base64.rst:185 +msgid "" +"A :exc:`binascii.Error` is raised if *s* is incorrectly padded or if there " +"are non-alphabet characters present in the input." msgstr "" -msgid "Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined in :rfc:`4648`." +#: ../../library/base64.rst:151 +msgid "" +"Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined " +"in :rfc:`4648`." msgstr "" -msgid "Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined in :rfc:`4648`." +#: ../../library/base64.rst:159 +msgid "" +"Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined " +"in :rfc:`4648`." msgstr "" -msgid "This version does not allow the digit 0 (zero) to the letter O (oh) and digit 1 (one) to either the letter I (eye) or letter L (el) mappings, all these characters are included in the Extended Hex Alphabet and are not interchangeable." +#: ../../library/base64.rst:162 +msgid "" +"This version does not allow the digit 0 (zero) to the letter O (oh) and " +"digit 1 (one) to either the letter I (eye) or letter L (el) mappings, all " +"these characters are included in the Extended Hex Alphabet and are not " +"interchangeable." msgstr "" -msgid "Encode the :term:`bytes-like object` *s* using Base16 and return the encoded :class:`bytes`." +#: ../../library/base64.rst:172 +msgid "" +"Encode the :term:`bytes-like object` *s* using Base16 and return the " +"encoded :class:`bytes`." msgstr "" -msgid "Decode the Base16 encoded :term:`bytes-like object` or ASCII string *s* and return the decoded :class:`bytes`." +#: ../../library/base64.rst:178 +msgid "" +"Decode the Base16 encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`." msgstr "" +#: ../../library/base64.rst:192 msgid "Base85 Encodings" msgstr "" -msgid "Base85 encoding is a family of algorithms which represent four bytes using five ASCII characters. Originally implemented in the Unix ``btoa(1)`` utility, a version of it was later adopted by Adobe in the PostScript language and is standardized in PDF 2.0 (ISO 32000-2). This version, in both its ``btoa`` and PDF variants, is implemented by :func:`a85encode`." +#: ../../library/base64.rst:194 +msgid "" +"Base85 encoding is a family of algorithms which represent four bytes using " +"five ASCII characters. Originally implemented in the Unix ``btoa(1)`` " +"utility, a version of it was later adopted by Adobe in the PostScript " +"language and is standardized in PDF 2.0 (ISO 32000-2). This version, in both " +"its ``btoa`` and PDF variants, is implemented by :func:`a85encode`." msgstr "" -msgid "A separate version, using a different output character set, was defined as an April Fool's joke in :rfc:`1924` but is now used by Git and other software. This version is implemented by :func:`b85encode`." +#: ../../library/base64.rst:201 +msgid "" +"A separate version, using a different output character set, was defined as " +"an April Fool's joke in :rfc:`1924` but is now used by Git and other " +"software. This version is implemented by :func:`b85encode`." msgstr "" -msgid "Finally, a third version, using yet another output character set designed for safe inclusion in programming language strings, is defined by ZeroMQ and implemented here by :func:`z85encode`." +#: ../../library/base64.rst:205 +msgid "" +"Finally, a third version, using yet another output character set designed " +"for safe inclusion in programming language strings, is defined by ZeroMQ and " +"implemented here by :func:`z85encode`." msgstr "" -msgid "The functions present in this module differ in how they handle the following:" +#: ../../library/base64.rst:209 +msgid "" +"The functions present in this module differ in how they handle the following:" msgstr "" +#: ../../library/base64.rst:211 msgid "Whether to include and expect enclosing ``<~`` and ``~>`` markers." msgstr "" +#: ../../library/base64.rst:212 msgid "Whether to fold the input into multiple lines." msgstr "" +#: ../../library/base64.rst:213 msgid "The set of ASCII characters used for encoding." msgstr "" +#: ../../library/base64.rst:214 msgid "Compact encodings of sequences of spaces and null bytes." msgstr "" +#: ../../library/base64.rst:215 msgid "The encoding of zero-padding bytes applied to the input." msgstr "" -msgid "Refer to the documentation of the individual functions for more information." +#: ../../library/base64.rst:217 +msgid "" +"Refer to the documentation of the individual functions for more information." msgstr "" -msgid "Encode the :term:`bytes-like object` *b* using Ascii85 and return the encoded :class:`bytes`." +#: ../../library/base64.rst:221 +msgid "" +"Encode the :term:`bytes-like object` *b* using Ascii85 and return the " +"encoded :class:`bytes`." msgstr "" -msgid "*foldspaces* is an optional flag that uses the special short sequence 'y' instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This feature is not supported by the standard encoding used in PDF." +#: ../../library/base64.rst:224 +msgid "" +"*foldspaces* is an optional flag that uses the special short sequence 'y' " +"instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This " +"feature is not supported by the standard encoding used in PDF." msgstr "" -msgid "*wrapcol* controls whether the output should have newline (``b'\\n'``) characters added to it. If this is non-zero, each output line will be at most this many characters long, excluding the trailing newline." +#: ../../library/base64.rst:228 +msgid "" +"*wrapcol* controls whether the output should have newline (``b'\\n'``) " +"characters added to it. If this is non-zero, each output line will be at " +"most this many characters long, excluding the trailing newline." msgstr "" -msgid "*pad* controls whether zero-padding applied to the end of the input is fully retained in the output encoding, as done by ``btoa``, producing an exact multiple of 5 bytes of output. This is not part of the standard encoding used in PDF, as it does not preserve the length of the data." +#: ../../library/base64.rst:232 +msgid "" +"*pad* controls whether zero-padding applied to the end of the input is fully " +"retained in the output encoding, as done by ``btoa``, producing an exact " +"multiple of 5 bytes of output. This is not part of the standard encoding " +"used in PDF, as it does not preserve the length of the data." msgstr "" -msgid "*adobe* controls whether the encoded byte sequence is framed with ``<~`` and ``~>``, as in a PostScript base-85 string literal. Note that while ASCII85Decode streams in PDF documents *must* be terminated with ``~>``, they *must not* use a leading ``<~``." +#: ../../library/base64.rst:238 +msgid "" +"*adobe* controls whether the encoded byte sequence is framed with ``<~`` and " +"``~>``, as in a PostScript base-85 string literal. Note that while " +"ASCII85Decode streams in PDF documents *must* be terminated with ``~>``, " +"they *must not* use a leading ``<~``." msgstr "" -msgid "Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and return the decoded :class:`bytes`." +#: ../../library/base64.rst:248 +msgid "" +"Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and " +"return the decoded :class:`bytes`." msgstr "" -msgid "*foldspaces* is a flag that specifies whether the 'y' short sequence should be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature is not supported by the standard Ascii85 encoding used in PDF and PostScript." +#: ../../library/base64.rst:251 +msgid "" +"*foldspaces* is a flag that specifies whether the 'y' short sequence should " +"be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature " +"is not supported by the standard Ascii85 encoding used in PDF and PostScript." msgstr "" -msgid "*adobe* controls whether the ``<~`` and ``~>`` markers are present. While the leading ``<~`` is not required, the input must end with ``~>``, or a :exc:`ValueError` is raised." +#: ../../library/base64.rst:256 +msgid "" +"*adobe* controls whether the ``<~`` and ``~>`` markers are present. While " +"the leading ``<~`` is not required, the input must end with ``~>``, or " +"a :exc:`ValueError` is raised." msgstr "" -msgid "*ignorechars* should be a byte string containing characters to ignore from the input. This should only contain whitespace characters, and by default contains all whitespace characters in ASCII." +#: ../../library/base64.rst:260 +msgid "" +"*ignorechars* should be a byte string containing characters to ignore from " +"the input. This should only contain whitespace characters, and by default " +"contains all whitespace characters in ASCII." msgstr "" -msgid "Encode the :term:`bytes-like object` *b* using base85 (as used in e.g. git-style binary diffs) and return the encoded :class:`bytes`." +#: ../../library/base64.rst:269 +msgid "" +"Encode the :term:`bytes-like object` *b* using base85 (as used in e.g. git-" +"style binary diffs) and return the encoded :class:`bytes`." msgstr "" -msgid "The input is padded with ``b'\\0'`` so its length is a multiple of 4 bytes before encoding. If *pad* is true, all the resulting characters are retained in the output, which will always be a multiple of 5 bytes, and thus the length of the data may not be preserved on decoding." +#: ../../library/base64.rst:272 +msgid "" +"The input is padded with ``b'\\0'`` so its length is a multiple of 4 bytes " +"before encoding. If *pad* is true, all the resulting characters are " +"retained in the output, which will always be a multiple of 5 bytes, and thus " +"the length of the data may not be preserved on decoding." msgstr "" -msgid "Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and return the decoded :class:`bytes`." +#: ../../library/base64.rst:283 +msgid "" +"Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and " +"return the decoded :class:`bytes`." msgstr "" -msgid "Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and return the encoded :class:`bytes`." +#: ../../library/base64.rst:291 +msgid "" +"Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " +"return the encoded :class:`bytes`." msgstr "" -msgid "The `ZeroMQ specification `_ requires the length of Z85-encoded data to be a multiple of 5 bytes. To produce compliant data frames, you must pad the input data to this function to a multiple of 4 bytes." +#: ../../library/base64.rst:294 +msgid "" +"The `ZeroMQ specification `_ requires the " +"length of Z85-encoded data to be a multiple of 5 bytes. To produce compliant " +"data frames, you must pad the input data to this function to a multiple of 4 " +"bytes." msgstr "" -msgid "Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and return the decoded :class:`bytes`." +#: ../../library/base64.rst:304 +msgid "" +"Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`." msgstr "" +#: ../../library/base64.rst:313 msgid "Legacy Interface" msgstr "" -msgid "Decode the contents of the binary *input* file and write the resulting binary data to the *output* file. *input* and *output* must be :term:`file objects `. *input* will be read until ``input.readline()`` returns an empty bytes object." +#: ../../library/base64.rst:317 +msgid "" +"Decode the contents of the binary *input* file and write the resulting " +"binary data to the *output* file. *input* and *output* must be :term:`file " +"objects `. *input* will be read until ``input.readline()`` " +"returns an empty bytes object." msgstr "" -msgid "Decode the :term:`bytes-like object` *s*, which must contain one or more lines of base64 encoded data, and return the decoded :class:`bytes`." +#: ../../library/base64.rst:325 +msgid "" +"Decode the :term:`bytes-like object` *s*, which must contain one or more " +"lines of base64 encoded data, and return the decoded :class:`bytes`." msgstr "" -msgid "Encode the contents of the binary *input* file and write the resulting base64 encoded data to the *output* file. *input* and *output* must be :term:`file objects `. *input* will be read until ``input.read()`` returns an empty bytes object. :func:`encode` inserts a newline character (``b'\\n'``) after every 76 bytes of the output, as well as ensuring that the output always ends with a newline, as per :rfc:`2045` (MIME)." +#: ../../library/base64.rst:333 +msgid "" +"Encode the contents of the binary *input* file and write the resulting " +"base64 encoded data to the *output* file. *input* and *output* must " +"be :term:`file objects `. *input* will be read until " +"``input.read()`` returns an empty bytes object. :func:`encode` inserts a " +"newline character (``b'\\n'``) after every 76 bytes of the output, as well " +"as ensuring that the output always ends with a newline, as per :rfc:`2045` " +"(MIME)." msgstr "" -msgid "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary data, and return :class:`bytes` containing the base64-encoded data, with newlines (``b'\\n'``) inserted after every 76 bytes of output, and ensuring that there is a trailing newline, as per :rfc:`2045` (MIME)." +#: ../../library/base64.rst:343 +msgid "" +"Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " +"data, and return :class:`bytes` containing the base64-encoded data, with " +"newlines (``b'\\n'``) inserted after every 76 bytes of output, and ensuring " +"that there is a trailing newline, as per :rfc:`2045` (MIME)." msgstr "" +#: ../../library/base64.rst:351 msgid "An example usage of the module:" msgstr "" +#: ../../library/base64.rst:364 msgid "Security Considerations" msgstr "" -msgid "A new security considerations section was added to :rfc:`4648` (section 12); it's recommended to review the security section for any code deployed to production." +#: ../../library/base64.rst:366 +msgid "" +"A new security considerations section was added to :rfc:`4648` (section 12); " +"it's recommended to review the security section for any code deployed to " +"production." msgstr "" +#: ../../library/base64.rst:371 msgid "Module :mod:`binascii`" msgstr "" -msgid "Support module containing ASCII-to-binary and binary-to-ASCII conversions." +#: ../../library/base64.rst:372 +msgid "" +"Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" -msgid ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies" +#: ../../library/base64.rst:374 +msgid "" +":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " +"Mechanisms for Specifying and Describing the Format of Internet Message " +"Bodies" msgstr "" -msgid "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition of the base64 encoding." +#: ../../library/base64.rst:375 +msgid "" +"Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " +"of the base64 encoding." msgstr "" -msgid "`ISO 32000-2 Portable document format - Part 2: PDF 2.0 `_" +#: ../../library/base64.rst:378 +msgid "" +"`ISO 32000-2 Portable document format - Part 2: PDF 2.0 `_" msgstr "" -msgid "Section 7.4.3, \"ASCII85Decode Filter,\" provides the definition of the Ascii85 encoding used in PDF and PostScript, including the output character set and the details of data length preservation using zero-padding and partial output groups." +#: ../../library/base64.rst:379 +msgid "" +"Section 7.4.3, \"ASCII85Decode Filter,\" provides the definition of the " +"Ascii85 encoding used in PDF and PostScript, including the output character " +"set and the details of data length preservation using zero-padding and " +"partial output groups." msgstr "" +#: ../../library/base64.rst:384 msgid "`ZeroMQ RFC 32/Z85 `_" msgstr "" -msgid "The \"Formal Specification\" section provides the character set used in Z85." +#: ../../library/base64.rst:385 +msgid "" +"The \"Formal Specification\" section provides the character set used in Z85." msgstr "" +#: ../../library/base64.rst:10 msgid "base64" msgstr "" +#: ../../library/base64.rst:10 msgid "encoding" msgstr "" +#: ../../library/base64.rst:10 msgid "MIME" msgstr "" +#: ../../library/base64.rst:10 msgid "base64 encoding" msgstr "" diff --git a/library/bdb.po b/library/bdb.po index 7caccea07..99a0ebeb9 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:55+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,359 +23,651 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/bdb.rst:2 msgid ":mod:`!bdb` --- Debugger framework" msgstr "" +#: ../../library/bdb.rst:7 msgid "**Source code:** :source:`Lib/bdb.py`" msgstr "" -msgid "The :mod:`!bdb` module handles basic debugger functions, like setting breakpoints or managing execution via the debugger." +#: ../../library/bdb.rst:11 +msgid "" +"The :mod:`!bdb` module handles basic debugger functions, like setting " +"breakpoints or managing execution via the debugger." msgstr "" +#: ../../library/bdb.rst:14 msgid "The following exception is defined:" msgstr "" +#: ../../library/bdb.rst:18 msgid "Exception raised by the :class:`Bdb` class for quitting the debugger." msgstr "" +#: ../../library/bdb.rst:21 msgid "The :mod:`!bdb` module also defines two classes:" msgstr "" -msgid "This class implements temporary breakpoints, ignore counts, disabling and (re-)enabling, and conditionals." +#: ../../library/bdb.rst:25 +msgid "" +"This class implements temporary breakpoints, ignore counts, disabling and " +"(re-)enabling, and conditionals." msgstr "" -msgid "Breakpoints are indexed by number through a list called :attr:`bpbynumber` and by ``(file, line)`` pairs through :attr:`bplist`. The former points to a single instance of class :class:`Breakpoint`. The latter points to a list of such instances since there may be more than one breakpoint per line." +#: ../../library/bdb.rst:28 +msgid "" +"Breakpoints are indexed by number through a list called :attr:`bpbynumber` " +"and by ``(file, line)`` pairs through :attr:`bplist`. The former points to " +"a single instance of class :class:`Breakpoint`. The latter points to a list " +"of such instances since there may be more than one breakpoint per line." msgstr "" -msgid "When creating a breakpoint, its associated :attr:`file name ` should be in canonical form. If a :attr:`funcname` is defined, a breakpoint :attr:`hit ` will be counted when the first line of that function is executed. A :attr:`conditional ` breakpoint always counts a :attr:`hit `." +#: ../../library/bdb.rst:33 +msgid "" +"When creating a breakpoint, its associated :attr:`file name ` should " +"be in canonical form. If a :attr:`funcname` is defined, a " +"breakpoint :attr:`hit ` will be counted when the first line of that " +"function is executed. A :attr:`conditional ` breakpoint always counts " +"a :attr:`hit `." msgstr "" +#: ../../library/bdb.rst:39 msgid ":class:`Breakpoint` instances have the following methods:" msgstr "" -msgid "Delete the breakpoint from the list associated to a file/line. If it is the last breakpoint in that position, it also deletes the entry for the file/line." +#: ../../library/bdb.rst:43 +msgid "" +"Delete the breakpoint from the list associated to a file/line. If it is the " +"last breakpoint in that position, it also deletes the entry for the file/" +"line." msgstr "" +#: ../../library/bdb.rst:50 msgid "Mark the breakpoint as enabled." msgstr "" +#: ../../library/bdb.rst:55 msgid "Mark the breakpoint as disabled." msgstr "" -msgid "Return a string with all the information about the breakpoint, nicely formatted:" +#: ../../library/bdb.rst:60 +msgid "" +"Return a string with all the information about the breakpoint, nicely " +"formatted:" msgstr "" +#: ../../library/bdb.rst:63 msgid "Breakpoint number." msgstr "" +#: ../../library/bdb.rst:64 msgid "Temporary status (del or keep)." msgstr "" +#: ../../library/bdb.rst:65 msgid "File/line position." msgstr "" +#: ../../library/bdb.rst:66 msgid "Break condition." msgstr "" +#: ../../library/bdb.rst:67 msgid "Number of times to ignore." msgstr "" +#: ../../library/bdb.rst:68 msgid "Number of times hit." msgstr "" -msgid "Print the output of :meth:`bpformat` to the file *out*, or if it is ``None``, to standard output." +#: ../../library/bdb.rst:74 +msgid "" +"Print the output of :meth:`bpformat` to the file *out*, or if it is " +"``None``, to standard output." msgstr "" +#: ../../library/bdb.rst:77 msgid ":class:`Breakpoint` instances have the following attributes:" msgstr "" +#: ../../library/bdb.rst:81 msgid "File name of the :class:`Breakpoint`." msgstr "" +#: ../../library/bdb.rst:85 msgid "Line number of the :class:`Breakpoint` within :attr:`file`." msgstr "" +#: ../../library/bdb.rst:89 msgid "``True`` if a :class:`Breakpoint` at (file, line) is temporary." msgstr "" +#: ../../library/bdb.rst:93 msgid "Condition for evaluating a :class:`Breakpoint` at (file, line)." msgstr "" -msgid "Function name that defines whether a :class:`Breakpoint` is hit upon entering the function." +#: ../../library/bdb.rst:97 +msgid "" +"Function name that defines whether a :class:`Breakpoint` is hit upon " +"entering the function." msgstr "" +#: ../../library/bdb.rst:102 msgid "``True`` if :class:`Breakpoint` is enabled." msgstr "" +#: ../../library/bdb.rst:106 msgid "Numeric index for a single instance of a :class:`Breakpoint`." msgstr "" -msgid "Dictionary of :class:`Breakpoint` instances indexed by (:attr:`file`, :attr:`line`) tuples." +#: ../../library/bdb.rst:110 +msgid "" +"Dictionary of :class:`Breakpoint` instances indexed by " +"(:attr:`file`, :attr:`line`) tuples." msgstr "" +#: ../../library/bdb.rst:115 msgid "Number of times to ignore a :class:`Breakpoint`." msgstr "" +#: ../../library/bdb.rst:119 msgid "Count of the number of times a :class:`Breakpoint` has been hit." msgstr "" +#: ../../library/bdb.rst:123 msgid "The :class:`Bdb` class acts as a generic Python debugger base class." msgstr "" -msgid "This class takes care of the details of the trace facility; a derived class should implement user interaction. The standard debugger class (:class:`pdb.Pdb`) is an example." +#: ../../library/bdb.rst:125 +msgid "" +"This class takes care of the details of the trace facility; a derived class " +"should implement user interaction. The standard debugger class " +"(:class:`pdb.Pdb`) is an example." msgstr "" -msgid "The *skip* argument, if given, must be an iterable of glob-style module name patterns. The debugger will not step into frames that originate in a module that matches one of these patterns. Whether a frame is considered to originate in a certain module is determined by the ``__name__`` in the frame globals." +#: ../../library/bdb.rst:129 +msgid "" +"The *skip* argument, if given, must be an iterable of glob-style module name " +"patterns. The debugger will not step into frames that originate in a module " +"that matches one of these patterns. Whether a frame is considered to " +"originate in a certain module is determined by the ``__name__`` in the frame " +"globals." msgstr "" -msgid "The *backend* argument specifies the backend to use for :class:`Bdb`. It can be either ``'settrace'`` or ``'monitoring'``. ``'settrace'`` uses :func:`sys.settrace` which has the best backward compatibility. The ``'monitoring'`` backend uses the new :mod:`sys.monitoring` that was introduced in Python 3.12, which can be much more efficient because it can disable unused events. We are trying to keep the exact interfaces for both backends, but there are some differences. The debugger developers are encouraged to use the ``'monitoring'`` backend to achieve better performance." +#: ../../library/bdb.rst:135 +msgid "" +"The *backend* argument specifies the backend to use for :class:`Bdb`. It can " +"be either ``'settrace'`` or ``'monitoring'``. ``'settrace'`` " +"uses :func:`sys.settrace` which has the best backward compatibility. The " +"``'monitoring'`` backend uses the new :mod:`sys.monitoring` that was " +"introduced in Python 3.12, which can be much more efficient because it can " +"disable unused events. We are trying to keep the exact interfaces for both " +"backends, but there are some differences. The debugger developers are " +"encouraged to use the ``'monitoring'`` backend to achieve better performance." msgstr "" +#: ../../library/bdb.rst:145 msgid "Added the *skip* parameter." msgstr "" +#: ../../library/bdb.rst:148 msgid "Added the *backend* parameter." msgstr "" -msgid "The following methods of :class:`Bdb` normally don't need to be overridden." +#: ../../library/bdb.rst:151 +msgid "" +"The following methods of :class:`Bdb` normally don't need to be overridden." msgstr "" +#: ../../library/bdb.rst:155 msgid "Return canonical form of *filename*." msgstr "" -msgid "For real file names, the canonical form is an operating-system-dependent, :func:`case-normalized ` :func:`absolute path `. A *filename* with angle brackets, such as ``\"\"`` generated in interactive mode, is returned unchanged." +#: ../../library/bdb.rst:157 +msgid "" +"For real file names, the canonical form is an operating-system-" +"dependent, :func:`case-normalized ` :func:`absolute path " +"`. A *filename* with angle brackets, such as " +"``\"\"`` generated in interactive mode, is returned unchanged." msgstr "" -msgid "Start tracing. For ``'settrace'`` backend, this method is equivalent to ``sys.settrace(self.trace_dispatch)``" +#: ../../library/bdb.rst:164 +msgid "" +"Start tracing. For ``'settrace'`` backend, this method is equivalent to " +"``sys.settrace(self.trace_dispatch)``" msgstr "" -msgid "Stop tracing. For ``'settrace'`` backend, this method is equivalent to ``sys.settrace(None)``" +#: ../../library/bdb.rst:171 +msgid "" +"Stop tracing. For ``'settrace'`` backend, this method is equivalent to " +"``sys.settrace(None)``" msgstr "" -msgid "Set the :attr:`!botframe`, :attr:`!stopframe`, :attr:`!returnframe` and :attr:`quitting ` attributes with values ready to start debugging." +#: ../../library/bdb.rst:178 +msgid "" +"Set the :attr:`!botframe`, :attr:`!stopframe`, :attr:`!returnframe` " +"and :attr:`quitting ` attributes with values ready to start " +"debugging." msgstr "" -msgid "This function is installed as the trace function of debugged frames. Its return value is the new trace function (in most cases, that is, itself)." +#: ../../library/bdb.rst:183 +msgid "" +"This function is installed as the trace function of debugged frames. Its " +"return value is the new trace function (in most cases, that is, itself)." msgstr "" -msgid "The default implementation decides how to dispatch a frame, depending on the type of event (passed as a string) that is about to be executed. *event* can be one of the following:" +#: ../../library/bdb.rst:186 +msgid "" +"The default implementation decides how to dispatch a frame, depending on the " +"type of event (passed as a string) that is about to be executed. *event* can " +"be one of the following:" msgstr "" +#: ../../library/bdb.rst:190 msgid "``\"line\"``: A new line of code is going to be executed." msgstr "" -msgid "``\"call\"``: A function is about to be called, or another code block entered." +#: ../../library/bdb.rst:191 +msgid "" +"``\"call\"``: A function is about to be called, or another code block " +"entered." msgstr "" +#: ../../library/bdb.rst:193 msgid "``\"return\"``: A function or other code block is about to return." msgstr "" +#: ../../library/bdb.rst:194 msgid "``\"exception\"``: An exception has occurred." msgstr "" +#: ../../library/bdb.rst:195 msgid "``\"c_call\"``: A C function is about to be called." msgstr "" +#: ../../library/bdb.rst:196 msgid "``\"c_return\"``: A C function has returned." msgstr "" +#: ../../library/bdb.rst:197 msgid "``\"c_exception\"``: A C function has raised an exception." msgstr "" -msgid "For the Python events, specialized functions (see below) are called. For the C events, no action is taken." +#: ../../library/bdb.rst:199 +msgid "" +"For the Python events, specialized functions (see below) are called. For " +"the C events, no action is taken." msgstr "" +#: ../../library/bdb.rst:202 msgid "The *arg* parameter depends on the previous event." msgstr "" -msgid "See the documentation for :func:`sys.settrace` for more information on the trace function. For more information on code and frame objects, refer to :ref:`types`." +#: ../../library/bdb.rst:204 +msgid "" +"See the documentation for :func:`sys.settrace` for more information on the " +"trace function. For more information on code and frame objects, refer " +"to :ref:`types`." msgstr "" -msgid "If the debugger should stop on the current line, invoke the :meth:`user_line` method (which should be overridden in subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` flag is set (which can be set from :meth:`user_line`). Return a reference to the :meth:`trace_dispatch` method for further tracing in that scope." +#: ../../library/bdb.rst:210 +msgid "" +"If the debugger should stop on the current line, invoke " +"the :meth:`user_line` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (which can be set from :meth:`user_line`). Return a reference " +"to the :meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -msgid "If the debugger should stop on this function call, invoke the :meth:`user_call` method (which should be overridden in subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` flag is set (which can be set from :meth:`user_call`). Return a reference to the :meth:`trace_dispatch` method for further tracing in that scope." +#: ../../library/bdb.rst:218 +msgid "" +"If the debugger should stop on this function call, invoke " +"the :meth:`user_call` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (which can be set from :meth:`user_call`). Return a reference " +"to the :meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -msgid "If the debugger should stop on this function return, invoke the :meth:`user_return` method (which should be overridden in subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` flag is set (which can be set from :meth:`user_return`). Return a reference to the :meth:`trace_dispatch` method for further tracing in that scope." +#: ../../library/bdb.rst:226 +msgid "" +"If the debugger should stop on this function return, invoke " +"the :meth:`user_return` method (which should be overridden in subclasses). " +"Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` " +"flag is set (which can be set from :meth:`user_return`). Return a reference " +"to the :meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -msgid "If the debugger should stop at this exception, invokes the :meth:`user_exception` method (which should be overridden in subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting ` flag is set (which can be set from :meth:`user_exception`). Return a reference to the :meth:`trace_dispatch` method for further tracing in that scope." +#: ../../library/bdb.rst:234 +msgid "" +"If the debugger should stop at this exception, invokes " +"the :meth:`user_exception` method (which should be overridden in " +"subclasses). Raise a :exc:`BdbQuit` exception if the :attr:`quitting " +"` flag is set (which can be set from :meth:`user_exception`). " +"Return a reference to the :meth:`trace_dispatch` method for further tracing " +"in that scope." msgstr "" -msgid "Normally derived classes don't override the following methods, but they may if they want to redefine the definition of stopping and breakpoints." +#: ../../library/bdb.rst:240 +msgid "" +"Normally derived classes don't override the following methods, but they may " +"if they want to redefine the definition of stopping and breakpoints." msgstr "" +#: ../../library/bdb.rst:245 msgid "Return ``True`` if *module_name* matches any skip pattern." msgstr "" +#: ../../library/bdb.rst:249 msgid "Return ``True`` if *frame* is below the starting frame in the stack." msgstr "" +#: ../../library/bdb.rst:253 msgid "Return ``True`` if there is an effective breakpoint for this line." msgstr "" -msgid "Check whether a line or function breakpoint exists and is in effect. Delete temporary breakpoints based on information from :func:`effective`." +#: ../../library/bdb.rst:255 +msgid "" +"Check whether a line or function breakpoint exists and is in effect. Delete " +"temporary breakpoints based on information from :func:`effective`." msgstr "" +#: ../../library/bdb.rst:260 msgid "Return ``True`` if any breakpoint exists for *frame*'s filename." msgstr "" -msgid "Derived classes should override these methods to gain control over debugger operation." +#: ../../library/bdb.rst:262 +msgid "" +"Derived classes should override these methods to gain control over debugger " +"operation." msgstr "" -msgid "Called from :meth:`dispatch_call` if a break might stop inside the called function." +#: ../../library/bdb.rst:267 +msgid "" +"Called from :meth:`dispatch_call` if a break might stop inside the called " +"function." msgstr "" -msgid "*argument_list* is not used anymore and will always be ``None``. The argument is kept for backwards compatibility." +#: ../../library/bdb.rst:270 +msgid "" +"*argument_list* is not used anymore and will always be ``None``. The " +"argument is kept for backwards compatibility." msgstr "" -msgid "Called from :meth:`dispatch_line` when either :meth:`stop_here` or :meth:`break_here` returns ``True``." +#: ../../library/bdb.rst:275 +msgid "" +"Called from :meth:`dispatch_line` when either :meth:`stop_here` " +"or :meth:`break_here` returns ``True``." msgstr "" -msgid "Called from :meth:`dispatch_return` when :meth:`stop_here` returns ``True``." +#: ../../library/bdb.rst:280 +msgid "" +"Called from :meth:`dispatch_return` when :meth:`stop_here` returns ``True``." msgstr "" -msgid "Called from :meth:`dispatch_exception` when :meth:`stop_here` returns ``True``." +#: ../../library/bdb.rst:284 +msgid "" +"Called from :meth:`dispatch_exception` when :meth:`stop_here` returns " +"``True``." msgstr "" +#: ../../library/bdb.rst:289 msgid "Handle how a breakpoint must be removed when it is a temporary one." msgstr "" +#: ../../library/bdb.rst:291 msgid "This method must be implemented by derived classes." msgstr "" -msgid "Derived classes and clients can call the following methods to affect the stepping state." +#: ../../library/bdb.rst:294 +msgid "" +"Derived classes and clients can call the following methods to affect the " +"stepping state." msgstr "" +#: ../../library/bdb.rst:299 msgid "Stop after one line of code." msgstr "" +#: ../../library/bdb.rst:303 msgid "Stop on the next line in or below the given frame." msgstr "" +#: ../../library/bdb.rst:307 msgid "Stop when returning from the given frame." msgstr "" -msgid "Stop when the line with the *lineno* greater than the current one is reached or when returning from current frame." +#: ../../library/bdb.rst:311 +msgid "" +"Stop when the line with the *lineno* greater than the current one is reached " +"or when returning from current frame." msgstr "" -msgid "Start debugging from *frame*. If *frame* is not specified, debugging starts from caller's frame." +#: ../../library/bdb.rst:316 +msgid "" +"Start debugging from *frame*. If *frame* is not specified, debugging starts " +"from caller's frame." msgstr "" -msgid ":func:`set_trace` will enter the debugger immediately, rather than on the next line of code to be executed." +#: ../../library/bdb.rst:319 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." msgstr "" -msgid "Stop only at breakpoints or when finished. If there are no breakpoints, set the system trace function to ``None``." +#: ../../library/bdb.rst:325 +msgid "" +"Stop only at breakpoints or when finished. If there are no breakpoints, set " +"the system trace function to ``None``." msgstr "" -msgid "Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` in the next call to one of the :meth:`!dispatch_\\*` methods." +#: ../../library/bdb.rst:332 +msgid "" +"Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` " +"in the next call to one of the :meth:`!dispatch_\\*` methods." msgstr "" -msgid "Derived classes and clients can call the following methods to manipulate breakpoints. These methods return a string containing an error message if something went wrong, or ``None`` if all is well." +#: ../../library/bdb.rst:336 +msgid "" +"Derived classes and clients can call the following methods to manipulate " +"breakpoints. These methods return a string containing an error message if " +"something went wrong, or ``None`` if all is well." msgstr "" -msgid "Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* passed as argument, return an error message. The *filename* should be in canonical form, as described in the :meth:`canonic` method." +#: ../../library/bdb.rst:342 +msgid "" +"Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* " +"passed as argument, return an error message. The *filename* should be in " +"canonical form, as described in the :meth:`canonic` method." msgstr "" -msgid "Delete the breakpoints in *filename* and *lineno*. If none were set, return an error message." +#: ../../library/bdb.rst:348 +msgid "" +"Delete the breakpoints in *filename* and *lineno*. If none were set, return " +"an error message." msgstr "" -msgid "Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint.bpbynumber`. If *arg* is not numeric or out of range, return an error message." +#: ../../library/bdb.rst:353 +msgid "" +"Delete the breakpoint which has the index *arg* in " +"the :attr:`Breakpoint.bpbynumber`. If *arg* is not numeric or out of range, " +"return an error message." msgstr "" -msgid "Delete all breakpoints in *filename*. If none were set, return an error message." +#: ../../library/bdb.rst:359 +msgid "" +"Delete all breakpoints in *filename*. If none were set, return an error " +"message." msgstr "" -msgid "Delete all existing breakpoints. If none were set, return an error message." +#: ../../library/bdb.rst:364 +msgid "" +"Delete all existing breakpoints. If none were set, return an error message." msgstr "" -msgid "Return a breakpoint specified by the given number. If *arg* is a string, it will be converted to a number. If *arg* is a non-numeric string, if the given breakpoint never existed or has been deleted, a :exc:`ValueError` is raised." +#: ../../library/bdb.rst:369 +msgid "" +"Return a breakpoint specified by the given number. If *arg* is a string, it " +"will be converted to a number. If *arg* is a non-numeric string, if the " +"given breakpoint never existed or has been deleted, a :exc:`ValueError` is " +"raised." msgstr "" +#: ../../library/bdb.rst:378 msgid "Return ``True`` if there is a breakpoint for *lineno* in *filename*." msgstr "" -msgid "Return all breakpoints for *lineno* in *filename*, or an empty list if none are set." +#: ../../library/bdb.rst:382 +msgid "" +"Return all breakpoints for *lineno* in *filename*, or an empty list if none " +"are set." msgstr "" +#: ../../library/bdb.rst:387 msgid "Return all breakpoints in *filename*, or an empty list if none are set." msgstr "" +#: ../../library/bdb.rst:391 msgid "Return all breakpoints that are set." msgstr "" -msgid "Derived classes and clients can call the following methods to disable and restart events to achieve better performance. These methods only work when using the ``'monitoring'`` backend." +#: ../../library/bdb.rst:394 +msgid "" +"Derived classes and clients can call the following methods to disable and " +"restart events to achieve better performance. These methods only work when " +"using the ``'monitoring'`` backend." msgstr "" -msgid "Disable the current event until the next time :func:`restart_events` is called. This is helpful when the debugger is not interested in the current line." +#: ../../library/bdb.rst:400 +msgid "" +"Disable the current event until the next time :func:`restart_events` is " +"called. This is helpful when the debugger is not interested in the current " +"line." msgstr "" -msgid "Restart all the disabled events. This function is automatically called in ``dispatch_*`` methods after ``user_*`` methods are called. If the ``dispatch_*`` methods are not overridden, the disabled events will be restarted after each user interaction." +#: ../../library/bdb.rst:408 +msgid "" +"Restart all the disabled events. This function is automatically called in " +"``dispatch_*`` methods after ``user_*`` methods are called. If the " +"``dispatch_*`` methods are not overridden, the disabled events will be " +"restarted after each user interaction." msgstr "" -msgid "Derived classes and clients can call the following methods to get a data structure representing a stack trace." +#: ../../library/bdb.rst:416 +msgid "" +"Derived classes and clients can call the following methods to get a data " +"structure representing a stack trace." msgstr "" +#: ../../library/bdb.rst:421 msgid "Return a list of (frame, lineno) tuples in a stack trace, and a size." msgstr "" -msgid "The most recently called frame is last in the list. The size is the number of frames below the frame where the debugger was invoked." +#: ../../library/bdb.rst:423 +msgid "" +"The most recently called frame is last in the list. The size is the number " +"of frames below the frame where the debugger was invoked." msgstr "" -msgid "Return a string with information about a stack entry, which is a ``(frame, lineno)`` tuple. The return string contains:" +#: ../../library/bdb.rst:428 +msgid "" +"Return a string with information about a stack entry, which is a ``(frame, " +"lineno)`` tuple. The return string contains:" msgstr "" +#: ../../library/bdb.rst:431 msgid "The canonical filename which contains the frame." msgstr "" +#: ../../library/bdb.rst:432 msgid "The function name or ``\"\"``." msgstr "" +#: ../../library/bdb.rst:433 msgid "The input arguments." msgstr "" +#: ../../library/bdb.rst:434 msgid "The return value." msgstr "" +#: ../../library/bdb.rst:435 msgid "The line of code (if it exists)." msgstr "" -msgid "The following two methods can be called by clients to use a debugger to debug a :term:`statement`, given as a string." +#: ../../library/bdb.rst:438 +msgid "" +"The following two methods can be called by clients to use a debugger to " +"debug a :term:`statement`, given as a string." msgstr "" -msgid "Debug a statement executed via the :func:`exec` function. *globals* defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." +#: ../../library/bdb.rst:443 +msgid "" +"Debug a statement executed via the :func:`exec` function. *globals* " +"defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." msgstr "" -msgid "Debug an expression executed via the :func:`eval` function. *globals* and *locals* have the same meaning as in :meth:`run`." +#: ../../library/bdb.rst:448 +msgid "" +"Debug an expression executed via the :func:`eval` function. *globals* and " +"*locals* have the same meaning as in :meth:`run`." msgstr "" +#: ../../library/bdb.rst:453 msgid "For backwards compatibility. Calls the :meth:`run` method." msgstr "" +#: ../../library/bdb.rst:457 msgid "Debug a single function call, and return its result." msgstr "" +#: ../../library/bdb.rst:460 msgid "Finally, the module defines the following functions:" msgstr "" -msgid "Return ``True`` if we should break here, depending on the way the :class:`Breakpoint` *b* was set." -msgstr "" - -msgid "If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :attr:`function name `, we have to check we are in the right *frame* (the right function) and if we are on its first executable line." +#: ../../library/bdb.rst:464 +msgid "" +"Return ``True`` if we should break here, depending on the way " +"the :class:`Breakpoint` *b* was set." msgstr "" -msgid "Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as the breakpoint to act upon." +#: ../../library/bdb.rst:467 +msgid "" +"If it was set via line number, it checks if :attr:`b.line " +"` is the same as the one in *frame*. If the breakpoint " +"was set via :attr:`function name `, we have to " +"check we are in the right *frame* (the right function) and if we are on its " +"first executable line." msgstr "" -msgid "The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line `) (which must exist) that is :attr:`enabled `, for which :func:`checkfuncname` is true, and that has neither a false :attr:`condition ` nor positive :attr:`ignore ` count. The *flag*, meaning that a temporary breakpoint should be deleted, is ``False`` only when the :attr:`cond ` cannot be evaluated (in which case, :attr:`ignore ` count is ignored)." +#: ../../library/bdb.rst:476 +msgid "" +"Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " +"the breakpoint to act upon." msgstr "" +#: ../../library/bdb.rst:479 +msgid "" +"The *active breakpoint* is the first entry in :attr:`bplist " +"` for the (:attr:`file " +"`, :attr:`line `) (which must " +"exist) that is :attr:`enabled `, for " +"which :func:`checkfuncname` is true, and that has neither a " +"false :attr:`condition ` nor positive :attr:`ignore " +"` count. The *flag*, meaning that a temporary " +"breakpoint should be deleted, is ``False`` only when the :attr:`cond " +"` cannot be evaluated (in which case, :attr:`ignore " +"` count is ignored)." +msgstr "" + +#: ../../library/bdb.rst:490 msgid "If no such entry exists, then ``(None, None)`` is returned." msgstr "" +#: ../../library/bdb.rst:495 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." msgstr "" +#: ../../library/bdb.rst:330 msgid "quitting (bdb.Bdb attribute)" msgstr "" diff --git a/library/binary.po b/library/binary.po index 7382a3787..21bb48fba 100644 --- a/library/binary.po +++ b/library/binary.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,27 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/binary.rst:5 msgid "Binary Data Services" msgstr "" -msgid "The modules described in this chapter provide some basic services operations for manipulation of binary data. Other operations on binary data, specifically in relation to file formats and network protocols, are described in the relevant sections." +#: ../../library/binary.rst:7 +msgid "" +"The modules described in this chapter provide some basic services operations " +"for manipulation of binary data. Other operations on binary data, " +"specifically in relation to file formats and network protocols, are " +"described in the relevant sections." msgstr "" -msgid "Some libraries described under :ref:`textservices` also work with either ASCII-compatible binary formats (for example, :mod:`re`) or all binary data (for example, :mod:`difflib`)." +#: ../../library/binary.rst:12 +msgid "" +"Some libraries described under :ref:`textservices` also work with either " +"ASCII-compatible binary formats (for example, :mod:`re`) or all binary data " +"(for example, :mod:`difflib`)." msgstr "" -msgid "In addition, see the documentation for Python's built-in binary data types in :ref:`binaryseq`." +#: ../../library/binary.rst:16 +msgid "" +"In addition, see the documentation for Python's built-in binary data types " +"in :ref:`binaryseq`." msgstr "" diff --git a/library/binascii.po b/library/binascii.po index 54957e73f..0188c0a52 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,72 +23,141 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/binascii.rst:2 msgid ":mod:`!binascii` --- Convert between binary and ASCII" msgstr "" -msgid "The :mod:`!binascii` module contains a number of methods to convert between binary and various ASCII-encoded binary representations. Normally, you will not use these functions directly but use wrapper modules like :mod:`base64` instead. The :mod:`!binascii` module contains low-level functions written in C for greater speed that are used by the higher-level modules." +#: ../../library/binascii.rst:13 +msgid "" +"The :mod:`!binascii` module contains a number of methods to convert between " +"binary and various ASCII-encoded binary representations. Normally, you will " +"not use these functions directly but use wrapper modules like :mod:`base64` " +"instead. The :mod:`!binascii` module contains low-level functions written in " +"C for greater speed that are used by the higher-level modules." msgstr "" -msgid "``a2b_*`` functions accept Unicode strings containing only ASCII characters. Other functions only accept :term:`bytes-like objects ` (such as :class:`bytes`, :class:`bytearray` and other objects that support the buffer protocol)." +#: ../../library/binascii.rst:22 +msgid "" +"``a2b_*`` functions accept Unicode strings containing only ASCII characters. " +"Other functions only accept :term:`bytes-like objects ` " +"(such as :class:`bytes`, :class:`bytearray` and other objects that support " +"the buffer protocol)." msgstr "" +#: ../../library/binascii.rst:27 msgid "ASCII-only unicode strings are now accepted by the ``a2b_*`` functions." msgstr "" +#: ../../library/binascii.rst:31 msgid "The :mod:`!binascii` module defines the following functions:" msgstr "" -msgid "Convert a single line of uuencoded data back to binary and return the binary data. Lines normally contain 45 (binary) bytes, except for the last line. Line data may be followed by whitespace." +#: ../../library/binascii.rst:36 +msgid "" +"Convert a single line of uuencoded data back to binary and return the binary " +"data. Lines normally contain 45 (binary) bytes, except for the last line. " +"Line data may be followed by whitespace." msgstr "" -msgid "Convert binary data to a line of ASCII characters, the return value is the converted line, including a newline char. The length of *data* should be at most 45. If *backtick* is true, zeros are represented by ``'`'`` instead of spaces." +#: ../../library/binascii.rst:43 +msgid "" +"Convert binary data to a line of ASCII characters, the return value is the " +"converted line, including a newline char. The length of *data* should be at " +"most 45. If *backtick* is true, zeros are represented by ``'`'`` instead of " +"spaces." msgstr "" +#: ../../library/binascii.rst:47 msgid "Added the *backtick* parameter." msgstr "" -msgid "Convert a block of base64 data back to binary and return the binary data. More than one line may be passed at a time." +#: ../../library/binascii.rst:53 +msgid "" +"Convert a block of base64 data back to binary and return the binary data. " +"More than one line may be passed at a time." msgstr "" -msgid "If *strict_mode* is true, only valid base64 data will be converted. Invalid base64 data will raise :exc:`binascii.Error`." +#: ../../library/binascii.rst:56 +msgid "" +"If *strict_mode* is true, only valid base64 data will be converted. Invalid " +"base64 data will raise :exc:`binascii.Error`." msgstr "" +#: ../../library/binascii.rst:59 msgid "Valid base64:" msgstr "" +#: ../../library/binascii.rst:61 msgid "Conforms to :rfc:`3548`." msgstr "" +#: ../../library/binascii.rst:62 msgid "Contains only characters from the base64 alphabet." msgstr "" -msgid "Contains no excess data after padding (including excess padding, newlines, etc.)." +#: ../../library/binascii.rst:63 +msgid "" +"Contains no excess data after padding (including excess padding, newlines, " +"etc.)." msgstr "" +#: ../../library/binascii.rst:64 msgid "Does not start with a padding." msgstr "" +#: ../../library/binascii.rst:66 msgid "Added the *strict_mode* parameter." msgstr "" -msgid "Convert binary data to a line of ASCII characters in base64 coding. The return value is the converted line, including a newline char if *newline* is true. The output of this function conforms to :rfc:`3548`." +#: ../../library/binascii.rst:72 +msgid "" +"Convert binary data to a line of ASCII characters in base64 coding. The " +"return value is the converted line, including a newline char if *newline* is " +"true. The output of this function conforms to :rfc:`3548`." msgstr "" +#: ../../library/binascii.rst:76 msgid "Added the *newline* parameter." msgstr "" -msgid "Convert a block of quoted-printable data back to binary and return the binary data. More than one line may be passed at a time. If the optional argument *header* is present and true, underscores will be decoded as spaces." -msgstr "" - -msgid "Convert binary data to a line(s) of ASCII characters in quoted-printable encoding. The return value is the converted line(s). If the optional argument *quotetabs* is present and true, all tabs and spaces will be encoded. If the optional argument *istext* is present and true, newlines are not encoded but trailing whitespace will be encoded. If the optional argument *header* is present and true, spaces will be encoded as underscores per :rfc:`1522`. If the optional argument *header* is present and false, newline characters will be encoded as well; otherwise linefeed conversion might corrupt the binary data stream." +#: ../../library/binascii.rst:82 +msgid "" +"Convert a block of quoted-printable data back to binary and return the " +"binary data. More than one line may be passed at a time. If the optional " +"argument *header* is present and true, underscores will be decoded as spaces." msgstr "" -msgid "Compute a 16-bit CRC value of *data*, starting with *value* as the initial CRC, and return the result. This uses the CRC-CCITT polynomial *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as 0x1021. This CRC is used in the binhex4 format." +#: ../../library/binascii.rst:89 +msgid "" +"Convert binary data to a line(s) of ASCII characters in quoted-printable " +"encoding. The return value is the converted line(s). If the optional " +"argument *quotetabs* is present and true, all tabs and spaces will be " +"encoded. If the optional argument *istext* is present and true, newlines " +"are not encoded but trailing whitespace will be encoded. If the optional " +"argument *header* is present and true, spaces will be encoded as underscores " +"per :rfc:`1522`. If the optional argument *header* is present and false, " +"newline characters will be encoded as well; otherwise linefeed conversion " +"might corrupt the binary data stream." +msgstr "" + +#: ../../library/binascii.rst:102 +msgid "" +"Compute a 16-bit CRC value of *data*, starting with *value* as the initial " +"CRC, and return the result. This uses the CRC-CCITT polynomial *x*:sup:`16` " +"+ *x*:sup:`12` + *x*:sup:`5` + 1, often represented as 0x1021. This CRC is " +"used in the binhex4 format." msgstr "" -msgid "Compute CRC-32, the unsigned 32-bit checksum of *data*, starting with an initial CRC of *value*. The default initial CRC is zero. The algorithm is consistent with the ZIP file checksum. Since the algorithm is designed for use as a checksum algorithm, it is not suitable for use as a general hash algorithm. Use as follows::" +#: ../../library/binascii.rst:110 +msgid "" +"Compute CRC-32, the unsigned 32-bit checksum of *data*, starting with an " +"initial CRC of *value*. The default initial CRC is zero. The algorithm is " +"consistent with the ZIP file checksum. Since the algorithm is designed for " +"use as a checksum algorithm, it is not suitable for use as a general hash " +"algorithm. Use as follows::" msgstr "" +#: ../../library/binascii.rst:116 msgid "" "print(binascii.crc32(b\"hello world\"))\n" "# Or, in two pieces:\n" @@ -97,47 +166,80 @@ msgid "" "print('crc32 = {:#010x}'.format(crc))" msgstr "" +#: ../../library/binascii.rst:122 msgid "The result is always unsigned." msgstr "" -msgid "Return the hexadecimal representation of the binary *data*. Every byte of *data* is converted into the corresponding 2-digit hex representation. The returned bytes object is therefore twice as long as the length of *data*." +#: ../../library/binascii.rst:128 +msgid "" +"Return the hexadecimal representation of the binary *data*. Every byte of " +"*data* is converted into the corresponding 2-digit hex representation. The " +"returned bytes object is therefore twice as long as the length of *data*." msgstr "" -msgid "Similar functionality (but returning a text string) is also conveniently accessible using the :meth:`bytes.hex` method." +#: ../../library/binascii.rst:132 +msgid "" +"Similar functionality (but returning a text string) is also conveniently " +"accessible using the :meth:`bytes.hex` method." msgstr "" -msgid "If *sep* is specified, it must be a single character str or bytes object. It will be inserted in the output after every *bytes_per_sep* input bytes. Separator placement is counted from the right end of the output by default, if you wish to count from the left, supply a negative *bytes_per_sep* value." +#: ../../library/binascii.rst:135 +msgid "" +"If *sep* is specified, it must be a single character str or bytes object. It " +"will be inserted in the output after every *bytes_per_sep* input bytes. " +"Separator placement is counted from the right end of the output by default, " +"if you wish to count from the left, supply a negative *bytes_per_sep* value." msgstr "" +#: ../../library/binascii.rst:150 msgid "The *sep* and *bytes_per_sep* parameters were added." msgstr "" -msgid "Return the binary data represented by the hexadecimal string *hexstr*. This function is the inverse of :func:`b2a_hex`. *hexstr* must contain an even number of hexadecimal digits (which can be upper or lower case), otherwise an :exc:`Error` exception is raised." +#: ../../library/binascii.rst:156 +msgid "" +"Return the binary data represented by the hexadecimal string *hexstr*. This " +"function is the inverse of :func:`b2a_hex`. *hexstr* must contain an even " +"number of hexadecimal digits (which can be upper or lower case), otherwise " +"an :exc:`Error` exception is raised." msgstr "" -msgid "Similar functionality (but more liberal towards whitespace) is also accessible using the :meth:`bytes.fromhex` class method." +#: ../../library/binascii.rst:161 +msgid "" +"Similar functionality (but more liberal towards whitespace) is also " +"accessible using the :meth:`bytes.fromhex` class method." msgstr "" +#: ../../library/binascii.rst:166 msgid "Exception raised on errors. These are usually programming errors." msgstr "" -msgid "Exception raised on incomplete data. These are usually not programming errors, but may be handled by reading a little more data and trying again." +#: ../../library/binascii.rst:171 +msgid "" +"Exception raised on incomplete data. These are usually not programming " +"errors, but may be handled by reading a little more data and trying again." msgstr "" +#: ../../library/binascii.rst:177 msgid "Module :mod:`base64`" msgstr "" -msgid "Support for RFC compliant base64-style encoding in base 16, 32, 64, and 85." +#: ../../library/binascii.rst:178 +msgid "" +"Support for RFC compliant base64-style encoding in base 16, 32, 64, and 85." msgstr "" +#: ../../library/binascii.rst:181 msgid "Module :mod:`quopri`" msgstr "" +#: ../../library/binascii.rst:182 msgid "Support for quoted-printable encoding used in MIME email messages." msgstr "" +#: ../../library/binascii.rst:8 msgid "module" msgstr "" +#: ../../library/binascii.rst:8 msgid "base64" msgstr "" diff --git a/library/bisect.po b/library/bisect.po index 6a50ae708..5abad6c01 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,90 +24,196 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/bisect.rst:2 msgid ":mod:`!bisect` --- Array bisection algorithm" msgstr "" +#: ../../library/bisect.rst:10 msgid "**Source code:** :source:`Lib/bisect.py`" msgstr "" -msgid "This module provides support for maintaining a list in sorted order without having to sort the list after each insertion. For long lists of items with expensive comparison operations, this can be an improvement over linear searches or frequent resorting." +#: ../../library/bisect.rst:14 +msgid "" +"This module provides support for maintaining a list in sorted order without " +"having to sort the list after each insertion. For long lists of items with " +"expensive comparison operations, this can be an improvement over linear " +"searches or frequent resorting." msgstr "" -msgid "The module is called :mod:`!bisect` because it uses a basic bisection algorithm to do its work. Unlike other bisection tools that search for a specific value, the functions in this module are designed to locate an insertion point. Accordingly, the functions never call an :meth:`~object.__eq__` method to determine whether a value has been found. Instead, the functions only call the :meth:`~object.__lt__` method and will return an insertion point between values in an array." +#: ../../library/bisect.rst:19 +msgid "" +"The module is called :mod:`!bisect` because it uses a basic bisection " +"algorithm to do its work. Unlike other bisection tools that search for a " +"specific value, the functions in this module are designed to locate an " +"insertion point. Accordingly, the functions never call " +"an :meth:`~object.__eq__` method to determine whether a value has been " +"found. Instead, the functions only call the :meth:`~object.__lt__` method " +"and will return an insertion point between values in an array." msgstr "" -msgid "The functions in this module are not thread-safe. If multiple threads concurrently use :mod:`!bisect` functions on the same sequence, this may result in undefined behaviour. Likewise, if the provided sequence is mutated by a different thread while a :mod:`!bisect` function is operating on it, the result is undefined. For example, using :py:func:`~bisect.insort_left` on the same list from multiple threads may result in the list becoming unsorted." +#: ../../library/bisect.rst:29 +msgid "" +"The functions in this module are not thread-safe. If multiple threads " +"concurrently use :mod:`!bisect` functions on the same sequence, this may " +"result in undefined behaviour. Likewise, if the provided sequence is mutated " +"by a different thread while a :mod:`!bisect` function is operating on it, " +"the result is undefined. For example, using :py:func:`~bisect.insort_left` " +"on the same list from multiple threads may result in the list becoming " +"unsorted." msgstr "" +#: ../../library/bisect.rst:39 msgid "The following functions are provided:" msgstr "" -msgid "Locate the insertion point for *x* in *a* to maintain sorted order. The parameters *lo* and *hi* may be used to specify a subset of the list which should be considered; by default the entire list is used. If *x* is already present in *a*, the insertion point will be before (to the left of) any existing entries. The return value is suitable for use as the first parameter to ``list.insert()`` assuming that *a* is already sorted." +#: ../../library/bisect.rst:44 +msgid "" +"Locate the insertion point for *x* in *a* to maintain sorted order. The " +"parameters *lo* and *hi* may be used to specify a subset of the list which " +"should be considered; by default the entire list is used. If *x* is already " +"present in *a*, the insertion point will be before (to the left of) any " +"existing entries. The return value is suitable for use as the first " +"parameter to ``list.insert()`` assuming that *a* is already sorted." msgstr "" -msgid "The returned insertion point *ip* partitions the array *a* into two slices such that ``all(elem < x for elem in a[lo : ip])`` is true for the left slice and ``all(elem >= x for elem in a[ip : hi])`` is true for the right slice." +#: ../../library/bisect.rst:51 +msgid "" +"The returned insertion point *ip* partitions the array *a* into two slices " +"such that ``all(elem < x for elem in a[lo : ip])`` is true for the left " +"slice and ``all(elem >= x for elem in a[ip : hi])`` is true for the right " +"slice." msgstr "" -msgid "*key* specifies a :term:`key function` of one argument that is used to extract a comparison key from each element in the array. To support searching complex records, the key function is not applied to the *x* value." +#: ../../library/bisect.rst:56 +msgid "" +"*key* specifies a :term:`key function` of one argument that is used to " +"extract a comparison key from each element in the array. To support " +"searching complex records, the key function is not applied to the *x* value." msgstr "" -msgid "If *key* is ``None``, the elements are compared directly and no key function is called." +#: ../../library/bisect.rst:60 +msgid "" +"If *key* is ``None``, the elements are compared directly and no key function " +"is called." msgstr "" +#: ../../library/bisect.rst:63 ../../library/bisect.rst:77 +#: ../../library/bisect.rst:95 ../../library/bisect.rst:115 msgid "Added the *key* parameter." msgstr "" -msgid "Similar to :py:func:`~bisect.bisect_left`, but returns an insertion point which comes after (to the right of) any existing entries of *x* in *a*." +#: ../../library/bisect.rst:70 +msgid "" +"Similar to :py:func:`~bisect.bisect_left`, but returns an insertion point " +"which comes after (to the right of) any existing entries of *x* in *a*." msgstr "" -msgid "The returned insertion point *ip* partitions the array *a* into two slices such that ``all(elem <= x for elem in a[lo : ip])`` is true for the left slice and ``all(elem > x for elem in a[ip : hi])`` is true for the right slice." +#: ../../library/bisect.rst:73 +msgid "" +"The returned insertion point *ip* partitions the array *a* into two slices " +"such that ``all(elem <= x for elem in a[lo : ip])`` is true for the left " +"slice and ``all(elem > x for elem in a[ip : hi])`` is true for the right " +"slice." msgstr "" +#: ../../library/bisect.rst:83 msgid "Insert *x* in *a* in sorted order." msgstr "" -msgid "This function first runs :py:func:`~bisect.bisect_left` to locate an insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to insert *x* at the appropriate position to maintain sort order." +#: ../../library/bisect.rst:85 +msgid "" +"This function first runs :py:func:`~bisect.bisect_left` to locate an " +"insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " +"insert *x* at the appropriate position to maintain sort order." msgstr "" -msgid "To support inserting records in a table, the *key* function (if any) is applied to *x* for the search step but not for the insertion step." +#: ../../library/bisect.rst:89 ../../library/bisect.rst:109 +msgid "" +"To support inserting records in a table, the *key* function (if any) is " +"applied to *x* for the search step but not for the insertion step." msgstr "" -msgid "Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ (*n*) insertion step." +#: ../../library/bisect.rst:92 ../../library/bisect.rst:112 +msgid "" +"Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ " +"(*n*) insertion step." msgstr "" -msgid "Similar to :py:func:`~bisect.insort_left`, but inserting *x* in *a* after any existing entries of *x*." +#: ../../library/bisect.rst:102 +msgid "" +"Similar to :py:func:`~bisect.insort_left`, but inserting *x* in *a* after " +"any existing entries of *x*." msgstr "" -msgid "This function first runs :py:func:`~bisect.bisect_right` to locate an insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to insert *x* at the appropriate position to maintain sort order." +#: ../../library/bisect.rst:105 +msgid "" +"This function first runs :py:func:`~bisect.bisect_right` to locate an " +"insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " +"insert *x* at the appropriate position to maintain sort order." msgstr "" +#: ../../library/bisect.rst:120 msgid "Performance Notes" msgstr "" -msgid "When writing time sensitive code using *bisect()* and *insort()*, keep these thoughts in mind:" +#: ../../library/bisect.rst:122 +msgid "" +"When writing time sensitive code using *bisect()* and *insort()*, keep these " +"thoughts in mind:" msgstr "" -msgid "Bisection is effective for searching ranges of values. For locating specific values, dictionaries are more performant." +#: ../../library/bisect.rst:125 +msgid "" +"Bisection is effective for searching ranges of values. For locating specific " +"values, dictionaries are more performant." msgstr "" -msgid "The *insort()* functions are *O*\\ (*n*) because the logarithmic search step is dominated by the linear time insertion step." +#: ../../library/bisect.rst:128 +msgid "" +"The *insort()* functions are *O*\\ (*n*) because the logarithmic search step " +"is dominated by the linear time insertion step." msgstr "" -msgid "The search functions are stateless and discard key function results after they are used. Consequently, if the search functions are used in a loop, the key function may be called again and again on the same array elements. If the key function isn't fast, consider wrapping it with :py:func:`functools.cache` to avoid duplicate computations. Alternatively, consider searching an array of precomputed keys to locate the insertion point (as shown in the examples section below)." +#: ../../library/bisect.rst:131 +msgid "" +"The search functions are stateless and discard key function results after " +"they are used. Consequently, if the search functions are used in a loop, " +"the key function may be called again and again on the same array elements. " +"If the key function isn't fast, consider wrapping it " +"with :py:deco:`functools.cache` to avoid duplicate computations. " +"Alternatively, consider searching an array of precomputed keys to locate the " +"insertion point (as shown in the examples section below)." msgstr "" -msgid "`Sorted Collections `_ is a high performance module that uses *bisect* to managed sorted collections of data." +#: ../../library/bisect.rst:141 +msgid "" +"`Sorted Collections `_ is a " +"high performance module that uses *bisect* to managed sorted collections of " +"data." msgstr "" -msgid "The `SortedCollection recipe `_ uses bisect to build a full-featured collection class with straight-forward search methods and support for a key-function. The keys are precomputed to save unnecessary calls to the key function during searches." +#: ../../library/bisect.rst:145 +msgid "" +"The `SortedCollection recipe `_ uses bisect to build a full-featured collection class " +"with straight-forward search methods and support for a key-function. The " +"keys are precomputed to save unnecessary calls to the key function during " +"searches." msgstr "" +#: ../../library/bisect.rst:153 msgid "Searching Sorted Lists" msgstr "" -msgid "The above `bisect functions`_ are useful for finding insertion points but can be tricky or awkward to use for common searching tasks. The following five functions show how to transform them into the standard lookups for sorted lists::" +#: ../../library/bisect.rst:155 +msgid "" +"The above `bisect functions`_ are useful for finding insertion points but " +"can be tricky or awkward to use for common searching tasks. The following " +"five functions show how to transform them into the standard lookups for " +"sorted lists::" msgstr "" +#: ../../library/bisect.rst:160 msgid "" "def index(a, x):\n" " 'Locate the leftmost value exactly equal to x'\n" @@ -145,12 +251,19 @@ msgid "" " raise ValueError" msgstr "" +#: ../../library/bisect.rst:197 msgid "Examples" msgstr "" -msgid "The :py:func:`~bisect.bisect` function can be useful for numeric table lookups. This example uses :py:func:`~bisect.bisect` to look up a letter grade for an exam score (say) based on a set of ordered numeric breakpoints: 90 and up is an 'A', 80 to 89 is a 'B', and so on::" +#: ../../library/bisect.rst:201 +msgid "" +"The :py:func:`~bisect.bisect` function can be useful for numeric table " +"lookups. This example uses :py:func:`~bisect.bisect` to look up a letter " +"grade for an exam score (say) based on a set of ordered numeric breakpoints: " +"90 and up is an 'A', 80 to 89 is a 'B', and so on::" msgstr "" +#: ../../library/bisect.rst:206 msgid "" ">>> def grade(score):\n" "... i = bisect([60, 70, 80, 90], score)\n" @@ -160,9 +273,14 @@ msgid "" "['F', 'A', 'C', 'C', 'B', 'A', 'A']" msgstr "" -msgid "The :py:func:`~bisect.bisect` and :py:func:`~bisect.insort` functions also work with lists of tuples. The *key* argument can serve to extract the field used for ordering records in a table::" +#: ../../library/bisect.rst:213 +msgid "" +"The :py:func:`~bisect.bisect` and :py:func:`~bisect.insort` functions also " +"work with lists of tuples. The *key* argument can serve to extract the " +"field used for ordering records in a table::" msgstr "" +#: ../../library/bisect.rst:217 msgid "" ">>> from collections import namedtuple\n" ">>> from operator import attrgetter\n" @@ -195,9 +313,13 @@ msgid "" " Movie(name='Titanic', released=1997, director='Cameron')]" msgstr "" -msgid "If the key function is expensive, it is possible to avoid repeated function calls by searching a list of precomputed keys to find the index of a record::" +#: ../../library/bisect.rst:247 +msgid "" +"If the key function is expensive, it is possible to avoid repeated function " +"calls by searching a list of precomputed keys to find the index of a record::" msgstr "" +#: ../../library/bisect.rst:250 msgid "" ">>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]\n" ">>> data.sort(key=lambda r: r[1]) # Or use operator.itemgetter(1).\n" diff --git a/library/builtins.po b/library/builtins.po index a5c242493..efc964782 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,15 +21,27 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/builtins.rst:2 msgid ":mod:`!builtins` --- Built-in objects" msgstr "" -msgid "This module provides direct access to all 'built-in' identifiers of Python; for example, ``builtins.open`` is the full name for the built-in function :func:`open`." +#: ../../library/builtins.rst:9 +msgid "" +"This module provides direct access to all 'built-in' identifiers of Python; " +"for example, ``builtins.open`` is the full name for the built-in " +"function :func:`open`." msgstr "" -msgid "This module is not normally accessed explicitly by most applications, but can be useful in modules that provide objects with the same name as a built-in value, but in which the built-in of that name is also needed. For example, in a module that wants to implement an :func:`open` function that wraps the built-in :func:`open`, this module can be used directly::" +#: ../../library/builtins.rst:12 +msgid "" +"This module is not normally accessed explicitly by most applications, but " +"can be useful in modules that provide objects with the same name as a built-" +"in value, but in which the built-in of that name is also needed. For " +"example, in a module that wants to implement an :func:`open` function that " +"wraps the built-in :func:`open`, this module can be used directly::" msgstr "" +#: ../../library/builtins.rst:18 msgid "" "import builtins\n" "\n" @@ -49,17 +61,27 @@ msgid "" " # ..." msgstr "" -msgid "As an implementation detail, most modules have the name ``__builtins__`` made available as part of their globals. The value of ``__builtins__`` is normally either this module or the value of this module's :attr:`~object.__dict__` attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python." +#: ../../library/builtins.rst:35 +msgid "" +"As an implementation detail, most modules have the name ``__builtins__`` " +"made available as part of their globals. The value of ``__builtins__`` is " +"normally either this module or the value of this " +"module's :attr:`~object.__dict__` attribute. Since this is an implementation " +"detail, it may not be used by alternate implementations of Python." msgstr "" +#: ../../library/builtins.rst:43 msgid ":ref:`built-in-consts`" msgstr "" +#: ../../library/builtins.rst:44 msgid ":ref:`bltin-exceptions`" msgstr "" +#: ../../library/builtins.rst:45 msgid ":ref:`built-in-funcs`" msgstr "" +#: ../../library/builtins.rst:46 msgid ":ref:`bltin-types`" msgstr "" diff --git a/library/bz2.po b/library/bz2.po index c39fbed7f..324aa7ad9 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,227 +23,417 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/bz2.rst:2 msgid ":mod:`!bz2` --- Support for :program:`bzip2` compression" msgstr "" +#: ../../library/bz2.rst:12 msgid "**Source code:** :source:`Lib/bz2.py`" msgstr "" -msgid "This module provides a comprehensive interface for compressing and decompressing data using the bzip2 compression algorithm." +#: ../../library/bz2.rst:16 +msgid "" +"This module provides a comprehensive interface for compressing and " +"decompressing data using the bzip2 compression algorithm." msgstr "" +#: ../../library/bz2.rst:19 msgid "The :mod:`!bz2` module contains:" msgstr "" -msgid "The :func:`.open` function and :class:`BZ2File` class for reading and writing compressed files." +#: ../../library/bz2.rst:21 +msgid "" +"The :func:`.open` function and :class:`BZ2File` class for reading and " +"writing compressed files." msgstr "" -msgid "The :class:`BZ2Compressor` and :class:`BZ2Decompressor` classes for incremental (de)compression." +#: ../../library/bz2.rst:23 +msgid "" +"The :class:`BZ2Compressor` and :class:`BZ2Decompressor` classes for " +"incremental (de)compression." msgstr "" -msgid "The :func:`compress` and :func:`decompress` functions for one-shot (de)compression." +#: ../../library/bz2.rst:25 +msgid "" +"The :func:`compress` and :func:`decompress` functions for one-shot " +"(de)compression." msgstr "" -msgid "This is an :term:`optional module`. If it is missing from your copy of CPython, look for documentation from your distributor (that is, whoever provided Python to you). If you are the distributor, see :ref:`optional-module-requirements`." +#: ../../includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" +#: ../../library/bz2.rst:32 msgid "(De)compression of files" msgstr "" -msgid "Open a bzip2-compressed file in binary or text mode, returning a :term:`file object`." +#: ../../library/bz2.rst:36 +msgid "" +"Open a bzip2-compressed file in binary or text mode, returning a :term:`file " +"object`." msgstr "" -msgid "As with the constructor for :class:`BZ2File`, the *filename* argument can be an actual filename (a :class:`str` or :class:`bytes` object), or an existing file object to read from or write to." +#: ../../library/bz2.rst:39 +msgid "" +"As with the constructor for :class:`BZ2File`, the *filename* argument can be " +"an actual filename (a :class:`str` or :class:`bytes` object), or an existing " +"file object to read from or write to." msgstr "" -msgid "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'w'``, ``'wb'``, ``'x'``, ``'xb'``, ``'a'`` or ``'ab'`` for binary mode, or ``'rt'``, ``'wt'``, ``'xt'``, or ``'at'`` for text mode. The default is ``'rb'``." +#: ../../library/bz2.rst:43 +msgid "" +"The *mode* argument can be any of ``'r'``, ``'rb'``, ``'w'``, ``'wb'``, " +"``'x'``, ``'xb'``, ``'a'`` or ``'ab'`` for binary mode, or ``'rt'``, " +"``'wt'``, ``'xt'``, or ``'at'`` for text mode. The default is ``'rb'``." msgstr "" -msgid "The *compresslevel* argument is an integer from 1 to 9, as for the :class:`BZ2File` constructor." +#: ../../library/bz2.rst:47 +msgid "" +"The *compresslevel* argument is an integer from 1 to 9, as for " +"the :class:`BZ2File` constructor." msgstr "" -msgid "For binary mode, this function is equivalent to the :class:`BZ2File` constructor: ``BZ2File(filename, mode, compresslevel=compresslevel)``. In this case, the *encoding*, *errors* and *newline* arguments must not be provided." +#: ../../library/bz2.rst:50 +msgid "" +"For binary mode, this function is equivalent to the :class:`BZ2File` " +"constructor: ``BZ2File(filename, mode, compresslevel=compresslevel)``. In " +"this case, the *encoding*, *errors* and *newline* arguments must not be " +"provided." msgstr "" -msgid "For text mode, a :class:`BZ2File` object is created, and wrapped in an :class:`io.TextIOWrapper` instance with the specified encoding, error handling behavior, and line ending(s)." +#: ../../library/bz2.rst:55 +msgid "" +"For text mode, a :class:`BZ2File` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " +"handling behavior, and line ending(s)." msgstr "" +#: ../../library/bz2.rst:61 ../../library/bz2.rst:177 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" +#: ../../library/bz2.rst:64 ../../library/bz2.rst:184 msgid "Accepts a :term:`path-like object`." msgstr "" +#: ../../library/bz2.rst:70 msgid "Open a bzip2-compressed file in binary mode." msgstr "" -msgid "If *filename* is a :class:`str` or :class:`bytes` object, open the named file directly. Otherwise, *filename* should be a :term:`file object`, which will be used to read or write the compressed data." +#: ../../library/bz2.rst:72 +msgid "" +"If *filename* is a :class:`str` or :class:`bytes` object, open the named " +"file directly. Otherwise, *filename* should be a :term:`file object`, which " +"will be used to read or write the compressed data." msgstr "" -msgid "The *mode* argument can be either ``'r'`` for reading (default), ``'w'`` for overwriting, ``'x'`` for exclusive creation, or ``'a'`` for appending. These can equivalently be given as ``'rb'``, ``'wb'``, ``'xb'`` and ``'ab'`` respectively." +#: ../../library/bz2.rst:76 +msgid "" +"The *mode* argument can be either ``'r'`` for reading (default), ``'w'`` for " +"overwriting, ``'x'`` for exclusive creation, or ``'a'`` for appending. These " +"can equivalently be given as ``'rb'``, ``'wb'``, ``'xb'`` and ``'ab'`` " +"respectively." msgstr "" -msgid "If *filename* is a file object (rather than an actual file name), a mode of ``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." +#: ../../library/bz2.rst:81 +msgid "" +"If *filename* is a file object (rather than an actual file name), a mode of " +"``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." msgstr "" -msgid "If *mode* is ``'w'`` or ``'a'``, *compresslevel* can be an integer between ``1`` and ``9`` specifying the level of compression: ``1`` produces the least compression, and ``9`` (default) produces the most compression." +#: ../../library/bz2.rst:84 +msgid "" +"If *mode* is ``'w'`` or ``'a'``, *compresslevel* can be an integer between " +"``1`` and ``9`` specifying the level of compression: ``1`` produces the " +"least compression, and ``9`` (default) produces the most compression." msgstr "" -msgid "If *mode* is ``'r'``, the input file may be the concatenation of multiple compressed streams." +#: ../../library/bz2.rst:88 +msgid "" +"If *mode* is ``'r'``, the input file may be the concatenation of multiple " +"compressed streams." msgstr "" -msgid ":class:`BZ2File` provides all of the members specified by the :class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io.IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." +#: ../../library/bz2.rst:91 +msgid "" +":class:`BZ2File` provides all of the members specified by " +"the :class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` " +"and :meth:`~io.IOBase.truncate`. Iteration and the :keyword:`with` statement " +"are supported." msgstr "" +#: ../../library/bz2.rst:96 msgid ":class:`BZ2File` also provides the following methods and attributes:" msgstr "" -msgid "Return buffered data without advancing the file position. At least one byte of data will be returned (unless at EOF). The exact number of bytes returned is unspecified." +#: ../../library/bz2.rst:100 +msgid "" +"Return buffered data without advancing the file position. At least one byte " +"of data will be returned (unless at EOF). The exact number of bytes returned " +"is unspecified." msgstr "" -msgid "While calling :meth:`peek` does not change the file position of the :class:`BZ2File`, it may change the position of the underlying file object (e.g. if the :class:`BZ2File` was constructed by passing a file object for *filename*)." +#: ../../library/bz2.rst:104 +msgid "" +"While calling :meth:`peek` does not change the file position of " +"the :class:`BZ2File`, it may change the position of the underlying file " +"object (e.g. if the :class:`BZ2File` was constructed by passing a file " +"object for *filename*)." msgstr "" +#: ../../library/bz2.rst:113 msgid "Return the file descriptor for the underlying file." msgstr "" +#: ../../library/bz2.rst:119 msgid "Return whether the file was opened for reading." msgstr "" +#: ../../library/bz2.rst:125 msgid "Return whether the file supports seeking." msgstr "" +#: ../../library/bz2.rst:131 msgid "Return whether the file was opened for writing." msgstr "" -msgid "Read up to *size* uncompressed bytes, while trying to avoid making multiple reads from the underlying stream. Reads up to a buffer's worth of data if size is negative." +#: ../../library/bz2.rst:137 +msgid "" +"Read up to *size* uncompressed bytes, while trying to avoid making multiple " +"reads from the underlying stream. Reads up to a buffer's worth of data if " +"size is negative." msgstr "" +#: ../../library/bz2.rst:141 msgid "Returns ``b''`` if the file is at EOF." msgstr "" +#: ../../library/bz2.rst:147 msgid "Read bytes into *b*." msgstr "" +#: ../../library/bz2.rst:149 msgid "Returns the number of bytes read (0 for EOF)." msgstr "" +#: ../../library/bz2.rst:155 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" -msgid "The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of the underlying :term:`file object`." +#: ../../library/bz2.rst:161 +msgid "" +"The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." msgstr "" +#: ../../library/bz2.rst:167 msgid "Support for the :keyword:`with` statement was added." msgstr "" -msgid "Support was added for *filename* being a :term:`file object` instead of an actual filename." +#: ../../library/bz2.rst:170 +msgid "" +"Support was added for *filename* being a :term:`file object` instead of an " +"actual filename." msgstr "" -msgid "The ``'a'`` (append) mode was added, along with support for reading multi-stream files." +#: ../../library/bz2.rst:174 +msgid "" +"The ``'a'`` (append) mode was added, along with support for reading multi-" +"stream files." msgstr "" -msgid "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of ``None``." +#: ../../library/bz2.rst:180 +msgid "" +"The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " +"``None``." msgstr "" -msgid "The *buffering* parameter has been removed. It was ignored and deprecated since Python 3.0. Pass an open file object to control how the file is opened." +#: ../../library/bz2.rst:187 +msgid "" +"The *buffering* parameter has been removed. It was ignored and deprecated " +"since Python 3.0. Pass an open file object to control how the file is opened." msgstr "" +#: ../../library/bz2.rst:192 msgid "The *compresslevel* parameter became keyword-only." msgstr "" -msgid "This class is thread unsafe in the face of multiple simultaneous readers or writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` have always been." +#: ../../library/bz2.rst:194 +msgid "" +"This class is thread unsafe in the face of multiple simultaneous readers or " +"writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` " +"have always been." msgstr "" +#: ../../library/bz2.rst:201 msgid "Incremental (de)compression" msgstr "" -msgid "Create a new compressor object. This object may be used to compress data incrementally. For one-shot compression, use the :func:`compress` function instead." +#: ../../library/bz2.rst:205 +msgid "" +"Create a new compressor object. This object may be used to compress data " +"incrementally. For one-shot compression, use the :func:`compress` function " +"instead." msgstr "" -msgid "*compresslevel*, if given, must be an integer between ``1`` and ``9``. The default is ``9``." +#: ../../library/bz2.rst:209 ../../library/bz2.rst:297 +msgid "" +"*compresslevel*, if given, must be an integer between ``1`` and ``9``. The " +"default is ``9``." msgstr "" -msgid "Provide data to the compressor object. Returns a chunk of compressed data if possible, or an empty byte string otherwise." +#: ../../library/bz2.rst:214 +msgid "" +"Provide data to the compressor object. Returns a chunk of compressed data if " +"possible, or an empty byte string otherwise." msgstr "" -msgid "When you have finished providing data to the compressor, call the :meth:`flush` method to finish the compression process." +#: ../../library/bz2.rst:217 +msgid "" +"When you have finished providing data to the compressor, call " +"the :meth:`flush` method to finish the compression process." msgstr "" -msgid "Finish the compression process. Returns the compressed data left in internal buffers." +#: ../../library/bz2.rst:223 +msgid "" +"Finish the compression process. Returns the compressed data left in internal " +"buffers." msgstr "" -msgid "The compressor object may not be used after this method has been called." +#: ../../library/bz2.rst:226 +msgid "" +"The compressor object may not be used after this method has been called." msgstr "" -msgid "Create a new decompressor object. This object may be used to decompress data incrementally. For one-shot compression, use the :func:`decompress` function instead." +#: ../../library/bz2.rst:231 +msgid "" +"Create a new decompressor object. This object may be used to decompress data " +"incrementally. For one-shot compression, use the :func:`decompress` function " +"instead." msgstr "" -msgid "This class does not transparently handle inputs containing multiple compressed streams, unlike :func:`decompress` and :class:`BZ2File`. If you need to decompress a multi-stream input with :class:`BZ2Decompressor`, you must use a new decompressor for each stream." +#: ../../library/bz2.rst:236 +msgid "" +"This class does not transparently handle inputs containing multiple " +"compressed streams, unlike :func:`decompress` and :class:`BZ2File`. If you " +"need to decompress a multi-stream input with :class:`BZ2Decompressor`, you " +"must use a new decompressor for each stream." msgstr "" -msgid "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data as bytes. Some of *data* may be buffered internally, for use in later calls to :meth:`decompress`. The returned data should be concatenated with the output of any previous calls to :meth:`decompress`." +#: ../../library/bz2.rst:243 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " +"as bytes. Some of *data* may be buffered internally, for use in later calls " +"to :meth:`decompress`. The returned data should be concatenated with the " +"output of any previous calls to :meth:`decompress`." msgstr "" -msgid "If *max_length* is nonnegative, returns at most *max_length* bytes of decompressed data. If this limit is reached and further output can be produced, the :attr:`~.needs_input` attribute will be set to ``False``. In this case, the next call to :meth:`~.decompress` may provide *data* as ``b''`` to obtain more of the output." +#: ../../library/bz2.rst:249 +msgid "" +"If *max_length* is nonnegative, returns at most *max_length* bytes of " +"decompressed data. If this limit is reached and further output can be " +"produced, the :attr:`~.needs_input` attribute will be set to ``False``. In " +"this case, the next call to :meth:`~.decompress` may provide *data* as " +"``b''`` to obtain more of the output." msgstr "" -msgid "If all of the input data was decompressed and returned (either because this was less than *max_length* bytes, or because *max_length* was negative), the :attr:`~.needs_input` attribute will be set to ``True``." +#: ../../library/bz2.rst:256 +msgid "" +"If all of the input data was decompressed and returned (either because this " +"was less than *max_length* bytes, or because *max_length* was negative), " +"the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -msgid "Attempting to decompress data after the end of stream is reached raises an :exc:`EOFError`. Any data found after the end of the stream is ignored and saved in the :attr:`~.unused_data` attribute." +#: ../../library/bz2.rst:261 +msgid "" +"Attempting to decompress data after the end of stream is reached raises " +"an :exc:`EOFError`. Any data found after the end of the stream is ignored " +"and saved in the :attr:`~.unused_data` attribute." msgstr "" +#: ../../library/bz2.rst:265 msgid "Added the *max_length* parameter." msgstr "" +#: ../../library/bz2.rst:270 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" +#: ../../library/bz2.rst:277 msgid "Data found after the end of the compressed stream." msgstr "" -msgid "If this attribute is accessed before the end of the stream has been reached, its value will be ``b''``." +#: ../../library/bz2.rst:279 +msgid "" +"If this attribute is accessed before the end of the stream has been reached, " +"its value will be ``b''``." msgstr "" -msgid "``False`` if the :meth:`.decompress` method can provide more decompressed data before requiring new uncompressed input." +#: ../../library/bz2.rst:284 +msgid "" +"``False`` if the :meth:`.decompress` method can provide more decompressed " +"data before requiring new uncompressed input." msgstr "" +#: ../../library/bz2.rst:291 msgid "One-shot (de)compression" msgstr "" +#: ../../library/bz2.rst:295 msgid "Compress *data*, a :term:`bytes-like object `." msgstr "" +#: ../../library/bz2.rst:300 msgid "For incremental compression, use a :class:`BZ2Compressor` instead." msgstr "" +#: ../../library/bz2.rst:305 msgid "Decompress *data*, a :term:`bytes-like object `." msgstr "" -msgid "If *data* is the concatenation of multiple compressed streams, decompress all of the streams." +#: ../../library/bz2.rst:307 +msgid "" +"If *data* is the concatenation of multiple compressed streams, decompress " +"all of the streams." msgstr "" +#: ../../library/bz2.rst:310 msgid "For incremental decompression, use a :class:`BZ2Decompressor` instead." msgstr "" +#: ../../library/bz2.rst:312 msgid "Support for multi-stream inputs was added." msgstr "" +#: ../../library/bz2.rst:318 msgid "Examples of usage" msgstr "" +#: ../../library/bz2.rst:320 msgid "Below are some examples of typical usage of the :mod:`!bz2` module." msgstr "" -msgid "Using :func:`compress` and :func:`decompress` to demonstrate round-trip compression:" +#: ../../library/bz2.rst:322 +msgid "" +"Using :func:`compress` and :func:`decompress` to demonstrate round-trip " +"compression:" msgstr "" +#: ../../library/bz2.rst:340 msgid "Using :class:`BZ2Compressor` for incremental compression:" msgstr "" -msgid "The example above uses a very \"nonrandom\" stream of data (a stream of ``b\"z\"`` chunks). Random data tends to compress poorly, while ordered, repetitive data usually yields a high compression ratio." +#: ../../library/bz2.rst:358 +msgid "" +"The example above uses a very \"nonrandom\" stream of data (a stream of " +"``b\"z\"`` chunks). Random data tends to compress poorly, while ordered, " +"repetitive data usually yields a high compression ratio." msgstr "" +#: ../../library/bz2.rst:362 msgid "Writing and reading a bzip2-compressed file in binary mode:" msgstr "" diff --git a/library/calendar.po b/library/calendar.po index 3326b85f7..072905266 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,177 +23,357 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/calendar.rst:2 msgid ":mod:`!calendar` --- General calendar-related functions" msgstr "" +#: ../../library/calendar.rst:10 msgid "**Source code:** :source:`Lib/calendar.py`" msgstr "" -msgid "This module allows you to output calendars like the Unix :program:`cal` program, and provides additional useful functions related to the calendar. By default, these calendars have Monday as the first day of the week, and Sunday as the last (the European convention). Use :func:`setfirstweekday` to set the first day of the week to Sunday (6) or to any other weekday. Parameters that specify dates are given as integers. For related functionality, see also the :mod:`datetime` and :mod:`time` modules." +#: ../../library/calendar.rst:14 +msgid "" +"This module allows you to output calendars like the Unix :program:`cal` " +"program, and provides additional useful functions related to the calendar. " +"By default, these calendars have Monday as the first day of the week, and " +"Sunday as the last (the European convention). Use :func:`setfirstweekday` to " +"set the first day of the week to Sunday (6) or to any other weekday. " +"Parameters that specify dates are given as integers. For related " +"functionality, see also the :mod:`datetime` and :mod:`time` modules." msgstr "" -msgid "The functions and classes defined in this module use an idealized calendar, the current Gregorian calendar extended indefinitely in both directions. This matches the definition of the \"proleptic Gregorian\" calendar in Dershowitz and Reingold's book \"Calendrical Calculations\", where it's the base calendar for all computations. Zero and negative years are interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is 2 BC, and so on." +#: ../../library/calendar.rst:22 +msgid "" +"The functions and classes defined in this module use an idealized calendar, " +"the current Gregorian calendar extended indefinitely in both directions. " +"This matches the definition of the \"proleptic Gregorian\" calendar in " +"Dershowitz and Reingold's book \"Calendrical Calculations\", where it's the " +"base calendar for all computations. Zero and negative years are interpreted " +"as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is 2 BC, " +"and so on." msgstr "" -msgid "Creates a :class:`Calendar` object. *firstweekday* is an integer specifying the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:`SUNDAY` is ``6``." +#: ../../library/calendar.rst:33 +msgid "" +"Creates a :class:`Calendar` object. *firstweekday* is an integer specifying " +"the first day of the week. :const:`MONDAY` is ``0`` (the " +"default), :const:`SUNDAY` is ``6``." msgstr "" -msgid "A :class:`Calendar` object provides several methods that can be used for preparing the calendar data for formatting. This class doesn't do any formatting itself. This is the job of subclasses." +#: ../../library/calendar.rst:36 +msgid "" +"A :class:`Calendar` object provides several methods that can be used for " +"preparing the calendar data for formatting. This class doesn't do any " +"formatting itself. This is the job of subclasses." msgstr "" +#: ../../library/calendar.rst:41 msgid ":class:`Calendar` instances have the following methods and attributes:" msgstr "" +#: ../../library/calendar.rst:45 msgid "The first weekday as an integer (0--6)." msgstr "" -msgid "This property can also be set and read using :meth:`~Calendar.setfirstweekday` and :meth:`~Calendar.getfirstweekday` respectively." +#: ../../library/calendar.rst:47 +msgid "" +"This property can also be set and read " +"using :meth:`~Calendar.setfirstweekday` " +"and :meth:`~Calendar.getfirstweekday` respectively." msgstr "" +#: ../../library/calendar.rst:53 msgid "Return an :class:`int` for the current first weekday (0--6)." msgstr "" +#: ../../library/calendar.rst:55 msgid "Identical to reading the :attr:`~Calendar.firstweekday` property." msgstr "" -msgid "Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)." +#: ../../library/calendar.rst:59 +msgid "" +"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)." msgstr "" +#: ../../library/calendar.rst:61 msgid "Identical to setting the :attr:`~Calendar.firstweekday` property." msgstr "" -msgid "Return an iterator for the weekday numbers that will be used for one week. The first value from the iterator will be the same as the value of the :attr:`~Calendar.firstweekday` property." +#: ../../library/calendar.rst:65 +msgid "" +"Return an iterator for the weekday numbers that will be used for one week. " +"The first value from the iterator will be the same as the value of " +"the :attr:`~Calendar.firstweekday` property." msgstr "" -msgid "Return an iterator for the month *month* (1--12) in the year *year*. This iterator will return all days (as :class:`datetime.date` objects) for the month and all days before the start of the month or after the end of the month that are required to get a complete week." +#: ../../library/calendar.rst:72 +msgid "" +"Return an iterator for the month *month* (1--12) in the year *year*. This " +"iterator will return all days (as :class:`datetime.date` objects) for the " +"month and all days before the start of the month or after the end of the " +"month that are required to get a complete week." msgstr "" -msgid "Return an iterator for the month *month* in the year *year* similar to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` range. Days returned will simply be day of the month numbers. For the days outside of the specified month, the day number is ``0``." +#: ../../library/calendar.rst:80 +msgid "" +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will simply be day of the month numbers. For the days " +"outside of the specified month, the day number is ``0``." msgstr "" -msgid "Return an iterator for the month *month* in the year *year* similar to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` range. Days returned will be tuples consisting of a day of the month number and a weekday number." +#: ../../library/calendar.rst:88 +msgid "" +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will be tuples consisting of a day of the month number " +"and a weekday number." msgstr "" -msgid "Return an iterator for the month *month* in the year *year* similar to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` range. Days returned will be tuples consisting of a year, a month and a day of the month numbers." +#: ../../library/calendar.rst:96 +msgid "" +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will be tuples consisting of a year, a month and a day " +"of the month numbers." msgstr "" -msgid "Return an iterator for the month *month* in the year *year* similar to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` range. Days returned will be tuples consisting of a year, a month, a day of the month, and a day of the week numbers." +#: ../../library/calendar.rst:106 +msgid "" +"Return an iterator for the month *month* in the year *year* similar " +"to :meth:`itermonthdates`, but not restricted by the :class:`datetime.date` " +"range. Days returned will be tuples consisting of a year, a month, a day of " +"the month, and a day of the week numbers." msgstr "" -msgid "Return a list of the weeks in the month *month* of the *year* as full weeks. Weeks are lists of seven :class:`datetime.date` objects." +#: ../../library/calendar.rst:116 +msgid "" +"Return a list of the weeks in the month *month* of the *year* as full " +"weeks. Weeks are lists of seven :class:`datetime.date` objects." msgstr "" -msgid "Return a list of the weeks in the month *month* of the *year* as full weeks. Weeks are lists of seven tuples of day numbers and weekday numbers." +#: ../../library/calendar.rst:122 +msgid "" +"Return a list of the weeks in the month *month* of the *year* as full " +"weeks. Weeks are lists of seven tuples of day numbers and weekday numbers." msgstr "" -msgid "Return a list of the weeks in the month *month* of the *year* as full weeks. Weeks are lists of seven day numbers." +#: ../../library/calendar.rst:129 +msgid "" +"Return a list of the weeks in the month *month* of the *year* as full " +"weeks. Weeks are lists of seven day numbers." msgstr "" -msgid "Return the data for the specified year ready for formatting. The return value is a list of month rows. Each month row contains up to *width* months (defaulting to 3). Each month contains between 4 and 6 weeks and each week contains 1--7 days. Days are :class:`datetime.date` objects." +#: ../../library/calendar.rst:135 +msgid "" +"Return the data for the specified year ready for formatting. The return " +"value is a list of month rows. Each month row contains up to *width* months " +"(defaulting to 3). Each month contains between 4 and 6 weeks and each week " +"contains 1--7 days. Days are :class:`datetime.date` objects." msgstr "" -msgid "Return the data for the specified year ready for formatting (similar to :meth:`yeardatescalendar`). Entries in the week lists are tuples of day numbers and weekday numbers. Day numbers outside this month are zero." +#: ../../library/calendar.rst:143 +msgid "" +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are tuples of day " +"numbers and weekday numbers. Day numbers outside this month are zero." msgstr "" -msgid "Return the data for the specified year ready for formatting (similar to :meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day numbers outside this month are zero." +#: ../../library/calendar.rst:150 +msgid "" +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are day numbers. " +"Day numbers outside this month are zero." msgstr "" +#: ../../library/calendar.rst:157 msgid "This class can be used to generate plain text calendars." msgstr "" +#: ../../library/calendar.rst:159 msgid ":class:`TextCalendar` instances have the following methods:" msgstr "" -msgid "Return a string representing a single day formatted with the given *width*. If *theday* is ``0``, return a string of spaces of the specified width, representing an empty day. The *weekday* parameter is unused." +#: ../../library/calendar.rst:164 +msgid "" +"Return a string representing a single day formatted with the given *width*. " +"If *theday* is ``0``, return a string of spaces of the specified width, " +"representing an empty day. The *weekday* parameter is unused." msgstr "" -msgid "Return a single week in a string with no newline. If *w* is provided, it specifies the width of the date columns, which are centered. Depends on the first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method." +#: ../../library/calendar.rst:171 +msgid "" +"Return a single week in a string with no newline. If *w* is provided, it " +"specifies the width of the date columns, which are centered. Depends on the " +"first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." msgstr "" -msgid "Return a string representing the name of a single weekday formatted to the specified *width*. The *weekday* parameter is an integer representing the day of the week, where ``0`` is Monday and ``6`` is Sunday." +#: ../../library/calendar.rst:179 +msgid "" +"Return a string representing the name of a single weekday formatted to the " +"specified *width*. The *weekday* parameter is an integer representing the " +"day of the week, where ``0`` is Monday and ``6`` is Sunday." msgstr "" -msgid "Return a string containing the header row of weekday names, formatted with the given *width* for each column. The names depend on the locale settings and are padded to the specified width." +#: ../../library/calendar.rst:186 +msgid "" +"Return a string containing the header row of weekday names, formatted with " +"the given *width* for each column. The names depend on the locale settings " +"and are padded to the specified width." msgstr "" -msgid "Return a month's calendar in a multi-line string. If *w* is provided, it specifies the width of the date columns, which are centered. If *l* is given, it specifies the number of lines that each week will use. Depends on the first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method." +#: ../../library/calendar.rst:193 +msgid "" +"Return a month's calendar in a multi-line string. If *w* is provided, it " +"specifies the width of the date columns, which are centered. If *l* is " +"given, it specifies the number of lines that each week will use. Depends on " +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." msgstr "" -msgid "Return a string representing the month's name centered within the specified *width*. If *withyear* is ``True``, include the year in the output. The *theyear* and *themonth* parameters specify the year and month for the name to be formatted respectively." +#: ../../library/calendar.rst:202 +msgid "" +"Return a string representing the month's name centered within the specified " +"*width*. If *withyear* is ``True``, include the year in the output. The " +"*theyear* and *themonth* parameters specify the year and month for the name " +"to be formatted respectively." msgstr "" +#: ../../library/calendar.rst:210 msgid "Print a month's calendar as returned by :meth:`formatmonth`." msgstr "" -msgid "Return a *m*-column calendar for an entire year as a multi-line string. Optional parameters *w*, *l*, and *c* are for date column width, lines per week, and number of spaces between month columns, respectively. Depends on the first weekday as specified in the constructor or set by the :meth:`setfirstweekday` method. The earliest year for which a calendar can be generated is platform-dependent." +#: ../../library/calendar.rst:215 +msgid "" +"Return a *m*-column calendar for an entire year as a multi-line string. " +"Optional parameters *w*, *l*, and *c* are for date column width, lines per " +"week, and number of spaces between month columns, respectively. Depends on " +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method. The earliest year for which a calendar " +"can be generated is platform-dependent." msgstr "" -msgid "Print the calendar for an entire year as returned by :meth:`formatyear`." +#: ../../library/calendar.rst:225 +msgid "" +"Print the calendar for an entire year as returned by :meth:`formatyear`." msgstr "" +#: ../../library/calendar.rst:230 msgid "This class can be used to generate HTML calendars." msgstr "" +#: ../../library/calendar.rst:233 msgid ":class:`!HTMLCalendar` instances have the following methods:" msgstr "" -msgid "Return a month's calendar as an HTML table. If *withyear* is true the year will be included in the header, otherwise just the month name will be used." +#: ../../library/calendar.rst:237 +msgid "" +"Return a month's calendar as an HTML table. If *withyear* is true the year " +"will be included in the header, otherwise just the month name will be used." msgstr "" -msgid "Return a year's calendar as an HTML table. *width* (defaulting to 3) specifies the number of months per row." +#: ../../library/calendar.rst:244 +msgid "" +"Return a year's calendar as an HTML table. *width* (defaulting to 3) " +"specifies the number of months per row." msgstr "" -msgid "Return a year's calendar as a complete HTML page. *width* (defaulting to 3) specifies the number of months per row. *css* is the name for the cascading style sheet to be used. :const:`None` can be passed if no style sheet should be used. *encoding* specifies the encoding to be used for the output (defaulting to the system default encoding)." +#: ../../library/calendar.rst:250 +msgid "" +"Return a year's calendar as a complete HTML page. *width* (defaulting to 3) " +"specifies the number of months per row. *css* is the name for the cascading " +"style sheet to be used. :const:`None` can be passed if no style sheet should " +"be used. *encoding* specifies the encoding to be used for the output " +"(defaulting to the system default encoding)." msgstr "" -msgid "Return a month name as an HTML table row. If *withyear* is true the year will be included in the row, otherwise just the month name will be used." +#: ../../library/calendar.rst:259 +msgid "" +"Return a month name as an HTML table row. If *withyear* is true the year " +"will be included in the row, otherwise just the month name will be used." msgstr "" -msgid ":class:`!HTMLCalendar` has the following attributes you can override to customize the CSS classes used by the calendar:" +#: ../../library/calendar.rst:264 +msgid "" +":class:`!HTMLCalendar` has the following attributes you can override to " +"customize the CSS classes used by the calendar:" msgstr "" -msgid "A list of CSS classes used for each weekday. The default class list is::" +#: ../../library/calendar.rst:269 +msgid "" +"A list of CSS classes used for each weekday. The default class list is::" msgstr "" -msgid "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" +#: ../../library/calendar.rst:271 +msgid "" +"cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" msgstr "" +#: ../../library/calendar.rst:273 msgid "more styles can be added for each day::" msgstr "" -msgid "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun red\"]" +#: ../../library/calendar.rst:275 +msgid "" +"cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " +"\"sat\", \"sun red\"]" msgstr "" +#: ../../library/calendar.rst:277 msgid "Note that the length of this list must be seven items." msgstr "" +#: ../../library/calendar.rst:282 msgid "The CSS class for a weekday occurring in the previous or coming month." msgstr "" -msgid "A list of CSS classes used for weekday names in the header row. The default is the same as :attr:`cssclasses`." +#: ../../library/calendar.rst:289 +msgid "" +"A list of CSS classes used for weekday names in the header row. The default " +"is the same as :attr:`cssclasses`." msgstr "" -msgid "The month's head CSS class (used by :meth:`formatmonthname`). The default value is ``\"month\"``." +#: ../../library/calendar.rst:297 +msgid "" +"The month's head CSS class (used by :meth:`formatmonthname`). The default " +"value is ``\"month\"``." msgstr "" -msgid "The CSS class for the whole month's table (used by :meth:`formatmonth`). The default value is ``\"month\"``." +#: ../../library/calendar.rst:305 +msgid "" +"The CSS class for the whole month's table (used by :meth:`formatmonth`). The " +"default value is ``\"month\"``." msgstr "" -msgid "The CSS class for the whole year's table of tables (used by :meth:`formatyear`). The default value is ``\"year\"``." +#: ../../library/calendar.rst:313 +msgid "" +"The CSS class for the whole year's table of tables (used " +"by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" -msgid "The CSS class for the table head for the whole year (used by :meth:`formatyear`). The default value is ``\"year\"``." +#: ../../library/calendar.rst:321 +msgid "" +"The CSS class for the table head for the whole year (used " +"by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" -msgid "Note that although the naming for the above described class attributes is singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the single CSS class with a space separated list of CSS classes, for example::" +#: ../../library/calendar.rst:327 +msgid "" +"Note that although the naming for the above described class attributes is " +"singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the " +"single CSS class with a space separated list of CSS classes, for example::" msgstr "" +#: ../../library/calendar.rst:331 msgid "\"text-bold text-red\"" msgstr "" +#: ../../library/calendar.rst:333 msgid "Here is an example how :class:`!HTMLCalendar` can be customized::" msgstr "" +#: ../../library/calendar.rst:335 msgid "" "class CustomHTMLCal(calendar.HTMLCalendar):\n" " cssclasses = [style + \" text-nowrap\" for style in\n" @@ -203,137 +383,244 @@ msgid "" " cssclass_year = \"text-italic lead\"" msgstr "" -msgid "This subclass of :class:`TextCalendar` can be passed a locale name in the constructor and will return month and weekday names in the specified locale." +#: ../../library/calendar.rst:345 +msgid "" +"This subclass of :class:`TextCalendar` can be passed a locale name in the " +"constructor and will return month and weekday names in the specified locale." msgstr "" -msgid "This subclass of :class:`HTMLCalendar` can be passed a locale name in the constructor and will return month and weekday names in the specified locale." +#: ../../library/calendar.rst:351 +msgid "" +"This subclass of :class:`HTMLCalendar` can be passed a locale name in the " +"constructor and will return month and weekday names in the specified locale." msgstr "" -msgid "The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods of these two classes temporarily change the ``LC_TIME`` locale to the given *locale*. Because the current locale is a process-wide setting, they are not thread-safe." +#: ../../library/calendar.rst:357 +msgid "" +"The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods " +"of these two classes temporarily change the ``LC_TIME`` locale to the given " +"*locale*. Because the current locale is a process-wide setting, they are not " +"thread-safe." msgstr "" +#: ../../library/calendar.rst:363 msgid "For simple text calendars this module provides the following functions." msgstr "" -msgid "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are provided for convenience. For example, to set the first weekday to Sunday::" +#: ../../library/calendar.rst:367 +msgid "" +"Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " +"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, " +"and :const:`SUNDAY` are provided for convenience. For example, to set the " +"first weekday to Sunday::" msgstr "" +#: ../../library/calendar.rst:372 msgid "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" msgstr "" +#: ../../library/calendar.rst:378 msgid "Returns the current setting for the weekday to start each week." msgstr "" -msgid "Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." +#: ../../library/calendar.rst:383 +msgid "" +"Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." msgstr "" -msgid "Returns the number of leap years in the range from *y1* to *y2* (exclusive), where *y1* and *y2* are years." +#: ../../library/calendar.rst:388 +msgid "" +"Returns the number of leap years in the range from *y1* to *y2* (exclusive), " +"where *y1* and *y2* are years." msgstr "" +#: ../../library/calendar.rst:391 msgid "This function works for ranges spanning a century change." msgstr "" -msgid "Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), *month* (``1``--``12``), *day* (``1``--``31``)." +#: ../../library/calendar.rst:396 +msgid "" +"Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), " +"*month* (``1``--``12``), *day* (``1``--``31``)." msgstr "" -msgid "Return a header containing abbreviated weekday names. *n* specifies the width in characters for one weekday." +#: ../../library/calendar.rst:402 +msgid "" +"Return a header containing abbreviated weekday names. *width* specifies the " +"width in characters for one weekday." msgstr "" -msgid "Returns weekday of first day of the month and number of days in month, for the specified *year* and *month*." +#: ../../library/calendar.rst:408 +msgid "" +"Returns weekday of first day of the month and number of days in month, for " +"the specified *year* and *month*." msgstr "" -msgid "Returns a matrix representing a month's calendar. Each row represents a week; days outside of the month are represented by zeros. Each week begins with Monday unless set by :func:`setfirstweekday`." +#: ../../library/calendar.rst:414 +msgid "" +"Returns a matrix representing a month's calendar. Each row represents a " +"week; days outside of the month are represented by zeros. Each week begins " +"with Monday unless set by :func:`setfirstweekday`." msgstr "" +#: ../../library/calendar.rst:421 msgid "Prints a month's calendar as returned by :func:`month`." msgstr "" -msgid "Returns a month's calendar in a multi-line string using the :meth:`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." +#: ../../library/calendar.rst:426 +msgid "" +"Returns a month's calendar in a multi-line string using " +"the :meth:`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." msgstr "" -msgid "Prints the calendar for an entire year as returned by :func:`calendar`." +#: ../../library/calendar.rst:432 +msgid "" +"Prints the calendar for an entire year as returned by :func:`calendar`." msgstr "" -msgid "Returns a 3-column calendar for an entire year as a multi-line string using the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." +#: ../../library/calendar.rst:437 +msgid "" +"Returns a 3-column calendar for an entire year as a multi-line string using " +"the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." msgstr "" -msgid "An unrelated but handy function that takes a time tuple such as returned by the :func:`~time.gmtime` function in the :mod:`time` module, and returns the corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's inverse." +#: ../../library/calendar.rst:443 +msgid "" +"An unrelated but handy function that takes a time tuple such as returned by " +"the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " +"corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX " +"encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's " +"inverse." msgstr "" +#: ../../library/calendar.rst:450 msgid "The :mod:`!calendar` module exports the following data attributes:" msgstr "" -msgid "A sequence that represents the days of the week in the current locale, where Monday is day number 0." +#: ../../library/calendar.rst:454 +msgid "" +"A sequence that represents the days of the week in the current locale, where " +"Monday is day number 0." msgstr "" -msgid "A sequence that represents the abbreviated days of the week in the current locale, where Mon is day number 0." +#: ../../library/calendar.rst:464 +msgid "" +"A sequence that represents the abbreviated days of the week in the current " +"locale, where Mon is day number 0." msgstr "" -msgid "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` is ``6``." +#: ../../library/calendar.rst:479 +msgid "" +"Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " +"is ``6``." msgstr "" -msgid "Enumeration defining days of the week as integer constants. The members of this enumeration are exported to the module scope as :data:`MONDAY` through :data:`SUNDAY`." +#: ../../library/calendar.rst:487 +msgid "" +"Enumeration defining days of the week as integer constants. The members of " +"this enumeration are exported to the module scope as :data:`MONDAY` " +"through :data:`SUNDAY`." msgstr "" -msgid "A sequence that represents the months of the year in the current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_name[0]`` is the empty string." +#: ../../library/calendar.rst:496 +msgid "" +"A sequence that represents the months of the year in the current locale. " +"This follows normal convention of January being month number 1, so it has a " +"length of 13 and ``month_name[0]`` is the empty string." msgstr "" -msgid "A sequence that represents the abbreviated months of the year in the current locale. This follows normal convention of January being month number 1, so it has a length of 13 and ``month_abbr[0]`` is the empty string." +#: ../../library/calendar.rst:507 +msgid "" +"A sequence that represents the abbreviated months of the year in the current " +"locale. This follows normal convention of January being month number 1, so " +"it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" -msgid "Aliases for the months of the year, where ``JANUARY`` is ``1`` and ``DECEMBER`` is ``12``." +#: ../../library/calendar.rst:528 +msgid "" +"Aliases for the months of the year, where ``JANUARY`` is ``1`` and " +"``DECEMBER`` is ``12``." msgstr "" -msgid "Enumeration defining months of the year as integer constants. The members of this enumeration are exported to the module scope as :data:`JANUARY` through :data:`DECEMBER`." +#: ../../library/calendar.rst:536 +msgid "" +"Enumeration defining months of the year as integer constants. The members of " +"this enumeration are exported to the module scope as :data:`JANUARY` " +"through :data:`DECEMBER`." msgstr "" +#: ../../library/calendar.rst:543 msgid "The :mod:`!calendar` module defines the following exceptions:" msgstr "" -msgid "A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given month number is outside of the range 1-12 (inclusive)." +#: ../../library/calendar.rst:547 +msgid "" +"A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given " +"month number is outside of the range 1-12 (inclusive)." msgstr "" -msgid ":exc:`IllegalMonthError` is now also a subclass of :exc:`ValueError`. New code should avoid catching :exc:`IndexError`." +#: ../../library/calendar.rst:550 +msgid "" +":exc:`IllegalMonthError` is now also a subclass of :exc:`ValueError`. New " +"code should avoid catching :exc:`IndexError`." msgstr "" +#: ../../library/calendar.rst:557 msgid "The invalid month number." msgstr "" -msgid "A subclass of :exc:`ValueError`, raised when the given weekday number is outside of the range 0-6 (inclusive)." +#: ../../library/calendar.rst:562 +msgid "" +"A subclass of :exc:`ValueError`, raised when the given weekday number is " +"outside of the range 0-6 (inclusive)." msgstr "" +#: ../../library/calendar.rst:567 msgid "The invalid weekday number." msgstr "" +#: ../../library/calendar.rst:572 msgid "Module :mod:`datetime`" msgstr "" -msgid "Object-oriented interface to dates and times with similar functionality to the :mod:`time` module." +#: ../../library/calendar.rst:573 +msgid "" +"Object-oriented interface to dates and times with similar functionality to " +"the :mod:`time` module." msgstr "" +#: ../../library/calendar.rst:576 msgid "Module :mod:`time`" msgstr "" +#: ../../library/calendar.rst:577 msgid "Low-level time related functions." msgstr "" +#: ../../library/calendar.rst:583 msgid "Command-line usage" msgstr "" -msgid "The :mod:`!calendar` module can be executed as a script from the command line to interactively print a calendar." +#: ../../library/calendar.rst:587 +msgid "" +"The :mod:`!calendar` module can be executed as a script from the command " +"line to interactively print a calendar." msgstr "" +#: ../../library/calendar.rst:590 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" " [-f FIRST_WEEKDAY] [year] [month]" msgstr "" +#: ../../library/calendar.rst:597 msgid "For example, to print a calendar for the year 2000:" msgstr "" +#: ../../library/calendar.rst:599 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -374,50 +661,83 @@ msgid "" "30 31" msgstr "" +#: ../../library/calendar.rst:640 msgid "The following options are accepted:" msgstr "" +#: ../../library/calendar.rst:647 msgid "Show the help message and exit." msgstr "" +#: ../../library/calendar.rst:652 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "" -msgid "The encoding to use for output. :option:`--encoding` is required if :option:`--locale` is set." +#: ../../library/calendar.rst:658 +msgid "" +"The encoding to use for output. :option:`--encoding` is required " +"if :option:`--locale` is set." msgstr "" +#: ../../library/calendar.rst:664 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "" -msgid "The weekday to start each week. Must be a number between 0 (Monday) and 6 (Sunday). Defaults to 0." +#: ../../library/calendar.rst:670 +msgid "" +"The weekday to start each week. Must be a number between 0 (Monday) and 6 " +"(Sunday). Defaults to 0." msgstr "" +#: ../../library/calendar.rst:678 msgid "The year to print the calendar for. Defaults to the current year." msgstr "" -msgid "The month of the specified :option:`year` to print the calendar for. Must be a number between 1 and 12, and may only be used in text mode. Defaults to printing a calendar for the full year." +#: ../../library/calendar.rst:684 +msgid "" +"The month of the specified :option:`year` to print the calendar for. Must be " +"a number between 1 and 12, and may only be used in text mode. Defaults to " +"printing a calendar for the full year." msgstr "" +#: ../../library/calendar.rst:690 msgid "*Text-mode options:*" msgstr "" -msgid "The width of the date column in terminal columns. The date is printed centred in the column. Any value lower than 2 is ignored. Defaults to 2." +#: ../../library/calendar.rst:694 +msgid "" +"The width of the date column in terminal columns. The date is printed " +"centred in the column. Any value lower than 2 is ignored. Defaults to 2." msgstr "" -msgid "The number of lines for each week in terminal rows. The date is printed top-aligned. Any value lower than 1 is ignored. Defaults to 1." +#: ../../library/calendar.rst:702 +msgid "" +"The number of lines for each week in terminal rows. The date is printed top-" +"aligned. Any value lower than 1 is ignored. Defaults to 1." msgstr "" -msgid "The space between months in columns. Any value lower than 2 is ignored. Defaults to 6." +#: ../../library/calendar.rst:710 +msgid "" +"The space between months in columns. Any value lower than 2 is ignored. " +"Defaults to 6." msgstr "" +#: ../../library/calendar.rst:717 msgid "The number of months printed per row. Defaults to 3." msgstr "" -msgid "By default, today's date is highlighted in color and can be :ref:`controlled using environment variables `." +#: ../../library/calendar.rst:720 +msgid "" +"By default, today's date is highlighted in color and can be :ref:`controlled " +"using environment variables `." msgstr "" +#: ../../library/calendar.rst:724 msgid "*HTML-mode options:*" msgstr "" -msgid "The path of a CSS stylesheet to use for the calendar. This must either be relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." +#: ../../library/calendar.rst:728 +msgid "" +"The path of a CSS stylesheet to use for the calendar. This must either be " +"relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." msgstr "" diff --git a/library/cgi.po b/library/cgi.po index 46fc50f4b..347bfffa3 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/cgi.rst:2 msgid ":mod:`!cgi` --- Common Gateway Interface support" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.13 ` after being deprecated in Python 3.11. The removal was decided in :pep:`594`." +#: ../../library/cgi.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.13 ` after being " +"deprecated in Python 3.11. The removal was decided in :pep:`594`." msgstr "" -msgid "A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`. This is a copy of the cgi module, no longer maintained or supported by the core Python team." +#: ../../library/cgi.rst:14 +msgid "" +"A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`. This " +"is a copy of the cgi module, no longer maintained or supported by the core " +"Python team." msgstr "" -msgid "The last version of Python that provided the :mod:`!cgi` module was `Python 3.12 `_." +#: ../../library/cgi.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!cgi` module was `Python " +"3.12 `_." msgstr "" diff --git a/library/cgitb.po b/library/cgitb.po index 6f93a6236..06c4ffa52 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/cgitb.rst:2 msgid ":mod:`!cgitb` --- Traceback manager for CGI scripts" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.13 ` after being deprecated in Python 3.11. The removal was decided in :pep:`594`." +#: ../../library/cgitb.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.13 ` after being " +"deprecated in Python 3.11. The removal was decided in :pep:`594`." msgstr "" -msgid "A fork of the module on PyPI can now be used instead: :pypi:`legacy-cgi`. This is a copy of the cgi module, no longer maintained or supported by the core Python team." +#: ../../library/cgitb.rst:14 +msgid "" +"A fork of the module on PyPI can now be used instead: :pypi:`legacy-cgi`. " +"This is a copy of the cgi module, no longer maintained or supported by the " +"core Python team." msgstr "" -msgid "The last version of Python that provided the :mod:`!cgitb` module was `Python 3.12 `_." +#: ../../library/cgitb.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!cgitb` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/chunk.po b/library/chunk.po index 31e3c0147..e3da877ba 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/chunk.rst:2 msgid ":mod:`!chunk` --- Read IFF chunked data" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.13 ` after being deprecated in Python 3.11. The removal was decided in :pep:`594`." +#: ../../library/chunk.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.13 ` after being " +"deprecated in Python 3.11. The removal was decided in :pep:`594`." msgstr "" -msgid "The last version of Python that provided the :mod:`!chunk` module was `Python 3.12 `_." +#: ../../library/chunk.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!chunk` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/cmath.po b/library/cmath.po index 634a050e6..a67ccc3fb 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,244 +24,359 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/cmath.rst:2 msgid ":mod:`!cmath` --- Mathematical functions for complex numbers" msgstr "" -msgid "This module provides access to mathematical functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments. They will also accept any Python object that has either a :meth:`~object.__complex__` or a :meth:`~object.__float__` method: these methods are used to convert the object to a complex or floating-point number, respectively, and the function is then applied to the result of the conversion." +#: ../../library/cmath.rst:9 +msgid "" +"This module provides access to mathematical functions for complex numbers. " +"The functions in this module accept integers, floating-point numbers or " +"complex numbers as arguments. They will also accept any Python object that " +"has either a :meth:`~object.__complex__` or a :meth:`~object.__float__` " +"method: these methods are used to convert the object to a complex or " +"floating-point number, respectively, and the function is then applied to the " +"result of the conversion." msgstr "" -msgid "For functions involving branch cuts, we have the problem of deciding how to define those functions on the cut itself. Following Kahan's \"Branch cuts for complex elementary functions\" paper, as well as Annex G of C99 and later C standards, we use the sign of zero to distinguish one side of the branch cut from the other: for a branch cut along (a portion of) the real axis we look at the sign of the imaginary part, while for a branch cut along the imaginary axis we look at the sign of the real part." +#: ../../library/cmath.rst:18 +msgid "" +"For functions involving branch cuts, we have the problem of deciding how to " +"define those functions on the cut itself. Following Kahan's \"Branch cuts " +"for complex elementary functions\" paper, as well as Annex G of C99 and " +"later C standards, we use the sign of zero to distinguish one side of the " +"branch cut from the other: for a branch cut along (a portion of) the real " +"axis we look at the sign of the imaginary part, while for a branch cut along " +"the imaginary axis we look at the sign of the real part." msgstr "" -msgid "For example, the :func:`cmath.sqrt` function has a branch cut along the negative real axis. An argument of ``-2-0j`` is treated as though it lies *below* the branch cut, and so gives a result on the negative imaginary axis::" +#: ../../library/cmath.rst:26 +msgid "" +"For example, the :func:`cmath.sqrt` function has a branch cut along the " +"negative real axis. An argument of ``-2-0j`` is treated as though it lies " +"*below* the branch cut, and so gives a result on the negative imaginary " +"axis::" msgstr "" +#: ../../library/cmath.rst:31 msgid "" ">>> cmath.sqrt(-2-0j)\n" "-1.4142135623730951j" msgstr "" -msgid "But an argument of ``-2+0j`` is treated as though it lies above the branch cut::" +#: ../../library/cmath.rst:34 +msgid "" +"But an argument of ``-2+0j`` is treated as though it lies above the branch " +"cut::" msgstr "" +#: ../../library/cmath.rst:37 msgid "" ">>> cmath.sqrt(-2+0j)\n" "1.4142135623730951j" msgstr "" +#: ../../library/cmath.rst:42 msgid "**Conversions to and from polar coordinates**" msgstr "" +#: ../../library/cmath.rst:44 msgid ":func:`phase(z) `" msgstr "" +#: ../../library/cmath.rst:44 msgid "Return the phase of *z*" msgstr "" +#: ../../library/cmath.rst:45 msgid ":func:`polar(z) `" msgstr "" +#: ../../library/cmath.rst:45 msgid "Return the representation of *z* in polar coordinates" msgstr "" +#: ../../library/cmath.rst:46 msgid ":func:`rect(r, phi) `" msgstr "" +#: ../../library/cmath.rst:46 msgid "Return the complex number *z* with polar coordinates *r* and *phi*" msgstr "" +#: ../../library/cmath.rst:48 msgid "**Power and logarithmic functions**" msgstr "" +#: ../../library/cmath.rst:50 msgid ":func:`exp(z) `" msgstr "" +#: ../../library/cmath.rst:50 msgid "Return *e* raised to the power *z*" msgstr "" +#: ../../library/cmath.rst:51 msgid ":func:`log(z[, base]) `" msgstr "" +#: ../../library/cmath.rst:51 msgid "Return the logarithm of *z* to the given *base* (*e* by default)" msgstr "" +#: ../../library/cmath.rst:52 msgid ":func:`log10(z) `" msgstr "" +#: ../../library/cmath.rst:52 msgid "Return the base-10 logarithm of *z*" msgstr "" +#: ../../library/cmath.rst:53 msgid ":func:`sqrt(z) `" msgstr "" +#: ../../library/cmath.rst:53 msgid "Return the square root of *z*" msgstr "" +#: ../../library/cmath.rst:55 msgid "**Trigonometric functions**" msgstr "" +#: ../../library/cmath.rst:57 msgid ":func:`acos(z) `" msgstr "" +#: ../../library/cmath.rst:57 msgid "Return the arc cosine of *z*" msgstr "" +#: ../../library/cmath.rst:58 msgid ":func:`asin(z) `" msgstr "" +#: ../../library/cmath.rst:58 msgid "Return the arc sine of *z*" msgstr "" +#: ../../library/cmath.rst:59 msgid ":func:`atan(z) `" msgstr "" +#: ../../library/cmath.rst:59 msgid "Return the arc tangent of *z*" msgstr "" +#: ../../library/cmath.rst:60 msgid ":func:`cos(z) `" msgstr "" +#: ../../library/cmath.rst:60 msgid "Return the cosine of *z*" msgstr "" +#: ../../library/cmath.rst:61 msgid ":func:`sin(z) `" msgstr "" +#: ../../library/cmath.rst:61 msgid "Return the sine of *z*" msgstr "" +#: ../../library/cmath.rst:62 msgid ":func:`tan(z) `" msgstr "" +#: ../../library/cmath.rst:62 msgid "Return the tangent of *z*" msgstr "" +#: ../../library/cmath.rst:64 msgid "**Hyperbolic functions**" msgstr "" +#: ../../library/cmath.rst:66 msgid ":func:`acosh(z) `" msgstr "" +#: ../../library/cmath.rst:66 msgid "Return the inverse hyperbolic cosine of *z*" msgstr "" +#: ../../library/cmath.rst:67 msgid ":func:`asinh(z) `" msgstr "" +#: ../../library/cmath.rst:67 msgid "Return the inverse hyperbolic sine of *z*" msgstr "" +#: ../../library/cmath.rst:68 msgid ":func:`atanh(z) `" msgstr "" +#: ../../library/cmath.rst:68 msgid "Return the inverse hyperbolic tangent of *z*" msgstr "" +#: ../../library/cmath.rst:69 msgid ":func:`cosh(z) `" msgstr "" +#: ../../library/cmath.rst:69 msgid "Return the hyperbolic cosine of *z*" msgstr "" +#: ../../library/cmath.rst:70 msgid ":func:`sinh(z) `" msgstr "" +#: ../../library/cmath.rst:70 msgid "Return the hyperbolic sine of *z*" msgstr "" +#: ../../library/cmath.rst:71 msgid ":func:`tanh(z) `" msgstr "" +#: ../../library/cmath.rst:71 msgid "Return the hyperbolic tangent of *z*" msgstr "" +#: ../../library/cmath.rst:73 msgid "**Classification functions**" msgstr "" +#: ../../library/cmath.rst:75 msgid ":func:`isfinite(z) `" msgstr "" +#: ../../library/cmath.rst:75 msgid "Check if all components of *z* are finite" msgstr "" +#: ../../library/cmath.rst:76 msgid ":func:`isinf(z) `" msgstr "" +#: ../../library/cmath.rst:76 msgid "Check if any component of *z* is infinite" msgstr "" +#: ../../library/cmath.rst:77 msgid ":func:`isnan(z) `" msgstr "" +#: ../../library/cmath.rst:77 msgid "Check if any component of *z* is a NaN" msgstr "" +#: ../../library/cmath.rst:78 msgid ":func:`isclose(a, b, *, rel_tol, abs_tol) `" msgstr "" +#: ../../library/cmath.rst:78 msgid "Check if the values *a* and *b* are close to each other" msgstr "" +#: ../../library/cmath.rst:80 msgid "**Constants**" msgstr "" +#: ../../library/cmath.rst:82 msgid ":data:`pi`" msgstr "" +#: ../../library/cmath.rst:82 msgid "*π* = 3.141592..." msgstr "" +#: ../../library/cmath.rst:83 msgid ":data:`e`" msgstr "" +#: ../../library/cmath.rst:83 msgid "*e* = 2.718281..." msgstr "" +#: ../../library/cmath.rst:84 msgid ":data:`tau`" msgstr "" +#: ../../library/cmath.rst:84 msgid "*τ* = 2\\ *π* = 6.283185..." msgstr "" +#: ../../library/cmath.rst:85 msgid ":data:`inf`" msgstr "" +#: ../../library/cmath.rst:85 msgid "Positive infinity" msgstr "" +#: ../../library/cmath.rst:86 msgid ":data:`infj`" msgstr "" +#: ../../library/cmath.rst:86 msgid "Pure imaginary infinity" msgstr "" +#: ../../library/cmath.rst:87 msgid ":data:`nan`" msgstr "" +#: ../../library/cmath.rst:87 msgid "\"Not a number\" (NaN)" msgstr "" +#: ../../library/cmath.rst:88 msgid ":data:`nanj`" msgstr "" +#: ../../library/cmath.rst:88 msgid "Pure imaginary NaN" msgstr "" +#: ../../library/cmath.rst:93 msgid "Conversions to and from polar coordinates" msgstr "" -msgid "A Python complex number ``z`` is stored internally using *rectangular* or *Cartesian* coordinates. It is completely determined by its *real part* ``z.real`` and its *imaginary part* ``z.imag``." +#: ../../library/cmath.rst:95 +msgid "" +"A Python complex number ``z`` is stored internally using *rectangular* or " +"*Cartesian* coordinates. It is completely determined by its *real part* " +"``z.real`` and its *imaginary part* ``z.imag``." msgstr "" -msgid "*Polar coordinates* give an alternative way to represent a complex number. In polar coordinates, a complex number *z* is defined by the modulus *r* and the phase angle *phi*. The modulus *r* is the distance from *z* to the origin, while the phase *phi* is the counterclockwise angle, measured in radians, from the positive x-axis to the line segment that joins the origin to *z*." +#: ../../library/cmath.rst:99 +msgid "" +"*Polar coordinates* give an alternative way to represent a complex number. " +"In polar coordinates, a complex number *z* is defined by the modulus *r* and " +"the phase angle *phi*. The modulus *r* is the distance from *z* to the " +"origin, while the phase *phi* is the counterclockwise angle, measured in " +"radians, from the positive x-axis to the line segment that joins the origin " +"to *z*." msgstr "" -msgid "The following functions can be used to convert from the native rectangular coordinates to polar coordinates and back." +#: ../../library/cmath.rst:106 +msgid "" +"The following functions can be used to convert from the native rectangular " +"coordinates to polar coordinates and back." msgstr "" -msgid "Return the phase of *z* (also known as the *argument* of *z*), as a float. ``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result lies in the range [-\\ *π*, *π*], and the branch cut for this operation lies along the negative real axis. The sign of the result is the same as the sign of ``z.imag``, even when ``z.imag`` is zero::" +#: ../../library/cmath.rst:111 +msgid "" +"Return the phase of *z* (also known as the *argument* of *z*), as a float. " +"``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result " +"lies in the range [-\\ *π*, *π*], and the branch cut for this operation lies " +"along the negative real axis. The sign of the result is the same as the " +"sign of ``z.imag``, even when ``z.imag`` is zero::" msgstr "" +#: ../../library/cmath.rst:117 msgid "" ">>> phase(-1+0j)\n" "3.141592653589793\n" @@ -269,137 +384,263 @@ msgid "" "-3.141592653589793" msgstr "" -msgid "The modulus (absolute value) of a complex number *z* can be computed using the built-in :func:`abs` function. There is no separate :mod:`!cmath` module function for this operation." +#: ../../library/cmath.rst:125 +msgid "" +"The modulus (absolute value) of a complex number *z* can be computed using " +"the built-in :func:`abs` function. There is no separate :mod:`!cmath` " +"module function for this operation." msgstr "" -msgid "Return the representation of *z* in polar coordinates. Returns a pair ``(r, phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. ``polar(z)`` is equivalent to ``(abs(z), phase(z))``." +#: ../../library/cmath.rst:132 +msgid "" +"Return the representation of *z* in polar coordinates. Returns a pair ``(r, " +"phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. " +"``polar(z)`` is equivalent to ``(abs(z), phase(z))``." msgstr "" -msgid "Return the complex number *z* with polar coordinates *r* and *phi*. Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." +#: ../../library/cmath.rst:140 +msgid "" +"Return the complex number *z* with polar coordinates *r* and *phi*. " +"Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." msgstr "" +#: ../../library/cmath.rst:145 msgid "Power and logarithmic functions" msgstr "" -msgid "Return *e* raised to the power *z*, where *e* is the base of natural logarithms." +#: ../../library/cmath.rst:149 +msgid "" +"Return *e* raised to the power *z*, where *e* is the base of natural " +"logarithms." msgstr "" -msgid "Return the logarithm of *z* to the given *base*. If the *base* is not specified, returns the natural logarithm of *z*. There is one branch cut, from 0 along the negative real axis to -∞." +#: ../../library/cmath.rst:155 +msgid "" +"Return the logarithm of *z* to the given *base*. If the *base* is not " +"specified, returns the natural logarithm of *z*. There is one branch cut, " +"from 0 along the negative real axis to -∞." msgstr "" -msgid "Return the base-10 logarithm of *z*. This has the same branch cut as :func:`log`." +#: ../../library/cmath.rst:162 +msgid "" +"Return the base-10 logarithm of *z*. This has the same branch cut " +"as :func:`log`." msgstr "" -msgid "Return the square root of *z*. This has the same branch cut as :func:`log`." +#: ../../library/cmath.rst:168 +msgid "" +"Return the square root of *z*. This has the same branch cut as :func:`log`." msgstr "" +#: ../../library/cmath.rst:172 msgid "Trigonometric functions" msgstr "" -msgid "Return the arc cosine of *z*. There are two branch cuts: One extends right from 1 along the real axis to ∞. The other extends left from -1 along the real axis to -∞." +#: ../../library/cmath.rst:176 +msgid "" +"Return the arc cosine of *z*. There are two branch cuts: One extends right " +"from 1 along the real axis to ∞. The other extends left from -1 along the " +"real axis to -∞." msgstr "" -msgid "Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." +#: ../../library/cmath.rst:183 +msgid "" +"Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." msgstr "" -msgid "Return the arc tangent of *z*. There are two branch cuts: One extends from ``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` along the imaginary axis to ``-∞j``." +#: ../../library/cmath.rst:188 +msgid "" +"Return the arc tangent of *z*. There are two branch cuts: One extends from " +"``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` " +"along the imaginary axis to ``-∞j``." msgstr "" +#: ../../library/cmath.rst:195 msgid "Return the cosine of *z*." msgstr "" +#: ../../library/cmath.rst:200 msgid "Return the sine of *z*." msgstr "" +#: ../../library/cmath.rst:205 msgid "Return the tangent of *z*." msgstr "" +#: ../../library/cmath.rst:209 msgid "Hyperbolic functions" msgstr "" -msgid "Return the inverse hyperbolic cosine of *z*. There is one branch cut, extending left from 1 along the real axis to -∞." +#: ../../library/cmath.rst:213 +msgid "" +"Return the inverse hyperbolic cosine of *z*. There is one branch cut, " +"extending left from 1 along the real axis to -∞." msgstr "" -msgid "Return the inverse hyperbolic sine of *z*. There are two branch cuts: One extends from ``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` along the imaginary axis to ``-∞j``." +#: ../../library/cmath.rst:219 +msgid "" +"Return the inverse hyperbolic sine of *z*. There are two branch cuts: One " +"extends from ``1j`` along the imaginary axis to ``∞j``. The other extends " +"from ``-1j`` along the imaginary axis to ``-∞j``." msgstr "" -msgid "Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One extends from ``1`` along the real axis to ``∞``. The other extends from ``-1`` along the real axis to ``-∞``." +#: ../../library/cmath.rst:226 +msgid "" +"Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One " +"extends from ``1`` along the real axis to ``∞``. The other extends from " +"``-1`` along the real axis to ``-∞``." msgstr "" +#: ../../library/cmath.rst:233 msgid "Return the hyperbolic cosine of *z*." msgstr "" +#: ../../library/cmath.rst:238 msgid "Return the hyperbolic sine of *z*." msgstr "" +#: ../../library/cmath.rst:243 msgid "Return the hyperbolic tangent of *z*." msgstr "" +#: ../../library/cmath.rst:247 msgid "Classification functions" msgstr "" -msgid "Return ``True`` if both the real and imaginary parts of *z* are finite, and ``False`` otherwise." +#: ../../library/cmath.rst:251 +msgid "" +"Return ``True`` if both the real and imaginary parts of *z* are finite, and " +"``False`` otherwise." msgstr "" -msgid "Return ``True`` if either the real or the imaginary part of *z* is an infinity, and ``False`` otherwise." +#: ../../library/cmath.rst:259 +msgid "" +"Return ``True`` if either the real or the imaginary part of *z* is an " +"infinity, and ``False`` otherwise." msgstr "" -msgid "Return ``True`` if either the real or the imaginary part of *z* is a NaN, and ``False`` otherwise." +#: ../../library/cmath.rst:265 +msgid "" +"Return ``True`` if either the real or the imaginary part of *z* is a NaN, " +"and ``False`` otherwise." msgstr "" -msgid "Return ``True`` if the values *a* and *b* are close to each other and ``False`` otherwise." +#: ../../library/cmath.rst:271 +msgid "" +"Return ``True`` if the values *a* and *b* are close to each other and " +"``False`` otherwise." msgstr "" -msgid "Whether or not two values are considered close is determined according to given absolute and relative tolerances. If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." +#: ../../library/cmath.rst:274 +msgid "" +"Whether or not two values are considered close is determined according to " +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." msgstr "" -msgid "*rel_tol* is the relative tolerance -- it is the maximum allowed difference between *a* and *b*, relative to the larger absolute value of *a* or *b*. For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default tolerance is ``1e-09``, which assures that the two values are the same within about 9 decimal digits. *rel_tol* must be nonnegative and less than ``1.0``." +#: ../../library/cmath.rst:278 +msgid "" +"*rel_tol* is the relative tolerance -- it is the maximum allowed difference " +"between *a* and *b*, relative to the larger absolute value of *a* or *b*. " +"For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " +"tolerance is ``1e-09``, which assures that the two values are the same " +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" -msgid "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument to the call." +#: ../../library/cmath.rst:285 +msgid "" +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " +"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " +"to the call." msgstr "" -msgid "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be handled according to IEEE rules. Specifically, ``NaN`` is not considered close to any other value, including ``NaN``. ``inf`` and ``-inf`` are only considered close to themselves." +#: ../../library/cmath.rst:291 +msgid "" +"The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " +"handled according to IEEE rules. Specifically, ``NaN`` is not considered " +"close to any other value, including ``NaN``. ``inf`` and ``-inf`` are only " +"considered close to themselves." msgstr "" +#: ../../library/cmath.rst:300 msgid ":pep:`485` -- A function for testing approximate equality" msgstr "" +#: ../../library/cmath.rst:304 msgid "Constants" msgstr "" +#: ../../library/cmath.rst:308 msgid "The mathematical constant *π*, as a float." msgstr "" +#: ../../library/cmath.rst:313 msgid "The mathematical constant *e*, as a float." msgstr "" +#: ../../library/cmath.rst:318 msgid "The mathematical constant *τ*, as a float." msgstr "" +#: ../../library/cmath.rst:325 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "" -msgid "Complex number with zero real part and positive infinity imaginary part. Equivalent to ``complex(0.0, float('inf'))``." +#: ../../library/cmath.rst:332 +msgid "" +"Complex number with zero real part and positive infinity imaginary part. " +"Equivalent to ``complex(0.0, float('inf'))``." msgstr "" -msgid "A floating-point \"not a number\" (NaN) value. Equivalent to ``float('nan')``. See also :data:`math.nan`." +#: ../../library/cmath.rst:340 +msgid "" +"A floating-point \"not a number\" (NaN) value. Equivalent to " +"``float('nan')``. See also :data:`math.nan`." msgstr "" -msgid "Complex number with zero real part and NaN imaginary part. Equivalent to ``complex(0.0, float('nan'))``." +#: ../../library/cmath.rst:348 +msgid "" +"Complex number with zero real part and NaN imaginary part. Equivalent to " +"``complex(0.0, float('nan'))``." msgstr "" -msgid "Note that the selection of functions is similar, but not identical, to that in module :mod:`math`. The reason for having two modules is that some users aren't interested in complex numbers, and perhaps don't even know what they are. They would rather have ``math.sqrt(-1)`` raise an exception than return a complex number. Also note that the functions defined in :mod:`!cmath` always return a complex number, even if the answer can be expressed as a real number (in which case the complex number has an imaginary part of zero)." +#: ../../library/cmath.rst:356 +msgid "" +"Note that the selection of functions is similar, but not identical, to that " +"in module :mod:`math`. The reason for having two modules is that some users " +"aren't interested in complex numbers, and perhaps don't even know what they " +"are. They would rather have ``math.sqrt(-1)`` raise an exception than " +"return a complex number. Also note that the functions defined in :mod:`!" +"cmath` always return a complex number, even if the answer can be expressed " +"as a real number (in which case the complex number has an imaginary part of " +"zero)." msgstr "" -msgid "A note on branch cuts: They are curves along which the given function fails to be continuous. They are a necessary feature of many complex functions. It is assumed that if you need to compute with complex functions, you will understand about branch cuts. Consult almost any (not too elementary) book on complex variables for enlightenment. For information of the proper choice of branch cuts for numerical purposes, a good reference should be the following:" +#: ../../library/cmath.rst:364 +msgid "" +"A note on branch cuts: They are curves along which the given function fails " +"to be continuous. They are a necessary feature of many complex functions. " +"It is assumed that if you need to compute with complex functions, you will " +"understand about branch cuts. Consult almost any (not too elementary) book " +"on complex variables for enlightenment. For information of the proper " +"choice of branch cuts for numerical purposes, a good reference should be the " +"following:" msgstr "" -msgid "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the art in numerical analysis. Clarendon Press (1987) pp165--211." +#: ../../library/cmath.rst:374 +msgid "" +"Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " +"nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " +"art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" +#: ../../library/cmath.rst:354 msgid "module" msgstr "" +#: ../../library/cmath.rst:354 msgid "math" msgstr "" diff --git a/library/cmd.po b/library/cmd.po index 225cde8cc..1595ee882 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,144 +21,317 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/cmd.rst:2 msgid ":mod:`!cmd` --- Support for line-oriented command interpreters" msgstr "" +#: ../../library/cmd.rst:9 msgid "**Source code:** :source:`Lib/cmd.py`" msgstr "" -msgid "The :class:`Cmd` class provides a simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface." +#: ../../library/cmd.rst:13 +msgid "" +"The :class:`Cmd` class provides a simple framework for writing line-oriented " +"command interpreters. These are often useful for test harnesses, " +"administrative tools, and prototypes that will later be wrapped in a more " +"sophisticated interface." msgstr "" -msgid "A :class:`Cmd` instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate :class:`Cmd` itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit :class:`Cmd`'s methods and encapsulate action methods." +#: ../../library/cmd.rst:20 +msgid "" +"A :class:`Cmd` instance or subclass instance is a line-oriented interpreter " +"framework. There is no good reason to instantiate :class:`Cmd` itself; " +"rather, it's useful as a superclass of an interpreter class you define " +"yourself in order to inherit :class:`Cmd`'s methods and encapsulate action " +"methods." msgstr "" -msgid "The optional argument *completekey* is the :mod:`readline` name of a completion key; it defaults to :kbd:`Tab`. If *completekey* is not :const:`None` and :mod:`readline` is available, command completion is done automatically." +#: ../../library/cmd.rst:25 +msgid "" +"The optional argument *completekey* is the :mod:`readline` name of a " +"completion key; it defaults to :kbd:`Tab`. If *completekey* is " +"not :const:`None` and :mod:`readline` is available, command completion is " +"done automatically." msgstr "" -msgid "The default, ``'tab'``, is treated specially, so that it refers to the :kbd:`Tab` key on every :data:`readline.backend`. Specifically, if :data:`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` instead of ``'tab'``. Note that other values are not treated this way, and might only work with a specific backend." +#: ../../library/cmd.rst:29 +msgid "" +"The default, ``'tab'``, is treated specially, so that it refers to " +"the :kbd:`Tab` key on every :data:`readline.backend`. Specifically, " +"if :data:`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` " +"instead of ``'tab'``. Note that other values are not treated this way, and " +"might only work with a specific backend." msgstr "" -msgid "The optional arguments *stdin* and *stdout* specify the input and output file objects that the Cmd instance or subclass instance will use for input and output. If not specified, they will default to :data:`sys.stdin` and :data:`sys.stdout`." +#: ../../library/cmd.rst:36 +msgid "" +"The optional arguments *stdin* and *stdout* specify the input and output " +"file objects that the Cmd instance or subclass instance will use for input " +"and output. If not specified, they will default to :data:`sys.stdin` " +"and :data:`sys.stdout`." msgstr "" -msgid "If you want a given *stdin* to be used, make sure to set the instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be ignored." +#: ../../library/cmd.rst:41 +msgid "" +"If you want a given *stdin* to be used, make sure to set the " +"instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* " +"will be ignored." msgstr "" +#: ../../library/cmd.rst:45 msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``." msgstr "" +#: ../../library/cmd.rst:52 msgid "Cmd Objects" msgstr "" +#: ../../library/cmd.rst:54 msgid "A :class:`Cmd` instance has the following methods:" msgstr "" -msgid "Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument." +#: ../../library/cmd.rst:59 +msgid "" +"Repeatedly issue a prompt, accept input, parse an initial prefix off the " +"received input, and dispatch to action methods, passing them the remainder " +"of the line as argument." msgstr "" -msgid "The optional argument is a banner or intro string to be issued before the first prompt (this overrides the :attr:`intro` class attribute)." +#: ../../library/cmd.rst:63 +msgid "" +"The optional argument is a banner or intro string to be issued before the " +"first prompt (this overrides the :attr:`intro` class attribute)." msgstr "" -msgid "If the :mod:`readline` module is loaded, input will automatically inherit :program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` scrolls back to the last command, :kbd:`Control-N` forward to the next one, :kbd:`Control-F` moves the cursor to the right non-destructively, :kbd:`Control-B` moves the cursor to the left non-destructively, etc.)." +#: ../../library/cmd.rst:66 +msgid "" +"If the :mod:`readline` module is loaded, input will automatically " +"inherit :program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` " +"scrolls back to the last command, :kbd:`Control-N` forward to the next " +"one, :kbd:`Control-F` moves the cursor to the right non-" +"destructively, :kbd:`Control-B` moves the cursor to the left non-" +"destructively, etc.)." msgstr "" +#: ../../library/cmd.rst:72 msgid "An end-of-file on input is passed back as the string ``'EOF'``." msgstr "" -msgid "An interpreter instance will recognize a command name ``foo`` if and only if it has a method :meth:`!do_foo`. As a special case, a line beginning with the character ``'?'`` is dispatched to the method :meth:`do_help`. As another special case, a line beginning with the character ``'!'`` is dispatched to the method :meth:`!do_shell` (if such a method is defined)." +#: ../../library/cmd.rst:78 +msgid "" +"An interpreter instance will recognize a command name ``foo`` if and only if " +"it has a method :meth:`!do_foo`. As a special case, a line beginning with " +"the character ``'?'`` is dispatched to the method :meth:`do_help`. As " +"another special case, a line beginning with the character ``'!'`` is " +"dispatched to the method :meth:`!do_shell` (if such a method is defined)." msgstr "" -msgid "This method will return when the :meth:`postcmd` method returns a true value. The *stop* argument to :meth:`postcmd` is the return value from the command's corresponding :meth:`!do_\\*` method." +#: ../../library/cmd.rst:84 +msgid "" +"This method will return when the :meth:`postcmd` method returns a true " +"value. The *stop* argument to :meth:`postcmd` is the return value from the " +"command's corresponding :meth:`!do_\\*` method." msgstr "" -msgid "If completion is enabled, completing commands will be done automatically, and completing of commands args is done by calling :meth:`!complete_foo` with arguments *text*, *line*, *begidx*, and *endidx*. *text* is the string prefix we are attempting to match: all returned matches must begin with it. *line* is the current input line with leading whitespace removed, *begidx* and *endidx* are the beginning and ending indexes of the prefix text, which could be used to provide different completion depending upon which position the argument is in." +#: ../../library/cmd.rst:88 +msgid "" +"If completion is enabled, completing commands will be done automatically, " +"and completing of commands args is done by calling :meth:`!complete_foo` " +"with arguments *text*, *line*, *begidx*, and *endidx*. *text* is the string " +"prefix we are attempting to match: all returned matches must begin with it. " +"*line* is the current input line with leading whitespace removed, *begidx* " +"and *endidx* are the beginning and ending indexes of the prefix text, which " +"could be used to provide different completion depending upon which position " +"the argument is in." msgstr "" -msgid "All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This method, called with an argument ``'bar'``, invokes the corresponding method :meth:`!help_bar`, and if that is not present, prints the docstring of :meth:`!do_bar`, if available. With no argument, :meth:`!do_help` lists all available help topics (that is, all commands with corresponding :meth:`!help_\\*` methods or commands that have docstrings), and also lists any undocumented commands." +#: ../../library/cmd.rst:99 +msgid "" +"All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This " +"method, called with an argument ``'bar'``, invokes the corresponding " +"method :meth:`!help_bar`, and if that is not present, prints the docstring " +"of :meth:`!do_bar`, if available. With no argument, :meth:`!do_help` lists " +"all available help topics (that is, all commands with corresponding :meth:`!" +"help_\\*` methods or commands that have docstrings), and also lists any " +"undocumented commands." msgstr "" -msgid "Interpret the argument as though it had been typed in response to the prompt. This may be overridden, but should not normally need to be; see the :meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop. If there is a :meth:`!do_\\*` method for the command *str*, the return value of that method is returned, otherwise the return value from the :meth:`default` method is returned." +#: ../../library/cmd.rst:110 +msgid "" +"Interpret the argument as though it had been typed in response to the " +"prompt. This may be overridden, but should not normally need to be; see " +"the :meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. " +"The return value is a flag indicating whether interpretation of commands by " +"the interpreter should stop. If there is a :meth:`!do_\\*` method for the " +"command *str*, the return value of that method is returned, otherwise the " +"return value from the :meth:`default` method is returned." msgstr "" -msgid "Method called when an empty line is entered in response to the prompt. If this method is not overridden, it repeats the last nonempty command entered." +#: ../../library/cmd.rst:121 +msgid "" +"Method called when an empty line is entered in response to the prompt. If " +"this method is not overridden, it repeats the last nonempty command entered." msgstr "" -msgid "Method called on an input line when the command prefix is not recognized. If this method is not overridden, it prints an error message and returns." +#: ../../library/cmd.rst:127 +msgid "" +"Method called on an input line when the command prefix is not recognized. If " +"this method is not overridden, it prints an error message and returns." msgstr "" -msgid "Method called to complete an input line when no command-specific :meth:`!complete_\\*` method is available. By default, it returns an empty list." +#: ../../library/cmd.rst:133 +msgid "" +"Method called to complete an input line when no command-specific :meth:`!" +"complete_\\*` method is available. By default, it returns an empty list." msgstr "" -msgid "Method called to display a list of strings as a compact set of columns. Each column is only as wide as necessary. Columns are separated by two spaces for readability." +#: ../../library/cmd.rst:139 +msgid "" +"Method called to display a list of strings as a compact set of columns. Each " +"column is only as wide as necessary. Columns are separated by two spaces for " +"readability." msgstr "" -msgid "Hook method executed just before the command line *line* is interpreted, but after the input prompt is generated and issued. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses. The return value is used as the command which will be executed by the :meth:`onecmd` method; the :meth:`precmd` implementation may re-write the command or simply return *line* unchanged." +#: ../../library/cmd.rst:146 +msgid "" +"Hook method executed just before the command line *line* is interpreted, but " +"after the input prompt is generated and issued. This method is a stub " +"in :class:`Cmd`; it exists to be overridden by subclasses. The return value " +"is used as the command which will be executed by the :meth:`onecmd` method; " +"the :meth:`precmd` implementation may re-write the command or simply return " +"*line* unchanged." msgstr "" -msgid "Hook method executed just after a command dispatch is finished. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* is the command line which was executed, and *stop* is a flag which indicates whether execution will be terminated after the call to :meth:`postcmd`; this will be the return value of the :meth:`onecmd` method. The return value of this method will be used as the new value for the internal flag which corresponds to *stop*; returning false will cause interpretation to continue." +#: ../../library/cmd.rst:156 +msgid "" +"Hook method executed just after a command dispatch is finished. This method " +"is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* " +"is the command line which was executed, and *stop* is a flag which indicates " +"whether execution will be terminated after the call to :meth:`postcmd`; this " +"will be the return value of the :meth:`onecmd` method. The return value of " +"this method will be used as the new value for the internal flag which " +"corresponds to *stop*; returning false will cause interpretation to continue." msgstr "" -msgid "Hook method executed once when :meth:`cmdloop` is called. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." +#: ../../library/cmd.rst:167 +msgid "" +"Hook method executed once when :meth:`cmdloop` is called. This method is a " +"stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -msgid "Hook method executed once when :meth:`cmdloop` is about to return. This method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." +#: ../../library/cmd.rst:173 +msgid "" +"Hook method executed once when :meth:`cmdloop` is about to return. This " +"method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -msgid "Instances of :class:`Cmd` subclasses have some public instance variables:" +#: ../../library/cmd.rst:177 +msgid "" +"Instances of :class:`Cmd` subclasses have some public instance variables:" msgstr "" +#: ../../library/cmd.rst:181 msgid "The prompt issued to solicit input." msgstr "" +#: ../../library/cmd.rst:186 msgid "The string of characters accepted for the command prefix." msgstr "" +#: ../../library/cmd.rst:191 msgid "The last nonempty command prefix seen." msgstr "" -msgid "A list of queued input lines. The cmdqueue list is checked in :meth:`cmdloop` when new input is needed; if it is nonempty, its elements will be processed in order, as if entered at the prompt." +#: ../../library/cmd.rst:196 +msgid "" +"A list of queued input lines. The cmdqueue list is checked " +"in :meth:`cmdloop` when new input is needed; if it is nonempty, its elements " +"will be processed in order, as if entered at the prompt." msgstr "" -msgid "A string to issue as an intro or banner. May be overridden by giving the :meth:`cmdloop` method an argument." +#: ../../library/cmd.rst:203 +msgid "" +"A string to issue as an intro or banner. May be overridden by giving " +"the :meth:`cmdloop` method an argument." msgstr "" -msgid "The header to issue if the help output has a section for documented commands." +#: ../../library/cmd.rst:209 +msgid "" +"The header to issue if the help output has a section for documented commands." msgstr "" -msgid "The header to issue if the help output has a section for miscellaneous help topics (that is, there are :meth:`!help_\\*` methods without corresponding :meth:`!do_\\*` methods)." +#: ../../library/cmd.rst:214 +msgid "" +"The header to issue if the help output has a section for miscellaneous help " +"topics (that is, there are :meth:`!help_\\*` methods without " +"corresponding :meth:`!do_\\*` methods)." msgstr "" -msgid "The header to issue if the help output has a section for undocumented commands (that is, there are :meth:`!do_\\*` methods without corresponding :meth:`!help_\\*` methods)." +#: ../../library/cmd.rst:221 +msgid "" +"The header to issue if the help output has a section for undocumented " +"commands (that is, there are :meth:`!do_\\*` methods without " +"corresponding :meth:`!help_\\*` methods)." msgstr "" -msgid "The character used to draw separator lines under the help-message headers. If empty, no ruler line is drawn. It defaults to ``'='``." +#: ../../library/cmd.rst:228 +msgid "" +"The character used to draw separator lines under the help-message headers. " +"If empty, no ruler line is drawn. It defaults to ``'='``." msgstr "" -msgid "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to display a prompt and read the next command; if false, :data:`sys.stdout.write() ` and :data:`sys.stdin.readline() ` are used. (This means that by importing :mod:`readline`, on systems that support it, the interpreter will automatically support :program:`Emacs`\\ -like line editing and command-history keystrokes.)" +#: ../../library/cmd.rst:234 +msgid "" +"A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " +"display a prompt and read the next command; if " +"false, :data:`sys.stdout.write() ` " +"and :data:`sys.stdin.readline() ` are used. (This means that by " +"importing :mod:`readline`, on systems that support it, the interpreter will " +"automatically support :program:`Emacs`\\ -like line editing and command-" +"history keystrokes.)" msgstr "" +#: ../../library/cmd.rst:244 msgid "Cmd Example" msgstr "" -msgid "The :mod:`!cmd` module is mainly useful for building custom shells that let a user work with a program interactively." +#: ../../library/cmd.rst:248 +msgid "" +"The :mod:`!cmd` module is mainly useful for building custom shells that let " +"a user work with a program interactively." msgstr "" -msgid "This section presents a simple example of how to build a shell around a few of the commands in the :mod:`turtle` module." +#: ../../library/cmd.rst:251 +msgid "" +"This section presents a simple example of how to build a shell around a few " +"of the commands in the :mod:`turtle` module." msgstr "" -msgid "Basic turtle commands such as :meth:`~turtle.forward` are added to a :class:`Cmd` subclass with method named :meth:`!do_forward`. The argument is converted to a number and dispatched to the turtle module. The docstring is used in the help utility provided by the shell." +#: ../../library/cmd.rst:254 +msgid "" +"Basic turtle commands such as :meth:`~turtle.forward` are added to " +"a :class:`Cmd` subclass with method named :meth:`!do_forward`. The argument " +"is converted to a number and dispatched to the turtle module. The docstring " +"is used in the help utility provided by the shell." msgstr "" -msgid "The example also includes a basic record and playback facility implemented with the :meth:`~Cmd.precmd` method which is responsible for converting the input to lowercase and writing the commands to a file. The :meth:`!do_playback` method reads the file and adds the recorded commands to the :attr:`~Cmd.cmdqueue` for immediate playback::" +#: ../../library/cmd.rst:259 +msgid "" +"The example also includes a basic record and playback facility implemented " +"with the :meth:`~Cmd.precmd` method which is responsible for converting the " +"input to lowercase and writing the commands to a file. The :meth:`!" +"do_playback` method reads the file and adds the recorded commands to " +"the :attr:`~Cmd.cmdqueue` for immediate playback::" msgstr "" +#: ../../library/cmd.rst:265 msgid "" "import cmd, sys\n" "from turtle import *\n" "\n" "class TurtleShell(cmd.Cmd):\n" -" intro = 'Welcome to the turtle shell. Type help or ? to list commands.\\n'\n" +" intro = 'Welcome to the turtle shell. Type help or ? to list commands." +"\\n'\n" " prompt = '(turtle) '\n" " file = None\n" "\n" @@ -173,13 +346,15 @@ msgid "" " 'Turn turtle left by given number of degrees: LEFT 90'\n" " left(*parse(arg))\n" " def do_goto(self, arg):\n" -" 'Move turtle to an absolute position with changing orientation. GOTO 100 200'\n" +" 'Move turtle to an absolute position with changing orientation. " +"GOTO 100 200'\n" " goto(*parse(arg))\n" " def do_home(self, arg):\n" " 'Return turtle to the home position: HOME'\n" " home()\n" " def do_circle(self, arg):\n" -" 'Draw circle with given radius an options extent and steps: CIRCLE 50'\n" +" 'Draw circle with given radius an options extent and steps: CIRCLE " +"50'\n" " circle(*parse(arg))\n" " def do_position(self, arg):\n" " 'Print the current turtle position: POSITION'\n" @@ -229,9 +404,14 @@ msgid "" " TurtleShell().cmdloop()" msgstr "" -msgid "Here is a sample session with the turtle shell showing the help functions, using blank lines to repeat commands, and the simple record and playback facility:" +#: ../../library/cmd.rst:340 +msgid "" +"Here is a sample session with the turtle shell showing the help functions, " +"using blank lines to repeat commands, and the simple record and playback " +"facility:" msgstr "" +#: ../../library/cmd.rst:343 msgid "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" @@ -292,11 +472,14 @@ msgid "" "Thank you for using Turtle" msgstr "" +#: ../../library/cmd.rst:74 msgid "? (question mark)" msgstr "" +#: ../../library/cmd.rst:74 msgid "in a command interpreter" msgstr "" +#: ../../library/cmd.rst:74 msgid "! (exclamation)" msgstr "" diff --git a/library/cmdline.po b/library/cmdline.po index d5f18f8b1..242d260a2 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-17 04:35+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2023-10-13 14:16+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,161 +21,214 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/cmdline.rst:5 msgid "Modules command-line interface (CLI)" msgstr "" +#: ../../library/cmdline.rst:7 msgid "The following modules have a command-line interface." msgstr "" +#: ../../library/cmdline.rst:9 msgid ":ref:`ast `" msgstr "" +#: ../../library/cmdline.rst:10 msgid ":ref:`asyncio `" msgstr "" +#: ../../library/cmdline.rst:11 msgid ":mod:`base64`" msgstr "" +#: ../../library/cmdline.rst:12 msgid ":ref:`calendar `" msgstr "" +#: ../../library/cmdline.rst:13 msgid ":mod:`code`" msgstr "" +#: ../../library/cmdline.rst:14 msgid ":ref:`compileall `" msgstr "" +#: ../../library/cmdline.rst:15 msgid ":mod:`cProfile`: see :ref:`profile `" msgstr "" +#: ../../library/cmdline.rst:16 msgid ":ref:`dis `" msgstr "" +#: ../../library/cmdline.rst:17 msgid ":ref:`doctest `" msgstr "" +#: ../../library/cmdline.rst:18 msgid ":mod:`!encodings.rot_13`" msgstr "" +#: ../../library/cmdline.rst:19 msgid ":ref:`ensurepip `" msgstr "" +#: ../../library/cmdline.rst:20 msgid ":mod:`filecmp`" msgstr "" +#: ../../library/cmdline.rst:21 msgid ":mod:`fileinput`" msgstr "" +#: ../../library/cmdline.rst:22 msgid ":mod:`ftplib`" msgstr "" +#: ../../library/cmdline.rst:23 msgid ":ref:`gzip `" msgstr "" +#: ../../library/cmdline.rst:24 msgid ":ref:`http.server `" msgstr "" +#: ../../library/cmdline.rst:25 msgid ":ref:`idlelib `" msgstr "" +#: ../../library/cmdline.rst:26 msgid ":ref:`inspect `" msgstr "" +#: ../../library/cmdline.rst:27 msgid ":ref:`json `" msgstr "" +#: ../../library/cmdline.rst:28 msgid ":ref:`mimetypes `" msgstr "" +#: ../../library/cmdline.rst:29 msgid ":ref:`pdb `" msgstr "" +#: ../../library/cmdline.rst:30 msgid ":ref:`pickle `" msgstr "" +#: ../../library/cmdline.rst:31 msgid ":ref:`pickletools `" msgstr "" +#: ../../library/cmdline.rst:32 msgid ":ref:`platform `" msgstr "" +#: ../../library/cmdline.rst:33 msgid ":mod:`poplib`" msgstr "" +#: ../../library/cmdline.rst:34 msgid ":ref:`profile `" msgstr "" +#: ../../library/cmdline.rst:35 msgid ":mod:`pstats`" msgstr "" +#: ../../library/cmdline.rst:36 msgid ":ref:`py_compile `" msgstr "" +#: ../../library/cmdline.rst:37 msgid ":mod:`pyclbr`" msgstr "" +#: ../../library/cmdline.rst:38 msgid ":mod:`pydoc`" msgstr "" +#: ../../library/cmdline.rst:39 msgid ":mod:`quopri`" msgstr "" +#: ../../library/cmdline.rst:40 msgid ":ref:`random `" msgstr "" +#: ../../library/cmdline.rst:41 msgid ":mod:`runpy`" msgstr "" +#: ../../library/cmdline.rst:42 msgid ":ref:`site `" msgstr "" +#: ../../library/cmdline.rst:43 msgid ":ref:`sqlite3 `" msgstr "" +#: ../../library/cmdline.rst:44 msgid ":ref:`symtable `" msgstr "" +#: ../../library/cmdline.rst:45 msgid ":ref:`sysconfig `" msgstr "" +#: ../../library/cmdline.rst:46 msgid ":mod:`tabnanny`" msgstr "" +#: ../../library/cmdline.rst:47 msgid ":ref:`tarfile `" msgstr "" +#: ../../library/cmdline.rst:48 msgid ":mod:`!this`" msgstr "" +#: ../../library/cmdline.rst:49 msgid ":ref:`timeit `" msgstr "" +#: ../../library/cmdline.rst:50 msgid ":ref:`tokenize `" msgstr "" +#: ../../library/cmdline.rst:51 msgid ":ref:`trace `" msgstr "" +#: ../../library/cmdline.rst:52 msgid ":mod:`turtledemo`" msgstr "" +#: ../../library/cmdline.rst:53 msgid ":ref:`unittest `" msgstr "" +#: ../../library/cmdline.rst:54 msgid ":ref:`uuid `" msgstr "" +#: ../../library/cmdline.rst:55 msgid ":ref:`venv `" msgstr "" +#: ../../library/cmdline.rst:56 msgid ":ref:`webbrowser `" msgstr "" +#: ../../library/cmdline.rst:57 msgid ":ref:`zipapp `" msgstr "" +#: ../../library/cmdline.rst:58 msgid ":ref:`zipfile `" msgstr "" +#: ../../library/cmdline.rst:60 msgid "See also the :ref:`Python command-line interface `." msgstr "" diff --git a/library/cmdlinelibs.po b/library/cmdlinelibs.po index 1b44d09ce..449e1d31c 100644 --- a/library/cmdlinelibs.po +++ b/library/cmdlinelibs.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-12-27 14:18+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/cmdlinelibs.rst:5 msgid "Command-line interface libraries" msgstr "" -msgid "The modules described in this chapter assist with implementing command line and terminal interfaces for applications." +#: ../../library/cmdlinelibs.rst:7 +msgid "" +"The modules described in this chapter assist with implementing command line " +"and terminal interfaces for applications." msgstr "" +#: ../../library/cmdlinelibs.rst:10 msgid "Here's an overview:" msgstr "" diff --git a/library/code.po b/library/code.po index 9c0dcc0dd..64bc01659 100644 --- a/library/code.po +++ b/library/code.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,101 +21,235 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/code.rst:2 msgid ":mod:`!code` --- Interpreter base classes" msgstr "" +#: ../../library/code.rst:7 msgid "**Source code:** :source:`Lib/code.py`" msgstr "" -msgid "The ``code`` module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt." +#: ../../library/code.rst:11 +msgid "" +"The ``code`` module provides facilities to implement read-eval-print loops " +"in Python. Two classes and convenience functions are included which can be " +"used to build applications which provide an interactive interpreter prompt." msgstr "" -msgid "This class deals with parsing and interpreter state (the user's namespace); it does not deal with input buffering or prompting or input file naming (the filename is always passed in explicitly). The optional *locals* argument specifies a mapping to use as the namespace in which code will be executed; it defaults to a newly created dictionary with key ``'__name__'`` set to ``'__console__'`` and key ``'__doc__'`` set to ``None``." +#: ../../library/code.rst:18 +msgid "" +"This class deals with parsing and interpreter state (the user's namespace); " +"it does not deal with input buffering or prompting or input file naming (the " +"filename is always passed in explicitly). The optional *locals* argument " +"specifies a mapping to use as the namespace in which code will be executed; " +"it defaults to a newly created dictionary with key ``'__name__'`` set to " +"``'__console__'`` and key ``'__doc__'`` set to ``None``." msgstr "" -msgid "Note that functions and classes objects created under an :class:`!InteractiveInterpreter` instance will belong to the namespace specified by *locals*. They are only pickleable if *locals* is the namespace of an existing module." +#: ../../library/code.rst:25 +msgid "" +"Note that functions and classes objects created under an :class:`!" +"InteractiveInterpreter` instance will belong to the namespace specified by " +"*locals*. They are only pickleable if *locals* is the namespace of an " +"existing module." msgstr "" -msgid "Closely emulate the behavior of the interactive Python interpreter. This class builds on :class:`InteractiveInterpreter` and adds prompting using the familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* is true, ``exit()`` and ``quit()`` in the console will not raise :exc:`SystemExit`, but instead return to the calling code." +#: ../../library/code.rst:34 +msgid "" +"Closely emulate the behavior of the interactive Python interpreter. This " +"class builds on :class:`InteractiveInterpreter` and adds prompting using the " +"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " +"is true, ``exit()`` and ``quit()`` in the console will not " +"raise :exc:`SystemExit`, but instead return to the calling code." msgstr "" +#: ../../library/code.rst:40 ../../library/code.rst:58 msgid "Added *local_exit* parameter." msgstr "" -msgid "Convenience function to run a read-eval-print loop. This creates a new instance of :class:`InteractiveConsole` and sets *readfunc* to be used as the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is provided, it is passed to the :class:`InteractiveConsole` constructor for use as the default namespace for the interpreter loop. If *local_exit* is provided, it is passed to the :class:`InteractiveConsole` constructor. The :meth:`~InteractiveConsole.interact` method of the instance is then run with *banner* and *exitmsg* passed as the banner and exit message to use, if provided. The console object is discarded after use." -msgstr "" - +#: ../../library/code.rst:45 +msgid "" +"Convenience function to run a read-eval-print loop. This creates a new " +"instance of :class:`InteractiveConsole` and sets *readfunc* to be used as " +"the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " +"provided, it is passed to the :class:`InteractiveConsole` constructor for " +"use as the default namespace for the interpreter loop. If *local_exit* is " +"provided, it is passed to the :class:`InteractiveConsole` constructor. " +"The :meth:`~InteractiveConsole.interact` method of the instance is then run " +"with *banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided. The console object is discarded after use." +msgstr "" + +#: ../../library/code.rst:55 msgid "Added *exitmsg* parameter." msgstr "" -msgid "This function is useful for programs that want to emulate Python's interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is to determine when the user has entered an incomplete command that can be completed by entering more text (as opposed to a complete command or a syntax error). This function *almost* always makes the same decision as the real interpreter main loop." +#: ../../library/code.rst:63 +msgid "" +"This function is useful for programs that want to emulate Python's " +"interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is " +"to determine when the user has entered an incomplete command that can be " +"completed by entering more text (as opposed to a complete command or a " +"syntax error). This function *almost* always makes the same decision as the " +"real interpreter main loop." msgstr "" -msgid "*source* is the source string; *filename* is the optional filename from which source was read, defaulting to ``''``; and *symbol* is the optional grammar start symbol, which should be ``'single'`` (the default), ``'eval'`` or ``'exec'``." +#: ../../library/code.rst:70 +msgid "" +"*source* is the source string; *filename* is the optional filename from " +"which source was read, defaulting to ``''``; and *symbol* is the " +"optional grammar start symbol, which should be ``'single'`` (the default), " +"``'eval'`` or ``'exec'``." msgstr "" -msgid "Returns a code object (the same as ``compile(source, filename, symbol)``) if the command is complete and valid; ``None`` if the command is incomplete; raises :exc:`SyntaxError` if the command is complete and contains a syntax error, or raises :exc:`OverflowError` or :exc:`ValueError` if the command contains an invalid literal." +#: ../../library/code.rst:75 +msgid "" +"Returns a code object (the same as ``compile(source, filename, symbol)``) if " +"the command is complete and valid; ``None`` if the command is incomplete; " +"raises :exc:`SyntaxError` if the command is complete and contains a syntax " +"error, or raises :exc:`OverflowError` or :exc:`ValueError` if the command " +"contains an invalid literal." msgstr "" +#: ../../library/code.rst:85 msgid "Interactive Interpreter Objects" msgstr "" -msgid "Compile and run some source in the interpreter. Arguments are the same as for :func:`compile_command`; the default for *filename* is ``''``, and for *symbol* is ``'single'``. One of several things can happen:" +#: ../../library/code.rst:90 +msgid "" +"Compile and run some source in the interpreter. Arguments are the same as " +"for :func:`compile_command`; the default for *filename* is ``''``, " +"and for *symbol* is ``'single'``. One of several things can happen:" msgstr "" -msgid "The input is incorrect; :func:`compile_command` raised an exception (:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns ``False``." +#: ../../library/code.rst:94 +msgid "" +"The input is incorrect; :func:`compile_command` raised an exception " +"(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be " +"printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` " +"returns ``False``." msgstr "" -msgid "The input is incomplete, and more input is required; :func:`compile_command` returned ``None``. :meth:`runsource` returns ``True``." +#: ../../library/code.rst:99 +msgid "" +"The input is incomplete, and more input is required; :func:`compile_command` " +"returned ``None``. :meth:`runsource` returns ``True``." msgstr "" -msgid "The input is complete; :func:`compile_command` returned a code object. The code is executed by calling the :meth:`runcode` (which also handles run-time exceptions, except for :exc:`SystemExit`). :meth:`runsource` returns ``False``." +#: ../../library/code.rst:102 +msgid "" +"The input is complete; :func:`compile_command` returned a code object. The " +"code is executed by calling the :meth:`runcode` (which also handles run-time " +"exceptions, except for :exc:`SystemExit`). :meth:`runsource` returns " +"``False``." msgstr "" -msgid "The return value can be used to decide whether to use ``sys.ps1`` or ``sys.ps2`` to prompt the next line." +#: ../../library/code.rst:106 +msgid "" +"The return value can be used to decide whether to use ``sys.ps1`` or " +"``sys.ps2`` to prompt the next line." msgstr "" -msgid "Execute a code object. When an exception occurs, :meth:`showtraceback` is called to display a traceback. All exceptions are caught except :exc:`SystemExit`, which is allowed to propagate." +#: ../../library/code.rst:112 +msgid "" +"Execute a code object. When an exception occurs, :meth:`showtraceback` is " +"called to display a traceback. All exceptions are caught " +"except :exc:`SystemExit`, which is allowed to propagate." msgstr "" -msgid "A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in this code, and may not always be caught. The caller should be prepared to deal with it." +#: ../../library/code.rst:116 +msgid "" +"A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in " +"this code, and may not always be caught. The caller should be prepared to " +"deal with it." msgstr "" -msgid "Display the syntax error that just occurred. This does not display a stack trace because there isn't one for syntax errors. If *filename* is given, it is stuffed into the exception instead of the default filename provided by Python's parser, because it always uses ``''`` when reading from a string. The output is written by the :meth:`write` method." +#: ../../library/code.rst:123 +msgid "" +"Display the syntax error that just occurred. This does not display a stack " +"trace because there isn't one for syntax errors. If *filename* is given, it " +"is stuffed into the exception instead of the default filename provided by " +"Python's parser, because it always uses ``''`` when reading from a " +"string. The output is written by the :meth:`write` method." msgstr "" -msgid "Display the exception that just occurred. We remove the first stack item because it is within the interpreter object implementation. The output is written by the :meth:`write` method." +#: ../../library/code.rst:132 +msgid "" +"Display the exception that just occurred. We remove the first stack item " +"because it is within the interpreter object implementation. The output is " +"written by the :meth:`write` method." msgstr "" -msgid "The full chained traceback is displayed instead of just the primary traceback." +#: ../../library/code.rst:136 +msgid "" +"The full chained traceback is displayed instead of just the primary " +"traceback." msgstr "" -msgid "Write a string to the standard error stream (``sys.stderr``). Derived classes should override this to provide the appropriate output handling as needed." +#: ../../library/code.rst:142 +msgid "" +"Write a string to the standard error stream (``sys.stderr``). Derived " +"classes should override this to provide the appropriate output handling as " +"needed." msgstr "" +#: ../../library/code.rst:149 msgid "Interactive Console Objects" msgstr "" -msgid "The :class:`InteractiveConsole` class is a subclass of :class:`InteractiveInterpreter`, and so offers all the methods of the interpreter objects as well as the following additions." +#: ../../library/code.rst:151 +msgid "" +"The :class:`InteractiveConsole` class is a subclass " +"of :class:`InteractiveInterpreter`, and so offers all the methods of the " +"interpreter objects as well as the following additions." msgstr "" -msgid "Closely emulate the interactive Python console. The optional *banner* argument specify the banner to print before the first interaction; by default it prints a banner similar to the one printed by the standard Python interpreter, followed by the class name of the console object in parentheses (so as not to confuse this with the real interpreter -- since it's so close!)." +#: ../../library/code.rst:158 +msgid "" +"Closely emulate the interactive Python console. The optional *banner* " +"argument specify the banner to print before the first interaction; by " +"default it prints a banner similar to the one printed by the standard Python " +"interpreter, followed by the class name of the console object in parentheses " +"(so as not to confuse this with the real interpreter -- since it's so " +"close!)." msgstr "" -msgid "The optional *exitmsg* argument specifies an exit message printed when exiting. Pass the empty string to suppress the exit message. If *exitmsg* is not given or ``None``, a default message is printed." +#: ../../library/code.rst:164 +msgid "" +"The optional *exitmsg* argument specifies an exit message printed when " +"exiting. Pass the empty string to suppress the exit message. If *exitmsg* is " +"not given or ``None``, a default message is printed." msgstr "" +#: ../../library/code.rst:168 msgid "To suppress printing any banner, pass an empty string." msgstr "" +#: ../../library/code.rst:171 msgid "Print an exit message when exiting." msgstr "" -msgid "Push a line of source text to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's :meth:`~InteractiveInterpreter.runsource` method is called with the concatenated contents of the buffer as source. If this indicates that the command was executed or invalid, the buffer is reset; otherwise, the command is incomplete, and the buffer is left as it was after the line was appended. The return value is ``True`` if more input is required, ``False`` if the line was dealt with in some way (this is the same as :meth:`!runsource`)." -msgstr "" - +#: ../../library/code.rst:177 +msgid "" +"Push a line of source text to the interpreter. The line should not have a " +"trailing newline; it may have internal newlines. The line is appended to a " +"buffer and the interpreter's :meth:`~InteractiveInterpreter.runsource` " +"method is called with the concatenated contents of the buffer as source. If " +"this indicates that the command was executed or invalid, the buffer is " +"reset; otherwise, the command is incomplete, and the buffer is left as it " +"was after the line was appended. The return value is ``True`` if more input " +"is required, ``False`` if the line was dealt with in some way (this is the " +"same as :meth:`!runsource`)." +msgstr "" + +#: ../../library/code.rst:189 msgid "Remove any unhandled source text from the input buffer." msgstr "" -msgid "Write a prompt and read a line. The returned line does not include the trailing newline. When the user enters the EOF key sequence, :exc:`EOFError` is raised. The base implementation reads from ``sys.stdin``; a subclass may replace this with a different implementation." +#: ../../library/code.rst:194 +msgid "" +"Write a prompt and read a line. The returned line does not include the " +"trailing newline. When the user enters the EOF key " +"sequence, :exc:`EOFError` is raised. The base implementation reads from " +"``sys.stdin``; a subclass may replace this with a different implementation." msgstr "" diff --git a/library/codecs.po b/library/codecs.po index 1853f6078..8751a1a67 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,1696 +23,2929 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/codecs.rst:2 msgid ":mod:`!codecs` --- Codec registry and base classes" msgstr "" +#: ../../library/codecs.rst:11 msgid "**Source code:** :source:`Lib/codecs.py`" msgstr "" -msgid "This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec registry, which manages the codec and error handling lookup process. Most standard codecs are :term:`text encodings `, which encode text to bytes (and decode bytes to text), but there are also codecs provided that encode text to text, and bytes to bytes. Custom codecs may encode and decode between arbitrary types, but some module features are restricted to be used specifically with :term:`text encodings ` or with codecs that encode to :class:`bytes`." -msgstr "" - -msgid "The module defines the following functions for encoding and decoding with any codec:" +#: ../../library/codecs.rst:23 +msgid "" +"This module defines base classes for standard Python codecs (encoders and " +"decoders) and provides access to the internal Python codec registry, which " +"manages the codec and error handling lookup process. Most standard codecs " +"are :term:`text encodings `, which encode text to bytes (and " +"decode bytes to text), but there are also codecs provided that encode text " +"to text, and bytes to bytes. Custom codecs may encode and decode between " +"arbitrary types, but some module features are restricted to be used " +"specifically with :term:`text encodings ` or with codecs that " +"encode to :class:`bytes`." +msgstr "" + +#: ../../library/codecs.rst:33 +msgid "" +"The module defines the following functions for encoding and decoding with " +"any codec:" msgstr "" +#: ../../library/codecs.rst:38 msgid "Encodes *obj* using the codec registered for *encoding*." msgstr "" -msgid "*Errors* may be given to set the desired error handling scheme. The default error handler is ``'strict'`` meaning that encoding errors raise :exc:`ValueError` (or a more codec specific subclass, such as :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more information on codec error handling." +#: ../../library/codecs.rst:40 +msgid "" +"*Errors* may be given to set the desired error handling scheme. The default " +"error handler is ``'strict'`` meaning that encoding errors " +"raise :exc:`ValueError` (or a more codec specific subclass, such " +"as :exc:`UnicodeEncodeError`). Refer to :ref:`codec-base-classes` for more " +"information on codec error handling." msgstr "" +#: ../../library/codecs.rst:48 msgid "Decodes *obj* using the codec registered for *encoding*." msgstr "" -msgid "*Errors* may be given to set the desired error handling scheme. The default error handler is ``'strict'`` meaning that decoding errors raise :exc:`ValueError` (or a more codec specific subclass, such as :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more information on codec error handling." +#: ../../library/codecs.rst:50 +msgid "" +"*Errors* may be given to set the desired error handling scheme. The default " +"error handler is ``'strict'`` meaning that decoding errors " +"raise :exc:`ValueError` (or a more codec specific subclass, such " +"as :exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more " +"information on codec error handling." msgstr "" -msgid "Return a mapping suitable for encoding with a custom single-byte encoding. Given a :class:`str` *string* of up to 256 characters representing a decoding table, returns either a compact internal mapping object ``EncodingMap`` or a :class:`dictionary ` mapping character ordinals to byte values. Raises a :exc:`TypeError` on invalid input." +#: ../../library/codecs.rst:58 +msgid "" +"Return a mapping suitable for encoding with a custom single-byte encoding. " +"Given a :class:`str` *string* of up to 256 characters representing a " +"decoding table, returns either a compact internal mapping object " +"``EncodingMap`` or a :class:`dictionary ` mapping character ordinals " +"to byte values. Raises a :exc:`TypeError` on invalid input." msgstr "" +#: ../../library/codecs.rst:64 msgid "The full details for each codec can also be looked up directly:" msgstr "" -msgid "Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below." +#: ../../library/codecs.rst:68 +msgid "" +"Looks up the codec info in the Python codec registry and returns " +"a :class:`CodecInfo` object as defined below." msgstr "" -msgid "Encodings are first looked up in the registry's cache. If not found, the list of registered search functions is scanned. If no :class:`CodecInfo` object is found, a :exc:`LookupError` is raised. Otherwise, the :class:`CodecInfo` object is stored in the cache and returned to the caller." +#: ../../library/codecs.rst:71 +msgid "" +"Encodings are first looked up in the registry's cache. If not found, the " +"list of registered search functions is scanned. If no :class:`CodecInfo` " +"object is found, a :exc:`LookupError` is raised. Otherwise, " +"the :class:`CodecInfo` object is stored in the cache and returned to the " +"caller." msgstr "" -msgid "Codec details when looking up the codec registry. The constructor arguments are stored in attributes of the same name:" +#: ../../library/codecs.rst:78 +msgid "" +"Codec details when looking up the codec registry. The constructor arguments " +"are stored in attributes of the same name:" msgstr "" +#: ../../library/codecs.rst:84 msgid "The name of the encoding." msgstr "" -msgid "The stateless encoding and decoding functions. These must be functions or methods which have the same interface as the :meth:`~Codec.encode` and :meth:`~Codec.decode` methods of Codec instances (see :ref:`Codec Interface `). The functions or methods are expected to work in a stateless mode." +#: ../../library/codecs.rst:90 +msgid "" +"The stateless encoding and decoding functions. These must be functions or " +"methods which have the same interface as the :meth:`~Codec.encode` " +"and :meth:`~Codec.decode` methods of Codec instances (see :ref:`Codec " +"Interface `). The functions or methods are expected to work " +"in a stateless mode." msgstr "" -msgid "Incremental encoder and decoder classes or factory functions. These have to provide the interface defined by the base classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`, respectively. Incremental codecs can maintain state." +#: ../../library/codecs.rst:100 +msgid "" +"Incremental encoder and decoder classes or factory functions. These have to " +"provide the interface defined by the base " +"classes :class:`IncrementalEncoder` and :class:`IncrementalDecoder`, " +"respectively. Incremental codecs can maintain state." msgstr "" -msgid "Stream writer and reader classes or factory functions. These have to provide the interface defined by the base classes :class:`StreamWriter` and :class:`StreamReader`, respectively. Stream codecs can maintain state." +#: ../../library/codecs.rst:109 +msgid "" +"Stream writer and reader classes or factory functions. These have to provide " +"the interface defined by the base classes :class:`StreamWriter` " +"and :class:`StreamReader`, respectively. Stream codecs can maintain state." msgstr "" -msgid "To simplify access to the various codec components, the module provides these additional functions which use :func:`lookup` for the codec lookup:" +#: ../../library/codecs.rst:114 +msgid "" +"To simplify access to the various codec components, the module provides " +"these additional functions which use :func:`lookup` for the codec lookup:" msgstr "" -msgid "Look up the codec for the given encoding and return its encoder function." +#: ../../library/codecs.rst:119 +msgid "" +"Look up the codec for the given encoding and return its encoder function." msgstr "" +#: ../../library/codecs.rst:121 ../../library/codecs.rst:128 +#: ../../library/codecs.rst:154 ../../library/codecs.rst:162 msgid "Raises a :exc:`LookupError` in case the encoding cannot be found." msgstr "" -msgid "Look up the codec for the given encoding and return its decoder function." +#: ../../library/codecs.rst:126 +msgid "" +"Look up the codec for the given encoding and return its decoder function." msgstr "" -msgid "Look up the codec for the given encoding and return its incremental encoder class or factory function." +#: ../../library/codecs.rst:133 +msgid "" +"Look up the codec for the given encoding and return its incremental encoder " +"class or factory function." msgstr "" -msgid "Raises a :exc:`LookupError` in case the encoding cannot be found or the codec doesn't support an incremental encoder." +#: ../../library/codecs.rst:136 +msgid "" +"Raises a :exc:`LookupError` in case the encoding cannot be found or the " +"codec doesn't support an incremental encoder." msgstr "" -msgid "Look up the codec for the given encoding and return its incremental decoder class or factory function." +#: ../../library/codecs.rst:142 +msgid "" +"Look up the codec for the given encoding and return its incremental decoder " +"class or factory function." msgstr "" -msgid "Raises a :exc:`LookupError` in case the encoding cannot be found or the codec doesn't support an incremental decoder." +#: ../../library/codecs.rst:145 +msgid "" +"Raises a :exc:`LookupError` in case the encoding cannot be found or the " +"codec doesn't support an incremental decoder." msgstr "" -msgid "Look up the codec for the given encoding and return its :class:`StreamReader` class or factory function." +#: ../../library/codecs.rst:151 +msgid "" +"Look up the codec for the given encoding and return " +"its :class:`StreamReader` class or factory function." msgstr "" -msgid "Look up the codec for the given encoding and return its :class:`StreamWriter` class or factory function." +#: ../../library/codecs.rst:159 +msgid "" +"Look up the codec for the given encoding and return " +"its :class:`StreamWriter` class or factory function." msgstr "" -msgid "Custom codecs are made available by registering a suitable codec search function:" +#: ../../library/codecs.rst:164 +msgid "" +"Custom codecs are made available by registering a suitable codec search " +"function:" msgstr "" -msgid "Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens and spaces converted to underscores, and return a :class:`CodecInfo` object. In case a search function cannot find a given encoding, it should return ``None``." +#: ../../library/codecs.rst:169 +msgid "" +"Register a codec search function. Search functions are expected to take one " +"argument, being the encoding name in all lower case letters with hyphens and " +"spaces converted to underscores, and return a :class:`CodecInfo` object. In " +"case a search function cannot find a given encoding, it should return " +"``None``." msgstr "" +#: ../../library/codecs.rst:175 msgid "Hyphens and spaces are converted to underscore." msgstr "" -msgid "Unregister a codec search function and clear the registry's cache. If the search function is not registered, do nothing." +#: ../../library/codecs.rst:181 +msgid "" +"Unregister a codec search function and clear the registry's cache. If the " +"search function is not registered, do nothing." msgstr "" -msgid "While the builtin :func:`open` and the associated :mod:`io` module are the recommended approach for working with encoded text files, this module provides additional utility functions and classes that allow the use of a wider range of codecs when working with binary files:" +#: ../../library/codecs.rst:187 +msgid "" +"While the builtin :func:`open` and the associated :mod:`io` module are the " +"recommended approach for working with encoded text files, this module " +"provides additional utility functions and classes that allow the use of a " +"wider range of codecs when working with binary files:" msgstr "" -msgid "Open an encoded file using the given *mode* and return an instance of :class:`StreamReaderWriter`, providing transparent encoding/decoding. The default file mode is ``'r'``, meaning to open the file in read mode." +#: ../../library/codecs.rst:194 +msgid "" +"Open an encoded file using the given *mode* and return an instance " +"of :class:`StreamReaderWriter`, providing transparent encoding/decoding. The " +"default file mode is ``'r'``, meaning to open the file in read mode." msgstr "" -msgid "If *encoding* is not ``None``, then the underlying encoded files are always opened in binary mode. No automatic conversion of ``'\\n'`` is done on reading and writing. The *mode* argument may be any binary mode acceptable to the built-in :func:`open` function; the ``'b'`` is automatically added." +#: ../../library/codecs.rst:200 +msgid "" +"If *encoding* is not ``None``, then the underlying encoded files are always " +"opened in binary mode. No automatic conversion of ``'\\n'`` is done on " +"reading and writing. The *mode* argument may be any binary mode acceptable " +"to the built-in :func:`open` function; the ``'b'`` is automatically added." msgstr "" -msgid "*encoding* specifies the encoding which is to be used for the file. Any encoding that encodes to and decodes from bytes is allowed, and the data types supported by the file methods depend on the codec used." +#: ../../library/codecs.rst:206 +msgid "" +"*encoding* specifies the encoding which is to be used for the file. Any " +"encoding that encodes to and decodes from bytes is allowed, and the data " +"types supported by the file methods depend on the codec used." msgstr "" -msgid "*errors* may be given to define the error handling. It defaults to ``'strict'`` which causes a :exc:`ValueError` to be raised in case an encoding error occurs." +#: ../../library/codecs.rst:210 +msgid "" +"*errors* may be given to define the error handling. It defaults to " +"``'strict'`` which causes a :exc:`ValueError` to be raised in case an " +"encoding error occurs." msgstr "" -msgid "*buffering* has the same meaning as for the built-in :func:`open` function. It defaults to -1 which means that the default buffer size will be used." +#: ../../library/codecs.rst:213 +msgid "" +"*buffering* has the same meaning as for the built-in :func:`open` function. " +"It defaults to -1 which means that the default buffer size will be used." msgstr "" +#: ../../library/codecs.rst:216 msgid "The ``'U'`` mode has been removed." msgstr "" +#: ../../library/codecs.rst:221 msgid ":func:`codecs.open` has been superseded by :func:`open`." msgstr "" -msgid "Return a :class:`StreamRecoder` instance, a wrapped version of *file* which provides transparent transcoding. The original file is closed when the wrapped version is closed." +#: ../../library/codecs.rst:226 +msgid "" +"Return a :class:`StreamRecoder` instance, a wrapped version of *file* which " +"provides transparent transcoding. The original file is closed when the " +"wrapped version is closed." msgstr "" -msgid "Data written to the wrapped file is decoded according to the given *data_encoding* and then written to the original file as bytes using *file_encoding*. Bytes read from the original file are decoded according to *file_encoding*, and the result is encoded using *data_encoding*." +#: ../../library/codecs.rst:230 +msgid "" +"Data written to the wrapped file is decoded according to the given " +"*data_encoding* and then written to the original file as bytes using " +"*file_encoding*. Bytes read from the original file are decoded according to " +"*file_encoding*, and the result is encoded using *data_encoding*." msgstr "" +#: ../../library/codecs.rst:236 msgid "If *file_encoding* is not given, it defaults to *data_encoding*." msgstr "" -msgid "*errors* may be given to define the error handling. It defaults to ``'strict'``, which causes :exc:`ValueError` to be raised in case an encoding error occurs." +#: ../../library/codecs.rst:238 +msgid "" +"*errors* may be given to define the error handling. It defaults to " +"``'strict'``, which causes :exc:`ValueError` to be raised in case an " +"encoding error occurs." msgstr "" -msgid "Uses an incremental encoder to iteratively encode the input provided by *iterator*. *iterator* must yield :class:`str` objects. This function is a :term:`generator`. The *errors* argument (as well as any other keyword argument) is passed through to the incremental encoder." +#: ../../library/codecs.rst:245 +msgid "" +"Uses an incremental encoder to iteratively encode the input provided by " +"*iterator*. *iterator* must yield :class:`str` objects. This function is " +"a :term:`generator`. The *errors* argument (as well as any other keyword " +"argument) is passed through to the incremental encoder." msgstr "" -msgid "This function requires that the codec accept text :class:`str` objects to encode. Therefore it does not support bytes-to-bytes encoders such as ``base64_codec``." +#: ../../library/codecs.rst:250 +msgid "" +"This function requires that the codec accept text :class:`str` objects to " +"encode. Therefore it does not support bytes-to-bytes encoders such as " +"``base64_codec``." msgstr "" -msgid "Uses an incremental decoder to iteratively decode the input provided by *iterator*. *iterator* must yield :class:`bytes` objects. This function is a :term:`generator`. The *errors* argument (as well as any other keyword argument) is passed through to the incremental decoder." +#: ../../library/codecs.rst:257 +msgid "" +"Uses an incremental decoder to iteratively decode the input provided by " +"*iterator*. *iterator* must yield :class:`bytes` objects. This function is " +"a :term:`generator`. The *errors* argument (as well as any other keyword " +"argument) is passed through to the incremental decoder." msgstr "" -msgid "This function requires that the codec accept :class:`bytes` objects to decode. Therefore it does not support text-to-text encoders such as ``rot_13``, although ``rot_13`` may be used equivalently with :func:`iterencode`." +#: ../../library/codecs.rst:262 +msgid "" +"This function requires that the codec accept :class:`bytes` objects to " +"decode. Therefore it does not support text-to-text encoders such as " +"``rot_13``, although ``rot_13`` may be used equivalently " +"with :func:`iterencode`." msgstr "" -msgid "Return a :class:`tuple` containing the raw bytes of *buffer*, a :ref:`buffer-compatible object ` or :class:`str` (encoded to UTF-8 before processing), and their length in bytes." +#: ../../library/codecs.rst:270 +msgid "" +"Return a :class:`tuple` containing the raw bytes of *buffer*, a :ref:`buffer-" +"compatible object ` or :class:`str` (encoded to UTF-8 before " +"processing), and their length in bytes." msgstr "" +#: ../../library/codecs.rst:274 msgid "The *errors* argument is ignored." msgstr "" +#: ../../library/codecs.rst:276 msgid "" ">>> codecs.readbuffer_encode(b\"Zito\")\n" "(b'Zito', 4)" msgstr "" -msgid "The module also provides the following constants which are useful for reading and writing to platform dependent files:" +#: ../../library/codecs.rst:282 +msgid "" +"The module also provides the following constants which are useful for " +"reading and writing to platform dependent files:" msgstr "" -msgid "These constants define various byte sequences, being Unicode byte order marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data streams to indicate the byte order used, and in UTF-8 as a Unicode signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` or :const:`BOM_UTF16_LE` depending on the platform's native byte order, :const:`BOM` is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` for :const:`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The others represent the BOM in UTF-8 and UTF-32 encodings." +#: ../../library/codecs.rst:297 +msgid "" +"These constants define various byte sequences, being Unicode byte order " +"marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " +"streams to indicate the byte order used, and in UTF-8 as a Unicode " +"signature. :const:`BOM_UTF16` is either :const:`BOM_UTF16_BE` " +"or :const:`BOM_UTF16_LE` depending on the platform's native byte " +"order, :const:`BOM` is an alias for :const:`BOM_UTF16`, :const:`BOM_LE` " +"for :const:`BOM_UTF16_LE` and :const:`BOM_BE` for :const:`BOM_UTF16_BE`. The " +"others represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" +#: ../../library/codecs.rst:311 msgid "Codec Base Classes" msgstr "" -msgid "The :mod:`!codecs` module defines a set of base classes which define the interfaces for working with codec objects, and can also be used as the basis for custom codec implementations." +#: ../../library/codecs.rst:313 +msgid "" +"The :mod:`!codecs` module defines a set of base classes which define the " +"interfaces for working with codec objects, and can also be used as the basis " +"for custom codec implementations." msgstr "" -msgid "Each codec has to define four interfaces to make it usable as codec in Python: stateless encoder, stateless decoder, stream reader and stream writer. The stream reader and writers typically reuse the stateless encoder/decoder to implement the file protocols. Codec authors also need to define how the codec will handle encoding and decoding errors." +#: ../../library/codecs.rst:317 +msgid "" +"Each codec has to define four interfaces to make it usable as codec in " +"Python: stateless encoder, stateless decoder, stream reader and stream " +"writer. The stream reader and writers typically reuse the stateless encoder/" +"decoder to implement the file protocols. Codec authors also need to define " +"how the codec will handle encoding and decoding errors." msgstr "" +#: ../../library/codecs.rst:328 msgid "Error Handlers" msgstr "" -msgid "To simplify and standardize error handling, codecs may implement different error handling schemes by accepting the *errors* string argument:" +#: ../../library/codecs.rst:330 +msgid "" +"To simplify and standardize error handling, codecs may implement different " +"error handling schemes by accepting the *errors* string argument:" msgstr "" -msgid "The following error handlers can be used with all Python :ref:`standard-encodings` codecs:" +#: ../../library/codecs.rst:350 +msgid "" +"The following error handlers can be used with all Python :ref:`standard-" +"encodings` codecs:" msgstr "" +#: ../../library/codecs.rst:356 ../../library/codecs.rst:399 +#: ../../library/codecs.rst:419 msgid "Value" msgstr "" +#: ../../library/codecs.rst:356 ../../library/codecs.rst:399 +#: ../../library/codecs.rst:419 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1456 ../../library/codecs.rst:1541 msgid "Meaning" msgstr "" +#: ../../library/codecs.rst:358 msgid "``'strict'``" msgstr "" -msgid "Raise :exc:`UnicodeError` (or a subclass), this is the default. Implemented in :func:`strict_errors`." +#: ../../library/codecs.rst:358 +msgid "" +"Raise :exc:`UnicodeError` (or a subclass), this is the default. Implemented " +"in :func:`strict_errors`." msgstr "" +#: ../../library/codecs.rst:362 msgid "``'ignore'``" msgstr "" -msgid "Ignore the malformed data and continue without further notice. Implemented in :func:`ignore_errors`." +#: ../../library/codecs.rst:362 +msgid "" +"Ignore the malformed data and continue without further notice. Implemented " +"in :func:`ignore_errors`." msgstr "" +#: ../../library/codecs.rst:366 msgid "``'replace'``" msgstr "" -msgid "Replace with a replacement marker. On encoding, use ``?`` (ASCII character). On decoding, use ``�`` (U+FFFD, the official REPLACEMENT CHARACTER). Implemented in :func:`replace_errors`." +#: ../../library/codecs.rst:366 +msgid "" +"Replace with a replacement marker. On encoding, use ``?`` (ASCII character). " +"On decoding, use ``�`` (U+FFFD, the official REPLACEMENT CHARACTER). " +"Implemented in :func:`replace_errors`." msgstr "" +#: ../../library/codecs.rst:372 msgid "``'backslashreplace'``" msgstr "" -msgid "Replace with backslashed escape sequences. On encoding, use hexadecimal form of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value with format :samp:`\\\\x{hh}`. Implemented in :func:`backslashreplace_errors`." +#: ../../library/codecs.rst:372 +msgid "" +"Replace with backslashed escape sequences. On encoding, use hexadecimal form " +"of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}" +"` :samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value " +"with format :samp:`\\\\x{hh}`. Implemented " +"in :func:`backslashreplace_errors`." msgstr "" +#: ../../library/codecs.rst:381 msgid "``'surrogateescape'``" msgstr "" -msgid "On decoding, replace byte with individual surrogate code ranging from ``U+DC80`` to ``U+DCFF``. This code will then be turned back into the same byte when the ``'surrogateescape'`` error handler is used when encoding the data. (See :pep:`383` for more.)" +#: ../../library/codecs.rst:381 +msgid "" +"On decoding, replace byte with individual surrogate code ranging from " +"``U+DC80`` to ``U+DCFF``. This code will then be turned back into the same " +"byte when the ``'surrogateescape'`` error handler is used when encoding the " +"data. (See :pep:`383` for more.)" msgstr "" -msgid "The following error handlers are only applicable to encoding (within :term:`text encodings `):" +#: ../../library/codecs.rst:395 +msgid "" +"The following error handlers are only applicable to encoding " +"(within :term:`text encodings `):" msgstr "" +#: ../../library/codecs.rst:401 msgid "``'xmlcharrefreplace'``" msgstr "" -msgid "Replace with XML/HTML numeric character reference, which is a decimal form of Unicode code point with format :samp:`&#{num};`. Implemented in :func:`xmlcharrefreplace_errors`." +#: ../../library/codecs.rst:401 +msgid "" +"Replace with XML/HTML numeric character reference, which is a decimal form " +"of Unicode code point with format :samp:`&#{num};`. Implemented " +"in :func:`xmlcharrefreplace_errors`." msgstr "" +#: ../../library/codecs.rst:407 msgid "``'namereplace'``" msgstr "" -msgid "Replace with ``\\N{...}`` escape sequences, what appears in the braces is the Name property from Unicode Character Database. Implemented in :func:`namereplace_errors`." +#: ../../library/codecs.rst:407 +msgid "" +"Replace with ``\\N{...}`` escape sequences, what appears in the braces is " +"the Name property from Unicode Character Database. Implemented " +"in :func:`namereplace_errors`." msgstr "" -msgid "In addition, the following error handler is specific to the given codecs:" +#: ../../library/codecs.rst:416 +msgid "" +"In addition, the following error handler is specific to the given codecs:" msgstr "" +#: ../../library/codecs.rst:13 ../../library/codecs.rst:419 msgid "Codecs" msgstr "" +#: ../../library/codecs.rst:421 msgid "``'surrogatepass'``" msgstr "" +#: ../../library/codecs.rst:421 msgid "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" msgstr "" -msgid "Allow encoding and decoding surrogate code point (``U+D800`` - ``U+DFFF``) as normal code point. Otherwise these codecs treat the presence of surrogate code point in :class:`str` as an error." +#: ../../library/codecs.rst:421 +msgid "" +"Allow encoding and decoding surrogate code point (``U+D800`` - ``U+DFFF``) " +"as normal code point. Otherwise these codecs treat the presence of surrogate " +"code point in :class:`str` as an error." msgstr "" +#: ../../library/codecs.rst:428 msgid "The ``'surrogateescape'`` and ``'surrogatepass'`` error handlers." msgstr "" -msgid "The ``'surrogatepass'`` error handler now works with utf-16\\* and utf-32\\* codecs." +#: ../../library/codecs.rst:431 +msgid "" +"The ``'surrogatepass'`` error handler now works with utf-16\\* and utf-32\\* " +"codecs." msgstr "" +#: ../../library/codecs.rst:435 msgid "The ``'namereplace'`` error handler." msgstr "" -msgid "The ``'backslashreplace'`` error handler now works with decoding and translating." -msgstr "" - -msgid "The set of allowed values can be extended by registering a new named error handler:" +#: ../../library/codecs.rst:438 +msgid "" +"The ``'backslashreplace'`` error handler now works with decoding and " +"translating." msgstr "" -msgid "Register the error handling function *error_handler* under the name *name*. The *error_handler* argument will be called during encoding and decoding in case of an error, when *name* is specified as the errors parameter." +#: ../../library/codecs.rst:442 +msgid "" +"The set of allowed values can be extended by registering a new named error " +"handler:" msgstr "" -msgid "For encoding, *error_handler* will be called with a :exc:`UnicodeEncodeError` instance, which contains information about the location of the error. The error handler must either raise this or a different exception, or return a tuple with a replacement for the unencodable part of the input and a position where encoding should continue. The replacement may be either :class:`str` or :class:`bytes`. If the replacement is bytes, the encoder will simply copy them into the output buffer. If the replacement is a string, the encoder will encode the replacement. Encoding continues on original input at the specified position. Negative position values will be treated as being relative to the end of the input string. If the resulting position is out of bound an :exc:`IndexError` will be raised." +#: ../../library/codecs.rst:447 +msgid "" +"Register the error handling function *error_handler* under the name *name*. " +"The *error_handler* argument will be called during encoding and decoding in " +"case of an error, when *name* is specified as the errors parameter." msgstr "" -msgid "Decoding and translating works similarly, except :exc:`UnicodeDecodeError` or :exc:`UnicodeTranslateError` will be passed to the handler and that the replacement from the error handler will be put into the output directly." +#: ../../library/codecs.rst:451 +msgid "" +"For encoding, *error_handler* will be called with " +"a :exc:`UnicodeEncodeError` instance, which contains information about the " +"location of the error. The error handler must either raise this or a " +"different exception, or return a tuple with a replacement for the " +"unencodable part of the input and a position where encoding should continue. " +"The replacement may be either :class:`str` or :class:`bytes`. If the " +"replacement is bytes, the encoder will simply copy them into the output " +"buffer. If the replacement is a string, the encoder will encode the " +"replacement. Encoding continues on original input at the specified position. " +"Negative position values will be treated as being relative to the end of the " +"input string. If the resulting position is out of bound an :exc:`IndexError` " +"will be raised." +msgstr "" + +#: ../../library/codecs.rst:463 +msgid "" +"Decoding and translating works similarly, except :exc:`UnicodeDecodeError` " +"or :exc:`UnicodeTranslateError` will be passed to the handler and that the " +"replacement from the error handler will be put into the output directly." msgstr "" -msgid "Previously registered error handlers (including the standard error handlers) can be looked up by name:" +#: ../../library/codecs.rst:468 +msgid "" +"Previously registered error handlers (including the standard error handlers) " +"can be looked up by name:" msgstr "" +#: ../../library/codecs.rst:473 msgid "Return the error handler previously registered under the name *name*." msgstr "" +#: ../../library/codecs.rst:475 msgid "Raises a :exc:`LookupError` in case the handler cannot be found." msgstr "" -msgid "The following standard error handlers are also made available as module level functions:" +#: ../../library/codecs.rst:477 +msgid "" +"The following standard error handlers are also made available as module " +"level functions:" msgstr "" +#: ../../library/codecs.rst:482 msgid "Implements the ``'strict'`` error handling." msgstr "" +#: ../../library/codecs.rst:484 msgid "Each encoding or decoding error raises a :exc:`UnicodeError`." msgstr "" +#: ../../library/codecs.rst:489 msgid "Implements the ``'ignore'`` error handling." msgstr "" -msgid "Malformed data is ignored; encoding or decoding is continued without further notice." +#: ../../library/codecs.rst:491 +msgid "" +"Malformed data is ignored; encoding or decoding is continued without further " +"notice." msgstr "" +#: ../../library/codecs.rst:497 msgid "Implements the ``'replace'`` error handling." msgstr "" -msgid "Substitutes ``?`` (ASCII character) for encoding errors or ``�`` (U+FFFD, the official REPLACEMENT CHARACTER) for decoding errors." +#: ../../library/codecs.rst:499 +msgid "" +"Substitutes ``?`` (ASCII character) for encoding errors or ``�`` (U+FFFD, " +"the official REPLACEMENT CHARACTER) for decoding errors." msgstr "" +#: ../../library/codecs.rst:505 msgid "Implements the ``'backslashreplace'`` error handling." msgstr "" -msgid "Malformed data is replaced by a backslashed escape sequence. On encoding, use the hexadecimal form of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :samp:`\\\\U{xxxxxxxx}`. On decoding, use the hexadecimal form of byte value with format :samp:`\\\\x{hh}`." +#: ../../library/codecs.rst:507 +msgid "" +"Malformed data is replaced by a backslashed escape sequence. On encoding, " +"use the hexadecimal form of Unicode code point with formats :samp:`\\\\x{hh}" +"` :samp:`\\\\u{xxxx}` :samp:`\\\\U{xxxxxxxx}`. On decoding, use the " +"hexadecimal form of byte value with format :samp:`\\\\x{hh}`." msgstr "" +#: ../../library/codecs.rst:513 msgid "Works with decoding and translating." msgstr "" -msgid "Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :term:`text encoding` only)." +#: ../../library/codecs.rst:519 +msgid "" +"Implements the ``'xmlcharrefreplace'`` error handling (for encoding " +"within :term:`text encoding` only)." msgstr "" -msgid "The unencodable character is replaced by an appropriate XML/HTML numeric character reference, which is a decimal form of Unicode code point with format :samp:`&#{num};` ." +#: ../../library/codecs.rst:522 +msgid "" +"The unencodable character is replaced by an appropriate XML/HTML numeric " +"character reference, which is a decimal form of Unicode code point with " +"format :samp:`&#{num};` ." msgstr "" -msgid "Implements the ``'namereplace'`` error handling (for encoding within :term:`text encoding` only)." +#: ../../library/codecs.rst:529 +msgid "" +"Implements the ``'namereplace'`` error handling (for encoding " +"within :term:`text encoding` only)." msgstr "" -msgid "The unencodable character is replaced by a ``\\N{...}`` escape sequence. The set of characters that appear in the braces is the Name property from Unicode Character Database. For example, the German lowercase letter ``'ß'`` will be converted to byte sequence ``\\N{LATIN SMALL LETTER SHARP S}`` ." +#: ../../library/codecs.rst:532 +msgid "" +"The unencodable character is replaced by a ``\\N{...}`` escape sequence. The " +"set of characters that appear in the braces is the Name property from " +"Unicode Character Database. For example, the German lowercase letter ``'ß'`` " +"will be converted to byte sequence ``\\N{LATIN SMALL LETTER SHARP S}`` ." msgstr "" +#: ../../library/codecs.rst:543 msgid "Stateless Encoding and Decoding" msgstr "" -msgid "The base :class:`Codec` class defines these methods which also define the function interfaces of the stateless encoder and decoder:" +#: ../../library/codecs.rst:545 +msgid "" +"The base :class:`Codec` class defines these methods which also define the " +"function interfaces of the stateless encoder and decoder:" msgstr "" -msgid "Encodes the object *input* and returns a tuple (output object, length consumed). For instance, :term:`text encoding` converts a string object to a bytes object using a particular character set encoding (e.g., ``cp1252`` or ``iso-8859-1``)." +#: ../../library/codecs.rst:553 +msgid "" +"Encodes the object *input* and returns a tuple (output object, length " +"consumed). For instance, :term:`text encoding` converts a string object to a " +"bytes object using a particular character set encoding (e.g., ``cp1252`` or " +"``iso-8859-1``)." msgstr "" -msgid "The *errors* argument defines the error handling to apply. It defaults to ``'strict'`` handling." +#: ../../library/codecs.rst:558 ../../library/codecs.rst:580 +msgid "" +"The *errors* argument defines the error handling to apply. It defaults to " +"``'strict'`` handling." msgstr "" -msgid "The method may not store state in the :class:`Codec` instance. Use :class:`StreamWriter` for codecs which have to keep state in order to make encoding efficient." +#: ../../library/codecs.rst:561 +msgid "" +"The method may not store state in the :class:`Codec` instance. " +"Use :class:`StreamWriter` for codecs which have to keep state in order to " +"make encoding efficient." msgstr "" -msgid "The encoder must be able to handle zero length input and return an empty object of the output object type in this situation." +#: ../../library/codecs.rst:565 +msgid "" +"The encoder must be able to handle zero length input and return an empty " +"object of the output object type in this situation." msgstr "" -msgid "Decodes the object *input* and returns a tuple (output object, length consumed). For instance, for a :term:`text encoding`, decoding converts a bytes object encoded using a particular character set encoding to a string object." +#: ../../library/codecs.rst:571 +msgid "" +"Decodes the object *input* and returns a tuple (output object, length " +"consumed). For instance, for a :term:`text encoding`, decoding converts a " +"bytes object encoded using a particular character set encoding to a string " +"object." msgstr "" -msgid "For text encodings and bytes-to-bytes codecs, *input* must be a bytes object or one which provides the read-only buffer interface -- for example, buffer objects and memory mapped files." +#: ../../library/codecs.rst:576 +msgid "" +"For text encodings and bytes-to-bytes codecs, *input* must be a bytes object " +"or one which provides the read-only buffer interface -- for example, buffer " +"objects and memory mapped files." msgstr "" -msgid "The method may not store state in the :class:`Codec` instance. Use :class:`StreamReader` for codecs which have to keep state in order to make decoding efficient." +#: ../../library/codecs.rst:583 +msgid "" +"The method may not store state in the :class:`Codec` instance. " +"Use :class:`StreamReader` for codecs which have to keep state in order to " +"make decoding efficient." msgstr "" -msgid "The decoder must be able to handle zero length input and return an empty object of the output object type in this situation." +#: ../../library/codecs.rst:587 +msgid "" +"The decoder must be able to handle zero length input and return an empty " +"object of the output object type in this situation." msgstr "" +#: ../../library/codecs.rst:592 msgid "Incremental Encoding and Decoding" msgstr "" -msgid "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes provide the basic interface for incremental encoding and decoding. Encoding/decoding the input isn't done with one call to the stateless encoder/decoder function, but with multiple calls to the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` method of the incremental encoder/decoder. The incremental encoder/decoder keeps track of the encoding/decoding process during method calls." +#: ../../library/codecs.rst:594 +msgid "" +"The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " +"provide the basic interface for incremental encoding and decoding. Encoding/" +"decoding the input isn't done with one call to the stateless encoder/decoder " +"function, but with multiple calls to " +"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " +"method of the incremental encoder/decoder. The incremental encoder/decoder " +"keeps track of the encoding/decoding process during method calls." msgstr "" -msgid "The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` method is the same as if all the single inputs were joined into one, and this input was encoded/decoded with the stateless encoder/decoder." +#: ../../library/codecs.rst:602 +msgid "" +"The joined output of calls to " +"the :meth:`~IncrementalEncoder.encode`/:meth:`~IncrementalDecoder.decode` " +"method is the same as if all the single inputs were joined into one, and " +"this input was encoded/decoded with the stateless encoder/decoder." msgstr "" +#: ../../library/codecs.rst:611 msgid "IncrementalEncoder Objects" msgstr "" -msgid "The :class:`IncrementalEncoder` class is used for encoding an input in multiple steps. It defines the following methods which every incremental encoder must define in order to be compatible with the Python codec registry." +#: ../../library/codecs.rst:613 +msgid "" +"The :class:`IncrementalEncoder` class is used for encoding an input in " +"multiple steps. It defines the following methods which every incremental " +"encoder must define in order to be compatible with the Python codec registry." msgstr "" +#: ../../library/codecs.rst:620 msgid "Constructor for an :class:`IncrementalEncoder` instance." msgstr "" -msgid "All incremental encoders must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry." +#: ../../library/codecs.rst:622 +msgid "" +"All incremental encoders must provide this constructor interface. They are " +"free to add additional keyword arguments, but only the ones defined here are " +"used by the Python codec registry." msgstr "" -msgid "The :class:`IncrementalEncoder` may implement different error handling schemes by providing the *errors* keyword argument. See :ref:`error-handlers` for possible values." +#: ../../library/codecs.rst:626 +msgid "" +"The :class:`IncrementalEncoder` may implement different error handling " +"schemes by providing the *errors* keyword argument. See :ref:`error-" +"handlers` for possible values." msgstr "" -msgid "The *errors* argument will be assigned to an attribute of the same name. Assigning to this attribute makes it possible to switch between different error handling strategies during the lifetime of the :class:`IncrementalEncoder` object." +#: ../../library/codecs.rst:630 +msgid "" +"The *errors* argument will be assigned to an attribute of the same name. " +"Assigning to this attribute makes it possible to switch between different " +"error handling strategies during the lifetime of " +"the :class:`IncrementalEncoder` object." msgstr "" -msgid "Encodes *object* (taking the current state of the encoder into account) and returns the resulting encoded object. If this is the last call to :meth:`encode` *final* must be true (the default is false)." +#: ../../library/codecs.rst:638 +msgid "" +"Encodes *object* (taking the current state of the encoder into account) and " +"returns the resulting encoded object. If this is the last call " +"to :meth:`encode` *final* must be true (the default is false)." msgstr "" -msgid "Reset the encoder to the initial state. The output is discarded: call ``.encode(object, final=True)``, passing an empty byte or text string if necessary, to reset the encoder and to get the output." +#: ../../library/codecs.rst:645 +msgid "" +"Reset the encoder to the initial state. The output is discarded: call " +"``.encode(object, final=True)``, passing an empty byte or text string if " +"necessary, to reset the encoder and to get the output." msgstr "" -msgid "Return the current state of the encoder which must be an integer. The implementation should make sure that ``0`` is the most common state. (States that are more complicated than integers can be converted into an integer by marshaling/pickling the state and encoding the bytes of the resulting string into an integer.)" +#: ../../library/codecs.rst:652 +msgid "" +"Return the current state of the encoder which must be an integer. The " +"implementation should make sure that ``0`` is the most common state. (States " +"that are more complicated than integers can be converted into an integer by " +"marshaling/pickling the state and encoding the bytes of the resulting string " +"into an integer.)" msgstr "" -msgid "Set the state of the encoder to *state*. *state* must be an encoder state returned by :meth:`getstate`." +#: ../../library/codecs.rst:661 +msgid "" +"Set the state of the encoder to *state*. *state* must be an encoder state " +"returned by :meth:`getstate`." msgstr "" +#: ../../library/codecs.rst:668 msgid "IncrementalDecoder Objects" msgstr "" -msgid "The :class:`IncrementalDecoder` class is used for decoding an input in multiple steps. It defines the following methods which every incremental decoder must define in order to be compatible with the Python codec registry." +#: ../../library/codecs.rst:670 +msgid "" +"The :class:`IncrementalDecoder` class is used for decoding an input in " +"multiple steps. It defines the following methods which every incremental " +"decoder must define in order to be compatible with the Python codec registry." msgstr "" +#: ../../library/codecs.rst:677 msgid "Constructor for an :class:`IncrementalDecoder` instance." msgstr "" -msgid "All incremental decoders must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry." +#: ../../library/codecs.rst:679 +msgid "" +"All incremental decoders must provide this constructor interface. They are " +"free to add additional keyword arguments, but only the ones defined here are " +"used by the Python codec registry." msgstr "" -msgid "The :class:`IncrementalDecoder` may implement different error handling schemes by providing the *errors* keyword argument. See :ref:`error-handlers` for possible values." +#: ../../library/codecs.rst:683 +msgid "" +"The :class:`IncrementalDecoder` may implement different error handling " +"schemes by providing the *errors* keyword argument. See :ref:`error-" +"handlers` for possible values." msgstr "" -msgid "The *errors* argument will be assigned to an attribute of the same name. Assigning to this attribute makes it possible to switch between different error handling strategies during the lifetime of the :class:`IncrementalDecoder` object." +#: ../../library/codecs.rst:687 +msgid "" +"The *errors* argument will be assigned to an attribute of the same name. " +"Assigning to this attribute makes it possible to switch between different " +"error handling strategies during the lifetime of " +"the :class:`IncrementalDecoder` object." msgstr "" -msgid "Decodes *object* (taking the current state of the decoder into account) and returns the resulting decoded object. If this is the last call to :meth:`decode` *final* must be true (the default is false). If *final* is true the decoder must decode the input completely and must flush all buffers. If this isn't possible (e.g. because of incomplete byte sequences at the end of the input) it must initiate error handling just like in the stateless case (which might raise an exception)." +#: ../../library/codecs.rst:695 +msgid "" +"Decodes *object* (taking the current state of the decoder into account) and " +"returns the resulting decoded object. If this is the last call " +"to :meth:`decode` *final* must be true (the default is false). If *final* is " +"true the decoder must decode the input completely and must flush all " +"buffers. If this isn't possible (e.g. because of incomplete byte sequences " +"at the end of the input) it must initiate error handling just like in the " +"stateless case (which might raise an exception)." msgstr "" +#: ../../library/codecs.rst:706 msgid "Reset the decoder to the initial state." msgstr "" -msgid "Return the current state of the decoder. This must be a tuple with two items, the first must be the buffer containing the still undecoded input. The second must be an integer and can be additional state info. (The implementation should make sure that ``0`` is the most common additional state info.) If this additional state info is ``0`` it must be possible to set the decoder to the state which has no input buffered and ``0`` as the additional state info, so that feeding the previously buffered input to the decoder returns it to the previous state without producing any output. (Additional state info that is more complicated than integers can be converted into an integer by marshaling/pickling the info and encoding the bytes of the resulting string into an integer.)" -msgstr "" - -msgid "Set the state of the decoder to *state*. *state* must be a decoder state returned by :meth:`getstate`." +#: ../../library/codecs.rst:711 +msgid "" +"Return the current state of the decoder. This must be a tuple with two " +"items, the first must be the buffer containing the still undecoded input. " +"The second must be an integer and can be additional state info. (The " +"implementation should make sure that ``0`` is the most common additional " +"state info.) If this additional state info is ``0`` it must be possible to " +"set the decoder to the state which has no input buffered and ``0`` as the " +"additional state info, so that feeding the previously buffered input to the " +"decoder returns it to the previous state without producing any output. " +"(Additional state info that is more complicated than integers can be " +"converted into an integer by marshaling/pickling the info and encoding the " +"bytes of the resulting string into an integer.)" +msgstr "" + +#: ../../library/codecs.rst:726 +msgid "" +"Set the state of the decoder to *state*. *state* must be a decoder state " +"returned by :meth:`getstate`." msgstr "" +#: ../../library/codecs.rst:731 msgid "Stream Encoding and Decoding" msgstr "" -msgid "The :class:`StreamWriter` and :class:`StreamReader` classes provide generic working interfaces which can be used to implement new encoding submodules very easily. See :mod:`!encodings.utf_8` for an example of how this is done." +#: ../../library/codecs.rst:734 +msgid "" +"The :class:`StreamWriter` and :class:`StreamReader` classes provide generic " +"working interfaces which can be used to implement new encoding submodules " +"very easily. See :mod:`!encodings.utf_8` for an example of how this is done." msgstr "" +#: ../../library/codecs.rst:742 msgid "StreamWriter Objects" msgstr "" -msgid "The :class:`StreamWriter` class is a subclass of :class:`Codec` and defines the following methods which every stream writer must define in order to be compatible with the Python codec registry." +#: ../../library/codecs.rst:744 +msgid "" +"The :class:`StreamWriter` class is a subclass of :class:`Codec` and defines " +"the following methods which every stream writer must define in order to be " +"compatible with the Python codec registry." msgstr "" +#: ../../library/codecs.rst:751 msgid "Constructor for a :class:`StreamWriter` instance." msgstr "" -msgid "All stream writers must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry." +#: ../../library/codecs.rst:753 +msgid "" +"All stream writers must provide this constructor interface. They are free to " +"add additional keyword arguments, but only the ones defined here are used by " +"the Python codec registry." msgstr "" -msgid "The *stream* argument must be a file-like object open for writing text or binary data, as appropriate for the specific codec." +#: ../../library/codecs.rst:757 +msgid "" +"The *stream* argument must be a file-like object open for writing text or " +"binary data, as appropriate for the specific codec." msgstr "" -msgid "The :class:`StreamWriter` may implement different error handling schemes by providing the *errors* keyword argument. See :ref:`error-handlers` for the standard error handlers the underlying stream codec may support." +#: ../../library/codecs.rst:760 +msgid "" +"The :class:`StreamWriter` may implement different error handling schemes by " +"providing the *errors* keyword argument. See :ref:`error-handlers` for the " +"standard error handlers the underlying stream codec may support." msgstr "" -msgid "The *errors* argument will be assigned to an attribute of the same name. Assigning to this attribute makes it possible to switch between different error handling strategies during the lifetime of the :class:`StreamWriter` object." +#: ../../library/codecs.rst:764 +msgid "" +"The *errors* argument will be assigned to an attribute of the same name. " +"Assigning to this attribute makes it possible to switch between different " +"error handling strategies during the lifetime of the :class:`StreamWriter` " +"object." msgstr "" +#: ../../library/codecs.rst:770 msgid "Writes the object's contents encoded to the stream." msgstr "" -msgid "Writes the concatenated iterable of strings to the stream (possibly by reusing the :meth:`write` method). Infinite or very large iterables are not supported. The standard bytes-to-bytes codecs do not support this method." +#: ../../library/codecs.rst:775 +msgid "" +"Writes the concatenated iterable of strings to the stream (possibly by " +"reusing the :meth:`write` method). Infinite or very large iterables are not " +"supported. The standard bytes-to-bytes codecs do not support this method." msgstr "" +#: ../../library/codecs.rst:783 ../../library/codecs.rst:878 msgid "Resets the codec buffers used for keeping internal state." msgstr "" -msgid "Calling this method should ensure that the data on the output is put into a clean state that allows appending of new fresh data without having to rescan the whole stream to recover state." +#: ../../library/codecs.rst:785 +msgid "" +"Calling this method should ensure that the data on the output is put into a " +"clean state that allows appending of new fresh data without having to rescan " +"the whole stream to recover state." msgstr "" -msgid "In addition to the above methods, the :class:`StreamWriter` must also inherit all other methods and attributes from the underlying stream." +#: ../../library/codecs.rst:790 +msgid "" +"In addition to the above methods, the :class:`StreamWriter` must also " +"inherit all other methods and attributes from the underlying stream." msgstr "" +#: ../../library/codecs.rst:797 msgid "StreamReader Objects" msgstr "" -msgid "The :class:`StreamReader` class is a subclass of :class:`Codec` and defines the following methods which every stream reader must define in order to be compatible with the Python codec registry." +#: ../../library/codecs.rst:799 +msgid "" +"The :class:`StreamReader` class is a subclass of :class:`Codec` and defines " +"the following methods which every stream reader must define in order to be " +"compatible with the Python codec registry." msgstr "" +#: ../../library/codecs.rst:806 msgid "Constructor for a :class:`StreamReader` instance." msgstr "" -msgid "All stream readers must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry." +#: ../../library/codecs.rst:808 +msgid "" +"All stream readers must provide this constructor interface. They are free to " +"add additional keyword arguments, but only the ones defined here are used by " +"the Python codec registry." msgstr "" -msgid "The *stream* argument must be a file-like object open for reading text or binary data, as appropriate for the specific codec." +#: ../../library/codecs.rst:812 +msgid "" +"The *stream* argument must be a file-like object open for reading text or " +"binary data, as appropriate for the specific codec." msgstr "" -msgid "The :class:`StreamReader` may implement different error handling schemes by providing the *errors* keyword argument. See :ref:`error-handlers` for the standard error handlers the underlying stream codec may support." +#: ../../library/codecs.rst:815 +msgid "" +"The :class:`StreamReader` may implement different error handling schemes by " +"providing the *errors* keyword argument. See :ref:`error-handlers` for the " +"standard error handlers the underlying stream codec may support." msgstr "" -msgid "The *errors* argument will be assigned to an attribute of the same name. Assigning to this attribute makes it possible to switch between different error handling strategies during the lifetime of the :class:`StreamReader` object." +#: ../../library/codecs.rst:819 +msgid "" +"The *errors* argument will be assigned to an attribute of the same name. " +"Assigning to this attribute makes it possible to switch between different " +"error handling strategies during the lifetime of the :class:`StreamReader` " +"object." msgstr "" -msgid "The set of allowed values for the *errors* argument can be extended with :func:`register_error`." +#: ../../library/codecs.rst:823 +msgid "" +"The set of allowed values for the *errors* argument can be extended " +"with :func:`register_error`." msgstr "" +#: ../../library/codecs.rst:829 msgid "Decodes data from the stream and returns the resulting object." msgstr "" -msgid "The *chars* argument indicates the number of decoded code points or bytes to return. The :func:`read` method will never return more data than requested, but it might return less, if there is not enough available." +#: ../../library/codecs.rst:831 +msgid "" +"The *chars* argument indicates the number of decoded code points or bytes to " +"return. The :func:`read` method will never return more data than requested, " +"but it might return less, if there is not enough available." msgstr "" -msgid "The *size* argument indicates the approximate maximum number of encoded bytes or code points to read for decoding. The decoder can modify this setting as appropriate. The default value -1 indicates to read and decode as much as possible. This parameter is intended to prevent having to decode huge files in one step." +#: ../../library/codecs.rst:836 +msgid "" +"The *size* argument indicates the approximate maximum number of encoded " +"bytes or code points to read for decoding. The decoder can modify this " +"setting as appropriate. The default value -1 indicates to read and decode as " +"much as possible. This parameter is intended to prevent having to decode " +"huge files in one step." msgstr "" -msgid "The *firstline* flag indicates that it would be sufficient to only return the first line, if there are decoding errors on later lines." +#: ../../library/codecs.rst:843 +msgid "" +"The *firstline* flag indicates that it would be sufficient to only return " +"the first line, if there are decoding errors on later lines." msgstr "" -msgid "The method should use a greedy read strategy meaning that it should read as much data as is allowed within the definition of the encoding and the given size, e.g. if optional encoding endings or state markers are available on the stream, these should be read too." +#: ../../library/codecs.rst:847 +msgid "" +"The method should use a greedy read strategy meaning that it should read as " +"much data as is allowed within the definition of the encoding and the given " +"size, e.g. if optional encoding endings or state markers are available on " +"the stream, these should be read too." msgstr "" +#: ../../library/codecs.rst:855 msgid "Read one line from the input stream and return the decoded data." msgstr "" -msgid "*size*, if given, is passed as size argument to the stream's :meth:`read` method." +#: ../../library/codecs.rst:857 +msgid "" +"*size*, if given, is passed as size argument to the stream's :meth:`read` " +"method." msgstr "" -msgid "If *keepends* is false line-endings will be stripped from the lines returned." +#: ../../library/codecs.rst:860 +msgid "" +"If *keepends* is false line-endings will be stripped from the lines returned." msgstr "" -msgid "Read all lines available on the input stream and return them as a list of lines." +#: ../../library/codecs.rst:866 +msgid "" +"Read all lines available on the input stream and return them as a list of " +"lines." msgstr "" -msgid "Line-endings are implemented using the codec's :meth:`decode` method and are included in the list entries if *keepends* is true." +#: ../../library/codecs.rst:869 +msgid "" +"Line-endings are implemented using the codec's :meth:`decode` method and are " +"included in the list entries if *keepends* is true." msgstr "" -msgid "*sizehint*, if given, is passed as the *size* argument to the stream's :meth:`read` method." +#: ../../library/codecs.rst:872 +msgid "" +"*sizehint*, if given, is passed as the *size* argument to the " +"stream's :meth:`read` method." msgstr "" -msgid "Note that no stream repositioning should take place. This method is primarily intended to be able to recover from decoding errors." +#: ../../library/codecs.rst:880 +msgid "" +"Note that no stream repositioning should take place. This method is " +"primarily intended to be able to recover from decoding errors." msgstr "" -msgid "In addition to the above methods, the :class:`StreamReader` must also inherit all other methods and attributes from the underlying stream." +#: ../../library/codecs.rst:884 +msgid "" +"In addition to the above methods, the :class:`StreamReader` must also " +"inherit all other methods and attributes from the underlying stream." msgstr "" +#: ../../library/codecs.rst:890 msgid "StreamReaderWriter Objects" msgstr "" -msgid "The :class:`StreamReaderWriter` is a convenience class that allows wrapping streams which work in both read and write modes." +#: ../../library/codecs.rst:892 +msgid "" +"The :class:`StreamReaderWriter` is a convenience class that allows wrapping " +"streams which work in both read and write modes." msgstr "" -msgid "The design is such that one can use the factory functions returned by the :func:`lookup` function to construct the instance." +#: ../../library/codecs.rst:895 ../../library/codecs.rst:919 +msgid "" +"The design is such that one can use the factory functions returned by " +"the :func:`lookup` function to construct the instance." msgstr "" -msgid "Creates a :class:`StreamReaderWriter` instance. *stream* must be a file-like object. *Reader* and *Writer* must be factory functions or classes providing the :class:`StreamReader` and :class:`StreamWriter` interface resp. Error handling is done in the same way as defined for the stream readers and writers." +#: ../../library/codecs.rst:901 +msgid "" +"Creates a :class:`StreamReaderWriter` instance. *stream* must be a file-like " +"object. *Reader* and *Writer* must be factory functions or classes providing " +"the :class:`StreamReader` and :class:`StreamWriter` interface resp. Error " +"handling is done in the same way as defined for the stream readers and " +"writers." msgstr "" -msgid ":class:`StreamReaderWriter` instances define the combined interfaces of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all other methods and attributes from the underlying stream." +#: ../../library/codecs.rst:906 +msgid "" +":class:`StreamReaderWriter` instances define the combined interfaces " +"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +"other methods and attributes from the underlying stream." msgstr "" +#: ../../library/codecs.rst:914 msgid "StreamRecoder Objects" msgstr "" -msgid "The :class:`StreamRecoder` translates data from one encoding to another, which is sometimes useful when dealing with different encoding environments." +#: ../../library/codecs.rst:916 +msgid "" +"The :class:`StreamRecoder` translates data from one encoding to another, " +"which is sometimes useful when dealing with different encoding environments." msgstr "" -msgid "Creates a :class:`StreamRecoder` instance which implements a two-way conversion: *encode* and *decode* work on the frontend — the data visible to code calling :meth:`~StreamReader.read` and :meth:`~StreamWriter.write`, while *Reader* and *Writer* work on the backend — the data in *stream*." +#: ../../library/codecs.rst:925 +msgid "" +"Creates a :class:`StreamRecoder` instance which implements a two-way " +"conversion: *encode* and *decode* work on the frontend — the data visible to " +"code calling :meth:`~StreamReader.read` and :meth:`~StreamWriter.write`, " +"while *Reader* and *Writer* work on the backend — the data in *stream*." msgstr "" -msgid "You can use these objects to do transparent transcodings, e.g., from Latin-1 to UTF-8 and back." +#: ../../library/codecs.rst:931 +msgid "" +"You can use these objects to do transparent transcodings, e.g., from Latin-1 " +"to UTF-8 and back." msgstr "" +#: ../../library/codecs.rst:934 msgid "The *stream* argument must be a file-like object." msgstr "" -msgid "The *encode* and *decode* arguments must adhere to the :class:`Codec` interface. *Reader* and *Writer* must be factory functions or classes providing objects of the :class:`StreamReader` and :class:`StreamWriter` interface respectively." +#: ../../library/codecs.rst:936 +msgid "" +"The *encode* and *decode* arguments must adhere to the :class:`Codec` " +"interface. *Reader* and *Writer* must be factory functions or classes " +"providing objects of the :class:`StreamReader` and :class:`StreamWriter` " +"interface respectively." msgstr "" -msgid "Error handling is done in the same way as defined for the stream readers and writers." +#: ../../library/codecs.rst:941 +msgid "" +"Error handling is done in the same way as defined for the stream readers and " +"writers." msgstr "" -msgid ":class:`StreamRecoder` instances define the combined interfaces of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all other methods and attributes from the underlying stream." +#: ../../library/codecs.rst:945 +msgid "" +":class:`StreamRecoder` instances define the combined interfaces " +"of :class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " +"other methods and attributes from the underlying stream." msgstr "" +#: ../../library/codecs.rst:953 msgid "Encodings and Unicode" msgstr "" -msgid "Strings are stored internally as sequences of code points in range ``U+0000``--``U+10FFFF``. (See :pep:`393` for more details about the implementation.) Once a string object is used outside of CPU and memory, endianness and how these arrays are stored as bytes become an issue. As with other codecs, serialising a string into a sequence of bytes is known as *encoding*, and recreating the string from the sequence of bytes is known as *decoding*. There are a variety of different text serialisation codecs, which are collectivity referred to as :term:`text encodings `." -msgstr "" - -msgid "The simplest text encoding (called ``'latin-1'`` or ``'iso-8859-1'``) maps the code points 0--255 to the bytes ``0x0``--``0xff``, which means that a string object that contains code points above ``U+00FF`` can't be encoded with this codec. Doing so will raise a :exc:`UnicodeEncodeError` that looks like the following (although the details of the error message may differ): ``UnicodeEncodeError: 'latin-1' codec can't encode character '\\u1234' in position 3: ordinal not in range(256)``." -msgstr "" - -msgid "There's another group of encodings (the so called charmap encodings) that choose a different subset of all Unicode code points and how these code points are mapped to the bytes ``0x0``--``0xff``. To see how this is done simply open e.g. :file:`encodings/cp1252.py` (which is an encoding that is used primarily on Windows). There's a string constant with 256 characters that shows you which character is mapped to which byte value." +#: ../../library/codecs.rst:955 +msgid "" +"Strings are stored internally as sequences of code points in range " +"``U+0000``--``U+10FFFF``. (See :pep:`393` for more details about the " +"implementation.) Once a string object is used outside of CPU and memory, " +"endianness and how these arrays are stored as bytes become an issue. As with " +"other codecs, serialising a string into a sequence of bytes is known as " +"*encoding*, and recreating the string from the sequence of bytes is known as " +"*decoding*. There are a variety of different text serialisation codecs, " +"which are collectivity referred to as :term:`text encodings `." msgstr "" -msgid "All of these encodings can only encode 256 of the 1114112 code points defined in Unicode. A simple and straightforward way that can store each Unicode code point, is to store each code point as four consecutive bytes. There are two possibilities: store the bytes in big endian or in little endian order. These two encodings are called ``UTF-32-BE`` and ``UTF-32-LE`` respectively. Their disadvantage is that if, for example, you use ``UTF-32-BE`` on a little endian machine you will always have to swap bytes on encoding and decoding. Python's ``UTF-16`` and ``UTF-32`` codecs avoid this problem by using the platform's native byte order when no BOM is present. Python follows prevailing platform practice, so native-endian data round-trips without redundant byte swapping, even though the Unicode Standard defaults to big-endian when the byte order is unspecified. When these bytes are read by a CPU with a different endianness, the bytes have to be swapped. To be able to detect the endianness of a ``UTF-16`` or ``UTF-32`` byte sequence, a BOM (\"Byte Order Mark\") is used. This is the Unicode character ``U+FEFF``. This character can be prepended to every ``UTF-16`` or ``UTF-32`` byte sequence. The byte swapped version of this character (``0xFFFE``) is an illegal character that may not appear in a Unicode text. When the first character of a ``UTF-16`` or ``UTF-32`` byte sequence is ``U+FFFE``, the bytes have to be swapped on decoding." +#: ../../library/codecs.rst:965 +msgid "" +"The simplest text encoding (called ``'latin-1'`` or ``'iso-8859-1'``) maps " +"the code points 0--255 to the bytes ``0x0``--``0xff``, which means that a " +"string object that contains code points above ``U+00FF`` can't be encoded " +"with this codec. Doing so will raise a :exc:`UnicodeEncodeError` that looks " +"like the following (although the details of the error message may differ): " +"``UnicodeEncodeError: 'latin-1' codec can't encode character '\\u1234' in " +"position 3: ordinal not in range(256)``." msgstr "" -msgid "Unfortunately the character ``U+FEFF`` had a second purpose as a ``ZERO WIDTH NO-BREAK SPACE``: a character that has no width and doesn't allow a word to be split. It can e.g. be used to give hints to a ligature algorithm. With Unicode 4.0 using ``U+FEFF`` as a ``ZERO WIDTH NO-BREAK SPACE`` has been deprecated (with ``U+2060`` (``WORD JOINER``) assuming this role). Nevertheless Unicode software still must be able to handle ``U+FEFF`` in both roles: as a BOM it's a device to determine the storage layout of the encoded bytes, and vanishes once the byte sequence has been decoded into a string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a normal character that will be decoded like any other." +#: ../../library/codecs.rst:973 +msgid "" +"There's another group of encodings (the so called charmap encodings) that " +"choose a different subset of all Unicode code points and how these code " +"points are mapped to the bytes ``0x0``--``0xff``. To see how this is done " +"simply open e.g. :file:`encodings/cp1252.py` (which is an encoding that is " +"used primarily on Windows). There's a string constant with 256 characters " +"that shows you which character is mapped to which byte value." msgstr "" -msgid "There's another encoding that is able to encode the full range of Unicode characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no issues with byte order in UTF-8. Each byte in a UTF-8 byte sequence consists of two parts: marker bits (the most significant bits) and payload bits. The marker bits are a sequence of zero to four ``1`` bits followed by a ``0`` bit. Unicode characters are encoded like this (with x being payload bits, which when concatenated give the Unicode character):" +#: ../../library/codecs.rst:980 +msgid "" +"All of these encodings can only encode 256 of the 1114112 code points " +"defined in Unicode. A simple and straightforward way that can store each " +"Unicode code point, is to store each code point as four consecutive bytes. " +"There are two possibilities: store the bytes in big endian or in little " +"endian order. These two encodings are called ``UTF-32-BE`` and ``UTF-32-LE`` " +"respectively. Their disadvantage is that if, for example, you use ``UTF-32-" +"BE`` on a little endian machine you will always have to swap bytes on " +"encoding and decoding. Python's ``UTF-16`` and ``UTF-32`` codecs avoid this " +"problem by using the platform's native byte order when no BOM is present. " +"Python follows prevailing platform practice, so native-endian data round-" +"trips without redundant byte swapping, even though the Unicode Standard " +"defaults to big-endian when the byte order is unspecified. When these bytes " +"are read by a CPU with a different endianness, the bytes have to be swapped. " +"To be able to detect the endianness of a ``UTF-16`` or ``UTF-32`` byte " +"sequence, a BOM (\"Byte Order Mark\") is used. This is the Unicode character " +"``U+FEFF``. This character can be prepended to every ``UTF-16`` or " +"``UTF-32`` byte sequence. The byte swapped version of this character " +"(``0xFFFE``) is an illegal character that may not appear in a Unicode text. " +"When the first character of a ``UTF-16`` or ``UTF-32`` byte sequence is " +"``U+FFFE``, the bytes have to be swapped on decoding." +msgstr "" + +#: ../../library/codecs.rst:1001 +msgid "" +"Unfortunately the character ``U+FEFF`` had a second purpose as a ``ZERO " +"WIDTH NO-BREAK SPACE``: a character that has no width and doesn't allow a " +"word to be split. It can e.g. be used to give hints to a ligature algorithm. " +"With Unicode 4.0 using ``U+FEFF`` as a ``ZERO WIDTH NO-BREAK SPACE`` has " +"been deprecated (with ``U+2060`` (``WORD JOINER``) assuming this role). " +"Nevertheless Unicode software still must be able to handle ``U+FEFF`` in " +"both roles: as a BOM it's a device to determine the storage layout of the " +"encoded bytes, and vanishes once the byte sequence has been decoded into a " +"string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a normal character that will " +"be decoded like any other." +msgstr "" + +#: ../../library/codecs.rst:1011 +msgid "" +"There's another encoding that is able to encode the full range of Unicode " +"characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no " +"issues with byte order in UTF-8. Each byte in a UTF-8 byte sequence consists " +"of two parts: marker bits (the most significant bits) and payload bits. The " +"marker bits are a sequence of zero to four ``1`` bits followed by a ``0`` " +"bit. Unicode characters are encoded like this (with x being payload bits, " +"which when concatenated give the Unicode character):" msgstr "" +#: ../../library/codecs.rst:1020 msgid "Range" msgstr "" +#: ../../library/codecs.rst:1020 msgid "Encoding" msgstr "" +#: ../../library/codecs.rst:1022 msgid "``U-00000000`` ... ``U-0000007F``" msgstr "" +#: ../../library/codecs.rst:1022 msgid "0xxxxxxx" msgstr "" +#: ../../library/codecs.rst:1024 msgid "``U-00000080`` ... ``U-000007FF``" msgstr "" +#: ../../library/codecs.rst:1024 msgid "110xxxxx 10xxxxxx" msgstr "" +#: ../../library/codecs.rst:1026 msgid "``U-00000800`` ... ``U-0000FFFF``" msgstr "" +#: ../../library/codecs.rst:1026 msgid "1110xxxx 10xxxxxx 10xxxxxx" msgstr "" +#: ../../library/codecs.rst:1028 msgid "``U-00010000`` ... ``U-0010FFFF``" msgstr "" +#: ../../library/codecs.rst:1028 msgid "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" msgstr "" -msgid "The least significant bit of the Unicode character is the rightmost x bit." -msgstr "" - -msgid "As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` character in the decoded string (even if it's the first character) is treated as a ``ZERO WIDTH NO-BREAK SPACE``." +#: ../../library/codecs.rst:1031 +msgid "" +"The least significant bit of the Unicode character is the rightmost x bit." msgstr "" -msgid "Without external information it's impossible to reliably determine which encoding was used for encoding a string. Each charmap encoding can decode any random byte sequence. However that's not possible with UTF-8, as UTF-8 byte sequences have a structure that doesn't allow arbitrary byte sequences. To increase the reliability with which a UTF-8 encoding can be detected, Microsoft invented a variant of UTF-8 (that Python calls ``\"utf-8-sig\"``) for its Notepad program: Before any of the Unicode characters is written to the file, a UTF-8 encoded BOM (which looks like this as a byte sequence: ``0xef``, ``0xbb``, ``0xbf``) is written. As it's rather improbable that any charmap encoded file starts with these byte values (which would e.g. map to" +#: ../../library/codecs.rst:1033 +msgid "" +"As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` " +"character in the decoded string (even if it's the first character) is " +"treated as a ``ZERO WIDTH NO-BREAK SPACE``." msgstr "" +#: ../../library/codecs.rst:1037 +msgid "" +"Without external information it's impossible to reliably determine which " +"encoding was used for encoding a string. Each charmap encoding can decode " +"any random byte sequence. However that's not possible with UTF-8, as UTF-8 " +"byte sequences have a structure that doesn't allow arbitrary byte sequences. " +"To increase the reliability with which a UTF-8 encoding can be detected, " +"Microsoft invented a variant of UTF-8 (that Python calls ``\"utf-8-sig\"``) " +"for its Notepad program: Before any of the Unicode characters is written to " +"the file, a UTF-8 encoded BOM (which looks like this as a byte sequence: " +"``0xef``, ``0xbb``, ``0xbf``) is written. As it's rather improbable that any " +"charmap encoded file starts with these byte values (which would e.g. map to" +msgstr "" + +#: ../../library/codecs.rst:0 msgid "LATIN SMALL LETTER I WITH DIAERESIS" msgstr "" +#: ../../library/codecs.rst:0 msgid "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK" msgstr "" +#: ../../library/codecs.rst:0 msgid "INVERTED QUESTION MARK" msgstr "" -msgid "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding can be correctly guessed from the byte sequence. So here the BOM is not used to be able to determine the byte order used for generating the byte sequence, but as a signature that helps in guessing the encoding. On encoding the utf-8-sig codec will write ``0xef``, ``0xbb``, ``0xbf`` as the first three bytes to the file. On decoding ``utf-8-sig`` will skip those three bytes if they appear as the first three bytes in the file. In UTF-8, the use of the BOM is discouraged and should generally be avoided." +#: ../../library/codecs.rst:1053 +msgid "" +"in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " +"can be correctly guessed from the byte sequence. So here the BOM is not used " +"to be able to determine the byte order used for generating the byte " +"sequence, but as a signature that helps in guessing the encoding. On " +"encoding the utf-8-sig codec will write ``0xef``, ``0xbb``, ``0xbf`` as the " +"first three bytes to the file. On decoding ``utf-8-sig`` will skip those " +"three bytes if they appear as the first three bytes in the file. In UTF-8, " +"the use of the BOM is discouraged and should generally be avoided." msgstr "" +#: ../../library/codecs.rst:1066 msgid "Standard Encodings" msgstr "" -msgid "Python comes with a number of codecs built-in, either implemented as C functions or with dictionaries as mapping tables. The following table lists the codecs by name, together with a few common aliases, and the languages for which the encoding is likely used. Neither the list of aliases nor the list of languages is meant to be exhaustive. Notice that spelling alternatives that only differ in case or use a hyphen instead of an underscore are also valid aliases because they are equivalent when normalized by :func:`~encodings.normalize_encoding`. For example, ``'utf-8'`` is a valid alias for the ``'utf_8'`` codec." -msgstr "" - -msgid "The below table lists the most common aliases, for a complete list refer to the source :source:`aliases.py ` file." +#: ../../library/codecs.rst:1068 +msgid "" +"Python comes with a number of codecs built-in, either implemented as C " +"functions or with dictionaries as mapping tables. The following table lists " +"the codecs by name, together with a few common aliases, and the languages " +"for which the encoding is likely used. Neither the list of aliases nor the " +"list of languages is meant to be exhaustive. Notice that spelling " +"alternatives that only differ in case or use a hyphen instead of an " +"underscore are also valid aliases because they are equivalent when " +"normalized by :func:`~encodings.normalize_encoding`. For example, " +"``'utf-8'`` is a valid alias for the ``'utf_8'`` codec." +msgstr "" + +#: ../../library/codecs.rst:1080 +msgid "" +"The below table lists the most common aliases, for a complete list refer to " +"the source :source:`aliases.py ` file." msgstr "" -msgid "On Windows, ``cpXXX`` codecs are available for all code pages. But only codecs listed in the following table are guarantead to exist on other platforms." +#: ../../library/codecs.rst:1083 +msgid "" +"On Windows, ``cpXXX`` codecs are available for all code pages. But only " +"codecs listed in the following table are guarantead to exist on other " +"platforms." msgstr "" -msgid "Some common encodings can bypass the codecs lookup machinery to improve performance. These optimization opportunities are only recognized by CPython for a limited set of (case insensitive) aliases: utf-8, utf8, latin-1, latin1, iso-8859-1, iso8859-1, mbcs (Windows only), ascii, us-ascii, utf-16, utf16, utf-32, utf32, and the same using underscores instead of dashes. Using alternative aliases for these encodings may result in slower execution." +#: ../../library/codecs.rst:1089 +msgid "" +"Some common encodings can bypass the codecs lookup machinery to improve " +"performance. These optimization opportunities are only recognized by CPython " +"for a limited set of (case insensitive) aliases: utf-8, utf8, latin-1, " +"latin1, iso-8859-1, iso8859-1, mbcs (Windows only), ascii, us-ascii, utf-16, " +"utf16, utf-32, utf32, and the same using underscores instead of dashes. " +"Using alternative aliases for these encodings may result in slower execution." msgstr "" +#: ../../library/codecs.rst:1097 msgid "Optimization opportunity recognized for us-ascii." msgstr "" -msgid "Many of the character sets support the same languages. They vary in individual characters (e.g. whether the EURO SIGN is supported or not), and in the assignment of characters to code positions. For the European languages in particular, the following variants typically exist:" +#: ../../library/codecs.rst:1100 +msgid "" +"Many of the character sets support the same languages. They vary in " +"individual characters (e.g. whether the EURO SIGN is supported or not), and " +"in the assignment of characters to code positions. For the European " +"languages in particular, the following variants typically exist:" msgstr "" +#: ../../library/codecs.rst:1105 msgid "an ISO 8859 codeset" msgstr "" -msgid "a Microsoft Windows code page, which is typically derived from an 8859 codeset, but replaces control characters with additional graphic characters" +#: ../../library/codecs.rst:1107 +msgid "" +"a Microsoft Windows code page, which is typically derived from an 8859 " +"codeset, but replaces control characters with additional graphic characters" msgstr "" +#: ../../library/codecs.rst:1110 msgid "an IBM EBCDIC code page" msgstr "" +#: ../../library/codecs.rst:1112 msgid "an IBM PC code page, which is ASCII compatible" msgstr "" +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1456 ../../library/codecs.rst:1541 msgid "Codec" msgstr "" +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1376 +#: ../../library/codecs.rst:1456 ../../library/codecs.rst:1541 msgid "Aliases" msgstr "" +#: ../../library/codecs.rst:1117 msgid "Languages" msgstr "" +#: ../../library/codecs.rst:1119 msgid "ascii" msgstr "" +#: ../../library/codecs.rst:1119 msgid "646, us-ascii" msgstr "" +#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1125 +#: ../../library/codecs.rst:1133 msgid "English" msgstr "" +#: ../../library/codecs.rst:1121 msgid "big5" msgstr "" +#: ../../library/codecs.rst:1121 msgid "big5-tw, csbig5" msgstr "" +#: ../../library/codecs.rst:1121 ../../library/codecs.rst:1123 +#: ../../library/codecs.rst:1182 msgid "Traditional Chinese" msgstr "" +#: ../../library/codecs.rst:1123 msgid "big5hkscs" msgstr "" +#: ../../library/codecs.rst:1123 msgid "big5-hkscs, hkscs" msgstr "" +#: ../../library/codecs.rst:1125 msgid "cp037" msgstr "" +#: ../../library/codecs.rst:1125 msgid "IBM037, IBM039" msgstr "" +#: ../../library/codecs.rst:1127 msgid "cp273" msgstr "" +#: ../../library/codecs.rst:1127 msgid "273, IBM273, csIBM273" msgstr "" +#: ../../library/codecs.rst:1127 msgid "German" msgstr "" +#: ../../library/codecs.rst:1131 msgid "cp424" msgstr "" +#: ../../library/codecs.rst:1131 msgid "EBCDIC-CP-HE, IBM424" msgstr "" +#: ../../library/codecs.rst:1131 ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1161 ../../library/codecs.rst:1205 +#: ../../library/codecs.rst:1268 msgid "Hebrew" msgstr "" +#: ../../library/codecs.rst:1133 msgid "cp437" msgstr "" +#: ../../library/codecs.rst:1133 msgid "437, IBM437" msgstr "" +#: ../../library/codecs.rst:1135 msgid "cp500" msgstr "" +#: ../../library/codecs.rst:1135 msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "" +#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1155 ../../library/codecs.rst:1192 +#: ../../library/codecs.rst:1199 ../../library/codecs.rst:1252 +#: ../../library/codecs.rst:1280 ../../library/codecs.rst:1308 msgid "Western Europe" msgstr "" +#: ../../library/codecs.rst:1138 msgid "cp720" msgstr "" +#: ../../library/codecs.rst:1138 ../../library/codecs.rst:1165 +#: ../../library/codecs.rst:1207 ../../library/codecs.rst:1264 msgid "Arabic" msgstr "" +#: ../../library/codecs.rst:1140 msgid "cp737" msgstr "" +#: ../../library/codecs.rst:1140 ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1175 ../../library/codecs.rst:1201 +#: ../../library/codecs.rst:1266 ../../library/codecs.rst:1301 msgid "Greek" msgstr "" +#: ../../library/codecs.rst:1142 msgid "cp775" msgstr "" +#: ../../library/codecs.rst:1142 msgid "IBM775" msgstr "" +#: ../../library/codecs.rst:1142 ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1276 msgid "Baltic languages" msgstr "" +#: ../../library/codecs.rst:1144 msgid "cp850" msgstr "" +#: ../../library/codecs.rst:1144 msgid "850, IBM850" msgstr "" +#: ../../library/codecs.rst:1146 msgid "cp852" msgstr "" +#: ../../library/codecs.rst:1146 msgid "852, IBM852" msgstr "" +#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1255 ../../library/codecs.rst:1305 msgid "Central and Eastern Europe" msgstr "" +#: ../../library/codecs.rst:1148 msgid "cp855" msgstr "" +#: ../../library/codecs.rst:1148 msgid "855, IBM855" msgstr "" +#: ../../library/codecs.rst:1148 ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1261 ../../library/codecs.rst:1298 msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" +#: ../../library/codecs.rst:1151 msgid "cp856" msgstr "" +#: ../../library/codecs.rst:1153 msgid "cp857" msgstr "" +#: ../../library/codecs.rst:1153 msgid "857, IBM857" msgstr "" +#: ../../library/codecs.rst:1153 ../../library/codecs.rst:1186 +#: ../../library/codecs.rst:1203 ../../library/codecs.rst:1270 +#: ../../library/codecs.rst:1310 msgid "Turkish" msgstr "" +#: ../../library/codecs.rst:1155 msgid "cp858" msgstr "" +#: ../../library/codecs.rst:1155 msgid "858, IBM00858" msgstr "" +#: ../../library/codecs.rst:1157 msgid "cp860" msgstr "" +#: ../../library/codecs.rst:1157 msgid "860, IBM860" msgstr "" +#: ../../library/codecs.rst:1157 msgid "Portuguese" msgstr "" +#: ../../library/codecs.rst:1159 msgid "cp861" msgstr "" +#: ../../library/codecs.rst:1159 msgid "861, CP-IS, IBM861" msgstr "" +#: ../../library/codecs.rst:1159 ../../library/codecs.rst:1303 msgid "Icelandic" msgstr "" +#: ../../library/codecs.rst:1161 msgid "cp862" msgstr "" +#: ../../library/codecs.rst:1161 msgid "862, IBM862" msgstr "" +#: ../../library/codecs.rst:1163 msgid "cp863" msgstr "" +#: ../../library/codecs.rst:1163 msgid "863, IBM863" msgstr "" +#: ../../library/codecs.rst:1163 msgid "Canadian" msgstr "" +#: ../../library/codecs.rst:1165 msgid "cp864" msgstr "" +#: ../../library/codecs.rst:1165 msgid "IBM864" msgstr "" +#: ../../library/codecs.rst:1167 msgid "cp865" msgstr "" +#: ../../library/codecs.rst:1167 msgid "865, IBM865" msgstr "" +#: ../../library/codecs.rst:1167 msgid "Danish, Norwegian" msgstr "" +#: ../../library/codecs.rst:1169 msgid "cp866" msgstr "" +#: ../../library/codecs.rst:1169 msgid "866, IBM866" msgstr "" +#: ../../library/codecs.rst:1169 ../../library/codecs.rst:1286 msgid "Russian" msgstr "" +#: ../../library/codecs.rst:1171 msgid "cp869" msgstr "" +#: ../../library/codecs.rst:1171 msgid "869, CP-GR, IBM869" msgstr "" +#: ../../library/codecs.rst:1173 msgid "cp874" msgstr "" +#: ../../library/codecs.rst:1173 msgid "Thai" msgstr "" +#: ../../library/codecs.rst:1175 msgid "cp875" msgstr "" +#: ../../library/codecs.rst:1177 msgid "cp932" msgstr "" +#: ../../library/codecs.rst:1177 msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "" +#: ../../library/codecs.rst:1177 ../../library/codecs.rst:1213 +#: ../../library/codecs.rst:1215 ../../library/codecs.rst:1217 +#: ../../library/codecs.rst:1234 ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1242 ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1247 ../../library/codecs.rst:1315 +#: ../../library/codecs.rst:1318 ../../library/codecs.rst:1321 msgid "Japanese" msgstr "" +#: ../../library/codecs.rst:1180 msgid "cp949" msgstr "" +#: ../../library/codecs.rst:1180 msgid "949, ms949, uhc" msgstr "" +#: ../../library/codecs.rst:1180 ../../library/codecs.rst:1219 +#: ../../library/codecs.rst:1249 ../../library/codecs.rst:1284 msgid "Korean" msgstr "" +#: ../../library/codecs.rst:1182 msgid "cp950" msgstr "" +#: ../../library/codecs.rst:1182 msgid "950, ms950" msgstr "" +#: ../../library/codecs.rst:1184 msgid "cp1006" msgstr "" +#: ../../library/codecs.rst:1184 msgid "Urdu" msgstr "" +#: ../../library/codecs.rst:1186 msgid "cp1026" msgstr "" +#: ../../library/codecs.rst:1186 msgid "ibm1026" msgstr "" +#: ../../library/codecs.rst:1188 msgid "cp1125" msgstr "" +#: ../../library/codecs.rst:1188 msgid "1125, ibm1125, cp866u, ruscii" msgstr "" +#: ../../library/codecs.rst:1188 ../../library/codecs.rst:1292 msgid "Ukrainian" msgstr "" +#: ../../library/codecs.rst:1192 msgid "cp1140" msgstr "" +#: ../../library/codecs.rst:1192 msgid "IBM01140" msgstr "" +#: ../../library/codecs.rst:1194 msgid "cp1250" msgstr "" +#: ../../library/codecs.rst:1194 msgid "windows-1250" msgstr "" +#: ../../library/codecs.rst:1196 msgid "cp1251" msgstr "" +#: ../../library/codecs.rst:1196 msgid "windows-1251" msgstr "" +#: ../../library/codecs.rst:1199 msgid "cp1252" msgstr "" +#: ../../library/codecs.rst:1199 msgid "windows-1252" msgstr "" +#: ../../library/codecs.rst:1201 msgid "cp1253" msgstr "" +#: ../../library/codecs.rst:1201 msgid "windows-1253" msgstr "" +#: ../../library/codecs.rst:1203 msgid "cp1254" msgstr "" +#: ../../library/codecs.rst:1203 msgid "windows-1254" msgstr "" +#: ../../library/codecs.rst:1205 msgid "cp1255" msgstr "" +#: ../../library/codecs.rst:1205 msgid "windows-1255" msgstr "" +#: ../../library/codecs.rst:1207 msgid "cp1256" msgstr "" +#: ../../library/codecs.rst:1207 msgid "windows-1256" msgstr "" +#: ../../library/codecs.rst:1209 msgid "cp1257" msgstr "" +#: ../../library/codecs.rst:1209 msgid "windows-1257" msgstr "" +#: ../../library/codecs.rst:1211 msgid "cp1258" msgstr "" +#: ../../library/codecs.rst:1211 msgid "windows-1258" msgstr "" +#: ../../library/codecs.rst:1211 msgid "Vietnamese" msgstr "" +#: ../../library/codecs.rst:1213 msgid "euc_jp" msgstr "" +#: ../../library/codecs.rst:1213 msgid "eucjp, ujis, u-jis" msgstr "" +#: ../../library/codecs.rst:1215 msgid "euc_jis_2004" msgstr "" +#: ../../library/codecs.rst:1215 msgid "jisx0213, eucjis2004" msgstr "" +#: ../../library/codecs.rst:1217 msgid "euc_jisx0213" msgstr "" +#: ../../library/codecs.rst:1217 msgid "eucjisx0213" msgstr "" +#: ../../library/codecs.rst:1219 msgid "euc_kr" msgstr "" +#: ../../library/codecs.rst:1219 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "" +#: ../../library/codecs.rst:1223 msgid "gb2312" msgstr "" -msgid "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, gb2312-80, iso-ir-58" +#: ../../library/codecs.rst:1223 +msgid "" +"chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " +"gb2312-80, iso-ir-58" msgstr "" +#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1232 msgid "Simplified Chinese" msgstr "" +#: ../../library/codecs.rst:1228 msgid "gbk" msgstr "" +#: ../../library/codecs.rst:1228 msgid "936, cp936, ms936" msgstr "" +#: ../../library/codecs.rst:1228 ../../library/codecs.rst:1230 msgid "Unified Chinese" msgstr "" +#: ../../library/codecs.rst:1230 msgid "gb18030" msgstr "" +#: ../../library/codecs.rst:1230 msgid "gb18030-2000" msgstr "" +#: ../../library/codecs.rst:1232 msgid "hz" msgstr "" +#: ../../library/codecs.rst:1232 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "" +#: ../../library/codecs.rst:1234 msgid "iso2022_jp" msgstr "" +#: ../../library/codecs.rst:1234 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "" +#: ../../library/codecs.rst:1237 msgid "iso2022_jp_1" msgstr "" +#: ../../library/codecs.rst:1237 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "" +#: ../../library/codecs.rst:1239 msgid "iso2022_jp_2" msgstr "" +#: ../../library/codecs.rst:1239 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "" +#: ../../library/codecs.rst:1239 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" +#: ../../library/codecs.rst:1242 msgid "iso2022_jp_2004" msgstr "" +#: ../../library/codecs.rst:1242 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "" +#: ../../library/codecs.rst:1245 msgid "iso2022_jp_3" msgstr "" +#: ../../library/codecs.rst:1245 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "" +#: ../../library/codecs.rst:1247 msgid "iso2022_jp_ext" msgstr "" +#: ../../library/codecs.rst:1247 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "" +#: ../../library/codecs.rst:1249 msgid "iso2022_kr" msgstr "" +#: ../../library/codecs.rst:1249 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "" +#: ../../library/codecs.rst:1252 msgid "latin_1" msgstr "" +#: ../../library/codecs.rst:1252 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "" +#: ../../library/codecs.rst:1255 msgid "iso8859_2" msgstr "" +#: ../../library/codecs.rst:1255 msgid "iso-8859-2, latin2, L2" msgstr "" +#: ../../library/codecs.rst:1257 msgid "iso8859_3" msgstr "" +#: ../../library/codecs.rst:1257 msgid "iso-8859-3, latin3, L3" msgstr "" +#: ../../library/codecs.rst:1257 msgid "Esperanto, Maltese" msgstr "" +#: ../../library/codecs.rst:1259 msgid "iso8859_4" msgstr "" +#: ../../library/codecs.rst:1259 msgid "iso-8859-4, latin4, L4" msgstr "" +#: ../../library/codecs.rst:1259 msgid "Northern Europe" msgstr "" +#: ../../library/codecs.rst:1261 msgid "iso8859_5" msgstr "" +#: ../../library/codecs.rst:1261 msgid "iso-8859-5, cyrillic" msgstr "" +#: ../../library/codecs.rst:1264 msgid "iso8859_6" msgstr "" +#: ../../library/codecs.rst:1264 msgid "iso-8859-6, arabic" msgstr "" +#: ../../library/codecs.rst:1266 msgid "iso8859_7" msgstr "" +#: ../../library/codecs.rst:1266 msgid "iso-8859-7, greek, greek8" msgstr "" +#: ../../library/codecs.rst:1268 msgid "iso8859_8" msgstr "" +#: ../../library/codecs.rst:1268 msgid "iso-8859-8, hebrew" msgstr "" +#: ../../library/codecs.rst:1270 msgid "iso8859_9" msgstr "" +#: ../../library/codecs.rst:1270 msgid "iso-8859-9, latin5, L5" msgstr "" +#: ../../library/codecs.rst:1272 msgid "iso8859_10" msgstr "" +#: ../../library/codecs.rst:1272 msgid "iso-8859-10, latin6, L6" msgstr "" +#: ../../library/codecs.rst:1272 msgid "Nordic languages" msgstr "" +#: ../../library/codecs.rst:1274 msgid "iso8859_11" msgstr "" +#: ../../library/codecs.rst:1274 msgid "iso-8859-11, thai" msgstr "" +#: ../../library/codecs.rst:1274 msgid "Thai languages" msgstr "" +#: ../../library/codecs.rst:1276 msgid "iso8859_13" msgstr "" +#: ../../library/codecs.rst:1276 msgid "iso-8859-13, latin7, L7" msgstr "" +#: ../../library/codecs.rst:1278 msgid "iso8859_14" msgstr "" +#: ../../library/codecs.rst:1278 msgid "iso-8859-14, latin8, L8" msgstr "" +#: ../../library/codecs.rst:1278 msgid "Celtic languages" msgstr "" +#: ../../library/codecs.rst:1280 msgid "iso8859_15" msgstr "" +#: ../../library/codecs.rst:1280 msgid "iso-8859-15, latin9, L9" msgstr "" +#: ../../library/codecs.rst:1282 msgid "iso8859_16" msgstr "" +#: ../../library/codecs.rst:1282 msgid "iso-8859-16, latin10, L10" msgstr "" +#: ../../library/codecs.rst:1282 msgid "South-Eastern Europe" msgstr "" +#: ../../library/codecs.rst:1284 msgid "johab" msgstr "" +#: ../../library/codecs.rst:1284 msgid "cp1361, ms1361" msgstr "" +#: ../../library/codecs.rst:1286 msgid "koi8_r" msgstr "" +#: ../../library/codecs.rst:1288 msgid "koi8_t" msgstr "" +#: ../../library/codecs.rst:1288 msgid "Tajik" msgstr "" +#: ../../library/codecs.rst:1292 msgid "koi8_u" msgstr "" +#: ../../library/codecs.rst:1294 msgid "kz1048" msgstr "" +#: ../../library/codecs.rst:1294 msgid "kz_1048, strk1048_2002, rk1048" msgstr "" +#: ../../library/codecs.rst:1294 ../../library/codecs.rst:1312 msgid "Kazakh" msgstr "" +#: ../../library/codecs.rst:1298 msgid "mac_cyrillic" msgstr "" +#: ../../library/codecs.rst:1298 msgid "maccyrillic" msgstr "" +#: ../../library/codecs.rst:1301 msgid "mac_greek" msgstr "" +#: ../../library/codecs.rst:1301 msgid "macgreek" msgstr "" +#: ../../library/codecs.rst:1303 msgid "mac_iceland" msgstr "" +#: ../../library/codecs.rst:1303 msgid "maciceland" msgstr "" +#: ../../library/codecs.rst:1305 msgid "mac_latin2" msgstr "" +#: ../../library/codecs.rst:1305 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "" +#: ../../library/codecs.rst:1308 msgid "mac_roman" msgstr "" +#: ../../library/codecs.rst:1308 msgid "macroman, macintosh" msgstr "" +#: ../../library/codecs.rst:1310 msgid "mac_turkish" msgstr "" +#: ../../library/codecs.rst:1310 msgid "macturkish" msgstr "" +#: ../../library/codecs.rst:1312 msgid "ptcp154" msgstr "" +#: ../../library/codecs.rst:1312 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "" +#: ../../library/codecs.rst:1315 msgid "shift_jis" msgstr "" +#: ../../library/codecs.rst:1315 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "" +#: ../../library/codecs.rst:1318 msgid "shift_jis_2004" msgstr "" +#: ../../library/codecs.rst:1318 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "" +#: ../../library/codecs.rst:1321 msgid "shift_jisx0213" msgstr "" +#: ../../library/codecs.rst:1321 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "" +#: ../../library/codecs.rst:1324 msgid "utf_32" msgstr "" +#: ../../library/codecs.rst:1324 msgid "U32, utf32" msgstr "" +#: ../../library/codecs.rst:1324 ../../library/codecs.rst:1326 +#: ../../library/codecs.rst:1328 ../../library/codecs.rst:1330 +#: ../../library/codecs.rst:1332 ../../library/codecs.rst:1334 +#: ../../library/codecs.rst:1336 ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1340 msgid "all languages" msgstr "" +#: ../../library/codecs.rst:1326 msgid "utf_32_be" msgstr "" +#: ../../library/codecs.rst:1326 msgid "UTF-32BE" msgstr "" +#: ../../library/codecs.rst:1328 msgid "utf_32_le" msgstr "" +#: ../../library/codecs.rst:1328 msgid "UTF-32LE" msgstr "" +#: ../../library/codecs.rst:1330 msgid "utf_16" msgstr "" +#: ../../library/codecs.rst:1330 msgid "U16, utf16" msgstr "" +#: ../../library/codecs.rst:1332 msgid "utf_16_be" msgstr "" +#: ../../library/codecs.rst:1332 msgid "UTF-16BE" msgstr "" +#: ../../library/codecs.rst:1334 msgid "utf_16_le" msgstr "" +#: ../../library/codecs.rst:1334 msgid "UTF-16LE" msgstr "" +#: ../../library/codecs.rst:1336 msgid "utf_7" msgstr "" +#: ../../library/codecs.rst:1336 msgid "U7, unicode-1-1-utf-7" msgstr "" +#: ../../library/codecs.rst:1338 msgid "utf_8" msgstr "" +#: ../../library/codecs.rst:1338 msgid "U8, UTF, utf8, cp65001" msgstr "" +#: ../../library/codecs.rst:1340 msgid "utf_8_sig" msgstr "" -msgid "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points (``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer decode byte sequences that correspond to surrogate code points." +#: ../../library/codecs.rst:1343 +msgid "" +"The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " +"(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " +"decode byte sequences that correspond to surrogate code points." msgstr "" +#: ../../library/codecs.rst:1349 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "" +#: ../../library/codecs.rst:1352 msgid "On Windows, ``cpXXX`` codecs are now available for all code pages." msgstr "" +#: ../../library/codecs.rst:1357 msgid "Python Specific Encodings" msgstr "" -msgid "A number of predefined codecs are specific to Python, so their codec names have no meaning outside Python. These are listed in the tables below based on the expected input and output types (note that while text encodings are the most common use case for codecs, the underlying codec infrastructure supports arbitrary data transforms rather than just text encodings). For asymmetric codecs, the stated meaning describes the encoding direction." +#: ../../library/codecs.rst:1359 +msgid "" +"A number of predefined codecs are specific to Python, so their codec names " +"have no meaning outside Python. These are listed in the tables below based " +"on the expected input and output types (note that while text encodings are " +"the most common use case for codecs, the underlying codec infrastructure " +"supports arbitrary data transforms rather than just text encodings). For " +"asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" +#: ../../library/codecs.rst:1367 msgid "Text Encodings" msgstr "" -msgid "The following codecs provide :class:`str` to :class:`bytes` encoding and :term:`bytes-like object` to :class:`str` decoding, similar to the Unicode text encodings." +#: ../../library/codecs.rst:1369 +msgid "" +"The following codecs provide :class:`str` to :class:`bytes` encoding " +"and :term:`bytes-like object` to :class:`str` decoding, similar to the " +"Unicode text encodings." msgstr "" +#: ../../library/codecs.rst:1378 msgid "idna" msgstr "" -msgid "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only ``errors='strict'`` is supported." +#: ../../library/codecs.rst:1378 +msgid "" +"Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " +"``errors='strict'`` is supported." msgstr "" +#: ../../library/codecs.rst:1384 msgid "mbcs" msgstr "" +#: ../../library/codecs.rst:1384 msgid "ansi, dbcs" msgstr "" -msgid "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." +#: ../../library/codecs.rst:1384 +msgid "" +"Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" +#: ../../library/codecs.rst:1388 msgid "oem" msgstr "" -msgid "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." +#: ../../library/codecs.rst:1388 +msgid "" +"Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" +#: ../../library/codecs.rst:1394 msgid "palmos" msgstr "" +#: ../../library/codecs.rst:1394 msgid "Encoding of PalmOS 3.5." msgstr "" +#: ../../library/codecs.rst:1396 msgid "punycode" msgstr "" +#: ../../library/codecs.rst:1396 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" +#: ../../library/codecs.rst:1402 +msgid "" +"The decoding and encoding algorithms scale poorly, so limit the length of " +"untrusted input." +msgstr "" + +#: ../../library/codecs.rst:1408 msgid "raw_unicode_escape" msgstr "" -msgid "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for other code points. Existing backslashes are not escaped in any way. It is used in the Python pickle protocol." +#: ../../library/codecs.rst:1408 +msgid "" +"Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " +"other code points. Existing backslashes are not escaped in any way. It is " +"used in the Python pickle protocol." msgstr "" +#: ../../library/codecs.rst:1418 msgid "undefined" msgstr "" +#: ../../library/codecs.rst:1418 msgid "This Codec should only be used for testing purposes." msgstr "" -msgid "Raise an exception for all conversions, even empty strings. The error handler is ignored." +#: ../../library/codecs.rst:1422 +msgid "" +"Raise an exception for all conversions, even empty strings. The error " +"handler is ignored." msgstr "" +#: ../../library/codecs.rst:1427 msgid "unicode_escape" msgstr "" -msgid "Encoding suitable as the contents of a Unicode literal in ASCII-encoded Python source code, except that quotes are not escaped. Decode from Latin-1 source code. Beware that Python source code actually uses UTF-8 by default." +#: ../../library/codecs.rst:1427 +msgid "" +"Encoding suitable as the contents of a Unicode literal in ASCII-encoded " +"Python source code, except that quotes are not escaped. Decode from Latin-1 " +"source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" +#: ../../library/codecs.rst:1439 msgid "\"unicode_internal\" codec is removed." msgstr "" +#: ../../library/codecs.rst:1446 msgid "Binary Transforms" msgstr "" -msgid "The following codecs provide binary transforms: :term:`bytes-like object` to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` (which only produces :class:`str` output)." +#: ../../library/codecs.rst:1448 +msgid "" +"The following codecs provide binary transforms: :term:`bytes-like object` " +"to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " +"(which only produces :class:`str` output)." msgstr "" +#: ../../library/codecs.rst:1456 msgid "Encoder / decoder" msgstr "" +#: ../../library/codecs.rst:1458 msgid "base64_codec [#b64]_" msgstr "" +#: ../../library/codecs.rst:1458 msgid "base64, base_64" msgstr "" -msgid "Convert the operand to multiline MIME base64 (the result always includes a trailing ``'\\n'``)." +#: ../../library/codecs.rst:1458 +msgid "" +"Convert the operand to multiline MIME base64 (the result always includes a " +"trailing ``'\\n'``)." msgstr "" -msgid "accepts any :term:`bytes-like object` as input for encoding and decoding" +#: ../../library/codecs.rst:1463 +msgid "" +"accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" +#: ../../library/codecs.rst:1458 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr "" +#: ../../library/codecs.rst:1469 msgid "bz2_codec" msgstr "" +#: ../../library/codecs.rst:1469 msgid "bz2" msgstr "" +#: ../../library/codecs.rst:1469 msgid "Compress the operand using bz2." msgstr "" +#: ../../library/codecs.rst:1469 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr "" +#: ../../library/codecs.rst:1472 msgid "hex_codec" msgstr "" +#: ../../library/codecs.rst:1472 msgid "hex" msgstr "" -msgid "Convert the operand to hexadecimal representation, with two digits per byte." +#: ../../library/codecs.rst:1472 +msgid "" +"Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" +#: ../../library/codecs.rst:1472 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr "" +#: ../../library/codecs.rst:1477 msgid "quopri_codec" msgstr "" +#: ../../library/codecs.rst:1477 msgid "quopri, quotedprintable, quoted_printable" msgstr "" +#: ../../library/codecs.rst:1477 msgid "Convert the operand to MIME quoted printable." msgstr "" +#: ../../library/codecs.rst:1477 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr "" +#: ../../library/codecs.rst:1481 msgid "uu_codec" msgstr "" +#: ../../library/codecs.rst:1481 msgid "uu" msgstr "" +#: ../../library/codecs.rst:1481 msgid "Convert the operand using uuencode." msgstr "" +#: ../../library/codecs.rst:1484 msgid "zlib_codec" msgstr "" +#: ../../library/codecs.rst:1484 msgid "zip, zlib" msgstr "" +#: ../../library/codecs.rst:1484 msgid "Compress the operand using gzip." msgstr "" +#: ../../library/codecs.rst:1484 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr "" -msgid "In addition to :term:`bytes-like objects `, ``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for decoding" +#: ../../library/codecs.rst:1488 +msgid "" +"In addition to :term:`bytes-like objects `, " +"``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " +"decoding" msgstr "" +#: ../../library/codecs.rst:1492 msgid "Restoration of the binary transforms." msgstr "" +#: ../../library/codecs.rst:1495 msgid "Restoration of the aliases for the binary transforms." msgstr "" +#: ../../library/codecs.rst:1502 msgid "Standalone Codec Functions" msgstr "" -msgid "The following functions provide encoding and decoding functionality similar to codecs, but are not available as named codecs through :func:`codecs.encode` or :func:`codecs.decode`. They are used internally (for example, by :mod:`pickle`) and behave similarly to the ``string_escape`` codec that was removed in Python 3." +#: ../../library/codecs.rst:1504 +msgid "" +"The following functions provide encoding and decoding functionality similar " +"to codecs, but are not available as named codecs " +"through :func:`codecs.encode` or :func:`codecs.decode`. They are used " +"internally (for example, by :mod:`pickle`) and behave similarly to the " +"``string_escape`` codec that was removed in Python 3." msgstr "" -msgid "Encode *input* using escape sequences. Similar to how :func:`repr` on bytes produces escaped byte values." +#: ../../library/codecs.rst:1511 +msgid "" +"Encode *input* using escape sequences. Similar to how :func:`repr` on bytes " +"produces escaped byte values." msgstr "" +#: ../../library/codecs.rst:1514 msgid "*input* must be a :class:`bytes` object." msgstr "" -msgid "Returns a tuple ``(output, length)`` where *output* is a :class:`bytes` object and *length* is the number of bytes consumed." +#: ../../library/codecs.rst:1516 ../../library/codecs.rst:1525 +msgid "" +"Returns a tuple ``(output, length)`` where *output* is a :class:`bytes` " +"object and *length* is the number of bytes consumed." msgstr "" +#: ../../library/codecs.rst:1521 msgid "Decode *input* from escape sequences back to the original bytes." msgstr "" +#: ../../library/codecs.rst:1523 msgid "*input* must be a :term:`bytes-like object`." msgstr "" +#: ../../library/codecs.rst:1532 msgid "Text Transforms" msgstr "" -msgid "The following codec provides a text transform: a :class:`str` to :class:`str` mapping. It is not supported by :meth:`str.encode` (which only produces :class:`bytes` output)." +#: ../../library/codecs.rst:1534 +msgid "" +"The following codec provides a text transform: a :class:`str` " +"to :class:`str` mapping. It is not supported by :meth:`str.encode` (which " +"only produces :class:`bytes` output)." msgstr "" +#: ../../library/codecs.rst:1543 msgid "rot_13" msgstr "" +#: ../../library/codecs.rst:1543 msgid "rot13" msgstr "" +#: ../../library/codecs.rst:1543 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" +#: ../../library/codecs.rst:1548 msgid "Restoration of the ``rot_13`` text transform." msgstr "" +#: ../../library/codecs.rst:1551 msgid "Restoration of the ``rot13`` alias." msgstr "" +#: ../../library/codecs.rst:1556 msgid ":mod:`!encodings` --- Encodings package" msgstr "" +#: ../../library/codecs.rst:1561 msgid "This module implements the following functions:" msgstr "" +#: ../../library/codecs.rst:1565 msgid "Normalize encoding name *encoding*." msgstr "" -msgid "Normalization works as follows: all non-alphanumeric characters except the dot used for Python package names are collapsed and replaced with a single underscore, leading and trailing underscores are removed. For example, ``' -;#'`` becomes ``'_'``." +#: ../../library/codecs.rst:1567 +msgid "" +"Normalization works as follows: all non-alphanumeric characters except the " +"dot used for Python package names are collapsed and replaced with a single " +"underscore, leading and trailing underscores are removed. For example, ``' " +"-;#'`` becomes ``'_'``." msgstr "" +#: ../../library/codecs.rst:1572 msgid "Note that *encoding* should be ASCII only." msgstr "" -msgid "The following functions should not be used directly, except for testing purposes; :func:`codecs.lookup` should be used instead." +#: ../../library/codecs.rst:1576 +msgid "" +"The following functions should not be used directly, except for testing " +"purposes; :func:`codecs.lookup` should be used instead." msgstr "" -msgid "Search for the codec module corresponding to the given encoding name *encoding*." +#: ../../library/codecs.rst:1582 +msgid "" +"Search for the codec module corresponding to the given encoding name " +"*encoding*." msgstr "" -msgid "This function first normalizes the *encoding* using :func:`normalize_encoding`, then looks for a corresponding alias. It attempts to import a codec module from the encodings package using either the alias or the normalized name. If the module is found and defines a valid ``getregentry()`` function that returns a :class:`codecs.CodecInfo` object, the codec is cached and returned." +#: ../../library/codecs.rst:1585 +msgid "" +"This function first normalizes the *encoding* " +"using :func:`normalize_encoding`, then looks for a corresponding alias. It " +"attempts to import a codec module from the encodings package using either " +"the alias or the normalized name. If the module is found and defines a valid " +"``getregentry()`` function that returns a :class:`codecs.CodecInfo` object, " +"the codec is cached and returned." msgstr "" -msgid "If the codec module defines a ``getaliases()`` function any returned aliases are registered for future use." +#: ../../library/codecs.rst:1592 +msgid "" +"If the codec module defines a ``getaliases()`` function any returned aliases " +"are registered for future use." msgstr "" -msgid "Search for a Windows code page encoding *encoding* of the form ``cpXXXX``." +#: ../../library/codecs.rst:1598 +msgid "" +"Search for a Windows code page encoding *encoding* of the form ``cpXXXX``." msgstr "" -msgid "If the code page is valid and supported, return a :class:`codecs.CodecInfo` object for it." +#: ../../library/codecs.rst:1600 +msgid "" +"If the code page is valid and supported, return a :class:`codecs.CodecInfo` " +"object for it." msgstr "" +#: ../../library/codecs.rst:1603 ../../library/codecs.rst:1689 msgid "Availability" msgstr "" +#: ../../library/codecs.rst:1608 msgid "This module implements the following exception:" msgstr "" +#: ../../library/codecs.rst:1612 msgid "Raised when a codec is invalid or incompatible." msgstr "" -msgid ":mod:`!encodings.idna` --- Internationalized Domain Names in Applications" -msgstr "" - -msgid "This module implements :rfc:`3490` (Internationalized Domain Names in Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)). It builds upon the ``punycode`` encoding and :mod:`stringprep`." -msgstr "" - -msgid "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the third-party :pypi:`idna` module." +#: ../../library/codecs.rst:1616 +msgid "" +":mod:`!encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -msgid "These RFCs together define a protocol to support non-ASCII characters in domain names. A domain name containing non-ASCII characters (such as ``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding (ACE, such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the domain name is then used in all places where arbitrary characters are not allowed by the protocol, such as DNS queries, HTTP :mailheader:`Host` fields, and so on. This conversion is carried out in the application; if possible invisible to the user: The application should transparently convert Unicode domain labels to IDNA on the wire, and convert back ACE labels to Unicode before presenting them to the user." +#: ../../library/codecs.rst:1622 +msgid "" +"This module implements :rfc:`3490` (Internationalized Domain Names in " +"Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " +"Internationalized Domain Names (IDN)). It builds upon the ``punycode`` " +"encoding and :mod:`stringprep`." msgstr "" -msgid "Python supports this conversion in several ways: the ``idna`` codec performs conversion between Unicode and ACE, separating an input string into labels based on the separator characters defined in :rfc:`section 3.1 of RFC 3490 <3490#section-3.1>` and converting each label to ACE as required, and conversely separating an input byte string into labels based on the ``.`` separator and converting any ACE labels found into unicode. Furthermore, the :mod:`socket` module transparently converts Unicode host names to ACE, so that applications need not be concerned about converting host names themselves when they pass them to the socket module. On top of that, modules that have host names as function parameters, such as :mod:`http.client` and :mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also transparently sends an IDNA hostname in the :mailheader:`Host` field if it sends that field at all)." +#: ../../library/codecs.rst:1627 +msgid "" +"If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " +"third-party :pypi:`idna` module." msgstr "" -msgid "When receiving host names from the wire (such as in reverse name lookup), no automatic conversion to Unicode is performed: applications wishing to present such host names to the user should decode them to Unicode." +#: ../../library/codecs.rst:1630 +msgid "" +"These RFCs together define a protocol to support non-ASCII characters in " +"domain names. A domain name containing non-ASCII characters (such as " +"``www.Alliancefrançaise.nu``) is converted into an ASCII-compatible encoding " +"(ACE, such as ``www.xn--alliancefranaise-npb.nu``). The ACE form of the " +"domain name is then used in all places where arbitrary characters are not " +"allowed by the protocol, such as DNS queries, HTTP :mailheader:`Host` " +"fields, and so on. This conversion is carried out in the application; if " +"possible invisible to the user: The application should transparently convert " +"Unicode domain labels to IDNA on the wire, and convert back ACE labels to " +"Unicode before presenting them to the user." +msgstr "" + +#: ../../library/codecs.rst:1641 +msgid "" +"Python supports this conversion in several ways: the ``idna`` codec " +"performs conversion between Unicode and ACE, separating an input string into " +"labels based on the separator characters defined in :rfc:`section 3.1 of RFC " +"3490 <3490#section-3.1>` and converting each label to ACE as required, and " +"conversely separating an input byte string into labels based on the ``.`` " +"separator and converting any ACE labels found into unicode. Furthermore, " +"the :mod:`socket` module transparently converts Unicode host names to ACE, " +"so that applications need not be concerned about converting host names " +"themselves when they pass them to the socket module. On top of that, modules " +"that have host names as function parameters, such as :mod:`http.client` " +"and :mod:`ftplib`, accept Unicode host names (:mod:`http.client` then also " +"transparently sends an IDNA hostname in the :mailheader:`Host` field if it " +"sends that field at all)." +msgstr "" + +#: ../../library/codecs.rst:1654 +msgid "" +"When receiving host names from the wire (such as in reverse name lookup), no " +"automatic conversion to Unicode is performed: applications wishing to " +"present such host names to the user should decode them to Unicode." msgstr "" -msgid "The module :mod:`!encodings.idna` also implements the nameprep procedure, which performs certain normalizations on host names, to achieve case-insensitivity of international domain names, and to unify similar characters. The nameprep functions can be used directly if desired." +#: ../../library/codecs.rst:1658 +msgid "" +"The module :mod:`!encodings.idna` also implements the nameprep procedure, " +"which performs certain normalizations on host names, to achieve case-" +"insensitivity of international domain names, and to unify similar " +"characters. The nameprep functions can be used directly if desired." msgstr "" -msgid "Return the nameprepped version of *label*. The implementation currently assumes query strings, so ``AllowUnassigned`` is true." +#: ../../library/codecs.rst:1666 +msgid "" +"Return the nameprepped version of *label*. The implementation currently " +"assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -msgid "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` is assumed to be false." +#: ../../library/codecs.rst:1672 +msgid "" +"Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " +"is assumed to be false." msgstr "" +#: ../../library/codecs.rst:1678 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" +#: ../../library/codecs.rst:1682 msgid ":mod:`!encodings.mbcs` --- Windows ANSI codepage" msgstr "" +#: ../../library/codecs.rst:1687 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "" -msgid "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used to encode, and ``'ignore'`` to decode." +#: ../../library/codecs.rst:1691 +msgid "" +"Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " +"to encode, and ``'ignore'`` to decode." msgstr "" +#: ../../library/codecs.rst:1695 msgid "Support any error handler." msgstr "" +#: ../../library/codecs.rst:1700 msgid ":mod:`!encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -msgid "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful encoder this is only done once (on the first write to the byte stream). On decoding, an optional UTF-8 encoded BOM at the start of the data will be skipped." +#: ../../library/codecs.rst:1706 +msgid "" +"This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " +"encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " +"encoder this is only done once (on the first write to the byte stream). On " +"decoding, an optional UTF-8 encoded BOM at the start of the data will be " +"skipped." msgstr "" +#: ../../library/codecs.rst:13 msgid "Unicode" msgstr "" +#: ../../library/codecs.rst:13 msgid "encode" msgstr "" +#: ../../library/codecs.rst:13 msgid "decode" msgstr "" +#: ../../library/codecs.rst:13 msgid "streams" msgstr "" +#: ../../library/codecs.rst:13 msgid "stackable" msgstr "" +#: ../../library/codecs.rst:338 msgid "strict" msgstr "" +#: ../../library/codecs.rst:338 ../../library/codecs.rst:390 +#: ../../library/codecs.rst:413 msgid "error handler's name" msgstr "" +#: ../../library/codecs.rst:338 msgid "ignore" msgstr "" +#: ../../library/codecs.rst:338 msgid "replace" msgstr "" +#: ../../library/codecs.rst:338 msgid "backslashreplace" msgstr "" +#: ../../library/codecs.rst:338 msgid "surrogateescape" msgstr "" +#: ../../library/codecs.rst:338 msgid "? (question mark)" msgstr "" +#: ../../library/codecs.rst:338 msgid "replacement character" msgstr "" +#: ../../library/codecs.rst:338 msgid "\\ (backslash)" msgstr "" +#: ../../library/codecs.rst:338 ../../library/codecs.rst:390 msgid "escape sequence" msgstr "" +#: ../../library/codecs.rst:338 msgid "\\x" msgstr "" +#: ../../library/codecs.rst:338 msgid "\\u" msgstr "" +#: ../../library/codecs.rst:338 msgid "\\U" msgstr "" +#: ../../library/codecs.rst:390 msgid "xmlcharrefreplace" msgstr "" +#: ../../library/codecs.rst:390 msgid "namereplace" msgstr "" +#: ../../library/codecs.rst:390 msgid "\\N" msgstr "" +#: ../../library/codecs.rst:413 msgid "surrogatepass" msgstr "" diff --git a/library/codeop.po b/library/codeop.po index 699244287..db72a80a5 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,44 +21,96 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/codeop.rst:2 msgid ":mod:`!codeop` --- Compile Python code" msgstr "" +#: ../../library/codeop.rst:10 msgid "**Source code:** :source:`Lib/codeop.py`" msgstr "" -msgid "The :mod:`!codeop` module provides utilities upon which the Python read-eval-print loop can be emulated, as is done in the :mod:`code` module. As a result, you probably don't want to use the module directly; if you want to include such a loop in your program you probably want to use the :mod:`code` module instead." +#: ../../library/codeop.rst:14 +msgid "" +"The :mod:`!codeop` module provides utilities upon which the Python read-eval-" +"print loop can be emulated, as is done in the :mod:`code` module. As a " +"result, you probably don't want to use the module directly; if you want to " +"include such a loop in your program you probably want to use the :mod:`code` " +"module instead." msgstr "" +#: ../../library/codeop.rst:20 msgid "There are two parts to this job:" msgstr "" -msgid "Being able to tell if a line of input completes a Python statement: in short, telling whether to print '``>>>``' or '``...``' next." +#: ../../library/codeop.rst:22 +msgid "" +"Being able to tell if a line of input completes a Python statement: in " +"short, telling whether to print '``>>>``' or '``...``' next." msgstr "" -msgid "Remembering which future statements the user has entered, so subsequent input can be compiled with these in effect." +#: ../../library/codeop.rst:25 +msgid "" +"Remembering which future statements the user has entered, so subsequent " +"input can be compiled with these in effect." msgstr "" -msgid "The :mod:`!codeop` module provides a way of doing each of these things, and a way of doing them both." +#: ../../library/codeop.rst:28 +msgid "" +"The :mod:`!codeop` module provides a way of doing each of these things, and " +"a way of doing them both." msgstr "" +#: ../../library/codeop.rst:31 msgid "To do just the former:" msgstr "" -msgid "Tries to compile *source*, which should be a string of Python code and return a code object if *source* is valid Python code. In that case, the filename attribute of the code object will be *filename*, which defaults to ``''``. Returns ``None`` if *source* is *not* valid Python code, but is a prefix of valid Python code." +#: ../../library/codeop.rst:35 +msgid "" +"Tries to compile *source*, which should be a string of Python code and " +"return a code object if *source* is valid Python code. In that case, the " +"filename attribute of the code object will be *filename*, which defaults to " +"``''``. Returns ``None`` if *source* is *not* valid Python code, but " +"is a prefix of valid Python code." msgstr "" -msgid "If there is a problem with *source*, an exception will be raised. :exc:`SyntaxError` is raised if there is invalid Python syntax, and :exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal." +#: ../../library/codeop.rst:41 +msgid "" +"If there is a problem with *source*, an exception will be " +"raised. :exc:`SyntaxError` is raised if there is invalid Python syntax, " +"and :exc:`OverflowError` or :exc:`ValueError` if there is an invalid literal." msgstr "" -msgid "The *symbol* argument determines whether *source* is compiled as a statement (``'single'``, the default), as a sequence of :term:`statement` (``'exec'``) or as an :term:`expression` (``'eval'``). Any other value will cause :exc:`ValueError` to be raised." +#: ../../library/codeop.rst:45 +msgid "" +"The *symbol* argument determines whether *source* is compiled as a statement " +"(``'single'``, the default), as a sequence of :term:`statement` (``'exec'``) " +"or as an :term:`expression` (``'eval'``). Any other value will " +"cause :exc:`ValueError` to be raised." msgstr "" -msgid "It is possible (but not likely) that the parser stops parsing with a successful outcome before reaching the end of the source; in this case, trailing symbols may be ignored instead of causing an error. For example, a backslash followed by two newlines may be followed by arbitrary garbage. This will be fixed once the API for the parser is better." +#: ../../library/codeop.rst:52 +msgid "" +"It is possible (but not likely) that the parser stops parsing with a " +"successful outcome before reaching the end of the source; in this case, " +"trailing symbols may be ignored instead of causing an error. For example, a " +"backslash followed by two newlines may be followed by arbitrary garbage. " +"This will be fixed once the API for the parser is better." msgstr "" -msgid "Instances of this class have :meth:`~object.__call__` methods identical in signature to the built-in function :func:`compile`, but with the difference that if the instance compiles program text containing a :mod:`__future__` statement, the instance 'remembers' and compiles all subsequent program texts with the statement in force." +#: ../../library/codeop.rst:61 +msgid "" +"Instances of this class have :meth:`~object.__call__` methods identical in " +"signature to the built-in function :func:`compile`, but with the difference " +"that if the instance compiles program text containing a :mod:`__future__` " +"statement, the instance 'remembers' and compiles all subsequent program " +"texts with the statement in force." msgstr "" -msgid "Instances of this class have :meth:`~object.__call__` methods identical in signature to :func:`compile_command`; the difference is that if the instance compiles program text containing a :mod:`__future__` statement, the instance 'remembers' and compiles all subsequent program texts with the statement in force." +#: ../../library/codeop.rst:70 +msgid "" +"Instances of this class have :meth:`~object.__call__` methods identical in " +"signature to :func:`compile_command`; the difference is that if the instance " +"compiles program text containing a :mod:`__future__` statement, the instance " +"'remembers' and compiles all subsequent program texts with the statement in " +"force." msgstr "" diff --git a/library/collections.abc.po b/library/collections.abc.po index 316db3fab..7ad99c51c 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,32 +23,51 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/collections.abc.rst:2 msgid ":mod:`!collections.abc` --- Abstract Base Classes for Containers" msgstr "" +#: ../../library/collections.abc.rst:10 msgid "Formerly, this module was part of the :mod:`collections` module." msgstr "" +#: ../../library/collections.abc.rst:13 msgid "**Source code:** :source:`Lib/_collections_abc.py`" msgstr "" -msgid "This module provides :term:`abstract base classes ` that can be used to test whether a class provides a particular interface; for example, whether it is :term:`hashable` or whether it is a :term:`mapping`." +#: ../../library/collections.abc.rst:23 +msgid "" +"This module provides :term:`abstract base classes ` " +"that can be used to test whether a class provides a particular interface; " +"for example, whether it is :term:`hashable` or whether it is " +"a :term:`mapping`." msgstr "" -msgid "An :func:`issubclass` or :func:`isinstance` test for an interface works in one of three ways." +#: ../../library/collections.abc.rst:27 +msgid "" +"An :func:`issubclass` or :func:`isinstance` test for an interface works in " +"one of three ways." msgstr "" -msgid "A newly written class can inherit directly from one of the abstract base classes. The class must supply the required abstract methods. The remaining mixin methods come from inheritance and can be overridden if desired. Other methods may be added as needed:" +#: ../../library/collections.abc.rst:30 +msgid "" +"A newly written class can inherit directly from one of the abstract base " +"classes. The class must supply the required abstract methods. The " +"remaining mixin methods come from inheritance and can be overridden if " +"desired. Other methods may be added as needed:" msgstr "" +#: ../../library/collections.abc.rst:35 msgid "" "class C(Sequence): # Direct inheritance\n" -" def __init__(self): ... # Extra method not required by the ABC\n" +" def __init__(self): ... # Extra method not required by the " +"ABC\n" " def __getitem__(self, index): ... # Required abstract method\n" " def __len__(self): ... # Required abstract method\n" " def count(self, value): ... # Optionally override a mixin method" msgstr "" +#: ../../library/collections.abc.rst:43 msgid "" ">>> issubclass(C, Sequence)\n" "True\n" @@ -56,12 +75,21 @@ msgid "" "True" msgstr "" -msgid "Existing classes and built-in classes can be registered as \"virtual subclasses\" of the ABCs. Those classes should define the full API including all of the abstract methods and all of the mixin methods. This lets users rely on :func:`issubclass` or :func:`isinstance` tests to determine whether the full interface is supported. The exception to this rule is for methods that are automatically inferred from the rest of the API:" +#: ../../library/collections.abc.rst:50 +msgid "" +"Existing classes and built-in classes can be registered as \"virtual " +"subclasses\" of the ABCs. Those classes should define the full API " +"including all of the abstract methods and all of the mixin methods. This " +"lets users rely on :func:`issubclass` or :func:`isinstance` tests to " +"determine whether the full interface is supported. The exception to this " +"rule is for methods that are automatically inferred from the rest of the API:" msgstr "" +#: ../../library/collections.abc.rst:58 msgid "" "class D: # No inheritance\n" -" def __init__(self): ... # Extra method not required by the ABC\n" +" def __init__(self): ... # Extra method not required by the " +"ABC\n" " def __getitem__(self, index): ... # Abstract method\n" " def __len__(self): ... # Abstract method\n" " def count(self, value): ... # Mixin method\n" @@ -70,6 +98,7 @@ msgid "" "Sequence.register(D) # Register instead of inherit" msgstr "" +#: ../../library/collections.abc.rst:69 msgid "" ">>> issubclass(D, Sequence)\n" "True\n" @@ -77,18 +106,29 @@ msgid "" "True" msgstr "" -msgid "In this example, class :class:`!D` does not need to define ``__contains__``, ``__iter__``, and ``__reversed__`` because the :ref:`in-operator `, the :term:`iteration ` logic, and the :func:`reversed` function automatically fall back to using ``__getitem__`` and ``__len__``." +#: ../../library/collections.abc.rst:76 +msgid "" +"In this example, class :class:`!D` does not need to define ``__contains__``, " +"``__iter__``, and ``__reversed__`` because the :ref:`in-operator " +"`, the :term:`iteration ` logic, and " +"the :func:`reversed` function automatically fall back to using " +"``__getitem__`` and ``__len__``." msgstr "" -msgid "Some simple interfaces are directly recognizable by the presence of the required methods (unless those methods have been set to :const:`None`):" +#: ../../library/collections.abc.rst:82 +msgid "" +"Some simple interfaces are directly recognizable by the presence of the " +"required methods (unless those methods have been set to :const:`None`):" msgstr "" +#: ../../library/collections.abc.rst:85 msgid "" "class E:\n" " def __iter__(self): ...\n" " def __next__(self): ..." msgstr "" +#: ../../library/collections.abc.rst:91 msgid "" ">>> issubclass(E, Iterable)\n" "True\n" @@ -96,369 +136,610 @@ msgid "" "True" msgstr "" -msgid "Complex interfaces do not support this last technique because an interface is more than just the presence of method names. Interfaces specify semantics and relationships between methods that cannot be inferred solely from the presence of specific method names. For example, knowing that a class supplies ``__getitem__``, ``__len__``, and ``__iter__`` is insufficient for distinguishing a :class:`Sequence` from a :class:`Mapping`." +#: ../../library/collections.abc.rst:98 +msgid "" +"Complex interfaces do not support this last technique because an interface " +"is more than just the presence of method names. Interfaces specify " +"semantics and relationships between methods that cannot be inferred solely " +"from the presence of specific method names. For example, knowing that a " +"class supplies ``__getitem__``, ``__len__``, and ``__iter__`` is " +"insufficient for distinguishing a :class:`Sequence` from a :class:`Mapping`." msgstr "" -msgid "These abstract classes now support ``[]``. See :ref:`types-genericalias` and :pep:`585`." +#: ../../library/collections.abc.rst:106 +msgid "" +"These abstract classes now support ``[]``. See :ref:`types-genericalias` " +"and :pep:`585`." msgstr "" +#: ../../library/collections.abc.rst:113 msgid "Collections Abstract Base Classes" msgstr "" -msgid "The collections module offers the following :term:`ABCs `:" +#: ../../library/collections.abc.rst:115 +msgid "" +"The collections module offers the following :term:`ABCs `:" msgstr "" +#: ../../library/collections.abc.rst:120 msgid "ABC" msgstr "" +#: ../../library/collections.abc.rst:120 msgid "Inherits from" msgstr "" +#: ../../library/collections.abc.rst:120 msgid "Abstract Methods" msgstr "" +#: ../../library/collections.abc.rst:120 msgid "Mixin Methods" msgstr "" +#: ../../library/collections.abc.rst:122 msgid ":class:`Container` [1]_" msgstr "" +#: ../../library/collections.abc.rst:122 msgid "``__contains__``" msgstr "" +#: ../../library/collections.abc.rst:123 msgid ":class:`Hashable` [1]_" msgstr "" +#: ../../library/collections.abc.rst:123 msgid "``__hash__``" msgstr "" +#: ../../library/collections.abc.rst:124 msgid ":class:`Iterable` [1]_ [2]_" msgstr "" +#: ../../library/collections.abc.rst:124 ../../library/collections.abc.rst:125 msgid "``__iter__``" msgstr "" +#: ../../library/collections.abc.rst:125 msgid ":class:`Iterator` [1]_" msgstr "" +#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 msgid ":class:`Iterable`" msgstr "" +#: ../../library/collections.abc.rst:125 msgid "``__next__``" msgstr "" +#: ../../library/collections.abc.rst:126 msgid ":class:`Reversible` [1]_" msgstr "" +#: ../../library/collections.abc.rst:126 msgid "``__reversed__``" msgstr "" +#: ../../library/collections.abc.rst:127 msgid ":class:`Generator` [1]_" msgstr "" +#: ../../library/collections.abc.rst:127 msgid ":class:`Iterator`" msgstr "" +#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:176 msgid "``send``, ``throw``" msgstr "" +#: ../../library/collections.abc.rst:127 msgid "``close``, ``__iter__``, ``__next__``" msgstr "" +#: ../../library/collections.abc.rst:128 msgid ":class:`Sized` [1]_" msgstr "" +#: ../../library/collections.abc.rst:128 msgid "``__len__``" msgstr "" +#: ../../library/collections.abc.rst:129 msgid ":class:`Callable` [1]_" msgstr "" +#: ../../library/collections.abc.rst:129 msgid "``__call__``" msgstr "" +#: ../../library/collections.abc.rst:130 msgid ":class:`Collection` [1]_" msgstr "" +#: ../../library/collections.abc.rst:130 msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" msgstr "" +#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:146 msgid "``__contains__``, ``__iter__``, ``__len__``" msgstr "" +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:137 +#: ../../library/collections.abc.rst:143 msgid ":class:`Sequence`" msgstr "" +#: ../../library/collections.abc.rst:134 msgid ":class:`Reversible`, :class:`Collection`" msgstr "" +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:143 msgid "``__getitem__``, ``__len__``" msgstr "" -msgid "``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" +#: ../../library/collections.abc.rst:134 +msgid "" +"``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" msgstr "" +#: ../../library/collections.abc.rst:137 msgid ":class:`MutableSequence`" msgstr "" -msgid "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" +#: ../../library/collections.abc.rst:137 +msgid "" +"``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" msgstr "" -msgid "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, ``extend``, ``pop``, ``remove``, and ``__iadd__``" +#: ../../library/collections.abc.rst:137 +msgid "" +"Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " +"``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" +#: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" msgstr "" +#: ../../library/collections.abc.rst:143 msgid "Inherited :class:`Sequence` methods" msgstr "" +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:151 msgid ":class:`Set`" msgstr "" +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:157 msgid ":class:`Collection`" msgstr "" -msgid "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, ``__rxor__`` and ``isdisjoint``" +#: ../../library/collections.abc.rst:146 +msgid "" +"``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " +"``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " +"``__rxor__`` and ``isdisjoint``" msgstr "" +#: ../../library/collections.abc.rst:151 msgid ":class:`MutableSet`" msgstr "" +#: ../../library/collections.abc.rst:151 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" msgstr "" -msgid "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, ``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" +#: ../../library/collections.abc.rst:151 +msgid "" +"Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " +"``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" +#: ../../library/collections.abc.rst:157 ../../library/collections.abc.rst:161 msgid ":class:`Mapping`" msgstr "" +#: ../../library/collections.abc.rst:157 msgid "``__getitem__``, ``__iter__``, ``__len__``" msgstr "" -msgid "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and ``__ne__``" +#: ../../library/collections.abc.rst:157 +msgid "" +"``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " +"``__ne__``" msgstr "" +#: ../../library/collections.abc.rst:161 msgid ":class:`MutableMapping`" msgstr "" -msgid "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" +#: ../../library/collections.abc.rst:161 +msgid "" +"``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" -msgid "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, ``update``, and ``setdefault``" +#: ../../library/collections.abc.rst:161 +msgid "" +"Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " +"``update``, and ``setdefault``" msgstr "" +#: ../../library/collections.abc.rst:168 msgid ":class:`MappingView`" msgstr "" +#: ../../library/collections.abc.rst:168 msgid ":class:`Sized`" msgstr "" +#: ../../library/collections.abc.rst:168 msgid "``__init__``, ``__len__`` and ``__repr__``" msgstr "" +#: ../../library/collections.abc.rst:169 msgid ":class:`ItemsView`" msgstr "" +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 msgid ":class:`MappingView`, :class:`Set`" msgstr "" +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:173 msgid "``__contains__``, ``__iter__``" msgstr "" +#: ../../library/collections.abc.rst:171 msgid ":class:`KeysView`" msgstr "" +#: ../../library/collections.abc.rst:173 msgid ":class:`ValuesView`" msgstr "" +#: ../../library/collections.abc.rst:173 msgid ":class:`MappingView`, :class:`Collection`" msgstr "" +#: ../../library/collections.abc.rst:175 msgid ":class:`Awaitable` [1]_" msgstr "" +#: ../../library/collections.abc.rst:175 msgid "``__await__``" msgstr "" +#: ../../library/collections.abc.rst:176 msgid ":class:`Coroutine` [1]_" msgstr "" +#: ../../library/collections.abc.rst:176 msgid ":class:`Awaitable`" msgstr "" +#: ../../library/collections.abc.rst:176 msgid "``close``" msgstr "" +#: ../../library/collections.abc.rst:177 msgid ":class:`AsyncIterable` [1]_" msgstr "" +#: ../../library/collections.abc.rst:177 ../../library/collections.abc.rst:178 msgid "``__aiter__``" msgstr "" +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterator` [1]_" msgstr "" +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterable`" msgstr "" +#: ../../library/collections.abc.rst:178 msgid "``__anext__``" msgstr "" +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncGenerator` [1]_" msgstr "" +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncIterator`" msgstr "" +#: ../../library/collections.abc.rst:179 msgid "``asend``, ``athrow``" msgstr "" +#: ../../library/collections.abc.rst:179 msgid "``aclose``, ``__aiter__``, ``__anext__``" msgstr "" +#: ../../library/collections.abc.rst:180 msgid ":class:`Buffer` [1]_" msgstr "" +#: ../../library/collections.abc.rst:180 msgid "``__buffer__``" msgstr "" +#: ../../library/collections.abc.rst:185 msgid "Footnotes" msgstr "" -msgid "These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing an interface by verifying the required methods are present and have not been set to :const:`None`. This only works for simple interfaces. More complex interfaces require registration or direct subclassing." +#: ../../library/collections.abc.rst:186 +msgid "" +"These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing " +"an interface by verifying the required methods are present and have not been " +"set to :const:`None`. This only works for simple interfaces. More complex " +"interfaces require registration or direct subclassing." msgstr "" -msgid "Checking ``isinstance(obj, Iterable)`` detects classes that are registered as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but it does not detect classes that iterate with the :meth:`~object.__getitem__` method. The only reliable way to determine whether an object is :term:`iterable` is to call ``iter(obj)``." +#: ../../library/collections.abc.rst:192 +msgid "" +"Checking ``isinstance(obj, Iterable)`` detects classes that are registered " +"as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " +"it does not detect classes that iterate with the :meth:`~object.__getitem__` " +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" +#: ../../library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" msgstr "" +#: ../../library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." msgstr "" +#: ../../library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." msgstr "" +#: ../../library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." msgstr "" +#: ../../library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." msgstr "" -msgid "See :ref:`annotating-callables` for details on how to use :class:`!Callable` in type annotations." +#: ../../library/collections.abc.rst:219 +msgid "" +"See :ref:`annotating-callables` for details on how to use :class:`!Callable` " +"in type annotations." msgstr "" +#: ../../library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." msgstr "" -msgid "Checking ``isinstance(obj, Iterable)`` detects classes that are registered as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but it does not detect classes that iterate with the :meth:`~object.__getitem__` method. The only reliable way to determine whether an object is :term:`iterable` is to call ``iter(obj)``." +#: ../../library/collections.abc.rst:226 +msgid "" +"Checking ``isinstance(obj, Iterable)`` detects classes that are registered " +"as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " +"it does not detect classes that iterate with the :meth:`~object.__getitem__` " +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" +#: ../../library/collections.abc.rst:235 msgid "ABC for sized iterable container classes." msgstr "" -msgid "ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:`~iterator.__next__` methods. See also the definition of :term:`iterator`." +#: ../../library/collections.abc.rst:241 +msgid "" +"ABC for classes that provide the :meth:`~iterator.__iter__` " +"and :meth:`~iterator.__next__` methods. See also the definition " +"of :term:`iterator`." msgstr "" -msgid "ABC for iterable classes that also provide the :meth:`~object.__reversed__` method." +#: ../../library/collections.abc.rst:247 +msgid "" +"ABC for iterable classes that also provide the :meth:`~object.__reversed__` " +"method." msgstr "" -msgid "ABC for :term:`generator` classes that implement the protocol defined in :pep:`342` that extends :term:`iterators ` with the :meth:`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` methods." +#: ../../library/collections.abc.rst:254 +msgid "" +"ABC for :term:`generator` classes that implement the protocol defined " +"in :pep:`342` that extends :term:`iterators ` with " +"the :meth:`~generator.send`, :meth:`~generator.throw` " +"and :meth:`~generator.close` methods." msgstr "" -msgid "See :ref:`annotating-generators-and-coroutines` for details on using :class:`!Generator` in type annotations." +#: ../../library/collections.abc.rst:259 +msgid "" +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Generator` in type annotations." msgstr "" +#: ../../library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" -msgid "Implementation note: Some of the mixin methods, such as :meth:`~container.__iter__`, :meth:`~object.__reversed__`, and :meth:`~sequence.index` make repeated calls to the underlying :meth:`~object.__getitem__` method. Consequently, if :meth:`~object.__getitem__` is implemented with constant access speed, the mixin methods will have linear performance; however, if the underlying method is linear (as it would be with a linked list), the mixins will have quadratic performance and will likely need to be overridden." +#: ../../library/collections.abc.rst:270 +msgid "" +"Implementation note: Some of the mixin methods, such " +"as :meth:`~container.__iter__`, :meth:`~object.__reversed__`, " +"and :meth:`~sequence.index` make repeated calls to the " +"underlying :meth:`~object.__getitem__` method. Consequently, " +"if :meth:`~object.__getitem__` is implemented with constant access speed, " +"the mixin methods will have linear performance; however, if the underlying " +"method is linear (as it would be with a linked list), the mixins will have " +"quadratic performance and will likely need to be overridden." msgstr "" +#: ../../library/collections.abc.rst:282 msgid "Return first index of *value*." msgstr "" +#: ../../library/collections.abc.rst:284 msgid "Raises :exc:`ValueError` if the value is not present." msgstr "" -msgid "Supporting the *start* and *stop* arguments is optional, but recommended." +#: ../../library/collections.abc.rst:286 +msgid "" +"Supporting the *start* and *stop* arguments is optional, but recommended." msgstr "" -msgid "The :meth:`~sequence.index` method gained support for the *stop* and *start* arguments." +#: ../../library/collections.abc.rst:288 +msgid "" +"The :meth:`~sequence.index` method gained support for the *stop* and *start* " +"arguments." msgstr "" +#: ../../library/collections.abc.rst:292 msgid "The :class:`ByteString` ABC has been deprecated." msgstr "" -msgid "Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` implements the :ref:`buffer protocol ` at runtime. For use in type annotations, either use :class:`Buffer` or a union that explicitly specifies the types your code supports (e.g., ``bytes | bytearray | memoryview``)." +#: ../../library/collections.abc.rst:295 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`Buffer` or a union that explicitly " +"specifies the types your code supports (e.g., ``bytes | bytearray | " +"memoryview``)." msgstr "" -msgid ":class:`!ByteString` was originally intended to be an abstract class that would serve as a supertype of both :class:`bytes` and :class:`bytearray`. However, since the ABC never had any methods, knowing that an object was an instance of :class:`!ByteString` never actually told you anything useful about the object. Other common buffer types such as :class:`memoryview` were also never understood as subtypes of :class:`!ByteString` (either at runtime or by static type checkers)." +#: ../../library/collections.abc.rst:301 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." msgstr "" +#: ../../library/collections.abc.rst:309 msgid "See :pep:`PEP 688 <688#current-options>` for more details." msgstr "" +#: ../../library/collections.abc.rst:314 msgid "ABCs for read-only and mutable :ref:`sets `." msgstr "" +#: ../../library/collections.abc.rst:319 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" -msgid "ABCs for mapping, items, keys, and values :term:`views `." +#: ../../library/collections.abc.rst:326 +msgid "" +"ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -msgid "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` expressions. Custom implementations must provide the :meth:`~object.__await__` method." +#: ../../library/collections.abc.rst:330 +msgid "" +"ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " +"expressions. Custom implementations must provide " +"the :meth:`~object.__await__` method." msgstr "" -msgid ":term:`Coroutine ` objects and instances of the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." +#: ../../library/collections.abc.rst:334 +msgid "" +":term:`Coroutine ` objects and instances of " +"the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -msgid "In CPython, generator-based coroutines (:term:`generators ` decorated with :deco:`types.coroutine`) are *awaitables*, even though they do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:`inspect.isawaitable` to detect them." +#: ../../library/collections.abc.rst:338 +msgid "" +"In CPython, generator-based coroutines (:term:`generators ` " +"decorated with :deco:`types.coroutine`) are *awaitables*, even though they " +"do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, " +"Awaitable)`` for them will return ``False``. Use :func:`inspect.isawaitable` " +"to detect them." msgstr "" -msgid "ABC for :term:`coroutine` compatible classes. These implement the following methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations must also implement :meth:`~object.__await__`. All :class:`Coroutine` instances are also instances of :class:`Awaitable`." +#: ../../library/collections.abc.rst:348 +msgid "" +"ABC for :term:`coroutine` compatible classes. These implement the following " +"methods, defined in :ref:`coroutine-" +"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " +"and :meth:`~coroutine.close`. Custom implementations must also " +"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " +"also instances of :class:`Awaitable`." msgstr "" -msgid "In CPython, generator-based coroutines (:term:`generators ` decorated with :deco:`types.coroutine`) are *awaitables*, even though they do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:`inspect.isawaitable` to detect them." +#: ../../library/collections.abc.rst:356 +msgid "" +"In CPython, generator-based coroutines (:term:`generators ` " +"decorated with :deco:`types.coroutine`) are *awaitables*, even though they " +"do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, " +"Coroutine)`` for them will return ``False``. Use :func:`inspect.isawaitable` " +"to detect them." msgstr "" -msgid "See :ref:`annotating-generators-and-coroutines` for details on using :class:`!Coroutine` in type annotations. The variance and order of type parameters correspond to those of :class:`Generator`." +#: ../../library/collections.abc.rst:362 +msgid "" +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Coroutine` in type annotations. The variance and order of " +"type parameters correspond to those of :class:`Generator`." msgstr "" -msgid "ABC for classes that provide an ``__aiter__`` method. See also the definition of :term:`asynchronous iterable`." +#: ../../library/collections.abc.rst:371 +msgid "" +"ABC for classes that provide an ``__aiter__`` method. See also the " +"definition of :term:`asynchronous iterable`." msgstr "" -msgid "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See also the definition of :term:`asynchronous iterator`." +#: ../../library/collections.abc.rst:378 +msgid "" +"ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " +"also the definition of :term:`asynchronous iterator`." msgstr "" -msgid "ABC for :term:`asynchronous generator` classes that implement the protocol defined in :pep:`525` and :pep:`492`." +#: ../../library/collections.abc.rst:385 +msgid "" +"ABC for :term:`asynchronous generator` classes that implement the protocol " +"defined in :pep:`525` and :pep:`492`." msgstr "" -msgid "See :ref:`annotating-generators-and-coroutines` for details on using :class:`!AsyncGenerator` in type annotations." +#: ../../library/collections.abc.rst:388 +msgid "" +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!AsyncGenerator` in type annotations." msgstr "" -msgid "ABC for classes that provide the :meth:`~object.__buffer__` method, implementing the :ref:`buffer protocol `. See :pep:`688`." +#: ../../library/collections.abc.rst:395 +msgid "" +"ABC for classes that provide the :meth:`~object.__buffer__` method, " +"implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" +#: ../../library/collections.abc.rst:401 msgid "Examples and Recipes" msgstr "" -msgid "ABCs allow us to ask classes or instances if they provide particular functionality, for example::" +#: ../../library/collections.abc.rst:403 +msgid "" +"ABCs allow us to ask classes or instances if they provide particular " +"functionality, for example::" msgstr "" +#: ../../library/collections.abc.rst:406 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" msgstr "" -msgid "Several of the ABCs are also useful as mixins that make it easier to develop classes supporting container APIs. For example, to write a class supporting the full :class:`Set` API, it is only necessary to supply the three underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +#: ../../library/collections.abc.rst:410 +msgid "" +"Several of the ABCs are also useful as mixins that make it easier to develop " +"classes supporting container APIs. For example, to write a class supporting " +"the full :class:`Set` API, it is only necessary to supply the three " +"underlying abstract " +"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " +"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " +"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" +#: ../../library/collections.abc.rst:417 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -480,23 +761,49 @@ msgid "" "\n" "s1 = ListBasedSet('abcdef')\n" "s2 = ListBasedSet('defghi')\n" -"overlap = s1 & s2 # The __and__() method is supported automatically" +"overlap = s1 & s2 # The __and__() method is supported " +"automatically" msgstr "" +#: ../../library/collections.abc.rst:439 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -msgid "Since some set operations create new sets, the default mixin methods need a way to create new instances from an :term:`iterable`. The class constructor is assumed to have a signature in the form ``ClassName(iterable)``. That assumption is factored-out to an internal :class:`classmethod` called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If the :class:`Set` mixin is being used in a class with a different constructor signature, you will need to override :meth:`!_from_iterable` with a classmethod or regular method that can construct new instances from an iterable argument." -msgstr "" - -msgid "To override the comparisons (presumably for speed, as the semantics are fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the other operations will automatically follow suit." +#: ../../library/collections.abc.rst:442 +msgid "" +"Since some set operations create new sets, the default mixin methods need a " +"way to create new instances from an :term:`iterable`. The class constructor " +"is assumed to have a signature in the form ``ClassName(iterable)``. That " +"assumption is factored-out to an internal :class:`classmethod` " +"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " +"new set. If the :class:`Set` mixin is being used in a class with a different " +"constructor signature, you will need to override :meth:`!_from_iterable` " +"with a classmethod or regular method that can construct new instances from " +"an iterable argument." +msgstr "" + +#: ../../library/collections.abc.rst:453 +msgid "" +"To override the comparisons (presumably for speed, as the semantics are " +"fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " +"other operations will automatically follow suit." msgstr "" -msgid "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash value for the set; however, :meth:`~object.__hash__` is not defined because not all sets are :term:`hashable` or immutable. To add set hashability using mixins, inherit from both :class:`Set` and :class:`Hashable`, then define ``__hash__ = Set._hash``." +#: ../../library/collections.abc.rst:459 +msgid "" +"The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " +"value for the set; however, :meth:`~object.__hash__` is not defined because " +"not all sets are :term:`hashable` or immutable. To add set hashability " +"using mixins, inherit from both :class:`Set` and :class:`Hashable`, then " +"define ``__hash__ = Set._hash``." msgstr "" -msgid "`OrderedSet recipe `_ for an example built on :class:`MutableSet`." +#: ../../library/collections.abc.rst:467 +msgid "" +"`OrderedSet recipe `_ for an " +"example built on :class:`MutableSet`." msgstr "" +#: ../../library/collections.abc.rst:470 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "" diff --git a/library/collections.po b/library/collections.po index a3540ea30..badb19421 100644 --- a/library/collections.po +++ b/library/collections.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:56+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,111 +23,190 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/collections.rst:2 msgid ":mod:`!collections` --- Container datatypes" msgstr "" +#: ../../library/collections.rst:10 msgid "**Source code:** :source:`Lib/collections/__init__.py`" msgstr "" -msgid "This module implements specialized container datatypes providing alternatives to Python's general purpose built-in containers, :class:`dict`, :class:`list`, :class:`set`, and :class:`tuple`." +#: ../../library/collections.rst:20 +msgid "" +"This module implements specialized container datatypes providing " +"alternatives to Python's general purpose built-in " +"containers, :class:`dict`, :class:`list`, :class:`set`, and :class:`tuple`." msgstr "" +#: ../../library/collections.rst:25 msgid ":func:`namedtuple`" msgstr "" +#: ../../library/collections.rst:25 msgid "factory function for creating tuple subclasses with named fields" msgstr "" +#: ../../library/collections.rst:26 msgid ":class:`deque`" msgstr "" +#: ../../library/collections.rst:26 msgid "list-like container with fast appends and pops on either end" msgstr "" +#: ../../library/collections.rst:27 msgid ":class:`ChainMap`" msgstr "" +#: ../../library/collections.rst:27 msgid "dict-like class for creating a single view of multiple mappings" msgstr "" +#: ../../library/collections.rst:28 msgid ":class:`Counter`" msgstr "" +#: ../../library/collections.rst:28 msgid "dict subclass for counting :term:`hashable` objects" msgstr "" +#: ../../library/collections.rst:29 msgid ":class:`OrderedDict`" msgstr "" +#: ../../library/collections.rst:29 msgid "dict subclass that remembers the order entries were added" msgstr "" +#: ../../library/collections.rst:30 msgid ":class:`defaultdict`" msgstr "" +#: ../../library/collections.rst:30 msgid "dict subclass that calls a factory function to supply missing values" msgstr "" +#: ../../library/collections.rst:31 msgid ":class:`UserDict`" msgstr "" +#: ../../library/collections.rst:31 msgid "wrapper around dictionary objects for easier dict subclassing" msgstr "" +#: ../../library/collections.rst:32 msgid ":class:`UserList`" msgstr "" +#: ../../library/collections.rst:32 msgid "wrapper around list objects for easier list subclassing" msgstr "" +#: ../../library/collections.rst:33 msgid ":class:`UserString`" msgstr "" +#: ../../library/collections.rst:33 msgid "wrapper around string objects for easier string subclassing" msgstr "" +#: ../../library/collections.rst:38 msgid ":class:`ChainMap` objects" msgstr "" -msgid "A :class:`ChainMap` class is provided for quickly linking a number of mappings so they can be treated as a single unit. It is often much faster than creating a new dictionary and running multiple :meth:`~dict.update` calls." +#: ../../library/collections.rst:42 +msgid "" +"A :class:`ChainMap` class is provided for quickly linking a number of " +"mappings so they can be treated as a single unit. It is often much faster " +"than creating a new dictionary and running multiple :meth:`~dict.update` " +"calls." msgstr "" -msgid "The class can be used to simulate nested scopes and is useful in templating." +#: ../../library/collections.rst:46 +msgid "" +"The class can be used to simulate nested scopes and is useful in templating." msgstr "" -msgid "A :class:`ChainMap` groups multiple dicts or other mappings together to create a single, updateable view. If no *maps* are specified, a single empty dictionary is provided so that a new chain always has at least one mapping." +#: ../../library/collections.rst:50 +msgid "" +"A :class:`ChainMap` groups multiple dicts or other mappings together to " +"create a single, updateable view. If no *maps* are specified, a single " +"empty dictionary is provided so that a new chain always has at least one " +"mapping." msgstr "" -msgid "The underlying mappings are stored in a list. That list is public and can be accessed or updated using the *maps* attribute. There is no other state." +#: ../../library/collections.rst:54 +msgid "" +"The underlying mappings are stored in a list. That list is public and can " +"be accessed or updated using the *maps* attribute. There is no other state." msgstr "" -msgid "Lookups search the underlying mappings successively until a key is found. In contrast, writes, updates, and deletions only operate on the first mapping." +#: ../../library/collections.rst:57 +msgid "" +"Lookups search the underlying mappings successively until a key is found. " +"In contrast, writes, updates, and deletions only operate on the first " +"mapping." msgstr "" -msgid "A :class:`ChainMap` incorporates the underlying mappings by reference. So, if one of the underlying mappings gets updated, those changes will be reflected in :class:`ChainMap`." +#: ../../library/collections.rst:60 +msgid "" +"A :class:`ChainMap` incorporates the underlying mappings by reference. So, " +"if one of the underlying mappings gets updated, those changes will be " +"reflected in :class:`ChainMap`." msgstr "" -msgid "All of the usual dictionary methods are supported. In addition, there is a *maps* attribute, a method for creating new subcontexts, and a property for accessing all but the first mapping:" +#: ../../library/collections.rst:64 +msgid "" +"All of the usual dictionary methods are supported. In addition, there is a " +"*maps* attribute, a method for creating new subcontexts, and a property for " +"accessing all but the first mapping:" msgstr "" -msgid "A user updateable list of mappings. The list is ordered from first-searched to last-searched. It is the only stored state and can be modified to change which mappings are searched. The list should always contain at least one mapping." +#: ../../library/collections.rst:70 +msgid "" +"A user updateable list of mappings. The list is ordered from first-searched " +"to last-searched. It is the only stored state and can be modified to change " +"which mappings are searched. The list should always contain at least one " +"mapping." msgstr "" -msgid "Returns a new :class:`ChainMap` containing a new map followed by all of the maps in the current instance. If ``m`` is specified, it becomes the new map at the front of the list of mappings; if not specified, an empty dict is used, so that a call to ``d.new_child()`` is equivalent to: ``ChainMap({}, *d.maps)``. If any keyword arguments are specified, they update passed map or new empty dict. This method is used for creating subcontexts that can be updated without altering values in any of the parent mappings." +#: ../../library/collections.rst:77 +msgid "" +"Returns a new :class:`ChainMap` containing a new map followed by all of the " +"maps in the current instance. If ``m`` is specified, it becomes the new map " +"at the front of the list of mappings; if not specified, an empty dict is " +"used, so that a call to ``d.new_child()`` is equivalent to: ``ChainMap({}, " +"*d.maps)``. If any keyword arguments are specified, they update passed map " +"or new empty dict. This method is used for creating subcontexts that can be " +"updated without altering values in any of the parent mappings." msgstr "" +#: ../../library/collections.rst:86 msgid "The optional ``m`` parameter was added." msgstr "" +#: ../../library/collections.rst:89 msgid "Keyword arguments support was added." msgstr "" -msgid "Property returning a new :class:`ChainMap` containing all of the maps in the current instance except the first one. This is useful for skipping the first map in the search. Use cases are similar to those for the :keyword:`nonlocal` keyword used in :term:`nested scopes `. The use cases also parallel those for the built-in :func:`super` function. A reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``." +#: ../../library/collections.rst:94 +msgid "" +"Property returning a new :class:`ChainMap` containing all of the maps in the " +"current instance except the first one. This is useful for skipping the " +"first map in the search. Use cases are similar to those for " +"the :keyword:`nonlocal` keyword used in :term:`nested scopes `. The use cases also parallel those for the built-in :func:`super` " +"function. A reference to ``d.parents`` is equivalent to: " +"``ChainMap(*d.maps[1:])``." msgstr "" -msgid "Note, the iteration order of a :class:`ChainMap` is determined by scanning the mappings last to first::" +#: ../../library/collections.rst:102 +msgid "" +"Note, the iteration order of a :class:`ChainMap` is determined by scanning " +"the mappings last to first::" msgstr "" +#: ../../library/collections.rst:105 msgid "" ">>> baseline = {'music': 'bach', 'art': 'rembrandt'}\n" ">>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}\n" @@ -135,9 +214,13 @@ msgid "" "['music', 'art', 'opera']" msgstr "" -msgid "This gives the same ordering as a series of :meth:`dict.update` calls starting with the last mapping::" +#: ../../library/collections.rst:110 +msgid "" +"This gives the same ordering as a series of :meth:`dict.update` calls " +"starting with the last mapping::" msgstr "" +#: ../../library/collections.rst:113 msgid "" ">>> combined = baseline.copy()\n" ">>> combined.update(adjustments)\n" @@ -145,38 +228,67 @@ msgid "" "['music', 'art', 'opera']" msgstr "" +#: ../../library/collections.rst:118 msgid "Added support for ``|`` and ``|=`` operators, specified in :pep:`584`." msgstr "" -msgid "The `MultiContext class `_ in the Enthought `CodeTools package `_ has options to support writing to any mapping in the chain." +#: ../../library/collections.rst:123 +msgid "" +"The `MultiContext class `_ in the Enthought `CodeTools package " +"`_ has options to support writing to " +"any mapping in the chain." msgstr "" -msgid "Django's `Context class `_ for templating is a read-only chain of mappings. It also features pushing and popping of contexts similar to the :meth:`~collections.ChainMap.new_child` method and the :attr:`~collections.ChainMap.parents` property." +#: ../../library/collections.rst:129 +msgid "" +"Django's `Context class `_ for templating is a read-only chain of mappings. It " +"also features pushing and popping of contexts similar to " +"the :meth:`~collections.ChainMap.new_child` method and " +"the :attr:`~collections.ChainMap.parents` property." msgstr "" -msgid "The `Nested Contexts recipe `_ has options to control whether writes and other mutations apply only to the first mapping or to any mapping in the chain." +#: ../../library/collections.rst:136 +msgid "" +"The `Nested Contexts recipe `_ has options to control " +"whether writes and other mutations apply only to the first mapping or to any " +"mapping in the chain." msgstr "" -msgid "A `greatly simplified read-only version of Chainmap `_." +#: ../../library/collections.rst:141 +msgid "" +"A `greatly simplified read-only version of Chainmap `_." msgstr "" +#: ../../library/collections.rst:146 msgid ":class:`ChainMap` Examples and Recipes" msgstr "" +#: ../../library/collections.rst:148 msgid "This section shows various approaches to working with chained maps." msgstr "" +#: ../../library/collections.rst:151 msgid "Example of simulating Python's internal lookup chain::" msgstr "" +#: ../../library/collections.rst:153 msgid "" "import builtins\n" "pylookup = ChainMap(locals(), globals(), vars(builtins))" msgstr "" -msgid "Example of letting user specified command-line arguments take precedence over environment variables which in turn take precedence over default values::" +#: ../../library/collections.rst:156 +msgid "" +"Example of letting user specified command-line arguments take precedence " +"over environment variables which in turn take precedence over default " +"values::" msgstr "" +#: ../../library/collections.rst:159 msgid "" "import os, argparse\n" "\n" @@ -186,21 +298,27 @@ msgid "" "parser.add_argument('-u', '--user')\n" "parser.add_argument('-c', '--color')\n" "namespace = parser.parse_args()\n" -"command_line_args = {k: v for k, v in vars(namespace).items() if v is not None}\n" +"command_line_args = {k: v for k, v in vars(namespace).items() if v is not " +"None}\n" "\n" "combined = ChainMap(command_line_args, os.environ, defaults)\n" "print(combined['color'])\n" "print(combined['user'])" msgstr "" -msgid "Example patterns for using the :class:`ChainMap` class to simulate nested contexts::" +#: ../../library/collections.rst:173 +msgid "" +"Example patterns for using the :class:`ChainMap` class to simulate nested " +"contexts::" msgstr "" +#: ../../library/collections.rst:176 msgid "" "c = ChainMap() # Create root context\n" "d = c.new_child() # Create nested child context\n" "e = c.new_child() # Child of c, independent from d\n" -"e.maps[0] # Current context dictionary -- like Python's locals()\n" +"e.maps[0] # Current context dictionary -- like Python's " +"locals()\n" "e.maps[-1] # Root context -- like Python's globals()\n" "e.parents # Enclosing context chain -- like Python's nonlocals\n" "\n" @@ -214,9 +332,15 @@ msgid "" "dict(d) # Flatten into a regular dictionary" msgstr "" -msgid "The :class:`ChainMap` class only makes updates (writes and deletions) to the first mapping in the chain while lookups will search the full chain. However, if deep writes and deletions are desired, it is easy to make a subclass that updates keys found deeper in the chain::" +#: ../../library/collections.rst:192 +msgid "" +"The :class:`ChainMap` class only makes updates (writes and deletions) to the " +"first mapping in the chain while lookups will search the full chain. " +"However, if deep writes and deletions are desired, it is easy to make a " +"subclass that updates keys found deeper in the chain::" msgstr "" +#: ../../library/collections.rst:197 msgid "" "class DeepChainMap(ChainMap):\n" " 'Variant of ChainMap that allows direct updates to inner scopes'\n" @@ -235,7 +359,8 @@ msgid "" " return\n" " raise KeyError(key)\n" "\n" -">>> d = DeepChainMap({'zebra': 'black'}, {'elephant': 'blue'}, {'lion': 'yellow'})\n" +">>> d = DeepChainMap({'zebra': 'black'}, {'elephant': 'blue'}, {'lion': " +"'yellow'})\n" ">>> d['lion'] = 'orange' # update an existing key two levels down\n" ">>> d['snake'] = 'red' # new keys get added to the topmost dict\n" ">>> del d['elephant'] # remove an existing key one level down\n" @@ -243,12 +368,17 @@ msgid "" "DeepChainMap({'zebra': 'black', 'snake': 'red'}, {}, {'lion': 'orange'})" msgstr "" +#: ../../library/collections.rst:223 msgid ":class:`Counter` objects" msgstr "" -msgid "A counter tool is provided to support convenient and rapid tallies. For example::" +#: ../../library/collections.rst:225 +msgid "" +"A counter tool is provided to support convenient and rapid tallies. For " +"example::" msgstr "" +#: ../../library/collections.rst:228 msgid "" ">>> # Tally occurrences of words in a list\n" ">>> cnt = Counter()\n" @@ -266,57 +396,116 @@ msgid "" " ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]" msgstr "" -msgid "A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` objects. It is a collection where elements are stored as dictionary keys and their counts are stored as dictionary values. Counts are allowed to be any integer value including zero or negative counts. The :class:`Counter` class is similar to bags or multisets in other languages." +#: ../../library/collections.rst:247 +msgid "" +"A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` " +"objects. It is a collection where elements are stored as dictionary keys and " +"their counts are stored as dictionary values. Counts are allowed to be any " +"integer value including zero or negative counts. The :class:`Counter` class " +"is similar to bags or multisets in other languages." msgstr "" -msgid "Elements are counted from an *iterable* or initialized from another *mapping* (or counter):" +#: ../../library/collections.rst:253 +msgid "" +"Elements are counted from an *iterable* or initialized from another " +"*mapping* (or counter):" msgstr "" -msgid "Counter objects have a dictionary interface except that they return a zero count for missing items instead of raising a :exc:`KeyError`:" +#: ../../library/collections.rst:261 +msgid "" +"Counter objects have a dictionary interface except that they return a zero " +"count for missing items instead of raising a :exc:`KeyError`:" msgstr "" -msgid "Setting a count to zero does not remove an element from a counter. Use ``del`` to remove it entirely:" +#: ../../library/collections.rst:268 +msgid "" +"Setting a count to zero does not remove an element from a counter. Use " +"``del`` to remove it entirely:" msgstr "" -msgid "As a :class:`dict` subclass, :class:`Counter` inherited the capability to remember insertion order. Math operations on *Counter* objects also preserve order. Results are ordered according to when an element is first encountered in the left operand and then by the order encountered in the right operand." +#: ../../library/collections.rst:276 +msgid "" +"As a :class:`dict` subclass, :class:`Counter` inherited the capability to " +"remember insertion order. Math operations on *Counter* objects also " +"preserve order. Results are ordered according to when an element is first " +"encountered in the left operand and then by the order encountered in the " +"right operand." msgstr "" -msgid "Counter objects support additional methods beyond those available for all dictionaries:" +#: ../../library/collections.rst:282 +msgid "" +"Counter objects support additional methods beyond those available for all " +"dictionaries:" msgstr "" -msgid "Return an iterator over elements repeating each as many times as its count. Elements are returned in the order first encountered. If an element's count is less than one, :meth:`elements` will ignore it." +#: ../../library/collections.rst:287 +msgid "" +"Return an iterator over elements repeating each as many times as its count. " +"Elements are returned in the order first encountered. If an element's count " +"is less than one, :meth:`elements` will ignore it." msgstr "" -msgid "Return a list of the *n* most common elements and their counts from the most common to the least. If *n* is omitted or ``None``, :meth:`most_common` returns *all* elements in the counter. Elements with equal counts are ordered in the order first encountered:" +#: ../../library/collections.rst:297 +msgid "" +"Return a list of the *n* most common elements and their counts from the most " +"common to the least. If *n* is omitted or ``None``, :meth:`most_common` " +"returns *all* elements in the counter. Elements with equal counts are " +"ordered in the order first encountered:" msgstr "" -msgid "Elements are subtracted from an *iterable* or from another *mapping* (or counter). Like :meth:`dict.update` but subtracts counts instead of replacing them. Both inputs and outputs may be zero or negative." +#: ../../library/collections.rst:309 +msgid "" +"Elements are subtracted from an *iterable* or from another *mapping* (or " +"counter). Like :meth:`dict.update` but subtracts counts instead of " +"replacing them. Both inputs and outputs may be zero or negative." msgstr "" +#: ../../library/collections.rst:323 msgid "Compute the sum of the counts." msgstr "" -msgid "The usual dictionary methods are available for :class:`Counter` objects except for two which work differently for counters." +#: ../../library/collections.rst:331 +msgid "" +"The usual dictionary methods are available for :class:`Counter` objects " +"except for two which work differently for counters." msgstr "" +#: ../../library/collections.rst:336 msgid "This class method is not implemented for :class:`Counter` objects." msgstr "" -msgid "Elements are counted from an *iterable* or added-in from another *mapping* (or counter). Like :meth:`dict.update` but adds counts instead of replacing them. Also, the *iterable* is expected to be a sequence of elements, not a sequence of ``(key, value)`` pairs." +#: ../../library/collections.rst:342 +msgid "" +"Elements are counted from an *iterable* or added-in from another *mapping* " +"(or counter). Like :meth:`dict.update` but adds counts instead of replacing " +"them. Also, the *iterable* is expected to be a sequence of elements, not a " +"sequence of ``(key, value)`` pairs." msgstr "" -msgid "Counters support rich comparison operators for equality, subset, and superset relationships: ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``. All of those tests treat missing elements as having zero counts so that ``Counter(a=1) == Counter(a=1, b=0)`` returns true." +#: ../../library/collections.rst:347 +msgid "" +"Counters support rich comparison operators for equality, subset, and " +"superset relationships: ``==``, ``!=``, ``<``, ``<=``, ``>``, ``>=``. All of " +"those tests treat missing elements as having zero counts so that " +"``Counter(a=1) == Counter(a=1, b=0)`` returns true." msgstr "" +#: ../../library/collections.rst:352 msgid "Rich comparison operations were added." msgstr "" -msgid "In equality tests, missing elements are treated as having zero counts. Formerly, ``Counter(a=3)`` and ``Counter(a=3, b=0)`` were considered distinct." +#: ../../library/collections.rst:355 +msgid "" +"In equality tests, missing elements are treated as having zero counts. " +"Formerly, ``Counter(a=3)`` and ``Counter(a=3, b=0)`` were considered " +"distinct." msgstr "" +#: ../../library/collections.rst:360 msgid "Common patterns for working with :class:`Counter` objects::" msgstr "" +#: ../../library/collections.rst:362 msgid "" "c.total() # total of all counts\n" "c.clear() # reset all counts\n" @@ -329,9 +518,18 @@ msgid "" "+c # remove zero and negative counts" msgstr "" -msgid "Several mathematical operations are provided for combining :class:`Counter` objects to produce multisets (counters that have counts greater than zero). Addition and subtraction combine counters by adding or subtracting the counts of corresponding elements. Intersection and union return the minimum and maximum of corresponding counts. Equality and inclusion compare corresponding counts. Each operation can accept inputs with signed counts, but the output will exclude results with counts of zero or less." +#: ../../library/collections.rst:372 +msgid "" +"Several mathematical operations are provided for combining :class:`Counter` " +"objects to produce multisets (counters that have counts greater than zero). " +"Addition and subtraction combine counters by adding or subtracting the " +"counts of corresponding elements. Intersection and union return the minimum " +"and maximum of corresponding counts. Equality and inclusion compare " +"corresponding counts. Each operation can accept inputs with signed counts, " +"but the output will exclude results with counts of zero or less." msgstr "" +#: ../../library/collections.rst:380 msgid "" ">>> c = Counter(a=3, b=1)\n" ">>> d = Counter(a=1, b=2)\n" @@ -349,132 +547,256 @@ msgid "" "False" msgstr "" -msgid "Unary addition and subtraction are shortcuts for adding an empty counter or subtracting from an empty counter." +#: ../../library/collections.rst:397 +msgid "" +"Unary addition and subtraction are shortcuts for adding an empty counter or " +"subtracting from an empty counter." msgstr "" -msgid "Added support for unary plus, unary minus, and in-place multiset operations." +#: ../../library/collections.rst:406 +msgid "" +"Added support for unary plus, unary minus, and in-place multiset operations." msgstr "" -msgid "Counters were primarily designed to work with positive integers to represent running counts; however, care was taken to not unnecessarily preclude use cases needing other types or negative values. To help with those use cases, this section documents the minimum range and type restrictions." +#: ../../library/collections.rst:411 +msgid "" +"Counters were primarily designed to work with positive integers to represent " +"running counts; however, care was taken to not unnecessarily preclude use " +"cases needing other types or negative values. To help with those use cases, " +"this section documents the minimum range and type restrictions." msgstr "" -msgid "The :class:`Counter` class itself is a dictionary subclass with no restrictions on its keys and values. The values are intended to be numbers representing counts, but you *could* store anything in the value field." +#: ../../library/collections.rst:416 +msgid "" +"The :class:`Counter` class itself is a dictionary subclass with no " +"restrictions on its keys and values. The values are intended to be numbers " +"representing counts, but you *could* store anything in the value field." msgstr "" -msgid "The :meth:`~Counter.most_common` method requires only that the values be orderable." +#: ../../library/collections.rst:420 +msgid "" +"The :meth:`~Counter.most_common` method requires only that the values be " +"orderable." msgstr "" -msgid "For in-place operations such as ``c[key] += 1``, the value type need only support addition and subtraction. So fractions, floats, and decimals would work and negative values are supported. The same is also true for :meth:`~Counter.update` and :meth:`~Counter.subtract` which allow negative and zero values for both inputs and outputs." +#: ../../library/collections.rst:422 +msgid "" +"For in-place operations such as ``c[key] += 1``, the value type need only " +"support addition and subtraction. So fractions, floats, and decimals would " +"work and negative values are supported. The same is also true " +"for :meth:`~Counter.update` and :meth:`~Counter.subtract` which allow " +"negative and zero values for both inputs and outputs." msgstr "" -msgid "The multiset methods are designed only for use cases with positive values. The inputs may be negative or zero, but only outputs with positive values are created. There are no type restrictions, but the value type needs to support addition, subtraction, and comparison." +#: ../../library/collections.rst:428 +msgid "" +"The multiset methods are designed only for use cases with positive values. " +"The inputs may be negative or zero, but only outputs with positive values " +"are created. There are no type restrictions, but the value type needs to " +"support addition, subtraction, and comparison." msgstr "" -msgid "The :meth:`~Counter.elements` method requires integer counts. It ignores zero and negative counts." +#: ../../library/collections.rst:433 +msgid "" +"The :meth:`~Counter.elements` method requires integer counts. It ignores " +"zero and negative counts." msgstr "" -msgid "`Bag class `_ in Smalltalk." +#: ../../library/collections.rst:438 +msgid "" +"`Bag class `_ in Smalltalk." msgstr "" -msgid "Wikipedia entry for `Multisets `_." +#: ../../library/collections.rst:441 +msgid "" +"Wikipedia entry for `Multisets `_." msgstr "" -msgid "`C++ multisets `_ tutorial with examples." +#: ../../library/collections.rst:443 +msgid "" +"`C++ multisets `_ tutorial with examples." msgstr "" -msgid "For mathematical operations on multisets and their use cases, see *Knuth, Donald. The Art of Computer Programming Volume II, Section 4.6.3, Exercise 19*." +#: ../../library/collections.rst:446 +msgid "" +"For mathematical operations on multisets and their use cases, see *Knuth, " +"Donald. The Art of Computer Programming Volume II, Section 4.6.3, Exercise " +"19*." msgstr "" -msgid "To enumerate all distinct multisets of a given size over a given set of elements, see :func:`itertools.combinations_with_replacement`::" +#: ../../library/collections.rst:450 +msgid "" +"To enumerate all distinct multisets of a given size over a given set of " +"elements, see :func:`itertools.combinations_with_replacement`::" msgstr "" -msgid "map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC" +#: ../../library/collections.rst:453 +msgid "" +"map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC" msgstr "" +#: ../../library/collections.rst:457 msgid ":class:`deque` objects" msgstr "" -msgid "Returns a new deque object initialized left-to-right (using :meth:`append`) with data from *iterable*. If *iterable* is not specified, the new deque is empty." +#: ../../library/collections.rst:461 +msgid "" +"Returns a new deque object initialized left-to-right (using :meth:`append`) " +"with data from *iterable*. If *iterable* is not specified, the new deque is " +"empty." msgstr "" -msgid "Deques are a generalization of stacks and queues (the name is pronounced \"deck\" and is short for \"double-ended queue\"). Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same *O*\\ (1) performance in either direction." +#: ../../library/collections.rst:464 +msgid "" +"Deques are a generalization of stacks and queues (the name is pronounced " +"\"deck\" and is short for \"double-ended queue\"). Deques support thread-" +"safe, memory efficient appends and pops from either side of the deque with " +"approximately the same *O*\\ (1) performance in either direction." msgstr "" -msgid "Though :class:`list` objects support similar operations, they are optimized for fast fixed-length operations and incur *O*\\ (*n*) memory movement costs for ``pop(0)`` and ``insert(0, v)`` operations which change both the size and position of the underlying data representation." +#: ../../library/collections.rst:469 +msgid "" +"Though :class:`list` objects support similar operations, they are optimized " +"for fast fixed-length operations and incur *O*\\ (*n*) memory movement costs " +"for ``pop(0)`` and ``insert(0, v)`` operations which change both the size " +"and position of the underlying data representation." msgstr "" -msgid "If *maxlen* is not specified or is ``None``, deques may grow to an arbitrary length. Otherwise, the deque is bounded to the specified maximum length. Once a bounded length deque is full, when new items are added, a corresponding number of items are discarded from the opposite end. Bounded length deques provide functionality similar to the ``tail`` filter in Unix. They are also useful for tracking transactions and other pools of data where only the most recent activity is of interest." +#: ../../library/collections.rst:475 +msgid "" +"If *maxlen* is not specified or is ``None``, deques may grow to an arbitrary " +"length. Otherwise, the deque is bounded to the specified maximum length. " +"Once a bounded length deque is full, when new items are added, a " +"corresponding number of items are discarded from the opposite end. Bounded " +"length deques provide functionality similar to the ``tail`` filter in Unix. " +"They are also useful for tracking transactions and other pools of data where " +"only the most recent activity is of interest." msgstr "" +#: ../../library/collections.rst:483 msgid "Deques are :ref:`generic ` over the type of their contents." msgstr "" +#: ../../library/collections.rst:486 msgid "Deque objects support the following methods:" msgstr "" +#: ../../library/collections.rst:490 msgid "Add *item* to the right side of the deque." msgstr "" +#: ../../library/collections.rst:495 msgid "Add *item* to the left side of the deque." msgstr "" +#: ../../library/collections.rst:500 msgid "Remove all elements from the deque leaving it with length 0." msgstr "" +#: ../../library/collections.rst:505 msgid "Create a shallow copy of the deque." msgstr "" +#: ../../library/collections.rst:512 msgid "Count the number of deque elements equal to *value*." msgstr "" -msgid "Extend the right side of the deque by appending elements from the iterable argument." +#: ../../library/collections.rst:519 +msgid "" +"Extend the right side of the deque by appending elements from the iterable " +"argument." msgstr "" -msgid "Extend the left side of the deque by appending elements from *iterable*. Note, the series of left appends results in reversing the order of elements in the iterable argument." +#: ../../library/collections.rst:525 +msgid "" +"Extend the left side of the deque by appending elements from *iterable*. " +"Note, the series of left appends results in reversing the order of elements " +"in the iterable argument." msgstr "" -msgid "Return the position of *value* in the deque (at or after index *start* and before index *stop*). Returns the first match or raises :exc:`ValueError` if not found." +#: ../../library/collections.rst:532 +msgid "" +"Return the position of *value* in the deque (at or after index *start* and " +"before index *stop*). Returns the first match or raises :exc:`ValueError` " +"if not found." msgstr "" +#: ../../library/collections.rst:541 msgid "Insert *value* into the deque at position *index*." msgstr "" -msgid "If the insertion would cause a bounded deque to grow beyond *maxlen*, an :exc:`IndexError` is raised." +#: ../../library/collections.rst:543 +msgid "" +"If the insertion would cause a bounded deque to grow beyond *maxlen*, " +"an :exc:`IndexError` is raised." msgstr "" -msgid "Remove and return an element from the right side of the deque. If no elements are present, raises an :exc:`IndexError`." +#: ../../library/collections.rst:551 +msgid "" +"Remove and return an element from the right side of the deque. If no " +"elements are present, raises an :exc:`IndexError`." msgstr "" -msgid "Remove and return an element from the left side of the deque. If no elements are present, raises an :exc:`IndexError`." +#: ../../library/collections.rst:557 +msgid "" +"Remove and return an element from the left side of the deque. If no elements " +"are present, raises an :exc:`IndexError`." msgstr "" -msgid "Remove the first occurrence of *value*. If not found, raises a :exc:`ValueError`." +#: ../../library/collections.rst:563 +msgid "" +"Remove the first occurrence of *value*. If not found, raises " +"a :exc:`ValueError`." msgstr "" +#: ../../library/collections.rst:569 msgid "Reverse the elements of the deque in-place and then return ``None``." msgstr "" -msgid "Rotate the deque *n* steps to the right. If *n* is negative, rotate to the left." +#: ../../library/collections.rst:576 +msgid "" +"Rotate the deque *n* steps to the right. If *n* is negative, rotate to the " +"left." msgstr "" -msgid "When the deque is not empty, rotating one step to the right is equivalent to ``d.appendleft(d.pop())``, and rotating one step to the left is equivalent to ``d.append(d.popleft())``." +#: ../../library/collections.rst:579 +msgid "" +"When the deque is not empty, rotating one step to the right is equivalent to " +"``d.appendleft(d.pop())``, and rotating one step to the left is equivalent " +"to ``d.append(d.popleft())``." msgstr "" +#: ../../library/collections.rst:584 msgid "Deque objects also provide one read-only attribute:" msgstr "" +#: ../../library/collections.rst:588 msgid "Maximum size of a deque or ``None`` if unbounded." msgstr "" -msgid "In addition to the above, deques support iteration, pickling, ``len(d)``, ``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with the :keyword:`in` operator, and subscript references such as ``d[0]`` to access the first element. Indexed access is *O*\\ (1) at both ends but slows to *O*\\ (*n*) in the middle. For fast random access, use lists instead." +#: ../../library/collections.rst:593 +msgid "" +"In addition to the above, deques support iteration, pickling, ``len(d)``, " +"``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing " +"with the :keyword:`in` operator, and subscript references such as ``d[0]`` " +"to access the first element. Indexed access is *O*\\ (1) at both ends but " +"slows to *O*\\ (*n*) in the middle. For fast random access, use lists " +"instead." msgstr "" -msgid "Starting in version 3.5, deques support ``__add__()``, ``__mul__()``, and ``__imul__()``." +#: ../../library/collections.rst:599 +msgid "" +"Starting in version 3.5, deques support ``__add__()``, ``__mul__()``, and " +"``__imul__()``." msgstr "" +#: ../../library/collections.rst:602 msgid "Example:" msgstr "" +#: ../../library/collections.rst:604 msgid "" ">>> from collections import deque\n" ">>> d = deque('ghi') # make a new deque with three items\n" @@ -500,7 +822,8 @@ msgid "" ">>> d[-1] # peek at rightmost item\n" "'i'\n" "\n" -">>> list(reversed(d)) # list the contents of a deque in reverse\n" +">>> list(reversed(d)) # list the contents of a deque in " +"reverse\n" "['i', 'h', 'g']\n" ">>> 'h' in d # search the deque\n" "True\n" @@ -523,20 +846,27 @@ msgid "" " d.pop()\n" "IndexError: pop from an empty deque\n" "\n" -">>> d.extendleft('abc') # extendleft() reverses the input order\n" +">>> d.extendleft('abc') # extendleft() reverses the input " +"order\n" ">>> d\n" "deque(['c', 'b', 'a'])" msgstr "" +#: ../../library/collections.rst:659 msgid ":class:`deque` Recipes" msgstr "" +#: ../../library/collections.rst:661 msgid "This section shows various approaches to working with deques." msgstr "" -msgid "Bounded length deques provide functionality similar to the ``tail`` filter in Unix::" +#: ../../library/collections.rst:663 +msgid "" +"Bounded length deques provide functionality similar to the ``tail`` filter " +"in Unix::" msgstr "" +#: ../../library/collections.rst:666 msgid "" "def tail(filename, n=10):\n" " 'Return the last n lines of a file'\n" @@ -544,9 +874,13 @@ msgid "" " return deque(f, n)" msgstr "" -msgid "Another approach to using deques is to maintain a sequence of recently added elements by appending to the right and popping to the left::" +#: ../../library/collections.rst:671 +msgid "" +"Another approach to using deques is to maintain a sequence of recently added " +"elements by appending to the right and popping to the left::" msgstr "" +#: ../../library/collections.rst:674 msgid "" "def moving_average(iterable, n=3):\n" " # moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0\n" @@ -561,9 +895,17 @@ msgid "" " yield s / n" msgstr "" -msgid "A `round-robin scheduler `_ can be implemented with input iterators stored in a :class:`deque`. Values are yielded from the active iterator in position zero. If that iterator is exhausted, it can be removed with :meth:`~deque.popleft`; otherwise, it can be cycled back to the end with the :meth:`~deque.rotate` method::" +#: ../../library/collections.rst:686 +msgid "" +"A `round-robin scheduler `_ can be implemented with input iterators stored in " +"a :class:`deque`. Values are yielded from the active iterator in position " +"zero. If that iterator is exhausted, it can be removed " +"with :meth:`~deque.popleft`; otherwise, it can be cycled back to the end " +"with the :meth:`~deque.rotate` method::" msgstr "" +#: ../../library/collections.rst:693 msgid "" "def roundrobin(*iterables):\n" " \"roundrobin('ABC', 'D', 'EF') --> A D E B F C\"\n" @@ -578,9 +920,14 @@ msgid "" " iterators.popleft()" msgstr "" -msgid "The :meth:`~deque.rotate` method provides a way to implement :class:`deque` slicing and deletion. For example, a pure Python implementation of ``del d[n]`` relies on the ``rotate()`` method to position elements to be popped::" +#: ../../library/collections.rst:705 +msgid "" +"The :meth:`~deque.rotate` method provides a way to implement :class:`deque` " +"slicing and deletion. For example, a pure Python implementation of ``del " +"d[n]`` relies on the ``rotate()`` method to position elements to be popped::" msgstr "" +#: ../../library/collections.rst:709 msgid "" "def delete_nth(d, n):\n" " d.rotate(-n)\n" @@ -588,118 +935,255 @@ msgid "" " d.rotate(n)" msgstr "" -msgid "To implement :class:`deque` slicing, use a similar approach applying :meth:`~deque.rotate` to bring a target element to the left side of the deque. Remove old entries with :meth:`~deque.popleft`, add new entries with :meth:`~deque.extend`, and then reverse the rotation. With minor variations on that approach, it is easy to implement Forth style stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ``rot``, and ``roll``." +#: ../../library/collections.rst:714 +msgid "" +"To implement :class:`deque` slicing, use a similar approach " +"applying :meth:`~deque.rotate` to bring a target element to the left side of " +"the deque. Remove old entries with :meth:`~deque.popleft`, add new entries " +"with :meth:`~deque.extend`, and then reverse the rotation. With minor " +"variations on that approach, it is easy to implement Forth style stack " +"manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, " +"``rot``, and ``roll``." msgstr "" +#: ../../library/collections.rst:724 msgid ":class:`defaultdict` objects" msgstr "" -msgid "Return a new dictionary-like object. :class:`defaultdict` is a subclass of the built-in :class:`dict` class. It overrides one method and adds one writable instance variable. The remaining functionality is the same as for the :class:`dict` class and is not documented here." +#: ../../library/collections.rst:730 +msgid "" +"Return a new dictionary-like object. :class:`defaultdict` is a subclass of " +"the built-in :class:`dict` class. It overrides one method and adds one " +"writable instance variable. The remaining functionality is the same as for " +"the :class:`dict` class and is not documented here." msgstr "" -msgid "The first argument provides the initial value for the :attr:`default_factory` attribute; it defaults to ``None``. All remaining arguments are treated the same as if they were passed to the :class:`dict` constructor, including keyword arguments." +#: ../../library/collections.rst:735 +msgid "" +"The first argument provides the initial value for " +"the :attr:`default_factory` attribute; it defaults to ``None``. All " +"remaining arguments are treated the same as if they were passed to " +"the :class:`dict` constructor, including keyword arguments." msgstr "" -msgid ":class:`!defaultdict`\\s are :ref:`generic ` over two types, signifying (respectively) the types of the dictionary's keys and values." +#: ../../library/collections.rst:740 +msgid "" +":class:`!defaultdict`\\s are :ref:`generic ` over two types, " +"signifying (respectively) the types of the dictionary's keys and values." msgstr "" -msgid ":class:`defaultdict` objects support the following method in addition to the standard :class:`dict` operations:" +#: ../../library/collections.rst:744 +msgid "" +":class:`defaultdict` objects support the following method in addition to the " +"standard :class:`dict` operations:" msgstr "" -msgid "If the :attr:`default_factory` attribute is ``None``, this raises a :exc:`KeyError` exception with the *key* as argument." +#: ../../library/collections.rst:749 +msgid "" +"If the :attr:`default_factory` attribute is ``None``, this raises " +"a :exc:`KeyError` exception with the *key* as argument." msgstr "" -msgid "If :attr:`default_factory` is not ``None``, it is called without arguments to provide a default value for the given *key*, this value is inserted in the dictionary for the *key*, and returned." +#: ../../library/collections.rst:752 +msgid "" +"If :attr:`default_factory` is not ``None``, it is called without arguments " +"to provide a default value for the given *key*, this value is inserted in " +"the dictionary for the *key*, and returned." msgstr "" -msgid "If calling :attr:`default_factory` raises an exception this exception is propagated unchanged." +#: ../../library/collections.rst:756 +msgid "" +"If calling :attr:`default_factory` raises an exception this exception is " +"propagated unchanged." msgstr "" -msgid "This method is called by the :meth:`~object.__getitem__` method of the :class:`dict` class when the requested key is not found; whatever it returns or raises is then returned or raised by :meth:`~object.__getitem__`." +#: ../../library/collections.rst:759 +msgid "" +"This method is called by the :meth:`~object.__getitem__` method of " +"the :class:`dict` class when the requested key is not found; whatever it " +"returns or raises is then returned or raised by :meth:`~object.__getitem__`." msgstr "" -msgid "Note that :meth:`__missing__` is *not* called for any operations besides :meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, like normal dictionaries, return ``None`` as a default rather than using :attr:`default_factory`." +#: ../../library/collections.rst:763 +msgid "" +"Note that :meth:`__missing__` is *not* called for any operations " +"besides :meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, " +"like normal dictionaries, return ``None`` as a default rather than " +"using :attr:`default_factory`." msgstr "" +#: ../../library/collections.rst:769 msgid ":class:`defaultdict` objects support the following instance variable:" msgstr "" -msgid "This attribute is used by the :meth:`~defaultdict.__missing__` method; it is initialized from the first argument to the constructor, if present, or to ``None``, if absent." +#: ../../library/collections.rst:774 +msgid "" +"This attribute is used by the :meth:`~defaultdict.__missing__` method; it is " +"initialized from the first argument to the constructor, if present, or to " +"``None``, if absent." msgstr "" -msgid "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." +#: ../../library/collections.rst:778 ../../library/collections.rst:1207 +msgid "" +"Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "" +#: ../../library/collections.rst:784 msgid ":class:`defaultdict` Examples" msgstr "" -msgid "Using :class:`list` as the :attr:`~defaultdict.default_factory`, it is easy to group a sequence of key-value pairs into a dictionary of lists:" -msgstr "" - -msgid "When each key is encountered for the first time, it is not already in the mapping; so an entry is automatically created using the :attr:`~defaultdict.default_factory` function which returns an empty :class:`list`. The :meth:`list.append` operation then attaches the value to the new list. When keys are encountered again, the look-up proceeds normally (returning the list for that key) and the :meth:`list.append` operation adds another value to the list. This technique is simpler and faster than an equivalent technique using :meth:`dict.setdefault`:" +#: ../../library/collections.rst:786 +msgid "" +"Using :class:`list` as the :attr:`~defaultdict.default_factory`, it is easy " +"to group a sequence of key-value pairs into a dictionary of lists:" msgstr "" -msgid "Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes the :class:`defaultdict` useful for counting (like a bag or multiset in other languages):" +#: ../../library/collections.rst:797 +msgid "" +"When each key is encountered for the first time, it is not already in the " +"mapping; so an entry is automatically created using " +"the :attr:`~defaultdict.default_factory` function which returns an " +"empty :class:`list`. The :meth:`list.append` operation then attaches the " +"value to the new list. When keys are encountered again, the look-up " +"proceeds normally (returning the list for that key) and " +"the :meth:`list.append` operation adds another value to the list. This " +"technique is simpler and faster than an equivalent technique " +"using :meth:`dict.setdefault`:" +msgstr "" + +#: ../../library/collections.rst:812 +msgid "" +"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes " +"the :class:`defaultdict` useful for counting (like a bag or multiset in " +"other languages):" msgstr "" -msgid "When a letter is first encountered, it is missing from the mapping, so the :attr:`~defaultdict.default_factory` function calls :func:`int` to supply a default count of zero. The increment operation then builds up the count for each letter." +#: ../../library/collections.rst:824 +msgid "" +"When a letter is first encountered, it is missing from the mapping, so " +"the :attr:`~defaultdict.default_factory` function calls :func:`int` to " +"supply a default count of zero. The increment operation then builds up the " +"count for each letter." msgstr "" -msgid "The function :func:`int` which always returns zero is just a special case of constant functions. A faster and more flexible way to create constant functions is to use a lambda function which can supply any constant value (not just zero):" +#: ../../library/collections.rst:828 +msgid "" +"The function :func:`int` which always returns zero is just a special case of " +"constant functions. A faster and more flexible way to create constant " +"functions is to use a lambda function which can supply any constant value " +"(not just zero):" msgstr "" -msgid "Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes the :class:`defaultdict` useful for building a dictionary of sets:" +#: ../../library/collections.rst:841 +msgid "" +"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes " +"the :class:`defaultdict` useful for building a dictionary of sets:" msgstr "" +#: ../../library/collections.rst:854 msgid ":func:`namedtuple` Factory Function for Tuples with Named Fields" msgstr "" -msgid "Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index." +#: ../../library/collections.rst:856 +msgid "" +"Named tuples assign meaning to each position in a tuple and allow for more " +"readable, self-documenting code. They can be used wherever regular tuples " +"are used, and they add the ability to access fields by name instead of " +"position index." msgstr "" -msgid "Returns a new tuple subclass named *typename*. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as well as being indexable and iterable. Instances of the subclass also have a helpful docstring (with *typename* and *field_names*) and a helpful :meth:`~object.__repr__` method which lists the tuple contents in a ``name=value`` format." +#: ../../library/collections.rst:862 +msgid "" +"Returns a new tuple subclass named *typename*. The new subclass is used to " +"create tuple-like objects that have fields accessible by attribute lookup as " +"well as being indexable and iterable. Instances of the subclass also have a " +"helpful docstring (with *typename* and *field_names*) and a " +"helpful :meth:`~object.__repr__` method which lists the tuple contents in a " +"``name=value`` format." msgstr "" -msgid "The *field_names* are a sequence of strings such as ``['x', 'y']``. Alternatively, *field_names* can be a single string with each fieldname separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``." +#: ../../library/collections.rst:869 +msgid "" +"The *field_names* are a sequence of strings such as ``['x', 'y']``. " +"Alternatively, *field_names* can be a single string with each fieldname " +"separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``." msgstr "" -msgid "Any valid Python identifier may be used for a fieldname except for names starting with an underscore. Valid identifiers consist of letters, digits, and underscores but do not start with a digit or underscore and cannot be a :mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or *raise*." +#: ../../library/collections.rst:873 +msgid "" +"Any valid Python identifier may be used for a fieldname except for names " +"starting with an underscore. Valid identifiers consist of letters, digits, " +"and underscores but do not start with a digit or underscore and cannot be " +"a :mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or " +"*raise*." msgstr "" -msgid "If *rename* is true, invalid fieldnames are automatically replaced with positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is converted to ``['abc', '_1', 'ghi', '_3']``, eliminating the keyword ``def`` and the duplicate fieldname ``abc``." +#: ../../library/collections.rst:879 +msgid "" +"If *rename* is true, invalid fieldnames are automatically replaced with " +"positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is " +"converted to ``['abc', '_1', 'ghi', '_3']``, eliminating the keyword ``def`` " +"and the duplicate fieldname ``abc``." msgstr "" -msgid "*defaults* can be ``None`` or an :term:`iterable` of default values. Since fields with a default value must come after any fields without a default, the *defaults* are applied to the rightmost parameters. For example, if the fieldnames are ``['x', 'y', 'z']`` and the defaults are ``(1, 2)``, then ``x`` will be a required argument, ``y`` will default to ``1``, and ``z`` will default to ``2``." +#: ../../library/collections.rst:884 +msgid "" +"*defaults* can be ``None`` or an :term:`iterable` of default values. Since " +"fields with a default value must come after any fields without a default, " +"the *defaults* are applied to the rightmost parameters. For example, if the " +"fieldnames are ``['x', 'y', 'z']`` and the defaults are ``(1, 2)``, then " +"``x`` will be a required argument, ``y`` will default to ``1``, and ``z`` " +"will default to ``2``." msgstr "" -msgid "If *module* is defined, the :attr:`~type.__module__` attribute of the named tuple is set to that value." +#: ../../library/collections.rst:891 +msgid "" +"If *module* is defined, the :attr:`~type.__module__` attribute of the named " +"tuple is set to that value." msgstr "" -msgid "Named tuple instances do not have per-instance dictionaries, so they are lightweight and require no more memory than regular tuples." +#: ../../library/collections.rst:894 +msgid "" +"Named tuple instances do not have per-instance dictionaries, so they are " +"lightweight and require no more memory than regular tuples." msgstr "" -msgid "To support pickling, the named tuple class should be assigned to a variable that matches *typename*." +#: ../../library/collections.rst:897 +msgid "" +"To support pickling, the named tuple class should be assigned to a variable " +"that matches *typename*." msgstr "" +#: ../../library/collections.rst:900 msgid "Added support for *rename*." msgstr "" -msgid "The *verbose* and *rename* parameters became :ref:`keyword-only arguments `." +#: ../../library/collections.rst:903 +msgid "" +"The *verbose* and *rename* parameters became :ref:`keyword-only arguments " +"`." msgstr "" +#: ../../library/collections.rst:907 msgid "Added the *module* parameter." msgstr "" +#: ../../library/collections.rst:910 msgid "Removed the *verbose* parameter and the :attr:`!_source` attribute." msgstr "" -msgid "Added the *defaults* parameter and the :attr:`~somenamedtuple._field_defaults` attribute." +#: ../../library/collections.rst:913 +msgid "" +"Added the *defaults* parameter and " +"the :attr:`~somenamedtuple._field_defaults` attribute." msgstr "" +#: ../../library/collections.rst:917 msgid "" ">>> # Basic example\n" ">>> Point = namedtuple('Point', ['x', 'y'])\n" -">>> p = Point(11, y=22) # instantiate with positional or keyword arguments\n" +">>> p = Point(11, y=22) # instantiate with positional or keyword " +"arguments\n" ">>> p[0] + p[1] # indexable like the plain tuple (11, 22)\n" "33\n" ">>> x, y = p # unpack like a regular tuple\n" @@ -711,72 +1195,110 @@ msgid "" "Point(x=11, y=22)" msgstr "" -msgid "Named tuples are especially useful for assigning field names to result tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::" +#: ../../library/collections.rst:933 +msgid "" +"Named tuples are especially useful for assigning field names to result " +"tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::" msgstr "" +#: ../../library/collections.rst:936 msgid "" -"EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade')\n" +"EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, " +"paygrade')\n" "\n" "import csv\n" -"for emp in map(EmployeeRecord._make, csv.reader(open(\"employees.csv\", \"rb\"))):\n" +"for emp in map(EmployeeRecord._make, csv.reader(open(\"employees.csv\", " +"\"rb\"))):\n" " print(emp.name, emp.title)\n" "\n" "import sqlite3\n" "conn = sqlite3.connect('/companydata')\n" "cursor = conn.cursor()\n" -"cursor.execute('SELECT name, age, title, department, paygrade FROM employees')\n" +"cursor.execute('SELECT name, age, title, department, paygrade FROM " +"employees')\n" "for emp in map(EmployeeRecord._make, cursor.fetchall()):\n" " print(emp.name, emp.title)" msgstr "" -msgid "In addition to the methods inherited from tuples, named tuples support three additional methods and two attributes. To prevent conflicts with field names, the method and attribute names start with an underscore." +#: ../../library/collections.rst:949 +msgid "" +"In addition to the methods inherited from tuples, named tuples support three " +"additional methods and two attributes. To prevent conflicts with field " +"names, the method and attribute names start with an underscore." msgstr "" -msgid "Class method that makes a new instance from an existing sequence or iterable." +#: ../../library/collections.rst:955 +msgid "" +"Class method that makes a new instance from an existing sequence or iterable." msgstr "" +#: ../../library/collections.rst:957 msgid "" ">>> t = [11, 22]\n" ">>> Point._make(t)\n" "Point(x=11, y=22)" msgstr "" -msgid "Return a new :class:`dict` which maps field names to their corresponding values:" +#: ../../library/collections.rst:965 +msgid "" +"Return a new :class:`dict` which maps field names to their corresponding " +"values:" msgstr "" +#: ../../library/collections.rst:968 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._asdict()\n" "{'x': 11, 'y': 22}" msgstr "" +#: ../../library/collections.rst:974 msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`." msgstr "" -msgid "Returns a regular :class:`dict` instead of an :class:`OrderedDict`. As of Python 3.7, regular dicts are guaranteed to be ordered. If the extra features of :class:`OrderedDict` are required, the suggested remediation is to cast the result to the desired type: ``OrderedDict(nt._asdict())``." +#: ../../library/collections.rst:977 +msgid "" +"Returns a regular :class:`dict` instead of an :class:`OrderedDict`. As of " +"Python 3.7, regular dicts are guaranteed to be ordered. If the extra " +"features of :class:`OrderedDict` are required, the suggested remediation is " +"to cast the result to the desired type: ``OrderedDict(nt._asdict())``." msgstr "" -msgid "Return a new instance of the named tuple replacing specified fields with new values::" +#: ../../library/collections.rst:986 +msgid "" +"Return a new instance of the named tuple replacing specified fields with new " +"values::" msgstr "" +#: ../../library/collections.rst:989 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._replace(x=33)\n" "Point(x=33, y=22)\n" "\n" ">>> for partnum, record in inventory.items():\n" -"... inventory[partnum] = record._replace(price=newprices[partnum], timestamp=time.now())" +"... inventory[partnum] = record._replace(price=newprices[partnum], " +"timestamp=time.now())" msgstr "" -msgid "Named tuples are also supported by generic function :func:`copy.replace`." +#: ../../library/collections.rst:996 +msgid "" +"Named tuples are also supported by generic function :func:`copy.replace`." msgstr "" -msgid "Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword arguments." +#: ../../library/collections.rst:998 +msgid "" +"Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " +"arguments." msgstr "" -msgid "Tuple of strings listing the field names. Useful for introspection and for creating new named tuple types from existing named tuples." +#: ../../library/collections.rst:1004 +msgid "" +"Tuple of strings listing the field names. Useful for introspection and for " +"creating new named tuple types from existing named tuples." msgstr "" +#: ../../library/collections.rst:1007 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -787,9 +1309,11 @@ msgid "" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" +#: ../../library/collections.rst:1019 msgid "Dictionary mapping field names to default values." msgstr "" +#: ../../library/collections.rst:1021 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -798,15 +1322,26 @@ msgid "" "Account(type='premium', balance=0)" msgstr "" -msgid "To retrieve a field whose name is stored in a string, use the :func:`getattr` function:" +#: ../../library/collections.rst:1029 +msgid "" +"To retrieve a field whose name is stored in a string, use " +"the :func:`getattr` function:" msgstr "" -msgid "To convert a dictionary to a named tuple, use the double-star-operator (as described in :ref:`tut-unpacking-arguments`):" +#: ../../library/collections.rst:1035 +msgid "" +"To convert a dictionary to a named tuple, use the double-star-operator (as " +"described in :ref:`tut-unpacking-arguments`):" msgstr "" -msgid "Since a named tuple is a regular Python class, it is easy to add or change functionality with a subclass. Here is how to add a calculated field and a fixed-width print format:" +#: ../../library/collections.rst:1042 +msgid "" +"Since a named tuple is a regular Python class, it is easy to add or change " +"functionality with a subclass. Here is how to add a calculated field and a " +"fixed-width print format:" msgstr "" +#: ../../library/collections.rst:1046 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -814,7 +1349,8 @@ msgid "" "... def hypot(self):\n" "... return (self.x ** 2 + self.y ** 2) ** 0.5\n" "... def __str__(self):\n" -"... return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)\n" +"... return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, " +"self.hypot)\n" "\n" ">>> for p in Point(3, 4), Point(14, 5/7):\n" "... print(p)\n" @@ -822,21 +1358,38 @@ msgid "" "Point: x=14.000 y= 0.714 hypot=14.018" msgstr "" -msgid "The subclass shown above sets ``__slots__`` to an empty tuple. This helps keep memory requirements low by preventing the creation of instance dictionaries." +#: ../../library/collections.rst:1061 +msgid "" +"The subclass shown above sets ``__slots__`` to an empty tuple. This helps " +"keep memory requirements low by preventing the creation of instance " +"dictionaries." msgstr "" -msgid "Subclassing is not useful for adding new, stored fields. Instead, simply create a new named tuple type from the :attr:`~somenamedtuple._fields` attribute:" +#: ../../library/collections.rst:1064 +msgid "" +"Subclassing is not useful for adding new, stored fields. Instead, simply " +"create a new named tuple type from the :attr:`~somenamedtuple._fields` " +"attribute:" msgstr "" -msgid "Docstrings can be customized by making direct assignments to the ``__doc__`` fields:" +#: ../../library/collections.rst:1069 +msgid "" +"Docstrings can be customized by making direct assignments to the ``__doc__`` " +"fields:" msgstr "" +#: ../../library/collections.rst:1078 msgid "Property docstrings became writeable." msgstr "" -msgid "See :class:`typing.NamedTuple` for a way to add type hints for named tuples. It also provides an elegant notation using the :keyword:`class` keyword::" +#: ../../library/collections.rst:1083 +msgid "" +"See :class:`typing.NamedTuple` for a way to add type hints for named " +"tuples. It also provides an elegant notation using the :keyword:`class` " +"keyword::" msgstr "" +#: ../../library/collections.rst:1087 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" @@ -844,66 +1397,132 @@ msgid "" " description: Optional[str] = None" msgstr "" -msgid "See :meth:`types.SimpleNamespace` for a mutable namespace based on an underlying dictionary instead of a tuple." +#: ../../library/collections.rst:1092 +msgid "" +"See :meth:`types.SimpleNamespace` for a mutable namespace based on an " +"underlying dictionary instead of a tuple." msgstr "" -msgid "The :mod:`dataclasses` module provides a decorator and functions for automatically adding generated special methods to user-defined classes." +#: ../../library/collections.rst:1095 +msgid "" +"The :mod:`dataclasses` module provides a decorator and functions for " +"automatically adding generated special methods to user-defined classes." msgstr "" +#: ../../library/collections.rst:1100 msgid ":class:`OrderedDict` objects" msgstr "" -msgid "Ordered dictionaries are just like regular dictionaries but have some extra capabilities relating to ordering operations. They have become less important now that the built-in :class:`dict` class gained the ability to remember insertion order (this new behavior became guaranteed in Python 3.7)." +#: ../../library/collections.rst:1102 +msgid "" +"Ordered dictionaries are just like regular dictionaries but have some extra " +"capabilities relating to ordering operations. They have become less " +"important now that the built-in :class:`dict` class gained the ability to " +"remember insertion order (this new behavior became guaranteed in Python 3.7)." msgstr "" +#: ../../library/collections.rst:1108 msgid "Some differences from :class:`dict` still remain:" msgstr "" -msgid "The regular :class:`dict` was designed to be very good at mapping operations. Tracking insertion order was secondary." +#: ../../library/collections.rst:1110 +msgid "" +"The regular :class:`dict` was designed to be very good at mapping " +"operations. Tracking insertion order was secondary." msgstr "" -msgid "The :class:`OrderedDict` was designed to be good at reordering operations. Space efficiency, iteration speed, and the performance of update operations were secondary." +#: ../../library/collections.rst:1113 +msgid "" +"The :class:`OrderedDict` was designed to be good at reordering operations. " +"Space efficiency, iteration speed, and the performance of update operations " +"were secondary." msgstr "" -msgid "The :class:`OrderedDict` algorithm can handle frequent reordering operations better than :class:`dict`. As shown in the recipes below, this makes it suitable for implementing various kinds of LRU caches." +#: ../../library/collections.rst:1117 +msgid "" +"The :class:`OrderedDict` algorithm can handle frequent reordering operations " +"better than :class:`dict`. As shown in the recipes below, this makes it " +"suitable for implementing various kinds of LRU caches." msgstr "" -msgid "The equality operation for :class:`OrderedDict` checks for matching order." +#: ../../library/collections.rst:1121 +msgid "" +"The equality operation for :class:`OrderedDict` checks for matching order." msgstr "" -msgid "A regular :class:`dict` can emulate the order sensitive equality test with ``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." +#: ../../library/collections.rst:1123 +msgid "" +"A regular :class:`dict` can emulate the order sensitive equality test with " +"``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." msgstr "" -msgid "The :meth:`~OrderedDict.popitem` method of :class:`OrderedDict` has a different signature. It accepts an optional argument to specify which item is popped." +#: ../../library/collections.rst:1126 +msgid "" +"The :meth:`~OrderedDict.popitem` method of :class:`OrderedDict` has a " +"different signature. It accepts an optional argument to specify which item " +"is popped." msgstr "" -msgid "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." +#: ../../library/collections.rst:1129 +msgid "" +"A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " +"with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." msgstr "" -msgid "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the leftmost (first) item if it exists." +#: ../../library/collections.rst:1132 +msgid "" +"A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " +"with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " +"leftmost (first) item if it exists." msgstr "" -msgid ":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to efficiently reposition an element to an endpoint." +#: ../../library/collections.rst:1136 +msgid "" +":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to " +"efficiently reposition an element to an endpoint." msgstr "" -msgid "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its associated value to the rightmost (last) position." +#: ../../library/collections.rst:1139 +msgid "" +"A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " +"last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " +"associated value to the rightmost (last) position." msgstr "" -msgid "A regular :class:`dict` does not have an efficient equivalent for OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its associated value to the leftmost (first) position." +#: ../../library/collections.rst:1143 +msgid "" +"A regular :class:`dict` does not have an efficient equivalent for " +"OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " +"associated value to the leftmost (first) position." msgstr "" -msgid "Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." +#: ../../library/collections.rst:1147 +msgid "" +"Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." msgstr "" -msgid "Return an instance of a :class:`dict` subclass that has methods specialized for rearranging dictionary order." +#: ../../library/collections.rst:1154 +msgid "" +"Return an instance of a :class:`dict` subclass that has methods specialized " +"for rearranging dictionary order." msgstr "" -msgid "The :meth:`popitem` method for ordered dictionaries returns and removes a (key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-out)` order if *last* is true or :abbr:`FIFO (first-in, first-out)` order if false." +#: ../../library/collections.rst:1161 +msgid "" +"The :meth:`popitem` method for ordered dictionaries returns and removes a " +"(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" +"out)` order if *last* is true or :abbr:`FIFO (first-in, first-out)` order if " +"false." msgstr "" -msgid "Move an existing *key* to either end of an ordered dictionary. The item is moved to the right end if *last* is true (the default) or to the beginning if *last* is false. Raises :exc:`KeyError` if the *key* does not exist:" +#: ../../library/collections.rst:1168 +msgid "" +"Move an existing *key* to either end of an ordered dictionary. The item is " +"moved to the right end if *last* is true (the default) or to the beginning " +"if *last* is false. Raises :exc:`KeyError` if the *key* does not exist:" msgstr "" +#: ../../library/collections.rst:1173 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -914,27 +1533,52 @@ msgid "" "'bacde'" msgstr "" -msgid "In addition to the usual mapping methods, ordered dictionaries also support reverse iteration using :func:`reversed`." +#: ../../library/collections.rst:1185 +msgid "" +"In addition to the usual mapping methods, ordered dictionaries also support " +"reverse iteration using :func:`reversed`." msgstr "" -msgid "Equality tests between :class:`OrderedDict` objects are order-sensitive and are roughly equivalent to ``list(od1.items())==list(od2.items())``." +#: ../../library/collections.rst:1190 +msgid "" +"Equality tests between :class:`OrderedDict` objects are order-sensitive and " +"are roughly equivalent to ``list(od1.items())==list(od2.items())``." msgstr "" -msgid "Equality tests between :class:`OrderedDict` objects and other :class:`~collections.abc.Mapping` objects are order-insensitive like regular dictionaries. This allows :class:`OrderedDict` objects to be substituted anywhere a regular dictionary is used." +#: ../../library/collections.rst:1193 +msgid "" +"Equality tests between :class:`OrderedDict` objects and " +"other :class:`~collections.abc.Mapping` objects are order-insensitive like " +"regular dictionaries. This allows :class:`OrderedDict` objects to be " +"substituted anywhere a regular dictionary is used." msgstr "" -msgid "The items, keys, and values :term:`views ` of :class:`OrderedDict` now support reverse iteration using :func:`reversed`." +#: ../../library/collections.rst:1198 +msgid "" +"The items, keys, and values :term:`views ` " +"of :class:`OrderedDict` now support reverse iteration using :func:`reversed`." msgstr "" -msgid "With the acceptance of :pep:`468`, order is retained for keyword arguments passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` method." +#: ../../library/collections.rst:1202 +msgid "" +"With the acceptance of :pep:`468`, order is retained for keyword arguments " +"passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` " +"method." msgstr "" +#: ../../library/collections.rst:1212 msgid ":class:`OrderedDict` Examples and Recipes" msgstr "" -msgid "It is straightforward to create an ordered dictionary variant that remembers the order the keys were *last* inserted. If a new entry overwrites an existing entry, the original insertion position is changed and moved to the end::" +#: ../../library/collections.rst:1214 +msgid "" +"It is straightforward to create an ordered dictionary variant that remembers " +"the order the keys were *last* inserted. If a new entry overwrites an " +"existing entry, the original insertion position is changed and moved to the " +"end::" msgstr "" +#: ../../library/collections.rst:1219 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -944,9 +1588,13 @@ msgid "" " self.move_to_end(key)" msgstr "" -msgid "An :class:`OrderedDict` would also be useful for implementing variants of :func:`functools.lru_cache`:" +#: ../../library/collections.rst:1226 +msgid "" +"An :class:`OrderedDict` would also be useful for implementing variants " +"of :deco:`functools.lru_cache`:" msgstr "" +#: ../../library/collections.rst:1229 msgid "" "from collections import OrderedDict\n" "from time import monotonic\n" @@ -973,6 +1621,7 @@ msgid "" " return result" msgstr "" +#: ../../library/collections.rst:1256 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -988,7 +1637,8 @@ msgid "" " self.cache = OrderedDict() # { cached_key : function_result }\n" " self.func = func\n" " self.maxrequests = maxrequests # max number of uncached requests\n" -" self.maxsize = maxsize # max number of stored return values\n" +" self.maxsize = maxsize # max number of stored return " +"values\n" " self.cache_after = cache_after\n" "\n" " def __call__(self, *args):\n" @@ -1009,59 +1659,130 @@ msgid "" " return result" msgstr "" +#: ../../library/collections.rst:1325 msgid ":class:`UserDict` objects" msgstr "" -msgid "The class, :class:`UserDict` acts as a wrapper around dictionary objects. The need for this class has been partially supplanted by the ability to subclass directly from :class:`dict`; however, this class can be easier to work with because the underlying dictionary is accessible as an attribute." +#: ../../library/collections.rst:1327 +msgid "" +"The class, :class:`UserDict` acts as a wrapper around dictionary objects. " +"The need for this class has been partially supplanted by the ability to " +"subclass directly from :class:`dict`; however, this class can be easier to " +"work with because the underlying dictionary is accessible as an attribute." msgstr "" -msgid "Class that simulates a dictionary. The instance's contents are kept in a regular dictionary, which is accessible via the :attr:`data` attribute of :class:`!UserDict` instances. If arguments are provided, they are used to initialize :attr:`data`, like a regular dictionary." +#: ../../library/collections.rst:1337 +msgid "" +"Class that simulates a dictionary. The instance's contents are kept in a " +"regular dictionary, which is accessible via the :attr:`data` attribute " +"of :class:`!UserDict` instances. If arguments are provided, they are used " +"to initialize :attr:`data`, like a regular dictionary." msgstr "" -msgid "In addition to supporting the methods and operations of mappings, :class:`!UserDict` instances provide the following attribute:" +#: ../../library/collections.rst:1342 +msgid "" +"In addition to supporting the methods and operations of mappings, :class:`!" +"UserDict` instances provide the following attribute:" msgstr "" -msgid "A real dictionary used to store the contents of the :class:`UserDict` class." +#: ../../library/collections.rst:1347 +msgid "" +"A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "" +#: ../../library/collections.rst:1353 msgid ":class:`UserList` objects" msgstr "" -msgid "This class acts as a wrapper around list objects. It is a useful base class for your own list-like classes which can inherit from them and override existing methods or add new ones. In this way, one can add new behaviors to lists." +#: ../../library/collections.rst:1355 +msgid "" +"This class acts as a wrapper around list objects. It is a useful base class " +"for your own list-like classes which can inherit from them and override " +"existing methods or add new ones. In this way, one can add new behaviors to " +"lists." msgstr "" -msgid "The need for this class has been partially supplanted by the ability to subclass directly from :class:`list`; however, this class can be easier to work with because the underlying list is accessible as an attribute." +#: ../../library/collections.rst:1360 +msgid "" +"The need for this class has been partially supplanted by the ability to " +"subclass directly from :class:`list`; however, this class can be easier to " +"work with because the underlying list is accessible as an attribute." msgstr "" -msgid "Class that simulates a list. The instance's contents are kept in a regular list, which is accessible via the :attr:`data` attribute of :class:`UserList` instances. The instance's contents are initially set to a copy of *list*, defaulting to the empty list ``[]``. *list* can be any iterable, for example a real Python list or a :class:`UserList` object." +#: ../../library/collections.rst:1366 +msgid "" +"Class that simulates a list. The instance's contents are kept in a regular " +"list, which is accessible via the :attr:`data` attribute " +"of :class:`UserList` instances. The instance's contents are initially set " +"to a copy of *list*, defaulting to the empty list ``[]``. *list* can be any " +"iterable, for example a real Python list or a :class:`UserList` object." msgstr "" -msgid "In addition to supporting the methods and operations of mutable sequences, :class:`UserList` instances provide the following attribute:" +#: ../../library/collections.rst:1372 +msgid "" +"In addition to supporting the methods and operations of mutable " +"sequences, :class:`UserList` instances provide the following attribute:" msgstr "" -msgid "A real :class:`list` object used to store the contents of the :class:`UserList` class." +#: ../../library/collections.rst:1377 +msgid "" +"A real :class:`list` object used to store the contents of " +"the :class:`UserList` class." msgstr "" -msgid "**Subclassing requirements:** Subclasses of :class:`UserList` are expected to offer a constructor which can be called with either no arguments or one argument. List operations which return a new sequence attempt to create an instance of the actual implementation class. To do so, it assumes that the constructor can be called with a single parameter, which is a sequence object used as a data source." +#: ../../library/collections.rst:1380 +msgid "" +"**Subclassing requirements:** Subclasses of :class:`UserList` are expected " +"to offer a constructor which can be called with either no arguments or one " +"argument. List operations which return a new sequence attempt to create an " +"instance of the actual implementation class. To do so, it assumes that the " +"constructor can be called with a single parameter, which is a sequence " +"object used as a data source." msgstr "" -msgid "If a derived class does not wish to comply with this requirement, all of the special methods supported by this class will need to be overridden; please consult the sources for information about the methods which need to be provided in that case." +#: ../../library/collections.rst:1387 +msgid "" +"If a derived class does not wish to comply with this requirement, all of the " +"special methods supported by this class will need to be overridden; please " +"consult the sources for information about the methods which need to be " +"provided in that case." msgstr "" +#: ../../library/collections.rst:1393 msgid ":class:`UserString` objects" msgstr "" -msgid "The class, :class:`UserString` acts as a wrapper around string objects. The need for this class has been partially supplanted by the ability to subclass directly from :class:`str`; however, this class can be easier to work with because the underlying string is accessible as an attribute." +#: ../../library/collections.rst:1395 +msgid "" +"The class, :class:`UserString` acts as a wrapper around string objects. The " +"need for this class has been partially supplanted by the ability to subclass " +"directly from :class:`str`; however, this class can be easier to work with " +"because the underlying string is accessible as an attribute." msgstr "" -msgid "Class that simulates a string object. The instance's content is kept in a regular string object, which is accessible via the :attr:`data` attribute of :class:`UserString` instances. The instance's contents are initially set to a copy of *seq*. The *seq* argument can be any object which can be converted into a string using the built-in :func:`str` function." +#: ../../library/collections.rst:1403 +msgid "" +"Class that simulates a string object. The instance's content is kept in a " +"regular string object, which is accessible via the :attr:`data` attribute " +"of :class:`UserString` instances. The instance's contents are initially set " +"to a copy of *seq*. The *seq* argument can be any object which can be " +"converted into a string using the built-in :func:`str` function." msgstr "" -msgid "In addition to supporting the methods and operations of strings, :class:`UserString` instances provide the following attribute:" +#: ../../library/collections.rst:1410 +msgid "" +"In addition to supporting the methods and operations of " +"strings, :class:`UserString` instances provide the following attribute:" msgstr "" -msgid "A real :class:`str` object used to store the contents of the :class:`UserString` class." +#: ../../library/collections.rst:1415 +msgid "" +"A real :class:`str` object used to store the contents of " +"the :class:`UserString` class." msgstr "" -msgid "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, ``isprintable``, and ``maketrans``." +#: ../../library/collections.rst:1418 +msgid "" +"New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " +"``isprintable``, and ``maketrans``." msgstr "" diff --git a/library/colorsys.po b/library/colorsys.po index c3bc455c7..6ee2ddbec 100644 --- a/library/colorsys.po +++ b/library/colorsys.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,42 +23,65 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/colorsys.rst:2 msgid ":mod:`!colorsys` --- Conversions between color systems" msgstr "" +#: ../../library/colorsys.rst:9 msgid "**Source code:** :source:`Lib/colorsys.py`" msgstr "" -msgid "The :mod:`!colorsys` module defines bidirectional conversions of color values between colors expressed in the RGB (Red Green Blue) color space used in computer monitors and three other coordinate systems: YIQ, HLS (Hue Lightness Saturation) and HSV (Hue Saturation Value). Coordinates in all of these color spaces are floating-point values. In the YIQ space, the Y coordinate is between 0 and 1, but the I and Q coordinates can be positive or negative. In all other spaces, the coordinates are all between 0 and 1." +#: ../../library/colorsys.rst:13 +msgid "" +"The :mod:`!colorsys` module defines bidirectional conversions of color " +"values between colors expressed in the RGB (Red Green Blue) color space used " +"in computer monitors and three other coordinate systems: YIQ, HLS (Hue " +"Lightness Saturation) and HSV (Hue Saturation Value). Coordinates in all of " +"these color spaces are floating-point values. In the YIQ space, the Y " +"coordinate is between 0 and 1, but the I and Q coordinates can be positive " +"or negative. In all other spaces, the coordinates are all between 0 and 1." msgstr "" -msgid "More information about color spaces can be found at https://poynton.ca/ColorFAQ.html and https://www.cambridgeincolour.com/tutorials/color-spaces.htm." +#: ../../library/colorsys.rst:23 +msgid "" +"More information about color spaces can be found at https://poynton.ca/" +"ColorFAQ.html and https://www.cambridgeincolour.com/tutorials/color-" +"spaces.htm." msgstr "" +#: ../../library/colorsys.rst:27 msgid "The :mod:`!colorsys` module defines the following functions:" msgstr "" +#: ../../library/colorsys.rst:32 msgid "Convert the color from RGB coordinates to YIQ coordinates." msgstr "" +#: ../../library/colorsys.rst:37 msgid "Convert the color from YIQ coordinates to RGB coordinates." msgstr "" +#: ../../library/colorsys.rst:42 msgid "Convert the color from RGB coordinates to HLS coordinates." msgstr "" +#: ../../library/colorsys.rst:47 msgid "Convert the color from HLS coordinates to RGB coordinates." msgstr "" +#: ../../library/colorsys.rst:52 msgid "Convert the color from RGB coordinates to HSV coordinates." msgstr "" +#: ../../library/colorsys.rst:57 msgid "Convert the color from HSV coordinates to RGB coordinates." msgstr "" +#: ../../library/colorsys.rst:59 msgid "Example::" msgstr "" +#: ../../library/colorsys.rst:61 msgid "" ">>> import colorsys\n" ">>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)\n" diff --git a/library/compileall.po b/library/compileall.po index 7c0393850..d030da538 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,186 +23,390 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/compileall.rst:2 msgid ":mod:`!compileall` --- Byte-compile Python libraries" msgstr "" +#: ../../library/compileall.rst:7 msgid "**Source code:** :source:`Lib/compileall.py`" msgstr "" -msgid "This module provides some utility functions to support installing Python libraries. These functions compile Python source files in a directory tree. This module can be used to create the cached byte-code files at library installation time, which makes them available for use even by users who don't have write permission to the library directories." +#: ../../library/compileall.rst:11 +msgid "" +"This module provides some utility functions to support installing Python " +"libraries. These functions compile Python source files in a directory tree. " +"This module can be used to create the cached byte-code files at library " +"installation time, which makes them available for use even by users who " +"don't have write permission to the library directories." msgstr "" +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/compileall.rst:22 msgid "Command-line use" msgstr "" -msgid "This module can work as a script (using :program:`python -m compileall`) to compile Python sources." +#: ../../library/compileall.rst:24 +msgid "" +"This module can work as a script (using :program:`python -m compileall`) to " +"compile Python sources." msgstr "" -msgid "Positional arguments are files to compile or directories that contain source files, traversed recursively. If no argument is given, behave as if the command line was :samp:`-l {}`." +#: ../../library/compileall.rst:32 +msgid "" +"Positional arguments are files to compile or directories that contain source " +"files, traversed recursively. If no argument is given, behave as if the " +"command line was :samp:`-l {}`." msgstr "" -msgid "Do not recurse into subdirectories, only compile source code files directly contained in the named or implied directories." +#: ../../library/compileall.rst:38 +msgid "" +"Do not recurse into subdirectories, only compile source code files directly " +"contained in the named or implied directories." msgstr "" +#: ../../library/compileall.rst:43 msgid "Force rebuild even if timestamps are up-to-date." msgstr "" -msgid "Do not print the list of files compiled. If passed once, error messages will still be printed. If passed twice (``-qq``), all output is suppressed." +#: ../../library/compileall.rst:47 +msgid "" +"Do not print the list of files compiled. If passed once, error messages will " +"still be printed. If passed twice (``-qq``), all output is suppressed." msgstr "" -msgid "Directory prepended to the path to each file being compiled. This will appear in compilation time tracebacks, and is also compiled in to the byte-code file, where it will be used in tracebacks and other messages in cases where the source file does not exist at the time the byte-code file is executed." +#: ../../library/compileall.rst:52 +msgid "" +"Directory prepended to the path to each file being compiled. This will " +"appear in compilation time tracebacks, and is also compiled in to the byte-" +"code file, where it will be used in tracebacks and other messages in cases " +"where the source file does not exist at the time the byte-code file is " +"executed." msgstr "" -msgid "Remove the given prefix from paths recorded in the ``.pyc`` files. Paths are made relative to the prefix." +#: ../../library/compileall.rst:60 +msgid "" +"Remove the given prefix from paths recorded in the ``.pyc`` files. Paths are " +"made relative to the prefix." msgstr "" +#: ../../library/compileall.rst:63 msgid "This option can be used with ``-p`` but not with ``-d``." msgstr "" -msgid "Prepend the given prefix to paths recorded in the ``.pyc`` files. Use ``-p /`` to make the paths absolute." +#: ../../library/compileall.rst:67 +msgid "" +"Prepend the given prefix to paths recorded in the ``.pyc`` files. Use ``-p /" +"`` to make the paths absolute." msgstr "" +#: ../../library/compileall.rst:70 msgid "This option can be used with ``-s`` but not with ``-d``." msgstr "" -msgid "regex is used to search the full path to each file considered for compilation, and if the regex produces a match, the file is skipped." -msgstr "" - -msgid "Read the file ``list`` and add each line that it contains to the list of files and directories to compile. If ``list`` is ``-``, read lines from ``stdin``." +#: ../../library/compileall.rst:74 +msgid "" +"regex is used to search the full path to each file considered for " +"compilation, and if the regex produces a match, the file is skipped." msgstr "" -msgid "Write the byte-code files to their legacy locations and names, which may overwrite byte-code files created by another version of Python. The default is to write files to their :pep:`3147` locations and names, which allows byte-code files from multiple versions of Python to coexist." +#: ../../library/compileall.rst:79 +msgid "" +"Read the file ``list`` and add each line that it contains to the list of " +"files and directories to compile. If ``list`` is ``-``, read lines from " +"``stdin``." msgstr "" -msgid "Control the maximum recursion level for subdirectories. If this is given, then ``-l`` option will not be taken into account. :program:`python -m compileall -r 0` is equivalent to :program:`python -m compileall -l`." +#: ../../library/compileall.rst:85 +msgid "" +"Write the byte-code files to their legacy locations and names, which may " +"overwrite byte-code files created by another version of Python. The default " +"is to write files to their :pep:`3147` locations and names, which allows " +"byte-code files from multiple versions of Python to coexist." msgstr "" -msgid "Use *N* workers to compile the files within the given directory. If ``0`` is used, then the result of :func:`os.process_cpu_count` will be used." +#: ../../library/compileall.rst:92 +msgid "" +"Control the maximum recursion level for subdirectories. If this is given, " +"then ``-l`` option will not be taken into account. :program:`python -m " +"compileall -r 0` is equivalent to :program:`python -m compileall " +" -l`." msgstr "" -msgid "Control how the generated byte-code files are invalidated at runtime. The ``timestamp`` value, means that ``.pyc`` files with the source timestamp and size embedded will be generated. The ``checked-hash`` and ``unchecked-hash`` values cause hash-based pycs to be generated. Hash-based pycs embed a hash of the source file contents rather than a timestamp. See :ref:`pyc-invalidation` for more information on how Python validates bytecode cache files at runtime. The default is ``timestamp`` if the :envvar:`SOURCE_DATE_EPOCH` environment variable is not set, and ``checked-hash`` if the ``SOURCE_DATE_EPOCH`` environment variable is set." +#: ../../library/compileall.rst:99 +msgid "" +"Use *N* workers to compile the files within the given directory. If ``0`` is " +"used, then the result of :func:`os.process_cpu_count` will be used." msgstr "" -msgid "Compile with the given optimization level. May be used multiple times to compile for multiple levels at a time (for example, ``compileall -o 1 -o 2``)." +#: ../../library/compileall.rst:105 +msgid "" +"Control how the generated byte-code files are invalidated at runtime. The " +"``timestamp`` value, means that ``.pyc`` files with the source timestamp and " +"size embedded will be generated. The ``checked-hash`` and ``unchecked-hash`` " +"values cause hash-based pycs to be generated. Hash-based pycs embed a hash " +"of the source file contents rather than a timestamp. See :ref:`pyc-" +"invalidation` for more information on how Python validates bytecode cache " +"files at runtime. The default is ``timestamp`` if " +"the :envvar:`SOURCE_DATE_EPOCH` environment variable is not set, and " +"``checked-hash`` if the ``SOURCE_DATE_EPOCH`` environment variable is set." +msgstr "" + +#: ../../library/compileall.rst:118 +msgid "" +"Compile with the given optimization level. May be used multiple times to " +"compile for multiple levels at a time (for example, ``compileall -o 1 -o " +"2``)." msgstr "" +#: ../../library/compileall.rst:124 msgid "Ignore symlinks pointing outside the given directory." msgstr "" -msgid "If two ``.pyc`` files with different optimization level have the same content, use hard links to consolidate duplicate files." +#: ../../library/compileall.rst:128 +msgid "" +"If two ``.pyc`` files with different optimization level have the same " +"content, use hard links to consolidate duplicate files." msgstr "" +#: ../../library/compileall.rst:131 msgid "Added the ``-i``, ``-b`` and ``-h`` options." msgstr "" -msgid "Added the ``-j``, ``-r``, and ``-qq`` options. ``-q`` option was changed to a multilevel value. ``-b`` will always produce a byte-code file ending in ``.pyc``, never ``.pyo``." +#: ../../library/compileall.rst:134 +msgid "" +"Added the ``-j``, ``-r``, and ``-qq`` options. ``-q`` option was changed " +"to a multilevel value. ``-b`` will always produce a byte-code file ending " +"in ``.pyc``, never ``.pyo``." msgstr "" +#: ../../library/compileall.rst:139 msgid "Added the ``--invalidation-mode`` option." msgstr "" -msgid "Added the ``-s``, ``-p``, ``-e`` and ``--hardlink-dupes`` options. Raised the default recursion limit from 10 to :py:func:`sys.getrecursionlimit()`. Added the possibility to specify the ``-o`` option multiple times." +#: ../../library/compileall.rst:142 +msgid "" +"Added the ``-s``, ``-p``, ``-e`` and ``--hardlink-dupes`` options. Raised " +"the default recursion limit from 10 to :py:func:`sys.getrecursionlimit()`. " +"Added the possibility to specify the ``-o`` option multiple times." msgstr "" -msgid "There is no command-line option to control the optimization level used by the :func:`compile` function, because the Python interpreter itself already provides the option: :program:`python -O -m compileall`." +#: ../../library/compileall.rst:149 +msgid "" +"There is no command-line option to control the optimization level used by " +"the :func:`compile` function, because the Python interpreter itself already " +"provides the option: :program:`python -O -m compileall`." msgstr "" -msgid "Similarly, the :func:`compile` function respects the :data:`sys.pycache_prefix` setting. The generated bytecode cache will only be useful if :func:`compile` is run with the same :data:`sys.pycache_prefix` (if any) that will be used at runtime." +#: ../../library/compileall.rst:153 +msgid "" +"Similarly, the :func:`compile` function respects " +"the :data:`sys.pycache_prefix` setting. The generated bytecode cache will " +"only be useful if :func:`compile` is run with the " +"same :data:`sys.pycache_prefix` (if any) that will be used at runtime." msgstr "" +#: ../../library/compileall.rst:159 msgid "Public functions" msgstr "" -msgid "Recursively descend the directory tree named by *dir*, compiling all :file:`.py` files along the way. Return a true value if all the files compiled successfully, and a false value otherwise." +#: ../../library/compileall.rst:163 +msgid "" +"Recursively descend the directory tree named by *dir*, compiling " +"all :file:`.py` files along the way. Return a true value if all the files " +"compiled successfully, and a false value otherwise." msgstr "" -msgid "The *maxlevels* parameter is used to limit the depth of the recursion; it defaults to ``sys.getrecursionlimit()``." +#: ../../library/compileall.rst:167 +msgid "" +"The *maxlevels* parameter is used to limit the depth of the recursion; it " +"defaults to ``sys.getrecursionlimit()``." msgstr "" -msgid "If *ddir* is given, it is prepended to the path to each file being compiled for use in compilation time tracebacks, and is also compiled in to the byte-code file, where it will be used in tracebacks and other messages in cases where the source file does not exist at the time the byte-code file is executed." +#: ../../library/compileall.rst:170 +msgid "" +"If *ddir* is given, it is prepended to the path to each file being compiled " +"for use in compilation time tracebacks, and is also compiled in to the byte-" +"code file, where it will be used in tracebacks and other messages in cases " +"where the source file does not exist at the time the byte-code file is " +"executed." msgstr "" -msgid "If *force* is true, modules are re-compiled even if the timestamps are up to date." +#: ../../library/compileall.rst:176 +msgid "" +"If *force* is true, modules are re-compiled even if the timestamps are up to " +"date." msgstr "" -msgid "If *rx* is given, its ``search`` method is called on the complete path to each file considered for compilation, and if it returns a true value, the file is skipped. This can be used to exclude files matching a regular expression, given as a :ref:`re.Pattern ` object." +#: ../../library/compileall.rst:179 +msgid "" +"If *rx* is given, its ``search`` method is called on the complete path to " +"each file considered for compilation, and if it returns a true value, the " +"file is skipped. This can be used to exclude files matching a regular " +"expression, given as a :ref:`re.Pattern ` object." msgstr "" -msgid "If *quiet* is ``False`` or ``0`` (the default), the filenames and other information are printed to standard out. Set to ``1``, only errors are printed. Set to ``2``, all output is suppressed." +#: ../../library/compileall.rst:184 ../../library/compileall.rst:261 +msgid "" +"If *quiet* is ``False`` or ``0`` (the default), the filenames and other " +"information are printed to standard out. Set to ``1``, only errors are " +"printed. Set to ``2``, all output is suppressed." msgstr "" -msgid "If *legacy* is true, byte-code files are written to their legacy locations and names, which may overwrite byte-code files created by another version of Python. The default is to write files to their :pep:`3147` locations and names, which allows byte-code files from multiple versions of Python to coexist." +#: ../../library/compileall.rst:188 ../../library/compileall.rst:265 +msgid "" +"If *legacy* is true, byte-code files are written to their legacy locations " +"and names, which may overwrite byte-code files created by another version of " +"Python. The default is to write files to their :pep:`3147` locations and " +"names, which allows byte-code files from multiple versions of Python to " +"coexist." msgstr "" -msgid "*optimize* specifies the optimization level for the compiler. It is passed to the built-in :func:`compile` function. Accepts also a sequence of optimization levels which lead to multiple compilations of one :file:`.py` file in one call." +#: ../../library/compileall.rst:194 ../../library/compileall.rst:271 +msgid "" +"*optimize* specifies the optimization level for the compiler. It is passed " +"to the built-in :func:`compile` function. Accepts also a sequence of " +"optimization levels which lead to multiple compilations of one :file:`.py` " +"file in one call." msgstr "" -msgid "The argument *workers* specifies how many workers are used to compile files in parallel. The default is to not use multiple workers. If the platform can't use multiple workers and *workers* argument is given, then sequential compilation will be used as a fallback. If *workers* is 0, the number of cores in the system is used. If *workers* is lower than ``0``, a :exc:`ValueError` will be raised." +#: ../../library/compileall.rst:198 +msgid "" +"The argument *workers* specifies how many workers are used to compile files " +"in parallel. The default is to not use multiple workers. If the platform " +"can't use multiple workers and *workers* argument is given, then sequential " +"compilation will be used as a fallback. If *workers* is 0, the number of " +"cores in the system is used. If *workers* is lower than ``0``, " +"a :exc:`ValueError` will be raised." msgstr "" -msgid "*invalidation_mode* should be a member of the :class:`py_compile.PycInvalidationMode` enum and controls how the generated pycs are invalidated at runtime." +#: ../../library/compileall.rst:205 ../../library/compileall.rst:275 +msgid "" +"*invalidation_mode* should be a member of " +"the :class:`py_compile.PycInvalidationMode` enum and controls how the " +"generated pycs are invalidated at runtime." msgstr "" -msgid "The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the ``-s``, ``-p`` and ``-e`` options described above. They may be specified as ``str`` or :py:class:`os.PathLike`." +#: ../../library/compileall.rst:209 ../../library/compileall.rst:279 +msgid "" +"The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the " +"``-s``, ``-p`` and ``-e`` options described above. They may be specified as " +"``str`` or :py:class:`os.PathLike`." msgstr "" -msgid "If *hardlink_dupes* is true and two ``.pyc`` files with different optimization level have the same content, use hard links to consolidate duplicate files." +#: ../../library/compileall.rst:213 ../../library/compileall.rst:283 +msgid "" +"If *hardlink_dupes* is true and two ``.pyc`` files with different " +"optimization level have the same content, use hard links to consolidate " +"duplicate files." msgstr "" +#: ../../library/compileall.rst:216 ../../library/compileall.rst:314 msgid "Added the *legacy* and *optimize* parameter." msgstr "" +#: ../../library/compileall.rst:219 msgid "Added the *workers* parameter." msgstr "" +#: ../../library/compileall.rst:222 ../../library/compileall.rst:288 +#: ../../library/compileall.rst:317 msgid "*quiet* parameter was changed to a multilevel value." msgstr "" -msgid "The *legacy* parameter only writes out ``.pyc`` files, not ``.pyo`` files no matter what the value of *optimize* is." +#: ../../library/compileall.rst:225 ../../library/compileall.rst:291 +#: ../../library/compileall.rst:320 +msgid "" +"The *legacy* parameter only writes out ``.pyc`` files, not ``.pyo`` files no " +"matter what the value of *optimize* is." msgstr "" +#: ../../library/compileall.rst:229 msgid "Accepts a :term:`path-like object`." msgstr "" +#: ../../library/compileall.rst:232 ../../library/compileall.rst:295 +#: ../../library/compileall.rst:324 msgid "The *invalidation_mode* parameter was added." msgstr "" -msgid "The *invalidation_mode* parameter's default value is updated to ``None``." +#: ../../library/compileall.rst:235 ../../library/compileall.rst:298 +#: ../../library/compileall.rst:327 +msgid "" +"The *invalidation_mode* parameter's default value is updated to ``None``." msgstr "" +#: ../../library/compileall.rst:238 msgid "Setting *workers* to 0 now chooses the optimal number of cores." msgstr "" -msgid "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments. Default value of *maxlevels* was changed from ``10`` to ``sys.getrecursionlimit()``" +#: ../../library/compileall.rst:241 +msgid "" +"Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " +"arguments. Default value of *maxlevels* was changed from ``10`` to " +"``sys.getrecursionlimit()``" msgstr "" -msgid "Compile the file with path *fullname*. Return a true value if the file compiled successfully, and a false value otherwise." +#: ../../library/compileall.rst:247 +msgid "" +"Compile the file with path *fullname*. Return a true value if the file " +"compiled successfully, and a false value otherwise." msgstr "" -msgid "If *ddir* is given, it is prepended to the path to the file being compiled for use in compilation time tracebacks, and is also compiled in to the byte-code file, where it will be used in tracebacks and other messages in cases where the source file does not exist at the time the byte-code file is executed." +#: ../../library/compileall.rst:250 +msgid "" +"If *ddir* is given, it is prepended to the path to the file being compiled " +"for use in compilation time tracebacks, and is also compiled in to the byte-" +"code file, where it will be used in tracebacks and other messages in cases " +"where the source file does not exist at the time the byte-code file is " +"executed." msgstr "" -msgid "If *rx* is given, its ``search`` method is passed the full path name to the file being compiled, and if it returns a true value, the file is not compiled and ``True`` is returned. This can be used to exclude files matching a regular expression, given as a :ref:`re.Pattern ` object." +#: ../../library/compileall.rst:256 +msgid "" +"If *rx* is given, its ``search`` method is passed the full path name to the " +"file being compiled, and if it returns a true value, the file is not " +"compiled and ``True`` is returned. This can be used to exclude files " +"matching a regular expression, given as a :ref:`re.Pattern ` " +"object." msgstr "" -msgid "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments." +#: ../../library/compileall.rst:301 +msgid "" +"Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " +"arguments." msgstr "" -msgid "Byte-compile all the :file:`.py` files found along ``sys.path``. Return a true value if all the files compiled successfully, and a false value otherwise." +#: ../../library/compileall.rst:306 +msgid "" +"Byte-compile all the :file:`.py` files found along ``sys.path``. Return a " +"true value if all the files compiled successfully, and a false value " +"otherwise." msgstr "" -msgid "If *skip_curdir* is true (the default), the current directory is not included in the search. All other parameters are passed to the :func:`compile_dir` function. Note that unlike the other compile functions, ``maxlevels`` defaults to ``0``." +#: ../../library/compileall.rst:309 +msgid "" +"If *skip_curdir* is true (the default), the current directory is not " +"included in the search. All other parameters are passed to " +"the :func:`compile_dir` function. Note that unlike the other compile " +"functions, ``maxlevels`` defaults to ``0``." msgstr "" -msgid "To force a recompile of all the :file:`.py` files in the :file:`Lib/` subdirectory and all its subdirectories::" +#: ../../library/compileall.rst:330 +msgid "" +"To force a recompile of all the :file:`.py` files in the :file:`Lib/` " +"subdirectory and all its subdirectories::" msgstr "" +#: ../../library/compileall.rst:333 msgid "" "import compileall\n" "\n" @@ -217,8 +421,10 @@ msgid "" "compileall.compile_dir(pathlib.Path('Lib/'), force=True)" msgstr "" +#: ../../library/compileall.rst:347 msgid "Module :mod:`py_compile`" msgstr "" +#: ../../library/compileall.rst:348 msgid "Byte-compile a single source file." msgstr "" diff --git a/library/compression.po b/library/compression.po index a9534e546..5e0ac4823 100644 --- a/library/compression.po +++ b/library/compression.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,23 +19,37 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: ../../library/compression.rst:2 msgid "The :mod:`!compression` package" msgstr "" -msgid "The :mod:`!compression` package contains the canonical compression modules containing interfaces to several different compression algorithms. Some of these modules have historically been available as separate modules; those will continue to be available under their original names for compatibility reasons, and will not be removed without a deprecation cycle. The use of modules in :mod:`!compression` is encouraged where practical." +#: ../../library/compression.rst:8 +msgid "" +"The :mod:`!compression` package contains the canonical compression modules " +"containing interfaces to several different compression algorithms. Some of " +"these modules have historically been available as separate modules; those " +"will continue to be available under their original names for compatibility " +"reasons, and will not be removed without a deprecation cycle. The use of " +"modules in :mod:`!compression` is encouraged where practical." msgstr "" +#: ../../library/compression.rst:15 msgid ":mod:`!compression.bz2` -- Re-exports :mod:`bz2`" msgstr "" +#: ../../library/compression.rst:16 msgid ":mod:`!compression.gzip` -- Re-exports :mod:`gzip`" msgstr "" +#: ../../library/compression.rst:17 msgid ":mod:`!compression.lzma` -- Re-exports :mod:`lzma`" msgstr "" +#: ../../library/compression.rst:18 msgid ":mod:`!compression.zlib` -- Re-exports :mod:`zlib`" msgstr "" -msgid ":mod:`compression.zstd` -- Wrapper for the Zstandard compression library" +#: ../../library/compression.rst:19 +msgid "" +":mod:`compression.zstd` -- Wrapper for the Zstandard compression library" msgstr "" diff --git a/library/compression.zstd.po b/library/compression.zstd.po index 410ef48f9..ccf8b28de 100644 --- a/library/compression.zstd.po +++ b/library/compression.zstd.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,453 +19,986 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -msgid ":mod:`!compression.zstd` --- Compression compatible with the Zstandard format" +#: ../../library/compression.zstd.rst:2 +msgid "" +":mod:`!compression.zstd` --- Compression compatible with the Zstandard format" msgstr "" +#: ../../library/compression.zstd.rst:10 msgid "**Source code:** :source:`Lib/compression/zstd/__init__.py`" msgstr "" -msgid "This module provides classes and functions for compressing and decompressing data using the Zstandard (or *zstd*) compression algorithm. The `zstd manual `__ describes Zstandard as \"a fast lossless compression algorithm, targeting real-time compression scenarios at zlib-level and better compression ratios.\" Also included is a file interface that supports reading and writing the contents of ``.zst`` files created by the :program:`zstd` utility, as well as raw zstd compressed streams." +#: ../../library/compression.zstd.rst:14 +msgid "" +"This module provides classes and functions for compressing and decompressing " +"data using the Zstandard (or *zstd*) compression algorithm. The `zstd manual " +"`__ describes " +"Zstandard as \"a fast lossless compression algorithm, targeting real-time " +"compression scenarios at zlib-level and better compression ratios.\" Also " +"included is a file interface that supports reading and writing the contents " +"of ``.zst`` files created by the :program:`zstd` utility, as well as raw " +"zstd compressed streams." msgstr "" +#: ../../library/compression.zstd.rst:23 msgid "The :mod:`!compression.zstd` module contains:" msgstr "" -msgid "The :func:`.open` function and :class:`ZstdFile` class for reading and writing compressed files." +#: ../../library/compression.zstd.rst:25 +msgid "" +"The :func:`.open` function and :class:`ZstdFile` class for reading and " +"writing compressed files." msgstr "" -msgid "The :class:`ZstdCompressor` and :class:`ZstdDecompressor` classes for incremental (de)compression." +#: ../../library/compression.zstd.rst:27 +msgid "" +"The :class:`ZstdCompressor` and :class:`ZstdDecompressor` classes for " +"incremental (de)compression." msgstr "" -msgid "The :func:`compress` and :func:`decompress` functions for one-shot (de)compression." +#: ../../library/compression.zstd.rst:29 +msgid "" +"The :func:`compress` and :func:`decompress` functions for one-shot " +"(de)compression." msgstr "" -msgid "The :func:`train_dict` and :func:`finalize_dict` functions and the :class:`ZstdDict` class to train and manage Zstandard dictionaries." +#: ../../library/compression.zstd.rst:31 +msgid "" +"The :func:`train_dict` and :func:`finalize_dict` functions and " +"the :class:`ZstdDict` class to train and manage Zstandard dictionaries." msgstr "" -msgid "The :class:`CompressionParameter`, :class:`DecompressionParameter`, and :class:`Strategy` classes for setting advanced (de)compression parameters." +#: ../../library/compression.zstd.rst:33 +msgid "" +"The :class:`CompressionParameter`, :class:`DecompressionParameter`, " +"and :class:`Strategy` classes for setting advanced (de)compression " +"parameters." msgstr "" -msgid "This is an :term:`optional module`. If it is missing from your copy of CPython, look for documentation from your distributor (that is, whoever provided Python to you). If you are the distributor, see :ref:`optional-module-requirements`." +#: ../../includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" +#: ../../library/compression.zstd.rst:40 msgid "Exceptions" msgstr "" -msgid "This exception is raised when an error occurs during compression or decompression, or while initializing the (de)compressor state." +#: ../../library/compression.zstd.rst:44 +msgid "" +"This exception is raised when an error occurs during compression or " +"decompression, or while initializing the (de)compressor state." msgstr "" +#: ../../library/compression.zstd.rst:49 msgid "Reading and writing compressed files" msgstr "" -msgid "Open a Zstandard-compressed file in binary or text mode, returning a :term:`file object`." +#: ../../library/compression.zstd.rst:54 +msgid "" +"Open a Zstandard-compressed file in binary or text mode, returning " +"a :term:`file object`." msgstr "" -msgid "The *file* argument can be either a file name (given as a :class:`str`, :class:`bytes` or :term:`path-like ` object), in which case the named file is opened, or it can be an existing file object to read from or write to." +#: ../../library/compression.zstd.rst:57 +msgid "" +"The *file* argument can be either a file name (given as " +"a :class:`str`, :class:`bytes` or :term:`path-like ` " +"object), in which case the named file is opened, or it can be an existing " +"file object to read from or write to." msgstr "" -msgid "The mode argument can be either ``'rb'`` for reading (default), ``'wb'`` for overwriting, ``'ab'`` for appending, or ``'xb'`` for exclusive creation. These can equivalently be given as ``'r'``, ``'w'``, ``'a'``, and ``'x'`` respectively. You may also open in text mode with ``'rt'``, ``'wt'``, ``'at'``, and ``'xt'`` respectively." +#: ../../library/compression.zstd.rst:62 +msgid "" +"The mode argument can be either ``'rb'`` for reading (default), ``'wb'`` for " +"overwriting, ``'ab'`` for appending, or ``'xb'`` for exclusive creation. " +"These can equivalently be given as ``'r'``, ``'w'``, ``'a'``, and ``'x'`` " +"respectively. You may also open in text mode with ``'rt'``, ``'wt'``, " +"``'at'``, and ``'xt'`` respectively." msgstr "" -msgid "When reading, the *options* argument can be a dictionary providing advanced decompression parameters; see :class:`DecompressionParameter` for detailed information about supported parameters. The *zstd_dict* argument is a :class:`ZstdDict` instance to be used during decompression. When reading, if the *level* argument is not None, a :exc:`!TypeError` will be raised." +#: ../../library/compression.zstd.rst:68 ../../library/compression.zstd.rst:112 +msgid "" +"When reading, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`DecompressionParameter` for detailed " +"information about supported parameters. The *zstd_dict* argument is " +"a :class:`ZstdDict` instance to be used during decompression. When reading, " +"if the *level* argument is not None, a :exc:`!TypeError` will be raised." msgstr "" -msgid "When writing, the *options* argument can be a dictionary providing advanced compression parameters; see :class:`CompressionParameter` for detailed information about supported parameters. The *level* argument is the compression level to use when writing compressed data. Only one of *level* or *options* may be non-None. The *zstd_dict* argument is a :class:`ZstdDict` instance to be used during compression." +#: ../../library/compression.zstd.rst:75 +msgid "" +"When writing, the *options* argument can be a dictionary providing advanced " +"compression parameters; see :class:`CompressionParameter` for detailed " +"information about supported parameters. The *level* argument is the " +"compression level to use when writing compressed data. Only one of *level* " +"or *options* may be non-None. The *zstd_dict* argument is " +"a :class:`ZstdDict` instance to be used during compression." msgstr "" -msgid "In binary mode, this function is equivalent to the :class:`ZstdFile` constructor: ``ZstdFile(file, mode, ...)``. In this case, the *encoding*, *errors*, and *newline* parameters must not be provided." +#: ../../library/compression.zstd.rst:83 +msgid "" +"In binary mode, this function is equivalent to the :class:`ZstdFile` " +"constructor: ``ZstdFile(file, mode, ...)``. In this case, the *encoding*, " +"*errors*, and *newline* parameters must not be provided." msgstr "" -msgid "In text mode, a :class:`ZstdFile` object is created, and wrapped in an :class:`io.TextIOWrapper` instance with the specified encoding, error handling behavior, and line endings." +#: ../../library/compression.zstd.rst:87 +msgid "" +"In text mode, a :class:`ZstdFile` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " +"handling behavior, and line endings." msgstr "" +#: ../../library/compression.zstd.rst:95 msgid "Open a Zstandard-compressed file in binary mode." msgstr "" -msgid "A :class:`ZstdFile` can wrap an already-open :term:`file object`, or operate directly on a named file. The *file* argument specifies either the file object to wrap, or the name of the file to open (as a :class:`str`, :class:`bytes` or :term:`path-like ` object). If wrapping an existing file object, the wrapped file will not be closed when the :class:`ZstdFile` is closed." +#: ../../library/compression.zstd.rst:97 +msgid "" +"A :class:`ZstdFile` can wrap an already-open :term:`file object`, or operate " +"directly on a named file. The *file* argument specifies either the file " +"object to wrap, or the name of the file to open (as " +"a :class:`str`, :class:`bytes` or :term:`path-like ` " +"object). If wrapping an existing file object, the wrapped file will not be " +"closed when the :class:`ZstdFile` is closed." msgstr "" -msgid "The *mode* argument can be either ``'rb'`` for reading (default), ``'wb'`` for overwriting, ``'xb'`` for exclusive creation, or ``'ab'`` for appending. These can equivalently be given as ``'r'``, ``'w'``, ``'x'`` and ``'a'`` respectively." +#: ../../library/compression.zstd.rst:104 +msgid "" +"The *mode* argument can be either ``'rb'`` for reading (default), ``'wb'`` " +"for overwriting, ``'xb'`` for exclusive creation, or ``'ab'`` for appending. " +"These can equivalently be given as ``'r'``, ``'w'``, ``'x'`` and ``'a'`` " +"respectively." msgstr "" -msgid "If *file* is a file object (rather than an actual file name), a mode of ``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." +#: ../../library/compression.zstd.rst:109 +msgid "" +"If *file* is a file object (rather than an actual file name), a mode of " +"``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." msgstr "" -msgid "When writing, the *options* argument can be a dictionary providing advanced compression parameters; see :class:`CompressionParameter` for detailed information about supported parameters. The *level* argument is the compression level to use when writing compressed data. Only one of *level* or *options* may be passed. The *zstd_dict* argument is a :class:`ZstdDict` instance to be used during compression." +#: ../../library/compression.zstd.rst:119 +msgid "" +"When writing, the *options* argument can be a dictionary providing advanced " +"compression parameters; see :class:`CompressionParameter` for detailed " +"information about supported parameters. The *level* argument is the " +"compression level to use when writing compressed data. Only one of *level* " +"or *options* may be passed. The *zstd_dict* argument is a :class:`ZstdDict` " +"instance to be used during compression." msgstr "" -msgid ":class:`!ZstdFile` supports all the members specified by :class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io.IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." +#: ../../library/compression.zstd.rst:127 +msgid "" +":class:`!ZstdFile` supports all the members specified " +"by :class:`io.BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` " +"and :meth:`~io.IOBase.truncate`. Iteration and the :keyword:`with` statement " +"are supported." msgstr "" +#: ../../library/compression.zstd.rst:132 msgid "The following method and attributes are also provided:" msgstr "" -msgid "Return buffered data without advancing the file position. At least one byte of data will be returned, unless EOF has been reached. The exact number of bytes returned is unspecified (the *size* argument is ignored)." +#: ../../library/compression.zstd.rst:136 +msgid "" +"Return buffered data without advancing the file position. At least one byte " +"of data will be returned, unless EOF has been reached. The exact number of " +"bytes returned is unspecified (the *size* argument is ignored)." msgstr "" -msgid "While calling :meth:`peek` does not change the file position of the :class:`ZstdFile`, it may change the position of the underlying file object (for example, if the :class:`ZstdFile` was constructed by passing a file object for *file*)." +#: ../../library/compression.zstd.rst:140 +msgid "" +"While calling :meth:`peek` does not change the file position of " +"the :class:`ZstdFile`, it may change the position of the underlying file " +"object (for example, if the :class:`ZstdFile` was constructed by passing a " +"file object for *file*)." msgstr "" +#: ../../library/compression.zstd.rst:147 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" -msgid "The name of the Zstandard file. Equivalent to the :attr:`~io.FileIO.name` attribute of the underlying :term:`file object`." +#: ../../library/compression.zstd.rst:151 +msgid "" +"The name of the Zstandard file. Equivalent to the :attr:`~io.FileIO.name` " +"attribute of the underlying :term:`file object`." msgstr "" +#: ../../library/compression.zstd.rst:156 msgid "Compressing and decompressing data in memory" msgstr "" -msgid "Compress *data* (a :term:`bytes-like object`), returning the compressed data as a :class:`bytes` object." -msgstr "" - -msgid "The *level* argument is an integer controlling the level of compression. *level* is an alternative to setting :attr:`CompressionParameter.compression_level` in *options*. Use :meth:`~CompressionParameter.bounds` on :attr:`~CompressionParameter.compression_level` to get the values that can be passed for *level*. If advanced compression options are needed, the *level* argument must be omitted and in the *options* dictionary the :attr:`!CompressionParameter.compression_level` parameter should be set." +#: ../../library/compression.zstd.rst:160 +msgid "" +"Compress *data* (a :term:`bytes-like object`), returning the compressed data " +"as a :class:`bytes` object." msgstr "" -msgid "The *options* argument is a Python dictionary containing advanced compression parameters. The valid keys and values for compression parameters are documented as part of the :class:`CompressionParameter` documentation." +#: ../../library/compression.zstd.rst:163 +#: ../../library/compression.zstd.rst:207 +msgid "" +"The *level* argument is an integer controlling the level of compression. " +"*level* is an alternative to " +"setting :attr:`CompressionParameter.compression_level` in *options*. " +"Use :meth:`~CompressionParameter.bounds` " +"on :attr:`~CompressionParameter.compression_level` to get the values that " +"can be passed for *level*. If advanced compression options are needed, the " +"*level* argument must be omitted and in the *options* dictionary the :attr:`!" +"CompressionParameter.compression_level` parameter should be set." +msgstr "" + +#: ../../library/compression.zstd.rst:172 +#: ../../library/compression.zstd.rst:216 +msgid "" +"The *options* argument is a Python dictionary containing advanced " +"compression parameters. The valid keys and values for compression parameters " +"are documented as part of the :class:`CompressionParameter` documentation." msgstr "" -msgid "The *zstd_dict* argument is an instance of :class:`ZstdDict` containing trained data to improve compression efficiency. The function :func:`train_dict` can be used to generate a Zstandard dictionary." +#: ../../library/compression.zstd.rst:176 +msgid "" +"The *zstd_dict* argument is an instance of :class:`ZstdDict` containing " +"trained data to improve compression efficiency. The " +"function :func:`train_dict` can be used to generate a Zstandard dictionary." msgstr "" -msgid "Decompress *data* (a :term:`bytes-like object`), returning the uncompressed data as a :class:`bytes` object." +#: ../../library/compression.zstd.rst:183 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning the uncompressed " +"data as a :class:`bytes` object." msgstr "" -msgid "The *options* argument is a Python dictionary containing advanced decompression parameters. The valid keys and values for compression parameters are documented as part of the :class:`DecompressionParameter` documentation." +#: ../../library/compression.zstd.rst:186 +#: ../../library/compression.zstd.rst:308 +msgid "" +"The *options* argument is a Python dictionary containing advanced " +"decompression parameters. The valid keys and values for compression " +"parameters are documented as part of the :class:`DecompressionParameter` " +"documentation." msgstr "" -msgid "The *zstd_dict* argument is an instance of :class:`ZstdDict` containing trained data used during compression. This must be the same Zstandard dictionary used during compression." +#: ../../library/compression.zstd.rst:191 +#: ../../library/compression.zstd.rst:313 +msgid "" +"The *zstd_dict* argument is an instance of :class:`ZstdDict` containing " +"trained data used during compression. This must be the same Zstandard " +"dictionary used during compression." msgstr "" -msgid "If *data* is the concatenation of multiple distinct compressed frames, decompress all of these frames, and return the concatenation of the results." +#: ../../library/compression.zstd.rst:195 +msgid "" +"If *data* is the concatenation of multiple distinct compressed frames, " +"decompress all of these frames, and return the concatenation of the results." msgstr "" -msgid "Create a compressor object, which can be used to compress data incrementally." +#: ../../library/compression.zstd.rst:201 +msgid "" +"Create a compressor object, which can be used to compress data incrementally." msgstr "" -msgid "For a more convenient way of compressing a single chunk of data, see the module-level function :func:`compress`." +#: ../../library/compression.zstd.rst:204 +msgid "" +"For a more convenient way of compressing a single chunk of data, see the " +"module-level function :func:`compress`." msgstr "" -msgid "The *zstd_dict* argument is an optional instance of :class:`ZstdDict` containing trained data to improve compression efficiency. The function :func:`train_dict` can be used to generate a Zstandard dictionary." +#: ../../library/compression.zstd.rst:220 +msgid "" +"The *zstd_dict* argument is an optional instance of :class:`ZstdDict` " +"containing trained data to improve compression efficiency. The " +"function :func:`train_dict` can be used to generate a Zstandard dictionary." msgstr "" -msgid "Compress *data* (a :term:`bytes-like object`), returning a :class:`bytes` object with compressed data if possible, or otherwise an empty :class:`!bytes` object. Some of *data* may be buffered internally, for use in later calls to :meth:`!compress` and :meth:`~.flush`. The returned data should be concatenated with the output of any previous calls to :meth:`~.compress`." +#: ../../library/compression.zstd.rst:227 +msgid "" +"Compress *data* (a :term:`bytes-like object`), returning a :class:`bytes` " +"object with compressed data if possible, or otherwise an empty :class:`!" +"bytes` object. Some of *data* may be buffered internally, for use in later " +"calls to :meth:`!compress` and :meth:`~.flush`. The returned data should be " +"concatenated with the output of any previous calls to :meth:`~.compress`." msgstr "" -msgid "The *mode* argument is a :class:`ZstdCompressor` attribute, either :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." +#: ../../library/compression.zstd.rst:234 +msgid "" +"The *mode* argument is a :class:`ZstdCompressor` attribute, " +"either :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." msgstr "" -msgid "When all data has been provided to the compressor, call the :meth:`~.flush` method to finish the compression process. If :meth:`~.compress` is called with *mode* set to :attr:`~.FLUSH_FRAME`, :meth:`~.flush` should not be called, as it would write out a new empty frame." +#: ../../library/compression.zstd.rst:238 +msgid "" +"When all data has been provided to the compressor, call the :meth:`~.flush` " +"method to finish the compression process. If :meth:`~.compress` is called " +"with *mode* set to :attr:`~.FLUSH_FRAME`, :meth:`~.flush` should not be " +"called, as it would write out a new empty frame." msgstr "" -msgid "Finish the compression process, returning a :class:`bytes` object containing any data stored in the compressor's internal buffers." +#: ../../library/compression.zstd.rst:246 +msgid "" +"Finish the compression process, returning a :class:`bytes` object containing " +"any data stored in the compressor's internal buffers." msgstr "" -msgid "The *mode* argument is a :class:`ZstdCompressor` attribute, either :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." +#: ../../library/compression.zstd.rst:249 +msgid "" +"The *mode* argument is a :class:`ZstdCompressor` attribute, " +"either :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." msgstr "" -msgid "Specify the amount of uncompressed data *size* that will be provided for the next frame. *size* will be written into the frame header of the next frame unless :attr:`CompressionParameter.content_size_flag` is ``False`` or ``0``. A size of ``0`` means that the frame is empty. If *size* is ``None``, the frame header will omit the frame size. Frames that include the uncompressed data size require less memory to decompress, especially at higher compression levels." +#: ../../library/compression.zstd.rst:254 +msgid "" +"Specify the amount of uncompressed data *size* that will be provided for the " +"next frame. *size* will be written into the frame header of the next frame " +"unless :attr:`CompressionParameter.content_size_flag` is ``False`` or ``0``. " +"A size of ``0`` means that the frame is empty. If *size* is ``None``, the " +"frame header will omit the frame size. Frames that include the uncompressed " +"data size require less memory to decompress, especially at higher " +"compression levels." msgstr "" -msgid "If :attr:`last_mode` is not :attr:`FLUSH_FRAME`, a :exc:`ValueError` is raised as the compressor is not at the start of a frame. If the pledged size does not match the actual size of data provided to :meth:`.compress`, future calls to :meth:`!compress` or :meth:`flush` may raise :exc:`ZstdError` and the last chunk of data may be lost." +#: ../../library/compression.zstd.rst:262 +msgid "" +"If :attr:`last_mode` is not :attr:`FLUSH_FRAME`, a :exc:`ValueError` is " +"raised as the compressor is not at the start of a frame. If the pledged size " +"does not match the actual size of data provided to :meth:`.compress`, future " +"calls to :meth:`!compress` or :meth:`flush` may raise :exc:`ZstdError` and " +"the last chunk of data may be lost." msgstr "" -msgid "After :meth:`flush` or :meth:`.compress` are called with mode :attr:`FLUSH_FRAME`, the next frame will not include the frame size into the header unless :meth:`!set_pledged_input_size` is called again." +#: ../../library/compression.zstd.rst:269 +msgid "" +"After :meth:`flush` or :meth:`.compress` are called with " +"mode :attr:`FLUSH_FRAME`, the next frame will not include the frame size " +"into the header unless :meth:`!set_pledged_input_size` is called again." msgstr "" -msgid "Collect more data for compression, which may or may not generate output immediately. This mode optimizes the compression ratio by maximizing the amount of data per block and frame." +#: ../../library/compression.zstd.rst:275 +msgid "" +"Collect more data for compression, which may or may not generate output " +"immediately. This mode optimizes the compression ratio by maximizing the " +"amount of data per block and frame." msgstr "" -msgid "Complete and write a block to the data stream. The data returned so far can be immediately decompressed. Past data can still be referenced in future blocks generated by calls to :meth:`~.compress`, improving compression." +#: ../../library/compression.zstd.rst:281 +msgid "" +"Complete and write a block to the data stream. The data returned so far can " +"be immediately decompressed. Past data can still be referenced in future " +"blocks generated by calls to :meth:`~.compress`, improving compression." msgstr "" -msgid "Complete and write out a frame. Future data provided to :meth:`~.compress` will be written into a new frame and *cannot* reference past data." +#: ../../library/compression.zstd.rst:288 +msgid "" +"Complete and write out a frame. Future data provided to :meth:`~.compress` " +"will be written into a new frame and *cannot* reference past data." msgstr "" -msgid "The last mode passed to either :meth:`~.compress` or :meth:`~.flush`. The value can be one of :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`. The initial value is :attr:`~.FLUSH_FRAME`, signifying that the compressor is at the start of a new frame." +#: ../../library/compression.zstd.rst:294 +msgid "" +"The last mode passed to either :meth:`~.compress` or :meth:`~.flush`. The " +"value can be one of :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, " +"or :attr:`~.FLUSH_FRAME`. The initial value is :attr:`~.FLUSH_FRAME`, " +"signifying that the compressor is at the start of a new frame." msgstr "" -msgid "Create a decompressor object, which can be used to decompress data incrementally." +#: ../../library/compression.zstd.rst:302 +msgid "" +"Create a decompressor object, which can be used to decompress data " +"incrementally." msgstr "" -msgid "For a more convenient way of decompressing an entire compressed stream at once, see the module-level function :func:`decompress`." +#: ../../library/compression.zstd.rst:305 +msgid "" +"For a more convenient way of decompressing an entire compressed stream at " +"once, see the module-level function :func:`decompress`." msgstr "" -msgid "This class does not transparently handle inputs containing multiple compressed frames, unlike the :func:`decompress` function and :class:`ZstdFile` class. To decompress a multi-frame input, you should use :func:`decompress`, :class:`ZstdFile` if working with a :term:`file object`, or multiple :class:`!ZstdDecompressor` instances." +#: ../../library/compression.zstd.rst:318 +msgid "" +"This class does not transparently handle inputs containing multiple " +"compressed frames, unlike the :func:`decompress` function " +"and :class:`ZstdFile` class. To decompress a multi-frame input, you should " +"use :func:`decompress`, :class:`ZstdFile` if working with a :term:`file " +"object`, or multiple :class:`!ZstdDecompressor` instances." msgstr "" -msgid "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data as bytes. Some of *data* may be buffered internally, for use in later calls to :meth:`!decompress`. The returned data should be concatenated with the output of any previous calls to :meth:`!decompress`." +#: ../../library/compression.zstd.rst:326 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " +"as bytes. Some of *data* may be buffered internally, for use in later calls " +"to :meth:`!decompress`. The returned data should be concatenated with the " +"output of any previous calls to :meth:`!decompress`." msgstr "" -msgid "If *max_length* is non-negative, the method returns at most *max_length* bytes of decompressed data. If this limit is reached and further output can be produced, the :attr:`~.needs_input` attribute will be set to ``False``. In this case, the next call to :meth:`~.decompress` may provide *data* as ``b''`` to obtain more of the output." +#: ../../library/compression.zstd.rst:332 +msgid "" +"If *max_length* is non-negative, the method returns at most *max_length* " +"bytes of decompressed data. If this limit is reached and further output can " +"be produced, the :attr:`~.needs_input` attribute will be set to ``False``. " +"In this case, the next call to :meth:`~.decompress` may provide *data* as " +"``b''`` to obtain more of the output." msgstr "" -msgid "If all of the input data was decompressed and returned (either because this was less than *max_length* bytes, or because *max_length* was negative), the :attr:`~.needs_input` attribute will be set to ``True``." +#: ../../library/compression.zstd.rst:339 +msgid "" +"If all of the input data was decompressed and returned (either because this " +"was less than *max_length* bytes, or because *max_length* was negative), " +"the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -msgid "Attempting to decompress data after the end of a frame will raise a :exc:`ZstdError`. Any data found after the end of the frame is ignored and saved in the :attr:`~.unused_data` attribute." +#: ../../library/compression.zstd.rst:344 +msgid "" +"Attempting to decompress data after the end of a frame will raise " +"a :exc:`ZstdError`. Any data found after the end of the frame is ignored and " +"saved in the :attr:`~.unused_data` attribute." msgstr "" +#: ../../library/compression.zstd.rst:350 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" +#: ../../library/compression.zstd.rst:354 msgid "Data found after the end of the compressed stream." msgstr "" +#: ../../library/compression.zstd.rst:356 msgid "Before the end of the stream is reached, this will be ``b''``." msgstr "" -msgid "``False`` if the :meth:`.decompress` method can provide more decompressed data before requiring new compressed input." +#: ../../library/compression.zstd.rst:360 +msgid "" +"``False`` if the :meth:`.decompress` method can provide more decompressed " +"data before requiring new compressed input." msgstr "" +#: ../../library/compression.zstd.rst:365 msgid "Zstandard dictionaries" msgstr "" -msgid "Train a Zstandard dictionary, returning a :class:`ZstdDict` instance. Zstandard dictionaries enable more efficient compression of smaller sizes of data, which is traditionally difficult to compress due to less repetition. If you are compressing multiple similar groups of data (such as similar files), Zstandard dictionaries can improve compression ratios and speed significantly." +#: ../../library/compression.zstd.rst:370 +msgid "" +"Train a Zstandard dictionary, returning a :class:`ZstdDict` instance. " +"Zstandard dictionaries enable more efficient compression of smaller sizes of " +"data, which is traditionally difficult to compress due to less repetition. " +"If you are compressing multiple similar groups of data (such as similar " +"files), Zstandard dictionaries can improve compression ratios and speed " +"significantly." msgstr "" -msgid "The *samples* argument (an iterable of :class:`bytes` objects), is the population of samples used to train the Zstandard dictionary." +#: ../../library/compression.zstd.rst:377 +msgid "" +"The *samples* argument (an iterable of :class:`bytes` objects), is the " +"population of samples used to train the Zstandard dictionary." msgstr "" -msgid "The *dict_size* argument, an integer, is the maximum size (in bytes) the Zstandard dictionary should be. The Zstandard documentation suggests an absolute maximum of no more than 100 KB, but the maximum can often be smaller depending on the data. Larger dictionaries generally slow down compression, but improve compression ratios. Smaller dictionaries lead to faster compression, but reduce the compression ratio." +#: ../../library/compression.zstd.rst:380 +msgid "" +"The *dict_size* argument, an integer, is the maximum size (in bytes) the " +"Zstandard dictionary should be. The Zstandard documentation suggests an " +"absolute maximum of no more than 100 KB, but the maximum can often be " +"smaller depending on the data. Larger dictionaries generally slow down " +"compression, but improve compression ratios. Smaller dictionaries lead to " +"faster compression, but reduce the compression ratio." msgstr "" -msgid "An advanced function for converting a \"raw content\" Zstandard dictionary into a regular Zstandard dictionary. \"Raw content\" dictionaries are a sequence of bytes that do not need to follow the structure of a normal Zstandard dictionary." +#: ../../library/compression.zstd.rst:390 +msgid "" +"An advanced function for converting a \"raw content\" Zstandard dictionary " +"into a regular Zstandard dictionary. \"Raw content\" dictionaries are a " +"sequence of bytes that do not need to follow the structure of a normal " +"Zstandard dictionary." msgstr "" -msgid "The *zstd_dict* argument is a :class:`ZstdDict` instance with the :attr:`~ZstdDict.dict_content` containing the raw dictionary contents." +#: ../../library/compression.zstd.rst:395 +msgid "" +"The *zstd_dict* argument is a :class:`ZstdDict` instance with " +"the :attr:`~ZstdDict.dict_content` containing the raw dictionary contents." msgstr "" -msgid "The *samples* argument (an iterable of :class:`bytes` objects), contains sample data for generating the Zstandard dictionary." +#: ../../library/compression.zstd.rst:398 +msgid "" +"The *samples* argument (an iterable of :class:`bytes` objects), contains " +"sample data for generating the Zstandard dictionary." msgstr "" -msgid "The *dict_size* argument, an integer, is the maximum size (in bytes) the Zstandard dictionary should be. See :func:`train_dict` for suggestions on the maximum dictionary size." +#: ../../library/compression.zstd.rst:401 +msgid "" +"The *dict_size* argument, an integer, is the maximum size (in bytes) the " +"Zstandard dictionary should be. See :func:`train_dict` for suggestions on " +"the maximum dictionary size." msgstr "" -msgid "The *level* argument (an integer) is the compression level expected to be passed to the compressors using this dictionary. The dictionary information varies for each compression level, so tuning for the proper compression level can make compression more efficient." +#: ../../library/compression.zstd.rst:405 +msgid "" +"The *level* argument (an integer) is the compression level expected to be " +"passed to the compressors using this dictionary. The dictionary information " +"varies for each compression level, so tuning for the proper compression " +"level can make compression more efficient." msgstr "" -msgid "A wrapper around Zstandard dictionaries. Dictionaries can be used to improve the compression of many small chunks of data. Use :func:`train_dict` if you need to train a new dictionary from sample data." +#: ../../library/compression.zstd.rst:413 +msgid "" +"A wrapper around Zstandard dictionaries. Dictionaries can be used to improve " +"the compression of many small chunks of data. Use :func:`train_dict` if you " +"need to train a new dictionary from sample data." msgstr "" -msgid "The *dict_content* argument (a :term:`bytes-like object`), is the already trained dictionary information." +#: ../../library/compression.zstd.rst:417 +msgid "" +"The *dict_content* argument (a :term:`bytes-like object`), is the already " +"trained dictionary information." msgstr "" -msgid "The *is_raw* argument, a boolean, is an advanced parameter controlling the meaning of *dict_content*. ``True`` means *dict_content* is a \"raw content\" dictionary, without any format restrictions. ``False`` means *dict_content* is an ordinary Zstandard dictionary, created from Zstandard functions, for example, :func:`train_dict` or the external :program:`zstd` CLI." +#: ../../library/compression.zstd.rst:420 +msgid "" +"The *is_raw* argument, a boolean, is an advanced parameter controlling the " +"meaning of *dict_content*. ``True`` means *dict_content* is a \"raw " +"content\" dictionary, without any format restrictions. ``False`` means " +"*dict_content* is an ordinary Zstandard dictionary, created from Zstandard " +"functions, for example, :func:`train_dict` or the external :program:`zstd` " +"CLI." msgstr "" -msgid "When passing a :class:`!ZstdDict` to a function, the :attr:`!as_digested_dict` and :attr:`!as_undigested_dict` attributes can control how the dictionary is loaded by passing them as the ``zstd_dict`` argument, for example, ``compress(data, zstd_dict=zd.as_digested_dict)``. Digesting a dictionary is a costly operation that occurs when loading a Zstandard dictionary. When making multiple calls to compression or decompression, passing a digested dictionary will reduce the overhead of loading the dictionary." +#: ../../library/compression.zstd.rst:426 +msgid "" +"When passing a :class:`!ZstdDict` to a function, the :attr:`!" +"as_digested_dict` and :attr:`!as_undigested_dict` attributes can control how " +"the dictionary is loaded by passing them as the ``zstd_dict`` argument, for " +"example, ``compress(data, zstd_dict=zd.as_digested_dict)``. Digesting a " +"dictionary is a costly operation that occurs when loading a Zstandard " +"dictionary. When making multiple calls to compression or decompression, " +"passing a digested dictionary will reduce the overhead of loading the " +"dictionary." msgstr "" +#: ../../library/compression.zstd.rst:435 msgid "Difference for compression" msgstr "" +#: ../../library/compression.zstd.rst:440 msgid "Digested dictionary" msgstr "" +#: ../../library/compression.zstd.rst:441 msgid "Undigested dictionary" msgstr "" -msgid "Advanced parameters of the compressor which may be overridden by the dictionary's parameters" +#: ../../library/compression.zstd.rst:442 +msgid "" +"Advanced parameters of the compressor which may be overridden by the " +"dictionary's parameters" msgstr "" -msgid "``window_log``, ``hash_log``, ``chain_log``, ``search_log``, ``min_match``, ``target_length``, ``strategy``, ``enable_long_distance_matching``, ``ldm_hash_log``, ``ldm_min_match``, ``ldm_bucket_size_log``, ``ldm_hash_rate_log``, and some non-public parameters." +#: ../../library/compression.zstd.rst:444 +msgid "" +"``window_log``, ``hash_log``, ``chain_log``, ``search_log``, ``min_match``, " +"``target_length``, ``strategy``, ``enable_long_distance_matching``, " +"``ldm_hash_log``, ``ldm_min_match``, ``ldm_bucket_size_log``, " +"``ldm_hash_rate_log``, and some non-public parameters." msgstr "" +#: ../../library/compression.zstd.rst:449 msgid "None" msgstr "" +#: ../../library/compression.zstd.rst:450 msgid ":class:`!ZstdDict` internally caches the dictionary" msgstr "" -msgid "Yes. It's faster when loading a digested dictionary again with the same compression level." +#: ../../library/compression.zstd.rst:451 +msgid "" +"Yes. It's faster when loading a digested dictionary again with the same " +"compression level." msgstr "" -msgid "No. If you wish to load an undigested dictionary multiple times, consider reusing a compressor object." +#: ../../library/compression.zstd.rst:453 +msgid "" +"No. If you wish to load an undigested dictionary multiple times, consider " +"reusing a compressor object." msgstr "" -msgid "If passing a :class:`!ZstdDict` without any attribute, an undigested dictionary is passed by default when compressing and a digested dictionary is generated if necessary and passed by default when decompressing." +#: ../../library/compression.zstd.rst:456 +msgid "" +"If passing a :class:`!ZstdDict` without any attribute, an undigested " +"dictionary is passed by default when compressing and a digested dictionary " +"is generated if necessary and passed by default when decompressing." msgstr "" -msgid "The content of the Zstandard dictionary, a ``bytes`` object. It's the same as the *dict_content* argument in the ``__init__`` method. It can be used with other programs, such as the ``zstd`` CLI program." +#: ../../library/compression.zstd.rst:462 +msgid "" +"The content of the Zstandard dictionary, a ``bytes`` object. It's the same " +"as the *dict_content* argument in the ``__init__`` method. It can be used " +"with other programs, such as the ``zstd`` CLI program." msgstr "" +#: ../../library/compression.zstd.rst:468 msgid "Identifier of the Zstandard dictionary, a non-negative int value." msgstr "" -msgid "Non-zero means the dictionary is ordinary, created by Zstandard functions and following the Zstandard format." +#: ../../library/compression.zstd.rst:470 +msgid "" +"Non-zero means the dictionary is ordinary, created by Zstandard functions " +"and following the Zstandard format." msgstr "" -msgid "``0`` means a \"raw content\" dictionary, free of any format restriction, used for advanced users." +#: ../../library/compression.zstd.rst:473 +msgid "" +"``0`` means a \"raw content\" dictionary, free of any format restriction, " +"used for advanced users." msgstr "" -msgid "The meaning of ``0`` for :attr:`!ZstdDict.dict_id` is different from the ``dictionary_id`` attribute to the :func:`get_frame_info` function." +#: ../../library/compression.zstd.rst:478 +msgid "" +"The meaning of ``0`` for :attr:`!ZstdDict.dict_id` is different from the " +"``dictionary_id`` attribute to the :func:`get_frame_info` function." msgstr "" +#: ../../library/compression.zstd.rst:484 msgid "Load as a digested dictionary." msgstr "" +#: ../../library/compression.zstd.rst:488 msgid "Load as an undigested dictionary." msgstr "" +#: ../../library/compression.zstd.rst:492 msgid "Advanced parameter control" msgstr "" -msgid "An :class:`~enum.IntEnum` containing the advanced compression parameter keys that can be used when compressing data." +#: ../../library/compression.zstd.rst:496 +msgid "" +"An :class:`~enum.IntEnum` containing the advanced compression parameter keys " +"that can be used when compressing data." msgstr "" -msgid "The :meth:`~.bounds` method can be used on any attribute to get the valid values for that parameter." +#: ../../library/compression.zstd.rst:499 +#: ../../library/compression.zstd.rst:733 +msgid "" +"The :meth:`~.bounds` method can be used on any attribute to get the valid " +"values for that parameter." msgstr "" -msgid "Parameters are optional; any omitted parameter will have it's value selected automatically." +#: ../../library/compression.zstd.rst:502 +msgid "" +"Parameters are optional; any omitted parameter will have its value selected " +"automatically." msgstr "" -msgid "Example getting the lower and upper bound of :attr:`~.compression_level`::" +#: ../../library/compression.zstd.rst:505 +msgid "" +"Example getting the lower and upper bound of :attr:`~.compression_level`::" msgstr "" +#: ../../library/compression.zstd.rst:507 msgid "lower, upper = CompressionParameter.compression_level.bounds()" msgstr "" +#: ../../library/compression.zstd.rst:509 msgid "Example setting the :attr:`~.window_log` to the maximum size::" msgstr "" +#: ../../library/compression.zstd.rst:511 msgid "" "_lower, upper = CompressionParameter.window_log.bounds()\n" "options = {CompressionParameter.window_log: upper}\n" "compress(b'venezuelan beaver cheese', options=options)" msgstr "" -msgid "Return the tuple of int bounds, ``(lower, upper)``, of a compression parameter. This method should be called on the attribute you wish to retrieve the bounds of. For example, to get the valid values for :attr:`~.compression_level`, one may check the result of ``CompressionParameter.compression_level.bounds()``." +#: ../../library/compression.zstd.rst:517 +msgid "" +"Return the tuple of int bounds, ``(lower, upper)``, of a compression " +"parameter. This method should be called on the attribute you wish to " +"retrieve the bounds of. For example, to get the valid values " +"for :attr:`~.compression_level`, one may check the result of " +"``CompressionParameter.compression_level.bounds()``." msgstr "" +#: ../../library/compression.zstd.rst:523 +#: ../../library/compression.zstd.rst:751 msgid "Both the lower and upper bounds are inclusive." msgstr "" -msgid "A high-level means of setting other compression parameters that affect the speed and ratio of compressing data." +#: ../../library/compression.zstd.rst:527 +msgid "" +"A high-level means of setting other compression parameters that affect the " +"speed and ratio of compressing data." msgstr "" -msgid "Regular compression levels are greater than ``0``. Values greater than ``20`` are considered \"ultra\" compression and require more memory than other levels. Negative values can be used to trade off faster compression for worse compression ratios." +#: ../../library/compression.zstd.rst:530 +msgid "" +"Regular compression levels are greater than ``0``. Values greater than " +"``20`` are considered \"ultra\" compression and require more memory than " +"other levels. Negative values can be used to trade off faster compression " +"for worse compression ratios." msgstr "" +#: ../../library/compression.zstd.rst:535 msgid "Setting the level to zero uses :attr:`COMPRESSION_LEVEL_DEFAULT`." msgstr "" -msgid "Maximum allowed back-reference distance the compressor can use when compressing data, expressed as power of two, ``1 << window_log`` bytes. This parameter greatly influences the memory usage of compression. Higher values require more memory but gain better compression values." -msgstr "" - +#: ../../library/compression.zstd.rst:539 +msgid "" +"Maximum allowed back-reference distance the compressor can use when " +"compressing data, expressed as power of two, ``1 << window_log`` bytes. This " +"parameter greatly influences the memory usage of compression. Higher values " +"require more memory but gain better compression values." +msgstr "" + +#: ../../library/compression.zstd.rst:544 +#: ../../library/compression.zstd.rst:553 +#: ../../library/compression.zstd.rst:564 +#: ../../library/compression.zstd.rst:572 +#: ../../library/compression.zstd.rst:583 +#: ../../library/compression.zstd.rst:598 +#: ../../library/compression.zstd.rst:629 +#: ../../library/compression.zstd.rst:636 +#: ../../library/compression.zstd.rst:644 +#: ../../library/compression.zstd.rst:652 +#: ../../library/compression.zstd.rst:711 +#: ../../library/compression.zstd.rst:760 msgid "A value of zero causes the value to be selected automatically." msgstr "" -msgid "Size of the initial probe table, as a power of two. The resulting memory usage is ``1 << (hash_log+2)`` bytes. Larger tables improve compression ratio of strategies <= :attr:`~Strategy.dfast`, and improve compression speed of strategies > :attr:`~Strategy.dfast`." +#: ../../library/compression.zstd.rst:548 +msgid "" +"Size of the initial probe table, as a power of two. The resulting memory " +"usage is ``1 << (hash_log+2)`` bytes. Larger tables improve compression " +"ratio of strategies <= :attr:`~Strategy.dfast`, and improve compression " +"speed of strategies > :attr:`~Strategy.dfast`." msgstr "" -msgid "Size of the multi-probe search table, as a power of two. The resulting memory usage is ``1 << (chain_log+2)`` bytes. Larger tables result in better and slower compression. This parameter has no effect for the :attr:`~Strategy.fast` strategy. It's still useful when using :attr:`~Strategy.dfast` strategy, in which case it defines a secondary probe table." +#: ../../library/compression.zstd.rst:557 +msgid "" +"Size of the multi-probe search table, as a power of two. The resulting " +"memory usage is ``1 << (chain_log+2)`` bytes. Larger tables result in better " +"and slower compression. This parameter has no effect for " +"the :attr:`~Strategy.fast` strategy. It's still useful when " +"using :attr:`~Strategy.dfast` strategy, in which case it defines a secondary " +"probe table." msgstr "" -msgid "Number of search attempts, as a power of two. More attempts result in better and slower compression. This parameter is useless for :attr:`~Strategy.fast` and :attr:`~Strategy.dfast` strategies." +#: ../../library/compression.zstd.rst:568 +msgid "" +"Number of search attempts, as a power of two. More attempts result in better " +"and slower compression. This parameter is useless for :attr:`~Strategy.fast` " +"and :attr:`~Strategy.dfast` strategies." msgstr "" -msgid "Minimum size of searched matches. Larger values increase compression and decompression speed, but decrease ratio. Note that Zstandard can still find matches of smaller size, it just tweaks its search algorithm to look for this size and larger. For all strategies < :attr:`~Strategy.btopt`, the effective minimum is ``4``; for all strategies > :attr:`~Strategy.fast`, the effective maximum is ``6``." +#: ../../library/compression.zstd.rst:576 +msgid "" +"Minimum size of searched matches. Larger values increase compression and " +"decompression speed, but decrease ratio. Note that Zstandard can still find " +"matches of smaller size, it just tweaks its search algorithm to look for " +"this size and larger. For all strategies < :attr:`~Strategy.btopt`, the " +"effective minimum is ``4``; for all strategies > :attr:`~Strategy.fast`, the " +"effective maximum is ``6``." msgstr "" +#: ../../library/compression.zstd.rst:587 msgid "The impact of this field depends on the selected :class:`Strategy`." msgstr "" -msgid "For strategies :attr:`~Strategy.btopt`, :attr:`~Strategy.btultra` and :attr:`~Strategy.btultra2`, the value is the length of a match considered \"good enough\" to stop searching. Larger values make compression ratios better, but compresses slower." +#: ../../library/compression.zstd.rst:589 +msgid "" +"For strategies :attr:`~Strategy.btopt`, :attr:`~Strategy.btultra` " +"and :attr:`~Strategy.btultra2`, the value is the length of a match " +"considered \"good enough\" to stop searching. Larger values make compression " +"ratios better, but compresses slower." msgstr "" -msgid "For strategy :attr:`~Strategy.fast`, it is the distance between match sampling. Larger values make compression faster, but with a worse compression ratio." +#: ../../library/compression.zstd.rst:594 +msgid "" +"For strategy :attr:`~Strategy.fast`, it is the distance between match " +"sampling. Larger values make compression faster, but with a worse " +"compression ratio." msgstr "" -msgid "The higher the value of selected strategy, the more complex the compression technique used by zstd, resulting in higher compression ratios but slower compression." +#: ../../library/compression.zstd.rst:602 +msgid "" +"The higher the value of selected strategy, the more complex the compression " +"technique used by zstd, resulting in higher compression ratios but slower " +"compression." msgstr "" +#: ../../library/compression.zstd.rst:606 msgid ":class:`Strategy`" msgstr "" -msgid "Long distance matching can be used to improve compression for large inputs by finding large matches at greater distances. It increases memory usage and window size." +#: ../../library/compression.zstd.rst:610 +msgid "" +"Long distance matching can be used to improve compression for large inputs " +"by finding large matches at greater distances. It increases memory usage and " +"window size." msgstr "" -msgid "``True`` or ``1`` enable long distance matching while ``False`` or ``0`` disable it." +#: ../../library/compression.zstd.rst:614 +msgid "" +"``True`` or ``1`` enable long distance matching while ``False`` or ``0`` " +"disable it." msgstr "" -msgid "Enabling this parameter increases default :attr:`~CompressionParameter.window_log` to 128 MiB except when expressly set to a different value. This setting is enabled by default if :attr:`!window_log` >= 128 MiB and the compression strategy >= :attr:`~Strategy.btopt` (compression level 16+)." +#: ../../library/compression.zstd.rst:617 +msgid "" +"Enabling this parameter increases " +"default :attr:`~CompressionParameter.window_log` to 128 MiB except when " +"expressly set to a different value. This setting is enabled by default " +"if :attr:`!window_log` >= 128 MiB and the compression strategy " +">= :attr:`~Strategy.btopt` (compression level 16+)." msgstr "" -msgid "Size of the table for long distance matching, as a power of two. Larger values increase memory usage and compression ratio, but decrease compression speed." +#: ../../library/compression.zstd.rst:625 +msgid "" +"Size of the table for long distance matching, as a power of two. Larger " +"values increase memory usage and compression ratio, but decrease compression " +"speed." msgstr "" -msgid "Minimum match size for long distance matcher. Larger or too small values can often decrease the compression ratio." +#: ../../library/compression.zstd.rst:633 +msgid "" +"Minimum match size for long distance matcher. Larger or too small values can " +"often decrease the compression ratio." msgstr "" -msgid "Log size of each bucket in the long distance matcher hash table for collision resolution. Larger values improve collision resolution but decrease compression speed." +#: ../../library/compression.zstd.rst:640 +msgid "" +"Log size of each bucket in the long distance matcher hash table for " +"collision resolution. Larger values improve collision resolution but " +"decrease compression speed." msgstr "" -msgid "Frequency of inserting/looking up entries into the long distance matcher hash table. Larger values improve compression speed. Deviating far from the default value will likely result in a compression ratio decrease." +#: ../../library/compression.zstd.rst:648 +msgid "" +"Frequency of inserting/looking up entries into the long distance matcher " +"hash table. Larger values improve compression speed. Deviating far from the " +"default value will likely result in a compression ratio decrease." msgstr "" -msgid "Write the size of the data to be compressed into the Zstandard frame header when known prior to compressing." +#: ../../library/compression.zstd.rst:656 +msgid "" +"Write the size of the data to be compressed into the Zstandard frame header " +"when known prior to compressing." msgstr "" +#: ../../library/compression.zstd.rst:659 msgid "This flag only takes effect under the following scenarios:" msgstr "" +#: ../../library/compression.zstd.rst:661 msgid "Calling :func:`compress` for one-shot compression" msgstr "" -msgid "Providing all of the data to be compressed in the frame in a single :meth:`ZstdCompressor.compress` call, with the :attr:`ZstdCompressor.FLUSH_FRAME` mode." +#: ../../library/compression.zstd.rst:662 +msgid "" +"Providing all of the data to be compressed in the frame in a " +"single :meth:`ZstdCompressor.compress` call, with " +"the :attr:`ZstdCompressor.FLUSH_FRAME` mode." msgstr "" -msgid "Calling :meth:`ZstdCompressor.set_pledged_input_size` with the exact amount of data that will be provided to the compressor prior to any calls to :meth:`ZstdCompressor.compress` for the current frame. :meth:`!ZstdCompressor.set_pledged_input_size` must be called for each new frame." +#: ../../library/compression.zstd.rst:665 +msgid "" +"Calling :meth:`ZstdCompressor.set_pledged_input_size` with the exact amount " +"of data that will be provided to the compressor prior to any calls " +"to :meth:`ZstdCompressor.compress` for the current frame. :meth:`!" +"ZstdCompressor.set_pledged_input_size` must be called for each new frame." msgstr "" -msgid "All other compression calls may not write the size information into the frame header." +#: ../../library/compression.zstd.rst:671 +msgid "" +"All other compression calls may not write the size information into the " +"frame header." msgstr "" -msgid "``True`` or ``1`` enable the content size flag while ``False`` or ``0`` disable it." +#: ../../library/compression.zstd.rst:674 +msgid "" +"``True`` or ``1`` enable the content size flag while ``False`` or ``0`` " +"disable it." msgstr "" -msgid "A four-byte checksum using XXHash64 of the uncompressed content is written at the end of each frame. Zstandard's decompression code verifies the checksum. If there is a mismatch a :class:`ZstdError` exception is raised." +#: ../../library/compression.zstd.rst:679 +msgid "" +"A four-byte checksum using XXHash64 of the uncompressed content is written " +"at the end of each frame. Zstandard's decompression code verifies the " +"checksum. If there is a mismatch a :class:`ZstdError` exception is raised." msgstr "" -msgid "``True`` or ``1`` enable checksum generation while ``False`` or ``0`` disable it." +#: ../../library/compression.zstd.rst:684 +msgid "" +"``True`` or ``1`` enable checksum generation while ``False`` or ``0`` " +"disable it." msgstr "" -msgid "When compressing with a :class:`ZstdDict`, the dictionary's ID is written into the frame header." +#: ../../library/compression.zstd.rst:689 +msgid "" +"When compressing with a :class:`ZstdDict`, the dictionary's ID is written " +"into the frame header." msgstr "" -msgid "``True`` or ``1`` enable storing the dictionary ID while ``False`` or ``0`` disable it." +#: ../../library/compression.zstd.rst:692 +msgid "" +"``True`` or ``1`` enable storing the dictionary ID while ``False`` or ``0`` " +"disable it." msgstr "" -msgid "Select how many threads will be spawned to compress in parallel. When :attr:`!nb_workers` > 0, enables multi-threaded compression, a value of ``1`` means \"one-thread multi-threaded mode\". More workers improve speed, but also increase memory usage and slightly reduce compression ratio." +#: ../../library/compression.zstd.rst:697 +msgid "" +"Select how many threads will be spawned to compress in parallel. " +"When :attr:`!nb_workers` > 0, enables multi-threaded compression, a value of " +"``1`` means \"one-thread multi-threaded mode\". More workers improve speed, " +"but also increase memory usage and slightly reduce compression ratio." msgstr "" +#: ../../library/compression.zstd.rst:702 msgid "A value of zero disables multi-threading." msgstr "" -msgid "Size of a compression job, in bytes. This value is enforced only when :attr:`~CompressionParameter.nb_workers` >= 1. Each compression job is completed in parallel, so this value can indirectly impact the number of active threads." +#: ../../library/compression.zstd.rst:706 +msgid "" +"Size of a compression job, in bytes. This value is enforced only " +"when :attr:`~CompressionParameter.nb_workers` >= 1. Each compression job is " +"completed in parallel, so this value can indirectly impact the number of " +"active threads." msgstr "" -msgid "Sets how much data is reloaded from previous jobs (threads) for new jobs to be used by the look behind window during compression. This value is only used when :attr:`~CompressionParameter.nb_workers` >= 1. Acceptable values vary from 0 to 9." +#: ../../library/compression.zstd.rst:715 +msgid "" +"Sets how much data is reloaded from previous jobs (threads) for new jobs to " +"be used by the look behind window during compression. This value is only " +"used when :attr:`~CompressionParameter.nb_workers` >= 1. Acceptable values " +"vary from 0 to 9." msgstr "" +#: ../../library/compression.zstd.rst:720 msgid "0 means dynamically set the overlap amount" msgstr "" +#: ../../library/compression.zstd.rst:721 msgid "1 means no overlap" msgstr "" +#: ../../library/compression.zstd.rst:722 msgid "9 means use a full window size from the previous job" msgstr "" -msgid "Each increment halves/doubles the overlap size. \"8\" means an overlap of ``window_size/2``, \"7\" means an overlap of ``window_size/4``, etc." +#: ../../library/compression.zstd.rst:724 +msgid "" +"Each increment halves/doubles the overlap size. \"8\" means an overlap of " +"``window_size/2``, \"7\" means an overlap of ``window_size/4``, etc." msgstr "" -msgid "An :class:`~enum.IntEnum` containing the advanced decompression parameter keys that can be used when decompressing data. Parameters are optional; any omitted parameter will have it's value selected automatically." +#: ../../library/compression.zstd.rst:729 +msgid "" +"An :class:`~enum.IntEnum` containing the advanced decompression parameter " +"keys that can be used when decompressing data. Parameters are optional; any " +"omitted parameter will have its value selected automatically." msgstr "" +#: ../../library/compression.zstd.rst:736 msgid "Example setting the :attr:`~.window_log_max` to the maximum size::" msgstr "" +#: ../../library/compression.zstd.rst:738 msgid "" "data = compress(b'Some very long buffer of bytes...')\n" "\n" @@ -475,48 +1008,83 @@ msgid "" "decompress(data, options=options)" msgstr "" -msgid "Return the tuple of int bounds, ``(lower, upper)``, of a decompression parameter. This method should be called on the attribute you wish to retrieve the bounds of." +#: ../../library/compression.zstd.rst:747 +msgid "" +"Return the tuple of int bounds, ``(lower, upper)``, of a decompression " +"parameter. This method should be called on the attribute you wish to " +"retrieve the bounds of." msgstr "" -msgid "The base-two logarithm of the maximum size of the window used during decompression. This can be useful to limit the amount of memory used when decompressing data. A larger maximum window size leads to faster decompression." +#: ../../library/compression.zstd.rst:755 +msgid "" +"The base-two logarithm of the maximum size of the window used during " +"decompression. This can be useful to limit the amount of memory used when " +"decompressing data. A larger maximum window size leads to faster " +"decompression." msgstr "" -msgid "An :class:`~enum.IntEnum` containing strategies for compression. Higher-numbered strategies correspond to more complex and slower compression." +#: ../../library/compression.zstd.rst:765 +msgid "" +"An :class:`~enum.IntEnum` containing strategies for compression. Higher-" +"numbered strategies correspond to more complex and slower compression." msgstr "" -msgid "The values of attributes of :class:`!Strategy` are not necessarily stable across zstd versions. Only the ordering of the attributes may be relied upon. The attributes are listed below in order." +#: ../../library/compression.zstd.rst:771 +msgid "" +"The values of attributes of :class:`!Strategy` are not necessarily stable " +"across zstd versions. Only the ordering of the attributes may be relied " +"upon. The attributes are listed below in order." msgstr "" +#: ../../library/compression.zstd.rst:775 msgid "The following strategies are available:" msgstr "" +#: ../../library/compression.zstd.rst:797 msgid "Miscellaneous" msgstr "" -msgid "Retrieve a :class:`FrameInfo` object containing metadata about a Zstandard frame. Frames contain metadata related to the compressed data they hold." +#: ../../library/compression.zstd.rst:801 +msgid "" +"Retrieve a :class:`FrameInfo` object containing metadata about a Zstandard " +"frame. Frames contain metadata related to the compressed data they hold." msgstr "" +#: ../../library/compression.zstd.rst:807 msgid "Metadata related to a Zstandard frame." msgstr "" +#: ../../library/compression.zstd.rst:811 msgid "The size of the decompressed contents of the frame." msgstr "" -msgid "An integer representing the Zstandard dictionary ID needed for decompressing the frame. ``0`` means the dictionary ID was not recorded in the frame header. This may mean that a Zstandard dictionary is not needed, or that the ID of a required dictionary was not recorded." +#: ../../library/compression.zstd.rst:815 +msgid "" +"An integer representing the Zstandard dictionary ID needed for decompressing " +"the frame. ``0`` means the dictionary ID was not recorded in the frame " +"header. This may mean that a Zstandard dictionary is not needed, or that the " +"ID of a required dictionary was not recorded." msgstr "" +#: ../../library/compression.zstd.rst:823 msgid "The default compression level for Zstandard: ``3``." msgstr "" -msgid "Version number of the runtime zstd library as a tuple of integers (major, minor, release)." +#: ../../library/compression.zstd.rst:828 +msgid "" +"Version number of the runtime zstd library as a tuple of integers (major, " +"minor, release)." msgstr "" +#: ../../library/compression.zstd.rst:833 msgid "Examples" msgstr "" +#: ../../library/compression.zstd.rst:835 msgid "Reading in a compressed file:" msgstr "" +#: ../../library/compression.zstd.rst:837 msgid "" "from compression import zstd\n" "\n" @@ -524,9 +1092,11 @@ msgid "" " file_content = f.read()" msgstr "" +#: ../../library/compression.zstd.rst:844 msgid "Creating a compressed file:" msgstr "" +#: ../../library/compression.zstd.rst:846 msgid "" "from compression import zstd\n" "\n" @@ -535,9 +1105,11 @@ msgid "" " f.write(data)" msgstr "" +#: ../../library/compression.zstd.rst:854 msgid "Compressing data in memory:" msgstr "" +#: ../../library/compression.zstd.rst:856 msgid "" "from compression import zstd\n" "\n" @@ -545,9 +1117,11 @@ msgid "" "data_out = zstd.compress(data_in)" msgstr "" +#: ../../library/compression.zstd.rst:863 msgid "Incremental compression:" msgstr "" +#: ../../library/compression.zstd.rst:865 msgid "" "from compression import zstd\n" "\n" @@ -560,9 +1134,11 @@ msgid "" "result = b\"\".join([out1, out2, out3, out4])" msgstr "" +#: ../../library/compression.zstd.rst:877 msgid "Writing compressed data to an already-open file:" msgstr "" +#: ../../library/compression.zstd.rst:879 msgid "" "from compression import zstd\n" "\n" @@ -573,9 +1149,11 @@ msgid "" " f.write(b\"Not compressed\\n\")" msgstr "" +#: ../../library/compression.zstd.rst:889 msgid "Creating a compressed file using compression parameters:" msgstr "" +#: ../../library/compression.zstd.rst:891 msgid "" "from compression import zstd\n" "\n" diff --git a/library/concurrency.po b/library/concurrency.po index 57047b11b..7afc56800 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/concurrency.rst:5 msgid "Concurrent Execution" msgstr "" -msgid "The modules described in this chapter provide support for concurrent execution of code. The appropriate choice of tool will depend on the task to be executed (CPU bound vs IO bound) and preferred style of development (event driven cooperative multitasking vs preemptive multitasking). Here's an overview:" +#: ../../library/concurrency.rst:7 +msgid "" +"The modules described in this chapter provide support for concurrent " +"execution of code. The appropriate choice of tool will depend on the task to " +"be executed (CPU bound vs IO bound) and preferred style of development " +"(event driven cooperative multitasking vs preemptive multitasking). Here's " +"an overview:" msgstr "" +#: ../../library/concurrency.rst:28 msgid "The following are support modules for some of the above services:" msgstr "" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index a9cd308cd..1cf39eec2 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,81 +23,167 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/concurrent.futures.rst:2 msgid ":mod:`!concurrent.futures` --- Launching parallel tasks" msgstr "" -msgid "**Source code:** :source:`Lib/concurrent/futures/thread.py`, :source:`Lib/concurrent/futures/process.py`, and :source:`Lib/concurrent/futures/interpreter.py`" +#: ../../library/concurrent.futures.rst:9 +msgid "" +"**Source code:** :source:`Lib/concurrent/futures/thread.py`, :source:`Lib/" +"concurrent/futures/process.py`, and :source:`Lib/concurrent/futures/" +"interpreter.py`" msgstr "" -msgid "The :mod:`!concurrent.futures` module provides a high-level interface for asynchronously executing callables." +#: ../../library/concurrent.futures.rst:15 +msgid "" +"The :mod:`!concurrent.futures` module provides a high-level interface for " +"asynchronously executing callables." msgstr "" -msgid "The asynchronous execution can be performed with threads, using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate processes, using :class:`ProcessPoolExecutor`. Each implements the same interface, which is defined by the abstract :class:`Executor` class." +#: ../../library/concurrent.futures.rst:18 +msgid "" +"The asynchronous execution can be performed with threads, " +"using :class:`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or " +"separate processes, using :class:`ProcessPoolExecutor`. Each implements the " +"same interface, which is defined by the abstract :class:`Executor` class." msgstr "" -msgid ":class:`concurrent.futures.Future` must not be confused with :class:`asyncio.Future`, which is designed for use with :mod:`asyncio` tasks and coroutines. See the :doc:`asyncio's Future ` documentation for a detailed comparison of the two." +#: ../../library/concurrent.futures.rst:24 +msgid "" +":class:`concurrent.futures.Future` must not be confused " +"with :class:`asyncio.Future`, which is designed for use with :mod:`asyncio` " +"tasks and coroutines. See the :doc:`asyncio's Future ` " +"documentation for a detailed comparison of the two." msgstr "" +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/concurrent.futures.rst:32 msgid "Executor Objects" msgstr "" -msgid "An abstract class that provides methods to execute calls asynchronously. It should not be used directly, but through its concrete subclasses." +#: ../../library/concurrent.futures.rst:36 +msgid "" +"An abstract class that provides methods to execute calls asynchronously. It " +"should not be used directly, but through its concrete subclasses." msgstr "" -msgid "Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and returns a :class:`Future` object representing the execution of the callable. ::" +#: ../../library/concurrent.futures.rst:41 +msgid "" +"Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and " +"returns a :class:`Future` object representing the execution of the " +"callable. ::" msgstr "" +#: ../../library/concurrent.futures.rst:45 msgid "" "with ThreadPoolExecutor(max_workers=1) as executor:\n" " future = executor.submit(pow, 323, 1235)\n" " print(future.result())" msgstr "" +#: ../../library/concurrent.futures.rst:51 msgid "Similar to :func:`map(fn, *iterables) ` except:" msgstr "" -msgid "The *iterables* are collected immediately rather than lazily, unless a *buffersize* is specified to limit the number of submitted tasks whose results have not yet been yielded. If the buffer is full, iteration over the *iterables* pauses until a result is yielded from the buffer." +#: ../../library/concurrent.futures.rst:53 +msgid "" +"The *iterables* are collected immediately rather than lazily, unless a " +"*buffersize* is specified to limit the number of submitted tasks whose " +"results have not yet been yielded. If the buffer is full, iteration over the " +"*iterables* pauses until a result is yielded from the buffer." msgstr "" -msgid "*fn* is executed asynchronously and several calls to *fn* may be made concurrently." +#: ../../library/concurrent.futures.rst:58 +msgid "" +"*fn* is executed asynchronously and several calls to *fn* may be made " +"concurrently." msgstr "" -msgid "The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator.__next__` is called and the result isn't available after *timeout* seconds from the original call to :meth:`Executor.map`. *timeout* can be an int or a float. If *timeout* is not specified or ``None``, there is no limit to the wait time." +#: ../../library/concurrent.futures.rst:61 +msgid "" +"The returned iterator raises a :exc:`TimeoutError` " +"if :meth:`~iterator.__next__` is called and the result isn't available after " +"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " +"can be an int or a float. If *timeout* is not specified or ``None``, there " +"is no limit to the wait time." msgstr "" -msgid "If a *fn* call raises an exception, then that exception will be raised when its value is retrieved from the iterator." +#: ../../library/concurrent.futures.rst:67 +msgid "" +"If a *fn* call raises an exception, then that exception will be raised when " +"its value is retrieved from the iterator." msgstr "" -msgid "When using :class:`ProcessPoolExecutor`, this method chops *iterables* into a number of chunks which it submits to the pool as separate tasks. The (approximate) size of these chunks can be specified by setting *chunksize* to a positive integer. For very long iterables, using a large value for *chunksize* can significantly improve performance compared to the default size of 1. With :class:`ThreadPoolExecutor` and :class:`InterpreterPoolExecutor`, *chunksize* has no effect." +#: ../../library/concurrent.futures.rst:70 +msgid "" +"When using :class:`ProcessPoolExecutor`, this method chops *iterables* into " +"a number of chunks which it submits to the pool as separate tasks. The " +"(approximate) size of these chunks can be specified by setting *chunksize* " +"to a positive integer. For very long iterables, using a large value for " +"*chunksize* can significantly improve performance compared to the default " +"size of 1. With :class:`ThreadPoolExecutor` " +"and :class:`InterpreterPoolExecutor`, *chunksize* has no effect." msgstr "" +#: ../../library/concurrent.futures.rst:79 msgid "Added the *chunksize* parameter." msgstr "" +#: ../../library/concurrent.futures.rst:82 msgid "Added the *buffersize* parameter." msgstr "" -msgid "Signal the executor that it should free any resources that it is using when the currently pending futures are done executing. Calls to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will raise :exc:`RuntimeError`." +#: ../../library/concurrent.futures.rst:87 +msgid "" +"Signal the executor that it should free any resources that it is using when " +"the currently pending futures are done executing. Calls " +"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " +"raise :exc:`RuntimeError`." msgstr "" -msgid "If *wait* is ``True`` then this method will not return until all the pending futures are done executing and the resources associated with the executor have been freed. If *wait* is ``False`` then this method will return immediately and the resources associated with the executor will be freed when all pending futures are done executing. Regardless of the value of *wait*, the entire Python program will not exit until all pending futures are done executing." +#: ../../library/concurrent.futures.rst:92 +msgid "" +"If *wait* is ``True`` then this method will not return until all the pending " +"futures are done executing and the resources associated with the executor " +"have been freed. If *wait* is ``False`` then this method will return " +"immediately and the resources associated with the executor will be freed " +"when all pending futures are done executing. Regardless of the value of " +"*wait*, the entire Python program will not exit until all pending futures " +"are done executing." msgstr "" -msgid "If *cancel_futures* is ``True``, this method will cancel all pending futures that the executor has not started running. Any futures that are completed or running won't be cancelled, regardless of the value of *cancel_futures*." +#: ../../library/concurrent.futures.rst:100 +msgid "" +"If *cancel_futures* is ``True``, this method will cancel all pending futures " +"that the executor has not started running. Any futures that are completed or " +"running won't be cancelled, regardless of the value of *cancel_futures*." msgstr "" -msgid "If both *cancel_futures* and *wait* are ``True``, all futures that the executor has started running will be completed prior to this method returning. The remaining futures are cancelled." +#: ../../library/concurrent.futures.rst:105 +msgid "" +"If both *cancel_futures* and *wait* are ``True``, all futures that the " +"executor has started running will be completed prior to this method " +"returning. The remaining futures are cancelled." msgstr "" -msgid "You can avoid having to call this method explicitly if you use the executor as a :term:`context manager` via the :keyword:`with` statement, which will shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown` were called with *wait* set to ``True``)::" +#: ../../library/concurrent.futures.rst:109 +msgid "" +"You can avoid having to call this method explicitly if you use the executor " +"as a :term:`context manager` via the :keyword:`with` statement, which will " +"shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown` were " +"called with *wait* set to ``True``)::" msgstr "" +#: ../../library/concurrent.futures.rst:114 msgid "" "import shutil\n" "with ThreadPoolExecutor(max_workers=4) as e:\n" @@ -107,18 +193,27 @@ msgid "" " e.submit(shutil.copy, 'src4.txt', 'dest4.txt')" msgstr "" +#: ../../library/concurrent.futures.rst:121 msgid "Added *cancel_futures*." msgstr "" +#: ../../library/concurrent.futures.rst:126 msgid "ThreadPoolExecutor" msgstr "" -msgid ":class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a pool of threads to execute calls asynchronously." +#: ../../library/concurrent.futures.rst:128 +msgid "" +":class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a " +"pool of threads to execute calls asynchronously." msgstr "" -msgid "Deadlocks can occur when the callable associated with a :class:`Future` waits on the results of another :class:`Future`. For example::" +#: ../../library/concurrent.futures.rst:131 +msgid "" +"Deadlocks can occur when the callable associated with a :class:`Future` " +"waits on the results of another :class:`Future`. For example::" msgstr "" +#: ../../library/concurrent.futures.rst:134 msgid "" "import time\n" "def wait_on_b():\n" @@ -137,9 +232,11 @@ msgid "" "b = executor.submit(wait_on_a)" msgstr "" +#: ../../library/concurrent.futures.rst:150 msgid "And::" msgstr "" +#: ../../library/concurrent.futures.rst:152 msgid "" "def wait_on_future():\n" " f = executor.submit(pow, 5, 2)\n" @@ -153,36 +250,77 @@ msgid "" "# the single worker thread is already waiting for wait_on_future()." msgstr "" -msgid "An :class:`Executor` subclass that uses a pool of at most *max_workers* threads to execute calls asynchronously." +#: ../../library/concurrent.futures.rst:166 +msgid "" +"An :class:`Executor` subclass that uses a pool of at most *max_workers* " +"threads to execute calls asynchronously." msgstr "" -msgid "All threads enqueued to ``ThreadPoolExecutor`` will be joined before the interpreter can exit. Note that the exit handler which does this is executed *before* any exit handlers added using ``atexit``. This means exceptions in the main thread must be caught and handled in order to signal threads to exit gracefully. For this reason, it is recommended that ``ThreadPoolExecutor`` not be used for long-running tasks." +#: ../../library/concurrent.futures.rst:169 +msgid "" +"All threads enqueued to ``ThreadPoolExecutor`` will be joined before the " +"interpreter can exit. Note that the exit handler which does this is executed " +"*before* any exit handlers added using ``atexit``. This means exceptions in " +"the main thread must be caught and handled in order to signal threads to " +"exit gracefully. For this reason, it is recommended that " +"``ThreadPoolExecutor`` not be used for long-running tasks." msgstr "" -msgid "*initializer* is an optional callable that is called at the start of each worker thread; *initargs* is a tuple of arguments passed to the initializer. Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`, as well as any attempt to submit more jobs to the pool." +#: ../../library/concurrent.futures.rst:176 +msgid "" +"*initializer* is an optional callable that is called at the start of each " +"worker thread; *initargs* is a tuple of arguments passed to the " +"initializer. Should *initializer* raise an exception, all currently pending " +"jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`, as " +"well as any attempt to submit more jobs to the pool." msgstr "" -msgid "If *max_workers* is ``None`` or not given, it will default to the number of processors on the machine, multiplied by ``5``, assuming that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and the number of workers should be higher than the number of workers for :class:`ProcessPoolExecutor`." +#: ../../library/concurrent.futures.rst:182 +msgid "" +"If *max_workers* is ``None`` or not given, it will default to the number of " +"processors on the machine, multiplied by ``5``, assuming " +"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " +"work and the number of workers should be higher than the number of workers " +"for :class:`ProcessPoolExecutor`." msgstr "" -msgid "Added the *thread_name_prefix* parameter to allow users to control the :class:`threading.Thread` names for worker threads created by the pool for easier debugging." +#: ../../library/concurrent.futures.rst:190 +msgid "" +"Added the *thread_name_prefix* parameter to allow users to control " +"the :class:`threading.Thread` names for worker threads created by the pool " +"for easier debugging." msgstr "" +#: ../../library/concurrent.futures.rst:195 +#: ../../library/concurrent.futures.rst:400 msgid "Added the *initializer* and *initargs* arguments." msgstr "" -msgid "Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``. This default value preserves at least 5 workers for I/O bound tasks. It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL. And it avoids using very large resources implicitly on many-core machines." +#: ../../library/concurrent.futures.rst:198 +msgid "" +"Default value of *max_workers* is changed to ``min(32, os.cpu_count() + " +"4)``. This default value preserves at least 5 workers for I/O bound tasks. " +"It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL. " +"And it avoids using very large resources implicitly on many-core machines." msgstr "" -msgid "ThreadPoolExecutor now reuses idle worker threads before starting *max_workers* worker threads too." +#: ../../library/concurrent.futures.rst:204 +msgid "" +"ThreadPoolExecutor now reuses idle worker threads before starting " +"*max_workers* worker threads too." msgstr "" -msgid "Default value of *max_workers* is changed to ``min(32, (os.process_cpu_count() or 1) + 4)``." +#: ../../library/concurrent.futures.rst:207 +msgid "" +"Default value of *max_workers* is changed to ``min(32, " +"(os.process_cpu_count() or 1) + 4)``." msgstr "" +#: ../../library/concurrent.futures.rst:215 msgid "ThreadPoolExecutor Example" msgstr "" +#: ../../library/concurrent.futures.rst:218 msgid "" "import concurrent.futures\n" "import urllib.request\n" @@ -201,7 +339,8 @@ msgid "" "# We can use a with statement to ensure threads are cleaned up promptly\n" "with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:\n" " # Start the load operations and mark each future with its URL\n" -" future_to_url = {executor.submit(load_url, url, 60): url for url in URLS}\n" +" future_to_url = {executor.submit(load_url, url, 60): url for url in " +"URLS}\n" " for future in concurrent.futures.as_completed(future_to_url):\n" " url = future_to_url[future]\n" " try:\n" @@ -212,102 +351,274 @@ msgid "" " print('%r page is %d bytes' % (url, len(data)))" msgstr "" +#: ../../library/concurrent.futures.rst:247 msgid "InterpreterPoolExecutor" msgstr "" -msgid "The :class:`InterpreterPoolExecutor` class uses a pool of interpreters to execute calls asynchronously. It is a :class:`ThreadPoolExecutor` subclass, which means each worker is running in its own thread. The difference here is that each worker has its own interpreter, and runs each task using that interpreter." -msgstr "" - -msgid "The biggest benefit to using interpreters instead of only threads is true multi-core parallelism. Each interpreter has its own :term:`Global Interpreter Lock `, so code running in one interpreter can run on one CPU core, while code in another interpreter runs unblocked on a different core." -msgstr "" - -msgid "The tradeoff is that writing concurrent code for use with multiple interpreters can take extra effort. However, this is because it forces you to be deliberate about how and when interpreters interact, and to be explicit about what data is shared between interpreters. This results in several benefits that help balance the extra effort, including true multi-core parallelism, For example, code written this way can make it easier to reason about concurrency. Another major benefit is that you don't have to deal with several of the big pain points of using threads, like race conditions." +#: ../../library/concurrent.futures.rst:251 +msgid "" +"The :class:`InterpreterPoolExecutor` class uses a pool of interpreters to " +"execute calls asynchronously. It is a :class:`ThreadPoolExecutor` subclass, " +"which means each worker is running in its own thread. The difference here is " +"that each worker has its own interpreter, and runs each task using that " +"interpreter." msgstr "" -msgid "Each worker's interpreter is isolated from all the other interpreters. \"Isolated\" means each interpreter has its own runtime state and operates completely independently. For example, if you redirect :data:`sys.stdout` in one interpreter, it will not be automatically redirected to any other interpreter. If you import a module in one interpreter, it is not automatically imported in any other. You would need to import the module separately in interpreter where you need it. In fact, each module imported in an interpreter is a completely separate object from the same module in a different interpreter, including :mod:`sys`, :mod:`builtins`, and even ``__main__``." +#: ../../library/concurrent.futures.rst:257 +msgid "" +"The biggest benefit to using interpreters instead of only threads is true " +"multi-core parallelism. Each interpreter has its own :term:`Global " +"Interpreter Lock `, so code running in one " +"interpreter can run on one CPU core, while code in another interpreter runs " +"unblocked on a different core." msgstr "" -msgid "Isolation means a mutable object, or other data, cannot be used by more than one interpreter at the same time. That effectively means interpreters cannot actually share such objects or data. Instead, each interpreter must have its own copy, and you will have to synchronize any changes between the copies manually. Immutable objects and data, like the builtin singletons, strings, and tuples of immutable objects, don't have these limitations." +#: ../../library/concurrent.futures.rst:263 +msgid "" +"The tradeoff is that writing concurrent code for use with multiple " +"interpreters can take extra effort. However, this is because it forces you " +"to be deliberate about how and when interpreters interact, and to be " +"explicit about what data is shared between interpreters. This results in " +"several benefits that help balance the extra effort, including true multi-" +"core parallelism, For example, code written this way can make it easier to " +"reason about concurrency. Another major benefit is that you don't have to " +"deal with several of the big pain points of using threads, like race " +"conditions." +msgstr "" + +#: ../../library/concurrent.futures.rst:273 +msgid "" +"Each worker's interpreter is isolated from all the other interpreters. " +"\"Isolated\" means each interpreter has its own runtime state and operates " +"completely independently. For example, if you redirect :data:`sys.stdout` " +"in one interpreter, it will not be automatically redirected to any other " +"interpreter. If you import a module in one interpreter, it is not " +"automatically imported in any other. You would need to import the module " +"separately in interpreter where you need it. In fact, each module imported " +"in an interpreter is a completely separate object from the same module in a " +"different interpreter, including :mod:`sys`, :mod:`builtins`, and even " +"``__main__``." +msgstr "" + +#: ../../library/concurrent.futures.rst:285 +msgid "" +"Isolation means a mutable object, or other data, cannot be used by more than " +"one interpreter at the same time. That effectively means interpreters " +"cannot actually share such objects or data. Instead, each interpreter must " +"have its own copy, and you will have to synchronize any changes between the " +"copies manually. Immutable objects and data, like the builtin singletons, " +"strings, and tuples of immutable objects, don't have these limitations." msgstr "" -msgid "Communicating and synchronizing between interpreters is most effectively done using dedicated tools, like those proposed in :pep:`734`. One less efficient alternative is to serialize with :mod:`pickle` and then send the bytes over a shared :mod:`socket ` or :func:`pipe `." +#: ../../library/concurrent.futures.rst:293 +msgid "" +"Communicating and synchronizing between interpreters is most effectively " +"done using dedicated tools, like those proposed in :pep:`734`. One less " +"efficient alternative is to serialize with :mod:`pickle` and then send the " +"bytes over a shared :mod:`socket ` or :func:`pipe `." msgstr "" -msgid "A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously using a pool of at most *max_workers* threads. Each thread runs tasks in its own interpreter. The worker interpreters are isolated from each other, which means each has its own runtime state and that they can't share any mutable objects or other data. Each interpreter has its own :term:`Global Interpreter Lock `, which means code run with this executor has true multi-core parallelism." +#: ../../library/concurrent.futures.rst:301 +msgid "" +"A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously " +"using a pool of at most *max_workers* threads. Each thread runs tasks in " +"its own interpreter. The worker interpreters are isolated from each other, " +"which means each has its own runtime state and that they can't share any " +"mutable objects or other data. Each interpreter has its own :term:`Global " +"Interpreter Lock `, which means code run with this " +"executor has true multi-core parallelism." msgstr "" -msgid "The optional *initializer* and *initargs* arguments have the same meaning as for :class:`!ThreadPoolExecutor`: the initializer is run when each worker is created, though in this case it is run in the worker's interpreter. The executor serializes the *initializer* and *initargs* using :mod:`pickle` when sending them to the worker's interpreter." +#: ../../library/concurrent.futures.rst:309 +msgid "" +"The optional *initializer* and *initargs* arguments have the same meaning as " +"for :class:`!ThreadPoolExecutor`: the initializer is run when each worker is " +"created, though in this case it is run in the worker's interpreter. The " +"executor serializes the *initializer* and *initargs* using :mod:`pickle` " +"when sending them to the worker's interpreter." msgstr "" -msgid "The executor may replace uncaught exceptions from *initializer* with :class:`~concurrent.interpreters.ExecutionFailed`." +#: ../../library/concurrent.futures.rst:317 +msgid "" +"The executor may replace uncaught exceptions from *initializer* " +"with :class:`~concurrent.interpreters.ExecutionFailed`." msgstr "" +#: ../../library/concurrent.futures.rst:320 msgid "Other caveats from parent :class:`ThreadPoolExecutor` apply here." msgstr "" -msgid ":meth:`~Executor.submit` and :meth:`~Executor.map` work like normal, except the worker serializes the callable and arguments using :mod:`pickle` when sending them to its interpreter. The worker likewise serializes the return value when sending it back." -msgstr "" - -msgid "When a worker's current task raises an uncaught exception, the worker always tries to preserve the exception as-is. If that is successful then it also sets the ``__cause__`` to a corresponding :class:`~concurrent.interpreters.ExecutionFailed` instance, which contains a summary of the original exception. In the uncommon case that the worker is not able to preserve the original as-is then it directly preserves the corresponding :class:`~concurrent.interpreters.ExecutionFailed` instance instead." +#: ../../library/concurrent.futures.rst:322 +msgid "" +":meth:`~Executor.submit` and :meth:`~Executor.map` work like normal, except " +"the worker serializes the callable and arguments using :mod:`pickle` when " +"sending them to its interpreter. The worker likewise serializes the return " +"value when sending it back." msgstr "" +#: ../../library/concurrent.futures.rst:327 +msgid "" +"When a worker's current task raises an uncaught exception, the worker always " +"tries to preserve the exception as-is. If that is successful then it also " +"sets the ``__cause__`` to a " +"corresponding :class:`~concurrent.interpreters.ExecutionFailed` instance, " +"which contains a summary of the original exception. In the uncommon case " +"that the worker is not able to preserve the original as-is then it directly " +"preserves the " +"corresponding :class:`~concurrent.interpreters.ExecutionFailed` instance " +"instead." +msgstr "" + +#: ../../library/concurrent.futures.rst:339 msgid "ProcessPoolExecutor" msgstr "" -msgid "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that uses a pool of processes to execute calls asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and returned." -msgstr "" - -msgid "The ``__main__`` module must be importable by worker subprocesses. This means that :class:`ProcessPoolExecutor` will not work in the interactive interpreter." +#: ../../library/concurrent.futures.rst:341 +msgid "" +"The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " +"uses a pool of processes to execute calls " +"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " +"module, which allows it to side-step the :term:`Global Interpreter Lock " +"` but also means that only picklable objects can be " +"executed and returned." msgstr "" -msgid "Calling :class:`Executor` or :class:`Future` methods from a callable submitted to a :class:`ProcessPoolExecutor` will result in deadlock." +#: ../../library/concurrent.futures.rst:348 +msgid "" +"The ``__main__`` module must be importable by worker subprocesses. This " +"means that :class:`ProcessPoolExecutor` will not work in the interactive " +"interpreter." msgstr "" -msgid "Note that the restrictions on functions and arguments needing to picklable as per :class:`multiprocessing.Process` apply when using :meth:`~Executor.submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda should not be expected to work." +#: ../../library/concurrent.futures.rst:351 +msgid "" +"Calling :class:`Executor` or :class:`Future` methods from a callable " +"submitted to a :class:`ProcessPoolExecutor` will result in deadlock." msgstr "" -msgid "An :class:`Executor` subclass that executes calls asynchronously using a pool of at most *max_workers* processes. If *max_workers* is ``None`` or not given, it will default to :func:`os.process_cpu_count`. If *max_workers* is less than or equal to ``0``, then a :exc:`ValueError` will be raised. On Windows, *max_workers* must be less than or equal to ``61``. If it is not then :exc:`ValueError` will be raised. If *max_workers* is ``None``, then the default chosen will be at most ``61``, even if more processors are available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. It will be used to launch the workers. If *mp_context* is ``None`` or not given, the default :mod:`multiprocessing` context is used. See :ref:`multiprocessing-start-methods`." +#: ../../library/concurrent.futures.rst:354 +msgid "" +"Note that the restrictions on functions and arguments needing to picklable " +"as per :class:`multiprocessing.Process` apply when " +"using :meth:`~Executor.submit` and :meth:`~Executor.map` on " +"a :class:`ProcessPoolExecutor`. A function defined in a REPL or a lambda " +"should not be expected to work." msgstr "" -msgid "*initializer* is an optional callable that is called at the start of each worker process; *initargs* is a tuple of arguments passed to the initializer. Should *initializer* raise an exception, all currently pending jobs will raise a :exc:`~concurrent.futures.process.BrokenProcessPool`, as well as any attempt to submit more jobs to the pool." +#: ../../library/concurrent.futures.rst:361 +msgid "" +"An :class:`Executor` subclass that executes calls asynchronously using a " +"pool of at most *max_workers* processes. If *max_workers* is ``None`` or " +"not given, it will default to :func:`os.process_cpu_count`. If *max_workers* " +"is less than or equal to ``0``, then a :exc:`ValueError` will be raised. On " +"Windows, *max_workers* must be less than or equal to ``61``. If it is not " +"then :exc:`ValueError` will be raised. If *max_workers* is ``None``, then " +"the default chosen will be at most ``61``, even if more processors are " +"available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " +"It will be used to launch the workers. If *mp_context* is ``None`` or not " +"given, the default :mod:`multiprocessing` context is used. " +"See :ref:`multiprocessing-start-methods`." +msgstr "" + +#: ../../library/concurrent.futures.rst:375 +msgid "" +"*initializer* is an optional callable that is called at the start of each " +"worker process; *initargs* is a tuple of arguments passed to the " +"initializer. Should *initializer* raise an exception, all currently pending " +"jobs will raise a :exc:`~concurrent.futures.process.BrokenProcessPool`, as " +"well as any attempt to submit more jobs to the pool." msgstr "" -msgid "*max_tasks_per_child* is an optional argument that specifies the maximum number of tasks a single process can execute before it will exit and be replaced with a fresh worker process. By default *max_tasks_per_child* is ``None`` which means worker processes will live as long as the pool. When a max is specified, the \"spawn\" multiprocessing start method will be used by default in absence of a *mp_context* parameter. This feature is incompatible with the \"fork\" start method." +#: ../../library/concurrent.futures.rst:381 +msgid "" +"*max_tasks_per_child* is an optional argument that specifies the maximum " +"number of tasks a single process can execute before it will exit and be " +"replaced with a fresh worker process. By default *max_tasks_per_child* is " +"``None`` which means worker processes will live as long as the pool. When a " +"max is specified, the \"spawn\" multiprocessing start method will be used by " +"default in absence of a *mp_context* parameter. This feature is incompatible " +"with the \"fork\" start method." msgstr "" -msgid "Bugs have been reported when using the *max_tasks_per_child* feature that can result in the :class:`ProcessPoolExecutor` hanging in some circumstances. Follow its eventual resolution in :gh:`115634`." +#: ../../library/concurrent.futures.rst:389 +msgid "" +"When one of the worker processes terminates abruptly, " +"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " +"Previously, behaviour was undefined but operations on the executor or its " +"futures would often freeze or deadlock." msgstr "" -msgid "When one of the worker processes terminates abruptly, a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. Previously, behaviour was undefined but operations on the executor or its futures would often freeze or deadlock." +#: ../../library/concurrent.futures.rst:396 +msgid "" +"The *mp_context* argument was added to allow users to control the " +"start_method for worker processes created by the pool." msgstr "" -msgid "The *mp_context* argument was added to allow users to control the start_method for worker processes created by the pool." +#: ../../library/concurrent.futures.rst:402 +msgid "" +"The *max_tasks_per_child* argument was added to allow users to control the " +"lifetime of workers in the pool." msgstr "" -msgid "The *max_tasks_per_child* argument was added to allow users to control the lifetime of workers in the pool." +#: ../../library/concurrent.futures.rst:406 +msgid "" +"On POSIX systems, if your application has multiple threads and " +"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " +"The :func:`os.fork` function called internally to spawn workers may raise " +"a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a " +"different start method. See the :func:`os.fork` documentation for further " +"explanation." msgstr "" -msgid "On POSIX systems, if your application has multiple threads and the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os.fork` function called internally to spawn workers may raise a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a different start method. See the :func:`os.fork` documentation for further explanation." +#: ../../library/concurrent.futures.rst:414 +msgid "" +"*max_workers* uses :func:`os.process_cpu_count` by default, instead " +"of :func:`os.cpu_count`." msgstr "" -msgid "*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:`os.cpu_count`." +#: ../../library/concurrent.futures.rst:418 +msgid "" +"The default process start method (see :ref:`multiprocessing-start-methods`) " +"changed away from *fork*. If you require the *fork* start method " +"for :class:`ProcessPoolExecutor` you must explicitly pass " +"``mp_context=multiprocessing.get_context(\"fork\")``." msgstr "" -msgid "The default process start method (see :ref:`multiprocessing-start-methods`) changed away from *fork*. If you require the *fork* start method for :class:`ProcessPoolExecutor` you must explicitly pass ``mp_context=multiprocessing.get_context(\"fork\")``." +#: ../../library/concurrent.futures.rst:424 +msgid "" +"Fixed a deadlock (:gh:`115634`) where the executor could hang after a worker " +"process exited upon reaching its *max_tasks_per_child* limit while tasks " +"remained queued." msgstr "" -msgid "Attempt to terminate all living worker processes immediately by calling :meth:`Process.terminate ` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed." +#: ../../library/concurrent.futures.rst:431 +msgid "" +"Attempt to terminate all living worker processes immediately by " +"calling :meth:`Process.terminate ` on " +"each of them. Internally, it will also call :meth:`Executor.shutdown` to " +"ensure that all other resources associated with the executor are freed." msgstr "" -msgid "After calling this method the caller should no longer submit tasks to the executor." +#: ../../library/concurrent.futures.rst:436 +#: ../../library/concurrent.futures.rst:448 +msgid "" +"After calling this method the caller should no longer submit tasks to the " +"executor." msgstr "" -msgid "Attempt to kill all living worker processes immediately by calling :meth:`Process.kill ` on each of them. Internally, it will also call :meth:`Executor.shutdown` to ensure that all other resources associated with the executor are freed." +#: ../../library/concurrent.futures.rst:443 +msgid "" +"Attempt to kill all living worker processes immediately by " +"calling :meth:`Process.kill ` on each of them. " +"Internally, it will also call :meth:`Executor.shutdown` to ensure that all " +"other resources associated with the executor are freed." msgstr "" +#: ../../library/concurrent.futures.rst:456 msgid "ProcessPoolExecutor Example" msgstr "" +#: ../../library/concurrent.futures.rst:459 msgid "" "import concurrent.futures\n" "import math\n" @@ -343,137 +654,287 @@ msgid "" " main()" msgstr "" +#: ../../library/concurrent.futures.rst:494 msgid "Future Objects" msgstr "" -msgid "The :class:`Future` class encapsulates the asynchronous execution of a callable. :class:`Future` instances are created by :meth:`Executor.submit`." +#: ../../library/concurrent.futures.rst:496 +msgid "" +"The :class:`Future` class encapsulates the asynchronous execution of a " +"callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -msgid "Encapsulates the asynchronous execution of a callable. :class:`Future` instances are created by :meth:`Executor.submit` and should not be created directly except for testing." +#: ../../library/concurrent.futures.rst:501 +msgid "" +"Encapsulates the asynchronous execution of a callable. :class:`Future` " +"instances are created by :meth:`Executor.submit` and should not be created " +"directly except for testing." msgstr "" -msgid "Attempt to cancel the call. If the call is currently being executed or finished running and cannot be cancelled then the method will return ``False``, otherwise the call will be cancelled and the method will return ``True``." +#: ../../library/concurrent.futures.rst:507 +msgid "" +"Attempt to cancel the call. If the call is currently being executed or " +"finished running and cannot be cancelled then the method will return " +"``False``, otherwise the call will be cancelled and the method will return " +"``True``." msgstr "" +#: ../../library/concurrent.futures.rst:514 msgid "Return ``True`` if the call was successfully cancelled." msgstr "" -msgid "Return ``True`` if the call is currently being executed and cannot be cancelled." +#: ../../library/concurrent.futures.rst:518 +msgid "" +"Return ``True`` if the call is currently being executed and cannot be " +"cancelled." msgstr "" -msgid "Return ``True`` if the call was successfully cancelled or finished running." +#: ../../library/concurrent.futures.rst:523 +msgid "" +"Return ``True`` if the call was successfully cancelled or finished running." msgstr "" -msgid "Return the value returned by the call. If the call hasn't yet completed then this method will wait up to *timeout* seconds. If the call hasn't completed in *timeout* seconds, then a :exc:`TimeoutError` will be raised. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time." +#: ../../library/concurrent.futures.rst:528 +msgid "" +"Return the value returned by the call. If the call hasn't yet completed then " +"this method will wait up to *timeout* seconds. If the call hasn't completed " +"in *timeout* seconds, then a :exc:`TimeoutError` will be raised. *timeout* " +"can be an int or float. If *timeout* is not specified or ``None``, there is " +"no limit to the wait time." msgstr "" -msgid "If the future is cancelled before completing then :exc:`.CancelledError` will be raised." +#: ../../library/concurrent.futures.rst:535 +#: ../../library/concurrent.futures.rst:549 +msgid "" +"If the future is cancelled before completing then :exc:`.CancelledError` " +"will be raised." msgstr "" -msgid "If the call raised an exception, this method will raise the same exception." +#: ../../library/concurrent.futures.rst:538 +msgid "" +"If the call raised an exception, this method will raise the same exception." msgstr "" -msgid "Return the exception raised by the call. If the call hasn't yet completed then this method will wait up to *timeout* seconds. If the call hasn't completed in *timeout* seconds, then a :exc:`TimeoutError` will be raised. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time." +#: ../../library/concurrent.futures.rst:542 +msgid "" +"Return the exception raised by the call. If the call hasn't yet completed " +"then this method will wait up to *timeout* seconds. If the call hasn't " +"completed in *timeout* seconds, then a :exc:`TimeoutError` will be raised. " +"*timeout* can be an int or float. If *timeout* is not specified or " +"``None``, there is no limit to the wait time." msgstr "" +#: ../../library/concurrent.futures.rst:552 msgid "If the call completed without raising, ``None`` is returned." msgstr "" -msgid "Attaches the callable *fn* to the future. *fn* will be called, with the future as its only argument, when the future is cancelled or finishes running." +#: ../../library/concurrent.futures.rst:556 +msgid "" +"Attaches the callable *fn* to the future. *fn* will be called, with the " +"future as its only argument, when the future is cancelled or finishes " +"running." msgstr "" -msgid "Added callables are called in the order that they were added and are always called in a thread belonging to the process that added them. If the callable raises an :exc:`Exception` subclass, it will be logged and ignored. If the callable raises a :exc:`BaseException` subclass, the behavior is undefined." +#: ../../library/concurrent.futures.rst:560 +msgid "" +"Added callables are called in the order that they were added and are always " +"called in a thread belonging to the process that added them. If the " +"callable raises an :exc:`Exception` subclass, it will be logged and " +"ignored. If the callable raises a :exc:`BaseException` subclass, the " +"behavior is undefined." msgstr "" -msgid "If the future has already completed or been cancelled, *fn* will be called immediately." +#: ../../library/concurrent.futures.rst:566 +msgid "" +"If the future has already completed or been cancelled, *fn* will be called " +"immediately." msgstr "" -msgid "The following :class:`Future` methods are meant for use in unit tests and :class:`Executor` implementations." +#: ../../library/concurrent.futures.rst:569 +msgid "" +"The following :class:`Future` methods are meant for use in unit tests " +"and :class:`Executor` implementations." msgstr "" -msgid "This method should only be called by :class:`Executor` implementations before executing the work associated with the :class:`Future` and by unit tests." +#: ../../library/concurrent.futures.rst:574 +msgid "" +"This method should only be called by :class:`Executor` implementations " +"before executing the work associated with the :class:`Future` and by unit " +"tests." msgstr "" -msgid "If the method returns ``False`` then the :class:`Future` was cancelled, i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads waiting on the :class:`Future` completing (i.e. through :func:`as_completed` or :func:`wait`) will be woken up." +#: ../../library/concurrent.futures.rst:578 +msgid "" +"If the method returns ``False`` then the :class:`Future` was cancelled, " +"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " +"or :func:`wait`) will be woken up." msgstr "" -msgid "If the method returns ``True`` then the :class:`Future` was not cancelled and has been put in the running state, i.e. calls to :meth:`Future.running` will return ``True``." +#: ../../library/concurrent.futures.rst:583 +msgid "" +"If the method returns ``True`` then the :class:`Future` was not cancelled " +"and has been put in the running state, i.e. calls to :meth:`Future.running` " +"will return ``True``." msgstr "" -msgid "This method can only be called once and cannot be called after :meth:`Future.set_result` or :meth:`Future.set_exception` have been called." +#: ../../library/concurrent.futures.rst:587 +msgid "" +"This method can only be called once and cannot be called " +"after :meth:`Future.set_result` or :meth:`Future.set_exception` have been " +"called." msgstr "" -msgid "Sets the result of the work associated with the :class:`Future` to *result*." +#: ../../library/concurrent.futures.rst:593 +msgid "" +"Sets the result of the work associated with the :class:`Future` to *result*." msgstr "" -msgid "This method should only be used by :class:`Executor` implementations and unit tests." +#: ../../library/concurrent.futures.rst:596 +#: ../../library/concurrent.futures.rst:609 +msgid "" +"This method should only be used by :class:`Executor` implementations and " +"unit tests." msgstr "" -msgid "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:`Future` is already done." +#: ../../library/concurrent.futures.rst:599 +#: ../../library/concurrent.futures.rst:612 +msgid "" +"This method raises :exc:`concurrent.futures.InvalidStateError` if " +"the :class:`Future` is already done." msgstr "" -msgid "Sets the result of the work associated with the :class:`Future` to the :class:`Exception` *exception*." +#: ../../library/concurrent.futures.rst:606 +msgid "" +"Sets the result of the work associated with the :class:`Future` to " +"the :class:`Exception` *exception*." msgstr "" +#: ../../library/concurrent.futures.rst:618 msgid "Module Functions" msgstr "" -msgid "Wait for the :class:`Future` instances (possibly created by different :class:`Executor` instances) given by *fs* to complete. Duplicate futures given to *fs* are removed and will be returned only once. Returns a named 2-tuple of sets. The first set, named ``done``, contains the futures that completed (finished or cancelled futures) before the wait completed. The second set, named ``not_done``, contains the futures that did not complete (pending or running futures)." +#: ../../library/concurrent.futures.rst:622 +msgid "" +"Wait for the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* to complete. Duplicate " +"futures given to *fs* are removed and will be returned only once. Returns a " +"named 2-tuple of sets. The first set, named ``done``, contains the futures " +"that completed (finished or cancelled futures) before the wait completed. " +"The second set, named ``not_done``, contains the futures that did not " +"complete (pending or running futures)." msgstr "" -msgid "*timeout* can be used to control the maximum number of seconds to wait before returning. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time." +#: ../../library/concurrent.futures.rst:630 +msgid "" +"*timeout* can be used to control the maximum number of seconds to wait " +"before returning. *timeout* can be an int or float. If *timeout* is not " +"specified or ``None``, there is no limit to the wait time." msgstr "" -msgid "*return_when* indicates when this function should return. It must be one of the following constants:" +#: ../../library/concurrent.futures.rst:634 +msgid "" +"*return_when* indicates when this function should return. It must be one of " +"the following constants:" msgstr "" +#: ../../library/concurrent.futures.rst:640 msgid "Constant" msgstr "" +#: ../../library/concurrent.futures.rst:641 msgid "Description" msgstr "" +#: ../../library/concurrent.futures.rst:644 msgid "The function will return when any future finishes or is cancelled." msgstr "" -msgid "The function will return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to :const:`ALL_COMPLETED`." +#: ../../library/concurrent.futures.rst:647 +msgid "" +"The function will return when any future finishes by raising an exception. " +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" +#: ../../library/concurrent.futures.rst:652 msgid "The function will return when all futures finish or are cancelled." msgstr "" -msgid "Returns an iterator over the :class:`Future` instances (possibly created by different :class:`Executor` instances) given by *fs* that yields futures as they complete (finished or cancelled futures). Any futures given by *fs* that are duplicated will be returned once. Any futures that completed before :func:`as_completed` is called will be yielded first. The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator.__next__` is called and the result isn't available after *timeout* seconds from the original call to :func:`as_completed`. *timeout* can be an int or float. If *timeout* is not specified or ``None``, there is no limit to the wait time." -msgstr "" - +#: ../../library/concurrent.futures.rst:656 +msgid "" +"Returns an iterator over the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* that yields futures as " +"they complete (finished or cancelled futures). Any futures given by *fs* " +"that are duplicated will be returned once. Any futures that completed " +"before :func:`as_completed` is called will be yielded first. The returned " +"iterator raises a :exc:`TimeoutError` if :meth:`~iterator.__next__` is " +"called and the result isn't available after *timeout* seconds from the " +"original call to :func:`as_completed`. *timeout* can be an int or float. If " +"*timeout* is not specified or ``None``, there is no limit to the wait time." +msgstr "" + +#: ../../library/concurrent.futures.rst:669 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr "" -msgid "The proposal which described this feature for inclusion in the Python standard library." +#: ../../library/concurrent.futures.rst:670 +msgid "" +"The proposal which described this feature for inclusion in the Python " +"standard library." msgstr "" +#: ../../library/concurrent.futures.rst:675 msgid "Exception classes" msgstr "" +#: ../../library/concurrent.futures.rst:681 msgid "Raised when a future is cancelled." msgstr "" -msgid "A deprecated alias of :exc:`TimeoutError`, raised when a future operation exceeds the given timeout." +#: ../../library/concurrent.futures.rst:685 +msgid "" +"A deprecated alias of :exc:`TimeoutError`, raised when a future operation " +"exceeds the given timeout." msgstr "" +#: ../../library/concurrent.futures.rst:690 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -msgid "Derived from :exc:`RuntimeError`, this exception class is raised when an executor is broken for some reason, and cannot be used to submit or execute new tasks." +#: ../../library/concurrent.futures.rst:695 +msgid "" +"Derived from :exc:`RuntimeError`, this exception class is raised when an " +"executor is broken for some reason, and cannot be used to submit or execute " +"new tasks." msgstr "" -msgid "Raised when an operation is performed on a future that is not allowed in the current state." +#: ../../library/concurrent.futures.rst:703 +msgid "" +"Raised when an operation is performed on a future that is not allowed in the " +"current state." msgstr "" -msgid "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class is raised when one of the workers of a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." +#: ../../library/concurrent.futures.rst:712 +msgid "" +"Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " +"is raised when one of the workers of " +"a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." msgstr "" -msgid "Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this exception class is raised when one of the workers of a :class:`~concurrent.futures.InterpreterPoolExecutor` has failed initializing." +#: ../../library/concurrent.futures.rst:723 +msgid "" +"Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " +"exception class is raised when one of the workers of " +"a :class:`~concurrent.futures.InterpreterPoolExecutor` has failed " +"initializing." msgstr "" -msgid "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:`RuntimeError`), this exception class is raised when one of the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-clean fashion (for example, if it was killed from the outside)." +#: ../../library/concurrent.futures.rst:734 +msgid "" +"Derived from :exc:`~concurrent.futures.BrokenExecutor` " +"(formerly :exc:`RuntimeError`), this exception class is raised when one of " +"the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has " +"terminated in a non-clean fashion (for example, if it was killed from the " +"outside)." msgstr "" diff --git a/library/concurrent.interpreters.po b/library/concurrent.interpreters.po index b684d1e7e..31511ec4f 100644 --- a/library/concurrent.interpreters.po +++ b/library/concurrent.interpreters.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2026-07-25 12:59+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: none\n" @@ -19,264 +19,478 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -msgid ":mod:`!concurrent.interpreters` --- Multiple interpreters in the same process" +#: ../../library/concurrent.interpreters.rst:2 +msgid "" +":mod:`!concurrent.interpreters` --- Multiple interpreters in the same process" msgstr "" +#: ../../library/concurrent.interpreters.rst:12 msgid "**Source code:** :source:`Lib/concurrent/interpreters`" msgstr "" -msgid "The :mod:`!concurrent.interpreters` module constructs higher-level interfaces on top of the lower level :mod:`!_interpreters` module." +#: ../../library/concurrent.interpreters.rst:16 +msgid "" +"The :mod:`!concurrent.interpreters` module constructs higher-level " +"interfaces on top of the lower level :mod:`!_interpreters` module." msgstr "" -msgid "The module is primarily meant to provide a basic API for managing interpreters (AKA \"subinterpreters\") and running things in them. Running mostly involves switching to an interpreter (in the current thread) and calling a function in that execution context." +#: ../../library/concurrent.interpreters.rst:19 +msgid "" +"The module is primarily meant to provide a basic API for managing " +"interpreters (AKA \"subinterpreters\") and running things in them. Running " +"mostly involves switching to an interpreter (in the current thread) and " +"calling a function in that execution context." msgstr "" -msgid "For concurrency, interpreters themselves (and this module) don't provide much more than isolation, which on its own isn't useful. Actual concurrency is available separately through :mod:`threads ` See `below `_" +#: ../../library/concurrent.interpreters.rst:24 +msgid "" +"For concurrency, interpreters themselves (and this module) don't provide " +"much more than isolation, which on its own isn't useful. Actual concurrency " +"is available separately through :mod:`threads ` -- see `below " +"`_." msgstr "" +#: ../../library/concurrent.interpreters.rst:31 msgid ":class:`~concurrent.futures.InterpreterPoolExecutor`" msgstr "" +#: ../../library/concurrent.interpreters.rst:32 msgid "Combines threads with interpreters in a familiar interface." msgstr "" +#: ../../library/concurrent.interpreters.rst:36 msgid ":ref:`isolating-extensions-howto`" msgstr "" +#: ../../library/concurrent.interpreters.rst:37 msgid "How to update an extension module to support multiple interpreters." msgstr "" +#: ../../library/concurrent.interpreters.rst:39 msgid ":pep:`554`" msgstr "" +#: ../../library/concurrent.interpreters.rst:41 msgid ":pep:`734`" msgstr "" +#: ../../library/concurrent.interpreters.rst:43 msgid ":pep:`684`" msgstr "" +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/concurrent.interpreters.rst:51 msgid "Key details" msgstr "" -msgid "Before we dive in further, there are a small number of details to keep in mind about using multiple interpreters:" +#: ../../library/concurrent.interpreters.rst:53 +msgid "" +"Before we dive in further, there are a small number of details to keep in " +"mind about using multiple interpreters:" msgstr "" +#: ../../library/concurrent.interpreters.rst:56 msgid "`isolated `_, by default" msgstr "" +#: ../../library/concurrent.interpreters.rst:57 msgid "no implicit threads" msgstr "" +#: ../../library/concurrent.interpreters.rst:58 msgid "not all PyPI packages support use in multiple interpreters yet" msgstr "" +#: ../../library/concurrent.interpreters.rst:66 msgid "Introduction" msgstr "" -msgid "An \"interpreter\" is effectively the execution context of the Python runtime. It contains all of the state the runtime needs to execute a program. This includes things like the import state and builtins. (Each thread, even if there's only the main thread, has some extra runtime state, in addition to the current interpreter, related to the current exception and the bytecode eval loop.)" +#: ../../library/concurrent.interpreters.rst:68 +msgid "" +"An \"interpreter\" is effectively the execution context of the Python " +"runtime. It contains all of the state the runtime needs to execute a " +"program. This includes things like the import state and builtins. (Each " +"thread, even if there's only the main thread, has some extra runtime state, " +"in addition to the current interpreter, related to the current exception and " +"the bytecode eval loop.)" msgstr "" -msgid "The concept and functionality of the interpreter have been a part of Python since version 2.2, but the feature was only available through the C-API and not well known, and the `isolation `_ was relatively incomplete until version 3.12." +#: ../../library/concurrent.interpreters.rst:75 +msgid "" +"The concept and functionality of the interpreter have been a part of Python " +"since version 2.2, but the feature was only available through the C-API and " +"not well known, and the `isolation `_ was relatively " +"incomplete until version 3.12." msgstr "" +#: ../../library/concurrent.interpreters.rst:83 msgid "Multiple Interpreters and Isolation" msgstr "" -msgid "A Python implementation may support using multiple interpreters in the same process. CPython has this support. Each interpreter is effectively isolated from the others (with a limited number of carefully managed process-global exceptions to the rule)." +#: ../../library/concurrent.interpreters.rst:85 +msgid "" +"A Python implementation may support using multiple interpreters in the same " +"process. CPython has this support. Each interpreter is effectively " +"isolated from the others (with a limited number of carefully managed process-" +"global exceptions to the rule)." msgstr "" -msgid "That isolation is primarily useful as a strong separation between distinct logical components of a program, where you want to have careful control of how those components interact." +#: ../../library/concurrent.interpreters.rst:90 +msgid "" +"That isolation is primarily useful as a strong separation between distinct " +"logical components of a program, where you want to have careful control of " +"how those components interact." msgstr "" -msgid "Interpreters in the same process can technically never be strictly isolated from one another since there are few restrictions on memory access within the same process. The Python runtime makes a best effort at isolation but extension modules may easily violate that. Therefore, do not use multiple interpreters in security-sensitive situations, where they shouldn't have access to each other's data." +#: ../../library/concurrent.interpreters.rst:96 +msgid "" +"Interpreters in the same process can technically never be strictly isolated " +"from one another since there are few restrictions on memory access within " +"the same process. The Python runtime makes a best effort at isolation but " +"extension modules may easily violate that. Therefore, do not use multiple " +"interpreters in security-sensitive situations, where they shouldn't have " +"access to each other's data." msgstr "" +#: ../../library/concurrent.interpreters.rst:104 msgid "Running in an Interpreter" msgstr "" -msgid "Running in a different interpreter involves switching to it in the current thread and then calling some function. The runtime will execute the function using the current interpreter's state. The :mod:`!concurrent.interpreters` module provides a basic API for creating and managing interpreters, as well as the switch-and-call operation." +#: ../../library/concurrent.interpreters.rst:106 +msgid "" +"Running in a different interpreter involves switching to it in the current " +"thread and then calling some function. The runtime will execute the " +"function using the current interpreter's state. The :mod:`!" +"concurrent.interpreters` module provides a basic API for creating and " +"managing interpreters, as well as the switch-and-call operation." msgstr "" -msgid "No other threads are automatically started for the operation. There is `a helper `_ for that though. There is another dedicated helper for calling the builtin :func:`exec` in an interpreter." +#: ../../library/concurrent.interpreters.rst:113 +msgid "" +"No other threads are automatically started for the operation. There is `a " +"helper `_ for that though. There is another " +"dedicated helper for calling the builtin :func:`exec` in an interpreter." msgstr "" -msgid "When :func:`exec` (or :func:`eval`) are called in an interpreter, they run using the interpreter's :mod:`!__main__` module as the \"globals\" namespace. The same is true for functions that aren't associated with any module. This is the same as how scripts invoked from the command-line run in the :mod:`!__main__` module." +#: ../../library/concurrent.interpreters.rst:118 +msgid "" +"When :func:`exec` (or :func:`eval`) are called in an interpreter, they run " +"using the interpreter's :mod:`!__main__` module as the \"globals\" " +"namespace. The same is true for functions that aren't associated with any " +"module. This is the same as how scripts invoked from the command-line run " +"in the :mod:`!__main__` module." msgstr "" +#: ../../library/concurrent.interpreters.rst:128 msgid "Concurrency and Parallelism" msgstr "" -msgid "As noted earlier, interpreters do not provide any concurrency on their own. They strictly represent the isolated execution context the runtime will use *in the current thread*. That isolation makes them similar to processes, but they still enjoy in-process efficiency, like threads." +#: ../../library/concurrent.interpreters.rst:130 +msgid "" +"As noted earlier, interpreters do not provide any concurrency on their own. " +"They strictly represent the isolated execution context the runtime will use " +"*in the current thread*. That isolation makes them similar to processes, " +"but they still enjoy in-process efficiency, like threads." msgstr "" -msgid "All that said, interpreters do naturally support certain flavors of concurrency. There's a powerful side effect of that isolation. It enables a different approach to concurrency than you can take with async or threads. It's a similar concurrency model to CSP or the actor model, a model which is relatively easy to reason about." +#: ../../library/concurrent.interpreters.rst:136 +msgid "" +"All that said, interpreters do naturally support certain flavors of " +"concurrency. There's a powerful side effect of that isolation. It enables a " +"different approach to concurrency than you can take with async or threads. " +"It's a similar concurrency model to CSP or the actor model, a model which is " +"relatively easy to reason about." msgstr "" -msgid "You can take advantage of that concurrency model in a single thread, switching back and forth between interpreters, Stackless-style. However, this model is more useful when you combine interpreters with multiple threads. This mostly involves starting a new thread, where you switch to another interpreter and run what you want there." +#: ../../library/concurrent.interpreters.rst:143 +msgid "" +"You can take advantage of that concurrency model in a single thread, " +"switching back and forth between interpreters, Stackless-style. However, " +"this model is more useful when you combine interpreters with multiple " +"threads. This mostly involves starting a new thread, where you switch to " +"another interpreter and run what you want there." msgstr "" -msgid "Each actual thread in Python, even if you're only running in the main thread, has its own *current* execution context. Multiple threads can use the same interpreter or different ones." +#: ../../library/concurrent.interpreters.rst:149 +msgid "" +"Each actual thread in Python, even if you're only running in the main " +"thread, has its own *current* execution context. Multiple threads can use " +"the same interpreter or different ones." msgstr "" -msgid "At a high level, you can think of the combination of threads and interpreters as threads with opt-in sharing." +#: ../../library/concurrent.interpreters.rst:153 +msgid "" +"At a high level, you can think of the combination of threads and " +"interpreters as threads with opt-in sharing." msgstr "" -msgid "As a significant bonus, interpreters are sufficiently isolated that they do not share the :term:`GIL`, which means combining threads with multiple interpreters enables full multi-core parallelism. (This has been the case since Python 3.12.)" +#: ../../library/concurrent.interpreters.rst:156 +msgid "" +"As a significant bonus, interpreters are sufficiently isolated that they do " +"not share the :term:`GIL`, which means combining threads with multiple " +"interpreters enables full multi-core parallelism. (This has been the case " +"since Python 3.12.)" msgstr "" +#: ../../library/concurrent.interpreters.rst:162 msgid "Communication Between Interpreters" msgstr "" -msgid "In practice, multiple interpreters are useful only if we have a way to communicate between them. This usually involves some form of message passing, but can even mean sharing data in some carefully managed way." +#: ../../library/concurrent.interpreters.rst:164 +msgid "" +"In practice, multiple interpreters are useful only if we have a way to " +"communicate between them. This usually involves some form of message " +"passing, but can even mean sharing data in some carefully managed way." msgstr "" -msgid "With this in mind, the :mod:`!concurrent.interpreters` module provides a :class:`queue.Queue` implementation, available through :func:`create_queue`." +#: ../../library/concurrent.interpreters.rst:169 +msgid "" +"With this in mind, the :mod:`!concurrent.interpreters` module provides " +"a :class:`queue.Queue` implementation, available " +"through :func:`create_queue`." msgstr "" +#: ../../library/concurrent.interpreters.rst:176 msgid "\"Sharing\" Objects" msgstr "" -msgid "Any data actually shared between interpreters loses the thread-safety provided by the :term:`GIL`. There are various options for dealing with this in extension modules. However, from Python code the lack of thread-safety means objects can't actually be shared, with a few exceptions. Instead, a copy must be created, which means mutable objects won't stay in sync." +#: ../../library/concurrent.interpreters.rst:178 +msgid "" +"Any data actually shared between interpreters loses the thread-safety " +"provided by the :term:`GIL`. There are various options for dealing with " +"this in extension modules. However, from Python code the lack of thread-" +"safety means objects can't actually be shared, with a few exceptions. " +"Instead, a copy must be created, which means mutable objects won't stay in " +"sync." msgstr "" -msgid "By default, most objects are copied with :mod:`pickle` when they are passed to another interpreter. Nearly all of the immutable builtin objects are either directly shared or copied efficiently. For example:" +#: ../../library/concurrent.interpreters.rst:185 +msgid "" +"By default, most objects are copied with :mod:`pickle` when they are passed " +"to another interpreter. Nearly all of the immutable builtin objects are " +"either directly shared or copied efficiently. For example:" msgstr "" +#: ../../library/concurrent.interpreters.rst:189 msgid ":const:`None`" msgstr "" +#: ../../library/concurrent.interpreters.rst:190 msgid ":class:`bool` (:const:`True` and :const:`False`)" msgstr "" +#: ../../library/concurrent.interpreters.rst:191 msgid ":class:`bytes`" msgstr "" +#: ../../library/concurrent.interpreters.rst:192 msgid ":class:`str`" msgstr "" +#: ../../library/concurrent.interpreters.rst:193 msgid ":class:`int`" msgstr "" +#: ../../library/concurrent.interpreters.rst:194 msgid ":class:`float`" msgstr "" +#: ../../library/concurrent.interpreters.rst:195 msgid ":class:`tuple` (of similarly supported objects)" msgstr "" -msgid "There is a small number of Python types that actually share mutable data between interpreters:" +#: ../../library/concurrent.interpreters.rst:197 +msgid "" +"There is a small number of Python types that actually share mutable data " +"between interpreters:" msgstr "" +#: ../../library/concurrent.interpreters.rst:200 msgid ":class:`memoryview`" msgstr "" +#: ../../library/concurrent.interpreters.rst:201 msgid ":class:`Queue`" msgstr "" +#: ../../library/concurrent.interpreters.rst:205 msgid "Reference" msgstr "" +#: ../../library/concurrent.interpreters.rst:207 msgid "This module defines the following functions:" msgstr "" -msgid "Return a :class:`list` of :class:`Interpreter` objects, one for each existing interpreter." +#: ../../library/concurrent.interpreters.rst:211 +msgid "" +"Return a :class:`list` of :class:`Interpreter` objects, one for each " +"existing interpreter." msgstr "" -msgid "Return an :class:`Interpreter` object for the currently running interpreter." +#: ../../library/concurrent.interpreters.rst:216 +msgid "" +"Return an :class:`Interpreter` object for the currently running interpreter." msgstr "" -msgid "Return an :class:`Interpreter` object for the main interpreter. This is the interpreter the runtime created to run the :term:`REPL` or the script given at the command-line. It is usually the only one." +#: ../../library/concurrent.interpreters.rst:221 +msgid "" +"Return an :class:`Interpreter` object for the main interpreter. This is the " +"interpreter the runtime created to run the :term:`REPL` or the script given " +"at the command-line. It is usually the only one." msgstr "" -msgid "Initialize a new (idle) Python interpreter and return a :class:`Interpreter` object for it." +#: ../../library/concurrent.interpreters.rst:227 +msgid "" +"Initialize a new (idle) Python interpreter and return a :class:`Interpreter` " +"object for it." msgstr "" -msgid "Initialize a new cross-interpreter queue and return a :class:`Queue` object for it." +#: ../../library/concurrent.interpreters.rst:232 +msgid "" +"Initialize a new cross-interpreter queue and return a :class:`Queue` object " +"for it." msgstr "" +#: ../../library/concurrent.interpreters.rst:237 msgid "Interpreter objects" msgstr "" +#: ../../library/concurrent.interpreters.rst:241 msgid "A single interpreter in the current process." msgstr "" -msgid "Generally, :class:`Interpreter` shouldn't be called directly. Instead, use :func:`create` or one of the other module functions." +#: ../../library/concurrent.interpreters.rst:243 +msgid "" +"Generally, :class:`Interpreter` shouldn't be called directly. Instead, " +"use :func:`create` or one of the other module functions." msgstr "" +#: ../../library/concurrent.interpreters.rst:248 +#: ../../library/concurrent.interpreters.rst:254 +#: ../../library/concurrent.interpreters.rst:333 msgid "(read-only)" msgstr "" +#: ../../library/concurrent.interpreters.rst:250 msgid "The underlying interpreter's ID." msgstr "" +#: ../../library/concurrent.interpreters.rst:256 msgid "A string describing where the interpreter came from." msgstr "" -msgid "Return ``True`` if the interpreter is currently executing code in its :mod:`!__main__` module and ``False`` otherwise." +#: ../../library/concurrent.interpreters.rst:260 +msgid "" +"Return ``True`` if the interpreter is currently executing code in its :mod:`!" +"__main__` module and ``False`` otherwise." msgstr "" +#: ../../library/concurrent.interpreters.rst:265 msgid "Finalize and destroy the interpreter." msgstr "" +#: ../../library/concurrent.interpreters.rst:269 msgid "Bind objects in the interpreter's :mod:`!__main__` module." msgstr "" -msgid "Some objects are actually shared and some are copied efficiently, but most are copied via :mod:`pickle`. See :ref:`interp-object-sharing`." +#: ../../library/concurrent.interpreters.rst:271 +#: ../../library/concurrent.interpreters.rst:328 +msgid "" +"Some objects are actually shared and some are copied efficiently, but most " +"are copied via :mod:`pickle`. See :ref:`interp-object-sharing`." msgstr "" +#: ../../library/concurrent.interpreters.rst:276 msgid "Run the given source code in the interpreter (in the current thread)." msgstr "" -msgid "Return the result of calling running the given function in the interpreter (in the current thread)." +#: ../../library/concurrent.interpreters.rst:280 +msgid "" +"Return the result of calling running the given function in the interpreter " +"(in the current thread)." msgstr "" +#: ../../library/concurrent.interpreters.rst:287 msgid "Run the given function in the interpreter (in a new thread)." msgstr "" +#: ../../library/concurrent.interpreters.rst:290 msgid "Exceptions" msgstr "" -msgid "This exception, a subclass of :exc:`Exception`, is raised when an interpreter-related error happens." +#: ../../library/concurrent.interpreters.rst:294 +msgid "" +"This exception, a subclass of :exc:`Exception`, is raised when an " +"interpreter-related error happens." msgstr "" -msgid "This exception, a subclass of :exc:`InterpreterError`, is raised when the targeted interpreter no longer exists." +#: ../../library/concurrent.interpreters.rst:299 +msgid "" +"This exception, a subclass of :exc:`InterpreterError`, is raised when the " +"targeted interpreter no longer exists." msgstr "" -msgid "This exception, a subclass of :exc:`InterpreterError`, is raised when the running code raised an uncaught exception." +#: ../../library/concurrent.interpreters.rst:304 +msgid "" +"This exception, a subclass of :exc:`InterpreterError`, is raised when the " +"running code raised an uncaught exception." msgstr "" +#: ../../library/concurrent.interpreters.rst:309 msgid "A basic snapshot of the exception raised in the other interpreter." msgstr "" -msgid "This exception, a subclass of :exc:`TypeError`, is raised when an object cannot be sent to another interpreter." +#: ../../library/concurrent.interpreters.rst:315 +msgid "" +"This exception, a subclass of :exc:`TypeError`, is raised when an object " +"cannot be sent to another interpreter." msgstr "" +#: ../../library/concurrent.interpreters.rst:320 msgid "Communicating Between Interpreters" msgstr "" -msgid "A wrapper around a low-level, cross-interpreter queue, which implements the :class:`queue.Queue` interface. The underlying queue can only be created through :func:`create_queue`." +#: ../../library/concurrent.interpreters.rst:324 +msgid "" +"A wrapper around a low-level, cross-interpreter queue, which implements " +"the :class:`queue.Queue` interface. The underlying queue can only be " +"created through :func:`create_queue`." msgstr "" +#: ../../library/concurrent.interpreters.rst:335 msgid "The queue's ID." msgstr "" -msgid "This exception, a subclass of :exc:`queue.Empty`, is raised from :meth:`!Queue.get` and :meth:`!Queue.get_nowait` when the queue is empty." +#: ../../library/concurrent.interpreters.rst:340 +msgid "" +"This exception, a subclass of :exc:`queue.Empty`, is raised from :meth:`!" +"Queue.get` and :meth:`!Queue.get_nowait` when the queue is empty." msgstr "" -msgid "This exception, a subclass of :exc:`queue.Full`, is raised from :meth:`!Queue.put` and :meth:`!Queue.put_nowait` when the queue is full." +#: ../../library/concurrent.interpreters.rst:346 +msgid "" +"This exception, a subclass of :exc:`queue.Full`, is raised from :meth:`!" +"Queue.put` and :meth:`!Queue.put_nowait` when the queue is full." msgstr "" +#: ../../library/concurrent.interpreters.rst:352 msgid "Basic usage" msgstr "" +#: ../../library/concurrent.interpreters.rst:354 msgid "Creating an interpreter and running code in it::" msgstr "" +#: ../../library/concurrent.interpreters.rst:356 msgid "" "from concurrent import interpreters\n" "\n" diff --git a/library/concurrent.po b/library/concurrent.po index fb5efeaba..b63024b70 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/concurrent.rst:2 msgid "The :mod:`!concurrent` package" msgstr "" +#: ../../library/concurrent.rst:4 msgid "This package contains the following modules:" msgstr "" +#: ../../library/concurrent.rst:6 msgid ":mod:`concurrent.futures` -- Launching parallel tasks" msgstr "" -msgid ":mod:`concurrent.interpreters` -- Multiple interpreters in the same process" +#: ../../library/concurrent.rst:7 +msgid "" +":mod:`concurrent.interpreters` -- Multiple interpreters in the same process" msgstr "" diff --git a/library/configparser.po b/library/configparser.po index f6a6b82ff..cd6f3c5bd 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,42 +23,67 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/configparser.rst:2 msgid ":mod:`!configparser` --- Configuration file parser" msgstr "" +#: ../../library/configparser.rst:14 msgid "**Source code:** :source:`Lib/configparser.py`" msgstr "" -msgid "This module provides the :class:`ConfigParser` class which implements a basic configuration language which provides a structure similar to what's found in Microsoft Windows INI files. You can use this to write Python programs which can be customized by end users easily." +#: ../../library/configparser.rst:24 +msgid "" +"This module provides the :class:`ConfigParser` class which implements a " +"basic configuration language which provides a structure similar to what's " +"found in Microsoft Windows INI files. You can use this to write Python " +"programs which can be customized by end users easily." msgstr "" -msgid "This library does *not* interpret or write the value-type prefixes used in the Windows Registry extended version of INI syntax." +#: ../../library/configparser.rst:31 +msgid "" +"This library does *not* interpret or write the value-type prefixes used in " +"the Windows Registry extended version of INI syntax." msgstr "" +#: ../../library/configparser.rst:36 msgid "Module :mod:`tomllib`" msgstr "" -msgid "TOML is a well-specified format for application configuration files. It is specifically designed to be an improved version of INI." +#: ../../library/configparser.rst:37 +msgid "" +"TOML is a well-specified format for application configuration files. It is " +"specifically designed to be an improved version of INI." msgstr "" +#: ../../library/configparser.rst:40 msgid "Module :mod:`shlex`" msgstr "" -msgid "Support for creating Unix shell-like mini-languages which can also be used for application configuration files." +#: ../../library/configparser.rst:41 +msgid "" +"Support for creating Unix shell-like mini-languages which can also be used " +"for application configuration files." msgstr "" +#: ../../library/configparser.rst:44 msgid "Module :mod:`json`" msgstr "" -msgid "The ``json`` module implements a subset of JavaScript syntax which is sometimes used for configuration, but does not support comments." +#: ../../library/configparser.rst:45 +msgid "" +"The ``json`` module implements a subset of JavaScript syntax which is " +"sometimes used for configuration, but does not support comments." msgstr "" +#: ../../library/configparser.rst:61 msgid "Quick Start" msgstr "" +#: ../../library/configparser.rst:63 msgid "Let's take a very basic configuration file that looks like this:" msgstr "" +#: ../../library/configparser.rst:65 msgid "" "[DEFAULT]\n" "ServerAliveInterval = 45\n" @@ -74,9 +99,16 @@ msgid "" "ForwardX11 = no" msgstr "" -msgid "The structure of INI files is described `in the following section <#supported-ini-file-structure>`_. Essentially, the file consists of sections, each of which contains keys with values. :mod:`!configparser` classes can read and write such files. Let's start by creating the above configuration file programmatically." +#: ../../library/configparser.rst:80 +msgid "" +"The structure of INI files is described `in the following section " +"<#supported-ini-file-structure>`_. Essentially, the file consists of " +"sections, each of which contains keys with values. :mod:`!configparser` " +"classes can read and write such files. Let's start by creating the above " +"configuration file programmatically." msgstr "" +#: ../../library/configparser.rst:86 msgid "" ">>> import configparser\n" ">>> config = configparser.ConfigParser()\n" @@ -95,12 +127,20 @@ msgid "" "..." msgstr "" -msgid "As you can see, we can treat a config parser much like a dictionary. There are differences, `outlined later <#mapping-protocol-access>`_, but the behavior is very close to what you would expect from a dictionary." +#: ../../library/configparser.rst:104 +msgid "" +"As you can see, we can treat a config parser much like a dictionary. There " +"are differences, `outlined later <#mapping-protocol-access>`_, but the " +"behavior is very close to what you would expect from a dictionary." msgstr "" -msgid "Now that we have created and saved a configuration file, let's read it back and explore the data it holds." +#: ../../library/configparser.rst:108 +msgid "" +"Now that we have created and saved a configuration file, let's read it back " +"and explore the data it holds." msgstr "" +#: ../../library/configparser.rst:111 msgid "" ">>> config = configparser.ConfigParser()\n" ">>> config.sections()\n" @@ -133,17 +173,31 @@ msgid "" "'yes'" msgstr "" -msgid "As we can see above, the API is pretty straightforward. The only bit of magic involves the ``DEFAULT`` section which provides default values for all other sections [1]_. Note also that keys in sections are case-insensitive and stored in lowercase [1]_." +#: ../../library/configparser.rst:143 +msgid "" +"As we can see above, the API is pretty straightforward. The only bit of " +"magic involves the ``DEFAULT`` section which provides default values for all " +"other sections [1]_. Note also that keys in sections are case-insensitive " +"and stored in lowercase [1]_." msgstr "" -msgid "It is possible to read several configurations into a single :class:`ConfigParser`, where the most recently added configuration has the highest priority. Any conflicting keys are taken from the more recent configuration while the previously existing keys are retained. The example below reads in an ``override.ini`` file, which will override any conflicting keys from the ``example.ini`` file." +#: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 +msgid "" +"It is possible to read several configurations into a " +"single :class:`ConfigParser`, where the most recently added configuration " +"has the highest priority. Any conflicting keys are taken from the more " +"recent configuration while the previously existing keys are retained. The " +"example below reads in an ``override.ini`` file, which will override any " +"conflicting keys from the ``example.ini`` file." msgstr "" +#: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" msgstr "" +#: ../../library/configparser.rst:160 ../../library/configparser.rst:1015 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -157,15 +211,24 @@ msgid "" "-1" msgstr "" -msgid "This behaviour is equivalent to a :meth:`ConfigParser.read` call with several files passed to the *filenames* parameter." +#: ../../library/configparser.rst:174 +msgid "" +"This behaviour is equivalent to a :meth:`ConfigParser.read` call with " +"several files passed to the *filenames* parameter." msgstr "" +#: ../../library/configparser.rst:179 msgid "Supported Datatypes" msgstr "" -msgid "Config parsers do not guess datatypes of values in configuration files, always storing them internally as strings. This means that if you need other datatypes, you should convert on your own:" +#: ../../library/configparser.rst:181 +msgid "" +"Config parsers do not guess datatypes of values in configuration files, " +"always storing them internally as strings. This means that if you need " +"other datatypes, you should convert on your own:" msgstr "" +#: ../../library/configparser.rst:185 msgid "" ">>> int(topsecret['Port'])\n" "50022\n" @@ -173,9 +236,18 @@ msgid "" "9.0" msgstr "" -msgid "Since this task is so common, config parsers provide a range of handy getter methods to handle integers, floats and booleans. The last one is the most interesting because simply passing the value to ``bool()`` would do no good since ``bool('False')`` is still ``True``. This is why config parsers also provide :meth:`~ConfigParser.getboolean`. This method is case-insensitive and recognizes Boolean values from ``'yes'``/``'no'``, ``'on'``/``'off'``, ``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:" +#: ../../library/configparser.rst:192 +msgid "" +"Since this task is so common, config parsers provide a range of handy getter " +"methods to handle integers, floats and booleans. The last one is the most " +"interesting because simply passing the value to ``bool()`` would do no good " +"since ``bool('False')`` is still ``True``. This is why config parsers also " +"provide :meth:`~ConfigParser.getboolean`. This method is case-insensitive " +"and recognizes Boolean values from ``'yes'``/``'no'``, ``'on'``/``'off'``, " +"``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:" msgstr "" +#: ../../library/configparser.rst:200 msgid "" ">>> topsecret.getboolean('ForwardX11')\n" "False\n" @@ -185,15 +257,25 @@ msgid "" "True" msgstr "" -msgid "Apart from :meth:`~ConfigParser.getboolean`, config parsers also provide equivalent :meth:`~ConfigParser.getint` and :meth:`~ConfigParser.getfloat` methods. You can register your own converters and customize the provided ones. [1]_" +#: ../../library/configparser.rst:209 +msgid "" +"Apart from :meth:`~ConfigParser.getboolean`, config parsers also provide " +"equivalent :meth:`~ConfigParser.getint` and :meth:`~ConfigParser.getfloat` " +"methods. You can register your own converters and customize the provided " +"ones. [1]_" msgstr "" +#: ../../library/configparser.rst:215 msgid "Fallback Values" msgstr "" -msgid "As with a dictionary, you can use a section's :meth:`~ConfigParser.get` method to provide fallback values:" +#: ../../library/configparser.rst:217 +msgid "" +"As with a dictionary, you can use a section's :meth:`~ConfigParser.get` " +"method to provide fallback values:" msgstr "" +#: ../../library/configparser.rst:220 msgid "" ">>> topsecret.get('Port')\n" "'50022'\n" @@ -204,26 +286,44 @@ msgid "" "'3des-cbc'" msgstr "" -msgid "Please note that default values have precedence over fallback values. For instance, in our example the ``'CompressionLevel'`` key was specified only in the ``'DEFAULT'`` section. If we try to get it from the section ``'topsecret.server.example'``, we will always get the default, even if we specify a fallback:" +#: ../../library/configparser.rst:230 +msgid "" +"Please note that default values have precedence over fallback values. For " +"instance, in our example the ``'CompressionLevel'`` key was specified only " +"in the ``'DEFAULT'`` section. If we try to get it from the section " +"``'topsecret.server.example'``, we will always get the default, even if we " +"specify a fallback:" msgstr "" +#: ../../library/configparser.rst:236 msgid "" ">>> topsecret.get('CompressionLevel', '3')\n" "'9'" msgstr "" -msgid "One more thing to be aware of is that the parser-level :meth:`~ConfigParser.get` method provides a custom, more complex interface, maintained for backwards compatibility. When using this method, a fallback value can be provided via the ``fallback`` keyword-only argument:" +#: ../../library/configparser.rst:241 +msgid "" +"One more thing to be aware of is that the parser-" +"level :meth:`~ConfigParser.get` method provides a custom, more complex " +"interface, maintained for backwards compatibility. When using this method, " +"a fallback value can be provided via the ``fallback`` keyword-only argument:" msgstr "" +#: ../../library/configparser.rst:246 msgid "" ">>> config.get('forge.example', 'monster',\n" "... fallback='No such things as monsters')\n" "'No such things as monsters'" msgstr "" -msgid "The same ``fallback`` argument can be used with the :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` methods, for example:" +#: ../../library/configparser.rst:252 +msgid "" +"The same ``fallback`` argument can be used with " +"the :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` " +"and :meth:`~ConfigParser.getboolean` methods, for example:" msgstr "" +#: ../../library/configparser.rst:256 msgid "" ">>> 'BatchMode' in topsecret\n" "False\n" @@ -234,24 +334,49 @@ msgid "" "False" msgstr "" +#: ../../library/configparser.rst:268 msgid "Supported INI File Structure" msgstr "" -msgid "A configuration file consists of sections, each led by a ``[section]`` header, followed by key/value entries separated by a specific string (``=`` or ``:`` by default [1]_). By default, section names are case sensitive but keys are not [1]_. Leading and trailing whitespace is removed from keys and values. Values can be omitted if the parser is configured to allow it [1]_, in which case the key/value delimiter may also be left out. Values can also span multiple lines, as long as they are indented deeper than the first line of the value. Depending on the parser's mode, blank lines may be treated as parts of multiline values or ignored." -msgstr "" - -msgid "By default, a valid section name can be any string that does not contain '\\\\n'. To change this, see :attr:`ConfigParser.SECTCRE`." +#: ../../library/configparser.rst:270 +msgid "" +"A configuration file consists of sections, each led by a ``[section]`` " +"header, followed by key/value entries separated by a specific string (``=`` " +"or ``:`` by default [1]_). By default, section names are case sensitive but " +"keys are not [1]_. Leading and trailing whitespace is removed from keys and " +"values. Values can be omitted if the parser is configured to allow it [1]_, " +"in which case the key/value delimiter may also be left out. Values can also " +"span multiple lines, as long as they are indented deeper than the first line " +"of the value. Depending on the parser's mode, blank lines may be treated as " +"parts of multiline values or ignored." +msgstr "" + +#: ../../library/configparser.rst:280 +msgid "" +"By default, a valid section name can be any string that does not contain '\\" +"\\n'. To change this, see :attr:`ConfigParser.SECTCRE`." msgstr "" -msgid "The first section name may be omitted if the parser is configured to allow an unnamed top level section with ``allow_unnamed_section=True``. In this case, the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in ``config[UNNAMED_SECTION]``." +#: ../../library/configparser.rst:283 +msgid "" +"The first section name may be omitted if the parser is configured to allow " +"an unnamed top level section with ``allow_unnamed_section=True``. In this " +"case, the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in " +"``config[UNNAMED_SECTION]``." msgstr "" -msgid "Configuration files may include comments, prefixed by specific characters (``#`` and ``;`` by default [1]_). Comments may appear on their own on an otherwise empty line, possibly indented. [1]_" +#: ../../library/configparser.rst:288 +msgid "" +"Configuration files may include comments, prefixed by specific characters " +"(``#`` and ``;`` by default [1]_). Comments may appear on their own on an " +"otherwise empty line, possibly indented. [1]_" msgstr "" +#: ../../library/configparser.rst:292 ../../library/configparser.rst:376 msgid "For example:" msgstr "" +#: ../../library/configparser.rst:294 msgid "" "[Simple Values]\n" "key=value\n" @@ -296,12 +421,17 @@ msgid "" " # Did I mention we can indent comments, too?" msgstr "" +#: ../../library/configparser.rst:342 msgid "Unnamed Sections" msgstr "" -msgid "The name of the first section (or unique) may be omitted and values retrieved by the :const:`UNNAMED_SECTION` attribute." +#: ../../library/configparser.rst:344 +msgid "" +"The name of the first section (or unique) may be omitted and values " +"retrieved by the :const:`UNNAMED_SECTION` attribute." msgstr "" +#: ../../library/configparser.rst:347 msgid "" ">>> config = \"\"\"\n" "... option = value\n" @@ -315,15 +445,26 @@ msgid "" "'value'" msgstr "" +#: ../../library/configparser.rst:361 msgid "Interpolation of values" msgstr "" -msgid "On top of the core functionality, :class:`ConfigParser` supports interpolation. This means values can be preprocessed before returning them from ``get()`` calls." +#: ../../library/configparser.rst:363 +msgid "" +"On top of the core functionality, :class:`ConfigParser` supports " +"interpolation. This means values can be preprocessed before returning them " +"from ``get()`` calls." msgstr "" -msgid "The default implementation used by :class:`ConfigParser`. It enables values to contain format strings which refer to other values in the same section, or values in the special default section [1]_. Additional default values can be provided on initialization." +#: ../../library/configparser.rst:371 +msgid "" +"The default implementation used by :class:`ConfigParser`. It enables values " +"to contain format strings which refer to other values in the same section, " +"or values in the special default section [1]_. Additional default values " +"can be provided on initialization." msgstr "" +#: ../../library/configparser.rst:378 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -331,22 +472,45 @@ msgid "" "my_pictures: %(my_dir)s/Pictures\n" "\n" "[Escape]\n" -"# use a %% to escape the % sign (% is the only character that needs to be escaped):\n" +"# use a %% to escape the % sign (% is the only character that needs to be " +"escaped):\n" "gain: 80%%" msgstr "" -msgid "In the example above, :class:`ConfigParser` with *interpolation* set to ``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of ``home_dir`` (``/Users`` in this case). ``%(my_dir)s`` in effect would resolve to ``/Users/lumberjack``. All interpolations are done on demand so keys used in the chain of references do not have to be specified in any specific order in the configuration file." +#: ../../library/configparser.rst:389 +msgid "" +"In the example above, :class:`ConfigParser` with *interpolation* set to " +"``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " +"``home_dir`` (``/Users`` in this case). ``%(my_dir)s`` in effect would " +"resolve to ``/Users/lumberjack``. All interpolations are done on demand so " +"keys used in the chain of references do not have to be specified in any " +"specific order in the configuration file." msgstr "" -msgid "With ``interpolation`` set to ``None``, the parser would simply return ``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/lumberjack`` as the value of ``my_dir``." +#: ../../library/configparser.rst:396 +msgid "" +"With ``interpolation`` set to ``None``, the parser would simply return ``%" +"(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" +"lumberjack`` as the value of ``my_dir``." msgstr "" -msgid "An alternative handler for interpolation which implements a more advanced syntax, used for instance in ``zc.buildout``. Extended interpolation is using ``${section:option}`` to denote a value from a foreign section. Interpolation can span multiple levels. For convenience, if the ``section:`` part is omitted, interpolation defaults to the current section (and possibly the default values from the special section)." +#: ../../library/configparser.rst:404 +msgid "" +"An alternative handler for interpolation which implements a more advanced " +"syntax, used for instance in ``zc.buildout``. Extended interpolation is " +"using ``${section:option}`` to denote a value from a foreign section. " +"Interpolation can span multiple levels. For convenience, if the " +"``section:`` part is omitted, interpolation defaults to the current section " +"(and possibly the default values from the special section)." msgstr "" -msgid "For example, the configuration specified above with basic interpolation, would look like this with extended interpolation:" +#: ../../library/configparser.rst:411 +msgid "" +"For example, the configuration specified above with basic interpolation, " +"would look like this with extended interpolation:" msgstr "" +#: ../../library/configparser.rst:414 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -354,13 +518,16 @@ msgid "" "my_pictures: ${my_dir}/Pictures\n" "\n" "[Escape]\n" -"# use a $$ to escape the $ sign ($ is the only character that needs to be escaped):\n" +"# use a $$ to escape the $ sign ($ is the only character that needs to be " +"escaped):\n" "cost: $$80" msgstr "" +#: ../../library/configparser.rst:425 msgid "Values from other sections can be fetched as well:" msgstr "" +#: ../../library/configparser.rst:427 msgid "" "[Common]\n" "home_dir: /Users\n" @@ -380,80 +547,163 @@ msgid "" "python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" msgstr "" +#: ../../library/configparser.rst:447 msgid "Mapping Protocol Access" msgstr "" -msgid "Mapping protocol access is a generic name for functionality that enables using custom objects as if they were dictionaries. In case of :mod:`!configparser`, the mapping interface implementation is using the ``parser['section']['option']`` notation." +#: ../../library/configparser.rst:451 +msgid "" +"Mapping protocol access is a generic name for functionality that enables " +"using custom objects as if they were dictionaries. In case of :mod:`!" +"configparser`, the mapping interface implementation is using the " +"``parser['section']['option']`` notation." msgstr "" -msgid "``parser['section']`` in particular returns a proxy for the section's data in the parser. This means that the values are not copied but they are taken from the original parser on demand. What's even more important is that when values are changed on a section proxy, they are actually mutated in the original parser." +#: ../../library/configparser.rst:456 +msgid "" +"``parser['section']`` in particular returns a proxy for the section's data " +"in the parser. This means that the values are not copied but they are taken " +"from the original parser on demand. What's even more important is that when " +"values are changed on a section proxy, they are actually mutated in the " +"original parser." msgstr "" -msgid ":mod:`!configparser` objects behave as close to actual dictionaries as possible. The mapping interface is complete and adheres to the :class:`~collections.abc.MutableMapping` ABC. However, there are a few differences that should be taken into account:" +#: ../../library/configparser.rst:462 +msgid "" +":mod:`!configparser` objects behave as close to actual dictionaries as " +"possible. The mapping interface is complete and adheres to " +"the :class:`~collections.abc.MutableMapping` ABC. However, there are a few " +"differences that should be taken into account:" msgstr "" -msgid "By default, all keys in sections are accessible in a case-insensitive manner [1]_. E.g. ``for option in parser[\"section\"]`` yields only ``optionxform``'ed option key names. This means lowercased keys by default. At the same time, for a section that holds the key ``'a'``, both expressions return ``True``::" +#: ../../library/configparser.rst:467 +msgid "" +"By default, all keys in sections are accessible in a case-insensitive manner " +"[1]_. E.g. ``for option in parser[\"section\"]`` yields only " +"``optionxform``'ed option key names. This means lowercased keys by " +"default. At the same time, for a section that holds the key ``'a'``, both " +"expressions return ``True``::" msgstr "" +#: ../../library/configparser.rst:472 msgid "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" msgstr "" -msgid "All sections include ``DEFAULTSECT`` values as well which means that ``.clear()`` on a section may not leave the section visibly empty. This is because default values cannot be deleted from the section (because technically they are not there). If they are overridden in the section, deleting causes the default value to be visible again. Trying to delete a default value causes a :exc:`KeyError`." +#: ../../library/configparser.rst:475 +msgid "" +"All sections include ``DEFAULTSECT`` values as well which means that " +"``.clear()`` on a section may not leave the section visibly empty. This is " +"because default values cannot be deleted from the section (because " +"technically they are not there). If they are overridden in the section, " +"deleting causes the default value to be visible again. Trying to delete a " +"default value causes a :exc:`KeyError`." msgstr "" +#: ../../library/configparser.rst:482 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" +#: ../../library/configparser.rst:484 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" +#: ../../library/configparser.rst:486 msgid "``parser.clear()`` leaves it intact," msgstr "" +#: ../../library/configparser.rst:488 msgid "``parser.popitem()`` never returns it." msgstr "" -msgid "``parser.get(section, option, **kwargs)`` - the second argument is **not** a fallback value. Note however that the section-level ``get()`` methods are compatible both with the mapping protocol and the classic configparser API." +#: ../../library/configparser.rst:490 +msgid "" +"``parser.get(section, option, **kwargs)`` - the second argument is **not** a " +"fallback value. Note however that the section-level ``get()`` methods are " +"compatible both with the mapping protocol and the classic configparser API." msgstr "" -msgid "``parser.items()`` is compatible with the mapping protocol (returns a list of *section_name*, *section_proxy* pairs including the DEFAULTSECT). However, this method can also be invoked with arguments: ``parser.items(section, raw, vars)``. The latter call returns a list of *option*, *value* pairs for a specified ``section``, with all interpolations expanded (unless ``raw=True`` is provided)." +#: ../../library/configparser.rst:494 +msgid "" +"``parser.items()`` is compatible with the mapping protocol (returns a list " +"of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " +"However, this method can also be invoked with arguments: " +"``parser.items(section, raw, vars)``. The latter call returns a list of " +"*option*, *value* pairs for a specified ``section``, with all interpolations " +"expanded (unless ``raw=True`` is provided)." msgstr "" -msgid "The mapping protocol is implemented on top of the existing legacy API so that subclasses overriding the original interface still should have mappings working as expected." +#: ../../library/configparser.rst:501 +msgid "" +"The mapping protocol is implemented on top of the existing legacy API so " +"that subclasses overriding the original interface still should have mappings " +"working as expected." msgstr "" +#: ../../library/configparser.rst:507 msgid "Customizing Parser Behaviour" msgstr "" -msgid "There are nearly as many INI format variants as there are applications using it. :mod:`!configparser` goes a long way to provide support for the largest sensible set of INI styles available. The default functionality is mainly dictated by historical background and it's very likely that you will want to customize some of the features." +#: ../../library/configparser.rst:509 +msgid "" +"There are nearly as many INI format variants as there are applications using " +"it. :mod:`!configparser` goes a long way to provide support for the largest " +"sensible set of INI styles available. The default functionality is mainly " +"dictated by historical background and it's very likely that you will want to " +"customize some of the features." msgstr "" -msgid "The most common way to change the way a specific config parser works is to use the :meth:`!__init__` options:" +#: ../../library/configparser.rst:515 +msgid "" +"The most common way to change the way a specific config parser works is to " +"use the :meth:`!__init__` options:" msgstr "" +#: ../../library/configparser.rst:518 msgid "*defaults*, default value: ``None``" msgstr "" -msgid "This option accepts a dictionary of key-value pairs which will be initially put in the ``DEFAULT`` section. This makes for an elegant way to support concise configuration files that don't specify values which are the same as the documented default." +#: ../../library/configparser.rst:520 +msgid "" +"This option accepts a dictionary of key-value pairs which will be initially " +"put in the ``DEFAULT`` section. This makes for an elegant way to support " +"concise configuration files that don't specify values which are the same as " +"the documented default." msgstr "" -msgid "Hint: if you want to specify default values for a specific section, use :meth:`~ConfigParser.read_dict` before you read the actual file." +#: ../../library/configparser.rst:525 +msgid "" +"Hint: if you want to specify default values for a specific section, " +"use :meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" +#: ../../library/configparser.rst:528 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -msgid "This option has a major impact on how the mapping protocol will behave and how the written configuration files look. With the standard dictionary, every section is stored in the order they were added to the parser. Same goes for options within sections." +#: ../../library/configparser.rst:530 +msgid "" +"This option has a major impact on how the mapping protocol will behave and " +"how the written configuration files look. With the standard dictionary, " +"every section is stored in the order they were added to the parser. Same " +"goes for options within sections." msgstr "" -msgid "An alternative dictionary type can be used for example to sort sections and options on write-back." +#: ../../library/configparser.rst:535 +msgid "" +"An alternative dictionary type can be used for example to sort sections and " +"options on write-back." msgstr "" -msgid "Please note: there are ways to add a set of key-value pairs in a single operation. When you use a regular dictionary in those operations, the order of the keys will be ordered. For example:" +#: ../../library/configparser.rst:538 +msgid "" +"Please note: there are ways to add a set of key-value pairs in a single " +"operation. When you use a regular dictionary in those operations, the order " +"of the keys will be ordered. For example:" msgstr "" +#: ../../library/configparser.rst:542 msgid "" ">>> parser = configparser.ConfigParser()\n" ">>> parser.read_dict({'section1': {'key1': 'value1',\n" @@ -472,12 +722,19 @@ msgid "" "['foo', 'bar', 'baz']" msgstr "" +#: ../../library/configparser.rst:560 msgid "*allow_no_value*, default value: ``False``" msgstr "" -msgid "Some configuration files are known to include settings without values, but which otherwise conform to the syntax supported by :mod:`!configparser`. The *allow_no_value* parameter to the constructor can be used to indicate that such values should be accepted:" +#: ../../library/configparser.rst:562 +msgid "" +"Some configuration files are known to include settings without values, but " +"which otherwise conform to the syntax supported by :mod:`!configparser`. " +"The *allow_no_value* parameter to the constructor can be used to indicate " +"that such values should be accepted:" msgstr "" +#: ../../library/configparser.rst:567 msgid "" ">>> import configparser\n" "\n" @@ -508,30 +765,58 @@ msgid "" "KeyError: 'does-not-exist'" msgstr "" +#: ../../library/configparser.rst:597 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -msgid "Delimiters are substrings that delimit keys from values within a section. The first occurrence of a delimiting substring on a line is considered a delimiter. This means values (but not keys) can contain the delimiters." +#: ../../library/configparser.rst:599 +msgid "" +"Delimiters are substrings that delimit keys from values within a section. " +"The first occurrence of a delimiting substring on a line is considered a " +"delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -msgid "See also the *space_around_delimiters* argument to :meth:`ConfigParser.write`." +#: ../../library/configparser.rst:603 +msgid "" +"See also the *space_around_delimiters* argument " +"to :meth:`ConfigParser.write`." msgstr "" +#: ../../library/configparser.rst:606 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" +#: ../../library/configparser.rst:608 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -msgid "Comment prefixes are strings that indicate the start of a valid comment within a config file. *comment_prefixes* are used only on otherwise empty lines (optionally indented) whereas *inline_comment_prefixes* can be used after every valid value (e.g. section names, options and empty lines as well). By default inline comments are disabled and ``'#'`` and ``';'`` are used as prefixes for whole line comments." +#: ../../library/configparser.rst:610 +msgid "" +"Comment prefixes are strings that indicate the start of a valid comment " +"within a config file. *comment_prefixes* are used only on otherwise empty " +"lines (optionally indented) whereas *inline_comment_prefixes* can be used " +"after every valid value (e.g. section names, options and empty lines as " +"well). By default inline comments are disabled and ``'#'`` and ``';'`` are " +"used as prefixes for whole line comments." msgstr "" -msgid "In previous versions of :mod:`!configparser` behaviour matched ``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." +#: ../../library/configparser.rst:617 +msgid "" +"In previous versions of :mod:`!configparser` behaviour matched " +"``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -msgid "Please note that config parsers don't support escaping of comment prefixes so using *inline_comment_prefixes* may prevent users from specifying option values with characters used as comment prefixes. When in doubt, avoid setting *inline_comment_prefixes*. In any circumstances, the only way of storing comment prefix characters at the beginning of a line in multiline values is to interpolate the prefix, for example::" +#: ../../library/configparser.rst:621 +msgid "" +"Please note that config parsers don't support escaping of comment prefixes " +"so using *inline_comment_prefixes* may prevent users from specifying option " +"values with characters used as comment prefixes. When in doubt, avoid " +"setting *inline_comment_prefixes*. In any circumstances, the only way of " +"storing comment prefix characters at the beginning of a line in multiline " +"values is to interpolate the prefix, for example::" msgstr "" +#: ../../library/configparser.rst:628 msgid "" ">>> from configparser import ConfigParser, ExtendedInterpolation\n" ">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" @@ -573,21 +858,40 @@ msgid "" "line #3" msgstr "" +#: ../../library/configparser.rst:667 msgid "*strict*, default value: ``True``" msgstr "" -msgid "When set to ``True``, the parser will not allow for any section or option duplicates while reading from a single source (using :meth:`~ConfigParser.read_file`, :meth:`~ConfigParser.read_string` or :meth:`~ConfigParser.read_dict`). It is recommended to use strict parsers in new applications." +#: ../../library/configparser.rst:669 +msgid "" +"When set to ``True``, the parser will not allow for any section or option " +"duplicates while reading from a single source " +"(using :meth:`~ConfigParser.read_file`, :meth:`~ConfigParser.read_string` " +"or :meth:`~ConfigParser.read_dict`). It is recommended to use strict " +"parsers in new applications." msgstr "" -msgid "In previous versions of :mod:`!configparser` behaviour matched ``strict=False``." +#: ../../library/configparser.rst:674 +msgid "" +"In previous versions of :mod:`!configparser` behaviour matched " +"``strict=False``." msgstr "" +#: ../../library/configparser.rst:678 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -msgid "In config parsers, values can span multiple lines as long as they are indented more than the key that holds them. By default parsers also let empty lines to be parts of values. At the same time, keys can be arbitrarily indented themselves to improve readability. In consequence, when configuration files get big and complex, it is easy for the user to lose track of the file structure. Take for instance:" +#: ../../library/configparser.rst:680 +msgid "" +"In config parsers, values can span multiple lines as long as they are " +"indented more than the key that holds them. By default parsers also let " +"empty lines to be parts of values. At the same time, keys can be " +"arbitrarily indented themselves to improve readability. In consequence, " +"when configuration files get big and complex, it is easy for the user to " +"lose track of the file structure. Take for instance:" msgstr "" +#: ../../library/configparser.rst:687 msgid "" "[Section]\n" "key = multiline\n" @@ -596,36 +900,92 @@ msgid "" " this = is still a part of the multiline value of 'key'" msgstr "" -msgid "This can be especially problematic for the user to see if she's using a proportional font to edit the file. That is why when your application does not need values with empty lines, you should consider disallowing them. This will make empty lines split keys every time. In the example above, it would produce two keys, ``key`` and ``this``." -msgstr "" - -msgid "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: ``\"DEFAULT\"``)" +#: ../../library/configparser.rst:695 +msgid "" +"This can be especially problematic for the user to see if she's using a " +"proportional font to edit the file. That is why when your application does " +"not need values with empty lines, you should consider disallowing them. " +"This will make empty lines split keys every time. In the example above, it " +"would produce two keys, ``key`` and ``this``." msgstr "" -msgid "The convention of allowing a special section of default values for other sections or interpolation purposes is a powerful concept of this library, letting users create complex declarative configurations. This section is normally called ``\"DEFAULT\"`` but this can be customized to point to any other valid section name. Some typical values include: ``\"general\"`` or ``\"common\"``. The name provided is used for recognizing default sections when reading from any source and is used when writing configuration back to a file. Its current value can be retrieved using the ``parser_instance.default_section`` attribute and may be modified at runtime (i.e. to convert files from one format to another)." +#: ../../library/configparser.rst:701 +msgid "" +"*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: " +"``\"DEFAULT\"``)" msgstr "" +#: ../../library/configparser.rst:704 +msgid "" +"The convention of allowing a special section of default values for other " +"sections or interpolation purposes is a powerful concept of this library, " +"letting users create complex declarative configurations. This section is " +"normally called ``\"DEFAULT\"`` but this can be customized to point to any " +"other valid section name. Some typical values include: ``\"general\"`` or " +"``\"common\"``. The name provided is used for recognizing default sections " +"when reading from any source and is used when writing configuration back to " +"a file. Its current value can be retrieved using the " +"``parser_instance.default_section`` attribute and may be modified at runtime " +"(i.e. to convert files from one format to another)." +msgstr "" + +#: ../../library/configparser.rst:715 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -msgid "Interpolation behaviour may be customized by providing a custom handler through the *interpolation* argument. ``None`` can be used to turn off interpolation completely, ``ExtendedInterpolation()`` provides a more advanced variant inspired by ``zc.buildout``. More on the subject in the `dedicated documentation section <#interpolation-of-values>`_. :class:`RawConfigParser` has a default value of ``None``." +#: ../../library/configparser.rst:717 +msgid "" +"Interpolation behaviour may be customized by providing a custom handler " +"through the *interpolation* argument. ``None`` can be used to turn off " +"interpolation completely, ``ExtendedInterpolation()`` provides a more " +"advanced variant inspired by ``zc.buildout``. More on the subject in the " +"`dedicated documentation section <#interpolation-of-" +"values>`_. :class:`RawConfigParser` has a default value of ``None``." msgstr "" +#: ../../library/configparser.rst:724 msgid "*converters*, default value: not set" msgstr "" -msgid "Config parsers provide option value getters that perform type conversion. By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, and :meth:`~ConfigParser.getboolean` are implemented. Should other getters be desirable, users may define them in a subclass or pass a dictionary where each key is a name of the converter and each value is a callable implementing said conversion. For instance, passing ``{'decimal': decimal.Decimal}`` would add :meth:`!getdecimal` on both the parser object and all section proxies. In other words, it will be possible to write both ``parser_instance.getdecimal('section', 'key', fallback=0)`` and ``parser_instance['section'].getdecimal('key', 0)``." -msgstr "" - -msgid "If the converter needs to access the state of the parser, it can be implemented as a method on a config parser subclass. If the name of this method starts with ``get``, it will be available on all section proxies, in the dict-compatible form (see the ``getdecimal()`` example above)." +#: ../../library/configparser.rst:726 +msgid "" +"Config parsers provide option value getters that perform type conversion. " +"By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " +"and :meth:`~ConfigParser.getboolean` are implemented. Should other getters " +"be desirable, users may define them in a subclass or pass a dictionary where " +"each key is a name of the converter and each value is a callable " +"implementing said conversion. For instance, passing ``{'decimal': " +"decimal.Decimal}`` would add :meth:`!getdecimal` on both the parser object " +"and all section proxies. In other words, it will be possible to write both " +"``parser_instance.getdecimal('section', 'key', fallback=0)`` and " +"``parser_instance['section'].getdecimal('key', 0)``." +msgstr "" + +#: ../../library/configparser.rst:737 +msgid "" +"If the converter needs to access the state of the parser, it can be " +"implemented as a method on a config parser subclass. If the name of this " +"method starts with ``get``, it will be available on all section proxies, in " +"the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -msgid "More advanced customization may be achieved by overriding default values of these parser attributes. The defaults are defined on the classes, so they may be overridden by subclasses or by attribute assignment." +#: ../../library/configparser.rst:742 +msgid "" +"More advanced customization may be achieved by overriding default values of " +"these parser attributes. The defaults are defined on the classes, so they " +"may be overridden by subclasses or by attribute assignment." msgstr "" -msgid "By default when using :meth:`~ConfigParser.getboolean`, config parsers consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, ``'on'`` and the following values ``False``: ``'0'``, ``'no'``, ``'false'``, ``'off'``. You can override this by specifying a custom dictionary of strings and their Boolean outcomes. For example:" +#: ../../library/configparser.rst:748 +msgid "" +"By default when using :meth:`~ConfigParser.getboolean`, config parsers " +"consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " +"``'on'`` and the following values ``False``: ``'0'``, ``'no'``, ``'false'``, " +"``'off'``. You can override this by specifying a custom dictionary of " +"strings and their Boolean outcomes. For example:" msgstr "" +#: ../../library/configparser.rst:754 msgid "" ">>> custom = configparser.ConfigParser()\n" ">>> custom['section1'] = {'funky': 'nope'}\n" @@ -638,12 +998,21 @@ msgid "" "False" msgstr "" -msgid "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/``disabled``." +#: ../../library/configparser.rst:766 +msgid "" +"Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" +"``disabled``." msgstr "" -msgid "This method transforms option names on every read, get, or set operation. The default converts the name to lowercase. This also means that when a configuration file gets written, all keys will be lowercase. Override this method if that's unsuitable. For example:" +#: ../../library/configparser.rst:772 +msgid "" +"This method transforms option names on every read, get, or set operation. " +"The default converts the name to lowercase. This also means that when a " +"configuration file gets written, all keys will be lowercase. Override this " +"method if that's unsuitable. For example:" msgstr "" +#: ../../library/configparser.rst:778 msgid "" ">>> config = \"\"\"\n" "... [Section1]\n" @@ -667,12 +1036,23 @@ msgid "" "['AnotherKey']" msgstr "" -msgid "The optionxform function transforms option names to a canonical form. This should be an idempotent function: if the name is already in canonical form, it should be returned unchanged." +#: ../../library/configparser.rst:802 +msgid "" +"The optionxform function transforms option names to a canonical form. This " +"should be an idempotent function: if the name is already in canonical form, " +"it should be returned unchanged." msgstr "" -msgid "A compiled regular expression used to parse section headers. The default matches ``[section]`` to the name ``\"section\"``. Whitespace is considered part of the section name, thus ``[ larch ]`` will be read as a section of name ``\" larch \"``. Override this attribute if that's unsuitable. For example:" +#: ../../library/configparser.rst:809 +msgid "" +"A compiled regular expression used to parse section headers. The default " +"matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " +"part of the section name, thus ``[ larch ]`` will be read as a section of " +"name ``\" larch \"``. Override this attribute if that's unsuitable. For " +"example:" msgstr "" +#: ../../library/configparser.rst:815 msgid "" ">>> import re\n" ">>> config = \"\"\"\n" @@ -693,18 +1073,31 @@ msgid "" "['Section 1', 'Section 2']" msgstr "" -msgid "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing option lines, it's not recommended to override it because that would interfere with constructor options *allow_no_value* and *delimiters*." +#: ../../library/configparser.rst:837 +msgid "" +"While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " +"option lines, it's not recommended to override it because that would " +"interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" +#: ../../library/configparser.rst:843 msgid "Legacy API Examples" msgstr "" -msgid "Mainly because of backwards compatibility concerns, :mod:`!configparser` provides also a legacy API with explicit ``get``/``set`` methods. While there are valid use cases for the methods outlined below, mapping protocol access is preferred for new projects. The legacy API is at times more advanced, low-level and downright counterintuitive." +#: ../../library/configparser.rst:845 +msgid "" +"Mainly because of backwards compatibility concerns, :mod:`!configparser` " +"provides also a legacy API with explicit ``get``/``set`` methods. While " +"there are valid use cases for the methods outlined below, mapping protocol " +"access is preferred for new projects. The legacy API is at times more " +"advanced, low-level and downright counterintuitive." msgstr "" +#: ../../library/configparser.rst:851 msgid "An example of writing to a configuration file::" msgstr "" +#: ../../library/configparser.rst:853 msgid "" "import configparser\n" "\n" @@ -728,9 +1121,11 @@ msgid "" " config.write(configfile)" msgstr "" +#: ../../library/configparser.rst:874 msgid "An example of reading the configuration file again::" msgstr "" +#: ../../library/configparser.rst:876 msgid "" "import configparser\n" "\n" @@ -749,9 +1144,11 @@ msgid "" " print(config.get('Section1', 'foo'))" msgstr "" +#: ../../library/configparser.rst:892 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" +#: ../../library/configparser.rst:894 msgid "" "import configparser\n" "\n" @@ -775,7 +1172,8 @@ msgid "" "print(cfg.get('Section1', 'foo', fallback='Monty is not.'))\n" " # -> \"Python is fun!\"\n" "\n" -"print(cfg.get('Section1', 'monster', fallback='No such things as monsters.'))\n" +"print(cfg.get('Section1', 'monster', fallback='No such things as " +"monsters.'))\n" " # -> \"No such things as monsters.\"\n" "\n" "# A bare print(cfg.get('Section1', 'monster')) would raise NoOptionError\n" @@ -785,9 +1183,13 @@ msgid "" " # -> None" msgstr "" -msgid "Default values are available in both types of ConfigParsers. They are used in interpolation if an option used is not defined elsewhere. ::" +#: ../../library/configparser.rst:925 +msgid "" +"Default values are available in both types of ConfigParsers. They are used " +"in interpolation if an option used is not defined elsewhere. ::" msgstr "" +#: ../../library/configparser.rst:928 msgid "" "import configparser\n" "\n" @@ -801,84 +1203,186 @@ msgid "" "print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" msgstr "" +#: ../../library/configparser.rst:943 msgid "ConfigParser Objects" msgstr "" -msgid "The main configuration parser. When *defaults* is given, it is initialized into the dictionary of intrinsic defaults. When *dict_type* is given, it will be used to create the dictionary objects for the list of sections, for the options within a section, and for the default values." -msgstr "" - -msgid "When *delimiters* is given, it is used as the set of substrings that divide keys from values. When *comment_prefixes* is given, it will be used as the set of substrings that prefix comments in otherwise empty lines. Comments can be indented. When *inline_comment_prefixes* is given, it will be used as the set of substrings that prefix comments in non-empty lines." +#: ../../library/configparser.rst:953 +msgid "" +"The main configuration parser. When *defaults* is given, it is initialized " +"into the dictionary of intrinsic defaults. When *dict_type* is given, it " +"will be used to create the dictionary objects for the list of sections, for " +"the options within a section, and for the default values." msgstr "" -msgid "When *strict* is ``True`` (the default), the parser won't allow for any section or option duplicates while reading from a single source (file, string or dictionary), raising :exc:`DuplicateSectionError` or :exc:`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` (default: ``True``), each empty line marks the end of an option. Otherwise, internal empty lines of a multiline option are kept as part of the value. When *allow_no_value* is ``True`` (default: ``False``), options without values are accepted; the value held for these is ``None`` and they are serialized without the trailing delimiter." +#: ../../library/configparser.rst:958 +msgid "" +"When *delimiters* is given, it is used as the set of substrings that divide " +"keys from values. When *comment_prefixes* is given, it will be used as the " +"set of substrings that prefix comments in otherwise empty lines. Comments " +"can be indented. When *inline_comment_prefixes* is given, it will be used " +"as the set of substrings that prefix comments in non-empty lines." msgstr "" -msgid "When *default_section* is given, it specifies the name for the special section holding default values for other sections and interpolation purposes (normally named ``\"DEFAULT\"``). This value can be retrieved and changed at runtime using the ``default_section`` instance attribute. This won't re-evaluate an already parsed config file, but will be used when writing parsed settings to a new config file." +#: ../../library/configparser.rst:964 +msgid "" +"When *strict* is ``True`` (the default), the parser won't allow for any " +"section or option duplicates while reading from a single source (file, " +"string or dictionary), raising :exc:`DuplicateSectionError` " +"or :exc:`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` " +"(default: ``True``), each empty line marks the end of an option. Otherwise, " +"internal empty lines of a multiline option are kept as part of the value. " +"When *allow_no_value* is ``True`` (default: ``False``), options without " +"values are accepted; the value held for these is ``None`` and they are " +"serialized without the trailing delimiter." +msgstr "" + +#: ../../library/configparser.rst:974 +msgid "" +"When *default_section* is given, it specifies the name for the special " +"section holding default values for other sections and interpolation purposes " +"(normally named ``\"DEFAULT\"``). This value can be retrieved and changed " +"at runtime using the ``default_section`` instance attribute. This won't re-" +"evaluate an already parsed config file, but will be used when writing parsed " +"settings to a new config file." msgstr "" -msgid "Interpolation behaviour may be customized by providing a custom handler through the *interpolation* argument. ``None`` can be used to turn off interpolation completely, ``ExtendedInterpolation()`` provides a more advanced variant inspired by ``zc.buildout``. More on the subject in the `dedicated documentation section <#interpolation-of-values>`_." +#: ../../library/configparser.rst:981 +msgid "" +"Interpolation behaviour may be customized by providing a custom handler " +"through the *interpolation* argument. ``None`` can be used to turn off " +"interpolation completely, ``ExtendedInterpolation()`` provides a more " +"advanced variant inspired by ``zc.buildout``. More on the subject in the " +"`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -msgid "All option names used in interpolation will be passed through the :meth:`optionxform` method just like any other option name reference. For example, using the default implementation of :meth:`optionxform` (which converts option names to lower case), the values ``foo %(bar)s`` and ``foo %(BAR)s`` are equivalent." +#: ../../library/configparser.rst:987 +msgid "" +"All option names used in interpolation will be passed through " +"the :meth:`optionxform` method just like any other option name reference. " +"For example, using the default implementation of :meth:`optionxform` (which " +"converts option names to lower case), the values ``foo %(bar)s`` and ``foo %" +"(BAR)s`` are equivalent." msgstr "" -msgid "When *converters* is given, it should be a dictionary where each key represents the name of a type converter and each value is a callable implementing the conversion from string to the desired datatype. Every converter gets its own corresponding :meth:`!get*` method on the parser object and section proxies." +#: ../../library/configparser.rst:993 +msgid "" +"When *converters* is given, it should be a dictionary where each key " +"represents the name of a type converter and each value is a callable " +"implementing the conversion from string to the desired datatype. Every " +"converter gets its own corresponding :meth:`!get*` method on the parser " +"object and section proxies." msgstr "" -msgid "When *allow_unnamed_section* is ``True`` (default: ``False``), the first section name can be omitted. See the `\"Unnamed Sections\" section <#unnamed-sections>`_." +#: ../../library/configparser.rst:999 +msgid "" +"When *allow_unnamed_section* is ``True`` (default: ``False``), the first " +"section name can be omitted. See the `\"Unnamed Sections\" section <#unnamed-" +"sections>`_." msgstr "" +#: ../../library/configparser.rst:1028 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -msgid "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, *empty_lines_in_values*, *default_section* and *interpolation* were added." +#: ../../library/configparser.rst:1031 ../../library/configparser.rst:1324 +msgid "" +"*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " +"*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" +#: ../../library/configparser.rst:1036 ../../library/configparser.rst:1329 msgid "The *converters* argument was added." msgstr "" -msgid "The *defaults* argument is read with :meth:`read_dict`, providing consistent behavior across the parser: non-string keys and values are implicitly converted to strings." +#: ../../library/configparser.rst:1039 +msgid "" +"The *defaults* argument is read with :meth:`read_dict`, providing consistent " +"behavior across the parser: non-string keys and values are implicitly " +"converted to strings." msgstr "" -msgid "The default *dict_type* is :class:`dict`, since it now preserves insertion order." +#: ../../library/configparser.rst:1044 ../../library/configparser.rst:1332 +msgid "" +"The default *dict_type* is :class:`dict`, since it now preserves insertion " +"order." msgstr "" -msgid "Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, and a key without a value is continued with an indented line." +#: ../../library/configparser.rst:1048 +msgid "" +"Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " +"and a key without a value is continued with an indented line." msgstr "" +#: ../../library/configparser.rst:1052 ../../library/configparser.rst:1336 msgid "The *allow_unnamed_section* argument was added." msgstr "" +#: ../../library/configparser.rst:1057 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -msgid "Return a list of the sections available; the *default section* is not included in the list." +#: ../../library/configparser.rst:1062 +msgid "" +"Return a list of the sections available; the *default section* is not " +"included in the list." msgstr "" -msgid "Add a section named *section* to the instance. If a section by the given name already exists, :exc:`DuplicateSectionError` is raised. If the *default section* name is passed, :exc:`ValueError` is raised. The name of the section must be a string; if not, :exc:`TypeError` is raised." +#: ../../library/configparser.rst:1068 +msgid "" +"Add a section named *section* to the instance. If a section by the given " +"name already exists, :exc:`DuplicateSectionError` is raised. If the " +"*default section* name is passed, :exc:`ValueError` is raised. The name of " +"the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" +#: ../../library/configparser.rst:1073 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -msgid "Indicates whether the named *section* is present in the configuration. The *default section* is not acknowledged." +#: ../../library/configparser.rst:1079 +msgid "" +"Indicates whether the named *section* is present in the configuration. The " +"*default section* is not acknowledged." msgstr "" +#: ../../library/configparser.rst:1085 msgid "Return a list of options available in the specified *section*." msgstr "" -msgid "If the given *section* exists, and contains the given *option*, return :const:`True`; otherwise return :const:`False`. If the specified *section* is :const:`None` or an empty string, DEFAULT is assumed." +#: ../../library/configparser.rst:1090 +msgid "" +"If the given *section* exists, and contains the given *option*, " +"return :const:`True`; otherwise return :const:`False`. If the specified " +"*section* is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -msgid "Attempt to read and parse an iterable of filenames, returning a list of filenames which were successfully parsed." +#: ../../library/configparser.rst:1097 +msgid "" +"Attempt to read and parse an iterable of filenames, returning a list of " +"filenames which were successfully parsed." msgstr "" -msgid "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like object`, it is treated as a single filename. If a file named in *filenames* cannot be opened, that file will be ignored. This is designed so that you can specify an iterable of potential configuration file locations (for example, the current directory, the user's home directory, and some system-wide directory), and all existing configuration files in the iterable will be read." +#: ../../library/configparser.rst:1100 +msgid "" +"If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " +"object`, it is treated as a single filename. If a file named in *filenames* " +"cannot be opened, that file will be ignored. This is designed so that you " +"can specify an iterable of potential configuration file locations (for " +"example, the current directory, the user's home directory, and some system-" +"wide directory), and all existing configuration files in the iterable will " +"be read." msgstr "" -msgid "If none of the named files exist, the :class:`ConfigParser` instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using :meth:`read_file` before calling :meth:`read` for any optional files::" +#: ../../library/configparser.rst:1109 +msgid "" +"If none of the named files exist, the :class:`ConfigParser` instance will " +"contain an empty dataset. An application which requires initial values to " +"be loaded from a file should load the required file or files " +"using :meth:`read_file` before calling :meth:`read` for any optional files::" msgstr "" +#: ../../library/configparser.rst:1115 msgid "" "import configparser, os\n" "\n" @@ -888,211 +1392,424 @@ msgid "" " encoding='cp1250')" msgstr "" -msgid "Added the *encoding* parameter. Previously, all files were read using the default encoding for :func:`open`." +#: ../../library/configparser.rst:1122 +msgid "" +"Added the *encoding* parameter. Previously, all files were read using the " +"default encoding for :func:`open`." msgstr "" +#: ../../library/configparser.rst:1126 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" +#: ../../library/configparser.rst:1129 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -msgid "Read and parse configuration data from *f* which must be an iterable yielding Unicode strings (for example files opened in text mode)." +#: ../../library/configparser.rst:1135 +msgid "" +"Read and parse configuration data from *f* which must be an iterable " +"yielding Unicode strings (for example files opened in text mode)." msgstr "" -msgid "Optional argument *source* specifies the name of the file being read. If not given and *f* has a :attr:`!name` attribute, that is used for *source*; the default is ``''``." +#: ../../library/configparser.rst:1138 +msgid "" +"Optional argument *source* specifies the name of the file being read. If " +"not given and *f* has a :attr:`!name` attribute, that is used for *source*; " +"the default is ``''``." msgstr "" +#: ../../library/configparser.rst:1142 msgid "Replaces :meth:`!readfp`." msgstr "" +#: ../../library/configparser.rst:1147 msgid "Parse configuration data from a string." msgstr "" -msgid "Optional argument *source* specifies a context-specific name of the string passed. If not given, ``''`` is used. This should commonly be a filesystem path or a URL." +#: ../../library/configparser.rst:1149 +msgid "" +"Optional argument *source* specifies a context-specific name of the string " +"passed. If not given, ``''`` is used. This should commonly be a " +"filesystem path or a URL." msgstr "" -msgid "Load configuration from any object that provides a dict-like ``items()`` method. Keys are section names, values are dictionaries with keys and values that should be present in the section. If the used dictionary type preserves order, sections and their keys will be added in order. Values are automatically converted to strings." +#: ../../library/configparser.rst:1158 +msgid "" +"Load configuration from any object that provides a dict-like ``items()`` " +"method. Keys are section names, values are dictionaries with keys and " +"values that should be present in the section. If the used dictionary type " +"preserves order, sections and their keys will be added in order. Values are " +"automatically converted to strings." msgstr "" -msgid "Optional argument *source* specifies a context-specific name of the dictionary passed. If not given, ```` is used." +#: ../../library/configparser.rst:1164 +msgid "" +"Optional argument *source* specifies a context-specific name of the " +"dictionary passed. If not given, ```` is used." msgstr "" +#: ../../library/configparser.rst:1167 msgid "This method can be used to copy state between parsers." msgstr "" -msgid "Get an *option* value for the named *section*. If *vars* is provided, it must be a dictionary. The *option* is looked up in *vars* (if provided), *section*, and in *DEFAULTSECT* in that order. If the key is not found and *fallback* is provided, it is used as a fallback value. ``None`` can be provided as a *fallback* value." +#: ../../library/configparser.rst:1174 +msgid "" +"Get an *option* value for the named *section*. If *vars* is provided, it " +"must be a dictionary. The *option* is looked up in *vars* (if provided), " +"*section*, and in *DEFAULTSECT* in that order. If the key is not found and " +"*fallback* is provided, it is used as a fallback value. ``None`` can be " +"provided as a *fallback* value." msgstr "" -msgid "All the ``'%'`` interpolations are expanded in the return values, unless the *raw* argument is true. Values for interpolation keys are looked up in the same manner as the option." +#: ../../library/configparser.rst:1180 +msgid "" +"All the ``'%'`` interpolations are expanded in the return values, unless the " +"*raw* argument is true. Values for interpolation keys are looked up in the " +"same manner as the option." msgstr "" -msgid "Arguments *raw*, *vars* and *fallback* are keyword only to protect users from trying to use the third argument as the *fallback* fallback (especially when using the mapping protocol)." +#: ../../library/configparser.rst:1184 +msgid "" +"Arguments *raw*, *vars* and *fallback* are keyword only to protect users " +"from trying to use the third argument as the *fallback* fallback (especially " +"when using the mapping protocol)." msgstr "" -msgid "A convenience method which coerces the *option* in the specified *section* to an integer. See :meth:`get` for explanation of *raw*, *vars* and *fallback*." +#: ../../library/configparser.rst:1192 +msgid "" +"A convenience method which coerces the *option* in the specified *section* " +"to an integer. See :meth:`get` for explanation of *raw*, *vars* and " +"*fallback*." msgstr "" -msgid "A convenience method which coerces the *option* in the specified *section* to a floating-point number. See :meth:`get` for explanation of *raw*, *vars* and *fallback*." +#: ../../library/configparser.rst:1199 +msgid "" +"A convenience method which coerces the *option* in the specified *section* " +"to a floating-point number. See :meth:`get` for explanation of *raw*, " +"*vars* and *fallback*." msgstr "" -msgid "A convenience method which coerces the *option* in the specified *section* to a Boolean value. Note that the accepted values for the option are ``'1'``, ``'yes'``, ``'true'``, and ``'on'``, which cause this method to return ``True``, and ``'0'``, ``'no'``, ``'false'``, and ``'off'``, which cause it to return ``False``. These string values are checked in a case-insensitive manner. Any other value will cause it to raise :exc:`ValueError`. See :meth:`get` for explanation of *raw*, *vars* and *fallback*." +#: ../../library/configparser.rst:1206 +msgid "" +"A convenience method which coerces the *option* in the specified *section* " +"to a Boolean value. Note that the accepted values for the option are " +"``'1'``, ``'yes'``, ``'true'``, and ``'on'``, which cause this method to " +"return ``True``, and ``'0'``, ``'no'``, ``'false'``, and ``'off'``, which " +"cause it to return ``False``. These string values are checked in a case-" +"insensitive manner. Any other value will cause it to " +"raise :exc:`ValueError`. See :meth:`get` for explanation of *raw*, *vars* " +"and *fallback*." msgstr "" -msgid "When *section* is not given, return a list of *section_name*, *section_proxy* pairs, including DEFAULTSECT." +#: ../../library/configparser.rst:1219 +msgid "" +"When *section* is not given, return a list of *section_name*, " +"*section_proxy* pairs, including DEFAULTSECT." msgstr "" -msgid "Otherwise, return a list of *name*, *value* pairs for the options in the given *section*. Optional arguments have the same meaning as for the :meth:`get` method." +#: ../../library/configparser.rst:1222 +msgid "" +"Otherwise, return a list of *name*, *value* pairs for the options in the " +"given *section*. Optional arguments have the same meaning as for " +"the :meth:`get` method." msgstr "" -msgid "Items present in *vars* no longer appear in the result. The previous behaviour mixed actual parser options with variables provided for interpolation." +#: ../../library/configparser.rst:1226 +msgid "" +"Items present in *vars* no longer appear in the result. The previous " +"behaviour mixed actual parser options with variables provided for " +"interpolation." msgstr "" -msgid "If the given section exists, set the given option to the specified value; otherwise raise :exc:`NoSectionError`. *option* and *value* must be strings; if not, :exc:`TypeError` is raised." +#: ../../library/configparser.rst:1234 +msgid "" +"If the given section exists, set the given option to the specified value; " +"otherwise raise :exc:`NoSectionError`. *option* and *value* must be " +"strings; if not, :exc:`TypeError` is raised." msgstr "" -msgid "Write a representation of the configuration to the specified :term:`file object`, which must be opened in text mode (accepting strings). This representation can be parsed by a future :meth:`read` call. If *space_around_delimiters* is true, delimiters between keys and values are surrounded by spaces." +#: ../../library/configparser.rst:1241 +msgid "" +"Write a representation of the configuration to the specified :term:`file " +"object`, which must be opened in text mode (accepting strings). This " +"representation can be parsed by a future :meth:`read` call. If " +"*space_around_delimiters* is true, delimiters between keys and values are " +"surrounded by spaces." msgstr "" -msgid "Raises InvalidWriteError if this would write a representation which cannot be accurately parsed by a future :meth:`read` call from this parser." +#: ../../library/configparser.rst:1247 +msgid "" +"Raises InvalidWriteError if this would write a representation which cannot " +"be accurately parsed by a future :meth:`read` call from this parser." msgstr "" -msgid "Comments in the original configuration file are not preserved when writing the configuration back. What is considered a comment, depends on the given values for *comment_prefix* and *inline_comment_prefix*." +#: ../../library/configparser.rst:1253 +msgid "" +"Comments in the original configuration file are not preserved when writing " +"the configuration back. What is considered a comment, depends on the given " +"values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -msgid "Remove the specified *option* from the specified *section*. If the section does not exist, raise :exc:`NoSectionError`. If the option existed to be removed, return :const:`True`; otherwise return :const:`False`." +#: ../../library/configparser.rst:1261 +msgid "" +"Remove the specified *option* from the specified *section*. If the section " +"does not exist, raise :exc:`NoSectionError`. If the option existed to be " +"removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -msgid "Remove the specified *section* from the configuration. If the section in fact existed, return ``True``. Otherwise return ``False``." +#: ../../library/configparser.rst:1269 +msgid "" +"Remove the specified *section* from the configuration. If the section in " +"fact existed, return ``True``. Otherwise return ``False``." msgstr "" -msgid "Transforms the option name *option* as found in an input file or as passed in by client code to the form that should be used in the internal structures. The default implementation returns a lower-case version of *option*; subclasses may override this or client code can set an attribute of this name on instances to affect this behavior." +#: ../../library/configparser.rst:1275 +msgid "" +"Transforms the option name *option* as found in an input file or as passed " +"in by client code to the form that should be used in the internal " +"structures. The default implementation returns a lower-case version of " +"*option*; subclasses may override this or client code can set an attribute " +"of this name on instances to affect this behavior." msgstr "" -msgid "You don't need to subclass the parser to use this method, you can also set it on an instance, to a function that takes a string argument and returns a string. Setting it to ``str``, for example, would make option names case sensitive::" +#: ../../library/configparser.rst:1281 +msgid "" +"You don't need to subclass the parser to use this method, you can also set " +"it on an instance, to a function that takes a string argument and returns a " +"string. Setting it to ``str``, for example, would make option names case " +"sensitive::" msgstr "" +#: ../../library/configparser.rst:1286 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" msgstr "" -msgid "Note that when reading configuration files, whitespace around the option names is stripped before :meth:`optionxform` is called." +#: ../../library/configparser.rst:1289 +msgid "" +"Note that when reading configuration files, whitespace around the option " +"names is stripped before :meth:`optionxform` is called." msgstr "" -msgid "A special object representing a section name used to reference the unnamed section (see :ref:`unnamed-sections`)." +#: ../../library/configparser.rst:1295 +msgid "" +"A special object representing a section name used to reference the unnamed " +"section (see :ref:`unnamed-sections`)." msgstr "" -msgid "The maximum depth for recursive interpolation for :meth:`~configparser.ConfigParser.get` when the *raw* parameter is false. This is relevant only when the default *interpolation* is used." +#: ../../library/configparser.rst:1300 +msgid "" +"The maximum depth for recursive interpolation " +"for :meth:`~configparser.ConfigParser.get` when the *raw* parameter is " +"false. This is relevant only when the default *interpolation* is used." msgstr "" +#: ../../library/configparser.rst:1308 msgid "RawConfigParser Objects" msgstr "" -msgid "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled by default and allows for non-string section names, option names, and values via its unsafe ``add_section`` and ``set`` methods, as well as the legacy ``defaults=`` keyword argument handling." +#: ../../library/configparser.rst:1319 +msgid "" +"Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " +"by default and allows for non-string section names, option names, and values " +"via its unsafe ``add_section`` and ``set`` methods, as well as the legacy " +"``defaults=`` keyword argument handling." msgstr "" -msgid "Consider using :class:`ConfigParser` instead which checks types of the values to be stored internally. If you don't want interpolation, you can use ``ConfigParser(interpolation=None)``." +#: ../../library/configparser.rst:1340 +msgid "" +"Consider using :class:`ConfigParser` instead which checks types of the " +"values to be stored internally. If you don't want interpolation, you can " +"use ``ConfigParser(interpolation=None)``." msgstr "" -msgid "Add a section named *section* or :const:`UNNAMED_SECTION` to the instance." +#: ../../library/configparser.rst:1347 +msgid "" +"Add a section named *section* or :const:`UNNAMED_SECTION` to the instance." msgstr "" -msgid "If the given section already exists, :exc:`DuplicateSectionError` is raised. If the *default section* name is passed, :exc:`ValueError` is raised. If :const:`UNNAMED_SECTION` is passed and support is disabled, :exc:`UnnamedSectionDisabledError` is raised." +#: ../../library/configparser.rst:1349 +msgid "" +"If the given section already exists, :exc:`DuplicateSectionError` is raised. " +"If the *default section* name is passed, :exc:`ValueError` is raised. " +"If :const:`UNNAMED_SECTION` is passed and support is " +"disabled, :exc:`UnnamedSectionDisabledError` is raised." msgstr "" -msgid "Type of *section* is not checked which lets users create non-string named sections. This behaviour is unsupported and may cause internal errors." +#: ../../library/configparser.rst:1354 +msgid "" +"Type of *section* is not checked which lets users create non-string named " +"sections. This behaviour is unsupported and may cause internal errors." msgstr "" +#: ../../library/configparser.rst:1357 msgid "Added support for :const:`UNNAMED_SECTION`." msgstr "" -msgid "If the given section exists, set the given option to the specified value; otherwise raise :exc:`NoSectionError`. While it is possible to use :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters set to true) for *internal* storage of non-string values, full functionality (including interpolation and output to files) can only be achieved using string values." +#: ../../library/configparser.rst:1363 +msgid "" +"If the given section exists, set the given option to the specified value; " +"otherwise raise :exc:`NoSectionError`. While it is possible to " +"use :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters " +"set to true) for *internal* storage of non-string values, full functionality " +"(including interpolation and output to files) can only be achieved using " +"string values." msgstr "" -msgid "This method lets users assign non-string values to keys internally. This behaviour is unsupported and will cause errors when attempting to write to a file or get it in non-raw mode. **Use the mapping protocol API** which does not allow such assignments to take place." +#: ../../library/configparser.rst:1370 +msgid "" +"This method lets users assign non-string values to keys internally. This " +"behaviour is unsupported and will cause errors when attempting to write to a " +"file or get it in non-raw mode. **Use the mapping protocol API** which does " +"not allow such assignments to take place." msgstr "" +#: ../../library/configparser.rst:1377 msgid "Exceptions" msgstr "" +#: ../../library/configparser.rst:1381 msgid "Base class for all other :mod:`!configparser` exceptions." msgstr "" +#: ../../library/configparser.rst:1386 msgid "Exception raised when a specified section is not found." msgstr "" -msgid "Exception raised if :meth:`~ConfigParser.add_section` is called with the name of a section that is already present or in strict parsers when a section if found more than once in a single input file, string or dictionary." +#: ../../library/configparser.rst:1391 +msgid "" +"Exception raised if :meth:`~ConfigParser.add_section` is called with the " +"name of a section that is already present or in strict parsers when a " +"section if found more than once in a single input file, string or dictionary." msgstr "" -msgid "Added the optional *source* and *lineno* attributes and parameters to :meth:`!__init__`." +#: ../../library/configparser.rst:1395 +msgid "" +"Added the optional *source* and *lineno* attributes and parameters " +"to :meth:`!__init__`." msgstr "" -msgid "Exception raised by strict parsers if a single option appears twice during reading from a single file, string or dictionary. This catches misspellings and case sensitivity-related errors, e.g. a dictionary may have two keys representing the same case-insensitive configuration key." +#: ../../library/configparser.rst:1402 +msgid "" +"Exception raised by strict parsers if a single option appears twice during " +"reading from a single file, string or dictionary. This catches misspellings " +"and case sensitivity-related errors, e.g. a dictionary may have two keys " +"representing the same case-insensitive configuration key." msgstr "" -msgid "Exception raised when a specified option is not found in the specified section." +#: ../../library/configparser.rst:1410 +msgid "" +"Exception raised when a specified option is not found in the specified " +"section." msgstr "" -msgid "Base class for exceptions raised when problems occur performing string interpolation." +#: ../../library/configparser.rst:1416 +msgid "" +"Base class for exceptions raised when problems occur performing string " +"interpolation." msgstr "" -msgid "Exception raised when string interpolation cannot be completed because the number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :exc:`InterpolationError`." +#: ../../library/configparser.rst:1422 +msgid "" +"Exception raised when string interpolation cannot be completed because the " +"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass " +"of :exc:`InterpolationError`." msgstr "" -msgid "Exception raised when an option referenced from a value does not exist. Subclass of :exc:`InterpolationError`." +#: ../../library/configparser.rst:1429 +msgid "" +"Exception raised when an option referenced from a value does not exist. " +"Subclass of :exc:`InterpolationError`." msgstr "" -msgid "Exception raised when the source text into which substitutions are made does not conform to the required syntax. Subclass of :exc:`InterpolationError`." +#: ../../library/configparser.rst:1435 +msgid "" +"Exception raised when the source text into which substitutions are made does " +"not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -msgid "Exception raised when attempting to parse a file which has no section headers." +#: ../../library/configparser.rst:1441 +msgid "" +"Exception raised when attempting to parse a file which has no section " +"headers." msgstr "" +#: ../../library/configparser.rst:1446 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -msgid "The ``filename`` attribute and :meth:`!__init__` constructor argument were removed. They have been available using the name ``source`` since 3.2." +#: ../../library/configparser.rst:1448 +msgid "" +"The ``filename`` attribute and :meth:`!__init__` constructor argument were " +"removed. They have been available using the name ``source`` since 3.2." msgstr "" -msgid "Exception raised when a key without a corresponding value is continued with an indented line." +#: ../../library/configparser.rst:1454 +msgid "" +"Exception raised when a key without a corresponding value is continued with " +"an indented line." msgstr "" -msgid "Exception raised when attempting to use the :const:`UNNAMED_SECTION` without enabling it." +#: ../../library/configparser.rst:1461 +msgid "" +"Exception raised when attempting to use the :const:`UNNAMED_SECTION` without " +"enabling it." msgstr "" -msgid "Exception raised when an attempted :meth:`ConfigParser.write` would not be parsed accurately with a future :meth:`ConfigParser.read` call." +#: ../../library/configparser.rst:1468 +msgid "" +"Exception raised when an attempted :meth:`ConfigParser.write` would not be " +"parsed accurately with a future :meth:`ConfigParser.read` call." msgstr "" -msgid "Ex: Writing a key beginning with the :attr:`ConfigParser.SECTCRE` pattern would parse as a section header when read. Attempting to write this will raise this exception." +#: ../../library/configparser.rst:1471 +msgid "" +"Ex: Writing a key beginning with the :attr:`ConfigParser.SECTCRE` pattern " +"would parse as a section header when read. Attempting to write this will " +"raise this exception." msgstr "" +#: ../../library/configparser.rst:1478 msgid "Footnotes" msgstr "" -msgid "Config parsers allow for heavy customization. If you are interested in changing the behaviour outlined by the footnote reference, consult the `Customizing Parser Behaviour`_ section." +#: ../../library/configparser.rst:1479 +msgid "" +"Config parsers allow for heavy customization. If you are interested in " +"changing the behaviour outlined by the footnote reference, consult the " +"`Customizing Parser Behaviour`_ section." msgstr "" +#: ../../library/configparser.rst:16 msgid ".ini" msgstr "" +#: ../../library/configparser.rst:16 msgid "file" msgstr "" +#: ../../library/configparser.rst:16 msgid "configuration" msgstr "" +#: ../../library/configparser.rst:16 msgid "ini file" msgstr "" +#: ../../library/configparser.rst:16 msgid "Windows ini file" msgstr "" +#: ../../library/configparser.rst:367 msgid "% (percent)" msgstr "" +#: ../../library/configparser.rst:367 ../../library/configparser.rst:400 msgid "interpolation in configuration files" msgstr "" +#: ../../library/configparser.rst:400 msgid "$ (dollar)" msgstr "" diff --git a/library/constants.po b/library/constants.po index 56e064b92..54acf88f7 100644 --- a/library/constants.po +++ b/library/constants.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,68 +22,144 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/constants.rst:4 msgid "Built-in Constants" msgstr "" +#: ../../library/constants.rst:6 msgid "A small number of constants live in the built-in namespace. They are:" msgstr "" -msgid "The false value of the :class:`bool` type. Assignments to ``False`` are illegal and raise a :exc:`SyntaxError`." +#: ../../library/constants.rst:10 +msgid "" +"The false value of the :class:`bool` type. Assignments to ``False`` are " +"illegal and raise a :exc:`SyntaxError`." msgstr "" -msgid "The true value of the :class:`bool` type. Assignments to ``True`` are illegal and raise a :exc:`SyntaxError`." +#: ../../library/constants.rst:16 +msgid "" +"The true value of the :class:`bool` type. Assignments to ``True`` are " +"illegal and raise a :exc:`SyntaxError`." msgstr "" -msgid "An object frequently used to represent the absence of a value, as when default arguments are not passed to a function. Assignments to ``None`` are illegal and raise a :exc:`SyntaxError`. ``None`` is the sole instance of the :class:`~types.NoneType` type." +#: ../../library/constants.rst:22 +msgid "" +"An object frequently used to represent the absence of a value, as when " +"default arguments are not passed to a function. Assignments to ``None`` are " +"illegal and raise a :exc:`SyntaxError`. ``None`` is the sole instance of " +"the :class:`~types.NoneType` type." msgstr "" -msgid "A special value which should be returned by the binary special methods (e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, etc.) to indicate that the operation is not implemented with respect to the other type; may be returned by the in-place binary special methods (e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same purpose. It should not be evaluated in a boolean context. :data:`!NotImplemented` is the sole instance of the :class:`types.NotImplementedType` type." +#: ../../library/constants.rst:30 +msgid "" +"A special value which should be returned by the binary special methods " +"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " +"etc.) to indicate that the operation is not implemented with respect to the " +"other type; may be returned by the in-place binary special methods " +"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same " +"purpose. It should not be evaluated in a boolean context. :data:`!" +"NotImplemented` is the sole instance of " +"the :class:`types.NotImplementedType` type." msgstr "" -msgid "When a binary (or in-place) method returns :data:`!NotImplemented` the interpreter will try the reflected operation on the other type (or some other fallback, depending on the operator). If all attempts return :data:`!NotImplemented`, the interpreter will raise an appropriate exception. Incorrectly returning :data:`!NotImplemented` will result in a misleading error message or the :data:`!NotImplemented` value being returned to Python code." +#: ../../library/constants.rst:40 +msgid "" +"When a binary (or in-place) method returns :data:`!NotImplemented` the " +"interpreter will try the reflected operation on the other type (or some " +"other fallback, depending on the operator). If all attempts return :data:`!" +"NotImplemented`, the interpreter will raise an appropriate exception. " +"Incorrectly returning :data:`!NotImplemented` will result in a misleading " +"error message or the :data:`!NotImplemented` value being returned to Python " +"code." msgstr "" +#: ../../library/constants.rst:47 msgid "See :ref:`implementing-the-arithmetic-operations` for examples." msgstr "" -msgid ":data:`!NotImplemented` and :exc:`!NotImplementedError` are not interchangeable. This constant should only be used as described above; see :exc:`NotImplementedError` for details on correct usage of the exception." +#: ../../library/constants.rst:51 +msgid "" +":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " +"interchangeable. This constant should only be used as described above; " +"see :exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" +#: ../../library/constants.rst:56 msgid "Evaluating :data:`!NotImplemented` in a boolean context was deprecated." msgstr "" -msgid "Evaluating :data:`!NotImplemented` in a boolean context now raises a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:`DeprecationWarning` since Python 3.9." +#: ../../library/constants.rst:59 +msgid "" +"Evaluating :data:`!NotImplemented` in a boolean context now raises " +"a :exc:`TypeError`. It previously evaluated to :const:`True` and emitted " +"a :exc:`DeprecationWarning` since Python 3.9." msgstr "" -msgid "The same as the ellipsis literal \"``...``\", an object frequently used to indicate that something is omitted. Assignment to ``Ellipsis`` is possible, but assignment to ``...`` raises a :exc:`SyntaxError`. ``Ellipsis`` is the sole instance of the :class:`types.EllipsisType` type." +#: ../../library/constants.rst:68 +msgid "" +"The same as the ellipsis literal \"``...``\", an object frequently used to " +"indicate that something is omitted. Assignment to ``Ellipsis`` is possible, " +"but assignment to ``...`` raises a :exc:`SyntaxError`. ``Ellipsis`` is the " +"sole instance of the :class:`types.EllipsisType` type." msgstr "" -msgid "This constant is true if Python was not started with an :option:`-O` option. See also the :keyword:`assert` statement." +#: ../../library/constants.rst:76 +msgid "" +"This constant is true if Python was not started with an :option:`-O` option. " +"See also the :keyword:`assert` statement." msgstr "" -msgid "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` cannot be reassigned (assignments to them, even as an attribute name, raise :exc:`SyntaxError`), so they can be considered \"true\" constants." +#: ../../library/constants.rst:82 +msgid "" +"The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " +"cannot be reassigned (assignments to them, even as an attribute name, " +"raise :exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" +#: ../../library/constants.rst:90 msgid "Constants added by the :mod:`site` module" msgstr "" -msgid "The :mod:`site` module (which is imported automatically during startup, except if the :option:`-S` command-line option is given) adds several constants to the built-in namespace. They are useful for the interactive interpreter shell and should not be used in programs." +#: ../../library/constants.rst:92 +msgid "" +"The :mod:`site` module (which is imported automatically during startup, " +"except if the :option:`-S` command-line option is given) adds several " +"constants to the built-in namespace. They are useful for the interactive " +"interpreter shell and should not be used in programs." msgstr "" -msgid "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. EOF) to exit\", and when accessed directly in the interactive interpreter or called as functions, raise :exc:`SystemExit` with the specified exit code." +#: ../../library/constants.rst:100 +msgid "" +"Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " +"EOF) to exit\", and when accessed directly in the interactive interpreter or " +"called as functions, raise :exc:`SystemExit` with the specified exit code." msgstr "" -msgid "Object that when printed, prints the message \"Type help() for interactive help, or help(object) for help about object.\", and when accessed directly in the interactive interpreter, invokes the built-in help system (see :func:`help`)." +#: ../../library/constants.rst:108 +msgid "" +"Object that when printed, prints the message \"Type help() for interactive " +"help, or help(object) for help about object.\", and when accessed directly " +"in the interactive interpreter, invokes the built-in help system " +"(see :func:`help`)." msgstr "" -msgid "Objects that when printed or called, print the text of copyright or credits, respectively." +#: ../../library/constants.rst:116 +msgid "" +"Objects that when printed or called, print the text of copyright or credits, " +"respectively." msgstr "" -msgid "Object that when printed, prints the message \"Type license() to see the full license text\", and when called, displays the full license text in a pager-like fashion (one screen at a time)." +#: ../../library/constants.rst:121 +msgid "" +"Object that when printed, prints the message \"Type license() to see the " +"full license text\", and when called, displays the full license text in a " +"pager-like fashion (one screen at a time)." msgstr "" +#: ../../library/constants.rst:65 msgid "..." msgstr "" +#: ../../library/constants.rst:65 msgid "ellipsis literal" msgstr "" diff --git a/library/contextlib.po b/library/contextlib.po index b4ad7685c..3fb9b4646 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,36 +24,73 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid ":mod:`!contextlib` --- Utilities for :keyword:`!with`\\ -statement contexts" +#: ../../library/contextlib.rst:2 +msgid "" +":mod:`!contextlib` --- Utilities for :keyword:`!with`\\ -statement contexts" msgstr "" +#: ../../library/contextlib.rst:7 msgid "**Source code:** :source:`Lib/contextlib.py`" msgstr "" -msgid "This module provides utilities for common tasks involving the :keyword:`with` statement. For more information see also :ref:`typecontextmanager` and :ref:`context-managers`." +#: ../../library/contextlib.rst:11 +msgid "" +"This module provides utilities for common tasks involving " +"the :keyword:`with` statement. For more information see " +"also :ref:`typecontextmanager` and :ref:`context-managers`." msgstr "" +#: ../../library/contextlib.rst:17 msgid "Utilities" msgstr "" +#: ../../library/contextlib.rst:19 msgid "Functions and classes provided:" msgstr "" -msgid "An :term:`abstract base class` for classes that implement :meth:`~object.__enter__` and :meth:`~object.__exit__`. A default implementation for :meth:`~object.__enter__` is provided which returns ``self`` while :meth:`~object.__exit__` is an abstract method which by default returns ``None``. See also the definition of :ref:`typecontextmanager`." +#: ../../library/contextlib.rst:23 +msgid "" +"An :term:`abstract base class` for classes that " +"implement :meth:`~object.__enter__` and :meth:`~object.__exit__`. A default " +"implementation for :meth:`~object.__enter__` is provided which returns " +"``self`` while :meth:`~object.__exit__` is an abstract method which by " +"default returns ``None``. See also the definition " +"of :ref:`typecontextmanager`." msgstr "" -msgid "An :term:`abstract base class` for classes that implement :meth:`~object.__aenter__` and :meth:`~object.__aexit__`. A default implementation for :meth:`~object.__aenter__` is provided which returns ``self`` while :meth:`~object.__aexit__` is an abstract method which by default returns ``None``. See also the definition of :ref:`async-context-managers`." +#: ../../library/contextlib.rst:34 +msgid "" +"An :term:`abstract base class` for classes that " +"implement :meth:`~object.__aenter__` and :meth:`~object.__aexit__`. A " +"default implementation for :meth:`~object.__aenter__` is provided which " +"returns ``self`` while :meth:`~object.__aexit__` is an abstract method which " +"by default returns ``None``. See also the definition of :ref:`async-context-" +"managers`." msgstr "" -msgid "This function is a :term:`decorator` that can be used to define a factory function for :keyword:`with` statement context managers, without needing to create a class or separate :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." +#: ../../library/contextlib.rst:46 +msgid "" +"This function is a :term:`decorator` that can be used to define a factory " +"function for :keyword:`with` statement context managers, without needing to " +"create a class or separate :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" -msgid "While many objects natively support use in with statements, sometimes a resource needs to be managed that isn't a context manager in its own right, and doesn't implement a ``close()`` method for use with ``contextlib.closing``." +#: ../../library/contextlib.rst:50 +msgid "" +"While many objects natively support use in with statements, sometimes a " +"resource needs to be managed that isn't a context manager in its own right, " +"and doesn't implement a ``close()`` method for use with " +"``contextlib.closing``." msgstr "" -msgid "An abstract example would be the following to ensure correct resource management::" +#: ../../library/contextlib.rst:54 +msgid "" +"An abstract example would be the following to ensure correct resource " +"management::" msgstr "" +#: ../../library/contextlib.rst:57 msgid "" "from contextlib import contextmanager\n" "\n" @@ -68,36 +105,75 @@ msgid "" " release_resource(resource)" msgstr "" +#: ../../library/contextlib.rst:69 msgid "The function can then be used like this::" msgstr "" +#: ../../library/contextlib.rst:71 msgid "" ">>> with managed_resource(timeout=3600) as resource:\n" "... # Resource is released at the end of this block,\n" "... # even if code in the block raises an exception" msgstr "" -msgid "The function being decorated must return a :term:`generator`-iterator when called. This iterator must yield exactly one value, which will be bound to the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any." -msgstr "" - -msgid "At the point where the generator yields, the block nested in the :keyword:`with` statement is executed. The generator is then resumed after the block is exited. If an unhandled exception occurs in the block, it is reraised inside the generator at the point where the yield occurred. Thus, you can use a :keyword:`try`...\\ :keyword:`except`...\\ :keyword:`finally` statement to trap the error (if any), or ensure that some cleanup takes place. If an exception is trapped merely in order to log it or to perform some action (rather than to suppress it entirely), the generator must reraise that exception. Otherwise the generator context manager will indicate to the :keyword:`!with` statement that the exception has been handled, and execution will resume with the statement immediately following the :keyword:`!with` statement." +#: ../../library/contextlib.rst:75 +msgid "" +"The function being decorated must return a :term:`generator`-iterator when " +"called. This iterator must yield exactly one value, which will be bound to " +"the targets in the :keyword:`with` statement's :keyword:`!as` clause, if any." msgstr "" -msgid ":func:`contextmanager` uses :class:`ContextDecorator` so the context managers it creates can be used as decorators as well as in :keyword:`with` statements. When used as a decorator, a new generator instance is implicitly created on each function call (this allows the otherwise \"one-shot\" context managers created by :func:`contextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators)." +#: ../../library/contextlib.rst:79 +msgid "" +"At the point where the generator yields, the block nested in " +"the :keyword:`with` statement is executed. The generator is then resumed " +"after the block is exited. If an unhandled exception occurs in the block, it " +"is reraised inside the generator at the point where the yield occurred. " +"Thus, you can use a :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` statement to trap the error (if any), or ensure that " +"some cleanup takes place. If an exception is trapped merely in order to log " +"it or to perform some action (rather than to suppress it entirely), the " +"generator must reraise that exception. Otherwise the generator context " +"manager will indicate to the :keyword:`!with` statement that the exception " +"has been handled, and execution will resume with the statement immediately " +"following the :keyword:`!with` statement." +msgstr "" + +#: ../../library/contextlib.rst:91 +msgid "" +":deco:`contextmanager` uses :class:`ContextDecorator` so the context " +"managers it creates can be used as decorators as well as in :keyword:`with` " +"statements. When used as a decorator, a new generator instance is implicitly " +"created on each function call (this allows the otherwise \"one-shot\" " +"context managers created by :deco:`contextmanager` to meet the requirement " +"that context managers support multiple invocations in order to be used as " +"decorators)." msgstr "" +#: ../../library/contextlib.rst:98 msgid "Use of :class:`ContextDecorator`." msgstr "" -msgid "Similar to :func:`~contextlib.contextmanager`, but creates an :ref:`asynchronous context manager `." +#: ../../library/contextlib.rst:104 +msgid "" +"Similar to :deco:`~contextlib.contextmanager`, but creates " +"an :ref:`asynchronous context manager `." msgstr "" -msgid "This function is a :term:`decorator` that can be used to define a factory function for :keyword:`async with` statement asynchronous context managers, without needing to create a class or separate :meth:`~object.__aenter__` and :meth:`~object.__aexit__` methods. It must be applied to an :term:`asynchronous generator` function." +#: ../../library/contextlib.rst:107 +msgid "" +"This function is a :term:`decorator` that can be used to define a factory " +"function for :keyword:`async with` statement asynchronous context managers, " +"without needing to create a class or separate :meth:`~object.__aenter__` " +"and :meth:`~object.__aexit__` methods. It must be applied to " +"an :term:`asynchronous generator` function." msgstr "" +#: ../../library/contextlib.rst:113 msgid "A simple example::" msgstr "" +#: ../../library/contextlib.rst:115 msgid "" "from contextlib import asynccontextmanager\n" "\n" @@ -114,9 +190,13 @@ msgid "" " return conn.query('SELECT ...')" msgstr "" -msgid "Context managers defined with :func:`asynccontextmanager` can be used either as decorators or with :keyword:`async with` statements::" +#: ../../library/contextlib.rst:131 +msgid "" +"Context managers defined with :deco:`asynccontextmanager` can be used either " +"as decorators or with :keyword:`async with` statements::" msgstr "" +#: ../../library/contextlib.rst:134 msgid "" "import time\n" "from contextlib import asynccontextmanager\n" @@ -134,15 +214,27 @@ msgid "" " # ... async code ..." msgstr "" -msgid "When used as a decorator, a new generator instance is implicitly created on each function call. This allows the otherwise \"one-shot\" context managers created by :func:`asynccontextmanager` to meet the requirement that context managers support multiple invocations in order to be used as decorators." +#: ../../library/contextlib.rst:149 +msgid "" +"When used as a decorator, a new generator instance is implicitly created on " +"each function call. This allows the otherwise \"one-shot\" context managers " +"created by :deco:`asynccontextmanager` to meet the requirement that context " +"managers support multiple invocations in order to be used as decorators." msgstr "" -msgid "Async context managers created with :func:`asynccontextmanager` can be used as decorators." +#: ../../library/contextlib.rst:154 +msgid "" +"Async context managers created with :deco:`asynccontextmanager` can be used " +"as decorators." msgstr "" -msgid "Return a context manager that closes *thing* upon completion of the block. This is basically equivalent to::" +#: ../../library/contextlib.rst:161 +msgid "" +"Return a context manager that closes *thing* upon completion of the block. " +"This is basically equivalent to::" msgstr "" +#: ../../library/contextlib.rst:164 msgid "" "from contextlib import contextmanager\n" "\n" @@ -154,9 +246,11 @@ msgid "" " thing.close()" msgstr "" +#: ../../library/contextlib.rst:173 msgid "And lets you write code like this::" msgstr "" +#: ../../library/contextlib.rst:175 msgid "" "from contextlib import closing\n" "from urllib.request import urlopen\n" @@ -166,15 +260,29 @@ msgid "" " print(line)" msgstr "" -msgid "without needing to explicitly close ``page``. Even if an error occurs, ``page.close()`` will be called when the :keyword:`with` block is exited." +#: ../../library/contextlib.rst:182 +msgid "" +"without needing to explicitly close ``page``. Even if an error occurs, " +"``page.close()`` will be called when the :keyword:`with` block is exited." msgstr "" -msgid "Most types managing resources support the :term:`context manager` protocol, which closes *thing* on leaving the :keyword:`with` statement. As such, :func:`!closing` is most useful for third party types that don't support context managers. This example is purely for illustration purposes, as :func:`~urllib.request.urlopen` would normally be used in a context manager." +#: ../../library/contextlib.rst:187 +msgid "" +"Most types managing resources support the :term:`context manager` protocol, " +"which closes *thing* on leaving the :keyword:`with` statement. As " +"such, :func:`!closing` is most useful for third party types that don't " +"support context managers. This example is purely for illustration purposes, " +"as :func:`~urllib.request.urlopen` would normally be used in a context " +"manager." msgstr "" -msgid "Return an async context manager that calls the ``aclose()`` method of *thing* upon completion of the block. This is basically equivalent to::" +#: ../../library/contextlib.rst:196 +msgid "" +"Return an async context manager that calls the ``aclose()`` method of " +"*thing* upon completion of the block. This is basically equivalent to::" msgstr "" +#: ../../library/contextlib.rst:199 msgid "" "from contextlib import asynccontextmanager\n" "\n" @@ -186,9 +294,14 @@ msgid "" " await thing.aclose()" msgstr "" -msgid "Significantly, ``aclosing()`` supports deterministic cleanup of async generators when they happen to exit early by :keyword:`break` or an exception. For example::" +#: ../../library/contextlib.rst:208 +msgid "" +"Significantly, ``aclosing()`` supports deterministic cleanup of async " +"generators when they happen to exit early by :keyword:`break` or an " +"exception. For example::" msgstr "" +#: ../../library/contextlib.rst:212 msgid "" "from contextlib import aclosing\n" "\n" @@ -198,12 +311,22 @@ msgid "" " break" msgstr "" -msgid "This pattern ensures that the generator's async exit code is executed in the same context as its iterations (so that exceptions and context variables work as expected, and the exit code isn't run after the lifetime of some task it depends on)." +#: ../../library/contextlib.rst:219 +msgid "" +"This pattern ensures that the generator's async exit code is executed in the " +"same context as its iterations (so that exceptions and context variables " +"work as expected, and the exit code isn't run after the lifetime of some " +"task it depends on)." msgstr "" -msgid "Return a context manager that returns *enter_result* from :meth:`~object.__enter__`, but otherwise does nothing. It is intended to be used as a stand-in for an optional context manager, for example::" +#: ../../library/contextlib.rst:231 +msgid "" +"Return a context manager that returns *enter_result* " +"from :meth:`~object.__enter__`, but otherwise does nothing. It is intended " +"to be used as a stand-in for an optional context manager, for example::" msgstr "" +#: ../../library/contextlib.rst:235 msgid "" "def myfunction(arg, ignore_exceptions=False):\n" " if ignore_exceptions:\n" @@ -216,9 +339,11 @@ msgid "" " # Do something" msgstr "" +#: ../../library/contextlib.rst:245 msgid "An example using *enter_result*::" msgstr "" +#: ../../library/contextlib.rst:247 msgid "" "def process_file(file_or_path):\n" " if isinstance(file_or_path, str):\n" @@ -232,9 +357,13 @@ msgid "" " # Perform processing on the file" msgstr "" -msgid "It can also be used as a stand-in for :ref:`asynchronous context managers `::" +#: ../../library/contextlib.rst:258 +msgid "" +"It can also be used as a stand-in for :ref:`asynchronous context managers " +"`::" msgstr "" +#: ../../library/contextlib.rst:261 msgid "" "async def send_http(session=None):\n" " if not session:\n" @@ -248,18 +377,31 @@ msgid "" " # Send http requests with session" msgstr "" +#: ../../library/contextlib.rst:274 msgid ":term:`asynchronous context manager` support was added." msgstr "" -msgid "Return a context manager that suppresses any of the specified exceptions if they occur in the body of a :keyword:`!with` statement and then resumes execution with the first statement following the end of the :keyword:`!with` statement." +#: ../../library/contextlib.rst:281 +msgid "" +"Return a context manager that suppresses any of the specified exceptions if " +"they occur in the body of a :keyword:`!with` statement and then resumes " +"execution with the first statement following the end of the :keyword:`!with` " +"statement." msgstr "" -msgid "As with any other mechanism that completely suppresses exceptions, this context manager should be used only to cover very specific errors where silently continuing with program execution is known to be the right thing to do." +#: ../../library/contextlib.rst:286 +msgid "" +"As with any other mechanism that completely suppresses exceptions, this " +"context manager should be used only to cover very specific errors where " +"silently continuing with program execution is known to be the right thing to " +"do." msgstr "" +#: ../../library/contextlib.rst:291 msgid "For example::" msgstr "" +#: ../../library/contextlib.rst:293 msgid "" "from contextlib import suppress\n" "\n" @@ -270,9 +412,11 @@ msgid "" " os.remove('someotherfile.tmp')" msgstr "" +#: ../../library/contextlib.rst:301 msgid "This code is equivalent to::" msgstr "" +#: ../../library/contextlib.rst:303 msgid "" "try:\n" " os.remove('somefile.tmp')\n" @@ -285,71 +429,131 @@ msgid "" " pass" msgstr "" +#: ../../library/contextlib.rst:313 ../../library/contextlib.rst:362 +#: ../../library/contextlib.rst:372 ../../library/contextlib.rst:389 msgid "This context manager is :ref:`reentrant `." msgstr "" -msgid "If the code within the :keyword:`!with` block raises a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any exceptions of the group which are not suppressed are re-raised in a new group which is created using the original group's :meth:`~BaseExceptionGroup.derive` method." +#: ../../library/contextlib.rst:315 +msgid "" +"If the code within the :keyword:`!with` block raises " +"a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the " +"group. Any exceptions of the group which are not suppressed are re-raised " +"in a new group which is created using the original " +"group's :meth:`~BaseExceptionGroup.derive` method." msgstr "" -msgid "``suppress`` now supports suppressing exceptions raised as part of a :exc:`BaseExceptionGroup`." +#: ../../library/contextlib.rst:323 +msgid "" +"``suppress`` now supports suppressing exceptions raised as part of " +"a :exc:`BaseExceptionGroup`." msgstr "" -msgid "Context manager for temporarily redirecting :data:`sys.stdout` to another file or file-like object." +#: ../../library/contextlib.rst:329 +msgid "" +"Context manager for temporarily redirecting :data:`sys.stdout` to another " +"file or file-like object." msgstr "" -msgid "This tool adds flexibility to existing functions or classes whose output is hardwired to stdout." +#: ../../library/contextlib.rst:332 +msgid "" +"This tool adds flexibility to existing functions or classes whose output is " +"hardwired to stdout." msgstr "" -msgid "For example, the output of :func:`help` normally is sent to *sys.stdout*. You can capture that output in a string by redirecting the output to an :class:`io.StringIO` object. The replacement stream is returned from the :meth:`~object.__enter__` method and so is available as the target of the :keyword:`with` statement::" +#: ../../library/contextlib.rst:335 +msgid "" +"For example, the output of :func:`help` normally is sent to *sys.stdout*. " +"You can capture that output in a string by redirecting the output to " +"an :class:`io.StringIO` object. The replacement stream is returned from " +"the :meth:`~object.__enter__` method and so is available as the target of " +"the :keyword:`with` statement::" msgstr "" +#: ../../library/contextlib.rst:341 msgid "" "with redirect_stdout(io.StringIO()) as f:\n" " help(pow)\n" "s = f.getvalue()" msgstr "" -msgid "To send the output of :func:`help` to a file on disk, redirect the output to a regular file::" +#: ../../library/contextlib.rst:345 +msgid "" +"To send the output of :func:`help` to a file on disk, redirect the output to " +"a regular file::" msgstr "" +#: ../../library/contextlib.rst:348 msgid "" "with open('help.txt', 'w') as f:\n" " with redirect_stdout(f):\n" " help(pow)" msgstr "" +#: ../../library/contextlib.rst:352 msgid "To send the output of :func:`help` to *sys.stderr*::" msgstr "" +#: ../../library/contextlib.rst:354 msgid "" "with redirect_stdout(sys.stderr):\n" " help(pow)" msgstr "" -msgid "Note that the global side effect on :data:`sys.stdout` means that this context manager is not suitable for use in library code and most threaded applications. It also has no effect on the output of subprocesses. However, it is still a useful approach for many utility scripts." +#: ../../library/contextlib.rst:357 +msgid "" +"Note that the global side effect on :data:`sys.stdout` means that this " +"context manager is not suitable for use in library code and most threaded " +"applications. It also has no effect on the output of subprocesses. However, " +"it is still a useful approach for many utility scripts." msgstr "" -msgid "Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys.stderr` to another file or file-like object." +#: ../../library/contextlib.rst:369 +msgid "" +"Similar to :func:`~contextlib.redirect_stdout` but " +"redirecting :data:`sys.stderr` to another file or file-like object." msgstr "" -msgid "Non parallel-safe context manager to change the current working directory. As this changes a global state, the working directory, it is not suitable for use in most threaded or async contexts. It is also not suitable for most non-linear code execution, like generators, where the program execution is temporarily relinquished -- unless explicitly desired, you should not yield when this context manager is active." +#: ../../library/contextlib.rst:379 +msgid "" +"Non parallel-safe context manager to change the current working directory. " +"As this changes a global state, the working directory, it is not suitable " +"for use in most threaded or async contexts. It is also not suitable for most " +"non-linear code execution, like generators, where the program execution is " +"temporarily relinquished -- unless explicitly desired, you should not yield " +"when this context manager is active." msgstr "" -msgid "This is a simple wrapper around :func:`~os.chdir`, it changes the current working directory upon entering and restores the old one on exit." +#: ../../library/contextlib.rst:386 +msgid "" +"This is a simple wrapper around :func:`~os.chdir`, it changes the current " +"working directory upon entering and restores the old one on exit." msgstr "" -msgid "A base class that enables a context manager to also be used as a decorator." +#: ../../library/contextlib.rst:396 +msgid "" +"A base class that enables a context manager to also be used as a decorator." msgstr "" -msgid "Context managers inheriting from ``ContextDecorator`` have to implement :meth:`~object.__enter__` and :meth:`~object.__exit__` as normal. ``__exit__`` retains its optional exception handling even when used as a decorator." +#: ../../library/contextlib.rst:398 +msgid "" +"Context managers inheriting from ``ContextDecorator`` have to " +"implement :meth:`~object.__enter__` and :meth:`~object.__exit__` as normal. " +"``__exit__`` retains its optional exception handling even when used as a " +"decorator." msgstr "" -msgid "``ContextDecorator`` is used by :func:`contextmanager`, so you get this functionality automatically." +#: ../../library/contextlib.rst:403 +msgid "" +"``ContextDecorator`` is used by :deco:`contextmanager`, so you get this " +"functionality automatically." msgstr "" +#: ../../library/contextlib.rst:406 msgid "Example of ``ContextDecorator``::" msgstr "" +#: ../../library/contextlib.rst:408 msgid "" "from contextlib import ContextDecorator\n" "\n" @@ -363,9 +567,11 @@ msgid "" " return False" msgstr "" +#: ../../library/contextlib.rst:419 ../../library/contextlib.rst:491 msgid "The class can then be used like this::" msgstr "" +#: ../../library/contextlib.rst:421 msgid "" ">>> @mycontext()\n" "... def function():\n" @@ -384,30 +590,42 @@ msgid "" "Finishing" msgstr "" -msgid "This change is just syntactic sugar for any construct of the following form::" +#: ../../library/contextlib.rst:437 +msgid "" +"This change is just syntactic sugar for any construct of the following form::" msgstr "" +#: ../../library/contextlib.rst:439 msgid "" "def f():\n" " with cm():\n" " # Do stuff" msgstr "" +#: ../../library/contextlib.rst:443 msgid "``ContextDecorator`` lets you instead write::" msgstr "" +#: ../../library/contextlib.rst:445 msgid "" "@cm()\n" "def f():\n" " # Do stuff" msgstr "" -msgid "It makes it clear that the ``cm`` applies to the whole function, rather than just a piece of it (and saving an indentation level is nice, too)." +#: ../../library/contextlib.rst:449 +msgid "" +"It makes it clear that the ``cm`` applies to the whole function, rather than " +"just a piece of it (and saving an indentation level is nice, too)." msgstr "" -msgid "Existing context managers that already have a base class can be extended by using ``ContextDecorator`` as a mixin class::" +#: ../../library/contextlib.rst:452 +msgid "" +"Existing context managers that already have a base class can be extended by " +"using ``ContextDecorator`` as a mixin class::" msgstr "" +#: ../../library/contextlib.rst:455 msgid "" "from contextlib import ContextDecorator\n" "\n" @@ -419,15 +637,24 @@ msgid "" " return False" msgstr "" -msgid "As the decorated function must be able to be called multiple times, the underlying context manager must support use in multiple :keyword:`with` statements. If this is not the case, then the original construct with the explicit :keyword:`!with` statement inside the function should be used." +#: ../../library/contextlib.rst:465 +msgid "" +"As the decorated function must be able to be called multiple times, the " +"underlying context manager must support use in multiple :keyword:`with` " +"statements. If this is not the case, then the original construct with the " +"explicit :keyword:`!with` statement inside the function should be used." msgstr "" -msgid "Similar to :class:`ContextDecorator` but only for asynchronous functions." +#: ../../library/contextlib.rst:475 +msgid "" +"Similar to :class:`ContextDecorator` but only for asynchronous functions." msgstr "" +#: ../../library/contextlib.rst:477 msgid "Example of ``AsyncContextDecorator``::" msgstr "" +#: ../../library/contextlib.rst:479 msgid "" "from asyncio import run\n" "from contextlib import AsyncContextDecorator\n" @@ -442,6 +669,7 @@ msgid "" " return False" msgstr "" +#: ../../library/contextlib.rst:493 msgid "" ">>> @mycontext()\n" "... async def function():\n" @@ -462,12 +690,20 @@ msgid "" "Finishing" msgstr "" -msgid "A context manager that is designed to make it easy to programmatically combine other context managers and cleanup functions, especially those that are optional or otherwise driven by input data." +#: ../../library/contextlib.rst:516 +msgid "" +"A context manager that is designed to make it easy to programmatically " +"combine other context managers and cleanup functions, especially those that " +"are optional or otherwise driven by input data." msgstr "" -msgid "For example, a set of files may easily be handled in a single with statement as follows::" +#: ../../library/contextlib.rst:520 +msgid "" +"For example, a set of files may easily be handled in a single with statement " +"as follows::" msgstr "" +#: ../../library/contextlib.rst:523 msgid "" "with ExitStack() as stack:\n" " files = [stack.enter_context(open(fname)) for fname in filenames]\n" @@ -476,60 +712,130 @@ msgid "" " # in the list raise an exception" msgstr "" -msgid "The :meth:`~object.__enter__` method returns the :class:`ExitStack` instance, and performs no additional operations." +#: ../../library/contextlib.rst:529 +msgid "" +"The :meth:`~object.__enter__` method returns the :class:`ExitStack` " +"instance, and performs no additional operations." msgstr "" -msgid "Each instance maintains a stack of registered callbacks that are called in reverse order when the instance is closed (either explicitly or implicitly at the end of a :keyword:`with` statement). Note that callbacks are *not* invoked implicitly when the context stack instance is garbage collected." +#: ../../library/contextlib.rst:532 +msgid "" +"Each instance maintains a stack of registered callbacks that are called in " +"reverse order when the instance is closed (either explicitly or implicitly " +"at the end of a :keyword:`with` statement). Note that callbacks are *not* " +"invoked implicitly when the context stack instance is garbage collected." msgstr "" -msgid "This stack model is used so that context managers that acquire their resources in their ``__init__`` method (such as file objects) can be handled correctly." +#: ../../library/contextlib.rst:537 +msgid "" +"This stack model is used so that context managers that acquire their " +"resources in their ``__init__`` method (such as file objects) can be handled " +"correctly." msgstr "" -msgid "Since registered callbacks are invoked in the reverse order of registration, this ends up behaving as if multiple nested :keyword:`with` statements had been used with the registered set of callbacks. This even extends to exception handling - if an inner callback suppresses or replaces an exception, then outer callbacks will be passed arguments based on that updated state." +#: ../../library/contextlib.rst:541 +msgid "" +"Since registered callbacks are invoked in the reverse order of registration, " +"this ends up behaving as if multiple nested :keyword:`with` statements had " +"been used with the registered set of callbacks. This even extends to " +"exception handling - if an inner callback suppresses or replaces an " +"exception, then outer callbacks will be passed arguments based on that " +"updated state." msgstr "" -msgid "This is a relatively low level API that takes care of the details of correctly unwinding the stack of exit callbacks. It provides a suitable foundation for higher level context managers that manipulate the exit stack in application specific ways." +#: ../../library/contextlib.rst:548 +msgid "" +"This is a relatively low level API that takes care of the details of " +"correctly unwinding the stack of exit callbacks. It provides a suitable " +"foundation for higher level context managers that manipulate the exit stack " +"in application specific ways." msgstr "" -msgid "Enters a new context manager and adds its :meth:`~object.__exit__` method to the callback stack. The return value is the result of the context manager's own :meth:`~object.__enter__` method." +#: ../../library/contextlib.rst:557 +msgid "" +"Enters a new context manager and adds its :meth:`~object.__exit__` method to " +"the callback stack. The return value is the result of the context manager's " +"own :meth:`~object.__enter__` method." msgstr "" -msgid "These context managers may suppress exceptions just as they normally would if used directly as part of a :keyword:`with` statement." +#: ../../library/contextlib.rst:561 +msgid "" +"These context managers may suppress exceptions just as they normally would " +"if used directly as part of a :keyword:`with` statement." msgstr "" -msgid "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a context manager." +#: ../../library/contextlib.rst:564 +msgid "" +"Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a " +"context manager." msgstr "" -msgid "Adds a context manager's :meth:`~object.__exit__` method to the callback stack." +#: ../../library/contextlib.rst:570 +msgid "" +"Adds a context manager's :meth:`~object.__exit__` method to the callback " +"stack." msgstr "" -msgid "As ``__enter__`` is *not* invoked, this method can be used to cover part of an :meth:`~object.__enter__` implementation with a context manager's own :meth:`~object.__exit__` method." +#: ../../library/contextlib.rst:572 +msgid "" +"As ``__enter__`` is *not* invoked, this method can be used to cover part of " +"an :meth:`~object.__enter__` implementation with a context manager's " +"own :meth:`~object.__exit__` method." msgstr "" -msgid "If passed an object that is not a context manager, this method assumes it is a callback with the same signature as a context manager's :meth:`~object.__exit__` method and adds it directly to the callback stack." +#: ../../library/contextlib.rst:576 +msgid "" +"If passed an object that is not a context manager, this method assumes it is " +"a callback with the same signature as a context " +"manager's :meth:`~object.__exit__` method and adds it directly to the " +"callback stack." msgstr "" -msgid "By returning true values, these callbacks can suppress exceptions the same way context manager :meth:`~object.__exit__` methods can." +#: ../../library/contextlib.rst:580 +msgid "" +"By returning true values, these callbacks can suppress exceptions the same " +"way context manager :meth:`~object.__exit__` methods can." msgstr "" -msgid "The passed in object is returned from the function, allowing this method to be used as a function decorator." +#: ../../library/contextlib.rst:583 +msgid "" +"The passed in object is returned from the function, allowing this method to " +"be used as a function decorator." msgstr "" -msgid "Accepts an arbitrary callback function and arguments and adds it to the callback stack." +#: ../../library/contextlib.rst:588 +msgid "" +"Accepts an arbitrary callback function and arguments and adds it to the " +"callback stack." msgstr "" -msgid "Unlike the other methods, callbacks added this way cannot suppress exceptions (as they are never passed the exception details)." +#: ../../library/contextlib.rst:591 +msgid "" +"Unlike the other methods, callbacks added this way cannot suppress " +"exceptions (as they are never passed the exception details)." msgstr "" -msgid "The passed in callback is returned from the function, allowing this method to be used as a function decorator." +#: ../../library/contextlib.rst:594 +msgid "" +"The passed in callback is returned from the function, allowing this method " +"to be used as a function decorator." msgstr "" -msgid "Transfers the callback stack to a fresh :class:`ExitStack` instance and returns it. No callbacks are invoked by this operation - instead, they will now be invoked when the new stack is closed (either explicitly or implicitly at the end of a :keyword:`with` statement)." +#: ../../library/contextlib.rst:599 +msgid "" +"Transfers the callback stack to a fresh :class:`ExitStack` instance and " +"returns it. No callbacks are invoked by this operation - instead, they will " +"now be invoked when the new stack is closed (either explicitly or implicitly " +"at the end of a :keyword:`with` statement)." msgstr "" -msgid "For example, a group of files can be opened as an \"all or nothing\" operation as follows::" +#: ../../library/contextlib.rst:604 +msgid "" +"For example, a group of files can be opened as an \"all or nothing\" " +"operation as follows::" msgstr "" +#: ../../library/contextlib.rst:607 msgid "" "with ExitStack() as stack:\n" " files = [stack.enter_context(open(fname)) for fname in filenames]\n" @@ -541,33 +847,58 @@ msgid "" " # close_files() can then be invoked explicitly to close them all." msgstr "" -msgid "Immediately unwinds the callback stack, invoking callbacks in the reverse order of registration. For any context managers and exit callbacks registered, the arguments passed in will indicate that no exception occurred." +#: ../../library/contextlib.rst:618 +msgid "" +"Immediately unwinds the callback stack, invoking callbacks in the reverse " +"order of registration. For any context managers and exit callbacks " +"registered, the arguments passed in will indicate that no exception occurred." msgstr "" -msgid "An :ref:`asynchronous context manager `, similar to :class:`ExitStack`, that supports combining both synchronous and asynchronous context managers, as well as having coroutines for cleanup logic." +#: ../../library/contextlib.rst:625 +msgid "" +"An :ref:`asynchronous context manager `, similar " +"to :class:`ExitStack`, that supports combining both synchronous and " +"asynchronous context managers, as well as having coroutines for cleanup " +"logic." msgstr "" -msgid "The :meth:`~ExitStack.close` method is not implemented; :meth:`aclose` must be used instead." +#: ../../library/contextlib.rst:630 +msgid "" +"The :meth:`~ExitStack.close` method is not implemented; :meth:`aclose` must " +"be used instead." msgstr "" -msgid "Similar to :meth:`ExitStack.enter_context` but expects an asynchronous context manager." +#: ../../library/contextlib.rst:636 +msgid "" +"Similar to :meth:`ExitStack.enter_context` but expects an asynchronous " +"context manager." msgstr "" -msgid "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an asynchronous context manager." +#: ../../library/contextlib.rst:639 +msgid "" +"Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an " +"asynchronous context manager." msgstr "" -msgid "Similar to :meth:`ExitStack.push` but expects either an asynchronous context manager or a coroutine function." +#: ../../library/contextlib.rst:645 +msgid "" +"Similar to :meth:`ExitStack.push` but expects either an asynchronous context " +"manager or a coroutine function." msgstr "" +#: ../../library/contextlib.rst:650 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." msgstr "" +#: ../../library/contextlib.rst:655 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." msgstr "" -msgid "Continuing the example for :func:`asynccontextmanager`::" +#: ../../library/contextlib.rst:657 +msgid "Continuing the example for :deco:`asynccontextmanager`::" msgstr "" +#: ../../library/contextlib.rst:659 msgid "" "async with AsyncExitStack() as stack:\n" " connections = [await stack.enter_async_context(get_connection())\n" @@ -577,18 +908,31 @@ msgid "" " # later in the list raise an exception." msgstr "" +#: ../../library/contextlib.rst:669 msgid "Examples and Recipes" msgstr "" -msgid "This section describes some examples and recipes for making effective use of the tools provided by :mod:`!contextlib`." +#: ../../library/contextlib.rst:671 +msgid "" +"This section describes some examples and recipes for making effective use of " +"the tools provided by :mod:`!contextlib`." msgstr "" +#: ../../library/contextlib.rst:676 msgid "Supporting a variable number of context managers" msgstr "" -msgid "The primary use case for :class:`ExitStack` is the one given in the class documentation: supporting a variable number of context managers and other cleanup operations in a single :keyword:`with` statement. The variability may come from the number of context managers needed being driven by user input (such as opening a user specified collection of files), or from some of the context managers being optional::" +#: ../../library/contextlib.rst:678 +msgid "" +"The primary use case for :class:`ExitStack` is the one given in the class " +"documentation: supporting a variable number of context managers and other " +"cleanup operations in a single :keyword:`with` statement. The variability " +"may come from the number of context managers needed being driven by user " +"input (such as opening a user specified collection of files), or from some " +"of the context managers being optional::" msgstr "" +#: ../../library/contextlib.rst:685 msgid "" "with ExitStack() as stack:\n" " for resource in resources:\n" @@ -599,15 +943,28 @@ msgid "" " # Perform operations that use the acquired resources" msgstr "" -msgid "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` statements to manage arbitrary resources that don't natively support the context management protocol." +#: ../../library/contextlib.rst:693 +msgid "" +"As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " +"statements to manage arbitrary resources that don't natively support the " +"context management protocol." msgstr "" +#: ../../library/contextlib.rst:699 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -msgid "It is occasionally desirable to catch exceptions from an :meth:`~object.__enter__` method implementation, *without* inadvertently catching exceptions from the :keyword:`with` statement body or the context manager's :meth:`~object.__exit__` method. By using :class:`ExitStack` the steps in the context management protocol can be separated slightly in order to allow this::" +#: ../../library/contextlib.rst:701 +msgid "" +"It is occasionally desirable to catch exceptions from " +"an :meth:`~object.__enter__` method implementation, *without* inadvertently " +"catching exceptions from the :keyword:`with` statement body or the context " +"manager's :meth:`~object.__exit__` method. By using :class:`ExitStack` the " +"steps in the context management protocol can be separated slightly in order " +"to allow this::" msgstr "" +#: ../../library/contextlib.rst:707 msgid "" "stack = ExitStack()\n" "try:\n" @@ -619,24 +976,43 @@ msgid "" " # Handle normal case" msgstr "" -msgid "Actually needing to do this is likely to indicate that the underlying API should be providing a direct resource management interface for use with :keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not all APIs are well designed in that regard. When a context manager is the only resource management API provided, then :class:`ExitStack` can make it easier to handle various situations that can't be handled directly in a :keyword:`with` statement." +#: ../../library/contextlib.rst:716 +msgid "" +"Actually needing to do this is likely to indicate that the underlying API " +"should be providing a direct resource management interface for use " +"with :keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not " +"all APIs are well designed in that regard. When a context manager is the " +"only resource management API provided, then :class:`ExitStack` can make it " +"easier to handle various situations that can't be handled directly in " +"a :keyword:`with` statement." msgstr "" +#: ../../library/contextlib.rst:726 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -msgid "As noted in the documentation of :meth:`ExitStack.push`, this method can be useful in cleaning up an already allocated resource if later steps in the :meth:`~object.__enter__` implementation fail." +#: ../../library/contextlib.rst:728 +msgid "" +"As noted in the documentation of :meth:`ExitStack.push`, this method can be " +"useful in cleaning up an already allocated resource if later steps in " +"the :meth:`~object.__enter__` implementation fail." msgstr "" -msgid "Here's an example of doing this for a context manager that accepts resource acquisition and release functions, along with an optional validation function, and maps them to the context management protocol::" +#: ../../library/contextlib.rst:732 +msgid "" +"Here's an example of doing this for a context manager that accepts resource " +"acquisition and release functions, along with an optional validation " +"function, and maps them to the context management protocol::" msgstr "" +#: ../../library/contextlib.rst:736 msgid "" "from contextlib import contextmanager, AbstractContextManager, ExitStack\n" "\n" "class ResourceManager(AbstractContextManager):\n" "\n" -" def __init__(self, acquire_resource, release_resource, check_resource_ok=None):\n" +" def __init__(self, acquire_resource, release_resource, " +"check_resource_ok=None):\n" " self.acquire_resource = acquire_resource\n" " self.release_resource = release_resource\n" " if check_resource_ok is None:\n" @@ -667,12 +1043,19 @@ msgid "" " self.release_resource()" msgstr "" +#: ../../library/contextlib.rst:772 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -msgid "A pattern you will sometimes see is a ``try-finally`` statement with a flag variable to indicate whether or not the body of the ``finally`` clause should be executed. In its simplest form (that can't already be handled just by using an ``except`` clause instead), it looks something like this::" +#: ../../library/contextlib.rst:774 +msgid "" +"A pattern you will sometimes see is a ``try-finally`` statement with a flag " +"variable to indicate whether or not the body of the ``finally`` clause " +"should be executed. In its simplest form (that can't already be handled just " +"by using an ``except`` clause instead), it looks something like this::" msgstr "" +#: ../../library/contextlib.rst:779 msgid "" "cleanup_needed = True\n" "try:\n" @@ -684,12 +1067,21 @@ msgid "" " cleanup_resources()" msgstr "" -msgid "As with any ``try`` statement based code, this can cause problems for development and review, because the setup code and the cleanup code can end up being separated by arbitrarily long sections of code." +#: ../../library/contextlib.rst:788 +msgid "" +"As with any ``try`` statement based code, this can cause problems for " +"development and review, because the setup code and the cleanup code can end " +"up being separated by arbitrarily long sections of code." msgstr "" -msgid ":class:`ExitStack` makes it possible to instead register a callback for execution at the end of a ``with`` statement, and then later decide to skip executing that callback::" +#: ../../library/contextlib.rst:792 +msgid "" +":class:`ExitStack` makes it possible to instead register a callback for " +"execution at the end of a ``with`` statement, and then later decide to skip " +"executing that callback::" msgstr "" +#: ../../library/contextlib.rst:796 msgid "" "from contextlib import ExitStack\n" "\n" @@ -700,12 +1092,19 @@ msgid "" " stack.pop_all()" msgstr "" -msgid "This allows the intended cleanup behaviour to be made explicit up front, rather than requiring a separate flag variable." +#: ../../library/contextlib.rst:804 +msgid "" +"This allows the intended cleanup behaviour to be made explicit up front, " +"rather than requiring a separate flag variable." msgstr "" -msgid "If a particular application uses this pattern a lot, it can be simplified even further by means of a small helper class::" +#: ../../library/contextlib.rst:807 +msgid "" +"If a particular application uses this pattern a lot, it can be simplified " +"even further by means of a small helper class::" msgstr "" +#: ../../library/contextlib.rst:810 msgid "" "from contextlib import ExitStack\n" "\n" @@ -723,9 +1122,14 @@ msgid "" " cb.cancel()" msgstr "" -msgid "If the resource cleanup isn't already neatly bundled into a standalone function, then it is still possible to use the decorator form of :meth:`ExitStack.callback` to declare the resource cleanup in advance::" +#: ../../library/contextlib.rst:825 +msgid "" +"If the resource cleanup isn't already neatly bundled into a standalone " +"function, then it is still possible to use the decorator form " +"of :meth:`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" +#: ../../library/contextlib.rst:830 msgid "" "from contextlib import ExitStack\n" "\n" @@ -738,18 +1142,33 @@ msgid "" " stack.pop_all()" msgstr "" -msgid "Due to the way the decorator protocol works, a callback function declared this way cannot take any parameters. Instead, any resources to be released must be accessed as closure variables." +#: ../../library/contextlib.rst:840 +msgid "" +"Due to the way the decorator protocol works, a callback function declared " +"this way cannot take any parameters. Instead, any resources to be released " +"must be accessed as closure variables." msgstr "" +#: ../../library/contextlib.rst:846 msgid "Using a context manager as a function decorator" msgstr "" -msgid ":class:`ContextDecorator` makes it possible to use a context manager in both an ordinary ``with`` statement and also as a function decorator." +#: ../../library/contextlib.rst:848 +msgid "" +":class:`ContextDecorator` makes it possible to use a context manager in both " +"an ordinary ``with`` statement and also as a function decorator." msgstr "" -msgid "For example, it is sometimes useful to wrap functions or groups of statements with a logger that can track the time of entry and time of exit. Rather than writing both a function decorator and a context manager for the task, inheriting from :class:`ContextDecorator` provides both capabilities in a single definition::" +#: ../../library/contextlib.rst:851 +msgid "" +"For example, it is sometimes useful to wrap functions or groups of " +"statements with a logger that can track the time of entry and time of exit. " +"Rather than writing both a function decorator and a context manager for the " +"task, inheriting from :class:`ContextDecorator` provides both capabilities " +"in a single definition::" msgstr "" +#: ../../library/contextlib.rst:857 msgid "" "from contextlib import ContextDecorator\n" "import logging\n" @@ -767,18 +1186,22 @@ msgid "" " logging.info('Exiting: %s', self.name)" msgstr "" +#: ../../library/contextlib.rst:872 msgid "Instances of this class can be used as both a context manager::" msgstr "" +#: ../../library/contextlib.rst:874 msgid "" "with track_entry_and_exit('widget loader'):\n" " print('Some time consuming activity goes here')\n" " load_widget()" msgstr "" +#: ../../library/contextlib.rst:878 msgid "And also as a function decorator::" msgstr "" +#: ../../library/contextlib.rst:880 msgid "" "@track_entry_and_exit('widget loader')\n" "def activity():\n" @@ -786,30 +1209,58 @@ msgid "" " load_widget()" msgstr "" -msgid "Note that there is one additional limitation when using context managers as function decorators: there's no way to access the return value of :meth:`~object.__enter__`. If that value is needed, then it is still necessary to use an explicit ``with`` statement." +#: ../../library/contextlib.rst:885 +msgid "" +"Note that there is one additional limitation when using context managers as " +"function decorators: there's no way to access the return value " +"of :meth:`~object.__enter__`. If that value is needed, then it is still " +"necessary to use an explicit ``with`` statement." msgstr "" +#: ../../library/contextlib.rst:892 msgid ":pep:`343` - The \"with\" statement" msgstr "" -msgid "The specification, background, and examples for the Python :keyword:`with` statement." +#: ../../library/contextlib.rst:893 +msgid "" +"The specification, background, and examples for the Python :keyword:`with` " +"statement." msgstr "" +#: ../../library/contextlib.rst:899 msgid "Single use, reusable and reentrant context managers" msgstr "" -msgid "Most context managers are written in a way that means they can only be used effectively in a :keyword:`with` statement once. These single use context managers must be created afresh each time they're used - attempting to use them a second time will trigger an exception or otherwise not work correctly." +#: ../../library/contextlib.rst:901 +msgid "" +"Most context managers are written in a way that means they can only be used " +"effectively in a :keyword:`with` statement once. These single use context " +"managers must be created afresh each time they're used - attempting to use " +"them a second time will trigger an exception or otherwise not work correctly." msgstr "" -msgid "This common limitation means that it is generally advisable to create context managers directly in the header of the :keyword:`with` statement where they are used (as shown in all of the usage examples above)." +#: ../../library/contextlib.rst:907 +msgid "" +"This common limitation means that it is generally advisable to create " +"context managers directly in the header of the :keyword:`with` statement " +"where they are used (as shown in all of the usage examples above)." msgstr "" -msgid "Files are an example of effectively single use context managers, since the first :keyword:`with` statement will close the file, preventing any further IO operations using that file object." +#: ../../library/contextlib.rst:911 +msgid "" +"Files are an example of effectively single use context managers, since the " +"first :keyword:`with` statement will close the file, preventing any further " +"IO operations using that file object." msgstr "" -msgid "Context managers created using :func:`contextmanager` are also single use context managers, and will complain about the underlying generator failing to yield if an attempt is made to use them a second time::" +#: ../../library/contextlib.rst:915 +msgid "" +"Context managers created using :deco:`contextmanager` are also single use " +"context managers, and will complain about the underlying generator failing " +"to yield if an attempt is made to use them a second time::" msgstr "" +#: ../../library/contextlib.rst:919 msgid "" ">>> from contextlib import contextmanager\n" ">>> @contextmanager\n" @@ -832,15 +1283,26 @@ msgid "" "RuntimeError: generator didn't yield" msgstr "" +#: ../../library/contextlib.rst:943 msgid "Reentrant context managers" msgstr "" -msgid "More sophisticated context managers may be \"reentrant\". These context managers can not only be used in multiple :keyword:`with` statements, but may also be used *inside* a :keyword:`!with` statement that is already using the same context manager." +#: ../../library/contextlib.rst:945 +msgid "" +"More sophisticated context managers may be \"reentrant\". These context " +"managers can not only be used in multiple :keyword:`with` statements, but " +"may also be used *inside* a :keyword:`!with` statement that is already using " +"the same context manager." msgstr "" -msgid ":class:`threading.RLock` is an example of a reentrant context manager, as are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a very simple example of reentrant use::" +#: ../../library/contextlib.rst:950 +msgid "" +":class:`threading.RLock` is an example of a reentrant context manager, as " +"are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a " +"very simple example of reentrant use::" msgstr "" +#: ../../library/contextlib.rst:954 msgid "" ">>> from contextlib import redirect_stdout\n" ">>> from io import StringIO\n" @@ -858,24 +1320,51 @@ msgid "" "This is also written to the stream" msgstr "" -msgid "Real world examples of reentrancy are more likely to involve multiple functions calling each other and hence be far more complicated than this example." +#: ../../library/contextlib.rst:969 +msgid "" +"Real world examples of reentrancy are more likely to involve multiple " +"functions calling each other and hence be far more complicated than this " +"example." msgstr "" -msgid "Note also that being reentrant is *not* the same thing as being thread safe. :func:`redirect_stdout`, for example, is definitely not thread safe, as it makes a global modification to the system state by binding :data:`sys.stdout` to a different stream." +#: ../../library/contextlib.rst:973 +msgid "" +"Note also that being reentrant is *not* the same thing as being thread " +"safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " +"as it makes a global modification to the system state by " +"binding :data:`sys.stdout` to a different stream." msgstr "" +#: ../../library/contextlib.rst:982 msgid "Reusable context managers" msgstr "" -msgid "Distinct from both single use and reentrant context managers are \"reusable\" context managers (or, to be completely explicit, \"reusable, but not reentrant\" context managers, since reentrant context managers are also reusable). These context managers support being used multiple times, but will fail (or otherwise not work correctly) if the specific context manager instance has already been used in a containing with statement." +#: ../../library/contextlib.rst:984 +msgid "" +"Distinct from both single use and reentrant context managers are " +"\"reusable\" context managers (or, to be completely explicit, \"reusable, " +"but not reentrant\" context managers, since reentrant context managers are " +"also reusable). These context managers support being used multiple times, " +"but will fail (or otherwise not work correctly) if the specific context " +"manager instance has already been used in a containing with statement." msgstr "" -msgid ":class:`threading.Lock` is an example of a reusable, but not reentrant, context manager (for a reentrant lock, it is necessary to use :class:`threading.RLock` instead)." +#: ../../library/contextlib.rst:991 +msgid "" +":class:`threading.Lock` is an example of a reusable, but not reentrant, " +"context manager (for a reentrant lock, it is necessary to " +"use :class:`threading.RLock` instead)." msgstr "" -msgid "Another example of a reusable, but not reentrant, context manager is :class:`ExitStack`, as it invokes *all* currently registered callbacks when leaving any with statement, regardless of where those callbacks were added::" +#: ../../library/contextlib.rst:995 +msgid "" +"Another example of a reusable, but not reentrant, context manager " +"is :class:`ExitStack`, as it invokes *all* currently registered callbacks " +"when leaving any with statement, regardless of where those callbacks were " +"added::" msgstr "" +#: ../../library/contextlib.rst:1000 msgid "" ">>> from contextlib import ExitStack\n" ">>> stack = ExitStack()\n" @@ -904,12 +1393,21 @@ msgid "" "Leaving outer context" msgstr "" -msgid "As the output from the example shows, reusing a single stack object across multiple with statements works correctly, but attempting to nest them will cause the stack to be cleared at the end of the innermost with statement, which is unlikely to be desirable behaviour." +#: ../../library/contextlib.rst:1026 +msgid "" +"As the output from the example shows, reusing a single stack object across " +"multiple with statements works correctly, but attempting to nest them will " +"cause the stack to be cleared at the end of the innermost with statement, " +"which is unlikely to be desirable behaviour." msgstr "" -msgid "Using separate :class:`ExitStack` instances instead of reusing a single instance avoids that problem::" +#: ../../library/contextlib.rst:1031 +msgid "" +"Using separate :class:`ExitStack` instances instead of reusing a single " +"instance avoids that problem::" msgstr "" +#: ../../library/contextlib.rst:1034 msgid "" ">>> from contextlib import ExitStack\n" ">>> with ExitStack() as outer_stack:\n" diff --git a/library/contextvars.po b/library/contextvars.po index a5261a5c7..8fc016233 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 00:57+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,69 +23,120 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/contextvars.rst:2 msgid ":mod:`!contextvars` --- Context Variables" msgstr "" -msgid "This module provides APIs to manage, store, and access context-local state. The :class:`~contextvars.ContextVar` class is used to declare and work with *Context Variables*. The :func:`~contextvars.copy_context` function and the :class:`~contextvars.Context` class should be used to manage the current context in asynchronous frameworks." +#: ../../library/contextvars.rst:11 +msgid "" +"This module provides APIs to manage, store, and access context-local state. " +"The :class:`~contextvars.ContextVar` class is used to declare and work with " +"*Context Variables*. The :func:`~contextvars.copy_context` function and " +"the :class:`~contextvars.Context` class should be used to manage the current " +"context in asynchronous frameworks." msgstr "" -msgid "Context managers that have state should use Context Variables instead of :func:`threading.local` to prevent their state from bleeding to other code unexpectedly, when used in concurrent code." +#: ../../library/contextvars.rst:17 +msgid "" +"Context managers that have state should use Context Variables instead " +"of :func:`threading.local` to prevent their state from bleeding to other " +"code unexpectedly, when used in concurrent code." msgstr "" +#: ../../library/contextvars.rst:21 msgid "See also :pep:`567` for additional details." msgstr "" +#: ../../library/contextvars.rst:27 msgid "Context Variables" msgstr "" +#: ../../library/contextvars.rst:31 msgid "This class is used to declare a new Context Variable, e.g.::" msgstr "" +#: ../../library/contextvars.rst:33 msgid "var: ContextVar[int] = ContextVar('var', default=42)" msgstr "" -msgid "The required *name* parameter is used for introspection and debug purposes." +#: ../../library/contextvars.rst:35 +msgid "" +"The required *name* parameter is used for introspection and debug purposes." msgstr "" -msgid "The optional keyword-only *default* parameter is returned by :meth:`ContextVar.get` when no value for the variable is found in the current context." +#: ../../library/contextvars.rst:38 +msgid "" +"The optional keyword-only *default* parameter is returned " +"by :meth:`ContextVar.get` when no value for the variable is found in the " +"current context." msgstr "" -msgid "**Important:** Context Variables should be created at the top module level and never in closures. :class:`Context` objects hold strong references to context variables which prevents context variables from being properly garbage collected." +#: ../../library/contextvars.rst:42 +msgid "" +"**Important:** Context Variables should be created at the top module level " +"and never in closures. :class:`Context` objects hold strong references to " +"context variables which prevents context variables from being properly " +"garbage collected." msgstr "" -msgid ":class:`!ContextVar`\\s are :ref:`generic ` over the type of their contained value." +#: ../../library/contextvars.rst:47 +msgid "" +":class:`!ContextVar`\\s are :ref:`generic ` over the type of their " +"contained value." msgstr "" +#: ../../library/contextvars.rst:52 msgid "The name of the variable. This is a read-only property." msgstr "" +#: ../../library/contextvars.rst:58 msgid "Return a value for the context variable for the current context." msgstr "" -msgid "If there is no value for the variable in the current context, the method will:" +#: ../../library/contextvars.rst:60 +msgid "" +"If there is no value for the variable in the current context, the method " +"will:" msgstr "" -msgid "return the value of the *default* argument of the method, if provided; or" +#: ../../library/contextvars.rst:63 +msgid "" +"return the value of the *default* argument of the method, if provided; or" msgstr "" -msgid "return the default value for the context variable, if it was created with one; or" +#: ../../library/contextvars.rst:66 +msgid "" +"return the default value for the context variable, if it was created with " +"one; or" msgstr "" +#: ../../library/contextvars.rst:69 msgid "raise a :exc:`LookupError`." msgstr "" -msgid "Call to set a new value for the context variable in the current context." +#: ../../library/contextvars.rst:73 +msgid "" +"Call to set a new value for the context variable in the current context." msgstr "" -msgid "The required *value* argument is the new value for the context variable." +#: ../../library/contextvars.rst:76 +msgid "" +"The required *value* argument is the new value for the context variable." msgstr "" -msgid "Returns a :class:`~contextvars.Token` object that can be used to restore the variable to its previous value via the :meth:`ContextVar.reset` method." +#: ../../library/contextvars.rst:79 +msgid "" +"Returns a :class:`~contextvars.Token` object that can be used to restore the " +"variable to its previous value via the :meth:`ContextVar.reset` method." msgstr "" -msgid "For convenience, the token object can be used as a context manager to avoid calling :meth:`ContextVar.reset` manually::" +#: ../../library/contextvars.rst:83 +msgid "" +"For convenience, the token object can be used as a context manager to avoid " +"calling :meth:`ContextVar.reset` manually::" msgstr "" +#: ../../library/contextvars.rst:86 msgid "" "var = ContextVar('var', default='default value')\n" "\n" @@ -95,9 +146,11 @@ msgid "" "assert var.get() == 'default value'" msgstr "" +#: ../../library/contextvars.rst:93 msgid "It is a shorthand for::" msgstr "" +#: ../../library/contextvars.rst:95 msgid "" "var = ContextVar('var', default='default value')\n" "\n" @@ -110,15 +163,21 @@ msgid "" "assert var.get() == 'default value'" msgstr "" +#: ../../library/contextvars.rst:107 msgid "Added support for using tokens as context managers." msgstr "" -msgid "Reset the context variable to the value it had before the :meth:`ContextVar.set` that created the *token* was used." +#: ../../library/contextvars.rst:111 +msgid "" +"Reset the context variable to the value it had before " +"the :meth:`ContextVar.set` that created the *token* was used." msgstr "" +#: ../../library/contextvars.rst:114 msgid "For example::" msgstr "" +#: ../../library/contextvars.rst:116 msgid "" "var = ContextVar('var')\n" "\n" @@ -130,83 +189,154 @@ msgid "" "# var.get() would raise a LookupError." msgstr "" +#: ../../library/contextvars.rst:125 msgid "The same *token* cannot be used twice." msgstr "" -msgid "*Token* objects are returned by the :meth:`ContextVar.set` method. They can be passed to the :meth:`ContextVar.reset` method to revert the value of the variable to what it was before the corresponding *set*. A single token cannot reset a context variable more than once." +#: ../../library/contextvars.rst:130 +msgid "" +"*Token* objects are returned by the :meth:`ContextVar.set` method. They can " +"be passed to the :meth:`ContextVar.reset` method to revert the value of the " +"variable to what it was before the corresponding *set*. A single token " +"cannot reset a context variable more than once." msgstr "" -msgid "Tokens support the :ref:`context manager protocol ` to automatically reset context variables. See :meth:`ContextVar.set`." +#: ../../library/contextvars.rst:135 +msgid "" +"Tokens support the :ref:`context manager protocol ` to " +"automatically reset context variables. See :meth:`ContextVar.set`." msgstr "" -msgid "Tokens are :ref:`generic ` over the same type as the :class:`ContextVar` which created them." +#: ../../library/contextvars.rst:138 +msgid "" +"Tokens are :ref:`generic ` over the same type as " +"the :class:`ContextVar` which created them." msgstr "" +#: ../../library/contextvars.rst:143 msgid "Added support for usage as a context manager." msgstr "" -msgid "A read-only property. Points to the :class:`ContextVar` object that created the token." +#: ../../library/contextvars.rst:147 +msgid "" +"A read-only property. Points to the :class:`ContextVar` object that created " +"the token." msgstr "" -msgid "A read-only property. Set to the value the variable had before the :meth:`ContextVar.set` method call that created the token. It points to :attr:`Token.MISSING` if the variable was not set before the call." +#: ../../library/contextvars.rst:152 +msgid "" +"A read-only property. Set to the value the variable had before " +"the :meth:`ContextVar.set` method call that created the token. It points " +"to :attr:`Token.MISSING` if the variable was not set before the call." msgstr "" +#: ../../library/contextvars.rst:159 msgid "A marker object used by :attr:`Token.old_value`." msgstr "" +#: ../../library/contextvars.rst:163 msgid "Manual Context Management" msgstr "" +#: ../../library/contextvars.rst:167 msgid "Returns a copy of the current :class:`~contextvars.Context` object." msgstr "" -msgid "The following snippet gets a copy of the current context and prints all variables and their values that are set in it::" +#: ../../library/contextvars.rst:169 +msgid "" +"The following snippet gets a copy of the current context and prints all " +"variables and their values that are set in it::" msgstr "" +#: ../../library/contextvars.rst:172 msgid "" "ctx: Context = copy_context()\n" "print(list(ctx.items()))" msgstr "" -msgid "The function has an *O*\\ (1) complexity, i.e. works equally fast for contexts with a few context variables and for contexts that have a lot of them." +#: ../../library/contextvars.rst:175 +msgid "" +"The function has an *O*\\ (1) complexity, i.e. works equally fast for " +"contexts with a few context variables and for contexts that have a lot of " +"them." msgstr "" +#: ../../library/contextvars.rst:182 msgid "A mapping of :class:`ContextVars ` to their values." msgstr "" -msgid "``Context()`` creates an empty context with no values in it. To get a copy of the current context use the :func:`~contextvars.copy_context` function." +#: ../../library/contextvars.rst:184 +msgid "" +"``Context()`` creates an empty context with no values in it. To get a copy " +"of the current context use the :func:`~contextvars.copy_context` function." msgstr "" -msgid "Each thread has its own effective stack of :class:`!Context` objects. The :term:`current context` is the :class:`!Context` object at the top of the current thread's stack. All :class:`!Context` objects in the stacks are considered to be *entered*." +#: ../../library/contextvars.rst:188 +msgid "" +"Each thread has its own effective stack of :class:`!Context` objects. " +"The :term:`current context` is the :class:`!Context` object at the top of " +"the current thread's stack. All :class:`!Context` objects in the stacks are " +"considered to be *entered*." msgstr "" -msgid "*Entering* a context, which can be done by calling its :meth:`~Context.run` method, makes the context the current context by pushing it onto the top of the current thread's context stack." +#: ../../library/contextvars.rst:193 +msgid "" +"*Entering* a context, which can be done by calling its :meth:`~Context.run` " +"method, makes the context the current context by pushing it onto the top of " +"the current thread's context stack." msgstr "" -msgid "*Exiting* from the current context, which can be done by returning from the callback passed to the :meth:`~Context.run` method, restores the current context to what it was before the context was entered by popping the context off the top of the context stack." +#: ../../library/contextvars.rst:197 +msgid "" +"*Exiting* from the current context, which can be done by returning from the " +"callback passed to the :meth:`~Context.run` method, restores the current " +"context to what it was before the context was entered by popping the context " +"off the top of the context stack." msgstr "" -msgid "Since each thread has its own context stack, :class:`ContextVar` objects behave in a similar fashion to :func:`threading.local` when values are assigned in different threads." +#: ../../library/contextvars.rst:202 +msgid "" +"Since each thread has its own context stack, :class:`ContextVar` objects " +"behave in a similar fashion to :func:`threading.local` when values are " +"assigned in different threads." msgstr "" -msgid "Attempting to enter an already entered context, including contexts entered in other threads, raises a :exc:`RuntimeError`." +#: ../../library/contextvars.rst:206 +msgid "" +"Attempting to enter an already entered context, including contexts entered " +"in other threads, raises a :exc:`RuntimeError`." msgstr "" +#: ../../library/contextvars.rst:209 msgid "After exiting a context, it can later be re-entered (from any thread)." msgstr "" -msgid "Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` method are recorded in the current context. The :meth:`ContextVar.get` method returns the value associated with the current context. Exiting a context effectively reverts any changes made to context variables while the context was entered (if needed, the values can be restored by re-entering the context)." +#: ../../library/contextvars.rst:211 +msgid "" +"Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " +"method are recorded in the current context. The :meth:`ContextVar.get` " +"method returns the value associated with the current context. Exiting a " +"context effectively reverts any changes made to context variables while the " +"context was entered (if needed, the values can be restored by re-entering " +"the context)." msgstr "" +#: ../../library/contextvars.rst:218 msgid "Context implements the :class:`collections.abc.Mapping` interface." msgstr "" -msgid "Enters the Context, executes ``callable(*args, **kwargs)``, then exits the Context. Returns *callable*'s return value, or propagates an exception if one occurred." +#: ../../library/contextvars.rst:222 +msgid "" +"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " +"Context. Returns *callable*'s return value, or propagates an exception if " +"one occurred." msgstr "" +#: ../../library/contextvars.rst:226 msgid "Example:" msgstr "" +#: ../../library/contextvars.rst:228 msgid "" "import contextvars\n" "\n" @@ -240,39 +370,63 @@ msgid "" "print(var.get()) # 'spam'" msgstr "" +#: ../../library/contextvars.rst:274 msgid "Return a shallow copy of the context object." msgstr "" -msgid "Return ``True`` if the *context* has a value for *var* set; return ``False`` otherwise." +#: ../../library/contextvars.rst:278 +msgid "" +"Return ``True`` if the *context* has a value for *var* set; return ``False`` " +"otherwise." msgstr "" -msgid "Return the value of the *var* :class:`ContextVar` variable. If the variable is not set in the context object, a :exc:`KeyError` is raised." +#: ../../library/contextvars.rst:283 +msgid "" +"Return the value of the *var* :class:`ContextVar` variable. If the variable " +"is not set in the context object, a :exc:`KeyError` is raised." msgstr "" -msgid "Return the value for *var* if *var* has the value in the context object. Return *default* otherwise. If *default* is not given, return ``None``." +#: ../../library/contextvars.rst:289 +msgid "" +"Return the value for *var* if *var* has the value in the context object. " +"Return *default* otherwise. If *default* is not given, return ``None``." msgstr "" +#: ../../library/contextvars.rst:295 msgid "Return an iterator over the variables stored in the context object." msgstr "" +#: ../../library/contextvars.rst:300 msgid "Return the number of variables set in the context object." msgstr "" +#: ../../library/contextvars.rst:304 msgid "Return a list of all variables in the context object." msgstr "" +#: ../../library/contextvars.rst:308 msgid "Return a list of all variables' values in the context object." msgstr "" -msgid "Return a list of 2-tuples containing all variables and their values in the context object." +#: ../../library/contextvars.rst:313 +msgid "" +"Return a list of 2-tuples containing all variables and their values in the " +"context object." msgstr "" +#: ../../library/contextvars.rst:318 msgid "asyncio support" msgstr "" -msgid "Context variables are natively supported in :mod:`asyncio` and are ready to be used without any extra configuration. For example, here is a simple echo server, that uses a context variable to make the address of a remote client available in the Task that handles that client::" +#: ../../library/contextvars.rst:320 +msgid "" +"Context variables are natively supported in :mod:`asyncio` and are ready to " +"be used without any extra configuration. For example, here is a simple echo " +"server, that uses a context variable to make the address of a remote client " +"available in the Task that handles that client::" msgstr "" +#: ../../library/contextvars.rst:326 msgid "" "import asyncio\n" "import contextvars\n" diff --git a/library/copy.po b/library/copy.po index 987fd692b..6f8c7bd5d 100644 --- a/library/copy.po +++ b/library/copy.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,98 +23,187 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/copy.rst:2 msgid ":mod:`!copy` --- Shallow and deep copy operations" msgstr "" +#: ../../library/copy.rst:7 msgid "**Source code:** :source:`Lib/copy.py`" msgstr "" -msgid "Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without changing the other. This module provides generic shallow and deep copy operations (explained below)." +#: ../../library/copy.rst:11 +msgid "" +"Assignment statements in Python do not copy objects, they create bindings " +"between a target and an object. For collections that are mutable or contain " +"mutable items, a copy is sometimes needed so one can change one copy without " +"changing the other. This module provides generic shallow and deep copy " +"operations (explained below)." msgstr "" +#: ../../library/copy.rst:18 msgid "Interface summary:" msgstr "" +#: ../../library/copy.rst:22 msgid "Return a shallow copy of *obj*." msgstr "" +#: ../../library/copy.rst:27 msgid "Return a deep copy of *obj*." msgstr "" -msgid "Creates a new object of the same type as *obj*, replacing fields with values from *changes*." +#: ../../library/copy.rst:32 +msgid "" +"Creates a new object of the same type as *obj*, replacing fields with values " +"from *changes*." msgstr "" +#: ../../library/copy.rst:40 msgid "Raised for module specific errors." msgstr "" -msgid "The difference between shallow and deep copying is only relevant for compound objects (objects that contain other objects, like lists or class instances):" +#: ../../library/copy.rst:44 +msgid "" +"The difference between shallow and deep copying is only relevant for " +"compound objects (objects that contain other objects, like lists or class " +"instances):" msgstr "" -msgid "A *shallow copy* constructs a new compound object and then (to the extent possible) inserts *references* into it to the objects found in the original." +#: ../../library/copy.rst:47 +msgid "" +"A *shallow copy* constructs a new compound object and then (to the extent " +"possible) inserts *references* into it to the objects found in the original." msgstr "" -msgid "A *deep copy* constructs a new compound object and then, recursively, inserts *copies* into it of the objects found in the original." +#: ../../library/copy.rst:50 +msgid "" +"A *deep copy* constructs a new compound object and then, recursively, " +"inserts *copies* into it of the objects found in the original." msgstr "" -msgid "Two problems often exist with deep copy operations that don't exist with shallow copy operations:" +#: ../../library/copy.rst:53 +msgid "" +"Two problems often exist with deep copy operations that don't exist with " +"shallow copy operations:" msgstr "" -msgid "Recursive objects (compound objects that, directly or indirectly, contain a reference to themselves) may cause a recursive loop." +#: ../../library/copy.rst:56 +msgid "" +"Recursive objects (compound objects that, directly or indirectly, contain a " +"reference to themselves) may cause a recursive loop." msgstr "" -msgid "Because deep copy copies everything it may copy too much, such as data which is intended to be shared between copies." +#: ../../library/copy.rst:59 +msgid "" +"Because deep copy copies everything it may copy too much, such as data which " +"is intended to be shared between copies." msgstr "" +#: ../../library/copy.rst:62 msgid "The :func:`deepcopy` function avoids these problems by:" msgstr "" -msgid "keeping a ``memo`` dictionary of objects already copied during the current copying pass; and" +#: ../../library/copy.rst:64 +msgid "" +"keeping a ``memo`` dictionary of objects already copied during the current " +"copying pass; and" msgstr "" -msgid "letting user-defined classes override the copying operation or the set of components copied." +#: ../../library/copy.rst:67 +msgid "" +"letting user-defined classes override the copying operation or the set of " +"components copied." msgstr "" -msgid "This module does not copy types like module, method, stack trace, stack frame, file, socket, window, or any similar types. It does \"copy\" functions and classes (shallow and deeply), by returning the original object unchanged; this is compatible with the way these are treated by the :mod:`pickle` module." +#: ../../library/copy.rst:70 +msgid "" +"This module does not copy types like module, method, stack trace, stack " +"frame, file, socket, window, or any similar types. It does \"copy\" " +"functions and classes (shallow and deeply), by returning the original object " +"unchanged; this is compatible with the way these are treated by " +"the :mod:`pickle` module." msgstr "" -msgid "Shallow copies of many collections can be made using the corresponding :meth:`!copy` method (such as :meth:`list.copy`, :meth:`dict.copy` or :meth:`set.copy`), and of sequences (such as lists or bytearrays) by making a slice of the entire sequence (``sequence[:]``). However, these methods and slicing can create an instance of the base type when copying an instance of a subclass, whereas :func:`copy.copy` normally returns an instance of the same type." +#: ../../library/copy.rst:75 +msgid "" +"Shallow copies of many collections can be made using the " +"corresponding :meth:`!copy` method (such " +"as :meth:`list.copy`, :meth:`dict.copy` or :meth:`set.copy`), and of " +"sequences (such as lists or bytearrays) by making a slice of the entire " +"sequence (``sequence[:]``). However, these methods and slicing can create an " +"instance of the base type when copying an instance of a subclass, " +"whereas :func:`copy.copy` normally returns an instance of the same type." msgstr "" -msgid "Classes can use the same interfaces to control copying that they use to control pickling. See the description of module :mod:`pickle` for information on these methods. In fact, the :mod:`!copy` module uses the registered pickle functions from the :mod:`copyreg` module." +#: ../../library/copy.rst:85 +msgid "" +"Classes can use the same interfaces to control copying that they use to " +"control pickling. See the description of module :mod:`pickle` for " +"information on these methods. In fact, the :mod:`!copy` module uses the " +"registered pickle functions from the :mod:`copyreg` module." msgstr "" -msgid "In order for a class to define its own copy implementation, it can define special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`." +#: ../../library/copy.rst:96 +msgid "" +"In order for a class to define its own copy implementation, it can define " +"special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`." msgstr "" -msgid "Called to implement the shallow copy operation; no additional arguments are passed." +#: ../../library/copy.rst:102 +msgid "" +"Called to implement the shallow copy operation; no additional arguments are " +"passed." msgstr "" -msgid "Called to implement the deep copy operation; it is passed one argument, the *memo* dictionary. If the ``__deepcopy__`` implementation needs to make a deep copy of a component, it should call the :func:`~copy.deepcopy` function with the component as first argument and the *memo* dictionary as second argument. The *memo* dictionary should be treated as an opaque object." +#: ../../library/copy.rst:108 +msgid "" +"Called to implement the deep copy operation; it is passed one argument, the " +"*memo* dictionary. If the ``__deepcopy__`` implementation needs to make a " +"deep copy of a component, it should call the :func:`~copy.deepcopy` function " +"with the component as first argument and the *memo* dictionary as second " +"argument. The *memo* dictionary should be treated as an opaque object." msgstr "" -msgid "Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :func:`~copy.deepcopy`, and only supports named tuples created by :func:`~collections.namedtuple`, :mod:`dataclasses`, and other classes which define method :meth:`~object.__replace__`." +#: ../../library/copy.rst:118 +msgid "" +"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` " +"and :func:`~copy.deepcopy`, and only supports named tuples created " +"by :func:`~collections.namedtuple`, :mod:`dataclasses`, and other classes " +"which define method :meth:`~object.__replace__`." msgstr "" -msgid "This method should create a new object of the same type, replacing fields with values from *changes*." +#: ../../library/copy.rst:126 +msgid "" +"This method should create a new object of the same type, replacing fields " +"with values from *changes*." msgstr "" +#: ../../library/copy.rst:134 msgid "Module :mod:`pickle`" msgstr "" -msgid "Discussion of the special methods used to support object state retrieval and restoration." +#: ../../library/copy.rst:135 +msgid "" +"Discussion of the special methods used to support object state retrieval and " +"restoration." msgstr "" +#: ../../library/copy.rst:83 msgid "module" msgstr "" +#: ../../library/copy.rst:83 msgid "pickle" msgstr "" +#: ../../library/copy.rst:90 msgid "__copy__() (copy protocol)" msgstr "" +#: ../../library/copy.rst:90 msgid "__deepcopy__() (copy protocol)" msgstr "" +#: ../../library/copy.rst:115 msgid "__replace__() (replace protocol)" msgstr "" diff --git a/library/copyreg.po b/library/copyreg.po index b8c95f98c..e0038c44d 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,38 +24,69 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/copyreg.rst:2 msgid ":mod:`!copyreg` --- Register :mod:`!pickle` support functions" msgstr "" +#: ../../library/copyreg.rst:7 msgid "**Source code:** :source:`Lib/copyreg.py`" msgstr "" -msgid "The :mod:`!copyreg` module offers a way to define functions used while pickling specific objects. The :mod:`pickle` and :mod:`copy` modules use those functions when pickling/copying those objects. The module provides configuration information about object constructors which are not classes. Such constructors may be factory functions or class instances." +#: ../../library/copyreg.rst:15 +msgid "" +"The :mod:`!copyreg` module offers a way to define functions used while " +"pickling specific objects. The :mod:`pickle` and :mod:`copy` modules use " +"those functions when pickling/copying those objects. The module provides " +"configuration information about object constructors which are not classes. " +"Such constructors may be factory functions or class instances." msgstr "" -msgid "Declares *object* to be a valid constructor. If *object* is not callable (and hence not valid as a constructor), raises :exc:`TypeError`." +#: ../../library/copyreg.rst:24 +msgid "" +"Declares *object* to be a valid constructor. If *object* is not callable " +"(and hence not valid as a constructor), raises :exc:`TypeError`." msgstr "" -msgid "Declares that *function* should be used as a \"reduction\" function for objects of type *type*. *function* must return either a string or a tuple containing between two and six elements. See the :attr:`~pickle.Pickler.dispatch_table` for more details on the interface of *function*." +#: ../../library/copyreg.rst:30 +msgid "" +"Declares that *function* should be used as a \"reduction\" function for " +"objects of type *type*. *function* must return either a string or a tuple " +"containing between two and six elements. See " +"the :attr:`~pickle.Pickler.dispatch_table` for more details on the interface " +"of *function*." msgstr "" -msgid "The *constructor_ob* parameter is a legacy feature and is now ignored, but if passed it must be a callable." +#: ../../library/copyreg.rst:35 +msgid "" +"The *constructor_ob* parameter is a legacy feature and is now ignored, but " +"if passed it must be a callable." msgstr "" -msgid "Note that the :attr:`~pickle.Pickler.dispatch_table` attribute of a pickler object or subclass of :class:`pickle.Pickler` can also be used for declaring reduction functions." +#: ../../library/copyreg.rst:38 +msgid "" +"Note that the :attr:`~pickle.Pickler.dispatch_table` attribute of a pickler " +"object or subclass of :class:`pickle.Pickler` can also be used for declaring " +"reduction functions." msgstr "" +#: ../../library/copyreg.rst:43 msgid "Example" msgstr "" -msgid "The example below would like to show how to register a pickle function and how it will be used:" +#: ../../library/copyreg.rst:45 +msgid "" +"The example below would like to show how to register a pickle function and " +"how it will be used:" msgstr "" +#: ../../library/copyreg.rst:9 msgid "module" msgstr "" +#: ../../library/copyreg.rst:9 msgid "pickle" msgstr "" +#: ../../library/copyreg.rst:9 msgid "copy" msgstr "" diff --git a/library/crypt.po b/library/crypt.po index cb2567216..650ab00d2 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,27 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/crypt.rst:2 msgid ":mod:`!crypt` --- Function to check Unix passwords" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.13 ` after being deprecated in Python 3.11. The removal was decided in :pep:`594`." +#: ../../library/crypt.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.13 ` after being " +"deprecated in Python 3.11. The removal was decided in :pep:`594`." msgstr "" -msgid "Applications can use the :mod:`hashlib` module from the standard library. Other possible replacements are third-party libraries from PyPI: :pypi:`legacycrypt`, :pypi:`bcrypt`, or :pypi:`argon2-cffi`. These are not supported or maintained by the Python core team." +#: ../../library/crypt.rst:14 +msgid "" +"Applications can use the :mod:`hashlib` module from the standard library. " +"Other possible replacements are third-party libraries from " +"PyPI: :pypi:`legacycrypt`, :pypi:`bcrypt`, or :pypi:`argon2-cffi`. These are " +"not supported or maintained by the Python core team." msgstr "" -msgid "The last version of Python that provided the :mod:`!crypt` module was `Python 3.12 `_." +#: ../../library/crypt.rst:19 +msgid "" +"The last version of Python that provided the :mod:`!crypt` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/crypto.po b/library/crypto.po index 93048df0a..415bfeb5b 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,17 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/crypto.rst:5 msgid "Cryptographic Services" msgstr "" -msgid "The modules described in this chapter implement various algorithms of a cryptographic nature. They are available at the discretion of the installation. Here's an overview:" +#: ../../library/crypto.rst:9 +msgid "" +"The modules described in this chapter implement various algorithms of a " +"cryptographic nature. They are available at the discretion of the " +"installation. Here's an overview:" msgstr "" +#: ../../library/crypto.rst:7 msgid "cryptography" msgstr "" diff --git a/library/csv.po b/library/csv.po index 9c38ae8e6..7a2ca3858 100644 --- a/library/csv.po +++ b/library/csv.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,42 +24,90 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/csv.rst:2 msgid ":mod:`!csv` --- CSV File Reading and Writing" msgstr "" +#: ../../library/csv.rst:9 msgid "**Source code:** :source:`Lib/csv.py`" msgstr "" -msgid "The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in :rfc:`4180`. The lack of a well-defined standard means that subtle differences often exist in the data produced and consumed by different applications. These differences can make it annoying to process CSV files from multiple sources. Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer." -msgstr "" - -msgid "The :mod:`!csv` module implements classes to read and write tabular data in CSV format. It allows programmers to say, \"write this data in the format preferred by Excel,\" or \"read data from this file which was generated by Excel,\" without knowing the precise details of the CSV format used by Excel. Programmers can also describe the CSV formats understood by other applications or define their own special-purpose CSV formats." +#: ../../library/csv.rst:17 +msgid "" +"The so-called CSV (Comma Separated Values) format is the most common import " +"and export format for spreadsheets and databases. CSV format was used for " +"many years prior to attempts to describe the format in a standardized way " +"in :rfc:`4180`. The lack of a well-defined standard means that subtle " +"differences often exist in the data produced and consumed by different " +"applications. These differences can make it annoying to process CSV files " +"from multiple sources. Still, while the delimiters and quoting characters " +"vary, the overall format is similar enough that it is possible to write a " +"single module which can efficiently manipulate such data, hiding the details " +"of reading and writing the data from the programmer." +msgstr "" + +#: ../../library/csv.rst:28 +msgid "" +"The :mod:`!csv` module implements classes to read and write tabular data in " +"CSV format. It allows programmers to say, \"write this data in the format " +"preferred by Excel,\" or \"read data from this file which was generated by " +"Excel,\" without knowing the precise details of the CSV format used by " +"Excel. Programmers can also describe the CSV formats understood by other " +"applications or define their own special-purpose CSV formats." msgstr "" -msgid "The :mod:`!csv` module's :class:`reader` and :class:`writer` objects read and write sequences. Programmers can also read and write data in dictionary form using the :class:`DictReader` and :class:`DictWriter` classes." +#: ../../library/csv.rst:35 +msgid "" +"The :mod:`!csv` module's :class:`reader` and :class:`writer` objects read " +"and write sequences. Programmers can also read and write data in dictionary " +"form using the :class:`DictReader` and :class:`DictWriter` classes." msgstr "" +#: ../../library/csv.rst:41 msgid ":pep:`305` - CSV File API" msgstr "" +#: ../../library/csv.rst:42 msgid "The Python Enhancement Proposal which proposed this addition to Python." msgstr "" +#: ../../library/csv.rst:48 msgid "Module Contents" msgstr "" +#: ../../library/csv.rst:50 msgid "The :mod:`!csv` module defines the following functions:" msgstr "" -msgid "Return a :ref:`reader object ` that will process lines from the given *csvfile*. A csvfile must be an iterable of strings, each in the reader's defined csv format. A csvfile is most commonly a file-like object or list. If *csvfile* is a file object, it should be opened with ``newline=''``. [1]_ An optional *dialect* parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the :class:`Dialect` class or one of the strings returned by the :func:`list_dialects` function. The other optional *fmtparams* keyword arguments can be given to override individual formatting parameters in the current dialect. For full details about the dialect and formatting parameters, see section :ref:`csv-fmt-params`." -msgstr "" - -msgid "Each row read from the csv file is returned as a list of strings. No automatic data type conversion is performed unless the :data:`QUOTE_NONNUMERIC` format option is specified (in which case unquoted fields are transformed into floats)." +#: ../../library/csv.rst:58 +msgid "" +"Return a :ref:`reader object ` that will process lines from " +"the given *csvfile*. A csvfile must be an iterable of strings, each in the " +"reader's defined csv format. A csvfile is most commonly a file-like object " +"or list. If *csvfile* is a file object, it should be opened with " +"``newline=''``. [1]_ An optional *dialect* parameter can be given which is " +"used to define a set of parameters specific to a particular CSV dialect. It " +"may be an instance of a subclass of the :class:`Dialect` class or one of the " +"strings returned by the :func:`list_dialects` function. The other optional " +"*fmtparams* keyword arguments can be given to override individual formatting " +"parameters in the current dialect. For full details about the dialect and " +"formatting parameters, see section :ref:`csv-fmt-params`." +msgstr "" + +#: ../../library/csv.rst:72 +msgid "" +"Each row read from the csv file is returned as a list of strings. No " +"automatic data type conversion is performed unless " +"the :data:`QUOTE_NONNUMERIC` format option is specified (in which case " +"unquoted fields are transformed into floats)." msgstr "" +#: ../../library/csv.rst:76 ../../library/csv.rst:113 ../../library/csv.rst:196 +#: ../../library/csv.rst:242 msgid "A short usage example::" msgstr "" +#: ../../library/csv.rst:78 msgid "" ">>> import csv\n" ">>> with open('eggs.csv', newline='') as csvfile:\n" @@ -70,9 +118,37 @@ msgid "" "Spam, Lovely Spam, Wonderful Spam" msgstr "" -msgid "Return a writer object responsible for converting the user's data into delimited strings on the given file-like object. *csvfile* can be any object with a :meth:`~io.TextIOBase.write` method. If *csvfile* is a file object, it should be opened with ``newline=''`` [1]_. An optional *dialect* parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the :class:`Dialect` class or one of the strings returned by the :func:`list_dialects` function. The other optional *fmtparams* keyword arguments can be given to override individual formatting parameters in the current dialect. For full details about dialects and formatting parameters, see the :ref:`csv-fmt-params` section. To make it as easy as possible to interface with modules which implement the DB API, the value :const:`None` is written as the empty string. While this isn't a reversible transformation, it makes it easier to dump SQL NULL data values to CSV files without preprocessing the data returned from a ``cursor.fetch*`` call. All other non-string data are stringified with :func:`str` before being written." +#: ../../library/csv.rst:86 +msgid "where :file:`eggs.csv` contains:" +msgstr "" + +#: ../../library/csv.rst:88 ../../library/csv.rst:124 +msgid "" +"Spam Spam Spam Spam Spam |Baked Beans|\n" +"Spam |Lovely Spam| |Wonderful Spam|" msgstr "" +#: ../../library/csv.rst:96 +msgid "" +"Return a writer object responsible for converting the user's data into " +"delimited strings on the given file-like object. *csvfile* can be any " +"object with a :meth:`~io.TextIOBase.write` method. If *csvfile* is a file " +"object, it should be opened with ``newline=''`` [1]_. An optional *dialect* " +"parameter can be given which is used to define a set of parameters specific " +"to a particular CSV dialect. It may be an instance of a subclass of " +"the :class:`Dialect` class or one of the strings returned by " +"the :func:`list_dialects` function. The other optional *fmtparams* keyword " +"arguments can be given to override individual formatting parameters in the " +"current dialect. For full details about dialects and formatting parameters, " +"see the :ref:`csv-fmt-params` section. To make it as easy as possible to " +"interface with modules which implement the DB API, the value :const:`None` " +"is written as the empty string. While this isn't a reversible " +"transformation, it makes it easier to dump SQL NULL data values to CSV files " +"without preprocessing the data returned from a ``cursor.fetch*`` call. All " +"other non-string data are stringified with :func:`str` before being written." +msgstr "" + +#: ../../library/csv.rst:115 msgid "" "import csv\n" "with open('eggs.csv', 'w', newline='') as csvfile:\n" @@ -82,45 +158,93 @@ msgid "" " spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" msgstr "" -msgid "Associate *dialect* with *name*. *name* must be a string. The dialect can be specified either by passing a sub-class of :class:`Dialect`, or by *fmtparams* keyword arguments, or both, with keyword arguments overriding parameters of the dialect. For full details about dialects and formatting parameters, see section :ref:`csv-fmt-params`." +#: ../../library/csv.rst:122 +msgid "which writes :file:`eggs.csv` containing:" msgstr "" -msgid "Delete the dialect associated with *name* from the dialect registry. An :exc:`Error` is raised if *name* is not a registered dialect name." +#: ../../library/csv.rst:132 +msgid "" +"Associate *dialect* with *name*. *name* must be a string. The dialect can " +"be specified either by passing a sub-class of :class:`Dialect`, or by " +"*fmtparams* keyword arguments, or both, with keyword arguments overriding " +"parameters of the dialect. For full details about dialects and formatting " +"parameters, see section :ref:`csv-fmt-params`." msgstr "" -msgid "Return the dialect associated with *name*. An :exc:`Error` is raised if *name* is not a registered dialect name. This function returns an immutable :class:`Dialect`." +#: ../../library/csv.rst:141 +msgid "" +"Delete the dialect associated with *name* from the dialect registry. " +"An :exc:`Error` is raised if *name* is not a registered dialect name." msgstr "" +#: ../../library/csv.rst:147 +msgid "" +"Return the dialect associated with *name*. An :exc:`Error` is raised if " +"*name* is not a registered dialect name. This function returns an " +"immutable :class:`Dialect`." +msgstr "" + +#: ../../library/csv.rst:153 msgid "Return the names of all registered dialects." msgstr "" -msgid "Returns the current maximum field size allowed by the parser. If *new_limit* is given, this becomes the new limit." +#: ../../library/csv.rst:159 +msgid "" +"Returns the current maximum field size allowed by the parser. If *new_limit* " +"is given, this becomes the new limit." msgstr "" +#: ../../library/csv.rst:163 msgid "The :mod:`!csv` module defines the following classes:" msgstr "" -msgid "Create an object that operates like a regular reader but maps the information in each row to a :class:`dict` whose keys are given by the optional *fieldnames* parameter." +#: ../../library/csv.rst:168 +msgid "" +"Create an object that operates like a regular reader but maps the " +"information in each row to a :class:`dict` whose keys are given by the " +"optional *fieldnames* parameter." msgstr "" -msgid "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is omitted, the values in the first row of file *f* will be used as the fieldnames and will be omitted from the results. If *fieldnames* is provided, they will be used and the first row will be included in the results. Regardless of how the fieldnames are determined, the dictionary preserves their original ordering." +#: ../../library/csv.rst:172 +msgid "" +"The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " +"omitted, the values in the first row of file *f* will be used as the " +"fieldnames and will be omitted from the results. If *fieldnames* is " +"provided, they will be used and the first row will be included in the " +"results. Regardless of how the fieldnames are determined, the dictionary " +"preserves their original ordering." msgstr "" -msgid "If a row has more fields than fieldnames, the remaining data is put in a list and stored with the fieldname specified by *restkey* (which defaults to ``None``). If a non-blank row has fewer fields than fieldnames, the missing values are filled-in with the value of *restval* (which defaults to ``None``)." +#: ../../library/csv.rst:179 +msgid "" +"If a row has more fields than fieldnames, the remaining data is put in a " +"list and stored with the fieldname specified by *restkey* (which defaults to " +"``None``). If a non-blank row has fewer fields than fieldnames, the missing " +"values are filled-in with the value of *restval* (which defaults to " +"``None``)." msgstr "" -msgid "All other optional or keyword arguments are passed to the underlying :class:`reader` instance." +#: ../../library/csv.rst:185 +msgid "" +"All other optional or keyword arguments are passed to the " +"underlying :class:`reader` instance." msgstr "" -msgid "If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`." +#: ../../library/csv.rst:188 ../../library/csv.rst:240 +msgid "" +"If the argument passed to *fieldnames* is an iterator, it will be coerced to " +"a :class:`list`." msgstr "" +#: ../../library/csv.rst:190 msgid "Returned rows are now of type :class:`OrderedDict`." msgstr "" +#: ../../library/csv.rst:193 msgid "Returned rows are now of type :class:`dict`." msgstr "" +#: ../../library/csv.rst:198 msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" @@ -135,12 +259,40 @@ msgid "" "{'first_name': 'John', 'last_name': 'Cleese'}" msgstr "" -msgid "Create an object which operates like a regular writer but maps dictionaries onto output rows. The *fieldnames* parameter is a :mod:`sequence ` of keys that identify the order in which values in the dictionary passed to the :meth:`~csvwriter.writerow` method are written to file *f*. The optional *restval* parameter specifies the value to be written if the dictionary is missing a key in *fieldnames*. If the dictionary passed to the :meth:`~csvwriter.writerow` method contains a key not found in *fieldnames*, the optional *extrasaction* parameter indicates what action to take. If it is set to ``'raise'``, the default value, a :exc:`ValueError` is raised. If it is set to ``'ignore'``, extra values in the dictionary are ignored. Any other optional or keyword arguments are passed to the underlying :class:`writer` instance." +#: ../../library/csv.rst:210 +msgid "where :file:`names.csv` contains:" msgstr "" -msgid "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter of the :class:`DictWriter` class is not optional." +#: ../../library/csv.rst:212 +msgid "" +"first_name,last_name\n" +"Eric,Idle\n" +"John,Cleese" msgstr "" +#: ../../library/csv.rst:222 +msgid "" +"Create an object which operates like a regular writer but maps dictionaries " +"onto output rows. The *fieldnames* parameter is a :mod:`sequence " +"` of keys that identify the order in which values in the " +"dictionary passed to the :meth:`~csvwriter.writerow` method are written to " +"file *f*. The optional *restval* parameter specifies the value to be " +"written if the dictionary is missing a key in *fieldnames*. If the " +"dictionary passed to the :meth:`~csvwriter.writerow` method contains a key " +"not found in *fieldnames*, the optional *extrasaction* parameter indicates " +"what action to take. If it is set to ``'raise'``, the default value, " +"a :exc:`ValueError` is raised. If it is set to ``'ignore'``, extra values in " +"the dictionary are ignored. Any other optional or keyword arguments are " +"passed to the underlying :class:`writer` instance." +msgstr "" + +#: ../../library/csv.rst:237 +msgid "" +"Note that unlike the :class:`DictReader` class, the *fieldnames* parameter " +"of the :class:`DictWriter` class is not optional." +msgstr "" + +#: ../../library/csv.rst:244 msgid "" "import csv\n" "\n" @@ -154,12 +306,35 @@ msgid "" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" msgstr "" -msgid "The :class:`Dialect` class is a container class whose attributes contain information for how to handle doublequotes, whitespace, delimiters, etc. Due to the lack of a strict CSV specification, different applications produce subtly different CSV data. :class:`Dialect` instances define how :class:`reader` and :class:`writer` instances behave." +#: ../../library/csv.rst:255 +msgid "which writes :file:`names.csv` containing:" msgstr "" -msgid "All available :class:`Dialect` names are returned by :func:`list_dialects`, and they can be registered with specific :class:`reader` and :class:`writer` classes through their initializer (``__init__``) functions like this::" +#: ../../library/csv.rst:257 +msgid "" +"first_name,last_name\n" +"Baked,Beans\n" +"Lovely,Spam\n" +"Wonderful,Spam" +msgstr "" + +#: ../../library/csv.rst:267 +msgid "" +"The :class:`Dialect` class is a container class whose attributes contain " +"information for how to handle doublequotes, whitespace, delimiters, etc. Due " +"to the lack of a strict CSV specification, different applications produce " +"subtly different CSV data. :class:`Dialect` instances define " +"how :class:`reader` and :class:`writer` instances behave." msgstr "" +#: ../../library/csv.rst:273 +msgid "" +"All available :class:`Dialect` names are returned by :func:`list_dialects`, " +"and they can be registered with specific :class:`reader` and :class:`writer` " +"classes through their initializer (``__init__``) functions like this::" +msgstr "" + +#: ../../library/csv.rst:277 msgid "" "import csv\n" "\n" @@ -167,42 +342,84 @@ msgid "" " writer = csv.writer(csvfile, dialect='unix')" msgstr "" -msgid "The :class:`excel` class defines the usual properties of an Excel-generated CSV file. It is registered with the dialect name ``'excel'``." +#: ../../library/csv.rst:285 +msgid "" +"The :class:`excel` class defines the usual properties of an Excel-generated " +"CSV file. It is registered with the dialect name ``'excel'``." msgstr "" -msgid "The :class:`excel_tab` class defines the usual properties of an Excel-generated TAB-delimited file. It is registered with the dialect name ``'excel-tab'``." +#: ../../library/csv.rst:291 +msgid "" +"The :class:`excel_tab` class defines the usual properties of an Excel-" +"generated TAB-delimited file. It is registered with the dialect name " +"``'excel-tab'``." msgstr "" -msgid "The :class:`unix_dialect` class defines the usual properties of a CSV file generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and quoting all fields. It is registered with the dialect name ``'unix'``." +#: ../../library/csv.rst:297 +msgid "" +"The :class:`unix_dialect` class defines the usual properties of a CSV file " +"generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and " +"quoting all fields. It is registered with the dialect name ``'unix'``." msgstr "" +#: ../../library/csv.rst:306 msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "" +#: ../../library/csv.rst:308 msgid "The :class:`Sniffer` class provides two methods:" msgstr "" -msgid "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting the parameters found. If the optional *delimiters* parameter is given, it is interpreted as a string containing possible valid delimiter characters." +#: ../../library/csv.rst:312 +msgid "" +"Analyze the given *sample* and return a :class:`Dialect` subclass reflecting " +"the parameters found. If the optional *delimiters* parameter is given, it " +"is interpreted as a string containing possible valid delimiter characters." msgstr "" -msgid "Analyze the sample text (presumed to be in CSV format) and return :const:`True` if the first row appears to be a series of column headers. Inspecting each column, one of two key criteria will be considered to estimate if the sample contains a header:" +#: ../../library/csv.rst:317 +msgid "" +"If several delimiters fit the sample equally well --- for example if both " +"``','`` and ``';'`` split every row consistently --- the delimiters ``','``, " +"``'\\t'``, ``';'``, ``' '`` and ``':'`` are preferred, in this order, no " +"matter how many times each of them occurs." msgstr "" +#: ../../library/csv.rst:325 +msgid "" +"Analyze the sample text (presumed to be in CSV format) and " +"return :const:`True` if the first row appears to be a series of column " +"headers. Inspecting each column, one of two key criteria will be considered " +"to estimate if the sample contains a header:" +msgstr "" + +#: ../../library/csv.rst:330 msgid "the second through n-th rows contain numeric values" msgstr "" -msgid "the second through n-th rows contain strings where at least one value's length differs from that of the putative header of that column." +#: ../../library/csv.rst:331 +msgid "" +"the second through n-th rows contain strings where at least one value's " +"length differs from that of the putative header of that column." msgstr "" -msgid "Twenty-one rows after the header are sampled; if more than half of the columns + rows meet the criteria, :const:`True` is returned." +#: ../../library/csv.rst:334 +msgid "" +"Twenty-one rows after the header are sampled; if more than half of the " +"columns + rows meet the criteria, :const:`True` is returned." msgstr "" -msgid "This method is a rough heuristic and may produce both false positives and negatives." +#: ../../library/csv.rst:339 +msgid "" +"This method is a rough heuristic and may produce both false positives and " +"negatives." msgstr "" +#: ../../library/csv.rst:342 msgid "An example for :class:`Sniffer` use::" msgstr "" +#: ../../library/csv.rst:344 msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" @@ -211,165 +428,317 @@ msgid "" " # ... process CSV file contents here ..." msgstr "" +#: ../../library/csv.rst:353 msgid "The :mod:`!csv` module defines the following constants:" msgstr "" +#: ../../library/csv.rst:357 msgid "Instructs :class:`writer` objects to quote all fields." msgstr "" -msgid "Instructs :class:`writer` objects to only quote those fields which contain special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or any of the characters in *lineterminator*." +#: ../../library/csv.rst:362 +msgid "" +"Instructs :class:`writer` objects to only quote those fields which contain " +"special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or " +"any of the characters in *lineterminator*." msgstr "" +#: ../../library/csv.rst:369 msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "" -msgid "Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`." +#: ../../library/csv.rst:371 +msgid "" +"Instructs :class:`reader` objects to convert all non-quoted fields to " +"type :class:`float`." msgstr "" -msgid "Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :class:`~enum.IntEnum`, have a string representation that cannot be converted to :class:`float`. They cannot be read in the :data:`QUOTE_NONNUMERIC` and :data:`QUOTE_STRINGS` modes." +#: ../../library/csv.rst:374 +msgid "" +"Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, " +"or :class:`~enum.IntEnum`, have a string representation that cannot be " +"converted to :class:`float`. They cannot be read in " +"the :data:`QUOTE_NONNUMERIC` and :data:`QUOTE_STRINGS` modes." msgstr "" -msgid "Instructs :class:`writer` objects to never quote fields. When the current *delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the characters in *lineterminator* occurs in output data it is preceded by the current *escapechar* character. If *escapechar* is not set, the writer will raise :exc:`Error` if any characters that require escaping are encountered. Set *quotechar* to ``None`` to prevent its escaping." +#: ../../library/csv.rst:382 +msgid "" +"Instructs :class:`writer` objects to never quote fields. When the current " +"*delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the " +"characters in *lineterminator* occurs in output data it is preceded by the " +"current *escapechar* character. If *escapechar* is not set, the writer will " +"raise :exc:`Error` if any characters that require escaping are encountered. " +"Set *quotechar* to ``None`` to prevent its escaping." msgstr "" -msgid "Instructs :class:`reader` objects to perform no special processing of quote characters." +#: ../../library/csv.rst:390 +msgid "" +"Instructs :class:`reader` objects to perform no special processing of quote " +"characters." msgstr "" -msgid "Instructs :class:`writer` objects to quote all fields which are not ``None``. This is similar to :data:`QUOTE_ALL`, except that if a field value is ``None`` an empty (unquoted) string is written." +#: ../../library/csv.rst:394 +msgid "" +"Instructs :class:`writer` objects to quote all fields which are not " +"``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " +"value is ``None`` an empty (unquoted) string is written." msgstr "" -msgid "Instructs :class:`reader` objects to interpret an empty (unquoted) field as ``None`` and to otherwise behave as :data:`QUOTE_ALL`." +#: ../../library/csv.rst:398 +msgid "" +"Instructs :class:`reader` objects to interpret an empty (unquoted) field as " +"``None`` and to otherwise behave as :data:`QUOTE_ALL`." msgstr "" -msgid "Instructs :class:`writer` objects to always place quotes around fields which are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a field value is ``None`` an empty (unquoted) string is written." +#: ../../library/csv.rst:405 +msgid "" +"Instructs :class:`writer` objects to always place quotes around fields which " +"are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " +"field value is ``None`` an empty (unquoted) string is written." msgstr "" -msgid "Instructs :class:`reader` objects to interpret an empty (unquoted) string as ``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." +#: ../../library/csv.rst:409 +msgid "" +"Instructs :class:`reader` objects to interpret an empty (unquoted) string as " +"``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." msgstr "" +#: ../../library/csv.rst:414 msgid "The :mod:`!csv` module defines the following exception:" msgstr "" +#: ../../library/csv.rst:419 msgid "Raised by any of the functions when an error is detected." msgstr "" +#: ../../library/csv.rst:424 msgid "Dialects and Formatting Parameters" msgstr "" -msgid "To make it easier to specify the format of input and output records, specific formatting parameters are grouped together into dialects. A dialect is a subclass of the :class:`Dialect` class containing various attributes describing the format of the CSV file. When creating :class:`reader` or :class:`writer` objects, the programmer can specify a string or a subclass of the :class:`Dialect` class as the dialect parameter. In addition to, or instead of, the *dialect* parameter, the programmer can also specify individual formatting parameters, which have the same names as the attributes defined below for the :class:`Dialect` class." -msgstr "" - +#: ../../library/csv.rst:426 +msgid "" +"To make it easier to specify the format of input and output records, " +"specific formatting parameters are grouped together into dialects. A " +"dialect is a subclass of the :class:`Dialect` class containing various " +"attributes describing the format of the CSV file. When " +"creating :class:`reader` or :class:`writer` objects, the programmer can " +"specify a string or a subclass of the :class:`Dialect` class as the dialect " +"parameter. In addition to, or instead of, the *dialect* parameter, the " +"programmer can also specify individual formatting parameters, which have the " +"same names as the attributes defined below for the :class:`Dialect` class." +msgstr "" + +#: ../../library/csv.rst:436 msgid "Dialects support the following attributes:" msgstr "" -msgid "A one-character string used to separate fields. It defaults to ``','``." +#: ../../library/csv.rst:441 +msgid "" +"A one-character string used to separate fields. It defaults to ``','``." msgstr "" -msgid "Controls how instances of *quotechar* appearing inside a field should themselves be quoted. When :const:`True`, the character is doubled. When :const:`False`, the *escapechar* is used as a prefix to the *quotechar*. It defaults to :const:`True`." +#: ../../library/csv.rst:446 +msgid "" +"Controls how instances of *quotechar* appearing inside a field should " +"themselves be quoted. When :const:`True`, the character is doubled. " +"When :const:`False`, the *escapechar* is used as a prefix to the " +"*quotechar*. It defaults to :const:`True`." msgstr "" -msgid "On output, if *doublequote* is :const:`False` and no *escapechar* is set, :exc:`Error` is raised if a *quotechar* is found in a field." +#: ../../library/csv.rst:451 +msgid "" +"On output, if *doublequote* is :const:`False` and no *escapechar* is " +"set, :exc:`Error` is raised if a *quotechar* is found in a field." msgstr "" -msgid "A one-character string used by the writer to escape characters that require escaping:" +#: ../../library/csv.rst:457 +msgid "" +"A one-character string used by the writer to escape characters that require " +"escaping:" msgstr "" -msgid "the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the characters in *lineterminator* are escaped if *quoting* is set to :const:`QUOTE_NONE`;" +#: ../../library/csv.rst:460 +msgid "" +"the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " +"characters in *lineterminator* are escaped if *quoting* is set " +"to :const:`QUOTE_NONE`;" msgstr "" +#: ../../library/csv.rst:463 msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" msgstr "" +#: ../../library/csv.rst:464 msgid "the *escapechar* itself." msgstr "" -msgid "On reading, the *escapechar* removes any special meaning from the following character. It defaults to :const:`None`, which disables escaping." +#: ../../library/csv.rst:466 +msgid "" +"On reading, the *escapechar* removes any special meaning from the following " +"character. It defaults to :const:`None`, which disables escaping." msgstr "" +#: ../../library/csv.rst:469 msgid "An empty *escapechar* is not allowed." msgstr "" -msgid "The string used to terminate lines produced by the :class:`writer`. It defaults to ``'\\r\\n'``." +#: ../../library/csv.rst:474 +msgid "" +"The string used to terminate lines produced by the :class:`writer`. It " +"defaults to ``'\\r\\n'``." msgstr "" -msgid "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` as end-of-line, and ignores *lineterminator*. This behavior may change in the future." +#: ../../library/csv.rst:479 +msgid "" +"The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " +"as end-of-line, and ignores *lineterminator*. This behavior may change in " +"the future." msgstr "" -msgid "A one-character string used to quote fields containing special characters, such as the *delimiter* or the *quotechar*, or which contain new-line characters (``'\\r'``, ``'\\n'`` or any of the characters in *lineterminator*). It defaults to ``'\"'``. Can be set to ``None`` to prevent escaping ``'\"'`` if *quoting* is set to :const:`QUOTE_NONE`." +#: ../../library/csv.rst:486 +msgid "" +"A one-character string used to quote fields containing special characters, " +"such as the *delimiter* or the *quotechar*, or which contain new-line " +"characters (``'\\r'``, ``'\\n'`` or any of the characters in " +"*lineterminator*). It defaults to ``'\"'``. Can be set to ``None`` to " +"prevent escaping ``'\"'`` if *quoting* is set to :const:`QUOTE_NONE`." msgstr "" +#: ../../library/csv.rst:493 msgid "An empty *quotechar* is not allowed." msgstr "" -msgid "Controls when quotes should be generated by the writer and recognised by the reader. It can take on any of the :ref:`QUOTE_\\* constants ` and defaults to :const:`QUOTE_MINIMAL` if *quotechar* is not ``None``, and :const:`QUOTE_NONE` otherwise." +#: ../../library/csv.rst:498 +msgid "" +"Controls when quotes should be generated by the writer and recognised by the " +"reader. It can take on any of the :ref:`QUOTE_\\* constants ` and defaults to :const:`QUOTE_MINIMAL` if *quotechar* is not " +"``None``, and :const:`QUOTE_NONE` otherwise." msgstr "" -msgid "When :const:`True`, spaces immediately following the *delimiter* are ignored. The default is :const:`False`. When combining ``delimiter=' '`` with ``skipinitialspace=True``, unquoted empty fields are not allowed." +#: ../../library/csv.rst:506 +msgid "" +"When :const:`True`, spaces immediately following the *delimiter* are " +"ignored. The default is :const:`False`. When combining ``delimiter=' '`` " +"with ``skipinitialspace=True``, unquoted empty fields are not allowed." msgstr "" -msgid "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is ``False``." +#: ../../library/csv.rst:513 +msgid "" +"When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " +"``False``." msgstr "" +#: ../../library/csv.rst:519 msgid "Reader Objects" msgstr "" -msgid "Reader objects (:class:`DictReader` instances and objects returned by the :func:`reader` function) have the following public methods:" +#: ../../library/csv.rst:521 +msgid "" +"Reader objects (:class:`DictReader` instances and objects returned by " +"the :func:`reader` function) have the following public methods:" msgstr "" -msgid "Return the next row of the reader's iterable object as a list (if the object was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` instance), parsed according to the current :class:`Dialect`. Usually you should call this as ``next(reader)``." +#: ../../library/csv.rst:526 +msgid "" +"Return the next row of the reader's iterable object as a list (if the object " +"was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " +"instance), parsed according to the current :class:`Dialect`. Usually you " +"should call this as ``next(reader)``." msgstr "" +#: ../../library/csv.rst:532 msgid "Reader objects have the following public attributes:" msgstr "" +#: ../../library/csv.rst:536 msgid "A read-only description of the dialect in use by the parser." msgstr "" -msgid "The number of lines read from the source iterator. This is not the same as the number of records returned, as records can span multiple lines." +#: ../../library/csv.rst:541 +msgid "" +"The number of lines read from the source iterator. This is not the same as " +"the number of records returned, as records can span multiple lines." msgstr "" +#: ../../library/csv.rst:545 msgid "DictReader objects have the following public attribute:" msgstr "" -msgid "If not passed as a parameter when creating the object, this attribute is initialized upon first access or when the first record is read from the file." +#: ../../library/csv.rst:549 +msgid "" +"If not passed as a parameter when creating the object, this attribute is " +"initialized upon first access or when the first record is read from the file." msgstr "" +#: ../../library/csv.rst:556 msgid "Writer Objects" msgstr "" -msgid ":class:`writer` objects (:class:`DictWriter` instances and objects returned by the :func:`writer` function) have the following public methods. A *row* must be an iterable of strings or numbers for :class:`writer` objects and a dictionary mapping fieldnames to strings or numbers (by passing them through :func:`str` first) for :class:`DictWriter` objects. Note that complex numbers are written out surrounded by parens. This may cause some problems for other programs which read CSV files (assuming they support complex numbers at all)." +#: ../../library/csv.rst:558 +msgid "" +":class:`writer` objects (:class:`DictWriter` instances and objects returned " +"by the :func:`writer` function) have the following public methods. A *row* " +"must be an iterable of strings or numbers for :class:`writer` objects and a " +"dictionary mapping fieldnames to strings or numbers (by passing them " +"through :func:`str` first) for :class:`DictWriter` objects. Note that " +"complex numbers are written out surrounded by parens. This may cause some " +"problems for other programs which read CSV files (assuming they support " +"complex numbers at all)." msgstr "" -msgid "Write the *row* parameter to the writer's file object, formatted according to the current :class:`Dialect`. Return the return value of the call to the *write* method of the underlying file object." +#: ../../library/csv.rst:569 +msgid "" +"Write the *row* parameter to the writer's file object, formatted according " +"to the current :class:`Dialect`. Return the return value of the call to the " +"*write* method of the underlying file object." msgstr "" +#: ../../library/csv.rst:573 msgid "Added support of arbitrary iterables." msgstr "" -msgid "Write all elements in *rows* (an iterable of *row* objects as described above) to the writer's file object, formatted according to the current dialect." +#: ../../library/csv.rst:578 +msgid "" +"Write all elements in *rows* (an iterable of *row* objects as described " +"above) to the writer's file object, formatted according to the current " +"dialect." msgstr "" +#: ../../library/csv.rst:582 msgid "Writer objects have the following public attribute:" msgstr "" +#: ../../library/csv.rst:587 msgid "A read-only description of the dialect in use by the writer." msgstr "" +#: ../../library/csv.rst:590 msgid "DictWriter objects have the following public method:" msgstr "" -msgid "Write a row with the field names (as specified in the constructor) to the writer's file object, formatted according to the current dialect. Return the return value of the :meth:`csvwriter.writerow` call used internally." +#: ../../library/csv.rst:595 +msgid "" +"Write a row with the field names (as specified in the constructor) to the " +"writer's file object, formatted according to the current dialect. Return the " +"return value of the :meth:`csvwriter.writerow` call used internally." msgstr "" -msgid ":meth:`writeheader` now also returns the value returned by the :meth:`csvwriter.writerow` method it uses internally." +#: ../../library/csv.rst:600 +msgid "" +":meth:`writeheader` now also returns the value returned by " +"the :meth:`csvwriter.writerow` method it uses internally." msgstr "" +#: ../../library/csv.rst:608 msgid "Examples" msgstr "" +#: ../../library/csv.rst:610 msgid "The simplest example of reading a CSV file::" msgstr "" +#: ../../library/csv.rst:612 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -378,9 +747,11 @@ msgid "" " print(row)" msgstr "" +#: ../../library/csv.rst:618 msgid "Reading a file with an alternate format::" msgstr "" +#: ../../library/csv.rst:620 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -389,9 +760,11 @@ msgid "" " print(row)" msgstr "" +#: ../../library/csv.rst:626 msgid "The corresponding simplest possible writing example is::" msgstr "" +#: ../../library/csv.rst:628 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" @@ -399,9 +772,15 @@ msgid "" " writer.writerows(someiterable)" msgstr "" -msgid "Since :func:`open` is used to open a CSV file for reading, the file will by default be decoded into unicode using the system default encoding (see :func:`locale.getencoding`). To decode a file using a different encoding, use the ``encoding`` argument of open::" +#: ../../library/csv.rst:633 +msgid "" +"Since :func:`open` is used to open a CSV file for reading, the file will by " +"default be decoded into unicode using the system default encoding " +"(see :func:`locale.getencoding`). To decode a file using a different " +"encoding, use the ``encoding`` argument of open::" msgstr "" +#: ../../library/csv.rst:638 msgid "" "import csv\n" "with open('some.csv', newline='', encoding='utf-8') as f:\n" @@ -410,12 +789,17 @@ msgid "" " print(row)" msgstr "" -msgid "The same applies to writing in something other than the system default encoding: specify the encoding argument when opening the output file." +#: ../../library/csv.rst:644 +msgid "" +"The same applies to writing in something other than the system default " +"encoding: specify the encoding argument when opening the output file." msgstr "" +#: ../../library/csv.rst:647 msgid "Registering a new dialect::" msgstr "" +#: ../../library/csv.rst:649 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" @@ -423,9 +807,13 @@ msgid "" " reader = csv.reader(f, 'unixpwd')" msgstr "" -msgid "A slightly more advanced use of the reader --- catching and reporting errors::" +#: ../../library/csv.rst:654 +msgid "" +"A slightly more advanced use of the reader --- catching and reporting " +"errors::" msgstr "" +#: ../../library/csv.rst:656 msgid "" "import csv, sys\n" "filename = 'some.csv'\n" @@ -438,32 +826,48 @@ msgid "" " sys.exit(f'file {filename}, line {reader.line_num}: {e}')" msgstr "" -msgid "And while the module doesn't directly support parsing strings, it can easily be done::" +#: ../../library/csv.rst:666 +msgid "" +"And while the module doesn't directly support parsing strings, it can easily " +"be done::" msgstr "" +#: ../../library/csv.rst:669 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" " print(row)" msgstr "" +#: ../../library/csv.rst:675 msgid "Footnotes" msgstr "" -msgid "If ``newline=''`` is not specified, newlines embedded inside quoted fields will not be interpreted correctly, and on platforms that use ``\\r\\n`` line endings on write an extra ``\\r`` will be added. It should always be safe to specify ``newline=''``, since the csv module does its own (:term:`universal `) newline handling." +#: ../../library/csv.rst:676 +msgid "" +"If ``newline=''`` is not specified, newlines embedded inside quoted fields " +"will not be interpreted correctly, and on platforms that use ``\\r\\n`` line " +"endings on write an extra ``\\r`` will be added. It should always be safe " +"to specify ``newline=''``, since the csv module does its own " +"(:term:`universal `) newline handling." msgstr "" +#: ../../library/csv.rst:11 msgid "csv" msgstr "" +#: ../../library/csv.rst:11 msgid "data" msgstr "" +#: ../../library/csv.rst:11 msgid "tabular" msgstr "" +#: ../../library/csv.rst:53 msgid "universal newlines" msgstr "" +#: ../../library/csv.rst:53 msgid "csv.reader function" msgstr "" diff --git a/library/ctypes.po b/library/ctypes.po index 6dabd4b32..71b0ca29f 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,42 +24,88 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/ctypes.rst:2 msgid ":mod:`!ctypes` --- A foreign function library for Python" msgstr "" +#: ../../library/ctypes.rst:9 msgid "**Source code:** :source:`Lib/ctypes`" msgstr "" -msgid ":mod:`!ctypes` is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be used to wrap these libraries in pure Python." +#: ../../library/ctypes.rst:13 +msgid "" +":mod:`!ctypes` is a foreign function library for Python. It provides C " +"compatible data types, and allows calling functions in DLLs or shared " +"libraries. It can be used to wrap these libraries in pure Python." msgstr "" -msgid "This is an :term:`optional module`. If it is missing from your copy of CPython, look for documentation from your distributor (that is, whoever provided Python to you). If you are the distributor, see :ref:`optional-module-requirements`." +#: ../../includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" -msgid ":mod:`!ctypes` provides low-level access to native libraries and the process's memory, bypassing Python's safety mechanisms and allowing execution of arbitrary native code. Incorrect use can corrupt data and objects, reveal sensitive information, cause crashes, or otherwise compromise the running process." +#: ../../library/ctypes.rst:21 +msgid "" +":mod:`!ctypes` provides low-level access to native libraries and the " +"process's memory, bypassing Python's safety mechanisms and allowing " +"execution of arbitrary native code. Incorrect use can corrupt data and " +"objects, reveal sensitive information, cause crashes, or otherwise " +"compromise the running process." msgstr "" +#: ../../library/ctypes.rst:31 msgid "ctypes tutorial" msgstr "" -msgid "Note: Some code samples reference the ctypes :class:`c_int` type. On platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:`c_long`. So, you should not be confused if :class:`c_long` is printed if you would expect :class:`c_int` --- they are actually the same type." +#: ../../library/ctypes.rst:33 +msgid "" +"Note: Some code samples reference the ctypes :class:`c_int` type. On " +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " +"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " +"printed if you would expect :class:`c_int` --- they are actually the same " +"type." msgstr "" +#: ../../library/ctypes.rst:41 msgid "Loading dynamic link libraries" msgstr "" -msgid ":mod:`!ctypes` exports the :py:data:`~ctypes.cdll`, and on Windows :py:data:`~ctypes.windll` and :py:data:`~ctypes.oledll` objects, for loading dynamic link libraries." +#: ../../library/ctypes.rst:43 +msgid "" +":mod:`!ctypes` exports the :py:data:`~ctypes.cdll`, and on " +"Windows :py:data:`~ctypes.windll` and :py:data:`~ctypes.oledll` objects, for " +"loading dynamic link libraries." msgstr "" -msgid "You load libraries by accessing them as attributes of these objects. :py:data:`!cdll` loads libraries which export functions using the standard ``cdecl`` calling convention, while :py:data:`!windll` libraries call functions using the ``stdcall`` calling convention. :py:data:`~oledll` also uses the ``stdcall`` calling convention, and assumes the functions return a Windows :c:type:`!HRESULT` error code. The error code is used to automatically raise an :class:`OSError` exception when the function call fails." +#: ../../library/ctypes.rst:47 +msgid "" +"You load libraries by accessing them as attributes of these " +"objects. :py:data:`!cdll` loads libraries which export functions using the " +"standard ``cdecl`` calling convention, while :py:data:`!windll` libraries " +"call functions using the ``stdcall`` calling convention. :py:data:`~oledll` " +"also uses the ``stdcall`` calling convention, and assumes the functions " +"return a Windows :c:type:`!HRESULT` error code. The error code is used to " +"automatically raise an :class:`OSError` exception when the function call " +"fails." msgstr "" -msgid "Windows errors used to raise :exc:`WindowsError`, which is now an alias of :exc:`OSError`." +#: ../../library/ctypes.rst:57 +msgid "" +"Windows errors used to raise :exc:`WindowsError`, which is now an alias " +"of :exc:`OSError`." msgstr "" -msgid "Here are some examples for Windows. Note that ``msvcrt`` is the MS standard C library containing most standard C functions, and uses the ``cdecl`` calling convention::" +#: ../../library/ctypes.rst:62 +msgid "" +"Here are some examples for Windows. Note that ``msvcrt`` is the MS standard " +"C library containing most standard C functions, and uses the ``cdecl`` " +"calling convention::" msgstr "" +#: ../../library/ctypes.rst:66 msgid "" ">>> from ctypes import *\n" ">>> print(windll.kernel32)\n" @@ -70,18 +116,32 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:74 msgid "Windows appends the usual ``.dll`` file suffix automatically." msgstr "" -msgid "Accessing the standard C library through ``cdll.msvcrt`` will use an outdated version of the library that may be incompatible with the one being used by Python. Where possible, use native Python functionality, or else import and use the ``msvcrt`` module." +#: ../../library/ctypes.rst:77 +msgid "" +"Accessing the standard C library through ``cdll.msvcrt`` will use an " +"outdated version of the library that may be incompatible with the one being " +"used by Python. Where possible, use native Python functionality, or else " +"import and use the ``msvcrt`` module." msgstr "" -msgid "Other systems require the filename *including* the extension to load a library, so attribute access can not be used to load libraries. Either the :meth:`~LibraryLoader.LoadLibrary` method of the dll loaders should be used, or you should load the library by creating an instance of :py:class:`CDLL` by calling the constructor." +#: ../../library/ctypes.rst:82 +msgid "" +"Other systems require the filename *including* the extension to load a " +"library, so attribute access can not be used to load libraries. Either " +"the :meth:`~LibraryLoader.LoadLibrary` method of the dll loaders should be " +"used, or you should load the library by creating an instance " +"of :py:class:`CDLL` by calling the constructor." msgstr "" +#: ../../library/ctypes.rst:88 msgid "For example, on Linux::" msgstr "" +#: ../../library/ctypes.rst:90 msgid "" ">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" @@ -91,9 +151,11 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:97 msgid "On macOS::" msgstr "" +#: ../../library/ctypes.rst:99 msgid "" ">>> cdll.LoadLibrary(\"libc.dylib\")\n" "\n" @@ -102,12 +164,15 @@ msgid "" "" msgstr "" +#: ../../library/ctypes.rst:110 msgid "Accessing functions from loaded dlls" msgstr "" +#: ../../library/ctypes.rst:112 msgid "Functions are accessed as attributes of dll objects::" msgstr "" +#: ../../library/ctypes.rst:114 msgid "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" @@ -122,9 +187,18 @@ msgid "" ">>>" msgstr "" -msgid "Note that win32 system dlls like ``kernel32`` and ``user32`` often export ANSI as well as UNICODE versions of a function. The UNICODE version is exported with a ``W`` appended to the name, while the ANSI version is exported with an ``A`` appended to the name. The win32 ``GetModuleHandle`` function, which returns a *module handle* for a given module name, has the following C prototype, and a macro is used to expose one of them as ``GetModuleHandle`` depending on whether UNICODE is defined or not::" +#: ../../library/ctypes.rst:126 +msgid "" +"Note that win32 system dlls like ``kernel32`` and ``user32`` often export " +"ANSI as well as UNICODE versions of a function. The UNICODE version is " +"exported with a ``W`` appended to the name, while the ANSI version is " +"exported with an ``A`` appended to the name. The win32 ``GetModuleHandle`` " +"function, which returns a *module handle* for a given module name, has the " +"following C prototype, and a macro is used to expose one of them as " +"``GetModuleHandle`` depending on whether UNICODE is defined or not::" msgstr "" +#: ../../library/ctypes.rst:134 msgid "" "/* ANSI version */\n" "HMODULE GetModuleHandleA(LPCSTR lpModuleName);\n" @@ -132,21 +206,35 @@ msgid "" "HMODULE GetModuleHandleW(LPCWSTR lpModuleName);" msgstr "" -msgid "*windll* does not try to select one of them by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` explicitly, and then call it with bytes or string objects respectively." +#: ../../library/ctypes.rst:139 +msgid "" +"*windll* does not try to select one of them by magic, you must access the " +"version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` " +"explicitly, and then call it with bytes or string objects respectively." msgstr "" -msgid "Sometimes, dlls export functions with names which aren't valid Python identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:`getattr` to retrieve the function::" +#: ../../library/ctypes.rst:143 +msgid "" +"Sometimes, dlls export functions with names which aren't valid Python " +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " +"use :func:`getattr` to retrieve the function::" msgstr "" +#: ../../library/ctypes.rst:147 msgid "" ">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" msgstr "" -msgid "On Windows, some dlls export functions not by name but by ordinal. These functions can be accessed by indexing the dll object with the ordinal number::" +#: ../../library/ctypes.rst:151 +msgid "" +"On Windows, some dlls export functions not by name but by ordinal. These " +"functions can be accessed by indexing the dll object with the ordinal " +"number::" msgstr "" +#: ../../library/ctypes.rst:154 msgid "" ">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" @@ -159,49 +247,74 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:168 msgid "Calling functions" msgstr "" -msgid "You can call these functions like any other Python callable. This example uses the ``rand()`` function, which takes no arguments and returns a pseudo-random integer::" +#: ../../library/ctypes.rst:170 +msgid "" +"You can call these functions like any other Python callable. This example " +"uses the ``rand()`` function, which takes no arguments and returns a pseudo-" +"random integer::" msgstr "" +#: ../../library/ctypes.rst:173 msgid "" ">>> print(libc.rand())\n" "1804289383" msgstr "" -msgid "On Windows, you can call the ``GetModuleHandleA()`` function, which returns a win32 module handle (passing ``None`` as single argument to call it with a ``NULL`` pointer)::" +#: ../../library/ctypes.rst:176 +msgid "" +"On Windows, you can call the ``GetModuleHandleA()`` function, which returns " +"a win32 module handle (passing ``None`` as single argument to call it with a " +"``NULL`` pointer)::" msgstr "" +#: ../../library/ctypes.rst:179 msgid "" ">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" msgstr "" -msgid ":exc:`ValueError` is raised when you call an ``stdcall`` function with the ``cdecl`` calling convention, or vice versa::" +#: ../../library/ctypes.rst:183 +msgid "" +":exc:`ValueError` is raised when you call an ``stdcall`` function with the " +"``cdecl`` calling convention, or vice versa::" msgstr "" +#: ../../library/ctypes.rst:186 msgid "" ">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ValueError: Procedure probably called with not enough arguments (4 bytes missing)\n" +"ValueError: Procedure probably called with not enough arguments (4 bytes " +"missing)\n" ">>>\n" "\n" ">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ValueError: Procedure probably called with too many arguments (4 bytes in excess)\n" +"ValueError: Procedure probably called with too many arguments (4 bytes in " +"excess)\n" ">>>" msgstr "" -msgid "To find out the correct calling convention you have to look into the C header file or the documentation for the function you want to call." +#: ../../library/ctypes.rst:198 +msgid "" +"To find out the correct calling convention you have to look into the C " +"header file or the documentation for the function you want to call." msgstr "" -msgid "On Windows, :mod:`!ctypes` uses win32 structured exception handling to prevent crashes from general protection faults when functions are called with invalid argument values::" +#: ../../library/ctypes.rst:201 +msgid "" +"On Windows, :mod:`!ctypes` uses win32 structured exception handling to " +"prevent crashes from general protection faults when functions are called " +"with invalid argument values::" msgstr "" +#: ../../library/ctypes.rst:205 msgid "" ">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" @@ -210,351 +323,500 @@ msgid "" ">>>" msgstr "" -msgid "The :mod:`faulthandler` module can help debug crashes, such as segmentation faults produced by erroneous C library calls." +#: ../../library/ctypes.rst:211 +msgid "" +"The :mod:`faulthandler` module can help debug crashes, such as segmentation " +"faults produced by erroneous C library calls." msgstr "" -msgid "``None``, integers, bytes objects and (unicode) strings are the only native Python objects that can directly be used as parameters in these function calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings are passed as pointer to the memory block that contains their data (:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as the platform's default C :c:expr:`int` type, their value is masked to fit into the C type." +#: ../../library/ctypes.rst:214 +msgid "" +"``None``, integers, bytes objects and (unicode) strings are the only native " +"Python objects that can directly be used as parameters in these function " +"calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " +"are passed as pointer to the memory block that contains their data " +"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " +"the platform's default C :c:expr:`int` type, their value is masked to fit " +"into the C type." msgstr "" -msgid "Before we move on calling functions with other parameter types, we have to learn more about :mod:`!ctypes` data types." +#: ../../library/ctypes.rst:221 +msgid "" +"Before we move on calling functions with other parameter types, we have to " +"learn more about :mod:`!ctypes` data types." msgstr "" +#: ../../library/ctypes.rst:228 ../../library/ctypes.rst:2542 msgid "Fundamental data types" msgstr "" +#: ../../library/ctypes.rst:230 msgid ":mod:`!ctypes` defines a number of primitive C compatible data types:" msgstr "" +#: ../../library/ctypes.rst:235 ../../library/ctypes.rst:374 msgid "ctypes type" msgstr "" +#: ../../library/ctypes.rst:236 ../../library/ctypes.rst:375 msgid "C type" msgstr "" +#: ../../library/ctypes.rst:237 ../../library/ctypes.rst:376 msgid "Python type" msgstr "" +#: ../../library/ctypes.rst:238 ../../library/ctypes.rst:377 msgid ":py:attr:`~_SimpleCData._type_`" msgstr "" +#: ../../library/ctypes.rst:239 msgid ":class:`c_bool`" msgstr "" +#: ../../library/ctypes.rst:240 msgid ":c:expr:`_Bool`" msgstr "" +#: ../../library/ctypes.rst:241 ../../library/ctypes.rst:365 msgid ":py:class:`bool`" msgstr "" +#: ../../library/ctypes.rst:242 msgid "``'?'``" msgstr "" +#: ../../library/ctypes.rst:243 msgid ":class:`c_char`" msgstr "" +#: ../../library/ctypes.rst:244 ../../library/ctypes.rst:252 msgid ":c:expr:`char`" msgstr "" +#: ../../library/ctypes.rst:245 msgid "1-character :py:class:`bytes`" msgstr "" +#: ../../library/ctypes.rst:246 msgid "``'c'``" msgstr "" +#: ../../library/ctypes.rst:247 msgid ":class:`c_wchar`" msgstr "" +#: ../../library/ctypes.rst:248 msgid ":c:type:`wchar_t`" msgstr "" +#: ../../library/ctypes.rst:249 msgid "1-character :py:class:`str`" msgstr "" +#: ../../library/ctypes.rst:250 msgid "``'u'``" msgstr "" +#: ../../library/ctypes.rst:251 msgid ":class:`c_byte`" msgstr "" +#: ../../library/ctypes.rst:253 ../../library/ctypes.rst:257 +#: ../../library/ctypes.rst:261 ../../library/ctypes.rst:265 +#: ../../library/ctypes.rst:269 ../../library/ctypes.rst:273 +#: ../../library/ctypes.rst:277 ../../library/ctypes.rst:281 +#: ../../library/ctypes.rst:285 ../../library/ctypes.rst:289 +#: ../../library/ctypes.rst:293 ../../library/ctypes.rst:297 +#: ../../library/ctypes.rst:301 ../../library/ctypes.rst:305 +#: ../../library/ctypes.rst:309 ../../library/ctypes.rst:313 +#: ../../library/ctypes.rst:317 ../../library/ctypes.rst:321 +#: ../../library/ctypes.rst:325 ../../library/ctypes.rst:329 +#: ../../library/ctypes.rst:333 msgid ":py:class:`int`" msgstr "" +#: ../../library/ctypes.rst:254 msgid "``'b'``" msgstr "" +#: ../../library/ctypes.rst:255 msgid ":class:`c_ubyte`" msgstr "" +#: ../../library/ctypes.rst:256 msgid ":c:expr:`unsigned char`" msgstr "" +#: ../../library/ctypes.rst:258 msgid "``'B'``" msgstr "" +#: ../../library/ctypes.rst:259 msgid ":class:`c_short`" msgstr "" +#: ../../library/ctypes.rst:260 msgid ":c:expr:`short`" msgstr "" +#: ../../library/ctypes.rst:262 msgid "``'h'``" msgstr "" +#: ../../library/ctypes.rst:263 msgid ":class:`c_ushort`" msgstr "" +#: ../../library/ctypes.rst:264 msgid ":c:expr:`unsigned short`" msgstr "" +#: ../../library/ctypes.rst:266 msgid "``'H'``" msgstr "" +#: ../../library/ctypes.rst:267 msgid ":class:`c_int`" msgstr "" +#: ../../library/ctypes.rst:268 msgid ":c:expr:`int`" msgstr "" +#: ../../library/ctypes.rst:270 msgid "``'i'`` \\*" msgstr "" +#: ../../library/ctypes.rst:271 msgid ":class:`c_int8`" msgstr "" +#: ../../library/ctypes.rst:272 msgid ":c:type:`int8_t`" msgstr "" +#: ../../library/ctypes.rst:274 ../../library/ctypes.rst:278 +#: ../../library/ctypes.rst:282 ../../library/ctypes.rst:286 +#: ../../library/ctypes.rst:294 ../../library/ctypes.rst:298 +#: ../../library/ctypes.rst:302 ../../library/ctypes.rst:306 +#: ../../library/ctypes.rst:326 ../../library/ctypes.rst:330 +#: ../../library/ctypes.rst:334 msgid "\\*" msgstr "" +#: ../../library/ctypes.rst:275 msgid ":class:`c_int16`" msgstr "" +#: ../../library/ctypes.rst:276 msgid ":c:type:`int16_t`" msgstr "" +#: ../../library/ctypes.rst:279 msgid ":class:`c_int32`" msgstr "" +#: ../../library/ctypes.rst:280 msgid ":c:type:`int32_t`" msgstr "" +#: ../../library/ctypes.rst:283 msgid ":class:`c_int64`" msgstr "" +#: ../../library/ctypes.rst:284 msgid ":c:type:`int64_t`" msgstr "" +#: ../../library/ctypes.rst:287 msgid ":class:`c_uint`" msgstr "" +#: ../../library/ctypes.rst:288 msgid ":c:expr:`unsigned int`" msgstr "" +#: ../../library/ctypes.rst:290 msgid "``'I'`` \\*" msgstr "" +#: ../../library/ctypes.rst:291 msgid ":class:`c_uint8`" msgstr "" +#: ../../library/ctypes.rst:292 msgid ":c:type:`uint8_t`" msgstr "" +#: ../../library/ctypes.rst:295 msgid ":class:`c_uint16`" msgstr "" +#: ../../library/ctypes.rst:296 msgid ":c:type:`uint16_t`" msgstr "" +#: ../../library/ctypes.rst:299 msgid ":class:`c_uint32`" msgstr "" +#: ../../library/ctypes.rst:300 msgid ":c:type:`uint32_t`" msgstr "" +#: ../../library/ctypes.rst:303 msgid ":class:`c_uint64`" msgstr "" +#: ../../library/ctypes.rst:304 msgid ":c:type:`uint64_t`" msgstr "" +#: ../../library/ctypes.rst:307 msgid ":class:`c_long`" msgstr "" +#: ../../library/ctypes.rst:308 msgid ":c:expr:`long`" msgstr "" +#: ../../library/ctypes.rst:310 msgid "``'l'``" msgstr "" +#: ../../library/ctypes.rst:311 msgid ":class:`c_ulong`" msgstr "" +#: ../../library/ctypes.rst:312 msgid ":c:expr:`unsigned long`" msgstr "" +#: ../../library/ctypes.rst:314 msgid "``'L'``" msgstr "" +#: ../../library/ctypes.rst:315 msgid ":class:`c_longlong`" msgstr "" +#: ../../library/ctypes.rst:316 msgid ":c:expr:`long long`" msgstr "" +#: ../../library/ctypes.rst:318 msgid "``'q'`` \\*" msgstr "" +#: ../../library/ctypes.rst:319 msgid ":class:`c_ulonglong`" msgstr "" +#: ../../library/ctypes.rst:320 msgid ":c:expr:`unsigned long long`" msgstr "" +#: ../../library/ctypes.rst:322 msgid "``'Q'`` \\*" msgstr "" +#: ../../library/ctypes.rst:323 msgid ":class:`c_size_t`" msgstr "" +#: ../../library/ctypes.rst:324 msgid ":c:type:`size_t`" msgstr "" +#: ../../library/ctypes.rst:327 msgid ":class:`c_ssize_t`" msgstr "" +#: ../../library/ctypes.rst:328 msgid ":c:type:`Py_ssize_t`" msgstr "" +#: ../../library/ctypes.rst:331 msgid ":class:`c_time_t`" msgstr "" +#: ../../library/ctypes.rst:332 msgid ":c:type:`time_t`" msgstr "" +#: ../../library/ctypes.rst:335 msgid ":class:`c_float`" msgstr "" +#: ../../library/ctypes.rst:336 msgid ":c:expr:`float`" msgstr "" +#: ../../library/ctypes.rst:337 ../../library/ctypes.rst:341 +#: ../../library/ctypes.rst:345 msgid ":py:class:`float`" msgstr "" +#: ../../library/ctypes.rst:338 msgid "``'f'``" msgstr "" +#: ../../library/ctypes.rst:339 msgid ":class:`c_double`" msgstr "" +#: ../../library/ctypes.rst:340 msgid ":c:expr:`double`" msgstr "" +#: ../../library/ctypes.rst:342 msgid "``'d'``" msgstr "" +#: ../../library/ctypes.rst:343 msgid ":class:`c_longdouble`" msgstr "" +#: ../../library/ctypes.rst:344 msgid ":c:expr:`long double`" msgstr "" +#: ../../library/ctypes.rst:346 msgid "``'g'`` \\*" msgstr "" +#: ../../library/ctypes.rst:347 msgid ":class:`c_char_p`" msgstr "" +#: ../../library/ctypes.rst:348 msgid ":c:expr:`char *` (NUL terminated)" msgstr "" +#: ../../library/ctypes.rst:349 msgid ":py:class:`bytes` or ``None``" msgstr "" +#: ../../library/ctypes.rst:350 msgid "``'z'``" msgstr "" +#: ../../library/ctypes.rst:351 msgid ":class:`c_wchar_p`" msgstr "" +#: ../../library/ctypes.rst:352 msgid ":c:expr:`wchar_t *` (NUL terminated)" msgstr "" +#: ../../library/ctypes.rst:353 msgid ":py:class:`str` or ``None``" msgstr "" +#: ../../library/ctypes.rst:354 msgid "``'Z'``" msgstr "" +#: ../../library/ctypes.rst:355 msgid ":class:`c_void_p`" msgstr "" +#: ../../library/ctypes.rst:356 msgid ":c:expr:`void *`" msgstr "" +#: ../../library/ctypes.rst:357 msgid ":py:class:`int` or ``None``" msgstr "" +#: ../../library/ctypes.rst:358 msgid "``'P'``" msgstr "" +#: ../../library/ctypes.rst:359 msgid ":class:`py_object`" msgstr "" +#: ../../library/ctypes.rst:360 msgid ":c:expr:`PyObject *`" msgstr "" +#: ../../library/ctypes.rst:361 msgid ":py:class:`object`" msgstr "" +#: ../../library/ctypes.rst:362 msgid "``'O'``" msgstr "" +#: ../../library/ctypes.rst:363 msgid ":ref:`VARIANT_BOOL `" msgstr "" +#: ../../library/ctypes.rst:364 msgid ":c:expr:`short int`" msgstr "" +#: ../../library/ctypes.rst:366 msgid "``'v'``" msgstr "" -msgid "Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is supported in both C and ``libffi``, the following complex types are available:" +#: ../../library/ctypes.rst:368 +msgid "" +"Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is " +"supported in both C and ``libffi``, the following complex types are " +"available:" msgstr "" +#: ../../library/ctypes.rst:378 msgid ":class:`c_float_complex`" msgstr "" +#: ../../library/ctypes.rst:379 msgid ":c:expr:`float complex`" msgstr "" +#: ../../library/ctypes.rst:380 ../../library/ctypes.rst:384 +#: ../../library/ctypes.rst:388 msgid ":py:class:`complex`" msgstr "" +#: ../../library/ctypes.rst:381 msgid "``'F'``" msgstr "" +#: ../../library/ctypes.rst:382 msgid ":class:`c_double_complex`" msgstr "" +#: ../../library/ctypes.rst:383 msgid ":c:expr:`double complex`" msgstr "" +#: ../../library/ctypes.rst:385 msgid "``'D'``" msgstr "" +#: ../../library/ctypes.rst:386 msgid ":class:`c_longdouble_complex`" msgstr "" +#: ../../library/ctypes.rst:387 msgid ":c:expr:`long double complex`" msgstr "" +#: ../../library/ctypes.rst:389 msgid "``'G'``" msgstr "" -msgid "All these types can be created by calling them with an optional initializer of the correct type and value::" +#: ../../library/ctypes.rst:392 +msgid "" +"All these types can be created by calling them with an optional initializer " +"of the correct type and value::" msgstr "" +#: ../../library/ctypes.rst:395 msgid "" ">>> c_int()\n" "c_long(0)\n" @@ -565,18 +827,27 @@ msgid "" ">>>" msgstr "" -msgid "The constructors for numeric types will convert input using :py:meth:`~object.__bool__`, :py:meth:`~object.__index__` (for ``int``), :py:meth:`~object.__float__` or :py:meth:`~object.__complex__`. This means :py:class:`~ctypes.c_bool` accepts any object with a truth value::" +#: ../../library/ctypes.rst:403 +msgid "" +"The constructors for numeric types will convert input " +"using :py:meth:`~object.__bool__`, :py:meth:`~object.__index__` (for " +"``int``), :py:meth:`~object.__float__` or :py:meth:`~object.__complex__`. " +"This means :py:class:`~ctypes.c_bool` accepts any object with a truth value::" msgstr "" +#: ../../library/ctypes.rst:409 msgid "" ">>> empty_list = []\n" ">>> c_bool(empty_list)\n" "c_bool(False)" msgstr "" -msgid "Since these types are mutable, their value can also be changed afterwards::" +#: ../../library/ctypes.rst:413 +msgid "" +"Since these types are mutable, their value can also be changed afterwards::" msgstr "" +#: ../../library/ctypes.rst:415 msgid "" ">>> i = c_int(42)\n" ">>> print(i)\n" @@ -589,9 +860,15 @@ msgid "" ">>>" msgstr "" -msgid "Assigning a new value to instances of the pointer types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they point to, *not the contents* of the memory block (of course not, because Python string objects are immutable)::" +#: ../../library/ctypes.rst:425 +msgid "" +"Assigning a new value to instances of the pointer " +"types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes " +"the *memory location* they point to, *not the contents* of the memory block " +"(of course not, because Python string objects are immutable)::" msgstr "" +#: ../../library/ctypes.rst:430 msgid "" ">>> s = \"Hello, World\"\n" ">>> c_s = c_wchar_p(s)\n" @@ -609,15 +886,25 @@ msgid "" ">>>" msgstr "" -msgid "You should be careful, however, not to pass them to functions expecting pointers to mutable memory. If you need mutable memory blocks, ctypes has a :func:`create_string_buffer` function which creates these in various ways. The current memory block contents can be accessed (or changed) with the ``raw`` property; if you want to access it as NUL terminated string, use the ``value`` property::" +#: ../../library/ctypes.rst:445 +msgid "" +"You should be careful, however, not to pass them to functions expecting " +"pointers to mutable memory. If you need mutable memory blocks, ctypes has " +"a :func:`create_string_buffer` function which creates these in various " +"ways. The current memory block contents can be accessed (or changed) with " +"the ``raw`` property; if you want to access it as NUL terminated string, use " +"the ``value`` property::" msgstr "" +#: ../../library/ctypes.rst:452 msgid "" ">>> from ctypes import *\n" -">>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes\n" +">>> p = create_string_buffer(3) # create a 3 byte buffer, " +"initialized to NUL bytes\n" ">>> print(sizeof(p), repr(p.raw))\n" "3 b'\\x00\\x00\\x00'\n" -">>> p = create_string_buffer(b\"Hello\") # create a buffer containing a NUL terminated string\n" +">>> p = create_string_buffer(b\"Hello\") # create a buffer containing a " +"NUL terminated string\n" ">>> print(sizeof(p), repr(p.raw))\n" "6 b'Hello\\x00'\n" ">>> print(repr(p.value))\n" @@ -631,15 +918,26 @@ msgid "" ">>>" msgstr "" -msgid "The :func:`create_string_buffer` function replaces the old :func:`!c_buffer` function (which is still available as an alias). To create a mutable memory block containing unicode characters of the C type :c:type:`wchar_t`, use the :func:`create_unicode_buffer` function." +#: ../../library/ctypes.rst:469 +msgid "" +"The :func:`create_string_buffer` function replaces the old :func:`!c_buffer` " +"function (which is still available as an alias). To create a mutable memory " +"block containing unicode characters of the C type :c:type:`wchar_t`, use " +"the :func:`create_unicode_buffer` function." msgstr "" +#: ../../library/ctypes.rst:478 msgid "Calling functions, continued" msgstr "" -msgid "Note that printf prints to the real standard output channel, *not* to :data:`sys.stdout`, so these examples will only work at the console prompt, not from within *IDLE* or *PythonWin*::" +#: ../../library/ctypes.rst:480 +msgid "" +"Note that printf prints to the real standard output channel, *not* " +"to :data:`sys.stdout`, so these examples will only work at the console " +"prompt, not from within *IDLE* or *PythonWin*::" msgstr "" +#: ../../library/ctypes.rst:484 msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -654,13 +952,19 @@ msgid "" ">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2\n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" ">>>" msgstr "" -msgid "As has been mentioned before, all Python types except integers, strings, and bytes objects have to be wrapped in their corresponding :mod:`!ctypes` type, so that they can be converted to the required C data type::" +#: ../../library/ctypes.rst:500 +msgid "" +"As has been mentioned before, all Python types except integers, strings, and " +"bytes objects have to be wrapped in their corresponding :mod:`!ctypes` type, " +"so that they can be converted to the required C data type::" msgstr "" +#: ../../library/ctypes.rst:504 msgid "" ">>> printf(b\"An int %d, a double %f\\n\", 1234, c_double(3.14))\n" "An int 1234, a double 3.140000\n" @@ -668,27 +972,49 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:512 msgid "Calling variadic functions" msgstr "" -msgid "On a lot of platforms calling variadic functions through ctypes is exactly the same as calling functions with a fixed number of parameters. On some platforms, and in particular ARM64 for Apple Platforms, the calling convention for variadic functions is different than that for regular functions." +#: ../../library/ctypes.rst:514 +msgid "" +"On a lot of platforms calling variadic functions through ctypes is exactly " +"the same as calling functions with a fixed number of parameters. On some " +"platforms, and in particular ARM64 for Apple Platforms, the calling " +"convention for variadic functions is different than that for regular " +"functions." msgstr "" -msgid "On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` attribute for the regular, non-variadic, function arguments:" +#: ../../library/ctypes.rst:519 +msgid "" +"On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` " +"attribute for the regular, non-variadic, function arguments:" msgstr "" +#: ../../library/ctypes.rst:522 msgid "libc.printf.argtypes = [ctypes.c_char_p]" msgstr "" -msgid "Because specifying the attribute does not inhibit portability it is advised to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." +#: ../../library/ctypes.rst:526 +msgid "" +"Because specifying the attribute does not inhibit portability it is advised " +"to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." msgstr "" +#: ../../library/ctypes.rst:533 msgid "Calling functions with your own custom data types" msgstr "" -msgid "You can also customize :mod:`!ctypes` argument conversion to allow instances of your own classes be used as function arguments. :mod:`!ctypes` looks for an :attr:`!_as_parameter_` attribute and uses this as the function argument. The attribute must be an integer, string, bytes, a :mod:`!ctypes` instance, or an object with an :attr:`!_as_parameter_` attribute::" +#: ../../library/ctypes.rst:535 +msgid "" +"You can also customize :mod:`!ctypes` argument conversion to allow instances " +"of your own classes be used as function arguments. :mod:`!ctypes` looks for " +"an :attr:`!_as_parameter_` attribute and uses this as the function argument. " +"The attribute must be an integer, string, bytes, a :mod:`!ctypes` instance, " +"or an object with an :attr:`!_as_parameter_` attribute::" msgstr "" +#: ../../library/ctypes.rst:541 msgid "" ">>> class Bottles:\n" "... def __init__(self, number):\n" @@ -701,18 +1027,33 @@ msgid "" ">>>" msgstr "" -msgid "If you don't want to store the instance's data in the :attr:`!_as_parameter_` instance variable, you could define a :class:`property` which makes the attribute available on request." +#: ../../library/ctypes.rst:551 +msgid "" +"If you don't want to store the instance's data in the :attr:`!" +"_as_parameter_` instance variable, you could define a :deco:`property` which " +"makes the attribute available on request." msgstr "" +#: ../../library/ctypes.rst:559 msgid "Specifying the required argument types (function prototypes)" msgstr "" -msgid "It is possible to specify the required argument types of functions exported from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." +#: ../../library/ctypes.rst:561 +msgid "" +"It is possible to specify the required argument types of functions exported " +"from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." msgstr "" -msgid ":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!printf` function is probably not a good example here, because it takes a variable number and different types of parameters depending on the format string, on the other hand this is quite handy to experiment with this feature)::" +#: ../../library/ctypes.rst:564 +msgid "" +":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!" +"printf` function is probably not a good example here, because it takes a " +"variable number and different types of parameters depending on the format " +"string, on the other hand this is quite handy to experiment with this " +"feature)::" msgstr "" +#: ../../library/ctypes.rst:569 msgid "" ">>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double]\n" ">>> printf(b\"String '%s', Int %d, Double %f\\n\", b\"Hi\", 10, 2.2)\n" @@ -721,52 +1062,90 @@ msgid "" ">>>" msgstr "" -msgid "Specifying a format protects against incompatible argument types (just as a prototype for a C function), and tries to convert the arguments to valid types::" +#: ../../library/ctypes.rst:575 +msgid "" +"Specifying a format protects against incompatible argument types (just as a " +"prototype for a C function), and tries to convert the arguments to valid " +"types::" msgstr "" +#: ../../library/ctypes.rst:578 msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be interpreted as ctypes.c_char_p\n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" ">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" "X 2 3.000000\n" "13\n" ">>>" msgstr "" -msgid "If you have defined your own classes which you pass to function calls, you have to implement a :meth:`~_CData.from_param` class method for them to be able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:`~_CData.from_param` class method receives the Python object passed to the function call, it should do a typecheck or whatever is needed to make sure this object is acceptable, and then return the object itself, its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C function argument in this case. Again, the result should be an integer, string, bytes, a :mod:`!ctypes` instance, or an object with an :attr:`!_as_parameter_` attribute." -msgstr "" - +#: ../../library/ctypes.rst:587 +msgid "" +"If you have defined your own classes which you pass to function calls, you " +"have to implement a :meth:`~_CData.from_param` class method for them to be " +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " +"The :meth:`~_CData.from_param` class method receives the Python object " +"passed to the function call, it should do a typecheck or whatever is needed " +"to make sure this object is acceptable, and then return the object itself, " +"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " +"function argument in this case. Again, the result should be an integer, " +"string, bytes, a :mod:`!ctypes` instance, or an object with an :attr:`!" +"_as_parameter_` attribute." +msgstr "" + +#: ../../library/ctypes.rst:601 msgid "Return types" msgstr "" -msgid "By default functions are assumed to return the C :c:expr:`int` type. Other return types can be specified by setting the :attr:`~_CFuncPtr.restype` attribute of the function object." +#: ../../library/ctypes.rst:611 +msgid "" +"By default functions are assumed to return the C :c:expr:`int` type. Other " +"return types can be specified by setting the :attr:`~_CFuncPtr.restype` " +"attribute of the function object." msgstr "" -msgid "The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:type:`time_t` might be of a different type than the default return type :c:expr:`int`, you should specify the :attr:`!restype` attribute::" +#: ../../library/ctypes.rst:615 +msgid "" +"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. " +"Because :c:type:`time_t` might be of a different type than the default " +"return type :c:expr:`int`, you should specify the :attr:`!restype` " +"attribute::" msgstr "" +#: ../../library/ctypes.rst:619 msgid ">>> libc.time.restype = c_time_t" msgstr "" +#: ../../library/ctypes.rst:621 msgid "The argument types can be specified using :attr:`~_CFuncPtr.argtypes`::" msgstr "" +#: ../../library/ctypes.rst:623 msgid ">>> libc.time.argtypes = (POINTER(c_time_t),)" msgstr "" -msgid "To call the function with a ``NULL`` pointer as first argument, use ``None``::" +#: ../../library/ctypes.rst:625 +msgid "" +"To call the function with a ``NULL`` pointer as first argument, use " +"``None``::" msgstr "" +#: ../../library/ctypes.rst:627 msgid "" ">>> print(libc.time(None))\n" "1150640792" msgstr "" -msgid "Here is a more advanced example, it uses the :func:`!strchr` function, which expects a string pointer and a char, and returns a pointer to a string::" +#: ../../library/ctypes.rst:630 +msgid "" +"Here is a more advanced example, it uses the :func:`!strchr` function, which " +"expects a string pointer and a char, and returns a pointer to a string::" msgstr "" +#: ../../library/ctypes.rst:633 msgid "" ">>> strchr = libc.strchr\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -779,9 +1158,14 @@ msgid "" ">>>" msgstr "" -msgid "If you want to avoid the :func:`ord(\"x\") ` calls above, you can set the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be converted from a single character Python bytes object into a C char:" +#: ../../library/ctypes.rst:643 +msgid "" +"If you want to avoid the :func:`ord(\"x\") ` calls above, you can set " +"the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be " +"converted from a single character Python bytes object into a C char:" msgstr "" +#: ../../library/ctypes.rst:647 msgid "" ">>> strchr.restype = c_char_p\n" ">>> strchr.argtypes = [c_char_p, c_char]\n" @@ -789,7 +1173,8 @@ msgid "" "b'def'\n" ">>> strchr(b\"abcdef\", b\"def\")\n" "Traceback (most recent call last):\n" -"ctypes.ArgumentError: argument 2: TypeError: one character bytes, bytearray or integer expected\n" +"ctypes.ArgumentError: argument 2: TypeError: one character bytes, bytearray " +"or integer expected\n" ">>> print(strchr(b\"abcdef\", b\"x\"))\n" "None\n" ">>> strchr(b\"abcdef\", b\"d\")\n" @@ -797,9 +1182,17 @@ msgid "" ">>>" msgstr "" -msgid "You can also use a callable Python object (a function or a class for example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign function returns an integer. The callable will be called with the *integer* the C function returns, and the result of this call will be used as the result of your function call. This is useful to check for error return values and automatically raise an exception::" +#: ../../library/ctypes.rst:662 +msgid "" +"You can also use a callable Python object (a function or a class for " +"example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign " +"function returns an integer. The callable will be called with the *integer* " +"the C function returns, and the result of this call will be used as the " +"result of your function call. This is useful to check for error return " +"values and automatically raise an exception::" msgstr "" +#: ../../library/ctypes.rst:668 msgid "" ">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" @@ -819,21 +1212,43 @@ msgid "" ">>>" msgstr "" -msgid "``WinError`` is a function which will call Windows ``FormatMessage()`` api to get the string representation of an error code, and *returns* an exception. ``WinError`` takes an optional error code parameter, if no one is used, it calls :func:`GetLastError` to retrieve it." +#: ../../library/ctypes.rst:685 +msgid "" +"``WinError`` is a function which will call Windows ``FormatMessage()`` api " +"to get the string representation of an error code, and *returns* an " +"exception. ``WinError`` takes an optional error code parameter, if no one is " +"used, it calls :func:`GetLastError` to retrieve it." msgstr "" -msgid "Please note that a much more powerful error checking mechanism is available through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual for details." +#: ../../library/ctypes.rst:690 +msgid "" +"Please note that a much more powerful error checking mechanism is available " +"through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual " +"for details." msgstr "" +#: ../../library/ctypes.rst:698 msgid "Passing pointers (or: passing parameters by reference)" msgstr "" -msgid "Sometimes a C api function expects a *pointer* to a data type as parameter, probably to write into the corresponding location, or if the data is too large to be passed by value. This is also known as *passing parameters by reference*." +#: ../../library/ctypes.rst:700 +msgid "" +"Sometimes a C api function expects a *pointer* to a data type as parameter, " +"probably to write into the corresponding location, or if the data is too " +"large to be passed by value. This is also known as *passing parameters by " +"reference*." msgstr "" -msgid ":mod:`!ctypes` exports the :func:`byref` function which is used to pass parameters by reference. The same effect can be achieved with the :func:`pointer` function, although :func:`pointer` does a lot more work since it constructs a real pointer object, so it is faster to use :func:`byref` if you don't need the pointer object in Python itself::" +#: ../../library/ctypes.rst:704 +msgid "" +":mod:`!ctypes` exports the :func:`byref` function which is used to pass " +"parameters by reference. The same effect can be achieved with " +"the :func:`pointer` function, although :func:`pointer` does a lot more work " +"since it constructs a real pointer object, so it is faster to " +"use :func:`byref` if you don't need the pointer object in Python itself::" msgstr "" +#: ../../library/ctypes.rst:710 msgid "" ">>> i = c_int()\n" ">>> f = c_float()\n" @@ -848,18 +1263,33 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:726 msgid "Structures and unions" msgstr "" -msgid "Structures and unions must derive from the :class:`Structure` and :class:`Union` base classes which are defined in the :mod:`!ctypes` module. Each subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a *field name* and a *field type*." +#: ../../library/ctypes.rst:728 +msgid "" +"Structures and unions must derive from the :class:`Structure` " +"and :class:`Union` base classes which are defined in the :mod:`!ctypes` " +"module. Each subclass must define a :attr:`~Structure._fields_` " +"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " +"*field name* and a *field type*." msgstr "" -msgid "The field type must be a :mod:`!ctypes` type like :class:`c_int`, or any other derived :mod:`!ctypes` type: structure, union, array, pointer." +#: ../../library/ctypes.rst:733 +msgid "" +"The field type must be a :mod:`!ctypes` type like :class:`c_int`, or any " +"other derived :mod:`!ctypes` type: structure, union, array, pointer." msgstr "" -msgid "Here is a simple example of a POINT structure, which contains two integers named *x* and *y*, and also shows how to initialize a structure in the constructor::" +#: ../../library/ctypes.rst:736 +msgid "" +"Here is a simple example of a POINT structure, which contains two integers " +"named *x* and *y*, and also shows how to initialize a structure in the " +"constructor::" msgstr "" +#: ../../library/ctypes.rst:739 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -879,12 +1309,19 @@ msgid "" ">>>" msgstr "" -msgid "You can, however, build much more complicated structures. A structure can itself contain other structures by using a structure as a field type." +#: ../../library/ctypes.rst:756 +msgid "" +"You can, however, build much more complicated structures. A structure can " +"itself contain other structures by using a structure as a field type." msgstr "" -msgid "Here is a RECT structure which contains two POINTs named *upperleft* and *lowerright*::" +#: ../../library/ctypes.rst:759 +msgid "" +"Here is a RECT structure which contains two POINTs named *upperleft* and " +"*lowerright*::" msgstr "" +#: ../../library/ctypes.rst:762 msgid "" ">>> class RECT(Structure):\n" "... _fields_ = [(\"upperleft\", POINT),\n" @@ -898,17 +1335,26 @@ msgid "" ">>>" msgstr "" -msgid "Nested structures can also be initialized in the constructor in several ways::" +#: ../../library/ctypes.rst:773 +msgid "" +"Nested structures can also be initialized in the constructor in several " +"ways::" msgstr "" +#: ../../library/ctypes.rst:775 msgid "" ">>> r = RECT(POINT(1, 2), POINT(3, 4))\n" ">>> r = RECT((1, 2), (3, 4))" msgstr "" -msgid "Field :term:`descriptor`\\s can be retrieved from the *class*, they are useful for debugging because they can provide useful information. See :class:`CField`::" +#: ../../library/ctypes.rst:778 +msgid "" +"Field :term:`descriptor`\\s can be retrieved from the *class*, they are " +"useful for debugging because they can provide useful information. " +"See :class:`CField`::" msgstr "" +#: ../../library/ctypes.rst:782 msgid "" ">>> POINT.x\n" "\n" @@ -917,27 +1363,55 @@ msgid "" ">>>" msgstr "" -msgid ":mod:`!ctypes` does not support passing unions or structures with bit-fields to functions by value. While this may work on 32-bit x86, it's not guaranteed by the library to work in the general case. Unions and structures with bit-fields should always be passed to functions by pointer." +#: ../../library/ctypes.rst:793 +msgid "" +":mod:`!ctypes` does not support passing unions or structures with bit-fields " +"to functions by value. While this may work on 32-bit x86, it's not " +"guaranteed by the library to work in the general case. Unions and " +"structures with bit-fields should always be passed to functions by pointer." msgstr "" +#: ../../library/ctypes.rst:799 msgid "Structure/union layout, alignment and byte order" msgstr "" -msgid "By default, Structure and Union fields are laid out in the same way the C compiler does it. It is possible to override this behavior entirely by specifying a :attr:`~Structure._layout_` class attribute in the subclass definition; see the attribute documentation for details." +#: ../../library/ctypes.rst:801 +msgid "" +"By default, Structure and Union fields are laid out in the same way the C " +"compiler does it. It is possible to override this behavior entirely by " +"specifying a :attr:`~Structure._layout_` class attribute in the subclass " +"definition; see the attribute documentation for details." msgstr "" -msgid "It is possible to specify the maximum alignment for the fields and/or for the structure itself by setting the class attributes :attr:`~Structure._pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute documentation for details." +#: ../../library/ctypes.rst:806 +msgid "" +"It is possible to specify the maximum alignment for the fields and/or for " +"the structure itself by setting the class " +"attributes :attr:`~Structure._pack_` and/or :attr:`~Structure._align_`, " +"respectively. See the attribute documentation for details." msgstr "" -msgid ":mod:`!ctypes` uses the native byte order for Structures and Unions. To build structures with non-native byte order, you can use one of the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These classes cannot contain pointer fields." +#: ../../library/ctypes.rst:811 +msgid "" +":mod:`!ctypes` uses the native byte order for Structures and Unions. To " +"build structures with non-native byte order, you can use one of " +"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " +"and :class:`LittleEndianUnion` base classes. These classes cannot contain " +"pointer fields." msgstr "" +#: ../../library/ctypes.rst:821 msgid "Bit fields in structures and unions" msgstr "" -msgid "It is possible to create structures and unions containing bit fields. Bit fields are only possible for integer fields, the bit width is specified as the third item in the :attr:`~Structure._fields_` tuples::" +#: ../../library/ctypes.rst:823 +msgid "" +"It is possible to create structures and unions containing bit fields. Bit " +"fields are only possible for integer fields, the bit width is specified as " +"the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" +#: ../../library/ctypes.rst:827 msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -949,24 +1423,42 @@ msgid "" "" msgstr "" -msgid "It is important to note that bit field allocation and layout in memory are not defined as a C standard; their implementation is compiler-specific. By default, Python will attempt to match the behavior of a \"native\" compiler for the current platform. See the :attr:`~Structure._layout_` attribute for details on the default behavior and how to change it." +#: ../../library/ctypes.rst:836 +msgid "" +"It is important to note that bit field allocation and layout in memory are " +"not defined as a C standard; their implementation is compiler-specific. By " +"default, Python will attempt to match the behavior of a \"native\" compiler " +"for the current platform. See the :attr:`~Structure._layout_` attribute for " +"details on the default behavior and how to change it." msgstr "" +#: ../../library/ctypes.rst:847 msgid "Arrays" msgstr "" -msgid "Arrays are sequences, containing a fixed number of instances of the same type." +#: ../../library/ctypes.rst:849 +msgid "" +"Arrays are sequences, containing a fixed number of instances of the same " +"type." msgstr "" -msgid "The recommended way to create array types is by multiplying a data type with a positive integer::" +#: ../../library/ctypes.rst:851 +msgid "" +"The recommended way to create array types is by multiplying a data type with " +"a positive integer::" msgstr "" +#: ../../library/ctypes.rst:854 msgid "TenPointsArrayType = POINT * 10" msgstr "" -msgid "Here is an example of a somewhat artificial data type, a structure containing 4 POINTs among other stuff::" +#: ../../library/ctypes.rst:856 +msgid "" +"Here is an example of a somewhat artificial data type, a structure " +"containing 4 POINTs among other stuff::" msgstr "" +#: ../../library/ctypes.rst:859 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -982,21 +1474,28 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:872 msgid "Instances are created in the usual way, by calling the class::" msgstr "" +#: ../../library/ctypes.rst:874 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" " print(pt.x, pt.y)" msgstr "" -msgid "The above code print a series of ``0 0`` lines, because the array contents is initialized to zeros." +#: ../../library/ctypes.rst:878 +msgid "" +"The above code print a series of ``0 0`` lines, because the array contents " +"is initialized to zeros." msgstr "" +#: ../../library/ctypes.rst:881 msgid "Initializers of the correct type can also be specified::" msgstr "" +#: ../../library/ctypes.rst:883 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1009,12 +1508,17 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:897 msgid "Pointers" msgstr "" -msgid "Pointer instances are created by calling the :func:`pointer` function on a :mod:`!ctypes` type::" +#: ../../library/ctypes.rst:899 +msgid "" +"Pointer instances are created by calling the :func:`pointer` function on " +"a :mod:`!ctypes` type::" msgstr "" +#: ../../library/ctypes.rst:902 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" @@ -1022,18 +1526,26 @@ msgid "" ">>>" msgstr "" -msgid "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns the object to which the pointer points, the ``i`` object above::" +#: ../../library/ctypes.rst:907 +msgid "" +"Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " +"the object to which the pointer points, the ``i`` object above::" msgstr "" +#: ../../library/ctypes.rst:910 msgid "" ">>> pi.contents\n" "c_long(42)\n" ">>>" msgstr "" -msgid "Note that :mod:`!ctypes` does not have OOR (original object return), it constructs a new, equivalent object each time you retrieve an attribute::" +#: ../../library/ctypes.rst:914 +msgid "" +"Note that :mod:`!ctypes` does not have OOR (original object return), it " +"constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" +#: ../../library/ctypes.rst:917 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1042,9 +1554,14 @@ msgid "" ">>>" msgstr "" -msgid "Assigning another :class:`c_int` instance to the pointer's contents attribute would cause the pointer to point to the memory location where this is stored::" +#: ../../library/ctypes.rst:923 +msgid "" +"Assigning another :class:`c_int` instance to the pointer's contents " +"attribute would cause the pointer to point to the memory location where this " +"is stored::" msgstr "" +#: ../../library/ctypes.rst:926 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1053,18 +1570,22 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:935 msgid "Pointer instances can also be indexed with integers::" msgstr "" +#: ../../library/ctypes.rst:937 msgid "" ">>> pi[0]\n" "99\n" ">>>" msgstr "" +#: ../../library/ctypes.rst:941 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" +#: ../../library/ctypes.rst:943 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1074,12 +1595,24 @@ msgid "" ">>>" msgstr "" -msgid "It is also possible to use indexes different from 0, but you must know what you're doing, just as in C: You can access or change arbitrary memory locations. Generally you only use this feature if you receive a pointer from a C function, and you *know* that the pointer actually points to an array instead of a single item." +#: ../../library/ctypes.rst:950 +msgid "" +"It is also possible to use indexes different from 0, but you must know what " +"you're doing, just as in C: You can access or change arbitrary memory " +"locations. Generally you only use this feature if you receive a pointer from " +"a C function, and you *know* that the pointer actually points to an array " +"instead of a single item." msgstr "" -msgid "Behind the scenes, the :func:`pointer` function does more than simply create pointer instances, it has to create pointer *types* first. This is done with the :func:`POINTER` function, which accepts any :mod:`!ctypes` type, and returns a new type::" +#: ../../library/ctypes.rst:956 +msgid "" +"Behind the scenes, the :func:`pointer` function does more than simply create " +"pointer instances, it has to create pointer *types* first. This is done with " +"the :func:`POINTER` function, which accepts any :mod:`!ctypes` type, and " +"returns a new type::" msgstr "" +#: ../../library/ctypes.rst:961 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1093,9 +1626,13 @@ msgid "" ">>>" msgstr "" -msgid "Calling the pointer type without an argument creates a ``NULL`` pointer. ``NULL`` pointers have a ``False`` boolean value::" +#: ../../library/ctypes.rst:972 +msgid "" +"Calling the pointer type without an argument creates a ``NULL`` pointer. " +"``NULL`` pointers have a ``False`` boolean value::" msgstr "" +#: ../../library/ctypes.rst:975 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" @@ -1103,9 +1640,13 @@ msgid "" ">>>" msgstr "" -msgid ":mod:`!ctypes` checks for ``NULL`` when dereferencing pointers (but dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" +#: ../../library/ctypes.rst:980 +msgid "" +":mod:`!ctypes` checks for ``NULL`` when dereferencing pointers (but " +"dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" +#: ../../library/ctypes.rst:983 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1120,21 +1661,34 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:998 msgid "Thread safety without the GIL" msgstr "" -msgid "From Python 3.13 onward, the :term:`GIL` can be disabled on the :term:`free-threaded build`. In ctypes, reads and writes to a single object concurrently is safe, but not across multiple objects:" +#: ../../library/ctypes.rst:1000 +msgid "" +"From Python 3.13 onward, the :term:`GIL` can be disabled on the :term:`free-" +"threaded build`. In ctypes, reads and writes to a single object concurrently " +"is safe, but not across multiple objects:" msgstr "" +#: ../../library/ctypes.rst:1003 msgid "" ">>> number = c_int(42)\n" ">>> pointer_a = pointer(number)\n" ">>> pointer_b = pointer(number)" msgstr "" -msgid "In the above, it's only safe for one object to read and write to the address at once if the GIL is disabled. So, ``pointer_a`` can be shared and written to across multiple threads, but only if ``pointer_b`` is not also attempting to do the same. If this is an issue, consider using a :class:`threading.Lock` to synchronize access to memory:" +#: ../../library/ctypes.rst:1009 +msgid "" +"In the above, it's only safe for one object to read and write to the address " +"at once if the GIL is disabled. So, ``pointer_a`` can be shared and written " +"to across multiple threads, but only if ``pointer_b`` is not also attempting " +"to do the same. If this is an issue, consider using " +"a :class:`threading.Lock` to synchronize access to memory:" msgstr "" +#: ../../library/ctypes.rst:1014 msgid "" ">>> import threading\n" ">>> lock = threading.Lock()\n" @@ -1146,12 +1700,22 @@ msgid "" "... pointer_b.contents = 42" msgstr "" +#: ../../library/ctypes.rst:1029 msgid "Type conversions" msgstr "" -msgid "Usually, ctypes does strict type checking. This means, if you have ``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or as the type of a member field in a structure definition, only instances of exactly the same type are accepted. There are some exceptions to this rule, where ctypes accepts other objects. For example, you can pass compatible array instances instead of pointer types. So, for ``POINTER(c_int)``, ctypes accepts an array of c_int::" +#: ../../library/ctypes.rst:1031 +msgid "" +"Usually, ctypes does strict type checking. This means, if you have " +"``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " +"as the type of a member field in a structure definition, only instances of " +"exactly the same type are accepted. There are some exceptions to this rule, " +"where ctypes accepts other objects. For example, you can pass compatible " +"array instances instead of pointer types. So, for ``POINTER(c_int)``, " +"ctypes accepts an array of c_int::" msgstr "" +#: ../../library/ctypes.rst:1038 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1168,34 +1732,58 @@ msgid "" ">>>" msgstr "" -msgid "In addition, if a function argument is explicitly declared to be a pointer type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object of the pointed type (``c_int`` in this case) can be passed to the function. ctypes will apply the required :func:`byref` conversion in this case automatically." +#: ../../library/ctypes.rst:1052 +msgid "" +"In addition, if a function argument is explicitly declared to be a pointer " +"type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " +"of the pointed type (``c_int`` in this case) can be passed to the function. " +"ctypes will apply the required :func:`byref` conversion in this case " +"automatically." msgstr "" +#: ../../library/ctypes.rst:1057 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" +#: ../../library/ctypes.rst:1059 msgid "" ">>> bar.values = None\n" ">>>" msgstr "" -msgid "Sometimes you have instances of incompatible types. In C, you can cast one type into another type. :mod:`!ctypes` provides a :func:`cast` function which can be used in the same way. The ``Bar`` structure defined above accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its ``values`` field, but not instances of other types::" +#: ../../library/ctypes.rst:1064 +msgid "" +"Sometimes you have instances of incompatible types. In C, you can cast one " +"type into another type. :mod:`!ctypes` provides a :func:`cast` function " +"which can be used in the same way. The ``Bar`` structure defined above " +"accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its " +"``values`` field, but not instances of other types::" msgstr "" +#: ../../library/ctypes.rst:1070 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance\n" +"TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long " +"instance\n" ">>>" msgstr "" +#: ../../library/ctypes.rst:1076 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -msgid "The :func:`cast` function can be used to cast a ctypes instance into a pointer to a different ctypes data type. :func:`cast` takes two parameters, a ctypes object that is or can be converted to a pointer of some kind, and a ctypes pointer type. It returns an instance of the second argument, which references the same memory block as the first argument::" +#: ../../library/ctypes.rst:1078 +msgid "" +"The :func:`cast` function can be used to cast a ctypes instance into a " +"pointer to a different ctypes data type. :func:`cast` takes two parameters, " +"a ctypes object that is or can be converted to a pointer of some kind, and a " +"ctypes pointer type. It returns an instance of the second argument, which " +"references the same memory block as the first argument::" msgstr "" +#: ../../library/ctypes.rst:1084 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" @@ -1203,9 +1791,13 @@ msgid "" ">>>" msgstr "" -msgid "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` the structure::" +#: ../../library/ctypes.rst:1089 +msgid "" +"So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " +"the structure::" msgstr "" +#: ../../library/ctypes.rst:1092 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1214,12 +1806,18 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:1102 msgid "Incomplete Types" msgstr "" -msgid "*Incomplete Types* are structures, unions or arrays whose members are not yet specified. In C, they are specified by forward declarations, which are defined later::" +#: ../../library/ctypes.rst:1104 +msgid "" +"*Incomplete Types* are structures, unions or arrays whose members are not " +"yet specified. In C, they are specified by forward declarations, which are " +"defined later::" msgstr "" +#: ../../library/ctypes.rst:1108 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1229,9 +1827,13 @@ msgid "" "};" msgstr "" -msgid "The straightforward translation into ctypes code would be this, but it does not work::" +#: ../../library/ctypes.rst:1115 +msgid "" +"The straightforward translation into ctypes code would be this, but it does " +"not work::" msgstr "" +#: ../../library/ctypes.rst:1118 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -1244,9 +1846,14 @@ msgid "" ">>>" msgstr "" -msgid "because the new ``class cell`` is not available in the class statement itself. In :mod:`!ctypes`, we can define the ``cell`` class and set the :attr:`~Structure._fields_` attribute later, after the class statement::" +#: ../../library/ctypes.rst:1128 +msgid "" +"because the new ``class cell`` is not available in the class statement " +"itself. In :mod:`!ctypes`, we can define the ``cell`` class and set " +"the :attr:`~Structure._fields_` attribute later, after the class statement::" msgstr "" +#: ../../library/ctypes.rst:1132 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -1257,9 +1864,13 @@ msgid "" ">>>" msgstr "" -msgid "Let's try it. We create two instances of ``cell``, and let them point to each other, and finally follow the pointer chain a few times::" +#: ../../library/ctypes.rst:1140 +msgid "" +"Let's try it. We create two instances of ``cell``, and let them point to " +"each other, and finally follow the pointer chain a few times::" msgstr "" +#: ../../library/ctypes.rst:1143 msgid "" ">>> c1 = cell()\n" ">>> c1.name = b\"foo\"\n" @@ -1276,24 +1887,46 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:1161 msgid "Callback functions" msgstr "" -msgid ":mod:`!ctypes` allows creating C callable function pointers from Python callables. These are sometimes called *callback functions*." +#: ../../library/ctypes.rst:1163 +msgid "" +":mod:`!ctypes` allows creating C callable function pointers from Python " +"callables. These are sometimes called *callback functions*." msgstr "" -msgid "First, you must create a class for the callback function. The class knows the calling convention, the return type, and the number and types of arguments this function will receive." +#: ../../library/ctypes.rst:1166 +msgid "" +"First, you must create a class for the callback function. The class knows " +"the calling convention, the return type, and the number and types of " +"arguments this function will receive." msgstr "" -msgid "The :func:`CFUNCTYPE` factory function creates types for callback functions using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` factory function creates types for callback functions using the ``stdcall`` calling convention." +#: ../../library/ctypes.rst:1170 +msgid "" +"The :func:`CFUNCTYPE` factory function creates types for callback functions " +"using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " +"factory function creates types for callback functions using the ``stdcall`` " +"calling convention." msgstr "" -msgid "Both of these factory functions are called with the result type as first argument, and the callback functions expected argument types as the remaining arguments." +#: ../../library/ctypes.rst:1175 +msgid "" +"Both of these factory functions are called with the result type as first " +"argument, and the callback functions expected argument types as the " +"remaining arguments." msgstr "" -msgid "I will present an example here which uses the standard C library's :c:func:`!qsort` function, that is used to sort items with the help of a callback function. :c:func:`!qsort` will be used to sort an array of integers::" +#: ../../library/ctypes.rst:1179 +msgid "" +"I will present an example here which uses the standard C library's :c:func:`!" +"qsort` function, that is used to sort items with the help of a callback " +"function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" +#: ../../library/ctypes.rst:1183 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -1302,20 +1935,35 @@ msgid "" ">>>" msgstr "" -msgid ":func:`!qsort` must be called with a pointer to the data to sort, the number of items in the data array, the size of one item, and a pointer to the comparison function, the callback. The callback will then be called with two pointers to items, and it must return a negative integer if the first item is smaller than the second, a zero if they are equal, and a positive integer otherwise." +#: ../../library/ctypes.rst:1189 +msgid "" +":func:`!qsort` must be called with a pointer to the data to sort, the number " +"of items in the data array, the size of one item, and a pointer to the " +"comparison function, the callback. The callback will then be called with two " +"pointers to items, and it must return a negative integer if the first item " +"is smaller than the second, a zero if they are equal, and a positive integer " +"otherwise." msgstr "" -msgid "So our callback function receives pointers to integers, and must return an integer. First we create the ``type`` for the callback function::" +#: ../../library/ctypes.rst:1195 +msgid "" +"So our callback function receives pointers to integers, and must return an " +"integer. First we create the ``type`` for the callback function::" msgstr "" +#: ../../library/ctypes.rst:1198 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" msgstr "" -msgid "To get started, here is a simple callback that shows the values it gets passed::" +#: ../../library/ctypes.rst:1201 +msgid "" +"To get started, here is a simple callback that shows the values it gets " +"passed::" msgstr "" +#: ../../library/ctypes.rst:1204 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -1325,9 +1973,11 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:1211 msgid "The result::" msgstr "" +#: ../../library/ctypes.rst:1213 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" @@ -1338,9 +1988,11 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:1221 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" +#: ../../library/ctypes.rst:1223 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -1356,9 +2008,11 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:1236 msgid "As we can easily check, our array is sorted now::" msgstr "" +#: ../../library/ctypes.rst:1238 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" @@ -1366,9 +2020,13 @@ msgid "" ">>>" msgstr "" -msgid "The function factories can be used as decorator factories, so we may as well write::" +#: ../../library/ctypes.rst:1243 +msgid "" +"The function factories can be used as decorator factories, so we may as well " +"write::" msgstr "" +#: ../../library/ctypes.rst:1246 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -1384,39 +2042,74 @@ msgid "" ">>>" msgstr "" -msgid "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they are used from C code. :mod:`!ctypes` doesn't, and if you don't, they may be garbage collected, crashing your program when a callback is made." +#: ../../library/ctypes.rst:1261 +msgid "" +"Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " +"are used from C code. :mod:`!ctypes` doesn't, and if you don't, they may be " +"garbage collected, crashing your program when a callback is made." msgstr "" -msgid "Also, note that if the callback function is called in a thread created outside of Python's control (e.g. by the foreign code that calls the callback), ctypes creates a new dummy Python thread on every invocation. This behavior is correct for most purposes, but it means that values stored with :class:`threading.local` will *not* survive across different callbacks, even when those calls are made from the same C thread." +#: ../../library/ctypes.rst:1265 +msgid "" +"Also, note that if the callback function is called in a thread created " +"outside of Python's control (e.g. by the foreign code that calls the " +"callback), ctypes creates a new dummy Python thread on every invocation. " +"This behavior is correct for most purposes, but it means that values stored " +"with :class:`threading.local` will *not* survive across different callbacks, " +"even when those calls are made from the same C thread." msgstr "" +#: ../../library/ctypes.rst:1275 msgid "Accessing values exported from dlls" msgstr "" -msgid "Some shared libraries not only export functions, they also export variables. An example in the Python library itself is the :c:data:`Py_Version`, Python runtime version number encoded in a single constant integer." +#: ../../library/ctypes.rst:1277 +msgid "" +"Some shared libraries not only export functions, they also export variables. " +"An example in the Python library itself is the :c:data:`Py_Version`, Python " +"runtime version number encoded in a single constant integer." msgstr "" -msgid ":mod:`!ctypes` can access values like this with the :meth:`~_CData.in_dll` class methods of the type. *pythonapi* is a predefined symbol giving access to the Python C api::" +#: ../../library/ctypes.rst:1281 +msgid "" +":mod:`!ctypes` can access values like this with the :meth:`~_CData.in_dll` " +"class methods of the type. *pythonapi* is a predefined symbol giving access " +"to the Python C api::" msgstr "" +#: ../../library/ctypes.rst:1285 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" "0x30c00a0" msgstr "" -msgid "An extended example which also demonstrates the use of pointers accesses the :c:data:`PyImport_FrozenModules` pointer exported by Python." +#: ../../library/ctypes.rst:1289 +msgid "" +"An extended example which also demonstrates the use of pointers accesses " +"the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" +#: ../../library/ctypes.rst:1292 msgid "Quoting the docs for that value:" msgstr "" -msgid "This pointer is initialized to point to an array of :c:struct:`_frozen` records, terminated by one whose members are all ``NULL`` or zero. When a frozen module is imported, it is searched in this table. Third-party code could play tricks with this to provide a dynamically created collection of frozen modules." +#: ../../library/ctypes.rst:1294 +msgid "" +"This pointer is initialized to point to an array of :c:struct:`_frozen` " +"records, terminated by one whose members are all ``NULL`` or zero. When a " +"frozen module is imported, it is searched in this table. Third-party code " +"could play tricks with this to provide a dynamically created collection of " +"frozen modules." msgstr "" -msgid "So manipulating this pointer could even prove useful. To restrict the example size, we show only how this table can be read with :mod:`!ctypes`::" +#: ../../library/ctypes.rst:1299 +msgid "" +"So manipulating this pointer could even prove useful. To restrict the " +"example size, we show only how this table can be read with :mod:`!ctypes`::" msgstr "" +#: ../../library/ctypes.rst:1302 msgid "" ">>> from ctypes import *\n" ">>>\n" @@ -1430,18 +2123,29 @@ msgid "" ">>>" msgstr "" -msgid "We have defined the :c:struct:`_frozen` data type, so we can get the pointer to the table::" +#: ../../library/ctypes.rst:1313 +msgid "" +"We have defined the :c:struct:`_frozen` data type, so we can get the pointer " +"to the table::" msgstr "" +#: ../../library/ctypes.rst:1316 msgid "" ">>> FrozenTable = POINTER(struct_frozen)\n" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" ">>>" msgstr "" -msgid "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, we can iterate over it, but we just have to make sure that our loop terminates, because pointers have no size. Sooner or later it would probably crash with an access violation or whatever, so it's better to break out of the loop when we hit the ``NULL`` entry::" +#: ../../library/ctypes.rst:1320 +msgid "" +"Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " +"we can iterate over it, but we just have to make sure that our loop " +"terminates, because pointers have no size. Sooner or later it would probably " +"crash with an access violation or whatever, so it's better to break out of " +"the loop when we hit the ``NULL`` entry::" msgstr "" +#: ../../library/ctypes.rst:1326 msgid "" ">>> for item in table:\n" "... if item.name is None:\n" @@ -1454,18 +2158,28 @@ msgid "" ">>>" msgstr "" -msgid "The fact that standard Python has a frozen module and a frozen package (indicated by the negative ``size`` member) is not well known, it is only used for testing. Try it out with ``import __hello__`` for example." +#: ../../library/ctypes.rst:1336 +msgid "" +"The fact that standard Python has a frozen module and a frozen package " +"(indicated by the negative ``size`` member) is not well known, it is only " +"used for testing. Try it out with ``import __hello__`` for example." msgstr "" +#: ../../library/ctypes.rst:1344 msgid "Surprises" msgstr "" -msgid "There are some edges in :mod:`!ctypes` where you might expect something other than what actually happens." +#: ../../library/ctypes.rst:1346 +msgid "" +"There are some edges in :mod:`!ctypes` where you might expect something " +"other than what actually happens." msgstr "" +#: ../../library/ctypes.rst:1349 msgid "Consider the following example::" msgstr "" +#: ../../library/ctypes.rst:1351 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1486,9 +2200,13 @@ msgid "" ">>>" msgstr "" -msgid "Hm. We certainly expected the last statement to print ``3 4 1 2``. What happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" +#: ../../library/ctypes.rst:1369 +msgid "" +"Hm. We certainly expected the last statement to print ``3 4 1 2``. What " +"happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" +#: ../../library/ctypes.rst:1372 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" @@ -1496,15 +2214,29 @@ msgid "" ">>>" msgstr "" -msgid "Note that ``temp0`` and ``temp1`` are objects still using the internal buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the buffer contents of ``temp0`` into ``rc`` 's buffer. This, in turn, changes the contents of ``temp1``. So, the last assignment ``rc.b = temp1``, doesn't have the expected effect." +#: ../../library/ctypes.rst:1377 +msgid "" +"Note that ``temp0`` and ``temp1`` are objects still using the internal " +"buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " +"buffer contents of ``temp0`` into ``rc`` 's buffer. This, in turn, changes " +"the contents of ``temp1``. So, the last assignment ``rc.b = temp1``, doesn't " +"have the expected effect." msgstr "" -msgid "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays doesn't *copy* the sub-object, instead it retrieves a wrapper object accessing the root-object's underlying buffer." +#: ../../library/ctypes.rst:1383 +msgid "" +"Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " +"doesn't *copy* the sub-object, instead it retrieves a wrapper object " +"accessing the root-object's underlying buffer." msgstr "" -msgid "Another example that may behave differently from what one would expect is this::" +#: ../../library/ctypes.rst:1387 +msgid "" +"Another example that may behave differently from what one would expect is " +"this::" msgstr "" +#: ../../library/ctypes.rst:1389 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -1515,21 +2247,41 @@ msgid "" ">>>" msgstr "" -msgid "Objects instantiated from :class:`c_char_p` can only have their value set to bytes or integers." +#: ../../library/ctypes.rst:1399 +msgid "" +"Objects instantiated from :class:`c_char_p` can only have their value set to " +"bytes or integers." msgstr "" -msgid "Why is it printing ``False``? ctypes instances are objects containing a memory block plus some :term:`descriptor`\\s accessing the contents of the memory. Storing a Python object in the memory block does not store the object itself, instead the ``contents`` of the object is stored. Accessing the contents again constructs a new Python object each time!" +#: ../../library/ctypes.rst:1402 +msgid "" +"Why is it printing ``False``? ctypes instances are objects containing a " +"memory block plus some :term:`descriptor`\\s accessing the contents of the " +"memory. Storing a Python object in the memory block does not store the " +"object itself, instead the ``contents`` of the object is stored. Accessing " +"the contents again constructs a new Python object each time!" msgstr "" +#: ../../library/ctypes.rst:1412 msgid "Variable-sized data types" msgstr "" -msgid ":mod:`!ctypes` provides some support for variable-sized arrays and structures." +#: ../../library/ctypes.rst:1414 +msgid "" +":mod:`!ctypes` provides some support for variable-sized arrays and " +"structures." msgstr "" -msgid "The :func:`resize` function can be used to resize the memory buffer of an existing ctypes object. The function takes the object as first argument, and the requested size in bytes as the second argument. The memory block cannot be made smaller than the natural memory block specified by the objects type, a :exc:`ValueError` is raised if this is tried::" +#: ../../library/ctypes.rst:1416 +msgid "" +"The :func:`resize` function can be used to resize the memory buffer of an " +"existing ctypes object. The function takes the object as first argument, " +"and the requested size in bytes as the second argument. The memory block " +"cannot be made smaller than the natural memory block specified by the " +"objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" +#: ../../library/ctypes.rst:1422 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -1546,9 +2298,14 @@ msgid "" ">>>" msgstr "" -msgid "This is nice and fine, but how would one access the additional elements contained in this array? Since the type still only knows about 4 elements, we get errors accessing other elements::" +#: ../../library/ctypes.rst:1436 +msgid "" +"This is nice and fine, but how would one access the additional elements " +"contained in this array? Since the type still only knows about 4 elements, " +"we get errors accessing other elements::" msgstr "" +#: ../../library/ctypes.rst:1440 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -1559,42 +2316,79 @@ msgid "" ">>>" msgstr "" -msgid "Another way to use variable-sized data types with :mod:`!ctypes` is to use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by case basis." +#: ../../library/ctypes.rst:1448 +msgid "" +"Another way to use variable-sized data types with :mod:`!ctypes` is to use " +"the dynamic nature of Python, and (re-)define the data type after the " +"required size is already known, on a case by case basis." msgstr "" +#: ../../library/ctypes.rst:1456 msgid "ctypes reference" msgstr "" +#: ../../library/ctypes.rst:1462 msgid "Finding shared libraries" msgstr "" -msgid "When programming in a compiled language, shared libraries are accessed when compiling/linking a program, and when the program is run." +#: ../../library/ctypes.rst:1464 +msgid "" +"When programming in a compiled language, shared libraries are accessed when " +"compiling/linking a program, and when the program is run." msgstr "" -msgid "The purpose of the :func:`~ctypes.util.find_library` function is to locate a library in a way similar to what the compiler or runtime loader does (on platforms with several versions of a shared library the most recent should be loaded), while the ctypes library loaders act like when a program is run, and call the runtime loader directly." +#: ../../library/ctypes.rst:1467 +msgid "" +"The purpose of the :func:`~ctypes.util.find_library` function is to locate a " +"library in a way similar to what the compiler or runtime loader does (on " +"platforms with several versions of a shared library the most recent should " +"be loaded), while the ctypes library loaders act like when a program is run, " +"and call the runtime loader directly." msgstr "" -msgid "The :mod:`!ctypes.util` module provides a function which can help to determine the library to load." +#: ../../library/ctypes.rst:1473 +msgid "" +"The :mod:`!ctypes.util` module provides a function which can help to " +"determine the library to load." msgstr "" -msgid "Try to find a library and return a pathname. *name* is the library name without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version number (this is the form used for the posix linker option :option:`!-l`). If no library can be found, returns ``None``." +#: ../../library/ctypes.rst:1481 +msgid "" +"Try to find a library and return a pathname. *name* is the library name " +"without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " +"number (this is the form used for the posix linker option :option:`!-l`). " +"If no library can be found, returns ``None``." msgstr "" +#: ../../library/ctypes.rst:1486 ../../library/ctypes.rst:2245 msgid "The exact functionality is system dependent." msgstr "" -msgid "On Linux, :func:`~ctypes.util.find_library` tries to run external programs (``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library file. It returns the filename of the library file." +#: ../../library/ctypes.rst:1488 +msgid "" +"On Linux, :func:`~ctypes.util.find_library` tries to run external programs " +"(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " +"file. It returns the filename of the library file." msgstr "" -msgid "Note that if the output of these programs does not correspond to the dynamic linker used by Python, the result of this function may be misleading." +#: ../../library/ctypes.rst:1492 +msgid "" +"Note that if the output of these programs does not correspond to the dynamic " +"linker used by Python, the result of this function may be misleading." msgstr "" -msgid "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used when searching for libraries, if a library cannot be found by any other means." +#: ../../library/ctypes.rst:1495 +msgid "" +"On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " +"when searching for libraries, if a library cannot be found by any other " +"means." msgstr "" +#: ../../library/ctypes.rst:1499 msgid "Here are some examples::" msgstr "" +#: ../../library/ctypes.rst:1501 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -1606,9 +2400,14 @@ msgid "" ">>>" msgstr "" -msgid "On macOS and Android, :func:`~ctypes.util.find_library` uses the system's standard naming schemes and paths to locate the library, and returns a full pathname if successful::" +#: ../../library/ctypes.rst:1510 +msgid "" +"On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " +"standard naming schemes and paths to locate the library, and returns a full " +"pathname if successful::" msgstr "" +#: ../../library/ctypes.rst:1514 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -1622,60 +2421,122 @@ msgid "" ">>>" msgstr "" -msgid "On Windows, :func:`~ctypes.util.find_library` searches along the system search path, and returns the full pathname, but since there is no predefined naming scheme a call like ``find_library(\"c\")`` will fail and return ``None``." +#: ../../library/ctypes.rst:1525 +msgid "" +"On Windows, :func:`~ctypes.util.find_library` searches along the system " +"search path, and returns the full pathname, but since there is no predefined " +"naming scheme a call like ``find_library(\"c\")`` will fail and return " +"``None``." msgstr "" -msgid "If wrapping a shared library with :mod:`!ctypes`, it *may* be better to determine the shared library name at development time, and hardcode that into the wrapper module instead of using :func:`~ctypes.util.find_library` to locate the library at runtime." +#: ../../library/ctypes.rst:1529 +msgid "" +"If wrapping a shared library with :mod:`!ctypes`, it *may* be better to " +"determine the shared library name at development time, and hardcode that " +"into the wrapper module instead of using :func:`~ctypes.util.find_library` " +"to locate the library at runtime." msgstr "" +#: ../../library/ctypes.rst:1537 msgid "Listing loaded shared libraries" msgstr "" -msgid "When writing code that relies on code loaded from shared libraries, it can be useful to know which shared libraries have already been loaded into the current process." +#: ../../library/ctypes.rst:1539 +msgid "" +"When writing code that relies on code loaded from shared libraries, it can " +"be useful to know which shared libraries have already been loaded into the " +"current process." msgstr "" -msgid "The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` function, which calls the different APIs provided by the various platforms to help determine which shared libraries have already been loaded into the current process." +#: ../../library/ctypes.rst:1543 +msgid "" +"The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` " +"function, which calls the different APIs provided by the various platforms " +"to help determine which shared libraries have already been loaded into the " +"current process." msgstr "" -msgid "The exact output of this function will be system dependent. On most platforms, the first entry of this list represents the current process itself, which may be an empty string. For example, on glibc-based Linux, the return may look like::" +#: ../../library/ctypes.rst:1547 +msgid "" +"The exact output of this function will be system dependent. On most " +"platforms, the first entry of this list represents the current process " +"itself, which may be an empty string. For example, on glibc-based Linux, the " +"return may look like::" msgstr "" +#: ../../library/ctypes.rst:1552 msgid "" ">>> from ctypes.util import dllist\n" ">>> dllist()\n" -"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-linux-gnu/libc.so.6', ... ]" +"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" +"linux-gnu/libc.so.6', ... ]" msgstr "" +#: ../../library/ctypes.rst:1559 msgid "Loading shared libraries" msgstr "" -msgid "There are several ways to load shared libraries into the Python process. One way is to instantiate :py:class:`CDLL` or one of its subclasses:" +#: ../../library/ctypes.rst:1561 +msgid "" +"There are several ways to load shared libraries into the Python process. " +"One way is to instantiate :py:class:`CDLL` or one of its subclasses:" msgstr "" +#: ../../library/ctypes.rst:1567 msgid "Represents a loaded shared library." msgstr "" -msgid "Functions in this library use the standard C calling convention, and are assumed to return :c:expr:`int`. The Python :term:`global interpreter lock` is released before calling any function exported by these libraries, and reacquired afterwards. For different function behavior, use a subclass: :py:class:`~ctypes.OleDLL`, :py:class:`~ctypes.WinDLL`, or :py:class:`~ctypes.PyDLL`." +#: ../../library/ctypes.rst:1569 +msgid "" +"Functions in this library use the standard C calling convention, and are " +"assumed to return :c:expr:`int`. The Python :term:`global interpreter lock` " +"is released before calling any function exported by these libraries, and " +"reacquired afterwards. For different function behavior, use a " +"subclass: :py:class:`~ctypes.OleDLL`, :py:class:`~ctypes.WinDLL`, " +"or :py:class:`~ctypes.PyDLL`." msgstr "" -msgid "If you have an existing :py:attr:`handle ` to an already loaded shared library, it can be passed as the *handle* argument to wrap the opened library in a new :py:class:`!CDLL` object. In this case, *name* is only used to set the :py:attr:`~ctypes.CDLL._name` attribute, but it may be adjusted and/or validated." +#: ../../library/ctypes.rst:1576 +msgid "" +"If you have an existing :py:attr:`handle ` to an " +"already loaded shared library, it can be passed as the *handle* argument to " +"wrap the opened library in a new :py:class:`!CDLL` object. In this case, " +"*name* is only used to set the :py:attr:`~ctypes.CDLL._name` attribute, but " +"it may be adjusted and/or validated." msgstr "" -msgid "If *handle* is ``None``, the underlying platform's :manpage:`dlopen(3)` or :c:func:`!LoadLibrary` function is used to load the library into the process, and to get a handle to it." +#: ../../library/ctypes.rst:1582 +msgid "" +"If *handle* is ``None``, the underlying platform's :manpage:`dlopen(3)` " +"or :c:func:`!LoadLibrary` function is used to load the library into the " +"process, and to get a handle to it." msgstr "" -msgid "*name* is the pathname of the shared library to open. If *name* does not contain a path separator, the library is found in a platform-specific way." +#: ../../library/ctypes.rst:1586 +msgid "" +"*name* is the pathname of the shared library to open. If *name* does not " +"contain a path separator, the library is found in a platform-specific way." msgstr "" -msgid "On non-Windows systems, *name* can be ``None``. In this case, :c:func:`!dlopen` is called with ``NULL``, which opens the main program as a \"library\". (Some systems do the same is *name* is empty; ``None``/``NULL`` is more portable.)" +#: ../../library/ctypes.rst:1590 +msgid "" +"On non-Windows systems, *name* can be ``None``. In this case, :c:func:`!" +"dlopen` is called with ``NULL``, which opens the main program as a " +"\"library\". (Some systems do the same is *name* is empty; ``None``/``NULL`` " +"is more portable.)" msgstr "" +#: ../../library/ctypes.rst:1596 msgid "CPython implementation detail" msgstr "" -msgid "Since CPython is linked to ``libc``, a ``None`` *name* is often used to access the C standard library::" +#: ../../library/ctypes.rst:1598 +msgid "" +"Since CPython is linked to ``libc``, a ``None`` *name* is often used to " +"access the C standard library::" msgstr "" +#: ../../library/ctypes.rst:1601 msgid "" ">>> printf = ctypes.CDLL(None).printf\n" ">>> printf.argtypes = [ctypes.c_char_p]\n" @@ -1684,39 +2545,95 @@ msgid "" "6" msgstr "" -msgid "To access the Python C API, prefer :py:data:`ctypes.pythonapi` which works across platforms." -msgstr "" - -msgid "The *mode* parameter can be used to specify how the library is loaded. For details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is ignored. On posix systems, RTLD_NOW is always added, and is not configurable." +#: ../../library/ctypes.rst:1607 +msgid "" +"To access the Python C API, prefer :py:data:`ctypes.pythonapi` which works " +"across platforms." msgstr "" -msgid "The *use_errno* parameter, when set to true, enables a ctypes mechanism that allows accessing the system :data:`errno` error number in a safe way. :mod:`!ctypes` maintains a thread-local copy of the system's :data:`errno` variable; if you call foreign functions created with ``use_errno=True`` then the :data:`errno` value before the function call is swapped with the ctypes private copy, the same happens immediately after the function call." +#: ../../library/ctypes.rst:1610 +msgid "" +"The *mode* parameter can be used to specify how the library is loaded. For " +"details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " +"ignored. On posix systems, RTLD_NOW is always added, and is not " +"configurable." msgstr "" -msgid "The function :func:`ctypes.get_errno` returns the value of the ctypes private copy, and the function :func:`ctypes.set_errno` changes the ctypes private copy to a new value and returns the former value." +#: ../../library/ctypes.rst:1615 +msgid "" +"The *use_errno* parameter, when set to true, enables a ctypes mechanism that " +"allows accessing the system :data:`errno` error number in a safe way. :mod:`!" +"ctypes` maintains a thread-local copy of the system's :data:`errno` " +"variable; if you call foreign functions created with ``use_errno=True`` then " +"the :data:`errno` value before the function call is swapped with the ctypes " +"private copy, the same happens immediately after the function call." msgstr "" -msgid "The *use_last_error* parameter, when set to true, enables the same mechanism for the Windows error code which is managed by the :func:`GetLastError` and :func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` are used to request and change the ctypes private copy of the windows error code." +#: ../../library/ctypes.rst:1622 +msgid "" +"The function :func:`ctypes.get_errno` returns the value of the ctypes " +"private copy, and the function :func:`ctypes.set_errno` changes the ctypes " +"private copy to a new value and returns the former value." msgstr "" -msgid "The *winmode* parameter is used on Windows to specify how the library is loaded (since *mode* is ignored). It takes any value that is valid for the Win32 API ``LoadLibraryEx`` flags parameter. When omitted, the default is to use the flags that result in the most secure DLL load, which avoids issues such as DLL hijacking. Passing the full path to the DLL is the safest way to ensure the correct library and dependencies are loaded." +#: ../../library/ctypes.rst:1626 +msgid "" +"The *use_last_error* parameter, when set to true, enables the same mechanism " +"for the Windows error code which is managed by the :func:`GetLastError` " +"and :func:`!SetLastError` Windows API " +"functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` " +"are used to request and change the ctypes private copy of the windows error " +"code." msgstr "" -msgid "On Windows creating a :class:`CDLL` instance may fail even if the DLL name exists. When a dependent DLL of the loaded DLL is not found, a :exc:`OSError` error is raised with the message *\"[WinError 126] The specified module could not be found\".* This error message does not contain the name of the missing DLL because the Windows API does not return this information making this error hard to diagnose. To resolve this error and determine which DLL is not found, you need to find the list of dependent DLLs and determine which one is not found using Windows debugging and tracing tools." +#: ../../library/ctypes.rst:1632 +msgid "" +"The *winmode* parameter is used on Windows to specify how the library is " +"loaded (since *mode* is ignored). It takes any value that is valid for the " +"Win32 API ``LoadLibraryEx`` flags parameter. When omitted, the default is to " +"use the flags that result in the most secure DLL load, which avoids issues " +"such as DLL hijacking. Passing the full path to the DLL is the safest way to " +"ensure the correct library and dependencies are loaded." msgstr "" -msgid "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." +#: ../../library/ctypes.rst:1639 +msgid "" +"On Windows creating a :class:`CDLL` instance may fail even if the DLL name " +"exists. When a dependent DLL of the loaded DLL is not found, " +"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " +"specified module could not be found\".* This error message does not contain " +"the name of the missing DLL because the Windows API does not return this " +"information making this error hard to diagnose. To resolve this error and " +"determine which DLL is not found, you need to find the list of dependent " +"DLLs and determine which one is not found using Windows debugging and " +"tracing tools." +msgstr "" + +#: ../../library/ctypes.rst:1651 +msgid "" +"`Microsoft DUMPBIN tool `_ -- A tool to find DLL " +"dependents." msgstr "" +#: ../../library/ctypes.rst:1654 msgid "Added *winmode* parameter." msgstr "" +#: ../../library/ctypes.rst:1659 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -msgid "Instances of this class have no public methods. Functions exported by the shared library can be accessed as attributes or by index. Please note that accessing the function through an attribute caches the result and therefore accessing it repeatedly returns the same object each time. On the other hand, accessing it through an index returns a new object each time::" +#: ../../library/ctypes.rst:1661 +msgid "" +"Instances of this class have no public methods. Functions exported by the " +"shared library can be accessed as attributes or by index. Please note that " +"accessing the function through an attribute caches the result and therefore " +"accessing it repeatedly returns the same object each time. On the other " +"hand, accessing it through an index returns a new object each time::" msgstr "" +#: ../../library/ctypes.rst:1667 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -1726,96 +2643,191 @@ msgid "" "False" msgstr "" -msgid "The following public attributes are available. Their name starts with an underscore to not clash with exported function names:" +#: ../../library/ctypes.rst:1674 +msgid "" +"The following public attributes are available. Their name starts with an " +"underscore to not clash with exported function names:" msgstr "" +#: ../../library/ctypes.rst:1679 msgid "The system handle used to access the library." msgstr "" +#: ../../library/ctypes.rst:1683 msgid "The name of the library passed in the constructor." msgstr "" +#: ../../library/ctypes.rst:1687 ../../library/ctypes.rst:1704 +#: ../../library/ctypes.rst:1713 msgid "See :py:class:`~ctypes.CDLL`, the superclass, for common information." msgstr "" -msgid "Functions in this library use the ``stdcall`` calling convention, and are assumed to return the windows specific :class:`HRESULT` code. :class:`HRESULT` values contain information specifying whether the function call failed or succeeded, together with additional error code. If the return value signals a failure, an :class:`OSError` is automatically raised." -msgstr "" - +#: ../../library/ctypes.rst:1689 +msgid "" +"Functions in this library use the ``stdcall`` calling convention, and are " +"assumed to return the windows specific :class:`HRESULT` " +"code. :class:`HRESULT` values contain information specifying whether the " +"function call failed or succeeded, together with additional error code. If " +"the return value signals a failure, an :class:`OSError` is automatically " +"raised." +msgstr "" + +#: ../../library/ctypes.rst:1695 ../../library/ctypes.rst:1709 +#: ../../library/ctypes.rst:1772 ../../library/ctypes.rst:1779 +#: ../../library/ctypes.rst:1949 ../../library/ctypes.rst:2001 +#: ../../library/ctypes.rst:2153 ../../library/ctypes.rst:2225 +#: ../../library/ctypes.rst:2234 ../../library/ctypes.rst:2261 +#: ../../library/ctypes.rst:2275 ../../library/ctypes.rst:2284 +#: ../../library/ctypes.rst:2293 ../../library/ctypes.rst:2308 +#: ../../library/ctypes.rst:2375 ../../library/ctypes.rst:2402 +#: ../../library/ctypes.rst:2834 ../../library/ctypes.rst:3257 msgid "Availability" msgstr "" -msgid ":exc:`WindowsError` used to be raised, which is now an alias of :exc:`OSError`." +#: ../../library/ctypes.rst:1697 +msgid "" +":exc:`WindowsError` used to be raised, which is now an alias " +"of :exc:`OSError`." msgstr "" -msgid "Functions in these libraries use the ``stdcall`` calling convention, and are assumed to return :c:expr:`int` by default." +#: ../../library/ctypes.rst:1706 +msgid "" +"Functions in these libraries use the ``stdcall`` calling convention, and are " +"assumed to return :c:expr:`int` by default." msgstr "" -msgid "When functions in this library are called, the Python GIL is *not* released during the function call, and after the function execution the Python error flag is checked. If the error flag is set, a Python exception is raised." +#: ../../library/ctypes.rst:1715 +msgid "" +"When functions in this library are called, the Python GIL is *not* released " +"during the function call, and after the function execution the Python error " +"flag is checked. If the error flag is set, a Python exception is raised." msgstr "" +#: ../../library/ctypes.rst:1720 msgid "Thus, this is only useful to call Python C API functions directly." msgstr "" -msgid "Flag to use as *mode* parameter. On platforms where this flag is not available, it is defined as the integer zero." +#: ../../library/ctypes.rst:1725 +msgid "" +"Flag to use as *mode* parameter. On platforms where this flag is not " +"available, it is defined as the integer zero." msgstr "" -msgid "Flag to use as *mode* parameter. On platforms where this is not available, it is the same as *RTLD_GLOBAL*." +#: ../../library/ctypes.rst:1731 +msgid "" +"Flag to use as *mode* parameter. On platforms where this is not available, " +"it is the same as *RTLD_GLOBAL*." msgstr "" -msgid "The default mode which is used to load shared libraries. On OSX 10.3, this is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." +#: ../../library/ctypes.rst:1737 +msgid "" +"The default mode which is used to load shared libraries. On OSX 10.3, this " +"is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -msgid "Shared libraries can also be loaded by using one of the prefabricated objects, which are instances of the :class:`LibraryLoader` class, either by calling the :meth:`~LibraryLoader.LoadLibrary` method, or by retrieving the library as attribute of the loader instance." +#: ../../library/ctypes.rst:1741 +msgid "" +"Shared libraries can also be loaded by using one of the prefabricated " +"objects, which are instances of the :class:`LibraryLoader` class, either by " +"calling the :meth:`~LibraryLoader.LoadLibrary` method, or by retrieving the " +"library as attribute of the loader instance." msgstr "" -msgid "Class which loads shared libraries. *dlltype* should be one of the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +#: ../../library/ctypes.rst:1748 +msgid "" +"Class which loads shared libraries. *dlltype* should be one of " +"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -msgid ":meth:`!__getattr__` has special behavior: It allows loading a shared library by accessing it as attribute of a library loader instance. The result is cached, so repeated attribute accesses return the same library each time." +#: ../../library/ctypes.rst:1751 +msgid "" +":meth:`!__getattr__` has special behavior: It allows loading a shared " +"library by accessing it as attribute of a library loader instance. The " +"result is cached, so repeated attribute accesses return the same library " +"each time." msgstr "" -msgid "Load a shared library into the process and return it. This method always returns a new instance of the library." +#: ../../library/ctypes.rst:1757 +msgid "" +"Load a shared library into the process and return it. This method always " +"returns a new instance of the library." msgstr "" +#: ../../library/ctypes.rst:1761 msgid "These prefabricated library loaders are available:" msgstr "" +#: ../../library/ctypes.rst:1765 msgid "Creates :class:`CDLL` instances." msgstr "" +#: ../../library/ctypes.rst:1770 msgid "Creates :class:`WinDLL` instances." msgstr "" +#: ../../library/ctypes.rst:1777 msgid "Creates :class:`OleDLL` instances." msgstr "" +#: ../../library/ctypes.rst:1784 msgid "Creates :class:`PyDLL` instances." msgstr "" -msgid "For accessing the C Python api directly, a ready-to-use Python shared library object is available:" +#: ../../library/ctypes.rst:1787 +msgid "" +"For accessing the C Python api directly, a ready-to-use Python shared " +"library object is available:" msgstr "" -msgid "An instance of :class:`PyDLL` that exposes Python C API functions as attributes. Note that all these functions are assumed to return C :c:expr:`int`, which is of course not always the truth, so you have to assign the correct :attr:`!restype` attribute to use these functions." +#: ../../library/ctypes.rst:1792 +msgid "" +"An instance of :class:`PyDLL` that exposes Python C API functions as " +"attributes. Note that all these functions are assumed to return " +"C :c:expr:`int`, which is of course not always the truth, so you have to " +"assign the correct :attr:`!restype` attribute to use these functions." msgstr "" -msgid "Loading a library through any of these objects raises an :ref:`auditing event ` ``ctypes.dlopen`` with string argument ``name``, the name used to load the library." +#: ../../library/ctypes.rst:1797 ../../library/ctypes.rst:1799 +msgid "" +"Loading a library through any of these objects raises an :ref:`auditing " +"event ` ``ctypes.dlopen`` with string argument ``name``, the name " +"used to load the library." msgstr "" -msgid "Accessing a function on a loaded library raises an auditing event ``ctypes.dlsym`` with arguments ``library`` (the library object) and ``name`` (the symbol's name as a string or integer)." +#: ../../library/ctypes.rst:1803 ../../library/ctypes.rst:1805 +msgid "" +"Accessing a function on a loaded library raises an auditing event " +"``ctypes.dlsym`` with arguments ``library`` (the library object) and " +"``name`` (the symbol's name as a string or integer)." msgstr "" -msgid "In cases when only the library handle is available rather than the object, accessing a function raises an auditing event ``ctypes.dlsym/handle`` with arguments ``handle`` (the raw library handle) and ``name``." +#: ../../library/ctypes.rst:1809 ../../library/ctypes.rst:1811 +msgid "" +"In cases when only the library handle is available rather than the object, " +"accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " +"arguments ``handle`` (the raw library handle) and ``name``." msgstr "" +#: ../../library/ctypes.rst:1818 msgid "Foreign functions" msgstr "" -msgid "As explained in the previous section, foreign functions can be accessed as attributes of loaded shared libraries. The function objects created in this way by default accept any number of arguments, accept any ctypes data instances as arguments, and return the default result type specified by the library loader." +#: ../../library/ctypes.rst:1820 +msgid "" +"As explained in the previous section, foreign functions can be accessed as " +"attributes of loaded shared libraries. The function objects created in this " +"way by default accept any number of arguments, accept any ctypes data " +"instances as arguments, and return the default result type specified by the " +"library loader." msgstr "" -msgid "They are instances of a private local class :class:`!_FuncPtr` (not exposed in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" +#: ../../library/ctypes.rst:1825 +msgid "" +"They are instances of a private local class :class:`!_FuncPtr` (not exposed " +"in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" msgstr "" +#: ../../library/ctypes.rst:1828 msgid "" ">>> import ctypes\n" ">>> lib = ctypes.CDLL(None)\n" @@ -1825,126 +2837,263 @@ msgid "" "False" msgstr "" +#: ../../library/ctypes.rst:1839 msgid "Base class for C callable foreign functions." msgstr "" -msgid "Instances of foreign functions are also C compatible data types; they represent C function pointers." +#: ../../library/ctypes.rst:1841 +msgid "" +"Instances of foreign functions are also C compatible data types; they " +"represent C function pointers." msgstr "" -msgid "This behavior can be customized by assigning to special attributes of the foreign function object." +#: ../../library/ctypes.rst:1844 +msgid "" +"This behavior can be customized by assigning to special attributes of the " +"foreign function object." msgstr "" -msgid "Assign a ctypes type to specify the result type of the foreign function. Use ``None`` for :c:expr:`void`, a function not returning anything." +#: ../../library/ctypes.rst:1849 +msgid "" +"Assign a ctypes type to specify the result type of the foreign function. Use " +"``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -msgid "It is possible to assign a callable Python object that is not a ctypes type, in this case the function is assumed to return a C :c:expr:`int`, and the callable will be called with this integer, allowing further processing or error checking. Using this is deprecated, for more flexible post processing or error checking use a ctypes data type as :attr:`!restype` and assign a callable to the :attr:`errcheck` attribute." +#: ../../library/ctypes.rst:1852 +msgid "" +"It is possible to assign a callable Python object that is not a ctypes type, " +"in this case the function is assumed to return a C :c:expr:`int`, and the " +"callable will be called with this integer, allowing further processing or " +"error checking. Using this is deprecated, for more flexible post processing " +"or error checking use a ctypes data type as :attr:`!restype` and assign a " +"callable to the :attr:`errcheck` attribute." msgstr "" -msgid "Assign a tuple of ctypes types to specify the argument types that the function accepts. Functions using the ``stdcall`` calling convention can only be called with the same number of arguments as the length of this tuple; functions using the C calling convention accept additional, unspecified arguments as well." +#: ../../library/ctypes.rst:1861 +msgid "" +"Assign a tuple of ctypes types to specify the argument types that the " +"function accepts. Functions using the ``stdcall`` calling convention can " +"only be called with the same number of arguments as the length of this " +"tuple; functions using the C calling convention accept additional, " +"unspecified arguments as well." msgstr "" -msgid "When a foreign function is called, each actual argument is passed to the :meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` tuple, this method allows adapting the actual argument to an object that the foreign function accepts. For example, a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string passed as argument into a bytes object using ctypes conversion rules." +#: ../../library/ctypes.rst:1867 +msgid "" +"When a foreign function is called, each actual argument is passed to " +"the :meth:`~_CData.from_param` class method of the items in " +"the :attr:`argtypes` tuple, this method allows adapting the actual argument " +"to an object that the foreign function accepts. For example, " +"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " +"passed as argument into a bytes object using ctypes conversion rules." msgstr "" -msgid "New: It is now possible to put items in argtypes which are not ctypes types, but each item must have a :meth:`~_CData.from_param` method which returns a value usable as argument (integer, string, ctypes instance). This allows defining adapters that can adapt custom objects as function parameters." +#: ../../library/ctypes.rst:1874 +msgid "" +"New: It is now possible to put items in argtypes which are not ctypes types, " +"but each item must have a :meth:`~_CData.from_param` method which returns a " +"value usable as argument (integer, string, ctypes instance). This allows " +"defining adapters that can adapt custom objects as function parameters." msgstr "" -msgid "Assign a Python function or another callable to this attribute. The callable will be called with three or more arguments:" +#: ../../library/ctypes.rst:1881 +msgid "" +"Assign a Python function or another callable to this attribute. The callable " +"will be called with three or more arguments:" msgstr "" -msgid "*result* is what the foreign function returns, as specified by the :attr:`!restype` attribute." +#: ../../library/ctypes.rst:1888 +msgid "" +"*result* is what the foreign function returns, as specified by the :attr:`!" +"restype` attribute." msgstr "" -msgid "*func* is the foreign function object itself, this allows reusing the same callable object to check or post process the results of several functions." +#: ../../library/ctypes.rst:1891 +msgid "" +"*func* is the foreign function object itself, this allows reusing the same " +"callable object to check or post process the results of several functions." msgstr "" -msgid "*arguments* is a tuple containing the parameters originally passed to the function call, this allows specializing the behavior on the arguments used." +#: ../../library/ctypes.rst:1895 +msgid "" +"*arguments* is a tuple containing the parameters originally passed to the " +"function call, this allows specializing the behavior on the arguments used." msgstr "" -msgid "The object that this function returns will be returned from the foreign function call, but it can also check the result value and raise an exception if the foreign function call failed." +#: ../../library/ctypes.rst:1899 +msgid "" +"The object that this function returns will be returned from the foreign " +"function call, but it can also check the result value and raise an exception " +"if the foreign function call failed." msgstr "" -msgid "On Windows, when a foreign function call raises a system exception (for example, due to an access violation), it will be captured and replaced with a suitable Python exception. Further, an auditing event ``ctypes.set_exception`` with argument ``code`` will be raised, allowing an audit hook to replace the exception with its own." +#: ../../library/ctypes.rst:1904 ../../library/ctypes.rst:1906 +msgid "" +"On Windows, when a foreign function call raises a system exception (for " +"example, due to an access violation), it will be captured and replaced with " +"a suitable Python exception. Further, an auditing event " +"``ctypes.set_exception`` with argument ``code`` will be raised, allowing an " +"audit hook to replace the exception with its own." msgstr "" -msgid "Some ways to invoke foreign function calls as well as some of the functions in this module may raise an auditing event ``ctypes.call_function`` with arguments ``function pointer`` and ``arguments``." +#: ../../library/ctypes.rst:1912 ../../library/ctypes.rst:1914 +msgid "" +"Some ways to invoke foreign function calls as well as some of the functions " +"in this module may raise an auditing event ``ctypes.call_function`` with " +"arguments ``function pointer`` and ``arguments``." msgstr "" +#: ../../library/ctypes.rst:1921 msgid "Function prototypes" msgstr "" -msgid "Foreign functions can also be created by instantiating function prototypes. Function prototypes are similar to function prototypes in C; they describe a function (return type, argument types, calling convention) without defining an implementation. The factory functions must be called with the desired result type and the argument types of the function, and can be used as decorator factories, and as such, be applied to functions through the ``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." +#: ../../library/ctypes.rst:1923 +msgid "" +"Foreign functions can also be created by instantiating function prototypes. " +"Function prototypes are similar to function prototypes in C; they describe a " +"function (return type, argument types, calling convention) without defining " +"an implementation. The factory functions must be called with the desired " +"result type and the argument types of the function, and can be used as " +"decorator factories, and as such, be applied to functions through the " +"``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -msgid "The returned function prototype creates functions that use the standard C calling convention. The function will release the GIL during the call. If *use_errno* is set to true, the ctypes private copy of the system :data:`errno` variable is exchanged with the real :data:`errno` value before and after the call; *use_last_error* does the same for the Windows error code." +#: ../../library/ctypes.rst:1934 +msgid "" +"The returned function prototype creates functions that use the standard C " +"calling convention. The function will release the GIL during the call. If " +"*use_errno* is set to true, the ctypes private copy of the " +"system :data:`errno` variable is exchanged with the real :data:`errno` value " +"before and after the call; *use_last_error* does the same for the Windows " +"error code." msgstr "" -msgid "The returned function prototype creates functions that use the ``stdcall`` calling convention. The function will release the GIL during the call. *use_errno* and *use_last_error* have the same meaning as above." +#: ../../library/ctypes.rst:1944 +msgid "" +"The returned function prototype creates functions that use the ``stdcall`` " +"calling convention. The function will release the GIL during the call. " +"*use_errno* and *use_last_error* have the same meaning as above." msgstr "" -msgid "The returned function prototype creates functions that use the Python calling convention. The function will *not* release the GIL during the call." +#: ../../library/ctypes.rst:1954 +msgid "" +"The returned function prototype creates functions that use the Python " +"calling convention. The function will *not* release the GIL during the call." msgstr "" -msgid "Function prototypes created by these factory functions can be instantiated in different ways, depending on the type and number of the parameters in the call:" +#: ../../library/ctypes.rst:1957 +msgid "" +"Function prototypes created by these factory functions can be instantiated " +"in different ways, depending on the type and number of the parameters in the " +"call:" msgstr "" -msgid "Returns a foreign function at the specified address which must be an integer." +#: ../../library/ctypes.rst:1964 +msgid "" +"Returns a foreign function at the specified address which must be an integer." msgstr "" -msgid "Create a C callable function (a callback function) from a Python *callable*." +#: ../../library/ctypes.rst:1971 +msgid "" +"Create a C callable function (a callback function) from a Python *callable*." msgstr "" -msgid "Returns a foreign function exported by a shared library. *func_spec* must be a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the exported function as string, or the ordinal of the exported function as small integer. The second item is the shared library instance." +#: ../../library/ctypes.rst:1978 +msgid "" +"Returns a foreign function exported by a shared library. *func_spec* must be " +"a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " +"exported function as string, or the ordinal of the exported function as " +"small integer. The second item is the shared library instance." msgstr "" -msgid "Returns a foreign function that will call a COM method. *vtbl_index* is the index into the virtual function table, a small non-negative integer. *name* is name of the COM method. *iid* is an optional pointer to the interface identifier which is used in extended error reporting." +#: ../../library/ctypes.rst:1988 +msgid "" +"Returns a foreign function that will call a COM method. *vtbl_index* is the " +"index into the virtual function table, a small non-negative integer. *name* " +"is name of the COM method. *iid* is an optional pointer to the interface " +"identifier which is used in extended error reporting." msgstr "" -msgid "If *iid* is not specified, an :exc:`OSError` is raised if the COM method call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised instead." +#: ../../library/ctypes.rst:1993 +msgid "" +"If *iid* is not specified, an :exc:`OSError` is raised if the COM method " +"call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised " +"instead." msgstr "" -msgid "COM methods use a special calling convention: They require a pointer to the COM interface as first argument, in addition to those parameters that are specified in the :attr:`!argtypes` tuple." +#: ../../library/ctypes.rst:1997 +msgid "" +"COM methods use a special calling convention: They require a pointer to the " +"COM interface as first argument, in addition to those parameters that are " +"specified in the :attr:`!argtypes` tuple." msgstr "" -msgid "The optional *paramflags* parameter creates foreign function wrappers with much more functionality than the features described above." +#: ../../library/ctypes.rst:2004 +msgid "" +"The optional *paramflags* parameter creates foreign function wrappers with " +"much more functionality than the features described above." msgstr "" -msgid "*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr.argtypes`." +#: ../../library/ctypes.rst:2007 +msgid "" +"*paramflags* must be a tuple of the same length " +"as :attr:`~_CFuncPtr.argtypes`." msgstr "" -msgid "Each item in this tuple contains further information about a parameter, it must be a tuple containing one, two, or three items." +#: ../../library/ctypes.rst:2009 +msgid "" +"Each item in this tuple contains further information about a parameter, it " +"must be a tuple containing one, two, or three items." msgstr "" -msgid "The first item is an integer containing a combination of direction flags for the parameter:" +#: ../../library/ctypes.rst:2012 +msgid "" +"The first item is an integer containing a combination of direction flags for " +"the parameter:" msgstr "" +#: ../../library/ctypes.rst:2015 msgid "1" msgstr "" +#: ../../library/ctypes.rst:2016 msgid "Specifies an input parameter to the function." msgstr "" +#: ../../library/ctypes.rst:2018 msgid "2" msgstr "" +#: ../../library/ctypes.rst:2019 msgid "Output parameter. The foreign function fills in a value." msgstr "" +#: ../../library/ctypes.rst:2021 msgid "4" msgstr "" +#: ../../library/ctypes.rst:2022 msgid "Input parameter which defaults to the integer zero." msgstr "" -msgid "The optional second item is the parameter name as string. If this is specified, the foreign function can be called with named parameters." +#: ../../library/ctypes.rst:2024 +msgid "" +"The optional second item is the parameter name as string. If this is " +"specified, the foreign function can be called with named parameters." msgstr "" +#: ../../library/ctypes.rst:2027 msgid "The optional third item is the default value for this parameter." msgstr "" -msgid "The following example demonstrates how to wrap the Windows ``MessageBoxW`` function so that it supports default parameters and named arguments. The C declaration from the windows header file is this::" +#: ../../library/ctypes.rst:2030 +msgid "" +"The following example demonstrates how to wrap the Windows ``MessageBoxW`` " +"function so that it supports default parameters and named arguments. The C " +"declaration from the windows header file is this::" msgstr "" +#: ../../library/ctypes.rst:2034 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -1954,29 +3103,40 @@ msgid "" " UINT uType);" msgstr "" +#: ../../library/ctypes.rst:2041 ../../library/ctypes.rst:2064 msgid "Here is the wrapping with :mod:`!ctypes`::" msgstr "" +#: ../../library/ctypes.rst:2043 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" ">>> prototype = WINFUNCTYPE(c_int, HWND, LPCWSTR, LPCWSTR, UINT)\n" -">>> paramflags = (1, \"hwnd\", 0), (1, \"text\", \"Hi\"), (1, \"caption\", \"Hello from ctypes\"), (1, \"flags\", 0)\n" +">>> paramflags = (1, \"hwnd\", 0), (1, \"text\", \"Hi\"), (1, \"caption\", " +"\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" msgstr "" +#: ../../library/ctypes.rst:2049 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" +#: ../../library/ctypes.rst:2051 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" msgstr "" -msgid "A second example demonstrates output parameters. The win32 ``GetWindowRect`` function retrieves the dimensions of a specified window by copying them into ``RECT`` structure that the caller has to supply. Here is the C declaration::" +#: ../../library/ctypes.rst:2055 +msgid "" +"A second example demonstrates output parameters. The win32 " +"``GetWindowRect`` function retrieves the dimensions of a specified window by " +"copying them into ``RECT`` structure that the caller has to supply. Here is " +"the C declaration::" msgstr "" +#: ../../library/ctypes.rst:2059 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -1984,21 +3144,35 @@ msgid "" " LPRECT lpRect);" msgstr "" +#: ../../library/ctypes.rst:2066 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" ">>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))\n" ">>> paramflags = (1, \"hwnd\"), (2, \"lprect\")\n" -">>> GetWindowRect = prototype((\"GetWindowRect\", windll.user32), paramflags)\n" +">>> GetWindowRect = prototype((\"GetWindowRect\", windll.user32), " +"paramflags)\n" ">>>" msgstr "" -msgid "Functions with output parameters will automatically return the output parameter value if there is a single one, or a tuple containing the output parameter values when there are more than one, so the GetWindowRect function now returns a RECT instance, when called." +#: ../../library/ctypes.rst:2073 +msgid "" +"Functions with output parameters will automatically return the output " +"parameter value if there is a single one, or a tuple containing the output " +"parameter values when there are more than one, so the GetWindowRect function " +"now returns a RECT instance, when called." msgstr "" -msgid "Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` protocol to do further output processing and error checking. The win32 ``GetWindowRect`` api function returns a ``BOOL`` to signal success or failure, so this function could do the error checking, and raises an exception when the api call failed::" +#: ../../library/ctypes.rst:2078 +msgid "" +"Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " +"protocol to do further output processing and error checking. The win32 " +"``GetWindowRect`` api function returns a ``BOOL`` to signal success or " +"failure, so this function could do the error checking, and raises an " +"exception when the api call failed::" msgstr "" +#: ../../library/ctypes.rst:2083 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -2009,9 +3183,17 @@ msgid "" ">>>" msgstr "" -msgid "If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it receives unchanged, :mod:`!ctypes` continues the normal processing it does on the output parameters. If you want to return a tuple of window coordinates instead of a ``RECT`` instance, you can retrieve the fields in the function and return them instead, the normal processing will no longer take place::" +#: ../../library/ctypes.rst:2091 +msgid "" +"If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " +"receives unchanged, :mod:`!ctypes` continues the normal processing it does " +"on the output parameters. If you want to return a tuple of window " +"coordinates instead of a ``RECT`` instance, you can retrieve the fields in " +"the function and return them instead, the normal processing will no longer " +"take place::" msgstr "" +#: ../../library/ctypes.rst:2097 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -2023,63 +3205,118 @@ msgid "" ">>>" msgstr "" +#: ../../library/ctypes.rst:2110 msgid "Utility functions" msgstr "" -msgid "Returns the address of the memory buffer as integer. *obj* must be an instance of a ctypes type." +#: ../../library/ctypes.rst:2114 +msgid "" +"Returns the address of the memory buffer as integer. *obj* must be an " +"instance of a ctypes type." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.addressof`` with argument ``obj``." +#: ../../library/ctypes.rst:2117 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.addressof`` with " +"argument ``obj``." msgstr "" -msgid "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a ctypes type or instance." +#: ../../library/ctypes.rst:2122 +msgid "" +"Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " +"ctypes type or instance." msgstr "" -msgid "Returns a light-weight pointer to *obj*, which must be an instance of a ctypes type. *offset* defaults to zero, and must be an integer that will be added to the internal pointer value." +#: ../../library/ctypes.rst:2128 +msgid "" +"Returns a light-weight pointer to *obj*, which must be an instance of a " +"ctypes type. *offset* defaults to zero, and must be an integer that will be " +"added to the internal pointer value." msgstr "" +#: ../../library/ctypes.rst:2132 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" +#: ../../library/ctypes.rst:2134 msgid "(((char *)&obj) + offset)" msgstr "" -msgid "The returned object can only be used as a foreign function call parameter. It behaves similar to ``pointer(obj)``, but the construction is a lot faster." +#: ../../library/ctypes.rst:2136 +msgid "" +"The returned object can only be used as a foreign function call parameter. " +"It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -msgid "Copies a COM pointer from *src* to *dst* and returns the Windows specific :c:type:`!HRESULT` value." +#: ../../library/ctypes.rst:2142 +msgid "" +"Copies a COM pointer from *src* to *dst* and returns the Windows " +"specific :c:type:`!HRESULT` value." msgstr "" -msgid "If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the reference count." +#: ../../library/ctypes.rst:2145 +msgid "" +"If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the " +"reference count." msgstr "" -msgid "In contrast, the reference count of *dst* will not be decremented before assigning the new value. Unless *dst* is ``NULL``, the caller is responsible for decrementing the reference count by calling its ``Release`` method when necessary." +#: ../../library/ctypes.rst:2148 +msgid "" +"In contrast, the reference count of *dst* will not be decremented before " +"assigning the new value. Unless *dst* is ``NULL``, the caller is responsible " +"for decrementing the reference count by calling its ``Release`` method when " +"necessary." msgstr "" -msgid "This function is similar to the cast operator in C. It returns a new instance of *type* which points to the same memory block as *obj*. *type* must be a pointer type, and *obj* must be an object that can be interpreted as a pointer." +#: ../../library/ctypes.rst:2160 +msgid "" +"This function is similar to the cast operator in C. It returns a new " +"instance of *type* which points to the same memory block as *obj*. *type* " +"must be a pointer type, and *obj* must be an object that can be interpreted " +"as a pointer." msgstr "" -msgid "This function creates a mutable character buffer. The returned object is a ctypes array of :class:`c_char`." +#: ../../library/ctypes.rst:2169 +msgid "" +"This function creates a mutable character buffer. The returned object is a " +"ctypes array of :class:`c_char`." msgstr "" -msgid "If *size* is given (and not ``None``), it must be an :class:`int`. It specifies the size of the returned array." +#: ../../library/ctypes.rst:2172 +msgid "" +"If *size* is given (and not ``None``), it must be an :class:`int`. It " +"specifies the size of the returned array." msgstr "" -msgid "If the *init* argument is given, it must be :class:`bytes`. It is used to initialize the array items. Bytes not initialized this way are set to zero (NUL)." +#: ../../library/ctypes.rst:2175 +msgid "" +"If the *init* argument is given, it must be :class:`bytes`. It is used to " +"initialize the array items. Bytes not initialized this way are set to zero " +"(NUL)." msgstr "" -msgid "If *size* is not given (or if it is ``None``), the buffer is made one element larger than *init*, effectively adding a NUL terminator." +#: ../../library/ctypes.rst:2179 +msgid "" +"If *size* is not given (or if it is ``None``), the buffer is made one " +"element larger than *init*, effectively adding a NUL terminator." msgstr "" -msgid "If both arguments are given, *size* must not be less than ``len(init)``." +#: ../../library/ctypes.rst:2182 +msgid "" +"If both arguments are given, *size* must not be less than ``len(init)``." msgstr "" -msgid "If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not treat such a buffer as a C string." +#: ../../library/ctypes.rst:2186 +msgid "" +"If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not " +"treat such a buffer as a C string." msgstr "" +#: ../../library/ctypes.rst:2189 msgid "For example::" msgstr "" +#: ../../library/ctypes.rst:2191 msgid "" ">>> bytes(create_string_buffer(2))\n" "b'\\x00\\x00'\n" @@ -2095,363 +3332,780 @@ msgid "" "ValueError: byte string too long" msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` with arguments ``init``, ``size``." +#: ../../library/ctypes.rst:2204 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " +"with arguments ``init``, ``size``." msgstr "" -msgid "This function creates a mutable unicode character buffer. The returned object is a ctypes array of :class:`c_wchar`." +#: ../../library/ctypes.rst:2210 +msgid "" +"This function creates a mutable unicode character buffer. The returned " +"object is a ctypes array of :class:`c_wchar`." msgstr "" -msgid "The function takes the same arguments as :func:`~create_string_buffer` except *init* must be a string and *size* counts :class:`c_wchar`." +#: ../../library/ctypes.rst:2213 +msgid "" +"The function takes the same arguments as :func:`~create_string_buffer` " +"except *init* must be a string and *size* counts :class:`c_wchar`." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` with arguments ``init``, ``size``." +#: ../../library/ctypes.rst:2216 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " +"with arguments ``init``, ``size``." msgstr "" -msgid "This function is a hook which allows implementing in-process COM servers with ctypes. It is called from the DllCanUnloadNow function that the _ctypes extension dll exports." +#: ../../library/ctypes.rst:2221 +msgid "" +"This function is a hook which allows implementing in-process COM servers " +"with ctypes. It is called from the DllCanUnloadNow function that the " +"_ctypes extension dll exports." msgstr "" -msgid "This function is a hook which allows implementing in-process COM servers with ctypes. It is called from the DllGetClassObject function that the ``_ctypes`` extension dll exports." +#: ../../library/ctypes.rst:2230 +msgid "" +"This function is a hook which allows implementing in-process COM servers " +"with ctypes. It is called from the DllGetClassObject function that the " +"``_ctypes`` extension dll exports." msgstr "" -msgid "Try to find a library and return a pathname. *name* is the library name without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version number (this is the form used for the posix linker option :option:`!-l`). If no library can be found, returns ``None``." +#: ../../library/ctypes.rst:2240 +msgid "" +"Try to find a library and return a pathname. *name* is the library name " +"without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " +"number (this is the form used for the posix linker option :option:`!-l`). " +"If no library can be found, returns ``None``." msgstr "" +#: ../../library/ctypes.rst:2247 msgid "See :ref:`ctypes-finding-shared-libraries` for complete documentation." msgstr "" -msgid "Returns the filename of the VC runtime library used by Python, and by the extension modules. If the name of the library cannot be determined, ``None`` is returned." +#: ../../library/ctypes.rst:2253 +msgid "" +"Returns the filename of the VC runtime library used by Python, and by the " +"extension modules. If the name of the library cannot be determined, " +"``None`` is returned." msgstr "" -msgid "If you need to free memory, for example, allocated by an extension module with a call to the ``free(void *)``, it is important that you use the function in the same library that allocated the memory." +#: ../../library/ctypes.rst:2257 +msgid "" +"If you need to free memory, for example, allocated by an extension module " +"with a call to the ``free(void *)``, it is important that you use the " +"function in the same library that allocated the memory." msgstr "" -msgid "Try to provide a list of paths of the shared libraries loaded into the current process. These paths are not normalized or processed in any way. The function can raise :exc:`OSError` if the underlying platform APIs fail. The exact functionality is system dependent." +#: ../../library/ctypes.rst:2267 +msgid "" +"Try to provide a list of paths of the shared libraries loaded into the " +"current process. These paths are not normalized or processed in any way. " +"The function can raise :exc:`OSError` if the underlying platform APIs fail. " +"The exact functionality is system dependent." msgstr "" -msgid "On most platforms, the first element of the list represents the current executable file. It may be an empty string." +#: ../../library/ctypes.rst:2272 +msgid "" +"On most platforms, the first element of the list represents the current " +"executable file. It may be an empty string." msgstr "" -msgid "Returns a textual description of the error code *code*. If no error code is specified, the last error code is used by calling the Windows API function :func:`GetLastError`." +#: ../../library/ctypes.rst:2280 +msgid "" +"Returns a textual description of the error code *code*. If no error code is " +"specified, the last error code is used by calling the Windows API " +"function :func:`GetLastError`." msgstr "" -msgid "Returns the last error code set by Windows in the calling thread. This function calls the Windows ``GetLastError()`` function directly, it does not return the ctypes-private copy of the error code." +#: ../../library/ctypes.rst:2289 +msgid "" +"Returns the last error code set by Windows in the calling thread. This " +"function calls the Windows ``GetLastError()`` function directly, it does not " +"return the ctypes-private copy of the error code." msgstr "" -msgid "Returns the current value of the ctypes-private copy of the system :data:`errno` variable in the calling thread." +#: ../../library/ctypes.rst:2298 +msgid "" +"Returns the current value of the ctypes-private copy of the " +"system :data:`errno` variable in the calling thread." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no arguments." +#: ../../library/ctypes.rst:2301 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " +"arguments." msgstr "" -msgid "Returns the current value of the ctypes-private copy of the system :data:`!LastError` variable in the calling thread." +#: ../../library/ctypes.rst:2305 +msgid "" +"Returns the current value of the ctypes-private copy of the system :data:`!" +"LastError` variable in the calling thread." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no arguments." +#: ../../library/ctypes.rst:2310 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " +"arguments." msgstr "" -msgid "Same as the standard C memmove library function: copies *count* bytes from *src* to *dst*. *dst* and *src* must be integers or ctypes instances that can be converted to pointers." +#: ../../library/ctypes.rst:2315 +msgid "" +"Same as the standard C memmove library function: copies *count* bytes from " +"*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " +"can be converted to pointers." msgstr "" -msgid "Same as the standard C memset library function: fills the memory block at address *dst* with *count* bytes of value *c*. *dst* must be an integer specifying an address, or a ctypes instance." +#: ../../library/ctypes.rst:2322 +msgid "" +"Same as the standard C memset library function: fills the memory block at " +"address *dst* with *count* bytes of value *c*. *dst* must be an integer " +"specifying an address, or a ctypes instance." msgstr "" -msgid "Create or return a ctypes pointer type. Pointer types are cached and reused internally, so calling this function repeatedly is cheap. *type* must be a ctypes type." +#: ../../library/ctypes.rst:2329 +msgid "" +"Create or return a ctypes pointer type. Pointer types are cached and reused " +"internally, so calling this function repeatedly is cheap. *type* must be a " +"ctypes type." msgstr "" -msgid "The resulting pointer type is cached in the ``__pointer_type__`` attribute of *type*. It is possible to set this attribute before the first call to ``POINTER`` in order to set a custom pointer type. However, doing this is discouraged: manually creating a suitable pointer type is difficult without relying on implementation details that may change in future Python versions." +#: ../../library/ctypes.rst:2335 +msgid "" +"The resulting pointer type is cached in the ``__pointer_type__`` attribute " +"of *type*. It is possible to set this attribute before the first call to " +"``POINTER`` in order to set a custom pointer type. However, doing this is " +"discouraged: manually creating a suitable pointer type is difficult without " +"relying on implementation details that may change in future Python versions." msgstr "" -msgid "Create a new pointer instance, pointing to *obj*. The returned object is of the type ``POINTER(type(obj))``." +#: ../../library/ctypes.rst:2346 +msgid "" +"Create a new pointer instance, pointing to *obj*. The returned object is of " +"the type ``POINTER(type(obj))``." msgstr "" -msgid "Note: If you just want to pass a pointer to an object to a foreign function call, you should use ``byref(obj)`` which is much faster." +#: ../../library/ctypes.rst:2349 +msgid "" +"Note: If you just want to pass a pointer to an object to a foreign function " +"call, you should use ``byref(obj)`` which is much faster." msgstr "" -msgid "This function resizes the internal memory buffer of *obj*, which must be an instance of a ctypes type. It is not possible to make the buffer smaller than the native size of the objects type, as given by ``sizeof(type(obj))``, but it is possible to enlarge the buffer." +#: ../../library/ctypes.rst:2355 +msgid "" +"This function resizes the internal memory buffer of *obj*, which must be an " +"instance of a ctypes type. It is not possible to make the buffer smaller " +"than the native size of the objects type, as given by ``sizeof(type(obj))``, " +"but it is possible to enlarge the buffer." msgstr "" -msgid "Set the current value of the ctypes-private copy of the system :data:`errno` variable in the calling thread to *value* and return the previous value." +#: ../../library/ctypes.rst:2363 +msgid "" +"Set the current value of the ctypes-private copy of the system :data:`errno` " +"variable in the calling thread to *value* and return the previous value." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with argument ``errno``." +#: ../../library/ctypes.rst:2366 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " +"argument ``errno``." msgstr "" -msgid "Sets the current value of the ctypes-private copy of the system :data:`!LastError` variable in the calling thread to *value* and return the previous value." +#: ../../library/ctypes.rst:2371 +msgid "" +"Sets the current value of the ctypes-private copy of the system :data:`!" +"LastError` variable in the calling thread to *value* and return the previous " +"value." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with argument ``error``." +#: ../../library/ctypes.rst:2377 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " +"argument ``error``." msgstr "" -msgid "Returns the size in bytes of a ctypes type or instance memory buffer. Does the same as the C ``sizeof`` operator." +#: ../../library/ctypes.rst:2382 +msgid "" +"Returns the size in bytes of a ctypes type or instance memory buffer. Does " +"the same as the C ``sizeof`` operator." msgstr "" -msgid "Return the byte string at *void \\*ptr*. If *size* is specified, it is used as size, otherwise the string is assumed to be zero-terminated." +#: ../../library/ctypes.rst:2388 +msgid "" +"Return the byte string at *void \\*ptr*. If *size* is specified, it is used " +"as size, otherwise the string is assumed to be zero-terminated." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.string_at`` with arguments ``ptr``, ``size``." +#: ../../library/ctypes.rst:2392 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.string_at`` with " +"arguments ``ptr``, ``size``." msgstr "" -msgid "Creates an instance of :exc:`OSError`. If *code* is not specified, :func:`GetLastError` is called to determine the error code. If *descr* is not specified, :func:`FormatError` is called to get a textual description of the error." +#: ../../library/ctypes.rst:2397 +msgid "" +"Creates an instance of :exc:`OSError`. If *code* is not " +"specified, :func:`GetLastError` is called to determine the error code. If " +"*descr* is not specified, :func:`FormatError` is called to get a textual " +"description of the error." msgstr "" -msgid "An instance of :exc:`WindowsError` used to be created, which is now an alias of :exc:`OSError`." +#: ../../library/ctypes.rst:2404 +msgid "" +"An instance of :exc:`WindowsError` used to be created, which is now an alias " +"of :exc:`OSError`." msgstr "" -msgid "Return the wide-character string at *void \\*ptr*. If *size* is specified, it is used as the number of characters of the string, otherwise the string is assumed to be zero-terminated." +#: ../../library/ctypes.rst:2411 +msgid "" +"Return the wide-character string at *void \\*ptr*. If *size* is specified, " +"it is used as the number of characters of the string, otherwise the string " +"is assumed to be zero-terminated." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with arguments ``ptr``, ``size``." +#: ../../library/ctypes.rst:2416 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " +"arguments ``ptr``, ``size``." msgstr "" -msgid "Return a :class:`memoryview` object of length *size* that references memory starting at *void \\*ptr*." +#: ../../library/ctypes.rst:2421 +msgid "" +"Return a :class:`memoryview` object of length *size* that references memory " +"starting at *void \\*ptr*." msgstr "" -msgid "If *readonly* is true, the returned :class:`!memoryview` object can not be used to modify the underlying memory. (Changes made by other means will still be reflected in the returned object.)" +#: ../../library/ctypes.rst:2424 +msgid "" +"If *readonly* is true, the returned :class:`!memoryview` object can not be " +"used to modify the underlying memory. (Changes made by other means will " +"still be reflected in the returned object.)" msgstr "" -msgid "This function is similar to :func:`string_at` with the key difference of not making a copy of the specified memory. It is a semantically equivalent (but more efficient) alternative to ``memoryview((c_byte * size).from_address(ptr))``. (While :meth:`~_CData.from_address` only takes integers, *ptr* can also be given as a :class:`ctypes.POINTER` or a :func:`~ctypes.byref` object.)" +#: ../../library/ctypes.rst:2429 +msgid "" +"This function is similar to :func:`string_at` with the key difference of not " +"making a copy of the specified memory. It is a semantically equivalent (but " +"more efficient) alternative to ``memoryview((c_byte * " +"size).from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " +"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or " +"a :func:`~ctypes.byref` object.)" msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with arguments ``address``, ``size``, ``readonly``." +#: ../../library/ctypes.rst:2436 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " +"arguments ``address``, ``size``, ``readonly``." msgstr "" +#: ../../library/ctypes.rst:2444 msgid "Data types" msgstr "" -msgid "This non-public class is the common base class of all ctypes data types. Among other things, all ctypes type instances contain a memory block that hold C compatible data; the address of the memory block is returned by the :func:`addressof` helper function. Another instance variable is exposed as :attr:`_objects`; this contains other Python objects that need to be kept alive in case the memory block contains pointers." +#: ../../library/ctypes.rst:2449 +msgid "" +"This non-public class is the common base class of all ctypes data types. " +"Among other things, all ctypes type instances contain a memory block that " +"hold C compatible data; the address of the memory block is returned by " +"the :func:`addressof` helper function. Another instance variable is exposed " +"as :attr:`_objects`; this contains other Python objects that need to be kept " +"alive in case the memory block contains pointers." msgstr "" -msgid "Common methods of ctypes data types, these are all class methods (to be exact, they are methods of the :term:`metaclass`):" +#: ../../library/ctypes.rst:2456 +msgid "" +"Common methods of ctypes data types, these are all class methods (to be " +"exact, they are methods of the :term:`metaclass`):" msgstr "" -msgid "This method returns a ctypes instance that shares the buffer of the *source* object. The *source* object must support the writeable buffer interface. The optional *offset* parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a :exc:`ValueError` is raised." +#: ../../library/ctypes.rst:2461 +msgid "" +"This method returns a ctypes instance that shares the buffer of the *source* " +"object. The *source* object must support the writeable buffer interface. " +"The optional *offset* parameter specifies an offset into the source buffer " +"in bytes; the default is zero. If the source buffer is not large enough " +"a :exc:`ValueError` is raised." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with arguments ``pointer``, ``size``, ``offset``." +#: ../../library/ctypes.rst:2467 ../../library/ctypes.rst:2477 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " +"arguments ``pointer``, ``size``, ``offset``." msgstr "" -msgid "This method creates a ctypes instance, copying the buffer from the *source* object buffer which must be readable. The optional *offset* parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a :exc:`ValueError` is raised." +#: ../../library/ctypes.rst:2471 +msgid "" +"This method creates a ctypes instance, copying the buffer from the *source* " +"object buffer which must be readable. The optional *offset* parameter " +"specifies an offset into the source buffer in bytes; the default is zero. " +"If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -msgid "This method returns a ctypes type instance using the memory specified by *address* which must be an integer." +#: ../../library/ctypes.rst:2481 +msgid "" +"This method returns a ctypes type instance using the memory specified by " +"*address* which must be an integer." msgstr "" -msgid "This method, and others that indirectly call this method, raises an :ref:`auditing event ` ``ctypes.cdata`` with argument ``address``." +#: ../../library/ctypes.rst:2484 ../../library/ctypes.rst:2486 +msgid "" +"This method, and others that indirectly call this method, raises " +"an :ref:`auditing event ` ``ctypes.cdata`` with argument " +"``address``." msgstr "" -msgid "This method adapts *obj* to a ctypes type. It is called with the actual object used in a foreign function call when the type is present in the foreign function's :attr:`~_CFuncPtr.argtypes` tuple; it must return an object that can be used as a function call parameter." +#: ../../library/ctypes.rst:2492 +msgid "" +"This method adapts *obj* to a ctypes type. It is called with the actual " +"object used in a foreign function call when the type is present in the " +"foreign function's :attr:`~_CFuncPtr.argtypes` tuple; it must return an " +"object that can be used as a function call parameter." msgstr "" -msgid "All ctypes data types have a default implementation of this classmethod that normally returns *obj* if that is an instance of the type. Some types accept other objects as well." +#: ../../library/ctypes.rst:2497 +msgid "" +"All ctypes data types have a default implementation of this classmethod that " +"normally returns *obj* if that is an instance of the type. Some types " +"accept other objects as well." msgstr "" -msgid "This method returns a ctypes type instance exported by a shared library. *name* is the name of the symbol that exports the data, *library* is the loaded shared library." +#: ../../library/ctypes.rst:2503 +msgid "" +"This method returns a ctypes type instance exported by a shared library. " +"*name* is the name of the symbol that exports the data, *library* is the " +"loaded shared library." msgstr "" +#: ../../library/ctypes.rst:2507 msgid "Common class variables of ctypes data types:" msgstr "" -msgid "The pointer type that was created by calling :func:`POINTER` for corresponding ctypes data type. If a pointer type was not yet created, the attribute is missing." +#: ../../library/ctypes.rst:2511 +msgid "" +"The pointer type that was created by calling :func:`POINTER` for " +"corresponding ctypes data type. If a pointer type was not yet created, the " +"attribute is missing." msgstr "" +#: ../../library/ctypes.rst:2517 msgid "Common instance variables of ctypes data types:" msgstr "" -msgid "Sometimes ctypes data instances do not own the memory block they contain, instead they share part of the memory block of a base object. The :attr:`_b_base_` read-only member is the root ctypes object that owns the memory block." +#: ../../library/ctypes.rst:2521 +msgid "" +"Sometimes ctypes data instances do not own the memory block they contain, " +"instead they share part of the memory block of a base object. " +"The :attr:`_b_base_` read-only member is the root ctypes object that owns " +"the memory block." msgstr "" -msgid "This read-only variable is true when the ctypes data instance has allocated the memory block itself, false otherwise." +#: ../../library/ctypes.rst:2528 +msgid "" +"This read-only variable is true when the ctypes data instance has allocated " +"the memory block itself, false otherwise." msgstr "" -msgid "This member is either ``None`` or a dictionary containing Python objects that need to be kept alive so that the memory block contents is kept valid. This object is only exposed for debugging; never modify the contents of this dictionary." +#: ../../library/ctypes.rst:2533 +msgid "" +"This member is either ``None`` or a dictionary containing Python objects " +"that need to be kept alive so that the memory block contents is kept valid. " +"This object is only exposed for debugging; never modify the contents of this " +"dictionary." msgstr "" -msgid "This non-public class is the base class of all fundamental ctypes data types. It is mentioned here because it contains the common attributes of the fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :class:`_CData`, so it inherits their methods and attributes. ctypes data types that are not and do not contain pointers can now be pickled." +#: ../../library/ctypes.rst:2546 +msgid "" +"This non-public class is the base class of all fundamental ctypes data " +"types. It is mentioned here because it contains the common attributes of the " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " +"of :class:`_CData`, so it inherits their methods and attributes. ctypes data " +"types that are not and do not contain pointers can now be pickled." msgstr "" +#: ../../library/ctypes.rst:2552 msgid "Instances have a single attribute:" msgstr "" -msgid "This attribute contains the actual value of the instance. For integer and pointer types, it is an integer, for character types, it is a single character bytes object or string, for character pointer types it is a Python bytes object or string." +#: ../../library/ctypes.rst:2556 +msgid "" +"This attribute contains the actual value of the instance. For integer and " +"pointer types, it is an integer, for character types, it is a single " +"character bytes object or string, for character pointer types it is a Python " +"bytes object or string." msgstr "" -msgid "When the ``value`` attribute is retrieved from a ctypes instance, usually a new object is returned each time. :mod:`!ctypes` does *not* implement original object return, always a new object is constructed. The same is true for all other ctypes object instances." +#: ../../library/ctypes.rst:2561 +msgid "" +"When the ``value`` attribute is retrieved from a ctypes instance, usually a " +"new object is returned each time. :mod:`!ctypes` does *not* implement " +"original object return, always a new object is constructed. The same is " +"true for all other ctypes object instances." msgstr "" +#: ../../library/ctypes.rst:2566 msgid "Each subclass has a class attribute:" msgstr "" -msgid "Class attribute that contains an internal type code, as a single-character string. See :ref:`ctypes-fundamental-data-types` for a summary." +#: ../../library/ctypes.rst:2570 +msgid "" +"Class attribute that contains an internal type code, as a single-character " +"string. See :ref:`ctypes-fundamental-data-types` for a summary." msgstr "" -msgid "Types marked \\* in the summary may be (or always are) aliases of a different :class:`_SimpleCData` subclass, and will not necessarily use the listed type code. For example, if the platform's :c:expr:`long`, :c:expr:`long long` and :c:expr:`time_t` C types are the same, then :class:`c_long`, :class:`c_longlong` and :class:`c_time_t` all refer to a single class, :class:`c_long`, whose :attr:`_type_` code is ``'l'``. The ``'L'`` code will be unused." +#: ../../library/ctypes.rst:2574 +msgid "" +"Types marked \\* in the summary may be (or always are) aliases of a " +"different :class:`_SimpleCData` subclass, and will not necessarily use the " +"listed type code. For example, if the " +"platform's :c:expr:`long`, :c:expr:`long long` and :c:expr:`time_t` C types " +"are the same, then :class:`c_long`, :class:`c_longlong` " +"and :class:`c_time_t` all refer to a single class, :class:`c_long`, " +"whose :attr:`_type_` code is ``'l'``. The ``'L'`` code will be unused." msgstr "" -msgid "The :mod:`array` and :ref:`struct ` modules, as well as third-party modules like `numpy `__, use similar -- but slightly different -- type codes." +#: ../../library/ctypes.rst:2585 +msgid "" +"The :mod:`array` and :ref:`struct ` modules, as well as " +"third-party modules like `numpy `__, use similar -- but " +"slightly different -- type codes." msgstr "" -msgid "Fundamental data types, when returned as foreign function call results, or, for example, by retrieving structure field members or array items, are transparently converted to native Python types. In other words, if a foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you will always receive a Python bytes object, *not* a :class:`c_char_p` instance." +#: ../../library/ctypes.rst:2590 +msgid "" +"Fundamental data types, when returned as foreign function call results, or, " +"for example, by retrieving structure field members or array items, are " +"transparently converted to native Python types. In other words, if a " +"foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you " +"will always receive a Python bytes object, *not* a :class:`c_char_p` " +"instance." msgstr "" -msgid "Subclasses of fundamental data types do *not* inherit this behavior. So, if a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you will receive an instance of this subclass from the function call. Of course, you can get the value of the pointer by accessing the ``value`` attribute." +#: ../../library/ctypes.rst:2598 +msgid "" +"Subclasses of fundamental data types do *not* inherit this behavior. So, if " +"a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " +"will receive an instance of this subclass from the function call. Of course, " +"you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" +#: ../../library/ctypes.rst:2603 msgid "These are the fundamental ctypes data types:" msgstr "" -msgid "Represents the C :c:expr:`signed char` datatype, and interprets the value as small integer. The constructor accepts an optional integer initializer; no overflow checking is done." +#: ../../library/ctypes.rst:2607 +msgid "" +"Represents the C :c:expr:`signed char` datatype, and interprets the value as " +"small integer. The constructor accepts an optional integer initializer; no " +"overflow checking is done." msgstr "" -msgid "Represents the C :c:expr:`char` datatype, and interprets the value as a single character. The constructor accepts an optional string initializer, the length of the string must be exactly one character." +#: ../../library/ctypes.rst:2614 +msgid "" +"Represents the C :c:expr:`char` datatype, and interprets the value as a " +"single character. The constructor accepts an optional string initializer, " +"the length of the string must be exactly one character." msgstr "" -msgid "Represents the C :c:expr:`char *` datatype when it points to a zero-terminated string. For a general character pointer that may also point to binary data, ``POINTER(c_char)`` must be used. The constructor accepts an integer address, or a bytes object." +#: ../../library/ctypes.rst:2621 +msgid "" +"Represents the C :c:expr:`char *` datatype when it points to a zero-" +"terminated string. For a general character pointer that may also point to " +"binary data, ``POINTER(c_char)`` must be used. The constructor accepts an " +"integer address, or a bytes object." msgstr "" -msgid "Represents the C :c:expr:`double` datatype. The constructor accepts an optional float initializer." +#: ../../library/ctypes.rst:2629 +msgid "" +"Represents the C :c:expr:`double` datatype. The constructor accepts an " +"optional float initializer." msgstr "" -msgid "Represents the C :c:expr:`long double` datatype. The constructor accepts an optional float initializer. On platforms where ``sizeof(long double) == sizeof(double)`` it is an alias to :class:`c_double`." +#: ../../library/ctypes.rst:2635 +msgid "" +"Represents the C :c:expr:`long double` datatype. The constructor accepts an " +"optional float initializer. On platforms where ``sizeof(long double) == " +"sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -msgid "Represents the C :c:expr:`float` datatype. The constructor accepts an optional float initializer." +#: ../../library/ctypes.rst:2641 +msgid "" +"Represents the C :c:expr:`float` datatype. The constructor accepts an " +"optional float initializer." msgstr "" -msgid "Represents the C :c:expr:`double complex` datatype, if available. The constructor accepts an optional :class:`complex` initializer." +#: ../../library/ctypes.rst:2647 +msgid "" +"Represents the C :c:expr:`double complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." msgstr "" -msgid "Represents the C :c:expr:`float complex` datatype, if available. The constructor accepts an optional :class:`complex` initializer." +#: ../../library/ctypes.rst:2655 +msgid "" +"Represents the C :c:expr:`float complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." msgstr "" -msgid "Represents the C :c:expr:`long double complex` datatype, if available. The constructor accepts an optional :class:`complex` initializer." +#: ../../library/ctypes.rst:2663 +msgid "" +"Represents the C :c:expr:`long double complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." msgstr "" -msgid "Represents the C :c:expr:`signed int` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." +#: ../../library/ctypes.rst:2671 +msgid "" +"Represents the C :c:expr:`signed int` datatype. The constructor accepts an " +"optional integer initializer; no overflow checking is done. On platforms " +"where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -msgid "Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias for :class:`c_byte`." +#: ../../library/ctypes.rst:2678 +msgid "" +"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias " +"for :class:`c_byte`." msgstr "" -msgid "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias for :class:`c_short`." +#: ../../library/ctypes.rst:2684 +msgid "" +"Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_short`." msgstr "" -msgid "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias for :class:`c_int`." +#: ../../library/ctypes.rst:2690 +msgid "" +"Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_int`." msgstr "" -msgid "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias for :class:`c_longlong`." +#: ../../library/ctypes.rst:2696 +msgid "" +"Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_longlong`." msgstr "" -msgid "Represents the C :c:expr:`signed long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done." +#: ../../library/ctypes.rst:2702 +msgid "" +"Represents the C :c:expr:`signed long` datatype. The constructor accepts an " +"optional integer initializer; no overflow checking is done." msgstr "" -msgid "Represents the C :c:expr:`signed long long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where ``sizeof(long long) == sizeof(long)`` it is an alias to :class:`c_long`." +#: ../../library/ctypes.rst:2708 +msgid "" +"Represents the C :c:expr:`signed long long` datatype. The constructor " +"accepts an optional integer initializer; no overflow checking is done. On " +"platforms where ``sizeof(long long) == sizeof(long)`` it is an alias " +"to :class:`c_long`." msgstr "" -msgid "Represents the C :c:expr:`signed short` datatype. The constructor accepts an optional integer initializer; no overflow checking is done." +#: ../../library/ctypes.rst:2716 +msgid "" +"Represents the C :c:expr:`signed short` datatype. The constructor accepts " +"an optional integer initializer; no overflow checking is done." msgstr "" -msgid "Represents the C :c:type:`size_t` datatype. Usually an alias for another unsigned integer type." +#: ../../library/ctypes.rst:2722 +msgid "" +"Represents the C :c:type:`size_t` datatype. Usually an alias for another " +"unsigned integer type." msgstr "" -msgid "Represents the :c:type:`Py_ssize_t` datatype. This is a signed version of :c:type:`size_t`; that is, the POSIX :c:type:`ssize_t` type. Usually an alias for another integer type." +#: ../../library/ctypes.rst:2728 +msgid "" +"Represents the :c:type:`Py_ssize_t` datatype. This is a signed version " +"of :c:type:`size_t`; that is, the POSIX :c:type:`ssize_t` type. Usually an " +"alias for another integer type." msgstr "" -msgid "Represents the C :c:type:`time_t` datatype. Usually an alias for another integer type." +#: ../../library/ctypes.rst:2738 +msgid "" +"Represents the C :c:type:`time_t` datatype. Usually an alias for another " +"integer type." msgstr "" -msgid "Represents the C :c:expr:`unsigned char` datatype, it interprets the value as small integer. The constructor accepts an optional integer initializer; no overflow checking is done." +#: ../../library/ctypes.rst:2746 +msgid "" +"Represents the C :c:expr:`unsigned char` datatype, it interprets the value " +"as small integer. The constructor accepts an optional integer initializer; " +"no overflow checking is done." msgstr "" -msgid "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." +#: ../../library/ctypes.rst:2753 +msgid "" +"Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " +"an optional integer initializer; no overflow checking is done. On platforms " +"where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -msgid "Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias for :class:`c_ubyte`." +#: ../../library/ctypes.rst:2760 +msgid "" +"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias " +"for :class:`c_ubyte`." msgstr "" -msgid "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias for :class:`c_ushort`." +#: ../../library/ctypes.rst:2766 +msgid "" +"Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " +"for :class:`c_ushort`." msgstr "" -msgid "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias for :class:`c_uint`." +#: ../../library/ctypes.rst:2772 +msgid "" +"Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " +"for :class:`c_uint`." msgstr "" -msgid "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias for :class:`c_ulonglong`." +#: ../../library/ctypes.rst:2778 +msgid "" +"Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " +"for :class:`c_ulonglong`." msgstr "" -msgid "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done." +#: ../../library/ctypes.rst:2784 +msgid "" +"Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " +"an optional integer initializer; no overflow checking is done." msgstr "" -msgid "Represents the C :c:expr:`unsigned long long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where ``sizeof(long long) == sizeof(long)`` it is an alias to :class:`c_long`." +#: ../../library/ctypes.rst:2790 +msgid "" +"Represents the C :c:expr:`unsigned long long` datatype. The constructor " +"accepts an optional integer initializer; no overflow checking is done. On " +"platforms where ``sizeof(long long) == sizeof(long)`` it is an alias " +"to :class:`c_long`." msgstr "" -msgid "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts an optional integer initializer; no overflow checking is done." +#: ../../library/ctypes.rst:2798 +msgid "" +"Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " +"an optional integer initializer; no overflow checking is done." msgstr "" -msgid "Represents the C :c:expr:`void *` type. The value is represented as integer. The constructor accepts an optional integer initializer." +#: ../../library/ctypes.rst:2804 +msgid "" +"Represents the C :c:expr:`void *` type. The value is represented as " +"integer. The constructor accepts an optional integer initializer." msgstr "" -msgid "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a single character unicode string. The constructor accepts an optional string initializer, the length of the string must be exactly one character." +#: ../../library/ctypes.rst:2810 +msgid "" +"Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " +"single character unicode string. The constructor accepts an optional string " +"initializer, the length of the string must be exactly one character." msgstr "" -msgid "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a zero-terminated wide character string. The constructor accepts an integer address, or a string." +#: ../../library/ctypes.rst:2817 +msgid "" +"Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " +"zero-terminated wide character string. The constructor accepts an integer " +"address, or a string." msgstr "" -msgid "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` from C99). Its value can be ``True`` or ``False``, and the constructor accepts any object that has a truth value." +#: ../../library/ctypes.rst:2824 +msgid "" +"Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " +"from C99). Its value can be ``True`` or ``False``, and the constructor " +"accepts any object that has a truth value." msgstr "" -msgid "Represents a :c:type:`!HRESULT` value, which contains success or error information for a function or method call." +#: ../../library/ctypes.rst:2831 +msgid "" +"Represents a :c:type:`!HRESULT` value, which contains success or error " +"information for a function or method call." msgstr "" -msgid "Represents the C :c:expr:`PyObject *` datatype. Calling this without an argument creates a ``NULL`` :c:expr:`PyObject *` pointer." +#: ../../library/ctypes.rst:2839 +msgid "" +"Represents the C :c:expr:`PyObject *` datatype. Calling this without an " +"argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" +#: ../../library/ctypes.rst:2842 msgid ":class:`!py_object` is now a :term:`generic type`." msgstr "" -msgid "The :mod:`!ctypes.wintypes` module provides quite some other Windows specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, :c:type:`!VARIANT_BOOL` or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` are also defined." +#: ../../library/ctypes.rst:2847 +msgid "" +"The :mod:`!ctypes.wintypes` module provides quite some other Windows " +"specific data types, for example :c:type:`!HWND`, :c:type:`!" +"WPARAM`, :c:type:`!VARIANT_BOOL` or :c:type:`!DWORD`. Some useful structures " +"like :c:type:`!MSG` or :c:type:`!RECT` are also defined." msgstr "" +#: ../../library/ctypes.rst:2856 msgid "Structured data types" msgstr "" +#: ../../library/ctypes.rst:2861 msgid "Abstract base class for unions in native byte order." msgstr "" -msgid "Unions share common attributes and behavior with structures; see :class:`Structure` documentation for details." +#: ../../library/ctypes.rst:2863 +msgid "" +"Unions share common attributes and behavior with structures; " +"see :class:`Structure` documentation for details." msgstr "" +#: ../../library/ctypes.rst:2868 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" +#: ../../library/ctypes.rst:2874 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" +#: ../../library/ctypes.rst:2880 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" +#: ../../library/ctypes.rst:2885 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -msgid "Structures and unions with non-native byte order cannot contain pointer type fields, or any other data types containing pointer type fields." +#: ../../library/ctypes.rst:2887 +msgid "" +"Structures and unions with non-native byte order cannot contain pointer type " +"fields, or any other data types containing pointer type fields." msgstr "" +#: ../../library/ctypes.rst:2893 msgid "Abstract base class for structures in *native* byte order." msgstr "" -msgid "Concrete structure and union types must be created by subclassing one of these types, and at least define a :attr:`_fields_` class variable. :mod:`!ctypes` will create :term:`descriptor`\\s which allow reading and writing the fields by direct attribute accesses. These are the" +#: ../../library/ctypes.rst:2895 +msgid "" +"Concrete structure and union types must be created by subclassing one of " +"these types, and at least define a :attr:`_fields_` class variable. :mod:`!" +"ctypes` will create :term:`descriptor`\\s which allow reading and writing " +"the fields by direct attribute accesses. These are the" msgstr "" -msgid "A sequence defining the structure fields. The items must be 2-tuples or 3-tuples. The first item is the name of the field, the second item specifies the type of the field; it can be any ctypes data type." +#: ../../library/ctypes.rst:2903 +msgid "" +"A sequence defining the structure fields. The items must be 2-tuples or 3-" +"tuples. The first item is the name of the field, the second item specifies " +"the type of the field; it can be any ctypes data type." msgstr "" -msgid "For integer type fields like :class:`c_int`, a third optional item can be given. It must be a small positive integer defining the bit width of the field." +#: ../../library/ctypes.rst:2907 +msgid "" +"For integer type fields like :class:`c_int`, a third optional item can be " +"given. It must be a small positive integer defining the bit width of the " +"field." msgstr "" -msgid "Field names must be unique within one structure or union. This is not checked, only one field can be accessed when names are repeated." +#: ../../library/ctypes.rst:2911 +msgid "" +"Field names must be unique within one structure or union. This is not " +"checked, only one field can be accessed when names are repeated." msgstr "" -msgid "It is possible to define the :attr:`_fields_` class variable *after* the class statement that defines the Structure subclass, this allows creating data types that directly or indirectly reference themselves::" +#: ../../library/ctypes.rst:2914 +msgid "" +"It is possible to define the :attr:`_fields_` class variable *after* the " +"class statement that defines the Structure subclass, this allows creating " +"data types that directly or indirectly reference themselves::" msgstr "" +#: ../../library/ctypes.rst:2918 msgid "" "class List(Structure):\n" " pass\n" @@ -2460,78 +4114,160 @@ msgid "" " ]" msgstr "" -msgid "The :attr:`!_fields_` class variable can only be set once. Later assignments will raise an :exc:`AttributeError`." +#: ../../library/ctypes.rst:2924 +msgid "" +"The :attr:`!_fields_` class variable can only be set once. Later assignments " +"will raise an :exc:`AttributeError`." msgstr "" -msgid "Additionally, the :attr:`!_fields_` class variable must be defined before the structure or union type is first used: an instance or subclass is created, :func:`sizeof` is called on it, and so on. Later assignments to :attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!_fields_` has not been set before such use, the structure or union will have no own fields, as if :attr:`!_fields_` was empty." +#: ../../library/ctypes.rst:2927 +msgid "" +"Additionally, the :attr:`!_fields_` class variable must be defined before " +"the structure or union type is first used: an instance or subclass is " +"created, :func:`sizeof` is called on it, and so on. Later assignments " +"to :attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!" +"_fields_` has not been set before such use, the structure or union will have " +"no own fields, as if :attr:`!_fields_` was empty." msgstr "" -msgid "Sub-subclasses of structure types inherit the fields of the base class plus the :attr:`_fields_` defined in the sub-subclass, if any." +#: ../../library/ctypes.rst:2935 +msgid "" +"Sub-subclasses of structure types inherit the fields of the base class plus " +"the :attr:`_fields_` defined in the sub-subclass, if any." msgstr "" -msgid "An optional small integer that allows overriding the alignment of structure fields in the instance." +#: ../../library/ctypes.rst:2941 +msgid "" +"An optional small integer that allows overriding the alignment of structure " +"fields in the instance." msgstr "" -msgid "This is only implemented for the MSVC-compatible memory layout (see :attr:`_layout_`)." +#: ../../library/ctypes.rst:2944 +msgid "" +"This is only implemented for the MSVC-compatible memory layout " +"(see :attr:`_layout_`)." msgstr "" -msgid "Setting :attr:`!_pack_` to 0 is the same as not setting it at all. Otherwise, the value must be a positive power of two. The effect is equivalent to ``#pragma pack(N)`` in C, except :mod:`!ctypes` may allow larger *n* than what the compiler accepts." +#: ../../library/ctypes.rst:2947 +msgid "" +"Setting :attr:`!_pack_` to 0 is the same as not setting it at all. " +"Otherwise, the value must be a positive power of two. The effect is " +"equivalent to ``#pragma pack(N)`` in C, except :mod:`!ctypes` may allow " +"larger *n* than what the compiler accepts." msgstr "" -msgid ":attr:`!_pack_` must already be defined when :attr:`_fields_` is assigned, otherwise it will have no effect." +#: ../../library/ctypes.rst:2952 +msgid "" +":attr:`!_pack_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." msgstr "" -msgid "For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible layout will be used by default. On non-Windows platforms, this default is deprecated and is slated to become an error in Python 3.19. If it is intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." +#: ../../library/ctypes.rst:2957 +msgid "" +"For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible " +"layout will be used by default. On non-Windows platforms, this default is " +"deprecated and is slated to become an error in Python 3.19. If it is " +"intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." msgstr "" -msgid "An optional small integer that allows increasing the alignment of the structure when being packed or unpacked to/from memory." +#: ../../library/ctypes.rst:2966 +msgid "" +"An optional small integer that allows increasing the alignment of the " +"structure when being packed or unpacked to/from memory." msgstr "" -msgid "The value must not be negative. The effect is equivalent to ``__attribute__((aligned(N)))`` on GCC or ``#pragma align(N)`` on MSVC, except :mod:`!ctypes` may allow values that the compiler would reject." +#: ../../library/ctypes.rst:2969 +msgid "" +"The value must not be negative. The effect is equivalent to " +"``__attribute__((aligned(N)))`` on GCC or ``#pragma align(N)`` on MSVC, " +"except :mod:`!ctypes` may allow values that the compiler would reject." msgstr "" -msgid ":attr:`!_align_` can only *increase* a structure's alignment requirements. Setting it to 0 or 1 has no effect." +#: ../../library/ctypes.rst:2974 +msgid "" +":attr:`!_align_` can only *increase* a structure's alignment requirements. " +"Setting it to 0 or 1 has no effect." msgstr "" -msgid "Using values that are not powers of two is discouraged and may lead to surprising behavior." +#: ../../library/ctypes.rst:2977 +msgid "" +"Using values that are not powers of two is discouraged and may lead to " +"surprising behavior." msgstr "" -msgid ":attr:`!_align_` must already be defined when :attr:`_fields_` is assigned, otherwise it will have no effect." +#: ../../library/ctypes.rst:2980 +msgid "" +":attr:`!_align_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." msgstr "" -msgid "An optional string naming the struct/union layout. It can currently be set to:" +#: ../../library/ctypes.rst:2987 +msgid "" +"An optional string naming the struct/union layout. It can currently be set " +"to:" msgstr "" -msgid "``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and Clang, this layout can be selected with ``__attribute__((ms_struct))``." +#: ../../library/ctypes.rst:2990 +msgid "" +"``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and " +"Clang, this layout can be selected with ``__attribute__((ms_struct))``." msgstr "" -msgid "``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” data model, as used on Linux and macOS. With this layout, :attr:`~Structure._pack_` must be unset or zero." +#: ../../library/ctypes.rst:2993 +msgid "" +"``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” " +"data model, as used on Linux and macOS. With this " +"layout, :attr:`~Structure._pack_` must be unset or zero." msgstr "" -msgid "If not set explicitly, ``ctypes`` will use a default that matches the platform conventions. This default may change in future Python releases (for example, when a new platform gains official support, or when a difference between similar platforms is found). Currently the default will be:" +#: ../../library/ctypes.rst:2997 +msgid "" +"If not set explicitly, ``ctypes`` will use a default that matches the " +"platform conventions. This default may change in future Python releases (for " +"example, when a new platform gains official support, or when a difference " +"between similar platforms is found). Currently the default will be:" msgstr "" +#: ../../library/ctypes.rst:3003 msgid "On Windows: ``\"ms\"``" msgstr "" -msgid "When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is deprecated; see :attr:`~Structure._pack_` documentation.)" +#: ../../library/ctypes.rst:3004 +msgid "" +"When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is " +"deprecated; see :attr:`~Structure._pack_` documentation.)" msgstr "" +#: ../../library/ctypes.rst:3006 msgid "Otherwise: ``\"gcc-sysv\"``" msgstr "" -msgid ":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` is assigned, otherwise it will have no effect." +#: ../../library/ctypes.rst:3008 +msgid "" +":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` " +"is assigned, otherwise it will have no effect." msgstr "" -msgid "An optional sequence that lists the names of unnamed (anonymous) fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is assigned, otherwise it will have no effect." +#: ../../library/ctypes.rst:3015 +msgid "" +"An optional sequence that lists the names of unnamed (anonymous) " +"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +"assigned, otherwise it will have no effect." msgstr "" -msgid "The fields listed in this variable must be structure or union type fields. :mod:`!ctypes` will create descriptors in the structure type that allows accessing the nested fields directly, without the need to create the structure or union field." +#: ../../library/ctypes.rst:3019 +msgid "" +"The fields listed in this variable must be structure or union type " +"fields. :mod:`!ctypes` will create descriptors in the structure type that " +"allows accessing the nested fields directly, without the need to create the " +"structure or union field." msgstr "" +#: ../../library/ctypes.rst:3024 msgid "Here is an example type (Windows)::" msgstr "" +#: ../../library/ctypes.rst:3026 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -2544,9 +4280,17 @@ msgid "" " (\"vt\", VARTYPE)]" msgstr "" -msgid "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field specifies which one of the union fields is valid. Since the ``u`` field is defined as anonymous field, it is now possible to access the members directly off the TYPEDESC instance. ``td.lptdesc`` and ``td.u.lptdesc`` are equivalent, but the former is faster since it does not need to create a temporary union instance::" +#: ../../library/ctypes.rst:3037 +msgid "" +"The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " +"specifies which one of the union fields is valid. Since the ``u`` field is " +"defined as anonymous field, it is now possible to access the members " +"directly off the TYPEDESC instance. ``td.lptdesc`` and ``td.u.lptdesc`` are " +"equivalent, but the former is faster since it does not need to create a " +"temporary union instance::" msgstr "" +#: ../../library/ctypes.rst:3044 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -2554,15 +4298,31 @@ msgid "" "td.u.lptdesc = POINTER(some_type)" msgstr "" -msgid "It is possible to define sub-subclasses of structures, they inherit the fields of the base class. If the subclass definition has a separate :attr:`_fields_` variable, the fields specified in this are appended to the fields of the base class." +#: ../../library/ctypes.rst:3049 +msgid "" +"It is possible to define sub-subclasses of structures, they inherit the " +"fields of the base class. If the subclass definition has a " +"separate :attr:`_fields_` variable, the fields specified in this are " +"appended to the fields of the base class." msgstr "" -msgid "Structure and union constructors accept both positional and keyword arguments. Positional arguments are used to initialize member fields in the same order as they are appear in :attr:`_fields_`. Keyword arguments in the constructor are interpreted as attribute assignments, so they will initialize :attr:`_fields_` with the same name, or create new attributes for names not present in :attr:`_fields_`." +#: ../../library/ctypes.rst:3054 +msgid "" +"Structure and union constructors accept both positional and keyword " +"arguments. Positional arguments are used to initialize member fields in the " +"same order as they are appear in :attr:`_fields_`. Keyword arguments in the " +"constructor are interpreted as attribute assignments, so they will " +"initialize :attr:`_fields_` with the same name, or create new attributes for " +"names not present in :attr:`_fields_`." msgstr "" -msgid "Descriptor for fields of a :class:`Structure` and :class:`Union`. For example::" +#: ../../library/ctypes.rst:3064 +msgid "" +"Descriptor for fields of a :class:`Structure` and :class:`Union`. For " +"example::" msgstr "" +#: ../../library/ctypes.rst:3067 msgid "" ">>> class Color(Structure):\n" "... _fields_ = (\n" @@ -2585,113 +4345,201 @@ msgid "" "1" msgstr "" +#: ../../library/ctypes.rst:3087 msgid "All attributes are read-only." msgstr "" -msgid ":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not instantiate the class directly." +#: ../../library/ctypes.rst:3089 +msgid "" +":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not " +"instantiate the class directly." msgstr "" -msgid "Previously, descriptors only had ``offset`` and ``size`` attributes and a readable string representation; the :class:`!CField` class was not available directly." +#: ../../library/ctypes.rst:3094 +msgid "" +"Previously, descriptors only had ``offset`` and ``size`` attributes and a " +"readable string representation; the :class:`!CField` class was not available " +"directly." msgstr "" +#: ../../library/ctypes.rst:3100 msgid "Name of the field, as a string." msgstr "" +#: ../../library/ctypes.rst:3104 msgid "Type of the field, as a :ref:`ctypes class `." msgstr "" +#: ../../library/ctypes.rst:3109 msgid "Offset of the field, in bytes." msgstr "" -msgid "For bitfields, this is the offset of the underlying byte-aligned *storage unit*; see :attr:`~CField.bit_offset`." +#: ../../library/ctypes.rst:3111 +msgid "" +"For bitfields, this is the offset of the underlying byte-aligned *storage " +"unit*; see :attr:`~CField.bit_offset`." msgstr "" +#: ../../library/ctypes.rst:3116 msgid "Size of the field, in bytes." msgstr "" -msgid "For bitfields, this is the size of the underlying *storage unit*. Typically, it has the same size as the bitfield's type." +#: ../../library/ctypes.rst:3118 +msgid "" +"For bitfields, this is the size of the underlying *storage unit*. Typically, " +"it has the same size as the bitfield's type." msgstr "" +#: ../../library/ctypes.rst:3123 msgid "For non-bitfields, equivalent to :attr:`~CField.byte_size`." msgstr "" -msgid "For bitfields, this contains a backwards-compatible bit-packed value that combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer using the explicit attributes instead." +#: ../../library/ctypes.rst:3125 +msgid "" +"For bitfields, this contains a backwards-compatible bit-packed value that " +"combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer " +"using the explicit attributes instead." msgstr "" +#: ../../library/ctypes.rst:3132 msgid "True if this is a bitfield." msgstr "" -msgid "The location of a bitfield within its *storage unit*, that is, within :attr:`~CField.byte_size` bytes of memory starting at :attr:`~CField.byte_offset`." +#: ../../library/ctypes.rst:3137 +msgid "" +"The location of a bitfield within its *storage unit*, that is, " +"within :attr:`~CField.byte_size` bytes of memory starting " +"at :attr:`~CField.byte_offset`." msgstr "" -msgid "To get the field's value, read the storage unit as an integer, :ref:`shift left ` by :attr:`!bit_offset` and take the :attr:`!bit_size` least significant bits." +#: ../../library/ctypes.rst:3141 +msgid "" +"To get the field's value, read the storage unit as an integer, :ref:`shift " +"left ` by :attr:`!bit_offset` and take the :attr:`!bit_size` least " +"significant bits." msgstr "" -msgid "For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is equal to ``byte_size * 8``." +#: ../../library/ctypes.rst:3145 +msgid "" +"For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is " +"equal to ``byte_size * 8``." msgstr "" -msgid "True if this field is anonymous, that is, it contains nested sub-fields that should be merged into a containing structure or union." +#: ../../library/ctypes.rst:3150 +msgid "" +"True if this field is anonymous, that is, it contains nested sub-fields that " +"should be merged into a containing structure or union." msgstr "" +#: ../../library/ctypes.rst:3157 msgid "Arrays and pointers" msgstr "" +#: ../../library/ctypes.rst:3161 msgid "Abstract base class for arrays." msgstr "" -msgid "The recommended way to create concrete array types is by multiplying any :mod:`!ctypes` data type with a non-negative integer. Alternatively, you can subclass this type and define :attr:`_length_` and :attr:`_type_` class variables. Array elements can be read and written using standard subscript and slice accesses; for slice reads, the resulting object is *not* itself an :class:`Array`." +#: ../../library/ctypes.rst:3163 +msgid "" +"The recommended way to create concrete array types is by multiplying " +"any :mod:`!ctypes` data type with a non-negative integer. Alternatively, " +"you can subclass this type and define :attr:`_length_` and :attr:`_type_` " +"class variables. Array elements can be read and written using standard " +"subscript and slice accesses; for slice reads, the resulting object is *not* " +"itself an :class:`Array`." msgstr "" +#: ../../library/ctypes.rst:3170 msgid "Arrays are :ref:`generic ` over the type of their elements." msgstr "" -msgid "A positive integer specifying the number of elements in the array. Out-of-range subscripts result in an :exc:`IndexError`. Will be returned by :func:`len`." +#: ../../library/ctypes.rst:3175 +msgid "" +"A positive integer specifying the number of elements in the array. Out-of-" +"range subscripts result in an :exc:`IndexError`. Will be returned " +"by :func:`len`." msgstr "" +#: ../../library/ctypes.rst:3182 msgid "Specifies the type of each element in the array." msgstr "" -msgid "Array subclass constructors accept positional arguments, used to initialize the elements in order." +#: ../../library/ctypes.rst:3185 +msgid "" +"Array subclass constructors accept positional arguments, used to initialize " +"the elements in order." msgstr "" -msgid "Create an array. Equivalent to ``type * length``, where *type* is a :mod:`!ctypes` data type and *length* an integer." +#: ../../library/ctypes.rst:3190 +msgid "" +"Create an array. Equivalent to ``type * length``, where *type* is a :mod:`!" +"ctypes` data type and *length* an integer." msgstr "" -msgid "This function is :term:`soft deprecated` in favor of multiplication. There are no plans to remove it." +#: ../../library/ctypes.rst:3194 +msgid "In favor of multiplication." msgstr "" +#: ../../library/ctypes.rst:3200 msgid "Private, abstract base class for pointers." msgstr "" -msgid "Concrete pointer types are created by calling :func:`POINTER` with the type that will be pointed to; this is done automatically by :func:`pointer`." +#: ../../library/ctypes.rst:3202 +msgid "" +"Concrete pointer types are created by calling :func:`POINTER` with the type " +"that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -msgid "If a pointer points to an array, its elements can be read and written using standard subscript and slice accesses. Pointer objects have no size, so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read from the memory *before* the pointer (as in C), and out-of-range subscripts will probably crash with an access violation (if you're lucky)." +#: ../../library/ctypes.rst:3206 +msgid "" +"If a pointer points to an array, its elements can be read and written using " +"standard subscript and slice accesses. Pointer objects have no size, " +"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " +"from the memory *before* the pointer (as in C), and out-of-range subscripts " +"will probably crash with an access violation (if you're lucky)." msgstr "" +#: ../../library/ctypes.rst:3216 msgid "Specifies the type pointed to." msgstr "" -msgid "Returns the object to which to pointer points. Assigning to this attribute changes the pointer to point to the assigned object." +#: ../../library/ctypes.rst:3220 +msgid "" +"Returns the object to which to pointer points. Assigning to this attribute " +"changes the pointer to point to the assigned object." msgstr "" +#: ../../library/ctypes.rst:3227 msgid "Exceptions" msgstr "" -msgid "This exception is raised when a foreign function call cannot convert one of the passed arguments." +#: ../../library/ctypes.rst:3231 +msgid "" +"This exception is raised when a foreign function call cannot convert one of " +"the passed arguments." msgstr "" +#: ../../library/ctypes.rst:3237 msgid "This exception is raised when a COM method call failed." msgstr "" +#: ../../library/ctypes.rst:3241 msgid "The integer value representing the error code." msgstr "" +#: ../../library/ctypes.rst:3245 msgid "The error message." msgstr "" +#: ../../library/ctypes.rst:3249 msgid "The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``." msgstr "" -msgid "*descr* is the textual description. *source* is the language-dependent ``ProgID`` for the class or application that raised the error. *helpfile* is the path of the help file. *helpcontext* is the help context identifier. *progid* is the ``ProgID`` of the interface that defined the error." +#: ../../library/ctypes.rst:3251 +msgid "" +"*descr* is the textual description. *source* is the language-dependent " +"``ProgID`` for the class or application that raised the error. *helpfile* " +"is the path of the help file. *helpcontext* is the help context " +"identifier. *progid* is the ``ProgID`` of the interface that defined the " +"error." msgstr "" diff --git a/library/curses.ascii.po b/library/curses.ascii.po index 94a93cb54..934529e95 100644 --- a/library/curses.ascii.po +++ b/library/curses.ascii.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,209 +24,325 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/curses.ascii.rst:2 msgid ":mod:`!curses.ascii` --- Utilities for ASCII characters" msgstr "" +#: ../../library/curses.ascii.rst:10 msgid "**Source code:** :source:`Lib/curses/ascii.py`" msgstr "" -msgid "The :mod:`!curses.ascii` module supplies name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants supplied are names for control characters as follows:" +#: ../../library/curses.ascii.rst:14 +msgid "" +"The :mod:`!curses.ascii` module supplies name constants for ASCII characters " +"and functions to test membership in various ASCII character classes. The " +"constants supplied are names for control characters as follows:" msgstr "" +#: ../../library/curses.ascii.rst:19 msgid "Name" msgstr "" +#: ../../library/curses.ascii.rst:19 msgid "Meaning" msgstr "" +#: ../../library/curses.ascii.rst:23 msgid "Start of heading, console interrupt" msgstr "" +#: ../../library/curses.ascii.rst:25 msgid "Start of text" msgstr "" +#: ../../library/curses.ascii.rst:27 msgid "End of text" msgstr "" +#: ../../library/curses.ascii.rst:29 msgid "End of transmission" msgstr "" +#: ../../library/curses.ascii.rst:31 msgid "Enquiry, goes with :const:`ACK` flow control" msgstr "" +#: ../../library/curses.ascii.rst:33 msgid "Acknowledgement" msgstr "" +#: ../../library/curses.ascii.rst:35 msgid "Bell" msgstr "" +#: ../../library/curses.ascii.rst:37 msgid "Backspace" msgstr "" +#: ../../library/curses.ascii.rst:39 msgid "Tab" msgstr "" +#: ../../library/curses.ascii.rst:41 msgid "Alias for :const:`TAB`: \"Horizontal tab\"" msgstr "" +#: ../../library/curses.ascii.rst:43 msgid "Line feed" msgstr "" +#: ../../library/curses.ascii.rst:45 msgid "Alias for :const:`LF`: \"New line\"" msgstr "" +#: ../../library/curses.ascii.rst:47 msgid "Vertical tab" msgstr "" +#: ../../library/curses.ascii.rst:49 msgid "Form feed" msgstr "" +#: ../../library/curses.ascii.rst:51 msgid "Carriage return" msgstr "" +#: ../../library/curses.ascii.rst:53 msgid "Shift-out, begin alternate character set" msgstr "" +#: ../../library/curses.ascii.rst:55 msgid "Shift-in, resume default character set" msgstr "" +#: ../../library/curses.ascii.rst:57 msgid "Data-link escape" msgstr "" +#: ../../library/curses.ascii.rst:59 msgid "XON, for flow control" msgstr "" +#: ../../library/curses.ascii.rst:61 msgid "Device control 2, block-mode flow control" msgstr "" +#: ../../library/curses.ascii.rst:63 msgid "XOFF, for flow control" msgstr "" +#: ../../library/curses.ascii.rst:65 msgid "Device control 4" msgstr "" +#: ../../library/curses.ascii.rst:67 msgid "Negative acknowledgement" msgstr "" +#: ../../library/curses.ascii.rst:69 msgid "Synchronous idle" msgstr "" +#: ../../library/curses.ascii.rst:71 msgid "End transmission block" msgstr "" +#: ../../library/curses.ascii.rst:73 msgid "Cancel" msgstr "" +#: ../../library/curses.ascii.rst:75 msgid "End of medium" msgstr "" +#: ../../library/curses.ascii.rst:77 msgid "Substitute" msgstr "" +#: ../../library/curses.ascii.rst:79 msgid "Escape" msgstr "" +#: ../../library/curses.ascii.rst:81 msgid "File separator" msgstr "" +#: ../../library/curses.ascii.rst:83 msgid "Group separator" msgstr "" +#: ../../library/curses.ascii.rst:85 msgid "Record separator, block-mode terminator" msgstr "" +#: ../../library/curses.ascii.rst:87 msgid "Unit separator" msgstr "" +#: ../../library/curses.ascii.rst:89 msgid "Space" msgstr "" +#: ../../library/curses.ascii.rst:91 msgid "Delete" msgstr "" -msgid "Note that many of these have little practical significance in modern usage. The mnemonics derive from teleprinter conventions that predate digital computers." +#: ../../library/curses.ascii.rst:94 +msgid "" +"Note that many of these have little practical significance in modern usage. " +"The mnemonics derive from teleprinter conventions that predate digital " +"computers." msgstr "" -msgid "The module supplies the following functions, patterned on those in the standard C library:" +#: ../../library/curses.ascii.rst:97 +msgid "" +"The module supplies the following functions, patterned on those in the " +"standard C library:" msgstr "" -msgid "Checks for an ASCII alphanumeric character; it is equivalent to ``isalpha(c) or isdigit(c)``." +#: ../../library/curses.ascii.rst:103 +msgid "" +"Checks for an ASCII alphanumeric character; it is equivalent to ``isalpha(c) " +"or isdigit(c)``." msgstr "" -msgid "Checks for an ASCII alphabetic character; it is equivalent to ``isupper(c) or islower(c)``." +#: ../../library/curses.ascii.rst:109 +msgid "" +"Checks for an ASCII alphabetic character; it is equivalent to ``isupper(c) " +"or islower(c)``." msgstr "" +#: ../../library/curses.ascii.rst:115 msgid "Checks for a character value that fits in the 7-bit ASCII set." msgstr "" -msgid "Checks for an ASCII whitespace character; space or horizontal tab." +#: ../../library/curses.ascii.rst:120 +msgid "Checks for an ASCII blank character; space or horizontal tab." msgstr "" -msgid "Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f)." +#: ../../library/curses.ascii.rst:125 +msgid "" +"Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f)." msgstr "" -msgid "Checks for an ASCII decimal digit, ``'0'`` through ``'9'``. This is equivalent to ``c in string.digits``." +#: ../../library/curses.ascii.rst:130 +msgid "" +"Checks for an ASCII decimal digit, ``'0'`` through ``'9'``. This is " +"equivalent to ``c in string.digits``." msgstr "" -msgid "Checks for ASCII any printable character except space." +#: ../../library/curses.ascii.rst:136 +msgid "Checks for any ASCII printable character except space." msgstr "" +#: ../../library/curses.ascii.rst:141 msgid "Checks for an ASCII lower-case character." msgstr "" +#: ../../library/curses.ascii.rst:146 msgid "Checks for any ASCII printable character including space." msgstr "" -msgid "Checks for any printable ASCII character which is not a space or an alphanumeric character." +#: ../../library/curses.ascii.rst:151 +msgid "" +"Checks for any ASCII printable character which is not a space or an " +"alphanumeric character." msgstr "" -msgid "Checks for ASCII white-space characters; space, line feed, carriage return, form feed, horizontal tab, vertical tab." +#: ../../library/curses.ascii.rst:157 +msgid "" +"Checks for ASCII white-space characters; space, line feed, carriage return, " +"form feed, horizontal tab, vertical tab." msgstr "" +#: ../../library/curses.ascii.rst:163 msgid "Checks for an ASCII uppercase letter." msgstr "" -msgid "Checks for an ASCII hexadecimal digit. This is equivalent to ``c in string.hexdigits``." +#: ../../library/curses.ascii.rst:168 +msgid "" +"Checks for an ASCII hexadecimal digit. This is equivalent to ``c in " +"string.hexdigits``." msgstr "" -msgid "Checks for an ASCII control character (ordinal values 0 to 31)." +#: ../../library/curses.ascii.rst:174 +msgid "" +"Checks for an ASCII control character (ordinal values 0 to 31). " +"Unlike :func:`iscntrl`, this does not include the delete character (0x7f)." msgstr "" +#: ../../library/curses.ascii.rst:180 msgid "Checks for a non-ASCII character (ordinal values 0x80 and above)." msgstr "" -msgid "These functions accept either integers or single-character strings; when the argument is a string, it is first converted using the built-in function :func:`ord`." +#: ../../library/curses.ascii.rst:182 +msgid "" +"These functions accept either integers or single-character strings; when the " +"argument is a string, it is first converted using the built-in " +"function :func:`ord`." msgstr "" -msgid "Note that all these functions check ordinal bit values derived from the character of the string you pass in; they do not actually know anything about the host machine's character encoding." +#: ../../library/curses.ascii.rst:185 +msgid "" +"Note that all these functions check ordinal bit values derived from the " +"character of the string you pass in; they do not actually know anything " +"about the host machine's character encoding." msgstr "" -msgid "The following two functions take either a single-character string or integer byte value; they return a value of the same type." +#: ../../library/curses.ascii.rst:189 +msgid "" +"The following two functions take either a single-character string or integer " +"byte value; they return a value of the same type." msgstr "" +#: ../../library/curses.ascii.rst:195 msgid "Return the ASCII value corresponding to the low 7 bits of *c*." msgstr "" -msgid "Return the control character corresponding to the given character (the character bit value is bitwise-anded with 0x1f)." +#: ../../library/curses.ascii.rst:200 +msgid "" +"Return the control character corresponding to the given character (the " +"character bit value is bitwise-anded with 0x1f)." msgstr "" -msgid "Return the 8-bit character corresponding to the given ASCII character (the character bit value is bitwise-ored with 0x80)." +#: ../../library/curses.ascii.rst:206 +msgid "" +"Return the 8-bit character corresponding to the given ASCII character (the " +"character bit value is bitwise-ored with 0x80)." msgstr "" -msgid "The following function takes either a single-character string or integer value; it returns a string." +#: ../../library/curses.ascii.rst:209 +msgid "" +"The following function takes either a single-character string or integer " +"value; it returns a string." msgstr "" -msgid "Return a string representation of the ASCII character *c*. If *c* is printable, this string is the character itself. If the character is a control character (0x00--0x1f) the string consists of a caret (``'^'``) followed by the corresponding uppercase letter. If the character is an ASCII delete (0x7f) the string is ``'^?'``. If the character has its meta bit (0x80) set, the meta bit is stripped, the preceding rules applied, and ``'!'`` prepended to the result." +#: ../../library/curses.ascii.rst:219 +msgid "" +"Return a string representation of the ASCII character *c*. If *c* is " +"printable, this string is the character itself. If the character is a " +"control character (0x00--0x1f) the string consists of a caret (``'^'``) " +"followed by the corresponding uppercase letter. If the character is an ASCII " +"delete (0x7f) the string is ``'^?'``. If the character has its meta bit " +"(0x80) set, the meta bit is stripped, the preceding rules applied, and " +"``'!'`` prepended to the result." msgstr "" -msgid "A 33-element string array that contains the ASCII mnemonics for the thirty-two ASCII control characters from 0 (NUL) to 0x1f (US), in order, plus the mnemonic ``SP`` for the space character." +#: ../../library/curses.ascii.rst:229 +msgid "" +"A 33-element string array that contains the ASCII mnemonics for the thirty-" +"two ASCII control characters from 0 (NUL) to 0x1f (US), in order, plus the " +"mnemonic ``SP`` for the space character." msgstr "" +#: ../../library/curses.ascii.rst:213 msgid "^ (caret)" msgstr "" +#: ../../library/curses.ascii.rst:213 msgid "in curses module" msgstr "" +#: ../../library/curses.ascii.rst:213 msgid "! (exclamation)" msgstr "" diff --git a/library/curses.panel.po b/library/curses.panel.po index a42ab95bc..31b3787c9 100644 --- a/library/curses.panel.po +++ b/library/curses.panel.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,71 +23,123 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/curses.panel.rst:2 msgid ":mod:`!curses.panel` --- A panel stack extension for curses" msgstr "" -msgid "Panels are windows with the added feature of depth, so they can be stacked on top of each other, and only the visible portions of each window will be displayed. Panels can be added, moved up or down in the stack, and removed." +#: ../../library/curses.panel.rst:11 +msgid "" +"Panels are windows with the added feature of depth, so they can be stacked " +"on top of each other, and only the visible portions of each window will be " +"displayed. Panels can be added, moved up or down in the stack, and removed." msgstr "" +#: ../../library/curses.panel.rst:19 msgid "Functions" msgstr "" +#: ../../library/curses.panel.rst:21 +msgid "The module :mod:`!curses.panel` defines the following exception:" +msgstr "" + +#: ../../library/curses.panel.rst:26 +msgid "Exception raised when a curses panel library function returns an error." +msgstr "" + +#: ../../library/curses.panel.rst:29 msgid "The module :mod:`!curses.panel` defines the following functions:" msgstr "" +#: ../../library/curses.panel.rst:34 msgid "Returns the bottom panel in the panel stack." msgstr "" -msgid "Returns a panel object, associating it with the given window *win*. Be aware that you need to keep the returned panel object referenced explicitly. If you don't, the panel object is garbage collected and removed from the panel stack." +#: ../../library/curses.panel.rst:39 +msgid "" +"Returns a panel object, associating it with the given window *win* and " +"placing the new panel on top of the panel stack. Be aware that you need to " +"keep the returned panel object referenced explicitly. If you don't, the " +"panel object is garbage collected and removed from the panel stack." msgstr "" +#: ../../library/curses.panel.rst:47 msgid "Returns the top panel in the panel stack." msgstr "" -msgid "Updates the virtual screen after changes in the panel stack. This does not call :func:`curses.doupdate`, so you'll have to do this yourself." +#: ../../library/curses.panel.rst:52 +msgid "" +"Updates the virtual screen after changes in the panel stack. This does not " +"call :func:`curses.doupdate`, so you'll have to do this yourself." msgstr "" -msgid "Panel Objects" +#: ../../library/curses.panel.rst:59 +msgid "Panel objects" msgstr "" -msgid "Panel objects, as returned by :func:`new_panel` above, are windows with a stacking order. There's always a window associated with a panel which determines the content, while the panel methods are responsible for the window's depth in the panel stack." +#: ../../library/curses.panel.rst:79 +msgid "" +"Panel objects, as returned by :func:`new_panel` above, are windows with a " +"stacking order. There's always a window associated with a panel which " +"determines the content, while the panel methods are responsible for the " +"window's depth in the panel stack." msgstr "" +#: ../../library/curses.panel.rst:84 msgid "Panel objects have the following methods:" msgstr "" +#: ../../library/curses.panel.rst:89 msgid "Returns the panel above the current panel." msgstr "" +#: ../../library/curses.panel.rst:94 msgid "Returns the panel below the current panel." msgstr "" +#: ../../library/curses.panel.rst:99 msgid "Push the panel to the bottom of the stack." msgstr "" -msgid "Returns ``True`` if the panel is hidden (not visible), ``False`` otherwise." +#: ../../library/curses.panel.rst:104 +msgid "" +"Returns ``True`` if the panel is hidden (not visible), ``False`` otherwise." msgstr "" -msgid "Hide the panel. This does not delete the object, it just makes the window on screen invisible." +#: ../../library/curses.panel.rst:109 +msgid "" +"Hide the panel. This does not delete the object, it just makes the window on " +"screen invisible." msgstr "" +#: ../../library/curses.panel.rst:115 msgid "Move the panel to the screen coordinates ``(y, x)``." msgstr "" +#: ../../library/curses.panel.rst:120 msgid "Change the window associated with the panel to the window *win*." msgstr "" -msgid "Set the panel's user pointer to *obj*. This is used to associate an arbitrary piece of data with the panel, and can be any Python object." +#: ../../library/curses.panel.rst:125 +msgid "" +"Set the panel's user pointer to *obj*. This is used to associate an " +"arbitrary piece of data with the panel, and can be any Python object." msgstr "" -msgid "Display the panel (which might have been hidden)." +#: ../../library/curses.panel.rst:131 +msgid "" +"Display the panel (which might have been hidden), placing it on top of the " +"panel stack." msgstr "" +#: ../../library/curses.panel.rst:137 msgid "Push panel to the top of the stack." msgstr "" -msgid "Returns the user pointer for the panel. This might be any Python object." +#: ../../library/curses.panel.rst:142 +msgid "" +"Returns the user pointer for the panel. This might be any Python object." msgstr "" +#: ../../library/curses.panel.rst:147 msgid "Returns the window object associated with the panel." msgstr "" diff --git a/library/curses.po b/library/curses.po index 141faaa9e..ca2901306 100644 --- a/library/curses.po +++ b/library/curses.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,1475 +25,2690 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/curses.rst:2 msgid ":mod:`!curses` --- Terminal handling for character-cell displays" msgstr "" +#: ../../library/curses.rst:11 msgid "**Source code:** :source:`Lib/curses`" msgstr "" -msgid "The :mod:`!curses` module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling." +#: ../../library/curses.rst:15 +msgid "" +"The :mod:`!curses` module provides an interface to the curses library, the " +"de-facto standard for portable advanced terminal handling." msgstr "" -msgid "While curses is most widely used in the Unix environment, versions are available for Windows, DOS, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix." +#: ../../library/curses.rst:18 +msgid "" +"While curses is most widely used in the Unix environment, versions are " +"available for Windows, DOS, and possibly other systems as well. This " +"extension module is designed to match the API of ncurses, an open-source " +"curses library hosted on Linux and the BSD variants of Unix." msgstr "" +#: ../../library/curses.rst:27 ../../includes/wasm-mobile-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +#: ../../includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -msgid "This is an :term:`optional module`. If it is missing from your copy of CPython, look for documentation from your distributor (that is, whoever provided Python to you). If you are the distributor, see :ref:`optional-module-requirements`." +#: ../../includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" -msgid "Whenever the documentation mentions a *character* it can be specified as an integer, a one-character Unicode string or a one-byte byte string." +#: ../../library/curses.rst:31 +msgid "" +"Whenever the documentation mentions a *character* it can be specified as an " +"integer, a one-character Unicode string or a one-byte byte string." msgstr "" -msgid "Whenever the documentation mentions a *character string* it can be specified as a Unicode string or a byte string." +#: ../../library/curses.rst:34 +msgid "" +"Whenever the documentation mentions a *character string* it can be specified " +"as a Unicode string or a byte string." msgstr "" +#: ../../library/curses.rst:39 msgid "Module :mod:`curses.ascii`" msgstr "" -msgid "Utilities for working with ASCII characters, regardless of your locale settings." +#: ../../library/curses.rst:40 +msgid "" +"Utilities for working with ASCII characters, regardless of your locale " +"settings." msgstr "" +#: ../../library/curses.rst:42 msgid "Module :mod:`curses.panel`" msgstr "" +#: ../../library/curses.rst:43 msgid "A panel stack extension that adds depth to curses windows." msgstr "" +#: ../../library/curses.rst:45 msgid "Module :mod:`curses.textpad`" msgstr "" -msgid "Editable text widget for curses supporting :program:`Emacs`\\ -like bindings." +#: ../../library/curses.rst:46 +msgid "" +"Editable text widget for curses supporting :program:`Emacs`\\ -like " +"bindings." msgstr "" +#: ../../library/curses.rst:48 msgid ":ref:`curses-howto`" msgstr "" -msgid "Tutorial material on using curses with Python, by Andrew Kuchling and Eric Raymond." +#: ../../library/curses.rst:49 +msgid "" +"Tutorial material on using curses with Python, by Andrew Kuchling and Eric " +"Raymond." msgstr "" +#: ../../library/curses.rst:56 msgid "Functions" msgstr "" +#: ../../library/curses.rst:58 msgid "The module :mod:`!curses` defines the following exception:" msgstr "" +#: ../../library/curses.rst:63 msgid "Exception raised when a curses library function returns an error." msgstr "" -msgid "Whenever *x* or *y* arguments to a function or a method are optional, they default to the current cursor location. Whenever *attr* is optional, it defaults to :const:`A_NORMAL`." +#: ../../library/curses.rst:67 +msgid "" +"Whenever *x* or *y* arguments to a function or a method are optional, they " +"default to the current cursor location. Whenever *attr* is optional, it " +"defaults to :const:`A_NORMAL`." msgstr "" +#: ../../library/curses.rst:71 msgid "The module :mod:`!curses` defines the following functions:" msgstr "" -msgid "Allow use of default values for colors on terminals supporting this feature. Use this to support transparency in your application." +#: ../../library/curses.rst:76 +msgid "" +"Allow use of default values for colors on terminals supporting this feature. " +"Use this to support transparency in your application." msgstr "" -msgid "Assign terminal default foreground/background colors to color number ``-1``. So ``init_pair(x, COLOR_RED, -1)`` will initialize pair *x* as red on default background and ``init_pair(x, -1, COLOR_BLUE)`` will initialize pair *x* as default foreground on blue." +#: ../../library/curses.rst:79 +msgid "" +"Assign terminal default foreground/background colors to color number ``-1``. " +"So ``init_pair(x, COLOR_RED, -1)`` will initialize pair *x* as red on " +"default background and ``init_pair(x, -1, COLOR_BLUE)`` will initialize pair " +"*x* as default foreground on blue." msgstr "" +#: ../../library/curses.rst:84 msgid "Change the definition of the color-pair ``0`` to ``(fg, bg)``." msgstr "" -msgid "Return the output speed of the terminal in bits per second. On software terminal emulators it will have a fixed high value. Included for historical reasons; in former times, it was used to write output loops for time delays and occasionally to change interfaces depending on the line speed." +#: ../../library/curses.rst:86 +msgid "This is an ncurses extension." msgstr "" +#: ../../library/curses.rst:93 +msgid "" +"Return the output speed of the terminal in bits per second. On software " +"terminal emulators it will have a fixed high value. Included for historical " +"reasons; in former times, it was used to write output loops for time delays " +"and occasionally to change interfaces depending on the line speed." +msgstr "" + +#: ../../library/curses.rst:101 msgid "Emit a short attention sound." msgstr "" -msgid "Return ``True`` or ``False``, depending on whether the programmer can change the colors displayed by the terminal." +#: ../../library/curses.rst:106 +msgid "" +"Return ``True`` or ``False``, depending on whether the programmer can change " +"the colors displayed by the terminal." msgstr "" -msgid "Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal tty line buffering is turned off and characters are available to be read one by one. However, unlike raw mode, special characters (interrupt, quit, suspend, and flow control) retain their effects on the tty driver and calling program. Calling first :func:`raw` then :func:`cbreak` leaves the terminal in cbreak mode." +#: ../../library/curses.rst:112 +msgid "" +"Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal " +"tty line buffering is turned off and characters are available to be read one " +"by one. However, unlike raw mode, special characters (interrupt, quit, " +"suspend, and flow control) retain their effects on the tty driver and " +"calling program. Calling first :func:`raw` then :func:`cbreak` leaves the " +"terminal in cbreak mode." msgstr "" -msgid "Return the intensity of the red, green, and blue (RGB) components in the color *color_number*, which must be between ``0`` and ``COLORS - 1``. Return a 3-tuple, containing the R,G,B values for the given color, which will be between ``0`` (no component) and ``1000`` (maximum amount of component)." +#: ../../library/curses.rst:121 +msgid "" +"Return the intensity of the red, green, and blue (RGB) components in the " +"color *color_number*, which must be between ``0`` and ``COLORS - 1``. " +"Return a 3-tuple, containing the R,G,B values for the given color, which " +"will be between ``0`` (no component) and ``1000`` (maximum amount of " +"component). Raise an exception if the color is not supported." msgstr "" -msgid "Return the attribute value for displaying text in the specified color pair. Only the first 256 color pairs are supported. This attribute value can be combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the other :const:`!A_\\*` attributes. :func:`pair_number` is the counterpart to this function." +#: ../../library/curses.rst:130 +msgid "" +"Return the attribute value for displaying text in the specified color pair. " +"Only the first 256 color pairs are supported. This attribute value can be " +"combined with :const:`A_STANDOUT`, :const:`A_REVERSE`, and the " +"other :const:`!A_\\*` attributes. :func:`pair_number` is the counterpart to " +"this function." msgstr "" -msgid "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, for invisible, normal, or very visible. If the terminal supports the visibility requested, return the previous cursor state; otherwise raise an exception. On many terminals, the \"visible\" mode is an underline cursor and the \"very visible\" mode is a block cursor." +#: ../../library/curses.rst:139 +msgid "" +"Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " +"for invisible, normal, or very visible. If the terminal supports the " +"visibility requested, return the previous cursor state; otherwise raise an " +"exception. On many terminals, the \"visible\" mode is an underline cursor " +"and the \"very visible\" mode is a block cursor." msgstr "" -msgid "Save the current terminal mode as the \"program\" mode, the mode when the running program is using curses. (Its counterpart is the \"shell\" mode, for when the program is not in curses.) Subsequent calls to :func:`reset_prog_mode` will restore this mode." +#: ../../library/curses.rst:148 +msgid "" +"Save the current terminal mode as the \"program\" mode, the mode when the " +"running program is using curses. (Its counterpart is the \"shell\" mode, " +"for when the program is not in curses.) Subsequent calls " +"to :func:`reset_prog_mode` will restore this mode." msgstr "" -msgid "Save the current terminal mode as the \"shell\" mode, the mode when the running program is not using curses. (Its counterpart is the \"program\" mode, when the program is using curses capabilities.) Subsequent calls to :func:`reset_shell_mode` will restore this mode." +#: ../../library/curses.rst:156 +msgid "" +"Save the current terminal mode as the \"shell\" mode, the mode when the " +"running program is not using curses. (Its counterpart is the \"program\" " +"mode, when the program is using curses capabilities.) Subsequent calls " +"to :func:`reset_shell_mode` will restore this mode." msgstr "" +#: ../../library/curses.rst:164 msgid "Insert an *ms* millisecond pause in output." msgstr "" -msgid "Update the physical screen. The curses library keeps two data structures, one representing the current physical screen contents and a virtual screen representing the desired next state. The :func:`doupdate` ground updates the physical screen to match the virtual screen." +#: ../../library/curses.rst:169 +msgid "" +"Update the physical screen. The curses library keeps two data structures, " +"one representing the current physical screen contents and a virtual screen " +"representing the desired next state. The :func:`doupdate` function updates " +"the physical screen to match the virtual screen." msgstr "" -msgid "The virtual screen may be updated by a :meth:`~window.noutrefresh` call after write operations such as :meth:`~window.addstr` have been performed on a window. The normal :meth:`~window.refresh` call is simply :meth:`!noutrefresh` followed by :func:`!doupdate`; if you have to update multiple windows, you can speed performance and perhaps reduce screen flicker by issuing :meth:`!noutrefresh` calls on all windows, followed by a single :func:`!doupdate`." +#: ../../library/curses.rst:174 +msgid "" +"The virtual screen may be updated by a :meth:`~window.noutrefresh` call " +"after write operations such as :meth:`~window.addstr` have been performed on " +"a window. The normal :meth:`~window.refresh` call is simply :meth:`!" +"noutrefresh` followed by :func:`!doupdate`; if you have to update multiple " +"windows, you can speed performance and perhaps reduce screen flicker by " +"issuing :meth:`!noutrefresh` calls on all windows, followed by a " +"single :func:`!doupdate`." msgstr "" -msgid "Enter echo mode. In echo mode, each character input is echoed to the screen as it is entered." +#: ../../library/curses.rst:184 +msgid "" +"Enter echo mode. In echo mode, each character input is echoed to the screen " +"as it is entered." msgstr "" +#: ../../library/curses.rst:190 msgid "De-initialize the library, and return terminal to normal status." msgstr "" -msgid "Return the user's current erase character as a one-byte bytes object. Under Unix operating systems this is a property of the controlling tty of the curses program, and is not set by the curses library itself." +#: ../../library/curses.rst:195 +msgid "" +"Return the user's current erase character as a one-byte bytes object. Under " +"Unix operating systems this is a property of the controlling tty of the " +"curses program, and is not set by the curses library itself." +msgstr "" + +#: ../../library/curses.rst:202 +msgid "" +"The :func:`.filter` routine, if used, must be called before :func:`initscr` " +"is called. The effect is that, during the initialization, :envvar:`LINES` " +"is set to ``1``; the capabilities ``clear``, ``cup``, ``cud``, ``cud1``, " +"``cuu1``, ``cuu``, ``vpa`` are disabled; and the ``home`` string is set to " +"the value of ``cr``. The effect is that the cursor is confined to the " +"current line, and so are screen updates. This may be used for enabling " +"character-at-a-time line editing without touching the rest of the screen." msgstr "" -msgid "The :func:`.filter` routine, if used, must be called before :func:`initscr` is called. The effect is that, during those calls, :envvar:`LINES` is set to ``1``; the capabilities ``clear``, ``cup``, ``cud``, ``cud1``, ``cuu1``, ``cuu``, ``vpa`` are disabled; and the ``home`` string is set to the value of ``cr``. The effect is that the cursor is confined to the current line, and so are screen updates. This may be used for enabling character-at-a-time line editing without touching the rest of the screen." +#: ../../library/curses.rst:212 +msgid "" +"Flash the screen. That is, change it to reverse-video and then change it " +"back in a short interval. Some people prefer such as 'visible bell' to the " +"audible attention signal produced by :func:`beep`." msgstr "" -msgid "Flash the screen. That is, change it to reverse-video and then change it back in a short interval. Some people prefer such as 'visible bell' to the audible attention signal produced by :func:`beep`." +#: ../../library/curses.rst:219 +msgid "" +"Flush all input buffers. This throws away any typeahead that has been " +"typed by the user and has not yet been processed by the program." msgstr "" -msgid "Flush all input buffers. This throws away any typeahead that has been typed by the user and has not yet been processed by the program." +#: ../../library/curses.rst:225 +msgid "" +"After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse " +"event, this method should be called to retrieve the queued mouse event, " +"represented as a 5-tuple ``(id, x, y, z, bstate)``. *id* is an ID value used " +"to distinguish multiple devices, and *x*, *y*, *z* are the event's " +"coordinates. (*z* is currently unused.) *bstate* is an integer value whose " +"bits will be set to indicate the type of event, and will be the bitwise OR " +"of one or more of the following constants, where *n* is the button number " +"from 1 to " +"5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`." +msgstr "" + +#: ../../library/curses.rst:236 ../../library/curses.rst:1864 +msgid "" +"The ``BUTTON5_*`` constants are now exposed if they are provided by the " +"underlying curses library." msgstr "" -msgid "After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse event, this method should be called to retrieve the queued mouse event, represented as a 5-tuple ``(id, x, y, z, bstate)``. *id* is an ID value used to distinguish multiple devices, and *x*, *y*, *z* are the event's coordinates. (*z* is currently unused.) *bstate* is an integer value whose bits will be set to indicate the type of event, and will be the bitwise OR of one or more of the following constants, where *n* is the button number from 1 to 5: :const:`BUTTONn_PRESSED`, :const:`BUTTONn_RELEASED`, :const:`BUTTONn_CLICKED`, :const:`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`." +#: ../../library/curses.rst:243 +msgid "" +"Return the current coordinates of the virtual screen cursor as a tuple ``(y, " +"x)``. If :meth:`leaveok ` is currently ``True``, then " +"return ``(-1, -1)``." msgstr "" -msgid "The ``BUTTON5_*`` constants are now exposed if they are provided by the underlying curses library." +#: ../../library/curses.rst:249 +msgid "" +"Read window-related data stored in the file by an " +"earlier :meth:`window.putwin` call. The routine then creates and initializes " +"a new window using that data, returning the new window object. The *file* " +"argument must be a file object opened for reading in binary mode." msgstr "" -msgid "Return the current coordinates of the virtual screen cursor as a tuple ``(y, x)``. If :meth:`leaveok ` is currently ``True``, then return ``(-1, -1)``." +#: ../../library/curses.rst:257 +msgid "" +"Return ``True`` if the terminal can display colors; otherwise, return " +"``False``." msgstr "" -msgid "Read window related data stored in the file by an earlier :func:`window.putwin` call. The routine then creates and initializes a new window using that data, returning the new window object." +#: ../../library/curses.rst:261 +msgid "" +"Return ``True`` if the module supports extended colors; otherwise, return " +"``False``. Extended color support allows more than 256 color pairs for " +"terminals that support more than 16 colors (for example, xterm-256color)." msgstr "" -msgid "Return ``True`` if the terminal can display colors; otherwise, return ``False``." +#: ../../library/curses.rst:265 +msgid "Extended color support requires ncurses version 6.1 or later." msgstr "" -msgid "Return ``True`` if the module supports extended colors; otherwise, return ``False``. Extended color support allows more than 256 color pairs for terminals that support more than 16 colors (e.g. xterm-256color)." +#: ../../library/curses.rst:271 +msgid "" +"Return ``True`` if the terminal has insert- and delete-character " +"capabilities. This function is included for historical reasons only, as all " +"modern software terminal emulators have such capabilities." msgstr "" -msgid "Extended color support requires ncurses version 6.1 or later." +#: ../../library/curses.rst:278 +msgid "" +"Return ``True`` if the terminal has insert- and delete-line capabilities, or " +"can simulate them using scrolling regions. This function is included for " +"historical reasons only, as all modern software terminal emulators have such " +"capabilities." msgstr "" -msgid "Return ``True`` if the terminal has insert- and delete-character capabilities. This function is included for historical reasons only, as all modern software terminal emulators have such capabilities." +#: ../../library/curses.rst:286 +msgid "" +"Take a key value *ch*, and return ``True`` if the current terminal type " +"recognizes a key with that value." msgstr "" -msgid "Return ``True`` if the terminal has insert- and delete-line capabilities, or can simulate them using scrolling regions. This function is included for historical reasons only, as all modern software terminal emulators have such capabilities." +#: ../../library/curses.rst:292 +msgid "" +"Used for half-delay mode, which is similar to cbreak mode in that characters " +"typed by the user are immediately available to the program. However, after " +"blocking for *tenths* tenths of seconds, raise an exception if nothing has " +"been typed. The value of *tenths* must be a number between ``1`` and " +"``255``. Use :func:`nocbreak` to leave half-delay mode." msgstr "" -msgid "Take a key value *ch*, and return ``True`` if the current terminal type recognizes a key with that value." +#: ../../library/curses.rst:301 +msgid "" +"Change the definition of a color, taking the number of the color to be " +"changed followed by three RGB values (for the amounts of red, green, and " +"blue components). The value of *color_number* must be between ``0`` and " +"``COLORS - 1``. Each of *r*, *g*, *b*, must be a value between ``0`` and " +"``1000``. When :func:`init_color` is used, all occurrences of that color on " +"the screen immediately change to the new definition. This function is a no-" +"op on most terminals; it is active only if :func:`can_change_color` returns " +"``True``." msgstr "" -msgid "Used for half-delay mode, which is similar to cbreak mode in that characters typed by the user are immediately available to the program. However, after blocking for *tenths* tenths of seconds, raise an exception if nothing has been typed. The value of *tenths* must be a number between ``1`` and ``255``. Use :func:`nocbreak` to leave half-delay mode." +#: ../../library/curses.rst:312 +msgid "" +"Change the definition of a color-pair. It takes three arguments: the number " +"of the color-pair to be changed, the foreground color number, and the " +"background color number. The value of *pair_number* must be between ``1`` " +"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed " +"by :func:`use_default_colors` and :func:`assume_default_colors`). The value " +"of *fg* and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, " +"after calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " +"``-1``. If the color-pair was previously initialized, the screen is " +"refreshed and all occurrences of that color-pair are changed to the new " +"definition." +msgstr "" + +#: ../../library/curses.rst:327 +msgid "" +"Initialize the library. Return a :ref:`window ` " +"object which represents the whole screen." msgstr "" -msgid "Change the definition of a color, taking the number of the color to be changed followed by three RGB values (for the amounts of red, green, and blue components). The value of *color_number* must be between ``0`` and ``COLORS - 1``. Each of *r*, *g*, *b*, must be a value between ``0`` and ``1000``. When :func:`init_color` is used, all occurrences of that color on the screen immediately change to the new definition. This function is a no-op on most terminals; it is active only if :func:`can_change_color` returns ``True``." +#: ../../library/curses.rst:330 +msgid "" +"See :func:`setupterm` for a caveat about calling it before this function." msgstr "" -msgid "Change the definition of a color-pair. It takes three arguments: the number of the color-pair to be changed, the foreground color number, and the background color number. The value of *pair_number* must be between ``1`` and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed by :func:`use_default_colors` and :func:`assume_default_colors`). The value of *fg* and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, after calling :func:`!use_default_colors` or :func:`!assume_default_colors`, ``-1``. If the color-pair was previously initialized, the screen is refreshed and all occurrences of that color-pair are changed to the new definition." +#: ../../library/curses.rst:334 +msgid "" +"If there is an error opening the terminal, the underlying curses library may " +"cause the interpreter to exit." msgstr "" -msgid "Initialize the library. Return a :ref:`window ` object which represents the whole screen." +#: ../../library/curses.rst:340 +msgid "" +"If *flag* is ``True``, pressing an interrupt key (interrupt, break, or quit) " +"will flush all output in the terminal driver queue. If *flag* is ``False``, " +"no flushing is done." msgstr "" -msgid "If there is an error opening the terminal, the underlying curses library may cause the interpreter to exit." +#: ../../library/curses.rst:347 +msgid "" +"Return ``True`` if :func:`resize_term` would modify the window structure, " +"``False`` otherwise." msgstr "" -msgid "Return ``True`` if :func:`resize_term` would modify the window structure, ``False`` otherwise." +#: ../../library/curses.rst:353 +msgid "" +"Return ``True`` if :func:`endwin` has been called (that is, the curses " +"library has been deinitialized)." msgstr "" -msgid "Return ``True`` if :func:`endwin` has been called (that is, the curses library has been deinitialized)." +#: ../../library/curses.rst:359 +msgid "" +"Return the name of the key numbered *k* as a bytes object. The name of a " +"key generating printable ASCII character is the key's character. The name " +"of a control-key combination is a two-byte bytes object consisting of a " +"caret (``b'^'``) followed by the corresponding printable ASCII character. " +"The name of an alt-key combination (128--255) is a bytes object consisting " +"of the prefix ``b'M-'`` followed by the name of the corresponding ASCII " +"character." msgstr "" -msgid "Return the name of the key numbered *k* as a bytes object. The name of a key generating printable ASCII character is the key's character. The name of a control-key combination is a two-byte bytes object consisting of a caret (``b'^'``) followed by the corresponding printable ASCII character. The name of an alt-key combination (128--255) is a bytes object consisting of the prefix ``b'M-'`` followed by the name of the corresponding ASCII character." +#: ../../library/curses.rst:366 +msgid "Raise a :exc:`ValueError` if *k* is negative." msgstr "" -msgid "Return the user's current line kill character as a one-byte bytes object. Under Unix operating systems this is a property of the controlling tty of the curses program, and is not set by the curses library itself." +#: ../../library/curses.rst:371 +msgid "" +"Return the user's current line kill character as a one-byte bytes object. " +"Under Unix operating systems this is a property of the controlling tty of " +"the curses program, and is not set by the curses library itself." msgstr "" -msgid "Return a bytes object containing the terminfo long name field describing the current terminal. The maximum length of a verbose description is 128 characters. It is defined only after the call to :func:`initscr`." +#: ../../library/curses.rst:378 +msgid "" +"Return a bytes object containing the terminfo long name field describing the " +"current terminal. The maximum length of a verbose description is 128 " +"characters. It is defined only after the call to :func:`initscr`." msgstr "" -msgid "If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is ``False``, allow only 7-bit chars." +#: ../../library/curses.rst:385 +msgid "" +"If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is " +"``False``, allow only 7-bit chars." msgstr "" -msgid "Set the maximum time in milliseconds that can elapse between press and release events in order for them to be recognized as a click, and return the previous interval value. The default value is 200 milliseconds, or one fifth of a second." +#: ../../library/curses.rst:391 +msgid "" +"Set the maximum time in milliseconds that can elapse between press and " +"release events in order for them to be recognized as a click, and return the " +"previous interval value. The default value is 166 milliseconds, or one " +"sixth of a second. Use a negative *interval* to obtain the interval value " +"without changing it." msgstr "" -msgid "Set the mouse events to be reported, and return a tuple ``(availmask, oldmask)``. *availmask* indicates which of the specified mouse events can be reported; on complete failure it returns ``0``. *oldmask* is the previous value of the given window's mouse event mask. If this function is never called, no mouse events are ever reported." +#: ../../library/curses.rst:399 +msgid "" +"Set the mouse events to be reported, and return a tuple ``(availmask, " +"oldmask)``. *availmask* indicates which of the specified mouse events can " +"be reported; on complete failure it returns ``0``. *oldmask* is the " +"previous value of the mouse event mask. If this function is never called, " +"no mouse events are ever reported." msgstr "" +#: ../../library/curses.rst:408 msgid "Sleep for *ms* milliseconds." msgstr "" -msgid "Create and return a pointer to a new pad data structure with the given number of lines and columns. Return a pad as a window object." +#: ../../library/curses.rst:413 +msgid "" +"Create and return a pointer to a new pad data structure with the given " +"number of lines and columns. Return a pad as a window object." msgstr "" -msgid "A pad is like a window, except that it is not restricted by the screen size, and is not necessarily associated with a particular part of the screen. Pads can be used when a large window is needed, and only a part of the window will be on the screen at one time. Automatic refreshes of pads (such as from scrolling or echoing of input) do not occur. The :meth:`~window.refresh` and :meth:`~window.noutrefresh` methods of a pad require 6 arguments to specify the part of the pad to be displayed and the location on the screen to be used for the display. The arguments are *pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* arguments refer to the upper left corner of the pad region to be displayed and the *s* arguments define a clipping box on the screen within which the pad region is to be displayed." +#: ../../library/curses.rst:416 +msgid "" +"A pad is like a window, except that it is not restricted by the screen size, " +"and is not necessarily associated with a particular part of the screen. " +"Pads can be used when a large window is needed, and only a part of the " +"window will be on the screen at one time. Automatic refreshes of pads (such " +"as from scrolling or echoing of input) do not occur. " +"The :meth:`~window.refresh` and :meth:`~window.noutrefresh` methods of a pad " +"require 6 arguments to specify the part of the pad to be displayed and the " +"location on the screen to be used for the display. The arguments are " +"*pminrow*, *pmincol*, *sminrow*, *smincol*, *smaxrow*, *smaxcol*; the *p* " +"arguments refer to the upper-left corner of the pad region to be displayed " +"and the *s* arguments define a clipping box on the screen within which the " +"pad region is to be displayed." +msgstr "" + +#: ../../library/curses.rst:432 +msgid "" +"Return a new :ref:`window `, whose left-upper corner " +"is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -msgid "Return a new :ref:`window `, whose left-upper corner is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." +#: ../../library/curses.rst:435 +msgid "" +"By default, the window will extend from the specified position to the lower " +"right corner of the screen." msgstr "" -msgid "By default, the window will extend from the specified position to the lower right corner of the screen." +#: ../../library/curses.rst:441 +msgid "" +"Enter newline mode. This mode translates the return key into newline on " +"input, and translates newline into return and line-feed on output. Newline " +"mode is initially on." msgstr "" -msgid "Enter newline mode. This mode translates the return key into newline on input, and translates newline into return and line-feed on output. Newline mode is initially on." +#: ../../library/curses.rst:445 +msgid "If *flag* is ``False``, the effect is the same as calling :func:`nonl`." msgstr "" -msgid "Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." +#: ../../library/curses.rst:450 +msgid "" +"Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." msgstr "" +#: ../../library/curses.rst:455 msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "" -msgid "Leave newline mode. Disable translation of return into newline on input, and disable low-level translation of newline into newline/return on output (but this does not change the behavior of ``addch('\\n')``, which always does the equivalent of return and line feed on the virtual screen). With translation off, curses can sometimes speed up vertical motion a little; also, it will be able to detect the return key on input." +#: ../../library/curses.rst:460 +msgid "" +"Leave newline mode. Disable translation of return into newline on input, " +"and disable low-level translation of newline into newline/return on output " +"(but this does not change the behavior of ``addch('\\n')``, which always " +"does the equivalent of return and line feed on the virtual screen). With " +"translation off, curses can sometimes speed up vertical motion a little; " +"also, it will be able to detect the return key on input." msgstr "" -msgid "When the :func:`!noqiflush` routine is used, normal flush of input and output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters will not be done. You may want to call :func:`!noqiflush` in a signal handler if you want output to continue as though the interrupt had not occurred, after the handler exits." +#: ../../library/curses.rst:470 +msgid "" +"When the :func:`!noqiflush` routine is used, normal flush of input and " +"output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters " +"will not be done. You may want to call :func:`!noqiflush` in a signal " +"handler if you want output to continue as though the interrupt had not " +"occurred, after the handler exits." msgstr "" +#: ../../library/curses.rst:478 msgid "Leave raw mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -msgid "Return a tuple ``(fg, bg)`` containing the colors for the requested color pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - 1``." +#: ../../library/curses.rst:483 +msgid "" +"Return a tuple ``(fg, bg)`` containing the colors for the requested color " +"pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - " +"1``." msgstr "" -msgid "Return the number of the color-pair set by the attribute value *attr*. :func:`color_pair` is the counterpart to this function." +#: ../../library/curses.rst:489 +msgid "" +"Return the number of the color-pair set by the attribute value " +"*attr*. :func:`color_pair` is the counterpart to this function." msgstr "" -msgid "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified terminfo capability for the current terminal. Note that the output of :func:`putp` always goes to standard output." +#: ../../library/curses.rst:495 +msgid "" +"Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " +"terminfo capability for the current terminal. Note that the output " +"of :func:`putp` always goes to standard output." msgstr "" -msgid "If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. If *flag* is ``True``, or no argument is provided, the queues will be flushed when these control characters are read." +#: ../../library/curses.rst:499 ../../library/curses.rst:642 +#: ../../library/curses.rst:652 ../../library/curses.rst:662 +#: ../../library/curses.rst:672 +msgid ":func:`setupterm` (or :func:`initscr`) must be called first." msgstr "" -msgid "Enter raw mode. In raw mode, normal line buffering and processing of interrupt, quit, suspend, and flow control keys are turned off; characters are presented to curses input functions one by one." +#: ../../library/curses.rst:504 +msgid "" +"If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. " +"If *flag* is ``True``, or no argument is provided, the queues will be " +"flushed when these control characters are read." msgstr "" -msgid "Restore the terminal to \"program\" mode, as previously saved by :func:`def_prog_mode`." +#: ../../library/curses.rst:511 +msgid "" +"Enter raw mode. In raw mode, normal line buffering and processing of " +"interrupt, quit, suspend, and flow control keys are turned off; characters " +"are presented to curses input functions one by one." msgstr "" -msgid "Restore the terminal to \"shell\" mode, as previously saved by :func:`def_shell_mode`." +#: ../../library/curses.rst:518 +msgid "" +"Restore the terminal to \"program\" mode, as previously saved " +"by :func:`def_prog_mode`." msgstr "" -msgid "Restore the state of the terminal modes to what it was at the last call to :func:`savetty`." +#: ../../library/curses.rst:524 +msgid "" +"Restore the terminal to \"shell\" mode, as previously saved " +"by :func:`def_shell_mode`." msgstr "" -msgid "Backend function used by :func:`resizeterm`, performing most of the work; when resizing the windows, :func:`resize_term` blank-fills the areas that are extended. The calling application should fill in these areas with appropriate data. The :func:`!resize_term` function attempts to resize all windows. However, due to the calling convention of pads, it is not possible to resize these without additional interaction with the application." +#: ../../library/curses.rst:530 +msgid "" +"Restore the state of the terminal modes to what it was at the last call " +"to :func:`savetty`." msgstr "" -msgid "Resize the standard and current windows to the specified dimensions, and adjusts other bookkeeping data used by the curses library that record the window dimensions (in particular the SIGWINCH handler)." +#: ../../library/curses.rst:536 +msgid "" +"Backend function used by :func:`resizeterm`, performing most of the work; " +"when resizing the windows, :func:`resize_term` blank-fills the areas that " +"are extended. The calling application should fill in these areas with " +"appropriate data. The :func:`!resize_term` function attempts to resize all " +"windows. However, due to the calling convention of pads, it is not possible " +"to resize these without additional interaction with the application." msgstr "" -msgid "Save the current state of the terminal modes in a buffer, usable by :func:`resetty`." +#: ../../library/curses.rst:546 +msgid "" +"Resize the standard and current windows to the specified dimensions, and " +"adjusts other bookkeeping data used by the curses library that record the " +"window dimensions (in particular the SIGWINCH handler)." msgstr "" +#: ../../library/curses.rst:553 +msgid "" +"Save the current state of the terminal modes in a buffer, usable " +"by :func:`resetty`." +msgstr "" + +#: ../../library/curses.rst:558 msgid "Retrieves the value set by :func:`set_escdelay`." msgstr "" -msgid "Sets the number of milliseconds to wait after reading an escape character, to distinguish between an individual escape character entered on the keyboard from escape sequences sent by cursor and function keys." +#: ../../library/curses.rst:564 +msgid "" +"Sets the number of milliseconds to wait after reading an escape character, " +"to distinguish between an individual escape character entered on the " +"keyboard from escape sequences sent by cursor and function keys." msgstr "" +#: ../../library/curses.rst:572 msgid "Retrieves the value set by :func:`set_tabsize`." msgstr "" -msgid "Sets the number of columns used by the curses library when converting a tab character to spaces as it adds the tab to a window." +#: ../../library/curses.rst:578 +msgid "" +"Sets the number of columns used by the curses library when converting a tab " +"character to spaces as it adds the tab to a window." +msgstr "" + +#: ../../library/curses.rst:585 +msgid "" +"Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " +"then :meth:`leaveok ` is set ``True``." msgstr "" -msgid "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, then :meth:`leaveok ` is set ``True``." +#: ../../library/curses.rst:591 +msgid "" +"Initialize the terminal. *term* is a string giving the terminal name, or " +"``None``; if omitted or ``None``, the value of the :envvar:`TERM` " +"environment variable will be used. *fd* is the file descriptor to which any " +"initialization sequences will be sent; if not supplied or ``-1``, the file " +"descriptor for ``sys.stdout`` will be used." msgstr "" -msgid "Initialize the terminal. *term* is a string giving the terminal name, or ``None``; if omitted or ``None``, the value of the :envvar:`TERM` environment variable will be used. *fd* is the file descriptor to which any initialization sequences will be sent; if not supplied or ``-1``, the file descriptor for ``sys.stdout`` will be used." +#: ../../library/curses.rst:597 +msgid "" +"Raise a :exc:`curses.error` if the terminal could not be found or its " +"terminfo database entry could not be read. If the terminal has already been " +"initialized, this function has no effect." msgstr "" -msgid "Must be called if the programmer wants to use colors, and before any other color manipulation routine is called. It is good practice to call this routine right after :func:`initscr`." +#: ../../library/curses.rst:603 +msgid "" +"Calling :func:`initscr` after :func:`setupterm` leaks the terminal " +"that :func:`setupterm` allocated: the curses library keeps only a single " +"current terminal and does not free the previously allocated one." msgstr "" -msgid ":func:`start_color` initializes eight basic colors (black, red, green, yellow, blue, magenta, cyan, and white), and two global variables in the :mod:`!curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, containing the maximum number of colors and color-pairs the terminal can support. It also restores the colors on the terminal to the values they had when the terminal was just turned on." +#: ../../library/curses.rst:611 +msgid "" +"Must be called if the programmer wants to use colors, and before any other " +"color manipulation routine is called. It is good practice to call this " +"routine right after :func:`initscr`." msgstr "" -msgid "Return a logical OR of all video attributes supported by the terminal. This information is useful when a curses program needs complete control over the appearance of the screen." +#: ../../library/curses.rst:615 +msgid "" +":func:`start_color` initializes eight basic colors (black, red, green, " +"yellow, blue, magenta, cyan, and white), and two global variables in " +"the :mod:`!curses` module, :const:`COLORS` and :const:`COLOR_PAIRS`, " +"containing the maximum number of colors and color-pairs the terminal can " +"support. It also restores the colors on the terminal to the values they had " +"when the terminal was just turned on." msgstr "" -msgid "Return the value of the environment variable :envvar:`TERM`, as a bytes object, truncated to 14 characters." +#: ../../library/curses.rst:624 +msgid "" +"Return a logical OR of all video attributes supported by the terminal. This " +"information is useful when a curses program needs complete control over the " +"appearance of the screen." msgstr "" -msgid "Return the value of the Boolean capability corresponding to the terminfo capability name *capname* as an integer. Return the value ``-1`` if *capname* is not a Boolean capability, or ``0`` if it is canceled or absent from the terminal description." +#: ../../library/curses.rst:631 +msgid "" +"Return the value of the environment variable :envvar:`TERM`, as a bytes " +"object, truncated to 14 characters." msgstr "" -msgid "Return the value of the numeric capability corresponding to the terminfo capability name *capname* as an integer. Return the value ``-2`` if *capname* is not a numeric capability, or ``-1`` if it is canceled or absent from the terminal description." +#: ../../library/curses.rst:637 +msgid "" +"Return the value of the Boolean capability corresponding to the terminfo " +"capability name *capname* as an integer. Return the value ``-1`` if " +"*capname* is not a Boolean capability, or ``0`` if it is canceled or absent " +"from the terminal description." msgstr "" -msgid "Return the value of the string capability corresponding to the terminfo capability name *capname* as a bytes object. Return ``None`` if *capname* is not a terminfo \"string capability\", or is canceled or absent from the terminal description." +#: ../../library/curses.rst:647 +msgid "" +"Return the value of the numeric capability corresponding to the terminfo " +"capability name *capname* as an integer. Return the value ``-2`` if " +"*capname* is not a numeric capability, or ``-1`` if it is canceled or absent " +"from the terminal description." msgstr "" -msgid "Instantiate the bytes object *str* with the supplied parameters, where *str* should be a parameterized string obtained from the terminfo database. E.g. ``tparm(tigetstr(\"cup\"), 5, 3)`` could result in ``b'\\033[6;4H'``, the exact result depending on terminal type." +#: ../../library/curses.rst:657 +msgid "" +"Return the value of the string capability corresponding to the terminfo " +"capability name *capname* as a bytes object. Return ``None`` if *capname* " +"is not a terminfo \"string capability\", or is canceled or absent from the " +"terminal description." msgstr "" -msgid "Specify that the file descriptor *fd* be used for typeahead checking. If *fd* is ``-1``, then no typeahead checking is done." +#: ../../library/curses.rst:667 +msgid "" +"Instantiate the bytes object *str* with the supplied parameters, where *str* " +"should be a parameterized string obtained from the terminfo database. For " +"example, ``tparm(tigetstr(\"cup\"), 5, 3)`` could result in " +"``b'\\033[6;4H'``, the exact result depending on terminal type. Up to nine " +"integer parameters may be supplied." msgstr "" -msgid "The curses library does \"line-breakout optimization\" by looking for typeahead periodically while updating the screen. If input is found, and it is coming from a tty, the current update is postponed until refresh or doupdate is called again, allowing faster response to commands typed in advance. This function allows specifying a different file descriptor for typeahead checking." +#: ../../library/curses.rst:677 +msgid "" +"Specify that the file descriptor *fd* be used for typeahead checking. If " +"*fd* is ``-1``, then no typeahead checking is done." msgstr "" -msgid "Return a bytes object which is a printable representation of the character *ch*. Control characters are represented as a caret followed by the character, for example as ``b'^C'``. Printing characters are left as they are." +#: ../../library/curses.rst:680 +msgid "" +"The curses library does \"line-breakout optimization\" by looking for " +"typeahead periodically while updating the screen. If input is found, and it " +"is coming from a tty, the current update is postponed until refresh or " +"doupdate is called again, allowing faster response to commands typed in " +"advance. This function allows specifying a different file descriptor for " +"typeahead checking." +msgstr "" + +#: ../../library/curses.rst:689 +msgid "" +"Return a bytes object which is a printable representation of the character " +"*ch*. Control characters are represented as a caret followed by the " +"character, for example as ``b'^C'``. Printing characters are left as they " +"are." msgstr "" +#: ../../library/curses.rst:696 msgid "Push *ch* so the next :meth:`~window.getch` will return it." msgstr "" +#: ../../library/curses.rst:700 msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr "" -msgid "Update the :const:`LINES` and :const:`COLS` module variables. Useful for detecting manual screen resize." +#: ../../library/curses.rst:705 +msgid "" +"Update the :const:`LINES` and :const:`COLS` module variables. Useful for " +"detecting manual screen resize." msgstr "" +#: ../../library/curses.rst:713 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." msgstr "" +#: ../../library/curses.rst:717 msgid "Only one *ch* can be pushed before :meth:`!get_wch` is called." msgstr "" -msgid "Push a :const:`KEY_MOUSE` event onto the input queue, associating the given state data with it." +#: ../../library/curses.rst:724 +msgid "" +"Push a :const:`KEY_MOUSE` event onto the input queue, associating the given " +"state data with it." msgstr "" -msgid "If used, this function should be called before :func:`initscr` or newterm are called. When *flag* is ``False``, the values of lines and columns specified in the terminfo database will be used, even if environment variables :envvar:`LINES` and :envvar:`COLUMNS` (used by default) are set, or if curses is running in a window (in which case default behavior would be to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." +#: ../../library/curses.rst:730 +msgid "" +"If used, this function should be called before :func:`initscr` or newterm " +"are called. When *flag* is ``False``, the values of lines and columns " +"specified in the terminfo database will be used, even if environment " +"variables :envvar:`LINES` and :envvar:`COLUMNS` (used by default) are set, " +"or if curses is running in a window (in which case default behavior would be " +"to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" +#: ../../library/curses.rst:740 msgid "Equivalent to ``assume_default_colors(-1, -1)``." msgstr "" -msgid "Initialize curses and call another callable object, *func*, which should be the rest of your curses-using application. If the application raises an exception, this function will restore the terminal to a sane state before re-raising the exception and generating a traceback. The callable object *func* is then passed the main window 'stdscr' as its first argument, followed by any other arguments passed to :func:`!wrapper`. Before calling *func*, :func:`!wrapper` turns on cbreak mode, turns off echo, enables the terminal keypad, and initializes colors if the terminal has color support. On exit (whether normally or by exception) it restores cooked mode, turns on echo, and disables the terminal keypad." +#: ../../library/curses.rst:745 +msgid "" +"Initialize curses and call another callable object, *func*, which should be " +"the rest of your curses-using application. If the application raises an " +"exception, this function will restore the terminal to a sane state before re-" +"raising the exception and generating a traceback. The callable object " +"*func* is then passed the main window 'stdscr' as its first argument, " +"followed by any other arguments passed to :func:`!wrapper`. Before calling " +"*func*, :func:`!wrapper` turns on cbreak mode, turns off echo, enables the " +"terminal keypad, and initializes colors if the terminal has color support. " +"On exit (whether normally or by exception) it restores cooked mode, turns on " +"echo, and disables the terminal keypad." msgstr "" -msgid "Window Objects" +#: ../../library/curses.rst:759 +msgid "Window objects" msgstr "" -msgid "Window objects, as returned by :func:`initscr` and :func:`newwin` above, have the following methods and attributes:" +#: ../../library/curses.rst:763 +msgid "" +"Window objects, as returned by :func:`initscr` and :func:`newwin` above, " +"have the following methods and attributes:" msgstr "" -msgid "Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any character previously painted at that location. By default, the character position and attributes are the current settings for the window object." +#: ../../library/curses.rst:770 +msgid "" +"Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any " +"character previously painted at that location. By default, the character " +"position and attributes are the current settings for the window object." msgstr "" -msgid "Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. Attempting to write to the lower right corner of a window, subwindow, or pad will cause an exception to be raised after the character is printed." +#: ../../library/curses.rst:776 +msgid "" +"Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. " +"Attempting to write to the lower-right corner of a window, subwindow, or pad " +"will cause an exception to be raised after the character is printed." msgstr "" -msgid "Paint at most *n* characters of the character string *str* at ``(y, x)`` with attributes *attr*, overwriting anything previously on the display." +#: ../../library/curses.rst:784 +msgid "" +"Paint at most *n* characters of the character string *str* at ``(y, x)`` " +"with attributes *attr*, overwriting anything previously on the display." msgstr "" -msgid "Paint the character string *str* at ``(y, x)`` with attributes *attr*, overwriting anything previously on the display." +#: ../../library/curses.rst:792 +msgid "" +"Paint the character string *str* at ``(y, x)`` with attributes *attr*, " +"overwriting anything previously on the display." msgstr "" -msgid "Writing outside the window, subwindow, or pad raises :exc:`curses.error`. Attempting to write to the lower right corner of a window, subwindow, or pad will cause an exception to be raised after the string is printed." +#: ../../library/curses.rst:797 +msgid "" +"Writing outside the window, subwindow, or pad raises :exc:`curses.error`. " +"Attempting to write to the lower-right corner of a window, subwindow, or pad " +"will cause an exception to be raised after the string is printed." msgstr "" -msgid "A `bug in ncurses `_, the backend for this Python module, can cause SegFaults when resizing windows. This is fixed in ncurses-6.1-20190511. If you are stuck with an earlier ncurses, you can avoid triggering this if you do not call :func:`addstr` with a *str* that has embedded newlines. Instead, call :func:`addstr` separately for each line." +#: ../../library/curses.rst:801 +msgid "" +"A bug in ncurses, the backend for this Python module, could cause segfaults " +"when resizing windows. This was fixed in ncurses-6.1-20190511. If you are " +"stuck with an earlier ncurses, you can avoid triggering it by not " +"calling :meth:`!addstr` with a *str* that has embedded newlines; instead, " +"call :meth:`!addstr` separately for each line." msgstr "" -msgid "Remove attribute *attr* from the \"background\" set applied to all writes to the current window." +#: ../../library/curses.rst:810 +msgid "" +"Remove attribute *attr* from the \"background\" set applied to all writes to " +"the current window." msgstr "" -msgid "Add attribute *attr* to the \"background\" set applied to all writes to the current window." +#: ../../library/curses.rst:816 +msgid "" +"Add attribute *attr* to the \"background\" set applied to all writes to the " +"current window." msgstr "" -msgid "Set the \"background\" set of attributes to *attr*. This set is initially ``0`` (no attributes)." +#: ../../library/curses.rst:822 +msgid "" +"Set the \"background\" set of attributes to *attr*. This set is initially " +"``0`` (no attributes)." msgstr "" -msgid "Set the background property of the window to the character *ch*, with attributes *attr*. The change is then applied to every character position in that window:" +#: ../../library/curses.rst:828 +msgid "" +"Set the background property of the window to the character *ch*, with " +"attributes *attr*. The change is then applied to every character position " +"in that window:" msgstr "" -msgid "The attribute of every character in the window is changed to the new background attribute." +#: ../../library/curses.rst:832 +msgid "" +"The attribute of every character in the window is changed to the new " +"background attribute." msgstr "" -msgid "Wherever the former background character appears, it is changed to the new background character." +#: ../../library/curses.rst:835 +msgid "" +"Wherever the former background character appears, it is changed to the new " +"background character." msgstr "" -msgid "Set the window's background. A window's background consists of a character and any combination of attributes. The attribute part of the background is combined (OR'ed) with all non-blank characters that are written into the window. Both the character and attribute parts of the background are combined with the blank characters. The background becomes a property of the character and moves with the character through any scrolling and insert/delete line/character operations." +#: ../../library/curses.rst:841 +msgid "" +"Set the window's background. A window's background consists of a character " +"and any combination of attributes. The attribute part of the background is " +"combined (OR'ed) with all non-blank characters that are written into the " +"window. Both the character and attribute parts of the background are " +"combined with the blank characters. The background becomes a property of " +"the character and moves with the character through any scrolling and insert/" +"delete line/character operations." msgstr "" -msgid "Draw a border around the edges of the window. Each parameter specifies the character to use for a specific part of the border; see the table below for more details." +#: ../../library/curses.rst:851 +msgid "" +"Draw a border around the edges of the window. Each parameter specifies the " +"character to use for a specific part of the border; see the table below for " +"more details." msgstr "" -msgid "A ``0`` value for any parameter will cause the default character to be used for that parameter. Keyword parameters can *not* be used. The defaults are listed in this table:" +#: ../../library/curses.rst:857 +msgid "" +"A ``0`` value for any parameter will cause the default character to be used " +"for that parameter. Keyword parameters can *not* be used. The defaults are " +"listed in this table:" msgstr "" +#: ../../library/curses.rst:862 msgid "Parameter" msgstr "" +#: ../../library/curses.rst:862 msgid "Description" msgstr "" +#: ../../library/curses.rst:862 msgid "Default value" msgstr "" +#: ../../library/curses.rst:864 msgid "*ls*" msgstr "" +#: ../../library/curses.rst:864 msgid "Left side" msgstr "" +#: ../../library/curses.rst:864 ../../library/curses.rst:866 msgid ":const:`ACS_VLINE`" msgstr "" +#: ../../library/curses.rst:866 msgid "*rs*" msgstr "" +#: ../../library/curses.rst:866 msgid "Right side" msgstr "" +#: ../../library/curses.rst:868 msgid "*ts*" msgstr "" +#: ../../library/curses.rst:868 msgid "Top" msgstr "" +#: ../../library/curses.rst:868 ../../library/curses.rst:870 msgid ":const:`ACS_HLINE`" msgstr "" +#: ../../library/curses.rst:870 msgid "*bs*" msgstr "" +#: ../../library/curses.rst:870 msgid "Bottom" msgstr "" +#: ../../library/curses.rst:872 msgid "*tl*" msgstr "" +#: ../../library/curses.rst:872 msgid "Upper-left corner" msgstr "" +#: ../../library/curses.rst:872 msgid ":const:`ACS_ULCORNER`" msgstr "" +#: ../../library/curses.rst:874 msgid "*tr*" msgstr "" +#: ../../library/curses.rst:874 msgid "Upper-right corner" msgstr "" +#: ../../library/curses.rst:874 msgid ":const:`ACS_URCORNER`" msgstr "" +#: ../../library/curses.rst:876 msgid "*bl*" msgstr "" +#: ../../library/curses.rst:876 msgid "Bottom-left corner" msgstr "" +#: ../../library/curses.rst:876 msgid ":const:`ACS_LLCORNER`" msgstr "" +#: ../../library/curses.rst:878 msgid "*br*" msgstr "" +#: ../../library/curses.rst:878 msgid "Bottom-right corner" msgstr "" +#: ../../library/curses.rst:878 msgid ":const:`ACS_LRCORNER`" msgstr "" -msgid "Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* and *bs* are *horch*. The default corner characters are always used by this function." +#: ../../library/curses.rst:884 +msgid "" +"Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* " +"and *bs* are *horch*. The default corner characters are always used by this " +"function." msgstr "" -msgid "Set the attributes of *num* characters at the current cursor position, or at position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the attribute will be set on all the characters to the end of the line. This function moves cursor to position ``(y, x)`` if supplied. The changed line will be touched using the :meth:`touchline` method so that the contents will be redisplayed by the next window refresh." +#: ../../library/curses.rst:893 +msgid "" +"Set the attributes of *num* characters at the current cursor position, or at " +"position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " +"attribute will be set on all the characters to the end of the line. This " +"function moves cursor to position ``(y, x)`` if supplied. The changed line " +"will be touched using the :meth:`touchline` method so that the contents will " +"be redisplayed by the next window refresh." msgstr "" -msgid "Like :meth:`erase`, but also cause the whole window to be repainted upon next call to :meth:`refresh`." +#: ../../library/curses.rst:903 +msgid "" +"Like :meth:`erase`, but also cause the whole window to be repainted upon " +"next call to :meth:`refresh`." msgstr "" -msgid "If *flag* is ``True``, the next call to :meth:`refresh` will clear the window completely." +#: ../../library/curses.rst:909 +msgid "" +"If *flag* is ``True``, the next call to :meth:`refresh` will clear the " +"window completely." msgstr "" -msgid "Erase from cursor to the end of the window: all lines below the cursor are deleted, and then the equivalent of :meth:`clrtoeol` is performed." +#: ../../library/curses.rst:915 +msgid "" +"Erase from cursor to the end of the window: all lines below the cursor are " +"deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" +#: ../../library/curses.rst:921 msgid "Erase from cursor to the end of the line." msgstr "" -msgid "Update the current cursor position of all the ancestors of the window to reflect the current cursor position of the window." +#: ../../library/curses.rst:926 +msgid "" +"Update the current cursor position of all the ancestors of the window to " +"reflect the current cursor position of the window." msgstr "" -msgid "Delete any character at ``(y, x)``." +#: ../../library/curses.rst:932 +msgid "" +"Delete the character under the cursor, or at ``(y, x)`` if specified. All " +"characters to the right on the same line are shifted one position left." msgstr "" -msgid "Delete the line under the cursor. All following lines are moved up by one line." +#: ../../library/curses.rst:938 +msgid "" +"Delete the line under the cursor. All following lines are moved up by one " +"line." msgstr "" -msgid "An abbreviation for \"derive window\", :meth:`derwin` is the same as calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to the origin of the window, rather than relative to the entire screen. Return a window object for the derived window." +#: ../../library/curses.rst:944 +msgid "" +"An abbreviation for \"derive window\", :meth:`derwin` is the same as " +"calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to " +"the origin of the window, rather than relative to the entire screen. Return " +"a window object for the derived window." msgstr "" -msgid "Add character *ch* with attribute *attr*, and immediately call :meth:`refresh` on the window." +#: ../../library/curses.rst:952 +msgid "" +"Add character *ch* with attribute *attr*, and immediately " +"call :meth:`refresh` on the window." msgstr "" -msgid "Test whether the given pair of screen-relative character-cell coordinates are enclosed by the given window, returning ``True`` or ``False``. It is useful for determining what subset of the screen windows enclose the location of a mouse event." +#: ../../library/curses.rst:958 +msgid "" +"Test whether the given pair of screen-relative character-cell coordinates " +"are enclosed by the given window, returning ``True`` or ``False``. It is " +"useful for determining what subset of the screen windows enclose the " +"location of a mouse event." msgstr "" +#: ../../library/curses.rst:963 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" -msgid "Encoding used to encode method arguments (Unicode strings and characters). The encoding attribute is inherited from the parent window when a subwindow is created, for example with :meth:`window.subwin`. By default, current locale encoding is used (see :func:`locale.getencoding`)." +#: ../../library/curses.rst:969 +msgid "" +"Encoding used to encode method arguments (Unicode strings and characters). " +"The encoding attribute is inherited from the parent window when a subwindow " +"is created, for example with :meth:`window.subwin`. By default, current " +"locale encoding is used (see :func:`locale.getencoding`)." msgstr "" +#: ../../library/curses.rst:979 msgid "Clear the window." msgstr "" +#: ../../library/curses.rst:984 msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." msgstr "" -msgid "Return the given window's current background character/attribute pair." +#: ../../library/curses.rst:989 +msgid "" +"Return the given window's current background character/attribute pair. Its " +"components can be extracted like those of :meth:`inch`." msgstr "" -msgid "Get a character. Note that the integer returned does *not* have to be in ASCII range: function keys, keypad keys and so on are represented by numbers higher than 255. In no-delay mode, return ``-1`` if there is no input, otherwise wait until a key is pressed." +#: ../../library/curses.rst:995 +msgid "" +"Get a character. Note that the integer returned does *not* have to be in " +"ASCII range: function keys, keypad keys and so on are represented by numbers " +"higher than 255. In no-delay mode, return ``-1`` if there is no input, " +"otherwise wait until a key is pressed." msgstr "" -msgid "Get a wide character. Return a character for most keys, or an integer for function keys, keypad keys, and other special keys. In no-delay mode, raise an exception if there is no input." +#: ../../library/curses.rst:1003 +msgid "" +"Get a wide character. Return a character for most keys, or an integer for " +"function keys, keypad keys, and other special keys. In no-delay mode, raise " +"an exception if there is no input." msgstr "" -msgid "Get a character, returning a string instead of an integer, as :meth:`getch` does. Function keys, keypad keys and other special keys return a multibyte string containing the key name. In no-delay mode, raise an exception if there is no input." +#: ../../library/curses.rst:1012 +msgid "" +"Get a character, returning a string instead of an integer, as :meth:`getch` " +"does. Function keys, keypad keys and other special keys return a multibyte " +"string containing the key name. In no-delay mode, raise an exception if " +"there is no input." msgstr "" +#: ../../library/curses.rst:1020 msgid "Return a tuple ``(y, x)`` of the height and width of the window." msgstr "" -msgid "Return the beginning coordinates of this window relative to its parent window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no parent." +#: ../../library/curses.rst:1025 +msgid "" +"Return the beginning coordinates of this window relative to its parent " +"window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no " +"parent." msgstr "" -msgid "Read a bytes object from the user, with primitive line editing capacity. The maximum value for *n* is 2047." +#: ../../library/curses.rst:1035 +msgid "" +"Read a bytes object from the user, with primitive line editing capacity. At " +"most *n* characters are read; *n* defaults to and cannot exceed 2047." msgstr "" +#: ../../library/curses.rst:1039 ../../library/curses.rst:1145 msgid "The maximum value for *n* was increased from 1023 to 2047." msgstr "" -msgid "Return a tuple ``(y, x)`` of current cursor position relative to the window's upper-left corner." +#: ../../library/curses.rst:1045 +msgid "" +"Return a tuple ``(y, x)`` of current cursor position relative to the " +"window's upper-left corner." msgstr "" -msgid "Display a horizontal line starting at ``(y, x)`` with length *n* consisting of the character *ch*." +#: ../../library/curses.rst:1052 +msgid "" +"Display a horizontal line starting at ``(y, x)`` with length *n* consisting " +"of the character *ch* with attributes *attr*. The line stops at the right " +"edge of the window if fewer than *n* cells are available." msgstr "" -msgid "If *flag* is ``False``, curses no longer considers using the hardware insert/delete character feature of the terminal; if *flag* is ``True``, use of character insertion and deletion is enabled. When curses is first initialized, use of character insert/delete is enabled by default." +#: ../../library/curses.rst:1059 +msgid "" +"If *flag* is ``False``, curses no longer considers using the hardware insert/" +"delete character feature of the terminal; if *flag* is ``True``, use of " +"character insertion and deletion is enabled. When curses is first " +"initialized, use of character insert/delete is enabled by default." msgstr "" -msgid "If *flag* is ``True``, :mod:`!curses` will try and use hardware line editing facilities. Otherwise, line insertion/deletion are disabled." +#: ../../library/curses.rst:1067 +msgid "" +"If *flag* is ``True``, :mod:`!curses` will try to use hardware line editing " +"facilities. Otherwise, curses will not use them." msgstr "" -msgid "If *flag* is ``True``, any change in the window image automatically causes the window to be refreshed; you no longer have to call :meth:`refresh` yourself. However, it may degrade performance considerably, due to repeated calls to wrefresh. This option is disabled by default." +#: ../../library/curses.rst:1073 +msgid "" +"If *flag* is ``True``, any change in the window image automatically causes " +"the window to be refreshed; you no longer have to call :meth:`refresh` " +"yourself. However, it may degrade performance considerably, due to repeated " +"calls to wrefresh. This option is disabled by default." msgstr "" -msgid "Return the character at the given position in the window. The bottom 8 bits are the character proper, and upper bits are the attributes." +#: ../../library/curses.rst:1081 +msgid "" +"Return the character at the given position in the window. The bottom 8 bits " +"are the character proper and the upper bits are the attributes; extract them " +"with the :data:`A_CHARTEXT` and :data:`A_ATTRIBUTES` bit-masks, and the " +"color pair with :func:`pair_number`. The character byte is the locale-" +"encoded byte of the cell's character, consistent with :meth:`instr`. On a " +"wide-character build, a character that does not fit in a single byte in the " +"current locale has a character byte of ``0``; use :meth:`instr` to read such " +"characters." msgstr "" -msgid "Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line from position *x* right by one character." +#: ../../library/curses.rst:1095 +msgid "" +"Insert character *ch* with attributes *attr* before the character under the " +"cursor, or at ``(y, x)`` if specified. All characters to the right of the " +"cursor are shifted one position right, with the rightmost character on the " +"line being lost. The cursor position does not change." msgstr "" -msgid "Insert *nlines* lines into the specified window above the current line. The *nlines* bottom lines are lost. For negative *nlines*, delete *nlines* lines starting with the one under the cursor, and move the remaining lines up. The bottom *nlines* lines are cleared. The current cursor position remains the same." +#: ../../library/curses.rst:1103 +msgid "" +"Insert *nlines* lines into the specified window above the current line. The " +"*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " +"lines starting with the one under the cursor, and move the remaining lines " +"up. The bottom *nlines* lines are cleared. The current cursor position " +"remains the same." msgstr "" -msgid "Insert a blank line under the cursor. All following lines are moved down by one line." +#: ../../library/curses.rst:1112 +msgid "" +"Insert a blank line under the cursor. All following lines are moved down by " +"one line." msgstr "" -msgid "Insert a character string (as many characters as will fit on the line) before the character under the cursor, up to *n* characters. If *n* is zero or negative, the entire string is inserted. All characters to the right of the cursor are shifted right, with the rightmost characters on the line being lost. The cursor position does not change (after moving to *y*, *x*, if specified)." +#: ../../library/curses.rst:1119 +msgid "" +"Insert a character string (as many characters as will fit on the line) " +"before the character under the cursor, up to *n* characters. If *n* is " +"zero or negative, the entire string is inserted. All characters to the right " +"of the cursor are shifted right, with the rightmost characters on the line " +"being lost. The cursor position does not change (after moving to *y*, *x*, " +"if specified)." msgstr "" -msgid "Insert a character string (as many characters as will fit on the line) before the character under the cursor. All characters to the right of the cursor are shifted right, with the rightmost characters on the line being lost. The cursor position does not change (after moving to *y*, *x*, if specified)." +#: ../../library/curses.rst:1129 +msgid "" +"Insert a character string (as many characters as will fit on the line) " +"before the character under the cursor. All characters to the right of the " +"cursor are shifted right, with the rightmost characters on the line being " +"lost. The cursor position does not change (after moving to *y*, *x*, if " +"specified)." msgstr "" -msgid "Return a bytes object of characters, extracted from the window starting at the current cursor position, or at *y*, *x* if specified. Attributes are stripped from the characters. If *n* is specified, :meth:`instr` returns a string at most *n* characters long (exclusive of the trailing NUL). The maximum value for *n* is 2047." +#: ../../library/curses.rst:1138 +msgid "" +"Return a bytes object of characters, extracted from the window starting at " +"the current cursor position, or at *y*, *x* if specified, and stopping at " +"the end of the line. Attributes and color information are stripped from the " +"characters. If *n* is specified, :meth:`instr` returns a string at most *n* " +"characters long (exclusive of the trailing NUL). The maximum value for *n* " +"is 2047." msgstr "" -msgid "Return ``True`` if the specified line was modified since the last call to :meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` exception if *line* is not valid for the given window." +#: ../../library/curses.rst:1151 +msgid "" +"Return ``True`` if the specified line was modified since the last call " +"to :meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " +"exception if *line* is not valid for the given window." msgstr "" -msgid "Return ``True`` if the specified window was modified since the last call to :meth:`refresh`; otherwise return ``False``." +#: ../../library/curses.rst:1158 +msgid "" +"Return ``True`` if the specified window was modified since the last call " +"to :meth:`refresh`; otherwise return ``False``." msgstr "" -msgid "If *flag* is ``True``, escape sequences generated by some keys (keypad, function keys) will be interpreted by :mod:`!curses`. If *flag* is ``False``, escape sequences will be left as is in the input stream." +#: ../../library/curses.rst:1164 +msgid "" +"If *flag* is ``True``, escape sequences generated by some keys (keypad, " +"function keys) will be interpreted by :mod:`!curses`. If *flag* is " +"``False``, escape sequences will be left as is in the input stream." msgstr "" -msgid "If *flag* is ``True``, cursor is left where it is on update, instead of being at \"cursor position.\" This reduces cursor movement where possible. If possible the cursor will be made invisible." +#: ../../library/curses.rst:1171 +msgid "" +"If *flag* is ``True``, cursor is left where it is on update, instead of " +"being at \"cursor position.\" This reduces cursor movement where possible." msgstr "" -msgid "If *flag* is ``False``, cursor will always be at \"cursor position\" after an update." +#: ../../library/curses.rst:1174 +msgid "" +"If *flag* is ``False``, cursor will always be at \"cursor position\" after " +"an update." msgstr "" +#: ../../library/curses.rst:1179 msgid "Move cursor to ``(new_y, new_x)``." msgstr "" -msgid "Move the window inside its parent window. The screen-relative parameters of the window are not changed. This routine is used to display different parts of the parent window at the same physical position on the screen." +#: ../../library/curses.rst:1184 +msgid "" +"Move the window inside its parent window. The screen-relative parameters of " +"the window are not changed. This routine is used to display different parts " +"of the parent window at the same physical position on the screen." msgstr "" +#: ../../library/curses.rst:1191 msgid "Move the window so its upper-left corner is at ``(new_y, new_x)``." msgstr "" +#: ../../library/curses.rst:1193 +msgid "" +"Moving the window so that any part of it would be off the screen is an " +"error: the window is not moved and :exc:`curses.error` is raised." +msgstr "" + +#: ../../library/curses.rst:1199 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." msgstr "" +#: ../../library/curses.rst:1204 msgid "If *flag* is ``True``, escape sequences will not be timed out." msgstr "" -msgid "If *flag* is ``False``, after a few milliseconds, an escape sequence will not be interpreted, and will be left in the input stream as is." +#: ../../library/curses.rst:1206 +msgid "" +"If *flag* is ``False``, after a few milliseconds, an escape sequence will " +"not be interpreted, and will be left in the input stream as is." msgstr "" -msgid "Mark for refresh but wait. This function updates the data structure representing the desired state of the window, but does not force an update of the physical screen. To accomplish that, call :func:`doupdate`." +#: ../../library/curses.rst:1213 +msgid "" +"Mark for refresh but wait. This function updates the data structure " +"representing the desired state of the window, but does not force an update " +"of the physical screen. To accomplish that, call :func:`doupdate`." msgstr "" -msgid "Overlay the window on top of *destwin*. The windows need not be the same size, only the overlapping region is copied. This copy is non-destructive, which means that the current background character does not overwrite the old contents of *destwin*." +#: ../../library/curses.rst:1217 +msgid "" +"The 6 arguments can only be specified, and are then required, when the " +"window is a pad created with :func:`newpad`; they have the same meaning as " +"for :meth:`refresh`." msgstr "" -msgid "To get fine-grained control over the copied region, the second form of :meth:`overlay` can be used. *sminrow* and *smincol* are the upper-left coordinates of the source window, and the other variables mark a rectangle in the destination window." +#: ../../library/curses.rst:1224 +msgid "" +"Overlay the window on top of *destwin*. The windows need not be the same " +"size, only the overlapping region is copied. This copy is non-destructive, " +"which means that the current background character does not overwrite the old " +"contents of *destwin*." msgstr "" -msgid "Overwrite the window on top of *destwin*. The windows need not be the same size, in which case only the overlapping region is copied. This copy is destructive, which means that the current background character overwrites the old contents of *destwin*." +#: ../../library/curses.rst:1229 +msgid "" +"To get fine-grained control over the copied region, the second form " +"of :meth:`overlay` can be used. *sminrow* and *smincol* are the upper-left " +"coordinates of the source window, and the other variables mark a rectangle " +"in the destination window." msgstr "" -msgid "To get fine-grained control over the copied region, the second form of :meth:`overwrite` can be used. *sminrow* and *smincol* are the upper-left coordinates of the source window, the other variables mark a rectangle in the destination window." +#: ../../library/curses.rst:1237 +msgid "" +"Overwrite the window on top of *destwin*. The windows need not be the same " +"size, in which case only the overlapping region is copied. This copy is " +"destructive, which means that the current background character overwrites " +"the old contents of *destwin*." msgstr "" -msgid "Write all data associated with the window into the provided file object. This information can be later retrieved using the :func:`getwin` function." +#: ../../library/curses.rst:1242 +msgid "" +"To get fine-grained control over the copied region, the second form " +"of :meth:`overwrite` can be used. *sminrow* and *smincol* are the upper-left " +"coordinates of the source window, the other variables mark a rectangle in " +"the destination window." msgstr "" -msgid "Indicate that the *num* screen lines, starting at line *beg*, are corrupted and should be completely redrawn on the next :meth:`refresh` call." +#: ../../library/curses.rst:1250 +msgid "" +"Write all data associated with the window into the provided file object. " +"This information can be later retrieved using the :func:`getwin` function." msgstr "" -msgid "Touch the entire window, causing it to be completely redrawn on the next :meth:`refresh` call." +#: ../../library/curses.rst:1256 +msgid "" +"Indicate that the *num* screen lines, starting at line *beg*, are corrupted " +"and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -msgid "Update the display immediately (sync actual screen with previous drawing/deleting methods)." +#: ../../library/curses.rst:1262 +msgid "" +"Touch the entire window, causing it to be completely redrawn on the " +"next :meth:`refresh` call." msgstr "" -msgid "The 6 optional arguments can only be specified when the window is a pad created with :func:`newpad`. The additional parameters are needed to indicate what part of the pad and screen are involved. *pminrow* and *pmincol* specify the upper left-hand corner of the rectangle to be displayed in the pad. *sminrow*, *smincol*, *smaxrow*, and *smaxcol* specify the edges of the rectangle to be displayed on the screen. The lower right-hand corner of the rectangle to be displayed in the pad is calculated from the screen coordinates, since the rectangles must be the same size. Both rectangles must be entirely contained within their respective structures. Negative values of *pminrow*, *pmincol*, *sminrow*, or *smincol* are treated as if they were zero." +#: ../../library/curses.rst:1268 +msgid "" +"Update the display immediately (sync actual screen with previous drawing/" +"deleting methods)." msgstr "" -msgid "Reallocate storage for a curses window to adjust its dimensions to the specified values. If either dimension is larger than the current values, the window's data is filled with blanks that have the current background rendition (as set by :meth:`bkgdset`) merged into them." +#: ../../library/curses.rst:1271 +msgid "" +"The 6 arguments can only be specified, and are then required, when the " +"window is a pad created with :func:`newpad`. The additional parameters are " +"needed to indicate what part of the pad and screen are involved. *pminrow* " +"and *pmincol* specify the upper-left corner of the rectangle to be displayed " +"in the pad. *sminrow*, *smincol*, *smaxrow*, and *smaxcol* specify the " +"edges of the rectangle to be displayed on the screen. The lower-right " +"corner of the rectangle to be displayed in the pad is calculated from the " +"screen coordinates, since the rectangles must be the same size. Both " +"rectangles must be entirely contained within their respective structures. " +"Negative values of *pminrow*, *pmincol*, *sminrow*, or *smincol* are treated " +"as if they were zero." +msgstr "" + +#: ../../library/curses.rst:1285 +msgid "" +"Reallocate storage for a curses window to adjust its dimensions to the " +"specified values. If either dimension is larger than the current values, " +"the window's data is filled with blanks that have the current background " +"rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" -msgid "Scroll the screen or scrolling region upward by *lines* lines." +#: ../../library/curses.rst:1293 +msgid "" +"Scroll the screen or scrolling region. Scroll upward by *lines* lines if " +"*lines* is positive, or downward if it is negative. Scrolling has no effect " +"unless it has been enabled for the window with :meth:`scrollok`." msgstr "" -msgid "Control what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last line. If *flag* is ``False``, the cursor is left on the bottom line. If *flag* is ``True``, the window is scrolled up one line. Note that in order to get the physical scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." +#: ../../library/curses.rst:1300 +msgid "" +"Control what happens when the cursor of a window is moved off the edge of " +"the window or scrolling region, either as a result of a newline action on " +"the bottom line, or typing the last character of the last line. If *flag* " +"is ``False``, the cursor is left on the bottom line. If *flag* is ``True``, " +"the window is scrolled up one line. Note that in order to get the physical " +"scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." msgstr "" -msgid "Set the scrolling region from line *top* to line *bottom*. All scrolling actions will take place in this region." +#: ../../library/curses.rst:1310 +msgid "" +"Set the scrolling region from line *top* to line *bottom*. All scrolling " +"actions will take place in this region." msgstr "" -msgid "Turn off the standout attribute. On some terminals this has the side effect of turning off all attributes." +#: ../../library/curses.rst:1316 +msgid "" +"Turn off the standout attribute. On some terminals this has the side effect " +"of turning off all attributes." msgstr "" +#: ../../library/curses.rst:1322 msgid "Turn on attribute *A_STANDOUT*." msgstr "" -msgid "Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, and whose width/height is *ncols*/*nlines*." +#: ../../library/curses.rst:1328 +msgid "" +"Return a sub-pad, whose upper-left corner is at ``(begin_y, begin_x)``, and " +"whose width/height is *ncols*/*nlines*. The coordinates are relative to the " +"parent pad (unlike :meth:`subwin`, which uses screen coordinates). This " +"method is only available for pads created with :func:`newpad`." msgstr "" -msgid "By default, the sub-window will extend from the specified position to the lower right corner of the window." +#: ../../library/curses.rst:1337 +msgid "" +"Return a sub-window, whose upper-left corner is at the screen-relative " +"coordinates ``(begin_y, begin_x)``, and whose width/height is *ncols*/" +"*nlines*." msgstr "" -msgid "Touch each location in the window that has been touched in any of its ancestor windows. This routine is called by :meth:`refresh`, so it should almost never be necessary to call it manually." +#: ../../library/curses.rst:1340 +msgid "" +"By default, the sub-window will extend from the specified position to the " +"lower right corner of the window." msgstr "" -msgid "If *flag* is ``True``, then :meth:`syncup` is called automatically whenever there is a change in the window." +#: ../../library/curses.rst:1346 +msgid "" +"Touch each location in the window that has been touched in any of its " +"ancestor windows. This routine is called by :meth:`refresh`, so it should " +"almost never be necessary to call it manually." msgstr "" -msgid "Touch all locations in ancestors of the window that have been changed in the window." +#: ../../library/curses.rst:1353 +msgid "" +"If *flag* is ``True``, then :meth:`syncup` is called automatically whenever " +"there is a change in the window." msgstr "" -msgid "Set blocking or non-blocking read behavior for the window. If *delay* is negative, blocking read is used (which will wait indefinitely for input). If *delay* is zero, then non-blocking read is used, and :meth:`getch` will return ``-1`` if no input is waiting. If *delay* is positive, then :meth:`getch` will block for *delay* milliseconds, and return ``-1`` if there is still no input at the end of that time." +#: ../../library/curses.rst:1359 +msgid "" +"Touch all locations in ancestors of the window that have been changed in " +"the window." msgstr "" -msgid "Pretend *count* lines have been changed, starting with line *start*. If *changed* is supplied, it specifies whether the affected lines are marked as having been changed (*changed*\\ ``=True``) or unchanged (*changed*\\ ``=False``)." +#: ../../library/curses.rst:1365 +msgid "" +"Set blocking or non-blocking read behavior for the window. If *delay* is " +"negative, blocking read is used (which will wait indefinitely for input). " +"If *delay* is zero, then non-blocking read is used, and :meth:`getch` will " +"return ``-1`` if no input is waiting. If *delay* is positive, " +"then :meth:`getch` will block for *delay* milliseconds, and return ``-1`` if " +"there is still no input at the end of that time." msgstr "" -msgid "Pretend the whole window has been changed, for purposes of drawing optimizations." +#: ../../library/curses.rst:1375 +msgid "" +"Pretend *count* lines have been changed, starting with line *start*. If " +"*changed* is supplied, it specifies whether the affected lines are marked as " +"having been changed (*changed*\\ ``=True``) or unchanged (*changed*\\ " +"``=False``)." msgstr "" -msgid "Mark all lines in the window as unchanged since the last call to :meth:`refresh`." +#: ../../library/curses.rst:1382 +msgid "" +"Pretend the whole window has been changed, for purposes of drawing " +"optimizations." +msgstr "" + +#: ../../library/curses.rst:1388 +msgid "" +"Mark all lines in the window as unchanged since the last call " +"to :meth:`refresh`." msgstr "" -msgid "Display a vertical line starting at ``(y, x)`` with length *n* consisting of the character *ch* with attributes *attr*." +#: ../../library/curses.rst:1395 +msgid "" +"Display a vertical line starting at ``(y, x)`` with length *n* consisting of " +"the character *ch* with attributes *attr*." msgstr "" +#: ../../library/curses.rst:1400 msgid "Constants" msgstr "" +#: ../../library/curses.rst:1402 msgid "The :mod:`!curses` module defines the following data members:" msgstr "" -msgid "Some curses routines that return an integer, such as :meth:`~window.getch`, return :const:`ERR` upon failure." +#: ../../library/curses.rst:1407 +msgid "" +"Some curses routines that return an integer, such " +"as :meth:`~window.getch`, return :const:`ERR` upon failure." msgstr "" -msgid "Some curses routines that return an integer, such as :func:`napms`, return :const:`OK` upon success." +#: ../../library/curses.rst:1413 +msgid "" +"Some curses routines that return an integer, such as :func:`napms`, " +"return :const:`OK` upon success." msgstr "" +#: ../../library/curses.rst:1419 msgid "A bytes object representing the current version of the module." msgstr "" -msgid "A named tuple containing the three components of the ncurses library version: *major*, *minor*, and *patch*. All values are integers. The components can also be accessed by name, so ``curses.ncurses_version[0]`` is equivalent to ``curses.ncurses_version.major`` and so on." +#: ../../library/curses.rst:1424 +msgid "" +"A named tuple containing the three components of the ncurses library " +"version: *major*, *minor*, and *patch*. All values are integers. The " +"components can also be accessed by name, so ``curses.ncurses_version[0]`` " +"is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" +#: ../../library/curses.rst:1429 msgid "Availability: if the ncurses library is used." msgstr "" -msgid "The maximum number of colors the terminal can support. It is defined only after the call to :func:`start_color`." +#: ../../library/curses.rst:1435 +msgid "" +"The maximum number of colors the terminal can support. It is defined only " +"after the call to :func:`start_color`." msgstr "" -msgid "The maximum number of color pairs the terminal can support. It is defined only after the call to :func:`start_color`." +#: ../../library/curses.rst:1440 +msgid "" +"The maximum number of color pairs the terminal can support. It is defined " +"only after the call to :func:`start_color`." msgstr "" -msgid "The width of the screen, i.e., the number of columns. It is defined only after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." +#: ../../library/curses.rst:1445 +msgid "" +"The width of the screen, that is, the number of columns. It is defined only " +"after the call to :func:`initscr`. Updated " +"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." msgstr "" -msgid "The height of the screen, i.e., the number of lines. It is defined only after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." +#: ../../library/curses.rst:1452 +msgid "" +"The height of the screen, that is, the number of lines. It is defined only " +"after the call to :func:`initscr`. Updated " +"by :func:`update_lines_cols`, :func:`resizeterm` and :func:`resize_term`." msgstr "" -msgid "Some constants are available to specify character cell attributes. The exact constants available are system dependent." +#: ../../library/curses.rst:1458 +msgid "" +"Some constants are available to specify character cell attributes. The exact " +"constants available are system dependent." msgstr "" +#: ../../library/curses.rst:1462 msgid "Attribute" msgstr "" +#: ../../library/curses.rst:1462 ../../library/curses.rst:1507 +#: ../../library/curses.rst:1753 ../../library/curses.rst:1845 msgid "Meaning" msgstr "" +#: ../../library/curses.rst:1464 msgid "Alternate character set mode" msgstr "" +#: ../../library/curses.rst:1466 msgid "Blink mode" msgstr "" +#: ../../library/curses.rst:1468 msgid "Bold mode" msgstr "" +#: ../../library/curses.rst:1470 msgid "Dim mode" msgstr "" +#: ../../library/curses.rst:1472 msgid "Invisible or blank mode" msgstr "" +#: ../../library/curses.rst:1474 msgid "Italic mode" msgstr "" +#: ../../library/curses.rst:1476 msgid "Normal attribute" msgstr "" +#: ../../library/curses.rst:1478 msgid "Protected mode" msgstr "" +#: ../../library/curses.rst:1480 msgid "Reverse background and foreground colors" msgstr "" +#: ../../library/curses.rst:1483 msgid "Standout mode" msgstr "" +#: ../../library/curses.rst:1485 msgid "Underline mode" msgstr "" +#: ../../library/curses.rst:1487 msgid "Horizontal highlight" msgstr "" +#: ../../library/curses.rst:1489 msgid "Left highlight" msgstr "" +#: ../../library/curses.rst:1491 msgid "Low highlight" msgstr "" +#: ../../library/curses.rst:1493 msgid "Right highlight" msgstr "" +#: ../../library/curses.rst:1495 msgid "Top highlight" msgstr "" +#: ../../library/curses.rst:1497 msgid "Vertical highlight" msgstr "" +#: ../../library/curses.rst:1500 msgid "``A_ITALIC`` was added." msgstr "" -msgid "Several constants are available to extract corresponding attributes returned by some methods." +#: ../../library/curses.rst:1503 +msgid "" +"Several constants are available to extract corresponding attributes returned " +"by some methods." msgstr "" +#: ../../library/curses.rst:1507 msgid "Bit-mask" msgstr "" +#: ../../library/curses.rst:1509 msgid "Bit-mask to extract attributes" msgstr "" +#: ../../library/curses.rst:1512 msgid "Bit-mask to extract a character" msgstr "" +#: ../../library/curses.rst:1515 msgid "Bit-mask to extract color-pair field information" msgstr "" -msgid "Keys are referred to by integer constants with names starting with ``KEY_``. The exact keycaps available are system dependent." +#: ../../library/curses.rst:1519 +msgid "" +"Keys are referred to by integer constants with names starting with " +"``KEY_``. The exact keycaps available are system dependent." msgstr "" +#: ../../library/curses.rst:1525 msgid "Key constant" msgstr "" +#: ../../library/curses.rst:1525 msgid "Key" msgstr "" +#: ../../library/curses.rst:1527 msgid "Minimum key value" msgstr "" +#: ../../library/curses.rst:1529 msgid "Break key (unreliable)" msgstr "" +#: ../../library/curses.rst:1531 msgid "Down-arrow" msgstr "" +#: ../../library/curses.rst:1533 msgid "Up-arrow" msgstr "" +#: ../../library/curses.rst:1535 msgid "Left-arrow" msgstr "" +#: ../../library/curses.rst:1537 msgid "Right-arrow" msgstr "" +#: ../../library/curses.rst:1539 msgid "Home key (upward+left arrow)" msgstr "" +#: ../../library/curses.rst:1541 msgid "Backspace (unreliable)" msgstr "" +#: ../../library/curses.rst:1543 msgid "Function keys. Up to 64 function keys are supported." msgstr "" +#: ../../library/curses.rst:1546 msgid "Value of function key *n*" msgstr "" +#: ../../library/curses.rst:1548 msgid "Delete line" msgstr "" +#: ../../library/curses.rst:1550 msgid "Insert line" msgstr "" +#: ../../library/curses.rst:1552 msgid "Delete character" msgstr "" +#: ../../library/curses.rst:1554 msgid "Insert char or enter insert mode" msgstr "" +#: ../../library/curses.rst:1556 msgid "Exit insert char mode" msgstr "" +#: ../../library/curses.rst:1558 msgid "Clear screen" msgstr "" +#: ../../library/curses.rst:1560 msgid "Clear to end of screen" msgstr "" +#: ../../library/curses.rst:1562 msgid "Clear to end of line" msgstr "" +#: ../../library/curses.rst:1564 msgid "Scroll 1 line forward" msgstr "" +#: ../../library/curses.rst:1566 msgid "Scroll 1 line backward (reverse)" msgstr "" +#: ../../library/curses.rst:1568 msgid "Next page" msgstr "" +#: ../../library/curses.rst:1570 msgid "Previous page" msgstr "" +#: ../../library/curses.rst:1572 msgid "Set tab" msgstr "" +#: ../../library/curses.rst:1574 msgid "Clear tab" msgstr "" +#: ../../library/curses.rst:1576 msgid "Clear all tabs" msgstr "" +#: ../../library/curses.rst:1578 msgid "Enter or send (unreliable)" msgstr "" +#: ../../library/curses.rst:1580 msgid "Soft (partial) reset (unreliable)" msgstr "" +#: ../../library/curses.rst:1582 msgid "Reset or hard reset (unreliable)" msgstr "" +#: ../../library/curses.rst:1584 msgid "Print" msgstr "" +#: ../../library/curses.rst:1586 msgid "Home down or bottom (lower left)" msgstr "" +#: ../../library/curses.rst:1588 msgid "Upper left of keypad" msgstr "" +#: ../../library/curses.rst:1590 msgid "Upper right of keypad" msgstr "" +#: ../../library/curses.rst:1592 msgid "Center of keypad" msgstr "" +#: ../../library/curses.rst:1594 msgid "Lower left of keypad" msgstr "" +#: ../../library/curses.rst:1596 msgid "Lower right of keypad" msgstr "" +#: ../../library/curses.rst:1598 msgid "Back tab" msgstr "" +#: ../../library/curses.rst:1600 msgid "Beg (beginning)" msgstr "" +#: ../../library/curses.rst:1602 msgid "Cancel" msgstr "" +#: ../../library/curses.rst:1604 msgid "Close" msgstr "" +#: ../../library/curses.rst:1606 msgid "Cmd (command)" msgstr "" +#: ../../library/curses.rst:1608 msgid "Copy" msgstr "" +#: ../../library/curses.rst:1610 msgid "Create" msgstr "" +#: ../../library/curses.rst:1612 msgid "End" msgstr "" +#: ../../library/curses.rst:1614 msgid "Exit" msgstr "" +#: ../../library/curses.rst:1616 msgid "Find" msgstr "" +#: ../../library/curses.rst:1618 msgid "Help" msgstr "" +#: ../../library/curses.rst:1620 msgid "Mark" msgstr "" +#: ../../library/curses.rst:1622 msgid "Message" msgstr "" +#: ../../library/curses.rst:1624 msgid "Move" msgstr "" +#: ../../library/curses.rst:1626 msgid "Next" msgstr "" +#: ../../library/curses.rst:1628 msgid "Open" msgstr "" +#: ../../library/curses.rst:1630 msgid "Options" msgstr "" +#: ../../library/curses.rst:1632 msgid "Prev (previous)" msgstr "" +#: ../../library/curses.rst:1634 msgid "Redo" msgstr "" +#: ../../library/curses.rst:1636 msgid "Ref (reference)" msgstr "" +#: ../../library/curses.rst:1638 msgid "Refresh" msgstr "" +#: ../../library/curses.rst:1640 msgid "Replace" msgstr "" +#: ../../library/curses.rst:1642 msgid "Restart" msgstr "" +#: ../../library/curses.rst:1644 msgid "Resume" msgstr "" +#: ../../library/curses.rst:1646 msgid "Save" msgstr "" +#: ../../library/curses.rst:1648 msgid "Shifted Beg (beginning)" msgstr "" +#: ../../library/curses.rst:1650 msgid "Shifted Cancel" msgstr "" +#: ../../library/curses.rst:1652 msgid "Shifted Command" msgstr "" +#: ../../library/curses.rst:1654 msgid "Shifted Copy" msgstr "" +#: ../../library/curses.rst:1656 msgid "Shifted Create" msgstr "" +#: ../../library/curses.rst:1658 msgid "Shifted Delete char" msgstr "" +#: ../../library/curses.rst:1660 msgid "Shifted Delete line" msgstr "" +#: ../../library/curses.rst:1662 msgid "Select" msgstr "" +#: ../../library/curses.rst:1664 msgid "Shifted End" msgstr "" +#: ../../library/curses.rst:1666 msgid "Shifted Clear line" msgstr "" +#: ../../library/curses.rst:1668 msgid "Shifted Exit" msgstr "" +#: ../../library/curses.rst:1670 msgid "Shifted Find" msgstr "" +#: ../../library/curses.rst:1672 msgid "Shifted Help" msgstr "" +#: ../../library/curses.rst:1674 msgid "Shifted Home" msgstr "" +#: ../../library/curses.rst:1676 msgid "Shifted Input" msgstr "" +#: ../../library/curses.rst:1678 msgid "Shifted Left arrow" msgstr "" +#: ../../library/curses.rst:1680 msgid "Shifted Message" msgstr "" +#: ../../library/curses.rst:1682 msgid "Shifted Move" msgstr "" +#: ../../library/curses.rst:1684 msgid "Shifted Next" msgstr "" +#: ../../library/curses.rst:1686 msgid "Shifted Options" msgstr "" +#: ../../library/curses.rst:1688 msgid "Shifted Prev" msgstr "" +#: ../../library/curses.rst:1690 msgid "Shifted Print" msgstr "" +#: ../../library/curses.rst:1692 msgid "Shifted Redo" msgstr "" +#: ../../library/curses.rst:1694 msgid "Shifted Replace" msgstr "" +#: ../../library/curses.rst:1696 msgid "Shifted Right arrow" msgstr "" +#: ../../library/curses.rst:1698 msgid "Shifted Resume" msgstr "" +#: ../../library/curses.rst:1700 msgid "Shifted Save" msgstr "" +#: ../../library/curses.rst:1702 msgid "Shifted Suspend" msgstr "" +#: ../../library/curses.rst:1704 msgid "Shifted Undo" msgstr "" +#: ../../library/curses.rst:1706 msgid "Suspend" msgstr "" +#: ../../library/curses.rst:1708 msgid "Undo" msgstr "" +#: ../../library/curses.rst:1710 msgid "Mouse event has occurred" msgstr "" +#: ../../library/curses.rst:1712 msgid "Terminal resize event" msgstr "" +#: ../../library/curses.rst:1714 msgid "Maximum key value" msgstr "" -msgid "On VT100s and their software emulations, such as X terminal emulators, there are normally at least four function keys (:const:`KEY_F1 `, :const:`KEY_F2 `, :const:`KEY_F3 `, :const:`KEY_F4 `) available, and the arrow keys mapped to :const:`KEY_UP`, :const:`KEY_DOWN`, :const:`KEY_LEFT` and :const:`KEY_RIGHT` in the obvious way. If your machine has a PC keyboard, it is safe to expect arrow keys and twelve function keys (older PC keyboards may have only ten function keys); also, the following keypad mappings are standard:" -msgstr "" - +#: ../../library/curses.rst:1717 +msgid "" +"On VT100s and their software emulations, such as X terminal emulators, there " +"are normally at least four function keys (:const:`KEY_F1 " +"`, :const:`KEY_F2 `, :const:`KEY_F3 " +"`, :const:`KEY_F4 `) available, and the arrow keys mapped " +"to :const:`KEY_UP`, :const:`KEY_DOWN`, :const:`KEY_LEFT` " +"and :const:`KEY_RIGHT` in the obvious way. If your machine has a PC " +"keyboard, it is safe to expect arrow keys and twelve function keys (older PC " +"keyboards may have only ten function keys); also, the following keypad " +"mappings are standard:" +msgstr "" + +#: ../../library/curses.rst:1726 msgid "Keycap" msgstr "" +#: ../../library/curses.rst:1726 ../../library/curses.rst:1871 +#: ../../library/curses.rst:2000 msgid "Constant" msgstr "" +#: ../../library/curses.rst:1728 msgid ":kbd:`Insert`" msgstr "" +#: ../../library/curses.rst:1728 msgid "KEY_IC" msgstr "" +#: ../../library/curses.rst:1730 msgid ":kbd:`Delete`" msgstr "" +#: ../../library/curses.rst:1730 msgid "KEY_DC" msgstr "" +#: ../../library/curses.rst:1732 msgid ":kbd:`Home`" msgstr "" +#: ../../library/curses.rst:1732 msgid "KEY_HOME" msgstr "" +#: ../../library/curses.rst:1734 msgid ":kbd:`End`" msgstr "" +#: ../../library/curses.rst:1734 msgid "KEY_END" msgstr "" +#: ../../library/curses.rst:1736 msgid ":kbd:`Page Up`" msgstr "" +#: ../../library/curses.rst:1736 msgid "KEY_PPAGE" msgstr "" +#: ../../library/curses.rst:1738 msgid ":kbd:`Page Down`" msgstr "" +#: ../../library/curses.rst:1738 msgid "KEY_NPAGE" msgstr "" -msgid "The following table lists characters from the alternate character set. These are inherited from the VT100 terminal, and will generally be available on software emulations such as X terminals. When there is no graphic available, curses falls back on a crude printable ASCII approximation." +#: ../../library/curses.rst:1743 +msgid "" +"The following table lists characters from the alternate character set. These " +"are inherited from the VT100 terminal, and will generally be available on " +"software emulations such as X terminals. When there is no graphic " +"available, curses falls back on a crude printable ASCII approximation." msgstr "" +#: ../../library/curses.rst:1750 msgid "These are available only after :func:`initscr` has been called." msgstr "" +#: ../../library/curses.rst:1753 msgid "ACS code" msgstr "" -msgid "alternate name for upper right corner" +#: ../../library/curses.rst:1755 +msgid "alternate name for upper-right corner" msgstr "" +#: ../../library/curses.rst:1757 msgid "solid square block" msgstr "" +#: ../../library/curses.rst:1759 msgid "board of squares" msgstr "" +#: ../../library/curses.rst:1761 msgid "alternate name for horizontal line" msgstr "" -msgid "alternate name for upper left corner" +#: ../../library/curses.rst:1763 +msgid "alternate name for upper-left corner" msgstr "" +#: ../../library/curses.rst:1765 msgid "alternate name for top tee" msgstr "" +#: ../../library/curses.rst:1767 msgid "bottom tee" msgstr "" +#: ../../library/curses.rst:1769 msgid "bullet" msgstr "" +#: ../../library/curses.rst:1771 msgid "checker board (stipple)" msgstr "" +#: ../../library/curses.rst:1773 msgid "arrow pointing down" msgstr "" +#: ../../library/curses.rst:1775 msgid "degree symbol" msgstr "" +#: ../../library/curses.rst:1777 msgid "diamond" msgstr "" +#: ../../library/curses.rst:1779 msgid "greater-than-or-equal-to" msgstr "" +#: ../../library/curses.rst:1781 msgid "horizontal line" msgstr "" +#: ../../library/curses.rst:1783 msgid "lantern symbol" msgstr "" +#: ../../library/curses.rst:1785 msgid "left arrow" msgstr "" +#: ../../library/curses.rst:1787 msgid "less-than-or-equal-to" msgstr "" -msgid "lower left-hand corner" +#: ../../library/curses.rst:1789 +msgid "lower-left corner" msgstr "" -msgid "lower right-hand corner" +#: ../../library/curses.rst:1791 +msgid "lower-right corner" msgstr "" +#: ../../library/curses.rst:1793 msgid "left tee" msgstr "" +#: ../../library/curses.rst:1795 msgid "not-equal sign" msgstr "" +#: ../../library/curses.rst:1797 msgid "letter pi" msgstr "" +#: ../../library/curses.rst:1799 msgid "plus-or-minus sign" msgstr "" +#: ../../library/curses.rst:1801 msgid "big plus sign" msgstr "" +#: ../../library/curses.rst:1803 msgid "right arrow" msgstr "" +#: ../../library/curses.rst:1805 msgid "right tee" msgstr "" +#: ../../library/curses.rst:1807 msgid "scan line 1" msgstr "" +#: ../../library/curses.rst:1809 msgid "scan line 3" msgstr "" +#: ../../library/curses.rst:1811 msgid "scan line 7" msgstr "" +#: ../../library/curses.rst:1813 msgid "scan line 9" msgstr "" -msgid "alternate name for lower right corner" +#: ../../library/curses.rst:1815 +msgid "alternate name for lower-right corner" msgstr "" +#: ../../library/curses.rst:1817 msgid "alternate name for vertical line" msgstr "" +#: ../../library/curses.rst:1819 msgid "alternate name for right tee" msgstr "" -msgid "alternate name for lower left corner" +#: ../../library/curses.rst:1821 +msgid "alternate name for lower-left corner" msgstr "" +#: ../../library/curses.rst:1823 msgid "alternate name for bottom tee" msgstr "" +#: ../../library/curses.rst:1825 msgid "alternate name for left tee" msgstr "" +#: ../../library/curses.rst:1827 msgid "alternate name for crossover or big plus" msgstr "" +#: ../../library/curses.rst:1829 msgid "pound sterling" msgstr "" +#: ../../library/curses.rst:1831 msgid "top tee" msgstr "" +#: ../../library/curses.rst:1833 msgid "up arrow" msgstr "" -msgid "upper left corner" +#: ../../library/curses.rst:1835 +msgid "upper-left corner" msgstr "" -msgid "upper right corner" +#: ../../library/curses.rst:1837 +msgid "upper-right corner" msgstr "" +#: ../../library/curses.rst:1839 msgid "vertical line" msgstr "" -msgid "The following table lists mouse button constants used by :meth:`getmouse`:" +#: ../../library/curses.rst:1842 +msgid "" +"The following table lists mouse button constants used by :meth:`getmouse`:" msgstr "" +#: ../../library/curses.rst:1845 msgid "Mouse button constant" msgstr "" +#: ../../library/curses.rst:1847 msgid "Mouse button *n* pressed" msgstr "" +#: ../../library/curses.rst:1849 msgid "Mouse button *n* released" msgstr "" +#: ../../library/curses.rst:1851 msgid "Mouse button *n* clicked" msgstr "" +#: ../../library/curses.rst:1853 msgid "Mouse button *n* double clicked" msgstr "" +#: ../../library/curses.rst:1855 msgid "Mouse button *n* triple clicked" msgstr "" +#: ../../library/curses.rst:1857 msgid "Shift was down during button state change" msgstr "" +#: ../../library/curses.rst:1859 msgid "Control was down during button state change" msgstr "" +#: ../../library/curses.rst:1861 +msgid "Alt was down during button state change" +msgstr "" + +#: ../../library/curses.rst:1868 msgid "The following table lists the predefined colors:" msgstr "" +#: ../../library/curses.rst:1871 msgid "Color" msgstr "" +#: ../../library/curses.rst:1873 msgid "Black" msgstr "" +#: ../../library/curses.rst:1875 msgid "Blue" msgstr "" +#: ../../library/curses.rst:1877 msgid "Cyan (light greenish blue)" msgstr "" +#: ../../library/curses.rst:1879 msgid "Green" msgstr "" +#: ../../library/curses.rst:1881 msgid "Magenta (purplish red)" msgstr "" +#: ../../library/curses.rst:1883 msgid "Red" msgstr "" +#: ../../library/curses.rst:1885 msgid "White" msgstr "" +#: ../../library/curses.rst:1887 msgid "Yellow" msgstr "" +#: ../../library/curses.rst:1892 msgid ":mod:`!curses.textpad` --- Text input widget for curses programs" msgstr "" -msgid "The :mod:`!curses.textpad` module provides a :class:`Textbox` class that handles elementary text editing in a curses window, supporting a set of keybindings resembling those of Emacs (thus, also of Netscape Navigator, BBedit 6.x, FrameMaker, and many other programs). The module also provides a rectangle-drawing function useful for framing text boxes or for other purposes." +#: ../../library/curses.rst:1900 +msgid "" +"The :mod:`!curses.textpad` module provides a :class:`Textbox` class that " +"handles elementary text editing in a curses window, supporting a set of " +"keybindings resembling those of Emacs (thus, also of Netscape Navigator, " +"BBedit 6.x, FrameMaker, and many other programs). The module also provides " +"a rectangle-drawing function useful for framing text boxes or for other " +"purposes." msgstr "" +#: ../../library/curses.rst:1906 msgid "The module :mod:`!curses.textpad` defines the following function:" msgstr "" -msgid "Draw a rectangle. The first argument must be a window object; the remaining arguments are coordinates relative to that window. The second and third arguments are the y and x coordinates of the upper left hand corner of the rectangle to be drawn; the fourth and fifth arguments are the y and x coordinates of the lower right hand corner. The rectangle will be drawn using VT100/IBM PC forms characters on terminals that make this possible (including xterm and most other software terminal emulators). Otherwise it will be drawn with ASCII dashes, vertical bars, and plus signs." +#: ../../library/curses.rst:1911 +msgid "" +"Draw a rectangle. The first argument must be a window object; the remaining " +"arguments are coordinates relative to that window. The second and third " +"arguments are the y and x coordinates of the upper-left corner of the " +"rectangle to be drawn; the fourth and fifth arguments are the y and x " +"coordinates of the lower-right corner. The rectangle will be drawn using " +"VT100/IBM PC forms characters on terminals that make this possible " +"(including xterm and most other software terminal emulators). Otherwise it " +"will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" +#: ../../library/curses.rst:1924 msgid "Textbox objects" msgstr "" +#: ../../library/curses.rst:1926 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -msgid "Return a textbox widget object. The *win* argument should be a curses :ref:`window ` object in which the textbox is to be contained. The edit cursor of the textbox is initially located at the upper left hand corner of the containing window, with coordinates ``(0, 0)``. The instance's :attr:`stripspaces` flag is initially on." +#: ../../library/curses.rst:1931 +msgid "" +"Return a textbox widget object. The *win* argument should be a " +"curses :ref:`window ` object in which the textbox is " +"to be contained. If *insert_mode* is true, the textbox inserts typed " +"characters, shifting existing text to the right, rather than overwriting it. " +"The edit cursor of the textbox is initially located at the upper-left corner " +"of the containing window, with coordinates ``(0, 0)``. The " +"instance's :attr:`stripspaces` flag is initially on." msgstr "" +#: ../../library/curses.rst:1939 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -msgid "This is the entry point you will normally use. It accepts editing keystrokes until one of the termination keystrokes is entered. If *validator* is supplied, it must be a function. It will be called for each keystroke entered with the keystroke as a parameter; command dispatch is done on the result. This method returns the window contents as a string; whether blanks in the window are included is affected by the :attr:`stripspaces` attribute." +#: ../../library/curses.rst:1944 +msgid "" +"This is the entry point you will normally use. It accepts editing " +"keystrokes until one of the termination keystrokes is entered. If " +"*validate* is supplied, it must be a function. It will be called for each " +"keystroke entered with the keystroke as a parameter; command dispatch is " +"done on the result. If it returns a false value, the keystroke is ignored. " +"This method returns the window contents as a string; whether blanks in the " +"window are included is affected by the :attr:`stripspaces` attribute." msgstr "" -msgid "Process a single command keystroke. Here are the supported special keystrokes:" +#: ../../library/curses.rst:1956 +msgid "" +"Process a single command keystroke. Returns ``1`` to continue editing, or " +"``0`` if a termination keystroke was processed. Here are the supported " +"special keystrokes:" msgstr "" +#: ../../library/curses.rst:1961 ../../library/curses.rst:2000 msgid "Keystroke" msgstr "" +#: ../../library/curses.rst:1961 msgid "Action" msgstr "" +#: ../../library/curses.rst:1963 msgid ":kbd:`Control-A`" msgstr "" +#: ../../library/curses.rst:1963 msgid "Go to left edge of window." msgstr "" +#: ../../library/curses.rst:1965 ../../library/curses.rst:2002 msgid ":kbd:`Control-B`" msgstr "" +#: ../../library/curses.rst:1965 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" +#: ../../library/curses.rst:1968 msgid ":kbd:`Control-D`" msgstr "" +#: ../../library/curses.rst:1968 msgid "Delete character under cursor." msgstr "" +#: ../../library/curses.rst:1970 msgid ":kbd:`Control-E`" msgstr "" +#: ../../library/curses.rst:1970 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" +#: ../../library/curses.rst:1973 ../../library/curses.rst:2004 msgid ":kbd:`Control-F`" msgstr "" +#: ../../library/curses.rst:1973 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" +#: ../../library/curses.rst:1976 msgid ":kbd:`Control-G`" msgstr "" +#: ../../library/curses.rst:1976 msgid "Terminate, returning the window contents." msgstr "" +#: ../../library/curses.rst:1978 msgid ":kbd:`Control-H`" msgstr "" +#: ../../library/curses.rst:1978 msgid "Delete character backward." msgstr "" +#: ../../library/curses.rst:1980 msgid ":kbd:`Control-J`" msgstr "" -msgid "Terminate if the window is 1 line, otherwise insert newline." +#: ../../library/curses.rst:1980 +msgid "" +"Terminate if the window is 1 line, otherwise move to the start of the next " +"line." msgstr "" +#: ../../library/curses.rst:1984 msgid ":kbd:`Control-K`" msgstr "" +#: ../../library/curses.rst:1984 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" +#: ../../library/curses.rst:1987 msgid ":kbd:`Control-L`" msgstr "" +#: ../../library/curses.rst:1987 msgid "Refresh screen." msgstr "" +#: ../../library/curses.rst:1989 ../../library/curses.rst:2008 msgid ":kbd:`Control-N`" msgstr "" +#: ../../library/curses.rst:1989 msgid "Cursor down; move down one line." msgstr "" +#: ../../library/curses.rst:1991 msgid ":kbd:`Control-O`" msgstr "" +#: ../../library/curses.rst:1991 msgid "Insert a blank line at cursor location." msgstr "" +#: ../../library/curses.rst:1993 ../../library/curses.rst:2006 msgid ":kbd:`Control-P`" msgstr "" +#: ../../library/curses.rst:1993 msgid "Cursor up; move up one line." msgstr "" -msgid "Move operations do nothing if the cursor is at an edge where the movement is not possible. The following synonyms are supported where possible:" +#: ../../library/curses.rst:1996 +msgid "" +"Move operations do nothing if the cursor is at an edge where the movement is " +"not possible. The following synonyms are supported where possible:" msgstr "" +#: ../../library/curses.rst:2002 msgid ":const:`~curses.KEY_LEFT`" msgstr "" +#: ../../library/curses.rst:2004 msgid ":const:`~curses.KEY_RIGHT`" msgstr "" +#: ../../library/curses.rst:2006 msgid ":const:`~curses.KEY_UP`" msgstr "" +#: ../../library/curses.rst:2008 msgid ":const:`~curses.KEY_DOWN`" msgstr "" +#: ../../library/curses.rst:2010 msgid ":const:`~curses.KEY_BACKSPACE`" msgstr "" +#: ../../library/curses.rst:2010 msgid ":kbd:`Control-h`" msgstr "" -msgid "All other keystrokes are treated as a command to insert the given character and move right (with line wrapping)." +#: ../../library/curses.rst:2013 +msgid "" +"All other keystrokes are treated as a command to insert the given character " +"and move right (with line wrapping)." msgstr "" -msgid "Return the window contents as a string; whether blanks in the window are included is affected by the :attr:`stripspaces` member." +#: ../../library/curses.rst:2019 +msgid "" +"Return the window contents as a string; whether blanks in the window are " +"included is affected by the :attr:`stripspaces` member." msgstr "" -msgid "This attribute is a flag which controls the interpretation of blanks in the window. When it is on, trailing blanks on each line are ignored; any cursor motion that would land the cursor on a trailing blank goes to the end of that line instead, and trailing blanks are stripped when the window contents are gathered." +#: ../../library/curses.rst:2025 +msgid "" +"This attribute is a flag which controls the interpretation of blanks in the " +"window. When it is on, trailing blanks on each line are ignored; any cursor " +"motion that would land the cursor on a trailing blank goes to the end of " +"that line instead, and trailing blanks are stripped when the window contents " +"are gathered." msgstr "" diff --git a/library/custominterp.po b/library/custominterp.po index de4ca0a4a..a1ffb37f7 100644 --- a/library/custominterp.po +++ b/library/custominterp.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/custominterp.rst:5 msgid "Custom Python Interpreters" msgstr "" -msgid "The modules described in this chapter allow writing interfaces similar to Python's interactive interpreter. If you want a Python interpreter that supports some special feature in addition to the Python language, you should look at the :mod:`code` module. (The :mod:`codeop` module is lower-level, used to support compiling a possibly incomplete chunk of Python code.)" +#: ../../library/custominterp.rst:7 +msgid "" +"The modules described in this chapter allow writing interfaces similar to " +"Python's interactive interpreter. If you want a Python interpreter that " +"supports some special feature in addition to the Python language, you should " +"look at the :mod:`code` module. (The :mod:`codeop` module is lower-level, " +"used to support compiling a possibly incomplete chunk of Python code.)" msgstr "" +#: ../../library/custominterp.rst:13 msgid "The full list of modules described in this chapter is:" msgstr "" diff --git a/library/dataclasses.po b/library/dataclasses.po index 338b64fe2..dc11a3b18 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:03+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,18 +23,29 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/dataclasses.rst:2 msgid ":mod:`!dataclasses` --- Data Classes" msgstr "" +#: ../../library/dataclasses.rst:10 msgid "**Source code:** :source:`Lib/dataclasses.py`" msgstr "" -msgid "This module provides a decorator and functions for automatically adding generated :term:`special methods ` such as :meth:`~object.__init__` and :meth:`~object.__repr__` to user-defined classes. It was originally described in :pep:`557`." +#: ../../library/dataclasses.rst:14 +msgid "" +"This module provides a decorator and functions for automatically adding " +"generated :term:`special methods ` such " +"as :meth:`~object.__init__` and :meth:`~object.__repr__` to user-defined " +"classes. It was originally described in :pep:`557`." msgstr "" -msgid "The member variables to use in these generated methods are defined using :pep:`526` type annotations. For example, this code::" +#: ../../library/dataclasses.rst:19 +msgid "" +"The member variables to use in these generated methods are defined " +"using :pep:`526` type annotations. For example, this code::" msgstr "" +#: ../../library/dataclasses.rst:22 msgid "" "from dataclasses import dataclass\n" "\n" @@ -49,37 +60,67 @@ msgid "" " return self.unit_price * self.quantity_on_hand" msgstr "" +#: ../../library/dataclasses.rst:34 msgid "will add, among other things, a :meth:`!__init__` that looks like::" msgstr "" +#: ../../library/dataclasses.rst:36 msgid "" -"def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):\n" +"def __init__(self, name: str, unit_price: float, quantity_on_hand: int = " +"0):\n" " self.name = name\n" " self.unit_price = unit_price\n" " self.quantity_on_hand = quantity_on_hand" msgstr "" -msgid "Note that this method is automatically added to the class: it is not directly specified in the :class:`!InventoryItem` definition shown above." +#: ../../library/dataclasses.rst:41 +msgid "" +"Note that this method is automatically added to the class: it is not " +"directly specified in the :class:`!InventoryItem` definition shown above." msgstr "" +#: ../../library/dataclasses.rst:47 msgid "Module contents" msgstr "" -msgid "This function is a :term:`decorator` that is used to add generated :term:`special methods ` to classes, as described below." +#: ../../library/dataclasses.rst:51 +msgid "" +"This function is a :term:`decorator` that is used to add " +"generated :term:`special methods ` to classes, as described " +"below." msgstr "" -msgid "The ``@dataclass`` decorator examines the class to find ``field``\\s. A ``field`` is defined as a class variable that has a :term:`type annotation `. With two exceptions described below, nothing in ``@dataclass`` examines the type specified in the variable annotation." +#: ../../library/dataclasses.rst:54 +msgid "" +"The ``@dataclass`` decorator examines the class to find ``field``\\s. A " +"``field`` is defined as a class variable that has a :term:`type annotation " +"`. With two exceptions described below, nothing in " +"``@dataclass`` examines the type specified in the variable annotation." msgstr "" -msgid "The order of the fields in all of the generated methods is the order in which they appear in the class definition." +#: ../../library/dataclasses.rst:60 +msgid "" +"The order of the fields in all of the generated methods is the order in " +"which they appear in the class definition." msgstr "" -msgid "The ``@dataclass`` decorator will add various \"dunder\" methods to the class, described below. If any of the added methods already exist in the class, the behavior depends on the parameter, as documented below. The decorator returns the same class that it is called on; no new class is created." +#: ../../library/dataclasses.rst:63 +msgid "" +"The ``@dataclass`` decorator will add various \"dunder\" methods to the " +"class, described below. If any of the added methods already exist in the " +"class, the behavior depends on the parameter, as documented below. The " +"decorator returns the same class that it is called on; no new class is " +"created." msgstr "" -msgid "If ``@dataclass`` is used just as a simple decorator with no parameters, it acts as if it has the default values documented in this signature. That is, these three uses of ``@dataclass`` are equivalent::" +#: ../../library/dataclasses.rst:69 +msgid "" +"If ``@dataclass`` is used just as a simple decorator with no parameters, it " +"acts as if it has the default values documented in this signature. That is, " +"these three uses of ``@dataclass`` are equivalent::" msgstr "" +#: ../../library/dataclasses.rst:74 msgid "" "@dataclass\n" "class C:\n" @@ -89,87 +130,232 @@ msgid "" "class C:\n" " ...\n" "\n" -"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False,\n" +"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, " +"frozen=False,\n" " match_args=True, kw_only=False, slots=False, weakref_slot=False)\n" "class C:\n" " ..." msgstr "" +#: ../../library/dataclasses.rst:87 msgid "The parameters to ``@dataclass`` are:" msgstr "" -msgid "*init*: If true (the default), a :meth:`~object.__init__` method will be generated." +#: ../../library/dataclasses.rst:89 +msgid "" +"*init*: If true (the default), a :meth:`~object.__init__` method will be " +"generated." msgstr "" -msgid "If the class already defines :meth:`!__init__`, this parameter is ignored." +#: ../../library/dataclasses.rst:92 +msgid "" +"If the class already defines :meth:`!__init__`, this parameter is ignored." msgstr "" -msgid "*repr*: If true (the default), a :meth:`~object.__repr__` method will be generated. The generated repr string will have the class name and the name and repr of each field, in the order they are defined in the class. Fields that are marked as being excluded from the repr are not included. For example: ``InventoryItem(name='widget', unit_price=3.0, quantity_on_hand=10)``." +#: ../../library/dataclasses.rst:95 +msgid "" +"*repr*: If true (the default), a :meth:`~object.__repr__` method will be " +"generated. The generated repr string will have the class name and the name " +"and repr of each field, in the order they are defined in the class. Fields " +"that are marked as being excluded from the repr are not included. For " +"example: ``InventoryItem(name='widget', unit_price=3.0, " +"quantity_on_hand=10)``." msgstr "" -msgid "If the class already defines :meth:`!__repr__`, this parameter is ignored." +#: ../../library/dataclasses.rst:102 +msgid "" +"If the class already defines :meth:`!__repr__`, this parameter is ignored." +msgstr "" + +#: ../../library/dataclasses.rst:105 +msgid "" +"*eq*: If true (the default), an :meth:`~object.__eq__` method will be " +"generated." msgstr "" -msgid "*eq*: If true (the default), an :meth:`~object.__eq__` method will be generated. This method compares the class as if it were a tuple of its fields, in order. Both instances in the comparison must be of the identical type." +#: ../../library/dataclasses.rst:108 +msgid "" +"This method compares the class by comparing each field in order. Both " +"instances in the comparison must be of the identical type." msgstr "" -msgid "If the class already defines :meth:`!__eq__`, this parameter is ignored." +#: ../../library/dataclasses.rst:111 +msgid "" +"If the class already defines :meth:`!__eq__`, this parameter is ignored." msgstr "" -msgid "*order*: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods will be generated. These compare the class as if it were a tuple of its fields, in order. Both instances in the comparison must be of the identical type. If *order* is true and *eq* is false, a :exc:`ValueError` is raised." +#: ../../library/dataclasses.rst:113 +msgid "" +"The generated ``__eq__`` method now compares each field individually (for " +"example, ``self.a == other.a and self.b == other.b``), rather than comparing " +"tuples of fields as in previous versions." msgstr "" -msgid "If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." +#: ../../library/dataclasses.rst:118 +msgid "" +"This change makes the comparison faster but it may alter results in cases " +"where attributes compare equal by identity but not by value (such as " +"``float('nan')``)." msgstr "" -msgid "*unsafe_hash*: If true, force ``dataclasses`` to create a :meth:`~object.__hash__` method, even though it may not be safe to do so. Otherwise, generate a :meth:`~object.__hash__` method according to how *eq* and *frozen* are set. The default value is ``False``." +#: ../../library/dataclasses.rst:122 +msgid "" +"In Python 3.12 and earlier, the comparison was performed by creating tuples " +"of the fields and comparing them (for example, ``(self.a, self.b) == " +"(other.a, other.b)``)." msgstr "" -msgid ":meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are added to hashed collections such as dictionaries and sets. Having a :meth:`!__hash__` implies that instances of the class are immutable. Mutability is a complicated property that depends on the programmer's intent, the existence and behavior of :meth:`!__eq__`, and the values of the *eq* and *frozen* flags in the ``@dataclass`` decorator." +#: ../../library/dataclasses.rst:126 +msgid "" +"*order*: If true (the default is " +"``False``), :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` methods will be generated. These compare the " +"class as if it were a tuple of its fields, in order. Both instances in the " +"comparison must be of the identical type. If *order* is true and *eq* is " +"false, a :exc:`ValueError` is raised." msgstr "" -msgid "By default, ``@dataclass`` will not implicitly add a :meth:`~object.__hash__` method unless it is safe to do so. Neither will it add or change an existing explicitly defined :meth:`!__hash__` method. Setting the class attribute ``__hash__ = None`` has a specific meaning to Python, as described in the :meth:`!__hash__` documentation." +#: ../../library/dataclasses.rst:133 +msgid "" +"If the class already defines any of :meth:`!__lt__`, :meth:`!" +"__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is " +"raised." msgstr "" -msgid "If :meth:`!__hash__` is not explicitly defined, or if it is set to ``None``, then ``@dataclass`` *may* add an implicit :meth:`!__hash__` method. Although not recommended, you can force ``@dataclass`` to create a :meth:`!__hash__` method with ``unsafe_hash=True``. This might be the case if your class is logically immutable but can still be mutated. This is a specialized use case and should be considered carefully." +#: ../../library/dataclasses.rst:137 +msgid "" +"*unsafe_hash*: If true, force ``dataclasses`` to create " +"a :meth:`~object.__hash__` method, even though it may not be safe to do so. " +"Otherwise, generate a :meth:`~object.__hash__` method according to how *eq* " +"and *frozen* are set. The default value is ``False``." msgstr "" -msgid "Here are the rules governing implicit creation of a :meth:`!__hash__` method. Note that you cannot both have an explicit :meth:`!__hash__` method in your dataclass and set ``unsafe_hash=True``; this will result in a :exc:`TypeError`." +#: ../../library/dataclasses.rst:143 +msgid "" +":meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are " +"added to hashed collections such as dictionaries and sets. Having a :meth:`!" +"__hash__` implies that instances of the class are immutable. Mutability is a " +"complicated property that depends on the programmer's intent, the existence " +"and behavior of :meth:`!__eq__`, and the values of the *eq* and *frozen* " +"flags in the ``@dataclass`` decorator." msgstr "" -msgid "If *eq* and *frozen* are both true, by default ``@dataclass`` will generate a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is false, :meth:`!__hash__` will be set to ``None``, marking it unhashable (which it is, since it is mutable). If *eq* is false, :meth:`!__hash__` will be left untouched meaning the :meth:`!__hash__` method of the superclass will be used (if the superclass is :class:`object`, this means it will fall back to id-based hashing)." +#: ../../library/dataclasses.rst:150 +msgid "" +"By default, ``@dataclass`` will not implicitly add " +"a :meth:`~object.__hash__` method unless it is safe to do so. Neither will " +"it add or change an existing explicitly defined :meth:`!__hash__` method. " +"Setting the class attribute ``__hash__ = None`` has a specific meaning to " +"Python, as described in the :meth:`!__hash__` documentation." msgstr "" -msgid "*frozen*: If true (the default is ``False``), assigning to fields will generate an exception. This emulates read-only frozen instances. See the :ref:`discussion ` below." +#: ../../library/dataclasses.rst:156 +msgid "" +"If :meth:`!__hash__` is not explicitly defined, or if it is set to ``None``, " +"then ``@dataclass`` *may* add an implicit :meth:`!__hash__` method. Although " +"not recommended, you can force ``@dataclass`` to create a :meth:`!__hash__` " +"method with ``unsafe_hash=True``. This might be the case if your class is " +"logically immutable but can still be mutated. This is a specialized use case " +"and should be considered carefully." msgstr "" -msgid "If :meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the class and *frozen* is true, then :exc:`TypeError` is raised." +#: ../../library/dataclasses.rst:163 +msgid "" +"Here are the rules governing implicit creation of a :meth:`!__hash__` " +"method. Note that you cannot both have an explicit :meth:`!__hash__` method " +"in your dataclass and set ``unsafe_hash=True``; this will result in " +"a :exc:`TypeError`." msgstr "" -msgid "*match_args*: If true (the default is ``True``), the :attr:`~object.__match_args__` tuple will be created from the list of non keyword-only parameters to the generated :meth:`~object.__init__` method (even if :meth:`!__init__` is not generated, see above). If false, or if :attr:`!__match_args__` is already defined in the class, then :attr:`!__match_args__` will not be generated." +#: ../../library/dataclasses.rst:168 +msgid "" +"If *eq* and *frozen* are both true, by default ``@dataclass`` will generate " +"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is " +"false, :meth:`!__hash__` will be set to ``None``, marking it unhashable " +"(which it is, since it is mutable). If *eq* is false, :meth:`!__hash__` " +"will be left untouched meaning the :meth:`!__hash__` method of the " +"superclass will be used (if the superclass is :class:`object`, this means it " +"will fall back to id-based hashing)." msgstr "" -msgid "*kw_only*: If true (the default value is ``False``), then all fields will be marked as keyword-only. If a field is marked as keyword-only, then the only effect is that the :meth:`~object.__init__` parameter generated from a keyword-only field must be specified with a keyword when :meth:`!__init__` is called. See the :term:`parameter` glossary entry for details. Also see the :const:`KW_ONLY` section." +#: ../../library/dataclasses.rst:176 +msgid "" +"*frozen*: If true (the default is ``False``), assigning to fields will " +"generate an exception. This emulates read-only frozen instances. See " +"the :ref:`discussion ` below." msgstr "" +#: ../../library/dataclasses.rst:180 +msgid "" +"If :meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in " +"the class and *frozen* is true, then :exc:`TypeError` is raised." +msgstr "" + +#: ../../library/dataclasses.rst:183 +msgid "" +"*match_args*: If true (the default is ``True``), " +"the :attr:`~object.__match_args__` tuple will be created from the list of " +"non keyword-only parameters to the generated :meth:`~object.__init__` method " +"(even if :meth:`!__init__` is not generated, see above). If false, or " +"if :attr:`!__match_args__` is already defined in the class, then :attr:`!" +"__match_args__` will not be generated." +msgstr "" + +#: ../../library/dataclasses.rst:192 +msgid "" +"*kw_only*: If true (the default value is ``False``), then all fields will be " +"marked as keyword-only. If a field is marked as keyword-only, then the only " +"effect is that the :meth:`~object.__init__` parameter generated from a " +"keyword-only field must be specified with a keyword when :meth:`!__init__` " +"is called. See the :term:`parameter` glossary entry for details. Also see " +"the :const:`KW_ONLY` section." +msgstr "" + +#: ../../library/dataclasses.rst:200 msgid "Keyword-only fields are not included in :attr:`!__match_args__`." msgstr "" -msgid "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` attribute will be generated and new class will be returned instead of the original one. If :attr:`!__slots__` is already defined in the class, then :exc:`TypeError` is raised." +#: ../../library/dataclasses.rst:204 +msgid "" +"*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " +"attribute will be generated and new class will be returned instead of the " +"original one. If :attr:`!__slots__` is already defined in the class, " +"then :exc:`TypeError` is raised." msgstr "" -msgid "Passing parameters to a base class :meth:`~object.__init_subclass__` when using ``slots=True`` will result in a :exc:`TypeError`. Either use ``__init_subclass__`` with no parameters or use default values as a workaround. See :gh:`91126` for full details." +#: ../../library/dataclasses.rst:210 +msgid "" +"Passing parameters to a base class :meth:`~object.__init_subclass__` when " +"using ``slots=True`` will result in a :exc:`TypeError`. Either use " +"``__init_subclass__`` with no parameters or use default values as a " +"workaround. See :gh:`91126` for full details." msgstr "" -msgid "If a field name is already included in the :attr:`!__slots__` of a base class, it will not be included in the generated :attr:`!__slots__` to prevent :ref:`overriding them `. Therefore, do not use :attr:`!__slots__` to retrieve the field names of a dataclass. Use :func:`fields` instead. To be able to determine inherited slots, base class :attr:`!__slots__` may be any iterable, but *not* an iterator." +#: ../../library/dataclasses.rst:218 +msgid "" +"If a field name is already included in the :attr:`!__slots__` of a base " +"class, it will not be included in the generated :attr:`!__slots__` to " +"prevent :ref:`overriding them `. Therefore, do not " +"use :attr:`!__slots__` to retrieve the field names of a dataclass. " +"Use :func:`fields` instead. To be able to determine inherited slots, base " +"class :attr:`!__slots__` may be any iterable, but *not* an iterator." msgstr "" -msgid "*weakref_slot*: If true (the default is ``False``), add a slot named \"__weakref__\", which is required to make an instance :func:`weakref-able `. It is an error to specify ``weakref_slot=True`` without also specifying ``slots=True``." +#: ../../library/dataclasses.rst:228 +msgid "" +"*weakref_slot*: If true (the default is ``False``), add a slot named " +"\"__weakref__\", which is required to make an instance :func:`weakref-able " +"`. It is an error to specify ``weakref_slot=True`` without also " +"specifying ``slots=True``." msgstr "" -msgid "``field``\\s may optionally specify a default value, using normal Python syntax::" +#: ../../library/dataclasses.rst:236 +msgid "" +"``field``\\s may optionally specify a default value, using normal Python " +"syntax::" msgstr "" +#: ../../library/dataclasses.rst:239 msgid "" "@dataclass\n" "class C:\n" @@ -177,18 +363,33 @@ msgid "" " b: int = 0 # assign a default value for 'b'" msgstr "" -msgid "In this example, both :attr:`!a` and :attr:`!b` will be included in the added :meth:`~object.__init__` method, which will be defined as::" +#: ../../library/dataclasses.rst:244 +msgid "" +"In this example, both :attr:`!a` and :attr:`!b` will be included in the " +"added :meth:`~object.__init__` method, which will be defined as::" msgstr "" +#: ../../library/dataclasses.rst:247 msgid "def __init__(self, a: int, b: int = 0):" msgstr "" -msgid ":exc:`TypeError` will be raised if a field without a default value follows a field with a default value. This is true whether this occurs in a single class, or as a result of class inheritance." +#: ../../library/dataclasses.rst:249 +msgid "" +":exc:`TypeError` will be raised if a field without a default value follows a " +"field with a default value. This is true whether this occurs in a single " +"class, or as a result of class inheritance." msgstr "" -msgid "For common and simple use cases, no other functionality is required. There are, however, some dataclass features that require additional per-field information. To satisfy this need for additional information, you can replace the default field value with a call to the provided :func:`!field` function. For example::" +#: ../../library/dataclasses.rst:255 +msgid "" +"For common and simple use cases, no other functionality is required. There " +"are, however, some dataclass features that require additional per-field " +"information. To satisfy this need for additional information, you can " +"replace the default field value with a call to the provided :func:`!field` " +"function. For example::" msgstr "" +#: ../../library/dataclasses.rst:261 msgid "" "@dataclass\n" "class C:\n" @@ -198,48 +399,109 @@ msgid "" "c.mylist += [1, 2, 3]" msgstr "" -msgid "As shown above, the :const:`MISSING` value is a sentinel object used to detect if some parameters are provided by the user. This sentinel is used because ``None`` is a valid value for some parameters with a distinct meaning. No code should directly use the :const:`MISSING` value." +#: ../../library/dataclasses.rst:268 +msgid "" +"As shown above, the :const:`MISSING` value is a sentinel object used to " +"detect if some parameters are provided by the user. This sentinel is used " +"because ``None`` is a valid value for some parameters with a distinct " +"meaning. No code should directly use the :const:`MISSING` value." msgstr "" +#: ../../library/dataclasses.rst:273 msgid "The parameters to :func:`!field` are:" msgstr "" -msgid "*default*: If provided, this will be the default value for this field. This is needed because the :func:`!field` call itself replaces the normal position of the default value." +#: ../../library/dataclasses.rst:275 +msgid "" +"*default*: If provided, this will be the default value for this field. This " +"is needed because the :func:`!field` call itself replaces the normal " +"position of the default value." msgstr "" -msgid "*default_factory*: If provided, it must be a zero-argument callable that will be called when a default value is needed for this field. Among other purposes, this can be used to specify fields with mutable default values, as discussed below. It is an error to specify both *default* and *default_factory*." +#: ../../library/dataclasses.rst:279 +msgid "" +"*default_factory*: If provided, it must be a zero-argument callable that " +"will be called when a default value is needed for this field. Among other " +"purposes, this can be used to specify fields with mutable default values, as " +"discussed below. It is an error to specify both *default* and " +"*default_factory*." msgstr "" -msgid "*init*: If true (the default), this field is included as a parameter to the generated :meth:`~object.__init__` method." +#: ../../library/dataclasses.rst:285 +msgid "" +"*init*: If true (the default), this field is included as a parameter to the " +"generated :meth:`~object.__init__` method." msgstr "" -msgid "*repr*: If true (the default), this field is included in the string returned by the generated :meth:`~object.__repr__` method." +#: ../../library/dataclasses.rst:288 +msgid "" +"*repr*: If true (the default), this field is included in the string returned " +"by the generated :meth:`~object.__repr__` method." msgstr "" -msgid "*hash*: This can be a bool or ``None``. If true, this field is included in the generated :meth:`~object.__hash__` method. If false, this field is excluded from the generated :meth:`~object.__hash__`. If ``None`` (the default), use the value of *compare*: this would normally be the expected behavior, since a field should be included in the hash if it's used for comparisons. Setting this value to anything other than ``None`` is discouraged." +#: ../../library/dataclasses.rst:291 +msgid "" +"*hash*: This can be a bool or ``None``. If true, this field is included in " +"the generated :meth:`~object.__hash__` method. If false, this field is " +"excluded from the generated :meth:`~object.__hash__`. If ``None`` (the " +"default), use the value of *compare*: this would normally be the expected " +"behavior, since a field should be included in the hash if it's used for " +"comparisons. Setting this value to anything other than ``None`` is " +"discouraged." msgstr "" -msgid "One possible reason to set ``hash=False`` but ``compare=True`` would be if a field is expensive to compute a hash value for, that field is needed for equality testing, and there are other fields that contribute to the type's hash value. Even if a field is excluded from the hash, it will still be used for comparisons." +#: ../../library/dataclasses.rst:299 +msgid "" +"One possible reason to set ``hash=False`` but ``compare=True`` would be if a " +"field is expensive to compute a hash value for, that field is needed for " +"equality testing, and there are other fields that contribute to the type's " +"hash value. Even if a field is excluded from the hash, it will still be " +"used for comparisons." msgstr "" -msgid "*compare*: If true (the default), this field is included in the generated equality and comparison methods (:meth:`~object.__eq__`, :meth:`~object.__gt__`, et al.)." +#: ../../library/dataclasses.rst:305 +msgid "" +"*compare*: If true (the default), this field is included in the generated " +"equality and comparison methods " +"(:meth:`~object.__eq__`, :meth:`~object.__gt__`, et al.)." msgstr "" -msgid "*metadata*: This can be a mapping or ``None``. ``None`` is treated as an empty dict. This value is wrapped in :func:`~types.MappingProxyType` to make it read-only, and exposed on the :class:`Field` object. It is not used at all by Data Classes, and is provided as a third-party extension mechanism. Multiple third-parties can each have their own key, to use as a namespace in the metadata." +#: ../../library/dataclasses.rst:309 +msgid "" +"*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " +"empty dict. This value is wrapped in :func:`~types.MappingProxyType` to " +"make it read-only, and exposed on the :class:`Field` object. It is not used " +"at all by Data Classes, and is provided as a third-party extension " +"mechanism. Multiple third-parties can each have their own key, to use as a " +"namespace in the metadata." msgstr "" -msgid "*kw_only*: If true, this field will be marked as keyword-only. This is used when the generated :meth:`~object.__init__` method's parameters are computed." +#: ../../library/dataclasses.rst:317 +msgid "" +"*kw_only*: If true, this field will be marked as keyword-only. This is used " +"when the generated :meth:`~object.__init__` method's parameters are computed." msgstr "" +#: ../../library/dataclasses.rst:321 msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." msgstr "" +#: ../../library/dataclasses.rst:325 msgid "*doc*: optional docstring for this field." msgstr "" -msgid "If the default value of a field is specified by a call to :func:`!field`, then the class attribute for this field will be replaced by the specified *default* value. If *default* is not provided, then the class attribute will be deleted. The intent is that after the :deco:`dataclass` decorator runs, the class attributes will all contain the default values for the fields, just as if the default value itself were specified. For example, after::" +#: ../../library/dataclasses.rst:329 +msgid "" +"If the default value of a field is specified by a call to :func:`!field`, " +"then the class attribute for this field will be replaced by the specified " +"*default* value. If *default* is not provided, then the class attribute " +"will be deleted. The intent is that after the :deco:`dataclass` decorator " +"runs, the class attributes will all contain the default values for the " +"fields, just as if the default value itself were specified. For example, " +"after::" msgstr "" +#: ../../library/dataclasses.rst:338 msgid "" "@dataclass\n" "class C:\n" @@ -249,36 +511,73 @@ msgid "" " t: int = 20" msgstr "" -msgid "The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!C.t` will be ``20``, and the class attributes :attr:`!C.x` and :attr:`!C.y` will not be set." +#: ../../library/dataclasses.rst:345 +msgid "" +"The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" +"C.t` will be ``20``, and the class attributes :attr:`!C.x` and :attr:`!C.y` " +"will not be set." msgstr "" -msgid ":class:`!Field` objects describe each defined field. These objects are created internally, and are returned by the :func:`fields` module-level method (see below). Users should never instantiate a :class:`!Field` object directly. Its documented attributes are:" +#: ../../library/dataclasses.rst:351 +msgid "" +":class:`!Field` objects describe each defined field. These objects are " +"created internally, and are returned by the :func:`fields` module-level " +"method (see below). Users should never instantiate a :class:`!Field` object " +"directly. Its documented attributes are:" msgstr "" +#: ../../library/dataclasses.rst:356 msgid ":attr:`!name`: The name of the field." msgstr "" +#: ../../library/dataclasses.rst:357 msgid ":attr:`!type`: The type of the field." msgstr "" -msgid ":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!kw_only` have the identical meaning and values as they do in the :func:`field` function." +#: ../../library/dataclasses.rst:358 +msgid "" +":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!" +"repr`, :attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!" +"kw_only` have the identical meaning and values as they do in " +"the :func:`field` function." msgstr "" -msgid "Other attributes may exist, but they are private and must not be inspected or relied on." +#: ../../library/dataclasses.rst:362 +msgid "" +"Other attributes may exist, but they are private and must not be inspected " +"or relied on." msgstr "" -msgid "``InitVar[T]`` type annotations describe variables that are :ref:`init-only `. Fields annotated with :class:`!InitVar` are considered pseudo-fields, and thus are neither returned by the :func:`fields` function nor used in any way except adding them as parameters to :meth:`~object.__init__` and an optional :meth:`__post_init__`." +#: ../../library/dataclasses.rst:367 +msgid "" +"``InitVar[T]`` type annotations describe variables that are :ref:`init-only " +"`. Fields annotated with :class:`!InitVar` " +"are considered pseudo-fields, and thus are neither returned by " +"the :func:`fields` function nor used in any way except adding them as " +"parameters to :meth:`~object.__init__` and an optional :meth:`__post_init__`." msgstr "" -msgid "Returns a tuple of :class:`Field` objects that define the fields for this dataclass. Accepts either a dataclass, or an instance of a dataclass. Raises :exc:`TypeError` if not passed a dataclass or instance of one. Does not return pseudo-fields which are ``ClassVar`` or ``InitVar``." +#: ../../library/dataclasses.rst:376 +msgid "" +"Returns a tuple of :class:`Field` objects that define the fields for this " +"dataclass. Accepts either a dataclass, or an instance of a dataclass. " +"Raises :exc:`TypeError` if not passed a dataclass or instance of one. Does " +"not return pseudo-fields which are ``ClassVar`` or ``InitVar``." msgstr "" -msgid "Converts the dataclass *obj* to a dict (by using the factory function *dict_factory*). Each dataclass is converted to a dict of its fields, as ``name: value`` pairs. dataclasses, dicts, lists, and tuples are recursed into. Other objects are copied with :func:`copy.deepcopy`." +#: ../../library/dataclasses.rst:383 +msgid "" +"Converts the dataclass *obj* to a dict (by using the factory function " +"*dict_factory*). Each dataclass is converted to a dict of its fields, as " +"``name: value`` pairs. dataclasses, dicts, lists, and tuples are recursed " +"into. Other objects are copied with :func:`copy.deepcopy`." msgstr "" +#: ../../library/dataclasses.rst:389 msgid "Example of using :func:`!asdict` on nested dataclasses::" msgstr "" +#: ../../library/dataclasses.rst:391 msgid "" "@dataclass\n" "class Point:\n" @@ -296,44 +595,82 @@ msgid "" "assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" msgstr "" +#: ../../library/dataclasses.rst:406 ../../library/dataclasses.rst:426 msgid "To create a shallow copy, the following workaround may be used::" msgstr "" +#: ../../library/dataclasses.rst:408 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" msgstr "" -msgid ":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." +#: ../../library/dataclasses.rst:410 +msgid "" +":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr "" -msgid "Converts the dataclass *obj* to a tuple (by using the factory function *tuple_factory*). Each dataclass is converted to a tuple of its field values. dataclasses, dicts, lists, and tuples are recursed into. Other objects are copied with :func:`copy.deepcopy`." +#: ../../library/dataclasses.rst:415 +msgid "" +"Converts the dataclass *obj* to a tuple (by using the factory function " +"*tuple_factory*). Each dataclass is converted to a tuple of its field " +"values. dataclasses, dicts, lists, and tuples are recursed into. Other " +"objects are copied with :func:`copy.deepcopy`." msgstr "" +#: ../../library/dataclasses.rst:421 msgid "Continuing from the previous example::" msgstr "" +#: ../../library/dataclasses.rst:423 msgid "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" msgstr "" +#: ../../library/dataclasses.rst:428 msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" msgstr "" -msgid ":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass instance." +#: ../../library/dataclasses.rst:430 +msgid "" +":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " +"instance." msgstr "" -msgid "Creates a new dataclass with name *cls_name*, fields as defined in *fields*, base classes as given in *bases*, and initialized with a namespace as given in *namespace*. *fields* is an iterable whose elements are each either ``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is supplied, :data:`typing.Any` is used for ``type``. The values of *init*, *repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, *slots*, and *weakref_slot* have the same meaning as they do in :deco:`dataclass`." +#: ../../library/dataclasses.rst:435 +msgid "" +"Creates a new dataclass with name *cls_name*, fields as defined in *fields*, " +"base classes as given in *bases*, and initialized with a namespace as given " +"in *namespace*. *fields* is an iterable whose elements are each either " +"``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is " +"supplied, :data:`typing.Any` is used for ``type``. The values of *init*, " +"*repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, " +"*slots*, and *weakref_slot* have the same meaning as they do " +"in :deco:`dataclass`." msgstr "" -msgid "If *module* is defined, the :attr:`!__module__` attribute of the dataclass is set to that value. By default, it is set to the module name of the caller." +#: ../../library/dataclasses.rst:445 +msgid "" +"If *module* is defined, the :attr:`!__module__` attribute of the dataclass " +"is set to that value. By default, it is set to the module name of the caller." msgstr "" -msgid "The *decorator* parameter is a callable that will be used to create the dataclass. It should take the class object as a first argument and the same keyword arguments as :deco:`dataclass`. By default, the :deco:`dataclass` function is used." +#: ../../library/dataclasses.rst:449 +msgid "" +"The *decorator* parameter is a callable that will be used to create the " +"dataclass. It should take the class object as a first argument and the same " +"keyword arguments as :deco:`dataclass`. By default, the :deco:`dataclass` " +"function is used." msgstr "" -msgid "This function is not strictly required, because any Python mechanism for creating a new class with :attr:`~object.__annotations__` can then apply the :deco:`dataclass` function to convert that class to a dataclass. This function is provided as a convenience. For example::" +#: ../../library/dataclasses.rst:454 +msgid "" +"This function is not strictly required, because any Python mechanism for " +"creating a new class with :attr:`~object.__annotations__` can then apply " +"the :deco:`dataclass` function to convert that class to a dataclass. This " +"function is provided as a convenience. For example::" msgstr "" +#: ../../library/dataclasses.rst:460 msgid "" "C = make_dataclass('C',\n" " [('x', int),\n" @@ -342,9 +679,11 @@ msgid "" " namespace={'add_one': lambda self: self.x + 1})" msgstr "" +#: ../../library/dataclasses.rst:466 msgid "Is equivalent to::" msgstr "" +#: ../../library/dataclasses.rst:468 msgid "" "@dataclass\n" "class C:\n" @@ -356,47 +695,97 @@ msgid "" " return self.x + 1" msgstr "" +#: ../../library/dataclasses.rst:477 msgid "Added the *decorator* parameter." msgstr "" -msgid "Creates a new object of the same type as *obj*, replacing fields with values from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If keys in *changes* are not field names of the given dataclass, raises :exc:`TypeError`." +#: ../../library/dataclasses.rst:482 +msgid "" +"Creates a new object of the same type as *obj*, replacing fields with values " +"from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If " +"keys in *changes* are not field names of the given dataclass, " +"raises :exc:`TypeError`." msgstr "" -msgid "The newly returned object is created by calling the :meth:`~object.__init__` method of the dataclass. This ensures that :meth:`__post_init__`, if present, is also called." +#: ../../library/dataclasses.rst:487 +msgid "" +"The newly returned object is created by calling the :meth:`~object.__init__` " +"method of the dataclass. This ensures that :meth:`__post_init__`, if " +"present, is also called." msgstr "" -msgid "Init-only variables without default values, if any exist, must be specified on the call to :func:`!replace` so that they can be passed to :meth:`!__init__` and :meth:`__post_init__`." +#: ../../library/dataclasses.rst:491 +msgid "" +"Init-only variables without default values, if any exist, must be specified " +"on the call to :func:`!replace` so that they can be passed to :meth:`!" +"__init__` and :meth:`__post_init__`." msgstr "" -msgid "It is an error for *changes* to contain any fields that are defined as having ``init=False``. A :exc:`ValueError` will be raised in this case." +#: ../../library/dataclasses.rst:495 +msgid "" +"It is an error for *changes* to contain any fields that are defined as " +"having ``init=False``. A :exc:`ValueError` will be raised in this case." msgstr "" -msgid "Be forewarned about how ``init=False`` fields work during a call to :func:`!replace`. They are not copied from the source object, but rather are initialized in :meth:`__post_init__`, if they're initialized at all. It is expected that ``init=False`` fields will be rarely and judiciously used. If they are used, it might be wise to have alternate class constructors, or perhaps a custom :func:`!replace` (or similarly named) method which handles instance copying." +#: ../../library/dataclasses.rst:499 +msgid "" +"Be forewarned about how ``init=False`` fields work during a call to :func:`!" +"replace`. They are not copied from the source object, but rather are " +"initialized in :meth:`__post_init__`, if they're initialized at all. It is " +"expected that ``init=False`` fields will be rarely and judiciously used. If " +"they are used, it might be wise to have alternate class constructors, or " +"perhaps a custom :func:`!replace` (or similarly named) method which handles " +"instance copying." msgstr "" -msgid "Dataclass instances are also supported by generic function :func:`copy.replace`." +#: ../../library/dataclasses.rst:508 +msgid "" +"Dataclass instances are also supported by generic " +"function :func:`copy.replace`." msgstr "" -msgid "Return ``True`` if its parameter is a dataclass (including subclasses of a dataclass, but not including :ref:`generic aliases `) or an instance of one, otherwise return ``False``." +#: ../../library/dataclasses.rst:512 +msgid "" +"Return ``True`` if its parameter is a dataclass (including subclasses of a " +"dataclass, but not including :ref:`generic aliases `) or " +"an instance of one, otherwise return ``False``." msgstr "" -msgid "If you need to know if a class is an instance of a dataclass (and not a dataclass itself), then add a further check for ``not isinstance(obj, type)``::" +#: ../../library/dataclasses.rst:516 +msgid "" +"If you need to know if a class is an instance of a dataclass (and not a " +"dataclass itself), then add a further check for ``not isinstance(obj, " +"type)``::" msgstr "" +#: ../../library/dataclasses.rst:520 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" +#: ../../library/dataclasses.rst:525 msgid "A sentinel value signifying a missing default or default_factory." msgstr "" -msgid "A sentinel value used as a type annotation. Any fields after a pseudo-field with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely ignored. This includes the name of such a field. By convention, a name of ``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields signify :meth:`~object.__init__` parameters that must be specified as keywords when the class is instantiated." +#: ../../library/dataclasses.rst:529 +msgid "" +"A sentinel value used as a type annotation. Any fields after a pseudo-field " +"with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note " +"that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely " +"ignored. This includes the name of such a field. By convention, a name of " +"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields " +"signify :meth:`~object.__init__` parameters that must be specified as " +"keywords when the class is instantiated." msgstr "" -msgid "In this example, the fields ``y`` and ``z`` will be marked as keyword-only fields::" +#: ../../library/dataclasses.rst:538 +msgid "" +"In this example, the fields ``y`` and ``z`` will be marked as keyword-only " +"fields::" msgstr "" +#: ../../library/dataclasses.rst:540 msgid "" "@dataclass\n" "class Point:\n" @@ -408,21 +797,40 @@ msgid "" "p = Point(0, y=1.5, z=2.0)" msgstr "" -msgid "In a single dataclass, it is an error to specify more than one field whose type is :const:`!KW_ONLY`." +#: ../../library/dataclasses.rst:549 +msgid "" +"In a single dataclass, it is an error to specify more than one field whose " +"type is :const:`!KW_ONLY`." msgstr "" -msgid "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:`~object.__delattr__` is called on a dataclass which was defined with ``frozen=True``. It is a subclass of :exc:`AttributeError`." +#: ../../library/dataclasses.rst:556 +msgid "" +"Raised when an implicitly defined :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` is called on a dataclass which was defined " +"with ``frozen=True``. It is a subclass of :exc:`AttributeError`." msgstr "" +#: ../../library/dataclasses.rst:563 msgid "Post-init processing" msgstr "" -msgid "When defined on the class, it will be called by the generated :meth:`~object.__init__`, normally as :meth:`!self.__post_init__`. However, if any ``InitVar`` fields are defined, they will also be passed to :meth:`!__post_init__` in the order they were defined in the class. If no :meth:`!__init__` method is generated, then :meth:`!__post_init__` will not automatically be called." +#: ../../library/dataclasses.rst:567 +msgid "" +"When defined on the class, it will be called by the " +"generated :meth:`~object.__init__`, normally as :meth:`!self.__post_init__`. " +"However, if any ``InitVar`` fields are defined, they will also be passed " +"to :meth:`!__post_init__` in the order they were defined in the class. If " +"no :meth:`!__init__` method is generated, then :meth:`!__post_init__` will " +"not automatically be called." msgstr "" -msgid "Among other uses, this allows for initializing field values that depend on one or more other fields. For example::" +#: ../../library/dataclasses.rst:574 +msgid "" +"Among other uses, this allows for initializing field values that depend on " +"one or more other fields. For example::" msgstr "" +#: ../../library/dataclasses.rst:577 msgid "" "@dataclass\n" "class C:\n" @@ -434,9 +842,15 @@ msgid "" " self.c = self.a + self.b" msgstr "" -msgid "The :meth:`~object.__init__` method generated by :deco:`dataclass` does not call base class :meth:`!__init__` methods. If the base class has an :meth:`!__init__` method that has to be called, it is common to call this method in a :meth:`__post_init__` method::" +#: ../../library/dataclasses.rst:586 +msgid "" +"The :meth:`~object.__init__` method generated by :deco:`dataclass` does not " +"call base class :meth:`!__init__` methods. If the base class has an :meth:`!" +"__init__` method that has to be called, it is common to call this method in " +"a :meth:`__post_init__` method::" msgstr "" +#: ../../library/dataclasses.rst:591 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" @@ -451,27 +865,59 @@ msgid "" " super().__init__(self.side, self.side)" msgstr "" -msgid "Note, however, that in general the dataclass-generated :meth:`!__init__` methods don't need to be called, since the derived dataclass will take care of initializing all fields of any base class that is a dataclass itself." +#: ../../library/dataclasses.rst:603 +msgid "" +"Note, however, that in general the dataclass-generated :meth:`!__init__` " +"methods don't need to be called, since the derived dataclass will take care " +"of initializing all fields of any base class that is a dataclass itself." msgstr "" -msgid "See the section below on init-only variables for ways to pass parameters to :meth:`!__post_init__`. Also see the warning about how :func:`replace` handles ``init=False`` fields." +#: ../../library/dataclasses.rst:607 +msgid "" +"See the section below on init-only variables for ways to pass parameters " +"to :meth:`!__post_init__`. Also see the warning about how :func:`replace` " +"handles ``init=False`` fields." msgstr "" +#: ../../library/dataclasses.rst:614 msgid "Class variables" msgstr "" -msgid "One of the few places where :deco:`dataclass` actually inspects the type of a field is to determine if a field is a class variable as defined in :pep:`526`. It does this by checking if the type of the field is :data:`typing.ClassVar`. If a field is a ``ClassVar``, it is excluded from consideration as a field and is ignored by the dataclass mechanisms. Such ``ClassVar`` pseudo-fields are not returned by the module-level :func:`fields` function." +#: ../../library/dataclasses.rst:616 +msgid "" +"One of the few places where :deco:`dataclass` actually inspects the type of " +"a field is to determine if a field is a class variable as defined " +"in :pep:`526`. It does this by checking if the type of the field " +"is :data:`typing.ClassVar`. If a field is a ``ClassVar``, it is excluded " +"from consideration as a field and is ignored by the dataclass mechanisms. " +"Such ``ClassVar`` pseudo-fields are not returned by the module-" +"level :func:`fields` function." msgstr "" +#: ../../library/dataclasses.rst:627 msgid "Init-only variables" msgstr "" -msgid "Another place where :deco:`dataclass` inspects a type annotation is to determine if a field is an init-only variable. It does this by seeing if the type of a field is of type :class:`InitVar`. If a field is an :class:`InitVar`, it is considered a pseudo-field called an init-only field. As it is not a true field, it is not returned by the module-level :func:`fields` function. Init-only fields are added as parameters to the generated :meth:`~object.__init__` method, and are passed to the optional :meth:`__post_init__` method. They are not otherwise used by dataclasses." -msgstr "" - -msgid "For example, suppose a field will be initialized from a database, if a value is not provided when creating the class::" +#: ../../library/dataclasses.rst:629 +msgid "" +"Another place where :deco:`dataclass` inspects a type annotation is to " +"determine if a field is an init-only variable. It does this by seeing if " +"the type of a field is of type :class:`InitVar`. If a field is " +"an :class:`InitVar`, it is considered a pseudo-field called an init-only " +"field. As it is not a true field, it is not returned by the module-" +"level :func:`fields` function. Init-only fields are added as parameters to " +"the generated :meth:`~object.__init__` method, and are passed to the " +"optional :meth:`__post_init__` method. They are not otherwise used by " +"dataclasses." +msgstr "" + +#: ../../library/dataclasses.rst:639 +msgid "" +"For example, suppose a field will be initialized from a database, if a value " +"is not provided when creating the class::" msgstr "" +#: ../../library/dataclasses.rst:642 msgid "" "@dataclass\n" "class C:\n" @@ -486,24 +932,50 @@ msgid "" "c = C(10, database=my_database)" msgstr "" -msgid "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!i` and :attr:`!j`, but not for :attr:`!database`." +#: ../../library/dataclasses.rst:654 +msgid "" +"In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" +"i` and :attr:`!j`, but not for :attr:`!database`." msgstr "" +#: ../../library/dataclasses.rst:660 msgid "Frozen instances" msgstr "" -msgid "It is not possible to create truly immutable Python objects. However, by passing ``frozen=True`` to the :deco:`dataclass` decorator you can emulate immutability. In that case, dataclasses will add :meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to the class. These methods will raise a :exc:`FrozenInstanceError` when invoked." +#: ../../library/dataclasses.rst:662 +msgid "" +"It is not possible to create truly immutable Python objects. However, by " +"passing ``frozen=True`` to the :deco:`dataclass` decorator you can emulate " +"immutability. In that case, dataclasses will " +"add :meth:`~object.__setattr__` and :meth:`~object.__delattr__` methods to " +"the class. These methods will raise a :exc:`FrozenInstanceError` when " +"invoked." msgstr "" -msgid "There is a tiny performance penalty when using ``frozen=True``: :meth:`~object.__init__` cannot use simple assignment to initialize fields, and must use :meth:`!object.__setattr__`." +#: ../../library/dataclasses.rst:668 +msgid "" +"There is a tiny performance penalty when using " +"``frozen=True``: :meth:`~object.__init__` cannot use simple assignment to " +"initialize fields, and must use :meth:`!object.__setattr__`." msgstr "" +#: ../../library/dataclasses.rst:677 msgid "Inheritance" msgstr "" -msgid "When the dataclass is being created by the :deco:`dataclass` decorator, it looks through all of the class's base classes in reverse MRO (that is, starting at :class:`object`) and, for each dataclass that it finds, adds the fields from that base class to an ordered mapping of fields. After all of the base class fields are added, it adds its own fields to the ordered mapping. All of the generated methods will use this combined, calculated ordered mapping of fields. Because the fields are in insertion order, derived classes override base classes. An example::" +#: ../../library/dataclasses.rst:679 +msgid "" +"When the dataclass is being created by the :deco:`dataclass` decorator, it " +"looks through all of the class's base classes in reverse MRO (that is, " +"starting at :class:`object`) and, for each dataclass that it finds, adds the " +"fields from that base class to an ordered mapping of fields. After all of " +"the base class fields are added, it adds its own fields to the ordered " +"mapping. All of the generated methods will use this combined, calculated " +"ordered mapping of fields. Because the fields are in insertion order, " +"derived classes override base classes. An example::" msgstr "" +#: ../../library/dataclasses.rst:689 msgid "" "@dataclass\n" "class Base:\n" @@ -516,24 +988,43 @@ msgid "" " x: int = 15" msgstr "" -msgid "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. The final type of :attr:`!x` is :class:`int`, as specified in class :class:`!C`." +#: ../../library/dataclasses.rst:699 +msgid "" +"The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " +"The final type of :attr:`!x` is :class:`int`, as specified in class :class:`!" +"C`." msgstr "" -msgid "The generated :meth:`~object.__init__` method for :class:`!C` will look like::" +#: ../../library/dataclasses.rst:702 +msgid "" +"The generated :meth:`~object.__init__` method for :class:`!C` will look " +"like::" msgstr "" +#: ../../library/dataclasses.rst:704 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" msgstr "" +#: ../../library/dataclasses.rst:707 msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr "" -msgid "After the parameters needed for :meth:`~object.__init__` are computed, any keyword-only parameters are moved to come after all regular (non-keyword-only) parameters. This is a requirement of how keyword-only parameters are implemented in Python: they must come after non-keyword-only parameters." +#: ../../library/dataclasses.rst:709 +msgid "" +"After the parameters needed for :meth:`~object.__init__` are computed, any " +"keyword-only parameters are moved to come after all regular (non-keyword-" +"only) parameters. This is a requirement of how keyword-only parameters are " +"implemented in Python: they must come after non-keyword-only parameters." msgstr "" -msgid "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are keyword-only fields, and :attr:`!Base.x` and :attr:`!D.z` are regular fields::" +#: ../../library/dataclasses.rst:715 +msgid "" +"In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " +"keyword-only fields, and :attr:`!Base.x` and :attr:`!D.z` are regular " +"fields::" msgstr "" +#: ../../library/dataclasses.rst:718 msgid "" "@dataclass\n" "class Base:\n" @@ -548,36 +1039,64 @@ msgid "" " t: int = field(kw_only=True, default=0)" msgstr "" +#: ../../library/dataclasses.rst:730 msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "" -msgid "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: int = 0):" +#: ../../library/dataclasses.rst:732 +msgid "" +"def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " +"int = 0):" msgstr "" -msgid "Note that the parameters have been re-ordered from how they appear in the list of fields: parameters derived from regular fields are followed by parameters derived from keyword-only fields." +#: ../../library/dataclasses.rst:734 +msgid "" +"Note that the parameters have been re-ordered from how they appear in the " +"list of fields: parameters derived from regular fields are followed by " +"parameters derived from keyword-only fields." msgstr "" -msgid "The relative ordering of keyword-only parameters is maintained in the re-ordered :meth:`!__init__` parameter list." +#: ../../library/dataclasses.rst:738 +msgid "" +"The relative ordering of keyword-only parameters is maintained in the re-" +"ordered :meth:`!__init__` parameter list." msgstr "" +#: ../../library/dataclasses.rst:743 msgid "Default factory functions" msgstr "" -msgid "If a :func:`field` specifies a *default_factory*, it is called with zero arguments when a default value for the field is needed. For example, to create a new instance of a list, use::" +#: ../../library/dataclasses.rst:745 +msgid "" +"If a :func:`field` specifies a *default_factory*, it is called with zero " +"arguments when a default value for the field is needed. For example, to " +"create a new instance of a list, use::" msgstr "" +#: ../../library/dataclasses.rst:749 msgid "mylist: list = field(default_factory=list)" msgstr "" -msgid "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) and the field also specifies *default_factory*, then the default factory function will always be called from the generated :meth:`!__init__` function. This happens because there is no other way to give the field an initial value." +#: ../../library/dataclasses.rst:751 +msgid "" +"If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " +"and the field also specifies *default_factory*, then the default factory " +"function will always be called from the generated :meth:`!__init__` " +"function. This happens because there is no other way to give the field an " +"initial value." msgstr "" +#: ../../library/dataclasses.rst:758 msgid "Mutable default values" msgstr "" -msgid "Python stores default member variable values in class attributes. Consider this example, not using dataclasses::" +#: ../../library/dataclasses.rst:760 +msgid "" +"Python stores default member variable values in class attributes. Consider " +"this example, not using dataclasses::" msgstr "" +#: ../../library/dataclasses.rst:763 msgid "" "class C:\n" " x = []\n" @@ -592,12 +1111,17 @@ msgid "" "assert o1.x is o2.x" msgstr "" -msgid "Note that the two instances of class :class:`!C` share the same class variable :attr:`!x`, as expected." +#: ../../library/dataclasses.rst:775 +msgid "" +"Note that the two instances of class :class:`!C` share the same class " +"variable :attr:`!x`, as expected." msgstr "" +#: ../../library/dataclasses.rst:778 msgid "Using dataclasses, *if* this code was valid::" msgstr "" +#: ../../library/dataclasses.rst:780 msgid "" "@dataclass\n" "class D:\n" @@ -606,9 +1130,11 @@ msgid "" " self.x.append(element)" msgstr "" +#: ../../library/dataclasses.rst:786 msgid "it would generate code similar to::" msgstr "" +#: ../../library/dataclasses.rst:788 msgid "" "class D:\n" " x = []\n" @@ -620,12 +1146,26 @@ msgid "" "assert D().x is D().x" msgstr "" -msgid "This has the same issue as the original example using class :class:`!C`. That is, two instances of class :class:`!D` that do not specify a value for :attr:`!x` when creating a class instance will share the same copy of :attr:`!x`. Because dataclasses just use normal Python class creation they also share this behavior. There is no general way for Data Classes to detect this condition. Instead, the :deco:`dataclass` decorator will raise a :exc:`ValueError` if it detects an unhashable default parameter. The assumption is that if a value is unhashable, it is mutable. This is a partial solution, but it does protect against many common errors." -msgstr "" - -msgid "Using default factory functions is a way to create new instances of mutable types as default values for fields::" +#: ../../library/dataclasses.rst:797 +msgid "" +"This has the same issue as the original example using class :class:`!C`. " +"That is, two instances of class :class:`!D` that do not specify a value " +"for :attr:`!x` when creating a class instance will share the same copy " +"of :attr:`!x`. Because dataclasses just use normal Python class creation " +"they also share this behavior. There is no general way for Data Classes to " +"detect this condition. Instead, the :deco:`dataclass` decorator will raise " +"a :exc:`ValueError` if it detects an unhashable default parameter. The " +"assumption is that if a value is unhashable, it is mutable. This is a " +"partial solution, but it does protect against many common errors." +msgstr "" + +#: ../../library/dataclasses.rst:808 +msgid "" +"Using default factory functions is a way to create new instances of mutable " +"types as default values for fields::" msgstr "" +#: ../../library/dataclasses.rst:811 msgid "" "@dataclass\n" "class D:\n" @@ -634,24 +1174,49 @@ msgid "" "assert D().x is not D().x" msgstr "" -msgid "Instead of looking for and disallowing objects of type :class:`list`, :class:`dict`, or :class:`set`, unhashable objects are now not allowed as default values. Unhashability is used to approximate mutability." +#: ../../library/dataclasses.rst:817 +msgid "" +"Instead of looking for and disallowing objects of " +"type :class:`list`, :class:`dict`, or :class:`set`, unhashable objects are " +"now not allowed as default values. Unhashability is used to approximate " +"mutability." msgstr "" +#: ../../library/dataclasses.rst:824 msgid "Descriptor-typed fields" msgstr "" -msgid "Fields that are assigned :ref:`descriptor objects ` as their default value have the following special behaviors:" +#: ../../library/dataclasses.rst:826 +msgid "" +"Fields that are assigned :ref:`descriptor objects ` as their " +"default value have the following special behaviors:" msgstr "" -msgid "The value for the field passed to the dataclass's :meth:`~object.__init__` method is passed to the descriptor's :meth:`~object.__set__` method rather than overwriting the descriptor object." +#: ../../library/dataclasses.rst:829 +msgid "" +"The value for the field passed to the dataclass's :meth:`~object.__init__` " +"method is passed to the descriptor's :meth:`~object.__set__` method rather " +"than overwriting the descriptor object." msgstr "" -msgid "Similarly, when getting or setting the field, the descriptor's :meth:`~object.__get__` or :meth:`!__set__` method is called rather than returning or overwriting the descriptor object." +#: ../../library/dataclasses.rst:833 +msgid "" +"Similarly, when getting or setting the field, the " +"descriptor's :meth:`~object.__get__` or :meth:`!__set__` method is called " +"rather than returning or overwriting the descriptor object." msgstr "" -msgid "To determine whether a field contains a default value, :deco:`dataclass` will call the descriptor's :meth:`!__get__` method using its class access form: ``descriptor.__get__(obj=None, type=cls)``. If the descriptor returns a value in this case, it will be used as the field's default. On the other hand, if the descriptor raises :exc:`AttributeError` in this situation, no default value will be provided for the field." +#: ../../library/dataclasses.rst:837 +msgid "" +"To determine whether a field contains a default value, :deco:`dataclass` " +"will call the descriptor's :meth:`!__get__` method using its class access " +"form: ``descriptor.__get__(obj=None, type=cls)``. If the descriptor returns " +"a value in this case, it will be used as the field's default. On the other " +"hand, if the descriptor raises :exc:`AttributeError` in this situation, no " +"default value will be provided for the field." msgstr "" +#: ../../library/dataclasses.rst:847 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -671,7 +1236,8 @@ msgid "" "\n" "@dataclass\n" "class InventoryItem:\n" -" quantity_on_hand: IntConversionDescriptor = IntConversionDescriptor(default=100)\n" +" quantity_on_hand: IntConversionDescriptor = " +"IntConversionDescriptor(default=100)\n" "\n" "i = InventoryItem()\n" "print(i.quantity_on_hand) # 100\n" @@ -679,5 +1245,9 @@ msgid "" "print(i.quantity_on_hand) # 2" msgstr "" -msgid "Note that if a field is annotated with a descriptor type, but is not assigned a descriptor object as its default value, the field will act like a normal field." +#: ../../library/dataclasses.rst:872 +msgid "" +"Note that if a field is annotated with a descriptor type, but is not " +"assigned a descriptor object as its default value, the field will act like a " +"normal field." msgstr "" diff --git a/library/datatypes.po b/library/datatypes.po index df49ac6af..c076f8898 100644 --- a/library/datatypes.po +++ b/library/datatypes.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,14 +21,26 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/datatypes.rst:5 msgid "Data Types" msgstr "" -msgid "The modules described in this chapter provide a variety of specialized data types such as dates and times, fixed-type arrays, heap queues, double-ended queues, and enumerations." +#: ../../library/datatypes.rst:7 +msgid "" +"The modules described in this chapter provide a variety of specialized data " +"types such as dates and times, fixed-type arrays, heap queues, double-ended " +"queues, and enumerations." msgstr "" -msgid "Python also provides some built-in data types, in particular, :class:`dict`, :class:`list`, :class:`set` and :class:`frozenset`, and :class:`tuple`. The :class:`str` class is used to hold Unicode strings, and the :class:`bytes` and :class:`bytearray` classes are used to hold binary data." +#: ../../library/datatypes.rst:11 +msgid "" +"Python also provides some built-in data types, in " +"particular, :class:`dict`, :class:`list`, :class:`set` " +"and :class:`frozenset`, and :class:`tuple`. The :class:`str` class is used " +"to hold Unicode strings, and the :class:`bytes` and :class:`bytearray` " +"classes are used to hold binary data." msgstr "" +#: ../../library/datatypes.rst:17 msgid "The following modules are documented in this chapter:" msgstr "" diff --git a/library/datetime.po b/library/datetime.po index 19ca07d4f..80011bd27 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -15,7 +15,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -25,203 +25,347 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/datetime.rst:2 msgid ":mod:`!datetime` --- Basic date and time types" msgstr "" +#: ../../library/datetime.rst:11 msgid "**Source code:** :source:`Lib/datetime.py`" msgstr "" -msgid "The :mod:`!datetime` module supplies classes for manipulating dates and times." +#: ../../library/datetime.rst:15 +msgid "" +"The :mod:`!datetime` module supplies classes for manipulating dates and " +"times." msgstr "" -msgid "While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation." +#: ../../library/datetime.rst:17 +msgid "" +"While date and time arithmetic is supported, the focus of the implementation " +"is on efficient attribute extraction for output formatting and manipulation." msgstr "" +#: ../../library/datetime.rst:22 msgid "Skip to :ref:`the format codes `." msgstr "" +#: ../../library/datetime.rst:26 msgid "Module :mod:`calendar`" msgstr "" +#: ../../library/datetime.rst:27 msgid "General calendar related functions." msgstr "" +#: ../../library/datetime.rst:29 msgid "Module :mod:`time`" msgstr "" +#: ../../library/datetime.rst:30 msgid "Time access and conversions." msgstr "" +#: ../../library/datetime.rst:32 msgid "Module :mod:`zoneinfo`" msgstr "" +#: ../../library/datetime.rst:33 msgid "Concrete time zones representing the IANA time zone database." msgstr "" +#: ../../library/datetime.rst:35 msgid "Package `dateutil `_" msgstr "" +#: ../../library/datetime.rst:36 msgid "Third-party library with expanded time zone and parsing support." msgstr "" +#: ../../library/datetime.rst:38 msgid "Package :pypi:`DateType`" msgstr "" -msgid "Third-party library that introduces distinct static types to for example, allow :term:`static type checkers ` to differentiate between naive and aware datetimes." +#: ../../library/datetime.rst:39 +msgid "" +"Third-party library that introduces distinct static types to for example, " +"allow :term:`static type checkers ` to differentiate " +"between naive and aware datetimes." msgstr "" +#: ../../library/datetime.rst:47 msgid "Aware and naive objects" msgstr "" -msgid "Date and time objects may be categorized as \"aware\" or \"naive\" depending on whether or not they include time zone information." +#: ../../library/datetime.rst:49 +msgid "" +"Date and time objects may be categorized as \"aware\" or \"naive\" depending " +"on whether or not they include time zone information." msgstr "" -msgid "With sufficient knowledge of applicable algorithmic and political time adjustments, such as time zone and daylight saving time information, an **aware** object can locate itself relative to other aware objects. An aware object represents a specific moment in time that is not open to interpretation. [#]_" +#: ../../library/datetime.rst:52 +msgid "" +"With sufficient knowledge of applicable algorithmic and political time " +"adjustments, such as time zone and daylight saving time information, an " +"**aware** object can locate itself relative to other aware objects. An aware " +"object represents a specific moment in time that is not open to " +"interpretation. [#]_" msgstr "" -msgid "A **naive** object does not contain enough information to unambiguously locate itself relative to other date/time objects. Whether a naive object represents Coordinated Universal Time (UTC), local time, or time in some other time zone is purely up to the program, just like it is up to the program whether a particular number represents metres, miles, or mass. Naive objects are easy to understand and to work with, at the cost of ignoring some aspects of reality." +#: ../../library/datetime.rst:58 +msgid "" +"A **naive** object does not contain enough information to unambiguously " +"locate itself relative to other date/time objects. Whether a naive object " +"represents Coordinated Universal Time (UTC), local time, or time in some " +"other time zone is purely up to the program, just like it is up to the " +"program whether a particular number represents metres, miles, or mass. Naive " +"objects are easy to understand and to work with, at the cost of ignoring " +"some aspects of reality." msgstr "" -msgid "For applications requiring aware objects, :class:`.datetime` and :class:`.time` objects have an optional time zone information attribute, :attr:`!tzinfo`, that can be set to an instance of a subclass of the abstract :class:`!tzinfo` class. These :class:`tzinfo` objects capture information about the offset from UTC time, the time zone name, and whether daylight saving time is in effect." +#: ../../library/datetime.rst:65 +msgid "" +"For applications requiring aware objects, :class:`.datetime` " +"and :class:`.time` objects have an optional time zone information " +"attribute, :attr:`!tzinfo`, that can be set to an instance of a subclass of " +"the abstract :class:`!tzinfo` class. These :class:`tzinfo` objects capture " +"information about the offset from UTC time, the time zone name, and whether " +"daylight saving time is in effect." msgstr "" -msgid "Only one concrete :class:`tzinfo` class, the :class:`timezone` class, is supplied by the :mod:`!datetime` module. The :class:`!timezone` class can represent simple time zones with fixed offsets from UTC, such as UTC itself or North American EST and EDT time zones. Supporting time zones at deeper levels of detail is up to the application. The rules for time adjustment across the world are more political than rational, change frequently, and there is no standard suitable for every application aside from UTC." +#: ../../library/datetime.rst:71 +msgid "" +"Only one concrete :class:`tzinfo` class, the :class:`timezone` class, is " +"supplied by the :mod:`!datetime` module. The :class:`!timezone` class can " +"represent simple time zones with fixed offsets from UTC, such as UTC itself " +"or North American EST and EDT time zones. Supporting time zones at deeper " +"levels of detail is up to the application. The rules for time adjustment " +"across the world are more political than rational, change frequently, and " +"there is no standard suitable for every application aside from UTC." msgstr "" +#: ../../library/datetime.rst:81 msgid "Constants" msgstr "" +#: ../../library/datetime.rst:83 msgid "The :mod:`!datetime` module exports the following constants:" msgstr "" -msgid "The smallest year number allowed in a :class:`date` or :class:`.datetime` object. :const:`MINYEAR` is 1." +#: ../../library/datetime.rst:87 +msgid "" +"The smallest year number allowed in a :class:`date` or :class:`.datetime` " +"object. :const:`MINYEAR` is 1." msgstr "" -msgid "The largest year number allowed in a :class:`date` or :class:`.datetime` object. :const:`MAXYEAR` is 9999." +#: ../../library/datetime.rst:93 +msgid "" +"The largest year number allowed in a :class:`date` or :class:`.datetime` " +"object. :const:`MAXYEAR` is 9999." msgstr "" +#: ../../library/datetime.rst:99 msgid "Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`." msgstr "" +#: ../../library/datetime.rst:105 msgid "Available types" msgstr "" -msgid "An idealized naive date, assuming the current Gregorian calendar always was, and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, and :attr:`day`." +#: ../../library/datetime.rst:110 +msgid "" +"An idealized naive date, assuming the current Gregorian calendar always was, " +"and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, " +"and :attr:`day`." msgstr "" -msgid "An idealized time, independent of any particular day, assuming that every day has exactly 24\\*60\\*60 seconds. (There is no notion of \"leap seconds\" here.) Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, and :attr:`.tzinfo`." +#: ../../library/datetime.rst:118 +msgid "" +"An idealized time, independent of any particular day, assuming that every " +"day has exactly 24\\*60\\*60 seconds. (There is no notion of \"leap " +"seconds\" here.) " +"Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"and :attr:`.tzinfo`." msgstr "" -msgid "A combination of a date and a time. Attributes: :attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, and :attr:`.tzinfo`." +#: ../../library/datetime.rst:127 +msgid "" +"A combination of a date and a time. " +"Attributes: :attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond`, " +"and :attr:`.tzinfo`." msgstr "" -msgid "A duration expressing the difference between two :class:`.datetime` or :class:`date` instances to microsecond resolution." +#: ../../library/datetime.rst:135 +msgid "" +"A duration expressing the difference between two :class:`.datetime` " +"or :class:`date` instances to microsecond resolution." msgstr "" -msgid "An abstract base class for time zone information objects. These are used by the :class:`.datetime` and :class:`.time` classes to provide a customizable notion of time adjustment (for example, to account for time zone and/or daylight saving time)." +#: ../../library/datetime.rst:142 +msgid "" +"An abstract base class for time zone information objects. These are used by " +"the :class:`.datetime` and :class:`.time` classes to provide a customizable " +"notion of time adjustment (for example, to account for time zone and/or " +"daylight saving time)." msgstr "" -msgid "A class that implements the :class:`tzinfo` abstract base class as a fixed offset from the UTC." +#: ../../library/datetime.rst:151 +msgid "" +"A class that implements the :class:`tzinfo` abstract base class as a fixed " +"offset from the UTC." msgstr "" +#: ../../library/datetime.rst:157 ../../library/datetime.rst:174 msgid "Objects of these types are immutable." msgstr "" +#: ../../library/datetime.rst:159 msgid "Subclass relationships:" msgstr "" +#: ../../library/datetime.rst:161 msgid "" "timedelta, tzinfo, time, and date inherit from object; timezone inherits\n" "from tzinfo; and datetime inherits from date." msgstr "" +#: ../../library/datetime.rst:169 msgid "Common properties" msgstr "" -msgid "The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone` types share these common features:" +#: ../../library/datetime.rst:171 +msgid "" +"The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone` " +"types share these common features:" msgstr "" -msgid "Objects of these types are :term:`hashable`, meaning that they can be used as dictionary keys." +#: ../../library/datetime.rst:175 +msgid "" +"Objects of these types are :term:`hashable`, meaning that they can be used " +"as dictionary keys." msgstr "" -msgid "Objects of these types support efficient pickling via the :mod:`pickle` module." +#: ../../library/datetime.rst:177 +msgid "" +"Objects of these types support efficient pickling via the :mod:`pickle` " +"module." msgstr "" +#: ../../library/datetime.rst:181 msgid "Determining if an object is aware or naive" msgstr "" +#: ../../library/datetime.rst:183 msgid "Objects of the :class:`date` type are always naive." msgstr "" -msgid "An object of type :class:`.time` or :class:`.datetime` may be aware or naive." +#: ../../library/datetime.rst:185 +msgid "" +"An object of type :class:`.time` or :class:`.datetime` may be aware or naive." msgstr "" -msgid "A :class:`.datetime` object ``d`` is aware if both of the following hold:" +#: ../../library/datetime.rst:187 +msgid "" +"A :class:`.datetime` object ``d`` is aware if both of the following hold:" msgstr "" +#: ../../library/datetime.rst:189 msgid "``d.tzinfo`` is not ``None``" msgstr "" +#: ../../library/datetime.rst:190 msgid "``d.tzinfo.utcoffset(d)`` does not return ``None``" msgstr "" +#: ../../library/datetime.rst:192 msgid "Otherwise, ``d`` is naive." msgstr "" +#: ../../library/datetime.rst:194 msgid "A :class:`.time` object ``t`` is aware if both of the following hold:" msgstr "" +#: ../../library/datetime.rst:196 msgid "``t.tzinfo`` is not ``None``" msgstr "" +#: ../../library/datetime.rst:197 msgid "``t.tzinfo.utcoffset(None)`` does not return ``None``." msgstr "" +#: ../../library/datetime.rst:199 msgid "Otherwise, ``t`` is naive." msgstr "" -msgid "The distinction between aware and naive doesn't apply to :class:`timedelta` objects." +#: ../../library/datetime.rst:201 +msgid "" +"The distinction between aware and naive doesn't apply to :class:`timedelta` " +"objects." msgstr "" +#: ../../library/datetime.rst:208 msgid ":class:`!timedelta` objects" msgstr "" -msgid "A :class:`timedelta` object represents a duration, the difference between two :class:`.datetime` or :class:`date` instances." +#: ../../library/datetime.rst:210 +msgid "" +"A :class:`timedelta` object represents a duration, the difference between " +"two :class:`.datetime` or :class:`date` instances." msgstr "" -msgid "All arguments are optional and default to 0. Arguments may be integers or floats, and may be positive or negative." +#: ../../library/datetime.rst:215 +msgid "" +"All arguments are optional and default to 0. Arguments may be integers or " +"floats, and may be positive or negative." msgstr "" -msgid "Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units:" +#: ../../library/datetime.rst:218 +msgid "" +"Only *days*, *seconds* and *microseconds* are stored internally. Arguments " +"are converted to those units:" msgstr "" +#: ../../library/datetime.rst:221 msgid "A millisecond is converted to 1000 microseconds." msgstr "" +#: ../../library/datetime.rst:222 msgid "A minute is converted to 60 seconds." msgstr "" +#: ../../library/datetime.rst:223 msgid "An hour is converted to 3600 seconds." msgstr "" +#: ../../library/datetime.rst:224 msgid "A week is converted to 7 days." msgstr "" -msgid "and days, seconds and microseconds are then normalized so that the representation is unique, with" +#: ../../library/datetime.rst:226 +msgid "" +"and days, seconds and microseconds are then normalized so that the " +"representation is unique, with" msgstr "" +#: ../../library/datetime.rst:229 msgid "``0 <= microseconds < 1000000``" msgstr "" +#: ../../library/datetime.rst:230 msgid "``0 <= seconds < 3600*24`` (the number of seconds in one day)" msgstr "" +#: ../../library/datetime.rst:231 msgid "``-999999999 <= days <= 999999999``" msgstr "" -msgid "The following example illustrates how any arguments besides *days*, *seconds* and *microseconds* are \"merged\" and normalized into those three resulting attributes::" +#: ../../library/datetime.rst:233 +msgid "" +"The following example illustrates how any arguments besides *days*, " +"*seconds* and *microseconds* are \"merged\" and normalized into those three " +"resulting attributes::" msgstr "" +#: ../../library/datetime.rst:237 msgid "" ">>> import datetime as dt\n" ">>> delta = dt.timedelta(\n" @@ -238,18 +382,36 @@ msgid "" "datetime.timedelta(days=64, seconds=29156, microseconds=10)" msgstr "" -msgid "``import datetime as dt`` instead of ``import datetime`` or ``from datetime import datetime`` to avoid confusion between the module and the class. See `How I Import Python’s datetime Module `__." +#: ../../library/datetime.rst:252 +msgid "" +"``import datetime as dt`` instead of ``import datetime`` or ``from datetime " +"import datetime`` to avoid confusion between the module and the class. See " +"`How I Import Python’s datetime Module `__." msgstr "" -msgid "If any argument is a float and there are fractional microseconds, the fractional microseconds left over from all arguments are combined and their sum is rounded to the nearest microsecond using round-half-to-even tiebreaker. If no argument is a float, the conversion and normalization processes are exact (no information is lost)." +#: ../../library/datetime.rst:257 +msgid "" +"If any argument is a float and there are fractional microseconds, the " +"fractional microseconds left over from all arguments are combined and their " +"sum is rounded to the nearest microsecond using round-half-to-even " +"tiebreaker. If no argument is a float, the conversion and normalization " +"processes are exact (no information is lost)." msgstr "" -msgid "If the normalized value of days lies outside the indicated range, :exc:`OverflowError` is raised." +#: ../../library/datetime.rst:264 +msgid "" +"If the normalized value of days lies outside the indicated " +"range, :exc:`OverflowError` is raised." msgstr "" -msgid "Note that normalization of negative values may be surprising at first. For example::" +#: ../../library/datetime.rst:267 +msgid "" +"Note that normalization of negative values may be surprising at first. For " +"example::" msgstr "" +#: ../../library/datetime.rst:270 msgid "" ">>> import datetime as dt\n" ">>> d = dt.timedelta(microseconds=-1)\n" @@ -257,9 +419,13 @@ msgid "" "(-1, 86399, 999999)" msgstr "" -msgid "Since the string representation of :class:`!timedelta` objects can be confusing, use the following recipe to produce a more readable format:" +#: ../../library/datetime.rst:275 +msgid "" +"Since the string representation of :class:`!timedelta` objects can be " +"confusing, use the following recipe to produce a more readable format:" msgstr "" +#: ../../library/datetime.rst:278 msgid "" ">>> def pretty_timedelta(td):\n" "... if td.days >= 0:\n" @@ -273,33 +439,56 @@ msgid "" "'-(1:00:00)'" msgstr "" +#: ../../library/datetime.rst:292 ../../library/datetime.rst:630 +#: ../../library/datetime.rst:1200 ../../library/datetime.rst:1845 +#: ../../library/datetime.rst:2481 msgid "Class attributes:" msgstr "" +#: ../../library/datetime.rst:296 msgid "The most negative :class:`timedelta` object, ``timedelta(-999999999)``." msgstr "" -msgid "The most positive :class:`timedelta` object, ``timedelta(days=999999999, hours=23, minutes=59, seconds=59, microseconds=999999)``." +#: ../../library/datetime.rst:301 +msgid "" +"The most positive :class:`timedelta` object, ``timedelta(days=999999999, " +"hours=23, minutes=59, seconds=59, microseconds=999999)``." msgstr "" -msgid "The smallest possible difference between non-equal :class:`timedelta` objects, ``timedelta(microseconds=1)``." +#: ../../library/datetime.rst:307 +msgid "" +"The smallest possible difference between non-equal :class:`timedelta` " +"objects, ``timedelta(microseconds=1)``." msgstr "" -msgid "Note that, because of normalization, ``timedelta.max`` is greater than ``-timedelta.min``. ``-timedelta.max`` is not representable as a :class:`timedelta` object." +#: ../../library/datetime.rst:311 +msgid "" +"Note that, because of normalization, ``timedelta.max`` is greater than ``-" +"timedelta.min``. ``-timedelta.max`` is not representable as " +"a :class:`timedelta` object." msgstr "" +#: ../../library/datetime.rst:315 ../../library/datetime.rst:648 +#: ../../library/datetime.rst:1220 ../../library/datetime.rst:1865 msgid "Instance attributes (read-only):" msgstr "" +#: ../../library/datetime.rst:319 msgid "Between -999,999,999 and 999,999,999 inclusive." msgstr "" +#: ../../library/datetime.rst:324 msgid "Between 0 and 86,399 inclusive." msgstr "" -msgid "It is a somewhat common bug for code to unintentionally use this attribute when it is actually intended to get a :meth:`~timedelta.total_seconds` value instead:" +#: ../../library/datetime.rst:328 +msgid "" +"It is a somewhat common bug for code to unintentionally use this attribute " +"when it is actually intended to get a :meth:`~timedelta.total_seconds` value " +"instead:" msgstr "" +#: ../../library/datetime.rst:332 msgid "" ">>> import datetime as dt\n" ">>> duration = dt.timedelta(seconds=11235813)\n" @@ -309,123 +498,194 @@ msgid "" "11235813.0" msgstr "" +#: ../../library/datetime.rst:344 msgid "Between 0 and 999,999 inclusive." msgstr "" +#: ../../library/datetime.rst:347 ../../library/datetime.rst:665 +#: ../../library/datetime.rst:1274 msgid "Supported operations:" msgstr "" +#: ../../library/datetime.rst:350 ../../library/datetime.rst:668 +#: ../../library/datetime.rst:1277 msgid "Operation" msgstr "" +#: ../../library/datetime.rst:350 ../../library/datetime.rst:668 +#: ../../library/datetime.rst:1277 msgid "Result" msgstr "" +#: ../../library/datetime.rst:352 msgid "``t1 = t2 + t3``" msgstr "" -msgid "Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2`` are true. (1)" +#: ../../library/datetime.rst:352 +msgid "" +"Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2`` " +"are true. (1)" msgstr "" +#: ../../library/datetime.rst:356 msgid "``t1 = t2 - t3``" msgstr "" -msgid "Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == t1 + t3`` are true. (1)(6)" +#: ../../library/datetime.rst:356 +msgid "" +"Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == " +"t1 + t3`` are true. (1)(6)" msgstr "" +#: ../../library/datetime.rst:360 msgid "``t1 = t2 * i or t1 = i * t2``" msgstr "" -msgid "Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, provided ``i != 0``." +#: ../../library/datetime.rst:360 +msgid "" +"Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, " +"provided ``i != 0``." msgstr "" +#: ../../library/datetime.rst:364 msgid "In general, ``t1 * i == t1 * (i-1) + t1`` is true. (1)" msgstr "" +#: ../../library/datetime.rst:367 msgid "``t1 = t2 * f or t1 = f * t2``" msgstr "" -msgid "Delta multiplied by a float. The result is rounded to the nearest multiple of timedelta.resolution using round-half-to-even." +#: ../../library/datetime.rst:367 +msgid "" +"Delta multiplied by a float. The result is rounded to the nearest multiple " +"of timedelta.resolution using round-half-to-even." msgstr "" +#: ../../library/datetime.rst:371 msgid "``f = t2 / t3``" msgstr "" -msgid "Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :class:`float` object." +#: ../../library/datetime.rst:371 +msgid "" +"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns " +"a :class:`float` object." msgstr "" +#: ../../library/datetime.rst:375 msgid "``t1 = t2 / f or t1 = t2 / i``" msgstr "" -msgid "Delta divided by a float or an int. The result is rounded to the nearest multiple of timedelta.resolution using round-half-to-even." +#: ../../library/datetime.rst:375 +msgid "" +"Delta divided by a float or an int. The result is rounded to the nearest " +"multiple of timedelta.resolution using round-half-to-even." msgstr "" +#: ../../library/datetime.rst:379 msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``" msgstr "" -msgid "The floor is computed and the remainder (if any) is thrown away. In the second case, an integer is returned. (3)" +#: ../../library/datetime.rst:379 +msgid "" +"The floor is computed and the remainder (if any) is thrown away. In the " +"second case, an integer is returned. (3)" msgstr "" +#: ../../library/datetime.rst:383 msgid "``t1 = t2 % t3``" msgstr "" +#: ../../library/datetime.rst:383 msgid "The remainder is computed as a :class:`timedelta` object. (3)" msgstr "" +#: ../../library/datetime.rst:386 msgid "``q, r = divmod(t1, t2)``" msgstr "" -msgid "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % t2``. ``q`` is an integer and ``r`` is a :class:`timedelta` object." +#: ../../library/datetime.rst:386 +msgid "" +"Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " +"t2``. ``q`` is an integer and ``r`` is a :class:`timedelta` object." msgstr "" +#: ../../library/datetime.rst:391 msgid "``+t1``" msgstr "" +#: ../../library/datetime.rst:391 msgid "Returns a :class:`timedelta` object with the same value. (2)" msgstr "" +#: ../../library/datetime.rst:394 msgid "``-t1``" msgstr "" -msgid "Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to ``t1 * -1``. (1)(4)" +#: ../../library/datetime.rst:394 +msgid "" +"Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " +"``t1 * -1``. (1)(4)" msgstr "" +#: ../../library/datetime.rst:398 msgid "``abs(t)``" msgstr "" -msgid "Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < 0``. (2)" +#: ../../library/datetime.rst:398 +msgid "" +"Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < " +"0``. (2)" msgstr "" +#: ../../library/datetime.rst:401 msgid "``str(t)``" msgstr "" -msgid "Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is negative for negative ``t``. (5)" +#: ../../library/datetime.rst:401 +msgid "" +"Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is " +"negative for negative ``t``. (5)" msgstr "" +#: ../../library/datetime.rst:405 msgid "``repr(t)``" msgstr "" -msgid "Returns a string representation of the :class:`timedelta` object as a constructor call with canonical attribute values." +#: ../../library/datetime.rst:405 +msgid "" +"Returns a string representation of the :class:`timedelta` object as a " +"constructor call with canonical attribute values." msgstr "" +#: ../../library/datetime.rst:410 ../../library/datetime.rst:687 +#: ../../library/datetime.rst:2750 msgid "Notes:" msgstr "" +#: ../../library/datetime.rst:413 msgid "This is exact but may overflow." msgstr "" +#: ../../library/datetime.rst:416 msgid "This is exact and cannot overflow." msgstr "" +#: ../../library/datetime.rst:419 msgid "Division by zero raises :exc:`ZeroDivisionError`." msgstr "" +#: ../../library/datetime.rst:422 msgid "``-timedelta.max`` is not representable as a :class:`timedelta` object." msgstr "" -msgid "String representations of :class:`timedelta` objects are normalized similarly to their internal representation. This leads to somewhat unusual results for negative timedeltas. For example::" +#: ../../library/datetime.rst:425 +msgid "" +"String representations of :class:`timedelta` objects are normalized " +"similarly to their internal representation. This leads to somewhat unusual " +"results for negative timedeltas. For example::" msgstr "" +#: ../../library/datetime.rst:429 msgid "" ">>> timedelta(hours=-5)\n" "datetime.timedelta(days=-1, seconds=68400)\n" @@ -433,36 +693,65 @@ msgid "" "-1 day, 19:00:00" msgstr "" -msgid "The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-t3)`` except when t3 is equal to ``timedelta.max``; in that case the former will produce a result while the latter will overflow." +#: ../../library/datetime.rst:435 +msgid "" +"The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-" +"t3)`` except when t3 is equal to ``timedelta.max``; in that case the former " +"will produce a result while the latter will overflow." msgstr "" -msgid "In addition to the operations listed above, :class:`timedelta` objects support certain additions and subtractions with :class:`date` and :class:`.datetime` objects (see below)." +#: ../../library/datetime.rst:439 +msgid "" +"In addition to the operations listed above, :class:`timedelta` objects " +"support certain additions and subtractions with :class:`date` " +"and :class:`.datetime` objects (see below)." msgstr "" -msgid "Floor division and true division of a :class:`timedelta` object by another :class:`!timedelta` object are now supported, as are remainder operations and the :func:`divmod` function. True division and multiplication of a :class:`!timedelta` object by a :class:`float` object are now supported." +#: ../../library/datetime.rst:443 +msgid "" +"Floor division and true division of a :class:`timedelta` object by " +"another :class:`!timedelta` object are now supported, as are remainder " +"operations and the :func:`divmod` function. True division and multiplication " +"of a :class:`!timedelta` object by a :class:`float` object are now supported." msgstr "" +#: ../../library/datetime.rst:449 msgid ":class:`timedelta` objects support equality and order comparisons." msgstr "" -msgid "In Boolean contexts, a :class:`timedelta` object is considered to be true if and only if it isn't equal to ``timedelta(0)``." +#: ../../library/datetime.rst:451 +msgid "" +"In Boolean contexts, a :class:`timedelta` object is considered to be true if " +"and only if it isn't equal to ``timedelta(0)``." msgstr "" +#: ../../library/datetime.rst:454 ../../library/datetime.rst:729 +#: ../../library/datetime.rst:1365 ../../library/datetime.rst:1990 msgid "Instance methods:" msgstr "" -msgid "Return the total number of seconds contained in the duration. Equivalent to ``td / timedelta(seconds=1)``. For interval units other than seconds, use the division form directly (for example, ``td / timedelta(microseconds=1)``)." +#: ../../library/datetime.rst:458 +msgid "" +"Return the total number of seconds contained in the duration. Equivalent to " +"``td / timedelta(seconds=1)``. For interval units other than seconds, use " +"the division form directly (for example, ``td / timedelta(microseconds=1)``)." msgstr "" -msgid "Note that for very large time intervals (greater than 270 years on most platforms) this method will lose microsecond accuracy." +#: ../../library/datetime.rst:462 +msgid "" +"Note that for very large time intervals (greater than 270 years on most " +"platforms) this method will lose microsecond accuracy." msgstr "" +#: ../../library/datetime.rst:469 msgid "Examples of usage: :class:`!timedelta`" msgstr "" +#: ../../library/datetime.rst:471 msgid "An additional example of normalization::" msgstr "" +#: ../../library/datetime.rst:473 msgid "" ">>> # Components of another_year add up to exactly 365 days\n" ">>> import datetime as dt\n" @@ -475,9 +764,11 @@ msgid "" "31536000.0" msgstr "" +#: ../../library/datetime.rst:483 msgid "Examples of :class:`timedelta` arithmetic::" msgstr "" +#: ../../library/datetime.rst:485 msgid "" ">>> import datetime as dt\n" ">>> year = dt.timedelta(days=365)\n" @@ -494,69 +785,121 @@ msgid "" "(datetime.timedelta(days=1095), 3)" msgstr "" +#: ../../library/datetime.rst:503 msgid ":class:`!date` objects" msgstr "" -msgid "A :class:`date` object represents a date (year, month and day) in an idealized calendar, the current Gregorian calendar indefinitely extended in both directions." +#: ../../library/datetime.rst:505 +msgid "" +"A :class:`date` object represents a date (year, month and day) in an " +"idealized calendar, the current Gregorian calendar indefinitely extended in " +"both directions." msgstr "" -msgid "January 1 of year 1 is called day number 1, January 2 of year 1 is called day number 2, and so on. [#]_" +#: ../../library/datetime.rst:509 +msgid "" +"January 1 of year 1 is called day number 1, January 2 of year 1 is called " +"day number 2, and so on. [#]_" msgstr "" -msgid "All arguments are required. Arguments must be integers, in the following ranges:" +#: ../../library/datetime.rst:514 +msgid "" +"All arguments are required. Arguments must be integers, in the following " +"ranges:" msgstr "" +#: ../../library/datetime.rst:517 msgid "``MINYEAR <= year <= MAXYEAR``" msgstr "" +#: ../../library/datetime.rst:518 msgid "``1 <= month <= 12``" msgstr "" +#: ../../library/datetime.rst:519 msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -msgid "If an argument outside those ranges is given, :exc:`ValueError` is raised." +#: ../../library/datetime.rst:521 ../../library/datetime.rst:950 +msgid "" +"If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" +#: ../../library/datetime.rst:524 ../../library/datetime.rst:956 msgid "Other constructors, all class methods:" msgstr "" +#: ../../library/datetime.rst:528 msgid "Return the current local date." msgstr "" +#: ../../library/datetime.rst:530 msgid "This is equivalent to ``date.fromtimestamp(time.time())``." msgstr "" -msgid "Return the local date corresponding to the POSIX *timestamp*, such as is returned by :func:`time.time`." +#: ../../library/datetime.rst:535 +msgid "" +"Return the local date corresponding to the POSIX *timestamp*, such as is " +"returned by :func:`time.time`." msgstr "" -msgid "This may raise :exc:`OverflowError`, if the timestamp is out of the range of values supported by the platform C :c:func:`localtime` function, and :exc:`OSError` on :c:func:`localtime` failure. It's common for this to be restricted to years from 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by :meth:`fromtimestamp`." +#: ../../library/datetime.rst:538 +msgid "" +"This may raise :exc:`OverflowError`, if the timestamp is out of the range of " +"values supported by the platform C :c:func:`localtime` function, " +"and :exc:`OSError` on :c:func:`localtime` failure. It's common for this to " +"be restricted to years from 1970 through 2038. Note that on non-POSIX " +"systems that include leap seconds in their notion of a timestamp, leap " +"seconds are ignored by :meth:`fromtimestamp`." msgstr "" -msgid "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is out of the range of values supported by the platform C :c:func:`localtime` function. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:`localtime` failure." +#: ../../library/datetime.rst:545 +msgid "" +"Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " +"out of the range of values supported by the platform C :c:func:`localtime` " +"function. Raise :exc:`OSError` instead of :exc:`ValueError` " +"on :c:func:`localtime` failure." msgstr "" -msgid "Return the date corresponding to the proleptic Gregorian *ordinal*, where January 1 of year 1 has ordinal 1." +#: ../../library/datetime.rst:554 +msgid "" +"Return the date corresponding to the proleptic Gregorian *ordinal*, where " +"January 1 of year 1 has ordinal 1." msgstr "" -msgid ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. For any date ``d``, ``date.fromordinal(d.toordinal()) == d``." +#: ../../library/datetime.rst:557 +msgid "" +":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " +"For any date ``d``, ``date.fromordinal(d.toordinal()) == d``." msgstr "" -msgid "Return a :class:`date` corresponding to a *date_string* given in any valid ISO 8601 format, with the following exceptions:" +#: ../../library/datetime.rst:564 +msgid "" +"Return a :class:`date` corresponding to a *date_string* given in any valid " +"ISO 8601 format, with the following exceptions:" msgstr "" -msgid "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." +#: ../../library/datetime.rst:567 ../../library/datetime.rst:1121 +msgid "" +"Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -msgid "Extended date representations are not currently supported (``±YYYYYY-MM-DD``)." +#: ../../library/datetime.rst:569 ../../library/datetime.rst:1123 +msgid "" +"Extended date representations are not currently supported (``±YYYYYY-MM-" +"DD``)." msgstr "" +#: ../../library/datetime.rst:571 ../../library/datetime.rst:1125 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" +#: ../../library/datetime.rst:573 ../../library/datetime.rst:1127 +#: ../../library/datetime.rst:1599 msgid "Examples::" msgstr "" +#: ../../library/datetime.rst:575 msgid "" ">>> import datetime as dt\n" ">>> dt.date.fromisoformat('2019-12-04')\n" @@ -567,125 +910,206 @@ msgid "" "datetime.date(2021, 1, 4)" msgstr "" +#: ../../library/datetime.rst:584 msgid "Previously, this method only supported the format ``YYYY-MM-DD``." msgstr "" -msgid "Return a :class:`date` corresponding to the ISO calendar date specified by *year*, *week* and *day*. This is the inverse of the function :meth:`date.isocalendar`." +#: ../../library/datetime.rst:590 +msgid "" +"Return a :class:`date` corresponding to the ISO calendar date specified by " +"*year*, *week* and *day*. This is the inverse of the " +"function :meth:`date.isocalendar`." msgstr "" -msgid "Return a :class:`.date` corresponding to *date_string*, parsed according to *format*. This is equivalent to::" +#: ../../library/datetime.rst:598 +msgid "" +"Return a :class:`.date` corresponding to *date_string*, parsed according to " +"*format*. This is equivalent to::" msgstr "" +#: ../../library/datetime.rst:601 msgid "date(*(time.strptime(date_string, format)[0:3]))" msgstr "" -msgid ":exc:`ValueError` is raised if the date_string and format can't be parsed by :func:`time.strptime` or if it returns a value which isn't a time tuple. See also :ref:`strftime-strptime-behavior` and :meth:`date.fromisoformat`." +#: ../../library/datetime.rst:603 +msgid "" +":exc:`ValueError` is raised if the date_string and format can't be parsed " +"by :func:`time.strptime` or if it returns a value which isn't a time tuple. " +"See also :ref:`strftime-strptime-behavior` and :meth:`date.fromisoformat`." msgstr "" -msgid "If *format* specifies a day of month without a year a :exc:`DeprecationWarning` is emitted. This is to avoid a quadrennial leap year bug in code seeking to parse only a month and day as the default year used in absence of one in the format is not a leap year. Such *format* values may raise an error as of Python 3.15. The workaround is to always include a year in your *format*. If parsing *date_string* values that do not have a year, explicitly add a year that is a leap year before parsing:" +#: ../../library/datetime.rst:610 +msgid "" +"If *format* specifies a day of month without a year " +"a :exc:`DeprecationWarning` is emitted. This is to avoid a quadrennial leap " +"year bug in code seeking to parse only a month and day as the default year " +"used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" +#: ../../library/datetime.rst:619 msgid "" ">>> import datetime as dt\n" ">>> date_string = \"02/29\"\n" -">>> when = dt.date.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # Avoids leap year bug.\n" +">>> when = dt.date.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # Avoids " +"leap year bug.\n" ">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" +#: ../../library/datetime.rst:634 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" +#: ../../library/datetime.rst:639 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -msgid "The smallest possible difference between non-equal date objects, ``timedelta(days=1)``." +#: ../../library/datetime.rst:644 +msgid "" +"The smallest possible difference between non-equal date objects, " +"``timedelta(days=1)``." msgstr "" +#: ../../library/datetime.rst:652 ../../library/datetime.rst:1224 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" +#: ../../library/datetime.rst:657 ../../library/datetime.rst:1229 msgid "Between 1 and 12 inclusive." msgstr "" +#: ../../library/datetime.rst:662 ../../library/datetime.rst:1234 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" +#: ../../library/datetime.rst:670 msgid "``date2 = date1 + timedelta``" msgstr "" +#: ../../library/datetime.rst:670 msgid "``date2`` will be ``timedelta.days`` days after ``date1``. (1)" msgstr "" +#: ../../library/datetime.rst:673 msgid "``date2 = date1 - timedelta``" msgstr "" +#: ../../library/datetime.rst:673 msgid "Computes ``date2`` such that ``date2 + timedelta == date1``. (2)" msgstr "" +#: ../../library/datetime.rst:676 msgid "``timedelta = date1 - date2``" msgstr "" +#: ../../library/datetime.rst:676 ../../library/datetime.rst:1283 msgid "\\(3)" msgstr "" +#: ../../library/datetime.rst:0 msgid "``date1 == date2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``date1 != date2``" msgstr "" +#: ../../library/datetime.rst:678 ../../library/datetime.rst:1285 msgid "Equality comparison. (4)" msgstr "" +#: ../../library/datetime.rst:0 msgid "``date1 < date2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``date1 > date2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``date1 <= date2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``date1 >= date2``" msgstr "" +#: ../../library/datetime.rst:681 ../../library/datetime.rst:1288 msgid "Order comparison. (5)" msgstr "" -msgid "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if ``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. ``timedelta.seconds`` and ``timedelta.microseconds`` are ignored. :exc:`OverflowError` is raised if ``date2.year`` would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`." +#: ../../library/datetime.rst:690 +msgid "" +"*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " +"``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " +"``timedelta.seconds`` and ``timedelta.microseconds`` are " +"ignored. :exc:`OverflowError` is raised if ``date2.year`` would be smaller " +"than :const:`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" +#: ../../library/datetime.rst:697 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "" -msgid "This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta.microseconds`` are 0, and ``date2 + timedelta == date1`` after." +#: ../../library/datetime.rst:700 +msgid "" +"This is exact, and cannot overflow. ``timedelta.seconds`` and " +"``timedelta.microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" +#: ../../library/datetime.rst:704 msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -msgid ":class:`!date` objects that are not also :class:`.datetime` instances are never equal to :class:`!datetime` objects, even if they represent the same date." +#: ../../library/datetime.rst:706 +msgid "" +":class:`!date` objects that are not also :class:`.datetime` instances are " +"never equal to :class:`!datetime` objects, even if they represent the same " +"date." msgstr "" -msgid "*date1* is considered less than *date2* when *date1* precedes *date2* in time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < date2.toordinal()``." +#: ../../library/datetime.rst:711 +msgid "" +"*date1* is considered less than *date2* when *date1* precedes *date2* in " +"time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " +"date2.toordinal()``." msgstr "" -msgid "Order comparison between a :class:`date` object that is not also a :class:`.datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." +#: ../../library/datetime.rst:715 +msgid "" +"Order comparison between a :class:`date` object that is not also " +"a :class:`.datetime` instance and a :class:`!datetime` object " +"raises :exc:`TypeError`." msgstr "" -msgid "Comparison between :class:`.datetime` object and an instance of the :class:`date` subclass that is not a :class:`!datetime` subclass no longer converts the latter to :class:`!date`, ignoring the time part and the time zone. The default behavior can be changed by overriding the special comparison methods in subclasses." +#: ../../library/datetime.rst:719 ../../library/datetime.rst:1356 +msgid "" +"Comparison between :class:`.datetime` object and an instance of " +"the :class:`date` subclass that is not a :class:`!datetime` subclass no " +"longer converts the latter to :class:`!date`, ignoring the time part and the " +"time zone. The default behavior can be changed by overriding the special " +"comparison methods in subclasses." msgstr "" -msgid "In Boolean contexts, all :class:`date` objects are considered to be true." +#: ../../library/datetime.rst:727 +msgid "" +"In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -msgid "Return a new :class:`date` object with the same values, but with specified parameters updated." +#: ../../library/datetime.rst:733 +msgid "" +"Return a new :class:`date` object with the same values, but with specified " +"parameters updated." msgstr "" +#: ../../library/datetime.rst:736 ../../library/datetime.rst:2036 msgid "Example::" msgstr "" +#: ../../library/datetime.rst:738 msgid "" ">>> import datetime as dt\n" ">>> d = dt.date(2002, 12, 31)\n" @@ -693,45 +1117,85 @@ msgid "" "datetime.date(2002, 12, 26)" msgstr "" -msgid "The generic function :func:`copy.replace` also supports :class:`date` objects." +#: ../../library/datetime.rst:743 +msgid "" +"The generic function :func:`copy.replace` also supports :class:`date` " +"objects." msgstr "" -msgid "Return a :class:`time.struct_time` such as returned by :func:`time.localtime`." +#: ../../library/datetime.rst:749 ../../library/datetime.rst:1481 +msgid "" +"Return a :class:`time.struct_time` such as returned " +"by :func:`time.localtime`." msgstr "" +#: ../../library/datetime.rst:751 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" +#: ../../library/datetime.rst:753 ../../library/datetime.rst:1483 msgid "``d.timetuple()`` is equivalent to::" msgstr "" -msgid "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" +#: ../../library/datetime.rst:755 +msgid "" +"time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" -msgid "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the day number within the current year starting with 1 for January 1st." +#: ../../library/datetime.rst:757 +msgid "" +"where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " +"day number within the current year starting with 1 for January 1st." msgstr "" -msgid "Return the proleptic Gregorian ordinal of the date, where January 1 of year 1 has ordinal 1. For any :class:`date` object ``d``, ``date.fromordinal(d.toordinal()) == d``." +#: ../../library/datetime.rst:763 +msgid "" +"Return the proleptic Gregorian ordinal of the date, where January 1 of year " +"1 has ordinal 1. For any :class:`date` object ``d``, " +"``date.fromordinal(d.toordinal()) == d``." msgstr "" -msgid "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :meth:`isoweekday`." +#: ../../library/datetime.rst:770 +msgid "" +"Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " +"For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See " +"also :meth:`isoweekday`." msgstr "" -msgid "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :meth:`weekday`, :meth:`isocalendar`." +#: ../../library/datetime.rst:777 +msgid "" +"Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " +"For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See " +"also :meth:`weekday`, :meth:`isocalendar`." msgstr "" -msgid "Return a :term:`named tuple` object with three components: ``year``, ``week`` and ``weekday``." +#: ../../library/datetime.rst:784 +msgid "" +"Return a :term:`named tuple` object with three components: ``year``, " +"``week`` and ``weekday``." msgstr "" -msgid "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" +#: ../../library/datetime.rst:787 +msgid "" +"The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -msgid "The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year." +#: ../../library/datetime.rst:789 +msgid "" +"The ISO year consists of 52 or 53 full weeks, and where a week starts on a " +"Monday and ends on a Sunday. The first week of an ISO year is the first " +"(Gregorian) calendar week of a year containing a Thursday. This is called " +"week number 1, and the ISO year of that Thursday is the same as its " +"Gregorian year." msgstr "" -msgid "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" +#: ../../library/datetime.rst:794 +msgid "" +"For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " +"begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" +#: ../../library/datetime.rst:797 msgid "" ">>> import datetime as dt\n" ">>> dt.date(2003, 12, 29).isocalendar()\n" @@ -740,51 +1204,77 @@ msgid "" "datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" msgstr "" +#: ../../library/datetime.rst:803 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -msgid "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" +#: ../../library/datetime.rst:809 +msgid "" +"Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "" +#: ../../library/datetime.rst:811 msgid "" ">>> import datetime as dt\n" ">>> dt.date(2002, 12, 4).isoformat()\n" "'2002-12-04'" msgstr "" +#: ../../library/datetime.rst:818 msgid "For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" +#: ../../library/datetime.rst:823 msgid "Return a string representing the date::" msgstr "" +#: ../../library/datetime.rst:825 msgid "" ">>> import datetime as dt\n" ">>> dt.date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" msgstr "" +#: ../../library/datetime.rst:829 ../../library/datetime.rst:1670 msgid "``d.ctime()`` is equivalent to::" msgstr "" +#: ../../library/datetime.rst:831 ../../library/datetime.rst:1672 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "" -msgid "on platforms where the native C :c:func:`ctime` function (which :func:`time.ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to the C standard." +#: ../../library/datetime.rst:833 +msgid "" +"on platforms where the native C :c:func:`ctime` function " +"(which :func:`time.ctime` invokes, but which :meth:`date.ctime` does not " +"invoke) conforms to the C standard." msgstr "" -msgid "Return a string representing the date, controlled by an explicit format string. Format codes referring to hours, minutes or seconds will see 0 values. See also :ref:`strftime-strptime-behavior` and :meth:`date.isoformat`." +#: ../../library/datetime.rst:840 +msgid "" +"Return a string representing the date, controlled by an explicit format " +"string. Format codes referring to hours, minutes or seconds will see 0 " +"values. See also :ref:`strftime-strptime-behavior` " +"and :meth:`date.isoformat`." msgstr "" -msgid "Same as :meth:`.date.strftime`. This makes it possible to specify a format string for a :class:`.date` object in :ref:`formatted string literals ` and when using :meth:`str.format`. See also :ref:`strftime-strptime-behavior` and :meth:`date.isoformat`." +#: ../../library/datetime.rst:847 +msgid "" +"Same as :meth:`.date.strftime`. This makes it possible to specify a format " +"string for a :class:`.date` object in :ref:`formatted string literals ` and when using :meth:`str.format`. See also :ref:`strftime-" +"strptime-behavior` and :meth:`date.isoformat`." msgstr "" +#: ../../library/datetime.rst:854 msgid "Examples of usage: :class:`!date`" msgstr "" +#: ../../library/datetime.rst:856 msgid "Example of counting days to an event::" msgstr "" +#: ../../library/datetime.rst:858 msgid "" ">>> import time\n" ">>> import datetime as dt\n" @@ -804,9 +1294,11 @@ msgid "" "202" msgstr "" +#: ../../library/datetime.rst:875 msgid "More examples of working with :class:`date`:" msgstr "" +#: ../../library/datetime.rst:877 msgid "" ">>> import datetime as dt\n" ">>> d = dt.date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" @@ -850,162 +1342,298 @@ msgid "" "datetime.date(2005, 3, 11)" msgstr "" +#: ../../library/datetime.rst:924 msgid ":class:`!datetime` objects" msgstr "" -msgid "A :class:`.datetime` object is a single object containing all the information from a :class:`date` object and a :class:`.time` object." +#: ../../library/datetime.rst:926 +msgid "" +"A :class:`.datetime` object is a single object containing all the " +"information from a :class:`date` object and a :class:`.time` object." msgstr "" -msgid "Like a :class:`date` object, :class:`.datetime` assumes the current Gregorian calendar extended in both directions; like a :class:`.time` object, :class:`!datetime` assumes there are exactly 3600\\*24 seconds in every day." +#: ../../library/datetime.rst:929 +msgid "" +"Like a :class:`date` object, :class:`.datetime` assumes the current " +"Gregorian calendar extended in both directions; like a :class:`.time` " +"object, :class:`!datetime` assumes there are exactly 3600\\*24 seconds in " +"every day." msgstr "" +#: ../../library/datetime.rst:933 msgid "Constructor:" msgstr "" -msgid "The *year*, *month* and *day* arguments are required. *tzinfo* may be ``None``, or an instance of a :class:`tzinfo` subclass. The remaining arguments must be integers in the following ranges:" +#: ../../library/datetime.rst:937 +msgid "" +"The *year*, *month* and *day* arguments are required. *tzinfo* may be " +"``None``, or an instance of a :class:`tzinfo` subclass. The remaining " +"arguments must be integers in the following ranges:" msgstr "" +#: ../../library/datetime.rst:941 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "" +#: ../../library/datetime.rst:942 msgid "``1 <= month <= 12``," msgstr "" +#: ../../library/datetime.rst:943 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" +#: ../../library/datetime.rst:944 ../../library/datetime.rst:1835 msgid "``0 <= hour < 24``," msgstr "" +#: ../../library/datetime.rst:945 ../../library/datetime.rst:1836 msgid "``0 <= minute < 60``," msgstr "" +#: ../../library/datetime.rst:946 ../../library/datetime.rst:1837 msgid "``0 <= second < 60``," msgstr "" +#: ../../library/datetime.rst:947 ../../library/datetime.rst:1838 msgid "``0 <= microsecond < 1000000``," msgstr "" +#: ../../library/datetime.rst:948 ../../library/datetime.rst:1839 msgid "``fold in [0, 1]``." msgstr "" +#: ../../library/datetime.rst:952 ../../library/datetime.rst:1402 +#: ../../library/datetime.rst:2003 msgid "Added the *fold* parameter." msgstr "" +#: ../../library/datetime.rst:960 msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "" +#: ../../library/datetime.rst:962 msgid "Equivalent to::" msgstr "" +#: ../../library/datetime.rst:964 msgid "datetime.fromtimestamp(time.time())" msgstr "" +#: ../../library/datetime.rst:966 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "" -msgid "This method is functionally equivalent to :meth:`now`, but without a ``tz`` parameter." +#: ../../library/datetime.rst:968 +msgid "" +"This method is functionally equivalent to :meth:`now`, but without a ``tz`` " +"parameter." msgstr "" +#: ../../library/datetime.rst:974 msgid "Return the current local date and time." msgstr "" -msgid "If optional argument *tz* is ``None`` or not specified, this is like :meth:`today`, but, if possible, supplies more precision than can be gotten from going through a :func:`time.time` timestamp (for example, this may be possible on platforms supplying the C :c:func:`gettimeofday` function)." +#: ../../library/datetime.rst:976 +msgid "" +"If optional argument *tz* is ``None`` or not specified, this is " +"like :meth:`today`, but, if possible, supplies more precision than can be " +"gotten from going through a :func:`time.time` timestamp (for example, this " +"may be possible on platforms supplying the C :c:func:`gettimeofday` " +"function)." msgstr "" -msgid "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` subclass, and the current date and time are converted to *tz*’s time zone." +#: ../../library/datetime.rst:982 +msgid "" +"If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " +"subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" +#: ../../library/datetime.rst:985 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -msgid "Subsequent calls to :meth:`!datetime.now` may return the same instant depending on the precision of the underlying clock." +#: ../../library/datetime.rst:989 +msgid "" +"Subsequent calls to :meth:`!datetime.now` may return the same instant " +"depending on the precision of the underlying clock." msgstr "" +#: ../../library/datetime.rst:995 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -msgid "This is like :meth:`now`, but returns the current UTC date and time, as a naive :class:`.datetime` object. An aware current UTC datetime can be obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." +#: ../../library/datetime.rst:997 +msgid "" +"This is like :meth:`now`, but returns the current UTC date and time, as a " +"naive :class:`.datetime` object. An aware current UTC datetime can be " +"obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -msgid "Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling ``datetime.now(timezone.utc)``." +#: ../../library/datetime.rst:1003 +msgid "" +"Because naive ``datetime`` objects are treated by many ``datetime`` methods " +"as local times, it is preferred to use aware datetimes to represent times in " +"UTC. As such, the recommended way to create an object representing the " +"current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" +#: ../../library/datetime.rst:1010 msgid "Use :meth:`datetime.now` with :const:`UTC` instead." msgstr "" -msgid "Return the local date and time corresponding to the POSIX timestamp, such as is returned by :func:`time.time`. If optional argument *tz* is ``None`` or not specified, the timestamp is converted to the platform's local date and time, and the returned :class:`.datetime` object is naive." -msgstr "" - -msgid "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` subclass, and the timestamp is converted to *tz*’s time zone." +#: ../../library/datetime.rst:1015 +msgid "" +"Return the local date and time corresponding to the POSIX timestamp, such as " +"is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " +"not specified, the timestamp is converted to the platform's local date and " +"time, and the returned :class:`.datetime` object is naive." msgstr "" -msgid ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is out of the range of values supported by the platform C :c:func:`localtime` or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :c:func:`gmtime` failure. It's common for this to be restricted to years in 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by :meth:`fromtimestamp`, and then it's possible to have two timestamps differing by a second that yield identical :class:`.datetime` objects. This method is preferred over :meth:`utcfromtimestamp`." +#: ../../library/datetime.rst:1020 +msgid "" +"If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " +"subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -msgid "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is out of the range of values supported by the platform C :c:func:`localtime` or :c:func:`gmtime` functions. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." +#: ../../library/datetime.rst:1023 +msgid "" +":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " +"out of the range of values supported by the platform C :c:func:`localtime` " +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " +"or :c:func:`gmtime` failure. It's common for this to be restricted to years " +"in 1970 through 2038. Note that on non-POSIX systems that include leap " +"seconds in their notion of a timestamp, leap seconds are ignored " +"by :meth:`fromtimestamp`, and then it's possible to have two timestamps " +"differing by a second that yield identical :class:`.datetime` objects. This " +"method is preferred over :meth:`utcfromtimestamp`." +msgstr "" + +#: ../../library/datetime.rst:1034 +msgid "" +"Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " +"out of the range of values supported by the platform C :c:func:`localtime` " +"or :c:func:`gmtime` functions. Raise :exc:`OSError` instead " +"of :exc:`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" +#: ../../library/datetime.rst:1041 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -msgid "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" +#: ../../library/datetime.rst:1046 +msgid "" +"Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " +"with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -msgid "This may raise :exc:`OverflowError`, if the timestamp is out of the range of values supported by the platform C :c:func:`gmtime` function, and :exc:`OSError` on :c:func:`gmtime` failure. It's common for this to be restricted to years in 1970 through 2038." +#: ../../library/datetime.rst:1049 +msgid "" +"This may raise :exc:`OverflowError`, if the timestamp is out of the range of " +"values supported by the platform C :c:func:`gmtime` function, " +"and :exc:`OSError` on :c:func:`gmtime` failure. It's common for this to be " +"restricted to years in 1970 through 2038." msgstr "" +#: ../../library/datetime.rst:1054 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" +#: ../../library/datetime.rst:1056 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "" -msgid "On the POSIX compliant platforms, it is equivalent to the following expression::" +#: ../../library/datetime.rst:1058 +msgid "" +"On the POSIX compliant platforms, it is equivalent to the following " +"expression::" msgstr "" -msgid "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" +#: ../../library/datetime.rst:1061 +msgid "" +"datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" -msgid "except the latter formula always supports the full years range: between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." +#: ../../library/datetime.rst:1063 +msgid "" +"except the latter formula always supports the full years range: " +"between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -msgid "Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing a specific timestamp in UTC is by calling ``datetime.fromtimestamp(timestamp, tz=timezone.utc)``." +#: ../../library/datetime.rst:1068 +msgid "" +"Because naive ``datetime`` objects are treated by many ``datetime`` methods " +"as local times, it is preferred to use aware datetimes to represent times in " +"UTC. As such, the recommended way to create an object representing a " +"specific timestamp in UTC is by calling ``datetime.fromtimestamp(timestamp, " +"tz=timezone.utc)``." msgstr "" -msgid "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is out of the range of values supported by the platform C :c:func:`gmtime` function. Raise :exc:`OSError` instead of :exc:`ValueError` on :c:func:`gmtime` failure." +#: ../../library/datetime.rst:1074 +msgid "" +"Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " +"out of the range of values supported by the platform C :c:func:`gmtime` " +"function. Raise :exc:`OSError` instead of :exc:`ValueError` " +"on :c:func:`gmtime` failure." msgstr "" +#: ../../library/datetime.rst:1080 msgid "Accepts any real number as *timestamp*, not only integer or float." msgstr "" +#: ../../library/datetime.rst:1085 msgid "Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead." msgstr "" -msgid "Return the :class:`.datetime` corresponding to the proleptic Gregorian ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is raised unless ``1 <= ordinal <= datetime.max.toordinal()``. The hour, minute, second and microsecond of the result are all 0, and :attr:`.tzinfo` is ``None``." +#: ../../library/datetime.rst:1090 +msgid "" +"Return the :class:`.datetime` corresponding to the proleptic Gregorian " +"ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " +"raised unless ``1 <= ordinal <= datetime.max.toordinal()``. The hour, " +"minute, second and microsecond of the result are all 0, and :attr:`.tzinfo` " +"is ``None``." msgstr "" -msgid "Return a new :class:`.datetime` object whose date components are equal to the given :class:`date` object's, and whose time components are equal to the given :class:`.time` object's. If the *tzinfo* argument is provided, its value is used to set the :attr:`.tzinfo` attribute of the result, otherwise the :attr:`~.time.tzinfo` attribute of the *time* argument is used. If the *date* argument is a :class:`!datetime` object, its time components and :attr:`.tzinfo` attributes are ignored." +#: ../../library/datetime.rst:1098 +msgid "" +"Return a new :class:`.datetime` object whose date components are equal to " +"the given :class:`date` object's, and whose time components are equal to the " +"given :class:`.time` object's. If the *tzinfo* argument is provided, its " +"value is used to set the :attr:`.tzinfo` attribute of the result, otherwise " +"the :attr:`~.time.tzinfo` attribute of the *time* argument is used. If the " +"*date* argument is a :class:`!datetime` object, its time components " +"and :attr:`.tzinfo` attributes are ignored." msgstr "" -msgid "For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), d.time(), d.tzinfo)``." +#: ../../library/datetime.rst:1106 +msgid "" +"For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), " +"d.time(), d.tzinfo)``." msgstr "" +#: ../../library/datetime.rst:1109 msgid "Added the *tzinfo* argument." msgstr "" -msgid "Return a :class:`.datetime` corresponding to a *date_string* in any valid ISO 8601 format, with the following exceptions:" +#: ../../library/datetime.rst:1115 +msgid "" +"Return a :class:`.datetime` corresponding to a *date_string* in any valid " +"ISO 8601 format, with the following exceptions:" msgstr "" +#: ../../library/datetime.rst:1118 ../../library/datetime.rst:1937 msgid "Time zone offsets may have fractional seconds." msgstr "" +#: ../../library/datetime.rst:1119 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" +#: ../../library/datetime.rst:1120 ../../library/datetime.rst:1942 msgid "Fractional hours and minutes are not supported." msgstr "" +#: ../../library/datetime.rst:1129 msgid "" ">>> import datetime as dt\n" ">>> dt.datetime.fromisoformat('2011-11-04')\n" @@ -1023,170 +1651,341 @@ msgid "" ">>> dt.datetime.fromisoformat('2011-11-04 00:05:23.283')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)\n" ">>> dt.datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" -"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone.utc)\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, " +"tzinfo=datetime.timezone.utc)\n" ">>> dt.datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" msgstr "" -msgid "Previously, this method only supported formats that could be emitted by :meth:`date.isoformat` or :meth:`datetime.isoformat`." +#: ../../library/datetime.rst:1151 +msgid "" +"Previously, this method only supported formats that could be emitted " +"by :meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -msgid "Return a :class:`.datetime` corresponding to the ISO calendar date specified by *year*, *week* and *day*. The non-date components of the datetime are populated with their normal default values. This is the inverse of the function :meth:`datetime.isocalendar`." +#: ../../library/datetime.rst:1158 +msgid "" +"Return a :class:`.datetime` corresponding to the ISO calendar date specified " +"by *year*, *week* and *day*. The non-date components of the datetime are " +"populated with their normal default values. This is the inverse of the " +"function :meth:`datetime.isocalendar`." msgstr "" -msgid "Return a :class:`.datetime` corresponding to *date_string*, parsed according to *format*." +#: ../../library/datetime.rst:1168 +msgid "" +"Return a :class:`.datetime` corresponding to *date_string*, parsed according " +"to *format*." msgstr "" -msgid "If *format* does not contain microseconds or time zone information, this is equivalent to::" +#: ../../library/datetime.rst:1171 +msgid "" +"If *format* does not contain microseconds or time zone information, this is " +"equivalent to::" msgstr "" +#: ../../library/datetime.rst:1173 ../../library/datetime.rst:2730 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "" -msgid ":exc:`ValueError` is raised if the date_string and format can't be parsed by :func:`time.strptime` or if it returns a value which isn't a time tuple. See also :ref:`strftime-strptime-behavior` and :meth:`datetime.fromisoformat`." +#: ../../library/datetime.rst:1175 +msgid "" +":exc:`ValueError` is raised if the date_string and format can't be parsed " +"by :func:`time.strptime` or if it returns a value which isn't a time tuple. " +"See also :ref:`strftime-strptime-behavior` " +"and :meth:`datetime.fromisoformat`." msgstr "" -msgid "If *format* specifies a day of month without a year a :exc:`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap year bug in code seeking to parse only a month and day as the default year used in absence of one in the format is not a leap year. Such *format* values may raise an error as of Python 3.15. The workaround is to always include a year in your *format*. If parsing *date_string* values that do not have a year, explicitly add a year that is a leap year before parsing:" +#: ../../library/datetime.rst:1182 +msgid "" +"If *format* specifies a day of month without a year " +"a :exc:`DeprecationWarning` is now emitted. This is to avoid a quadrennial " +"leap year bug in code seeking to parse only a month and day as the default " +"year used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" +#: ../../library/datetime.rst:1191 msgid "" ">>> import datetime as dt\n" ">>> date_string = \"02/29\"\n" -">>> when = dt.datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # Avoids leap year bug.\n" +">>> when = dt.datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " +"Avoids leap year bug.\n" ">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" -msgid "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, tzinfo=None)``." +#: ../../library/datetime.rst:1204 +msgid "" +"The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " +"tzinfo=None)``." msgstr "" -msgid "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzinfo=None)``." +#: ../../library/datetime.rst:1210 +msgid "" +"The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " +"59, 59, 999999, tzinfo=None)``." msgstr "" -msgid "The smallest possible difference between non-equal :class:`.datetime` objects, ``timedelta(microseconds=1)``." +#: ../../library/datetime.rst:1216 +msgid "" +"The smallest possible difference between non-equal :class:`.datetime` " +"objects, ``timedelta(microseconds=1)``." msgstr "" +#: ../../library/datetime.rst:1239 ../../library/datetime.rst:1869 msgid "In ``range(24)``." msgstr "" +#: ../../library/datetime.rst:1244 ../../library/datetime.rst:1249 +#: ../../library/datetime.rst:1874 ../../library/datetime.rst:1879 msgid "In ``range(60)``." msgstr "" +#: ../../library/datetime.rst:1254 ../../library/datetime.rst:1884 msgid "In ``range(1000000)``." msgstr "" -msgid "The object passed as the *tzinfo* argument to the :class:`.datetime` constructor, or ``None`` if none was passed." +#: ../../library/datetime.rst:1259 +msgid "" +"The object passed as the *tzinfo* argument to the :class:`.datetime` " +"constructor, or ``None`` if none was passed." msgstr "" -msgid "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. (A repeated interval occurs when clocks are rolled back at the end of daylight saving time or when the UTC offset for the current zone is decreased for political reasons.) The values 0 and 1 represent, respectively, the earlier and later of the two moments with the same wall time representation." +#: ../../library/datetime.rst:1265 ../../library/datetime.rst:1895 +msgid "" +"In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " +"(A repeated interval occurs when clocks are rolled back at the end of " +"daylight saving time or when the UTC offset for the current zone is " +"decreased for political reasons.) The values 0 and 1 represent, " +"respectively, the earlier and later of the two moments with the same wall " +"time representation." msgstr "" +#: ../../library/datetime.rst:1279 msgid "``datetime2 = datetime1 + timedelta``" msgstr "" +#: ../../library/datetime.rst:1279 ../../library/datetime.rst:2538 +#: ../../library/datetime.rst:2543 ../../library/datetime.rst:2555 +#: ../../library/datetime.rst:2560 ../../library/datetime.rst:2620 +#: ../../library/datetime.rst:2625 ../../library/datetime.rst:2629 msgid "\\(1)" msgstr "" +#: ../../library/datetime.rst:1281 msgid "``datetime2 = datetime1 - timedelta``" msgstr "" +#: ../../library/datetime.rst:1281 ../../library/datetime.rst:2571 msgid "\\(2)" msgstr "" +#: ../../library/datetime.rst:1283 msgid "``timedelta = datetime1 - datetime2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``datetime1 == datetime2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``datetime1 != datetime2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``datetime1 < datetime2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``datetime1 > datetime2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``datetime1 <= datetime2``" msgstr "" +#: ../../library/datetime.rst:0 msgid "``datetime1 >= datetime2``" msgstr "" -msgid "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta.days < 0``. The result has the same :attr:`~.datetime.tzinfo` attribute as the input datetime, and ``datetime2 - datetime1 == timedelta`` after. :exc:`OverflowError` is raised if ``datetime2.year`` would be smaller than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time zone adjustments are done even if the input is an aware object." +#: ../../library/datetime.rst:1295 +msgid "" +"``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " +"moving forward in time if ``timedelta.days > 0``, or backward if " +"``timedelta.days < 0``. The result has the same :attr:`~.datetime.tzinfo` " +"attribute as the input datetime, and ``datetime2 - datetime1 == timedelta`` " +"after. :exc:`OverflowError` is raised if ``datetime2.year`` would be smaller " +"than :const:`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time " +"zone adjustments are done even if the input is an aware object." msgstr "" -msgid "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute as the input datetime, and no time zone adjustments are done even if the input is aware." +#: ../../library/datetime.rst:1304 +msgid "" +"Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " +"As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " +"as the input datetime, and no time zone adjustments are done even if the " +"input is aware." msgstr "" -msgid "Subtraction of a :class:`.datetime` from a :class:`!datetime` is defined only if both operands are naive, or if both are aware. If one is aware and the other is naive, :exc:`TypeError` is raised." +#: ../../library/datetime.rst:1309 +msgid "" +"Subtraction of a :class:`.datetime` from a :class:`!datetime` is defined " +"only if both operands are naive, or if both are aware. If one is aware and " +"the other is naive, :exc:`TypeError` is raised." msgstr "" -msgid "If both are naive, or both are aware and have the same :attr:`~.datetime.tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and the result is a :class:`timedelta` object ``t`` such that ``datetime2 + t == datetime1``. No time zone adjustments are done in this case." +#: ../../library/datetime.rst:1313 +msgid "" +"If both are naive, or both are aware and have the " +"same :attr:`~.datetime.tzinfo` attribute, the :attr:`~.datetime.tzinfo` " +"attributes are ignored, and the result is a :class:`timedelta` object ``t`` " +"such that ``datetime2 + t == datetime1``. No time zone adjustments are done " +"in this case." msgstr "" -msgid "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, ``a-b`` acts as if ``a`` and ``b`` were first converted to naive UTC datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) - b.utcoffset())`` except that the implementation never overflows." +#: ../../library/datetime.rst:1318 +msgid "" +"If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " +"``a-b`` acts as if ``a`` and ``b`` were first converted to naive UTC " +"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - " +"(b.replace(tzinfo=None) - b.utcoffset())`` except that the implementation " +"never overflows." msgstr "" -msgid ":class:`.datetime` objects are equal if they represent the same date and time, taking into account the time zone." +#: ../../library/datetime.rst:1324 +msgid "" +":class:`.datetime` objects are equal if they represent the same date and " +"time, taking into account the time zone." msgstr "" +#: ../../library/datetime.rst:1327 msgid "Naive and aware :class:`.datetime` objects are never equal." msgstr "" -msgid "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and the base datetimes are compared. If both comparands are aware and have different :attr:`~.datetime.tzinfo` attributes, the comparison acts as comparands were first converted to UTC datetimes except that the implementation never overflows. :class:`.datetime` instances in a repeated interval are never equal to :class:`!datetime` instances in other time zone." +#: ../../library/datetime.rst:1329 +msgid "" +"If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " +"the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " +"the base datetimes are compared. If both comparands are aware and have " +"different :attr:`~.datetime.tzinfo` attributes, the comparison acts as " +"comparands were first converted to UTC datetimes except that the " +"implementation never overflows. :class:`.datetime` instances in a repeated " +"interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -msgid "*datetime1* is considered less than *datetime2* when *datetime1* precedes *datetime2* in time, taking into account the time zone." +#: ../../library/datetime.rst:1339 +msgid "" +"*datetime1* is considered less than *datetime2* when *datetime1* precedes " +"*datetime2* in time, taking into account the time zone." msgstr "" -msgid "Order comparison between naive and aware :class:`.datetime` objects raises :exc:`TypeError`." +#: ../../library/datetime.rst:1342 +msgid "" +"Order comparison between naive and aware :class:`.datetime` objects " +"raises :exc:`TypeError`." msgstr "" -msgid "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and the base datetimes are compared. If both comparands are aware and have different :attr:`~.datetime.tzinfo` attributes, the comparison acts as comparands were first converted to UTC datetimes except that the implementation never overflows." +#: ../../library/datetime.rst:1345 +msgid "" +"If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " +"the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " +"the base datetimes are compared. If both comparands are aware and have " +"different :attr:`~.datetime.tzinfo` attributes, the comparison acts as " +"comparands were first converted to UTC datetimes except that the " +"implementation never overflows." msgstr "" -msgid "Equality comparisons between aware and naive :class:`.datetime` instances don't raise :exc:`TypeError`." +#: ../../library/datetime.rst:1352 +msgid "" +"Equality comparisons between aware and naive :class:`.datetime` instances " +"don't raise :exc:`TypeError`." msgstr "" +#: ../../library/datetime.rst:1369 msgid "Return :class:`date` object with same year, month and day." msgstr "" -msgid "Return :class:`.time` object with same hour, minute, second, microsecond and fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." +#: ../../library/datetime.rst:1374 +msgid "" +"Return :class:`.time` object with same hour, minute, second, microsecond and " +"fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" +#: ../../library/datetime.rst:1377 ../../library/datetime.rst:1386 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -msgid "Return :class:`.time` object with same hour, minute, second, microsecond, fold, and tzinfo attributes. See also method :meth:`time`." +#: ../../library/datetime.rst:1383 +msgid "" +"Return :class:`.time` object with same hour, minute, second, microsecond, " +"fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -msgid "Return a new :class:`datetime` object with the same attributes, but with specified parameters updated. Note that ``tzinfo=None`` can be specified to create a naive datetime from an aware datetime with no conversion of date and time data." +#: ../../library/datetime.rst:1394 +msgid "" +"Return a new :class:`datetime` object with the same attributes, but with " +"specified parameters updated. Note that ``tzinfo=None`` can be specified to " +"create a naive datetime from an aware datetime with no conversion of date " +"and time data." msgstr "" -msgid ":class:`.datetime` objects are also supported by generic function :func:`copy.replace`." +#: ../../library/datetime.rst:1399 +msgid "" +":class:`.datetime` objects are also supported by generic " +"function :func:`copy.replace`." msgstr "" -msgid "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, adjusting the date and time data so the result is the same UTC time as *self*, but in *tz*'s local time." +#: ../../library/datetime.rst:1408 +msgid "" +"Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " +"adjusting the date and time data so the result is the same UTC time as " +"*self*, but in *tz*'s local time." msgstr "" -msgid "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If *self* is naive, it is presumed to represent time in the system time zone." +#: ../../library/datetime.rst:1412 +msgid "" +"If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " +"its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " +"*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -msgid "If called without arguments (or with ``tz=None``) the system local time zone is assumed for the target time zone. The ``.tzinfo`` attribute of the converted datetime instance will be set to an instance of :class:`timezone` with the zone name and offset obtained from the OS." +#: ../../library/datetime.rst:1416 +msgid "" +"If called without arguments (or with ``tz=None``) the system local time zone " +"is assumed for the target time zone. The ``.tzinfo`` attribute of the " +"converted datetime instance will be set to an instance of :class:`timezone` " +"with the zone name and offset obtained from the OS." msgstr "" -msgid "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no adjustment of date or time data is performed. Else the result is local time in the time zone *tz*, representing the same UTC time as *self*: after ``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will have the same date and time data as ``dt - dt.utcoffset()``." +#: ../../library/datetime.rst:1421 +msgid "" +"If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " +"adjustment of date or time data is performed. Else the result is local time " +"in the time zone *tz*, representing the same UTC time as *self*: after " +"``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will have the same " +"date and time data as ``dt - dt.utcoffset()``." msgstr "" -msgid "If you merely want to attach a :class:`timezone` object *tz* to a datetime *dt* without adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If you merely want to remove the :class:`!timezone` object from an aware datetime *dt* without conversion of date and time data, use ``dt.replace(tzinfo=None)``." +#: ../../library/datetime.rst:1427 +msgid "" +"If you merely want to attach a :class:`timezone` object *tz* to a datetime " +"*dt* without adjustment of date and time data, use " +"``dt.replace(tzinfo=tz)``. If you merely want to remove the :class:`!" +"timezone` object from an aware datetime *dt* without conversion of date and " +"time data, use ``dt.replace(tzinfo=None)``." msgstr "" -msgid "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. Ignoring error cases, :meth:`astimezone` acts like::" +#: ../../library/datetime.rst:1432 +msgid "" +"Note that the default :meth:`tzinfo.fromutc` method can be overridden in " +"a :class:`tzinfo` subclass to affect the result returned " +"by :meth:`astimezone`. Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" +#: ../../library/datetime.rst:1436 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -1197,102 +1996,202 @@ msgid "" " return tz.fromutc(utc)" msgstr "" +#: ../../library/datetime.rst:1444 msgid "*tz* now can be omitted." msgstr "" -msgid "The :meth:`astimezone` method can now be called on naive instances that are presumed to represent system local time." +#: ../../library/datetime.rst:1447 +msgid "" +"The :meth:`astimezone` method can now be called on naive instances that are " +"presumed to represent system local time." msgstr "" -msgid "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo.utcoffset(self)``, and raises an exception if the latter doesn't return ``None`` or a :class:`timedelta` object with magnitude less than one day." +#: ../../library/datetime.rst:1454 +msgid "" +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.utcoffset(self)``, and raises an exception if the latter " +"doesn't return ``None`` or a :class:`timedelta` object with magnitude less " +"than one day." msgstr "" +#: ../../library/datetime.rst:1458 ../../library/datetime.rst:2076 +#: ../../library/datetime.rst:2185 ../../library/datetime.rst:2438 +#: ../../library/datetime.rst:2450 ../../library/datetime.rst:2803 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -msgid "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo.dst(self)``, and raises an exception if the latter doesn't return ``None`` or a :class:`timedelta` object with magnitude less than one day." +#: ../../library/datetime.rst:1464 +msgid "" +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.dst(self)``, and raises an exception if the latter doesn't " +"return ``None`` or a :class:`timedelta` object with magnitude less than one " +"day." msgstr "" +#: ../../library/datetime.rst:1468 ../../library/datetime.rst:2086 +#: ../../library/datetime.rst:2243 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -msgid "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo.tzname(self)``, raises an exception if the latter doesn't return ``None`` or a string object," +#: ../../library/datetime.rst:1474 +msgid "" +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.tzname(self)``, raises an exception if the latter doesn't " +"return ``None`` or a string object," msgstr "" +#: ../../library/datetime.rst:1485 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" msgstr "" -msgid "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the day number within the current year starting with 1 for January 1st. The :attr:`~time.struct_time.tm_isdst` flag of the result is set according to the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` returns ``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` returns a non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!tm_isdst` is set to 0." +#: ../../library/datetime.rst:1489 +msgid "" +"where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " +"day number within the current year starting with 1 for January 1st. " +"The :attr:`~time.struct_time.tm_isdst` flag of the result is set according " +"to the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` " +"returns ``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` " +"returns a non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!" +"tm_isdst` is set to 0." msgstr "" -msgid "If :class:`.datetime` instance ``d`` is naive, this is the same as ``d.timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 regardless of what ``d.dst()`` returns. DST is never in effect for a UTC time." +#: ../../library/datetime.rst:1500 +msgid "" +"If :class:`.datetime` instance ``d`` is naive, this is the same as " +"``d.timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced " +"to 0 regardless of what ``d.dst()`` returns. DST is never in effect for a " +"UTC time." msgstr "" -msgid "If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting ``d.utcoffset()``, and a :class:`time.struct_time` for the normalized time is returned. :attr:`!tm_isdst` is forced to 0. Note that an :exc:`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or ``MAXYEAR`` and UTC adjustment spills over a year boundary." +#: ../../library/datetime.rst:1504 +msgid "" +"If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting " +"``d.utcoffset()``, and a :class:`time.struct_time` for the normalized time " +"is returned. :attr:`!tm_isdst` is forced to 0. Note that " +"an :exc:`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or " +"``MAXYEAR`` and UTC adjustment spills over a year boundary." msgstr "" -msgid "Because naive ``datetime`` objects are treated by many ``datetime`` methods as local times, it is preferred to use aware datetimes to represent times in UTC; as a result, using :meth:`datetime.utctimetuple` may give misleading results. If you have a naive ``datetime`` representing UTC, use ``datetime.replace(tzinfo=timezone.utc)`` to make it aware, at which point you can use :meth:`.datetime.timetuple`." +#: ../../library/datetime.rst:1513 +msgid "" +"Because naive ``datetime`` objects are treated by many ``datetime`` methods " +"as local times, it is preferred to use aware datetimes to represent times in " +"UTC; as a result, using :meth:`datetime.utctimetuple` may give misleading " +"results. If you have a naive ``datetime`` representing UTC, use " +"``datetime.replace(tzinfo=timezone.utc)`` to make it aware, at which point " +"you can use :meth:`.datetime.timetuple`." msgstr "" -msgid "Return the proleptic Gregorian ordinal of the date. The same as ``self.date().toordinal()``." +#: ../../library/datetime.rst:1523 +msgid "" +"Return the proleptic Gregorian ordinal of the date. The same as " +"``self.date().toordinal()``." msgstr "" -msgid "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The return value is a :class:`float` similar to that returned by :func:`time.time`." +#: ../../library/datetime.rst:1529 +msgid "" +"Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " +"return value is a :class:`float` similar to that returned " +"by :func:`time.time`." msgstr "" -msgid "Naive :class:`.datetime` instances are assumed to represent local time and this method relies on the platform C :c:func:`mktime` function to perform the conversion. Since :class:`!datetime` supports wider range of values than :c:func:`mktime` on many platforms, this method may raise :exc:`OverflowError` or :exc:`OSError` for times far in the past or far in the future." +#: ../../library/datetime.rst:1533 +msgid "" +"Naive :class:`.datetime` instances are assumed to represent local time and " +"this method relies on the platform C :c:func:`mktime` function to perform " +"the conversion. Since :class:`!datetime` supports wider range of values " +"than :c:func:`mktime` on many platforms, this method may " +"raise :exc:`OverflowError` or :exc:`OSError` for times far in the past or " +"far in the future." msgstr "" -msgid "For aware :class:`.datetime` instances, the return value is computed as::" +#: ../../library/datetime.rst:1540 +msgid "" +"For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" +#: ../../library/datetime.rst:1543 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "" -msgid "There is no method to obtain the POSIX timestamp directly from a naive :class:`.datetime` instance representing UTC time. If your application uses this convention and your system time zone is not set to UTC, you can obtain the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" +#: ../../library/datetime.rst:1547 +msgid "" +"There is no method to obtain the POSIX timestamp directly from a " +"naive :class:`.datetime` instance representing UTC time. If your application " +"uses this convention and your system time zone is not set to UTC, you can " +"obtain the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" +#: ../../library/datetime.rst:1553 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "" +#: ../../library/datetime.rst:1555 msgid "or by calculating the timestamp directly::" msgstr "" +#: ../../library/datetime.rst:1557 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "" -msgid "The :meth:`timestamp` method uses the :attr:`.fold` attribute to disambiguate the times during a repeated interval." +#: ../../library/datetime.rst:1561 +msgid "" +"The :meth:`timestamp` method uses the :attr:`.fold` attribute to " +"disambiguate the times during a repeated interval." msgstr "" -msgid "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. The same as ``self.date().weekday()``. See also :meth:`isoweekday`." +#: ../../library/datetime.rst:1568 +msgid "" +"Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " +"The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -msgid "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:`isocalendar`." +#: ../../library/datetime.rst:1574 +msgid "" +"Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " +"The same as ``self.date().isoweekday()``. See " +"also :meth:`weekday`, :meth:`isocalendar`." msgstr "" -msgid "Return a :term:`named tuple` with three components: ``year``, ``week`` and ``weekday``. The same as ``self.date().isocalendar()``." +#: ../../library/datetime.rst:1581 +msgid "" +"Return a :term:`named tuple` with three components: ``year``, ``week`` and " +"``weekday``. The same as ``self.date().isocalendar()``." msgstr "" +#: ../../library/datetime.rst:1587 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" +#: ../../library/datetime.rst:1589 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" +#: ../../library/datetime.rst:1590 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -msgid "If :meth:`utcoffset` does not return ``None``, a string is appended, giving the UTC offset:" +#: ../../library/datetime.rst:1592 +msgid "" +"If :meth:`utcoffset` does not return ``None``, a string is appended, giving " +"the UTC offset:" msgstr "" -msgid "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is not 0" +#: ../../library/datetime.rst:1595 +msgid "" +"``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " +"is not 0" msgstr "" -msgid "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" +#: ../../library/datetime.rst:1597 +msgid "" +"``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" +#: ../../library/datetime.rst:1601 msgid "" ">>> import datetime as dt\n" ">>> dt.datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -1301,9 +2200,13 @@ msgid "" "'2019-05-18T15:17:00+00:00'" msgstr "" -msgid "The optional argument *sep* (default ``'T'``) is a one-character separator, placed between the date and time portions of the result. For example::" +#: ../../library/datetime.rst:1607 +msgid "" +"The optional argument *sep* (default ``'T'``) is a one-character separator, " +"placed between the date and time portions of the result. For example::" msgstr "" +#: ../../library/datetime.rst:1610 msgid "" ">>> import datetime as dt\n" ">>> class TZ(dt.tzinfo):\n" @@ -1317,33 +2220,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -msgid "The optional argument *timespec* specifies the number of additional components of the time to include (the default is ``'auto'``). It can be one of the following:" +#: ../../library/datetime.rst:1621 ../../library/datetime.rst:2016 +msgid "" +"The optional argument *timespec* specifies the number of additional " +"components of the time to include (the default is ``'auto'``). It can be one " +"of the following:" msgstr "" -msgid "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as ``'microseconds'`` otherwise." +#: ../../library/datetime.rst:1625 ../../library/datetime.rst:2020 +msgid "" +"``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " +"``'microseconds'`` otherwise." msgstr "" +#: ../../library/datetime.rst:1627 ../../library/datetime.rst:2022 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -msgid "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." +#: ../../library/datetime.rst:1628 ../../library/datetime.rst:2023 +msgid "" +"``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -msgid "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in ``HH:MM:SS`` format." +#: ../../library/datetime.rst:1629 ../../library/datetime.rst:2024 +msgid "" +"``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " +"``HH:MM:SS`` format." msgstr "" -msgid "``'milliseconds'``: Include full time, but truncate fractional second part to milliseconds. ``HH:MM:SS.sss`` format." +#: ../../library/datetime.rst:1631 ../../library/datetime.rst:2026 +msgid "" +"``'milliseconds'``: Include full time, but truncate fractional second part " +"to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" +#: ../../library/datetime.rst:1633 ../../library/datetime.rst:2028 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" +#: ../../library/datetime.rst:1637 ../../library/datetime.rst:2032 msgid "Excluded time components are truncated, not rounded." msgstr "" +#: ../../library/datetime.rst:1639 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" +#: ../../library/datetime.rst:1642 msgid "" ">>> import datetime as dt\n" ">>> dt.datetime.now().isoformat(timespec='minutes')\n" @@ -1353,39 +2276,64 @@ msgid "" "'2015-01-01T12:30:59.000000'" msgstr "" +#: ../../library/datetime.rst:1649 ../../library/datetime.rst:2047 msgid "Added the *timespec* parameter." msgstr "" -msgid "For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to ``d.isoformat(' ')``." +#: ../../library/datetime.rst:1655 +msgid "" +"For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to " +"``d.isoformat(' ')``." msgstr "" +#: ../../library/datetime.rst:1661 msgid "Return a string representing the date and time::" msgstr "" +#: ../../library/datetime.rst:1663 msgid "" ">>> import datetime as dt\n" ">>> dt.datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" msgstr "" -msgid "The output string will *not* include time zone information, regardless of whether the input is aware or naive." +#: ../../library/datetime.rst:1667 +msgid "" +"The output string will *not* include time zone information, regardless of " +"whether the input is aware or naive." msgstr "" -msgid "on platforms where the native C :c:func:`ctime` function (which :func:`time.ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms to the C standard." +#: ../../library/datetime.rst:1674 +msgid "" +"on platforms where the native C :c:func:`ctime` function " +"(which :func:`time.ctime` invokes, but which :meth:`datetime.ctime` does not " +"invoke) conforms to the C standard." msgstr "" -msgid "Return a string representing the date and time, controlled by an explicit format string. See also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`." +#: ../../library/datetime.rst:1681 +msgid "" +"Return a string representing the date and time, controlled by an explicit " +"format string. See also :ref:`strftime-strptime-behavior` " +"and :meth:`datetime.isoformat`." msgstr "" -msgid "Same as :meth:`.datetime.strftime`. This makes it possible to specify a format string for a :class:`.datetime` object in :ref:`formatted string literals ` and when using :meth:`str.format`. See also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`." +#: ../../library/datetime.rst:1688 +msgid "" +"Same as :meth:`.datetime.strftime`. This makes it possible to specify a " +"format string for a :class:`.datetime` object in :ref:`formatted string " +"literals ` and when using :meth:`str.format`. See " +"also :ref:`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" +#: ../../library/datetime.rst:1695 msgid "Examples of usage: :class:`!datetime`" msgstr "" +#: ../../library/datetime.rst:1697 msgid "Examples of working with :class:`.datetime` objects:" msgstr "" +#: ../../library/datetime.rst:1699 msgid "" ">>> import datetime as dt\n" "\n" @@ -1399,10 +2347,12 @@ msgid "" ">>> dt.datetime.now()\n" "datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" ">>> dt.datetime.now(dt.timezone.utc)\n" -"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone.utc)\n" +"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> # Using datetime.strptime()\n" -">>> my_datetime = dt.datetime.strptime(\"21/11/06 16:30\", \"%d/%m/%y %H:%M\")\n" +">>> my_datetime = dt.datetime.strptime(\"21/11/06 16:30\", \"%d/%m/%y %H:" +"%M\")\n" ">>> my_datetime\n" "datetime.datetime(2006, 11, 21, 16, 30)\n" "\n" @@ -1433,13 +2383,19 @@ msgid "" ">>> # Formatting a datetime\n" ">>> my_datetime.strftime(\"%A, %d. %B %Y %I:%M%p\")\n" "'Tuesday, 21. November 2006 04:30PM'\n" -">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.'.format(my_datetime, \"day\", \"month\", \"time\")\n" +">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:" +"%M%p}.'.format(my_datetime, \"day\", \"month\", \"time\")\n" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -msgid "The example below defines a :class:`tzinfo` subclass capturing time zone information for Kabul, Afghanistan, which used +4 UTC until 1945 and then +4:30 UTC thereafter::" +#: ../../library/datetime.rst:1750 +msgid "" +"The example below defines a :class:`tzinfo` subclass capturing time zone " +"information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " +"+4:30 UTC thereafter::" msgstr "" +#: ../../library/datetime.rst:1754 msgid "" "import datetime as dt\n" "\n" @@ -1450,7 +2406,8 @@ msgid "" " def utcoffset(self, when):\n" " if when.year < 1945:\n" " return dt.timedelta(hours=4)\n" -" elif (1945, 1, 1, 0, 0) <= when.timetuple()[:5] < (1945, 1, 1, 0, 30):\n" +" elif (1945, 1, 1, 0, 0) <= when.timetuple()[:5] < (1945, 1, 1, 0, " +"30):\n" " # An ambiguous (\"imaginary\") half-hour range representing\n" " # a 'fold' in time due to the shift from +4 to +4:30.\n" " # If when falls in the imaginary range, use fold to decide how\n" @@ -1485,9 +2442,11 @@ msgid "" " return \"+04\"" msgstr "" +#: ../../library/datetime.rst:1797 msgid "Usage of ``KabulTz`` from above::" msgstr "" +#: ../../library/datetime.rst:1799 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -1511,63 +2470,117 @@ msgid "" "True" msgstr "" +#: ../../library/datetime.rst:1824 msgid ":class:`!time` objects" msgstr "" -msgid "A :class:`.time` object represents a (local) time of day, independent of any particular day, and subject to adjustment via a :class:`tzinfo` object." +#: ../../library/datetime.rst:1826 +msgid "" +"A :class:`.time` object represents a (local) time of day, independent of any " +"particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -msgid "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :class:`tzinfo` subclass. The remaining arguments must be integers in the following ranges:" +#: ../../library/datetime.rst:1831 +msgid "" +"All arguments are optional. *tzinfo* may be ``None``, or an instance of " +"a :class:`tzinfo` subclass. The remaining arguments must be integers in the " +"following ranges:" msgstr "" -msgid "If an argument outside those ranges is given, :exc:`ValueError` is raised. All default to 0 except *tzinfo*, which defaults to ``None``." +#: ../../library/datetime.rst:1841 +msgid "" +"If an argument outside those ranges is given, :exc:`ValueError` is raised. " +"All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" +#: ../../library/datetime.rst:1850 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" +#: ../../library/datetime.rst:1855 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -msgid "The smallest possible difference between non-equal :class:`.time` objects, ``timedelta(microseconds=1)``, although note that arithmetic on :class:`.time` objects is not supported." +#: ../../library/datetime.rst:1860 +msgid "" +"The smallest possible difference between non-equal :class:`.time` objects, " +"``timedelta(microseconds=1)``, although note that arithmetic " +"on :class:`.time` objects is not supported." msgstr "" -msgid "The object passed as the tzinfo argument to the :class:`.time` constructor, or ``None`` if none was passed." +#: ../../library/datetime.rst:1889 +msgid "" +"The object passed as the tzinfo argument to the :class:`.time` constructor, " +"or ``None`` if none was passed." msgstr "" -msgid ":class:`.time` objects support equality and order comparisons, where ``a`` is considered less than ``b`` when ``a`` precedes ``b`` in time." +#: ../../library/datetime.rst:1904 +msgid "" +":class:`.time` objects support equality and order comparisons, where ``a`` " +"is considered less than ``b`` when ``a`` precedes ``b`` in time." msgstr "" -msgid "Naive and aware :class:`!time` objects are never equal. Order comparison between naive and aware :class:`!time` objects raises :exc:`TypeError`." +#: ../../library/datetime.rst:1907 +msgid "" +"Naive and aware :class:`!time` objects are never equal. Order comparison " +"between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -msgid "If both comparands are aware, and have the same :attr:`~.time.tzinfo` attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and the base times are compared. If both comparands are aware and have different :attr:`!tzinfo` attributes, the comparands are first adjusted by subtracting their UTC offsets (obtained from ``self.utcoffset()``)." +#: ../../library/datetime.rst:1911 +msgid "" +"If both comparands are aware, and have the same :attr:`~.time.tzinfo` " +"attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " +"the base times are compared. If both comparands are aware and have " +"different :attr:`!tzinfo` attributes, the comparands are first adjusted by " +"subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -msgid "Equality comparisons between aware and naive :class:`.time` instances don't raise :exc:`TypeError`." +#: ../../library/datetime.rst:1917 +msgid "" +"Equality comparisons between aware and naive :class:`.time` instances don't " +"raise :exc:`TypeError`." msgstr "" -msgid "In Boolean contexts, a :class:`.time` object is always considered to be true." +#: ../../library/datetime.rst:1921 +msgid "" +"In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -msgid "Before Python 3.5, a :class:`.time` object was considered to be false if it represented midnight in UTC. This behavior was considered obscure and error-prone and has been removed in Python 3.5. See :issue:`13936` for more information." +#: ../../library/datetime.rst:1923 +msgid "" +"Before Python 3.5, a :class:`.time` object was considered to be false if it " +"represented midnight in UTC. This behavior was considered obscure and error-" +"prone and has been removed in Python 3.5. See :issue:`13936` for more " +"information." msgstr "" +#: ../../library/datetime.rst:1930 msgid "Other constructors:" msgstr "" -msgid "Return a :class:`.time` corresponding to a *time_string* in any valid ISO 8601 format, with the following exceptions:" +#: ../../library/datetime.rst:1934 +msgid "" +"Return a :class:`.time` corresponding to a *time_string* in any valid ISO " +"8601 format, with the following exceptions:" msgstr "" -msgid "The leading ``T``, normally required in cases where there may be ambiguity between a date and a time, is not required." +#: ../../library/datetime.rst:1938 +msgid "" +"The leading ``T``, normally required in cases where there may be ambiguity " +"between a date and a time, is not required." msgstr "" -msgid "Fractional seconds may have any number of digits (anything beyond 6 will be truncated)." +#: ../../library/datetime.rst:1940 +msgid "" +"Fractional seconds may have any number of digits (anything beyond 6 will be " +"truncated)." msgstr "" +#: ../../library/datetime.rst:1944 msgid "Examples:" msgstr "" +#: ../../library/datetime.rst:1946 msgid "" ">>> import datetime as dt\n" ">>> dt.time.fromisoformat('04:23:01')\n" @@ -1581,55 +2594,91 @@ msgid "" ">>> dt.time.fromisoformat('04:23:01,000384')\n" "datetime.time(4, 23, 1, 384)\n" ">>> dt.time.fromisoformat('04:23:01+04:00')\n" -"datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n" +"datetime.time(4, 23, 1, " +"tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n" ">>> dt.time.fromisoformat('04:23:01Z')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n" ">>> dt.time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" msgstr "" -msgid "Previously, this method only supported formats that could be emitted by :meth:`time.isoformat`." +#: ../../library/datetime.rst:1968 +msgid "" +"Previously, this method only supported formats that could be emitted " +"by :meth:`time.isoformat`." msgstr "" -msgid "Return a :class:`.time` corresponding to *date_string*, parsed according to *format*." +#: ../../library/datetime.rst:1975 +msgid "" +"Return a :class:`.time` corresponding to *date_string*, parsed according to " +"*format*." msgstr "" -msgid "If *format* does not contain microseconds or timezone information, this is equivalent to::" +#: ../../library/datetime.rst:1978 +msgid "" +"If *format* does not contain microseconds or timezone information, this is " +"equivalent to::" msgstr "" +#: ../../library/datetime.rst:1980 msgid "time(*(time.strptime(date_string, format)[3:6]))" msgstr "" -msgid ":exc:`ValueError` is raised if the *date_string* and *format* cannot be parsed by :func:`time.strptime` or if it returns a value which is not a time tuple. See also :ref:`strftime-strptime-behavior` and :meth:`time.fromisoformat`." +#: ../../library/datetime.rst:1982 +msgid "" +":exc:`ValueError` is raised if the *date_string* and *format* cannot be " +"parsed by :func:`time.strptime` or if it returns a value which is not a time " +"tuple. See also :ref:`strftime-strptime-behavior` " +"and :meth:`time.fromisoformat`." msgstr "" -msgid "Return a new :class:`.time` with the same values, but with specified parameters updated. Note that ``tzinfo=None`` can be specified to create a naive :class:`!time` from an aware :class:`!time`, without conversion of the time data." +#: ../../library/datetime.rst:1995 +msgid "" +"Return a new :class:`.time` with the same values, but with specified " +"parameters updated. Note that ``tzinfo=None`` can be specified to create a " +"naive :class:`!time` from an aware :class:`!time`, without conversion of the " +"time data." msgstr "" -msgid ":class:`.time` objects are also supported by generic function :func:`copy.replace`." +#: ../../library/datetime.rst:2000 +msgid "" +":class:`.time` objects are also supported by generic " +"function :func:`copy.replace`." msgstr "" +#: ../../library/datetime.rst:2009 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" +#: ../../library/datetime.rst:2011 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" +#: ../../library/datetime.rst:2012 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -msgid "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not return ``None``" +#: ../../library/datetime.rst:2013 +msgid "" +"``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " +"return ``None``" msgstr "" -msgid "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:`utcoffset` does not return ``None``" +#: ../../library/datetime.rst:2014 +msgid "" +"``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 " +"and :meth:`utcoffset` does not return ``None``" msgstr "" +#: ../../library/datetime.rst:2034 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" +#: ../../library/datetime.rst:2038 msgid "" ">>> import datetime as dt\n" -">>> dt.time(hour=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes')\n" +">>> dt.time(hour=12, minute=34, second=56, " +"microsecond=123456).isoformat(timespec='minutes')\n" "'12:34'\n" ">>> my_time = dt.time(hour=12, minute=34, second=56, microsecond=0)\n" ">>> my_time.isoformat(timespec='microseconds')\n" @@ -1638,30 +2687,57 @@ msgid "" "'12:34:56'" msgstr "" +#: ../../library/datetime.rst:2053 msgid "For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -msgid "Return a string representing the time, controlled by an explicit format string. See also :ref:`strftime-strptime-behavior` and :meth:`time.isoformat`." +#: ../../library/datetime.rst:2058 +msgid "" +"Return a string representing the time, controlled by an explicit format " +"string. See also :ref:`strftime-strptime-behavior` " +"and :meth:`time.isoformat`." msgstr "" -msgid "Same as :meth:`.time.strftime`. This makes it possible to specify a format string for a :class:`.time` object in :ref:`formatted string literals ` and when using :meth:`str.format`. See also :ref:`strftime-strptime-behavior` and :meth:`time.isoformat`." +#: ../../library/datetime.rst:2064 +msgid "" +"Same as :meth:`.time.strftime`. This makes it possible to specify a format " +"string for a :class:`.time` object in :ref:`formatted string literals ` and when using :meth:`str.format`. See also :ref:`strftime-" +"strptime-behavior` and :meth:`time.isoformat`." msgstr "" -msgid "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo.utcoffset(None)``, and raises an exception if the latter doesn't return ``None`` or a :class:`timedelta` object with magnitude less than one day." +#: ../../library/datetime.rst:2072 +msgid "" +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.utcoffset(None)``, and raises an exception if the latter " +"doesn't return ``None`` or a :class:`timedelta` object with magnitude less " +"than one day." msgstr "" -msgid "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo.dst(None)``, and raises an exception if the latter doesn't return ``None``, or a :class:`timedelta` object with magnitude less than one day." +#: ../../library/datetime.rst:2082 +msgid "" +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.dst(None)``, and raises an exception if the latter doesn't " +"return ``None``, or a :class:`timedelta` object with magnitude less than one " +"day." msgstr "" -msgid "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo.tzname(None)``, or raises an exception if the latter doesn't return ``None`` or a string object." +#: ../../library/datetime.rst:2092 +msgid "" +"If :attr:`.tzinfo` is ``None``, returns ``None``, else returns " +"``self.tzinfo.tzname(None)``, or raises an exception if the latter doesn't " +"return ``None`` or a string object." msgstr "" +#: ../../library/datetime.rst:2098 msgid "Examples of usage: :class:`!time`" msgstr "" +#: ../../library/datetime.rst:2100 msgid "Examples of working with a :class:`.time` object::" msgstr "" +#: ../../library/datetime.rst:2102 msgid "" ">>> import datetime as dt\n" ">>> class TZ1(dt.tzinfo):\n" @@ -1689,59 +2765,138 @@ msgid "" "'The time is 12:10.'" msgstr "" +#: ../../library/datetime.rst:2131 msgid ":class:`!tzinfo` objects" msgstr "" -msgid "This is an :term:`abstract base class`, meaning that this class should not be instantiated directly. Define a subclass of :class:`tzinfo` to capture information about a particular time zone." +#: ../../library/datetime.rst:2135 +msgid "" +"This is an :term:`abstract base class`, meaning that this class should not " +"be instantiated directly. Define a subclass of :class:`tzinfo` to capture " +"information about a particular time zone." msgstr "" -msgid "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the constructors for :class:`.datetime` and :class:`.time` objects. The latter objects view their attributes as being in local time, and the :class:`!tzinfo` object supports methods revealing offset of local time from UTC, the name of the time zone, and DST offset, all relative to a date or time object passed to them." +#: ../../library/datetime.rst:2139 +msgid "" +"An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " +"constructors for :class:`.datetime` and :class:`.time` objects. The latter " +"objects view their attributes as being in local time, and the :class:`!" +"tzinfo` object supports methods revealing offset of local time from UTC, the " +"name of the time zone, and DST offset, all relative to a date or time object " +"passed to them." msgstr "" -msgid "You need to derive a concrete subclass, and (at least) supply implementations of the standard :class:`tzinfo` methods needed by the :class:`.datetime` methods you use. The :mod:`!datetime` module provides :class:`timezone`, a simple concrete subclass of :class:`!tzinfo` which can represent time zones with fixed offset from UTC such as UTC itself or North American EST and EDT." +#: ../../library/datetime.rst:2145 +msgid "" +"You need to derive a concrete subclass, and (at least) supply " +"implementations of the standard :class:`tzinfo` methods needed by " +"the :class:`.datetime` methods you use. The :mod:`!datetime` module " +"provides :class:`timezone`, a simple concrete subclass of :class:`!tzinfo` " +"which can represent time zones with fixed offset from UTC such as UTC itself " +"or North American EST and EDT." msgstr "" -msgid "Special requirement for pickling: A :class:`tzinfo` subclass must have an :meth:`~object.__init__` method that can be called with no arguments, otherwise it can be pickled but possibly not unpickled again. This is a technical requirement that may be relaxed in the future." +#: ../../library/datetime.rst:2152 +msgid "" +"Special requirement for pickling: A :class:`tzinfo` subclass must have " +"an :meth:`~object.__init__` method that can be called with no arguments, " +"otherwise it can be pickled but possibly not unpickled again. This is a " +"technical requirement that may be relaxed in the future." msgstr "" -msgid "A concrete subclass of :class:`tzinfo` may need to implement the following methods. Exactly which methods are needed depends on the uses made of aware :mod:`!datetime` objects. If in doubt, simply implement all of them." +#: ../../library/datetime.rst:2158 +msgid "" +"A concrete subclass of :class:`tzinfo` may need to implement the following " +"methods. Exactly which methods are needed depends on the uses made of " +"aware :mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -msgid "Return offset of local time from UTC, as a :class:`timedelta` object that is positive east of UTC. If local time is west of UTC, this should be negative." +#: ../../library/datetime.rst:2165 +msgid "" +"Return offset of local time from UTC, as a :class:`timedelta` object that is " +"positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -msgid "This represents the *total* offset from UTC; for example, if a :class:`tzinfo` object represents both time zone and DST adjustments, :meth:`utcoffset` should return their sum. If the UTC offset isn't known, return ``None``. Else the value returned must be a :class:`timedelta` object strictly between ``-timedelta(hours=24)`` and ``timedelta(hours=24)`` (the magnitude of the offset must be less than one day). Most implementations of :meth:`utcoffset` will probably look like one of these two::" +#: ../../library/datetime.rst:2168 +msgid "" +"This represents the *total* offset from UTC; for example, if " +"a :class:`tzinfo` object represents both time zone and DST " +"adjustments, :meth:`utcoffset` should return their sum. If the UTC offset " +"isn't known, return ``None``. Else the value returned must be " +"a :class:`timedelta` object strictly between ``-timedelta(hours=24)`` and " +"``timedelta(hours=24)`` (the magnitude of the offset must be less than one " +"day). Most implementations of :meth:`utcoffset` will probably look like one " +"of these two::" msgstr "" +#: ../../library/datetime.rst:2176 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -msgid "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return ``None`` either." -msgstr "" - -msgid "The default implementation of :meth:`utcoffset` raises :exc:`NotImplementedError`." +#: ../../library/datetime.rst:2179 +msgid "" +"If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " +"``None`` either." msgstr "" -msgid "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` object or ``None`` if DST information isn't known." +#: ../../library/datetime.rst:2182 +msgid "" +"The default implementation of :meth:`utcoffset` " +"raises :exc:`NotImplementedError`." msgstr "" -msgid "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return the offset as a :class:`timedelta` object (see :meth:`utcoffset` for details). Note that DST offset, if applicable, has already been added to the UTC offset returned by :meth:`utcoffset`, so there's no need to consult :meth:`dst` unless you're interested in obtaining DST info separately. For example, :meth:`datetime.timetuple` calls its :attr:`~.datetime.tzinfo` attribute's :meth:`dst` method to determine how the :attr:`~time.struct_time.tm_isdst` flag should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes when crossing time zones." +#: ../../library/datetime.rst:2191 +msgid "" +"Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " +"object or ``None`` if DST information isn't known." msgstr "" -msgid "An instance *tz* of a :class:`tzinfo` subclass that models both standard and daylight times must be consistent in this sense:" +#: ../../library/datetime.rst:2195 +msgid "" +"Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " +"the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " +"details). Note that DST offset, if applicable, has already been added to the " +"UTC offset returned by :meth:`utcoffset`, so there's no need to " +"consult :meth:`dst` unless you're interested in obtaining DST info " +"separately. For example, :meth:`datetime.timetuple` calls " +"its :attr:`~.datetime.tzinfo` attribute's :meth:`dst` method to determine " +"how the :attr:`~time.struct_time.tm_isdst` flag should be set, " +"and :meth:`tzinfo.fromutc` calls :meth:`dst` to account for DST changes when " +"crossing time zones." +msgstr "" + +#: ../../library/datetime.rst:2205 +msgid "" +"An instance *tz* of a :class:`tzinfo` subclass that models both standard and " +"daylight times must be consistent in this sense:" msgstr "" +#: ../../library/datetime.rst:2208 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "" -msgid "must return the same result for every :class:`.datetime` *dt* with ``dt.tzinfo == tz``. For sane :class:`!tzinfo` subclasses, this expression yields the time zone's \"standard offset\", which should not depend on the date or the time, but only on geographic location. The implementation of :meth:`datetime.astimezone` relies on this, but cannot detect violations; it's the programmer's responsibility to ensure it. If a :class:`!tzinfo` subclass cannot guarantee this, it may be able to override the default implementation of :meth:`tzinfo.fromutc` to work correctly with :meth:`~.datetime.astimezone` regardless." -msgstr "" - -msgid "Most implementations of :meth:`dst` will probably look like one of these two::" +#: ../../library/datetime.rst:2210 +msgid "" +"must return the same result for every :class:`.datetime` *dt* with " +"``dt.tzinfo == tz``. For sane :class:`!tzinfo` subclasses, this expression " +"yields the time zone's \"standard offset\", which should not depend on the " +"date or the time, but only on geographic location. The implementation " +"of :meth:`datetime.astimezone` relies on this, but cannot detect violations; " +"it's the programmer's responsibility to ensure it. If a :class:`!tzinfo` " +"subclass cannot guarantee this, it may be able to override the default " +"implementation of :meth:`tzinfo.fromutc` to work correctly " +"with :meth:`~.datetime.astimezone` regardless." +msgstr "" + +#: ../../library/datetime.rst:2219 +msgid "" +"Most implementations of :meth:`dst` will probably look like one of these " +"two::" msgstr "" +#: ../../library/datetime.rst:2221 msgid "" "import datetime as dt\n" "\n" @@ -1750,9 +2905,11 @@ msgid "" " return dt.timedelta(0)" msgstr "" +#: ../../library/datetime.rst:2227 msgid "or::" msgstr "" +#: ../../library/datetime.rst:2229 msgid "" "import datetime as dt\n" "\n" @@ -1767,36 +2924,97 @@ msgid "" " return dt.timedelta(0)" msgstr "" -msgid "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." -msgstr "" - -msgid "Return the time zone name corresponding to the :class:`.datetime` object *dt*, as a string. Nothing about string names is defined by the :mod:`!datetime` module, and there's no requirement that it mean anything in particular. For example, ``\"GMT\"``, ``\"UTC\"``, ``\"-500\"``, ``\"-5:00\"``, ``\"EDT\"``, ``\"US/Eastern\"``, ``\"America/New York\"`` are all valid replies. Return ``None`` if a string name isn't known. Note that this is a method rather than a fixed string primarily because some :class:`tzinfo` subclasses will wish to return different names depending on the specific value of *dt* passed, especially if the :class:`!tzinfo` class is accounting for daylight time." -msgstr "" - -msgid "The default implementation of :meth:`tzname` raises :exc:`NotImplementedError`." +#: ../../library/datetime.rst:2241 +msgid "" +"The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -msgid "These methods are called by a :class:`.datetime` or :class:`.time` object, in response to their methods of the same names. A :class:`!datetime` object passes itself as the argument, and a :class:`!time` object passes ``None`` as the argument. A :class:`tzinfo` subclass's methods should therefore be prepared to accept a *dt* argument of ``None``, or of class :class:`!datetime`." +#: ../../library/datetime.rst:2249 +msgid "" +"Return the time zone name corresponding to the :class:`.datetime` object " +"*dt*, as a string. Nothing about string names is defined by the :mod:`!" +"datetime` module, and there's no requirement that it mean anything in " +"particular. For example, ``\"GMT\"``, ``\"UTC\"``, ``\"-500\"``, " +"``\"-5:00\"``, ``\"EDT\"``, ``\"US/Eastern\"``, ``\"America/New York\"`` are " +"all valid replies. Return ``None`` if a string name isn't known. Note that " +"this is a method rather than a fixed string primarily because " +"some :class:`tzinfo` subclasses will wish to return different names " +"depending on the specific value of *dt* passed, especially if the :class:`!" +"tzinfo` class is accounting for daylight time." +msgstr "" + +#: ../../library/datetime.rst:2259 +msgid "" +"The default implementation of :meth:`tzname` " +"raises :exc:`NotImplementedError`." msgstr "" -msgid "When ``None`` is passed, it's up to the class designer to decide the best response. For example, returning ``None`` is appropriate if the class wishes to say that time objects don't participate in the :class:`tzinfo` protocols. It may be more useful for ``utcoffset(None)`` to return the standard UTC offset, as there is no other convention for discovering the standard offset." +#: ../../library/datetime.rst:2262 +msgid "" +"These methods are called by a :class:`.datetime` or :class:`.time` object, " +"in response to their methods of the same names. A :class:`!datetime` object " +"passes itself as the argument, and a :class:`!time` object passes ``None`` " +"as the argument. A :class:`tzinfo` subclass's methods should therefore be " +"prepared to accept a *dt* argument of ``None``, or of class :class:`!" +"datetime`." msgstr "" -msgid "When a :class:`.datetime` object is passed in response to a :class:`!datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:`tzinfo` methods can rely on this, unless user code calls :class:`!tzinfo` methods directly. The intent is that the :class:`!tzinfo` methods interpret *dt* as being in local time, and not need worry about objects in other time zones." +#: ../../library/datetime.rst:2268 +msgid "" +"When ``None`` is passed, it's up to the class designer to decide the best " +"response. For example, returning ``None`` is appropriate if the class wishes " +"to say that time objects don't participate in the :class:`tzinfo` protocols. " +"It may be more useful for ``utcoffset(None)`` to return the standard UTC " +"offset, as there is no other convention for discovering the standard offset." msgstr "" -msgid "There is one more :class:`tzinfo` method that a subclass may wish to override:" +#: ../../library/datetime.rst:2274 +msgid "" +"When a :class:`.datetime` object is passed in response to a :class:`!" +"datetime` method, ``dt.tzinfo`` is the same object as " +"*self*. :class:`tzinfo` methods can rely on this, unless user code " +"calls :class:`!tzinfo` methods directly. The intent is that the :class:`!" +"tzinfo` methods interpret *dt* as being in local time, and not need worry " +"about objects in other time zones." msgstr "" -msgid "This is called from the default :meth:`datetime.astimezone` implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time data are to be viewed as expressing a UTC time. The purpose of :meth:`fromutc` is to adjust the date and time data, returning an equivalent datetime in *self*'s local time." +#: ../../library/datetime.rst:2280 +msgid "" +"There is one more :class:`tzinfo` method that a subclass may wish to " +"override:" msgstr "" -msgid "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:`fromutc` implementation without problems. It's strong enough to handle fixed-offset time zones, and time zones accounting for both standard and daylight time, and the latter even if the DST transition times differ in different years. An example of a time zone the default :meth:`fromutc` implementation may not handle correctly in all cases is one where the standard offset (from UTC) depends on the specific date and time passed, which can happen for political reasons. The default implementations of :meth:`~.datetime.astimezone` and :meth:`fromutc` may not produce the result you want if the result is one of the hours straddling the moment the standard offset changes." +#: ../../library/datetime.rst:2285 +msgid "" +"This is called from the default :meth:`datetime.astimezone` implementation. " +"When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " +"data are to be viewed as expressing a UTC time. The purpose " +"of :meth:`fromutc` is to adjust the date and time data, returning an " +"equivalent datetime in *self*'s local time." msgstr "" -msgid "Skipping code for error cases, the default :meth:`fromutc` implementation acts like::" +#: ../../library/datetime.rst:2291 +msgid "" +"Most :class:`tzinfo` subclasses should be able to inherit the " +"default :meth:`fromutc` implementation without problems. It's strong enough " +"to handle fixed-offset time zones, and time zones accounting for both " +"standard and daylight time, and the latter even if the DST transition times " +"differ in different years. An example of a time zone the " +"default :meth:`fromutc` implementation may not handle correctly in all cases " +"is one where the standard offset (from UTC) depends on the specific date and " +"time passed, which can happen for political reasons. The default " +"implementations of :meth:`~.datetime.astimezone` and :meth:`fromutc` may not " +"produce the result you want if the result is one of the hours straddling the " +"moment the standard offset changes." +msgstr "" + +#: ../../library/datetime.rst:2302 +msgid "" +"Skipping code for error cases, the default :meth:`fromutc` implementation " +"acts like::" msgstr "" +#: ../../library/datetime.rst:2305 msgid "" "import datetime as dt\n" "\n" @@ -1816,9 +3034,13 @@ msgid "" " return when" msgstr "" -msgid "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples.py>` file there are some examples of :class:`tzinfo` classes:" +#: ../../library/datetime.rst:2322 +msgid "" +"In the following :download:`tzinfo_examples.py <../includes/" +"tzinfo_examples.py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" +#: ../../library/datetime.rst:2326 msgid "" "import datetime as dt\n" "\n" @@ -1908,7 +3130,8 @@ msgid "" "DSTSTART_1987_2006 = dt.datetime(1, 4, 1, 2)\n" "DSTEND_1987_2006 = dt.datetime(1, 10, 25, 2)\n" "# From 1967 to 1986, DST used to start at 2am (standard time) on the last\n" -"# Sunday in April (the one on or after April 24) and to end at 2am (DST time)\n" +"# Sunday in April (the one on or after April 24) and to end at 2am (DST " +"time)\n" "# on the last Sunday of October, which is the first Sunday\n" "# on or after Oct 25.\n" "DSTSTART_1967_1986 = dt.datetime(1, 4, 24, 2)\n" @@ -2000,9 +3223,16 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -msgid "Note that there are unavoidable subtleties twice per year in a :class:`tzinfo` subclass accounting for both standard and daylight time, at the DST transition points. For concreteness, consider US Eastern (UTC -0500), where EDT begins the minute after 1:59 (EST) on the second Sunday in March, and ends the minute after 1:59 (EDT) on the first Sunday in November::" +#: ../../library/datetime.rst:2328 +msgid "" +"Note that there are unavoidable subtleties twice per year in " +"a :class:`tzinfo` subclass accounting for both standard and daylight time, " +"at the DST transition points. For concreteness, consider US Eastern (UTC " +"-0500), where EDT begins the minute after 1:59 (EST) on the second Sunday in " +"March, and ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" +#: ../../library/datetime.rst:2334 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -2013,9 +3243,16 @@ msgid "" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" msgstr "" -msgid "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, so ``astimezone(Eastern)`` won't deliver a result with ``hour == 2`` on the day DST begins. For example, at the Spring forward transition of 2016, we get::" +#: ../../library/datetime.rst:2342 +msgid "" +"When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " +"to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " +"so ``astimezone(Eastern)`` won't deliver a result with ``hour == 2`` on the " +"day DST begins. For example, at the Spring forward transition of 2016, we " +"get::" msgstr "" +#: ../../library/datetime.rst:2347 msgid "" ">>> import datetime as dt\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -2031,9 +3268,22 @@ msgid "" "08:00:00 UTC = 04:00:00 EDT" msgstr "" -msgid "When DST ends (the \"end\" line), there's a potentially worse problem: there's an hour that can't be spelled unambiguously in local wall time: the last hour of daylight time. In Eastern, that's times of the form 5:MM UTC on the day daylight time ends. The local wall clock leaps from 1:59 (daylight time) back to 1:00 (standard time) again. Local times of the form 1:MM are ambiguous. :meth:`~.datetime.astimezone` mimics the local clock's behavior by mapping two adjacent UTC hours into the same local hour then. In the Eastern example, UTC times of the form 5:MM and 6:MM both map to 1:MM when converted to Eastern, but earlier times have the :attr:`~.datetime.fold` attribute set to 0 and the later times have it set to 1. For example, at the Fall back transition of 2016, we get::" -msgstr "" - +#: ../../library/datetime.rst:2361 +msgid "" +"When DST ends (the \"end\" line), there's a potentially worse problem: " +"there's an hour that can't be spelled unambiguously in local wall time: the " +"last hour of daylight time. In Eastern, that's times of the form 5:MM UTC on " +"the day daylight time ends. The local wall clock leaps from 1:59 (daylight " +"time) back to 1:00 (standard time) again. Local times of the form 1:MM are " +"ambiguous. :meth:`~.datetime.astimezone` mimics the local clock's behavior " +"by mapping two adjacent UTC hours into the same local hour then. In the " +"Eastern example, UTC times of the form 5:MM and 6:MM both map to 1:MM when " +"converted to Eastern, but earlier times have the :attr:`~.datetime.fold` " +"attribute set to 0 and the later times have it set to 1. For example, at the " +"Fall back transition of 2016, we get::" +msgstr "" + +#: ../../library/datetime.rst:2372 msgid "" ">>> import datetime as dt\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -2049,114 +3299,203 @@ msgid "" "07:00:00 UTC = 02:00:00 EST 0" msgstr "" -msgid "Note that the :class:`.datetime` instances that differ only by the value of the :attr:`~.datetime.fold` attribute are considered equal in comparisons." +#: ../../library/datetime.rst:2385 +msgid "" +"Note that the :class:`.datetime` instances that differ only by the value of " +"the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -msgid "Applications that can't bear wall-time ambiguities should explicitly check the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :class:`tzinfo` subclasses; there are no ambiguities when using :class:`timezone`, or any other fixed-offset :class:`!tzinfo` subclass (such as a class representing only EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours))." +#: ../../library/datetime.rst:2388 +msgid "" +"Applications that can't bear wall-time ambiguities should explicitly check " +"the value of the :attr:`~.datetime.fold` attribute or avoid using " +"hybrid :class:`tzinfo` subclasses; there are no ambiguities when " +"using :class:`timezone`, or any other fixed-offset :class:`!tzinfo` subclass " +"(such as a class representing only EST (fixed offset -5 hours), or only EDT " +"(fixed offset -4 hours))." msgstr "" +#: ../../library/datetime.rst:2396 msgid ":mod:`zoneinfo`" msgstr "" -msgid "The :mod:`!datetime` module has a basic :class:`timezone` class (for handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` attribute (a UTC :class:`!timezone` instance)." +#: ../../library/datetime.rst:2397 +msgid "" +"The :mod:`!datetime` module has a basic :class:`timezone` class (for " +"handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " +"attribute (a UTC :class:`!timezone` instance)." msgstr "" -msgid "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson database) to Python, and its usage is recommended." +#: ../../library/datetime.rst:2401 +msgid "" +"``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " +"database) to Python, and its usage is recommended." msgstr "" +#: ../../library/datetime.rst:2404 msgid "`IANA time zone database `_" msgstr "" -msgid "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code and data that represent the history of local time for many representative locations around the globe. It is updated periodically to reflect changes made by political bodies to time zone boundaries, UTC offsets, and daylight-saving rules." +#: ../../library/datetime.rst:2405 +msgid "" +"The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " +"and data that represent the history of local time for many representative " +"locations around the globe. It is updated periodically to reflect changes " +"made by political bodies to time zone boundaries, UTC offsets, and daylight-" +"saving rules." msgstr "" +#: ../../library/datetime.rst:2415 msgid ":class:`!timezone` objects" msgstr "" -msgid "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance of which represents a time zone defined by a fixed offset from UTC." +#: ../../library/datetime.rst:2417 +msgid "" +"The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " +"of which represents a time zone defined by a fixed offset from UTC." msgstr "" -msgid "Objects of this class cannot be used to represent time zone information in the locations where different offsets are used in different days of the year or where historical changes have been made to civil time." +#: ../../library/datetime.rst:2421 +msgid "" +"Objects of this class cannot be used to represent time zone information in " +"the locations where different offsets are used in different days of the year " +"or where historical changes have been made to civil time." msgstr "" -msgid "The *offset* argument must be specified as a :class:`timedelta` object representing the difference between the local time and UTC. It must be strictly between ``-timedelta(hours=24)`` and ``timedelta(hours=24)``, otherwise :exc:`ValueError` is raised." +#: ../../library/datetime.rst:2428 +msgid "" +"The *offset* argument must be specified as a :class:`timedelta` object " +"representing the difference between the local time and UTC. It must be " +"strictly between ``-timedelta(hours=24)`` and ``timedelta(hours=24)``, " +"otherwise :exc:`ValueError` is raised." msgstr "" -msgid "The *name* argument is optional. If specified it must be a string that will be used as the value returned by the :meth:`datetime.tzname` method." +#: ../../library/datetime.rst:2433 +msgid "" +"The *name* argument is optional. If specified it must be a string that will " +"be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -msgid "Return the fixed value specified when the :class:`timezone` instance is constructed." +#: ../../library/datetime.rst:2444 ../../library/datetime.rst:2456 +msgid "" +"Return the fixed value specified when the :class:`timezone` instance is " +"constructed." msgstr "" -msgid "The *dt* argument is ignored. The return value is a :class:`timedelta` instance equal to the difference between the local time and UTC." +#: ../../library/datetime.rst:2447 +msgid "" +"The *dt* argument is ignored. The return value is a :class:`timedelta` " +"instance equal to the difference between the local time and UTC." msgstr "" -msgid "If *name* is not provided in the constructor, the name returned by ``tzname(dt)`` is generated from the value of the ``offset`` as follows. If *offset* is ``timedelta(0)``, the name is \"UTC\", otherwise it is a string in the format ``UTC±HH:MM``, where ± is the sign of ``offset``, HH and MM are two digits of ``offset.hours`` and ``offset.minutes`` respectively." +#: ../../library/datetime.rst:2459 +msgid "" +"If *name* is not provided in the constructor, the name returned by " +"``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " +"*offset* is ``timedelta(0)``, the name is \"UTC\", otherwise it is a string " +"in the format ``UTC±HH:MM``, where ± is the sign of ``offset``, HH and MM " +"are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -msgid "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not ``'UTC+00:00'``." +#: ../../library/datetime.rst:2465 +msgid "" +"Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " +"``'UTC+00:00'``." msgstr "" +#: ../../library/datetime.rst:2472 msgid "Always returns ``None``." msgstr "" -msgid "Return ``dt + offset``. The *dt* argument must be an aware :class:`.datetime` instance, with ``tzinfo`` set to ``self``." +#: ../../library/datetime.rst:2477 +msgid "" +"Return ``dt + offset``. The *dt* argument must be an " +"aware :class:`.datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" +#: ../../library/datetime.rst:2485 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "" +#: ../../library/datetime.rst:2494 msgid ":meth:`!strftime` and :meth:`!strptime` behavior" msgstr "" -msgid ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a ``strftime(format)`` method, to create a string representing the time under the control of an explicit format string." +#: ../../library/datetime.rst:2496 +msgid "" +":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " +"``strftime(format)`` method, to create a string representing the time under " +"the control of an explicit format string." msgstr "" -msgid "Conversely, the :meth:`date.strptime`, :meth:`datetime.strptime` and :meth:`time.strptime` class methods create an object from a string representing the time and a corresponding format string." +#: ../../library/datetime.rst:2500 +msgid "" +"Conversely, the :meth:`date.strptime`, :meth:`datetime.strptime` " +"and :meth:`time.strptime` class methods create an object from a string " +"representing the time and a corresponding format string." msgstr "" -msgid "The table below provides a high-level comparison of :meth:`~.datetime.strftime` versus :meth:`~.datetime.strptime`:" +#: ../../library/datetime.rst:2504 +msgid "" +"The table below provides a high-level comparison " +"of :meth:`~.datetime.strftime` versus :meth:`~.datetime.strptime`:" msgstr "" +#: ../../library/datetime.rst:2508 msgid "``strftime``" msgstr "" +#: ../../library/datetime.rst:2508 msgid "``strptime``" msgstr "" +#: ../../library/datetime.rst:2510 msgid "Usage" msgstr "" +#: ../../library/datetime.rst:2510 msgid "Convert object to a string according to a given format" msgstr "" +#: ../../library/datetime.rst:2510 msgid "Parse a string into an object given a corresponding format" msgstr "" +#: ../../library/datetime.rst:2512 msgid "Type of method" msgstr "" +#: ../../library/datetime.rst:2512 msgid "Instance method" msgstr "" +#: ../../library/datetime.rst:2512 msgid "Class method" msgstr "" +#: ../../library/datetime.rst:2514 msgid "Signature" msgstr "" +#: ../../library/datetime.rst:2514 msgid "``strftime(format)``" msgstr "" +#: ../../library/datetime.rst:2514 msgid "``strptime(date_string, format)``" msgstr "" +#: ../../library/datetime.rst:2521 msgid ":meth:`!strftime` and :meth:`!strptime` format codes" msgstr "" -msgid "These methods accept format codes that can be used to parse and format dates::" +#: ../../library/datetime.rst:2523 +msgid "" +"These methods accept format codes that can be used to parse and format " +"dates::" msgstr "" +#: ../../library/datetime.rst:2525 msgid "" ">>> import datetime as dt\n" ">>> dt.datetime.strptime('31/01/22 23:59:59.999999',\n" @@ -2166,342 +3505,502 @@ msgid "" "'Mon 31 Jan 2022, 11:59PM'" msgstr "" -msgid "The following is a list of all the format codes that the 1989 C standard requires, and these work on all platforms with a standard C implementation." +#: ../../library/datetime.rst:2532 +msgid "" +"The following is a list of all the format codes that the 1989 C standard " +"requires, and these work on all platforms with a standard C implementation." msgstr "" +#: ../../library/datetime.rst:2536 ../../library/datetime.rst:2639 msgid "Directive" msgstr "" +#: ../../library/datetime.rst:2536 ../../library/datetime.rst:2639 msgid "Meaning" msgstr "" +#: ../../library/datetime.rst:2536 ../../library/datetime.rst:2639 msgid "Example" msgstr "" +#: ../../library/datetime.rst:2536 ../../library/datetime.rst:2639 msgid "Notes" msgstr "" +#: ../../library/datetime.rst:2538 msgid "``%a``" msgstr "" +#: ../../library/datetime.rst:2538 msgid "Weekday as locale's abbreviated name." msgstr "" +#: ../../library/datetime.rst:0 msgid "Sun, Mon, ..., Sat (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "So, Mo, ..., Sa (de_DE)" msgstr "" +#: ../../library/datetime.rst:2543 msgid "``%A``" msgstr "" +#: ../../library/datetime.rst:2543 msgid "Weekday as locale's full name." msgstr "" +#: ../../library/datetime.rst:0 msgid "Sunday, Monday, ..., Saturday (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" +#: ../../library/datetime.rst:2548 msgid "``%w``" msgstr "" +#: ../../library/datetime.rst:2548 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" +#: ../../library/datetime.rst:2548 msgid "0, 1, ..., 6" msgstr "" +#: ../../library/datetime.rst:2552 msgid "``%d``" msgstr "" +#: ../../library/datetime.rst:2552 msgid "Day of the month as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2552 msgid "01, 02, ..., 31" msgstr "" +#: ../../library/datetime.rst:2552 ../../library/datetime.rst:2565 +#: ../../library/datetime.rst:2568 ../../library/datetime.rst:2574 +#: ../../library/datetime.rst:2577 ../../library/datetime.rst:2583 +#: ../../library/datetime.rst:2601 msgid "\\(9)" msgstr "" +#: ../../library/datetime.rst:2555 msgid "``%b``" msgstr "" +#: ../../library/datetime.rst:2555 msgid "Month as locale's abbreviated name." msgstr "" +#: ../../library/datetime.rst:0 msgid "Jan, Feb, ..., Dec (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" +#: ../../library/datetime.rst:2560 msgid "``%B``" msgstr "" +#: ../../library/datetime.rst:2560 msgid "Month as locale's full name." msgstr "" +#: ../../library/datetime.rst:0 msgid "January, February, ..., December (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" +#: ../../library/datetime.rst:2565 msgid "``%m``" msgstr "" +#: ../../library/datetime.rst:2565 msgid "Month as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2565 ../../library/datetime.rst:2577 msgid "01, 02, ..., 12" msgstr "" +#: ../../library/datetime.rst:2568 msgid "``%y``" msgstr "" +#: ../../library/datetime.rst:2568 msgid "Year without century as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2568 msgid "00, 01, ..., 99" msgstr "" +#: ../../library/datetime.rst:2571 msgid "``%Y``" msgstr "" +#: ../../library/datetime.rst:2571 msgid "Year with century as a decimal number." msgstr "" +#: ../../library/datetime.rst:2571 ../../library/datetime.rst:2641 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "" +#: ../../library/datetime.rst:2574 msgid "``%H``" msgstr "" +#: ../../library/datetime.rst:2574 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2574 msgid "00, 01, ..., 23" msgstr "" +#: ../../library/datetime.rst:2577 msgid "``%I``" msgstr "" +#: ../../library/datetime.rst:2577 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2580 msgid "``%p``" msgstr "" +#: ../../library/datetime.rst:2580 msgid "Locale's equivalent of either AM or PM." msgstr "" +#: ../../library/datetime.rst:0 msgid "AM, PM (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "am, pm (de_DE)" msgstr "" +#: ../../library/datetime.rst:2580 msgid "\\(1), \\(3)" msgstr "" +#: ../../library/datetime.rst:2583 msgid "``%M``" msgstr "" +#: ../../library/datetime.rst:2583 msgid "Minute as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2583 ../../library/datetime.rst:2586 msgid "00, 01, ..., 59" msgstr "" +#: ../../library/datetime.rst:2586 msgid "``%S``" msgstr "" +#: ../../library/datetime.rst:2586 msgid "Second as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2586 msgid "\\(4), \\(9)" msgstr "" +#: ../../library/datetime.rst:2589 msgid "``%f``" msgstr "" +#: ../../library/datetime.rst:2589 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" +#: ../../library/datetime.rst:2589 msgid "000000, 000001, ..., 999999" msgstr "" +#: ../../library/datetime.rst:2589 msgid "\\(5)" msgstr "" +#: ../../library/datetime.rst:2593 ../../library/datetime.rst:2791 msgid "``%z``" msgstr "" -msgid "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is naive)." +#: ../../library/datetime.rst:2593 +msgid "" +"UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " +"naive)." msgstr "" +#: ../../library/datetime.rst:2593 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" +#: ../../library/datetime.rst:2593 ../../library/datetime.rst:2598 +#: ../../library/datetime.rst:2655 msgid "\\(6)" msgstr "" +#: ../../library/datetime.rst:2598 ../../library/datetime.rst:2817 msgid "``%Z``" msgstr "" +#: ../../library/datetime.rst:2598 msgid "Time zone name (empty string if the object is naive)." msgstr "" +#: ../../library/datetime.rst:2598 msgid "(empty), UTC, GMT" msgstr "" +#: ../../library/datetime.rst:2601 msgid "``%j``" msgstr "" +#: ../../library/datetime.rst:2601 msgid "Day of the year as a zero-padded decimal number." msgstr "" +#: ../../library/datetime.rst:2601 msgid "001, 002, ..., 366" msgstr "" +#: ../../library/datetime.rst:2604 msgid "``%U``" msgstr "" -msgid "Week number of the year (Sunday as the first day of the week) as a zero-padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0." +#: ../../library/datetime.rst:2604 +msgid "" +"Week number of the year (Sunday as the first day of the week) as a zero-" +"padded decimal number. All days in a new year preceding the first Sunday are " +"considered to be in week 0." msgstr "" +#: ../../library/datetime.rst:2604 ../../library/datetime.rst:2612 msgid "00, 01, ..., 53" msgstr "" +#: ../../library/datetime.rst:2604 ../../library/datetime.rst:2612 msgid "\\(7), \\(9)" msgstr "" +#: ../../library/datetime.rst:2612 msgid "``%W``" msgstr "" -msgid "Week number of the year (Monday as the first day of the week) as a zero-padded decimal number. All days in a new year preceding the first Monday are considered to be in week 0." +#: ../../library/datetime.rst:2612 +msgid "" +"Week number of the year (Monday as the first day of the week) as a zero-" +"padded decimal number. All days in a new year preceding the first Monday are " +"considered to be in week 0." msgstr "" +#: ../../library/datetime.rst:2620 msgid "``%c``" msgstr "" +#: ../../library/datetime.rst:2620 msgid "Locale's appropriate date and time representation." msgstr "" +#: ../../library/datetime.rst:0 msgid "Tue Aug 16 21:30:00 1988 (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" +#: ../../library/datetime.rst:2625 msgid "``%x``" msgstr "" +#: ../../library/datetime.rst:2625 msgid "Locale's appropriate date representation." msgstr "" +#: ../../library/datetime.rst:0 msgid "08/16/88 (None);" msgstr "" +#: ../../library/datetime.rst:0 msgid "08/16/1988 (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "16.08.1988 (de_DE)" msgstr "" +#: ../../library/datetime.rst:2629 msgid "``%X``" msgstr "" +#: ../../library/datetime.rst:2629 msgid "Locale's appropriate time representation." msgstr "" +#: ../../library/datetime.rst:0 msgid "21:30:00 (en_US);" msgstr "" +#: ../../library/datetime.rst:0 msgid "21:30:00 (de_DE)" msgstr "" +#: ../../library/datetime.rst:2632 msgid "``%%``" msgstr "" +#: ../../library/datetime.rst:2632 msgid "A literal ``'%'`` character." msgstr "" +#: ../../library/datetime.rst:2632 msgid "%" msgstr "" -msgid "Several additional directives not required by the C89 standard are included for convenience. These parameters all correspond to ISO 8601 date values." +#: ../../library/datetime.rst:2635 +msgid "" +"Several additional directives not required by the C89 standard are included " +"for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" +#: ../../library/datetime.rst:2641 msgid "``%G``" msgstr "" -msgid "ISO 8601 year with century representing the year that contains the greater part of the ISO week (``%V``)." +#: ../../library/datetime.rst:2641 +msgid "" +"ISO 8601 year with century representing the year that contains the greater " +"part of the ISO week (``%V``)." msgstr "" +#: ../../library/datetime.rst:2641 msgid "\\(8)" msgstr "" +#: ../../library/datetime.rst:2646 msgid "``%u``" msgstr "" +#: ../../library/datetime.rst:2646 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" +#: ../../library/datetime.rst:2646 msgid "1, 2, ..., 7" msgstr "" +#: ../../library/datetime.rst:2649 msgid "``%V``" msgstr "" -msgid "ISO 8601 week as a decimal number with Monday as the first day of the week. Week 01 is the week containing Jan 4." +#: ../../library/datetime.rst:2649 +msgid "" +"ISO 8601 week as a decimal number with Monday as the first day of the week. " +"Week 01 is the week containing Jan 4." msgstr "" +#: ../../library/datetime.rst:2649 msgid "01, 02, ..., 53" msgstr "" +#: ../../library/datetime.rst:2649 msgid "\\(8), \\(9)" msgstr "" +#: ../../library/datetime.rst:2655 ../../library/datetime.rst:2813 msgid "``%:z``" msgstr "" -msgid "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object is naive)." +#: ../../library/datetime.rst:2655 +msgid "" +"UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " +"is naive)." msgstr "" +#: ../../library/datetime.rst:2655 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -msgid "These may not be available on all platforms when used with the :meth:`~.datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives are not interchangeable with the year and week number directives above. Calling :meth:`~.datetime.strptime` with incomplete or ambiguous ISO 8601 directives will raise a :exc:`ValueError`." +#: ../../library/datetime.rst:2661 +msgid "" +"These may not be available on all platforms when used with " +"the :meth:`~.datetime.strftime` method. The ISO 8601 year and ISO 8601 week " +"directives are not interchangeable with the year and week number directives " +"above. Calling :meth:`~.datetime.strptime` with incomplete or ambiguous ISO " +"8601 directives will raise a :exc:`ValueError`." msgstr "" -msgid "The full set of format codes supported varies across platforms, because Python calls the platform C library's :c:func:`strftime` function, and platform variations are common. To see the full set of format codes supported on your platform, consult the :manpage:`strftime(3)` documentation. There are also differences between platforms in handling of unsupported format specifiers." +#: ../../library/datetime.rst:2666 +msgid "" +"The full set of format codes supported varies across platforms, because " +"Python calls the platform C library's :c:func:`strftime` function, and " +"platform variations are common. To see the full set of format codes " +"supported on your platform, consult the :manpage:`strftime(3)` " +"documentation. There are also differences between platforms in handling of " +"unsupported format specifiers." msgstr "" +#: ../../library/datetime.rst:2672 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "" +#: ../../library/datetime.rst:2675 msgid "``%:z`` was added." msgstr "" +#: ../../library/datetime.rst:2680 msgid "Technical detail" msgstr "" -msgid "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's ``time.strftime(fmt, d.timetuple())`` although not all objects support a :meth:`~date.timetuple` method." +#: ../../library/datetime.rst:2682 +msgid "" +"Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " +"``time.strftime(fmt, d.timetuple())`` although not all objects support " +"a :meth:`~date.timetuple` method." msgstr "" -msgid "For the :meth:`.datetime.strptime` and :meth:`.date.strptime` class methods, the default value is ``1900-01-01T00:00:00.000``: any components not specified in the format string will be pulled from the default value." +#: ../../library/datetime.rst:2686 +msgid "" +"For the :meth:`.datetime.strptime` and :meth:`.date.strptime` class methods, " +"the default value is ``1900-01-01T00:00:00.000``: any components not " +"specified in the format string will be pulled from the default value." msgstr "" -msgid "Format strings without separators can be ambiguous for parsing. For example, with ``%Y%m%d``, the string ``2026111`` may be parsed either as ``2026-11-01`` or as ``2026-01-11``. Use separators to ensure the input is parsed as intended." +#: ../../library/datetime.rst:2691 +msgid "" +"Format strings without separators can be ambiguous for parsing. For example, " +"with ``%Y%m%d``, the string ``2026111`` may be parsed either as " +"``2026-11-01`` or as ``2026-01-11``. Use separators to ensure the input is " +"parsed as intended." msgstr "" -msgid "When used to parse partial dates lacking a year, :meth:`.datetime.strptime` and :meth:`.date.strptime` will raise when encountering February 29 because the default year of 1900 is *not* a leap year. Always add a default leap year to partial date strings before parsing." +#: ../../library/datetime.rst:2697 +msgid "" +"When used to parse partial dates lacking a year, :meth:`.datetime.strptime` " +"and :meth:`.date.strptime` will raise when encountering February 29 because " +"the default year of 1900 is *not* a leap year. Always add a default leap " +"year to partial date strings before parsing." msgstr "" +#: ../../library/datetime.rst:2717 msgid "" ">>> import datetime as dt\n" ">>> value = \"2/29\"\n" @@ -2513,110 +4012,235 @@ msgid "" "datetime.datetime(1904, 2, 29, 0, 0)" msgstr "" +#: ../../library/datetime.rst:2728 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -msgid "except when the format includes sub-second components or time zone offset information, which are supported in ``datetime.strptime`` but are discarded by ``time.strptime``." +#: ../../library/datetime.rst:2732 +msgid "" +"except when the format includes sub-second components or time zone offset " +"information, which are supported in ``datetime.strptime`` but are discarded " +"by ``time.strptime``." msgstr "" -msgid "For :class:`.time` objects, the format codes for year, month, and day should not be used, as :class:`!time` objects have no such values. If they're used anyway, 1900 is substituted for the year, and 1 for the month and day." +#: ../../library/datetime.rst:2736 +msgid "" +"For :class:`.time` objects, the format codes for year, month, and day should " +"not be used, as :class:`!time` objects have no such values. If they're used " +"anyway, 1900 is substituted for the year, and 1 for the month and day." msgstr "" -msgid "For :class:`date` objects, the format codes for hours, minutes, seconds, and microseconds should not be used, as :class:`date` objects have no such values. If they're used anyway, 0 is substituted for them." +#: ../../library/datetime.rst:2740 +msgid "" +"For :class:`date` objects, the format codes for hours, minutes, seconds, and " +"microseconds should not be used, as :class:`date` objects have no such " +"values. If they're used anyway, 0 is substituted for them." msgstr "" -msgid "For the same reason, handling of format strings containing Unicode code points that can't be represented in the charset of the current locale is also platform-dependent. On some platforms such code points are preserved intact in the output, while on others ``strftime`` may raise :exc:`UnicodeError` or return an empty string instead." +#: ../../library/datetime.rst:2744 +msgid "" +"For the same reason, handling of format strings containing Unicode code " +"points that can't be represented in the charset of the current locale is " +"also platform-dependent. On some platforms such code points are preserved " +"intact in the output, while on others ``strftime`` may " +"raise :exc:`UnicodeError` or return an empty string instead." msgstr "" -msgid "Because the format depends on the current locale, care should be taken when making assumptions about the output value. Field orderings will vary (for example, \"month/day/year\" versus \"day/month/year\"), and the output may contain non-ASCII characters." +#: ../../library/datetime.rst:2753 +msgid "" +"Because the format depends on the current locale, care should be taken when " +"making assumptions about the output value. Field orderings will vary (for " +"example, \"month/day/year\" versus \"day/month/year\"), and the output may " +"contain non-ASCII characters." msgstr "" -msgid "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] range, but years < 1000 must be zero-filled to 4-digit width." +#: ../../library/datetime.rst:2759 +msgid "" +"The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " +"range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -msgid "In previous versions, :meth:`~.datetime.strftime` method was restricted to years >= 1900." +#: ../../library/datetime.rst:2762 +msgid "" +"In previous versions, :meth:`~.datetime.strftime` method was restricted to " +"years >= 1900." msgstr "" -msgid "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years >= 1000." +#: ../../library/datetime.rst:2766 +msgid "" +"In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " +">= 1000." msgstr "" -msgid "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive only affects the output hour field if the ``%I`` directive is used to parse the hour." +#: ../../library/datetime.rst:2771 +msgid "" +"When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " +"only affects the output hour field if the ``%I`` directive is used to parse " +"the hour." msgstr "" -msgid "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support leap seconds." +#: ../../library/datetime.rst:2775 +msgid "" +"Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " +"leap seconds." msgstr "" -msgid "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive accepts from one to six digits and zero pads on the right. ``%f`` is an extension to the set of format characters in the C standard (but implemented separately in datetime objects, and therefore always available)." +#: ../../library/datetime.rst:2779 +msgid "" +"When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " +"accepts from one to six digits and zero pads on the right. ``%f`` is an " +"extension to the set of format characters in the C standard (but implemented " +"separately in datetime objects, and therefore always available)." msgstr "" -msgid "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced by empty strings." +#: ../../library/datetime.rst:2786 +msgid "" +"For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " +"by empty strings." msgstr "" +#: ../../library/datetime.rst:2789 msgid "For an aware object:" msgstr "" -msgid ":meth:`~.datetime.utcoffset` is transformed into a string of the form ``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number of UTC offset hours, ``MM`` is a 2-digit string giving the number of UTC offset minutes, ``SS`` is a 2-digit string giving the number of UTC offset seconds and ``ffffff`` is a 6-digit string giving the number of UTC offset microseconds. The ``ffffff`` part is omitted when the offset is a whole number of seconds and both the ``ffffff`` and the ``SS`` part is omitted when the offset is a whole number of minutes. For example, if :meth:`~.datetime.utcoffset` returns ``timedelta(hours=-3, minutes=-30)``, ``%z`` is replaced with the string ``'-0330'``." -msgstr "" - -msgid "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` method, the UTC offsets can have a colon as a separator between hours, minutes and seconds. For example, ``'+01:00:00'`` will be parsed as an offset of one hour. In addition, providing ``'Z'`` is identical to ``'+00:00'``." +#: ../../library/datetime.rst:2792 +msgid "" +":meth:`~.datetime.utcoffset` is transformed into a string of the form " +"``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " +"of UTC offset hours, ``MM`` is a 2-digit string giving the number of UTC " +"offset minutes, ``SS`` is a 2-digit string giving the number of UTC offset " +"seconds and ``ffffff`` is a 6-digit string giving the number of UTC offset " +"microseconds. The ``ffffff`` part is omitted when the offset is a whole " +"number of seconds and both the ``ffffff`` and the ``SS`` part is omitted " +"when the offset is a whole number of minutes. For example, " +"if :meth:`~.datetime.utcoffset` returns ``timedelta(hours=-3, " +"minutes=-30)``, ``%z`` is replaced with the string ``'-0330'``." +msgstr "" + +#: ../../library/datetime.rst:2806 +msgid "" +"When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " +"method, the UTC offsets can have a colon as a separator between hours, " +"minutes and seconds. For example, ``'+01:00:00'`` will be parsed as an " +"offset of one hour. In addition, providing ``'Z'`` is identical to " +"``'+00:00'``." msgstr "" -msgid "Behaves exactly as ``%z``, but has a colon separator added between hours, minutes and seconds." +#: ../../library/datetime.rst:2814 +msgid "" +"Behaves exactly as ``%z``, but has a colon separator added between hours, " +"minutes and seconds." msgstr "" -msgid "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by the returned value, which must be a string." +#: ../../library/datetime.rst:2818 +msgid "" +"In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string " +"if :meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced " +"by the returned value, which must be a string." msgstr "" +#: ../../library/datetime.rst:2822 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" +#: ../../library/datetime.rst:2824 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" +#: ../../library/datetime.rst:2825 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -msgid "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid values, but probably not ``EST``. It will raise ``ValueError`` for invalid values." +#: ../../library/datetime.rst:2827 +msgid "" +"So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " +"values, but probably not ``EST``. It will raise ``ValueError`` for invalid " +"values." msgstr "" -msgid "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` of the result will be set to a :class:`timezone` instance." +#: ../../library/datetime.rst:2831 +msgid "" +"When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " +"method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " +"of the result will be set to a :class:`timezone` instance." msgstr "" -msgid "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are only used in calculations when the day of the week and the calendar year (``%Y``) are specified." +#: ../../library/datetime.rst:2837 +msgid "" +"When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " +"only used in calculations when the day of the week and the calendar year " +"(``%Y``) are specified." msgstr "" -msgid "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the day of the week and the ISO year (``%G``) are specified in a :meth:`~.datetime.strptime` format string. Also note that ``%G`` and ``%Y`` are not interchangeable." +#: ../../library/datetime.rst:2842 +msgid "" +"Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " +"day of the week and the ISO year (``%G``) are specified in " +"a :meth:`~.datetime.strptime` format string. Also note that ``%G`` and " +"``%Y`` are not interchangeable." msgstr "" -msgid "When used with the :meth:`~.datetime.strptime` method, the leading zero is optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, ``%j``, ``%U``, ``%W``, and ``%V``. Format ``%y`` does require a leading zero." +#: ../../library/datetime.rst:2848 +msgid "" +"When used with the :meth:`~.datetime.strptime` method, the leading zero is " +"optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " +"``%j``, ``%U``, ``%W``, and ``%V``. Format ``%y`` does require a leading " +"zero." msgstr "" -msgid "When parsing a month and day using :meth:`~.datetime.strptime`, always include a year in the format. If the value you need to parse lacks a year, append an explicit dummy leap year. Otherwise your code will raise an exception when it encounters leap day because the default year used by the parser (1900) is not a leap year. Users run into that bug every leap year." +#: ../../library/datetime.rst:2853 +msgid "" +"When parsing a month and day using :meth:`~.datetime.strptime`, always " +"include a year in the format. If the value you need to parse lacks a year, " +"append an explicit dummy leap year. Otherwise your code will raise an " +"exception when it encounters leap day because the default year used by the " +"parser (1900) is not a leap year. Users run into that bug every leap year." msgstr "" +#: ../../library/datetime.rst:2859 msgid "" ">>> month_day = \"02/29\"\n" -">>> dt.datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year bug.\n" +">>> dt.datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap " +"year bug.\n" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" -msgid ":meth:`~.datetime.strptime` calls using a format string containing a day of month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later we may change this into an error or change the default year to a leap year. See :gh:`70647`." +#: ../../library/datetime.rst:2865 +msgid "" +":meth:`~.datetime.strptime` calls using a format string containing a day of " +"month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " +"we may change this into an error or change the default year to a leap year. " +"See :gh:`70647`." msgstr "" +#: ../../library/datetime.rst:2872 msgid "Footnotes" msgstr "" +#: ../../library/datetime.rst:2873 msgid "If, that is, we ignore the effects of relativity." msgstr "" -msgid "This matches the definition of the \"proleptic Gregorian\" calendar in Dershowitz and Reingold's book *Calendrical Calculations*, where it's the base calendar for all computations. See the book for algorithms for converting between proleptic Gregorian ordinals and many other calendar systems." +#: ../../library/datetime.rst:2875 +msgid "" +"This matches the definition of the \"proleptic Gregorian\" calendar in " +"Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " +"base calendar for all computations. See the book for algorithms for " +"converting between proleptic Gregorian ordinals and many other calendar " +"systems." msgstr "" -msgid "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar `_ for a good explanation." +#: ../../library/datetime.rst:2881 +msgid "" +"See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " +"`_ for a good explanation." msgstr "" +#: ../../library/datetime.rst:2488 msgid "% (percent)" msgstr "" +#: ../../library/datetime.rst:2488 msgid "datetime format" msgstr "" diff --git a/library/dbm.po b/library/dbm.po index b83caae3d..00cc685c7 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,108 +23,188 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/dbm.rst:2 msgid ":mod:`!dbm` --- Interfaces to Unix \"databases\"" msgstr "" +#: ../../library/dbm.rst:7 msgid "**Source code:** :source:`Lib/dbm/__init__.py`" msgstr "" +#: ../../library/dbm.rst:11 msgid ":mod:`!dbm` is a generic interface to variants of the DBM database:" msgstr "" +#: ../../library/dbm.rst:13 msgid ":mod:`dbm.sqlite3`" msgstr "" +#: ../../library/dbm.rst:14 msgid ":mod:`dbm.gnu`" msgstr "" +#: ../../library/dbm.rst:15 msgid ":mod:`dbm.ndbm`" msgstr "" -msgid "If none of these modules are installed, the slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There is a `third party interface `_ to the Oracle Berkeley DB." +#: ../../library/dbm.rst:17 +msgid "" +"If none of these modules are installed, the slow-but-simple implementation " +"in module :mod:`dbm.dumb` will be used. There is a `third party interface " +"`_ to the Oracle Berkeley DB." msgstr "" -msgid "A tuple containing the exceptions that can be raised by each of the supported modules, with a unique exception also named :exc:`dbm.error` as the first item --- the latter is used when :exc:`dbm.error` is raised." +#: ../../library/dbm.rst:24 +msgid "" +"A tuple containing the exceptions that can be raised by each of the " +"supported modules, with a unique exception also named :exc:`dbm.error` as " +"the first item --- the latter is used when :exc:`dbm.error` is raised." msgstr "" -msgid "This function attempts to guess which of the several simple database modules available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:`dbm.dumb` --- should be used to open a given file." +#: ../../library/dbm.rst:31 +msgid "" +"This function attempts to guess which of the several simple database modules " +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, " +"or :mod:`dbm.dumb` --- should be used to open a given file." msgstr "" +#: ../../library/dbm.rst:35 msgid "Return one of the following values:" msgstr "" -msgid "``None`` if the file can't be opened because it's unreadable or doesn't exist" +#: ../../library/dbm.rst:37 +msgid "" +"``None`` if the file can't be opened because it's unreadable or doesn't exist" msgstr "" +#: ../../library/dbm.rst:38 msgid "the empty string (``''``) if the file's format can't be guessed" msgstr "" -msgid "a string containing the required module name, such as ``'dbm.ndbm'`` or ``'dbm.gnu'``" +#: ../../library/dbm.rst:39 +msgid "" +"a string containing the required module name, such as ``'dbm.ndbm'`` or " +"``'dbm.gnu'``" msgstr "" +#: ../../library/dbm.rst:41 ../../library/dbm.rst:270 ../../library/dbm.rst:472 msgid "*filename* accepts a :term:`path-like object`." msgstr "" +#: ../../library/dbm.rst:65 msgid "Open a database and return the corresponding database object." msgstr "" +#: ../../library/dbm.rst:0 msgid "Parameters" msgstr "" -msgid "The database file to open. If the database file already exists, the :func:`whichdb` function is used to determine its type and the appropriate module is used; if it does not exist, the first submodule listed above that can be imported is used." +#: ../../library/dbm.rst:67 +msgid "" +"The database file to open. If the database file already exists, " +"the :func:`whichdb` function is used to determine its type and the " +"appropriate module is used; if it does not exist, the first submodule listed " +"above that can be imported is used." msgstr "" +#: ../../library/dbm.rst:68 ../../library/dbm.rst:242 msgid "The database file to open." msgstr "" -msgid "If the database file already exists, the :func:`whichdb` function is used to determine its type and the appropriate module is used; if it does not exist, the first submodule listed above that can be imported is used." +#: ../../library/dbm.rst:70 +msgid "" +"If the database file already exists, the :func:`whichdb` function is used to " +"determine its type and the appropriate module is used; if it does not exist, " +"the first submodule listed above that can be imported is used." msgstr "" -msgid "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * ``'n'``: |flag_n|" +#: ../../library/dbm.rst:75 ../../library/dbm.rst:181 ../../library/dbm.rst:375 +msgid "" +"* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " +"``'n'``: |flag_n|" msgstr "" +#: ../../library/dbm.rst:76 ../../library/dbm.rst:183 ../../library/dbm.rst:247 +#: ../../library/dbm.rst:376 msgid "``'r'`` (default): |flag_r|" msgstr "" +#: ../../library/dbm.rst:77 ../../library/dbm.rst:184 ../../library/dbm.rst:248 +#: ../../library/dbm.rst:377 ../../library/dbm.rst:453 msgid "``'w'``: |flag_w|" msgstr "" +#: ../../library/dbm.rst:78 ../../library/dbm.rst:185 ../../library/dbm.rst:249 +#: ../../library/dbm.rst:378 msgid "``'c'``: |flag_c|" msgstr "" +#: ../../library/dbm.rst:79 ../../library/dbm.rst:186 ../../library/dbm.rst:250 +#: ../../library/dbm.rst:379 ../../library/dbm.rst:455 msgid "``'n'``: |flag_n|" msgstr "" +#: ../../library/dbm.rst:81 ../../library/dbm.rst:264 ../../library/dbm.rst:381 +#: ../../library/dbm.rst:457 msgid "|mode_param_doc|" msgstr "" +#: ../../library/dbm.rst:84 msgid "*file* accepts a :term:`path-like object`." msgstr "" -msgid "The object returned by :func:`~dbm.open` supports the basic functionality of mutable :term:`mappings `; keys and their corresponding values can be stored, retrieved, and deleted, and iteration, the :keyword:`in` operator and methods :meth:`!keys`, :meth:`!get`, :meth:`!setdefault` and :meth:`!clear` are available. The :meth:`!keys` method returns a list instead of a view object. The :meth:`!setdefault` method requires two arguments." +#: ../../library/dbm.rst:87 +msgid "" +"The object returned by :func:`~dbm.open` supports the basic functionality of " +"mutable :term:`mappings `; keys and their corresponding values can " +"be stored, retrieved, and deleted, and iteration, the :keyword:`in` operator " +"and methods :meth:`!keys`, :meth:`!get`, :meth:`!setdefault` and :meth:`!" +"clear` are available. The :meth:`!keys` method returns a list instead of a " +"view object. The :meth:`!setdefault` method requires two arguments." msgstr "" -msgid "Key and values are always stored as :class:`bytes`. This means that when strings are used they are implicitly converted to the default encoding before being stored." +#: ../../library/dbm.rst:95 +msgid "" +"Key and values are always stored as :class:`bytes`. This means that when " +"strings are used they are implicitly converted to the default encoding " +"before being stored." msgstr "" -msgid "These objects also support being used in a :keyword:`with` statement, which will automatically close them when done." +#: ../../library/dbm.rst:99 +msgid "" +"These objects also support being used in a :keyword:`with` statement, which " +"will automatically close them when done." msgstr "" -msgid ":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:`!dbm` backends." +#: ../../library/dbm.rst:102 +msgid "" +":meth:`!get` and :meth:`!setdefault` methods are now available for " +"all :mod:`!dbm` backends." msgstr "" -msgid "Added native support for the context management protocol to the objects returned by :func:`~dbm.open`." +#: ../../library/dbm.rst:106 +msgid "" +"Added native support for the context management protocol to the objects " +"returned by :func:`~dbm.open`." msgstr "" -msgid "Deleting a key from a read-only database raises a database module specific exception instead of :exc:`KeyError`." +#: ../../library/dbm.rst:110 +msgid "" +"Deleting a key from a read-only database raises a database module specific " +"exception instead of :exc:`KeyError`." msgstr "" +#: ../../library/dbm.rst:114 msgid ":meth:`!clear` methods are now available for all :mod:`!dbm` backends." msgstr "" -msgid "The following example records some hostnames and a corresponding title, and then prints out the contents of the database::" +#: ../../library/dbm.rst:118 +msgid "" +"The following example records some hostnames and a corresponding title, and " +"then prints out the contents of the database::" msgstr "" +#: ../../library/dbm.rst:121 msgid "" "import dbm\n" "\n" @@ -151,117 +231,208 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" +#: ../../library/dbm.rst:148 msgid "Module :mod:`shelve`" msgstr "" +#: ../../library/dbm.rst:149 msgid "Persistence module which stores non-string data." msgstr "" +#: ../../library/dbm.rst:152 msgid "The individual submodules are described in the following sections." msgstr "" +#: ../../library/dbm.rst:155 msgid ":mod:`!dbm.sqlite3` --- SQLite backend for dbm" msgstr "" +#: ../../library/dbm.rst:162 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" msgstr "" -msgid "This module uses the standard library :mod:`sqlite3` module to provide an SQLite backend for the :mod:`!dbm` module. The files created by :mod:`!dbm.sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, including the SQLite CLI." +#: ../../library/dbm.rst:166 +msgid "" +"This module uses the standard library :mod:`sqlite3` module to provide an " +"SQLite backend for the :mod:`!dbm` module. The files created by :mod:`!" +"dbm.sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite " +"browser, including the SQLite CLI." msgstr "" +#: ../../library/dbm.rst:225 ../../library/dbm.rst:353 +#: ../../includes/wasm-mobile-notavail.rst:3 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/dbm.rst:175 msgid "Open an SQLite database." msgstr "" +#: ../../library/dbm.rst:177 msgid "The path to the database to be opened." msgstr "" -msgid "The Unix file access mode of the file (default: octal ``0o666``), used only when the database has to be created." +#: ../../library/dbm.rst:188 +msgid "" +"The Unix file access mode of the file (default: octal ``0o666``), used only " +"when the database has to be created." msgstr "" -msgid "The returned database object behaves similar to a mutable :term:`mapping`, but the :meth:`!keys` method returns a list, and the :meth:`!setdefault` method requires two arguments. It also supports a \"closing\" context manager via the :keyword:`with` keyword." +#: ../../library/dbm.rst:192 +msgid "" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` method returns a list, and the :meth:`!setdefault` " +"method requires two arguments. It also supports a \"closing\" context " +"manager via the :keyword:`with` keyword." msgstr "" +#: ../../library/dbm.rst:197 ../../library/dbm.rst:400 msgid "The following method is also provided:" msgstr "" +#: ../../library/dbm.rst:201 msgid "Close the SQLite database." msgstr "" +#: ../../library/dbm.rst:205 msgid ":mod:`!dbm.gnu` --- GNU database manager" msgstr "" +#: ../../library/dbm.rst:210 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "" -msgid "The :mod:`!dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional functionality like crash tolerance." +#: ../../library/dbm.rst:214 +msgid "" +"The :mod:`!dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " +"dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " +"functionality like crash tolerance." msgstr "" -msgid "The file formats created by :mod:`!dbm.gnu` and :mod:`dbm.ndbm` are incompatible and can not be used interchangeably." +#: ../../library/dbm.rst:220 +msgid "" +"The file formats created by :mod:`!dbm.gnu` and :mod:`dbm.ndbm` are " +"incompatible and can not be used interchangeably." msgstr "" -msgid "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +#: ../../includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -msgid "Raised on :mod:`!dbm.gnu`-specific errors, such as I/O errors. :exc:`KeyError` is raised for general mapping errors like specifying an incorrect key." +#: ../../library/dbm.rst:229 +msgid "" +"Raised on :mod:`!dbm.gnu`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like specifying " +"an incorrect key." msgstr "" -msgid "A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` supports." +#: ../../library/dbm.rst:235 +msgid "" +"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " +"supports." msgstr "" +#: ../../library/dbm.rst:240 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "" -msgid "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * ``'n'``: |flag_n| The following additional characters may be appended to control how the database is opened: * ``'f'``: Open the database in fast mode. Writes to the database will not be synchronized. * ``'s'``: Synchronized mode. Changes to the database will be written immediately to the file. * ``'u'``: Do not lock database. Not all flags are valid for all versions of GDBM. See the :data:`open_flags` member for a list of supported flag characters." +#: ../../library/dbm.rst:246 +msgid "" +"* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " +"``'n'``: |flag_n| The following additional characters may be appended to " +"control how the database is opened: * ``'f'``: Open the database in fast " +"mode. Writes to the database will not be synchronized. * ``'s'``: " +"Synchronized mode. Changes to the database will be written immediately to " +"the file. * ``'u'``: Do not lock database. Not all flags are valid for all " +"versions of GDBM. See the :data:`open_flags` member for a list of supported " +"flag characters." msgstr "" -msgid "The following additional characters may be appended to control how the database is opened:" +#: ../../library/dbm.rst:252 +msgid "" +"The following additional characters may be appended to control how the " +"database is opened:" msgstr "" -msgid "``'f'``: Open the database in fast mode. Writes to the database will not be synchronized." +#: ../../library/dbm.rst:255 +msgid "" +"``'f'``: Open the database in fast mode. Writes to the database will not be " +"synchronized." msgstr "" -msgid "``'s'``: Synchronized mode. Changes to the database will be written immediately to the file." +#: ../../library/dbm.rst:257 +msgid "" +"``'s'``: Synchronized mode. Changes to the database will be written " +"immediately to the file." msgstr "" +#: ../../library/dbm.rst:259 msgid "``'u'``: Do not lock database." msgstr "" -msgid "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` member for a list of supported flag characters." +#: ../../library/dbm.rst:261 +msgid "" +"Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " +"member for a list of supported flag characters." msgstr "" +#: ../../library/dbm.rst:0 msgid "Raises" msgstr "" +#: ../../library/dbm.rst:267 msgid "If an invalid *flag* argument is passed." msgstr "" -msgid ":class:`!gdbm` objects behave similar to mutable :term:`mappings `, but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, and :meth:`!update` are not supported, the :meth:`!keys` method returns a list, and the :meth:`!setdefault` method requires two arguments. It also supports a \"closing\" context manager via the :keyword:`with` keyword." +#: ../../library/dbm.rst:273 +msgid "" +":class:`!gdbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" +#: ../../library/dbm.rst:280 ../../library/dbm.rst:394 msgid "Added the :meth:`!get` and :meth:`!setdefault` methods." msgstr "" +#: ../../library/dbm.rst:283 ../../library/dbm.rst:397 msgid "Added the :meth:`!clear` method." msgstr "" +#: ../../library/dbm.rst:286 ../../library/dbm.rst:480 msgid "The following methods are also provided:" msgstr "" +#: ../../library/dbm.rst:290 msgid "Close the GDBM database." msgstr "" -msgid "It's possible to loop over every key in the database using this method and the :meth:`nextkey` method. The traversal is ordered by GDBM's internal hash values, and won't be sorted by the key values. This method returns the starting key." +#: ../../library/dbm.rst:294 +msgid "" +"It's possible to loop over every key in the database using this method and " +"the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " +"hash values, and won't be sorted by the key values. This method returns the " +"starting key." msgstr "" -msgid "Returns the key that follows *key* in the traversal. The following code prints every key in the database ``db``, without having to create a list in memory that contains them all::" +#: ../../library/dbm.rst:301 +msgid "" +"Returns the key that follows *key* in the traversal. The following code " +"prints every key in the database ``db``, without having to create a list in " +"memory that contains them all::" msgstr "" +#: ../../library/dbm.rst:305 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -269,107 +440,197 @@ msgid "" " k = db.nextkey(k)" msgstr "" -msgid "If you have carried out a lot of deletions and would like to shrink the space used by the GDBM file, this routine will reorganize the database. :class:`!gdbm` objects will not shorten the length of a database file except by using this reorganization; otherwise, deleted file space will be kept and reused as new (key, value) pairs are added." +#: ../../library/dbm.rst:312 +msgid "" +"If you have carried out a lot of deletions and would like to shrink the " +"space used by the GDBM file, this routine will reorganize the " +"database. :class:`!gdbm` objects will not shorten the length of a database " +"file except by using this reorganization; otherwise, deleted file space will " +"be kept and reused as new (key, value) pairs are added." msgstr "" -msgid "When the database has been opened in fast mode, this method forces any unwritten data to be written to the disk." +#: ../../library/dbm.rst:320 +msgid "" +"When the database has been opened in fast mode, this method forces any " +"unwritten data to be written to the disk." msgstr "" +#: ../../library/dbm.rst:325 msgid ":mod:`!dbm.ndbm` --- New Database Manager" msgstr "" +#: ../../library/dbm.rst:330 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "" -msgid "The :mod:`!dbm.ndbm` module provides an interface to the :abbr:`NDBM (New Database Manager)` library. This module can be used with the \"classic\" NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." +#: ../../library/dbm.rst:334 +msgid "" +"The :mod:`!dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " +"Database Manager)` library. This module can be used with the \"classic\" " +"NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -msgid "The file formats created by :mod:`dbm.gnu` and :mod:`!dbm.ndbm` are incompatible and can not be used interchangeably." +#: ../../library/dbm.rst:341 +msgid "" +"The file formats created by :mod:`dbm.gnu` and :mod:`!dbm.ndbm` are " +"incompatible and can not be used interchangeably." msgstr "" -msgid "The NDBM library shipped as part of macOS has an undocumented limitation on the size of values, which can result in corrupted database files when storing values larger than this limit. Reading such corrupted files can result in a hard crash (segmentation fault)." +#: ../../library/dbm.rst:346 +msgid "" +"The NDBM library shipped as part of macOS has an undocumented limitation on " +"the size of values, which can result in corrupted database files when " +"storing values larger than this limit. Reading such corrupted files can " +"result in a hard crash (segmentation fault)." msgstr "" -msgid "Raised on :mod:`!dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised for general mapping errors like specifying an incorrect key." +#: ../../library/dbm.rst:357 +msgid "" +"Raised on :mod:`!dbm.ndbm`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like specifying " +"an incorrect key." msgstr "" +#: ../../library/dbm.rst:363 msgid "Name of the NDBM implementation library used." msgstr "" +#: ../../library/dbm.rst:368 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -msgid "The basename of the database file (without the :file:`.dir` or :file:`.pag` extensions)." +#: ../../library/dbm.rst:370 +msgid "" +"The basename of the database file (without the :file:`.dir` or :file:`.pag` " +"extensions)." msgstr "" +#: ../../library/dbm.rst:384 msgid "Accepts :term:`path-like object` for filename." msgstr "" -msgid ":class:`!ndbm` objects behave similar to mutable :term:`mappings `, but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, and :meth:`!update` are not supported, the :meth:`!keys` method returns a list, and the :meth:`!setdefault` method requires two arguments. It also supports a \"closing\" context manager via the :keyword:`with` keyword." +#: ../../library/dbm.rst:387 +msgid "" +":class:`!ndbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" +#: ../../library/dbm.rst:404 msgid "Close the NDBM database." msgstr "" +#: ../../library/dbm.rst:408 msgid ":mod:`!dbm.dumb` --- Portable DBM implementation" msgstr "" +#: ../../library/dbm.rst:413 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "" -msgid "The :mod:`!dbm.dumb` module is intended as a last resort fallback for the :mod:`!dbm` module when a more robust module is not available. The :mod:`!dbm.dumb` module is not written for speed and is not nearly as heavily used as the other database modules." +#: ../../library/dbm.rst:419 +msgid "" +"The :mod:`!dbm.dumb` module is intended as a last resort fallback for " +"the :mod:`!dbm` module when a more robust module is not available. " +"The :mod:`!dbm.dumb` module is not written for speed and is not nearly as " +"heavily used as the other database modules." msgstr "" -msgid "The :mod:`!dbm.dumb` module provides a persistent :class:`dict`-like interface which is written entirely in Python. Unlike other :mod:`!dbm` backends, such as :mod:`dbm.gnu`, no external library is required." +#: ../../library/dbm.rst:426 +msgid "" +"The :mod:`!dbm.dumb` module provides a persistent :class:`dict`-like " +"interface which is written entirely in Python. Unlike other :mod:`!dbm` " +"backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" +#: ../../library/dbm.rst:431 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr "" -msgid "Raised on :mod:`!dbm.dumb`-specific errors, such as I/O errors. :exc:`KeyError` is raised for general mapping errors like specifying an incorrect key." +#: ../../library/dbm.rst:435 +msgid "" +"Raised on :mod:`!dbm.dumb`-specific errors, such as I/O " +"errors. :exc:`KeyError` is raised for general mapping errors like " +"specifying an incorrect key." msgstr "" +#: ../../library/dbm.rst:441 msgid "Open a :mod:`!dbm.dumb` database." msgstr "" -msgid "The basename of the database file (without extensions). A new database creates the following files: - :file:`{filename}.dat` - :file:`{filename}.dir`" +#: ../../library/dbm.rst:443 +msgid "" +"The basename of the database file (without extensions). A new database " +"creates the following files: - :file:`{filename}.dat` " +"- :file:`{filename}.dir`" msgstr "" -msgid "The basename of the database file (without extensions). A new database creates the following files:" +#: ../../library/dbm.rst:444 +msgid "" +"The basename of the database file (without extensions). A new database " +"creates the following files:" msgstr "" +#: ../../library/dbm.rst:447 msgid ":file:`{filename}.dat`" msgstr "" +#: ../../library/dbm.rst:448 msgid ":file:`{filename}.dir`" msgstr "" -msgid "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * ``'n'``: |flag_n|" +#: ../../library/dbm.rst:451 +msgid "" +"* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " +"``'n'``: |flag_n|" msgstr "" +#: ../../library/dbm.rst:452 msgid "``'r'``: |flag_r|" msgstr "" +#: ../../library/dbm.rst:454 msgid "``'c'`` (default): |flag_c|" msgstr "" -msgid "It is possible to crash the Python interpreter when loading a database with a sufficiently large/complex entry due to stack depth limitations in Python's AST compiler." +#: ../../library/dbm.rst:461 +msgid "" +"It is possible to crash the Python interpreter when loading a database with " +"a sufficiently large/complex entry due to stack depth limitations in " +"Python's AST compiler." msgstr "" -msgid ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." +#: ../../library/dbm.rst:465 +msgid "" +":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -msgid "A database opened read-only if *flag* is ``'r'``. A database is not created if it does not exist if *flag* is ``'r'`` or ``'w'``." +#: ../../library/dbm.rst:468 +msgid "" +"A database opened read-only if *flag* is ``'r'``. A database is not created " +"if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -msgid "The returned database object behaves similar to a mutable :term:`mapping`, but the :meth:`!keys` and :meth:`!items` methods return lists, and the :meth:`!setdefault` method requires two arguments. It also supports a \"closing\" context manager via the :keyword:`with` keyword." +#: ../../library/dbm.rst:475 +msgid "" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` and :meth:`!items` methods return lists, and " +"the :meth:`!setdefault` method requires two arguments. It also supports a " +"\"closing\" context manager via the :keyword:`with` keyword." msgstr "" +#: ../../library/dbm.rst:484 msgid "Close the database." msgstr "" -msgid "Synchronize the on-disk directory and data files. This method is called by the :meth:`shelve.Shelf.sync` method." +#: ../../library/dbm.rst:488 +msgid "" +"Synchronize the on-disk directory and data files. This method is called by " +"the :meth:`shelve.Shelf.sync` method." msgstr "" +#: ../../library/dbm.rst:415 msgid "databases" msgstr "" diff --git a/library/debug.po b/library/debug.po index c4c4c8238..7b7c8d62d 100644 --- a/library/debug.po +++ b/library/debug.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,8 +21,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/debug.rst:3 msgid "Debugging and Profiling" msgstr "" -msgid "These libraries help you with Python development: the debugger enables you to step through code, analyze stack frames and set breakpoints etc., and the profilers run code and give you a detailed breakdown of execution times, allowing you to identify bottlenecks in your programs. Auditing events provide visibility into runtime behaviors that would otherwise require intrusive debugging or patching." +#: ../../library/debug.rst:5 +msgid "" +"These libraries help you with Python development: the debugger enables you " +"to step through code, analyze stack frames and set breakpoints etc., and the " +"profilers run code and give you a detailed breakdown of execution times, " +"allowing you to identify bottlenecks in your programs. Auditing events " +"provide visibility into runtime behaviors that would otherwise require " +"intrusive debugging or patching." msgstr "" diff --git a/library/decimal.po b/library/decimal.po index 5db2a6c35..708543d19 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,60 +24,144 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/decimal.rst:2 msgid ":mod:`!decimal` --- Decimal fixed-point and floating-point arithmetic" msgstr "" +#: ../../library/decimal.rst:15 msgid "**Source code:** :source:`Lib/decimal.py`" msgstr "" -msgid "The :mod:`!decimal` module provides support for fast correctly rounded decimal floating-point arithmetic. It offers several advantages over the :class:`float` datatype:" +#: ../../library/decimal.rst:33 +msgid "" +"The :mod:`!decimal` module provides support for fast correctly rounded " +"decimal floating-point arithmetic. It offers several advantages over " +"the :class:`float` datatype:" msgstr "" -msgid "Decimal \"is based on a `floating-point model `__ which was designed with people in mind, and necessarily has a paramount guiding principle -- computers must provide an arithmetic that works in the same way as the arithmetic that people learn at school.\" -- excerpt from the decimal arithmetic specification." +#: ../../library/decimal.rst:37 +msgid "" +"Decimal \"is based on a `floating-point model `__ which was designed with people in mind, " +"and necessarily has a paramount guiding principle -- computers must provide " +"an arithmetic that works in the same way as the arithmetic that people learn " +"at school.\" -- excerpt from the decimal arithmetic specification." msgstr "" -msgid "Decimal numbers can be represented exactly. In contrast, numbers like ``1.1`` and ``2.2`` do not have exact representations in binary floating point. End users typically would not expect ``1.1 + 2.2`` to display as ``3.3000000000000003`` as it does with binary floating point." +#: ../../library/decimal.rst:44 +msgid "" +"Decimal numbers can be represented exactly. In contrast, numbers like " +"``1.1`` and ``2.2`` do not have exact representations in binary floating " +"point. End users typically would not expect ``1.1 + 2.2`` to display as " +"``3.3000000000000003`` as it does with binary floating point." msgstr "" -msgid "The exactness carries over into arithmetic. In decimal floating point, ``0.1 + 0.1 + 0.1 - 0.3`` is exactly equal to zero. In binary floating point, the result is ``5.5511151231257827e-017``. While near to zero, the differences prevent reliable equality testing and differences can accumulate. For this reason, decimal is preferred in accounting applications which have strict equality invariants." +#: ../../library/decimal.rst:49 +msgid "" +"The exactness carries over into arithmetic. In decimal floating point, " +"``0.1 + 0.1 + 0.1 - 0.3`` is exactly equal to zero. In binary floating " +"point, the result is ``5.5511151231257827e-017``. While near to zero, the " +"differences prevent reliable equality testing and differences can " +"accumulate. For this reason, decimal is preferred in accounting applications " +"which have strict equality invariants." msgstr "" -msgid "The decimal module incorporates a notion of significant places so that ``1.30 + 1.20`` is ``2.50``. The trailing zero is kept to indicate significance. This is the customary presentation for monetary applications. For multiplication, the \"schoolbook\" approach uses all the figures in the multiplicands. For instance, ``1.3 * 1.2`` gives ``1.56`` while ``1.30 * 1.20`` gives ``1.5600``." +#: ../../library/decimal.rst:56 +msgid "" +"The decimal module incorporates a notion of significant places so that " +"``1.30 + 1.20`` is ``2.50``. The trailing zero is kept to indicate " +"significance. This is the customary presentation for monetary applications. " +"For multiplication, the \"schoolbook\" approach uses all the figures in the " +"multiplicands. For instance, ``1.3 * 1.2`` gives ``1.56`` while ``1.30 * " +"1.20`` gives ``1.5600``." msgstr "" -msgid "Unlike hardware based binary floating point, the decimal module has a user alterable precision (defaulting to 28 places) which can be as large as needed for a given problem:" +#: ../../library/decimal.rst:63 +msgid "" +"Unlike hardware based binary floating point, the decimal module has a user " +"alterable precision (defaulting to 28 places) which can be as large as " +"needed for a given problem:" msgstr "" -msgid "Both binary and decimal floating point are implemented in terms of published standards. While the built-in float type exposes only a modest portion of its capabilities, the decimal module exposes all required parts of the standard. When needed, the programmer has full control over rounding and signal handling. This includes an option to enforce exact arithmetic by using exceptions to block any inexact operations." +#: ../../library/decimal.rst:75 +msgid "" +"Both binary and decimal floating point are implemented in terms of published " +"standards. While the built-in float type exposes only a modest portion of " +"its capabilities, the decimal module exposes all required parts of the " +"standard. When needed, the programmer has full control over rounding and " +"signal handling. This includes an option to enforce exact arithmetic by " +"using exceptions to block any inexact operations." msgstr "" -msgid "The decimal module was designed to support \"without prejudice, both exact unrounded decimal arithmetic (sometimes called fixed-point arithmetic) and rounded floating-point arithmetic.\" -- excerpt from the decimal arithmetic specification." +#: ../../library/decimal.rst:82 +msgid "" +"The decimal module was designed to support \"without prejudice, both exact " +"unrounded decimal arithmetic (sometimes called fixed-point arithmetic) and " +"rounded floating-point arithmetic.\" -- excerpt from the decimal arithmetic " +"specification." msgstr "" -msgid "The module design is centered around three concepts: the decimal number, the context for arithmetic, and signals." +#: ../../library/decimal.rst:87 +msgid "" +"The module design is centered around three concepts: the decimal number, " +"the context for arithmetic, and signals." msgstr "" -msgid "A decimal number is immutable. It has a sign, coefficient digits, and an exponent. To preserve significance, the coefficient digits do not truncate trailing zeros. Decimals also include special values such as ``Infinity``, ``-Infinity``, and ``NaN``. The standard also differentiates ``-0`` from ``+0``." +#: ../../library/decimal.rst:90 +msgid "" +"A decimal number is immutable. It has a sign, coefficient digits, and an " +"exponent. To preserve significance, the coefficient digits do not truncate " +"trailing zeros. Decimals also include special values such as ``Infinity``, " +"``-Infinity``, and ``NaN``. The standard also differentiates ``-0`` from " +"``+0``." msgstr "" -msgid "The context for arithmetic is an environment specifying precision, rounding rules, limits on exponents, flags indicating the results of operations, and trap enablers which determine whether signals are treated as exceptions. Rounding options include :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:`ROUND_HALF_UP`, :const:`ROUND_UP`, and :const:`ROUND_05UP`." +#: ../../library/decimal.rst:96 +msgid "" +"The context for arithmetic is an environment specifying precision, rounding " +"rules, limits on exponents, flags indicating the results of operations, and " +"trap enablers which determine whether signals are treated as exceptions. " +"Rounding options " +"include :const:`ROUND_CEILING`, :const:`ROUND_DOWN`, :const:`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:`ROUND_HALF_UP`, :const:`ROUND_UP`, " +"and :const:`ROUND_05UP`." msgstr "" -msgid "Signals are groups of exceptional conditions arising during the course of computation. Depending on the needs of the application, signals may be ignored, considered as informational, or treated as exceptions. The signals in the decimal module are: :const:`Clamped`, :const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow` and :const:`FloatOperation`." +#: ../../library/decimal.rst:103 +msgid "" +"Signals are groups of exceptional conditions arising during the course of " +"computation. Depending on the needs of the application, signals may be " +"ignored, considered as informational, or treated as exceptions. The signals " +"in the decimal module " +"are: :const:`Clamped`, :const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow` " +"and :const:`FloatOperation`." msgstr "" -msgid "For each signal there is a flag and a trap enabler. When a signal is encountered, its flag is set to one, then, if the trap enabler is set to one, an exception is raised. Flags are sticky, so the user needs to reset them before monitoring a calculation." +#: ../../library/decimal.rst:110 +msgid "" +"For each signal there is a flag and a trap enabler. When a signal is " +"encountered, its flag is set to one, then, if the trap enabler is set to " +"one, an exception is raised. Flags are sticky, so the user needs to reset " +"them before monitoring a calculation." msgstr "" -msgid "IBM's General Decimal Arithmetic Specification, `The General Decimal Arithmetic Specification `_." +#: ../../library/decimal.rst:118 +msgid "" +"IBM's General Decimal Arithmetic Specification, `The General Decimal " +"Arithmetic Specification `_." msgstr "" +#: ../../library/decimal.rst:127 msgid "Quick-start tutorial" msgstr "" -msgid "The usual start to using decimals is importing the module, viewing the current context with :func:`getcontext` and, if necessary, setting new values for precision, rounding, or enabled traps::" +#: ../../library/decimal.rst:129 +msgid "" +"The usual start to using decimals is importing the module, viewing the " +"current context with :func:`getcontext` and, if necessary, setting new " +"values for precision, rounding, or enabled traps::" msgstr "" +#: ../../library/decimal.rst:133 msgid "" ">>> from decimal import *\n" ">>> getcontext()\n" @@ -88,9 +172,16 @@ msgid "" ">>> getcontext().prec = 7 # Set a new precision" msgstr "" -msgid "Decimal instances can be constructed from integers, strings, floats, or tuples. Construction from an integer or a float performs an exact conversion of the value of that integer or float. Decimal numbers include special values such as ``NaN`` which stands for \"Not a number\", positive and negative ``Infinity``, and ``-0``::" +#: ../../library/decimal.rst:141 +msgid "" +"Decimal instances can be constructed from integers, strings, floats, or " +"tuples. Construction from an integer or a float performs an exact conversion " +"of the value of that integer or float. Decimal numbers include special " +"values such as ``NaN`` which stands for \"Not a number\", positive and " +"negative ``Infinity``, and ``-0``::" msgstr "" +#: ../../library/decimal.rst:147 msgid "" ">>> getcontext().prec = 28\n" ">>> Decimal(10)\n" @@ -111,9 +202,14 @@ msgid "" "Decimal('-Infinity')" msgstr "" -msgid "If the :exc:`FloatOperation` signal is trapped, accidental mixing of decimals and floats in constructors or ordering comparisons raises an exception::" +#: ../../library/decimal.rst:165 +msgid "" +"If the :exc:`FloatOperation` signal is trapped, accidental mixing of " +"decimals and floats in constructors or ordering comparisons raises an " +"exception::" msgstr "" +#: ../../library/decimal.rst:169 msgid "" ">>> c = getcontext()\n" ">>> c.traps[FloatOperation] = True\n" @@ -129,9 +225,14 @@ msgid "" "True" msgstr "" -msgid "The significance of a new Decimal is determined solely by the number of digits input. Context precision and rounding only come into play during arithmetic operations." +#: ../../library/decimal.rst:184 +msgid "" +"The significance of a new Decimal is determined solely by the number of " +"digits input. Context precision and rounding only come into play during " +"arithmetic operations." msgstr "" +#: ../../library/decimal.rst:188 msgid "" ">>> getcontext().prec = 6\n" ">>> Decimal('3.0')\n" @@ -145,9 +246,13 @@ msgid "" "Decimal('5.85988')" msgstr "" -msgid "If the internal limits of the C version are exceeded, constructing a decimal raises :class:`InvalidOperation`::" +#: ../../library/decimal.rst:201 +msgid "" +"If the internal limits of the C version are exceeded, constructing a decimal " +"raises :class:`InvalidOperation`::" msgstr "" +#: ../../library/decimal.rst:204 msgid "" ">>> Decimal(\"1e9999999999999999999\")\n" "Traceback (most recent call last):\n" @@ -155,9 +260,13 @@ msgid "" "decimal.InvalidOperation: []" msgstr "" -msgid "Decimals interact well with much of the rest of Python. Here is a small decimal floating-point flying circus:" +#: ../../library/decimal.rst:211 +msgid "" +"Decimals interact well with much of the rest of Python. Here is a small " +"decimal floating-point flying circus:" msgstr "" +#: ../../library/decimal.rst:214 msgid "" ">>> data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))\n" ">>> max(data)\n" @@ -186,9 +295,14 @@ msgid "" "Decimal('0.77')" msgstr "" -msgid "Decimals can be formatted (with :func:`format` built-in or :ref:`f-strings`) in fixed-point or scientific notation, using the same formatting syntax (see :ref:`formatspec`) as builtin :class:`float` type:" +#: ../../library/decimal.rst:243 +msgid "" +"Decimals can be formatted (with :func:`format` built-in or :ref:`f-strings`) " +"in fixed-point or scientific notation, using the same formatting syntax " +"(see :ref:`formatspec`) as builtin :class:`float` type:" msgstr "" +#: ../../library/decimal.rst:247 msgid "" ">>> format(Decimal('2.675'), \"f\")\n" "'2.675'\n" @@ -205,21 +319,40 @@ msgid "" "2.67" msgstr "" +#: ../../library/decimal.rst:263 msgid "And some mathematical functions are also available to Decimal:" msgstr "" -msgid "The :meth:`~Decimal.quantize` method rounds a number to a fixed exponent. This method is useful for monetary applications that often round results to a fixed number of places:" +#: ../../library/decimal.rst:275 +msgid "" +"The :meth:`~Decimal.quantize` method rounds a number to a fixed exponent. " +"This method is useful for monetary applications that often round results to " +"a fixed number of places:" msgstr "" -msgid "As shown above, the :func:`getcontext` function accesses the current context and allows the settings to be changed. This approach meets the needs of most applications." +#: ../../library/decimal.rst:284 +msgid "" +"As shown above, the :func:`getcontext` function accesses the current context " +"and allows the settings to be changed. This approach meets the needs of " +"most applications." msgstr "" -msgid "For more advanced work, it may be useful to create alternate contexts using the :meth:`Context` constructor. To make an alternate active, use the :func:`setcontext` function." +#: ../../library/decimal.rst:288 +msgid "" +"For more advanced work, it may be useful to create alternate contexts using " +"the :meth:`Context` constructor. To make an alternate active, use " +"the :func:`setcontext` function." msgstr "" -msgid "In accordance with the standard, the :mod:`!decimal` module provides two ready to use standard contexts, :const:`BasicContext` and :const:`ExtendedContext`. The former is especially useful for debugging because many of the traps are enabled:" +#: ../../library/decimal.rst:292 +msgid "" +"In accordance with the standard, the :mod:`!decimal` module provides two " +"ready to use standard contexts, :const:`BasicContext` " +"and :const:`ExtendedContext`. The former is especially useful for debugging " +"because many of the traps are enabled:" msgstr "" +#: ../../library/decimal.rst:297 msgid "" ">>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)\n" ">>> setcontext(myothercontext)\n" @@ -243,9 +376,15 @@ msgid "" "DivisionByZero: x / 0" msgstr "" -msgid "Contexts also have signal flags for monitoring exceptional conditions encountered during computations. The flags remain set until explicitly cleared, so it is best to clear the flags before each set of monitored computations by using the :meth:`~Context.clear_flags` method. ::" +#: ../../library/decimal.rst:321 +msgid "" +"Contexts also have signal flags for monitoring exceptional conditions " +"encountered during computations. The flags remain set until explicitly " +"cleared, so it is best to clear the flags before each set of monitored " +"computations by using the :meth:`~Context.clear_flags` method. ::" msgstr "" +#: ../../library/decimal.rst:326 msgid "" ">>> setcontext(ExtendedContext)\n" ">>> getcontext().clear_flags()\n" @@ -256,12 +395,20 @@ msgid "" " capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[])" msgstr "" -msgid "The *flags* entry shows that the rational approximation to pi was rounded (digits beyond the context precision were thrown away) and that the result is inexact (some of the discarded digits were non-zero)." +#: ../../library/decimal.rst:334 +msgid "" +"The *flags* entry shows that the rational approximation to pi was rounded " +"(digits beyond the context precision were thrown away) and that the result " +"is inexact (some of the discarded digits were non-zero)." msgstr "" -msgid "Individual traps are set using the dictionary in the :attr:`~Context.traps` attribute of a context:" +#: ../../library/decimal.rst:338 +msgid "" +"Individual traps are set using the dictionary in the :attr:`~Context.traps` " +"attribute of a context:" msgstr "" +#: ../../library/decimal.rst:341 msgid "" ">>> setcontext(ExtendedContext)\n" ">>> Decimal(1) / Decimal(0)\n" @@ -274,21 +421,37 @@ msgid "" "DivisionByZero: x / 0" msgstr "" -msgid "Most programs adjust the current context only once, at the beginning of the program. And, in many applications, data is converted to :class:`Decimal` with a single cast inside a loop. With context set and decimals created, the bulk of the program manipulates the data no differently than with other Python numeric types." +#: ../../library/decimal.rst:353 +msgid "" +"Most programs adjust the current context only once, at the beginning of the " +"program. And, in many applications, data is converted to :class:`Decimal` " +"with a single cast inside a loop. With context set and decimals created, " +"the bulk of the program manipulates the data no differently than with other " +"Python numeric types." msgstr "" +#: ../../library/decimal.rst:365 msgid "Decimal objects" msgstr "" +#: ../../library/decimal.rst:370 msgid "Construct a new :class:`Decimal` object based from *value*." msgstr "" -msgid "*value* can be an integer, string, tuple, :class:`float`, or another :class:`Decimal` object. If no *value* is given, returns ``Decimal('0')``. If *value* is a string, it should conform to the decimal numeric string syntax after leading and trailing whitespace characters, as well as underscores throughout, are removed::" +#: ../../library/decimal.rst:372 +msgid "" +"*value* can be an integer, string, tuple, :class:`float`, or " +"another :class:`Decimal` object. If no *value* is given, returns " +"``Decimal('0')``. If *value* is a string, it should conform to the decimal " +"numeric string syntax after leading and trailing whitespace characters, as " +"well as underscores throughout, are removed::" msgstr "" +#: ../../library/decimal.rst:377 msgid "" "sign ::= '+' | '-'\n" -"digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'\n" +"digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | " +"'9'\n" "indicator ::= 'e' | 'E'\n" "digits ::= digit [digit]...\n" "decimal-part ::= digits '.' [digits] | ['.'] digits\n" @@ -299,39 +462,90 @@ msgid "" "numeric-string ::= [sign] numeric-value | [sign] nan" msgstr "" -msgid "Other Unicode decimal digits are also permitted where ``digit`` appears above. These include decimal digits from various other alphabets (for example, Arabic-Indic and Devanāgarī digits) along with the fullwidth digits ``'\\uff10'`` through ``'\\uff19'``. Case is not significant, so, for example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable spellings for positive infinity." +#: ../../library/decimal.rst:388 +msgid "" +"Other Unicode decimal digits are also permitted where ``digit`` appears " +"above. These include decimal digits from various other alphabets (for " +"example, Arabic-Indic and Devanāgarī digits) along with the fullwidth digits " +"``'\\uff10'`` through ``'\\uff19'``. Case is not significant, so, for " +"example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable " +"spellings for positive infinity." msgstr "" -msgid "If *value* is a :class:`tuple`, it should have three components, a sign (``0`` for positive or ``1`` for negative), a :class:`tuple` of digits, and an integer exponent. For example, ``Decimal((0, (1, 4, 1, 4), -3))`` returns ``Decimal('1.414')``." +#: ../../library/decimal.rst:395 +msgid "" +"If *value* is a :class:`tuple`, it should have three components, a sign " +"(``0`` for positive or ``1`` for negative), a :class:`tuple` of digits, and " +"an integer exponent. For example, ``Decimal((0, (1, 4, 1, 4), -3))`` returns " +"``Decimal('1.414')``." msgstr "" -msgid "If *value* is a :class:`float`, the binary floating-point value is losslessly converted to its exact decimal equivalent. This conversion can often require 53 or more digits of precision. For example, ``Decimal(float('1.1'))`` converts to ``Decimal('1.100000000000000088817841970012523233890533447265625')``." +#: ../../library/decimal.rst:400 +msgid "" +"If *value* is a :class:`float`, the binary floating-point value is " +"losslessly converted to its exact decimal equivalent. This conversion can " +"often require 53 or more digits of precision. For example, " +"``Decimal(float('1.1'))`` converts to " +"``Decimal('1.100000000000000088817841970012523233890533447265625')``." msgstr "" -msgid "The *context* precision does not affect how many digits are stored. That is determined exclusively by the number of digits in *value*. For example, ``Decimal('3.00000')`` records all five zeros even if the context precision is only three." +#: ../../library/decimal.rst:406 +msgid "" +"The *context* precision does not affect how many digits are stored. That is " +"determined exclusively by the number of digits in *value*. For example, " +"``Decimal('3.00000')`` records all five zeros even if the context precision " +"is only three." msgstr "" -msgid "The purpose of the *context* argument is determining what to do if *value* is a malformed string. If the context traps :const:`InvalidOperation`, an exception is raised; otherwise, the constructor returns a new Decimal with the value of ``NaN``." +#: ../../library/decimal.rst:411 +msgid "" +"The purpose of the *context* argument is determining what to do if *value* " +"is a malformed string. If the context traps :const:`InvalidOperation`, an " +"exception is raised; otherwise, the constructor returns a new Decimal with " +"the value of ``NaN``." msgstr "" +#: ../../library/decimal.rst:416 msgid "Once constructed, :class:`Decimal` objects are immutable." msgstr "" -msgid "The argument to the constructor is now permitted to be a :class:`float` instance." +#: ../../library/decimal.rst:418 +msgid "" +"The argument to the constructor is now permitted to be a :class:`float` " +"instance." msgstr "" -msgid ":class:`float` arguments raise an exception if the :exc:`FloatOperation` trap is set. By default the trap is off." +#: ../../library/decimal.rst:422 +msgid "" +":class:`float` arguments raise an exception if the :exc:`FloatOperation` " +"trap is set. By default the trap is off." msgstr "" -msgid "Underscores are allowed for grouping, as with integral and floating-point literals in code." +#: ../../library/decimal.rst:426 +msgid "" +"Underscores are allowed for grouping, as with integral and floating-point " +"literals in code." msgstr "" -msgid "Decimal floating-point objects share many properties with the other built-in numeric types such as :class:`float` and :class:`int`. All of the usual math operations and special methods apply. Likewise, decimal objects can be copied, pickled, printed, used as dictionary keys, used as set elements, compared, sorted, and coerced to another type (such as :class:`float` or :class:`int`)." +#: ../../library/decimal.rst:430 +msgid "" +"Decimal floating-point objects share many properties with the other built-in " +"numeric types such as :class:`float` and :class:`int`. All of the usual " +"math operations and special methods apply. Likewise, decimal objects can be " +"copied, pickled, printed, used as dictionary keys, used as set elements, " +"compared, sorted, and coerced to another type (such as :class:`float` " +"or :class:`int`)." msgstr "" -msgid "There are some small differences between arithmetic on Decimal objects and arithmetic on integers and floats. When the remainder operator ``%`` is applied to Decimal objects, the sign of the result is the sign of the *dividend* rather than the sign of the divisor::" +#: ../../library/decimal.rst:437 +msgid "" +"There are some small differences between arithmetic on Decimal objects and " +"arithmetic on integers and floats. When the remainder operator ``%`` is " +"applied to Decimal objects, the sign of the result is the sign of the " +"*dividend* rather than the sign of the divisor::" msgstr "" +#: ../../library/decimal.rst:442 msgid "" ">>> (-7) % 4\n" "1\n" @@ -339,9 +553,14 @@ msgid "" "Decimal('-3')" msgstr "" -msgid "The integer division operator ``//`` behaves analogously, returning the integer part of the true quotient (truncating towards zero) rather than its floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::" +#: ../../library/decimal.rst:447 +msgid "" +"The integer division operator ``//`` behaves analogously, returning the " +"integer part of the true quotient (truncating towards zero) rather than its " +"floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::" msgstr "" +#: ../../library/decimal.rst:451 msgid "" ">>> -7 // 4\n" "-2\n" @@ -349,41 +568,82 @@ msgid "" "Decimal('-1')" msgstr "" -msgid "The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-integer`` operations (respectively) as described in the specification." +#: ../../library/decimal.rst:456 +msgid "" +"The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-" +"integer`` operations (respectively) as described in the specification." msgstr "" -msgid "Decimal objects cannot generally be combined with floats or instances of :class:`fractions.Fraction` in arithmetic operations: an attempt to add a :class:`Decimal` to a :class:`float`, for example, will raise a :exc:`TypeError`. However, it is possible to use Python's comparison operators to compare a :class:`Decimal` instance ``x`` with another number ``y``. This avoids confusing results when doing equality comparisons between numbers of different types." +#: ../../library/decimal.rst:460 +msgid "" +"Decimal objects cannot generally be combined with floats or instances " +"of :class:`fractions.Fraction` in arithmetic operations: an attempt to add " +"a :class:`Decimal` to a :class:`float`, for example, will raise " +"a :exc:`TypeError`. However, it is possible to use Python's comparison " +"operators to compare a :class:`Decimal` instance ``x`` with another number " +"``y``. This avoids confusing results when doing equality comparisons " +"between numbers of different types." msgstr "" -msgid "Mixed-type comparisons between :class:`Decimal` instances and other numeric types are now fully supported." +#: ../../library/decimal.rst:468 +msgid "" +"Mixed-type comparisons between :class:`Decimal` instances and other numeric " +"types are now fully supported." msgstr "" -msgid "In addition to the standard numeric properties, decimal floating-point objects also have a number of specialized methods:" +#: ../../library/decimal.rst:472 +msgid "" +"In addition to the standard numeric properties, decimal floating-point " +"objects also have a number of specialized methods:" msgstr "" -msgid "Return the adjusted exponent after shifting out the coefficient's rightmost digits until only the lead digit remains: ``Decimal('321e+5').adjusted()`` returns seven. Used for determining the position of the most significant digit with respect to the decimal point." +#: ../../library/decimal.rst:478 +msgid "" +"Return the adjusted exponent after shifting out the coefficient's rightmost " +"digits until only the lead digit remains: ``Decimal('321e+5').adjusted()`` " +"returns seven. Used for determining the position of the most significant " +"digit with respect to the decimal point." msgstr "" -msgid "Return a pair ``(n, d)`` of integers that represent the given :class:`Decimal` instance as a fraction, in lowest terms and with a positive denominator::" +#: ../../library/decimal.rst:485 +msgid "" +"Return a pair ``(n, d)`` of integers that represent the " +"given :class:`Decimal` instance as a fraction, in lowest terms and with a " +"positive denominator::" msgstr "" +#: ../../library/decimal.rst:489 msgid "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" msgstr "" -msgid "The conversion is exact. Raise OverflowError on infinities and ValueError on NaNs." +#: ../../library/decimal.rst:492 +msgid "" +"The conversion is exact. Raise OverflowError on infinities and ValueError " +"on NaNs." msgstr "" -msgid "Return a :term:`named tuple` representation of the number: ``DecimalTuple(sign, digits, exponent)``." +#: ../../library/decimal.rst:499 +msgid "" +"Return a :term:`named tuple` representation of the number: " +"``DecimalTuple(sign, digits, exponent)``." msgstr "" -msgid "Return the canonical encoding of the argument. Currently, the encoding of a :class:`Decimal` instance is always canonical, so this operation returns its argument unchanged." +#: ../../library/decimal.rst:505 +msgid "" +"Return the canonical encoding of the argument. Currently, the encoding of " +"a :class:`Decimal` instance is always canonical, so this operation returns " +"its argument unchanged." msgstr "" -msgid "Compare the values of two Decimal instances. :meth:`compare` returns a Decimal instance, and if either operand is a NaN then the result is a NaN::" +#: ../../library/decimal.rst:511 +msgid "" +"Compare the values of two Decimal instances. :meth:`compare` returns a " +"Decimal instance, and if either operand is a NaN then the result is a NaN::" msgstr "" +#: ../../library/decimal.rst:515 msgid "" "a or b is a NaN ==> Decimal('NaN')\n" "a < b ==> Decimal('-1')\n" @@ -391,45 +651,101 @@ msgid "" "a > b ==> Decimal('1')" msgstr "" -msgid "This operation is identical to the :meth:`compare` method, except that all NaNs signal. That is, if neither operand is a signaling NaN then any quiet NaN operand is treated as though it were a signaling NaN." +#: ../../library/decimal.rst:522 +msgid "" +"This operation is identical to the :meth:`compare` method, except that all " +"NaNs signal. That is, if neither operand is a signaling NaN then any quiet " +"NaN operand is treated as though it were a signaling NaN." msgstr "" -msgid "Compare two operands using their abstract representation rather than their numerical value. Similar to the :meth:`compare` method, but the result gives a total ordering on :class:`Decimal` instances. Two :class:`Decimal` instances with the same numeric value but different representations compare unequal in this ordering:" +#: ../../library/decimal.rst:528 +msgid "" +"Compare two operands using their abstract representation rather than their " +"numerical value. Similar to the :meth:`compare` method, but the result " +"gives a total ordering on :class:`Decimal` instances. Two :class:`Decimal` " +"instances with the same numeric value but different representations compare " +"unequal in this ordering:" msgstr "" -msgid "Quiet and signaling NaNs are also included in the total ordering. The result of this function is ``Decimal('0')`` if both operands have the same representation, ``Decimal('-1')`` if the first operand is lower in the total order than the second, and ``Decimal('1')`` if the first operand is higher in the total order than the second operand. See the specification for details of the total order." +#: ../../library/decimal.rst:537 +msgid "" +"Quiet and signaling NaNs are also included in the total ordering. The " +"result of this function is ``Decimal('0')`` if both operands have the same " +"representation, ``Decimal('-1')`` if the first operand is lower in the total " +"order than the second, and ``Decimal('1')`` if the first operand is higher " +"in the total order than the second operand. See the specification for " +"details of the total order." msgstr "" -msgid "This operation is unaffected by context and is quiet: no flags are changed and no rounding is performed. As an exception, the C version may raise InvalidOperation if the second operand cannot be converted exactly." +#: ../../library/decimal.rst:544 ../../library/decimal.rst:555 +#: ../../library/decimal.rst:583 ../../library/decimal.rst:887 +msgid "" +"This operation is unaffected by context and is quiet: no flags are changed " +"and no rounding is performed. As an exception, the C version may raise " +"InvalidOperation if the second operand cannot be converted exactly." msgstr "" -msgid "Compare two operands using their abstract representation rather than their value as in :meth:`compare_total`, but ignoring the sign of each operand. ``x.compare_total_mag(y)`` is equivalent to ``x.copy_abs().compare_total(y.copy_abs())``." +#: ../../library/decimal.rst:550 +msgid "" +"Compare two operands using their abstract representation rather than their " +"value as in :meth:`compare_total`, but ignoring the sign of each operand. " +"``x.compare_total_mag(y)`` is equivalent to " +"``x.copy_abs().compare_total(y.copy_abs())``." msgstr "" -msgid "Just returns self, this method is only to comply with the Decimal Specification." +#: ../../library/decimal.rst:561 +msgid "" +"Just returns self, this method is only to comply with the Decimal " +"Specification." msgstr "" -msgid "Return the absolute value of the argument. This operation is unaffected by the context and is quiet: no flags are changed and no rounding is performed." +#: ../../library/decimal.rst:566 +msgid "" +"Return the absolute value of the argument. This operation is unaffected by " +"the context and is quiet: no flags are changed and no rounding is performed." msgstr "" -msgid "Return the negation of the argument. This operation is unaffected by the context and is quiet: no flags are changed and no rounding is performed." +#: ../../library/decimal.rst:572 +msgid "" +"Return the negation of the argument. This operation is unaffected by the " +"context and is quiet: no flags are changed and no rounding is performed." msgstr "" -msgid "Return a copy of the first operand with the sign set to be the same as the sign of the second operand. For example:" +#: ../../library/decimal.rst:577 +msgid "" +"Return a copy of the first operand with the sign set to be the same as the " +"sign of the second operand. For example:" msgstr "" -msgid "Return the value of the (natural) exponential function ``e**x`` at the given number. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." +#: ../../library/decimal.rst:589 +msgid "" +"Return the value of the (natural) exponential function ``e**x`` at the given " +"number. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` " +"rounding mode." msgstr "" -msgid "Alternative constructor that only accepts instances of :class:`float` or :class:`int`." +#: ../../library/decimal.rst:600 +msgid "" +"Alternative constructor that only accepts instances of :class:`float` " +"or :class:`int`." msgstr "" -msgid "Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``. Since 0.1 is not exactly representable in binary floating point, the value is stored as the nearest representable value which is ``0x1.999999999999ap-4``. That equivalent value in decimal is ``0.1000000000000000055511151231257827021181583404541015625``." +#: ../../library/decimal.rst:603 +msgid "" +"Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``. " +"Since 0.1 is not exactly representable in binary floating point, the value " +"is stored as the nearest representable value which is " +"``0x1.999999999999ap-4``. That equivalent value in decimal is " +"``0.1000000000000000055511151231257827021181583404541015625``." msgstr "" -msgid "From Python 3.2 onwards, a :class:`Decimal` instance can also be constructed directly from a :class:`float`." +#: ../../library/decimal.rst:609 +msgid "" +"From Python 3.2 onwards, a :class:`Decimal` instance can also be constructed " +"directly from a :class:`float`." msgstr "" +#: ../../library/decimal.rst:612 msgid "" ">>> Decimal.from_float(0.1)\n" "Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" @@ -441,9 +757,14 @@ msgid "" "Decimal('-Infinity')" msgstr "" -msgid "Alternative constructor that only accepts instances of :class:`float`, :class:`int` or :class:`Decimal`, but not strings or tuples." +#: ../../library/decimal.rst:627 +msgid "" +"Alternative constructor that only accepts instances " +"of :class:`float`, :class:`int` or :class:`Decimal`, but not strings or " +"tuples." msgstr "" +#: ../../library/decimal.rst:631 msgid "" ">>> Decimal.from_number(314)\n" "Decimal('314')\n" @@ -453,207 +774,428 @@ msgid "" "Decimal('3.14')" msgstr "" -msgid "Fused multiply-add. Return self*other+third with no rounding of the intermediate product self*other." +#: ../../library/decimal.rst:644 +msgid "" +"Fused multiply-add. Return self*other+third with no rounding of the " +"intermediate product self*other." msgstr "" -msgid "Return :const:`True` if the argument is canonical and :const:`False` otherwise. Currently, a :class:`Decimal` instance is always canonical, so this operation always returns :const:`True`." +#: ../../library/decimal.rst:652 +msgid "" +"Return :const:`True` if the argument is canonical and :const:`False` " +"otherwise. Currently, a :class:`Decimal` instance is always canonical, so " +"this operation always returns :const:`True`." msgstr "" -msgid "Return :const:`True` if the argument is a finite number, and :const:`False` if the argument is an infinity or a NaN." +#: ../../library/decimal.rst:658 +msgid "" +"Return :const:`True` if the argument is a finite number, and :const:`False` " +"if the argument is an infinity or a NaN." msgstr "" -msgid "Return :const:`True` if the argument is either positive or negative infinity and :const:`False` otherwise." +#: ../../library/decimal.rst:663 +msgid "" +"Return :const:`True` if the argument is either positive or negative infinity " +"and :const:`False` otherwise." msgstr "" -msgid "Return :const:`True` if the argument is a (quiet or signaling) NaN and :const:`False` otherwise." +#: ../../library/decimal.rst:668 +msgid "" +"Return :const:`True` if the argument is a (quiet or signaling) NaN " +"and :const:`False` otherwise." msgstr "" -msgid "Return :const:`True` if the argument is a *normal* finite number. Return :const:`False` if the argument is zero, subnormal, infinite or a NaN." +#: ../../library/decimal.rst:673 +msgid "" +"Return :const:`True` if the argument is a *normal* finite number. " +"Return :const:`False` if the argument is zero, subnormal, infinite or a NaN." msgstr "" -msgid "Return :const:`True` if the argument is a quiet NaN, and :const:`False` otherwise." +#: ../../library/decimal.rst:678 +msgid "" +"Return :const:`True` if the argument is a quiet NaN, and :const:`False` " +"otherwise." msgstr "" -msgid "Return :const:`True` if the argument has a negative sign and :const:`False` otherwise. Note that zeros and NaNs can both carry signs." +#: ../../library/decimal.rst:683 +msgid "" +"Return :const:`True` if the argument has a negative sign and :const:`False` " +"otherwise. Note that zeros and NaNs can both carry signs." msgstr "" -msgid "Return :const:`True` if the argument is a signaling NaN and :const:`False` otherwise." +#: ../../library/decimal.rst:688 +msgid "" +"Return :const:`True` if the argument is a signaling NaN and :const:`False` " +"otherwise." msgstr "" -msgid "Return :const:`True` if the argument is subnormal, and :const:`False` otherwise." +#: ../../library/decimal.rst:693 +msgid "" +"Return :const:`True` if the argument is subnormal, and :const:`False` " +"otherwise." msgstr "" -msgid "Return :const:`True` if the argument is a (positive or negative) zero and :const:`False` otherwise." +#: ../../library/decimal.rst:698 +msgid "" +"Return :const:`True` if the argument is a (positive or negative) zero " +"and :const:`False` otherwise." msgstr "" -msgid "Return the natural (base e) logarithm of the operand. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." +#: ../../library/decimal.rst:703 +msgid "" +"Return the natural (base e) logarithm of the operand. The result is " +"correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -msgid "Return the base ten logarithm of the operand. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." +#: ../../library/decimal.rst:708 +msgid "" +"Return the base ten logarithm of the operand. The result is correctly " +"rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -msgid "For a nonzero number, return the adjusted exponent of its operand as a :class:`Decimal` instance. If the operand is a zero then ``Decimal('-Infinity')`` is returned and the :const:`DivisionByZero` flag is raised. If the operand is an infinity then ``Decimal('Infinity')`` is returned." +#: ../../library/decimal.rst:713 +msgid "" +"For a nonzero number, return the adjusted exponent of its operand as " +"a :class:`Decimal` instance. If the operand is a zero then ``Decimal('-" +"Infinity')`` is returned and the :const:`DivisionByZero` flag is raised. If " +"the operand is an infinity then ``Decimal('Infinity')`` is returned." msgstr "" -msgid ":meth:`logical_and` is a logical operation which takes two *logical operands* (see :ref:`logical_operands_label`). The result is the digit-wise ``and`` of the two operands." +#: ../../library/decimal.rst:721 +msgid "" +":meth:`logical_and` is a logical operation which takes two *logical " +"operands* (see :ref:`logical_operands_label`). The result is the digit-wise " +"``and`` of the two operands." msgstr "" -msgid ":meth:`logical_invert` is a logical operation. The result is the digit-wise inversion of the operand." +#: ../../library/decimal.rst:727 +msgid "" +":meth:`logical_invert` is a logical operation. The result is the digit-wise " +"inversion of the operand." msgstr "" -msgid ":meth:`logical_or` is a logical operation which takes two *logical operands* (see :ref:`logical_operands_label`). The result is the digit-wise ``or`` of the two operands." +#: ../../library/decimal.rst:732 +msgid "" +":meth:`logical_or` is a logical operation which takes two *logical operands* " +"(see :ref:`logical_operands_label`). The result is the digit-wise ``or`` of " +"the two operands." msgstr "" -msgid ":meth:`logical_xor` is a logical operation which takes two *logical operands* (see :ref:`logical_operands_label`). The result is the digit-wise exclusive or of the two operands." +#: ../../library/decimal.rst:738 +msgid "" +":meth:`logical_xor` is a logical operation which takes two *logical " +"operands* (see :ref:`logical_operands_label`). The result is the digit-wise " +"exclusive or of the two operands." msgstr "" -msgid "Like ``max(self, other)`` except that the context rounding rule is applied before returning and that ``NaN`` values are either signaled or ignored (depending on the context and whether they are signaling or quiet)." +#: ../../library/decimal.rst:744 +msgid "" +"Like ``max(self, other)`` except that the context rounding rule is applied " +"before returning and that ``NaN`` values are either signaled or ignored " +"(depending on the context and whether they are signaling or quiet)." msgstr "" -msgid "Similar to the :meth:`.max` method, but the comparison is done using the absolute values of the operands." +#: ../../library/decimal.rst:751 +msgid "" +"Similar to the :meth:`.max` method, but the comparison is done using the " +"absolute values of the operands." msgstr "" -msgid "Like ``min(self, other)`` except that the context rounding rule is applied before returning and that ``NaN`` values are either signaled or ignored (depending on the context and whether they are signaling or quiet)." +#: ../../library/decimal.rst:756 +msgid "" +"Like ``min(self, other)`` except that the context rounding rule is applied " +"before returning and that ``NaN`` values are either signaled or ignored " +"(depending on the context and whether they are signaling or quiet)." msgstr "" -msgid "Similar to the :meth:`.min` method, but the comparison is done using the absolute values of the operands." +#: ../../library/decimal.rst:763 +msgid "" +"Similar to the :meth:`.min` method, but the comparison is done using the " +"absolute values of the operands." msgstr "" -msgid "Return the largest number representable in the given context (or in the current thread's context if no context is given) that is smaller than the given operand." +#: ../../library/decimal.rst:768 +msgid "" +"Return the largest number representable in the given context (or in the " +"current thread's context if no context is given) that is smaller than the " +"given operand." msgstr "" -msgid "Return the smallest number representable in the given context (or in the current thread's context if no context is given) that is larger than the given operand." +#: ../../library/decimal.rst:774 +msgid "" +"Return the smallest number representable in the given context (or in the " +"current thread's context if no context is given) that is larger than the " +"given operand." msgstr "" -msgid "If the two operands are unequal, return the number closest to the first operand in the direction of the second operand. If both operands are numerically equal, return a copy of the first operand with the sign set to be the same as the sign of the second operand." +#: ../../library/decimal.rst:780 +msgid "" +"If the two operands are unequal, return the number closest to the first " +"operand in the direction of the second operand. If both operands are " +"numerically equal, return a copy of the first operand with the sign set to " +"be the same as the sign of the second operand." msgstr "" -msgid "Used for producing canonical values of an equivalence class within either the current context or the specified context." +#: ../../library/decimal.rst:787 +msgid "" +"Used for producing canonical values of an equivalence class within either " +"the current context or the specified context." msgstr "" -msgid "This has the same semantics as the unary plus operation, except that if the final result is finite it is reduced to its simplest form, with all trailing zeros removed and its sign preserved. That is, while the coefficient is non-zero and a multiple of ten the coefficient is divided by ten and the exponent is incremented by 1. Otherwise (the coefficient is zero) the exponent is set to 0. In all cases the sign is unchanged." +#: ../../library/decimal.rst:790 +msgid "" +"This has the same semantics as the unary plus operation, except that if the " +"final result is finite it is reduced to its simplest form, with all trailing " +"zeros removed and its sign preserved. That is, while the coefficient is non-" +"zero and a multiple of ten the coefficient is divided by ten and the " +"exponent is incremented by 1. Otherwise (the coefficient is zero) the " +"exponent is set to 0. In all cases the sign is unchanged." msgstr "" -msgid "For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both normalize to the equivalent value ``Decimal('32.1')``." +#: ../../library/decimal.rst:797 +msgid "" +"For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " +"normalize to the equivalent value ``Decimal('32.1')``." msgstr "" +#: ../../library/decimal.rst:800 msgid "Note that rounding is applied *before* reducing to simplest form." msgstr "" -msgid "In the latest versions of the specification, this operation is also known as ``reduce``." +#: ../../library/decimal.rst:802 +msgid "" +"In the latest versions of the specification, this operation is also known as " +"``reduce``." msgstr "" -msgid "Return a string describing the *class* of the operand. The returned value is one of the following ten strings." +#: ../../library/decimal.rst:807 +msgid "" +"Return a string describing the *class* of the operand. The returned value " +"is one of the following ten strings." msgstr "" +#: ../../library/decimal.rst:810 msgid "``\"-Infinity\"``, indicating that the operand is negative infinity." msgstr "" -msgid "``\"-Normal\"``, indicating that the operand is a negative normal number." +#: ../../library/decimal.rst:811 +msgid "" +"``\"-Normal\"``, indicating that the operand is a negative normal number." msgstr "" -msgid "``\"-Subnormal\"``, indicating that the operand is negative and subnormal." +#: ../../library/decimal.rst:812 +msgid "" +"``\"-Subnormal\"``, indicating that the operand is negative and subnormal." msgstr "" +#: ../../library/decimal.rst:813 msgid "``\"-Zero\"``, indicating that the operand is a negative zero." msgstr "" +#: ../../library/decimal.rst:814 msgid "``\"+Zero\"``, indicating that the operand is a positive zero." msgstr "" -msgid "``\"+Subnormal\"``, indicating that the operand is positive and subnormal." +#: ../../library/decimal.rst:815 +msgid "" +"``\"+Subnormal\"``, indicating that the operand is positive and subnormal." msgstr "" -msgid "``\"+Normal\"``, indicating that the operand is a positive normal number." +#: ../../library/decimal.rst:816 +msgid "" +"``\"+Normal\"``, indicating that the operand is a positive normal number." msgstr "" +#: ../../library/decimal.rst:817 msgid "``\"+Infinity\"``, indicating that the operand is positive infinity." msgstr "" +#: ../../library/decimal.rst:818 msgid "``\"NaN\"``, indicating that the operand is a quiet NaN (Not a Number)." msgstr "" +#: ../../library/decimal.rst:819 msgid "``\"sNaN\"``, indicating that the operand is a signaling NaN." msgstr "" -msgid "Return a value equal to the first operand after rounding and having the exponent of the second operand." +#: ../../library/decimal.rst:823 +msgid "" +"Return a value equal to the first operand after rounding and having the " +"exponent of the second operand." msgstr "" -msgid "Unlike other operations, if the length of the coefficient after the quantize operation would be greater than precision, then an :const:`InvalidOperation` is signaled. This guarantees that, unless there is an error condition, the quantized exponent is always equal to that of the right-hand operand." +#: ../../library/decimal.rst:829 +msgid "" +"Unlike other operations, if the length of the coefficient after the quantize " +"operation would be greater than precision, then an :const:`InvalidOperation` " +"is signaled. This guarantees that, unless there is an error condition, the " +"quantized exponent is always equal to that of the right-hand operand." msgstr "" -msgid "Also unlike other operations, quantize never signals Underflow, even if the result is subnormal and inexact." +#: ../../library/decimal.rst:835 +msgid "" +"Also unlike other operations, quantize never signals Underflow, even if the " +"result is subnormal and inexact." msgstr "" -msgid "If the exponent of the second operand is larger than that of the first then rounding may be necessary. In this case, the rounding mode is determined by the ``rounding`` argument if given, else by the given ``context`` argument; if neither argument is given the rounding mode of the current thread's context is used." +#: ../../library/decimal.rst:838 +msgid "" +"If the exponent of the second operand is larger than that of the first then " +"rounding may be necessary. In this case, the rounding mode is determined by " +"the ``rounding`` argument if given, else by the given ``context`` argument; " +"if neither argument is given the rounding mode of the current thread's " +"context is used." msgstr "" -msgid "An error is returned whenever the resulting exponent is greater than :attr:`~Context.Emax` or less than :meth:`~Context.Etiny`." +#: ../../library/decimal.rst:844 +msgid "" +"An error is returned whenever the resulting exponent is greater " +"than :attr:`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -msgid "Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class does all its arithmetic. Included for compatibility with the specification." +#: ../../library/decimal.rst:849 +msgid "" +"Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class " +"does all its arithmetic. Included for compatibility with the specification." msgstr "" -msgid "Return the remainder from dividing *self* by *other*. This differs from ``self % other`` in that the sign of the remainder is chosen so as to minimize its absolute value. More precisely, the return value is ``self - n * other`` where ``n`` is the integer nearest to the exact value of ``self / other``, and if two integers are equally near then the even one is chosen." +#: ../../library/decimal.rst:855 +msgid "" +"Return the remainder from dividing *self* by *other*. This differs from " +"``self % other`` in that the sign of the remainder is chosen so as to " +"minimize its absolute value. More precisely, the return value is ``self - n " +"* other`` where ``n`` is the integer nearest to the exact value of ``self / " +"other``, and if two integers are equally near then the even one is chosen." msgstr "" +#: ../../library/decimal.rst:862 msgid "If the result is zero then its sign will be the sign of *self*." msgstr "" -msgid "Return the result of rotating the digits of the first operand by an amount specified by the second operand. The second operand must be an integer in the range -precision through precision. The absolute value of the second operand gives the number of places to rotate. If the second operand is positive then rotation is to the left; otherwise rotation is to the right. The coefficient of the first operand is padded on the left with zeros to length precision if necessary. The sign and exponent of the first operand are unchanged." +#: ../../library/decimal.rst:873 +msgid "" +"Return the result of rotating the digits of the first operand by an amount " +"specified by the second operand. The second operand must be an integer in " +"the range -precision through precision. The absolute value of the second " +"operand gives the number of places to rotate. If the second operand is " +"positive then rotation is to the left; otherwise rotation is to the right. " +"The coefficient of the first operand is padded on the left with zeros to " +"length precision if necessary. The sign and exponent of the first operand " +"are unchanged." msgstr "" -msgid "Test whether self and other have the same exponent or whether both are ``NaN``." +#: ../../library/decimal.rst:884 +msgid "" +"Test whether self and other have the same exponent or whether both are " +"``NaN``." msgstr "" -msgid "Return the first operand with exponent adjusted by the second. Equivalently, return the first operand multiplied by ``10**other``. The second operand must be an integer." +#: ../../library/decimal.rst:893 +msgid "" +"Return the first operand with exponent adjusted by the second. Equivalently, " +"return the first operand multiplied by ``10**other``. The second operand " +"must be an integer." msgstr "" -msgid "Return the result of shifting the digits of the first operand by an amount specified by the second operand. The second operand must be an integer in the range -precision through precision. The absolute value of the second operand gives the number of places to shift. If the second operand is positive then the shift is to the left; otherwise the shift is to the right. Digits shifted into the coefficient are zeros. The sign and exponent of the first operand are unchanged." +#: ../../library/decimal.rst:899 +msgid "" +"Return the result of shifting the digits of the first operand by an amount " +"specified by the second operand. The second operand must be an integer in " +"the range -precision through precision. The absolute value of the second " +"operand gives the number of places to shift. If the second operand is " +"positive then the shift is to the left; otherwise the shift is to the " +"right. Digits shifted into the coefficient are zeros. The sign and " +"exponent of the first operand are unchanged." msgstr "" +#: ../../library/decimal.rst:909 msgid "Return the square root of the argument to full precision." msgstr "" -msgid "Convert to a string, using engineering notation if an exponent is needed." +#: ../../library/decimal.rst:914 ../../library/decimal.rst:1571 +msgid "" +"Convert to a string, using engineering notation if an exponent is needed." msgstr "" -msgid "Engineering notation has an exponent which is a multiple of 3. This can leave up to 3 digits to the left of the decimal place and may require the addition of either one or two trailing zeros." +#: ../../library/decimal.rst:916 ../../library/decimal.rst:1573 +msgid "" +"Engineering notation has an exponent which is a multiple of 3. This can " +"leave up to 3 digits to the left of the decimal place and may require the " +"addition of either one or two trailing zeros." msgstr "" -msgid "For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." +#: ../../library/decimal.rst:920 +msgid "" +"For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." msgstr "" -msgid "Identical to the :meth:`to_integral_value` method. The ``to_integral`` name has been kept for compatibility with older versions." +#: ../../library/decimal.rst:924 +msgid "" +"Identical to the :meth:`to_integral_value` method. The ``to_integral`` name " +"has been kept for compatibility with older versions." msgstr "" -msgid "Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` as appropriate if rounding occurs. The rounding mode is determined by the ``rounding`` parameter if given, else by the given ``context``. If neither parameter is given then the rounding mode of the current context is used." +#: ../../library/decimal.rst:929 +msgid "" +"Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` " +"as appropriate if rounding occurs. The rounding mode is determined by the " +"``rounding`` parameter if given, else by the given ``context``. If neither " +"parameter is given then the rounding mode of the current context is used." msgstr "" -msgid "Round to the nearest integer without signaling :const:`Inexact` or :const:`Rounded`. If given, applies *rounding*; otherwise, uses the rounding method in either the supplied *context* or the current context." +#: ../../library/decimal.rst:937 +msgid "" +"Round to the nearest integer without signaling :const:`Inexact` " +"or :const:`Rounded`. If given, applies *rounding*; otherwise, uses the " +"rounding method in either the supplied *context* or the current context." msgstr "" +#: ../../library/decimal.rst:941 msgid "Decimal numbers can be rounded using the :func:`.round` function:" msgstr "" -msgid "If *ndigits* is not given or ``None``, returns the nearest :class:`int` to *number*, rounding ties to even, and ignoring the rounding mode of the :class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." -msgstr "" - -msgid "If *ndigits* is an :class:`int`, the context's rounding mode is respected and a :class:`Decimal` representing *number* rounded to the nearest multiple of ``Decimal('1E-ndigits')`` is returned; in this case, ``round(number, ndigits)`` is equivalent to ``self.quantize(Decimal('1E-ndigits'))``. Returns ``Decimal('NaN')`` if *number* is a quiet NaN. Raises :class:`InvalidOperation` if *number* is an infinity, a signaling NaN, or if the length of the coefficient after the quantize operation would be greater than the current context's precision. In other words, for the non-corner cases:" +#: ../../library/decimal.rst:946 +msgid "" +"If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " +"*number*, rounding ties to even, and ignoring the rounding mode of " +"the :class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an " +"infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." msgstr "" -msgid "if *ndigits* is positive, return *number* rounded to *ndigits* decimal places;" +#: ../../library/decimal.rst:952 +msgid "" +"If *ndigits* is an :class:`int`, the context's rounding mode is respected " +"and a :class:`Decimal` representing *number* rounded to the nearest multiple " +"of ``Decimal('1E-ndigits')`` is returned; in this case, ``round(number, " +"ndigits)`` is equivalent to ``self.quantize(Decimal('1E-ndigits'))``. " +"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. " +"Raises :class:`InvalidOperation` if *number* is an infinity, a signaling " +"NaN, or if the length of the coefficient after the quantize operation would " +"be greater than the current context's precision. In other words, for the " +"non-corner cases:" +msgstr "" + +#: ../../library/decimal.rst:962 +msgid "" +"if *ndigits* is positive, return *number* rounded to *ndigits* decimal " +"places;" msgstr "" +#: ../../library/decimal.rst:964 msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" msgstr "" -msgid "if *ndigits* is negative, return *number* rounded to the nearest multiple of ``10**abs(ndigits)``." +#: ../../library/decimal.rst:965 +msgid "" +"if *ndigits* is negative, return *number* rounded to the nearest multiple of " +"``10**abs(ndigits)``." msgstr "" +#: ../../library/decimal.rst:968 msgid "For example::" msgstr "" +#: ../../library/decimal.rst:970 msgid "" ">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" ">>> getcontext().rounding = ROUND_DOWN\n" @@ -669,36 +1211,67 @@ msgid "" "Decimal('0E+1')" msgstr "" +#: ../../library/decimal.rst:987 msgid "Logical operands" msgstr "" -msgid "The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their arguments to be *logical operands*. A *logical operand* is a :class:`Decimal` instance whose exponent and sign are both zero, and whose digits are all either ``0`` or ``1``." +#: ../../library/decimal.rst:989 +msgid "" +"The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:`~Decimal.logical_or`, " +"and :meth:`~Decimal.logical_xor` methods expect their arguments to be " +"*logical operands*. A *logical operand* is a :class:`Decimal` instance " +"whose exponent and sign are both zero, and whose digits are all either ``0`` " +"or ``1``." msgstr "" +#: ../../library/decimal.rst:1001 msgid "Context objects" msgstr "" -msgid "Contexts are environments for arithmetic operations. They govern precision, set rules for rounding, determine which signals are treated as exceptions, and limit the range for exponents." +#: ../../library/decimal.rst:1003 +msgid "" +"Contexts are environments for arithmetic operations. They govern precision, " +"set rules for rounding, determine which signals are treated as exceptions, " +"and limit the range for exponents." msgstr "" -msgid "Each thread has its own current context which is accessed or changed using the :func:`getcontext` and :func:`setcontext` functions:" +#: ../../library/decimal.rst:1007 +msgid "" +"Each thread has its own current context which is accessed or changed using " +"the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" +#: ../../library/decimal.rst:1013 msgid "Return the current context for the active thread." msgstr "" +#: ../../library/decimal.rst:1018 msgid "Set the current context for the active thread to *c*." msgstr "" -msgid "You can also use the :keyword:`with` statement and the :func:`localcontext` function to temporarily change the active context." +#: ../../library/decimal.rst:1020 +msgid "" +"You can also use the :keyword:`with` statement and the :func:`localcontext` " +"function to temporarily change the active context." msgstr "" -msgid "Return a context manager that will set the current context for the active thread to a copy of *ctx* on entry to the with-statement and restore the previous context when exiting the with-statement. If no context is specified, a copy of the current context is used. The *kwargs* argument is used to set the attributes of the new context." +#: ../../library/decimal.rst:1025 +msgid "" +"Return a context manager that will set the current context for the active " +"thread to a copy of *ctx* on entry to the with-statement and restore the " +"previous context when exiting the with-statement. If no context is " +"specified, a copy of the current context is used. The *kwargs* argument is " +"used to set the attributes of the new context." msgstr "" -msgid "For example, the following code sets the current decimal precision to 42 places, performs a calculation, and then automatically restores the previous context::" +#: ../../library/decimal.rst:1031 +msgid "" +"For example, the following code sets the current decimal precision to 42 " +"places, performs a calculation, and then automatically restores the previous " +"context::" msgstr "" +#: ../../library/decimal.rst:1034 msgid "" "from decimal import localcontext\n" "\n" @@ -708,9 +1281,11 @@ msgid "" "s = +s # Round the final result back to the default precision" msgstr "" +#: ../../library/decimal.rst:1041 msgid "Using keyword arguments, the code would be the following::" msgstr "" +#: ../../library/decimal.rst:1043 msgid "" "from decimal import localcontext\n" "\n" @@ -719,95 +1294,208 @@ msgid "" "s = +s" msgstr "" -msgid "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:`Context` doesn't support. Raises either :exc:`TypeError` or :exc:`ValueError` if *kwargs* supplies an invalid value for an attribute." +#: ../../library/decimal.rst:1049 +msgid "" +"Raises :exc:`TypeError` if *kwargs* supplies an attribute " +"that :class:`Context` doesn't support. Raises either :exc:`TypeError` " +"or :exc:`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -msgid ":meth:`localcontext` now supports setting context attributes through the use of keyword arguments." +#: ../../library/decimal.rst:1053 +msgid "" +":meth:`localcontext` now supports setting context attributes through the use " +"of keyword arguments." msgstr "" -msgid "Return a context object initialized to the proper values for one of the IEEE interchange formats. The argument must be a multiple of 32 and less than :const:`IEEE_CONTEXT_MAX_BITS`." +#: ../../library/decimal.rst:1058 +msgid "" +"Return a context object initialized to the proper values for one of the IEEE " +"interchange formats. The argument must be a multiple of 32 and less " +"than :const:`IEEE_CONTEXT_MAX_BITS`." msgstr "" -msgid "New contexts can also be created using the :class:`Context` constructor described below. In addition, the module provides three pre-made contexts:" +#: ../../library/decimal.rst:1064 +msgid "" +"New contexts can also be created using the :class:`Context` constructor " +"described below. In addition, the module provides three pre-made contexts:" msgstr "" -msgid "This is a standard context defined by the General Decimal Arithmetic Specification. Precision is set to nine. Rounding is set to :const:`ROUND_HALF_UP`. All flags are cleared. All traps are enabled (treated as exceptions) except :const:`Inexact`, :const:`Rounded`, and :const:`Subnormal`." +#: ../../library/decimal.rst:1070 +msgid "" +"This is a standard context defined by the General Decimal Arithmetic " +"Specification. Precision is set to nine. Rounding is set " +"to :const:`ROUND_HALF_UP`. All flags are cleared. All traps are enabled " +"(treated as exceptions) except :const:`Inexact`, :const:`Rounded`, " +"and :const:`Subnormal`." msgstr "" -msgid "Because many of the traps are enabled, this context is useful for debugging." +#: ../../library/decimal.rst:1076 +msgid "" +"Because many of the traps are enabled, this context is useful for debugging." msgstr "" -msgid "This is a standard context defined by the General Decimal Arithmetic Specification. Precision is set to nine. Rounding is set to :const:`ROUND_HALF_EVEN`. All flags are cleared. No traps are enabled (so that exceptions are not raised during computations)." +#: ../../library/decimal.rst:1081 +msgid "" +"This is a standard context defined by the General Decimal Arithmetic " +"Specification. Precision is set to nine. Rounding is set " +"to :const:`ROUND_HALF_EVEN`. All flags are cleared. No traps are enabled " +"(so that exceptions are not raised during computations)." msgstr "" -msgid "Because the traps are disabled, this context is useful for applications that prefer to have result value of ``NaN`` or ``Infinity`` instead of raising exceptions. This allows an application to complete a run in the presence of conditions that would otherwise halt the program." +#: ../../library/decimal.rst:1086 +msgid "" +"Because the traps are disabled, this context is useful for applications that " +"prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " +"exceptions. This allows an application to complete a run in the presence of " +"conditions that would otherwise halt the program." msgstr "" -msgid "This context is used by the :class:`Context` constructor as a prototype for new contexts. Changing a field (such a precision) has the effect of changing the default for new contexts created by the :class:`Context` constructor." +#: ../../library/decimal.rst:1094 +msgid "" +"This context is used by the :class:`Context` constructor as a prototype for " +"new contexts. Changing a field (such a precision) has the effect of " +"changing the default for new contexts created by the :class:`Context` " +"constructor." msgstr "" -msgid "This context is most useful in multi-threaded environments. Changing one of the fields before threads are started has the effect of setting system-wide defaults. Changing the fields after threads have started is not recommended as it would require thread synchronization to prevent race conditions." +#: ../../library/decimal.rst:1098 +msgid "" +"This context is most useful in multi-threaded environments. Changing one of " +"the fields before threads are started has the effect of setting system-wide " +"defaults. Changing the fields after threads have started is not recommended " +"as it would require thread synchronization to prevent race conditions." msgstr "" -msgid "In single threaded environments, it is preferable to not use this context at all. Instead, simply create contexts explicitly as described below." +#: ../../library/decimal.rst:1103 +msgid "" +"In single threaded environments, it is preferable to not use this context at " +"all. Instead, simply create contexts explicitly as described below." msgstr "" -msgid "The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context.rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." +#: ../../library/decimal.rst:1106 +msgid "" +"The default values are :attr:`Context.prec`\\ =\\ " +"``28``, :attr:`Context.rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled " +"traps for :class:`Overflow`, :class:`InvalidOperation`, " +"and :class:`DivisionByZero`." msgstr "" -msgid "In addition to the three supplied contexts, new contexts can be created with the :class:`Context` constructor." +#: ../../library/decimal.rst:1111 +msgid "" +"In addition to the three supplied contexts, new contexts can be created with " +"the :class:`Context` constructor." msgstr "" -msgid "Creates a new context. If a field is not specified or is :const:`None`, the default values are copied from the :const:`DefaultContext`. If the *flags* field is not specified or is :const:`None`, all flags are cleared." +#: ../../library/decimal.rst:1117 +msgid "" +"Creates a new context. If a field is not specified or is :const:`None`, the " +"default values are copied from the :const:`DefaultContext`. If the *flags* " +"field is not specified or is :const:`None`, all flags are cleared." msgstr "" -msgid "An integer in the range [``1``, :const:`MAX_PREC`] that sets the precision for arithmetic operations in the context." +#: ../../library/decimal.rst:1123 +msgid "" +"An integer in the range [``1``, :const:`MAX_PREC`] that sets the precision " +"for arithmetic operations in the context." msgstr "" +#: ../../library/decimal.rst:1128 msgid "One of the constants listed in the section `Rounding Modes`_." msgstr "" -msgid "Lists of any signals to be set. Generally, new contexts should only set traps and leave the flags clear." -msgstr "" - -msgid "Integers specifying the outer limits allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range [``0``, :const:`MAX_EMAX`]." +#: ../../library/decimal.rst:1133 +msgid "" +"Lists of any signals to be set. Generally, new contexts should only set " +"traps and leave the flags clear." msgstr "" -msgid "Either ``0`` or ``1`` (the default). If set to ``1``, exponents are printed with a capital ``E``; otherwise, a lowercase ``e`` is used: ``Decimal('6.02e+23')``." +#: ../../library/decimal.rst:1139 +msgid "" +"Integers specifying the outer limits allowable for exponents. *Emin* must be " +"in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range " +"[``0``, :const:`MAX_EMAX`]." msgstr "" -msgid "Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e`` of a :class:`Decimal` instance representable in this context is strictly limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* is ``0`` then a weaker condition holds: the adjusted exponent of the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is ``1``, a large normal number will, where possible, have its exponent reduced and a corresponding number of zeros added to its coefficient, in order to fit the exponent constraints; this preserves the value of the number but loses information about significant trailing zeros. For example::" +#: ../../library/decimal.rst:1145 +msgid "" +"Either ``0`` or ``1`` (the default). If set to ``1``, exponents are printed " +"with a capital ``E``; otherwise, a lowercase ``e`` is used: " +"``Decimal('6.02e+23')``." msgstr "" +#: ../../library/decimal.rst:1151 +msgid "" +"Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e`` of " +"a :class:`Decimal` instance representable in this context is strictly " +"limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* " +"is ``0`` then a weaker condition holds: the adjusted exponent of " +"the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When " +"*clamp* is ``1``, a large normal number will, where possible, have its " +"exponent reduced and a corresponding number of zeros added to its " +"coefficient, in order to fit the exponent constraints; this preserves the " +"value of the number but loses information about significant trailing zeros. " +"For example::" +msgstr "" + +#: ../../library/decimal.rst:1162 msgid "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" msgstr "" -msgid "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal interchange formats specified in IEEE 754." -msgstr "" - -msgid "The :class:`Context` class defines several general purpose methods as well as a large number of methods for doing arithmetic directly in a given context. In addition, for each of the :class:`Decimal` methods described above (with the exception of the :meth:`~Decimal.adjusted` and :meth:`~Decimal.as_tuple` methods) there is a corresponding :class:`Context` method. For example, for a :class:`Context` instance ``C`` and :class:`Decimal` instance ``x``, ``C.exp(x)`` is equivalent to ``x.exp(context=C)``. Each :class:`Context` method accepts a Python integer (an instance of :class:`int`) anywhere that a Decimal instance is accepted." +#: ../../library/decimal.rst:1165 +msgid "" +"A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " +"interchange formats specified in IEEE 754." msgstr "" +#: ../../library/decimal.rst:1168 +msgid "" +"The :class:`Context` class defines several general purpose methods as well " +"as a large number of methods for doing arithmetic directly in a given " +"context. In addition, for each of the :class:`Decimal` methods described " +"above (with the exception of the :meth:`~Decimal.adjusted` " +"and :meth:`~Decimal.as_tuple` methods) there is a " +"corresponding :class:`Context` method. For example, for a :class:`Context` " +"instance ``C`` and :class:`Decimal` instance ``x``, ``C.exp(x)`` is " +"equivalent to ``x.exp(context=C)``. Each :class:`Context` method accepts a " +"Python integer (an instance of :class:`int`) anywhere that a Decimal " +"instance is accepted." +msgstr "" + +#: ../../library/decimal.rst:1181 msgid "Resets all of the flags to ``0``." msgstr "" +#: ../../library/decimal.rst:1185 msgid "Resets all of the traps to ``0``." msgstr "" +#: ../../library/decimal.rst:1191 msgid "Return a duplicate of the context." msgstr "" +#: ../../library/decimal.rst:1195 msgid "Return a copy of the Decimal instance num." msgstr "" -msgid "Creates a new Decimal instance from *num* but using *self* as context. Unlike the :class:`Decimal` constructor, the context precision, rounding method, flags, and traps are applied to the conversion." +#: ../../library/decimal.rst:1199 +msgid "" +"Creates a new Decimal instance from *num* but using *self* as context. " +"Unlike the :class:`Decimal` constructor, the context precision, rounding " +"method, flags, and traps are applied to the conversion." msgstr "" -msgid "This is useful because constants are often given to a greater precision than is needed by the application. Another benefit is that rounding immediately eliminates unintended effects from digits beyond the current precision. In the following example, using unrounded inputs means that adding zero to a sum can change the result:" +#: ../../library/decimal.rst:1203 +msgid "" +"This is useful because constants are often given to a greater precision than " +"is needed by the application. Another benefit is that rounding immediately " +"eliminates unintended effects from digits beyond the current precision. In " +"the following example, using unrounded inputs means that adding zero to a " +"sum can change the result:" msgstr "" +#: ../../library/decimal.rst:1209 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -816,12 +1504,22 @@ msgid "" "Decimal('4.44')" msgstr "" -msgid "This method implements the to-number operation of the IBM specification. If the argument is a string, no leading or trailing whitespace or underscores are permitted." +#: ../../library/decimal.rst:1217 +msgid "" +"This method implements the to-number operation of the IBM specification. If " +"the argument is a string, no leading or trailing whitespace or underscores " +"are permitted." msgstr "" -msgid "Creates a new Decimal instance from a float *f* but rounding using *self* as the context. Unlike the :meth:`Decimal.from_float` class method, the context precision, rounding method, flags, and traps are applied to the conversion." +#: ../../library/decimal.rst:1223 +msgid "" +"Creates a new Decimal instance from a float *f* but rounding using *self* as " +"the context. Unlike the :meth:`Decimal.from_float` class method, the " +"context precision, rounding method, flags, and traps are applied to the " +"conversion." msgstr "" +#: ../../library/decimal.rst:1228 msgid "" ">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" ">>> context.create_decimal_from_float(math.pi)\n" @@ -833,321 +1531,494 @@ msgid "" "decimal.Inexact: None" msgstr "" -msgid "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent value for subnormal results. When underflow occurs, the exponent is set to :const:`Etiny`." +#: ../../library/decimal.rst:1243 +msgid "" +"Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " +"value for subnormal results. When underflow occurs, the exponent is set " +"to :const:`Etiny`." msgstr "" +#: ../../library/decimal.rst:1249 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -msgid "The usual approach to working with decimals is to create :class:`Decimal` instances and then apply arithmetic operations which take place within the current context for the active thread. An alternative approach is to use context methods for calculating within a specific context. The methods are similar to those for the :class:`Decimal` class and are only briefly recounted here." +#: ../../library/decimal.rst:1251 +msgid "" +"The usual approach to working with decimals is to create :class:`Decimal` " +"instances and then apply arithmetic operations which take place within the " +"current context for the active thread. An alternative approach is to use " +"context methods for calculating within a specific context. The methods are " +"similar to those for the :class:`Decimal` class and are only briefly " +"recounted here." msgstr "" +#: ../../library/decimal.rst:1261 msgid "Returns the absolute value of *x*." msgstr "" +#: ../../library/decimal.rst:1266 msgid "Return the sum of *x* and *y*." msgstr "" +#: ../../library/decimal.rst:1271 msgid "Returns the same Decimal object *x*." msgstr "" +#: ../../library/decimal.rst:1276 msgid "Compares *x* and *y* numerically." msgstr "" +#: ../../library/decimal.rst:1281 msgid "Compares the values of the two operands numerically." msgstr "" +#: ../../library/decimal.rst:1286 msgid "Compares two operands using their abstract representation." msgstr "" -msgid "Compares two operands using their abstract representation, ignoring sign." +#: ../../library/decimal.rst:1291 +msgid "" +"Compares two operands using their abstract representation, ignoring sign." msgstr "" +#: ../../library/decimal.rst:1296 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" +#: ../../library/decimal.rst:1301 msgid "Returns a copy of *x* with the sign inverted." msgstr "" +#: ../../library/decimal.rst:1306 msgid "Copies the sign from *y* to *x*." msgstr "" +#: ../../library/decimal.rst:1311 msgid "Return *x* divided by *y*." msgstr "" +#: ../../library/decimal.rst:1316 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" +#: ../../library/decimal.rst:1321 msgid "Divides two numbers and returns the integer part of the result." msgstr "" +#: ../../library/decimal.rst:1326 msgid "Returns ``e ** x``." msgstr "" +#: ../../library/decimal.rst:1331 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" +#: ../../library/decimal.rst:1336 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1341 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1346 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1351 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -msgid "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." +#: ../../library/decimal.rst:1356 +msgid "" +"Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1361 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1366 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -msgid "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." +#: ../../library/decimal.rst:1371 +msgid "" +"Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1376 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1381 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" +#: ../../library/decimal.rst:1386 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" +#: ../../library/decimal.rst:1391 msgid "Returns the base 10 logarithm of *x*." msgstr "" +#: ../../library/decimal.rst:1396 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" +#: ../../library/decimal.rst:1401 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" +#: ../../library/decimal.rst:1406 msgid "Invert all the digits in *x*." msgstr "" +#: ../../library/decimal.rst:1411 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" +#: ../../library/decimal.rst:1416 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" +#: ../../library/decimal.rst:1421 msgid "Compares two values numerically and returns the maximum." msgstr "" +#: ../../library/decimal.rst:1426 ../../library/decimal.rst:1436 msgid "Compares the values numerically with their sign ignored." msgstr "" +#: ../../library/decimal.rst:1431 msgid "Compares two values numerically and returns the minimum." msgstr "" +#: ../../library/decimal.rst:1441 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" +#: ../../library/decimal.rst:1446 msgid "Return the product of *x* and *y*." msgstr "" +#: ../../library/decimal.rst:1451 msgid "Returns the largest representable number smaller than *x*." msgstr "" +#: ../../library/decimal.rst:1456 msgid "Returns the smallest representable number larger than *x*." msgstr "" +#: ../../library/decimal.rst:1461 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" +#: ../../library/decimal.rst:1466 msgid "Reduces *x* to its simplest form." msgstr "" +#: ../../library/decimal.rst:1471 msgid "Returns an indication of the class of *x*." msgstr "" -msgid "Plus corresponds to the unary prefix plus operator in Python. This operation applies the context precision and rounding, so it is *not* an identity operation." +#: ../../library/decimal.rst:1476 +msgid "" +"Plus corresponds to the unary prefix plus operator in Python. This " +"operation applies the context precision and rounding, so it is *not* an " +"identity operation." msgstr "" +#: ../../library/decimal.rst:1483 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -msgid "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must be integral. The result will be inexact unless ``y`` is integral and the result is finite and can be expressed exactly in 'precision' digits. The rounding mode of the context is used. Results are always correctly rounded in the Python version." +#: ../../library/decimal.rst:1485 +msgid "" +"With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " +"be integral. The result will be inexact unless ``y`` is integral and the " +"result is finite and can be expressed exactly in 'precision' digits. The " +"rounding mode of the context is used. Results are always correctly rounded " +"in the Python version." msgstr "" -msgid "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if ``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." +#: ../../library/decimal.rst:1491 +msgid "" +"``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " +"``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -msgid "The C module computes :meth:`power` in terms of the correctly rounded :meth:`exp` and :meth:`ln` functions. The result is well-defined but only \"almost always correctly rounded\"." +#: ../../library/decimal.rst:1494 +msgid "" +"The C module computes :meth:`power` in terms of the correctly " +"rounded :meth:`exp` and :meth:`ln` functions. The result is well-defined but " +"only \"almost always correctly rounded\"." msgstr "" -msgid "With three arguments, compute ``(x**y) % modulo``. For the three argument form, the following restrictions on the arguments hold:" +#: ../../library/decimal.rst:1499 +msgid "" +"With three arguments, compute ``(x**y) % modulo``. For the three argument " +"form, the following restrictions on the arguments hold:" msgstr "" +#: ../../library/decimal.rst:1502 msgid "all three arguments must be integral" msgstr "" +#: ../../library/decimal.rst:1503 msgid "``y`` must be nonnegative" msgstr "" +#: ../../library/decimal.rst:1504 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" +#: ../../library/decimal.rst:1505 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -msgid "The value resulting from ``Context.power(x, y, modulo)`` is equal to the value that would be obtained by computing ``(x**y) % modulo`` with unbounded precision, but is computed more efficiently. The exponent of the result is zero, regardless of the exponents of ``x``, ``y`` and ``modulo``. The result is always exact." +#: ../../library/decimal.rst:1507 +msgid "" +"The value resulting from ``Context.power(x, y, modulo)`` is equal to the " +"value that would be obtained by computing ``(x**y) % modulo`` with unbounded " +"precision, but is computed more efficiently. The exponent of the result is " +"zero, regardless of the exponents of ``x``, ``y`` and ``modulo``. The " +"result is always exact." msgstr "" +#: ../../library/decimal.rst:1517 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" +#: ../../library/decimal.rst:1522 msgid "Just returns 10, as this is Decimal, :)" msgstr "" +#: ../../library/decimal.rst:1527 msgid "Returns the remainder from integer division." msgstr "" -msgid "The sign of the result, if non-zero, is the same as that of the original dividend." +#: ../../library/decimal.rst:1529 +msgid "" +"The sign of the result, if non-zero, is the same as that of the original " +"dividend." msgstr "" -msgid "Returns ``x - y * n``, where *n* is the integer nearest the exact value of ``x / y`` (if the result is 0 then its sign will be the sign of *x*)." +#: ../../library/decimal.rst:1535 +msgid "" +"Returns ``x - y * n``, where *n* is the integer nearest the exact value of " +"``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" +#: ../../library/decimal.rst:1541 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" +#: ../../library/decimal.rst:1546 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" +#: ../../library/decimal.rst:1551 msgid "Returns the first operand after adding the second value its exp." msgstr "" +#: ../../library/decimal.rst:1556 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" +#: ../../library/decimal.rst:1561 msgid "Square root of a non-negative number to context precision." msgstr "" +#: ../../library/decimal.rst:1566 msgid "Return the difference between *x* and *y*." msgstr "" +#: ../../library/decimal.rst:1580 msgid "Rounds to an integer." msgstr "" +#: ../../library/decimal.rst:1585 msgid "Converts a number to a string using scientific notation." msgstr "" +#: ../../library/decimal.rst:1592 msgid "Constants" msgstr "" -msgid "The constants in this section are only relevant for the C module. They are also included in the pure Python version for compatibility." +#: ../../library/decimal.rst:1594 +msgid "" +"The constants in this section are only relevant for the C module. They are " +"also included in the pure Python version for compatibility." msgstr "" +#: ../../library/decimal.rst:1598 msgid "32-bit" msgstr "" +#: ../../library/decimal.rst:1598 msgid "64-bit" msgstr "" +#: ../../library/decimal.rst:1600 ../../library/decimal.rst:1602 msgid "``425000000``" msgstr "" +#: ../../library/decimal.rst:1600 ../../library/decimal.rst:1602 msgid "``999999999999999999``" msgstr "" +#: ../../library/decimal.rst:1604 msgid "``-425000000``" msgstr "" +#: ../../library/decimal.rst:1604 msgid "``-999999999999999999``" msgstr "" +#: ../../library/decimal.rst:1606 msgid "``-849999999``" msgstr "" +#: ../../library/decimal.rst:1606 msgid "``-1999999999999999997``" msgstr "" +#: ../../library/decimal.rst:1608 msgid "``256``" msgstr "" +#: ../../library/decimal.rst:1608 msgid "``512``" msgstr "" -msgid "The value is ``True``. Deprecated, because Python now always has threads." +#: ../../library/decimal.rst:1613 +msgid "" +"The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -msgid "The default value is ``True``. If Python is :option:`configured using the --without-decimal-contextvar option <--without-decimal-contextvar>`, the C version uses a thread-local rather than a coroutine-local context and the value is ``False``. This is slightly faster in some nested context scenarios." +#: ../../library/decimal.rst:1619 +msgid "" +"The default value is ``True``. If Python is :option:`configured using the --" +"without-decimal-contextvar option <--without-decimal-contextvar>`, the C " +"version uses a thread-local rather than a coroutine-local context and the " +"value is ``False``. This is slightly faster in some nested context " +"scenarios." msgstr "" +#: ../../library/decimal.rst:1628 msgid "Rounding modes" msgstr "" +#: ../../library/decimal.rst:1632 msgid "Round towards ``Infinity``." msgstr "" +#: ../../library/decimal.rst:1636 msgid "Round towards zero." msgstr "" +#: ../../library/decimal.rst:1640 msgid "Round towards ``-Infinity``." msgstr "" +#: ../../library/decimal.rst:1644 msgid "Round to nearest with ties going towards zero." msgstr "" +#: ../../library/decimal.rst:1648 msgid "Round to nearest with ties going to nearest even integer." msgstr "" +#: ../../library/decimal.rst:1652 msgid "Round to nearest with ties going away from zero." msgstr "" +#: ../../library/decimal.rst:1656 msgid "Round away from zero." msgstr "" -msgid "Round away from zero if last digit after rounding towards zero would have been 0 or 5; otherwise round towards zero." +#: ../../library/decimal.rst:1660 +msgid "" +"Round away from zero if last digit after rounding towards zero would have " +"been 0 or 5; otherwise round towards zero." msgstr "" +#: ../../library/decimal.rst:1667 msgid "Signals" msgstr "" -msgid "Signals represent conditions that arise during computation. Each corresponds to one context flag and one context trap enabler." +#: ../../library/decimal.rst:1669 +msgid "" +"Signals represent conditions that arise during computation. Each corresponds " +"to one context flag and one context trap enabler." msgstr "" -msgid "The context flag is set whenever the condition is encountered. After the computation, flags may be checked for informational purposes (for instance, to determine whether a computation was exact). After checking the flags, be sure to clear all flags before starting the next computation." +#: ../../library/decimal.rst:1672 +msgid "" +"The context flag is set whenever the condition is encountered. After the " +"computation, flags may be checked for informational purposes (for instance, " +"to determine whether a computation was exact). After checking the flags, be " +"sure to clear all flags before starting the next computation." msgstr "" -msgid "If the context's trap enabler is set for the signal, then the condition causes a Python exception to be raised. For example, if the :class:`DivisionByZero` trap is set, then a :exc:`DivisionByZero` exception is raised upon encountering the condition." +#: ../../library/decimal.rst:1677 +msgid "" +"If the context's trap enabler is set for the signal, then the condition " +"causes a Python exception to be raised. For example, if " +"the :class:`DivisionByZero` trap is set, then a :exc:`DivisionByZero` " +"exception is raised upon encountering the condition." msgstr "" +#: ../../library/decimal.rst:1685 msgid "Altered an exponent to fit representation constraints." msgstr "" -msgid "Typically, clamping occurs when an exponent falls outside the context's :attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the exponent is reduced to fit by adding zeros to the coefficient." +#: ../../library/decimal.rst:1687 +msgid "" +"Typically, clamping occurs when an exponent falls outside the " +"context's :attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If " +"possible, the exponent is reduced to fit by adding zeros to the coefficient." msgstr "" +#: ../../library/decimal.rst:1694 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" +#: ../../library/decimal.rst:1699 msgid "Signals the division of a non-infinite number by zero." msgstr "" -msgid "Can occur with division, modulo division, or when raising a number to a negative power. If this signal is not trapped, returns ``Infinity`` or ``-Infinity`` with the sign determined by the inputs to the calculation." +#: ../../library/decimal.rst:1701 +msgid "" +"Can occur with division, modulo division, or when raising a number to a " +"negative power. If this signal is not trapped, returns ``Infinity`` or ``-" +"Infinity`` with the sign determined by the inputs to the calculation." msgstr "" +#: ../../library/decimal.rst:1708 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -msgid "Signals when non-zero digits were discarded during rounding. The rounded result is returned. The signal flag or trap is used to detect when results are inexact." +#: ../../library/decimal.rst:1710 +msgid "" +"Signals when non-zero digits were discarded during rounding. The rounded " +"result is returned. The signal flag or trap is used to detect when results " +"are inexact." msgstr "" +#: ../../library/decimal.rst:1717 msgid "An invalid operation was performed." msgstr "" -msgid "Indicates that an operation was requested that does not make sense. If not trapped, returns ``NaN``. Possible causes include::" +#: ../../library/decimal.rst:1719 +msgid "" +"Indicates that an operation was requested that does not make sense. If not " +"trapped, returns ``NaN``. Possible causes include::" msgstr "" +#: ../../library/decimal.rst:1722 msgid "" "Infinity - Infinity\n" "0 * Infinity\n" @@ -1160,42 +2031,77 @@ msgid "" "x ** Infinity" msgstr "" +#: ../../library/decimal.rst:1735 msgid "Numerical overflow." msgstr "" -msgid "Indicates the exponent is larger than :attr:`Context.Emax` after rounding has occurred. If not trapped, the result depends on the rounding mode, either pulling inward to the largest representable finite number or rounding outward to ``Infinity``. In either case, :class:`Inexact` and :class:`Rounded` are also signaled." +#: ../../library/decimal.rst:1737 +msgid "" +"Indicates the exponent is larger than :attr:`Context.Emax` after rounding " +"has occurred. If not trapped, the result depends on the rounding mode, " +"either pulling inward to the largest representable finite number or rounding " +"outward to ``Infinity``. In either case, :class:`Inexact` " +"and :class:`Rounded` are also signaled." msgstr "" +#: ../../library/decimal.rst:1746 msgid "Rounding occurred though possibly no information was lost." msgstr "" -msgid "Signaled whenever rounding discards digits; even if those digits are zero (such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result unchanged. This signal is used to detect loss of significant digits." +#: ../../library/decimal.rst:1748 +msgid "" +"Signaled whenever rounding discards digits; even if those digits are zero " +"(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " +"unchanged. This signal is used to detect loss of significant digits." msgstr "" +#: ../../library/decimal.rst:1756 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -msgid "Occurs when an operation result is subnormal (the exponent is too small). If not trapped, returns the result unchanged." +#: ../../library/decimal.rst:1758 +msgid "" +"Occurs when an operation result is subnormal (the exponent is too small). If " +"not trapped, returns the result unchanged." msgstr "" +#: ../../library/decimal.rst:1764 msgid "Numerical underflow with result rounded to zero." msgstr "" -msgid "Occurs when a subnormal result is pushed to zero by rounding. :class:`Inexact` and :class:`Subnormal` are also signaled." +#: ../../library/decimal.rst:1766 +msgid "" +"Occurs when a subnormal result is pushed to zero by " +"rounding. :class:`Inexact` and :class:`Subnormal` are also signaled." msgstr "" +#: ../../library/decimal.rst:1772 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -msgid "If the signal is not trapped (default), mixing floats and Decimals is permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal.Context.create_decimal` and all comparison operators. Both conversion and comparisons are exact. Any occurrence of a mixed operation is silently recorded by setting :exc:`FloatOperation` in the context flags. Explicit conversions with :meth:`~decimal.Decimal.from_float` or :meth:`~decimal.Context.create_decimal_from_float` do not set the flag." +#: ../../library/decimal.rst:1774 +msgid "" +"If the signal is not trapped (default), mixing floats and Decimals is " +"permitted in the :class:`~decimal.Decimal` " +"constructor, :meth:`~decimal.Context.create_decimal` and all comparison " +"operators. Both conversion and comparisons are exact. Any occurrence of a " +"mixed operation is silently recorded by setting :exc:`FloatOperation` in the " +"context flags. Explicit conversions with :meth:`~decimal.Decimal.from_float` " +"or :meth:`~decimal.Context.create_decimal_from_float` do not set the flag." msgstr "" -msgid "Otherwise (the signal is trapped), only equality comparisons and explicit conversions are silent. All other mixed operations raise :exc:`FloatOperation`." +#: ../../library/decimal.rst:1782 +msgid "" +"Otherwise (the signal is trapped), only equality comparisons and explicit " +"conversions are silent. All other mixed operations " +"raise :exc:`FloatOperation`." msgstr "" +#: ../../library/decimal.rst:1786 msgid "The following table summarizes the hierarchy of signals::" msgstr "" +#: ../../library/decimal.rst:1788 msgid "" "exceptions.ArithmeticError(exceptions.Exception)\n" " DecimalException\n" @@ -1210,18 +2116,32 @@ msgid "" " FloatOperation(DecimalException, exceptions.TypeError)" msgstr "" +#: ../../library/decimal.rst:1807 msgid "Floating-point notes" msgstr "" +#: ../../library/decimal.rst:1811 msgid "Mitigating round-off error with increased precision" msgstr "" -msgid "The use of decimal floating point eliminates decimal representation error (making it possible to represent ``0.1`` exactly); however, some operations can still incur round-off error when non-zero digits exceed the fixed precision." +#: ../../library/decimal.rst:1813 +msgid "" +"The use of decimal floating point eliminates decimal representation error " +"(making it possible to represent ``0.1`` exactly); however, some operations " +"can still incur round-off error when non-zero digits exceed the fixed " +"precision." msgstr "" -msgid "The effects of round-off error can be amplified by the addition or subtraction of nearly offsetting quantities resulting in loss of significance. Knuth provides two instructive examples where rounded floating-point arithmetic with insufficient precision causes the breakdown of the associative and distributive properties of addition:" +#: ../../library/decimal.rst:1817 +msgid "" +"The effects of round-off error can be amplified by the addition or " +"subtraction of nearly offsetting quantities resulting in loss of " +"significance. Knuth provides two instructive examples where rounded " +"floating-point arithmetic with insufficient precision causes the breakdown " +"of the associative and distributive properties of addition:" msgstr "" +#: ../../library/decimal.rst:1823 msgid "" "# Examples from Seminumerical Algorithms, Section 4.2.2.\n" ">>> from decimal import Decimal, getcontext\n" @@ -1240,9 +2160,13 @@ msgid "" "Decimal('0.0060000')" msgstr "" -msgid "The :mod:`!decimal` module makes it possible to restore the identities by expanding the precision sufficiently to avoid loss of significance:" +#: ../../library/decimal.rst:1841 +msgid "" +"The :mod:`!decimal` module makes it possible to restore the identities by " +"expanding the precision sufficiently to avoid loss of significance:" msgstr "" +#: ../../library/decimal.rst:1844 msgid "" ">>> getcontext().prec = 20\n" ">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" @@ -1258,51 +2182,130 @@ msgid "" "Decimal('0.0060000')" msgstr "" +#: ../../library/decimal.rst:1861 msgid "Special values" msgstr "" -msgid "The number system for the :mod:`!decimal` module provides special values including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, ``+0`` and ``-0``." -msgstr "" - -msgid "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, they can arise from dividing by zero when the :exc:`DivisionByZero` signal is not trapped. Likewise, when the :exc:`Overflow` signal is not trapped, infinity can result from rounding beyond the limits of the largest representable number." +#: ../../library/decimal.rst:1863 +msgid "" +"The number system for the :mod:`!decimal` module provides special values " +"including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " +"``+0`` and ``-0``." msgstr "" -msgid "The infinities are signed (affine) and can be used in arithmetic operations where they get treated as very large, indeterminate numbers. For instance, adding a constant to infinity gives another infinite result." +#: ../../library/decimal.rst:1867 +msgid "" +"Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " +"they can arise from dividing by zero when the :exc:`DivisionByZero` signal " +"is not trapped. Likewise, when the :exc:`Overflow` signal is not trapped, " +"infinity can result from rounding beyond the limits of the largest " +"representable number." msgstr "" -msgid "Some operations are indeterminate and return ``NaN``, or if the :exc:`InvalidOperation` signal is trapped, raise an exception. For example, ``0/0`` returns ``NaN`` which means \"not a number\". This variety of ``NaN`` is quiet and, once created, will flow through other computations always resulting in another ``NaN``. This behavior can be useful for a series of computations that occasionally have missing inputs --- it allows the calculation to proceed while flagging specific results as invalid." +#: ../../library/decimal.rst:1872 +msgid "" +"The infinities are signed (affine) and can be used in arithmetic operations " +"where they get treated as very large, indeterminate numbers. For instance, " +"adding a constant to infinity gives another infinite result." msgstr "" -msgid "A variant is ``sNaN`` which signals rather than remaining quiet after every operation. This is a useful return value when an invalid result needs to interrupt a calculation for special handling." +#: ../../library/decimal.rst:1876 +msgid "" +"Some operations are indeterminate and return ``NaN``, or if " +"the :exc:`InvalidOperation` signal is trapped, raise an exception. For " +"example, ``0/0`` returns ``NaN`` which means \"not a number\". This variety " +"of ``NaN`` is quiet and, once created, will flow through other computations " +"always resulting in another ``NaN``. This behavior can be useful for a " +"series of computations that occasionally have missing inputs --- it allows " +"the calculation to proceed while flagging specific results as invalid." msgstr "" -msgid "The behavior of Python's comparison operators can be a little surprising where a ``NaN`` is involved. A test for equality where one of the operands is a quiet or signaling ``NaN`` always returns :const:`False` (even when doing ``Decimal('NaN')==Decimal('NaN')``), while a test for inequality always returns :const:`True`. An attempt to compare two Decimals using any of the ``<``, ``<=``, ``>`` or ``>=`` operators will raise the :exc:`InvalidOperation` signal if either operand is a ``NaN``, and return :const:`False` if this signal is not trapped. Note that the General Decimal Arithmetic specification does not specify the behavior of direct comparisons; these rules for comparisons involving a ``NaN`` were taken from the IEEE 854 standard (see Table 3 in section 5.7). To ensure strict standards-compliance, use the :meth:`~Decimal.compare` and :meth:`~Decimal.compare_signal` methods instead." +#: ../../library/decimal.rst:1884 +msgid "" +"A variant is ``sNaN`` which signals rather than remaining quiet after every " +"operation. This is a useful return value when an invalid result needs to " +"interrupt a calculation for special handling." msgstr "" -msgid "The signed zeros can result from calculations that underflow. They keep the sign that would have resulted if the calculation had been carried out to greater precision. Since their magnitude is zero, both positive and negative zeros are treated as equal and their sign is informational." +#: ../../library/decimal.rst:1888 +msgid "" +"The behavior of Python's comparison operators can be a little surprising " +"where a ``NaN`` is involved. A test for equality where one of the operands " +"is a quiet or signaling ``NaN`` always returns :const:`False` (even when " +"doing ``Decimal('NaN')==Decimal('NaN')``), while a test for inequality " +"always returns :const:`True`. An attempt to compare two Decimals using any " +"of the ``<``, ``<=``, ``>`` or ``>=`` operators will raise " +"the :exc:`InvalidOperation` signal if either operand is a ``NaN``, and " +"return :const:`False` if this signal is not trapped. Note that the General " +"Decimal Arithmetic specification does not specify the behavior of direct " +"comparisons; these rules for comparisons involving a ``NaN`` were taken from " +"the IEEE 854 standard (see Table 3 in section 5.7). To ensure strict " +"standards-compliance, use the :meth:`~Decimal.compare` " +"and :meth:`~Decimal.compare_signal` methods instead." +msgstr "" + +#: ../../library/decimal.rst:1901 +msgid "" +"The signed zeros can result from calculations that underflow. They keep the " +"sign that would have resulted if the calculation had been carried out to " +"greater precision. Since their magnitude is zero, both positive and " +"negative zeros are treated as equal and their sign is informational." msgstr "" -msgid "In addition to the two signed zeros which are distinct yet equal, there are various representations of zero with differing precisions yet equivalent in value. This takes a bit of getting used to. For an eye accustomed to normalized floating-point representations, it is not immediately obvious that the following calculation returns a value equal to zero:" +#: ../../library/decimal.rst:1906 +msgid "" +"In addition to the two signed zeros which are distinct yet equal, there are " +"various representations of zero with differing precisions yet equivalent in " +"value. This takes a bit of getting used to. For an eye accustomed to " +"normalized floating-point representations, it is not immediately obvious " +"that the following calculation returns a value equal to zero:" msgstr "" +#: ../../library/decimal.rst:1921 msgid "Working with threads" msgstr "" -msgid "The :func:`getcontext` function accesses a different :class:`Context` object for each thread. Having separate thread contexts means that threads may make changes (such as ``getcontext().prec=10``) without interfering with other threads." +#: ../../library/decimal.rst:1923 +msgid "" +"The :func:`getcontext` function accesses a different :class:`Context` object " +"for each thread. Having separate thread contexts means that threads may " +"make changes (such as ``getcontext().prec=10``) without interfering with " +"other threads." msgstr "" -msgid "Likewise, the :func:`setcontext` function automatically assigns its target to the current thread." +#: ../../library/decimal.rst:1927 +msgid "" +"Likewise, the :func:`setcontext` function automatically assigns its target " +"to the current thread." msgstr "" -msgid "If :func:`setcontext` has not been called before :func:`getcontext`, then :func:`getcontext` will automatically create a new context for use in the current thread. New context objects have default values set from the :data:`decimal.DefaultContext` object." +#: ../../library/decimal.rst:1930 +msgid "" +"If :func:`setcontext` has not been called before :func:`getcontext`, " +"then :func:`getcontext` will automatically create a new context for use in " +"the current thread. New context objects have default values set from " +"the :data:`decimal.DefaultContext` object." msgstr "" -msgid "The :data:`sys.flags.thread_inherit_context` flag affects the context for new threads. If the flag is false, new threads will start with an empty context. In this case, :func:`getcontext` will create a new context object when called and use the default values from *DefaultContext*. If the flag is true, new threads will start with a copy of context from the caller of :meth:`threading.Thread.start`." +#: ../../library/decimal.rst:1935 +msgid "" +"The :data:`sys.flags.thread_inherit_context` flag affects the context for " +"new threads. If the flag is false, new threads will start with an empty " +"context. In this case, :func:`getcontext` will create a new context object " +"when called and use the default values from *DefaultContext*. If the flag " +"is true, new threads will start with a copy of context from the caller " +"of :meth:`threading.Thread.start`." msgstr "" -msgid "To control the defaults so that each thread will use the same values throughout the application, directly modify the *DefaultContext* object. This should be done *before* any threads are started so that there won't be a race condition between threads calling :func:`getcontext`. For example::" +#: ../../library/decimal.rst:1942 +msgid "" +"To control the defaults so that each thread will use the same values " +"throughout the application, directly modify the *DefaultContext* object. " +"This should be done *before* any threads are started so that there won't be " +"a race condition between threads calling :func:`getcontext`. For example::" msgstr "" +#: ../../library/decimal.rst:1947 msgid "" "# Set applicationwide defaults for all threads about to be launched\n" "DefaultContext.prec = 12\n" @@ -1318,12 +2321,17 @@ msgid "" " . . ." msgstr "" +#: ../../library/decimal.rst:1966 msgid "Recipes" msgstr "" -msgid "Here are a few recipes that serve as utility functions and that demonstrate ways to work with the :class:`Decimal` class::" +#: ../../library/decimal.rst:1968 +msgid "" +"Here are a few recipes that serve as utility functions and that demonstrate " +"ways to work with the :class:`Decimal` class::" msgstr "" +#: ../../library/decimal.rst:1971 msgid "" "def moneyfmt(value, places=2, curr='', sep=',', dp='.',\n" " pos='', neg='-', trailneg=''):\n" @@ -1395,7 +2403,8 @@ msgid "" " return +s # unary plus applies the new precision\n" "\n" "def exp(x):\n" -" \"\"\"Return e raised to the power of x. Result type matches input type.\n" +" \"\"\"Return e raised to the power of x. Result type matches input " +"type.\n" "\n" " >>> print(exp(Decimal(1)))\n" " 2.718281828459045235360287471\n" @@ -1471,42 +2480,83 @@ msgid "" " return +s" msgstr "" +#: ../../library/decimal.rst:2123 msgid "Decimal FAQ" msgstr "" -msgid "Q: It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way to minimize typing when using the interactive interpreter?" +#: ../../library/decimal.rst:2125 +msgid "" +"Q: It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " +"to minimize typing when using the interactive interpreter?" msgstr "" +#: ../../library/decimal.rst:2128 msgid "A: Some users abbreviate the constructor to just a single letter:" msgstr "" -msgid "Q: In a fixed-point application with two decimal places, some inputs have many places and need to be rounded. Others are not supposed to have excess digits and need to be validated. What methods should be used?" +#: ../../library/decimal.rst:2134 +msgid "" +"Q: In a fixed-point application with two decimal places, some inputs have " +"many places and need to be rounded. Others are not supposed to have excess " +"digits and need to be validated. What methods should be used?" msgstr "" -msgid "A: The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal places. If the :const:`Inexact` trap is set, it is also useful for validation:" +#: ../../library/decimal.rst:2138 +msgid "" +"A: The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " +"places. If the :const:`Inexact` trap is set, it is also useful for " +"validation:" msgstr "" -msgid "Q: Once I have valid two place inputs, how do I maintain that invariant throughout an application?" +#: ../../library/decimal.rst:2156 +msgid "" +"Q: Once I have valid two place inputs, how do I maintain that invariant " +"throughout an application?" msgstr "" -msgid "A: Some operations like addition, subtraction, and multiplication by an integer will automatically preserve fixed point. Others operations, like division and non-integer multiplication, will change the number of decimal places and need to be followed-up with a :meth:`~Decimal.quantize` step:" +#: ../../library/decimal.rst:2159 +msgid "" +"A: Some operations like addition, subtraction, and multiplication by an " +"integer will automatically preserve fixed point. Others operations, like " +"division and non-integer multiplication, will change the number of decimal " +"places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -msgid "In developing fixed-point applications, it is convenient to define functions to handle the :meth:`~Decimal.quantize` step:" +#: ../../library/decimal.rst:2177 +msgid "" +"In developing fixed-point applications, it is convenient to define functions " +"to handle the :meth:`~Decimal.quantize` step:" msgstr "" -msgid "Q: There are many ways to express the same value. The numbers ``200``, ``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various precisions. Is there a way to transform them to a single recognizable canonical value?" +#: ../../library/decimal.rst:2191 +msgid "" +"Q: There are many ways to express the same value. The numbers ``200``, " +"``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " +"precisions. Is there a way to transform them to a single recognizable " +"canonical value?" msgstr "" -msgid "A: The :meth:`~Decimal.normalize` method maps all equivalent values to a single representative:" +#: ../../library/decimal.rst:2196 +msgid "" +"A: The :meth:`~Decimal.normalize` method maps all equivalent values to a " +"single representative:" msgstr "" +#: ../../library/decimal.rst:2203 msgid "Q: When does rounding occur in a computation?" msgstr "" -msgid "A: It occurs *after* the computation. The philosophy of the decimal specification is that numbers are considered exact and are created independent of the current context. They can even have greater precision than current context. Computations process with those exact inputs and then rounding (or other context operations) is applied to the *result* of the computation::" +#: ../../library/decimal.rst:2205 +msgid "" +"A: It occurs *after* the computation. The philosophy of the decimal " +"specification is that numbers are considered exact and are created " +"independent of the current context. They can even have greater precision " +"than current context. Computations process with those exact inputs and then " +"rounding (or other context operations) is applied to the *result* of the " +"computation::" msgstr "" +#: ../../library/decimal.rst:2212 msgid "" ">>> getcontext().prec = 5\n" ">>> pi = Decimal('3.1415926535') # More than 5 digits\n" @@ -1520,38 +2570,75 @@ msgid "" "Decimal('3.1416')" msgstr "" -msgid "Q: Some decimal values always print with exponential notation. Is there a way to get a non-exponential representation?" +#: ../../library/decimal.rst:2223 +msgid "" +"Q: Some decimal values always print with exponential notation. Is there a " +"way to get a non-exponential representation?" msgstr "" -msgid "A: For some values, exponential notation is the only way to express the number of significant places in the coefficient. For example, expressing ``5.0E+3`` as ``5000`` keeps the value constant but cannot show the original's two-place significance." +#: ../../library/decimal.rst:2226 +msgid "" +"A: For some values, exponential notation is the only way to express the " +"number of significant places in the coefficient. For example, expressing " +"``5.0E+3`` as ``5000`` keeps the value constant but cannot show the " +"original's two-place significance." msgstr "" -msgid "If an application does not care about tracking significance, it is easy to remove the exponent and trailing zeroes, losing significance, but keeping the value unchanged:" +#: ../../library/decimal.rst:2231 +msgid "" +"If an application does not care about tracking significance, it is easy to " +"remove the exponent and trailing zeroes, losing significance, but keeping " +"the value unchanged:" msgstr "" +#: ../../library/decimal.rst:2241 msgid "Q: Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -msgid "A: Yes, any binary floating-point number can be exactly expressed as a Decimal though an exact conversion may take more precision than intuition would suggest:" +#: ../../library/decimal.rst:2243 +msgid "" +"A: Yes, any binary floating-point number can be exactly expressed as a " +"Decimal though an exact conversion may take more precision than intuition " +"would suggest:" msgstr "" +#: ../../library/decimal.rst:2247 msgid "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" msgstr "" -msgid "Q: Within a complex calculation, how can I make sure that I haven't gotten a spurious result because of insufficient precision or rounding anomalies." +#: ../../library/decimal.rst:2252 +msgid "" +"Q: Within a complex calculation, how can I make sure that I haven't gotten a " +"spurious result because of insufficient precision or rounding anomalies." msgstr "" -msgid "A: The decimal module makes it easy to test results. A best practice is to re-run calculations using greater precision and with various rounding modes. Widely differing results indicate insufficient precision, rounding mode issues, ill-conditioned inputs, or a numerically unstable algorithm." +#: ../../library/decimal.rst:2255 +msgid "" +"A: The decimal module makes it easy to test results. A best practice is to " +"re-run calculations using greater precision and with various rounding modes. " +"Widely differing results indicate insufficient precision, rounding mode " +"issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -msgid "Q: I noticed that context precision is applied to the results of operations but not to the inputs. Is there anything to watch out for when mixing values of different precisions?" +#: ../../library/decimal.rst:2260 +msgid "" +"Q: I noticed that context precision is applied to the results of operations " +"but not to the inputs. Is there anything to watch out for when mixing " +"values of different precisions?" msgstr "" -msgid "A: Yes. The principle is that all values are considered to be exact and so is the arithmetic on those values. Only the results are rounded. The advantage for inputs is that \"what you type is what you get\". A disadvantage is that the results can look odd if you forget that the inputs haven't been rounded:" +#: ../../library/decimal.rst:2264 +msgid "" +"A: Yes. The principle is that all values are considered to be exact and so " +"is the arithmetic on those values. Only the results are rounded. The " +"advantage for inputs is that \"what you type is what you get\". A " +"disadvantage is that the results can look odd if you forget that the inputs " +"haven't been rounded:" msgstr "" +#: ../../library/decimal.rst:2269 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -1560,30 +2647,57 @@ msgid "" "Decimal('5.20')" msgstr "" -msgid "The solution is either to increase precision or to force rounding of inputs using the unary plus operation:" +#: ../../library/decimal.rst:2277 +msgid "" +"The solution is either to increase precision or to force rounding of inputs " +"using the unary plus operation:" msgstr "" +#: ../../library/decimal.rst:2280 msgid "" ">>> getcontext().prec = 3\n" ">>> +Decimal('1.23456789') # unary plus triggers rounding\n" "Decimal('1.23')" msgstr "" -msgid "Alternatively, inputs can be rounded upon creation using the :meth:`Context.create_decimal` method:" +#: ../../library/decimal.rst:2286 +msgid "" +"Alternatively, inputs can be rounded upon creation using " +"the :meth:`Context.create_decimal` method:" msgstr "" +#: ../../library/decimal.rst:2292 msgid "Q: Is the CPython implementation fast for large numbers?" msgstr "" -msgid "A: Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of the decimal module integrate the high speed `libmpdec `_ library for arbitrary precision correctly rounded decimal floating-point arithmetic [#]_. ``libmpdec`` uses `Karatsuba multiplication `_ for medium-sized numbers and the `Number Theoretic Transform `_ for very large numbers." -msgstr "" - -msgid "The context must be adapted for exact arbitrary precision arithmetic. :attr:`~Context.Emin` and :attr:`~Context.Emax` should always be set to the maximum values, :attr:`~Context.clamp` should always be 0 (the default). Setting :attr:`~Context.prec` requires some care." +#: ../../library/decimal.rst:2294 +msgid "" +"A: Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " +"the decimal module integrate the high speed `libmpdec `_ library for arbitrary " +"precision correctly rounded decimal floating-point arithmetic [#]_. " +"``libmpdec`` uses `Karatsuba multiplication `_ for medium-sized numbers and the `Number Theoretic " +"Transform `_ for very " +"large numbers." +msgstr "" + +#: ../../library/decimal.rst:2304 +msgid "" +"The context must be adapted for exact arbitrary precision " +"arithmetic. :attr:`~Context.Emin` and :attr:`~Context.Emax` should always be " +"set to the maximum values, :attr:`~Context.clamp` should always be 0 (the " +"default). Setting :attr:`~Context.prec` requires some care." msgstr "" -msgid "The easiest approach for trying out bignum arithmetic is to use the maximum value for :attr:`~Context.prec` as well [#]_::" +#: ../../library/decimal.rst:2308 +msgid "" +"The easiest approach for trying out bignum arithmetic is to use the maximum " +"value for :attr:`~Context.prec` as well [#]_::" msgstr "" +#: ../../library/decimal.rst:2311 msgid "" ">>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" ">>> x = Decimal(2) ** 256\n" @@ -1591,9 +2705,13 @@ msgid "" "Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" msgstr "" -msgid "For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms and the available memory will be insufficient::" +#: ../../library/decimal.rst:2317 +msgid "" +"For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " +"and the available memory will be insufficient::" msgstr "" +#: ../../library/decimal.rst:2320 msgid "" ">>> Decimal(1) / 3\n" "Traceback (most recent call last):\n" @@ -1601,13 +2719,20 @@ msgid "" "MemoryError" msgstr "" -msgid "On systems with overallocation (e.g. Linux), a more sophisticated approach is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose that you have 8GB of RAM and expect 10 simultaneous operands using a maximum of 500MB each::" +#: ../../library/decimal.rst:2325 +msgid "" +"On systems with overallocation (e.g. Linux), a more sophisticated approach " +"is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " +"that you have 8GB of RAM and expect 10 simultaneous operands using a maximum " +"of 500MB each::" msgstr "" +#: ../../library/decimal.rst:2329 msgid "" ">>> import sys\n" ">>>\n" -">>> # Maximum number of digits for a single operand using 500MB in 8-byte words\n" +">>> # Maximum number of digits for a single operand using 500MB in 8-byte " +"words\n" ">>> # with 19 digits per word (4-byte and 9 digits for the 32-bit build):\n" ">>> maxdigits = 19 * ((500 * 1024**2) // 8)\n" ">>>\n" @@ -1626,8 +2751,14 @@ msgid "" " decimal.Inexact: []" msgstr "" -msgid "In general (and especially on systems without overallocation), it is recommended to estimate even tighter bounds and set the :attr:`Inexact` trap if all calculations are expected to be exact." +#: ../../library/decimal.rst:2349 +msgid "" +"In general (and especially on systems without overallocation), it is " +"recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " +"if all calculations are expected to be exact." msgstr "" -msgid "This approach now works for all exact results except for non-integer powers." +#: ../../library/decimal.rst:2358 +msgid "" +"This approach now works for all exact results except for non-integer powers." msgstr "" diff --git a/library/development.po b/library/development.po index 21756a875..08d3f8612 100644 --- a/library/development.po +++ b/library/development.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,19 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/development.rst:5 msgid "Development Tools" msgstr "" -msgid "The modules described in this chapter help you write software. For example, the :mod:`pydoc` module takes a module and generates documentation based on the module's contents. The :mod:`doctest` and :mod:`unittest` modules contains frameworks for writing unit tests that automatically exercise code and verify that the expected output is produced." +#: ../../library/development.rst:7 +msgid "" +"The modules described in this chapter help you write software. For example, " +"the :mod:`pydoc` module takes a module and generates documentation based on " +"the module's contents. The :mod:`doctest` and :mod:`unittest` modules " +"contains frameworks for writing unit tests that automatically exercise code " +"and verify that the expected output is produced." msgstr "" +#: ../../library/development.rst:13 msgid "The list of modules described in this chapter is:" msgstr "" diff --git a/library/devmode.po b/library/devmode.po index 848f057c5..503fa30b7 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,123 +24,220 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/devmode.rst:4 msgid "Python Development Mode" msgstr "" -msgid "The Python Development Mode introduces additional runtime checks that are too expensive to be enabled by default. It should not be more verbose than the default if the code is correct; new warnings are only emitted when an issue is detected." +#: ../../library/devmode.rst:8 +msgid "" +"The Python Development Mode introduces additional runtime checks that are " +"too expensive to be enabled by default. It should not be more verbose than " +"the default if the code is correct; new warnings are only emitted when an " +"issue is detected." msgstr "" -msgid "It can be enabled using the :option:`-X dev <-X>` command line option or by setting the :envvar:`PYTHONDEVMODE` environment variable to ``1``." +#: ../../library/devmode.rst:13 +msgid "" +"It can be enabled using the :option:`-X dev <-X>` command line option or by " +"setting the :envvar:`PYTHONDEVMODE` environment variable to ``1``." msgstr "" +#: ../../library/devmode.rst:16 msgid "See also :ref:`Python debug build `." msgstr "" +#: ../../library/devmode.rst:19 msgid "Effects of the Python Development Mode" msgstr "" -msgid "Enabling the Python Development Mode is similar to the following command, but with additional effects described below::" +#: ../../library/devmode.rst:21 +msgid "" +"Enabling the Python Development Mode is similar to the following command, " +"but with additional effects described below::" msgstr "" -msgid "PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler" +#: ../../library/devmode.rst:24 +msgid "" +"PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler" msgstr "" +#: ../../library/devmode.rst:26 msgid "Effects of the Python Development Mode:" msgstr "" -msgid "Add ``default`` :ref:`warning filter `. The following warnings are shown:" +#: ../../library/devmode.rst:28 +msgid "" +"Add ``default`` :ref:`warning filter `. The " +"following warnings are shown:" msgstr "" +#: ../../library/devmode.rst:31 msgid ":exc:`DeprecationWarning`" msgstr "" +#: ../../library/devmode.rst:32 msgid ":exc:`ImportWarning`" msgstr "" +#: ../../library/devmode.rst:33 msgid ":exc:`PendingDeprecationWarning`" msgstr "" +#: ../../library/devmode.rst:34 msgid ":exc:`ResourceWarning`" msgstr "" -msgid "Normally, the above warnings are filtered by the default :ref:`warning filters `." +#: ../../library/devmode.rst:36 +msgid "" +"Normally, the above warnings are filtered by the default :ref:`warning " +"filters `." msgstr "" -msgid "It behaves as if the :option:`-W default <-W>` command line option is used." +#: ../../library/devmode.rst:39 +msgid "" +"It behaves as if the :option:`-W default <-W>` command line option is used." msgstr "" -msgid "Use the :option:`-W error <-W>` command line option or set the :envvar:`PYTHONWARNINGS` environment variable to ``error`` to treat warnings as errors." +#: ../../library/devmode.rst:41 +msgid "" +"Use the :option:`-W error <-W>` command line option or set " +"the :envvar:`PYTHONWARNINGS` environment variable to ``error`` to treat " +"warnings as errors." msgstr "" +#: ../../library/devmode.rst:45 msgid "Install debug hooks on memory allocators to check for:" msgstr "" +#: ../../library/devmode.rst:47 msgid "Buffer underflow" msgstr "" +#: ../../library/devmode.rst:48 msgid "Buffer overflow" msgstr "" +#: ../../library/devmode.rst:49 msgid "Memory allocator API violation" msgstr "" +#: ../../library/devmode.rst:50 msgid "Unsafe usage of the GIL" msgstr "" +#: ../../library/devmode.rst:52 msgid "See the :c:func:`PyMem_SetupDebugHooks` C function." msgstr "" -msgid "It behaves as if the :envvar:`PYTHONMALLOC` environment variable is set to ``debug``." +#: ../../library/devmode.rst:54 +msgid "" +"It behaves as if the :envvar:`PYTHONMALLOC` environment variable is set to " +"``debug``." msgstr "" -msgid "To enable the Python Development Mode without installing debug hooks on memory allocators, set the :envvar:`PYTHONMALLOC` environment variable to ``default``." +#: ../../library/devmode.rst:57 +msgid "" +"To enable the Python Development Mode without installing debug hooks on " +"memory allocators, set the :envvar:`PYTHONMALLOC` environment variable to " +"``default``." msgstr "" -msgid "Call :func:`faulthandler.enable` at Python startup to install handlers for the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python traceback on a crash." +#: ../../library/devmode.rst:61 +msgid "" +"Call :func:`faulthandler.enable` at Python startup to install handlers for " +"the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` " +"and :const:`~signal.SIGILL` signals to dump the Python traceback on a crash." msgstr "" -msgid "It behaves as if the :option:`-X faulthandler <-X>` command line option is used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to ``1``." +#: ../../library/devmode.rst:66 +msgid "" +"It behaves as if the :option:`-X faulthandler <-X>` command line option is " +"used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to " +"``1``." msgstr "" -msgid "Enable :ref:`asyncio debug mode `. For example, :mod:`asyncio` checks for coroutines that were not awaited and logs them." +#: ../../library/devmode.rst:70 +msgid "" +"Enable :ref:`asyncio debug mode `. For " +"example, :mod:`asyncio` checks for coroutines that were not awaited and logs " +"them." msgstr "" -msgid "It behaves as if the :envvar:`PYTHONASYNCIODEBUG` environment variable is set to ``1``." +#: ../../library/devmode.rst:73 +msgid "" +"It behaves as if the :envvar:`PYTHONASYNCIODEBUG` environment variable is " +"set to ``1``." msgstr "" -msgid "Check the *encoding* and *errors* arguments for string encoding and decoding operations. Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." +#: ../../library/devmode.rst:76 +msgid "" +"Check the *encoding* and *errors* arguments for string encoding and decoding " +"operations. Examples: :func:`open`, :meth:`str.encode` " +"and :meth:`bytes.decode`." msgstr "" -msgid "By default, for best performance, the *errors* argument is only checked at the first encoding/decoding error and the *encoding* argument is sometimes ignored for empty strings." +#: ../../library/devmode.rst:80 +msgid "" +"By default, for best performance, the *errors* argument is only checked at " +"the first encoding/decoding error and the *encoding* argument is sometimes " +"ignored for empty strings." msgstr "" +#: ../../library/devmode.rst:84 msgid "The :class:`io.IOBase` destructor logs ``close()`` exceptions." msgstr "" -msgid "Set the :attr:`~sys.flags.dev_mode` attribute of :data:`sys.flags` to ``True``." +#: ../../library/devmode.rst:85 +msgid "" +"Set the :attr:`~sys.flags.dev_mode` attribute of :data:`sys.flags` to " +"``True``." msgstr "" -msgid "The Python Development Mode does not enable the :mod:`tracemalloc` module by default, because the overhead cost (to performance and memory) would be too large. Enabling the :mod:`tracemalloc` module provides additional information on the origin of some errors. For example, :exc:`ResourceWarning` logs the traceback where the resource was allocated, and a buffer overflow error logs the traceback where the memory block was allocated." +#: ../../library/devmode.rst:88 +msgid "" +"The Python Development Mode does not enable the :mod:`tracemalloc` module by " +"default, because the overhead cost (to performance and memory) would be too " +"large. Enabling the :mod:`tracemalloc` module provides additional " +"information on the origin of some errors. For " +"example, :exc:`ResourceWarning` logs the traceback where the resource was " +"allocated, and a buffer overflow error logs the traceback where the memory " +"block was allocated." msgstr "" -msgid "The Python Development Mode does not prevent the :option:`-O` command line option from removing :keyword:`assert` statements nor from setting :const:`__debug__` to ``False``." +#: ../../library/devmode.rst:95 +msgid "" +"The Python Development Mode does not prevent the :option:`-O` command line " +"option from removing :keyword:`assert` statements nor from " +"setting :const:`__debug__` to ``False``." msgstr "" -msgid "The Python Development Mode can only be enabled at the Python startup. Its value can be read from :data:`sys.flags.dev_mode `." +#: ../../library/devmode.rst:99 +msgid "" +"The Python Development Mode can only be enabled at the Python startup. Its " +"value can be read from :data:`sys.flags.dev_mode `." msgstr "" +#: ../../library/devmode.rst:102 msgid "The :class:`io.IOBase` destructor now logs ``close()`` exceptions." msgstr "" -msgid "The *encoding* and *errors* arguments are now checked for string encoding and decoding operations." +#: ../../library/devmode.rst:105 +msgid "" +"The *encoding* and *errors* arguments are now checked for string encoding " +"and decoding operations." msgstr "" +#: ../../library/devmode.rst:111 msgid "ResourceWarning Example" msgstr "" -msgid "Example of a script counting the number of lines of the text file specified in the command line::" +#: ../../library/devmode.rst:113 +msgid "" +"Example of a script counting the number of lines of the text file specified " +"in the command line::" msgstr "" +#: ../../library/devmode.rst:116 msgid "" "import sys\n" "\n" @@ -154,32 +251,46 @@ msgid "" " main()" msgstr "" -msgid "The script does not close the file explicitly. By default, Python does not emit any warning. Example using README.txt, which has 269 lines:" +#: ../../library/devmode.rst:127 +msgid "" +"The script does not close the file explicitly. By default, Python does not " +"emit any warning. Example using README.txt, which has 269 lines:" msgstr "" +#: ../../library/devmode.rst:130 msgid "" "$ python script.py README.txt\n" "269" msgstr "" -msgid "Enabling the Python Development Mode displays a :exc:`ResourceWarning` warning:" +#: ../../library/devmode.rst:135 +msgid "" +"Enabling the Python Development Mode displays a :exc:`ResourceWarning` " +"warning:" msgstr "" +#: ../../library/devmode.rst:137 msgid "" "$ python -X dev script.py README.txt\n" "269\n" -"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper " +"name='README.rst' mode='r' encoding='UTF-8'>\n" " main()\n" "ResourceWarning: Enable tracemalloc to get the object allocation traceback" msgstr "" -msgid "In addition, enabling :mod:`tracemalloc` shows the line where the file was opened:" +#: ../../library/devmode.rst:145 +msgid "" +"In addition, enabling :mod:`tracemalloc` shows the line where the file was " +"opened:" msgstr "" +#: ../../library/devmode.rst:148 msgid "" "$ python -X dev -X tracemalloc=5 script.py README.rst\n" "269\n" -"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper " +"name='README.rst' mode='r' encoding='UTF-8'>\n" " main()\n" "Object allocated at (most recent call last):\n" " File \"script.py\", lineno 10\n" @@ -188,9 +299,12 @@ msgid "" " fp = open(sys.argv[1])" msgstr "" -msgid "The fix is to close explicitly the file. Example using a context manager::" +#: ../../library/devmode.rst:160 +msgid "" +"The fix is to close explicitly the file. Example using a context manager::" msgstr "" +#: ../../library/devmode.rst:162 msgid "" "def main():\n" " # Close the file explicitly when exiting the with block\n" @@ -199,15 +313,23 @@ msgid "" " print(nlines)" msgstr "" -msgid "Not closing a resource explicitly can leave a resource open for way longer than expected; it can cause severe issues upon exiting Python. It is bad in CPython, but it is even worse in PyPy. Closing resources explicitly makes an application more deterministic and more reliable." +#: ../../library/devmode.rst:168 +msgid "" +"Not closing a resource explicitly can leave a resource open for way longer " +"than expected; it can cause severe issues upon exiting Python. It is bad in " +"CPython, but it is even worse in PyPy. Closing resources explicitly makes an " +"application more deterministic and more reliable." msgstr "" +#: ../../library/devmode.rst:175 msgid "Bad file descriptor error example" msgstr "" +#: ../../library/devmode.rst:177 msgid "Script displaying the first line of itself::" msgstr "" +#: ../../library/devmode.rst:179 msgid "" "import os\n" "\n" @@ -221,32 +343,49 @@ msgid "" "main()" msgstr "" +#: ../../library/devmode.rst:190 msgid "By default, Python does not emit any warning:" msgstr "" +#: ../../library/devmode.rst:192 msgid "" "$ python script.py\n" "import os" msgstr "" -msgid "The Python Development Mode shows a :exc:`ResourceWarning` and logs a \"Bad file descriptor\" error when finalizing the file object:" +#: ../../library/devmode.rst:197 +msgid "" +"The Python Development Mode shows a :exc:`ResourceWarning` and logs a \"Bad " +"file descriptor\" error when finalizing the file object:" msgstr "" +#: ../../library/devmode.rst:200 msgid "" "$ python -X dev script.py\n" "import os\n" -"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'>\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper " +"name='script.py' mode='r' encoding='UTF-8'>\n" " main()\n" "ResourceWarning: Enable tracemalloc to get the object allocation traceback\n" -"Exception ignored in: <_io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'>\n" +"Exception ignored in: <_io.TextIOWrapper name='script.py' mode='r' " +"encoding='UTF-8'>\n" "Traceback (most recent call last):\n" " File \"script.py\", line 10, in \n" " main()\n" "OSError: [Errno 9] Bad file descriptor" msgstr "" -msgid "``os.close(fp.fileno())`` closes the file descriptor. When the file object finalizer tries to close the file descriptor again, it fails with the ``Bad file descriptor`` error. A file descriptor must be closed only once. In the worst case scenario, closing it twice can lead to a crash (see :issue:`18748` for an example)." +#: ../../library/devmode.rst:213 +msgid "" +"``os.close(fp.fileno())`` closes the file descriptor. When the file object " +"finalizer tries to close the file descriptor again, it fails with the ``Bad " +"file descriptor`` error. A file descriptor must be closed only once. In the " +"worst case scenario, closing it twice can lead to a crash " +"(see :issue:`18748` for an example)." msgstr "" -msgid "The fix is to remove the ``os.close(fp.fileno())`` line, or open the file with ``closefd=False``." +#: ../../library/devmode.rst:219 +msgid "" +"The fix is to remove the ``os.close(fp.fileno())`` line, or open the file " +"with ``closefd=False``." msgstr "" diff --git a/library/dialog.po b/library/dialog.po index 6cddf9f94..62a018b0c 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,173 +21,372 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid "Tkinter Dialogs" +#: ../../library/dialog.rst:2 +msgid "Tkinter dialogs" msgstr "" +#: ../../library/dialog.rst:5 msgid ":mod:`!tkinter.simpledialog` --- Standard Tkinter input dialogs" msgstr "" +#: ../../library/dialog.rst:10 msgid "**Source code:** :source:`Lib/tkinter/simpledialog.py`" msgstr "" -msgid "The :mod:`!tkinter.simpledialog` module contains convenience classes and functions for creating simple modal dialogs to get a value from the user." +#: ../../library/dialog.rst:14 +msgid "" +"The :mod:`!tkinter.simpledialog` module contains convenience classes and " +"functions for creating simple modal dialogs to get a value from the user." +msgstr "" + +#: ../../library/dialog.rst:22 +msgid "" +"Prompt the user to enter a value of the desired type and return it, or " +"``None`` if the dialog is cancelled." +msgstr "" + +#: ../../library/dialog.rst:25 +msgid "" +"*title* is the dialog title and *prompt* the message shown above the entry. " +"*initialvalue* is the value initially placed in the entry. *parent* is the " +"window over which the dialog is shown. :func:`askinteger` " +"and :func:`askfloat` also accept *minvalue* and *maxvalue*, which bound the " +"accepted value. :func:`askstring` also accepts *show*, a character used to " +"mask the entered text, for example ``'*'`` to hide a password." +msgstr "" + +#: ../../library/dialog.rst:35 +msgid "" +"The base class for custom dialogs. Instantiating it shows the dialog modally " +"and returns once the user closes it; the entered value is then available in " +"the :attr:`!result` attribute." +msgstr "" + +#: ../../library/dialog.rst:41 +msgid "" +"The value produced by :meth:`apply`, or ``None`` if the dialog was cancelled." +msgstr "" + +#: ../../library/dialog.rst:46 +msgid "" +"Override to construct the dialog's interface and return the widget that " +"should have initial focus." +msgstr "" + +#: ../../library/dialog.rst:51 +msgid "" +"Default behaviour adds OK and Cancel buttons. Override for custom button " +"layouts." msgstr "" -msgid "The above three functions provide dialogs that prompt the user to enter a value of the desired type." +#: ../../library/dialog.rst:56 +msgid "" +"Validate the data entered by the user. Return true if it is valid, in which " +"case the dialog proceeds to :meth:`apply`; return false to keep the dialog " +"open. The default implementation always returns true; override it to check " +"the input." msgstr "" -msgid "The base class for custom dialogs." +#: ../../library/dialog.rst:64 +msgid "" +"Process the data entered by the user, for example by storing it in " +"the :attr:`!result` attribute. Called after :meth:`validate` succeeds and " +"just before the dialog is destroyed. The default implementation does " +"nothing; override it to act on or store the result." msgstr "" -msgid "Override to construct the dialog's interface and return the widget that should have initial focus." +#: ../../library/dialog.rst:73 +msgid "" +"Destroy the dialog window, clearing the reference to the widget that had the " +"initial focus." msgstr "" -msgid "Default behaviour adds OK and Cancel buttons. Override for custom button layouts." +#: ../../library/dialog.rst:79 +msgid "" +"A simple modal dialog that displays the message *text* above a row of push " +"buttons whose labels are given by *buttons*, and returns the index of the " +"button the user presses. *default* is the index of the button activated by " +"the Return key, *cancel* the index returned when the window is closed " +"through the window manager, *title* the window title, and *class_* the Tk " +"class name of the window." +msgstr "" + +#: ../../library/dialog.rst:88 +msgid "" +"Display the dialog, wait until the user presses a button or closes the " +"window, and return the index of the chosen button." msgstr "" +#: ../../library/dialog.rst:94 msgid ":mod:`!tkinter.filedialog` --- File selection dialogs" msgstr "" +#: ../../library/dialog.rst:99 msgid "**Source code:** :source:`Lib/tkinter/filedialog.py`" msgstr "" -msgid "The :mod:`!tkinter.filedialog` module provides classes and factory functions for creating file/directory selection windows." +#: ../../library/dialog.rst:103 +msgid "" +"The :mod:`!tkinter.filedialog` module provides classes and factory functions " +"for creating file/directory selection windows." msgstr "" -msgid "Native Load/Save Dialogs" +#: ../../library/dialog.rst:107 +msgid "Native load/save dialogs" msgstr "" -msgid "The following classes and functions provide file dialog windows that combine a native look-and-feel with configuration options to customize behaviour. The following keyword arguments are applicable to the classes and functions listed below:" +#: ../../library/dialog.rst:109 +msgid "" +"The following classes and functions provide file dialog windows that combine " +"a native look-and-feel with configuration options to customize behaviour. " +"The following keyword arguments are applicable to the classes and functions " +"listed below:" msgstr "" +#: ../../library/dialog.rst:0 msgid "*parent* - the window to place the dialog on top of" msgstr "" +#: ../../library/dialog.rst:0 msgid "*title* - the title of the window" msgstr "" +#: ../../library/dialog.rst:0 msgid "*initialdir* - the directory that the dialog starts in" msgstr "" +#: ../../library/dialog.rst:0 msgid "*initialfile* - the file selected upon opening of the dialog" msgstr "" -msgid "*filetypes* - a sequence of (label, pattern) tuples, '*' wildcard is allowed" +#: ../../library/dialog.rst:0 +msgid "" +"*filetypes* - a sequence of (label, pattern) tuples, '*' wildcard is allowed" msgstr "" +#: ../../library/dialog.rst:0 msgid "*defaultextension* - default extension to append to file (save dialogs)" msgstr "" +#: ../../library/dialog.rst:0 msgid "*multiple* - when true, selection of multiple items is allowed" msgstr "" +#: ../../library/dialog.rst:129 msgid "**Static factory functions**" msgstr "" -msgid "The below functions when called create a modal, native look-and-feel dialog, wait for the user's selection, then return the selected value(s) or ``None`` to the caller." -msgstr "" - -msgid "The above two functions create an :class:`Open` dialog and return the opened file object(s) in read-only mode." -msgstr "" - -msgid "Create a :class:`SaveAs` dialog and return a file object opened in write-only mode." +#: ../../library/dialog.rst:131 +msgid "" +"The below functions when called create a modal, native look-and-feel dialog, " +"wait for the user's selection, and return it. The exact return value depends " +"on the function (see below); when the dialog is cancelled it is an empty " +"string, an empty tuple or ``None``. The precise type of this empty value may " +"vary between platforms and Tk versions, so test the result for truth rather " +"than comparing it with a specific value." msgstr "" -msgid "The above two functions create an :class:`Open` dialog and return the selected filename(s) that correspond to existing file(s)." +#: ../../library/dialog.rst:142 +msgid "" +"Create an :class:`Open` dialog. :func:`askopenfile` returns the opened file " +"object, or ``None`` if the dialog is cancelled. :func:`askopenfiles` returns " +"a list of the opened file objects, or an empty tuple if cancelled. The files " +"are opened in mode *mode* (read-only ``'r'`` by default)." msgstr "" -msgid "Create a :class:`SaveAs` dialog and return the selected filename." +#: ../../library/dialog.rst:151 +msgid "" +"Create a :class:`SaveAs` dialog and return the opened file object, or " +"``None`` if the dialog is cancelled. The file is opened in mode *mode* " +"(``'w'`` by default)." msgstr "" -msgid "Prompt user to select a directory." +#: ../../library/dialog.rst:158 +msgid "" +"Create an :class:`Open` dialog. :func:`askopenfilename` returns the selected " +"filename as a string, or an empty string if the dialog is " +"cancelled. :func:`askopenfilenames` returns a tuple of the selected " +"filenames, or an empty tuple if cancelled." msgstr "" -msgid "Additional keyword option:" +#: ../../library/dialog.rst:166 +msgid "" +"Create a :class:`SaveAs` dialog and return the selected filename as a " +"string, or an empty string if the dialog is cancelled." msgstr "" -msgid "*mustexist* - determines if selection must be an existing directory." +#: ../../library/dialog.rst:171 +msgid "" +"Prompt the user to select a directory, and return its path as a string, or " +"an empty string if the dialog is cancelled. Additional keyword option: " +"*mustexist* - if true, the user may only select an existing directory (false " +"by default)." msgstr "" -msgid "The above two classes provide native dialog windows for saving and loading files." +#: ../../library/dialog.rst:180 +msgid "" +"The above three classes provide native dialog windows for loading and saving " +"files and for selecting a directory." msgstr "" +#: ../../library/dialog.rst:183 msgid "**Convenience classes**" msgstr "" -msgid "The below classes are used for creating file/directory windows from scratch. These do not emulate the native look-and-feel of the platform." -msgstr "" - -msgid "Create a dialog prompting the user to select a directory." +#: ../../library/dialog.rst:185 +msgid "" +"The below classes are used for creating file/directory windows from scratch. " +"These do not emulate the native look-and-feel of the platform." msgstr "" -msgid "The *FileDialog* class should be subclassed for custom event handling and behaviour." +#: ../../library/dialog.rst:188 +msgid "" +"The *FileDialog* class should be subclassed for custom event handling and " +"behaviour." msgstr "" +#: ../../library/dialog.rst:193 msgid "Create a basic file selection dialog." msgstr "" +#: ../../library/dialog.rst:197 msgid "Trigger the termination of the dialog window." msgstr "" +#: ../../library/dialog.rst:201 msgid "Event handler for double-click event on directory." msgstr "" +#: ../../library/dialog.rst:205 msgid "Event handler for click event on directory." msgstr "" +#: ../../library/dialog.rst:209 msgid "Event handler for double-click event on file." msgstr "" +#: ../../library/dialog.rst:213 msgid "Event handler for single-click event on file." msgstr "" +#: ../../library/dialog.rst:217 msgid "Filter the files by directory." msgstr "" +#: ../../library/dialog.rst:221 msgid "Retrieve the file filter currently in use." msgstr "" +#: ../../library/dialog.rst:225 msgid "Retrieve the currently selected item." msgstr "" +#: ../../library/dialog.rst:229 msgid "Render dialog and start event loop." msgstr "" +#: ../../library/dialog.rst:233 msgid "Exit dialog returning current selection." msgstr "" +#: ../../library/dialog.rst:237 +msgid "" +"Called when the user confirms the current selection. The base implementation " +"accepts the selection and closes the dialog; :class:`LoadFileDialog` " +"and :class:`SaveFileDialog` override it to check the selection first." +msgstr "" + +#: ../../library/dialog.rst:244 msgid "Exit dialog returning filename, if any." msgstr "" +#: ../../library/dialog.rst:248 msgid "Set the file filter." msgstr "" +#: ../../library/dialog.rst:252 msgid "Update the current file selection to *file*." msgstr "" -msgid "A subclass of FileDialog that creates a dialog window for selecting an existing file." +#: ../../library/dialog.rst:257 +msgid "" +"A subclass of FileDialog that creates a dialog window for selecting an " +"existing file." msgstr "" -msgid "Test that a file is provided and that the selection indicates an already existing file." +#: ../../library/dialog.rst:262 +msgid "" +"Test that a file is provided and that the selection indicates an already " +"existing file." msgstr "" -msgid "A subclass of FileDialog that creates a dialog window for selecting a destination file." +#: ../../library/dialog.rst:267 +msgid "" +"A subclass of FileDialog that creates a dialog window for selecting a " +"destination file." msgstr "" -msgid "Test whether or not the selection points to a valid file that is not a directory. Confirmation is required if an already existing file is selected." +#: ../../library/dialog.rst:272 +msgid "" +"Test whether or not the selection points to a valid file that is not a " +"directory. Confirmation is required if an already existing file is selected." msgstr "" +#: ../../library/dialog.rst:277 msgid ":mod:`!tkinter.commondialog` --- Dialog window templates" msgstr "" +#: ../../library/dialog.rst:282 msgid "**Source code:** :source:`Lib/tkinter/commondialog.py`" msgstr "" -msgid "The :mod:`!tkinter.commondialog` module provides the :class:`Dialog` class that is the base class for dialogs defined in other supporting modules." +#: ../../library/dialog.rst:286 +msgid "" +"The :mod:`!tkinter.commondialog` module provides the :class:`Dialog` class " +"that is the base class for dialogs defined in other supporting modules." msgstr "" +#: ../../library/dialog.rst:293 msgid "Render the Dialog window." msgstr "" +#: ../../library/dialog.rst:297 +msgid ":mod:`!tkinter.dialog` --- Classic Tk dialog boxes" +msgstr "" + +#: ../../library/dialog.rst:302 +msgid "**Source code:** :source:`Lib/tkinter/dialog.py`" +msgstr "" + +#: ../../library/dialog.rst:306 +msgid "" +"The :mod:`!tkinter.dialog` module provides a simple modal dialog box built " +"on the classic (non-themed) Tk widgets." +msgstr "" + +#: ../../library/dialog.rst:311 +msgid "" +"The name of a bitmap (``'questhead'``) suitable for use as the *bitmap* of " +"a :class:`Dialog`." +msgstr "" + +#: ../../library/dialog.rst:316 +msgid "" +"Display a modal dialog box built from the classic (non-themed) Tk widgets " +"and wait for the user to press one of its buttons. The options, given " +"through *cnf* or as keyword arguments, are all required: *title* (the window " +"title), *text* (the message), *bitmap* (the name of a bitmap icon, such " +"as :data:`DIALOG_ICON`), *default* (the index of the default button) and " +"*strings* (the sequence of button labels). After construction, the :attr:`!" +"num` attribute holds the index of the button the user pressed." +msgstr "" + +#: ../../library/dialog.rst:327 +msgid "" +"Do nothing. The dialog window is destroyed automatically before the " +"constructor returns, so there is nothing left for this method to do." +msgstr "" + +#: ../../library/dialog.rst:334 msgid "Modules :mod:`tkinter.messagebox`, :ref:`tut-files`" msgstr "" diff --git a/library/difflib.po b/library/difflib.po index 148da3965..eecf361b9 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,300 +23,731 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/difflib.rst:2 msgid ":mod:`!difflib` --- Helpers for computing deltas" msgstr "" +#: ../../library/difflib.rst:11 msgid "**Source code:** :source:`Lib/difflib.py`" msgstr "" -msgid "This module provides classes and functions for comparing sequences. It can be used for example, for comparing files, and can produce information about file differences in various formats, including HTML and context and unified diffs. For comparing directories and files, see also, the :mod:`filecmp` module." +#: ../../library/difflib.rst:20 +msgid "" +"This module provides classes and functions for comparing sequences. Most of " +"them compare sequences of text lines (for example lists of strings, " +"or :term:`file objects `) and produce :dfn:`diffs` -- reports " +"on the differences. Diffs can be produced in in various formats, including " +"HTML and context and unified diffs -- formats produced by tools " +"like :manpage:`diff ` and :manpage:`git diff `." msgstr "" -msgid "This is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are :term:`hashable`. The basic algorithm predates, and is a little fancier than, an algorithm published in the late 1980's by Ratcliff and Obershelp under the hyperbolic name \"gestalt pattern matching.\" The idea is to find the longest contiguous matching subsequence that contains no \"junk\" elements; these \"junk\" elements are ones that are uninteresting in some sense, such as blank lines or whitespace. (Handling junk is an extension to the Ratcliff and Obershelp algorithm.) The same idea is then applied recursively to the pieces of the sequences to the left and to the right of the matching subsequence. This does not yield minimal edit sequences, but does tend to yield matches that \"look right\" to people." +#: ../../library/difflib.rst:28 +msgid "" +"Comparisons are done using a matching algorithm implemented " +"in :class:`SequenceMatcher` -- a flexible class for comparing pairs of " +"sequences of any type, not just text, so long as the sequence elements " +"are :term:`hashable`." msgstr "" -msgid "**Timing:** The basic Ratcliff-Obershelp algorithm is cubic time in the worst case and quadratic time in the expected case. :class:`SequenceMatcher` is quadratic time for the worst case and has expected-case behavior dependent in a complicated way on how many elements the sequences have in common; best case time is linear." +#: ../../library/difflib.rst:37 +msgid "Junk heuristic" msgstr "" -msgid "**Automatic junk heuristic:** :class:`SequenceMatcher` supports a heuristic that automatically treats certain sequence items as junk. The heuristic counts how many times each individual item appears in the sequence. If an item's duplicates (after the first one) account for more than 1% of the sequence and the sequence is at least 200 items long, this item is marked as \"popular\" and is treated as junk for the purpose of sequence matching. This heuristic can be turned off by setting the ``autojunk`` argument to ``False`` when creating the :class:`SequenceMatcher`." +#: ../../library/difflib.rst:39 +msgid "" +":mod:`!difflib` uses a :dfn:`junk` heuristic: some items are deemed to " +"be :dfn:`junk`, and ignored when searching for similarities. Ideally, these " +"are uninteresting or common items, such as blank lines or whitespace." msgstr "" -msgid "Added the *autojunk* parameter." +#: ../../library/difflib.rst:44 +msgid "" +"This heuristic can speed the algorithm up (because it reduces the number of " +"possible combinations) and it can produce results that are more " +"understandable for humans (typically breaking on whitespace). But it can " +"also cause pathological cases:" +msgstr "" + +#: ../../library/difflib.rst:49 +msgid "" +"Inappropriately chosen junk items can cause an unexpectedly **large** (but " +"still correct) result." +msgstr "" + +#: ../../library/difflib.rst:51 +msgid "" +"The default heuristic is **asymmetric**: only the second sequence is " +"inspected when determining what is considered junk, so comparing A to B can " +"give different results than comparing B to A and reversing the result." +msgstr "" + +#: ../../library/difflib.rst:55 +msgid "" +"By default, if the second input sequence is at least 200 items long, items " +"that account for more than 1% it are considered *junk*." +msgstr "" + +#: ../../library/difflib.rst:58 +msgid "" +"Depending on your data, you should consider turning this heuristic off " +"(setting :class:`~difflib.SequenceMatcher`'s *autojunk* argument to to " +"``False``) or tuning it (using the *isjunk* argument, perhaps to one of " +"the :ref:`predefined functions `)." +msgstr "" + +#: ../../library/difflib.rst:65 +msgid "The :mod:`!difflib` algorithm" +msgstr "" + +#: ../../library/difflib.rst:67 +msgid "" +"The algorithm used in :class:`SequenceMatcher` predates, and is a little " +"fancier than, an algorithm published in the late 1980s by Ratcliff and " +"Obershelp under the hyperbolic name \"gestalt pattern matching.\" The idea " +"is to find the longest contiguous subsequence common to both inputs, then " +"recursively handle the pieces of the sequences to the left and to the right " +"of the matching subsequence." +msgstr "" + +#: ../../library/difflib.rst:76 +msgid "" +"`Pattern Matching: The Gestalt Approach `_" msgstr "" -msgid "This is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses :class:`SequenceMatcher` both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines." +#: ../../library/difflib.rst:77 +msgid "" +"Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. " +"This was published in Dr. Dobb's Journal in July, 1988." msgstr "" +#: ../../library/difflib.rst:80 +msgid "" +"As an extension to the Ratcliff and Obershelp algorithm, :mod:`!difflib` " +"searches for the longest *junk-free* contiguous subsequence. See " +"the :ref:`difflib-junk` section for details." +msgstr "" + +#: ../../library/difflib.rst:84 +msgid "Timing" +msgstr "" + +#: ../../library/difflib.rst:86 +msgid "" +"The basic Ratcliff-Obershelp algorithm is cubic time in the worst case and " +"quadratic time in the expected case. :mod:`difflib`'s algorithm is quadratic " +"time for the worst case and has expected-case behavior dependent in a " +"complicated way on how many elements the sequences have in common; best case " +"time is linear." +msgstr "" + +#: ../../library/difflib.rst:97 +msgid "Diff generation" +msgstr "" + +#: ../../library/difflib.rst:103 +msgid "" +"This is a class for comparing sequences of lines of text, and producing " +"human-readable differences or deltas. Differ uses :class:`SequenceMatcher` " +"both to compare sequences of lines, and to compare sequences of characters " +"within similar (near-matching) lines." +msgstr "" + +#: ../../library/difflib.rst:108 msgid "Each line of a :class:`Differ` delta begins with a two-letter code:" msgstr "" +#: ../../library/difflib.rst:111 msgid "Code" msgstr "" +#: ../../library/difflib.rst:111 ../../library/difflib.rst:580 msgid "Meaning" msgstr "" +#: ../../library/difflib.rst:113 msgid "``'- '``" msgstr "" +#: ../../library/difflib.rst:113 msgid "line unique to sequence 1" msgstr "" +#: ../../library/difflib.rst:115 msgid "``'+ '``" msgstr "" +#: ../../library/difflib.rst:115 msgid "line unique to sequence 2" msgstr "" +#: ../../library/difflib.rst:117 msgid "``' '``" msgstr "" +#: ../../library/difflib.rst:117 msgid "line common to both sequences" msgstr "" +#: ../../library/difflib.rst:119 msgid "``'? '``" msgstr "" +#: ../../library/difflib.rst:119 msgid "line not present in either input sequence" msgstr "" -msgid "Lines beginning with '``?``' attempt to guide the eye to intraline differences, and were not present in either input sequence. These lines can be confusing if the sequences contain whitespace characters, such as spaces, tabs or line breaks." +#: ../../library/difflib.rst:122 +msgid "" +"Lines beginning with '``?``' attempt to guide the eye to intraline " +"differences, and were not present in either input sequence. These lines can " +"be confusing if the sequences contain whitespace characters, such as spaces, " +"tabs or line breaks." msgstr "" -msgid "This class can be used to create an HTML table (or a complete HTML file containing the table) showing a side by side, line by line comparison of text with inter-line and intra-line change highlights. The table can be generated in either full or contextual difference mode." +#: ../../library/difflib.rst:126 +msgid "" +"Note that :class:`Differ`\\ -generated deltas make no claim to be " +"**minimal** diffs. To the contrary, minimal diffs are often counter-" +"intuitive for humans, because they synch up anywhere possible, sometimes at " +"accidental matches 100 pages apart. Restricting synch points to contiguous " +"matches preserves some notion of locality, at the occasional cost of " +"producing a longer diff." msgstr "" +#: ../../library/difflib.rst:133 +msgid "The :class:`Differ` class has this constructor:" +msgstr "" + +#: ../../library/difflib.rst:137 +msgid "" +"Optional keyword parameters *linejunk* and *charjunk* are for filter " +"functions (or ``None``):" +msgstr "" + +#: ../../library/difflib.rst:140 +msgid "" +"*linejunk*: A function that accepts a single string argument, and returns " +"true if the string is junk. The default is ``None``, meaning that no line " +"is considered junk." +msgstr "" + +#: ../../library/difflib.rst:144 +msgid "" +"*charjunk*: A function that accepts a single character argument (a string of " +"length 1), and returns true if the character is junk. The default is " +"``None``, meaning that no character is considered junk." +msgstr "" + +#: ../../library/difflib.rst:148 +msgid "" +"These junk-filtering functions speed up matching to find differences and do " +"not cause any differing lines or characters to be ignored. Read the " +"description of the :meth:`~SequenceMatcher.find_longest_match` method's " +"*isjunk* parameter for an explanation." +msgstr "" + +#: ../../library/difflib.rst:154 +msgid "" +":class:`Differ` objects are used (deltas generated) via a single method:" +msgstr "" + +#: ../../library/difflib.rst:159 +msgid "" +"Compare two sequences of lines, and generate the delta (a sequence of lines)." +msgstr "" + +#: ../../library/difflib.rst:161 +msgid "" +"Each sequence must contain individual single-line strings ending with " +"newlines. Such sequences can be obtained from " +"the :meth:`~io.IOBase.readlines` method of file-like objects. The generated " +"delta also consists of newline-terminated strings, ready to be printed as-is " +"via the :meth:`~io.IOBase.writelines` method of a file-like object." +msgstr "" + +#: ../../library/difflib.rst:170 +msgid "" +"This class can be used to create an HTML table (or a complete HTML file " +"containing the table) showing a side by side, line by line comparison of " +"text with inter-line and intra-line change highlights. The table can be " +"generated in either full or contextual difference mode." +msgstr "" + +#: ../../library/difflib.rst:177 +msgid "" +"The trailing newlines get stripped before the diff, so the result can be " +"incomplete. See :gh:`71896` for details." +msgstr "" + +#: ../../library/difflib.rst:180 msgid "The constructor for this class is:" msgstr "" +#: ../../library/difflib.rst:185 msgid "Initializes instance of :class:`HtmlDiff`." msgstr "" -msgid "*tabsize* is an optional keyword argument to specify tab stop spacing and defaults to ``8``." +#: ../../library/difflib.rst:187 +msgid "" +"*tabsize* is an optional keyword argument to specify tab stop spacing and " +"defaults to ``8``." msgstr "" -msgid "*wrapcolumn* is an optional keyword to specify column number where lines are broken and wrapped, defaults to ``None`` where lines are not wrapped." +#: ../../library/difflib.rst:190 +msgid "" +"*wrapcolumn* is an optional keyword to specify column number where lines are " +"broken and wrapped, defaults to ``None`` where lines are not wrapped." msgstr "" -msgid "*linejunk* and *charjunk* are optional keyword arguments passed into :func:`ndiff` (used by :class:`HtmlDiff` to generate the side by side HTML differences). See :func:`ndiff` documentation for argument default values and descriptions." +#: ../../library/difflib.rst:193 +msgid "" +"*linejunk* and *charjunk* are optional keyword arguments passed " +"into :func:`ndiff` (used by :class:`HtmlDiff` to generate the side by side " +"HTML differences). See :func:`ndiff` documentation for argument default " +"values and descriptions." msgstr "" +#: ../../library/difflib.rst:197 msgid "The following methods are public:" msgstr "" -msgid "Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML file containing a table showing line by line differences with inter-line and intra-line changes highlighted." -msgstr "" - -msgid "*fromdesc* and *todesc* are optional keyword arguments to specify from/to file column header strings (both default to an empty string)." +#: ../../library/difflib.rst:202 +msgid "" +"Compares *fromlines* and *tolines* (lists of strings) and returns a string " +"which is a complete HTML file containing a table showing line by line " +"differences with inter-line and intra-line changes highlighted." msgstr "" -msgid "*context* and *numlines* are both optional keyword arguments. Set *context* to ``True`` when contextual differences are to be shown, else the default is ``False`` to show the full files. *numlines* defaults to ``5``. When *context* is ``True`` *numlines* controls the number of context lines which surround the difference highlights. When *context* is ``False`` *numlines* controls the number of lines which are shown before a difference highlight when using the \"next\" hyperlinks (setting to zero would cause the \"next\" hyperlinks to place the next difference highlight at the top of the browser without any leading context)." +#: ../../library/difflib.rst:206 +msgid "" +"*fromdesc* and *todesc* are optional keyword arguments to specify from/to " +"file column header strings (both default to an empty string)." msgstr "" -msgid "*fromdesc* and *todesc* are interpreted as unescaped HTML and should be properly escaped while receiving input from untrusted sources." +#: ../../library/difflib.rst:209 +msgid "" +"*context* and *numlines* are both optional keyword arguments. Set *context* " +"to ``True`` when contextual differences are to be shown, else the default is " +"``False`` to show the full files. *numlines* defaults to ``5``. When " +"*context* is ``True`` *numlines* controls the number of context lines which " +"surround the difference highlights. When *context* is ``False`` *numlines* " +"controls the number of lines which are shown before a difference highlight " +"when using the \"next\" hyperlinks (setting to zero would cause the \"next\" " +"hyperlinks to place the next difference highlight at the top of the browser " +"without any leading context)." +msgstr "" + +#: ../../library/difflib.rst:220 +msgid "" +"*fromdesc* and *todesc* are interpreted as unescaped HTML and should be " +"properly escaped while receiving input from untrusted sources." msgstr "" -msgid "*charset* keyword-only argument was added. The default charset of HTML document changed from ``'ISO-8859-1'`` to ``'utf-8'``." +#: ../../library/difflib.rst:223 +msgid "" +"*charset* keyword-only argument was added. The default charset of HTML " +"document changed from ``'ISO-8859-1'`` to ``'utf-8'``." msgstr "" -msgid "Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML table showing line by line differences with inter-line and intra-line changes highlighted." +#: ../../library/difflib.rst:229 +msgid "" +"Compares *fromlines* and *tolines* (lists of strings) and returns a string " +"which is a complete HTML table showing line by line differences with inter-" +"line and intra-line changes highlighted." msgstr "" -msgid "The arguments for this method are the same as those for the :meth:`make_file` method." +#: ../../library/difflib.rst:233 +msgid "" +"The arguments for this method are the same as those for " +"the :meth:`make_file` method." msgstr "" -msgid "Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in context diff format." +#: ../../library/difflib.rst:240 +msgid "" +"Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` " +"generating the delta lines) in context diff format." msgstr "" -msgid "Context diffs are a compact way of showing just the lines that have changed plus a few lines of context. The changes are shown in a before/after style. The number of context lines is set by *n* which defaults to three." +#: ../../library/difflib.rst:243 +msgid "" +"Context diffs are a compact way of showing just the lines that have changed " +"plus a few lines of context. The changes are shown in a before/after " +"style. The number of context lines is set by *n* which defaults to three." msgstr "" -msgid "By default, the diff control lines (those with ``***`` or ``---``) are created with a trailing newline. This is helpful so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines." +#: ../../library/difflib.rst:247 +msgid "" +"By default, the diff control lines (those with ``***`` or ``---``) are " +"created with a trailing newline. This is helpful so that inputs created " +"from :func:`io.IOBase.readlines` result in diffs that are suitable for use " +"with :func:`io.IOBase.writelines` since both the inputs and outputs have " +"trailing newlines." msgstr "" -msgid "For inputs that do not have trailing newlines, set the *lineterm* argument to ``\"\"`` so that the output will be uniformly newline free." +#: ../../library/difflib.rst:253 ../../library/difflib.rst:385 +msgid "" +"For inputs that do not have trailing newlines, set the *lineterm* argument " +"to ``\"\"`` so that the output will be uniformly newline free." msgstr "" -msgid "The context diff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks." +#: ../../library/difflib.rst:256 +msgid "" +"The context diff format normally has a header for filenames and modification " +"times. Any or all of these may be specified using strings for *fromfile*, " +"*tofile*, *fromfiledate*, and *tofiledate*. The modification times are " +"normally expressed in the ISO 8601 format. If not specified, the strings " +"default to blanks." msgstr "" +#: ../../library/difflib.rst:282 ../../library/difflib.rst:408 msgid "See :ref:`difflib-interface` for a more detailed example." msgstr "" -msgid "Return a list of the best \"good enough\" matches. *word* is a sequence for which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings)." +#: ../../library/difflib.rst:287 +msgid "" +"Return a list of the best \"good enough\" matches. *word* is a sequence for " +"which close matches are desired (typically a string), and *possibilities* is " +"a list of sequences against which to match *word* (typically a list of " +"strings)." msgstr "" -msgid "Optional argument *n* (default ``3``) is the maximum number of close matches to return; *n* must be greater than ``0``." +#: ../../library/difflib.rst:291 +msgid "" +"Optional argument *n* (default ``3``) is the maximum number of close matches " +"to return; *n* must be greater than ``0``." msgstr "" -msgid "Optional argument *cutoff* (default ``0.6``) is a float in the range [0, 1]. Possibilities that don't score at least that similar to *word* are ignored." +#: ../../library/difflib.rst:294 +msgid "" +"Optional argument *cutoff* (default ``0.6``) is a float in the range [0, 1]. " +"Possibilities that don't score at least that similar to *word* are ignored." msgstr "" -msgid "The best (no more than *n*) matches among the possibilities are returned in a list, sorted by similarity score, most similar first." +#: ../../library/difflib.rst:297 +msgid "" +"The best (no more than *n*) matches among the possibilities are returned in " +"a list, sorted by similarity score, most similar first." msgstr "" -msgid "Compare *a* and *b* (lists of strings); return a :class:`Differ`\\ -style delta (a :term:`generator` generating the delta lines)." +#: ../../library/difflib.rst:313 +msgid "" +"Compare *a* and *b* (lists of strings); return a :class:`Differ`\\ -style " +"delta (a :term:`generator` generating the delta lines)." msgstr "" -msgid "Optional keyword parameters *linejunk* and *charjunk* are filtering functions (or ``None``):" +#: ../../library/difflib.rst:316 +msgid "" +"Optional keyword parameters *linejunk* and *charjunk* are filtering " +"functions (or ``None``):" msgstr "" -msgid "*linejunk*: A function that accepts a single string argument, and returns true if the string is junk, or false if not. The default is ``None``. There is also a module-level function :func:`IS_LINE_JUNK`, which filters out lines without visible characters, except for at most one hash character (``'#'``) -- however the underlying :class:`SequenceMatcher` class does a dynamic analysis of which lines are so frequent as to constitute noise, and this usually works better than using this function." +#: ../../library/difflib.rst:319 +msgid "" +"*linejunk*: A function that accepts a single string argument, and returns " +"true if the string is junk, or false if not. The default is ``None``. There " +"is also a module-level function :func:`IS_LINE_JUNK`, which filters out " +"lines without visible characters, except for at most one hash character " +"(``'#'``) -- however the underlying :class:`SequenceMatcher` class does a " +"dynamic analysis of which lines are so frequent as to constitute noise, and " +"this usually works better than using this function." msgstr "" -msgid "*charjunk*: A function that accepts a character (a string of length 1), and returns if the character is junk, or false if not. The default is module-level function :func:`IS_CHARACTER_JUNK`, which filters out whitespace characters (a blank or tab; it's a bad idea to include newline in this!)." +#: ../../library/difflib.rst:327 +msgid "" +"*charjunk*: A function that accepts a character (a string of length 1), and " +"returns if the character is junk, or false if not. The default is module-" +"level function :func:`IS_CHARACTER_JUNK`, which filters out whitespace " +"characters (a blank or tab; it's a bad idea to include newline in this!)." msgstr "" +#: ../../library/difflib.rst:348 msgid "Return one of the two sequences that generated a delta." msgstr "" -msgid "Given a *sequence* produced by :meth:`Differ.compare` or :func:`ndiff`, extract lines originating from file 1 or 2 (parameter *which*), stripping off line prefixes." +#: ../../library/difflib.rst:350 +msgid "" +"Given a *sequence* produced by :meth:`Differ.compare` or :func:`ndiff`, " +"extract lines originating from file 1 or 2 (parameter *which*), stripping " +"off line prefixes." msgstr "" +#: ../../library/difflib.rst:354 msgid "Example:" msgstr "" -msgid "Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format." -msgstr "" - -msgid "Unified diffs are a compact way of showing just the lines that have changed plus a few lines of context. The changes are shown in an inline style (instead of separate before/after blocks). The number of context lines is set by *n* which defaults to three." +#: ../../library/difflib.rst:371 +msgid "" +"Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` " +"generating the delta lines) in unified diff format." msgstr "" -msgid "By default, the diff control lines (those with ``---``, ``+++``, or ``@@``) are created with a trailing newline. This is helpful so that inputs created from :func:`io.IOBase.readlines` result in diffs that are suitable for use with :func:`io.IOBase.writelines` since both the inputs and outputs have trailing newlines." +#: ../../library/difflib.rst:374 +msgid "" +"Unified diffs are a compact way of showing just the lines that have changed " +"plus a few lines of context. The changes are shown in an inline style " +"(instead of separate before/after blocks). The number of context lines is " +"set by *n* which defaults to three." msgstr "" -msgid "The unified diff format normally has a header for filenames and modification times. Any or all of these may be specified using strings for *fromfile*, *tofile*, *fromfiledate*, and *tofiledate*. The modification times are normally expressed in the ISO 8601 format. If not specified, the strings default to blanks." +#: ../../library/difflib.rst:379 +msgid "" +"By default, the diff control lines (those with ``---``, ``+++``, or ``@@``) " +"are created with a trailing newline. This is helpful so that inputs created " +"from :func:`io.IOBase.readlines` result in diffs that are suitable for use " +"with :func:`io.IOBase.writelines` since both the inputs and outputs have " +"trailing newlines." msgstr "" -msgid "Compare *a* and *b* (lists of bytes objects) using *dfunc*; yield a sequence of delta lines (also bytes) in the format returned by *dfunc*. *dfunc* must be a callable, typically either :func:`unified_diff` or :func:`context_diff`." +#: ../../library/difflib.rst:388 +msgid "" +"The unified diff format normally has a header for filenames and modification " +"times. Any or all of these may be specified using strings for *fromfile*, " +"*tofile*, *fromfiledate*, and *tofiledate*. The modification times are " +"normally expressed in the ISO 8601 format. If not specified, the strings " +"default to blanks." msgstr "" -msgid "Allows you to compare data with unknown or inconsistent encoding. All inputs except *n* must be bytes objects, not str. Works by losslessly converting all inputs (except *n*) to str, and calling ``dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)``. The output of *dfunc* is then converted back to bytes, so the delta lines that you receive have the same unknown/inconsistent encodings as *a* and *b*." +#: ../../library/difflib.rst:412 +msgid "" +"Compare *a* and *b* (lists of bytes objects) using *dfunc*; yield a sequence " +"of delta lines (also bytes) in the format returned by *dfunc*. *dfunc* must " +"be a callable, typically either :func:`unified_diff` or :func:`context_diff`." msgstr "" -msgid "Return ``True`` for ignorable lines. The line *line* is ignorable if *line* is blank or contains a single ``'#'``, otherwise it is not ignorable. Used as a default for parameter *linejunk* in :func:`ndiff` in older versions." +#: ../../library/difflib.rst:417 +msgid "" +"Allows you to compare data with unknown or inconsistent encoding. All inputs " +"except *n* must be bytes objects, not str. Works by losslessly converting " +"all inputs (except *n*) to str, and calling ``dfunc(a, b, fromfile, tofile, " +"fromfiledate, tofiledate, n, lineterm)``. The output of *dfunc* is then " +"converted back to bytes, so the delta lines that you receive have the same " +"unknown/inconsistent encodings as *a* and *b*." msgstr "" -msgid "Return ``True`` for ignorable characters. The character *ch* is ignorable if *ch* is a space or tab, otherwise it is not ignorable. Used as a default for parameter *charjunk* in :func:`ndiff`." +#: ../../library/difflib.rst:430 +msgid "Junk definition functions" msgstr "" -msgid "`Pattern Matching: The Gestalt Approach `_" +#: ../../library/difflib.rst:434 +msgid "" +"Return ``True`` for ignorable lines. The line *line* is ignorable if *line* " +"is blank or contains a single ``'#'``, otherwise it is not ignorable. Used " +"as a default for parameter *linejunk* in :func:`ndiff` in older versions." msgstr "" -msgid "Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. This was published in Dr. Dobb's Journal in July, 1988." +#: ../../library/difflib.rst:441 +msgid "" +"Return ``True`` for ignorable characters. The character *ch* is ignorable " +"if *ch* is a space or tab, otherwise it is not ignorable. Used as a default " +"for parameter *charjunk* in :func:`ndiff`." msgstr "" +#: ../../library/difflib.rst:449 msgid "SequenceMatcher objects" msgstr "" -msgid "The :class:`SequenceMatcher` class has this constructor:" +#: ../../library/difflib.rst:453 +msgid "" +"Optional argument *isjunk* must be ``None`` (the default) or a one-argument " +"function that takes a sequence element and returns true if and only if the " +"element is \"junk\" and should be ignored. Passing ``None`` for *isjunk* is " +"equivalent to passing ``lambda x: False``; in other words, no elements are " +"ignored. For example, pass::" msgstr "" -msgid "Optional argument *isjunk* must be ``None`` (the default) or a one-argument function that takes a sequence element and returns true if and only if the element is \"junk\" and should be ignored. Passing ``None`` for *isjunk* is equivalent to passing ``lambda x: False``; in other words, no elements are ignored. For example, pass::" +#: ../../library/difflib.rst:459 +msgid "lambda x: x in \" \\t\"" msgstr "" -msgid "lambda x: x in \" \\t\"" +#: ../../library/difflib.rst:461 +msgid "" +"if you're comparing lines as sequences of characters, and don't want to " +"synch up on blanks or hard tabs." msgstr "" -msgid "if you're comparing lines as sequences of characters, and don't want to synch up on blanks or hard tabs." +#: ../../library/difflib.rst:464 +msgid "" +"The optional arguments *a* and *b* are sequences to be compared; both " +"default to empty strings. The elements of both sequences must " +"be :term:`hashable`." msgstr "" -msgid "The optional arguments *a* and *b* are sequences to be compared; both default to empty strings. The elements of both sequences must be :term:`hashable`." +#: ../../library/difflib.rst:467 +msgid "" +"The optional argument *autojunk* can be used to disable the automatic junk " +"heuristic." msgstr "" -msgid "The optional argument *autojunk* can be used to disable the automatic junk heuristic." +#: ../../library/difflib.rst:470 +msgid "Added the *autojunk* parameter." msgstr "" -msgid "SequenceMatcher objects get three data attributes: *bjunk* is the set of elements of *b* for which *isjunk* is ``True``; *bpopular* is the set of non-junk elements considered popular by the heuristic (if it is not disabled); *b2j* is a dict mapping the remaining elements of *b* to a list of positions where they occur. All three are reset whenever *b* is reset with :meth:`set_seqs` or :meth:`set_seq2`." +#: ../../library/difflib.rst:473 +msgid "" +"SequenceMatcher objects get three data attributes: *bjunk* is the set of " +"elements of *b* for which *isjunk* is ``True``; *bpopular* is the set of non-" +"junk elements considered popular by the heuristic (if it is not disabled); " +"*b2j* is a dict mapping the remaining elements of *b* to a list of positions " +"where they occur. All three are reset whenever *b* is reset " +"with :meth:`set_seqs` or :meth:`set_seq2`." msgstr "" +#: ../../library/difflib.rst:480 msgid "The *bjunk* and *bpopular* attributes." msgstr "" +#: ../../library/difflib.rst:483 msgid ":class:`SequenceMatcher` objects have the following methods:" msgstr "" +#: ../../library/difflib.rst:487 msgid "Set the two sequences to be compared." msgstr "" -msgid ":class:`SequenceMatcher` computes and caches detailed information about the second sequence, so if you want to compare one sequence against many sequences, use :meth:`set_seq2` to set the commonly used sequence once and call :meth:`set_seq1` repeatedly, once for each of the other sequences." +#: ../../library/difflib.rst:489 +msgid "" +":class:`SequenceMatcher` computes and caches detailed information about the " +"second sequence, so if you want to compare one sequence against many " +"sequences, use :meth:`set_seq2` to set the commonly used sequence once and " +"call :meth:`set_seq1` repeatedly, once for each of the other sequences." msgstr "" -msgid "Set the first sequence to be compared. The second sequence to be compared is not changed." +#: ../../library/difflib.rst:497 +msgid "" +"Set the first sequence to be compared. The second sequence to be compared " +"is not changed." msgstr "" -msgid "Set the second sequence to be compared. The first sequence to be compared is not changed." +#: ../../library/difflib.rst:503 +msgid "" +"Set the second sequence to be compared. The first sequence to be compared " +"is not changed." msgstr "" +#: ../../library/difflib.rst:509 msgid "Find longest matching block in ``a[alo:ahi]`` and ``b[blo:bhi]``." msgstr "" -msgid "If *isjunk* was omitted or ``None``, :meth:`find_longest_match` returns ``(i, j, k)`` such that ``a[i:i+k]`` is equal to ``b[j:j+k]``, where ``alo <= i <= i+k <= ahi`` and ``blo <= j <= j+k <= bhi``. For all ``(i', j', k')`` meeting those conditions, the additional conditions ``k >= k'``, ``i <= i'``, and if ``i == i'``, ``j <= j'`` are also met. In other words, of all maximal matching blocks, return one that starts earliest in *a*, and of all those maximal matching blocks that start earliest in *a*, return the one that starts earliest in *b*." +#: ../../library/difflib.rst:511 +msgid "" +"If *isjunk* was omitted or ``None``, :meth:`find_longest_match` returns " +"``(i, j, k)`` such that ``a[i:i+k]`` is equal to ``b[j:j+k]``, where ``alo " +"<= i <= i+k <= ahi`` and ``blo <= j <= j+k <= bhi``. For all ``(i', j', " +"k')`` meeting those conditions, the additional conditions ``k >= k'``, ``i " +"<= i'``, and if ``i == i'``, ``j <= j'`` are also met. In other words, of " +"all maximal matching blocks, return one that starts earliest in *a*, and of " +"all those maximal matching blocks that start earliest in *a*, return the one " +"that starts earliest in *b*." msgstr "" -msgid "If *isjunk* was provided, first the longest matching block is determined as above, but with the additional restriction that no junk element appears in the block. Then that block is extended as far as possible by matching (only) junk elements on both sides. So the resulting block never matches on junk except as identical junk happens to be adjacent to an interesting match." +#: ../../library/difflib.rst:524 +msgid "" +"If *isjunk* was provided, first the longest matching block is determined as " +"above, but with the additional restriction that no junk element appears in " +"the block. Then that block is extended as far as possible by matching " +"(only) junk elements on both sides. So the resulting block never matches on " +"junk except as identical junk happens to be adjacent to an interesting match." msgstr "" -msgid "Here's the same example as before, but considering blanks to be junk. That prevents ``' abcd'`` from matching the ``' abcd'`` at the tail end of the second sequence directly. Instead only the ``'abcd'`` can match, and matches the leftmost ``'abcd'`` in the second sequence:" +#: ../../library/difflib.rst:531 +msgid "" +"Here's the same example as before, but considering blanks to be junk. That " +"prevents ``' abcd'`` from matching the ``' abcd'`` at the tail end of the " +"second sequence directly. Instead only the ``'abcd'`` can match, and " +"matches the leftmost ``'abcd'`` in the second sequence:" msgstr "" +#: ../../library/difflib.rst:540 msgid "If no blocks match, this returns ``(alo, blo, 0)``." msgstr "" +#: ../../library/difflib.rst:542 msgid "This method returns a :term:`named tuple` ``Match(a, b, size)``." msgstr "" +#: ../../library/difflib.rst:544 msgid "Added default arguments." msgstr "" -msgid "Return list of triples describing non-overlapping matching subsequences. Each triple is of the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:j+n]``. The triples are monotonically increasing in *i* and *j*." +#: ../../library/difflib.rst:550 +msgid "" +"Return list of triples describing non-overlapping matching subsequences. " +"Each triple is of the form ``(i, j, n)``, and means that ``a[i:i+n] == " +"b[j:j+n]``. The triples are monotonically increasing in *i* and *j*." msgstr "" -msgid "The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')`` are adjacent triples in the list, and the second is not the last triple in the list, then ``i+n < i'`` or ``j+n < j'``; in other words, adjacent triples always describe non-adjacent equal blocks." +#: ../../library/difflib.rst:555 +msgid "" +"The last triple is a dummy, and has the value ``(len(a), len(b), 0)``. It " +"is the only triple with ``n == 0``. If ``(i, j, n)`` and ``(i', j', n')`` " +"are adjacent triples in the list, and the second is not the last triple in " +"the list, then ``i+n < i'`` or ``j+n < j'``; in other words, adjacent " +"triples always describe non-adjacent equal blocks." msgstr "" +#: ../../library/difflib.rst:563 msgid "" ">>> s = SequenceMatcher(None, \"abxcd\", \"abcd\")\n" ">>> s.get_matching_blocks()\n" "[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]" msgstr "" -msgid "Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is of the form ``(tag, i1, i2, j1, j2)``. The first tuple has ``i1 == j1 == 0``, and remaining tuples have *i1* equal to the *i2* from the preceding tuple, and, likewise, *j1* equal to the previous *j2*." +#: ../../library/difflib.rst:572 +msgid "" +"Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is " +"of the form ``(tag, i1, i2, j1, j2)``. The first tuple has ``i1 == j1 == " +"0``, and remaining tuples have *i1* equal to the *i2* from the preceding " +"tuple, and, likewise, *j1* equal to the previous *j2*." msgstr "" +#: ../../library/difflib.rst:577 msgid "The *tag* values are strings, with these meanings:" msgstr "" +#: ../../library/difflib.rst:580 msgid "Value" msgstr "" +#: ../../library/difflib.rst:582 msgid "``'replace'``" msgstr "" +#: ../../library/difflib.rst:582 msgid "``a[i1:i2]`` should be replaced by ``b[j1:j2]``." msgstr "" +#: ../../library/difflib.rst:585 msgid "``'delete'``" msgstr "" +#: ../../library/difflib.rst:585 msgid "``a[i1:i2]`` should be deleted. Note that ``j1 == j2`` in this case." msgstr "" +#: ../../library/difflib.rst:588 msgid "``'insert'``" msgstr "" -msgid "``b[j1:j2]`` should be inserted at ``a[i1:i1]``. Note that ``i1 == i2`` in this case." +#: ../../library/difflib.rst:588 +msgid "" +"``b[j1:j2]`` should be inserted at ``a[i1:i1]``. Note that ``i1 == i2`` in " +"this case." msgstr "" +#: ../../library/difflib.rst:592 msgid "``'equal'``" msgstr "" +#: ../../library/difflib.rst:592 msgid "``a[i1:i2] == b[j1:j2]`` (the sub-sequences are equal)." msgstr "" +#: ../../library/difflib.rst:596 msgid "For example::" msgstr "" +#: ../../library/difflib.rst:598 msgid "" ">>> a = \"qabxcd\"\n" ">>> b = \"abycdf\"\n" @@ -331,126 +762,159 @@ msgid "" "insert a[6:6] --> b[5:6] '' --> 'f'" msgstr "" +#: ../../library/difflib.rst:613 msgid "Return a :term:`generator` of groups with up to *n* lines of context." msgstr "" -msgid "Starting with the groups returned by :meth:`get_opcodes`, this method splits out smaller change clusters and eliminates intervening ranges which have no changes." +#: ../../library/difflib.rst:615 +msgid "" +"Starting with the groups returned by :meth:`get_opcodes`, this method splits " +"out smaller change clusters and eliminates intervening ranges which have no " +"changes." msgstr "" +#: ../../library/difflib.rst:619 msgid "The groups are returned in the same format as :meth:`get_opcodes`." msgstr "" -msgid "Return a measure of the sequences' similarity as a float in the range [0, 1]." -msgstr "" - -msgid "Where T is the total number of elements in both sequences, and M is the number of matches, this is 2.0\\*M / T. Note that this is ``1.0`` if the sequences are identical, and ``0.0`` if they have nothing in common." -msgstr "" - -msgid "This is expensive to compute if :meth:`get_matching_blocks` or :meth:`get_opcodes` hasn't already been called, in which case you may want to try :meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an upper bound." +#: ../../library/difflib.rst:624 +msgid "" +"Return a measure of the sequences' similarity as a float in the range [0, 1]." msgstr "" -msgid "Caution: The result of a :meth:`ratio` call may depend on the order of the arguments. For instance::" +#: ../../library/difflib.rst:627 +msgid "" +"Where T is the total number of elements in both sequences, and M is the " +"number of matches, this is 2.0\\*M / T. Note that this is ``1.0`` if the " +"sequences are identical, and ``0.0`` if they have nothing in common." msgstr "" +#: ../../library/difflib.rst:631 msgid "" -">>> SequenceMatcher(None, 'tide', 'diet').ratio()\n" -"0.25\n" -">>> SequenceMatcher(None, 'diet', 'tide').ratio()\n" -"0.5" +"This is expensive to compute if :meth:`get_matching_blocks` " +"or :meth:`get_opcodes` hasn't already been called, in which case you may " +"want to try :meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an " +"upper bound." msgstr "" +#: ../../library/difflib.rst:639 msgid "Return an upper bound on :meth:`ratio` relatively quickly." msgstr "" +#: ../../library/difflib.rst:644 msgid "Return an upper bound on :meth:`ratio` very quickly." msgstr "" -msgid "The three methods that return the ratio of matching to total characters can give different results due to differing levels of approximation, although :meth:`~SequenceMatcher.quick_ratio` and :meth:`~SequenceMatcher.real_quick_ratio` are always at least as large as :meth:`~SequenceMatcher.ratio`:" -msgstr "" - -msgid "SequenceMatcher examples" -msgstr "" - -msgid "This example compares two strings, considering blanks to be \"junk\":" -msgstr "" - -msgid ":meth:`~SequenceMatcher.ratio` returns a float in [0, 1], measuring the similarity of the sequences. As a rule of thumb, a :meth:`~SequenceMatcher.ratio` value over 0.6 means the sequences are close matches:" -msgstr "" - -msgid "If you're only interested in where the sequences match, :meth:`~SequenceMatcher.get_matching_blocks` is handy:" -msgstr "" - -msgid "Note that the last tuple returned by :meth:`~SequenceMatcher.get_matching_blocks` is always a dummy, ``(len(a), len(b), 0)``, and this is the only case in which the last tuple element (number of elements matched) is ``0``." -msgstr "" - -msgid "If you want to know how to change the first sequence into the second, use :meth:`~SequenceMatcher.get_opcodes`:" -msgstr "" - -msgid "The :func:`get_close_matches` function in this module which shows how simple code building on :class:`SequenceMatcher` can be used to do useful work." -msgstr "" - -msgid "`Simple version control recipe `_ for a small application built with :class:`SequenceMatcher`." -msgstr "" - -msgid "Differ objects" +#: ../../library/difflib.rst:647 +msgid "" +"The three methods that return the ratio of matching to total characters can " +"give different results due to differing levels of approximation, " +"although :meth:`~SequenceMatcher.quick_ratio` " +"and :meth:`~SequenceMatcher.real_quick_ratio` are always at least as large " +"as :meth:`~SequenceMatcher.ratio`:" msgstr "" -msgid "Note that :class:`Differ`\\ -generated deltas make no claim to be **minimal** diffs. To the contrary, minimal diffs are often counter-intuitive, because they synch up anywhere possible, sometimes accidental matches 100 pages apart. Restricting synch points to contiguous matches preserves some notion of locality, at the occasional cost of producing a longer diff." +#: ../../library/difflib.rst:662 +msgid "Examples" msgstr "" -msgid "The :class:`Differ` class has this constructor:" +#: ../../library/difflib.rst:667 +msgid "SequenceMatcher examples" msgstr "" -msgid "Optional keyword parameters *linejunk* and *charjunk* are for filter functions (or ``None``):" +#: ../../library/difflib.rst:669 +msgid "This example compares two strings, considering blanks to be \"junk\":" msgstr "" -msgid "*linejunk*: A function that accepts a single string argument, and returns true if the string is junk. The default is ``None``, meaning that no line is considered junk." +#: ../../library/difflib.rst:675 +msgid "" +":meth:`~SequenceMatcher.ratio` returns a float in [0, 1], measuring the " +"similarity of the sequences. As a rule of thumb, " +"a :meth:`~SequenceMatcher.ratio` value over 0.6 means the sequences are " +"close matches:" msgstr "" -msgid "*charjunk*: A function that accepts a single character argument (a string of length 1), and returns true if the character is junk. The default is ``None``, meaning that no character is considered junk." +#: ../../library/difflib.rst:682 +msgid "" +"If you're only interested in where the sequences " +"match, :meth:`~SequenceMatcher.get_matching_blocks` is handy:" msgstr "" -msgid "These junk-filtering functions speed up matching to find differences and do not cause any differing lines or characters to be ignored. Read the description of the :meth:`~SequenceMatcher.find_longest_match` method's *isjunk* parameter for an explanation." +#: ../../library/difflib.rst:691 +msgid "" +"Note that the last tuple returned " +"by :meth:`~SequenceMatcher.get_matching_blocks` is always a dummy, " +"``(len(a), len(b), 0)``, and this is the only case in which the last tuple " +"element (number of elements matched) is ``0``." msgstr "" -msgid ":class:`Differ` objects are used (deltas generated) via a single method:" +#: ../../library/difflib.rst:695 +msgid "" +"If you want to know how to change the first sequence into the second, " +"use :meth:`~SequenceMatcher.get_opcodes`:" msgstr "" -msgid "Compare two sequences of lines, and generate the delta (a sequence of lines)." +#: ../../library/difflib.rst:706 +msgid "" +"The :func:`get_close_matches` function in this module which shows how simple " +"code building on :class:`SequenceMatcher` can be used to do useful work." msgstr "" -msgid "Each sequence must contain individual single-line strings ending with newlines. Such sequences can be obtained from the :meth:`~io.IOBase.readlines` method of file-like objects. The delta generated also consists of newline-terminated strings, ready to be printed as-is via the :meth:`~io.IOBase.writelines` method of a file-like object." +#: ../../library/difflib.rst:710 +msgid "" +"`Simple version control recipe `_ for a small application built " +"with :class:`SequenceMatcher`." msgstr "" +#: ../../library/difflib.rst:718 msgid "Differ example" msgstr "" -msgid "This example compares two texts. First we set up the texts, sequences of individual single-line strings ending with newlines (such sequences can also be obtained from the :meth:`~io.IOBase.readlines` method of file-like objects):" +#: ../../library/difflib.rst:720 +msgid "" +"This example compares two texts. First we set up the texts, sequences of " +"individual single-line strings ending with newlines (such sequences can also " +"be obtained from the :meth:`~io.IOBase.readlines` method of file-like " +"objects):" msgstr "" +#: ../../library/difflib.rst:739 msgid "Next we instantiate a Differ object:" msgstr "" -msgid "Note that when instantiating a :class:`Differ` object we may pass functions to filter out line and character \"junk.\" See the :meth:`Differ` constructor for details." +#: ../../library/difflib.rst:743 +msgid "" +"Note that when instantiating a :class:`Differ` object we may pass functions " +"to filter out line and character \"junk.\" See the :meth:`Differ` " +"constructor for details." msgstr "" +#: ../../library/difflib.rst:747 msgid "Finally, we compare the two:" msgstr "" +#: ../../library/difflib.rst:751 msgid "``result`` is a list of strings, so let's pretty-print it:" msgstr "" +#: ../../library/difflib.rst:766 msgid "As a single multi-line string it looks like this:" msgstr "" +#: ../../library/difflib.rst:785 msgid "A command-line interface to difflib" msgstr "" -msgid "This example shows how to use difflib to create a ``diff``-like utility." +#: ../../library/difflib.rst:787 +msgid "" +"This example shows how to use difflib to create a ``diff``-like utility." msgstr "" +#: ../../library/difflib.rst:789 msgid "" -"\"\"\" Command-line interface to difflib.py providing diffs in four formats:\n" +"\"\"\" Command-line interface to difflib.py providing diffs in four " +"formats:\n" "\n" "* ndiff: lists every line and highlights interline changes.\n" "* context: highlights clusters of changes in a before/after format.\n" @@ -497,13 +961,16 @@ msgid "" " tolines = tf.readlines()\n" "\n" " if options.u:\n" -" diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n" +" diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, " +"fromdate, todate, n=n)\n" " elif options.n:\n" " diff = difflib.ndiff(fromlines, tolines)\n" " elif options.m:\n" -" diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)\n" +" diff = " +"difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)\n" " else:\n" -" diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n" +" diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, " +"fromdate, todate, n=n)\n" "\n" " sys.stdout.writelines(diff)\n" "\n" @@ -511,12 +978,15 @@ msgid "" " main()\n" msgstr "" +#: ../../library/difflib.rst:792 msgid "ndiff example" msgstr "" +#: ../../library/difflib.rst:794 msgid "This example shows how to use :func:`difflib.ndiff`." msgstr "" +#: ../../library/difflib.rst:796 msgid "" "\"\"\"ndiff [-q] file1 file2\n" " or\n" @@ -544,9 +1014,11 @@ msgid "" "confusing if the source files contain tab characters.\n" "\n" "The first file can be recovered by retaining only lines that begin with\n" -"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with -r1.\n" +"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with " +"-r1.\n" "\n" -"The second file can be recovered similarly, but by retaining only \" \" and\n" +"The second file can be recovered similarly, but by retaining only \" \" " +"and\n" "\"+ \" lines; use ndiff with -r2; or, on Unix, the second file can be\n" "recovered by piping the output through\n" "\n" diff --git a/library/dis.po b/library/dis.po index bfc453c95..8430b9f36 100644 --- a/library/dis.po +++ b/library/dis.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,53 +23,100 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/dis.rst:2 msgid ":mod:`!dis` --- Disassembler for Python bytecode" msgstr "" +#: ../../library/dis.rst:7 msgid "**Source code:** :source:`Lib/dis.py`" msgstr "" -msgid "The :mod:`!dis` module supports the analysis of CPython :term:`bytecode` by disassembling it. The CPython bytecode which this module takes as an input is defined in the file :file:`Include/opcode.h` and used by the compiler and the interpreter." +#: ../../library/dis.rst:17 +msgid "" +"The :mod:`!dis` module supports the analysis of CPython :term:`bytecode` by " +"disassembling it. The CPython bytecode which this module takes as an input " +"is defined in the file :file:`Include/opcode.h` and used by the compiler and " +"the interpreter." msgstr "" -msgid "Bytecode is an implementation detail of the CPython interpreter. No guarantees are made that bytecode will not be added, removed, or changed between versions of Python. Use of this module should not be considered to work across Python VMs or Python releases." +#: ../../library/dis.rst:24 +msgid "" +"Bytecode is an implementation detail of the CPython interpreter. No " +"guarantees are made that bytecode will not be added, removed, or changed " +"between versions of Python. Use of this module should not be considered to " +"work across Python VMs or Python releases." msgstr "" -msgid "Use 2 bytes for each instruction. Previously the number of bytes varied by instruction." +#: ../../library/dis.rst:29 +msgid "" +"Use 2 bytes for each instruction. Previously the number of bytes varied by " +"instruction." msgstr "" -msgid "The argument of jump, exception handling and loop instructions is now the instruction offset rather than the byte offset." +#: ../../library/dis.rst:33 +msgid "" +"The argument of jump, exception handling and loop instructions is now the " +"instruction offset rather than the byte offset." msgstr "" -msgid "Some instructions are accompanied by one or more inline cache entries, which take the form of :opcode:`CACHE` instructions. These instructions are hidden by default, but can be shown by passing ``show_caches=True`` to any :mod:`!dis` utility. Furthermore, the interpreter now adapts the bytecode to specialize it for different runtime conditions. The adaptive bytecode can be shown by passing ``adaptive=True``." +#: ../../library/dis.rst:37 +msgid "" +"Some instructions are accompanied by one or more inline cache entries, which " +"take the form of :opcode:`CACHE` instructions. These instructions are hidden " +"by default, but can be shown by passing ``show_caches=True`` to any :mod:`!" +"dis` utility. Furthermore, the interpreter now adapts the bytecode to " +"specialize it for different runtime conditions. The adaptive bytecode can be " +"shown by passing ``adaptive=True``." msgstr "" -msgid "The argument of a jump is the offset of the target instruction relative to the instruction that appears immediately after the jump instruction's :opcode:`CACHE` entries." +#: ../../library/dis.rst:45 +msgid "" +"The argument of a jump is the offset of the target instruction relative to " +"the instruction that appears immediately after the jump " +"instruction's :opcode:`CACHE` entries." msgstr "" -msgid "As a consequence, the presence of the :opcode:`CACHE` instructions is transparent for forward jumps but needs to be taken into account when reasoning about backward jumps." +#: ../../library/dis.rst:50 +msgid "" +"As a consequence, the presence of the :opcode:`CACHE` instructions is " +"transparent for forward jumps but needs to be taken into account when " +"reasoning about backward jumps." msgstr "" -msgid "The output shows logical labels rather than instruction offsets for jump targets and exception handlers. The ``-O`` command line option and the ``show_offsets`` argument were added." +#: ../../library/dis.rst:54 +msgid "" +"The output shows logical labels rather than instruction offsets for jump " +"targets and exception handlers. The ``-O`` command line option and the " +"``show_offsets`` argument were added." msgstr "" -msgid "The :option:`-P ` command-line option and the ``show_positions`` argument were added." +#: ../../library/dis.rst:59 +msgid "" +"The :option:`-P ` command-line option and the " +"``show_positions`` argument were added." msgstr "" +#: ../../library/dis.rst:63 msgid "The :option:`-S ` command-line option is added." msgstr "" +#: ../../library/dis.rst:65 msgid "Example: Given the function :func:`!myfunc`::" msgstr "" +#: ../../library/dis.rst:67 msgid "" "def myfunc(alist):\n" " return len(alist)" msgstr "" -msgid "the following command can be used to display the disassembly of :func:`!myfunc`:" +#: ../../library/dis.rst:70 +msgid "" +"the following command can be used to display the disassembly of :func:`!" +"myfunc`:" msgstr "" +#: ../../library/dis.rst:73 msgid "" ">>> dis.dis(myfunc)\n" " 2 RESUME 0\n" @@ -80,99 +127,169 @@ msgid "" " RETURN_VALUE" msgstr "" +#: ../../library/dis.rst:83 msgid "(The \"2\" is a line number)." msgstr "" +#: ../../library/dis.rst:88 msgid "Command-line interface" msgstr "" -msgid "The :mod:`!dis` module can be invoked as a script from the command line:" +#: ../../library/dis.rst:90 +msgid "" +"The :mod:`!dis` module can be invoked as a script from the command line:" msgstr "" +#: ../../library/dis.rst:92 msgid "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" msgstr "" +#: ../../library/dis.rst:96 msgid "The following options are accepted:" msgstr "" +#: ../../library/dis.rst:102 msgid "Display usage and exit." msgstr "" +#: ../../library/dis.rst:106 msgid "Show inline caches." msgstr "" +#: ../../library/dis.rst:112 msgid "Show offsets of instructions." msgstr "" +#: ../../library/dis.rst:118 msgid "Show positions of instructions in the source code." msgstr "" +#: ../../library/dis.rst:124 msgid "Show specialized bytecode." msgstr "" -msgid "If :file:`infile` is specified, its disassembled code will be written to stdout. Otherwise, disassembly is performed on compiled source code received from stdin." +#: ../../library/dis.rst:128 +msgid "" +"If :file:`infile` is specified, its disassembled code will be written to " +"stdout. Otherwise, disassembly is performed on compiled source code received " +"from stdin." msgstr "" +#: ../../library/dis.rst:132 msgid "Bytecode analysis" msgstr "" -msgid "The bytecode analysis API allows pieces of Python code to be wrapped in a :class:`Bytecode` object that provides easy access to details of the compiled code." +#: ../../library/dis.rst:136 +msgid "" +"The bytecode analysis API allows pieces of Python code to be wrapped in " +"a :class:`Bytecode` object that provides easy access to details of the " +"compiled code." msgstr "" -msgid "Analyse the bytecode corresponding to a function, generator, asynchronous generator, coroutine, method, string of source code, or a code object (as returned by :func:`compile`)." +#: ../../library/dis.rst:144 +msgid "" +"Analyse the bytecode corresponding to a function, generator, asynchronous " +"generator, coroutine, method, string of source code, or a code object (as " +"returned by :func:`compile`)." msgstr "" -msgid "This is a convenience wrapper around many of the functions listed below, most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` instance yields the bytecode operations as :class:`Instruction` instances." +#: ../../library/dis.rst:148 +msgid "" +"This is a convenience wrapper around many of the functions listed below, " +"most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " +"instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -msgid "If *first_line* is not ``None``, it indicates the line number that should be reported for the first source line in the disassembled code. Otherwise, the source line information (if any) is taken directly from the disassembled code object." +#: ../../library/dis.rst:152 ../../library/dis.rst:373 +msgid "" +"If *first_line* is not ``None``, it indicates the line number that should be " +"reported for the first source line in the disassembled code. Otherwise, the " +"source line information (if any) is taken directly from the disassembled " +"code object." msgstr "" -msgid "If *current_offset* is not ``None``, it refers to an instruction offset in the disassembled code. Setting this means :meth:`.dis` will display a \"current instruction\" marker against the specified opcode." +#: ../../library/dis.rst:157 +msgid "" +"If *current_offset* is not ``None``, it refers to an instruction offset in " +"the disassembled code. Setting this means :meth:`.dis` will display a " +"\"current instruction\" marker against the specified opcode." msgstr "" -msgid "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries used by the interpreter to specialize the bytecode." +#: ../../library/dis.rst:161 +msgid "" +"If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " +"used by the interpreter to specialize the bytecode." msgstr "" -msgid "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode that may be different from the original bytecode." +#: ../../library/dis.rst:164 +msgid "" +"If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " +"that may be different from the original bytecode." msgstr "" -msgid "If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets in the output." +#: ../../library/dis.rst:167 +msgid "" +"If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " +"in the output." msgstr "" -msgid "If *show_positions* is ``True``, :meth:`.dis` will include instruction source code positions in the output." +#: ../../library/dis.rst:170 +msgid "" +"If *show_positions* is ``True``, :meth:`.dis` will include instruction " +"source code positions in the output." msgstr "" -msgid "Construct a :class:`Bytecode` instance from the given traceback, setting *current_offset* to the instruction responsible for the exception." +#: ../../library/dis.rst:175 +msgid "" +"Construct a :class:`Bytecode` instance from the given traceback, setting " +"*current_offset* to the instruction responsible for the exception." msgstr "" +#: ../../library/dis.rst:180 msgid "The compiled code object." msgstr "" +#: ../../library/dis.rst:184 msgid "The first source line of the code object (if available)" msgstr "" -msgid "Return a formatted view of the bytecode operations (the same as printed by :func:`dis.dis`, but returned as a multi-line string)." +#: ../../library/dis.rst:188 +msgid "" +"Return a formatted view of the bytecode operations (the same as printed " +"by :func:`dis.dis`, but returned as a multi-line string)." msgstr "" -msgid "Return a formatted multi-line string with detailed information about the code object, like :func:`code_info`." +#: ../../library/dis.rst:193 +msgid "" +"Return a formatted multi-line string with detailed information about the " +"code object, like :func:`code_info`." msgstr "" +#: ../../library/dis.rst:196 ../../library/dis.rst:242 +#: ../../library/dis.rst:295 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" +#: ../../library/dis.rst:199 ../../library/dis.rst:298 +#: ../../library/dis.rst:320 ../../library/dis.rst:356 +#: ../../library/dis.rst:382 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "" +#: ../../library/dis.rst:202 msgid "Added the *show_offsets* parameter" msgstr "" +#: ../../library/dis.rst:205 ../../library/dis.rst:304 +#: ../../library/dis.rst:326 ../../library/dis.rst:362 msgid "Added the *show_positions* parameter." msgstr "" +#: ../../library/dis.rst:208 msgid "Example:" msgstr "" +#: ../../library/dis.rst:210 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -185,296 +302,534 @@ msgid "" "RETURN_VALUE" msgstr "" +#: ../../library/dis.rst:224 msgid "Analysis functions" msgstr "" -msgid "The :mod:`!dis` module also defines the following analysis functions that convert the input directly to the desired output. They can be useful if only a single operation is being performed, so the intermediate analysis object isn't useful:" +#: ../../library/dis.rst:226 +msgid "" +"The :mod:`!dis` module also defines the following analysis functions that " +"convert the input directly to the desired output. They can be useful if only " +"a single operation is being performed, so the intermediate analysis object " +"isn't useful:" msgstr "" -msgid "Return a formatted multi-line string with detailed code object information for the supplied function, generator, asynchronous generator, coroutine, method, source code string or code object." +#: ../../library/dis.rst:232 +msgid "" +"Return a formatted multi-line string with detailed code object information " +"for the supplied function, generator, asynchronous generator, coroutine, " +"method, source code string or code object." msgstr "" -msgid "Note that the exact contents of code info strings are highly implementation dependent and they may change arbitrarily across Python VMs or Python releases." +#: ../../library/dis.rst:236 +msgid "" +"Note that the exact contents of code info strings are highly implementation " +"dependent and they may change arbitrarily across Python VMs or Python " +"releases." msgstr "" -msgid "Print detailed code object information for the supplied function, method, source code string or code object to *file* (or ``sys.stdout`` if *file* is not specified)." +#: ../../library/dis.rst:248 +msgid "" +"Print detailed code object information for the supplied function, method, " +"source code string or code object to *file* (or ``sys.stdout`` if *file* is " +"not specified)." msgstr "" -msgid "This is a convenient shorthand for ``print(code_info(x), file=file)``, intended for interactive exploration at the interpreter prompt." +#: ../../library/dis.rst:252 +msgid "" +"This is a convenient shorthand for ``print(code_info(x), file=file)``, " +"intended for interactive exploration at the interpreter prompt." msgstr "" +#: ../../library/dis.rst:257 ../../library/dis.rst:289 +#: ../../library/dis.rst:317 ../../library/dis.rst:353 msgid "Added *file* parameter." msgstr "" -msgid "Disassemble the *x* object. *x* can denote either a module, a class, a method, a function, a generator, an asynchronous generator, a coroutine, a code object, a string of source code or a byte sequence of raw bytecode. For a module, it disassembles all functions. For a class, it disassembles all methods (including class and static methods). For a code object or sequence of raw bytecode, it prints one line per bytecode instruction. It also recursively disassembles nested code objects. These can include generator expressions, nested functions, the bodies of nested classes, and the code objects used for :ref:`annotation scopes `. Strings are first compiled to code objects with the :func:`compile` built-in function before being disassembled. If no object is provided, this function disassembles the last traceback." -msgstr "" - -msgid "The disassembly is written as text to the supplied *file* argument if provided and to ``sys.stdout`` otherwise." +#: ../../library/dis.rst:264 +msgid "" +"Disassemble the *x* object. *x* can denote either a module, a class, a " +"method, a function, a generator, an asynchronous generator, a coroutine, a " +"code object, a string of source code or a byte sequence of raw bytecode. For " +"a module, it disassembles all functions. For a class, it disassembles all " +"methods (including class and static methods). For a code object or sequence " +"of raw bytecode, it prints one line per bytecode instruction. It also " +"recursively disassembles nested code objects. These can include generator " +"expressions, nested functions, the bodies of nested classes, and the code " +"objects used for :ref:`annotation scopes `. Strings are " +"first compiled to code objects with the :func:`compile` built-in function " +"before being disassembled. If no object is provided, this function " +"disassembles the last traceback." +msgstr "" + +#: ../../library/dis.rst:277 ../../library/dis.rst:314 +#: ../../library/dis.rst:350 +msgid "" +"The disassembly is written as text to the supplied *file* argument if " +"provided and to ``sys.stdout`` otherwise." msgstr "" -msgid "The maximal depth of recursion is limited by *depth* unless it is ``None``. ``depth=0`` means no recursion." +#: ../../library/dis.rst:280 +msgid "" +"The maximal depth of recursion is limited by *depth* unless it is ``None``. " +"``depth=0`` means no recursion." msgstr "" -msgid "If *show_caches* is ``True``, this function will display inline cache entries used by the interpreter to specialize the bytecode." +#: ../../library/dis.rst:283 +msgid "" +"If *show_caches* is ``True``, this function will display inline cache " +"entries used by the interpreter to specialize the bytecode." msgstr "" -msgid "If *adaptive* is ``True``, this function will display specialized bytecode that may be different from the original bytecode." +#: ../../library/dis.rst:286 +msgid "" +"If *adaptive* is ``True``, this function will display specialized bytecode " +"that may be different from the original bytecode." msgstr "" +#: ../../library/dis.rst:292 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" +#: ../../library/dis.rst:301 ../../library/dis.rst:323 +#: ../../library/dis.rst:359 msgid "Added the *show_offsets* parameter." msgstr "" -msgid "Disassemble the top-of-stack function of a traceback, using the last traceback if none was passed. The instruction causing the exception is indicated." +#: ../../library/dis.rst:310 +msgid "" +"Disassemble the top-of-stack function of a traceback, using the last " +"traceback if none was passed. The instruction causing the exception is " +"indicated." msgstr "" -msgid "Disassemble a code object, indicating the last instruction if *lasti* was provided. The output is divided in the following columns:" +#: ../../library/dis.rst:334 +msgid "" +"Disassemble a code object, indicating the last instruction if *lasti* was " +"provided. The output is divided in the following columns:" msgstr "" -msgid "the source code location of the instruction. Complete location information is shown if *show_positions* is true. Otherwise (the default) only the line number is displayed." +#: ../../library/dis.rst:337 +msgid "" +"the source code location of the instruction. Complete location information " +"is shown if *show_positions* is true. Otherwise (the default) only the line " +"number is displayed." msgstr "" +#: ../../library/dis.rst:340 msgid "the current instruction, indicated as ``-->``," msgstr "" +#: ../../library/dis.rst:341 msgid "a labelled instruction, indicated with ``>>``," msgstr "" +#: ../../library/dis.rst:342 msgid "the address of the instruction," msgstr "" +#: ../../library/dis.rst:343 msgid "the operation code name," msgstr "" +#: ../../library/dis.rst:344 msgid "operation parameters, and" msgstr "" +#: ../../library/dis.rst:345 msgid "interpretation of the parameters in parentheses." msgstr "" -msgid "The parameter interpretation recognizes local and global variable names, constant values, branch targets, and compare operators." +#: ../../library/dis.rst:347 +msgid "" +"The parameter interpretation recognizes local and global variable names, " +"constant values, branch targets, and compare operators." msgstr "" -msgid "Return an iterator over the instructions in the supplied function, method, source code string or code object." +#: ../../library/dis.rst:367 +msgid "" +"Return an iterator over the instructions in the supplied function, method, " +"source code string or code object." msgstr "" -msgid "The iterator generates a series of :class:`Instruction` named tuples giving the details of each operation in the supplied code." +#: ../../library/dis.rst:370 +msgid "" +"The iterator generates a series of :class:`Instruction` named tuples giving " +"the details of each operation in the supplied code." msgstr "" +#: ../../library/dis.rst:378 msgid "The *adaptive* parameter works as it does in :func:`dis`." msgstr "" -msgid "The *show_caches* parameter is deprecated and has no effect. The iterator generates the :class:`Instruction` instances with the *cache_info* field populated (regardless of the value of *show_caches*) and it no longer generates separate items for the cache entries." +#: ../../library/dis.rst:385 +msgid "" +"The *show_caches* parameter is deprecated and has no effect. The iterator " +"generates the :class:`Instruction` instances with the *cache_info* field " +"populated (regardless of the value of *show_caches*) and it no longer " +"generates separate items for the cache entries." msgstr "" -msgid "This generator function uses the :meth:`~codeobject.co_lines` method of the :ref:`code object ` *code* to find the offsets which are starts of lines in the source code. They are generated as ``(offset, lineno)`` pairs." +#: ../../library/dis.rst:393 +msgid "" +"This generator function uses the :meth:`~codeobject.co_lines` method of " +"the :ref:`code object ` *code* to find the offsets which are " +"starts of lines in the source code. They are generated as ``(offset, " +"lineno)`` pairs." msgstr "" +#: ../../library/dis.rst:398 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -msgid "The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` attributes of the :ref:`code object `." +#: ../../library/dis.rst:401 +msgid "" +"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " +"the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " +"attributes of the :ref:`code object `." msgstr "" -msgid "Line numbers can be ``None`` for bytecode that does not map to source lines." +#: ../../library/dis.rst:406 +msgid "" +"Line numbers can be ``None`` for bytecode that does not map to source lines." msgstr "" -msgid "Detect all offsets in the raw compiled bytecode string *code* which are jump targets, and return a list of these offsets." +#: ../../library/dis.rst:412 +msgid "" +"Detect all offsets in the raw compiled bytecode string *code* which are jump " +"targets, and return a list of these offsets." msgstr "" +#: ../../library/dis.rst:418 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -msgid "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` will return the stack effect of jumping. If *jump* is ``False``, it will return the stack effect of not jumping. And if *jump* is ``None`` (default), it will return the maximal stack effect of both cases." +#: ../../library/dis.rst:420 +msgid "" +"If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " +"will return the stack effect of jumping. If *jump* is ``False``, it will " +"return the stack effect of not jumping. And if *jump* is ``None`` (default), " +"it will return the maximal stack effect of both cases." msgstr "" +#: ../../library/dis.rst:427 msgid "Added *jump* parameter." msgstr "" -msgid "If ``oparg`` is omitted (or ``None``), the stack effect is now returned for ``oparg=0``. Previously this was an error for opcodes that use their arg. It is also no longer an error to pass an integer ``oparg`` when the ``opcode`` does not use it; the ``oparg`` in this case is ignored." +#: ../../library/dis.rst:430 +msgid "" +"If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " +"``oparg=0``. Previously this was an error for opcodes that use their arg. It " +"is also no longer an error to pass an integer ``oparg`` when the ``opcode`` " +"does not use it; the ``oparg`` in this case is ignored." msgstr "" +#: ../../library/dis.rst:440 msgid "Python Bytecode Instructions" msgstr "" -msgid "The :func:`get_instructions` function and :class:`Bytecode` class provide details of bytecode instructions as :class:`Instruction` instances:" +#: ../../library/dis.rst:442 +msgid "" +"The :func:`get_instructions` function and :class:`Bytecode` class provide " +"details of bytecode instructions as :class:`Instruction` instances:" msgstr "" +#: ../../library/dis.rst:447 msgid "Details for a bytecode operation" msgstr "" -msgid "numeric code for operation, corresponding to the opcode values listed below and the bytecode values in the :ref:`opcode_collections`." +#: ../../library/dis.rst:451 +msgid "" +"numeric code for operation, corresponding to the opcode values listed below " +"and the bytecode values in the :ref:`opcode_collections`." msgstr "" +#: ../../library/dis.rst:457 msgid "human readable name for operation" msgstr "" -msgid "numeric code for the base operation if operation is specialized; otherwise equal to :data:`opcode`" +#: ../../library/dis.rst:462 +msgid "" +"numeric code for the base operation if operation is specialized; otherwise " +"equal to :data:`opcode`" msgstr "" -msgid "human readable name for the base operation if operation is specialized; otherwise equal to :data:`opname`" +#: ../../library/dis.rst:468 +msgid "" +"human readable name for the base operation if operation is specialized; " +"otherwise equal to :data:`opname`" msgstr "" +#: ../../library/dis.rst:474 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" +#: ../../library/dis.rst:478 msgid "alias for :data:`arg`" msgstr "" +#: ../../library/dis.rst:482 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -msgid "human readable description of operation argument (if any), otherwise an empty string." +#: ../../library/dis.rst:487 +msgid "" +"human readable description of operation argument (if any), otherwise an " +"empty string." msgstr "" +#: ../../library/dis.rst:493 msgid "start index of operation within bytecode sequence" msgstr "" -msgid "start index of operation within bytecode sequence, including prefixed ``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" +#: ../../library/dis.rst:498 +msgid "" +"start index of operation within bytecode sequence, including prefixed " +"``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" msgstr "" +#: ../../library/dis.rst:504 msgid "start index of the cache entries following the operation" msgstr "" +#: ../../library/dis.rst:509 msgid "end index of the cache entries following the operation" msgstr "" +#: ../../library/dis.rst:514 msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -msgid "source line number associated with this opcode (if any), otherwise ``None``" +#: ../../library/dis.rst:519 +msgid "" +"source line number associated with this opcode (if any), otherwise ``None``" msgstr "" +#: ../../library/dis.rst:524 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -msgid "bytecode index of the jump target if this is a jump operation, otherwise ``None``" +#: ../../library/dis.rst:529 +msgid "" +"bytecode index of the jump target if this is a jump operation, otherwise " +"``None``" msgstr "" -msgid ":class:`dis.Positions` object holding the start and end locations that are covered by this instruction." +#: ../../library/dis.rst:535 +msgid "" +":class:`dis.Positions` object holding the start and end locations that are " +"covered by this instruction." msgstr "" -msgid "Information about the cache entries of this instruction, as triplets of the form ``(name, size, data)``, where the ``name`` and ``size`` describe the cache format and data is the contents of the cache. ``cache_info`` is ``None`` if the instruction does not have caches." +#: ../../library/dis.rst:540 +msgid "" +"Information about the cache entries of this instruction, as triplets of the " +"form ``(name, size, data)``, where the ``name`` and ``size`` describe the " +"cache format and data is the contents of the cache. ``cache_info`` is " +"``None`` if the instruction does not have caches." msgstr "" +#: ../../library/dis.rst:550 msgid "Field ``positions`` is added." msgstr "" +#: ../../library/dis.rst:554 msgid "Changed field ``starts_line``." msgstr "" -msgid "Added fields ``start_offset``, ``cache_offset``, ``end_offset``, ``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` and ``cache_info``." +#: ../../library/dis.rst:556 +msgid "" +"Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " +"``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " +"and ``cache_info``." msgstr "" -msgid "In case the information is not available, some fields might be ``None``." +#: ../../library/dis.rst:563 +msgid "" +"In case the information is not available, some fields might be ``None``." msgstr "" -msgid "The Python compiler currently generates the following bytecode instructions." +#: ../../library/dis.rst:573 +msgid "" +"The Python compiler currently generates the following bytecode instructions." msgstr "" +#: ../../library/dis.rst:576 msgid "**General instructions**" msgstr "" -msgid "In the following, We will refer to the interpreter stack as ``STACK`` and describe operations on it as if it was a Python list. The top of the stack corresponds to ``STACK[-1]`` in this language." +#: ../../library/dis.rst:578 +msgid "" +"In the following, We will refer to the interpreter stack as ``STACK`` and " +"describe operations on it as if it was a Python list. The top of the stack " +"corresponds to ``STACK[-1]`` in this language." msgstr "" -msgid "Do nothing code. Used as a placeholder by the bytecode optimizer, and to generate line tracing events." +#: ../../library/dis.rst:584 +msgid "" +"Do nothing code. Used as a placeholder by the bytecode optimizer, and to " +"generate line tracing events." msgstr "" -msgid "Do nothing code. Used by the interpreter to record :monitoring-event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events for :mod:`sys.monitoring`." +#: ../../library/dis.rst:590 +msgid "" +"Do nothing code. Used by the interpreter to record :monitoring-" +"event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events " +"for :mod:`sys.monitoring`." msgstr "" +#: ../../library/dis.rst:599 msgid "Removes the iterator from the top of the stack." msgstr "" +#: ../../library/dis.rst:606 msgid "Removes the top-of-stack item::" msgstr "" +#: ../../library/dis.rst:608 msgid "STACK.pop()" msgstr "" -msgid "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up at the end of loops, hence the name." +#: ../../library/dis.rst:613 +msgid "" +"Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " +"at the end of loops, hence the name." msgstr "" +#: ../../library/dis.rst:622 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -msgid "Push the i-th item to the top of the stack without removing it from its original location::" +#: ../../library/dis.rst:630 +msgid "" +"Push the i-th item to the top of the stack without removing it from its " +"original location::" msgstr "" +#: ../../library/dis.rst:633 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" msgstr "" +#: ../../library/dis.rst:641 msgid "Swap the top of the stack with the i-th element::" msgstr "" +#: ../../library/dis.rst:643 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "" -msgid "Rather than being an actual instruction, this opcode is used to mark extra space for the interpreter to cache useful data directly in the bytecode itself. It is automatically hidden by all ``dis`` utilities, but can be viewed with ``show_caches=True``." +#: ../../library/dis.rst:650 +msgid "" +"Rather than being an actual instruction, this opcode is used to mark extra " +"space for the interpreter to cache useful data directly in the bytecode " +"itself. It is automatically hidden by all ``dis`` utilities, but can be " +"viewed with ``show_caches=True``." msgstr "" -msgid "Logically, this space is part of the preceding instruction. Many opcodes expect to be followed by an exact number of caches, and will instruct the interpreter to skip over them at runtime." +#: ../../library/dis.rst:655 +msgid "" +"Logically, this space is part of the preceding instruction. Many opcodes " +"expect to be followed by an exact number of caches, and will instruct the " +"interpreter to skip over them at runtime." msgstr "" -msgid "Populated caches can look like arbitrary instructions, so great care should be taken when reading or modifying raw, adaptive bytecode containing quickened data." +#: ../../library/dis.rst:659 +msgid "" +"Populated caches can look like arbitrary instructions, so great care should " +"be taken when reading or modifying raw, adaptive bytecode containing " +"quickened data." msgstr "" +#: ../../library/dis.rst:666 msgid "**Unary operations**" msgstr "" -msgid "Unary operations take the top of the stack, apply the operation, and push the result back on the stack." +#: ../../library/dis.rst:668 +msgid "" +"Unary operations take the top of the stack, apply the operation, and push " +"the result back on the stack." msgstr "" +#: ../../library/dis.rst:674 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" +#: ../../library/dis.rst:679 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" +#: ../../library/dis.rst:681 ../../library/dis.rst:1383 +#: ../../library/dis.rst:1399 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" +#: ../../library/dis.rst:687 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" +#: ../../library/dis.rst:692 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -msgid "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." +#: ../../library/dis.rst:697 +msgid "" +"If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " +"it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" +#: ../../library/dis.rst:705 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" +#: ../../library/dis.rst:710 msgid "**Binary and in-place operations**" msgstr "" -msgid "Binary operations remove the top two items from the stack (``STACK[-1]`` and ``STACK[-2]``). They perform the operation, then put the result back on the stack." +#: ../../library/dis.rst:712 +msgid "" +"Binary operations remove the top two items from the stack (``STACK[-1]`` and " +"``STACK[-2]``). They perform the operation, then put the result back on the " +"stack." msgstr "" -msgid "In-place operations are like binary operations, but the operation is done in-place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be (but does not have to be) the original ``STACK[-2]``." +#: ../../library/dis.rst:715 +msgid "" +"In-place operations are like binary operations, but the operation is done in-" +"place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " +"(but does not have to be) the original ``STACK[-2]``." msgstr "" -msgid "Implements the binary and in-place operators (depending on the value of *op*)::" +#: ../../library/dis.rst:722 +msgid "" +"Implements the binary and in-place operators (depending on the value of " +"*op*)::" msgstr "" +#: ../../library/dis.rst:725 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" msgstr "" -msgid "With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode ``BINARY_SUBSCR``)" +#: ../../library/dis.rst:730 +msgid "" +"With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode " +"``BINARY_SUBSCR``)" msgstr "" +#: ../../library/dis.rst:736 ../../library/dis.rst:746 +#: ../../library/dis.rst:754 ../../library/dis.rst:766 +#: ../../library/dis.rst:844 ../../library/dis.rst:854 +#: ../../library/dis.rst:864 ../../library/dis.rst:1070 +#: ../../library/dis.rst:1081 ../../library/dis.rst:1226 +#: ../../library/dis.rst:1238 ../../library/dis.rst:1250 msgid "Implements::" msgstr "" +#: ../../library/dis.rst:738 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -482,12 +837,14 @@ msgid "" "container[key] = value" msgstr "" +#: ../../library/dis.rst:748 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" "del container[key]" msgstr "" +#: ../../library/dis.rst:756 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -495,6 +852,7 @@ msgid "" "STACK.append(container[start:end])" msgstr "" +#: ../../library/dis.rst:768 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -503,224 +861,416 @@ msgid "" "container[start:end] = value" msgstr "" +#: ../../library/dis.rst:777 msgid "**Coroutine opcodes**" msgstr "" -msgid "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where ``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a generator object with the :data:`~inspect.CO_ITERABLE_COROUTINE` flag, or resolves ``o.__await__``." +#: ../../library/dis.rst:781 +msgid "" +"Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " +"``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " +"generator object with the :data:`~inspect.CO_ITERABLE_COROUTINE` flag, or " +"resolves ``o.__await__``." msgstr "" -msgid "If the ``where`` operand is nonzero, it indicates where the instruction occurs:" +#: ../../library/dis.rst:786 +msgid "" +"If the ``where`` operand is nonzero, it indicates where the instruction " +"occurs:" msgstr "" +#: ../../library/dis.rst:789 msgid "``1``: After a call to ``__aenter__``" msgstr "" +#: ../../library/dis.rst:790 msgid "``2``: After a call to ``__aexit__``" msgstr "" +#: ../../library/dis.rst:794 msgid "Previously, this instruction did not have an oparg." msgstr "" +#: ../../library/dis.rst:800 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" +#: ../../library/dis.rst:803 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -msgid "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." +#: ../../library/dis.rst:810 +msgid "" +"Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " +"stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -msgid "Terminates an :keyword:`async for` loop. Handles an exception raised when awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` and the raised exception in ``STACK[-1]``. Both are popped. If the exception is not :exc:`StopAsyncIteration`, it is re-raised." +#: ../../library/dis.rst:818 +msgid "" +"Terminates an :keyword:`async for` loop. Handles an exception raised when " +"awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " +"and the raised exception in ``STACK[-1]``. Both are popped. If the exception " +"is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -msgid "Exception representation on the stack now consist of one, not three, items." +#: ../../library/dis.rst:825 ../../library/dis.rst:916 +#: ../../library/dis.rst:927 +msgid "" +"Exception representation on the stack now consist of one, not three, items." msgstr "" -msgid "Handles an exception raised during a :meth:`~generator.throw` or :meth:`~generator.close` call through the current frame. If ``STACK[-1]`` is an instance of :exc:`StopIteration`, pop three values from the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." +#: ../../library/dis.rst:831 +msgid "" +"Handles an exception raised during a :meth:`~generator.throw` " +"or :meth:`~generator.close` call through the current frame. If " +"``STACK[-1]`` is an instance of :exc:`StopIteration`, pop three values from " +"the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" +#: ../../library/dis.rst:840 msgid "**Miscellaneous opcodes**" msgstr "" +#: ../../library/dis.rst:846 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" msgstr "" +#: ../../library/dis.rst:849 msgid "Used to implement set comprehensions." msgstr "" +#: ../../library/dis.rst:856 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" msgstr "" +#: ../../library/dis.rst:859 msgid "Used to implement list comprehensions." msgstr "" +#: ../../library/dis.rst:866 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" msgstr "" +#: ../../library/dis.rst:870 msgid "Used to implement dict comprehensions." msgstr "" -msgid "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were reversed." +#: ../../library/dis.rst:873 +msgid "" +"Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " +"reversed." msgstr "" -msgid "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:`MAP_ADD` instructions, while the added value or key/value pair is popped off, the container object remains on the stack so that it is available for further iterations of the loop." +#: ../../library/dis.rst:877 +msgid "" +"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` " +"and :opcode:`MAP_ADD` instructions, while the added value or key/value pair " +"is popped off, the container object remains on the stack so that it is " +"available for further iterations of the loop." msgstr "" +#: ../../library/dis.rst:885 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" +#: ../../library/dis.rst:890 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" +#: ../../library/dis.rst:892 msgid "oparg set to be the stack depth." msgstr "" -msgid "oparg set to be the exception block depth, for efficient closing of generators." +#: ../../library/dis.rst:895 +msgid "" +"oparg set to be the exception block depth, for efficient closing of " +"generators." msgstr "" -msgid "oparg is ``1`` if this instruction is part of a yield-from or await, and ``0`` otherwise." +#: ../../library/dis.rst:898 +msgid "" +"oparg is ``1`` if this instruction is part of a yield-from or await, and " +"``0`` otherwise." msgstr "" -msgid "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is set up to an empty ``dict``. This opcode is only emitted if a class or module body contains :term:`variable annotations ` statically." +#: ../../library/dis.rst:904 +msgid "" +"Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " +"set up to an empty ``dict``. This opcode is only emitted if a class or " +"module body contains :term:`variable annotations ` " +"statically." msgstr "" -msgid "Pops a value from the stack, which is used to restore the exception state." +#: ../../library/dis.rst:914 +msgid "" +"Pops a value from the stack, which is used to restore the exception state." msgstr "" -msgid "Re-raises the exception currently on top of the stack. If oparg is non-zero, pops an additional value from the stack which is used to set :attr:`~frame.f_lasti` of the current frame." +#: ../../library/dis.rst:921 +msgid "" +"Re-raises the exception currently on top of the stack. If oparg is non-zero, " +"pops an additional value from the stack which is used to " +"set :attr:`~frame.f_lasti` of the current frame." msgstr "" -msgid "Pops a value from the stack. Pushes the current exception to the top of the stack. Pushes the value originally popped back to the stack. Used in exception handlers." +#: ../../library/dis.rst:932 +msgid "" +"Pops a value from the stack. Pushes the current exception to the top of the " +"stack. Pushes the value originally popped back to the stack. Used in " +"exception handlers." msgstr "" -msgid "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the boolean result of the test." +#: ../../library/dis.rst:940 +msgid "" +"Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " +"is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " +"boolean result of the test." msgstr "" -msgid "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on the exception group representing ``STACK[-2]``." +#: ../../library/dis.rst:948 +msgid "" +"Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " +"the exception group representing ``STACK[-2]``." msgstr "" -msgid "In case of a match, pops two items from the stack and pushes the non-matching subgroup (``None`` in case of full match) followed by the matching subgroup. When there is no match, pops one item (the match type) and pushes ``None``." +#: ../../library/dis.rst:951 +msgid "" +"In case of a match, pops two items from the stack and pushes the non-" +"matching subgroup (``None`` in case of full match) followed by the matching " +"subgroup. When there is no match, pops one item (the match type) and pushes " +"``None``." msgstr "" -msgid "Calls the function in position 4 on the stack with arguments (type, val, tb) representing the exception at the top of the stack. Used to implement the call ``context_manager.__exit__(*exc_info())`` when an exception has occurred in a :keyword:`with` statement." +#: ../../library/dis.rst:960 +msgid "" +"Calls the function in position 4 on the stack with arguments (type, val, tb) " +"representing the exception at the top of the stack. Used to implement the " +"call ``context_manager.__exit__(*exc_info())`` when an exception has " +"occurred in a :keyword:`with` statement." msgstr "" -msgid "The ``__exit__`` function is in position 4 of the stack rather than 7. Exception representation on the stack now consist of one, not three, items." +#: ../../library/dis.rst:967 +msgid "" +"The ``__exit__`` function is in position 4 of the stack rather than 7. " +"Exception representation on the stack now consist of one, not three, items." msgstr "" -msgid "Pushes a common constant onto the stack. The interpreter contains a hardcoded list of constants supported by this instruction. Used by the :keyword:`assert` statement to load :exc:`AssertionError`." +#: ../../library/dis.rst:974 +msgid "" +"Pushes a common constant onto the stack. The interpreter contains a " +"hardcoded list of constants supported by this instruction. Used by " +"the :keyword:`assert` statement to load :exc:`AssertionError`." msgstr "" -msgid "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called to construct a class." +#: ../../library/dis.rst:983 +msgid "" +"Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " +"to construct a class." msgstr "" -msgid "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` statements where comparison with structure of pattern is needed." +#: ../../library/dis.rst:988 +msgid "" +"Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " +"statements where comparison with structure of pattern is needed." msgstr "" -msgid "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in its :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack. Otherwise, push ``False``." +#: ../../library/dis.rst:996 +msgid "" +"If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " +"more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " +"its :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack. " +"Otherwise, push ``False``." msgstr "" -msgid "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is *not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, more technically: if it has the :c:macro:`Py_TPFLAGS_SEQUENCE` flag set in its :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack. Otherwise, push ``False``." +#: ../../library/dis.rst:1006 +msgid "" +"If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " +"*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " +"more technically: if it has the :c:macro:`Py_TPFLAGS_SEQUENCE` flag set in " +"its :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack. " +"Otherwise, push ``False``." msgstr "" -msgid "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :class:`tuple` containing the corresponding values. Otherwise, push ``None``." +#: ../../library/dis.rst:1016 +msgid "" +"``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " +"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push " +"a :class:`tuple` containing the corresponding values. Otherwise, push " +"``None``." msgstr "" -msgid "Previously, this instruction also pushed a boolean value indicating success (``True``) or failure (``False``)." +#: ../../library/dis.rst:1022 ../../library/dis.rst:1768 +msgid "" +"Previously, this instruction also pushed a boolean value indicating success " +"(``True``) or failure (``False``)." msgstr "" -msgid "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` or :opcode:`STORE_GLOBAL` if possible." +#: ../../library/dis.rst:1029 +msgid "" +"Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " +"attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` " +"or :opcode:`STORE_GLOBAL` if possible." msgstr "" -msgid "Implements ``del name``, where *namei* is the index into :attr:`~codeobject.co_names` attribute of the :ref:`code object `." +#: ../../library/dis.rst:1036 +msgid "" +"Implements ``del name``, where *namei* is the index " +"into :attr:`~codeobject.co_names` attribute of the :ref:`code object `." msgstr "" -msgid "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the stack right-to-left. Require there to be exactly *count* values.::" +#: ../../library/dis.rst:1042 +msgid "" +"Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " +"stack right-to-left. Require there to be exactly *count* values.::" msgstr "" +#: ../../library/dis.rst:1045 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" msgstr "" -msgid "Implements assignment with a starred target: Unpacks an iterable in ``STACK[-1]`` into individual values, where the total number of values can be smaller than the number of items in the iterable: one of the new values will be a list of all leftover items." +#: ../../library/dis.rst:1051 +msgid "" +"Implements assignment with a starred target: Unpacks an iterable in " +"``STACK[-1]`` into individual values, where the total number of values can " +"be smaller than the number of items in the iterable: one of the new values " +"will be a list of all leftover items." msgstr "" +#: ../../library/dis.rst:1056 msgid "The number of values before and after the list value is limited to 255." msgstr "" -msgid "The number of values before the list value is encoded in the argument of the opcode. The number of values after the list if any is encoded using an ``EXTENDED_ARG``. As a consequence, the argument can be seen as a two bytes values where the low byte of *counts* is the number of values before the list value, the high byte of *counts* the number of values after it." +#: ../../library/dis.rst:1058 +msgid "" +"The number of values before the list value is encoded in the argument of the " +"opcode. The number of values after the list if any is encoded using an " +"``EXTENDED_ARG``. As a consequence, the argument can be seen as a two bytes " +"values where the low byte of *counts* is the number of values before the " +"list value, the high byte of *counts* the number of values after it." msgstr "" -msgid "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = d`` will be stored after execution as ``STACK.extend((a, b, c))``." +#: ../../library/dis.rst:1064 +msgid "" +"The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " +"d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" +#: ../../library/dis.rst:1072 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" "obj.name = value" msgstr "" -msgid "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :ref:`code object `." +#: ../../library/dis.rst:1076 +msgid "" +"where *namei* is the index of name in :attr:`~codeobject.co_names` of " +"the :ref:`code object `." msgstr "" +#: ../../library/dis.rst:1083 msgid "" "obj = STACK.pop()\n" "del obj.name" msgstr "" -msgid "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :ref:`code object `." +#: ../../library/dis.rst:1086 +msgid "" +"where *namei* is the index of name into :attr:`~codeobject.co_names` of " +"the :ref:`code object `." msgstr "" +#: ../../library/dis.rst:1092 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" +#: ../../library/dis.rst:1097 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" +#: ../../library/dis.rst:1102 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -msgid "Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" +#: ../../library/dis.rst:1107 +msgid "" +"Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" msgstr "" -msgid "Pushes the value associated with ``co_names[namei]`` onto the stack. The name is looked up within the locals, then the globals, then the builtins." +#: ../../library/dis.rst:1115 +msgid "" +"Pushes the value associated with ``co_names[namei]`` onto the stack. The " +"name is looked up within the locals, then the globals, then the builtins." msgstr "" -msgid "Pushes a reference to the locals dictionary onto the stack. This is used to prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." +#: ../../library/dis.rst:1121 +msgid "" +"Pushes a reference to the locals dictionary onto the stack. This is used to " +"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` " +"and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -msgid "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. If the name is not found there, looks it up in the globals and then the builtins, similar to :opcode:`LOAD_GLOBAL`. This is used for loading global variables in :ref:`annotation scopes ` within class bodies." +#: ../../library/dis.rst:1130 +msgid "" +"Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " +"If the name is not found there, looks it up in the globals and then the " +"builtins, similar to :opcode:`LOAD_GLOBAL`. This is used for loading global " +"variables in :ref:`annotation scopes ` within class " +"bodies." msgstr "" -msgid "Constructs a new :class:`~string.templatelib.Template` instance from a tuple of strings and a tuple of interpolations and pushes the resulting object onto the stack::" +#: ../../library/dis.rst:1141 +msgid "" +"Constructs a new :class:`~string.templatelib.Template` instance from a tuple " +"of strings and a tuple of interpolations and pushes the resulting object " +"onto the stack::" msgstr "" +#: ../../library/dis.rst:1145 msgid "" "interpolations = STACK.pop()\n" "strings = STACK.pop()\n" "STACK.append(_build_template(strings, interpolations))" msgstr "" -msgid "Constructs a new :class:`~string.templatelib.Interpolation` instance from a value and its source expression and pushes the resulting object onto the stack." +#: ../../library/dis.rst:1154 +msgid "" +"Constructs a new :class:`~string.templatelib.Interpolation` instance from a " +"value and its source expression and pushes the resulting object onto the " +"stack." msgstr "" -msgid "If no conversion or format specification is present, ``format`` is set to ``2``." +#: ../../library/dis.rst:1158 +msgid "" +"If no conversion or format specification is present, ``format`` is set to " +"``2``." msgstr "" -msgid "If the low bit of ``format`` is set, it indicates that the interpolation contains a format specification." +#: ../../library/dis.rst:1161 +msgid "" +"If the low bit of ``format`` is set, it indicates that the interpolation " +"contains a format specification." msgstr "" -msgid "If ``format >> 2`` is non-zero, it indicates that the interpolation contains a conversion. The value of ``format >> 2`` is the conversion type (``0`` for no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" +#: ../../library/dis.rst:1164 +msgid "" +"If ``format >> 2`` is non-zero, it indicates that the interpolation contains " +"a conversion. The value of ``format >> 2`` is the conversion type (``0`` for " +"no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" msgstr "" +#: ../../library/dis.rst:1169 msgid "" "conversion = format >> 2\n" "if format & 1:\n" @@ -729,12 +1279,17 @@ msgid "" " format_spec = None\n" "expression = STACK.pop()\n" "value = STACK.pop()\n" -"STACK.append(_build_interpolation(value, expression, conversion, format_spec))" +"STACK.append(_build_interpolation(value, expression, conversion, " +"format_spec))" msgstr "" -msgid "Creates a tuple consuming *count* items from the stack, and pushes the resulting tuple onto the stack::" +#: ../../library/dis.rst:1183 +msgid "" +"Creates a tuple consuming *count* items from the stack, and pushes the " +"resulting tuple onto the stack::" msgstr "" +#: ../../library/dis.rst:1186 msgid "" "if count == 0:\n" " value = ()\n" @@ -745,294 +1300,529 @@ msgid "" "STACK.append(value)" msgstr "" +#: ../../library/dis.rst:1197 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" +#: ../../library/dis.rst:1202 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -msgid "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], STACK[-2]: STACK[-1]}``." +#: ../../library/dis.rst:1207 +msgid "" +"Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " +"that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " +"STACK[-2]: STACK[-1]}``." msgstr "" -msgid "The dictionary is created from stack items instead of creating an empty dictionary pre-sized to hold *count* items." +#: ../../library/dis.rst:1211 +msgid "" +"The dictionary is created from stack items instead of creating an empty " +"dictionary pre-sized to hold *count* items." msgstr "" -msgid "Concatenates *count* strings from the stack and pushes the resulting string onto the stack." +#: ../../library/dis.rst:1218 +msgid "" +"Concatenates *count* strings from the stack and pushes the resulting string " +"onto the stack." msgstr "" +#: ../../library/dis.rst:1228 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" msgstr "" +#: ../../library/dis.rst:1231 msgid "Used to build lists." msgstr "" +#: ../../library/dis.rst:1240 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" msgstr "" +#: ../../library/dis.rst:1243 msgid "Used to build sets." msgstr "" +#: ../../library/dis.rst:1252 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" msgstr "" +#: ../../library/dis.rst:1255 msgid "Used to build dicts." msgstr "" +#: ../../library/dis.rst:1262 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -msgid "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with ``getattr(STACK[-1], co_names[namei>>1])``." +#: ../../library/dis.rst:1269 +msgid "" +"If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " +"``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -msgid "If the low bit of ``namei`` is set, this will attempt to load a method named ``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is popped. This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the correct name, the bytecode pushes the unbound method and ``STACK[-1]``. ``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL` or :opcode:`CALL_KW` when calling the unbound method. Otherwise, ``NULL`` and the object returned by the attribute lookup are pushed." +#: ../../library/dis.rst:1272 +msgid "" +"If the low bit of ``namei`` is set, this will attempt to load a method named " +"``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " +"popped. This bytecode distinguishes two cases: if ``STACK[-1]`` has a method " +"with the correct name, the bytecode pushes the unbound method and " +"``STACK[-1]``. ``STACK[-1]`` will be used as the first argument (``self``) " +"by :opcode:`CALL` or :opcode:`CALL_KW` when calling the unbound method. " +"Otherwise, ``NULL`` and the object returned by the attribute lookup are " +"pushed." msgstr "" -msgid "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to the stack before the attribute or unbound method respectively." +#: ../../library/dis.rst:1281 +msgid "" +"If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " +"the stack before the attribute or unbound method respectively." msgstr "" -msgid "This opcode implements :func:`super`, both in its zero-argument and two-argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, self).method()``, ``super(cls, self).attr``)." +#: ../../library/dis.rst:1288 +msgid "" +"This opcode implements :func:`super`, both in its zero-argument and two-" +"argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " +"self).method()``, ``super(cls, self).attr``)." msgstr "" +#: ../../library/dis.rst:1292 msgid "It pops three values from the stack (from top of stack down):" msgstr "" +#: ../../library/dis.rst:1294 msgid "``self``: the first argument to the current method" msgstr "" +#: ../../library/dis.rst:1295 msgid "``cls``: the class within which the current method was defined" msgstr "" +#: ../../library/dis.rst:1296 msgid "the global ``super``" msgstr "" -msgid "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, except that ``namei`` is shifted left by 2 bits instead of 1." +#: ../../library/dis.rst:1298 +msgid "" +"With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " +"except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -msgid "The low bit of ``namei`` signals to attempt a method load, as with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When it is unset a single value is pushed to the stack." +#: ../../library/dis.rst:1301 +msgid "" +"The low bit of ``namei`` signals to attempt a method load, as " +"with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " +"method. When it is unset a single value is pushed to the stack." msgstr "" -msgid "The second-low bit of ``namei``, if set, means that this was a two-argument call to :func:`super` (unset means zero-argument)." +#: ../../library/dis.rst:1305 +msgid "" +"The second-low bit of ``namei``, if set, means that this was a two-argument " +"call to :func:`super` (unset means zero-argument)." msgstr "" -msgid "Performs a Boolean operation. The operation name can be found in ``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set (``opname & 16``), the result should be coerced to ``bool``." +#: ../../library/dis.rst:1313 +msgid "" +"Performs a Boolean operation. The operation name can be found in " +"``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " +"(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -msgid "The fifth-lowest bit of the oparg now indicates a forced conversion to :class:`bool`." +#: ../../library/dis.rst:1317 +msgid "" +"The fifth-lowest bit of the oparg now indicates a forced conversion " +"to :class:`bool`." msgstr "" +#: ../../library/dis.rst:1324 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" +#: ../../library/dis.rst:1331 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -msgid "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are popped and provide the *fromlist* and *level* arguments of :func:`__import__`. The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent :opcode:`STORE_FAST` instruction modifies the namespace." +#: ../../library/dis.rst:1338 +msgid "" +"Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " +"popped and provide the *fromlist* and *level* arguments " +"of :func:`__import__`. The module object is pushed onto the stack. The " +"current namespace is not affected: for a proper import statement, a " +"subsequent :opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -msgid "Loads the attribute ``co_names[namei]`` from the module found in ``STACK[-1]``. The resulting object is pushed onto the stack, to be subsequently stored by a :opcode:`STORE_FAST` instruction." +#: ../../library/dis.rst:1346 +msgid "" +"Loads the attribute ``co_names[namei]`` from the module found in " +"``STACK[-1]``. The resulting object is pushed onto the stack, to be " +"subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" +#: ../../library/dis.rst:1353 msgid "Increments bytecode counter by *delta*." msgstr "" +#: ../../library/dis.rst:1358 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" +#: ../../library/dis.rst:1365 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -msgid "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. ``STACK[-1]`` is popped." +#: ../../library/dis.rst:1372 +msgid "" +"If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " +"``STACK[-1]`` is popped." msgstr "" -msgid "The oparg is now a relative delta rather than an absolute target. This opcode is a pseudo-instruction, replaced in final bytecode by the directed versions (forward/backward)." +#: ../../library/dis.rst:1375 ../../library/dis.rst:1391 +msgid "" +"The oparg is now a relative delta rather than an absolute target. This " +"opcode is a pseudo-instruction, replaced in final bytecode by the directed " +"versions (forward/backward)." msgstr "" +#: ../../library/dis.rst:1380 ../../library/dis.rst:1396 +#: ../../library/dis.rst:1409 ../../library/dis.rst:1420 msgid "This is no longer a pseudo-instruction." msgstr "" -msgid "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. ``STACK[-1]`` is popped." +#: ../../library/dis.rst:1388 +msgid "" +"If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " +"``STACK[-1]`` is popped." msgstr "" -msgid "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by *delta*. ``STACK[-1]`` is popped." +#: ../../library/dis.rst:1404 +msgid "" +"If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " +"*delta*. ``STACK[-1]`` is popped." msgstr "" -msgid "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. ``STACK[-1]`` is popped." +#: ../../library/dis.rst:1415 +msgid "" +"If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " +"``STACK[-1]`` is popped." msgstr "" -msgid "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` method. If this yields a new value, push it on the stack (leaving the iterator below it). If the iterator indicates it is exhausted then the byte code counter is incremented by *delta*." +#: ../../library/dis.rst:1425 +msgid "" +"``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " +"method. If this yields a new value, push it on the stack (leaving the " +"iterator below it). If the iterator indicates it is exhausted then the byte " +"code counter is incremented by *delta*." msgstr "" +#: ../../library/dis.rst:1430 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" +#: ../../library/dis.rst:1435 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -msgid "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack before the global variable." +#: ../../library/dis.rst:1437 +msgid "" +"If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " +"before the global variable." msgstr "" -msgid "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." +#: ../../library/dis.rst:1443 +msgid "" +"Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -msgid "This opcode is now only used in situations where the local variable is guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." +#: ../../library/dis.rst:1445 +msgid "" +"This opcode is now only used in situations where the local variable is " +"guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -msgid "Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the stack." +#: ../../library/dis.rst:1451 +msgid "" +"Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " +"stack." msgstr "" -msgid "Pushes references to ``co_varnames[var_nums >> 4]`` and ``co_varnames[var_nums & 15]`` onto the stack." +#: ../../library/dis.rst:1458 +msgid "" +"Pushes references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -msgid "Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and ``co_varnames[var_nums & 15]`` onto the stack." +#: ../../library/dis.rst:1466 +msgid "" +"Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -msgid "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, raising an :exc:`UnboundLocalError` if the local variable has not been initialized." +#: ../../library/dis.rst:1473 +msgid "" +"Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " +"raising an :exc:`UnboundLocalError` if the local variable has not been " +"initialized." msgstr "" -msgid "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or pushes ``NULL`` onto the stack if the local variable has not been initialized) and sets ``co_varnames[var_num]`` to ``NULL``." +#: ../../library/dis.rst:1481 +msgid "" +"Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " +"pushes ``NULL`` onto the stack if the local variable has not been " +"initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" +#: ../../library/dis.rst:1489 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -msgid "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` into ``co_varnames[var_nums & 15]``." +#: ../../library/dis.rst:1493 +msgid "" +"Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " +"into ``co_varnames[var_nums & 15]``." msgstr "" -msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the stack." +#: ../../library/dis.rst:1500 +msgid "" +"Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " +"pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " +"stack." msgstr "" +#: ../../library/dis.rst:1508 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -msgid "Creates a new cell in slot ``i``. If that slot is nonempty then that value is stored into the new cell." +#: ../../library/dis.rst:1513 +msgid "" +"Creates a new cell in slot ``i``. If that slot is nonempty then that value " +"is stored into the new cell." msgstr "" -msgid "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. Pushes a reference to the object the cell contains on the stack." +#: ../../library/dis.rst:1521 +msgid "" +"Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " +"Pushes a reference to the object the cell contains on the stack." msgstr "" -msgid "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." +#: ../../library/dis.rst:1524 ../../library/dis.rst:1546 +#: ../../library/dis.rst:1557 +msgid "" +"``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -msgid "Pops a mapping off the stack and looks up the name associated with slot ``i`` of the \"fast locals\" storage in this mapping. If the name is not found there, loads it from the cell contained in slot ``i``, similar to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables ` in class bodies (which previously used :opcode:`!LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within class bodies." +#: ../../library/dis.rst:1530 +msgid "" +"Pops a mapping off the stack and looks up the name associated with slot " +"``i`` of the \"fast locals\" storage in this mapping. If the name is not " +"found there, loads it from the cell contained in slot ``i``, similar " +"to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"` in class bodies (which previously used :opcode:`!" +"LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " +"class bodies." msgstr "" -msgid "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast locals\" storage." +#: ../../library/dis.rst:1543 +msgid "" +"Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " +"locals\" storage." msgstr "" -msgid "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. Used by the :keyword:`del` statement." +#: ../../library/dis.rst:1552 +msgid "" +"Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " +"Used by the :keyword:`del` statement." msgstr "" -msgid "Copies the ``n`` :term:`free (closure) variables ` from the closure into the frame. Removes the need for special code on the caller's side when calling closures." +#: ../../library/dis.rst:1563 +msgid "" +"Copies the ``n`` :term:`free (closure) variables ` from " +"the closure into the frame. Removes the need for special code on the " +"caller's side when calling closures." msgstr "" -msgid "Raises an exception using one of the 3 forms of the ``raise`` statement, depending on the value of *argc*:" +#: ../../library/dis.rst:1572 +msgid "" +"Raises an exception using one of the 3 forms of the ``raise`` statement, " +"depending on the value of *argc*:" msgstr "" +#: ../../library/dis.rst:1575 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -msgid "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" +#: ../../library/dis.rst:1576 +msgid "" +"1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -msgid "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at ``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" +#: ../../library/dis.rst:1577 +msgid "" +"2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " +"``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -msgid "Calls a callable object with the number of arguments specified by ``argc``. On the stack are (in ascending order):" +#: ../../library/dis.rst:1583 +msgid "" +"Calls a callable object with the number of arguments specified by ``argc``. " +"On the stack are (in ascending order):" msgstr "" +#: ../../library/dis.rst:1586 ../../library/dis.rst:1610 msgid "The callable" msgstr "" +#: ../../library/dis.rst:1587 ../../library/dis.rst:1611 msgid "``self`` or ``NULL``" msgstr "" +#: ../../library/dis.rst:1588 ../../library/dis.rst:1612 msgid "The remaining positional arguments" msgstr "" +#: ../../library/dis.rst:1590 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -msgid "``CALL`` pops all arguments and the callable object off the stack, calls the callable object with those arguments, and pushes the return value returned by the callable object." +#: ../../library/dis.rst:1592 +msgid "" +"``CALL`` pops all arguments and the callable object off the stack, calls the " +"callable object with those arguments, and pushes the return value returned " +"by the callable object." msgstr "" +#: ../../library/dis.rst:1598 msgid "The callable now always appears at the same position on the stack." msgstr "" +#: ../../library/dis.rst:1601 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -msgid "Calls a callable object with the number of arguments specified by ``argc``, including one or more named arguments. On the stack are (in ascending order):" +#: ../../library/dis.rst:1607 +msgid "" +"Calls a callable object with the number of arguments specified by ``argc``, " +"including one or more named arguments. On the stack are (in ascending order):" msgstr "" +#: ../../library/dis.rst:1613 msgid "The named arguments" msgstr "" +#: ../../library/dis.rst:1614 msgid "A :class:`tuple` of keyword argument names" msgstr "" -msgid "``argc`` is the total of the positional and named arguments, excluding ``self``. The length of the tuple of keyword argument names is the number of named arguments." +#: ../../library/dis.rst:1616 +msgid "" +"``argc`` is the total of the positional and named arguments, excluding " +"``self``. The length of the tuple of keyword argument names is the number of " +"named arguments." msgstr "" -msgid "``CALL_KW`` pops all arguments, the keyword names, and the callable object off the stack, calls the callable object with those arguments, and pushes the return value returned by the callable object." +#: ../../library/dis.rst:1619 +msgid "" +"``CALL_KW`` pops all arguments, the keyword names, and the callable object " +"off the stack, calls the callable object with those arguments, and pushes " +"the return value returned by the callable object." msgstr "" -msgid "Calls a callable object with variable set of positional and keyword arguments. If the lowest bit of *flags* is set, the top of the stack contains a mapping object containing additional keyword arguments. Before the callable is called, the mapping object and iterable object are each \"unpacked\" and their contents passed in as keyword and positional arguments respectively. ``CALL_FUNCTION_EX`` pops all arguments and the callable object off the stack, calls the callable object with those arguments, and pushes the return value returned by the callable object." +#: ../../library/dis.rst:1628 +msgid "" +"Calls a callable object with variable set of positional and keyword " +"arguments. If the lowest bit of *flags* is set, the top of the stack " +"contains a mapping object containing additional keyword arguments. Before " +"the callable is called, the mapping object and iterable object are each " +"\"unpacked\" and their contents passed in as keyword and positional " +"arguments respectively. ``CALL_FUNCTION_EX`` pops all arguments and the " +"callable object off the stack, calls the callable object with those " +"arguments, and pushes the return value returned by the callable object." msgstr "" -msgid "Pushes a ``NULL`` to the stack. Used in the call sequence to match the ``NULL`` pushed by :opcode:`!LOAD_METHOD` for non-method calls." +#: ../../library/dis.rst:1643 +msgid "" +"Pushes a ``NULL`` to the stack. Used in the call sequence to match the " +"``NULL`` pushed by :opcode:`!LOAD_METHOD` for non-method calls." msgstr "" -msgid "Pushes a new function object on the stack built from the code object at ``STACK[-1]``." +#: ../../library/dis.rst:1652 +msgid "" +"Pushes a new function object on the stack built from the code object at " +"``STACK[-1]``." msgstr "" +#: ../../library/dis.rst:1654 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" +#: ../../library/dis.rst:1657 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -msgid "Extra function attributes on the stack, signaled by oparg flags, were removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." +#: ../../library/dis.rst:1660 +msgid "" +"Extra function attributes on the stack, signaled by oparg flags, were " +"removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -msgid "Sets an attribute on a function object. Expects the function at ``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both and leaves the function at ``STACK[-1]``. The flag determines which attribute to set:" +#: ../../library/dis.rst:1667 +msgid "" +"Sets an attribute on a function object. Expects the function at " +"``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " +"and leaves the function at ``STACK[-1]``. The flag determines which " +"attribute to set:" msgstr "" -msgid "``0x01`` a tuple of default values for positional-only and positional-or-keyword parameters in positional order" +#: ../../library/dis.rst:1671 +msgid "" +"``0x01`` a tuple of default values for positional-only and positional-or-" +"keyword parameters in positional order" msgstr "" +#: ../../library/dis.rst:1673 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" +#: ../../library/dis.rst:1674 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" +#: ../../library/dis.rst:1675 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" +#: ../../library/dis.rst:1676 msgid "``0x10`` the :term:`annotate function` for the function object" msgstr "" -msgid "Added ``0x10`` to indicate the annotate function for the function object." +#: ../../library/dis.rst:1680 +msgid "" +"Added ``0x10`` to indicate the annotate function for the function object." msgstr "" -msgid "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, implements::" +#: ../../library/dis.rst:1688 +msgid "" +"Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " +"implements::" msgstr "" +#: ../../library/dis.rst:1690 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" +#: ../../library/dis.rst:1694 msgid "if it is 3, implements::" msgstr "" +#: ../../library/dis.rst:1696 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1040,45 +1830,62 @@ msgid "" "STACK.append(slice(start, end, step))" msgstr "" +#: ../../library/dis.rst:1701 msgid "See the :func:`slice` built-in function for more information." msgstr "" -msgid "Prefixes any opcode which has an argument too big to fit into the default one byte. *ext* holds an additional byte which act as higher bits in the argument. For each opcode, at most three prefixal ``EXTENDED_ARG`` are allowed, forming an argument from two-byte to four-byte." +#: ../../library/dis.rst:1706 +msgid "" +"Prefixes any opcode which has an argument too big to fit into the default " +"one byte. *ext* holds an additional byte which act as higher bits in the " +"argument. For each opcode, at most three prefixal ``EXTENDED_ARG`` are " +"allowed, forming an argument from two-byte to four-byte." msgstr "" +#: ../../library/dis.rst:1714 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" +#: ../../library/dis.rst:1716 msgid "" "value = STACK.pop()\n" "result = func(value)\n" "STACK.append(result)" msgstr "" +#: ../../library/dis.rst:1720 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" +#: ../../library/dis.rst:1721 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" +#: ../../library/dis.rst:1722 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" +#: ../../library/dis.rst:1724 ../../library/dis.rst:1737 +#: ../../library/dis.rst:1750 msgid "Used for implementing formatted string literals (f-strings)." msgstr "" +#: ../../library/dis.rst:1731 msgid "Formats the value on top of stack::" msgstr "" +#: ../../library/dis.rst:1733 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" "STACK.append(result)" msgstr "" +#: ../../library/dis.rst:1743 msgid "Formats the given value with the given format spec::" msgstr "" +#: ../../library/dis.rst:1745 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1086,147 +1893,234 @@ msgid "" "STACK.append(result)" msgstr "" -msgid "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the class being matched against, and ``STACK[-3]`` is the match subject. *count* is the number of positional sub-patterns." +#: ../../library/dis.rst:1757 +msgid "" +"``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " +"class being matched against, and ``STACK[-3]`` is the match subject. " +"*count* is the number of positional sub-patterns." msgstr "" -msgid "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an instance of ``STACK[-2]`` and has the positional and keyword attributes required by *count* and ``STACK[-1]``, push a tuple of extracted attributes. Otherwise, push ``None``." +#: ../../library/dis.rst:1761 +msgid "" +"Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " +"instance of ``STACK[-2]`` and has the positional and keyword attributes " +"required by *count* and ``STACK[-1]``, push a tuple of extracted attributes. " +"Otherwise, push ``None``." msgstr "" +#: ../../library/dis.rst:1775 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -msgid "The ``context`` operand consists of two parts. The lowest two bits indicate where the ``RESUME`` occurs:" +#: ../../library/dis.rst:1777 +msgid "" +"The ``context`` operand consists of two parts. The lowest two bits indicate " +"where the ``RESUME`` occurs:" msgstr "" -msgid "``0`` The start of a function, which is neither a generator, coroutine nor an async generator" +#: ../../library/dis.rst:1780 +msgid "" +"``0`` The start of a function, which is neither a generator, coroutine nor " +"an async generator" msgstr "" +#: ../../library/dis.rst:1782 msgid "``1`` After a ``yield`` expression" msgstr "" +#: ../../library/dis.rst:1783 msgid "``2`` After a ``yield from`` expression" msgstr "" +#: ../../library/dis.rst:1784 msgid "``3`` After an ``await`` expression" msgstr "" -msgid "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` otherwise." +#: ../../library/dis.rst:1786 +msgid "" +"The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " +"otherwise." msgstr "" +#: ../../library/dis.rst:1791 msgid "The oparg value changed to include information about except-depth" msgstr "" -msgid "Create a generator, coroutine, or async generator from the current frame. Used as first opcode of in code object for the above mentioned callables. Clear the current frame and return the newly created generator." +#: ../../library/dis.rst:1797 +msgid "" +"Create a generator, coroutine, or async generator from the current frame. " +"Used as first opcode of in code object for the above mentioned callables. " +"Clear the current frame and return the newly created generator." msgstr "" -msgid "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield from`` and ``await`` statements." +#: ../../library/dis.rst:1806 +msgid "" +"Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " +"from`` and ``await`` statements." msgstr "" -msgid "If the call raises :exc:`StopIteration`, pop the top value from the stack, push the exception's ``value`` attribute, and increment the bytecode counter by *delta*." +#: ../../library/dis.rst:1809 +msgid "" +"If the call raises :exc:`StopIteration`, pop the top value from the stack, " +"push the exception's ``value`` attribute, and increment the bytecode counter " +"by *delta*." msgstr "" -msgid "This is not really an opcode. It identifies the dividing line between opcodes in the range [0,255] which don't use their argument and those that do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." +#: ../../library/dis.rst:1818 +msgid "" +"This is not really an opcode. It identifies the dividing line between " +"opcodes in the range [0,255] which don't use their argument and those that " +"do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -msgid "If your application uses pseudo instructions or specialized instructions, use the :data:`hasarg` collection instead." +#: ../../library/dis.rst:1822 +msgid "" +"If your application uses pseudo instructions or specialized instructions, " +"use the :data:`hasarg` collection instead." msgstr "" -msgid "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." +#: ../../library/dis.rst:1825 +msgid "" +"Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " +"ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -msgid "Pseudo instructions were added to the :mod:`!dis` module, and for them it is not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use their arg." +#: ../../library/dis.rst:1829 +msgid "" +"Pseudo instructions were added to the :mod:`!dis` module, and for them it is " +"not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " +"their arg." msgstr "" +#: ../../library/dis.rst:1834 msgid "Use :data:`hasarg` instead." msgstr "" -msgid "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the argument and sets ``STACK[-1]`` to the result. Used to implement functionality that is not performance critical." +#: ../../library/dis.rst:1839 +msgid "" +"Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " +"argument and sets ``STACK[-1]`` to the result. Used to implement " +"functionality that is not performance critical." msgstr "" +#: ../../library/dis.rst:1843 ../../library/dis.rst:1897 msgid "The operand determines which intrinsic function is called:" msgstr "" +#: ../../library/dis.rst:1846 ../../library/dis.rst:1900 msgid "Operand" msgstr "" +#: ../../library/dis.rst:1846 ../../library/dis.rst:1900 msgid "Description" msgstr "" +#: ../../library/dis.rst:1848 msgid "``INTRINSIC_1_INVALID``" msgstr "" +#: ../../library/dis.rst:1848 ../../library/dis.rst:1902 msgid "Not valid" msgstr "" +#: ../../library/dis.rst:1850 msgid "``INTRINSIC_PRINT``" msgstr "" +#: ../../library/dis.rst:1850 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" +#: ../../library/dis.rst:1853 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "" +#: ../../library/dis.rst:1853 msgid "Performs ``import *`` for the named module." msgstr "" +#: ../../library/dis.rst:1856 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "" +#: ../../library/dis.rst:1856 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" +#: ../../library/dis.rst:1859 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "" +#: ../../library/dis.rst:1859 msgid "Wraps an async generator value" msgstr "" +#: ../../library/dis.rst:1861 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "" +#: ../../library/dis.rst:1861 msgid "Performs the unary ``+`` operation" msgstr "" +#: ../../library/dis.rst:1864 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "" +#: ../../library/dis.rst:1864 msgid "Converts a list to a tuple" msgstr "" +#: ../../library/dis.rst:1866 msgid "``INTRINSIC_TYPEVAR``" msgstr "" +#: ../../library/dis.rst:1866 msgid "Creates a :class:`typing.TypeVar`" msgstr "" +#: ../../library/dis.rst:1868 msgid "``INTRINSIC_PARAMSPEC``" msgstr "" +#: ../../library/dis.rst:1868 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" +#: ../../library/dis.rst:1871 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "" +#: ../../library/dis.rst:1871 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" +#: ../../library/dis.rst:1874 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "" +#: ../../library/dis.rst:1874 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" +#: ../../library/dis.rst:1877 msgid "``INTRINSIC_TYPEALIAS``" msgstr "" -msgid "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` statement. The argument is a tuple of the type alias's name, type parameters, and value." +#: ../../library/dis.rst:1877 +msgid "" +"Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " +"statement. The argument is a tuple of the type alias's name, type " +"parameters, and value." msgstr "" -msgid "Calls an intrinsic function with two arguments. Used to implement functionality that is not performance critical::" +#: ../../library/dis.rst:1889 +msgid "" +"Calls an intrinsic function with two arguments. Used to implement " +"functionality that is not performance critical::" msgstr "" +#: ../../library/dis.rst:1892 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -1234,131 +2128,216 @@ msgid "" "STACK.append(result)" msgstr "" +#: ../../library/dis.rst:1902 msgid "``INTRINSIC_2_INVALID``" msgstr "" +#: ../../library/dis.rst:1904 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "" +#: ../../library/dis.rst:1904 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" +#: ../../library/dis.rst:1908 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "" +#: ../../library/dis.rst:1908 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" +#: ../../library/dis.rst:1911 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "" +#: ../../library/dis.rst:1911 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" +#: ../../library/dis.rst:1915 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "" +#: ../../library/dis.rst:1915 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -msgid "Performs special method lookup on ``STACK[-1]``. If ``type(STACK[-1]).__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; STACK[-1]`` on the stack. If ``type(STACK[-1]).__xxx__`` is not a method, leave ``STACK[-1].__xxx__; NULL`` on the stack." +#: ../../library/dis.rst:1924 +msgid "" +"Performs special method lookup on ``STACK[-1]``. If " +"``type(STACK[-1]).__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; " +"STACK[-1]`` on the stack. If ``type(STACK[-1]).__xxx__`` is not a method, " +"leave ``STACK[-1].__xxx__; NULL`` on the stack." msgstr "" +#: ../../library/dis.rst:1933 msgid "**Pseudo-instructions**" msgstr "" -msgid "These opcodes do not appear in Python bytecode. They are used by the compiler but are replaced by real opcodes or removed before bytecode is generated." +#: ../../library/dis.rst:1935 +msgid "" +"These opcodes do not appear in Python bytecode. They are used by the " +"compiler but are replaced by real opcodes or removed before bytecode is " +"generated." msgstr "" -msgid "Set up an exception handler for the following code block. If an exception occurs, the value stack level is restored to its current state and control is transferred to the exception handler at ``target``." +#: ../../library/dis.rst:1940 +msgid "" +"Set up an exception handler for the following code block. If an exception " +"occurs, the value stack level is restored to its current state and control " +"is transferred to the exception handler at ``target``." msgstr "" -msgid "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If an exception occurs, the value stack level and the last instruction on the frame are restored to their current state, and control is transferred to the exception handler at ``target``." +#: ../../library/dis.rst:1947 +msgid "" +"Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " +"instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " +"an exception occurs, the value stack level and the last instruction on the " +"frame are restored to their current state, and control is transferred to the " +"exception handler at ``target``." msgstr "" -msgid "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped from the stack before control is transferred to the exception handler at ``target``." +#: ../../library/dis.rst:1956 +msgid "" +"Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " +"from the stack before control is transferred to the exception handler at " +"``target``." msgstr "" -msgid "This variant is used in :keyword:`with` and :keyword:`async with` constructs, which push the return value of the context manager's :meth:`~object.__enter__` or :meth:`~object.__aenter__` to the stack." +#: ../../library/dis.rst:1960 +msgid "" +"This variant is used in :keyword:`with` and :keyword:`async with` " +"constructs, which push the return value of the context " +"manager's :meth:`~object.__enter__` or :meth:`~object.__aenter__` to the " +"stack." msgstr "" -msgid "Marks the end of the code block associated with the last ``SETUP_FINALLY``, ``SETUP_CLEANUP`` or ``SETUP_WITH``." +#: ../../library/dis.rst:1967 +msgid "" +"Marks the end of the code block associated with the last ``SETUP_FINALLY``, " +"``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -msgid "Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." +#: ../../library/dis.rst:1973 +msgid "" +"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." msgstr "" -msgid "Undirected relative jump instructions which are replaced by their directed (forward/backward) counterparts by the assembler." +#: ../../library/dis.rst:1979 +msgid "" +"Undirected relative jump instructions which are replaced by their directed " +"(forward/backward) counterparts by the assembler." msgstr "" -msgid "Conditional jumps which do not impact the stack. Replaced by the sequence ``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." +#: ../../library/dis.rst:1985 +msgid "" +"Conditional jumps which do not impact the stack. Replaced by the sequence " +"``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." msgstr "" -msgid "Pushes a reference to the cell contained in slot ``i`` of the \"fast locals\" storage." +#: ../../library/dis.rst:1990 +msgid "" +"Pushes a reference to the cell contained in slot ``i`` of the \"fast " +"locals\" storage." msgstr "" -msgid "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." +#: ../../library/dis.rst:1993 +msgid "" +"Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" +#: ../../library/dis.rst:1995 msgid "This opcode is now a pseudo-instruction." msgstr "" +#: ../../library/dis.rst:2002 msgid "Opcode collections" msgstr "" -msgid "These collections are provided for automatic introspection of bytecode instructions:" +#: ../../library/dis.rst:2004 +msgid "" +"These collections are provided for automatic introspection of bytecode " +"instructions:" msgstr "" -msgid "The collections now contain pseudo instructions and instrumented instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` and ``>= MIN_INSTRUMENTED_OPCODE``." +#: ../../library/dis.rst:2007 +msgid "" +"The collections now contain pseudo instructions and instrumented " +"instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " +"and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" +#: ../../library/dis.rst:2014 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" +#: ../../library/dis.rst:2019 msgid "Dictionary mapping operation names to bytecodes." msgstr "" +#: ../../library/dis.rst:2024 msgid "Sequence of all compare operation names." msgstr "" +#: ../../library/dis.rst:2029 msgid "Sequence of bytecodes that use their argument." msgstr "" +#: ../../library/dis.rst:2036 msgid "Sequence of bytecodes that access a constant." msgstr "" -msgid "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that are referenced by inner scopes or names in outer scopes that are referenced from this scope. It does *not* include references to global or builtin scopes." +#: ../../library/dis.rst:2041 +msgid "" +"Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " +"are referenced by inner scopes or names in outer scopes that are referenced " +"from this scope. It does *not* include references to global or builtin " +"scopes." msgstr "" +#: ../../library/dis.rst:2049 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" +#: ../../library/dis.rst:2054 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" +#: ../../library/dis.rst:2061 msgid "Sequence of bytecodes that access a local variable." msgstr "" +#: ../../library/dis.rst:2066 msgid "Sequence of bytecodes of Boolean operations." msgstr "" +#: ../../library/dis.rst:2070 msgid "Sequence of bytecodes that set an exception handler." msgstr "" +#: ../../library/dis.rst:2077 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" +#: ../../library/dis.rst:2079 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" +#: ../../library/dis.rst:2085 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" +#: ../../library/dis.rst:2087 msgid "All jumps are now relative. This list is empty." msgstr "" +#: ../../library/dis.rst:1686 msgid "built-in function" msgstr "" +#: ../../library/dis.rst:1686 msgid "slice" msgstr "" diff --git a/library/distribution.po b/library/distribution.po index 624a584a7..236a26812 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,8 +21,14 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/distribution.rst:3 msgid "Software Packaging and Distribution" msgstr "" -msgid "These libraries help you with publishing and installing Python software. While these modules are designed to work in conjunction with the `Python Package Index `__, they can also be used with a local index server, or without any index server at all." +#: ../../library/distribution.rst:5 +msgid "" +"These libraries help you with publishing and installing Python software. " +"While these modules are designed to work in conjunction with the `Python " +"Package Index `__, they can also be used with a local " +"index server, or without any index server at all." msgstr "" diff --git a/library/distutils.po b/library/distutils.po index df7878305..4eb5e6509 100644 --- a/library/distutils.po +++ b/library/distutils.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,21 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/distutils.rst:2 msgid ":mod:`!distutils` --- Building and installing Python modules" msgstr "" -msgid "This module is no longer part of the Python standard library. It was :ref:`removed in Python 3.12 ` after being deprecated in Python 3.10. The removal was decided in :pep:`632`, which has `migration advice `_." +#: ../../library/distutils.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It " +"was :ref:`removed in Python 3.12 ` after " +"being deprecated in Python 3.10. The removal was decided in :pep:`632`, " +"which has `migration advice `_." msgstr "" -msgid "The last version of Python that provided the :mod:`!distutils` module was `Python 3.11 `_." +#: ../../library/distutils.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!distutils` module was " +"`Python 3.11 `_." msgstr "" diff --git a/library/doctest.po b/library/doctest.po index f4cff6d69..10409d49c 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,27 +23,46 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/doctest.rst:2 msgid ":mod:`!doctest` --- Test interactive Python examples" msgstr "" +#: ../../library/doctest.rst:12 msgid "**Source code:** :source:`Lib/doctest.py`" msgstr "" -msgid "The :mod:`!doctest` module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. There are several common ways to use doctest:" +#: ../../library/doctest.rst:16 +msgid "" +"The :mod:`!doctest` module searches for pieces of text that look like " +"interactive Python sessions, and then executes those sessions to verify that " +"they work exactly as shown. There are several common ways to use doctest:" msgstr "" -msgid "To check that a module's docstrings are up-to-date by verifying that all interactive examples still work as documented." +#: ../../library/doctest.rst:20 +msgid "" +"To check that a module's docstrings are up-to-date by verifying that all " +"interactive examples still work as documented." msgstr "" -msgid "To perform regression testing by verifying that interactive examples from a test file or a test object work as expected." +#: ../../library/doctest.rst:23 +msgid "" +"To perform regression testing by verifying that interactive examples from a " +"test file or a test object work as expected." msgstr "" -msgid "To write tutorial documentation for a package, liberally illustrated with input-output examples. Depending on whether the examples or the expository text are emphasized, this has the flavor of \"literate testing\" or \"executable documentation\"." +#: ../../library/doctest.rst:26 +msgid "" +"To write tutorial documentation for a package, liberally illustrated with " +"input-output examples. Depending on whether the examples or the expository " +"text are emphasized, this has the flavor of \"literate testing\" or " +"\"executable documentation\"." msgstr "" +#: ../../library/doctest.rst:31 msgid "Here's a complete but small example module::" msgstr "" +#: ../../library/doctest.rst:33 msgid "" "\"\"\"\n" "This is the \"example\" module.\n" @@ -101,17 +120,26 @@ msgid "" " doctest.testmod()" msgstr "" -msgid "If you run :file:`example.py` directly from the command line, :mod:`!doctest` works its magic:" +#: ../../library/doctest.rst:88 +msgid "" +"If you run :file:`example.py` directly from the command line, :mod:`!" +"doctest` works its magic:" msgstr "" +#: ../../library/doctest.rst:91 msgid "" "$ python example.py\n" "$" msgstr "" -msgid "There's no output! That's normal, and it means all the examples worked. Pass ``-v`` to the script, and :mod:`!doctest` prints a detailed log of what it's trying, and prints a summary at the end:" +#: ../../library/doctest.rst:96 +msgid "" +"There's no output! That's normal, and it means all the examples worked. " +"Pass ``-v`` to the script, and :mod:`!doctest` prints a detailed log of what " +"it's trying, and prints a summary at the end:" msgstr "" +#: ../../library/doctest.rst:100 msgid "" "$ python example.py -v\n" "Trying:\n" @@ -126,9 +154,11 @@ msgid "" "ok" msgstr "" +#: ../../library/doctest.rst:114 msgid "And so on, eventually ending with:" msgstr "" +#: ../../library/doctest.rst:116 msgid "" "Trying:\n" " factorial(1e100)\n" @@ -146,68 +176,119 @@ msgid "" "$" msgstr "" -msgid "That's all you need to know to start making productive use of :mod:`!doctest`! Jump in. The following sections provide full details. Note that there are many examples of doctests in the standard Python test suite and libraries. Especially useful examples can be found in the standard test file :file:`Lib/test/test_doctest/test_doctest.py`." +#: ../../library/doctest.rst:133 +msgid "" +"That's all you need to know to start making productive use of :mod:`!" +"doctest`! Jump in. The following sections provide full details. Note that " +"there are many examples of doctests in the standard Python test suite and " +"libraries. Especially useful examples can be found in the standard test " +"file :file:`Lib/test/test_doctest/test_doctest.py`." msgstr "" -msgid "Output is colorized by default and can be :ref:`controlled using environment variables `." +#: ../../library/doctest.rst:139 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." msgstr "" +#: ../../library/doctest.rst:147 msgid "Simple Usage: Checking Examples in Docstrings" msgstr "" -msgid "The simplest way to start using doctest (but not necessarily the way you'll continue to do it) is to end each module :mod:`!M` with::" +#: ../../library/doctest.rst:149 +msgid "" +"The simplest way to start using doctest (but not necessarily the way you'll " +"continue to do it) is to end each module :mod:`!M` with::" msgstr "" +#: ../../library/doctest.rst:152 msgid "" "if __name__ == \"__main__\":\n" " import doctest\n" " doctest.testmod()" msgstr "" +#: ../../library/doctest.rst:156 msgid ":mod:`!doctest` then examines docstrings in module :mod:`!M`." msgstr "" -msgid "Running the module as a script causes the examples in the docstrings to get executed and verified::" +#: ../../library/doctest.rst:158 +msgid "" +"Running the module as a script causes the examples in the docstrings to get " +"executed and verified::" msgstr "" +#: ../../library/doctest.rst:161 msgid "python M.py" msgstr "" -msgid "This won't display anything unless an example fails, in which case the failing example(s) and the cause(s) of the failure(s) are printed to stdout, and the final line of output is ``***Test Failed*** N failures.``, where *N* is the number of examples that failed." +#: ../../library/doctest.rst:163 +msgid "" +"This won't display anything unless an example fails, in which case the " +"failing example(s) and the cause(s) of the failure(s) are printed to stdout, " +"and the final line of output is ``***Test Failed*** N failures.``, where *N* " +"is the number of examples that failed." msgstr "" +#: ../../library/doctest.rst:168 msgid "Run it with the ``-v`` switch instead::" msgstr "" +#: ../../library/doctest.rst:170 msgid "python M.py -v" msgstr "" -msgid "and a detailed report of all examples tried is printed to standard output, along with assorted summaries at the end." +#: ../../library/doctest.rst:172 +msgid "" +"and a detailed report of all examples tried is printed to standard output, " +"along with assorted summaries at the end." msgstr "" -msgid "You can force verbose mode by passing ``verbose=True`` to :func:`testmod`, or prohibit it by passing ``verbose=False``. In either of those cases, :data:`sys.argv` is not examined by :func:`testmod` (so passing ``-v`` or not has no effect)." +#: ../../library/doctest.rst:175 +msgid "" +"You can force verbose mode by passing ``verbose=True`` to :func:`testmod`, " +"or prohibit it by passing ``verbose=False``. In either of those " +"cases, :data:`sys.argv` is not examined by :func:`testmod` (so passing ``-" +"v`` or not has no effect)." msgstr "" -msgid "There is also a command line shortcut for running :func:`testmod`, see section :ref:`doctest-cli`." +#: ../../library/doctest.rst:180 +msgid "" +"There is also a command line shortcut for running :func:`testmod`, see " +"section :ref:`doctest-cli`." msgstr "" -msgid "For more information on :func:`testmod`, see section :ref:`doctest-basic-api`." +#: ../../library/doctest.rst:183 +msgid "" +"For more information on :func:`testmod`, see section :ref:`doctest-basic-" +"api`." msgstr "" +#: ../../library/doctest.rst:189 msgid "Simple Usage: Checking Examples in a Text File" msgstr "" -msgid "Another simple application of doctest is testing interactive examples in a text file. This can be done with the :func:`testfile` function::" +#: ../../library/doctest.rst:191 +msgid "" +"Another simple application of doctest is testing interactive examples in a " +"text file. This can be done with the :func:`testfile` function::" msgstr "" +#: ../../library/doctest.rst:194 msgid "" "import doctest\n" "doctest.testfile(\"example.txt\")" msgstr "" -msgid "That short script executes and verifies any interactive Python examples contained in the file :file:`example.txt`. The file content is treated as if it were a single giant docstring; the file doesn't need to contain a Python program! For example, perhaps :file:`example.txt` contains this:" +#: ../../library/doctest.rst:197 +msgid "" +"That short script executes and verifies any interactive Python examples " +"contained in the file :file:`example.txt`. The file content is treated as " +"if it were a single giant docstring; the file doesn't need to contain a " +"Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" +#: ../../library/doctest.rst:202 msgid "" "The ``example`` module\n" "======================\n" @@ -226,9 +307,13 @@ msgid "" " 120" msgstr "" -msgid "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this documentation::" +#: ../../library/doctest.rst:220 +msgid "" +"Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " +"documentation::" msgstr "" +#: ../../library/doctest.rst:223 msgid "" "File \"./example.txt\", line 14, in example.txt\n" "Failed example:\n" @@ -239,69 +324,132 @@ msgid "" " 720" msgstr "" -msgid "As with :func:`testmod`, :func:`testfile` won't display anything unless an example fails. If an example does fail, then the failing example(s) and the cause(s) of the failure(s) are printed to stdout, using the same format as :func:`!testmod`." +#: ../../library/doctest.rst:231 +msgid "" +"As with :func:`testmod`, :func:`testfile` won't display anything unless an " +"example fails. If an example does fail, then the failing example(s) and the " +"cause(s) of the failure(s) are printed to stdout, using the same format " +"as :func:`!testmod`." msgstr "" -msgid "By default, :func:`testfile` looks for files in the calling module's directory. See section :ref:`doctest-basic-api` for a description of the optional arguments that can be used to tell it to look for files in other locations." +#: ../../library/doctest.rst:236 +msgid "" +"By default, :func:`testfile` looks for files in the calling module's " +"directory. See section :ref:`doctest-basic-api` for a description of the " +"optional arguments that can be used to tell it to look for files in other " +"locations." msgstr "" -msgid "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-v`` command-line switch or with the optional keyword argument *verbose*." +#: ../../library/doctest.rst:240 +msgid "" +"Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" +"v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" -msgid "There is also a command line shortcut for running :func:`testfile`, see section :ref:`doctest-cli`." +#: ../../library/doctest.rst:244 +msgid "" +"There is also a command line shortcut for running :func:`testfile`, see " +"section :ref:`doctest-cli`." msgstr "" -msgid "For more information on :func:`testfile`, see section :ref:`doctest-basic-api`." +#: ../../library/doctest.rst:247 +msgid "" +"For more information on :func:`testfile`, see section :ref:`doctest-basic-" +"api`." msgstr "" +#: ../../library/doctest.rst:253 msgid "Command-line Usage" msgstr "" -msgid "The :mod:`!doctest` module can be invoked as a script from the command line:" +#: ../../library/doctest.rst:255 +msgid "" +"The :mod:`!doctest` module can be invoked as a script from the command line:" msgstr "" +#: ../../library/doctest.rst:257 msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" msgstr "" -msgid "Detailed report of all examples tried is printed to standard output, along with assorted summaries at the end::" +#: ../../library/doctest.rst:265 +msgid "" +"Detailed report of all examples tried is printed to standard output, along " +"with assorted summaries at the end::" msgstr "" +#: ../../library/doctest.rst:268 msgid "python -m doctest -v example.py" msgstr "" -msgid "This will import :file:`example.py` as a standalone module and run :func:`testmod` on it. Note that this may not work correctly if the file is part of a package and imports other submodules from that package." +#: ../../library/doctest.rst:270 +msgid "" +"This will import :file:`example.py` as a standalone module and " +"run :func:`testmod` on it. Note that this may not work correctly if the file " +"is part of a package and imports other submodules from that package." msgstr "" -msgid "If the file name does not end with :file:`.py`, :mod:`!doctest` infers that it must be run with :func:`testfile` instead::" +#: ../../library/doctest.rst:274 +msgid "" +"If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " +"it must be run with :func:`testfile` instead::" msgstr "" +#: ../../library/doctest.rst:277 msgid "python -m doctest -v example.txt" msgstr "" -msgid "Option flags control various aspects of doctest's behavior, see section :ref:`doctest-options`." +#: ../../library/doctest.rst:281 +msgid "" +"Option flags control various aspects of doctest's behavior, see " +"section :ref:`doctest-options`." msgstr "" +#: ../../library/doctest.rst:288 msgid "This is shorthand for ``-o FAIL_FAST``." msgstr "" +#: ../../library/doctest.rst:296 msgid "How It Works" msgstr "" -msgid "This section examines in detail how doctest works: which docstrings it looks at, how it finds interactive examples, what execution context it uses, how it handles exceptions, and how option flags can be used to control its behavior. This is the information that you need to know to write doctest examples; for information about actually running doctest on these examples, see the following sections." +#: ../../library/doctest.rst:298 +msgid "" +"This section examines in detail how doctest works: which docstrings it looks " +"at, how it finds interactive examples, what execution context it uses, how " +"it handles exceptions, and how option flags can be used to control its " +"behavior. This is the information that you need to know to write doctest " +"examples; for information about actually running doctest on these examples, " +"see the following sections." msgstr "" +#: ../../library/doctest.rst:309 msgid "Which Docstrings Are Examined?" msgstr "" -msgid "The module docstring, and all function, class and method docstrings are searched. Objects imported into the module are not searched." -msgstr "" - -msgid "In addition, there are cases when you want tests to be part of a module but not part of the help text, which requires that the tests not be included in the docstring. Doctest looks for a module-level variable called ``__test__`` and uses it to locate other tests. If ``M.__test__`` exists, it must be a dict, and each entry maps a (string) name to a function object, class object, or string. Function and class object docstrings found from ``M.__test__`` are searched, and strings are treated as if they were docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M.__test__.K``." +#: ../../library/doctest.rst:311 +msgid "" +"The module docstring, and all function, class and method docstrings are " +"searched. Objects imported into the module are not searched." msgstr "" +#: ../../library/doctest.rst:321 +msgid "" +"In addition, there are cases when you want tests to be part of a module but " +"not part of the help text, which requires that the tests not be included in " +"the docstring. Doctest looks for a module-level variable called ``__test__`` " +"and uses it to locate other tests. If ``M.__test__`` exists, it must be a " +"dict, and each entry maps a (string) name to a function object, class " +"object, or string. Function and class object docstrings found from " +"``M.__test__`` are searched, and strings are treated as if they were " +"docstrings. In output, a key ``K`` in ``M.__test__`` appears with name " +"``M.__test__.K``." +msgstr "" + +#: ../../library/doctest.rst:330 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" +#: ../../library/doctest.rst:332 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -314,24 +462,45 @@ msgid "" "}" msgstr "" -msgid "The value of ``example.__test__[\"numbers\"]`` will be treated as a docstring and all the tests inside it will be run. It is important to note that the value can be mapped to a function, class object, or module; if so, :mod:`!doctest` searches them recursively for docstrings, which are then scanned for tests." +#: ../../library/doctest.rst:344 +msgid "" +"The value of ``example.__test__[\"numbers\"]`` will be treated as a " +"docstring and all the tests inside it will be run. It is important to note " +"that the value can be mapped to a function, class object, or module; if " +"so, :mod:`!doctest` searches them recursively for docstrings, which are then " +"scanned for tests." msgstr "" -msgid "Any classes found are recursively searched similarly, to test docstrings in their contained methods and nested classes." +#: ../../library/doctest.rst:350 +msgid "" +"Any classes found are recursively searched similarly, to test docstrings in " +"their contained methods and nested classes." msgstr "" -msgid "``doctest`` can only automatically discover classes and functions that are defined at the module level or inside other classes." +#: ../../library/doctest.rst:355 +msgid "" +"``doctest`` can only automatically discover classes and functions that are " +"defined at the module level or inside other classes." msgstr "" -msgid "Since nested classes and functions only exist when an outer function is called, they cannot be discovered. Define them outside to make them visible." +#: ../../library/doctest.rst:358 +msgid "" +"Since nested classes and functions only exist when an outer function is " +"called, they cannot be discovered. Define them outside to make them visible." msgstr "" +#: ../../library/doctest.rst:364 msgid "How are Docstring Examples Recognized?" msgstr "" -msgid "In most cases a copy-and-paste of an interactive console session works fine, but doctest isn't trying to do an exact emulation of any specific Python shell." +#: ../../library/doctest.rst:366 +msgid "" +"In most cases a copy-and-paste of an interactive console session works fine, " +"but doctest isn't trying to do an exact emulation of any specific Python " +"shell." msgstr "" +#: ../../library/doctest.rst:371 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -350,24 +519,54 @@ msgid "" ">>>" msgstr "" -msgid "Any expected output must immediately follow the final ``'>>> '`` or ``'... '`` line containing the code, and the expected output (if any) extends to the next ``'>>> '`` or all-whitespace line." +#: ../../library/doctest.rst:391 +msgid "" +"Any expected output must immediately follow the final ``'>>> '`` or ``'... " +"'`` line containing the code, and the expected output (if any) extends to " +"the next ``'>>> '`` or all-whitespace line." msgstr "" +#: ../../library/doctest.rst:395 msgid "The fine print:" msgstr "" -msgid "Expected output cannot contain an all-whitespace line, since such a line is taken to signal the end of expected output. If expected output does contain a blank line, put ```` in your doctest example each place a blank line is expected." -msgstr "" - -msgid "All hard tab characters are expanded to spaces, using 8-column tab stops. Tabs in output generated by the tested code are not modified. Because any hard tabs in the sample output *are* expanded, this means that if the code output includes hard tabs, the only way the doctest can pass is if the :const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` is in effect. Alternatively, the test can be rewritten to capture the output and compare it to an expected value as part of the test. This handling of tabs in the source was arrived at through trial and error, and has proven to be the least error prone way of handling them. It is possible to use a different algorithm for handling tabs by writing a custom :class:`DocTestParser` class." +#: ../../library/doctest.rst:397 +msgid "" +"Expected output cannot contain an all-whitespace line, since such a line is " +"taken to signal the end of expected output. If expected output does contain " +"a blank line, put ```` in your doctest example each place a blank " +"line is expected." msgstr "" -msgid "Output to stdout is captured, but not output to stderr (exception tracebacks are captured via a different means)." +#: ../../library/doctest.rst:402 +msgid "" +"All hard tab characters are expanded to spaces, using 8-column tab stops. " +"Tabs in output generated by the tested code are not modified. Because any " +"hard tabs in the sample output *are* expanded, this means that if the code " +"output includes hard tabs, the only way the doctest can pass is if " +"the :const:`NORMALIZE_WHITESPACE` option or :ref:`directive ` is in effect. Alternatively, the test can be rewritten to " +"capture the output and compare it to an expected value as part of the test. " +"This handling of tabs in the source was arrived at through trial and error, " +"and has proven to be the least error prone way of handling them. It is " +"possible to use a different algorithm for handling tabs by writing a " +"custom :class:`DocTestParser` class." +msgstr "" + +#: ../../library/doctest.rst:414 +msgid "" +"Output to stdout is captured, but not output to stderr (exception tracebacks " +"are captured via a different means)." msgstr "" -msgid "If you continue a line via backslashing in an interactive session, or for any other reason use a backslash, you should use a raw docstring, which will preserve your backslashes exactly as you type them::" +#: ../../library/doctest.rst:417 +msgid "" +"If you continue a line via backslashing in an interactive session, or for " +"any other reason use a backslash, you should use a raw docstring, which will " +"preserve your backslashes exactly as you type them::" msgstr "" +#: ../../library/doctest.rst:421 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -376,9 +575,15 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -msgid "Otherwise, the backslash will be interpreted as part of the string. For example, the ``\\n`` above would be interpreted as a newline character. Alternatively, you can double each backslash in the doctest version (and not use a raw string)::" +#: ../../library/doctest.rst:427 +msgid "" +"Otherwise, the backslash will be interpreted as part of the string. For " +"example, the ``\\n`` above would be interpreted as a newline character. " +"Alternatively, you can double each backslash in the doctest version (and not " +"use a raw string)::" msgstr "" +#: ../../library/doctest.rst:431 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -387,9 +592,11 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" +#: ../../library/doctest.rst:437 msgid "The starting column doesn't matter::" msgstr "" +#: ../../library/doctest.rst:439 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" @@ -397,27 +604,51 @@ msgid "" " 1" msgstr "" -msgid "and as many leading whitespace characters are stripped from the expected output as appeared in the initial ``'>>> '`` line that started the example." +#: ../../library/doctest.rst:444 +msgid "" +"and as many leading whitespace characters are stripped from the expected " +"output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" +#: ../../library/doctest.rst:451 msgid "What's the Execution Context?" msgstr "" -msgid "By default, each time :mod:`!doctest` finds a docstring to test, it uses a *shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change the module's real globals, and so that one test in :mod:`!M` can't leave behind crumbs that accidentally allow another test to work. This means examples can freely use any names defined at top-level in :mod:`!M`, and names defined earlier in the docstring being run. Examples cannot see names defined in other docstrings." +#: ../../library/doctest.rst:453 +msgid "" +"By default, each time :mod:`!doctest` finds a docstring to test, it uses a " +"*shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change " +"the module's real globals, and so that one test in :mod:`!M` can't leave " +"behind crumbs that accidentally allow another test to work. This means " +"examples can freely use any names defined at top-level in :mod:`!M`, and " +"names defined earlier in the docstring being run. Examples cannot see names " +"defined in other docstrings." msgstr "" -msgid "You can force use of your own dict as the execution context by passing ``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." +#: ../../library/doctest.rst:461 +msgid "" +"You can force use of your own dict as the execution context by passing " +"``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" +#: ../../library/doctest.rst:468 msgid "What About Exceptions?" msgstr "" -msgid "No problem, provided that the traceback is the only output produced by the example: just paste in the traceback. [#]_ Since tracebacks contain details that are likely to change rapidly (for example, exact file paths and line numbers), this is one case where doctest works hard to be flexible in what it accepts." +#: ../../library/doctest.rst:470 +msgid "" +"No problem, provided that the traceback is the only output produced by the " +"example: just paste in the traceback. [#]_ Since tracebacks contain details " +"that are likely to change rapidly (for example, exact file paths and line " +"numbers), this is one case where doctest works hard to be flexible in what " +"it accepts." msgstr "" +#: ../../library/doctest.rst:476 msgid "Simple example::" msgstr "" +#: ../../library/doctest.rst:478 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" @@ -425,23 +656,41 @@ msgid "" "ValueError: list.remove(x): x not in list" msgstr "" -msgid "That doctest succeeds if :exc:`ValueError` is raised, with the ``list.remove(x): x not in list`` detail as shown." +#: ../../library/doctest.rst:483 +msgid "" +"That doctest succeeds if :exc:`ValueError` is raised, with the " +"``list.remove(x): x not in list`` detail as shown." msgstr "" -msgid "The expected output for an exception must start with a traceback header, which may be either of the following two lines, indented the same as the first line of the example::" +#: ../../library/doctest.rst:486 +msgid "" +"The expected output for an exception must start with a traceback header, " +"which may be either of the following two lines, indented the same as the " +"first line of the example::" msgstr "" +#: ../../library/doctest.rst:490 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" msgstr "" -msgid "The traceback header is followed by an optional traceback stack, whose contents are ignored by doctest. The traceback stack is typically omitted, or copied verbatim from an interactive session." +#: ../../library/doctest.rst:493 +msgid "" +"The traceback header is followed by an optional traceback stack, whose " +"contents are ignored by doctest. The traceback stack is typically omitted, " +"or copied verbatim from an interactive session." msgstr "" -msgid "The traceback stack is followed by the most interesting part: the line(s) containing the exception type and detail. This is usually the last line of a traceback, but can extend across multiple lines if the exception has a multi-line detail::" +#: ../../library/doctest.rst:497 +msgid "" +"The traceback stack is followed by the most interesting part: the line(s) " +"containing the exception type and detail. This is usually the last line of " +"a traceback, but can extend across multiple lines if the exception has a " +"multi-line detail::" msgstr "" +#: ../../library/doctest.rst:502 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -451,12 +700,20 @@ msgid "" "detail" msgstr "" -msgid "The last three lines (starting with :exc:`ValueError`) are compared against the exception's type and detail, and the rest are ignored." +#: ../../library/doctest.rst:509 +msgid "" +"The last three lines (starting with :exc:`ValueError`) are compared against " +"the exception's type and detail, and the rest are ignored." msgstr "" -msgid "Best practice is to omit the traceback stack, unless it adds significant documentation value to the example. So the last example is probably better as::" +#: ../../library/doctest.rst:512 +msgid "" +"Best practice is to omit the traceback stack, unless it adds significant " +"documentation value to the example. So the last example is probably better " +"as::" msgstr "" +#: ../../library/doctest.rst:515 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -466,27 +723,61 @@ msgid "" "detail" msgstr "" -msgid "Note that tracebacks are treated very specially. In particular, in the rewritten example, the use of ``...`` is independent of doctest's :const:`ELLIPSIS` option. The ellipsis in that example could be left out, or could just as well be three (or three hundred) commas or digits, or an indented transcript of a Monty Python skit." +#: ../../library/doctest.rst:522 +msgid "" +"Note that tracebacks are treated very specially. In particular, in the " +"rewritten example, the use of ``...`` is independent of " +"doctest's :const:`ELLIPSIS` option. The ellipsis in that example could be " +"left out, or could just as well be three (or three hundred) commas or " +"digits, or an indented transcript of a Monty Python skit." msgstr "" +#: ../../library/doctest.rst:528 msgid "Some details you should read once, but won't need to remember:" msgstr "" -msgid "Doctest can't guess whether your expected output came from an exception traceback or from ordinary printing. So, e.g., an example that expects ``ValueError: 42 is prime`` will pass whether :exc:`ValueError` is actually raised or if the example merely prints that traceback text. In practice, ordinary output rarely begins with a traceback header line, so this doesn't create real problems." +#: ../../library/doctest.rst:530 +msgid "" +"Doctest can't guess whether your expected output came from an exception " +"traceback or from ordinary printing. So, e.g., an example that expects " +"``ValueError: 42 is prime`` will pass whether :exc:`ValueError` is actually " +"raised or if the example merely prints that traceback text. In practice, " +"ordinary output rarely begins with a traceback header line, so this doesn't " +"create real problems." msgstr "" -msgid "Each line of the traceback stack (if present) must be indented further than the first line of the example, *or* start with a non-alphanumeric character. The first line following the traceback header indented the same and starting with an alphanumeric is taken to be the start of the exception detail. Of course this does the right thing for genuine tracebacks." +#: ../../library/doctest.rst:537 +msgid "" +"Each line of the traceback stack (if present) must be indented further than " +"the first line of the example, *or* start with a non-alphanumeric character. " +"The first line following the traceback header indented the same and starting " +"with an alphanumeric is taken to be the start of the exception detail. Of " +"course this does the right thing for genuine tracebacks." msgstr "" -msgid "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, everything following the leftmost colon and any module information in the exception name is ignored." +#: ../../library/doctest.rst:543 +msgid "" +"When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " +"everything following the leftmost colon and any module information in the " +"exception name is ignored." msgstr "" -msgid "The interactive shell omits the traceback header line for some :exc:`SyntaxError`\\ s. But doctest uses the traceback header line to distinguish exceptions from non-exceptions. So in the rare case where you need to test a :exc:`!SyntaxError` that omits the traceback header, you will need to manually add the traceback header line to your test example." +#: ../../library/doctest.rst:547 +msgid "" +"The interactive shell omits the traceback header line for " +"some :exc:`SyntaxError`\\ s. But doctest uses the traceback header line to " +"distinguish exceptions from non-exceptions. So in the rare case where you " +"need to test a :exc:`!SyntaxError` that omits the traceback header, you will " +"need to manually add the traceback header line to your test example." msgstr "" -msgid "For some exceptions, Python displays the position of the error using ``^`` markers and tildes::" +#: ../../library/doctest.rst:555 +msgid "" +"For some exceptions, Python displays the position of the error using ``^`` " +"markers and tildes::" msgstr "" +#: ../../library/doctest.rst:558 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -495,9 +786,15 @@ msgid "" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" msgstr "" -msgid "Since the lines showing the position of the error come before the exception type and detail, they are not checked by doctest. For example, the following test would pass, even though it puts the ``^`` marker in the wrong location::" +#: ../../library/doctest.rst:564 +msgid "" +"Since the lines showing the position of the error come before the exception " +"type and detail, they are not checked by doctest. For example, the " +"following test would pass, even though it puts the ``^`` marker in the wrong " +"location::" msgstr "" +#: ../../library/doctest.rst:568 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -506,33 +803,85 @@ msgid "" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" msgstr "" +#: ../../library/doctest.rst:579 msgid "Option Flags" msgstr "" -msgid "A number of option flags control various aspects of doctest's behavior. Symbolic names for the flags are supplied as module constants, which can be :ref:`bitwise ORed ` together and passed to various functions. The names can also be used in :ref:`doctest directives `, and may be passed to the doctest command line interface via the ``-o`` option." +#: ../../library/doctest.rst:581 +msgid "" +"A number of option flags control various aspects of doctest's behavior. " +"Symbolic names for the flags are supplied as module constants, which can " +"be :ref:`bitwise ORed ` together and passed to various functions. " +"The names can also be used in :ref:`doctest directives `, and may be passed to the doctest command line interface via " +"the ``-o`` option." msgstr "" -msgid "The first group of options define test semantics, controlling aspects of how doctest decides whether actual output matches an example's expected output:" +#: ../../library/doctest.rst:587 +msgid "" +"The first group of options define test semantics, controlling aspects of how " +"doctest decides whether actual output matches an example's expected output:" msgstr "" -msgid "By default, if an expected output block contains just ``1``, an actual output block containing just ``1`` or just ``True`` is considered to be a match, and similarly for ``0`` versus ``False``. When :const:`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is allowed. The default behavior caters to that Python changed the return type of many functions from integer to boolean; doctests expecting \"little integer\" output still work in these cases. This option will probably go away, but not for several years." +#: ../../library/doctest.rst:593 +msgid "" +"By default, if an expected output block contains just ``1``, an actual " +"output block containing just ``1`` or just ``True`` is considered to be a " +"match, and similarly for ``0`` versus ``False``. " +"When :const:`DONT_ACCEPT_TRUE_FOR_1` is specified, neither substitution is " +"allowed. The default behavior caters to that Python changed the return type " +"of many functions from integer to boolean; doctests expecting \"little " +"integer\" output still work in these cases. This option will probably go " +"away, but not for several years." msgstr "" -msgid "By default, if an expected output block contains a line containing only the string ````, then that line will match a blank line in the actual output. Because a genuinely blank line delimits the expected output, this is the only way to communicate that a blank line is expected. When :const:`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." +#: ../../library/doctest.rst:605 +msgid "" +"By default, if an expected output block contains a line containing only the " +"string ````, then that line will match a blank line in the actual " +"output. Because a genuinely blank line delimits the expected output, this " +"is the only way to communicate that a blank line is expected. " +"When :const:`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not " +"allowed." msgstr "" -msgid "When specified, all sequences of whitespace (blanks and newlines) are treated as equal. Any sequence of whitespace within the expected output will match any sequence of whitespace within the actual output. By default, whitespace must match exactly. :const:`NORMALIZE_WHITESPACE` is especially useful when a line of expected output is very long, and you want to wrap it across multiple lines in your source." +#: ../../library/doctest.rst:614 +msgid "" +"When specified, all sequences of whitespace (blanks and newlines) are " +"treated as equal. Any sequence of whitespace within the expected output " +"will match any sequence of whitespace within the actual output. By default, " +"whitespace must match exactly. :const:`NORMALIZE_WHITESPACE` is especially " +"useful when a line of expected output is very long, and you want to wrap it " +"across multiple lines in your source." msgstr "" -msgid "When specified, an ellipsis marker (``...``) in the expected output can match any substring in the actual output. This includes substrings that span line boundaries, and empty substrings, so it's best to keep usage of this simple. Complicated uses can lead to the same kinds of \"oops, it matched too much!\" surprises that ``.*`` is prone to in regular expressions." +#: ../../library/doctest.rst:625 +msgid "" +"When specified, an ellipsis marker (``...``) in the expected output can " +"match any substring in the actual output. This includes substrings that " +"span line boundaries, and empty substrings, so it's best to keep usage of " +"this simple. Complicated uses can lead to the same kinds of \"oops, it " +"matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -msgid "When specified, doctests expecting exceptions pass so long as an exception of the expected type is raised, even if the details (message and fully qualified exception name) don't match." +#: ../../library/doctest.rst:634 +msgid "" +"When specified, doctests expecting exceptions pass so long as an exception " +"of the expected type is raised, even if the details (message and fully " +"qualified exception name) don't match." msgstr "" -msgid "For example, an example expecting ``ValueError: 42`` will pass if the actual exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:`TypeError` is raised instead. It will also ignore any fully qualified name included before the exception class, which can vary between implementations and versions of Python and the code/libraries in use. Hence, all three of these variations will work with the flag specified:" +#: ../../library/doctest.rst:638 +msgid "" +"For example, an example expecting ``ValueError: 42`` will pass if the actual " +"exception raised is ``ValueError: 3*14``, but will fail if, say, " +"a :exc:`TypeError` is raised instead. It will also ignore any fully " +"qualified name included before the exception class, which can vary between " +"implementations and versions of Python and the code/libraries in use. Hence, " +"all three of these variations will work with the flag specified:" msgstr "" +#: ../../library/doctest.rst:646 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -547,143 +896,253 @@ msgid "" "__main__.Exception: message" msgstr "" -msgid "Note that :const:`ELLIPSIS` can also be used to ignore the details of the exception message, but such a test may still fail based on whether the module name is present or matches exactly." +#: ../../library/doctest.rst:660 +msgid "" +"Note that :const:`ELLIPSIS` can also be used to ignore the details of the " +"exception message, but such a test may still fail based on whether the " +"module name is present or matches exactly." msgstr "" -msgid ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating to the module containing the exception under test." +#: ../../library/doctest.rst:664 +msgid "" +":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " +"to the module containing the exception under test." msgstr "" -msgid "When specified, do not run the example at all. This can be useful in contexts where doctest examples serve as both documentation and test cases, and an example should be included for documentation purposes, but should not be checked. E.g., the example's output might be random; or the example might depend on resources which would be unavailable to the test driver." +#: ../../library/doctest.rst:671 +msgid "" +"When specified, do not run the example at all. This can be useful in " +"contexts where doctest examples serve as both documentation and test cases, " +"and an example should be included for documentation purposes, but should not " +"be checked. E.g., the example's output might be random; or the example " +"might depend on resources which would be unavailable to the test driver." msgstr "" -msgid "The SKIP flag can also be used for temporarily \"commenting out\" examples." +#: ../../library/doctest.rst:677 +msgid "" +"The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" +#: ../../library/doctest.rst:682 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" +#: ../../library/doctest.rst:684 msgid "The second group of options controls how test failures are reported:" msgstr "" -msgid "When specified, failures that involve multi-line expected and actual outputs are displayed using a unified diff." +#: ../../library/doctest.rst:689 +msgid "" +"When specified, failures that involve multi-line expected and actual outputs " +"are displayed using a unified diff." msgstr "" -msgid "When specified, failures that involve multi-line expected and actual outputs will be displayed using a context diff." +#: ../../library/doctest.rst:695 +msgid "" +"When specified, failures that involve multi-line expected and actual outputs " +"will be displayed using a context diff." msgstr "" -msgid "When specified, differences are computed by ``difflib.Differ``, using the same algorithm as the popular :file:`ndiff.py` utility. This is the only method that marks differences within lines as well as across lines. For example, if a line of expected output contains digit ``1`` where actual output contains letter ``l``, a line is inserted with a caret marking the mismatching column positions." +#: ../../library/doctest.rst:701 +msgid "" +"When specified, differences are computed by ``difflib.Differ``, using the " +"same algorithm as the popular :file:`ndiff.py` utility. This is the only " +"method that marks differences within lines as well as across lines. For " +"example, if a line of expected output contains digit ``1`` where actual " +"output contains letter ``l``, a line is inserted with a caret marking the " +"mismatching column positions." msgstr "" -msgid "When specified, display the first failing example in each doctest, but suppress output for all remaining examples. This will prevent doctest from reporting correct examples that break because of earlier failures; but it might also hide incorrect examples that fail independently of the first failure. When :const:`REPORT_ONLY_FIRST_FAILURE` is specified, the remaining examples are still run, and still count towards the total number of failures reported; only the output is suppressed." +#: ../../library/doctest.rst:710 +msgid "" +"When specified, display the first failing example in each doctest, but " +"suppress output for all remaining examples. This will prevent doctest from " +"reporting correct examples that break because of earlier failures; but it " +"might also hide incorrect examples that fail independently of the first " +"failure. When :const:`REPORT_ONLY_FIRST_FAILURE` is specified, the " +"remaining examples are still run, and still count towards the total number " +"of failures reported; only the output is suppressed." msgstr "" -msgid "When specified, exit after the first failing example and don't attempt to run the remaining examples. Thus, the number of failures reported will be at most 1. This flag may be useful during debugging, since examples after the first failure won't even produce debugging output." +#: ../../library/doctest.rst:721 +msgid "" +"When specified, exit after the first failing example and don't attempt to " +"run the remaining examples. Thus, the number of failures reported will be at " +"most 1. This flag may be useful during debugging, since examples after the " +"first failure won't even produce debugging output." msgstr "" +#: ../../library/doctest.rst:729 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -msgid "There is also a way to register new option flag names, though this isn't useful unless you intend to extend :mod:`!doctest` internals via subclassing:" +#: ../../library/doctest.rst:732 +msgid "" +"There is also a way to register new option flag names, though this isn't " +"useful unless you intend to extend :mod:`!doctest` internals via subclassing:" msgstr "" -msgid "Create a new option flag with a given name, and return the new flag's integer value. :func:`register_optionflag` can be used when subclassing :class:`OutputChecker` or :class:`DocTestRunner` to create new options that are supported by your subclasses. :func:`register_optionflag` should always be called using the following idiom::" +#: ../../library/doctest.rst:738 +msgid "" +"Create a new option flag with a given name, and return the new flag's " +"integer value. :func:`register_optionflag` can be used when " +"subclassing :class:`OutputChecker` or :class:`DocTestRunner` to create new " +"options that are supported by your subclasses. :func:`register_optionflag` " +"should always be called using the following idiom::" msgstr "" +#: ../../library/doctest.rst:744 msgid "MY_FLAG = register_optionflag('MY_FLAG')" msgstr "" +#: ../../library/doctest.rst:754 msgid "Directives" msgstr "" -msgid "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python comments following an example's source code:" +#: ../../library/doctest.rst:756 +msgid "" +"Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " +"comments following an example's source code:" msgstr "" -msgid "Whitespace is not allowed between the ``+`` or ``-`` and the directive option name. The directive option name can be any of the option flag names explained above." +#: ../../library/doctest.rst:767 +msgid "" +"Whitespace is not allowed between the ``+`` or ``-`` and the directive " +"option name. The directive option name can be any of the option flag names " +"explained above." msgstr "" -msgid "An example's doctest directives modify doctest's behavior for that single example. Use ``+`` to enable the named behavior, or ``-`` to disable it." +#: ../../library/doctest.rst:771 +msgid "" +"An example's doctest directives modify doctest's behavior for that single " +"example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" +#: ../../library/doctest.rst:774 msgid "For example, this test passes:" msgstr "" +#: ../../library/doctest.rst:776 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" "10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" msgstr "" -msgid "Without the directive it would fail, both because the actual output doesn't have two blanks before the single-digit list elements, and because the actual output is on a single line. This test also passes, and also requires a directive to do so:" +#: ../../library/doctest.rst:783 +msgid "" +"Without the directive it would fail, both because the actual output doesn't " +"have two blanks before the single-digit list elements, and because the " +"actual output is on a single line. This test also passes, and also requires " +"a directive to do so:" msgstr "" +#: ../../library/doctest.rst:788 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" msgstr "" -msgid "Multiple directives can be used on a single physical line, separated by commas:" +#: ../../library/doctest.rst:794 +msgid "" +"Multiple directives can be used on a single physical line, separated by " +"commas:" msgstr "" +#: ../../library/doctest.rst:797 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" msgstr "" -msgid "If multiple directive comments are used for a single example, then they are combined:" +#: ../../library/doctest.rst:803 +msgid "" +"If multiple directive comments are used for a single example, then they are " +"combined:" msgstr "" +#: ../../library/doctest.rst:806 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" msgstr "" -msgid "As the previous example shows, you can add ``...`` lines to your example containing only directives. This can be useful when an example is too long for a directive to comfortably fit on the same line:" +#: ../../library/doctest.rst:813 +msgid "" +"As the previous example shows, you can add ``...`` lines to your example " +"containing only directives. This can be useful when an example is too long " +"for a directive to comfortably fit on the same line:" msgstr "" +#: ../../library/doctest.rst:817 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" msgstr "" -msgid "Note that since all options are disabled by default, and directives apply only to the example they appear in, enabling options (via ``+`` in a directive) is usually the only meaningful choice. However, option flags can also be passed to functions that run doctests, establishing different defaults. In such cases, disabling an option via ``-`` in a directive can be useful." +#: ../../library/doctest.rst:824 +msgid "" +"Note that since all options are disabled by default, and directives apply " +"only to the example they appear in, enabling options (via ``+`` in a " +"directive) is usually the only meaningful choice. However, option flags can " +"also be passed to functions that run doctests, establishing different " +"defaults. In such cases, disabling an option via ``-`` in a directive can " +"be useful." msgstr "" +#: ../../library/doctest.rst:834 msgid "Warnings" msgstr "" -msgid ":mod:`!doctest` is serious about requiring exact matches in expected output. If even a single character doesn't match, the test fails. This will probably surprise you a few times, as you learn exactly what Python does and doesn't guarantee about output. For example, when printing a set, Python doesn't guarantee that the element is printed in any particular order, so a test like ::" +#: ../../library/doctest.rst:836 +msgid "" +":mod:`!doctest` is serious about requiring exact matches in expected " +"output. If even a single character doesn't match, the test fails. This " +"will probably surprise you a few times, as you learn exactly what Python " +"does and doesn't guarantee about output. For example, when printing a set, " +"Python doesn't guarantee that the element is printed in any particular " +"order, so a test like ::" msgstr "" +#: ../../library/doctest.rst:842 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" msgstr "" +#: ../../library/doctest.rst:845 msgid "is vulnerable! One workaround is to do ::" msgstr "" +#: ../../library/doctest.rst:847 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" msgstr "" +#: ../../library/doctest.rst:850 msgid "instead. Another is to do ::" msgstr "" +#: ../../library/doctest.rst:852 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" "['eggs', 'spam']" msgstr "" +#: ../../library/doctest.rst:856 msgid "There are others, but you get the idea." msgstr "" +#: ../../library/doctest.rst:858 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" +#: ../../library/doctest.rst:860 msgid "" ">>> id(1.0) # certain to fail some of the time\n" "7948648\n" @@ -692,17 +1151,25 @@ msgid "" "" msgstr "" -msgid "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" +#: ../../library/doctest.rst:868 +msgid "" +"The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" +#: ../../library/doctest.rst:870 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" msgstr "" -msgid "Floating-point numbers are also subject to small output variations across platforms, because Python defers to the platform C library for some floating-point calculations, and C libraries vary widely in quality here. ::" +#: ../../library/doctest.rst:876 +msgid "" +"Floating-point numbers are also subject to small output variations across " +"platforms, because Python defers to the platform C library for some floating-" +"point calculations, and C libraries vary widely in quality here. ::" msgstr "" +#: ../../library/doctest.rst:880 msgid "" ">>> 1000**0.1 # risky\n" "1.9952623149688797\n" @@ -712,116 +1179,256 @@ msgid "" "1.9953" msgstr "" -msgid "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often contrive doctest examples to produce numbers of that form::" +#: ../../library/doctest.rst:887 +msgid "" +"Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " +"contrive doctest examples to produce numbers of that form::" msgstr "" +#: ../../library/doctest.rst:890 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" -msgid "Simple fractions are also easier for people to understand, and that makes for better documentation." +#: ../../library/doctest.rst:893 +msgid "" +"Simple fractions are also easier for people to understand, and that makes " +"for better documentation." msgstr "" +#: ../../library/doctest.rst:900 msgid "Basic API" msgstr "" -msgid "The functions :func:`testmod` and :func:`testfile` provide a simple interface to doctest that should be sufficient for most basic uses. For a less formal introduction to these two functions, see sections :ref:`doctest-simple-testmod` and :ref:`doctest-simple-testfile`." -msgstr "" - -msgid "All arguments except *filename* are optional, and should be specified in keyword form." +#: ../../library/doctest.rst:902 +msgid "" +"The functions :func:`testmod` and :func:`testfile` provide a simple " +"interface to doctest that should be sufficient for most basic uses. For a " +"less formal introduction to these two functions, see sections :ref:`doctest-" +"simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -msgid "Test examples in the file named *filename*. Return ``(failure_count, test_count)``." +#: ../../library/doctest.rst:910 +msgid "" +"All arguments except *filename* are optional, and should be specified in " +"keyword form." msgstr "" -msgid "Optional argument *module_relative* specifies how the filename should be interpreted:" +#: ../../library/doctest.rst:913 +msgid "" +"Test examples in the file named *filename*. Return ``(failure_count, " +"test_count)``." msgstr "" -msgid "If *module_relative* is ``True`` (the default), then *filename* specifies an OS-independent module-relative path. By default, this path is relative to the calling module's directory; but if the *package* argument is specified, then it is relative to that package. To ensure OS-independence, *filename* should use ``/`` characters to separate path segments, and may not be an absolute path (i.e., it may not begin with ``/``)." +#: ../../library/doctest.rst:916 +msgid "" +"Optional argument *module_relative* specifies how the filename should be " +"interpreted:" msgstr "" -msgid "If *module_relative* is ``False``, then *filename* specifies an OS-specific path. The path may be absolute or relative; relative paths are resolved with respect to the current working directory." +#: ../../library/doctest.rst:919 +msgid "" +"If *module_relative* is ``True`` (the default), then *filename* specifies an " +"OS-independent module-relative path. By default, this path is relative to " +"the calling module's directory; but if the *package* argument is specified, " +"then it is relative to that package. To ensure OS-independence, *filename* " +"should use ``/`` characters to separate path segments, and may not be an " +"absolute path (i.e., it may not begin with ``/``)." msgstr "" -msgid "Optional argument *name* gives the name of the test; by default, or if ``None``, ``os.path.basename(filename)`` is used." +#: ../../library/doctest.rst:926 +msgid "" +"If *module_relative* is ``False``, then *filename* specifies an OS-specific " +"path. The path may be absolute or relative; relative paths are resolved " +"with respect to the current working directory." msgstr "" -msgid "Optional argument *package* is a Python package or the name of a Python package whose directory should be used as the base directory for a module-relative filename. If no package is specified, then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``." +#: ../../library/doctest.rst:930 +msgid "" +"Optional argument *name* gives the name of the test; by default, or if " +"``None``, ``os.path.basename(filename)`` is used." msgstr "" -msgid "Optional argument *globs* gives a dict to be used as the globals when executing examples. A new shallow copy of this dict is created for the doctest, so its examples start with a clean slate. By default, or if ``None``, a new empty dict is used." +#: ../../library/doctest.rst:933 +msgid "" +"Optional argument *package* is a Python package or the name of a Python " +"package whose directory should be used as the base directory for a module-" +"relative filename. If no package is specified, then the calling module's " +"directory is used as the base directory for module-relative filenames. It " +"is an error to specify *package* if *module_relative* is ``False``." msgstr "" -msgid "Optional argument *extraglobs* gives a dict merged into the globals used to execute examples. This works like :meth:`dict.update`: if *globs* and *extraglobs* have a common key, the associated value in *extraglobs* appears in the combined dict. By default, or if ``None``, no extra globals are used. This is an advanced feature that allows parameterization of doctests. For example, a doctest can be written for a base class, using a generic name for the class, then reused to test any number of subclasses by passing an *extraglobs* dict mapping the generic name to the subclass to be tested." +#: ../../library/doctest.rst:939 +msgid "" +"Optional argument *globs* gives a dict to be used as the globals when " +"executing examples. A new shallow copy of this dict is created for the " +"doctest, so its examples start with a clean slate. By default, or if " +"``None``, a new empty dict is used." msgstr "" -msgid "Optional argument *verbose* prints lots of stuff if true, and prints only failures if false; by default, or if ``None``, it's true if and only if ``'-v'`` is in :data:`sys.argv`." +#: ../../library/doctest.rst:944 +msgid "" +"Optional argument *extraglobs* gives a dict merged into the globals used to " +"execute examples. This works like :meth:`dict.update`: if *globs* and " +"*extraglobs* have a common key, the associated value in *extraglobs* appears " +"in the combined dict. By default, or if ``None``, no extra globals are " +"used. This is an advanced feature that allows parameterization of " +"doctests. For example, a doctest can be written for a base class, using a " +"generic name for the class, then reused to test any number of subclasses by " +"passing an *extraglobs* dict mapping the generic name to the subclass to be " +"tested." +msgstr "" + +#: ../../library/doctest.rst:953 +msgid "" +"Optional argument *verbose* prints lots of stuff if true, and prints only " +"failures if false; by default, or if ``None``, it's true if and only if ``'-" +"v'`` is in :data:`sys.argv`." msgstr "" -msgid "Optional argument *report* prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else the summary is very brief (in fact, empty if all tests passed)." +#: ../../library/doctest.rst:957 +msgid "" +"Optional argument *report* prints a summary at the end when true, else " +"prints nothing at the end. In verbose mode, the summary is detailed, else " +"the summary is very brief (in fact, empty if all tests passed)." msgstr "" -msgid "Optional argument *optionflags* (default value ``0``) takes the :ref:`bitwise OR ` of option flags. See section :ref:`doctest-options`." +#: ../../library/doctest.rst:961 +msgid "" +"Optional argument *optionflags* (default value ``0``) takes " +"the :ref:`bitwise OR ` of option flags. See section :ref:`doctest-" +"options`." msgstr "" -msgid "Optional argument *raise_on_error* defaults to false. If true, an exception is raised upon the first failure or unexpected exception in an example. This allows failures to be post-mortem debugged. Default behavior is to continue running examples." +#: ../../library/doctest.rst:965 +msgid "" +"Optional argument *raise_on_error* defaults to false. If true, an exception " +"is raised upon the first failure or unexpected exception in an example. " +"This allows failures to be post-mortem debugged. Default behavior is to " +"continue running examples." msgstr "" -msgid "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) that should be used to extract tests from the files. It defaults to a normal parser (i.e., ``DocTestParser()``)." +#: ../../library/doctest.rst:970 ../../library/doctest.rst:1113 +msgid "" +"Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " +"that should be used to extract tests from the files. It defaults to a " +"normal parser (i.e., ``DocTestParser()``)." msgstr "" -msgid "Optional argument *encoding* specifies an encoding that should be used to convert the file to unicode." +#: ../../library/doctest.rst:974 ../../library/doctest.rst:1117 +msgid "" +"Optional argument *encoding* specifies an encoding that should be used to " +"convert the file to unicode." msgstr "" -msgid "All arguments are optional, and all except for *m* should be specified in keyword form." +#: ../../library/doctest.rst:980 +msgid "" +"All arguments are optional, and all except for *m* should be specified in " +"keyword form." msgstr "" -msgid "Test examples in docstrings in functions and classes reachable from module *m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), starting with ``m.__doc__``." +#: ../../library/doctest.rst:983 +msgid "" +"Test examples in docstrings in functions and classes reachable from module " +"*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " +"starting with ``m.__doc__``." msgstr "" -msgid "Also test examples reachable from dict ``m.__test__``, if it exists. ``m.__test__`` maps names (strings) to functions, classes and strings; function and class docstrings are searched for examples; strings are searched directly, as if they were docstrings." +#: ../../library/doctest.rst:987 +msgid "" +"Also test examples reachable from dict ``m.__test__``, if it exists. " +"``m.__test__`` maps names (strings) to functions, classes and strings; " +"function and class docstrings are searched for examples; strings are " +"searched directly, as if they were docstrings." msgstr "" -msgid "Only docstrings attached to objects belonging to module *m* are searched." +#: ../../library/doctest.rst:992 +msgid "" +"Only docstrings attached to objects belonging to module *m* are searched." msgstr "" +#: ../../library/doctest.rst:994 msgid "Return ``(failure_count, test_count)``." msgstr "" -msgid "Optional argument *name* gives the name of the module; by default, or if ``None``, ``m.__name__`` is used." +#: ../../library/doctest.rst:996 +msgid "" +"Optional argument *name* gives the name of the module; by default, or if " +"``None``, ``m.__name__`` is used." msgstr "" -msgid "Optional argument *exclude_empty* defaults to false. If true, objects for which no doctests are found are excluded from consideration. The default is a backward compatibility hack, so that code still using :meth:`doctest.master.summarize ` in conjunction with :func:`testmod` continues to get output for objects with no tests. The *exclude_empty* argument to the newer :class:`DocTestFinder` constructor defaults to true." +#: ../../library/doctest.rst:999 +msgid "" +"Optional argument *exclude_empty* defaults to false. If true, objects for " +"which no doctests are found are excluded from consideration. The default is " +"a backward compatibility hack, so that code still " +"using :meth:`doctest.master.summarize ` in " +"conjunction with :func:`testmod` continues to get output for objects with no " +"tests. The *exclude_empty* argument to the newer :class:`DocTestFinder` " +"constructor defaults to true." msgstr "" -msgid "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, *raise_on_error*, and *globs* are the same as for function :func:`testfile` above, except that *globs* defaults to ``m.__dict__``." +#: ../../library/doctest.rst:1007 +msgid "" +"Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " +"*raise_on_error*, and *globs* are the same as for function :func:`testfile` " +"above, except that *globs* defaults to ``m.__dict__``." msgstr "" -msgid "Test examples associated with object *f*; for example, *f* may be a string, a module, a function, or a class object." +#: ../../library/doctest.rst:1014 +msgid "" +"Test examples associated with object *f*; for example, *f* may be a string, " +"a module, a function, or a class object." msgstr "" -msgid "A shallow copy of dictionary argument *globs* is used for the execution context." +#: ../../library/doctest.rst:1017 +msgid "" +"A shallow copy of dictionary argument *globs* is used for the execution " +"context." msgstr "" -msgid "Optional argument *name* is used in failure messages, and defaults to ``\"NoName\"``." +#: ../../library/doctest.rst:1019 +msgid "" +"Optional argument *name* is used in failure messages, and defaults to " +"``\"NoName\"``." msgstr "" -msgid "If optional argument *verbose* is true, output is generated even if there are no failures. By default, output is generated only in case of an example failure." +#: ../../library/doctest.rst:1022 +msgid "" +"If optional argument *verbose* is true, output is generated even if there " +"are no failures. By default, output is generated only in case of an example " +"failure." msgstr "" -msgid "Optional argument *compileflags* gives the set of flags that should be used by the Python compiler when running the examples. By default, or if ``None``, flags are deduced corresponding to the set of future features found in *globs*." +#: ../../library/doctest.rst:1025 +msgid "" +"Optional argument *compileflags* gives the set of flags that should be used " +"by the Python compiler when running the examples. By default, or if " +"``None``, flags are deduced corresponding to the set of future features " +"found in *globs*." msgstr "" -msgid "Optional argument *optionflags* works as for function :func:`testfile` above." +#: ../../library/doctest.rst:1029 +msgid "" +"Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" +#: ../../library/doctest.rst:1035 msgid "Unittest API" msgstr "" -msgid "As your collection of doctest'ed modules grows, you'll want a way to run all their doctests systematically. :mod:`!doctest` provides two functions that can be used to create :mod:`unittest` test suites from modules and text files containing doctests. To integrate with :mod:`unittest` test discovery, include a :ref:`load_tests ` function in your test module::" +#: ../../library/doctest.rst:1037 +msgid "" +"As your collection of doctest'ed modules grows, you'll want a way to run all " +"their doctests systematically. :mod:`!doctest` provides two functions that " +"can be used to create :mod:`unittest` test suites from modules and text " +"files containing doctests. To integrate with :mod:`unittest` test " +"discovery, include a :ref:`load_tests ` function in " +"your test module::" msgstr "" +#: ../../library/doctest.rst:1043 msgid "" "import unittest\n" "import doctest\n" @@ -832,132 +1439,302 @@ msgid "" " return tests" msgstr "" -msgid "There are two main functions for creating :class:`unittest.TestSuite` instances from text files and modules with doctests:" +#: ../../library/doctest.rst:1051 +msgid "" +"There are two main functions for creating :class:`unittest.TestSuite` " +"instances from text files and modules with doctests:" msgstr "" -msgid "Convert doctest tests from one or more text files to a :class:`unittest.TestSuite`." +#: ../../library/doctest.rst:1057 +msgid "" +"Convert doctest tests from one or more text files to " +"a :class:`unittest.TestSuite`." msgstr "" -msgid "The returned :class:`unittest.TestSuite` is to be run by the unittest framework and runs the interactive examples in each file. If an example in any file fails, then the synthesized unit test fails, and a :exc:`~unittest.TestCase.failureException` exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. If all the examples in a file are skipped, then the synthesized unit test is also marked as skipped." +#: ../../library/doctest.rst:1060 +msgid "" +"The returned :class:`unittest.TestSuite` is to be run by the unittest " +"framework and runs the interactive examples in each file. If an example in " +"any file fails, then the synthesized unit test fails, and " +"a :exc:`~unittest.TestCase.failureException` exception is raised showing the " +"name of the file containing the test and a (sometimes approximate) line " +"number. If all the examples in a file are skipped, then the synthesized " +"unit test is also marked as skipped." msgstr "" +#: ../../library/doctest.rst:1067 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" +#: ../../library/doctest.rst:1069 msgid "Options may be provided as keyword arguments:" msgstr "" -msgid "Optional argument *module_relative* specifies how the filenames in *paths* should be interpreted:" +#: ../../library/doctest.rst:1071 +msgid "" +"Optional argument *module_relative* specifies how the filenames in *paths* " +"should be interpreted:" msgstr "" -msgid "If *module_relative* is ``True`` (the default), then each filename in *paths* specifies an OS-independent module-relative path. By default, this path is relative to the calling module's directory; but if the *package* argument is specified, then it is relative to that package. To ensure OS-independence, each filename should use ``/`` characters to separate path segments, and may not be an absolute path (i.e., it may not begin with ``/``)." +#: ../../library/doctest.rst:1074 +msgid "" +"If *module_relative* is ``True`` (the default), then each filename in " +"*paths* specifies an OS-independent module-relative path. By default, this " +"path is relative to the calling module's directory; but if the *package* " +"argument is specified, then it is relative to that package. To ensure OS-" +"independence, each filename should use ``/`` characters to separate path " +"segments, and may not be an absolute path (i.e., it may not begin with ``/" +"``)." msgstr "" -msgid "If *module_relative* is ``False``, then each filename in *paths* specifies an OS-specific path. The path may be absolute or relative; relative paths are resolved with respect to the current working directory." +#: ../../library/doctest.rst:1082 +msgid "" +"If *module_relative* is ``False``, then each filename in *paths* specifies " +"an OS-specific path. The path may be absolute or relative; relative paths " +"are resolved with respect to the current working directory." msgstr "" -msgid "Optional argument *package* is a Python package or the name of a Python package whose directory should be used as the base directory for module-relative filenames in *paths*. If no package is specified, then the calling module's directory is used as the base directory for module-relative filenames. It is an error to specify *package* if *module_relative* is ``False``." +#: ../../library/doctest.rst:1086 +msgid "" +"Optional argument *package* is a Python package or the name of a Python " +"package whose directory should be used as the base directory for module-" +"relative filenames in *paths*. If no package is specified, then the calling " +"module's directory is used as the base directory for module-relative " +"filenames. It is an error to specify *package* if *module_relative* is " +"``False``." msgstr "" -msgid "Optional argument *setUp* specifies a set-up function for the test suite. This is called before running the tests in each file. The *setUp* function will be passed a :class:`DocTest` object. The *setUp* function can access the test globals as the :attr:`~DocTest.globs` attribute of the test passed." +#: ../../library/doctest.rst:1093 +msgid "" +"Optional argument *setUp* specifies a set-up function for the test suite. " +"This is called before running the tests in each file. The *setUp* function " +"will be passed a :class:`DocTest` object. The *setUp* function can access " +"the test globals as the :attr:`~DocTest.globs` attribute of the test passed." msgstr "" -msgid "Optional argument *tearDown* specifies a tear-down function for the test suite. This is called after running the tests in each file. The *tearDown* function will be passed a :class:`DocTest` object. The *tearDown* function can access the test globals as the :attr:`~DocTest.globs` attribute of the test passed." +#: ../../library/doctest.rst:1098 +msgid "" +"Optional argument *tearDown* specifies a tear-down function for the test " +"suite. This is called after running the tests in each file. The *tearDown* " +"function will be passed a :class:`DocTest` object. The *tearDown* function " +"can access the test globals as the :attr:`~DocTest.globs` attribute of the " +"test passed." msgstr "" -msgid "Optional argument *globs* is a dictionary containing the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is a new empty dictionary." +#: ../../library/doctest.rst:1104 +msgid "" +"Optional argument *globs* is a dictionary containing the initial global " +"variables for the tests. A new copy of this dictionary is created for each " +"test. By default, *globs* is a new empty dictionary." msgstr "" -msgid "Optional argument *optionflags* specifies the default doctest options for the tests, created by or-ing together individual option flags. See section :ref:`doctest-options`. See function :func:`set_unittest_reportflags` below for a better way to set reporting options." +#: ../../library/doctest.rst:1108 +msgid "" +"Optional argument *optionflags* specifies the default doctest options for " +"the tests, created by or-ing together individual option flags. See " +"section :ref:`doctest-options`. See " +"function :func:`set_unittest_reportflags` below for a better way to set " +"reporting options." msgstr "" -msgid "The global ``__file__`` is added to the globals provided to doctests loaded from a text file using :func:`DocFileSuite`." +#: ../../library/doctest.rst:1120 +msgid "" +"The global ``__file__`` is added to the globals provided to doctests loaded " +"from a text file using :func:`DocFileSuite`." msgstr "" +#: ../../library/doctest.rst:1126 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -msgid "The returned :class:`unittest.TestSuite` is to be run by the unittest framework and runs each doctest in the module. Each docstring is run as a separate unit test. If any of the doctests fail, then the synthesized unit test fails, and a :exc:`unittest.TestCase.failureException` exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. If all the examples in a docstring are skipped, then the" +#: ../../library/doctest.rst:1128 +msgid "" +"The returned :class:`unittest.TestSuite` is to be run by the unittest " +"framework and runs each doctest in the module. Each docstring is run as a " +"separate unit test. If any of the doctests fail, then the synthesized unit " +"test fails, and a :exc:`unittest.TestCase.failureException` exception is " +"raised showing the name of the file containing the test and a (sometimes " +"approximate) line number. If all the examples in a docstring are skipped, " +"then the" msgstr "" -msgid "Optional argument *module* provides the module to be tested. It can be a module object or a (possibly dotted) module name. If not specified, the module calling this function is used." +#: ../../library/doctest.rst:1136 +msgid "" +"Optional argument *module* provides the module to be tested. It can be a " +"module object or a (possibly dotted) module name. If not specified, the " +"module calling this function is used." msgstr "" -msgid "Optional argument *globs* is a dictionary containing the initial global variables for the tests. A new copy of this dictionary is created for each test. By default, *globs* is the module's :attr:`~module.__dict__`." +#: ../../library/doctest.rst:1140 +msgid "" +"Optional argument *globs* is a dictionary containing the initial global " +"variables for the tests. A new copy of this dictionary is created for each " +"test. By default, *globs* is the module's :attr:`~module.__dict__`." msgstr "" -msgid "Optional argument *extraglobs* specifies an extra set of global variables, which is merged into *globs*. By default, no extra globals are used." +#: ../../library/doctest.rst:1144 +msgid "" +"Optional argument *extraglobs* specifies an extra set of global variables, " +"which is merged into *globs*. By default, no extra globals are used." msgstr "" -msgid "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a drop-in replacement) that is used to extract doctests from the module." +#: ../../library/doctest.rst:1147 +msgid "" +"Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " +"drop-in replacement) that is used to extract doctests from the module." msgstr "" -msgid "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as for function :func:`DocFileSuite` above, but they are called for each docstring." +#: ../../library/doctest.rst:1150 +msgid "" +"Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " +"for function :func:`DocFileSuite` above, but they are called for each " +"docstring." msgstr "" +#: ../../library/doctest.rst:1153 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -msgid ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if *module* contains no docstrings instead of raising :exc:`ValueError`." -msgstr "" - -msgid "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is a subclass of :class:`unittest.TestCase`. :class:`!DocTestCase` isn't documented here (it's an internal detail), but studying its code can answer questions about the exact details of :mod:`unittest` integration." +#: ../../library/doctest.rst:1155 +msgid "" +":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " +"*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -msgid "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a subclass of :class:`!DocTestCase`." +#: ../../library/doctest.rst:1159 +msgid "" +"Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " +"out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " +"a subclass of :class:`unittest.TestCase`. :class:`!DocTestCase` isn't " +"documented here (it's an internal detail), but studying its code can answer " +"questions about the exact details of :mod:`unittest` integration." msgstr "" -msgid "So both ways of creating a :class:`unittest.TestSuite` run instances of :class:`!DocTestCase`. This is important for a subtle reason: when you run :mod:`!doctest` functions yourself, you can control the :mod:`!doctest` options in use directly, by passing option flags to :mod:`!doctest` functions. However, if you're writing a :mod:`unittest` framework, :mod:`!unittest` ultimately controls when and how tests get run. The framework author typically wants to control :mod:`!doctest` reporting options (perhaps, e.g., specified by command line options), but there's no way to pass options through :mod:`!unittest` to :mod:`!doctest` test runners." +#: ../../library/doctest.rst:1165 +msgid "" +"Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " +"of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " +"subclass of :class:`!DocTestCase`." msgstr "" -msgid "For this reason, :mod:`!doctest` also supports a notion of :mod:`!doctest` reporting flags specific to :mod:`unittest` support, via this function:" +#: ../../library/doctest.rst:1169 +msgid "" +"So both ways of creating a :class:`unittest.TestSuite` run instances " +"of :class:`!DocTestCase`. This is important for a subtle reason: when you " +"run :mod:`!doctest` functions yourself, you can control the :mod:`!doctest` " +"options in use directly, by passing option flags to :mod:`!doctest` " +"functions. However, if you're writing a :mod:`unittest` framework, :mod:`!" +"unittest` ultimately controls when and how tests get run. The framework " +"author typically wants to control :mod:`!doctest` reporting options " +"(perhaps, e.g., specified by command line options), but there's no way to " +"pass options through :mod:`!unittest` to :mod:`!doctest` test runners." +msgstr "" + +#: ../../library/doctest.rst:1179 +msgid "" +"For this reason, :mod:`!doctest` also supports a notion of :mod:`!doctest` " +"reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" +#: ../../library/doctest.rst:1185 msgid "Set the :mod:`!doctest` reporting flags to use." msgstr "" -msgid "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See section :ref:`doctest-options`. Only \"reporting flags\" can be used." -msgstr "" - -msgid "This is a module-global setting, and affects all future doctests run by module :mod:`unittest`: the :meth:`!runTest` method of :class:`!DocTestCase` looks at the option flags specified for the test case when the :class:`!DocTestCase` instance was constructed. If no reporting flags were specified (which is the typical and expected case), :mod:`!doctest`'s :mod:`!unittest` reporting flags are :ref:`bitwise ORed ` into the option flags, and the option flags so augmented are passed to the :class:`DocTestRunner` instance created to run the doctest. If any reporting flags were specified when the :class:`!DocTestCase` instance was constructed, :mod:`!doctest`'s :mod:`!unittest` reporting flags are ignored." +#: ../../library/doctest.rst:1187 +msgid "" +"Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " +"section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -msgid "The value of the :mod:`unittest` reporting flags in effect before the function was called is returned by the function." +#: ../../library/doctest.rst:1190 +msgid "" +"This is a module-global setting, and affects all future doctests run by " +"module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" +"DocTestCase` looks at the option flags specified for the test case when " +"the :class:`!DocTestCase` instance was constructed. If no reporting flags " +"were specified (which is the typical and expected case), :mod:`!" +"doctest`'s :mod:`!unittest` reporting flags are :ref:`bitwise ORed " +"` into the option flags, and the option flags so augmented are " +"passed to the :class:`DocTestRunner` instance created to run the doctest. " +"If any reporting flags were specified when the :class:`!DocTestCase` " +"instance was constructed, :mod:`!doctest`'s :mod:`!unittest` reporting flags " +"are ignored." +msgstr "" + +#: ../../library/doctest.rst:1201 +msgid "" +"The value of the :mod:`unittest` reporting flags in effect before the " +"function was called is returned by the function." msgstr "" +#: ../../library/doctest.rst:1208 msgid "Advanced API" msgstr "" -msgid "The basic API is a simple wrapper that's intended to make doctest easy to use. It is fairly flexible, and should meet most users' needs; however, if you require more fine-grained control over testing, or wish to extend doctest's capabilities, then you should use the advanced API." +#: ../../library/doctest.rst:1210 +msgid "" +"The basic API is a simple wrapper that's intended to make doctest easy to " +"use. It is fairly flexible, and should meet most users' needs; however, if " +"you require more fine-grained control over testing, or wish to extend " +"doctest's capabilities, then you should use the advanced API." msgstr "" -msgid "The advanced API revolves around two container classes, which are used to store the interactive examples extracted from doctest cases:" +#: ../../library/doctest.rst:1215 +msgid "" +"The advanced API revolves around two container classes, which are used to " +"store the interactive examples extracted from doctest cases:" msgstr "" -msgid ":class:`Example`: A single Python :term:`statement`, paired with its expected output." +#: ../../library/doctest.rst:1218 +msgid "" +":class:`Example`: A single Python :term:`statement`, paired with its " +"expected output." msgstr "" -msgid ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted from a single docstring or text file." +#: ../../library/doctest.rst:1221 +msgid "" +":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " +"from a single docstring or text file." msgstr "" -msgid "Additional processing classes are defined to find, parse, and run, and check doctest examples:" +#: ../../library/doctest.rst:1224 +msgid "" +"Additional processing classes are defined to find, parse, and run, and check " +"doctest examples:" msgstr "" -msgid ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :class:`DocTestParser` to create a :class:`DocTest` from every docstring that contains interactive examples." +#: ../../library/doctest.rst:1227 +msgid "" +":class:`DocTestFinder`: Finds all docstrings in a given module, and uses " +"a :class:`DocTestParser` to create a :class:`DocTest` from every docstring " +"that contains interactive examples." msgstr "" -msgid ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string (such as an object's docstring)." +#: ../../library/doctest.rst:1231 +msgid "" +":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " +"(such as an object's docstring)." msgstr "" -msgid ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and uses an :class:`OutputChecker` to verify their output." +#: ../../library/doctest.rst:1234 +msgid "" +":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " +"uses an :class:`OutputChecker` to verify their output." msgstr "" -msgid ":class:`OutputChecker`: Compares the actual output from a doctest example with the expected output, and decides whether they match." +#: ../../library/doctest.rst:1237 +msgid "" +":class:`OutputChecker`: Compares the actual output from a doctest example " +"with the expected output, and decides whether they match." msgstr "" -msgid "The relationships among these processing classes are summarized in the following diagram::" +#: ../../library/doctest.rst:1240 +msgid "" +"The relationships among these processing classes are summarized in the " +"following diagram::" msgstr "" +#: ../../library/doctest.rst:1243 msgid "" " list of:\n" "+------+ +---------+\n" @@ -969,252 +1746,532 @@ msgid "" " +---------+" msgstr "" +#: ../../library/doctest.rst:1256 msgid "DocTest Objects" msgstr "" -msgid "A collection of doctest examples that should be run in a single namespace. The constructor arguments are used to initialize the attributes of the same names." +#: ../../library/doctest.rst:1261 +msgid "" +"A collection of doctest examples that should be run in a single namespace. " +"The constructor arguments are used to initialize the attributes of the same " +"names." msgstr "" -msgid ":class:`DocTest` defines the following attributes. They are initialized by the constructor, and should not be modified directly." +#: ../../library/doctest.rst:1265 +msgid "" +":class:`DocTest` defines the following attributes. They are initialized by " +"the constructor, and should not be modified directly." msgstr "" -msgid "A list of :class:`Example` objects encoding the individual interactive Python examples that should be run by this test." +#: ../../library/doctest.rst:1271 +msgid "" +"A list of :class:`Example` objects encoding the individual interactive " +"Python examples that should be run by this test." msgstr "" -msgid "The namespace (aka globals) that the examples should be run in. This is a dictionary mapping names to values. Any changes to the namespace made by the examples (such as binding new variables) will be reflected in :attr:`globs` after the test is run." +#: ../../library/doctest.rst:1277 +msgid "" +"The namespace (aka globals) that the examples should be run in. This is a " +"dictionary mapping names to values. Any changes to the namespace made by " +"the examples (such as binding new variables) will be reflected " +"in :attr:`globs` after the test is run." msgstr "" -msgid "A string name identifying the :class:`DocTest`. Typically, this is the name of the object or file that the test was extracted from." +#: ../../library/doctest.rst:1285 +msgid "" +"A string name identifying the :class:`DocTest`. Typically, this is the name " +"of the object or file that the test was extracted from." msgstr "" -msgid "The name of the file that this :class:`DocTest` was extracted from; or ``None`` if the filename is unknown, or if the :class:`!DocTest` was not extracted from a file." +#: ../../library/doctest.rst:1291 +msgid "" +"The name of the file that this :class:`DocTest` was extracted from; or " +"``None`` if the filename is unknown, or if the :class:`!DocTest` was not " +"extracted from a file." msgstr "" -msgid "The line number within :attr:`filename` where this :class:`DocTest` begins, or ``None`` if the line number is unavailable. This line number is zero-based with respect to the beginning of the file." +#: ../../library/doctest.rst:1298 +msgid "" +"The line number within :attr:`filename` where this :class:`DocTest` begins, " +"or ``None`` if the line number is unavailable. This line number is zero-" +"based with respect to the beginning of the file." msgstr "" -msgid "The string that the test was extracted from, or ``None`` if the string is unavailable, or if the test was not extracted from a string." +#: ../../library/doctest.rst:1305 +msgid "" +"The string that the test was extracted from, or ``None`` if the string is " +"unavailable, or if the test was not extracted from a string." msgstr "" +#: ../../library/doctest.rst:1312 msgid "Example Objects" msgstr "" -msgid "A single interactive example, consisting of a Python statement and its expected output. The constructor arguments are used to initialize the attributes of the same names." +#: ../../library/doctest.rst:1317 +msgid "" +"A single interactive example, consisting of a Python statement and its " +"expected output. The constructor arguments are used to initialize the " +"attributes of the same names." msgstr "" -msgid ":class:`Example` defines the following attributes. They are initialized by the constructor, and should not be modified directly." +#: ../../library/doctest.rst:1322 +msgid "" +":class:`Example` defines the following attributes. They are initialized by " +"the constructor, and should not be modified directly." msgstr "" -msgid "A string containing the example's source code. This source code consists of a single Python statement, and always ends with a newline; the constructor adds a newline when necessary." +#: ../../library/doctest.rst:1328 +msgid "" +"A string containing the example's source code. This source code consists of " +"a single Python statement, and always ends with a newline; the constructor " +"adds a newline when necessary." msgstr "" -msgid "The expected output from running the example's source code (either from stdout, or a traceback in case of exception). :attr:`want` ends with a newline unless no output is expected, in which case it's an empty string. The constructor adds a newline when necessary." +#: ../../library/doctest.rst:1335 +msgid "" +"The expected output from running the example's source code (either from " +"stdout, or a traceback in case of exception). :attr:`want` ends with a " +"newline unless no output is expected, in which case it's an empty string. " +"The constructor adds a newline when necessary." msgstr "" -msgid "The exception message generated by the example, if the example is expected to generate an exception; or ``None`` if it is not expected to generate an exception. This exception message is compared against the return value of :func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a newline unless it's ``None``. The constructor adds a newline if needed." +#: ../../library/doctest.rst:1343 +msgid "" +"The exception message generated by the example, if the example is expected " +"to generate an exception; or ``None`` if it is not expected to generate an " +"exception. This exception message is compared against the return value " +"of :func:`traceback.format_exception_only`. :attr:`exc_msg` ends with a " +"newline unless it's ``None``. The constructor adds a newline if needed." msgstr "" -msgid "The line number within the string containing this example where the example begins. This line number is zero-based with respect to the beginning of the containing string." +#: ../../library/doctest.rst:1352 +msgid "" +"The line number within the string containing this example where the example " +"begins. This line number is zero-based with respect to the beginning of the " +"containing string." msgstr "" -msgid "The example's indentation in the containing string, i.e., the number of space characters that precede the example's first prompt." +#: ../../library/doctest.rst:1359 +msgid "" +"The example's indentation in the containing string, i.e., the number of " +"space characters that precede the example's first prompt." msgstr "" -msgid "A dictionary mapping from option flags to ``True`` or ``False``, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the :class:`DocTestRunner`'s :ref:`optionflags `). By default, no options are set." +#: ../../library/doctest.rst:1365 +msgid "" +"A dictionary mapping from option flags to ``True`` or ``False``, which is " +"used to override default options for this example. Any option flags not " +"contained in this dictionary are left at their default value (as specified " +"by the :class:`DocTestRunner`'s :ref:`optionflags `). By " +"default, no options are set." msgstr "" +#: ../../library/doctest.rst:1375 msgid "DocTestFinder objects" msgstr "" -msgid "A processing class used to extract the :class:`DocTest`\\ s that are relevant to a given object, from its docstring and the docstrings of its contained objects. :class:`DocTest`\\ s can be extracted from modules, classes, functions, methods, staticmethods, classmethods, and properties." +#: ../../library/doctest.rst:1380 +msgid "" +"A processing class used to extract the :class:`DocTest`\\ s that are " +"relevant to a given object, from its docstring and the docstrings of its " +"contained objects. :class:`DocTest`\\ s can be extracted from modules, " +"classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -msgid "The optional argument *verbose* can be used to display the objects searched by the finder. It defaults to ``False`` (no output)." +#: ../../library/doctest.rst:1385 +msgid "" +"The optional argument *verbose* can be used to display the objects searched " +"by the finder. It defaults to ``False`` (no output)." msgstr "" -msgid "The optional argument *parser* specifies the :class:`DocTestParser` object (or a drop-in replacement) that is used to extract doctests from docstrings." +#: ../../library/doctest.rst:1388 +msgid "" +"The optional argument *parser* specifies the :class:`DocTestParser` object " +"(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -msgid "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` will only examine the given object, and not any contained objects." +#: ../../library/doctest.rst:1391 +msgid "" +"If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " +"will only examine the given object, and not any contained objects." msgstr "" -msgid "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder.find` will include tests for objects with empty docstrings." +#: ../../library/doctest.rst:1394 +msgid "" +"If the optional argument *exclude_empty* is false, " +"then :meth:`DocTestFinder.find` will include tests for objects with empty " +"docstrings." msgstr "" +#: ../../library/doctest.rst:1398 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -msgid "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s docstring, or by any of its contained objects' docstrings." +#: ../../library/doctest.rst:1403 +msgid "" +"Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " +"docstring, or by any of its contained objects' docstrings." msgstr "" -msgid "The optional argument *name* specifies the object's name; this name will be used to construct names for the returned :class:`DocTest`\\ s. If *name* is not specified, then ``obj.__name__`` is used." +#: ../../library/doctest.rst:1406 +msgid "" +"The optional argument *name* specifies the object's name; this name will be " +"used to construct names for the returned :class:`DocTest`\\ s. If *name* is " +"not specified, then ``obj.__name__`` is used." msgstr "" -msgid "The optional parameter *module* is the module that contains the given object. If the module is not specified or is ``None``, then the test finder will attempt to automatically determine the correct module. The object's module is used:" +#: ../../library/doctest.rst:1410 +msgid "" +"The optional parameter *module* is the module that contains the given " +"object. If the module is not specified or is ``None``, then the test finder " +"will attempt to automatically determine the correct module. The object's " +"module is used:" msgstr "" +#: ../../library/doctest.rst:1414 msgid "As a default namespace, if *globs* is not specified." msgstr "" -msgid "To prevent the DocTestFinder from extracting DocTests from objects that are imported from other modules. (Contained objects with modules other than *module* are ignored.)" +#: ../../library/doctest.rst:1416 +msgid "" +"To prevent the DocTestFinder from extracting DocTests from objects that are " +"imported from other modules. (Contained objects with modules other than " +"*module* are ignored.)" msgstr "" +#: ../../library/doctest.rst:1420 msgid "To find the name of the file containing the object." msgstr "" +#: ../../library/doctest.rst:1422 msgid "To help find the line number of the object within its file." msgstr "" -msgid "If *module* is ``False``, no attempt to find the module will be made. This is obscure, of use mostly in testing doctest itself: if *module* is ``False``, or is ``None`` but cannot be found automatically, then all objects are considered to belong to the (non-existent) module, so all contained objects will (recursively) be searched for doctests." +#: ../../library/doctest.rst:1424 +msgid "" +"If *module* is ``False``, no attempt to find the module will be made. This " +"is obscure, of use mostly in testing doctest itself: if *module* is " +"``False``, or is ``None`` but cannot be found automatically, then all " +"objects are considered to belong to the (non-existent) module, so all " +"contained objects will (recursively) be searched for doctests." msgstr "" -msgid "The globals for each :class:`DocTest` is formed by combining *globs* and *extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new shallow copy of the globals dictionary is created for each :class:`!DocTest`. If *globs* is not specified, then it defaults to the module's :attr:`~module.__dict__`, if specified, or ``{}`` otherwise. If *extraglobs* is not specified, then it defaults to ``{}``." +#: ../../library/doctest.rst:1430 +msgid "" +"The globals for each :class:`DocTest` is formed by combining *globs* and " +"*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " +"shallow copy of the globals dictionary is created for each :class:`!" +"DocTest`. If *globs* is not specified, then it defaults to the " +"module's :attr:`~module.__dict__`, if specified, or ``{}`` otherwise. If " +"*extraglobs* is not specified, then it defaults to ``{}``." msgstr "" +#: ../../library/doctest.rst:1441 msgid "DocTestParser objects" msgstr "" -msgid "A processing class used to extract interactive examples from a string, and use them to create a :class:`DocTest` object." +#: ../../library/doctest.rst:1446 +msgid "" +"A processing class used to extract interactive examples from a string, and " +"use them to create a :class:`DocTest` object." msgstr "" +#: ../../library/doctest.rst:1450 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -msgid "Extract all doctest examples from the given string, and collect them into a :class:`DocTest` object." +#: ../../library/doctest.rst:1455 +msgid "" +"Extract all doctest examples from the given string, and collect them into " +"a :class:`DocTest` object." msgstr "" -msgid "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:`!DocTest` object. See the documentation for :class:`DocTest` for more information." +#: ../../library/doctest.rst:1458 +msgid "" +"*globs*, *name*, *filename*, and *lineno* are attributes for the " +"new :class:`!DocTest` object. See the documentation for :class:`DocTest` " +"for more information." msgstr "" -msgid "Extract all doctest examples from the given string, and return them as a list of :class:`Example` objects. Line numbers are 0-based. The optional argument *name* is a name identifying this string, and is only used for error messages." +#: ../../library/doctest.rst:1465 +msgid "" +"Extract all doctest examples from the given string, and return them as a " +"list of :class:`Example` objects. Line numbers are 0-based. The optional " +"argument *name* is a name identifying this string, and is only used for " +"error messages." msgstr "" -msgid "Divide the given string into examples and intervening text, and return them as a list of alternating :class:`Example`\\ s and strings. Line numbers for the :class:`!Example`\\ s are 0-based. The optional argument *name* is a name identifying this string, and is only used for error messages." +#: ../../library/doctest.rst:1472 +msgid "" +"Divide the given string into examples and intervening text, and return them " +"as a list of alternating :class:`Example`\\ s and strings. Line numbers for " +"the :class:`!Example`\\ s are 0-based. The optional argument *name* is a " +"name identifying this string, and is only used for error messages." msgstr "" +#: ../../library/doctest.rst:1479 msgid "TestResults objects" msgstr "" +#: ../../library/doctest.rst:1486 msgid "Number of failed tests." msgstr "" +#: ../../library/doctest.rst:1490 msgid "Number of attempted tests." msgstr "" +#: ../../library/doctest.rst:1494 msgid "Number of skipped tests." msgstr "" +#: ../../library/doctest.rst:1502 msgid "DocTestRunner objects" msgstr "" -msgid "A processing class used to execute and verify the interactive examples in a :class:`DocTest`." +#: ../../library/doctest.rst:1507 +msgid "" +"A processing class used to execute and verify the interactive examples in " +"a :class:`DocTest`." msgstr "" -msgid "The comparison between expected outputs and actual outputs is done by an :class:`OutputChecker`. This comparison may be customized with a number of option flags; see section :ref:`doctest-options` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of :class:`!OutputChecker` to the constructor." +#: ../../library/doctest.rst:1510 +msgid "" +"The comparison between expected outputs and actual outputs is done by " +"an :class:`OutputChecker`. This comparison may be customized with a number " +"of option flags; see section :ref:`doctest-options` for more information. " +"If the option flags are insufficient, then the comparison may also be " +"customized by passing a subclass of :class:`!OutputChecker` to the " +"constructor." msgstr "" -msgid "The test runner's display output can be controlled in two ways. First, an output function can be passed to :meth:`run`; this function will be called with strings that should be displayed. It defaults to ``sys.stdout.write``. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods :meth:`report_start`, :meth:`report_success`, :meth:`report_unexpected_exception`, and :meth:`report_failure`." +#: ../../library/doctest.rst:1516 +msgid "" +"The test runner's display output can be controlled in two ways. First, an " +"output function can be passed to :meth:`run`; this function will be called " +"with strings that should be displayed. It defaults to " +"``sys.stdout.write``. If capturing the output is not sufficient, then the " +"display output can be also customized by subclassing DocTestRunner, and " +"overriding the " +"methods :meth:`report_start`, :meth:`report_success`, :meth:`report_unexpected_exception`, " +"and :meth:`report_failure`." msgstr "" -msgid "The optional keyword argument *checker* specifies the :class:`OutputChecker` object (or drop-in replacement) that should be used to compare the expected outputs to the actual outputs of doctest examples." +#: ../../library/doctest.rst:1524 +msgid "" +"The optional keyword argument *checker* specifies the :class:`OutputChecker` " +"object (or drop-in replacement) that should be used to compare the expected " +"outputs to the actual outputs of doctest examples." msgstr "" -msgid "The optional keyword argument *verbose* controls the :class:`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is printed about each example, as it is run. If *verbose* is ``False``, then only failures are printed. If *verbose* is unspecified, or ``None``, then verbose output is used iff the command-line switch ``-v`` is used." +#: ../../library/doctest.rst:1528 +msgid "" +"The optional keyword argument *verbose* controls " +"the :class:`DocTestRunner`'s verbosity. If *verbose* is ``True``, then " +"information is printed about each example, as it is run. If *verbose* is " +"``False``, then only failures are printed. If *verbose* is unspecified, or " +"``None``, then verbose output is used iff the command-line switch ``-v`` is " +"used." msgstr "" -msgid "The optional keyword argument *optionflags* can be used to control how the test runner compares expected output to actual output, and how it displays failures. For more information, see section :ref:`doctest-options`." +#: ../../library/doctest.rst:1534 +msgid "" +"The optional keyword argument *optionflags* can be used to control how the " +"test runner compares expected output to actual output, and how it displays " +"failures. For more information, see section :ref:`doctest-options`." msgstr "" -msgid "The test runner accumulates statistics. The aggregated number of attempted, failed and skipped examples is also available via the :attr:`tries`, :attr:`failures` and :attr:`skips` attributes. The :meth:`run` and :meth:`summarize` methods return a :class:`TestResults` instance." +#: ../../library/doctest.rst:1538 +msgid "" +"The test runner accumulates statistics. The aggregated number of attempted, " +"failed and skipped examples is also available via " +"the :attr:`tries`, :attr:`failures` and :attr:`skips` attributes. " +"The :meth:`run` and :meth:`summarize` methods return a :class:`TestResults` " +"instance." msgstr "" +#: ../../library/doctest.rst:1543 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -msgid "Report that the test runner is about to process the given example. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly." +#: ../../library/doctest.rst:1548 +msgid "" +"Report that the test runner is about to process the given example. This " +"method is provided to allow subclasses of :class:`DocTestRunner` to " +"customize their output; it should not be called directly." msgstr "" -msgid "*example* is the example about to be processed. *test* is the test containing *example*. *out* is the output function that was passed to :meth:`DocTestRunner.run`." +#: ../../library/doctest.rst:1552 +msgid "" +"*example* is the example about to be processed. *test* is the test " +"containing *example*. *out* is the output function that was passed " +"to :meth:`DocTestRunner.run`." msgstr "" -msgid "Report that the given example ran successfully. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly." +#: ../../library/doctest.rst:1559 +msgid "" +"Report that the given example ran successfully. This method is provided to " +"allow subclasses of :class:`DocTestRunner` to customize their output; it " +"should not be called directly." msgstr "" -msgid "*example* is the example about to be processed. *got* is the actual output from the example. *test* is the test containing *example*. *out* is the output function that was passed to :meth:`DocTestRunner.run`." +#: ../../library/doctest.rst:1563 ../../library/doctest.rst:1574 +msgid "" +"*example* is the example about to be processed. *got* is the actual output " +"from the example. *test* is the test containing *example*. *out* is the " +"output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -msgid "Report that the given example failed. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly." +#: ../../library/doctest.rst:1570 +msgid "" +"Report that the given example failed. This method is provided to allow " +"subclasses of :class:`DocTestRunner` to customize their output; it should " +"not be called directly." msgstr "" -msgid "Report that the given example raised an unexpected exception. This method is provided to allow subclasses of :class:`DocTestRunner` to customize their output; it should not be called directly." +#: ../../library/doctest.rst:1581 +msgid "" +"Report that the given example raised an unexpected exception. This method is " +"provided to allow subclasses of :class:`DocTestRunner` to customize their " +"output; it should not be called directly." msgstr "" -msgid "*example* is the example about to be processed. *exc_info* is a tuple containing information about the unexpected exception (as returned by :func:`sys.exc_info`). *test* is the test containing *example*. *out* is the output function that was passed to :meth:`DocTestRunner.run`." +#: ../../library/doctest.rst:1585 +msgid "" +"*example* is the example about to be processed. *exc_info* is a tuple " +"containing information about the unexpected exception (as returned " +"by :func:`sys.exc_info`). *test* is the test containing *example*. *out* is " +"the output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -msgid "Run the examples in *test* (a :class:`DocTest` object), and display the results using the writer function *out*. Return a :class:`TestResults` instance." +#: ../../library/doctest.rst:1593 +msgid "" +"Run the examples in *test* (a :class:`DocTest` object), and display the " +"results using the writer function *out*. Return a :class:`TestResults` " +"instance." msgstr "" -msgid "The examples are run in the namespace ``test.globs``. If *clear_globs* is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use *clear_globs=False*." +#: ../../library/doctest.rst:1597 +msgid "" +"The examples are run in the namespace ``test.globs``. If *clear_globs* is " +"true (the default), then this namespace will be cleared after the test runs, " +"to help with garbage collection. If you would like to examine the namespace " +"after the test completes, then use *clear_globs=False*." msgstr "" -msgid "*compileflags* gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to *globs*." +#: ../../library/doctest.rst:1602 +msgid "" +"*compileflags* gives the set of flags that should be used by the Python " +"compiler when running the examples. If not specified, then it will default " +"to the set of future-import flags that apply to *globs*." msgstr "" -msgid "The output of each example is checked using the :class:`DocTestRunner`'s output checker, and the results are formatted by the :meth:`!DocTestRunner.report_\\*` methods." +#: ../../library/doctest.rst:1606 +msgid "" +"The output of each example is checked using the :class:`DocTestRunner`'s " +"output checker, and the results are formatted by the :meth:`!" +"DocTestRunner.report_\\*` methods." msgstr "" -msgid "Print a summary of all the test cases that have been run by this DocTestRunner, and return a :class:`TestResults` instance." +#: ../../library/doctest.rst:1613 +msgid "" +"Print a summary of all the test cases that have been run by this " +"DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -msgid "The optional *verbose* argument controls how detailed the summary is. If the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity is used." +#: ../../library/doctest.rst:1616 +msgid "" +"The optional *verbose* argument controls how detailed the summary is. If " +"the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " +"is used." msgstr "" +#: ../../library/doctest.rst:1620 msgid ":class:`DocTestParser` has the following attributes:" msgstr "" +#: ../../library/doctest.rst:1624 msgid "Number of attempted examples." msgstr "" +#: ../../library/doctest.rst:1628 msgid "Number of failed examples." msgstr "" +#: ../../library/doctest.rst:1632 msgid "Number of skipped examples." msgstr "" +#: ../../library/doctest.rst:1640 msgid "OutputChecker objects" msgstr "" -msgid "A class used to check the whether the actual output from a doctest example matches the expected output. :class:`OutputChecker` defines two methods: :meth:`check_output`, which compares a given pair of outputs, and returns ``True`` if they match; and :meth:`output_difference`, which returns a string describing the differences between two outputs." +#: ../../library/doctest.rst:1645 +msgid "" +"A class used to check the whether the actual output from a doctest example " +"matches the expected output. :class:`OutputChecker` defines two " +"methods: :meth:`check_output`, which compares a given pair of outputs, and " +"returns ``True`` if they match; and :meth:`output_difference`, which returns " +"a string describing the differences between two outputs." msgstr "" +#: ../../library/doctest.rst:1652 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -msgid "Return ``True`` iff the actual output from an example (*got*) matches the expected output (*want*). These strings are always considered to match if they are identical; but depending on what option flags the test runner is using, several non-exact match types are also possible. See section :ref:`doctest-options` for more information about option flags." +#: ../../library/doctest.rst:1656 +msgid "" +"Return ``True`` iff the actual output from an example (*got*) matches the " +"expected output (*want*). These strings are always considered to match if " +"they are identical; but depending on what option flags the test runner is " +"using, several non-exact match types are also possible. See " +"section :ref:`doctest-options` for more information about option flags." msgstr "" -msgid "Return a string describing the differences between the expected output for a given example (*example*) and the actual output (*got*). *optionflags* is the set of option flags used to compare *want* and *got*." +#: ../../library/doctest.rst:1665 +msgid "" +"Return a string describing the differences between the expected output for a " +"given example (*example*) and the actual output (*got*). *optionflags* is " +"the set of option flags used to compare *want* and *got*." msgstr "" +#: ../../library/doctest.rst:1673 msgid "Debugging" msgstr "" +#: ../../library/doctest.rst:1675 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -msgid "Several functions convert doctests to executable Python programs, which can be run under the Python debugger, :mod:`pdb`." +#: ../../library/doctest.rst:1677 +msgid "" +"Several functions convert doctests to executable Python programs, which can " +"be run under the Python debugger, :mod:`pdb`." msgstr "" -msgid "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that raises an exception for the first failing example, containing information about that example. This information can be used to perform post-mortem debugging on the example." +#: ../../library/doctest.rst:1680 +msgid "" +"The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " +"raises an exception for the first failing example, containing information " +"about that example. This information can be used to perform post-mortem " +"debugging on the example." msgstr "" -msgid "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :meth:`debug` method defined by :class:`unittest.TestCase`." +#: ../../library/doctest.rst:1685 +msgid "" +"The :mod:`unittest` cases generated by :func:`DocTestSuite` support " +"the :meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -msgid "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll drop into the Python debugger when that line is executed. Then you can inspect current values of variables, and so on. For example, suppose :file:`a.py` contains just this module docstring::" +#: ../../library/doctest.rst:1688 +msgid "" +"You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " +"drop into the Python debugger when that line is executed. Then you can " +"inspect current values of variables, and so on. For example, " +"suppose :file:`a.py` contains just this module docstring::" msgstr "" +#: ../../library/doctest.rst:1693 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -1227,9 +2284,11 @@ msgid "" "\"\"\"" msgstr "" +#: ../../library/doctest.rst:1703 msgid "Then an interactive Python session may look like this::" msgstr "" +#: ../../library/doctest.rst:1705 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -1262,15 +2321,25 @@ msgid "" ">>>" msgstr "" -msgid "Functions that convert doctests to Python code, and possibly run the synthesized code under the debugger:" +#: ../../library/doctest.rst:1736 +msgid "" +"Functions that convert doctests to Python code, and possibly run the " +"synthesized code under the debugger:" msgstr "" +#: ../../library/doctest.rst:1742 msgid "Convert text with examples to a script." msgstr "" -msgid "Argument *s* is a string containing doctest examples. The string is converted to a Python script, where doctest examples in *s* are converted to regular code, and everything else is converted to Python comments. The generated script is returned as a string. For example, ::" +#: ../../library/doctest.rst:1744 +msgid "" +"Argument *s* is a string containing doctest examples. The string is " +"converted to a Python script, where doctest examples in *s* are converted to " +"regular code, and everything else is converted to Python comments. The " +"generated script is returned as a string. For example, ::" msgstr "" +#: ../../library/doctest.rst:1749 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -1283,9 +2352,11 @@ msgid "" "\"\"\"))" msgstr "" +#: ../../library/doctest.rst:1759 msgid "displays::" msgstr "" +#: ../../library/doctest.rst:1761 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -1296,122 +2367,262 @@ msgid "" "## 3" msgstr "" -msgid "This function is used internally by other functions (see below), but can also be useful when you want to transform an interactive Python session into a Python script." +#: ../../library/doctest.rst:1769 +msgid "" +"This function is used internally by other functions (see below), but can " +"also be useful when you want to transform an interactive Python session into " +"a Python script." msgstr "" +#: ../../library/doctest.rst:1776 msgid "Convert the doctest for an object to a script." msgstr "" -msgid "Argument *module* is a module object, or dotted name of a module, containing the object whose doctests are of interest. Argument *name* is the name (within the module) of the object with the doctests of interest. The result is a string, containing the object's docstring converted to a Python script, as described for :func:`script_from_examples` above. For example, if module :file:`a.py` contains a top-level function :func:`!f`, then ::" +#: ../../library/doctest.rst:1778 +msgid "" +"Argument *module* is a module object, or dotted name of a module, containing " +"the object whose doctests are of interest. Argument *name* is the name " +"(within the module) of the object with the doctests of interest. The result " +"is a string, containing the object's docstring converted to a Python script, " +"as described for :func:`script_from_examples` above. For example, if " +"module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" +#: ../../library/doctest.rst:1785 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" msgstr "" -msgid "prints a script version of function :func:`!f`'s docstring, with doctests converted to code, and the rest placed in comments." +#: ../../library/doctest.rst:1788 +msgid "" +"prints a script version of function :func:`!f`'s docstring, with doctests " +"converted to code, and the rest placed in comments." msgstr "" +#: ../../library/doctest.rst:1794 msgid "Debug the doctests for an object." msgstr "" -msgid "The *module* and *name* arguments are the same as for function :func:`testsource` above. The synthesized Python script for the named object's docstring is written to a temporary file, and then that file is run under the control of the Python debugger, :mod:`pdb`." +#: ../../library/doctest.rst:1796 +msgid "" +"The *module* and *name* arguments are the same as for " +"function :func:`testsource` above. The synthesized Python script for the " +"named object's docstring is written to a temporary file, and then that file " +"is run under the control of the Python debugger, :mod:`pdb`." msgstr "" -msgid "A shallow copy of ``module.__dict__`` is used for both local and global execution context." +#: ../../library/doctest.rst:1801 +msgid "" +"A shallow copy of ``module.__dict__`` is used for both local and global " +"execution context." msgstr "" -msgid "Optional argument *pm* controls whether post-mortem debugging is used. If *pm* has a true value, the script file is run directly, and the debugger gets involved only if the script terminates via raising an unhandled exception. If it does, then post-mortem debugging is invoked, via :func:`pdb.post_mortem`, passing the traceback object from the unhandled exception. If *pm* is not specified, or is false, the script is run under the debugger from the start, via passing an appropriate :func:`exec` call to :func:`pdb.run`." +#: ../../library/doctest.rst:1804 +msgid "" +"Optional argument *pm* controls whether post-mortem debugging is used. If " +"*pm* has a true value, the script file is run directly, and the debugger " +"gets involved only if the script terminates via raising an unhandled " +"exception. If it does, then post-mortem debugging is invoked, " +"via :func:`pdb.post_mortem`, passing the traceback object from the unhandled " +"exception. If *pm* is not specified, or is false, the script is run under " +"the debugger from the start, via passing an appropriate :func:`exec` call " +"to :func:`pdb.run`." msgstr "" +#: ../../library/doctest.rst:1815 msgid "Debug the doctests in a string." msgstr "" -msgid "This is like function :func:`debug` above, except that a string containing doctest examples is specified directly, via the *src* argument." +#: ../../library/doctest.rst:1817 +msgid "" +"This is like function :func:`debug` above, except that a string containing " +"doctest examples is specified directly, via the *src* argument." msgstr "" -msgid "Optional argument *pm* has the same meaning as in function :func:`debug` above." +#: ../../library/doctest.rst:1820 +msgid "" +"Optional argument *pm* has the same meaning as in function :func:`debug` " +"above." msgstr "" -msgid "Optional argument *globs* gives a dictionary to use as both local and global execution context. If not specified, or ``None``, an empty dictionary is used. If specified, a shallow copy of the dictionary is used." +#: ../../library/doctest.rst:1822 +msgid "" +"Optional argument *globs* gives a dictionary to use as both local and global " +"execution context. If not specified, or ``None``, an empty dictionary is " +"used. If specified, a shallow copy of the dictionary is used." msgstr "" -msgid "The :class:`DebugRunner` class, and the special exceptions it may raise, are of most interest to testing framework authors, and will only be sketched here. See the source code, and especially :class:`DebugRunner`'s docstring (which is a doctest!) for more details:" +#: ../../library/doctest.rst:1827 +msgid "" +"The :class:`DebugRunner` class, and the special exceptions it may raise, are " +"of most interest to testing framework authors, and will only be sketched " +"here. See the source code, and especially :class:`DebugRunner`'s docstring " +"(which is a doctest!) for more details:" msgstr "" -msgid "A subclass of :class:`DocTestRunner` that raises an exception as soon as a failure is encountered. If an unexpected exception occurs, an :exc:`UnexpectedException` exception is raised, containing the test, the example, and the original exception. If the output doesn't match, then a :exc:`DocTestFailure` exception is raised, containing the test, the example, and the actual output." +#: ../../library/doctest.rst:1835 +msgid "" +"A subclass of :class:`DocTestRunner` that raises an exception as soon as a " +"failure is encountered. If an unexpected exception occurs, " +"an :exc:`UnexpectedException` exception is raised, containing the test, the " +"example, and the original exception. If the output doesn't match, then " +"a :exc:`DocTestFailure` exception is raised, containing the test, the " +"example, and the actual output." msgstr "" -msgid "For information about the constructor parameters and methods, see the documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-api`." +#: ../../library/doctest.rst:1842 +msgid "" +"For information about the constructor parameters and methods, see the " +"documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" +"api`." msgstr "" -msgid "There are two exceptions that may be raised by :class:`DebugRunner` instances:" +#: ../../library/doctest.rst:1845 +msgid "" +"There are two exceptions that may be raised by :class:`DebugRunner` " +"instances:" msgstr "" -msgid "An exception raised by :class:`DocTestRunner` to signal that a doctest example's actual output did not match its expected output. The constructor arguments are used to initialize the attributes of the same names." +#: ../../library/doctest.rst:1850 +msgid "" +"An exception raised by :class:`DocTestRunner` to signal that a doctest " +"example's actual output did not match its expected output. The constructor " +"arguments are used to initialize the attributes of the same names." msgstr "" +#: ../../library/doctest.rst:1854 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr "" +#: ../../library/doctest.rst:1859 ../../library/doctest.rst:1883 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" +#: ../../library/doctest.rst:1864 ../../library/doctest.rst:1888 msgid "The :class:`Example` that failed." msgstr "" +#: ../../library/doctest.rst:1869 msgid "The example's actual output." msgstr "" -msgid "An exception raised by :class:`DocTestRunner` to signal that a doctest example raised an unexpected exception. The constructor arguments are used to initialize the attributes of the same names." +#: ../../library/doctest.rst:1874 +msgid "" +"An exception raised by :class:`DocTestRunner` to signal that a doctest " +"example raised an unexpected exception. The constructor arguments are used " +"to initialize the attributes of the same names." msgstr "" +#: ../../library/doctest.rst:1878 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -msgid "A tuple containing information about the unexpected exception, as returned by :func:`sys.exc_info`." +#: ../../library/doctest.rst:1893 +msgid "" +"A tuple containing information about the unexpected exception, as returned " +"by :func:`sys.exc_info`." msgstr "" +#: ../../library/doctest.rst:1900 msgid "Soapbox" msgstr "" -msgid "As mentioned in the introduction, :mod:`!doctest` has grown to have three primary uses:" +#: ../../library/doctest.rst:1902 +msgid "" +"As mentioned in the introduction, :mod:`!doctest` has grown to have three " +"primary uses:" msgstr "" +#: ../../library/doctest.rst:1905 msgid "Checking examples in docstrings." msgstr "" +#: ../../library/doctest.rst:1907 msgid "Regression testing." msgstr "" +#: ../../library/doctest.rst:1909 msgid "Executable documentation / literate testing." msgstr "" -msgid "These uses have different requirements, and it is important to distinguish them. In particular, filling your docstrings with obscure test cases makes for bad documentation." -msgstr "" - -msgid "When writing a docstring, choose docstring examples with care. There's an art to this that needs to be learned---it may not be natural at first. Examples should add genuine value to the documentation. A good example can often be worth many words. If done with care, the examples will be invaluable for your users, and will pay back the time it takes to collect them many times over as the years go by and things change. I'm still amazed at how often one of my :mod:`!doctest` examples stops working after a \"harmless\" change." +#: ../../library/doctest.rst:1911 +msgid "" +"These uses have different requirements, and it is important to distinguish " +"them. In particular, filling your docstrings with obscure test cases makes " +"for bad documentation." msgstr "" -msgid "Doctest also makes an excellent tool for regression testing, especially if you don't skimp on explanatory text. By interleaving prose and examples, it becomes much easier to keep track of what's actually being tested, and why. When a test fails, good prose can make it much easier to figure out what the problem is, and how it should be fixed. It's true that you could write extensive comments in code-based testing, but few programmers do. Many have found that using doctest approaches instead leads to much clearer tests. Perhaps this is simply because doctest makes writing prose a little easier than writing code, while writing comments in code is a little harder. I think it goes deeper than just that: the natural attitude when writing a doctest-based test is that you want to explain the fine points of your software, and illustrate them with examples. This in turn naturally leads to test files that start with the simplest features, and logically progress to complications and edge cases. A coherent narrative is the result, instead of a collection of isolated functions that test isolated bits of functionality seemingly at random. It's a different attitude, and produces different results, blurring the distinction between testing and explaining." +#: ../../library/doctest.rst:1915 +msgid "" +"When writing a docstring, choose docstring examples with care. There's an " +"art to this that needs to be learned---it may not be natural at first. " +"Examples should add genuine value to the documentation. A good example can " +"often be worth many words. If done with care, the examples will be " +"invaluable for your users, and will pay back the time it takes to collect " +"them many times over as the years go by and things change. I'm still amazed " +"at how often one of my :mod:`!doctest` examples stops working after a " +"\"harmless\" change." msgstr "" -msgid "Regression testing is best confined to dedicated objects or files. There are several options for organizing tests:" +#: ../../library/doctest.rst:1923 +msgid "" +"Doctest also makes an excellent tool for regression testing, especially if " +"you don't skimp on explanatory text. By interleaving prose and examples, it " +"becomes much easier to keep track of what's actually being tested, and why. " +"When a test fails, good prose can make it much easier to figure out what the " +"problem is, and how it should be fixed. It's true that you could write " +"extensive comments in code-based testing, but few programmers do. Many have " +"found that using doctest approaches instead leads to much clearer tests. " +"Perhaps this is simply because doctest makes writing prose a little easier " +"than writing code, while writing comments in code is a little harder. I " +"think it goes deeper than just that: the natural attitude when writing a " +"doctest-based test is that you want to explain the fine points of your " +"software, and illustrate them with examples. This in turn naturally leads to " +"test files that start with the simplest features, and logically progress to " +"complications and edge cases. A coherent narrative is the result, instead " +"of a collection of isolated functions that test isolated bits of " +"functionality seemingly at random. It's a different attitude, and produces " +"different results, blurring the distinction between testing and explaining." +msgstr "" + +#: ../../library/doctest.rst:1941 +msgid "" +"Regression testing is best confined to dedicated objects or files. There " +"are several options for organizing tests:" msgstr "" -msgid "Write text files containing test cases as interactive examples, and test the files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, although is easiest to do for new projects, designed from the start to use doctest." +#: ../../library/doctest.rst:1944 +msgid "" +"Write text files containing test cases as interactive examples, and test the " +"files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " +"although is easiest to do for new projects, designed from the start to use " +"doctest." msgstr "" -msgid "Define functions named ``_regrtest_topic`` that consist of single docstrings, containing test cases for the named topics. These functions can be included in the same file as the module, or separated out into a separate test file." +#: ../../library/doctest.rst:1949 +msgid "" +"Define functions named ``_regrtest_topic`` that consist of single " +"docstrings, containing test cases for the named topics. These functions can " +"be included in the same file as the module, or separated out into a separate " +"test file." msgstr "" -msgid "Define a :attr:`~module.__test__` dictionary mapping from regression test topics to docstrings containing test cases." +#: ../../library/doctest.rst:1953 +msgid "" +"Define a :attr:`~module.__test__` dictionary mapping from regression test " +"topics to docstrings containing test cases." msgstr "" -msgid "When you have placed your tests in a module, the module can itself be the test runner. When a test fails, you can arrange for your test runner to re-run only the failing doctest while you debug the problem. Here is a minimal example of such a test runner::" +#: ../../library/doctest.rst:1956 +msgid "" +"When you have placed your tests in a module, the module can itself be the " +"test runner. When a test fails, you can arrange for your test runner to re-" +"run only the failing doctest while you debug the problem. Here is a minimal " +"example of such a test runner::" msgstr "" +#: ../../library/doctest.rst:1961 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -1429,38 +2640,53 @@ msgid "" " print(f\"{fail} failures out of {total} tests\")" msgstr "" +#: ../../library/doctest.rst:1978 msgid "Footnotes" msgstr "" -msgid "Examples containing both expected output and an exception are not supported. Trying to guess where one ends and the other begins is too error-prone, and that also makes for a confusing test." +#: ../../library/doctest.rst:1979 +msgid "" +"Examples containing both expected output and an exception are not supported. " +"Trying to guess where one ends and the other begins is too error-prone, and " +"that also makes for a confusing test." msgstr "" +#: ../../library/doctest.rst:387 msgid ">>>" msgstr "" +#: ../../library/doctest.rst:387 msgid "interpreter prompt" msgstr "" +#: ../../library/doctest.rst:387 ../../library/doctest.rst:622 msgid "..." msgstr "" +#: ../../library/doctest.rst:553 msgid "^ (caret)" msgstr "" +#: ../../library/doctest.rst:553 msgid "marker" msgstr "" +#: ../../library/doctest.rst:602 msgid "" msgstr "" +#: ../../library/doctest.rst:622 ../../library/doctest.rst:747 msgid "in doctests" msgstr "" +#: ../../library/doctest.rst:747 msgid "# (hash)" msgstr "" +#: ../../library/doctest.rst:747 msgid "+ (plus)" msgstr "" +#: ../../library/doctest.rst:747 msgid "- (minus)" msgstr "" diff --git a/library/email.charset.po b/library/email.charset.po index e6979a4fc..57f8d7d76 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,134 +23,278 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.charset.rst:2 msgid ":mod:`!email.charset`: Representing character sets" msgstr "" +#: ../../library/email.charset.rst:7 msgid "**Source code:** :source:`Lib/email/charset.py`" msgstr "" -msgid "This module is part of the legacy (``Compat32``) email API. In the new API only the aliases table is used." +#: ../../library/email.charset.rst:11 +msgid "" +"This module is part of the legacy (``Compat32``) email API. In the new API " +"only the aliases table is used." msgstr "" -msgid "The remaining text in this section is the original documentation of the module." +#: ../../library/email.charset.rst:14 +msgid "" +"The remaining text in this section is the original documentation of the " +"module." msgstr "" -msgid "This module provides a class :class:`Charset` for representing character sets and character set conversions in email messages, as well as a character set registry and several convenience methods for manipulating this registry. Instances of :class:`Charset` are used in several other modules within the :mod:`email` package." +#: ../../library/email.charset.rst:16 +msgid "" +"This module provides a class :class:`Charset` for representing character " +"sets and character set conversions in email messages, as well as a character " +"set registry and several convenience methods for manipulating this registry. " +"Instances of :class:`Charset` are used in several other modules within " +"the :mod:`email` package." msgstr "" +#: ../../library/email.charset.rst:22 msgid "Import this class from the :mod:`!email.charset` module." msgstr "" +#: ../../library/email.charset.rst:27 msgid "Map character sets to their email properties." msgstr "" -msgid "This class provides information about the requirements imposed on email for a specific character set. It also provides convenience routines for converting between character sets, given the availability of the applicable codecs. Given a character set, it will do its best to provide information on how to use that character set in an email message in an RFC-compliant way." -msgstr "" - -msgid "Certain character sets must be encoded with quoted-printable or base64 when used in email headers or bodies. Certain character sets must be converted outright, and are not allowed in email." +#: ../../library/email.charset.rst:29 +msgid "" +"This class provides information about the requirements imposed on email for " +"a specific character set. It also provides convenience routines for " +"converting between character sets, given the availability of the applicable " +"codecs. Given a character set, it will do its best to provide information " +"on how to use that character set in an email message in an RFC-compliant way." msgstr "" -msgid "Optional *input_charset* is as described below; it is always coerced to lower case. After being alias normalized it is also used as a lookup into the registry of character sets to find out the header encoding, body encoding, and output conversion codec to be used for the character set. For example, if *input_charset* is ``iso-8859-1``, then headers and bodies will be encoded using quoted-printable and no output conversion codec is necessary. If *input_charset* is ``euc-jp``, then headers will be encoded with base64, bodies will not be encoded, but output text will be converted from the ``euc-jp`` character set to the ``iso-2022-jp`` character set." +#: ../../library/email.charset.rst:35 +msgid "" +"Certain character sets must be encoded with quoted-printable or base64 when " +"used in email headers or bodies. Certain character sets must be converted " +"outright, and are not allowed in email." msgstr "" +#: ../../library/email.charset.rst:39 +msgid "" +"Optional *input_charset* is as described below; it is always coerced to " +"lower case. After being alias normalized it is also used as a lookup into " +"the registry of character sets to find out the header encoding, body " +"encoding, and output conversion codec to be used for the character set. For " +"example, if *input_charset* is ``iso-8859-1``, then headers and bodies will " +"be encoded using quoted-printable and no output conversion codec is " +"necessary. If *input_charset* is ``euc-jp``, then headers will be encoded " +"with base64, bodies will not be encoded, but output text will be converted " +"from the ``euc-jp`` character set to the ``iso-2022-jp`` character set." +msgstr "" + +#: ../../library/email.charset.rst:49 msgid ":class:`Charset` instances have the following data attributes:" msgstr "" -msgid "The initial character set specified. Common aliases are converted to their *official* email names (e.g. ``latin_1`` is converted to ``iso-8859-1``). Defaults to 7-bit ``us-ascii``." +#: ../../library/email.charset.rst:53 +msgid "" +"The initial character set specified. Common aliases are converted to their " +"*official* email names (e.g. ``latin_1`` is converted to ``iso-8859-1``). " +"Defaults to 7-bit ``us-ascii``." msgstr "" -msgid "If the character set must be encoded before it can be used in an email header, this attribute will be set to ``charset.QP`` (for quoted-printable), ``charset.BASE64`` (for base64 encoding), or ``charset.SHORTEST`` for the shortest of QP or BASE64 encoding. Otherwise, it will be ``None``." +#: ../../library/email.charset.rst:60 +msgid "" +"If the character set must be encoded before it can be used in an email " +"header, this attribute will be set to ``charset.QP`` (for quoted-printable), " +"``charset.BASE64`` (for base64 encoding), or ``charset.SHORTEST`` for the " +"shortest of QP or BASE64 encoding. Otherwise, it will be ``None``." msgstr "" -msgid "Same as *header_encoding*, but describes the encoding for the mail message's body, which indeed may be different than the header encoding. ``charset.SHORTEST`` is not allowed for *body_encoding*." +#: ../../library/email.charset.rst:69 +msgid "" +"Same as *header_encoding*, but describes the encoding for the mail message's " +"body, which indeed may be different than the header encoding. " +"``charset.SHORTEST`` is not allowed for *body_encoding*." msgstr "" -msgid "Some character sets must be converted before they can be used in email headers or bodies. If the *input_charset* is one of them, this attribute will contain the name of the character set output will be converted to. Otherwise, it will be ``None``." +#: ../../library/email.charset.rst:76 +msgid "" +"Some character sets must be converted before they can be used in email " +"headers or bodies. If the *input_charset* is one of them, this attribute " +"will contain the name of the character set output will be converted to. " +"Otherwise, it will be ``None``." msgstr "" -msgid "The name of the Python codec used to convert the *input_charset* to Unicode. If no conversion codec is necessary, this attribute will be ``None``." +#: ../../library/email.charset.rst:84 +msgid "" +"The name of the Python codec used to convert the *input_charset* to " +"Unicode. If no conversion codec is necessary, this attribute will be " +"``None``." msgstr "" -msgid "The name of the Python codec used to convert Unicode to the *output_charset*. If no conversion codec is necessary, this attribute will have the same value as the *input_codec*." +#: ../../library/email.charset.rst:91 +msgid "" +"The name of the Python codec used to convert Unicode to the " +"*output_charset*. If no conversion codec is necessary, this attribute will " +"have the same value as the *input_codec*." msgstr "" +#: ../../library/email.charset.rst:96 msgid ":class:`Charset` instances also have the following methods:" msgstr "" +#: ../../library/email.charset.rst:100 msgid "Return the content transfer encoding used for body encoding." msgstr "" -msgid "This is either the string ``quoted-printable`` or ``base64`` depending on the encoding used, or it is a function, in which case you should call the function with a single argument, the Message object being encoded. The function should then set the :mailheader:`Content-Transfer-Encoding` header itself to whatever is appropriate." +#: ../../library/email.charset.rst:102 +msgid "" +"This is either the string ``quoted-printable`` or ``base64`` depending on " +"the encoding used, or it is a function, in which case you should call the " +"function with a single argument, the Message object being encoded. The " +"function should then set the :mailheader:`Content-Transfer-Encoding` header " +"itself to whatever is appropriate." msgstr "" -msgid "Returns the string ``quoted-printable`` if *body_encoding* is ``QP``, returns the string ``base64`` if *body_encoding* is ``BASE64``, and returns the string ``7bit`` otherwise." +#: ../../library/email.charset.rst:108 +msgid "" +"Returns the string ``quoted-printable`` if *body_encoding* is ``QP``, " +"returns the string ``base64`` if *body_encoding* is ``BASE64``, and returns " +"the string ``7bit`` otherwise." msgstr "" +#: ../../library/email.charset.rst:115 msgid "Return the output character set." msgstr "" -msgid "This is the *output_charset* attribute if that is not ``None``, otherwise it is *input_charset*." +#: ../../library/email.charset.rst:117 +msgid "" +"This is the *output_charset* attribute if that is not ``None``, otherwise it " +"is *input_charset*." msgstr "" +#: ../../library/email.charset.rst:123 msgid "Header-encode the string *string*." msgstr "" -msgid "The type of encoding (base64 or quoted-printable) will be based on the *header_encoding* attribute." +#: ../../library/email.charset.rst:125 +msgid "" +"The type of encoding (base64 or quoted-printable) will be based on the " +"*header_encoding* attribute." msgstr "" +#: ../../library/email.charset.rst:131 msgid "Header-encode a *string* by converting it first to bytes." msgstr "" -msgid "This is similar to :meth:`header_encode` except that the string is fit into maximum line lengths as given by the argument *maxlengths*, which must be an iterator: each element returned from this iterator will provide the next maximum line length." +#: ../../library/email.charset.rst:133 +msgid "" +"This is similar to :meth:`header_encode` except that the string is fit into " +"maximum line lengths as given by the argument *maxlengths*, which must be an " +"iterator: each element returned from this iterator will provide the next " +"maximum line length." msgstr "" +#: ../../library/email.charset.rst:141 msgid "Body-encode the string *string*." msgstr "" -msgid "The type of encoding (base64 or quoted-printable) will be based on the *body_encoding* attribute." +#: ../../library/email.charset.rst:143 +msgid "" +"The type of encoding (base64 or quoted-printable) will be based on the " +"*body_encoding* attribute." msgstr "" -msgid "The :class:`Charset` class also provides a number of methods to support standard operations and built-in functions." +#: ../../library/email.charset.rst:146 +msgid "" +"The :class:`Charset` class also provides a number of methods to support " +"standard operations and built-in functions." msgstr "" -msgid "Returns *input_charset* as a string coerced to lower case. :meth:`!__repr__` is an alias for :meth:`!__str__`." +#: ../../library/email.charset.rst:152 +msgid "" +"Returns *input_charset* as a string coerced to lower case. :meth:`!__repr__` " +"is an alias for :meth:`!__str__`." msgstr "" -msgid "This method allows you to compare two :class:`Charset` instances for equality." +#: ../../library/email.charset.rst:158 +msgid "" +"This method allows you to compare two :class:`Charset` instances for " +"equality." msgstr "" -msgid "This method allows you to compare two :class:`Charset` instances for inequality." +#: ../../library/email.charset.rst:164 +msgid "" +"This method allows you to compare two :class:`Charset` instances for " +"inequality." msgstr "" -msgid "The :mod:`!email.charset` module also provides the following functions for adding new entries to the global character set, alias, and codec registries:" +#: ../../library/email.charset.rst:167 +msgid "" +"The :mod:`!email.charset` module also provides the following functions for " +"adding new entries to the global character set, alias, and codec registries:" msgstr "" +#: ../../library/email.charset.rst:173 msgid "Add character properties to the global registry." msgstr "" -msgid "*charset* is the input character set, and must be the canonical name of a character set." +#: ../../library/email.charset.rst:175 +msgid "" +"*charset* is the input character set, and must be the canonical name of a " +"character set." msgstr "" -msgid "Optional *header_enc* and *body_enc* is either ``charset.QP`` for quoted-printable, ``charset.BASE64`` for base64 encoding, ``charset.SHORTEST`` for the shortest of quoted-printable or base64 encoding, or ``None`` for no encoding. ``SHORTEST`` is only valid for *header_enc*. The default is ``None`` for no encoding." +#: ../../library/email.charset.rst:178 +msgid "" +"Optional *header_enc* and *body_enc* is either ``charset.QP`` for quoted-" +"printable, ``charset.BASE64`` for base64 encoding, ``charset.SHORTEST`` for " +"the shortest of quoted-printable or base64 encoding, or ``None`` for no " +"encoding. ``SHORTEST`` is only valid for *header_enc*. The default is " +"``None`` for no encoding." msgstr "" -msgid "Optional *output_charset* is the character set that the output should be in. Conversions will proceed from input charset, to Unicode, to the output charset when the method :meth:`Charset.convert` is called. The default is to output in the same character set as the input." +#: ../../library/email.charset.rst:184 +msgid "" +"Optional *output_charset* is the character set that the output should be in. " +"Conversions will proceed from input charset, to Unicode, to the output " +"charset when the method :meth:`Charset.convert` is called. The default is " +"to output in the same character set as the input." msgstr "" -msgid "Both *input_charset* and *output_charset* must have Unicode codec entries in the module's character set-to-codec mapping; use :func:`add_codec` to add codecs the module does not know about. See the :mod:`codecs` module's documentation for more information." +#: ../../library/email.charset.rst:189 +msgid "" +"Both *input_charset* and *output_charset* must have Unicode codec entries in " +"the module's character set-to-codec mapping; use :func:`add_codec` to add " +"codecs the module does not know about. See the :mod:`codecs` module's " +"documentation for more information." msgstr "" -msgid "The global character set registry is kept in the module global dictionary ``CHARSETS``." +#: ../../library/email.charset.rst:194 +msgid "" +"The global character set registry is kept in the module global dictionary " +"``CHARSETS``." msgstr "" -msgid "Add a character set alias. *alias* is the alias name, e.g. ``latin-1``. *canonical* is the character set's canonical name, e.g. ``iso-8859-1``." +#: ../../library/email.charset.rst:200 +msgid "" +"Add a character set alias. *alias* is the alias name, e.g. ``latin-1``. " +"*canonical* is the character set's canonical name, e.g. ``iso-8859-1``." msgstr "" -msgid "The global charset alias registry is kept in the module global dictionary ``ALIASES``." +#: ../../library/email.charset.rst:203 +msgid "" +"The global charset alias registry is kept in the module global dictionary " +"``ALIASES``." msgstr "" -msgid "Add a codec that map characters in the given character set to and from Unicode." +#: ../../library/email.charset.rst:209 +msgid "" +"Add a codec that map characters in the given character set to and from " +"Unicode." msgstr "" -msgid "*charset* is the canonical name of a character set. *codecname* is the name of a Python codec, as appropriate for the second argument to the :class:`str`'s :meth:`~str.encode` method." +#: ../../library/email.charset.rst:211 +msgid "" +"*charset* is the canonical name of a character set. *codecname* is the name " +"of a Python codec, as appropriate for the second argument to " +"the :class:`str`'s :meth:`~str.encode` method." msgstr "" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index c322fd0e3..6dec33b3b 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,45 +21,121 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid ":mod:`email.message.Message`: Representing an email message using the :data:`~email.policy.compat32` API" +#: ../../library/email.compat32-message.rst:4 +msgid "" +":mod:`email.message.Message`: Representing an email message using " +"the :data:`~email.policy.compat32` API" msgstr "" -msgid "The :class:`Message` class is very similar to the :class:`~email.message.EmailMessage` class, without the methods added by that class, and with the default behavior of certain other methods being slightly different. We also document here some methods that, while supported by the :class:`~email.message.EmailMessage` class, are not recommended unless you are dealing with legacy code." +#: ../../library/email.compat32-message.rst:13 +msgid "" +"The :class:`Message` class is very similar to " +"the :class:`~email.message.EmailMessage` class, without the methods added by " +"that class, and with the default behavior of certain other methods being " +"slightly different. We also document here some methods that, while " +"supported by the :class:`~email.message.EmailMessage` class, are not " +"recommended unless you are dealing with legacy code." msgstr "" +#: ../../library/email.compat32-message.rst:20 msgid "The philosophy and structure of the two classes is otherwise the same." msgstr "" -msgid "This document describes the behavior under the default (for :class:`Message`) policy :attr:`~email.policy.Compat32`. If you are going to use another policy, you should be using the :class:`~email.message.EmailMessage` class instead." -msgstr "" - -msgid "An email message consists of *headers* and a *payload*. Headers must be :rfc:`5322` style names and values, where the field name and value are separated by a colon. The colon is not part of either the field name or the field value. The payload may be a simple text message, or a binary object, or a structured sequence of sub-messages each with their own set of headers and their own payload. The latter type of payload is indicated by the message having a MIME type such as :mimetype:`multipart/\\*` or :mimetype:`message/rfc822`." +#: ../../library/email.compat32-message.rst:22 +msgid "" +"This document describes the behavior under the default " +"(for :class:`Message`) policy :attr:`~email.policy.Compat32`. If you are " +"going to use another policy, you should be using " +"the :class:`~email.message.EmailMessage` class instead." msgstr "" -msgid "The conceptual model provided by a :class:`Message` object is that of an ordered dictionary of headers with additional methods for accessing both specialized information from the headers, for accessing the payload, for generating a serialized version of the message, and for recursively walking over the object tree. Note that duplicate headers are supported but special methods must be used to access them." +#: ../../library/email.compat32-message.rst:26 +msgid "" +"An email message consists of *headers* and a *payload*. Headers must " +"be :rfc:`5322` style names and values, where the field name and value are " +"separated by a colon. The colon is not part of either the field name or the " +"field value. The payload may be a simple text message, or a binary object, " +"or a structured sequence of sub-messages each with their own set of headers " +"and their own payload. The latter type of payload is indicated by the " +"message having a MIME type such as :mimetype:`multipart/\\*` " +"or :mimetype:`message/rfc822`." msgstr "" -msgid "The :class:`Message` pseudo-dictionary is indexed by the header names, which must be ASCII values. The values of the dictionary are strings that are supposed to contain only ASCII characters; there is some special handling for non-ASCII input, but it doesn't always produce the correct results. Headers are stored and returned in case-preserving form, but field names are matched case-insensitively. There may also be a single envelope header, also known as the *Unix-From* header or the ``From_`` header. The *payload* is either a string or bytes, in the case of simple message objects, or a list of :class:`Message` objects, for MIME container documents (e.g. :mimetype:`multipart/\\*` and :mimetype:`message/rfc822`)." +#: ../../library/email.compat32-message.rst:35 +msgid "" +"The conceptual model provided by a :class:`Message` object is that of an " +"ordered dictionary of headers with additional methods for accessing both " +"specialized information from the headers, for accessing the payload, for " +"generating a serialized version of the message, and for recursively walking " +"over the object tree. Note that duplicate headers are supported but special " +"methods must be used to access them." msgstr "" +#: ../../library/email.compat32-message.rst:42 +msgid "" +"The :class:`Message` pseudo-dictionary is indexed by the header names, which " +"must be ASCII values. The values of the dictionary are strings that are " +"supposed to contain only ASCII characters; there is some special handling " +"for non-ASCII input, but it doesn't always produce the correct results. " +"Headers are stored and returned in case-preserving form, but field names are " +"matched case-insensitively. There may also be a single envelope header, " +"also known as the *Unix-From* header or the ``From_`` header. The *payload* " +"is either a string or bytes, in the case of simple message objects, or a " +"list of :class:`Message` objects, for MIME container documents " +"(e.g. :mimetype:`multipart/\\*` and :mimetype:`message/rfc822`)." +msgstr "" + +#: ../../library/email.compat32-message.rst:53 msgid "Here are the methods of the :class:`Message` class:" msgstr "" -msgid "If *policy* is specified (it must be an instance of a :mod:`~email.policy` class) use the rules it specifies to update and serialize the representation of the message. If *policy* is not set, use the :class:`compat32 ` policy, which maintains backward compatibility with the Python 3.2 version of the email package. For more information see the :mod:`~email.policy` documentation." +#: ../../library/email.compat32-message.rst:58 +msgid "" +"If *policy* is specified (it must be an instance of a :mod:`~email.policy` " +"class) use the rules it specifies to update and serialize the representation " +"of the message. If *policy* is not set, use the :class:`compat32 " +"` policy, which maintains backward compatibility with " +"the Python 3.2 version of the email package. For more information see " +"the :mod:`~email.policy` documentation." msgstr "" +#: ../../library/email.compat32-message.rst:65 msgid "The *policy* keyword argument was added." msgstr "" -msgid "Return the entire message flattened as a string. When optional *unixfrom* is true, the envelope header is included in the returned string. *unixfrom* defaults to ``False``. For backward compatibility reasons, *maxheaderlen* defaults to ``0``, so if you want a different value you must override it explicitly (the value specified for *max_line_length* in the policy will be ignored by this method). The *policy* argument may be used to override the default policy obtained from the message instance. This can be used to control some of the formatting produced by the method, since the specified *policy* will be passed to the ``Generator``." -msgstr "" - -msgid "Flattening the message may trigger changes to the :class:`Message` if defaults need to be filled in to complete the transformation to a string (for example, MIME boundaries may be generated or modified)." +#: ../../library/email.compat32-message.rst:70 +msgid "" +"Return the entire message flattened as a string. When optional *unixfrom* " +"is true, the envelope header is included in the returned string. *unixfrom* " +"defaults to ``False``. For backward compatibility reasons, *maxheaderlen* " +"defaults to ``0``, so if you want a different value you must override it " +"explicitly (the value specified for *max_line_length* in the policy will be " +"ignored by this method). The *policy* argument may be used to override the " +"default policy obtained from the message instance. This can be used to " +"control some of the formatting produced by the method, since the specified " +"*policy* will be passed to the ``Generator``." +msgstr "" + +#: ../../library/email.compat32-message.rst:80 +#: ../../library/email.compat32-message.rst:122 +msgid "" +"Flattening the message may trigger changes to the :class:`Message` if " +"defaults need to be filled in to complete the transformation to a string " +"(for example, MIME boundaries may be generated or modified)." msgstr "" -msgid "Note that this method is provided as a convenience and may not always format the message the way you want. For example, by default it does not do the mangling of lines that begin with ``From`` that is required by the Unix mbox format. For more flexibility, instantiate a :class:`~email.generator.Generator` instance and use its :meth:`~email.generator.Generator.flatten` method directly. For example::" +#: ../../library/email.compat32-message.rst:84 +msgid "" +"Note that this method is provided as a convenience and may not always format " +"the message the way you want. For example, by default it does not do the " +"mangling of lines that begin with ``From`` that is required by the Unix mbox " +"format. For more flexibility, instantiate " +"a :class:`~email.generator.Generator` instance and use " +"its :meth:`~email.generator.Generator.flatten` method directly. For " +"example::" msgstr "" +#: ../../library/email.compat32-message.rst:91 msgid "" "from io import StringIO\n" "from email.generator import Generator\n" @@ -69,21 +145,46 @@ msgid "" "text = fp.getvalue()" msgstr "" -msgid "If the message object contains binary data that is not encoded according to RFC standards, the non-compliant data will be replaced by unicode \"unknown character\" code points. (See also :meth:`.as_bytes` and :class:`~email.generator.BytesGenerator`.)" +#: ../../library/email.compat32-message.rst:98 +msgid "" +"If the message object contains binary data that is not encoded according to " +"RFC standards, the non-compliant data will be replaced by unicode \"unknown " +"character\" code points. (See also :meth:`.as_bytes` " +"and :class:`~email.generator.BytesGenerator`.)" msgstr "" +#: ../../library/email.compat32-message.rst:103 msgid "the *policy* keyword argument was added." msgstr "" -msgid "Equivalent to :meth:`.as_string`. Allows ``str(msg)`` to produce a string containing the formatted message." +#: ../../library/email.compat32-message.rst:108 +msgid "" +"Equivalent to :meth:`.as_string`. Allows ``str(msg)`` to produce a string " +"containing the formatted message." msgstr "" -msgid "Return the entire message flattened as a bytes object. When optional *unixfrom* is true, the envelope header is included in the returned string. *unixfrom* defaults to ``False``. The *policy* argument may be used to override the default policy obtained from the message instance. This can be used to control some of the formatting produced by the method, since the specified *policy* will be passed to the ``BytesGenerator``." +#: ../../library/email.compat32-message.rst:114 +msgid "" +"Return the entire message flattened as a bytes object. When optional " +"*unixfrom* is true, the envelope header is included in the returned string. " +"*unixfrom* defaults to ``False``. The *policy* argument may be used to " +"override the default policy obtained from the message instance. This can be " +"used to control some of the formatting produced by the method, since the " +"specified *policy* will be passed to the ``BytesGenerator``." msgstr "" -msgid "Note that this method is provided as a convenience and may not always format the message the way you want. For example, by default it does not do the mangling of lines that begin with ``From`` that is required by the Unix mbox format. For more flexibility, instantiate a :class:`~email.generator.BytesGenerator` instance and use its :meth:`~email.generator.BytesGenerator.flatten` method directly. For example::" +#: ../../library/email.compat32-message.rst:126 +msgid "" +"Note that this method is provided as a convenience and may not always format " +"the message the way you want. For example, by default it does not do the " +"mangling of lines that begin with ``From`` that is required by the Unix mbox " +"format. For more flexibility, instantiate " +"a :class:`~email.generator.BytesGenerator` instance and use " +"its :meth:`~email.generator.BytesGenerator.flatten` method directly. For " +"example::" msgstr "" +#: ../../library/email.compat32-message.rst:134 msgid "" "from io import BytesIO\n" "from email.generator import BytesGenerator\n" @@ -93,266 +194,638 @@ msgid "" "text = fp.getvalue()" msgstr "" -msgid "Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes object containing the formatted message." -msgstr "" - -msgid "Return ``True`` if the message's payload is a list of sub-\\ :class:`Message` objects, otherwise return ``False``. When :meth:`is_multipart` returns ``False``, the payload should be a string object (which might be a CTE encoded binary payload). (Note that :meth:`is_multipart` returning ``True`` does not necessarily mean that \"msg.get_content_maintype() == 'multipart'\" will return the ``True``. For example, ``is_multipart`` will return ``True`` when the :class:`Message` is of type ``message/rfc822``.)" -msgstr "" - -msgid "Set the message's envelope header to *unixfrom*, which should be a string." -msgstr "" - -msgid "Return the message's envelope header. Defaults to ``None`` if the envelope header was never set." +#: ../../library/email.compat32-message.rst:146 +msgid "" +"Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes " +"object containing the formatted message." msgstr "" -msgid "Add the given *payload* to the current payload, which must be ``None`` or a list of :class:`Message` objects before the call. After the call, the payload will always be a list of :class:`Message` objects. If you want to set the payload to a scalar object (e.g. a string), use :meth:`set_payload` instead." +#: ../../library/email.compat32-message.rst:154 +msgid "" +"Return ``True`` if the message's payload is a list of sub-" +"\\ :class:`Message` objects, otherwise return ``False``. " +"When :meth:`is_multipart` returns ``False``, the payload should be a string " +"object (which might be a CTE encoded binary payload). (Note " +"that :meth:`is_multipart` returning ``True`` does not necessarily mean that " +"\"msg.get_content_maintype() == 'multipart'\" will return the ``True``. For " +"example, ``is_multipart`` will return ``True`` when the :class:`Message` is " +"of type ``message/rfc822``.)" msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class its functionality is replaced by :meth:`~email.message.EmailMessage.set_content` and the related ``make`` and ``add`` methods." +#: ../../library/email.compat32-message.rst:166 +msgid "" +"Set the message's envelope header to *unixfrom*, which should be a string." msgstr "" -msgid "Return the current payload, which will be a list of :class:`Message` objects when :meth:`is_multipart` is ``True``, or a string when :meth:`is_multipart` is ``False``. If the payload is a list and you mutate the list object, you modify the message's payload in place." +#: ../../library/email.compat32-message.rst:171 +msgid "" +"Return the message's envelope header. Defaults to ``None`` if the envelope " +"header was never set." msgstr "" -msgid "With optional argument *i*, :meth:`get_payload` will return the *i*-th element of the payload, counting from zero, if :meth:`is_multipart` is ``True``. An :exc:`IndexError` will be raised if *i* is less than 0 or greater than or equal to the number of items in the payload. If the payload is a string (i.e. :meth:`is_multipart` is ``False``) and *i* is given, a :exc:`TypeError` is raised." +#: ../../library/email.compat32-message.rst:177 +msgid "" +"Add the given *payload* to the current payload, which must be ``None`` or a " +"list of :class:`Message` objects before the call. After the call, the " +"payload will always be a list of :class:`Message` objects. If you want to " +"set the payload to a scalar object (e.g. a string), use :meth:`set_payload` " +"instead." msgstr "" -msgid "Optional *decode* is a flag indicating whether the payload should be decoded or not, according to the :mailheader:`Content-Transfer-Encoding` header. When ``True`` and the message is not a multipart, the payload will be decoded if this header's value is ``quoted-printable`` or ``base64``. If some other encoding is used, or :mailheader:`Content-Transfer-Encoding` header is missing, the payload is returned as-is (undecoded). In all cases the returned value is binary data. If the message is a multipart and the *decode* flag is ``True``, then ``None`` is returned. If the payload is base64 and it was not perfectly formed (missing padding, characters outside the base64 alphabet), then an appropriate defect will be added to the message's defect property (:class:`~email.errors.InvalidBase64PaddingDefect` or :class:`~email.errors.InvalidBase64CharactersDefect`, respectively)." +#: ../../library/email.compat32-message.rst:183 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced " +"by :meth:`~email.message.EmailMessage.set_content` and the related ``make`` " +"and ``add`` methods." msgstr "" -msgid "When *decode* is ``False`` (the default) the body is returned as a string without decoding the :mailheader:`Content-Transfer-Encoding`. However, for a :mailheader:`Content-Transfer-Encoding` of 8bit, an attempt is made to decode the original bytes using the ``charset`` specified by the :mailheader:`Content-Type` header, using the ``replace`` error handler. If no ``charset`` is specified, or if the ``charset`` given is not recognized by the email package, the body is decoded using the default ASCII charset." +#: ../../library/email.compat32-message.rst:191 +msgid "" +"Return the current payload, which will be a list of :class:`Message` objects " +"when :meth:`is_multipart` is ``True``, or a string when :meth:`is_multipart` " +"is ``False``. If the payload is a list and you mutate the list object, you " +"modify the message's payload in place." msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class its functionality is replaced by :meth:`~email.message.EmailMessage.get_content` and :meth:`~email.message.EmailMessage.iter_parts`." +#: ../../library/email.compat32-message.rst:196 +msgid "" +"With optional argument *i*, :meth:`get_payload` will return the *i*-th " +"element of the payload, counting from zero, if :meth:`is_multipart` is " +"``True``. An :exc:`IndexError` will be raised if *i* is less than 0 or " +"greater than or equal to the number of items in the payload. If the payload " +"is a string (i.e. :meth:`is_multipart` is ``False``) and *i* is given, " +"a :exc:`TypeError` is raised." msgstr "" -msgid "Set the entire message object's payload to *payload*. It is the client's responsibility to ensure the payload invariants. Optional *charset* sets the message's default character set; see :meth:`set_charset` for details." +#: ../../library/email.compat32-message.rst:203 +msgid "" +"Optional *decode* is a flag indicating whether the payload should be decoded " +"or not, according to the :mailheader:`Content-Transfer-Encoding` header. " +"When ``True`` and the message is not a multipart, the payload will be " +"decoded if this header's value is ``quoted-printable`` or ``base64``. If " +"some other encoding is used, or :mailheader:`Content-Transfer-Encoding` " +"header is missing, the payload is returned as-is (undecoded). In all cases " +"the returned value is binary data. If the message is a multipart and the " +"*decode* flag is ``True``, then ``None`` is returned. If the payload is " +"base64 and it was not perfectly formed (missing padding, characters outside " +"the base64 alphabet), then an appropriate defect will be added to the " +"message's defect property (:class:`~email.errors.InvalidBase64PaddingDefect` " +"or :class:`~email.errors.InvalidBase64CharactersDefect`, respectively)." +msgstr "" + +#: ../../library/email.compat32-message.rst:217 +msgid "" +"When *decode* is ``False`` (the default) the body is returned as a string " +"without decoding the :mailheader:`Content-Transfer-Encoding`. However, for " +"a :mailheader:`Content-Transfer-Encoding` of 8bit, an attempt is made to " +"decode the original bytes using the ``charset`` specified by " +"the :mailheader:`Content-Type` header, using the ``replace`` error handler. " +"If no ``charset`` is specified, or if the ``charset`` given is not " +"recognized by the email package, the body is decoded using the default ASCII " +"charset." msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class its functionality is replaced by :meth:`~email.message.EmailMessage.set_content`." +#: ../../library/email.compat32-message.rst:226 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced " +"by :meth:`~email.message.EmailMessage.get_content` " +"and :meth:`~email.message.EmailMessage.iter_parts`." msgstr "" -msgid "Set the character set of the payload to *charset*, which can either be a :class:`~email.charset.Charset` instance (see :mod:`email.charset`), a string naming a character set, or ``None``. If it is a string, it will be converted to a :class:`~email.charset.Charset` instance. If *charset* is ``None``, the ``charset`` parameter will be removed from the :mailheader:`Content-Type` header (the message will not be otherwise modified). Anything else will generate a :exc:`TypeError`." +#: ../../library/email.compat32-message.rst:234 +msgid "" +"Set the entire message object's payload to *payload*. It is the client's " +"responsibility to ensure the payload invariants. Optional *charset* sets " +"the message's default character set; see :meth:`set_charset` for details." msgstr "" -msgid "If there is no existing :mailheader:`MIME-Version` header one will be added. If there is no existing :mailheader:`Content-Type` header, one will be added with a value of :mimetype:`text/plain`. Whether the :mailheader:`Content-Type` header already exists or not, its ``charset`` parameter will be set to *charset.output_charset*. If *charset.input_charset* and *charset.output_charset* differ, the payload will be re-encoded to the *output_charset*. If there is no existing :mailheader:`Content-Transfer-Encoding` header, then the payload will be transfer-encoded, if needed, using the specified :class:`~email.charset.Charset`, and a header with the appropriate value will be added. If a :mailheader:`Content-Transfer-Encoding` header already exists, the payload is assumed to already be correctly encoded using that :mailheader:`Content-Transfer-Encoding` and is not modified." +#: ../../library/email.compat32-message.rst:238 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced " +"by :meth:`~email.message.EmailMessage.set_content`." msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class its functionality is replaced by the *charset* parameter of the :meth:`email.message.EmailMessage.set_content` method." +#: ../../library/email.compat32-message.rst:245 +msgid "" +"Set the character set of the payload to *charset*, which can either be " +"a :class:`~email.charset.Charset` instance (see :mod:`email.charset`), a " +"string naming a character set, or ``None``. If it is a string, it will be " +"converted to a :class:`~email.charset.Charset` instance. If *charset* is " +"``None``, the ``charset`` parameter will be removed from " +"the :mailheader:`Content-Type` header (the message will not be otherwise " +"modified). Anything else will generate a :exc:`TypeError`." msgstr "" -msgid "Return the :class:`~email.charset.Charset` instance associated with the message's payload." +#: ../../library/email.compat32-message.rst:253 +msgid "" +"If there is no existing :mailheader:`MIME-Version` header one will be " +"added. If there is no existing :mailheader:`Content-Type` header, one will " +"be added with a value of :mimetype:`text/plain`. Whether " +"the :mailheader:`Content-Type` header already exists or not, its ``charset`` " +"parameter will be set to *charset.output_charset*. If " +"*charset.input_charset* and *charset.output_charset* differ, the payload " +"will be re-encoded to the *output_charset*. If there is no " +"existing :mailheader:`Content-Transfer-Encoding` header, then the payload " +"will be transfer-encoded, if needed, using the " +"specified :class:`~email.charset.Charset`, and a header with the appropriate " +"value will be added. If a :mailheader:`Content-Transfer-Encoding` header " +"already exists, the payload is assumed to already be correctly encoded using " +"that :mailheader:`Content-Transfer-Encoding` and is not modified." +msgstr "" + +#: ../../library/email.compat32-message.rst:267 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by the *charset* parameter of " +"the :meth:`email.message.EmailMessage.set_content` method." msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class it always returns ``None``." +#: ../../library/email.compat32-message.rst:275 +msgid "" +"Return the :class:`~email.charset.Charset` instance associated with the " +"message's payload." msgstr "" -msgid "The following methods implement a mapping-like interface for accessing the message's :rfc:`2822` headers. Note that there are some semantic differences between these methods and a normal mapping (i.e. dictionary) interface. For example, in a dictionary there are no duplicate keys, but here there may be duplicate message headers. Also, in dictionaries there is no guaranteed order to the keys returned by :meth:`keys`, but in a :class:`Message` object, headers are always returned in the order they appeared in the original message, or were added to the message later. Any header deleted and then re-added are always appended to the end of the header list." +#: ../../library/email.compat32-message.rst:278 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"it always returns ``None``." msgstr "" -msgid "These semantic differences are intentional and are biased toward maximal convenience." +#: ../../library/email.compat32-message.rst:283 +msgid "" +"The following methods implement a mapping-like interface for accessing the " +"message's :rfc:`2822` headers. Note that there are some semantic " +"differences between these methods and a normal mapping (i.e. dictionary) " +"interface. For example, in a dictionary there are no duplicate keys, but " +"here there may be duplicate message headers. Also, in dictionaries there is " +"no guaranteed order to the keys returned by :meth:`keys`, but in " +"a :class:`Message` object, headers are always returned in the order they " +"appeared in the original message, or were added to the message later. Any " +"header deleted and then re-added are always appended to the end of the " +"header list." +msgstr "" + +#: ../../library/email.compat32-message.rst:293 +msgid "" +"These semantic differences are intentional and are biased toward maximal " +"convenience." msgstr "" -msgid "Note that in all cases, any envelope header present in the message is not included in the mapping interface." +#: ../../library/email.compat32-message.rst:296 +msgid "" +"Note that in all cases, any envelope header present in the message is not " +"included in the mapping interface." msgstr "" -msgid "In a model generated from bytes, any header values that (in contravention of the RFCs) contain non-ASCII bytes will, when retrieved through this interface, be represented as :class:`~email.header.Header` objects with a charset of ``unknown-8bit``." +#: ../../library/email.compat32-message.rst:299 +msgid "" +"In a model generated from bytes, any header values that (in contravention of " +"the RFCs) contain non-ASCII bytes will, when retrieved through this " +"interface, be represented as :class:`~email.header.Header` objects with a " +"charset of ``unknown-8bit``." msgstr "" +#: ../../library/email.compat32-message.rst:307 msgid "Return the total number of headers, including duplicates." msgstr "" -msgid "Return ``True`` if the message object has a field named *name*. Matching is done case-insensitively and *name* should not include the trailing colon. Used for the ``in`` operator, e.g.::" +#: ../../library/email.compat32-message.rst:312 +msgid "" +"Return ``True`` if the message object has a field named *name*. Matching is " +"done case-insensitively and *name* should not include the trailing colon. " +"Used for the ``in`` operator, e.g.::" msgstr "" +#: ../../library/email.compat32-message.rst:316 msgid "" "if 'message-id' in myMessage:\n" " print('Message-ID:', myMessage['message-id'])" msgstr "" -msgid "Return the value of the named header field. *name* should not include the colon field separator. If the header is missing, ``None`` is returned; a :exc:`KeyError` is never raised." +#: ../../library/email.compat32-message.rst:322 +msgid "" +"Return the value of the named header field. *name* should not include the " +"colon field separator. If the header is missing, ``None`` is returned; " +"a :exc:`KeyError` is never raised." msgstr "" -msgid "Note that if the named field appears more than once in the message's headers, exactly which of those field values will be returned is undefined. Use the :meth:`get_all` method to get the values of all the extant named headers." +#: ../../library/email.compat32-message.rst:326 +msgid "" +"Note that if the named field appears more than once in the message's " +"headers, exactly which of those field values will be returned is undefined. " +"Use the :meth:`get_all` method to get the values of all the extant named " +"headers." msgstr "" -msgid "Add a header to the message with field name *name* and value *val*. The field is appended to the end of the message's existing fields." +#: ../../library/email.compat32-message.rst:334 +msgid "" +"Add a header to the message with field name *name* and value *val*. The " +"field is appended to the end of the message's existing fields." msgstr "" -msgid "Note that this does *not* overwrite or delete any existing header with the same name. If you want to ensure that the new header is the only one present in the message with field name *name*, delete the field first, e.g.::" +#: ../../library/email.compat32-message.rst:337 +msgid "" +"Note that this does *not* overwrite or delete any existing header with the " +"same name. If you want to ensure that the new header is the only one " +"present in the message with field name *name*, delete the field first, e.g.::" msgstr "" +#: ../../library/email.compat32-message.rst:341 msgid "" "del msg['subject']\n" "msg['subject'] = 'Python roolz!'" msgstr "" -msgid "Delete all occurrences of the field with name *name* from the message's headers. No exception is raised if the named field isn't present in the headers." +#: ../../library/email.compat32-message.rst:347 +msgid "" +"Delete all occurrences of the field with name *name* from the message's " +"headers. No exception is raised if the named field isn't present in the " +"headers." msgstr "" +#: ../../library/email.compat32-message.rst:354 msgid "Return a list of all the message's header field names." msgstr "" +#: ../../library/email.compat32-message.rst:359 msgid "Return a list of all the message's field values." msgstr "" -msgid "Return a list of 2-tuples containing all the message's field headers and values." +#: ../../library/email.compat32-message.rst:364 +msgid "" +"Return a list of 2-tuples containing all the message's field headers and " +"values." msgstr "" -msgid "Return the value of the named header field. This is identical to :meth:`~object.__getitem__` except that optional *failobj* is returned if the named header is missing (defaults to ``None``)." +#: ../../library/email.compat32-message.rst:370 +msgid "" +"Return the value of the named header field. This is identical " +"to :meth:`~object.__getitem__` except that optional *failobj* is returned if " +"the named header is missing (defaults to ``None``)." msgstr "" +#: ../../library/email.compat32-message.rst:374 msgid "Here are some additional useful methods:" msgstr "" -msgid "Return a list of all the values for the field named *name*. If there are no such named headers in the message, *failobj* is returned (defaults to ``None``)." -msgstr "" - -msgid "Extended header setting. This method is similar to :meth:`__setitem__` except that additional header parameters can be provided as keyword arguments. *_name* is the header field to add and *_value* is the *primary* value for the header." +#: ../../library/email.compat32-message.rst:379 +msgid "" +"Return a list of all the values for the field named *name*. If there are no " +"such named headers in the message, *failobj* is returned (defaults to " +"``None``)." msgstr "" -msgid "For each item in the keyword argument dictionary *_params*, the key is taken as the parameter name, with underscores converted to dashes (since dashes are illegal in Python identifiers). Normally, the parameter will be added as ``key=\"value\"`` unless the value is ``None``, in which case only the key will be added. If the value contains non-ASCII characters, it can be specified as a three tuple in the format ``(CHARSET, LANGUAGE, VALUE)``, where ``CHARSET`` is a string naming the charset to be used to encode the value, ``LANGUAGE`` can usually be set to ``None`` or the empty string (see :rfc:`2231` for other possibilities), and ``VALUE`` is the string value containing non-ASCII code points. If a three tuple is not passed and the value contains non-ASCII characters, it is automatically encoded in :rfc:`2231` format using a ``CHARSET`` of ``utf-8`` and a ``LANGUAGE`` of ``None``." +#: ../../library/email.compat32-message.rst:386 +msgid "" +"Extended header setting. This method is similar to :meth:`__setitem__` " +"except that additional header parameters can be provided as keyword " +"arguments. *_name* is the header field to add and *_value* is the *primary* " +"value for the header." msgstr "" +#: ../../library/email.compat32-message.rst:391 +msgid "" +"For each item in the keyword argument dictionary *_params*, the key is taken " +"as the parameter name, with underscores converted to dashes (since dashes " +"are illegal in Python identifiers). Normally, the parameter will be added " +"as ``key=\"value\"`` unless the value is ``None``, in which case only the " +"key will be added. If the value contains non-ASCII characters, it can be " +"specified as a three tuple in the format ``(CHARSET, LANGUAGE, VALUE)``, " +"where ``CHARSET`` is a string naming the charset to be used to encode the " +"value, ``LANGUAGE`` can usually be set to ``None`` or the empty string " +"(see :rfc:`2231` for other possibilities), and ``VALUE`` is the string value " +"containing non-ASCII code points. If a three tuple is not passed and the " +"value contains non-ASCII characters, it is automatically encoded " +"in :rfc:`2231` format using a ``CHARSET`` of ``utf-8`` and a ``LANGUAGE`` of " +"``None``." +msgstr "" + +#: ../../library/email.compat32-message.rst:405 msgid "Here's an example::" msgstr "" +#: ../../library/email.compat32-message.rst:407 msgid "msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" msgstr "" +#: ../../library/email.compat32-message.rst:409 msgid "This will add a header that looks like ::" msgstr "" +#: ../../library/email.compat32-message.rst:411 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" msgstr "" +#: ../../library/email.compat32-message.rst:413 msgid "An example with non-ASCII characters::" msgstr "" +#: ../../library/email.compat32-message.rst:415 msgid "" "msg.add_header('Content-Disposition', 'attachment',\n" " filename=('iso-8859-1', '', 'Fußballer.ppt'))" msgstr "" +#: ../../library/email.compat32-message.rst:418 msgid "Which produces ::" msgstr "" -msgid "Content-Disposition: attachment; filename*=\"iso-8859-1''Fu%DFballer.ppt\"" +#: ../../library/email.compat32-message.rst:420 +msgid "" +"Content-Disposition: attachment; filename*=\"iso-8859-1''Fu%DFballer.ppt\"" msgstr "" -msgid "Replace a header. Replace the first header found in the message that matches *_name*, retaining header order and field name case. If no matching header was found, a :exc:`KeyError` is raised." +#: ../../library/email.compat32-message.rst:425 +msgid "" +"Replace a header. Replace the first header found in the message that " +"matches *_name*, retaining header order and field name case. If no matching " +"header was found, a :exc:`KeyError` is raised." msgstr "" -msgid "Return the message's content type. The returned string is coerced to lower case of the form :mimetype:`maintype/subtype`. If there was no :mailheader:`Content-Type` header in the message the default type as given by :meth:`get_default_type` will be returned. Since according to :rfc:`2045`, messages always have a default type, :meth:`get_content_type` will always return a value." +#: ../../library/email.compat32-message.rst:432 +msgid "" +"Return the message's content type. The returned string is coerced to lower " +"case of the form :mimetype:`maintype/subtype`. If there was " +"no :mailheader:`Content-Type` header in the message the default type as " +"given by :meth:`get_default_type` will be returned. Since according " +"to :rfc:`2045`, messages always have a default " +"type, :meth:`get_content_type` will always return a value." msgstr "" -msgid ":rfc:`2045` defines a message's default type to be :mimetype:`text/plain` unless it appears inside a :mimetype:`multipart/digest` container, in which case it would be :mimetype:`message/rfc822`. If the :mailheader:`Content-Type` header has an invalid type specification, :rfc:`2045` mandates that the default type be :mimetype:`text/plain`." +#: ../../library/email.compat32-message.rst:439 +msgid "" +":rfc:`2045` defines a message's default type to be :mimetype:`text/plain` " +"unless it appears inside a :mimetype:`multipart/digest` container, in which " +"case it would be :mimetype:`message/rfc822`. If the :mailheader:`Content-" +"Type` header has an invalid type specification, :rfc:`2045` mandates that " +"the default type be :mimetype:`text/plain`." msgstr "" -msgid "Return the message's main content type. This is the :mimetype:`maintype` part of the string returned by :meth:`get_content_type`." +#: ../../library/email.compat32-message.rst:448 +msgid "" +"Return the message's main content type. This is the :mimetype:`maintype` " +"part of the string returned by :meth:`get_content_type`." msgstr "" -msgid "Return the message's sub-content type. This is the :mimetype:`subtype` part of the string returned by :meth:`get_content_type`." +#: ../../library/email.compat32-message.rst:454 +msgid "" +"Return the message's sub-content type. This is the :mimetype:`subtype` part " +"of the string returned by :meth:`get_content_type`." msgstr "" -msgid "Return the default content type. Most messages have a default content type of :mimetype:`text/plain`, except for messages that are subparts of :mimetype:`multipart/digest` containers. Such subparts have a default content type of :mimetype:`message/rfc822`." +#: ../../library/email.compat32-message.rst:460 +msgid "" +"Return the default content type. Most messages have a default content type " +"of :mimetype:`text/plain`, except for messages that are subparts " +"of :mimetype:`multipart/digest` containers. Such subparts have a default " +"content type of :mimetype:`message/rfc822`." msgstr "" -msgid "Set the default content type. *ctype* should either be :mimetype:`text/plain` or :mimetype:`message/rfc822`, although this is not enforced. The default content type is not stored in the :mailheader:`Content-Type` header." +#: ../../library/email.compat32-message.rst:468 +msgid "" +"Set the default content type. *ctype* should either be :mimetype:`text/" +"plain` or :mimetype:`message/rfc822`, although this is not enforced. The " +"default content type is not stored in the :mailheader:`Content-Type` header." msgstr "" -msgid "Return the message's :mailheader:`Content-Type` parameters, as a list. The elements of the returned list are 2-tuples of key/value pairs, as split on the ``'='`` sign. The left hand side of the ``'='`` is the key, while the right hand side is the value. If there is no ``'='`` sign in the parameter the value is the empty string, otherwise the value is as described in :meth:`get_param` and is unquoted if optional *unquote* is ``True`` (the default)." +#: ../../library/email.compat32-message.rst:476 +msgid "" +"Return the message's :mailheader:`Content-Type` parameters, as a list. The " +"elements of the returned list are 2-tuples of key/value pairs, as split on " +"the ``'='`` sign. The left hand side of the ``'='`` is the key, while the " +"right hand side is the value. If there is no ``'='`` sign in the parameter " +"the value is the empty string, otherwise the value is as described " +"in :meth:`get_param` and is unquoted if optional *unquote* is ``True`` (the " +"default)." msgstr "" -msgid "Optional *failobj* is the object to return if there is no :mailheader:`Content-Type` header. Optional *header* is the header to search instead of :mailheader:`Content-Type`." +#: ../../library/email.compat32-message.rst:484 +msgid "" +"Optional *failobj* is the object to return if there is " +"no :mailheader:`Content-Type` header. Optional *header* is the header to " +"search instead of :mailheader:`Content-Type`." msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class its functionality is replaced by the *params* property of the individual header objects returned by the header access methods." +#: ../../library/email.compat32-message.rst:488 +#: ../../library/email.compat32-message.rst:526 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by the *params* property of the individual " +"header objects returned by the header access methods." msgstr "" -msgid "Return the value of the :mailheader:`Content-Type` header's parameter *param* as a string. If the message has no :mailheader:`Content-Type` header or if there is no such parameter, then *failobj* is returned (defaults to ``None``)." +#: ../../library/email.compat32-message.rst:496 +msgid "" +"Return the value of the :mailheader:`Content-Type` header's parameter " +"*param* as a string. If the message has no :mailheader:`Content-Type` " +"header or if there is no such parameter, then *failobj* is returned " +"(defaults to ``None``)." msgstr "" -msgid "Optional *header* if given, specifies the message header to use instead of :mailheader:`Content-Type`." +#: ../../library/email.compat32-message.rst:501 +msgid "" +"Optional *header* if given, specifies the message header to use instead " +"of :mailheader:`Content-Type`." msgstr "" -msgid "Parameter keys are always compared case insensitively. The return value can either be a string, or a 3-tuple if the parameter was :rfc:`2231` encoded. When it's a 3-tuple, the elements of the value are of the form ``(CHARSET, LANGUAGE, VALUE)``. Note that both ``CHARSET`` and ``LANGUAGE`` can be ``None``, in which case you should consider ``VALUE`` to be encoded in the ``us-ascii`` charset. You can usually ignore ``LANGUAGE``." +#: ../../library/email.compat32-message.rst:504 +msgid "" +"Parameter keys are always compared case insensitively. The return value can " +"either be a string, or a 3-tuple if the parameter was :rfc:`2231` encoded. " +"When it's a 3-tuple, the elements of the value are of the form ``(CHARSET, " +"LANGUAGE, VALUE)``. Note that both ``CHARSET`` and ``LANGUAGE`` can be " +"``None``, in which case you should consider ``VALUE`` to be encoded in the " +"``us-ascii`` charset. You can usually ignore ``LANGUAGE``." msgstr "" -msgid "If your application doesn't care whether the parameter was encoded as in :rfc:`2231`, you can collapse the parameter value by calling :func:`email.utils.collapse_rfc2231_value`, passing in the return value from :meth:`get_param`. This will return a suitably decoded Unicode string when the value is a tuple, or the original string unquoted if it isn't. For example::" +#: ../../library/email.compat32-message.rst:512 +msgid "" +"If your application doesn't care whether the parameter was encoded as " +"in :rfc:`2231`, you can collapse the parameter value by " +"calling :func:`email.utils.collapse_rfc2231_value`, passing in the return " +"value from :meth:`get_param`. This will return a suitably decoded Unicode " +"string when the value is a tuple, or the original string unquoted if it " +"isn't. For example::" msgstr "" +#: ../../library/email.compat32-message.rst:519 msgid "" "rawparam = msg.get_param('foo')\n" "param = email.utils.collapse_rfc2231_value(rawparam)" msgstr "" -msgid "In any case, the parameter value (either the returned string, or the ``VALUE`` item in the 3-tuple) is always unquoted, unless *unquote* is set to ``False``." +#: ../../library/email.compat32-message.rst:522 +msgid "" +"In any case, the parameter value (either the returned string, or the " +"``VALUE`` item in the 3-tuple) is always unquoted, unless *unquote* is set " +"to ``False``." msgstr "" -msgid "Set a parameter in the :mailheader:`Content-Type` header. If the parameter already exists in the header, its value will be replaced with *value*. If the :mailheader:`Content-Type` header as not yet been defined for this message, it will be set to :mimetype:`text/plain` and the new parameter value will be appended as per :rfc:`2045`." +#: ../../library/email.compat32-message.rst:535 +msgid "" +"Set a parameter in the :mailheader:`Content-Type` header. If the parameter " +"already exists in the header, its value will be replaced with *value*. If " +"the :mailheader:`Content-Type` header as not yet been defined for this " +"message, it will be set to :mimetype:`text/plain` and the new parameter " +"value will be appended as per :rfc:`2045`." msgstr "" -msgid "Optional *header* specifies an alternative header to :mailheader:`Content-Type`, and all parameters will be quoted as necessary unless optional *requote* is ``False`` (the default is ``True``)." +#: ../../library/email.compat32-message.rst:541 +msgid "" +"Optional *header* specifies an alternative header to :mailheader:`Content-" +"Type`, and all parameters will be quoted as necessary unless optional " +"*requote* is ``False`` (the default is ``True``)." msgstr "" -msgid "If optional *charset* is specified, the parameter will be encoded according to :rfc:`2231`. Optional *language* specifies the RFC 2231 language, defaulting to the empty string. Both *charset* and *language* should be strings." +#: ../../library/email.compat32-message.rst:545 +msgid "" +"If optional *charset* is specified, the parameter will be encoded according " +"to :rfc:`2231`. Optional *language* specifies the RFC 2231 language, " +"defaulting to the empty string. Both *charset* and *language* should be " +"strings." msgstr "" -msgid "If *replace* is ``False`` (the default) the header is moved to the end of the list of headers. If *replace* is ``True``, the header will be updated in place." +#: ../../library/email.compat32-message.rst:550 +msgid "" +"If *replace* is ``False`` (the default) the header is moved to the end of " +"the list of headers. If *replace* is ``True``, the header will be updated " +"in place." msgstr "" +#: ../../library/email.compat32-message.rst:554 msgid "``replace`` keyword was added." msgstr "" -msgid "Remove the given parameter completely from the :mailheader:`Content-Type` header. The header will be re-written in place without the parameter or its value. All values will be quoted as necessary unless *requote* is ``False`` (the default is ``True``). Optional *header* specifies an alternative to :mailheader:`Content-Type`." +#: ../../library/email.compat32-message.rst:559 +msgid "" +"Remove the given parameter completely from the :mailheader:`Content-Type` " +"header. The header will be re-written in place without the parameter or its " +"value. All values will be quoted as necessary unless *requote* is ``False`` " +"(the default is ``True``). Optional *header* specifies an alternative " +"to :mailheader:`Content-Type`." msgstr "" -msgid "Set the main type and subtype for the :mailheader:`Content-Type` header. *type* must be a string in the form :mimetype:`maintype/subtype`, otherwise a :exc:`ValueError` is raised." +#: ../../library/email.compat32-message.rst:568 +msgid "" +"Set the main type and subtype for the :mailheader:`Content-Type` header. " +"*type* must be a string in the form :mimetype:`maintype/subtype`, otherwise " +"a :exc:`ValueError` is raised." msgstr "" -msgid "This method replaces the :mailheader:`Content-Type` header, keeping all the parameters in place. If *requote* is ``False``, this leaves the existing header's quoting as is, otherwise the parameters will be quoted (the default)." +#: ../../library/email.compat32-message.rst:572 +msgid "" +"This method replaces the :mailheader:`Content-Type` header, keeping all the " +"parameters in place. If *requote* is ``False``, this leaves the existing " +"header's quoting as is, otherwise the parameters will be quoted (the " +"default)." msgstr "" -msgid "An alternative header can be specified in the *header* argument. When the :mailheader:`Content-Type` header is set a :mailheader:`MIME-Version` header is also added." +#: ../../library/email.compat32-message.rst:577 +msgid "" +"An alternative header can be specified in the *header* argument. When " +"the :mailheader:`Content-Type` header is set a :mailheader:`MIME-Version` " +"header is also added." msgstr "" -msgid "This is a legacy method. On the :class:`~email.message.EmailMessage` class its functionality is replaced by the ``make_`` and ``add_`` methods." +#: ../../library/email.compat32-message.rst:581 +msgid "" +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by the ``make_`` and ``add_`` methods." msgstr "" -msgid "Return the value of the ``filename`` parameter of the :mailheader:`Content-Disposition` header of the message. If the header does not have a ``filename`` parameter, this method falls back to looking for the ``name`` parameter on the :mailheader:`Content-Type` header. If neither is found, or the header is missing, then *failobj* is returned. The returned string will always be unquoted as per :func:`email.utils.unquote`." +#: ../../library/email.compat32-message.rst:588 +msgid "" +"Return the value of the ``filename`` parameter of the :mailheader:`Content-" +"Disposition` header of the message. If the header does not have a " +"``filename`` parameter, this method falls back to looking for the ``name`` " +"parameter on the :mailheader:`Content-Type` header. If neither is found, or " +"the header is missing, then *failobj* is returned. The returned string will " +"always be unquoted as per :func:`email.utils.unquote`." msgstr "" -msgid "Return the value of the ``boundary`` parameter of the :mailheader:`Content-Type` header of the message, or *failobj* if either the header is missing, or has no ``boundary`` parameter. The returned string will always be unquoted as per :func:`email.utils.unquote`." +#: ../../library/email.compat32-message.rst:599 +msgid "" +"Return the value of the ``boundary`` parameter of the :mailheader:`Content-" +"Type` header of the message, or *failobj* if either the header is missing, " +"or has no ``boundary`` parameter. The returned string will always be " +"unquoted as per :func:`email.utils.unquote`." msgstr "" -msgid "Set the ``boundary`` parameter of the :mailheader:`Content-Type` header to *boundary*. :meth:`set_boundary` will always quote *boundary* if necessary. A :exc:`~email.errors.HeaderParseError` is raised if the message object has no :mailheader:`Content-Type` header." +#: ../../library/email.compat32-message.rst:607 +msgid "" +"Set the ``boundary`` parameter of the :mailheader:`Content-Type` header to " +"*boundary*. :meth:`set_boundary` will always quote *boundary* if " +"necessary. A :exc:`~email.errors.HeaderParseError` is raised if the message " +"object has no :mailheader:`Content-Type` header." msgstr "" -msgid "Note that using this method is subtly different than deleting the old :mailheader:`Content-Type` header and adding a new one with the new boundary via :meth:`add_header`, because :meth:`set_boundary` preserves the order of the :mailheader:`Content-Type` header in the list of headers. However, it does *not* preserve any continuation lines which may have been present in the original :mailheader:`Content-Type` header." +#: ../../library/email.compat32-message.rst:612 +msgid "" +"Note that using this method is subtly different than deleting the " +"old :mailheader:`Content-Type` header and adding a new one with the new " +"boundary via :meth:`add_header`, because :meth:`set_boundary` preserves the " +"order of the :mailheader:`Content-Type` header in the list of headers. " +"However, it does *not* preserve any continuation lines which may have been " +"present in the original :mailheader:`Content-Type` header." msgstr "" -msgid "Return the ``charset`` parameter of the :mailheader:`Content-Type` header, coerced to lower case. If there is no :mailheader:`Content-Type` header, or if that header has no ``charset`` parameter, *failobj* is returned." +#: ../../library/email.compat32-message.rst:622 +msgid "" +"Return the ``charset`` parameter of the :mailheader:`Content-Type` header, " +"coerced to lower case. If there is no :mailheader:`Content-Type` header, or " +"if that header has no ``charset`` parameter, *failobj* is returned." msgstr "" -msgid "Note that this method differs from :meth:`get_charset` which returns the :class:`~email.charset.Charset` instance for the default encoding of the message body." +#: ../../library/email.compat32-message.rst:626 +msgid "" +"Note that this method differs from :meth:`get_charset` which returns " +"the :class:`~email.charset.Charset` instance for the default encoding of the " +"message body." msgstr "" -msgid "Return a list containing the character set names in the message. If the message is a :mimetype:`multipart`, then the list will contain one element for each subpart in the payload, otherwise, it will be a list of length 1." +#: ../../library/email.compat32-message.rst:632 +msgid "" +"Return a list containing the character set names in the message. If the " +"message is a :mimetype:`multipart`, then the list will contain one element " +"for each subpart in the payload, otherwise, it will be a list of length 1." msgstr "" -msgid "Each item in the list will be a string which is the value of the ``charset`` parameter in the :mailheader:`Content-Type` header for the represented subpart. However, if the subpart has no :mailheader:`Content-Type` header, no ``charset`` parameter, or is not of the :mimetype:`text` main MIME type, then that item in the returned list will be *failobj*." +#: ../../library/email.compat32-message.rst:636 +msgid "" +"Each item in the list will be a string which is the value of the ``charset`` " +"parameter in the :mailheader:`Content-Type` header for the represented " +"subpart. However, if the subpart has no :mailheader:`Content-Type` header, " +"no ``charset`` parameter, or is not of the :mimetype:`text` main MIME type, " +"then that item in the returned list will be *failobj*." msgstr "" -msgid "Return the lowercased value (without parameters) of the message's :mailheader:`Content-Disposition` header if it has one, or ``None``. The possible values for this method are *inline*, *attachment* or ``None`` if the message follows :rfc:`2183`." +#: ../../library/email.compat32-message.rst:646 +msgid "" +"Return the lowercased value (without parameters) of the " +"message's :mailheader:`Content-Disposition` header if it has one, or " +"``None``. The possible values for this method are *inline*, *attachment* or " +"``None`` if the message follows :rfc:`2183`." msgstr "" -msgid "The :meth:`walk` method is an all-purpose generator which can be used to iterate over all the parts and subparts of a message object tree, in depth-first traversal order. You will typically use :meth:`walk` as the iterator in a ``for`` loop; each iteration returns the next subpart." +#: ../../library/email.compat32-message.rst:655 +msgid "" +"The :meth:`walk` method is an all-purpose generator which can be used to " +"iterate over all the parts and subparts of a message object tree, in depth-" +"first traversal order. You will typically use :meth:`walk` as the iterator " +"in a ``for`` loop; each iteration returns the next subpart." msgstr "" -msgid "Here's an example that prints the MIME type of every part of a multipart message structure:" +#: ../../library/email.compat32-message.rst:660 +msgid "" +"Here's an example that prints the MIME type of every part of a multipart " +"message structure:" msgstr "" +#: ../../library/email.compat32-message.rst:674 msgid "" ">>> for part in msg.walk():\n" "... print(part.get_content_type())\n" @@ -365,9 +838,15 @@ msgid "" "text/plain" msgstr "" -msgid "``walk`` iterates over the subparts of any part where :meth:`is_multipart` returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` may return ``False``. We can see this in our example by making use of the ``_structure`` debug helper function:" +#: ../../library/email.compat32-message.rst:686 +msgid "" +"``walk`` iterates over the subparts of any part where :meth:`is_multipart` " +"returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` " +"may return ``False``. We can see this in our example by making use of the " +"``_structure`` debug helper function:" msgstr "" +#: ../../library/email.compat32-message.rst:692 msgid "" ">>> for part in msg.walk():\n" "... print(part.get_content_maintype() == 'multipart',\n" @@ -389,26 +868,66 @@ msgid "" " text/plain" msgstr "" -msgid "Here the ``message`` parts are not ``multiparts``, but they do contain subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the subparts." -msgstr "" - -msgid ":class:`Message` objects can also optionally contain two instance attributes, which can be used when generating the plain text of a MIME message." +#: ../../library/email.compat32-message.rst:713 +msgid "" +"Here the ``message`` parts are not ``multiparts``, but they do contain " +"subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the " +"subparts." msgstr "" -msgid "The format of a MIME document allows for some text between the blank line following the headers, and the first multipart boundary string. Normally, this text is never visible in a MIME-aware mail reader because it falls outside the standard MIME armor. However, when viewing the raw text of the message, or when viewing the message in a non-MIME aware reader, this text can become visible." +#: ../../library/email.compat32-message.rst:718 +msgid "" +":class:`Message` objects can also optionally contain two instance " +"attributes, which can be used when generating the plain text of a MIME " +"message." msgstr "" -msgid "The *preamble* attribute contains this leading extra-armor text for MIME documents. When the :class:`~email.parser.Parser` discovers some text after the headers but before the first boundary string, it assigns this text to the message's *preamble* attribute. When the :class:`~email.generator.Generator` is writing out the plain text representation of a MIME message, and it finds the message has a *preamble* attribute, it will write this text in the area between the headers and the first boundary. See :mod:`email.parser` and :mod:`email.generator` for details." +#: ../../library/email.compat32-message.rst:724 +msgid "" +"The format of a MIME document allows for some text between the blank line " +"following the headers, and the first multipart boundary string. Normally, " +"this text is never visible in a MIME-aware mail reader because it falls " +"outside the standard MIME armor. However, when viewing the raw text of the " +"message, or when viewing the message in a non-MIME aware reader, this text " +"can become visible." msgstr "" -msgid "Note that if the message object has no preamble, the *preamble* attribute will be ``None``." +#: ../../library/email.compat32-message.rst:731 +msgid "" +"The *preamble* attribute contains this leading extra-armor text for MIME " +"documents. When the :class:`~email.parser.Parser` discovers some text after " +"the headers but before the first boundary string, it assigns this text to " +"the message's *preamble* attribute. When " +"the :class:`~email.generator.Generator` is writing out the plain text " +"representation of a MIME message, and it finds the message has a *preamble* " +"attribute, it will write this text in the area between the headers and the " +"first boundary. See :mod:`email.parser` and :mod:`email.generator` for " +"details." +msgstr "" + +#: ../../library/email.compat32-message.rst:741 +msgid "" +"Note that if the message object has no preamble, the *preamble* attribute " +"will be ``None``." msgstr "" -msgid "The *epilogue* attribute acts the same way as the *preamble* attribute, except that it contains text that appears between the last boundary and the end of the message." +#: ../../library/email.compat32-message.rst:747 +msgid "" +"The *epilogue* attribute acts the same way as the *preamble* attribute, " +"except that it contains text that appears between the last boundary and the " +"end of the message." msgstr "" -msgid "You do not need to set the epilogue to the empty string in order for the :class:`~email.generator.Generator` to print a newline at the end of the file." +#: ../../library/email.compat32-message.rst:751 +msgid "" +"You do not need to set the epilogue to the empty string in order for " +"the :class:`~email.generator.Generator` to print a newline at the end of the " +"file." msgstr "" -msgid "The *defects* attribute contains a list of all the problems found when parsing this message. See :mod:`email.errors` for a detailed description of the possible parsing defects." +#: ../../library/email.compat32-message.rst:758 +msgid "" +"The *defects* attribute contains a list of all the problems found when " +"parsing this message. See :mod:`email.errors` for a detailed description of " +"the possible parsing defects." msgstr "" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index 72b339cc6..dff80e07a 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,128 +23,275 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.contentmanager.rst:2 msgid ":mod:`!email.contentmanager`: Managing MIME Content" msgstr "" +#: ../../library/email.contentmanager.rst:10 msgid "**Source code:** :source:`Lib/email/contentmanager.py`" msgstr "" +#: ../../library/email.contentmanager.rst:14 msgid "[1]_" msgstr "" -msgid "Base class for content managers. Provides the standard registry mechanisms to register converters between MIME content and other representations, as well as the ``get_content`` and ``set_content`` dispatch methods." +#: ../../library/email.contentmanager.rst:19 +msgid "" +"Base class for content managers. Provides the standard registry mechanisms " +"to register converters between MIME content and other representations, as " +"well as the ``get_content`` and ``set_content`` dispatch methods." msgstr "" -msgid "Look up a handler function based on the ``mimetype`` of *msg* (see next paragraph), call it, passing through all arguments, and return the result of the call. The expectation is that the handler will extract the payload from *msg* and return an object that encodes information about the extracted data." +#: ../../library/email.contentmanager.rst:26 +msgid "" +"Look up a handler function based on the ``mimetype`` of *msg* (see next " +"paragraph), call it, passing through all arguments, and return the result of " +"the call. The expectation is that the handler will extract the payload from " +"*msg* and return an object that encodes information about the extracted data." msgstr "" -msgid "To find the handler, look for the following keys in the registry, stopping with the first one found:" +#: ../../library/email.contentmanager.rst:32 +msgid "" +"To find the handler, look for the following keys in the registry, stopping " +"with the first one found:" msgstr "" +#: ../../library/email.contentmanager.rst:35 msgid "the string representing the full MIME type (``maintype/subtype``)" msgstr "" +#: ../../library/email.contentmanager.rst:36 msgid "the string representing the ``maintype``" msgstr "" +#: ../../library/email.contentmanager.rst:37 msgid "the empty string" msgstr "" -msgid "If none of these keys produce a handler, raise a :exc:`KeyError` for the full MIME type." +#: ../../library/email.contentmanager.rst:39 +msgid "" +"If none of these keys produce a handler, raise a :exc:`KeyError` for the " +"full MIME type." msgstr "" -msgid "If the ``maintype`` is ``multipart``, raise a :exc:`TypeError`; otherwise look up a handler function based on the type of *obj* (see next paragraph), call :meth:`~email.message.EmailMessage.clear_content` on the *msg*, and call the handler function, passing through all arguments. The expectation is that the handler will transform and store *obj* into *msg*, possibly making other changes to *msg* as well, such as adding various MIME headers to encode information needed to interpret the stored data." +#: ../../library/email.contentmanager.rst:45 +msgid "" +"If the ``maintype`` is ``multipart``, raise a :exc:`TypeError`; otherwise " +"look up a handler function based on the type of *obj* (see next paragraph), " +"call :meth:`~email.message.EmailMessage.clear_content` on the *msg*, and " +"call the handler function, passing through all arguments. The expectation " +"is that the handler will transform and store *obj* into *msg*, possibly " +"making other changes to *msg* as well, such as adding various MIME headers " +"to encode information needed to interpret the stored data." msgstr "" -msgid "To find the handler, obtain the type of *obj* (``typ = type(obj)``), and look for the following keys in the registry, stopping with the first one found:" +#: ../../library/email.contentmanager.rst:54 +msgid "" +"To find the handler, obtain the type of *obj* (``typ = type(obj)``), and " +"look for the following keys in the registry, stopping with the first one " +"found:" msgstr "" +#: ../../library/email.contentmanager.rst:58 msgid "the type itself (``typ``)" msgstr "" -msgid "the type's fully qualified name (``typ.__module__ + '.' + typ.__qualname__``)." +#: ../../library/email.contentmanager.rst:59 +msgid "" +"the type's fully qualified name (``typ.__module__ + '.' + " +"typ.__qualname__``)." msgstr "" +#: ../../library/email.contentmanager.rst:61 msgid "the type's :attr:`qualname ` (``typ.__qualname__``)" msgstr "" +#: ../../library/email.contentmanager.rst:62 msgid "the type's :attr:`name ` (``typ.__name__``)." msgstr "" -msgid "If none of the above match, repeat all of the checks above for each of the types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if no other key yields a handler, check for a handler for the key ``None``. If there is no handler for ``None``, raise a :exc:`KeyError` for the fully qualified name of the type." +#: ../../library/email.contentmanager.rst:64 +msgid "" +"If none of the above match, repeat all of the checks above for each of the " +"types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if " +"no other key yields a handler, check for a handler for the key ``None``. If " +"there is no handler for ``None``, raise a :exc:`KeyError` for the fully " +"qualified name of the type." msgstr "" -msgid "Also add a :mailheader:`MIME-Version` header if one is not present (see also :class:`.MIMEPart`)." +#: ../../library/email.contentmanager.rst:71 +msgid "" +"Also add a :mailheader:`MIME-Version` header if one is not present (see " +"also :class:`.MIMEPart`)." msgstr "" -msgid "Record the function *handler* as the handler for *key*. For the possible values of *key*, see :meth:`get_content`." +#: ../../library/email.contentmanager.rst:77 +msgid "" +"Record the function *handler* as the handler for *key*. For the possible " +"values of *key*, see :meth:`get_content`." msgstr "" -msgid "Record *handler* as the function to call when an object of a type matching *typekey* is passed to :meth:`set_content`. For the possible values of *typekey*, see :meth:`set_content`." +#: ../../library/email.contentmanager.rst:83 +msgid "" +"Record *handler* as the function to call when an object of a type matching " +"*typekey* is passed to :meth:`set_content`. For the possible values of " +"*typekey*, see :meth:`set_content`." msgstr "" +#: ../../library/email.contentmanager.rst:89 msgid "Content Manager Instances" msgstr "" -msgid "Currently the email package provides only one concrete content manager, :data:`raw_data_manager`, although more may be added in the future. :data:`raw_data_manager` is the :attr:`~email.policy.EmailPolicy.content_manager` provided by :attr:`~email.policy.EmailPolicy` and its derivatives." -msgstr "" - -msgid "This content manager provides only a minimum interface beyond that provided by :class:`~email.message.Message` itself: it deals only with text, raw byte strings, and :class:`~email.message.Message` objects. Nevertheless, it provides significant advantages compared to the base API: ``get_content`` on a text part will return a unicode string without the application needing to manually decode it, ``set_content`` provides a rich set of options for controlling the headers added to a part and controlling the content transfer encoding, and it enables the use of the various ``add_`` methods, thereby simplifying the creation of multipart messages." +#: ../../library/email.contentmanager.rst:91 +msgid "" +"Currently the email package provides only one concrete content " +"manager, :data:`raw_data_manager`, although more may be added in the " +"future. :data:`raw_data_manager` is " +"the :attr:`~email.policy.EmailPolicy.content_manager` provided " +"by :attr:`~email.policy.EmailPolicy` and its derivatives." msgstr "" -msgid "Return the payload of the part as either a string (for ``text`` parts), an :class:`~email.message.EmailMessage` object (for ``message/rfc822`` parts), or a ``bytes`` object (for all other non-multipart types). Raise a :exc:`KeyError` if called on a ``multipart``. If the part is a ``text`` part and *errors* is specified, use it as the error handler when decoding the payload to unicode. The default error handler is ``replace``." +#: ../../library/email.contentmanager.rst:100 +msgid "" +"This content manager provides only a minimum interface beyond that provided " +"by :class:`~email.message.Message` itself: it deals only with text, raw " +"byte strings, and :class:`~email.message.Message` objects. Nevertheless, it " +"provides significant advantages compared to the base API: ``get_content`` on " +"a text part will return a unicode string without the application needing to " +"manually decode it, ``set_content`` provides a rich set of options for " +"controlling the headers added to a part and controlling the content transfer " +"encoding, and it enables the use of the various ``add_`` methods, thereby " +"simplifying the creation of multipart messages." +msgstr "" + +#: ../../library/email.contentmanager.rst:112 +msgid "" +"Return the payload of the part as either a string (for ``text`` parts), " +"an :class:`~email.message.EmailMessage` object (for ``message/rfc822`` " +"parts), or a ``bytes`` object (for all other non-multipart types). Raise " +"a :exc:`KeyError` if called on a ``multipart``. If the part is a ``text`` " +"part and *errors* is specified, use it as the error handler when decoding " +"the payload to unicode. The default error handler is ``replace``." msgstr "" +#: ../../library/email.contentmanager.rst:131 msgid "Add headers and payload to *msg*:" msgstr "" -msgid "Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." +#: ../../library/email.contentmanager.rst:133 +msgid "" +"Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." msgstr "" -msgid "For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to *subtype* if it is specified, or ``plain`` if it is not." +#: ../../library/email.contentmanager.rst:136 +msgid "" +"For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to " +"*subtype* if it is specified, or ``plain`` if it is not." msgstr "" -msgid "For ``bytes``, use the specified *maintype* and *subtype*, or raise a :exc:`TypeError` if they are not specified." +#: ../../library/email.contentmanager.rst:138 +msgid "" +"For ``bytes``, use the specified *maintype* and *subtype*, or raise " +"a :exc:`TypeError` if they are not specified." msgstr "" -msgid "For :class:`~email.message.EmailMessage` objects, set the maintype to ``message``, and set the subtype to *subtype* if it is specified or ``rfc822`` if it is not. If *subtype* is ``partial``, raise an error (``bytes`` objects must be used to construct ``message/partial`` parts)." +#: ../../library/email.contentmanager.rst:140 +msgid "" +"For :class:`~email.message.EmailMessage` objects, set the maintype to " +"``message``, and set the subtype to *subtype* if it is specified or " +"``rfc822`` if it is not. If *subtype* is ``partial``, raise an error " +"(``bytes`` objects must be used to construct ``message/partial`` parts)." msgstr "" -msgid "If *charset* is provided (which is valid only for ``str``), encode the string to bytes using the specified character set. The default is ``utf-8``. If the specified *charset* is a known alias for a standard MIME charset name, use the standard charset instead." +#: ../../library/email.contentmanager.rst:146 +msgid "" +"If *charset* is provided (which is valid only for ``str``), encode the " +"string to bytes using the specified character set. The default is " +"``utf-8``. If the specified *charset* is a known alias for a standard MIME " +"charset name, use the standard charset instead." msgstr "" -msgid "If *cte* is set, encode the payload using the specified content transfer encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that value. Possible values for *cte* are ``quoted-printable``, ``base64``, ``7bit``, ``8bit``, and ``binary``. If the input cannot be encoded in the specified encoding (for example, specifying a *cte* of ``7bit`` for an input that contains non-ASCII values), raise a :exc:`ValueError`." +#: ../../library/email.contentmanager.rst:151 +msgid "" +"If *cte* is set, encode the payload using the specified content transfer " +"encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that " +"value. Possible values for *cte* are ``quoted-printable``, ``base64``, " +"``7bit``, ``8bit``, and ``binary``. If the input cannot be encoded in the " +"specified encoding (for example, specifying a *cte* of ``7bit`` for an input " +"that contains non-ASCII values), raise a :exc:`ValueError`." msgstr "" -msgid "For ``str`` objects, if *cte* is not set use heuristics to determine the most compact encoding. Prior to encoding, :meth:`str.splitlines` is used to normalize all line boundaries, ensuring that each line of the payload is terminated by the current policy's :data:`~email.policy.Policy.linesep` property (even if the original string did not end with one)." +#: ../../library/email.contentmanager.rst:159 +msgid "" +"For ``str`` objects, if *cte* is not set use heuristics to determine the " +"most compact encoding. Prior to encoding, :meth:`str.splitlines` is used to " +"normalize all line boundaries, ensuring that each line of the payload is " +"terminated by the current policy's :data:`~email.policy.Policy.linesep` " +"property (even if the original string did not end with one)." msgstr "" -msgid "For ``bytes`` objects, *cte* is taken to be base64 if not set, and the aforementioned newline translation is not performed." +#: ../../library/email.contentmanager.rst:165 +msgid "" +"For ``bytes`` objects, *cte* is taken to be base64 if not set, and the " +"aforementioned newline translation is not performed." msgstr "" -msgid "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* ``rfc822``, and for any *cte* other than ``7bit`` for *subtype* ``external-body``. For ``message/rfc822``, use ``8bit`` if *cte* is not specified. For all other values of *subtype*, use ``7bit``." +#: ../../library/email.contentmanager.rst:167 +msgid "" +"For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " +"a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " +"``rfc822``, and for any *cte* other than ``7bit`` for *subtype* ``external-" +"body``. For ``message/rfc822``, use ``8bit`` if *cte* is not specified. " +"For all other values of *subtype*, use ``7bit``." msgstr "" -msgid "A *cte* of ``binary`` does not actually work correctly yet. The ``EmailMessage`` object as modified by ``set_content`` is correct, but :class:`~email.generator.BytesGenerator` does not serialize it correctly." +#: ../../library/email.contentmanager.rst:174 +msgid "" +"A *cte* of ``binary`` does not actually work correctly yet. The " +"``EmailMessage`` object as modified by ``set_content`` is correct, " +"but :class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -msgid "If *disposition* is set, use it as the value of the :mailheader:`Content-Disposition` header. If not specified, and *filename* is specified, add the header with the value ``attachment``. If *disposition* is not specified and *filename* is also not specified, do not add the header. The only valid values for *disposition* are ``attachment`` and ``inline``." +#: ../../library/email.contentmanager.rst:179 +msgid "" +"If *disposition* is set, use it as the value of the :mailheader:`Content-" +"Disposition` header. If not specified, and *filename* is specified, add the " +"header with the value ``attachment``. If *disposition* is not specified and " +"*filename* is also not specified, do not add the header. The only valid " +"values for *disposition* are ``attachment`` and ``inline``." msgstr "" -msgid "If *filename* is specified, use it as the value of the ``filename`` parameter of the :mailheader:`Content-Disposition` header." +#: ../../library/email.contentmanager.rst:186 +msgid "" +"If *filename* is specified, use it as the value of the ``filename`` " +"parameter of the :mailheader:`Content-Disposition` header." msgstr "" -msgid "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as its value." +#: ../../library/email.contentmanager.rst:189 +msgid "" +"If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " +"its value." msgstr "" -msgid "If *params* is specified, iterate its ``items`` method and use the resulting ``(key, value)`` pairs to set additional parameters on the :mailheader:`Content-Type` header." +#: ../../library/email.contentmanager.rst:192 +msgid "" +"If *params* is specified, iterate its ``items`` method and use the resulting " +"``(key, value)`` pairs to set additional parameters on " +"the :mailheader:`Content-Type` header." msgstr "" -msgid "If *headers* is specified and is a list of strings of the form ``headername: headervalue`` or a list of ``header`` objects (distinguished from strings by having a ``name`` attribute), add the headers to *msg*." +#: ../../library/email.contentmanager.rst:196 +msgid "" +"If *headers* is specified and is a list of strings of the form ``headername: " +"headervalue`` or a list of ``header`` objects (distinguished from strings by " +"having a ``name`` attribute), add the headers to *msg*." msgstr "" +#: ../../library/email.contentmanager.rst:203 msgid "Footnotes" msgstr "" -msgid "Originally added in 3.4 as a :term:`provisional module `" +#: ../../library/email.contentmanager.rst:204 +msgid "" +"Originally added in 3.4 as a :term:`provisional module `" msgstr "" diff --git a/library/email.encoders.po b/library/email.encoders.po index 8d2dd2513..973d56085 100644 --- a/library/email.encoders.po +++ b/library/email.encoders.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:04+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,47 +23,102 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.encoders.rst:2 msgid ":mod:`!email.encoders`: Encoders" msgstr "" +#: ../../library/email.encoders.rst:7 msgid "**Source code:** :source:`Lib/email/encoders.py`" msgstr "" -msgid "This module is part of the legacy (``Compat32``) email API. In the new API the functionality is provided by the *cte* parameter of the :meth:`~email.message.EmailMessage.set_content` method." +#: ../../library/email.encoders.rst:11 +msgid "" +"This module is part of the legacy (``Compat32``) email API. In the new API " +"the functionality is provided by the *cte* parameter of " +"the :meth:`~email.message.EmailMessage.set_content` method." msgstr "" -msgid "This module is deprecated in Python 3. The functions provided here should not be called explicitly since the :class:`~email.mime.text.MIMEText` class sets the content type and CTE header using the *_subtype* and *_charset* values passed during the instantiation of that class." +#: ../../library/email.encoders.rst:15 +msgid "" +"This module is deprecated in Python 3. The functions provided here should " +"not be called explicitly since the :class:`~email.mime.text.MIMEText` class " +"sets the content type and CTE header using the *_subtype* and *_charset* " +"values passed during the instantiation of that class." msgstr "" -msgid "The remaining text in this section is the original documentation of the module." +#: ../../library/email.encoders.rst:20 +msgid "" +"The remaining text in this section is the original documentation of the " +"module." msgstr "" -msgid "When creating :class:`~email.message.Message` objects from scratch, you often need to encode the payloads for transport through compliant mail servers. This is especially true for :mimetype:`image/\\*` and :mimetype:`text/\\*` type messages containing binary data." +#: ../../library/email.encoders.rst:22 +msgid "" +"When creating :class:`~email.message.Message` objects from scratch, you " +"often need to encode the payloads for transport through compliant mail " +"servers. This is especially true for :mimetype:`image/\\*` " +"and :mimetype:`text/\\*` type messages containing binary data." msgstr "" -msgid "The :mod:`email` package provides some convenient encoders in its :mod:`!encoders` module. These encoders are actually used by the :class:`~email.mime.audio.MIMEAudio` and :class:`~email.mime.image.MIMEImage` class constructors to provide default encodings. All encoder functions take exactly one argument, the message object to encode. They usually extract the payload, encode it, and reset the payload to this newly encoded value. They should also set the :mailheader:`Content-Transfer-Encoding` header as appropriate." +#: ../../library/email.encoders.rst:27 +msgid "" +"The :mod:`email` package provides some convenient encoders in its :mod:`!" +"encoders` module. These encoders are actually used by " +"the :class:`~email.mime.audio.MIMEAudio` " +"and :class:`~email.mime.image.MIMEImage` class constructors to provide " +"default encodings. All encoder functions take exactly one argument, the " +"message object to encode. They usually extract the payload, encode it, and " +"reset the payload to this newly encoded value. They should also set " +"the :mailheader:`Content-Transfer-Encoding` header as appropriate." msgstr "" -msgid "Note that these functions are not meaningful for a multipart message. They must be applied to individual subparts instead, and will raise a :exc:`TypeError` if passed a message whose type is multipart." +#: ../../library/email.encoders.rst:35 +msgid "" +"Note that these functions are not meaningful for a multipart message. They " +"must be applied to individual subparts instead, and will raise " +"a :exc:`TypeError` if passed a message whose type is multipart." msgstr "" +#: ../../library/email.encoders.rst:39 msgid "Here are the encoding functions provided:" msgstr "" -msgid "Encodes the payload into quoted-printable form and sets the :mailheader:`Content-Transfer-Encoding` header to ``quoted-printable`` [#]_. This is a good encoding to use when most of your payload is normal printable data, but contains a few unprintable characters." +#: ../../library/email.encoders.rst:44 +msgid "" +"Encodes the payload into quoted-printable form and sets " +"the :mailheader:`Content-Transfer-Encoding` header to ``quoted-printable`` " +"[#]_. This is a good encoding to use when most of your payload is normal " +"printable data, but contains a few unprintable characters." msgstr "" -msgid "Encodes the payload into base64 form and sets the :mailheader:`Content-Transfer-Encoding` header to ``base64``. This is a good encoding to use when most of your payload is unprintable data since it is a more compact form than quoted-printable. The drawback of base64 encoding is that it renders the text non-human readable." +#: ../../library/email.encoders.rst:52 +msgid "" +"Encodes the payload into base64 form and sets the :mailheader:`Content-" +"Transfer-Encoding` header to ``base64``. This is a good encoding to use " +"when most of your payload is unprintable data since it is a more compact " +"form than quoted-printable. The drawback of base64 encoding is that it " +"renders the text non-human readable." msgstr "" -msgid "This doesn't actually modify the message's payload, but it does set the :mailheader:`Content-Transfer-Encoding` header to either ``7bit`` or ``8bit`` as appropriate, based on the payload data." +#: ../../library/email.encoders.rst:61 +msgid "" +"This doesn't actually modify the message's payload, but it does set " +"the :mailheader:`Content-Transfer-Encoding` header to either ``7bit`` or " +"``8bit`` as appropriate, based on the payload data." msgstr "" -msgid "This does nothing; it doesn't even set the :mailheader:`Content-Transfer-Encoding` header." +#: ../../library/email.encoders.rst:68 +msgid "" +"This does nothing; it doesn't even set the :mailheader:`Content-Transfer-" +"Encoding` header." msgstr "" +#: ../../library/email.encoders.rst:72 msgid "Footnotes" msgstr "" -msgid "Note that encoding with :meth:`encode_quopri` also encodes all tabs and space characters in the data." +#: ../../library/email.encoders.rst:73 +msgid "" +"Note that encoding with :meth:`encode_quopri` also encodes all tabs and " +"space characters in the data." msgstr "" diff --git a/library/email.errors.po b/library/email.errors.po index 8c2efafc3..08acdfd69 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,80 +21,166 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.errors.rst:2 msgid ":mod:`!email.errors`: Exception and Defect classes" msgstr "" +#: ../../library/email.errors.rst:7 msgid "**Source code:** :source:`Lib/email/errors.py`" msgstr "" -msgid "The following exception classes are defined in the :mod:`!email.errors` module:" -msgstr "" - -msgid "This is the base class for all exceptions that the :mod:`email` package can raise. It is derived from the standard :exc:`Exception` class and defines no additional methods." +#: ../../library/email.errors.rst:11 +msgid "" +"The following exception classes are defined in the :mod:`!email.errors` " +"module:" msgstr "" -msgid "This is the base class for exceptions raised by the :class:`~email.parser.Parser` class. It is derived from :exc:`MessageError`. This class is also used internally by the parser used by :mod:`~email.headerregistry`." +#: ../../library/email.errors.rst:16 +msgid "" +"This is the base class for all exceptions that the :mod:`email` package can " +"raise. It is derived from the standard :exc:`Exception` class and defines " +"no additional methods." msgstr "" -msgid "Raised under some error conditions when parsing the :rfc:`5322` headers of a message, this class is derived from :exc:`MessageParseError`. The :meth:`~email.message.EmailMessage.set_boundary` method will raise this error if the content type is unknown when the method is called. :class:`~email.header.Header` may raise this error for certain base64 decoding errors, and when an attempt is made to create a header that appears to contain an embedded header (that is, there is what is supposed to be a continuation line that has no leading whitespace and looks like a header)." +#: ../../library/email.errors.rst:23 +msgid "" +"This is the base class for exceptions raised by " +"the :class:`~email.parser.Parser` class. It is derived " +"from :exc:`MessageError`. This class is also used internally by the parser " +"used by :mod:`~email.headerregistry`." msgstr "" +#: ../../library/email.errors.rst:31 +msgid "" +"Raised under some error conditions when parsing the :rfc:`5322` headers of a " +"message, this class is derived from :exc:`MessageParseError`. " +"The :meth:`~email.message.EmailMessage.set_boundary` method will raise this " +"error if the content type is unknown when the method is " +"called. :class:`~email.header.Header` may raise this error for certain " +"base64 decoding errors, and when an attempt is made to create a header that " +"appears to contain an embedded header (that is, there is what is supposed to " +"be a continuation line that has no leading whitespace and looks like a " +"header)." +msgstr "" + +#: ../../library/email.errors.rst:43 msgid "Deprecated and no longer used." msgstr "" -msgid "Raised if the :meth:`~email.message.Message.attach` method is called on an instance of a class derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). :exc:`MultipartConversionError` multiply inherits from :exc:`MessageError` and the built-in :exc:`TypeError`." +#: ../../library/email.errors.rst:48 +msgid "" +"Raised if the :meth:`~email.message.Message.attach` method is called on an " +"instance of a class derived " +"from :class:`~email.mime.nonmultipart.MIMENonMultipart` " +"(e.g. :class:`~email.mime.image.MIMEImage`). :exc:`MultipartConversionError` " +"multiply inherits from :exc:`MessageError` and the built-in :exc:`TypeError`." msgstr "" -msgid "Raised when an error occurs when the :mod:`~email.generator` outputs headers." +#: ../../library/email.errors.rst:58 +msgid "" +"Raised when an error occurs when the :mod:`~email.generator` outputs headers." msgstr "" -msgid "This is the base class for all defects found when parsing email messages. It is derived from :exc:`ValueError`." +#: ../../library/email.errors.rst:64 +msgid "" +"This is the base class for all defects found when parsing email messages. It " +"is derived from :exc:`ValueError`." msgstr "" -msgid "This is the base class for all defects found when parsing email headers. It is derived from :exc:`MessageDefect`." +#: ../../library/email.errors.rst:69 +msgid "" +"This is the base class for all defects found when parsing email headers. It " +"is derived from :exc:`MessageDefect`." msgstr "" -msgid "Here is the list of the defects that the :class:`~email.parser.FeedParser` can find while parsing messages. Note that the defects are added to the message where the problem was found, so for example, if a message nested inside a :mimetype:`multipart/alternative` had a malformed header, that nested message object would have a defect, but the containing messages would not." +#: ../../library/email.errors.rst:72 +msgid "" +"Here is the list of the defects that the :class:`~email.parser.FeedParser` " +"can find while parsing messages. Note that the defects are added to the " +"message where the problem was found, so for example, if a message nested " +"inside a :mimetype:`multipart/alternative` had a malformed header, that " +"nested message object would have a defect, but the containing messages would " +"not." msgstr "" -msgid "All defect classes are subclassed from :class:`email.errors.MessageDefect`." +#: ../../library/email.errors.rst:78 +msgid "" +"All defect classes are subclassed from :class:`email.errors.MessageDefect`." msgstr "" -msgid "A message claimed to be a multipart, but had no :mimetype:`boundary` parameter." +#: ../../library/email.errors.rst:82 +msgid "" +"A message claimed to be a multipart, but had no :mimetype:`boundary` " +"parameter." msgstr "" -msgid "The start boundary claimed in the :mailheader:`Content-Type` header was never found." +#: ../../library/email.errors.rst:87 +msgid "" +"The start boundary claimed in the :mailheader:`Content-Type` header was " +"never found." msgstr "" -msgid "A start boundary was found, but no corresponding close boundary was ever found." +#: ../../library/email.errors.rst:92 +msgid "" +"A start boundary was found, but no corresponding close boundary was ever " +"found." msgstr "" +#: ../../library/email.errors.rst:99 msgid "The message had a continuation line as its first header line." msgstr "" +#: ../../library/email.errors.rst:103 msgid "A \"Unix From\" header was found in the middle of a header block." msgstr "" -msgid "A line was found while parsing headers that had no leading white space but contained no ':'. Parsing continues assuming that the line represents the first line of the body." +#: ../../library/email.errors.rst:107 +msgid "" +"A line was found while parsing headers that had no leading white space but " +"contained no ':'. Parsing continues assuming that the line represents the " +"first line of the body." msgstr "" -msgid "A header was found that was missing a colon, or was otherwise malformed." +#: ../../library/email.errors.rst:115 +msgid "" +"A header was found that was missing a colon, or was otherwise malformed." msgstr "" +#: ../../library/email.errors.rst:117 msgid "This defect has not been used for several Python versions." msgstr "" -msgid "A message claimed to be a :mimetype:`multipart`, but no subparts were found. Note that when a message has this defect, its :meth:`~email.message.Message.is_multipart` method may return ``False`` even though its content type claims to be :mimetype:`multipart`." +#: ../../library/email.errors.rst:122 +msgid "" +"A message claimed to be a :mimetype:`multipart`, but no subparts were found. " +"Note that when a message has this defect, " +"its :meth:`~email.message.Message.is_multipart` method may return ``False`` " +"even though its content type claims to be :mimetype:`multipart`." msgstr "" -msgid "When decoding a block of base64 encoded bytes, the padding was not correct. Enough padding is added to perform the decode, but the resulting decoded bytes may be invalid." +#: ../../library/email.errors.rst:129 +msgid "" +"When decoding a block of base64 encoded bytes, the padding was not correct. " +"Enough padding is added to perform the decode, but the resulting decoded " +"bytes may be invalid." msgstr "" -msgid "When decoding a block of base64 encoded bytes, characters outside the base64 alphabet were encountered. The characters are ignored, but the resulting decoded bytes may be invalid." +#: ../../library/email.errors.rst:135 +msgid "" +"When decoding a block of base64 encoded bytes, characters outside the base64 " +"alphabet were encountered. The characters are ignored, but the resulting " +"decoded bytes may be invalid." msgstr "" -msgid "When decoding a block of base64 encoded bytes, the number of non-padding base64 characters was invalid (1 more than a multiple of 4). The encoded block was kept as-is." +#: ../../library/email.errors.rst:141 +msgid "" +"When decoding a block of base64 encoded bytes, the number of non-padding " +"base64 characters was invalid (1 more than a multiple of 4). The encoded " +"block was kept as-is." msgstr "" -msgid "When decoding an invalid or unparsable date field. The original value is kept as-is." +#: ../../library/email.errors.rst:147 +msgid "" +"When decoding an invalid or unparsable date field. The original value is " +"kept as-is." msgstr "" diff --git a/library/email.examples.po b/library/email.examples.po index e77ea65f2..a301a8510 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,15 +23,23 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.examples.rst:4 msgid ":mod:`email`: Examples" msgstr "" -msgid "Here are a few examples of how to use the :mod:`email` package to read, write, and send simple email messages, as well as more complex MIME messages." +#: ../../library/email.examples.rst:6 +msgid "" +"Here are a few examples of how to use the :mod:`email` package to read, " +"write, and send simple email messages, as well as more complex MIME messages." msgstr "" -msgid "First, let's see how to create and send a simple text message (both the text content and the addresses may contain unicode characters):" +#: ../../library/email.examples.rst:9 +msgid "" +"First, let's see how to create and send a simple text message (both the text " +"content and the addresses may contain unicode characters):" msgstr "" +#: ../../library/email.examples.rst:12 msgid "" "# Import smtplib for the actual sending function\n" "import smtplib\n" @@ -57,9 +65,13 @@ msgid "" "s.quit()\n" msgstr "" -msgid "Parsing :rfc:`822` headers can easily be done by the using the classes from the :mod:`~email.parser` module:" +#: ../../library/email.examples.rst:15 +msgid "" +"Parsing :rfc:`822` headers can easily be done by the using the classes from " +"the :mod:`~email.parser` module:" msgstr "" +#: ../../library/email.examples.rst:18 msgid "" "# Import the email modules we'll need\n" "#from email.parser import BytesParser\n" @@ -88,9 +100,13 @@ msgid "" "print('Sender name: {}'.format(headers['from'].addresses[0].display_name))\n" msgstr "" -msgid "Here's an example of how to send a MIME message containing a bunch of family pictures that may be residing in a directory:" +#: ../../library/email.examples.rst:21 +msgid "" +"Here's an example of how to send a MIME message containing a bunch of family " +"pictures that may be residing in a directory:" msgstr "" +#: ../../library/email.examples.rst:24 msgid "" "# Import smtplib for the actual sending function.\n" "import smtplib\n" @@ -120,9 +136,13 @@ msgid "" " s.send_message(msg)\n" msgstr "" -msgid "Here's an example of how to send the entire contents of a directory as an email message: [1]_" +#: ../../library/email.examples.rst:27 +msgid "" +"Here's an example of how to send the entire contents of a directory as an " +"email message: [1]_" msgstr "" +#: ../../library/email.examples.rst:30 msgid "" "#!/usr/bin/env python3\n" "\n" @@ -142,18 +162,24 @@ msgid "" "def main():\n" " parser = ArgumentParser(description=\"\"\"\\\n" "Send the contents of a directory as a MIME message.\n" -"Unless the -o option is given, the email is sent by forwarding to your local\n" -"SMTP server, which then does the normal delivery process. Your local machine\n" +"Unless the -o option is given, the email is sent by forwarding to your " +"local\n" +"SMTP server, which then does the normal delivery process. Your local " +"machine\n" "must be running an SMTP server.\n" "\"\"\")\n" " parser.add_argument('-d', '--directory',\n" -" help=\"\"\"Mail the contents of the specified directory,\n" -" otherwise use the current directory. Only the regular\n" -" files in the directory are sent, and we don't recurse to\n" +" help=\"\"\"Mail the contents of the specified " +"directory,\n" +" otherwise use the current directory. Only the " +"regular\n" +" files in the directory are sent, and we don't " +"recurse to\n" " subdirectories.\"\"\")\n" " parser.add_argument('-o', '--output',\n" " metavar='FILE',\n" -" help=\"\"\"Print the composed message to FILE instead of\n" +" help=\"\"\"Print the composed message to FILE " +"instead of\n" " sending the message to the SMTP server.\"\"\")\n" " parser.add_argument('-s', '--sender', required=True,\n" " help='The value of the From: header (required)')\n" @@ -181,7 +207,8 @@ msgid "" " # gzip'd or compressed files.\n" " ctype, encoding = mimetypes.guess_file_type(path)\n" " if ctype is None or encoding is not None:\n" -" # No guess could be made, or the file is encoded (compressed), so\n" +" # No guess could be made, or the file is encoded (compressed), " +"so\n" " # use a generic bag-of-bits type.\n" " ctype = 'application/octet-stream'\n" " maintype, subtype = ctype.split('/', 1)\n" @@ -203,9 +230,13 @@ msgid "" " main()\n" msgstr "" -msgid "Here's an example of how to unpack a MIME message like the one above, into a directory of files:" +#: ../../library/email.examples.rst:33 +msgid "" +"Here's an example of how to unpack a MIME message like the one above, into a " +"directory of files:" msgstr "" +#: ../../library/email.examples.rst:36 msgid "" "#!/usr/bin/env python3\n" "\n" @@ -226,7 +257,8 @@ msgid "" "\"\"\")\n" " parser.add_argument('-d', '--directory', required=True,\n" " help=\"\"\"Unpack the MIME message into the named\n" -" directory, which will be created if it doesn't already\n" +" directory, which will be created if it doesn't " +"already\n" " exist.\"\"\")\n" " parser.add_argument('msgfile')\n" " args = parser.parse_args()\n" @@ -262,9 +294,15 @@ msgid "" " main()\n" msgstr "" -msgid "Here's an example of how to create an HTML message with an alternative plain text version. To make things a bit more interesting, we include a related image in the html part, and we save a copy of what we are going to send to disk, as well as sending it." +#: ../../library/email.examples.rst:39 +msgid "" +"Here's an example of how to create an HTML message with an alternative plain " +"text version. To make things a bit more interesting, we include a related " +"image in the html part, and we save a copy of what we are going to send to " +"disk, as well as sending it." msgstr "" +#: ../../library/email.examples.rst:44 msgid "" "#!/usr/bin/env python3\n" "\n" @@ -290,8 +328,10 @@ msgid "" "--Pepé\n" "\"\"\")\n" "\n" -"# Add the html version. This converts the message into a multipart/alternative\n" -"# container, with the original text message as the first part and the new html\n" +"# Add the html version. This converts the message into a multipart/" +"alternative\n" +"# container, with the original text message as the first part and the new " +"html\n" "# message as the second part.\n" "asparagus_cid = make_msgid()\n" "msg.add_alternative(\"\"\"\\\n" @@ -300,7 +340,8 @@ msgid "" " \n" "

Salut!

\n" "

Cette\n" -" \n" +" \n" " recette\n" " sera sûrement un très bon repas.\n" "

\n" @@ -324,9 +365,13 @@ msgid "" " s.send_message(msg)\n" msgstr "" -msgid "If we were sent the message from the last example, here is one way we could process it:" +#: ../../library/email.examples.rst:47 +msgid "" +"If we were sent the message from the last example, here is one way we could " +"process it:" msgstr "" +#: ../../library/email.examples.rst:50 msgid "" "import os\n" "import sys\n" @@ -342,7 +387,8 @@ msgid "" "def magic_html_parser(html_text, partfiles):\n" " \"\"\"Return safety-sanitized html linked to partfiles.\n" "\n" -" Rewrite the href=\"cid:....\" attributes to point to the filenames in partfiles.\n" +" Rewrite the href=\"cid:....\" attributes to point to the filenames in " +"partfiles.\n" " Though not trivial, this should be possible using html.parser.\n" " \"\"\"\n" " raise NotImplementedError(\"Add the magic needed\")\n" @@ -352,15 +398,19 @@ msgid "" "with open('outgoing.msg', 'rb') as fp:\n" " msg = BytesParser(policy=policy.default).parse(fp)\n" "\n" -"# Now the header items can be accessed as a dictionary, and any non-ASCII will\n" +"# Now the header items can be accessed as a dictionary, and any non-ASCII " +"will\n" "# be converted to unicode:\n" "print('To:', msg['to'])\n" "print('From:', msg['from'])\n" "print('Subject:', msg['subject'])\n" "\n" -"# If we want to print a preview of the message content, we can extract whatever\n" -"# the least formatted payload is and print the first three lines. Of course,\n" -"# if the message has no plain text part printing the first three lines of html\n" +"# If we want to print a preview of the message content, we can extract " +"whatever\n" +"# the least formatted payload is and print the first three lines. Of " +"course,\n" +"# if the message has no plain text part printing the first three lines of " +"html\n" "# is probably useless, but this is just a conceptual example.\n" "simplest = msg.get_body(preferencelist=('plain', 'html'))\n" "print()\n" @@ -381,7 +431,8 @@ msgid "" " elif richest['content-type'].subtype == 'html':\n" " body = richest\n" " else:\n" -" print(\"Don't know how to display {}\".format(richest.get_content_type()))\n" +" print(\"Don't know how to display {}" +"\".format(richest.get_content_type()))\n" " sys.exit()\n" "elif richest['content-type'].content_type == 'multipart/related':\n" " body = richest.get_body(preferencelist=('html'))\n" @@ -391,12 +442,14 @@ msgid "" " extension = os.path.splitext(part.get_filename())[1]\n" " else:\n" " extension = mimetypes.guess_extension(part.get_content_type())\n" -" with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as f:\n" +" with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as " +"f:\n" " f.write(part.get_content())\n" " # again strip the <> to go from email form of cid to html form.\n" " partfiles[part['content-id'][1:-1]] = f.name\n" "else:\n" -" print(\"Don't know how to display {}\".format(richest.get_content_type()))\n" +" print(\"Don't know how to display {}" +"\".format(richest.get_content_type()))\n" " sys.exit()\n" "with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:\n" " f.write(magic_html_parser(body.get_content(), partfiles))\n" @@ -409,11 +462,14 @@ msgid "" "# minded program, but it will handle the most common ones.\n" msgstr "" +#: ../../library/email.examples.rst:52 msgid "Up to the prompt, the output from the above is:" msgstr "" +#: ../../library/email.examples.rst:54 msgid "" -"To: Penelope Pussycat , Fabrette Pussycat \n" +"To: Penelope Pussycat , Fabrette Pussycat " +"\n" "From: Pepé Le Pew \n" "Subject: Pourquoi pas des asperges pour ce midi ?\n" "\n" @@ -422,8 +478,11 @@ msgid "" "Cette recette [1] sera sûrement un très bon repas." msgstr "" +#: ../../library/email.examples.rst:66 msgid "Footnotes" msgstr "" -msgid "Thanks to Matthew Dixon Cowles for the original inspiration and examples." +#: ../../library/email.examples.rst:67 +msgid "" +"Thanks to Matthew Dixon Cowles for the original inspiration and examples." msgstr "" diff --git a/library/email.generator.po b/library/email.generator.po index 5a50ecd2b..44985a375 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,125 +23,316 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.generator.rst:2 msgid ":mod:`!email.generator`: Generating MIME documents" msgstr "" +#: ../../library/email.generator.rst:7 msgid "**Source code:** :source:`Lib/email/generator.py`" msgstr "" -msgid "One of the most common tasks is to generate the flat (serialized) version of the email message represented by a message object structure. You will need to do this if you want to send your message via :meth:`smtplib.SMTP.sendmail`, or print the message on the console. Taking a message object structure and producing a serialized representation is the job of the generator classes." -msgstr "" - -msgid "As with the :mod:`email.parser` module, you aren't limited to the functionality of the bundled generator; you could write one from scratch yourself. However the bundled generator knows how to generate most email in a standards-compliant way, should handle MIME and non-MIME email messages just fine, and is designed so that the bytes-oriented parsing and generation operations are inverses, assuming the same non-transforming :mod:`~email.policy` is used for both. That is, parsing the serialized byte stream via the :class:`~email.parser.BytesParser` class and then regenerating the serialized byte stream using :class:`BytesGenerator` should produce output identical to the input [#]_. (On the other hand, using the generator on an :class:`~email.message.EmailMessage` constructed by program may result in changes to the :class:`~email.message.EmailMessage` object as defaults are filled in.)" -msgstr "" - -msgid "The :class:`Generator` class can be used to flatten a message into a text (as opposed to binary) serialized representation, but since Unicode cannot represent binary data directly, the message is of necessity transformed into something that contains only ASCII characters, using the standard email RFC Content Transfer Encoding techniques for encoding email messages for transport over channels that are not \"8 bit clean\"." +#: ../../library/email.generator.rst:11 +msgid "" +"One of the most common tasks is to generate the flat (serialized) version of " +"the email message represented by a message object structure. You will need " +"to do this if you want to send your message " +"via :meth:`smtplib.SMTP.sendmail`, or print the message on the console. " +"Taking a message object structure and producing a serialized representation " +"is the job of the generator classes." msgstr "" -msgid "To accommodate reproducible processing of SMIME-signed messages :class:`Generator` disables header folding for message parts of type ``multipart/signed`` and all subparts." +#: ../../library/email.generator.rst:18 +msgid "" +"As with the :mod:`email.parser` module, you aren't limited to the " +"functionality of the bundled generator; you could write one from scratch " +"yourself. However the bundled generator knows how to generate most email in " +"a standards-compliant way, should handle MIME and non-MIME email messages " +"just fine, and is designed so that the bytes-oriented parsing and generation " +"operations are inverses, assuming the same non-" +"transforming :mod:`~email.policy` is used for both. That is, parsing the " +"serialized byte stream via the :class:`~email.parser.BytesParser` class and " +"then regenerating the serialized byte stream using :class:`BytesGenerator` " +"should produce output identical to the input [#]_. (On the other hand, " +"using the generator on an :class:`~email.message.EmailMessage` constructed " +"by program may result in changes to the :class:`~email.message.EmailMessage` " +"object as defaults are filled in.)" +msgstr "" + +#: ../../library/email.generator.rst:32 +msgid "" +"The :class:`Generator` class can be used to flatten a message into a text " +"(as opposed to binary) serialized representation, but since Unicode cannot " +"represent binary data directly, the message is of necessity transformed into " +"something that contains only ASCII characters, using the standard email RFC " +"Content Transfer Encoding techniques for encoding email messages for " +"transport over channels that are not \"8 bit clean\"." msgstr "" -msgid "Return a :class:`BytesGenerator` object that will write any message provided to the :meth:`flatten` method, or any surrogateescape encoded text provided to the :meth:`write` method, to the :term:`file-like object` *outfp*. *outfp* must support a ``write`` method that accepts binary data." +#: ../../library/email.generator.rst:39 +msgid "" +"To accommodate reproducible processing of SMIME-signed " +"messages :class:`Generator` disables header folding for message parts of " +"type ``multipart/signed`` and all subparts." msgstr "" -msgid "If optional *mangle_from_* is ``True``, put a ``>`` character in front of any line in the body that starts with the exact string ``\"From \"``, that is ``From`` followed by a space at the beginning of a line. *mangle_from_* defaults to the value of the :attr:`~email.policy.Policy.mangle_from_` setting of the *policy* (which is ``True`` for the :data:`~email.policy.compat32` policy and ``False`` for all others). *mangle_from_* is intended for use when messages are stored in Unix mbox format (see :mod:`mailbox` and `WHY THE CONTENT-LENGTH FORMAT IS BAD `_)." +#: ../../library/email.generator.rst:47 +msgid "" +"Return a :class:`BytesGenerator` object that will write any message provided " +"to the :meth:`flatten` method, or any surrogateescape encoded text provided " +"to the :meth:`write` method, to the :term:`file-like object` *outfp*. " +"*outfp* must support a ``write`` method that accepts binary data." msgstr "" -msgid "If *maxheaderlen* is not ``None``, refold any header lines that are longer than *maxheaderlen*, or if ``0``, do not rewrap any headers. If *manheaderlen* is ``None`` (the default), wrap headers and other message lines according to the *policy* settings." +#: ../../library/email.generator.rst:52 ../../library/email.generator.rst:153 +msgid "" +"If optional *mangle_from_* is ``True``, put a ``>`` character in front of " +"any line in the body that starts with the exact string ``\"From \"``, that " +"is ``From`` followed by a space at the beginning of a line. *mangle_from_* " +"defaults to the value of the :attr:`~email.policy.Policy.mangle_from_` " +"setting of the *policy* (which is ``True`` for " +"the :data:`~email.policy.compat32` policy and ``False`` for all others). " +"*mangle_from_* is intended for use when messages are stored in Unix mbox " +"format (see :mod:`mailbox` and `WHY THE CONTENT-LENGTH FORMAT IS BAD " +"`_)." +msgstr "" + +#: ../../library/email.generator.rst:62 ../../library/email.generator.rst:163 +msgid "" +"If *maxheaderlen* is not ``None``, refold any header lines that are longer " +"than *maxheaderlen*, or if ``0``, do not rewrap any headers. If " +"*manheaderlen* is ``None`` (the default), wrap headers and other message " +"lines according to the *policy* settings." msgstr "" -msgid "If *policy* is specified, use that policy to control message generation. If *policy* is ``None`` (the default), use the policy associated with the :class:`~email.message.Message` or :class:`~email.message.EmailMessage` object passed to ``flatten`` to control the message generation. See :mod:`email.policy` for details on what *policy* controls." +#: ../../library/email.generator.rst:67 ../../library/email.generator.rst:168 +msgid "" +"If *policy* is specified, use that policy to control message generation. If " +"*policy* is ``None`` (the default), use the policy associated with " +"the :class:`~email.message.Message` or :class:`~email.message.EmailMessage` " +"object passed to ``flatten`` to control the message generation. " +"See :mod:`email.policy` for details on what *policy* controls." msgstr "" +#: ../../library/email.generator.rst:75 ../../library/email.generator.rst:174 msgid "Added the *policy* keyword." msgstr "" -msgid "The default behavior of the *mangle_from_* and *maxheaderlen* parameters is to follow the policy." -msgstr "" - -msgid "Print the textual representation of the message object structure rooted at *msg* to the output file specified when the :class:`BytesGenerator` instance was created." -msgstr "" - -msgid "If the :mod:`~email.policy` option :attr:`~email.policy.Policy.cte_type` is ``8bit`` (the default), copy any headers in the original parsed message that have not been modified to the output with any bytes with the high bit set reproduced as in the original, and preserve the non-ASCII :mailheader:`Content-Transfer-Encoding` of any body parts that have them. If ``cte_type`` is ``7bit``, convert the bytes with the high bit set as needed using an ASCII-compatible :mailheader:`Content-Transfer-Encoding`. That is, transform parts with non-ASCII :mailheader:`Content-Transfer-Encoding` (:mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII compatible :mailheader:`Content-Transfer-Encoding`, and encode RFC-invalid non-ASCII bytes in headers using the MIME ``unknown-8bit`` character set, thus rendering them RFC-compliant." +#: ../../library/email.generator.rst:77 ../../library/email.generator.rst:176 +msgid "" +"The default behavior of the *mangle_from_* and *maxheaderlen* parameters is " +"to follow the policy." msgstr "" -msgid "If *unixfrom* is ``True``, print the envelope header delimiter used by the Unix mailbox format (see :mod:`mailbox`) before the first of the :rfc:`5322` headers of the root message object. If the root object has no envelope header, craft a standard one. The default is ``False``. Note that for subparts, no envelope header is ever printed." +#: ../../library/email.generator.rst:83 +msgid "" +"Print the textual representation of the message object structure rooted at " +"*msg* to the output file specified when the :class:`BytesGenerator` instance " +"was created." msgstr "" -msgid "If *linesep* is not ``None``, use it as the separator character between all the lines of the flattened message. If *linesep* is ``None`` (the default), use the value specified in the *policy*." +#: ../../library/email.generator.rst:87 +msgid "" +"If the :mod:`~email.policy` option :attr:`~email.policy.Policy.cte_type` is " +"``8bit`` (the default), copy any headers in the original parsed message that " +"have not been modified to the output with any bytes with the high bit set " +"reproduced as in the original, and preserve the non-" +"ASCII :mailheader:`Content-Transfer-Encoding` of any body parts that have " +"them. If ``cte_type`` is ``7bit``, convert the bytes with the high bit set " +"as needed using an ASCII-compatible :mailheader:`Content-Transfer-Encoding`. " +"That is, transform parts with non-ASCII :mailheader:`Content-Transfer-" +"Encoding` (:mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII " +"compatible :mailheader:`Content-Transfer-Encoding`, and encode RFC-invalid " +"non-ASCII bytes in headers using the MIME ``unknown-8bit`` character set, " +"thus rendering them RFC-compliant." +msgstr "" + +#: ../../library/email.generator.rst:104 ../../library/email.generator.rst:197 +msgid "" +"If *unixfrom* is ``True``, print the envelope header delimiter used by the " +"Unix mailbox format (see :mod:`mailbox`) before the first of the :rfc:`5322` " +"headers of the root message object. If the root object has no envelope " +"header, craft a standard one. The default is ``False``. Note that for " +"subparts, no envelope header is ever printed." msgstr "" -msgid "Return an independent clone of this :class:`BytesGenerator` instance with the exact same option settings, and *fp* as the new *outfp*." +#: ../../library/email.generator.rst:110 ../../library/email.generator.rst:203 +msgid "" +"If *linesep* is not ``None``, use it as the separator character between all " +"the lines of the flattened message. If *linesep* is ``None`` (the default), " +"use the value specified in the *policy*." msgstr "" -msgid "Encode *s* using the ``ASCII`` codec and the ``surrogateescape`` error handler, and pass it to the *write* method of the *outfp* passed to the :class:`BytesGenerator`'s constructor." +#: ../../library/email.generator.rst:119 +msgid "" +"Return an independent clone of this :class:`BytesGenerator` instance with " +"the exact same option settings, and *fp* as the new *outfp*." msgstr "" -msgid "As a convenience, :class:`~email.message.EmailMessage` provides the methods :meth:`~email.message.EmailMessage.as_bytes` and ``bytes(aMessage)`` (a.k.a. :meth:`~email.message.EmailMessage.__bytes__`), which simplify the generation of a serialized binary representation of a message object. For more detail, see :mod:`email.message`." +#: ../../library/email.generator.rst:125 +msgid "" +"Encode *s* using the ``ASCII`` codec and the ``surrogateescape`` error " +"handler, and pass it to the *write* method of the *outfp* passed to " +"the :class:`BytesGenerator`'s constructor." msgstr "" -msgid "Because strings cannot represent binary data, the :class:`Generator` class must convert any binary data in any message it flattens to an ASCII compatible format, by converting them to an ASCII compatible :mailheader:`Content-Transfer_Encoding`. Using the terminology of the email RFCs, you can think of this as :class:`Generator` serializing to an I/O stream that is not \"8 bit clean\". In other words, most applications will want to be using :class:`BytesGenerator`, and not :class:`Generator`." +#: ../../library/email.generator.rst:130 +msgid "" +"As a convenience, :class:`~email.message.EmailMessage` provides the " +"methods :meth:`~email.message.EmailMessage.as_bytes` and ``bytes(aMessage)`` " +"(a.k.a. :meth:`~email.message.EmailMessage.__bytes__`), which simplify the " +"generation of a serialized binary representation of a message object. For " +"more detail, see :mod:`email.message`." msgstr "" -msgid "Return a :class:`Generator` object that will write any message provided to the :meth:`flatten` method, or any text provided to the :meth:`write` method, to the :term:`file-like object` *outfp*. *outfp* must support a ``write`` method that accepts string data." +#: ../../library/email.generator.rst:137 +msgid "" +"Because strings cannot represent binary data, the :class:`Generator` class " +"must convert any binary data in any message it flattens to an ASCII " +"compatible format, by converting them to an ASCII " +"compatible :mailheader:`Content-Transfer_Encoding`. Using the terminology " +"of the email RFCs, you can think of this as :class:`Generator` serializing " +"to an I/O stream that is not \"8 bit clean\". In other words, most " +"applications will want to be using :class:`BytesGenerator`, and " +"not :class:`Generator`." msgstr "" -msgid "Print the textual representation of the message object structure rooted at *msg* to the output file specified when the :class:`Generator` instance was created." +#: ../../library/email.generator.rst:148 +msgid "" +"Return a :class:`Generator` object that will write any message provided to " +"the :meth:`flatten` method, or any text provided to the :meth:`write` " +"method, to the :term:`file-like object` *outfp*. *outfp* must support a " +"``write`` method that accepts string data." msgstr "" -msgid "If the :mod:`~email.policy` option :attr:`~email.policy.Policy.cte_type` is ``8bit``, generate the message as if the option were set to ``7bit``. (This is required because strings cannot represent non-ASCII bytes.) Convert any bytes with the high bit set as needed using an ASCII-compatible :mailheader:`Content-Transfer-Encoding`. That is, transform parts with non-ASCII :mailheader:`Content-Transfer-Encoding` (:mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII compatible :mailheader:`Content-Transfer-Encoding`, and encode RFC-invalid non-ASCII bytes in headers using the MIME ``unknown-8bit`` character set, thus rendering them RFC-compliant." +#: ../../library/email.generator.rst:182 +msgid "" +"Print the textual representation of the message object structure rooted at " +"*msg* to the output file specified when the :class:`Generator` instance was " +"created." msgstr "" -msgid "Added support for re-encoding ``8bit`` message bodies, and the *linesep* argument." +#: ../../library/email.generator.rst:186 +msgid "" +"If the :mod:`~email.policy` option :attr:`~email.policy.Policy.cte_type` is " +"``8bit``, generate the message as if the option were set to ``7bit``. (This " +"is required because strings cannot represent non-ASCII bytes.) Convert any " +"bytes with the high bit set as needed using an ASCII-" +"compatible :mailheader:`Content-Transfer-Encoding`. That is, transform " +"parts with non-ASCII :mailheader:`Content-Transfer-Encoding` " +"(:mailheader:`Content-Transfer-Encoding: 8bit`) to an ASCII " +"compatible :mailheader:`Content-Transfer-Encoding`, and encode RFC-invalid " +"non-ASCII bytes in headers using the MIME ``unknown-8bit`` character set, " +"thus rendering them RFC-compliant." +msgstr "" + +#: ../../library/email.generator.rst:209 +msgid "" +"Added support for re-encoding ``8bit`` message bodies, and the *linesep* " +"argument." msgstr "" -msgid "Return an independent clone of this :class:`Generator` instance with the exact same options, and *fp* as the new *outfp*." +#: ../../library/email.generator.rst:216 +msgid "" +"Return an independent clone of this :class:`Generator` instance with the " +"exact same options, and *fp* as the new *outfp*." msgstr "" -msgid "Write *s* to the *write* method of the *outfp* passed to the :class:`Generator`'s constructor. This provides just enough file-like API for :class:`Generator` instances to be used in the :func:`print` function." +#: ../../library/email.generator.rst:222 +msgid "" +"Write *s* to the *write* method of the *outfp* passed to " +"the :class:`Generator`'s constructor. This provides just enough file-like " +"API for :class:`Generator` instances to be used in the :func:`print` " +"function." msgstr "" -msgid "As a convenience, :class:`~email.message.EmailMessage` provides the methods :meth:`~email.message.EmailMessage.as_string` and ``str(aMessage)`` (a.k.a. :meth:`~email.message.EmailMessage.__str__`), which simplify the generation of a formatted string representation of a message object. For more detail, see :mod:`email.message`." +#: ../../library/email.generator.rst:228 +msgid "" +"As a convenience, :class:`~email.message.EmailMessage` provides the " +"methods :meth:`~email.message.EmailMessage.as_string` and ``str(aMessage)`` " +"(a.k.a. :meth:`~email.message.EmailMessage.__str__`), which simplify the " +"generation of a formatted string representation of a message object. For " +"more detail, see :mod:`email.message`." msgstr "" -msgid "The :mod:`!email.generator` module also provides a derived class, :class:`DecodedGenerator`, which is like the :class:`Generator` base class, except that non-\\ :mimetype:`text` parts are not serialized, but are instead represented in the output stream by a string derived from a template filled in with information about the part." +#: ../../library/email.generator.rst:235 +msgid "" +"The :mod:`!email.generator` module also provides a derived " +"class, :class:`DecodedGenerator`, which is like the :class:`Generator` base " +"class, except that non-\\ :mimetype:`text` parts are not serialized, but are " +"instead represented in the output stream by a string derived from a template " +"filled in with information about the part." msgstr "" -msgid "Act like :class:`Generator`, except that for any subpart of the message passed to :meth:`Generator.flatten`, if the subpart is of main type :mimetype:`text`, print the decoded payload of the subpart, and if the main type is not :mimetype:`text`, instead of printing it fill in the string *fmt* using information from the part and print the resulting filled-in string." +#: ../../library/email.generator.rst:244 +msgid "" +"Act like :class:`Generator`, except that for any subpart of the message " +"passed to :meth:`Generator.flatten`, if the subpart is of main " +"type :mimetype:`text`, print the decoded payload of the subpart, and if the " +"main type is not :mimetype:`text`, instead of printing it fill in the string " +"*fmt* using information from the part and print the resulting filled-in " +"string." msgstr "" -msgid "To fill in *fmt*, execute ``fmt % part_info``, where ``part_info`` is a dictionary composed of the following keys and values:" +#: ../../library/email.generator.rst:251 +msgid "" +"To fill in *fmt*, execute ``fmt % part_info``, where ``part_info`` is a " +"dictionary composed of the following keys and values:" msgstr "" +#: ../../library/email.generator.rst:254 msgid "``type`` -- Full MIME type of the non-\\ :mimetype:`text` part" msgstr "" +#: ../../library/email.generator.rst:256 msgid "``maintype`` -- Main MIME type of the non-\\ :mimetype:`text` part" msgstr "" +#: ../../library/email.generator.rst:258 msgid "``subtype`` -- Sub-MIME type of the non-\\ :mimetype:`text` part" msgstr "" +#: ../../library/email.generator.rst:260 msgid "``filename`` -- Filename of the non-\\ :mimetype:`text` part" msgstr "" -msgid "``description`` -- Description associated with the non-\\ :mimetype:`text` part" +#: ../../library/email.generator.rst:262 +msgid "" +"``description`` -- Description associated with the non-\\ :mimetype:`text` " +"part" msgstr "" -msgid "``encoding`` -- Content transfer encoding of the non-\\ :mimetype:`text` part" +#: ../../library/email.generator.rst:264 +msgid "" +"``encoding`` -- Content transfer encoding of the non-\\ :mimetype:`text` part" msgstr "" +#: ../../library/email.generator.rst:266 msgid "If *fmt* is ``None``, use the following default *fmt*:" msgstr "" -msgid "\"[Non-text (%(type)s) part of message omitted, filename %(filename)s]\"" +#: ../../library/email.generator.rst:268 +msgid "" +"\"[Non-text (%(type)s) part of message omitted, filename %(filename)s]\"" msgstr "" -msgid "Optional *_mangle_from_* and *maxheaderlen* are as with the :class:`Generator` base class." +#: ../../library/email.generator.rst:270 +msgid "" +"Optional *_mangle_from_* and *maxheaderlen* are as with " +"the :class:`Generator` base class." msgstr "" +#: ../../library/email.generator.rst:275 msgid "Footnotes" msgstr "" -msgid "This statement assumes that you use the appropriate setting for ``unixfrom``, and that there are no :mod:`email.policy` settings calling for automatic adjustments (for example, :attr:`~email.policy.EmailPolicy.refold_source` must be ``none``, which is *not* the default). It is also not 100% true, since if the message does not conform to the RFC standards occasionally information about the exact original text is lost during parsing error recovery. It is a goal to fix these latter edge cases when possible." +#: ../../library/email.generator.rst:276 +msgid "" +"This statement assumes that you use the appropriate setting for " +"``unixfrom``, and that there are no :mod:`email.policy` settings calling for " +"automatic adjustments (for " +"example, :attr:`~email.policy.EmailPolicy.refold_source` must be ``none``, " +"which is *not* the default). It is also not 100% true, since if the message " +"does not conform to the RFC standards occasionally information about the " +"exact original text is lost during parsing error recovery. It is a goal to " +"fix these latter edge cases when possible." msgstr "" diff --git a/library/email.header.po b/library/email.header.po index b2ccbc1d0..cef465a5f 100644 --- a/library/email.header.po +++ b/library/email.header.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,27 +23,63 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.header.rst:2 msgid ":mod:`!email.header`: Internationalized headers" msgstr "" +#: ../../library/email.header.rst:7 msgid "**Source code:** :source:`Lib/email/header.py`" msgstr "" -msgid "This module is part of the legacy (``Compat32``) email API. In the current API encoding and decoding of headers is handled transparently by the dictionary-like API of the :class:`~email.message.EmailMessage` class. In addition to uses in legacy code, this module can be useful in applications that need to completely control the character sets used when encoding headers." -msgstr "" - -msgid "The remaining text in this section is the original documentation of the module." +#: ../../library/email.header.rst:11 +msgid "" +"This module is part of the legacy (``Compat32``) email API. In the current " +"API encoding and decoding of headers is handled transparently by the " +"dictionary-like API of the :class:`~email.message.EmailMessage` class. In " +"addition to uses in legacy code, this module can be useful in applications " +"that need to completely control the character sets used when encoding " +"headers." msgstr "" -msgid ":rfc:`2822` is the base standard that describes the format of email messages. It derives from the older :rfc:`822` standard which came into widespread use at a time when most email was composed of ASCII characters only. :rfc:`2822` is a specification written assuming email contains only 7-bit ASCII characters." +#: ../../library/email.header.rst:17 +msgid "" +"The remaining text in this section is the original documentation of the " +"module." msgstr "" -msgid "Of course, as email has been deployed worldwide, it has become internationalized, such that language specific character sets can now be used in email messages. The base standard still requires email messages to be transferred using only 7-bit ASCII characters, so a slew of RFCs have been written describing how to encode email containing non-ASCII characters into :rfc:`2822`\\ -compliant format. These RFCs include :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, and :rfc:`2231`. The :mod:`email` package supports these standards in its :mod:`!email.header` and :mod:`email.charset` modules." +#: ../../library/email.header.rst:19 +msgid "" +":rfc:`2822` is the base standard that describes the format of email " +"messages. It derives from the older :rfc:`822` standard which came into " +"widespread use at a time when most email was composed of ASCII characters " +"only. :rfc:`2822` is a specification written assuming email contains only 7-" +"bit ASCII characters." msgstr "" -msgid "If you want to include non-ASCII characters in your email headers, say in the :mailheader:`Subject` or :mailheader:`To` fields, you should use the :class:`Header` class and assign the field in the :class:`~email.message.Message` object to an instance of :class:`Header` instead of using a string for the header value. Import the :class:`Header` class from the :mod:`!email.header` module. For example::" +#: ../../library/email.header.rst:24 +msgid "" +"Of course, as email has been deployed worldwide, it has become " +"internationalized, such that language specific character sets can now be " +"used in email messages. The base standard still requires email messages to " +"be transferred using only 7-bit ASCII characters, so a slew of RFCs have " +"been written describing how to encode email containing non-ASCII characters " +"into :rfc:`2822`\\ -compliant format. These RFCs " +"include :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, and :rfc:`2231`. " +"The :mod:`email` package supports these standards in its :mod:`!" +"email.header` and :mod:`email.charset` modules." +msgstr "" + +#: ../../library/email.header.rst:33 +msgid "" +"If you want to include non-ASCII characters in your email headers, say in " +"the :mailheader:`Subject` or :mailheader:`To` fields, you should use " +"the :class:`Header` class and assign the field in " +"the :class:`~email.message.Message` object to an instance of :class:`Header` " +"instead of using a string for the header value. Import the :class:`Header` " +"class from the :mod:`!email.header` module. For example::" msgstr "" +#: ../../library/email.header.rst:40 msgid "" ">>> from email.message import Message\n" ">>> from email.header import Header\n" @@ -54,116 +90,252 @@ msgid "" "'Subject: =?iso-8859-1?q?p=F6stal?=\\n\\n'" msgstr "" -msgid "Notice here how we wanted the :mailheader:`Subject` field to contain a non-ASCII character? We did this by creating a :class:`Header` instance and passing in the character set that the byte string was encoded in. When the subsequent :class:`~email.message.Message` instance was flattened, the :mailheader:`Subject` field was properly :rfc:`2047` encoded. MIME-aware mail readers would show this header using the embedded ISO-8859-1 character." +#: ../../library/email.header.rst:50 +msgid "" +"Notice here how we wanted the :mailheader:`Subject` field to contain a non-" +"ASCII character? We did this by creating a :class:`Header` instance and " +"passing in the character set that the byte string was encoded in. When the " +"subsequent :class:`~email.message.Message` instance was flattened, " +"the :mailheader:`Subject` field was properly :rfc:`2047` encoded. MIME-" +"aware mail readers would show this header using the embedded ISO-8859-1 " +"character." msgstr "" +#: ../../library/email.header.rst:57 msgid "Here is the :class:`Header` class description:" msgstr "" -msgid "Create a MIME-compliant header that can contain strings in different character sets." +#: ../../library/email.header.rst:62 +msgid "" +"Create a MIME-compliant header that can contain strings in different " +"character sets." msgstr "" -msgid "Optional *s* is the initial header value. If ``None`` (the default), the initial header value is not set. You can later append to the header with :meth:`append` method calls. *s* may be an instance of :class:`bytes` or :class:`str`, but see the :meth:`append` documentation for semantics." +#: ../../library/email.header.rst:65 +msgid "" +"Optional *s* is the initial header value. If ``None`` (the default), the " +"initial header value is not set. You can later append to the header " +"with :meth:`append` method calls. *s* may be an instance of :class:`bytes` " +"or :class:`str`, but see the :meth:`append` documentation for semantics." msgstr "" -msgid "Optional *charset* serves two purposes: it has the same meaning as the *charset* argument to the :meth:`append` method. It also sets the default character set for all subsequent :meth:`append` calls that omit the *charset* argument. If *charset* is not provided in the constructor (the default), the ``us-ascii`` character set is used both as *s*'s initial charset and as the default for subsequent :meth:`append` calls." +#: ../../library/email.header.rst:70 +msgid "" +"Optional *charset* serves two purposes: it has the same meaning as the " +"*charset* argument to the :meth:`append` method. It also sets the default " +"character set for all subsequent :meth:`append` calls that omit the " +"*charset* argument. If *charset* is not provided in the constructor (the " +"default), the ``us-ascii`` character set is used both as *s*'s initial " +"charset and as the default for subsequent :meth:`append` calls." msgstr "" -msgid "The maximum line length can be specified explicitly via *maxlinelen*. For splitting the first line to a shorter value (to account for the field header which isn't included in *s*, e.g. :mailheader:`Subject`) pass in the name of the field in *header_name*. The default *maxlinelen* is 78, and the default value for *header_name* is ``None``, meaning it is not taken into account for the first line of a long, split header." +#: ../../library/email.header.rst:77 +msgid "" +"The maximum line length can be specified explicitly via *maxlinelen*. For " +"splitting the first line to a shorter value (to account for the field header " +"which isn't included in *s*, e.g. :mailheader:`Subject`) pass in the name of " +"the field in *header_name*. The default *maxlinelen* is 78, and the default " +"value for *header_name* is ``None``, meaning it is not taken into account " +"for the first line of a long, split header." msgstr "" -msgid "Optional *continuation_ws* must be :rfc:`2822`\\ -compliant folding whitespace, and is usually either a space or a hard tab character. This character will be prepended to continuation lines. *continuation_ws* defaults to a single space character." +#: ../../library/email.header.rst:84 +msgid "" +"Optional *continuation_ws* must be :rfc:`2822`\\ -compliant folding " +"whitespace, and is usually either a space or a hard tab character. This " +"character will be prepended to continuation lines. *continuation_ws* " +"defaults to a single space character." msgstr "" -msgid "Optional *errors* is passed straight through to the :meth:`append` method." +#: ../../library/email.header.rst:89 +msgid "" +"Optional *errors* is passed straight through to the :meth:`append` method." msgstr "" +#: ../../library/email.header.rst:94 msgid "Append the string *s* to the MIME header." msgstr "" -msgid "Optional *charset*, if given, should be a :class:`~email.charset.Charset` instance (see :mod:`email.charset`) or the name of a character set, which will be converted to a :class:`~email.charset.Charset` instance. A value of ``None`` (the default) means that the *charset* given in the constructor is used." -msgstr "" - -msgid "*s* may be an instance of :class:`bytes` or :class:`str`. If it is an instance of :class:`bytes`, then *charset* is the encoding of that byte string, and a :exc:`UnicodeError` will be raised if the string cannot be decoded with that character set." +#: ../../library/email.header.rst:96 +msgid "" +"Optional *charset*, if given, should be a :class:`~email.charset.Charset` " +"instance (see :mod:`email.charset`) or the name of a character set, which " +"will be converted to a :class:`~email.charset.Charset` instance. A value of " +"``None`` (the default) means that the *charset* given in the constructor is " +"used." msgstr "" -msgid "If *s* is an instance of :class:`str`, then *charset* is a hint specifying the character set of the characters in the string." +#: ../../library/email.header.rst:102 +msgid "" +"*s* may be an instance of :class:`bytes` or :class:`str`. If it is an " +"instance of :class:`bytes`, then *charset* is the encoding of that byte " +"string, and a :exc:`UnicodeError` will be raised if the string cannot be " +"decoded with that character set." msgstr "" -msgid "In either case, when producing an :rfc:`2822`\\ -compliant header using :rfc:`2047` rules, the string will be encoded using the output codec of the charset. If the string cannot be encoded using the output codec, a UnicodeError will be raised." +#: ../../library/email.header.rst:107 +msgid "" +"If *s* is an instance of :class:`str`, then *charset* is a hint specifying " +"the character set of the characters in the string." msgstr "" -msgid "Optional *errors* is passed as the errors argument to the decode call if *s* is a byte string." +#: ../../library/email.header.rst:110 +msgid "" +"In either case, when producing an :rfc:`2822`\\ -compliant header " +"using :rfc:`2047` rules, the string will be encoded using the output codec " +"of the charset. If the string cannot be encoded using the output codec, a " +"UnicodeError will be raised." msgstr "" -msgid "Encode a message header into an RFC-compliant format, possibly wrapping long lines and encapsulating non-ASCII parts in base64 or quoted-printable encodings." +#: ../../library/email.header.rst:115 +msgid "" +"Optional *errors* is passed as the errors argument to the decode call if *s* " +"is a byte string." msgstr "" -msgid "Optional *splitchars* is a string containing characters which should be given extra weight by the splitting algorithm during normal header wrapping. This is in very rough support of :RFC:`2822`\\'s 'higher level syntactic breaks': split points preceded by a splitchar are preferred during line splitting, with the characters preferred in the order in which they appear in the string. Space and tab may be included in the string to indicate whether preference should be given to one over the other as a split point when other split chars do not appear in the line being split. Splitchars does not affect :RFC:`2047` encoded lines." +#: ../../library/email.header.rst:121 +msgid "" +"Encode a message header into an RFC-compliant format, possibly wrapping long " +"lines and encapsulating non-ASCII parts in base64 or quoted-printable " +"encodings." msgstr "" -msgid "*maxlinelen*, if given, overrides the instance's value for the maximum line length." +#: ../../library/email.header.rst:125 +msgid "" +"Optional *splitchars* is a string containing characters which should be " +"given extra weight by the splitting algorithm during normal header " +"wrapping. This is in very rough support of :RFC:`2822`\\'s 'higher level " +"syntactic breaks': split points preceded by a splitchar are preferred " +"during line splitting, with the characters preferred in the order in which " +"they appear in the string. Space and tab may be included in the string to " +"indicate whether preference should be given to one over the other as a split " +"point when other split chars do not appear in the line being split. " +"Splitchars does not affect :RFC:`2047` encoded lines." +msgstr "" + +#: ../../library/email.header.rst:135 +msgid "" +"*maxlinelen*, if given, overrides the instance's value for the maximum line " +"length." msgstr "" -msgid "*linesep* specifies the characters used to separate the lines of the folded header. It defaults to the most useful value for Python application code (``\\n``), but ``\\r\\n`` can be specified in order to produce headers with RFC-compliant line separators." +#: ../../library/email.header.rst:138 +msgid "" +"*linesep* specifies the characters used to separate the lines of the folded " +"header. It defaults to the most useful value for Python application code " +"(``\\n``), but ``\\r\\n`` can be specified in order to produce headers with " +"RFC-compliant line separators." msgstr "" +#: ../../library/email.header.rst:143 msgid "Added the *linesep* argument." msgstr "" -msgid "The :class:`Header` class also provides a number of methods to support standard operators and built-in functions." +#: ../../library/email.header.rst:147 +msgid "" +"The :class:`Header` class also provides a number of methods to support " +"standard operators and built-in functions." msgstr "" -msgid "Returns an approximation of the :class:`Header` as a string, using an unlimited line length. All pieces are converted to unicode using the specified encoding and joined together appropriately. Any pieces with a charset of ``'unknown-8bit'`` are decoded as ASCII using the ``'replace'`` error handler." +#: ../../library/email.header.rst:152 +msgid "" +"Returns an approximation of the :class:`Header` as a string, using an " +"unlimited line length. All pieces are converted to unicode using the " +"specified encoding and joined together appropriately. Any pieces with a " +"charset of ``'unknown-8bit'`` are decoded as ASCII using the ``'replace'`` " +"error handler." msgstr "" +#: ../../library/email.header.rst:158 msgid "Added handling for the ``'unknown-8bit'`` charset." msgstr "" -msgid "This method allows you to compare two :class:`Header` instances for equality." +#: ../../library/email.header.rst:164 +msgid "" +"This method allows you to compare two :class:`Header` instances for equality." msgstr "" -msgid "This method allows you to compare two :class:`Header` instances for inequality." +#: ../../library/email.header.rst:170 +msgid "" +"This method allows you to compare two :class:`Header` instances for " +"inequality." msgstr "" -msgid "The :mod:`!email.header` module also provides the following convenient functions." +#: ../../library/email.header.rst:173 +msgid "" +"The :mod:`!email.header` module also provides the following convenient " +"functions." msgstr "" -msgid "Decode a message header value without converting the character set. The header value is in *header*." +#: ../../library/email.header.rst:178 +msgid "" +"Decode a message header value without converting the character set. The " +"header value is in *header*." msgstr "" +#: ../../library/email.header.rst:181 msgid "For historical reasons, this function may return either:" msgstr "" -msgid "A list of pairs containing each of the decoded parts of the header, ``(decoded_bytes, charset)``, where *decoded_bytes* is always an instance of :class:`bytes`, and *charset* is either:" +#: ../../library/email.header.rst:183 +msgid "" +"A list of pairs containing each of the decoded parts of the header, " +"``(decoded_bytes, charset)``, where *decoded_bytes* is always an instance " +"of :class:`bytes`, and *charset* is either:" msgstr "" +#: ../../library/email.header.rst:187 msgid "A lower case string containing the name of the character set specified." msgstr "" +#: ../../library/email.header.rst:189 msgid "``None`` for non-encoded parts of the header." msgstr "" -msgid "A list of length 1 containing a pair ``(string, None)``, where *string* is always an instance of :class:`str`." +#: ../../library/email.header.rst:191 +msgid "" +"A list of length 1 containing a pair ``(string, None)``, where *string* is " +"always an instance of :class:`str`." msgstr "" -msgid "An :exc:`email.errors.HeaderParseError` may be raised when certain decoding errors occur (e.g. a base64 decoding exception)." +#: ../../library/email.header.rst:194 +msgid "" +"An :exc:`email.errors.HeaderParseError` may be raised when certain decoding " +"errors occur (e.g. a base64 decoding exception)." msgstr "" +#: ../../library/email.header.rst:197 msgid "Here are examples:" msgstr "" -msgid "This function exists for backwards compatibility only. For new code, we recommend using :class:`email.headerregistry.HeaderRegistry`." +#: ../../library/email.header.rst:209 +msgid "" +"This function exists for backwards compatibility only. For new code, we " +"recommend using :class:`email.headerregistry.HeaderRegistry`." msgstr "" -msgid "Create a :class:`Header` instance from a sequence of pairs as returned by :func:`decode_header`." +#: ../../library/email.header.rst:215 +msgid "" +"Create a :class:`Header` instance from a sequence of pairs as returned " +"by :func:`decode_header`." msgstr "" -msgid ":func:`decode_header` takes a header value string and returns a sequence of pairs of the format ``(decoded_string, charset)`` where *charset* is the name of the character set." +#: ../../library/email.header.rst:218 +msgid "" +":func:`decode_header` takes a header value string and returns a sequence of " +"pairs of the format ``(decoded_string, charset)`` where *charset* is the " +"name of the character set." msgstr "" -msgid "This function takes one of those sequence of pairs and returns a :class:`Header` instance. Optional *maxlinelen*, *header_name*, and *continuation_ws* are as in the :class:`Header` constructor." +#: ../../library/email.header.rst:222 +msgid "" +"This function takes one of those sequence of pairs and returns " +"a :class:`Header` instance. Optional *maxlinelen*, *header_name*, and " +"*continuation_ws* are as in the :class:`Header` constructor." msgstr "" -msgid "This function exists for backwards compatibility only, and is not recommended for use in new code." +#: ../../library/email.header.rst:228 +msgid "" +"This function exists for backwards compatibility only, and is not " +"recommended for use in new code." msgstr "" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index 85b47b6a2..80c681f40 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,338 +24,669 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.headerregistry.rst:2 msgid ":mod:`!email.headerregistry`: Custom Header Objects" msgstr "" +#: ../../library/email.headerregistry.rst:10 msgid "**Source code:** :source:`Lib/email/headerregistry.py`" msgstr "" +#: ../../library/email.headerregistry.rst:14 msgid "[1]_" msgstr "" -msgid "Headers are represented by customized subclasses of :class:`str`. The particular class used to represent a given header is determined by the :attr:`~email.policy.EmailPolicy.header_factory` of the :mod:`~email.policy` in effect when the headers are created. This section documents the particular ``header_factory`` implemented by the email package for handling :RFC:`5322` compliant email messages, which not only provides customized header objects for various header types, but also provides an extension mechanism for applications to add their own custom header types." -msgstr "" - -msgid "When using any of the policy objects derived from :data:`~email.policy.EmailPolicy`, all headers are produced by :class:`.HeaderRegistry` and have :class:`.BaseHeader` as their last base class. Each header class has an additional base class that is determined by the type of the header. For example, many headers have the class :class:`.UnstructuredHeader` as their other base class. The specialized second class for a header is determined by the name of the header, using a lookup table stored in the :class:`.HeaderRegistry`. All of this is managed transparently for the typical application program, but interfaces are provided for modifying the default behavior for use by more complex applications." -msgstr "" - -msgid "The sections below first document the header base classes and their attributes, followed by the API for modifying the behavior of :class:`.HeaderRegistry`, and finally the support classes used to represent the data parsed from structured headers." +#: ../../library/email.headerregistry.rst:16 +msgid "" +"Headers are represented by customized subclasses of :class:`str`. The " +"particular class used to represent a given header is determined by " +"the :attr:`~email.policy.EmailPolicy.header_factory` of " +"the :mod:`~email.policy` in effect when the headers are created. This " +"section documents the particular ``header_factory`` implemented by the email " +"package for handling :RFC:`5322` compliant email messages, which not only " +"provides customized header objects for various header types, but also " +"provides an extension mechanism for applications to add their own custom " +"header types." +msgstr "" + +#: ../../library/email.headerregistry.rst:25 +msgid "" +"When using any of the policy objects derived " +"from :data:`~email.policy.EmailPolicy`, all headers are produced " +"by :class:`.HeaderRegistry` and have :class:`.BaseHeader` as their last base " +"class. Each header class has an additional base class that is determined by " +"the type of the header. For example, many headers have the " +"class :class:`.UnstructuredHeader` as their other base class. The " +"specialized second class for a header is determined by the name of the " +"header, using a lookup table stored in the :class:`.HeaderRegistry`. All of " +"this is managed transparently for the typical application program, but " +"interfaces are provided for modifying the default behavior for use by more " +"complex applications." +msgstr "" + +#: ../../library/email.headerregistry.rst:36 +msgid "" +"The sections below first document the header base classes and their " +"attributes, followed by the API for modifying the behavior " +"of :class:`.HeaderRegistry`, and finally the support classes used to " +"represent the data parsed from structured headers." msgstr "" -msgid "*name* and *value* are passed to ``BaseHeader`` from the :attr:`~email.policy.EmailPolicy.header_factory` call. The string value of any header object is the *value* fully decoded to unicode." +#: ../../library/email.headerregistry.rst:44 +msgid "" +"*name* and *value* are passed to ``BaseHeader`` from " +"the :attr:`~email.policy.EmailPolicy.header_factory` call. The string value " +"of any header object is the *value* fully decoded to unicode." msgstr "" +#: ../../library/email.headerregistry.rst:48 msgid "This base class defines the following read-only properties:" msgstr "" -msgid "The name of the header (the portion of the field before the ':'). This is exactly the value passed in the :attr:`~email.policy.EmailPolicy.header_factory` call for *name*; that is, case is preserved." +#: ../../library/email.headerregistry.rst:53 +msgid "" +"The name of the header (the portion of the field before the ':'). This is " +"exactly the value passed in " +"the :attr:`~email.policy.EmailPolicy.header_factory` call for *name*; that " +"is, case is preserved." msgstr "" -msgid "A tuple of :exc:`~email.errors.HeaderDefect` instances reporting any RFC compliance problems found during parsing. The email package tries to be complete about detecting compliance issues. See the :mod:`~email.errors` module for a discussion of the types of defects that may be reported." +#: ../../library/email.headerregistry.rst:61 +msgid "" +"A tuple of :exc:`~email.errors.HeaderDefect` instances reporting any RFC " +"compliance problems found during parsing. The email package tries to be " +"complete about detecting compliance issues. See the :mod:`~email.errors` " +"module for a discussion of the types of defects that may be reported." msgstr "" -msgid "The maximum number of headers of this type that can have the same ``name``. A value of ``None`` means unlimited. The ``BaseHeader`` value for this attribute is ``None``; it is expected that specialized header classes will override this value as needed." +#: ../../library/email.headerregistry.rst:69 +msgid "" +"The maximum number of headers of this type that can have the same ``name``. " +"A value of ``None`` means unlimited. The ``BaseHeader`` value for this " +"attribute is ``None``; it is expected that specialized header classes will " +"override this value as needed." msgstr "" -msgid "``BaseHeader`` also provides the following method, which is called by the email library code and should not in general be called by application programs:" +#: ../../library/email.headerregistry.rst:74 +msgid "" +"``BaseHeader`` also provides the following method, which is called by the " +"email library code and should not in general be called by application " +"programs:" msgstr "" -msgid "Return a string containing :attr:`~email.policy.Policy.linesep` characters as required to correctly fold the header according to *policy*. A :attr:`~email.policy.Policy.cte_type` of ``8bit`` will be treated as if it were ``7bit``, since headers may not contain arbitrary binary data. If :attr:`~email.policy.EmailPolicy.utf8` is ``False``, non-ASCII data will be :rfc:`2047` encoded." +#: ../../library/email.headerregistry.rst:80 +msgid "" +"Return a string containing :attr:`~email.policy.Policy.linesep` characters " +"as required to correctly fold the header according to *policy*. " +"A :attr:`~email.policy.Policy.cte_type` of ``8bit`` will be treated as if it " +"were ``7bit``, since headers may not contain arbitrary binary data. " +"If :attr:`~email.policy.EmailPolicy.utf8` is ``False``, non-ASCII data will " +"be :rfc:`2047` encoded." msgstr "" -msgid "``BaseHeader`` by itself cannot be used to create a header object. It defines a protocol that each specialized header cooperates with in order to produce the header object. Specifically, ``BaseHeader`` requires that the specialized class provide a :func:`classmethod` named ``parse``. This method is called as follows::" +#: ../../library/email.headerregistry.rst:88 +msgid "" +"``BaseHeader`` by itself cannot be used to create a header object. It " +"defines a protocol that each specialized header cooperates with in order to " +"produce the header object. Specifically, ``BaseHeader`` requires that the " +"specialized class provide a :func:`classmethod` named ``parse``. This " +"method is called as follows::" msgstr "" +#: ../../library/email.headerregistry.rst:94 msgid "parse(string, kwds)" msgstr "" -msgid "``kwds`` is a dictionary containing one pre-initialized key, ``defects``. ``defects`` is an empty list. The parse method should append any detected defects to this list. On return, the ``kwds`` dictionary *must* contain values for at least the keys ``decoded``, ``defects`` and ``parse_tree``. ``decoded`` should be the string value for the header (that is, the header value fully decoded to unicode). ``parse_tree`` is set to the parse tree obtained from parsing the header. The parse method should assume that *string* may contain content-transfer-encoded parts, but should correctly handle all valid unicode characters as well so that it can parse un-encoded header values." -msgstr "" - -msgid "``BaseHeader``'s ``__new__`` then creates the header instance, and calls its ``init`` method. The specialized class only needs to provide an ``init`` method if it wishes to set additional attributes beyond those provided by ``BaseHeader`` itself. Such an ``init`` method should look like this::" +#: ../../library/email.headerregistry.rst:96 +msgid "" +"``kwds`` is a dictionary containing one pre-initialized key, ``defects``. " +"``defects`` is an empty list. The parse method should append any detected " +"defects to this list. On return, the ``kwds`` dictionary *must* contain " +"values for at least the keys ``decoded``, ``defects`` and ``parse_tree``. " +"``decoded`` should be the string value for the header (that is, the header " +"value fully decoded to unicode). ``parse_tree`` is set to the parse tree " +"obtained from parsing the header. The parse method should assume that " +"*string* may contain content-transfer-encoded parts, but should correctly " +"handle all valid unicode characters as well so that it can parse un-encoded " +"header values." +msgstr "" + +#: ../../library/email.headerregistry.rst:106 +msgid "" +"``BaseHeader``'s ``__new__`` then creates the header instance, and calls its " +"``init`` method. The specialized class only needs to provide an ``init`` " +"method if it wishes to set additional attributes beyond those provided by " +"``BaseHeader`` itself. Such an ``init`` method should look like this::" msgstr "" +#: ../../library/email.headerregistry.rst:111 msgid "" "def init(self, /, *args, **kw):\n" " self._myattr = kw.pop('myattr')\n" " super().init(*args, **kw)" msgstr "" -msgid "That is, anything extra that the specialized class puts in to the ``kwds`` dictionary should be removed and handled, and the remaining contents of ``kw`` (and ``args``) passed to the ``BaseHeader`` ``init`` method." -msgstr "" - -msgid "An \"unstructured\" header is the default type of header in :rfc:`5322`. Any header that does not have a specified syntax is treated as unstructured. The classic example of an unstructured header is the :mailheader:`Subject` header." +#: ../../library/email.headerregistry.rst:115 +msgid "" +"That is, anything extra that the specialized class puts in to the ``kwds`` " +"dictionary should be removed and handled, and the remaining contents of " +"``kw`` (and ``args``) passed to the ``BaseHeader`` ``init`` method." msgstr "" -msgid "In :rfc:`5322`, an unstructured header is a run of arbitrary text in the ASCII character set. :rfc:`2047`, however, has an :rfc:`5322` compatible mechanism for encoding non-ASCII text as ASCII characters within a header value. When a *value* containing encoded words is passed to the constructor, the ``UnstructuredHeader`` parser converts such encoded words into unicode, following the :rfc:`2047` rules for unstructured text. The parser uses heuristics to attempt to decode certain non-compliant encoded words. Defects are registered in such cases, as well as defects for issues such as invalid characters within the encoded words or the non-encoded text." +#: ../../library/email.headerregistry.rst:122 +msgid "" +"An \"unstructured\" header is the default type of header in :rfc:`5322`. Any " +"header that does not have a specified syntax is treated as unstructured. " +"The classic example of an unstructured header is the :mailheader:`Subject` " +"header." msgstr "" +#: ../../library/email.headerregistry.rst:127 +msgid "" +"In :rfc:`5322`, an unstructured header is a run of arbitrary text in the " +"ASCII character set. :rfc:`2047`, however, has an :rfc:`5322` compatible " +"mechanism for encoding non-ASCII text as ASCII characters within a header " +"value. When a *value* containing encoded words is passed to the " +"constructor, the ``UnstructuredHeader`` parser converts such encoded words " +"into unicode, following the :rfc:`2047` rules for unstructured text. The " +"parser uses heuristics to attempt to decode certain non-compliant encoded " +"words. Defects are registered in such cases, as well as defects for issues " +"such as invalid characters within the encoded words or the non-encoded text." +msgstr "" + +#: ../../library/email.headerregistry.rst:137 msgid "This header type provides no additional attributes." msgstr "" -msgid ":rfc:`5322` specifies a very specific format for dates within email headers. The ``DateHeader`` parser recognizes that date format, as well as recognizing a number of variant forms that are sometimes found \"in the wild\"." +#: ../../library/email.headerregistry.rst:142 +msgid "" +":rfc:`5322` specifies a very specific format for dates within email headers. " +"The ``DateHeader`` parser recognizes that date format, as well as " +"recognizing a number of variant forms that are sometimes found \"in the " +"wild\"." msgstr "" +#: ../../library/email.headerregistry.rst:147 +#: ../../library/email.headerregistry.rst:189 msgid "This header type provides the following additional attributes:" msgstr "" -msgid "If the header value can be recognized as a valid date of one form or another, this attribute will contain a :class:`~datetime.datetime` instance representing that date. If the timezone of the input date is specified as ``-0000`` (indicating it is in UTC but contains no information about the source timezone), then :attr:`.datetime` will be a naive :class:`~datetime.datetime`. If a specific timezone offset is found (including ``+0000``), then :attr:`.datetime` will contain an aware ``datetime`` that uses :class:`datetime.timezone` to record the timezone offset." -msgstr "" - -msgid "The ``decoded`` value of the header is determined by formatting the ``datetime`` according to the :rfc:`5322` rules; that is, it is set to::" +#: ../../library/email.headerregistry.rst:151 +msgid "" +"If the header value can be recognized as a valid date of one form or " +"another, this attribute will contain a :class:`~datetime.datetime` instance " +"representing that date. If the timezone of the input date is specified as " +"``-0000`` (indicating it is in UTC but contains no information about the " +"source timezone), then :attr:`.datetime` will be a " +"naive :class:`~datetime.datetime`. If a specific timezone offset is found " +"(including ``+0000``), then :attr:`.datetime` will contain an aware " +"``datetime`` that uses :class:`datetime.timezone` to record the timezone " +"offset." +msgstr "" + +#: ../../library/email.headerregistry.rst:161 +msgid "" +"The ``decoded`` value of the header is determined by formatting the " +"``datetime`` according to the :rfc:`5322` rules; that is, it is set to::" msgstr "" +#: ../../library/email.headerregistry.rst:164 msgid "email.utils.format_datetime(self.datetime)" msgstr "" -msgid "When creating a ``DateHeader``, *value* may be :class:`~datetime.datetime` instance. This means, for example, that the following code is valid and does what one would expect::" +#: ../../library/email.headerregistry.rst:166 +msgid "" +"When creating a ``DateHeader``, *value* may be :class:`~datetime.datetime` " +"instance. This means, for example, that the following code is valid and " +"does what one would expect::" msgstr "" +#: ../../library/email.headerregistry.rst:170 msgid "msg['Date'] = datetime(2011, 7, 15, 21)" msgstr "" -msgid "Because this is a naive ``datetime`` it will be interpreted as a UTC timestamp, and the resulting value will have a timezone of ``-0000``. Much more useful is to use the :func:`~email.utils.localtime` function from the :mod:`~email.utils` module::" +#: ../../library/email.headerregistry.rst:172 +msgid "" +"Because this is a naive ``datetime`` it will be interpreted as a UTC " +"timestamp, and the resulting value will have a timezone of ``-0000``. Much " +"more useful is to use the :func:`~email.utils.localtime` function from " +"the :mod:`~email.utils` module::" msgstr "" +#: ../../library/email.headerregistry.rst:177 msgid "msg['Date'] = utils.localtime()" msgstr "" -msgid "This example sets the date header to the current time and date using the current timezone offset." +#: ../../library/email.headerregistry.rst:179 +msgid "" +"This example sets the date header to the current time and date using the " +"current timezone offset." msgstr "" -msgid "Address headers are one of the most complex structured header types. The ``AddressHeader`` class provides a generic interface to any address header." +#: ../../library/email.headerregistry.rst:185 +msgid "" +"Address headers are one of the most complex structured header types. The " +"``AddressHeader`` class provides a generic interface to any address header." msgstr "" -msgid "A tuple of :class:`.Group` objects encoding the addresses and groups found in the header value. Addresses that are not part of a group are represented in this list as single-address ``Groups`` whose :attr:`~.Group.display_name` is ``None``." +#: ../../library/email.headerregistry.rst:194 +msgid "" +"A tuple of :class:`.Group` objects encoding the addresses and groups found " +"in the header value. Addresses that are not part of a group are represented " +"in this list as single-address ``Groups`` whose :attr:`~.Group.display_name` " +"is ``None``." msgstr "" -msgid "A tuple of :class:`.Address` objects encoding all of the individual addresses from the header value. If the header value contains any groups, the individual addresses from the group are included in the list at the point where the group occurs in the value (that is, the list of addresses is \"flattened\" into a one dimensional list)." +#: ../../library/email.headerregistry.rst:202 +msgid "" +"A tuple of :class:`.Address` objects encoding all of the individual " +"addresses from the header value. If the header value contains any groups, " +"the individual addresses from the group are included in the list at the " +"point where the group occurs in the value (that is, the list of addresses is " +"\"flattened\" into a one dimensional list)." msgstr "" -msgid "The ``decoded`` value of the header will have all encoded words decoded to unicode. :class:`~encodings.idna` encoded domain names are also decoded to unicode. The ``decoded`` value is set by :ref:`joining ` the :class:`str` value of the elements of the ``groups`` attribute with ``', '``." +#: ../../library/email.headerregistry.rst:208 +msgid "" +"The ``decoded`` value of the header will have all encoded words decoded to " +"unicode. :class:`~encodings.idna` encoded domain names are also decoded to " +"unicode. The ``decoded`` value is set by :ref:`joining ` " +"the :class:`str` value of the elements of the ``groups`` attribute with ``', " +"'``." msgstr "" -msgid "A list of :class:`.Address` and :class:`.Group` objects in any combination may be used to set the value of an address header. ``Group`` objects whose ``display_name`` is ``None`` will be interpreted as single addresses, which allows an address list to be copied with groups intact by using the list obtained from the ``groups`` attribute of the source header." +#: ../../library/email.headerregistry.rst:214 +msgid "" +"A list of :class:`.Address` and :class:`.Group` objects in any combination " +"may be used to set the value of an address header. ``Group`` objects whose " +"``display_name`` is ``None`` will be interpreted as single addresses, which " +"allows an address list to be copied with groups intact by using the list " +"obtained from the ``groups`` attribute of the source header." msgstr "" -msgid "A subclass of :class:`.AddressHeader` that adds one additional attribute:" +#: ../../library/email.headerregistry.rst:223 +msgid "" +"A subclass of :class:`.AddressHeader` that adds one additional attribute:" msgstr "" -msgid "The single address encoded by the header value. If the header value actually contains more than one address (which would be a violation of the RFC under the default :mod:`~email.policy`), accessing this attribute will result in a :exc:`ValueError`." +#: ../../library/email.headerregistry.rst:229 +msgid "" +"The single address encoded by the header value. If the header value " +"actually contains more than one address (which would be a violation of the " +"RFC under the default :mod:`~email.policy`), accessing this attribute will " +"result in a :exc:`ValueError`." msgstr "" -msgid "Many of the above classes also have a ``Unique`` variant (for example, ``UniqueUnstructuredHeader``). The only difference is that in the ``Unique`` variant, :attr:`~.BaseHeader.max_count` is set to 1." +#: ../../library/email.headerregistry.rst:235 +msgid "" +"Many of the above classes also have a ``Unique`` variant (for example, " +"``UniqueUnstructuredHeader``). The only difference is that in the " +"``Unique`` variant, :attr:`~.BaseHeader.max_count` is set to 1." msgstr "" -msgid "There is really only one valid value for the :mailheader:`MIME-Version` header, and that is ``1.0``. For future proofing, this header class supports other valid version numbers. If a version number has a valid value per :rfc:`2045`, then the header object will have non-``None`` values for the following attributes:" +#: ../../library/email.headerregistry.rst:242 +msgid "" +"There is really only one valid value for the :mailheader:`MIME-Version` " +"header, and that is ``1.0``. For future proofing, this header class " +"supports other valid version numbers. If a version number has a valid value " +"per :rfc:`2045`, then the header object will have non-``None`` values for " +"the following attributes:" msgstr "" -msgid "The version number as a string, with any whitespace and/or comments removed." +#: ../../library/email.headerregistry.rst:250 +msgid "" +"The version number as a string, with any whitespace and/or comments removed." msgstr "" +#: ../../library/email.headerregistry.rst:255 msgid "The major version number as an integer" msgstr "" +#: ../../library/email.headerregistry.rst:259 msgid "The minor version number as an integer" msgstr "" -msgid "MIME headers all start with the prefix 'Content-'. Each specific header has a certain value, described under the class for that header. Some can also take a list of supplemental parameters, which have a common format. This class serves as a base for all the MIME headers that take parameters." +#: ../../library/email.headerregistry.rst:264 +msgid "" +"MIME headers all start with the prefix 'Content-'. Each specific header has " +"a certain value, described under the class for that header. Some can also " +"take a list of supplemental parameters, which have a common format. This " +"class serves as a base for all the MIME headers that take parameters." msgstr "" +#: ../../library/email.headerregistry.rst:271 msgid "A dictionary mapping parameter names to parameter values." msgstr "" -msgid "A :class:`ParameterizedMIMEHeader` class that handles the :mailheader:`Content-Type` header." +#: ../../library/email.headerregistry.rst:276 +msgid "" +"A :class:`ParameterizedMIMEHeader` class that handles " +"the :mailheader:`Content-Type` header." msgstr "" +#: ../../library/email.headerregistry.rst:281 msgid "The content type string, in the form ``maintype/subtype``." msgstr "" -msgid "A :class:`ParameterizedMIMEHeader` class that handles the :mailheader:`Content-Disposition` header." +#: ../../library/email.headerregistry.rst:290 +msgid "" +"A :class:`ParameterizedMIMEHeader` class that handles " +"the :mailheader:`Content-Disposition` header." msgstr "" +#: ../../library/email.headerregistry.rst:295 msgid "``inline`` and ``attachment`` are the only valid values in common use." msgstr "" +#: ../../library/email.headerregistry.rst:300 msgid "Handles the :mailheader:`Content-Transfer-Encoding` header." msgstr "" -msgid "Valid values are ``7bit``, ``8bit``, ``base64``, and ``quoted-printable``. See :rfc:`2045` for more information." -msgstr "" - -msgid "This is the factory used by :class:`~email.policy.EmailPolicy` by default. ``HeaderRegistry`` builds the class used to create a header instance dynamically, using *base_class* and a specialized class retrieved from a registry that it holds. When a given header name does not appear in the registry, the class specified by *default_class* is used as the specialized class. When *use_default_map* is ``True`` (the default), the standard mapping of header names to classes is copied in to the registry during initialization. *base_class* is always the last class in the generated class's :class:`~type.__bases__` list." +#: ../../library/email.headerregistry.rst:304 +msgid "" +"Valid values are ``7bit``, ``8bit``, ``base64``, and ``quoted-printable``. " +"See :rfc:`2045` for more information." msgstr "" +#: ../../library/email.headerregistry.rst:313 +msgid "" +"This is the factory used by :class:`~email.policy.EmailPolicy` by default. " +"``HeaderRegistry`` builds the class used to create a header instance " +"dynamically, using *base_class* and a specialized class retrieved from a " +"registry that it holds. When a given header name does not appear in the " +"registry, the class specified by *default_class* is used as the specialized " +"class. When *use_default_map* is ``True`` (the default), the standard " +"mapping of header names to classes is copied in to the registry during " +"initialization. *base_class* is always the last class in the generated " +"class's :class:`~type.__bases__` list." +msgstr "" + +#: ../../library/email.headerregistry.rst:323 msgid "The default mappings are:" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "subject" msgstr "" +#: ../../library/email.headerregistry.rst:325 msgid "UniqueUnstructuredHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "date" msgstr "" +#: ../../library/email.headerregistry.rst:326 +#: ../../library/email.headerregistry.rst:328 msgid "UniqueDateHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "resent-date" msgstr "" +#: ../../library/email.headerregistry.rst:327 msgid "DateHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "orig-date" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "sender" msgstr "" +#: ../../library/email.headerregistry.rst:329 msgid "UniqueSingleAddressHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "resent-sender" msgstr "" +#: ../../library/email.headerregistry.rst:330 msgid "SingleAddressHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "to" msgstr "" +#: ../../library/email.headerregistry.rst:331 +#: ../../library/email.headerregistry.rst:333 +#: ../../library/email.headerregistry.rst:335 +#: ../../library/email.headerregistry.rst:337 +#: ../../library/email.headerregistry.rst:339 msgid "UniqueAddressHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "resent-to" msgstr "" +#: ../../library/email.headerregistry.rst:332 +#: ../../library/email.headerregistry.rst:334 +#: ../../library/email.headerregistry.rst:336 +#: ../../library/email.headerregistry.rst:338 msgid "AddressHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "cc" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "resent-cc" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "bcc" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "resent-bcc" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "from" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "resent-from" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "reply-to" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "mime-version" msgstr "" +#: ../../library/email.headerregistry.rst:340 msgid "MIMEVersionHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "content-type" msgstr "" +#: ../../library/email.headerregistry.rst:341 msgid "ContentTypeHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "content-disposition" msgstr "" +#: ../../library/email.headerregistry.rst:342 msgid "ContentDispositionHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "content-transfer-encoding" msgstr "" +#: ../../library/email.headerregistry.rst:343 msgid "ContentTransferEncodingHeader" msgstr "" +#: ../../library/email.headerregistry.rst:0 msgid "message-id" msgstr "" +#: ../../library/email.headerregistry.rst:344 msgid "MessageIDHeader" msgstr "" +#: ../../library/email.headerregistry.rst:346 msgid "``HeaderRegistry`` has the following methods:" msgstr "" -msgid "*name* is the name of the header to be mapped. It will be converted to lower case in the registry. *cls* is the specialized class to be used, along with *base_class*, to create the class used to instantiate headers that match *name*." +#: ../../library/email.headerregistry.rst:351 +msgid "" +"*name* is the name of the header to be mapped. It will be converted to " +"lower case in the registry. *cls* is the specialized class to be used, " +"along with *base_class*, to create the class used to instantiate headers " +"that match *name*." msgstr "" +#: ../../library/email.headerregistry.rst:359 msgid "Construct and return a class to handle creating a *name* header." msgstr "" -msgid "Retrieves the specialized header associated with *name* from the registry (using *default_class* if *name* does not appear in the registry) and composes it with *base_class* to produce a class, calls the constructed class's constructor, passing it the same argument list, and finally returns the class instance created thereby." +#: ../../library/email.headerregistry.rst:364 +msgid "" +"Retrieves the specialized header associated with *name* from the registry " +"(using *default_class* if *name* does not appear in the registry) and " +"composes it with *base_class* to produce a class, calls the constructed " +"class's constructor, passing it the same argument list, and finally returns " +"the class instance created thereby." msgstr "" -msgid "The following classes are the classes used to represent data parsed from structured headers and can, in general, be used by an application program to construct structured values to assign to specific headers." +#: ../../library/email.headerregistry.rst:371 +msgid "" +"The following classes are the classes used to represent data parsed from " +"structured headers and can, in general, be used by an application program to " +"construct structured values to assign to specific headers." msgstr "" -msgid "The class used to represent an email address. The general form of an address is::" +#: ../../library/email.headerregistry.rst:378 +msgid "" +"The class used to represent an email address. The general form of an " +"address is::" msgstr "" +#: ../../library/email.headerregistry.rst:381 msgid "[display_name] " msgstr "" +#: ../../library/email.headerregistry.rst:383 msgid "or::" msgstr "" +#: ../../library/email.headerregistry.rst:385 msgid "username@domain" msgstr "" -msgid "where each part must conform to specific syntax rules spelled out in :rfc:`5322`." +#: ../../library/email.headerregistry.rst:387 +msgid "" +"where each part must conform to specific syntax rules spelled out " +"in :rfc:`5322`." msgstr "" -msgid "As a convenience *addr_spec* can be specified instead of *username* and *domain*, in which case *username* and *domain* will be parsed from the *addr_spec*. An *addr_spec* must be a properly RFC quoted string; if it is not ``Address`` will raise an error. Unicode characters are allowed and will be property encoded when serialized. However, per the RFCs, unicode is *not* allowed in the username portion of the address." +#: ../../library/email.headerregistry.rst:390 +msgid "" +"As a convenience *addr_spec* can be specified instead of *username* and " +"*domain*, in which case *username* and *domain* will be parsed from the " +"*addr_spec*. An *addr_spec* must be a properly RFC quoted string; if it is " +"not ``Address`` will raise an error. Unicode characters are allowed and " +"will be property encoded when serialized. However, per the RFCs, unicode is " +"*not* allowed in the username portion of the address." msgstr "" -msgid "The display name portion of the address, if any, with all quoting removed. If the address does not have a display name, this attribute will be an empty string." +#: ../../library/email.headerregistry.rst:399 +msgid "" +"The display name portion of the address, if any, with all quoting removed. " +"If the address does not have a display name, this attribute will be an empty " +"string." msgstr "" +#: ../../library/email.headerregistry.rst:405 msgid "The ``username`` portion of the address, with all quoting removed." msgstr "" +#: ../../library/email.headerregistry.rst:409 msgid "The ``domain`` portion of the address." msgstr "" -msgid "The ``username@domain`` portion of the address, correctly quoted for use as a bare address (the second form shown above). This attribute is not mutable." +#: ../../library/email.headerregistry.rst:413 +msgid "" +"The ``username@domain`` portion of the address, correctly quoted for use as " +"a bare address (the second form shown above). This attribute is not mutable." msgstr "" -msgid "The ``str`` value of the object is the address quoted according to :rfc:`5322` rules, but with no Content Transfer Encoding of any non-ASCII characters." +#: ../../library/email.headerregistry.rst:419 +msgid "" +"The ``str`` value of the object is the address quoted according " +"to :rfc:`5322` rules, but with no Content Transfer Encoding of any non-ASCII " +"characters." msgstr "" -msgid "To support SMTP (:rfc:`5321`), ``Address`` handles one special case: if ``username`` and ``domain`` are both the empty string (or ``None``), then the string value of the ``Address`` is ``<>``." +#: ../../library/email.headerregistry.rst:423 +msgid "" +"To support SMTP (:rfc:`5321`), ``Address`` handles one special case: if " +"``username`` and ``domain`` are both the empty string (or ``None``), then " +"the string value of the ``Address`` is ``<>``." msgstr "" -msgid "The class used to represent an address group. The general form of an address group is::" +#: ../../library/email.headerregistry.rst:430 +msgid "" +"The class used to represent an address group. The general form of an " +"address group is::" msgstr "" +#: ../../library/email.headerregistry.rst:433 msgid "display_name: [address-list];" msgstr "" -msgid "As a convenience for processing lists of addresses that consist of a mixture of groups and single addresses, a ``Group`` may also be used to represent single addresses that are not part of a group by setting *display_name* to ``None`` and providing a list of the single address as *addresses*." +#: ../../library/email.headerregistry.rst:435 +msgid "" +"As a convenience for processing lists of addresses that consist of a mixture " +"of groups and single addresses, a ``Group`` may also be used to represent " +"single addresses that are not part of a group by setting *display_name* to " +"``None`` and providing a list of the single address as *addresses*." msgstr "" -msgid "The ``display_name`` of the group. If it is ``None`` and there is exactly one ``Address`` in ``addresses``, then the ``Group`` represents a single address that is not in a group." +#: ../../library/email.headerregistry.rst:442 +msgid "" +"The ``display_name`` of the group. If it is ``None`` and there is exactly " +"one ``Address`` in ``addresses``, then the ``Group`` represents a single " +"address that is not in a group." msgstr "" -msgid "A possibly empty tuple of :class:`.Address` objects representing the addresses in the group." +#: ../../library/email.headerregistry.rst:448 +msgid "" +"A possibly empty tuple of :class:`.Address` objects representing the " +"addresses in the group." msgstr "" -msgid "The ``str`` value of a ``Group`` is formatted according to :rfc:`5322`, but with no Content Transfer Encoding of any non-ASCII characters. If ``display_name`` is none and there is a single ``Address`` in the ``addresses`` list, the ``str`` value will be the same as the ``str`` of that single ``Address``." +#: ../../library/email.headerregistry.rst:453 +msgid "" +"The ``str`` value of a ``Group`` is formatted according to :rfc:`5322`, but " +"with no Content Transfer Encoding of any non-ASCII characters. If " +"``display_name`` is none and there is a single ``Address`` in the " +"``addresses`` list, the ``str`` value will be the same as the ``str`` of " +"that single ``Address``." msgstr "" +#: ../../library/email.headerregistry.rst:461 msgid "Footnotes" msgstr "" -msgid "Originally added in 3.3 as a :term:`provisional module `" +#: ../../library/email.headerregistry.rst:462 +msgid "" +"Originally added in 3.3 as a :term:`provisional module `" msgstr "" diff --git a/library/email.iterators.po b/library/email.iterators.po index cad3e825b..f5c9f7279 100644 --- a/library/email.iterators.po +++ b/library/email.iterators.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,36 +21,70 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.iterators.rst:2 msgid ":mod:`!email.iterators`: Iterators" msgstr "" +#: ../../library/email.iterators.rst:7 msgid "**Source code:** :source:`Lib/email/iterators.py`" msgstr "" -msgid "Iterating over a message object tree is fairly easy with the :meth:`Message.walk ` method. The :mod:`!email.iterators` module provides some useful higher level iterations over message object trees." +#: ../../library/email.iterators.rst:11 +msgid "" +"Iterating over a message object tree is fairly easy with " +"the :meth:`Message.walk ` method. The :mod:`!" +"email.iterators` module provides some useful higher level iterations over " +"message object trees." msgstr "" -msgid "This iterates over all the payloads in all the subparts of *msg*, returning the string payloads line-by-line. It skips over all the subpart headers, and it skips over any subpart with a payload that isn't a Python string. This is somewhat equivalent to reading the flat text representation of the message from a file using :meth:`~io.TextIOBase.readline`, skipping over all the intervening headers." +#: ../../library/email.iterators.rst:19 +msgid "" +"This iterates over all the payloads in all the subparts of *msg*, returning " +"the string payloads line-by-line. It skips over all the subpart headers, " +"and it skips over any subpart with a payload that isn't a Python string. " +"This is somewhat equivalent to reading the flat text representation of the " +"message from a file using :meth:`~io.TextIOBase.readline`, skipping over all " +"the intervening headers." msgstr "" -msgid "Optional *decode* is passed through to :meth:`Message.get_payload `." +#: ../../library/email.iterators.rst:26 +msgid "" +"Optional *decode* is passed through to :meth:`Message.get_payload " +"`." msgstr "" -msgid "This iterates over all the subparts of *msg*, returning only those subparts that match the MIME type specified by *maintype* and *subtype*." +#: ../../library/email.iterators.rst:32 +msgid "" +"This iterates over all the subparts of *msg*, returning only those subparts " +"that match the MIME type specified by *maintype* and *subtype*." msgstr "" -msgid "Note that *subtype* is optional; if omitted, then subpart MIME type matching is done only with the main type. *maintype* is optional too; it defaults to :mimetype:`text`." +#: ../../library/email.iterators.rst:35 +msgid "" +"Note that *subtype* is optional; if omitted, then subpart MIME type matching " +"is done only with the main type. *maintype* is optional too; it defaults " +"to :mimetype:`text`." msgstr "" -msgid "Thus, by default :func:`typed_subpart_iterator` returns each subpart that has a MIME type of :mimetype:`text/\\*`." +#: ../../library/email.iterators.rst:39 +msgid "" +"Thus, by default :func:`typed_subpart_iterator` returns each subpart that " +"has a MIME type of :mimetype:`text/\\*`." msgstr "" -msgid "The following function has been added as a useful debugging tool. It should *not* be considered part of the supported public interface for the package." +#: ../../library/email.iterators.rst:43 +msgid "" +"The following function has been added as a useful debugging tool. It should " +"*not* be considered part of the supported public interface for the package." msgstr "" -msgid "Prints an indented representation of the content types of the message object structure. For example:" +#: ../../library/email.iterators.rst:48 +msgid "" +"Prints an indented representation of the content types of the message object " +"structure. For example:" msgstr "" +#: ../../library/email.iterators.rst:57 msgid "" ">>> msg = email.message_from_file(somefile)\n" ">>> _structure(msg)\n" @@ -71,5 +105,9 @@ msgid "" " text/plain" msgstr "" -msgid "Optional *fp* is a file-like object to print the output to. It must be suitable for Python's :func:`print` function. *level* is used internally. *include_default*, if true, prints the default type as well." +#: ../../library/email.iterators.rst:81 +msgid "" +"Optional *fp* is a file-like object to print the output to. It must be " +"suitable for Python's :func:`print` function. *level* is used internally. " +"*include_default*, if true, prints the default type as well." msgstr "" diff --git a/library/email.message.po b/library/email.message.po index cedff1a53..4b1d16109 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,243 +23,576 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.message.rst:2 msgid ":mod:`!email.message`: Representing an email message" msgstr "" +#: ../../library/email.message.rst:10 msgid "**Source code:** :source:`Lib/email/message.py`" msgstr "" +#: ../../library/email.message.rst:14 msgid "[1]_" msgstr "" -msgid "The central class in the :mod:`email` package is the :class:`EmailMessage` class, imported from the :mod:`!email.message` module. It is the base class for the :mod:`email` object model. :class:`EmailMessage` provides the core functionality for setting and querying header fields, for accessing message bodies, and for creating or modifying structured messages." -msgstr "" - -msgid "An email message consists of *headers* and a *payload* (which is also referred to as the *content*). Headers are :rfc:`5322` or :rfc:`6532` style field names and values, where the field name and value are separated by a colon. The colon is not part of either the field name or the field value. The payload may be a simple text message, or a binary object, or a structured sequence of sub-messages each with their own set of headers and their own payload. The latter type of payload is indicated by the message having a MIME type such as :mimetype:`multipart/\\*` or :mimetype:`message/rfc822`." -msgstr "" - -msgid "The conceptual model provided by an :class:`EmailMessage` object is that of an ordered dictionary of headers coupled with a *payload* that represents the :rfc:`5322` body of the message, which might be a list of sub-``EmailMessage`` objects. In addition to the normal dictionary methods for accessing the header names and values, there are methods for accessing specialized information from the headers (for example the MIME content type), for operating on the payload, for generating a serialized version of the message, and for recursively walking over the object tree." -msgstr "" - -msgid "The :class:`EmailMessage` dictionary-like interface is indexed by the header names, which must be ASCII values. The values of the dictionary are strings with some extra methods. Headers are stored and returned in case-preserving form, but field names are matched case-insensitively. The keys are ordered, but unlike a real dict, there can be duplicates. Additional methods are provided for working with headers that have duplicate keys." +#: ../../library/email.message.rst:16 +msgid "" +"The central class in the :mod:`email` package is the :class:`EmailMessage` " +"class, imported from the :mod:`!email.message` module. It is the base class " +"for the :mod:`email` object model. :class:`EmailMessage` provides the core " +"functionality for setting and querying header fields, for accessing message " +"bodies, and for creating or modifying structured messages." msgstr "" -msgid "The *payload* is either a string or bytes object, in the case of simple message objects, or a list of :class:`EmailMessage` objects, for MIME container documents such as :mimetype:`multipart/\\*` and :mimetype:`message/rfc822` message objects." +#: ../../library/email.message.rst:22 +msgid "" +"An email message consists of *headers* and a *payload* (which is also " +"referred to as the *content*). Headers are :rfc:`5322` or :rfc:`6532` style " +"field names and values, where the field name and value are separated by a " +"colon. The colon is not part of either the field name or the field value. " +"The payload may be a simple text message, or a binary object, or a " +"structured sequence of sub-messages each with their own set of headers and " +"their own payload. The latter type of payload is indicated by the message " +"having a MIME type such as :mimetype:`multipart/\\*` or :mimetype:`message/" +"rfc822`." +msgstr "" + +#: ../../library/email.message.rst:31 +msgid "" +"The conceptual model provided by an :class:`EmailMessage` object is that of " +"an ordered dictionary of headers coupled with a *payload* that represents " +"the :rfc:`5322` body of the message, which might be a list of sub-" +"``EmailMessage`` objects. In addition to the normal dictionary methods for " +"accessing the header names and values, there are methods for accessing " +"specialized information from the headers (for example the MIME content " +"type), for operating on the payload, for generating a serialized version of " +"the message, and for recursively walking over the object tree." msgstr "" -msgid "If *policy* is specified use the rules it specifies to update and serialize the representation of the message. If *policy* is not set, use the :class:`~email.policy.default` policy, which follows the rules of the email RFCs except for line endings (instead of the RFC mandated ``\\r\\n``, it uses the Python standard ``\\n`` line endings). For more information see the :mod:`~email.policy` documentation. [2]_" +#: ../../library/email.message.rst:40 +msgid "" +"The :class:`EmailMessage` dictionary-like interface is indexed by the header " +"names, which must be ASCII values. The values of the dictionary are strings " +"with some extra methods. Headers are stored and returned in case-preserving " +"form, but field names are matched case-insensitively. The keys are ordered, " +"but unlike a real dict, there can be duplicates. Additional methods are " +"provided for working with headers that have duplicate keys." msgstr "" -msgid "Return the entire message flattened as a string. When optional *unixfrom* is true, the envelope header is included in the returned string. *unixfrom* defaults to ``False``. For backward compatibility with the base :class:`~email.message.Message` class *maxheaderlen* is accepted, but defaults to ``None``, which means that by default the line length is controlled by the :attr:`~email.policy.Policy.max_line_length` of the policy. The *policy* argument may be used to override the default policy obtained from the message instance. This can be used to control some of the formatting produced by the method, since the specified *policy* will be passed to the :class:`~email.generator.Generator`." +#: ../../library/email.message.rst:47 +msgid "" +"The *payload* is either a string or bytes object, in the case of simple " +"message objects, or a list of :class:`EmailMessage` objects, for MIME " +"container documents such as :mimetype:`multipart/\\*` and :mimetype:`message/" +"rfc822` message objects." msgstr "" -msgid "Flattening the message may trigger changes to the :class:`EmailMessage` if defaults need to be filled in to complete the transformation to a string (for example, MIME boundaries may be generated or modified)." +#: ../../library/email.message.rst:55 +msgid "" +"If *policy* is specified use the rules it specifies to update and serialize " +"the representation of the message. If *policy* is not set, use " +"the :class:`~email.policy.default` policy, which follows the rules of the " +"email RFCs except for line endings (instead of the RFC mandated ``\\r\\n``, " +"it uses the Python standard ``\\n`` line endings). For more information see " +"the :mod:`~email.policy` documentation. [2]_" msgstr "" -msgid "Note that this method is provided as a convenience and may not be the most useful way to serialize messages in your application, especially if you are dealing with multiple messages. See :class:`email.generator.Generator` for a more flexible API for serializing messages. Note also that this method is restricted to producing messages serialized as \"7 bit clean\" when :attr:`~email.policy.EmailPolicy.utf8` is ``False``, which is the default." +#: ../../library/email.message.rst:64 +msgid "" +"Return the entire message flattened as a string. When optional *unixfrom* " +"is true, the envelope header is included in the returned string. *unixfrom* " +"defaults to ``False``. For backward compatibility with the " +"base :class:`~email.message.Message` class *maxheaderlen* is accepted, but " +"defaults to ``None``, which means that by default the line length is " +"controlled by the :attr:`~email.policy.Policy.max_line_length` of the " +"policy. The *policy* argument may be used to override the default policy " +"obtained from the message instance. This can be used to control some of the " +"formatting produced by the method, since the specified *policy* will be " +"passed to the :class:`~email.generator.Generator`." +msgstr "" + +#: ../../library/email.message.rst:76 ../../library/email.message.rst:114 +msgid "" +"Flattening the message may trigger changes to the :class:`EmailMessage` if " +"defaults need to be filled in to complete the transformation to a string " +"(for example, MIME boundaries may be generated or modified)." msgstr "" -msgid "the default behavior when *maxheaderlen* is not specified was changed from defaulting to 0 to defaulting to the value of *max_line_length* from the policy." +#: ../../library/email.message.rst:80 +msgid "" +"Note that this method is provided as a convenience and may not be the most " +"useful way to serialize messages in your application, especially if you are " +"dealing with multiple messages. See :class:`email.generator.Generator` for " +"a more flexible API for serializing messages. Note also that this method is " +"restricted to producing messages serialized as \"7 bit clean\" " +"when :attr:`~email.policy.EmailPolicy.utf8` is ``False``, which is the " +"default." msgstr "" -msgid "Equivalent to ``as_string(policy=self.policy.clone(utf8=True))``. Allows ``str(msg)`` to produce a string containing the serialized message in a readable format." +#: ../../library/email.message.rst:88 +msgid "" +"the default behavior when *maxheaderlen* is not specified was changed from " +"defaulting to 0 to defaulting to the value of *max_line_length* from the " +"policy." msgstr "" -msgid "the method was changed to use ``utf8=True``, thus producing an :rfc:`6531`-like message representation, instead of being a direct alias for :meth:`as_string`." +#: ../../library/email.message.rst:95 +msgid "" +"Equivalent to ``as_string(policy=self.policy.clone(utf8=True))``. Allows " +"``str(msg)`` to produce a string containing the serialized message in a " +"readable format." msgstr "" -msgid "Return the entire message flattened as a bytes object. When optional *unixfrom* is true, the envelope header is included in the returned string. *unixfrom* defaults to ``False``. The *policy* argument may be used to override the default policy obtained from the message instance. This can be used to control some of the formatting produced by the method, since the specified *policy* will be passed to the :class:`~email.generator.BytesGenerator`." +#: ../../library/email.message.rst:99 +msgid "" +"the method was changed to use ``utf8=True``, thus producing an :rfc:`6531`-" +"like message representation, instead of being a direct alias " +"for :meth:`as_string`." msgstr "" -msgid "Note that this method is provided as a convenience and may not be the most useful way to serialize messages in your application, especially if you are dealing with multiple messages. See :class:`email.generator.BytesGenerator` for a more flexible API for serializing messages." +#: ../../library/email.message.rst:106 +msgid "" +"Return the entire message flattened as a bytes object. When optional " +"*unixfrom* is true, the envelope header is included in the returned string. " +"*unixfrom* defaults to ``False``. The *policy* argument may be used to " +"override the default policy obtained from the message instance. This can be " +"used to control some of the formatting produced by the method, since the " +"specified *policy* will be passed to " +"the :class:`~email.generator.BytesGenerator`." msgstr "" -msgid "Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes object containing the serialized message." +#: ../../library/email.message.rst:118 +msgid "" +"Note that this method is provided as a convenience and may not be the most " +"useful way to serialize messages in your application, especially if you are " +"dealing with multiple messages. See :class:`email.generator.BytesGenerator` " +"for a more flexible API for serializing messages." msgstr "" -msgid "Return ``True`` if the message's payload is a list of sub-\\ :class:`EmailMessage` objects, otherwise return ``False``. When :meth:`is_multipart` returns ``False``, the payload should be a string object (which might be a CTE encoded binary payload). Note that :meth:`is_multipart` returning ``True`` does not necessarily mean that \"msg.get_content_maintype() == 'multipart'\" will return the ``True``. For example, ``is_multipart`` will return ``True`` when the :class:`EmailMessage` is of type ``message/rfc822``." +#: ../../library/email.message.rst:127 +msgid "" +"Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes " +"object containing the serialized message." msgstr "" -msgid "Set the message's envelope header to *unixfrom*, which should be a string. (See :class:`~mailbox.mboxMessage` for a brief description of this header.)" +#: ../../library/email.message.rst:133 +msgid "" +"Return ``True`` if the message's payload is a list of sub-" +"\\ :class:`EmailMessage` objects, otherwise return ``False``. " +"When :meth:`is_multipart` returns ``False``, the payload should be a string " +"object (which might be a CTE encoded binary payload). Note " +"that :meth:`is_multipart` returning ``True`` does not necessarily mean that " +"\"msg.get_content_maintype() == 'multipart'\" will return the ``True``. For " +"example, ``is_multipart`` will return ``True`` when " +"the :class:`EmailMessage` is of type ``message/rfc822``." msgstr "" -msgid "Return the message's envelope header. Defaults to ``None`` if the envelope header was never set." +#: ../../library/email.message.rst:145 +msgid "" +"Set the message's envelope header to *unixfrom*, which should be a string. " +"(See :class:`~mailbox.mboxMessage` for a brief description of this header.)" msgstr "" -msgid "The following methods implement the mapping-like interface for accessing the message's headers. Note that there are some semantic differences between these methods and a normal mapping (i.e. dictionary) interface. For example, in a dictionary there are no duplicate keys, but here there may be duplicate message headers. Also, in dictionaries there is no guaranteed order to the keys returned by :meth:`keys`, but in an :class:`EmailMessage` object, headers are always returned in the order they appeared in the original message, or in which they were added to the message later. Any header deleted and then re-added is always appended to the end of the header list." +#: ../../library/email.message.rst:152 +msgid "" +"Return the message's envelope header. Defaults to ``None`` if the envelope " +"header was never set." msgstr "" -msgid "These semantic differences are intentional and are biased toward convenience in the most common use cases." +#: ../../library/email.message.rst:156 +msgid "" +"The following methods implement the mapping-like interface for accessing the " +"message's headers. Note that there are some semantic differences between " +"these methods and a normal mapping (i.e. dictionary) interface. For " +"example, in a dictionary there are no duplicate keys, but here there may be " +"duplicate message headers. Also, in dictionaries there is no guaranteed " +"order to the keys returned by :meth:`keys`, but in an :class:`EmailMessage` " +"object, headers are always returned in the order they appeared in the " +"original message, or in which they were added to the message later. Any " +"header deleted and then re-added is always appended to the end of the header " +"list." +msgstr "" + +#: ../../library/email.message.rst:167 +msgid "" +"These semantic differences are intentional and are biased toward convenience " +"in the most common use cases." msgstr "" -msgid "Note that in all cases, any envelope header present in the message is not included in the mapping interface." +#: ../../library/email.message.rst:170 +msgid "" +"Note that in all cases, any envelope header present in the message is not " +"included in the mapping interface." msgstr "" +#: ../../library/email.message.rst:176 msgid "Return the total number of headers, including duplicates." msgstr "" -msgid "Return ``True`` if the message object has a field named *name*. Matching is done without regard to case and *name* does not include the trailing colon. Used for the ``in`` operator. For example::" +#: ../../library/email.message.rst:181 +msgid "" +"Return ``True`` if the message object has a field named *name*. Matching is " +"done without regard to case and *name* does not include the trailing colon. " +"Used for the ``in`` operator. For example::" msgstr "" +#: ../../library/email.message.rst:185 msgid "" "if 'message-id' in myMessage:\n" " print('Message-ID:', myMessage['message-id'])" msgstr "" -msgid "Return the value of the named header field. *name* does not include the colon field separator. If the header is missing, ``None`` is returned; a :exc:`KeyError` is never raised." +#: ../../library/email.message.rst:191 +msgid "" +"Return the value of the named header field. *name* does not include the " +"colon field separator. If the header is missing, ``None`` is returned; " +"a :exc:`KeyError` is never raised." msgstr "" -msgid "Note that if the named field appears more than once in the message's headers, exactly which of those field values will be returned is undefined. Use the :meth:`get_all` method to get the values of all the extant headers named *name*." +#: ../../library/email.message.rst:195 +msgid "" +"Note that if the named field appears more than once in the message's " +"headers, exactly which of those field values will be returned is undefined. " +"Use the :meth:`get_all` method to get the values of all the extant headers " +"named *name*." msgstr "" -msgid "Using the standard (non-``compat32``) policies, the returned value is an instance of a subclass of :class:`email.headerregistry.BaseHeader`." +#: ../../library/email.message.rst:200 +msgid "" +"Using the standard (non-``compat32``) policies, the returned value is an " +"instance of a subclass of :class:`email.headerregistry.BaseHeader`." msgstr "" -msgid "Add a header to the message with field name *name* and value *val*. The field is appended to the end of the message's existing headers." +#: ../../library/email.message.rst:206 +msgid "" +"Add a header to the message with field name *name* and value *val*. The " +"field is appended to the end of the message's existing headers." msgstr "" -msgid "Note that this does *not* overwrite or delete any existing header with the same name. If you want to ensure that the new header is the only one present in the message with field name *name*, delete the field first, e.g.::" +#: ../../library/email.message.rst:209 +msgid "" +"Note that this does *not* overwrite or delete any existing header with the " +"same name. If you want to ensure that the new header is the only one " +"present in the message with field name *name*, delete the field first, e.g.::" msgstr "" +#: ../../library/email.message.rst:213 msgid "" "del msg['subject']\n" "msg['subject'] = 'Python roolz!'" msgstr "" -msgid "If the :mod:`policy ` defines certain headers to be unique (as the standard policies do), this method may raise a :exc:`ValueError` when an attempt is made to assign a value to such a header when one already exists. This behavior is intentional for consistency's sake, but do not depend on it as we may choose to make such assignments do an automatic deletion of the existing header in the future." +#: ../../library/email.message.rst:216 +msgid "" +"If the :mod:`policy ` defines certain headers to be unique (as " +"the standard policies do), this method may raise a :exc:`ValueError` when an " +"attempt is made to assign a value to such a header when one already exists. " +"This behavior is intentional for consistency's sake, but do not depend on it " +"as we may choose to make such assignments do an automatic deletion of the " +"existing header in the future." msgstr "" -msgid "Delete all occurrences of the field with name *name* from the message's headers. No exception is raised if the named field isn't present in the headers." +#: ../../library/email.message.rst:226 +msgid "" +"Delete all occurrences of the field with name *name* from the message's " +"headers. No exception is raised if the named field isn't present in the " +"headers." msgstr "" +#: ../../library/email.message.rst:233 msgid "Return a list of all the message's header field names." msgstr "" +#: ../../library/email.message.rst:238 msgid "Return a list of all the message's field values." msgstr "" -msgid "Return a list of 2-tuples containing all the message's field headers and values." +#: ../../library/email.message.rst:243 +msgid "" +"Return a list of 2-tuples containing all the message's field headers and " +"values." msgstr "" -msgid "Return the value of the named header field. This is identical to :meth:`~object.__getitem__` except that optional *failobj* is returned if the named header is missing (*failobj* defaults to ``None``)." +#: ../../library/email.message.rst:249 +msgid "" +"Return the value of the named header field. This is identical " +"to :meth:`~object.__getitem__` except that optional *failobj* is returned if " +"the named header is missing (*failobj* defaults to ``None``)." msgstr "" +#: ../../library/email.message.rst:254 msgid "Here are some additional useful header related methods:" msgstr "" -msgid "Return a list of all the values for the field named *name*. If there are no such named headers in the message, *failobj* is returned (defaults to ``None``)." -msgstr "" - -msgid "Extended header setting. This method is similar to :meth:`__setitem__` except that additional header parameters can be provided as keyword arguments. *_name* is the header field to add and *_value* is the *primary* value for the header." +#: ../../library/email.message.rst:259 +msgid "" +"Return a list of all the values for the field named *name*. If there are no " +"such named headers in the message, *failobj* is returned (defaults to " +"``None``)." msgstr "" -msgid "For each item in the keyword argument dictionary *_params*, the key is taken as the parameter name, with underscores converted to dashes (since dashes are illegal in Python identifiers). Normally, the parameter will be added as ``key=\"value\"`` unless the value is ``None``, in which case only the key will be added." +#: ../../library/email.message.rst:266 +msgid "" +"Extended header setting. This method is similar to :meth:`__setitem__` " +"except that additional header parameters can be provided as keyword " +"arguments. *_name* is the header field to add and *_value* is the *primary* " +"value for the header." msgstr "" -msgid "If the value contains non-ASCII characters, the charset and language may be explicitly controlled by specifying the value as a three tuple in the format ``(CHARSET, LANGUAGE, VALUE)``, where ``CHARSET`` is a string naming the charset to be used to encode the value, ``LANGUAGE`` can usually be set to ``None`` or the empty string (see :rfc:`2231` for other possibilities), and ``VALUE`` is the string value containing non-ASCII code points. If a three tuple is not passed and the value contains non-ASCII characters, it is automatically encoded in :rfc:`2231` format using a ``CHARSET`` of ``utf-8`` and a ``LANGUAGE`` of ``None``." +#: ../../library/email.message.rst:271 +msgid "" +"For each item in the keyword argument dictionary *_params*, the key is taken " +"as the parameter name, with underscores converted to dashes (since dashes " +"are illegal in Python identifiers). Normally, the parameter will be added " +"as ``key=\"value\"`` unless the value is ``None``, in which case only the " +"key will be added." msgstr "" +#: ../../library/email.message.rst:277 +msgid "" +"If the value contains non-ASCII characters, the charset and language may be " +"explicitly controlled by specifying the value as a three tuple in the format " +"``(CHARSET, LANGUAGE, VALUE)``, where ``CHARSET`` is a string naming the " +"charset to be used to encode the value, ``LANGUAGE`` can usually be set to " +"``None`` or the empty string (see :rfc:`2231` for other possibilities), and " +"``VALUE`` is the string value containing non-ASCII code points. If a three " +"tuple is not passed and the value contains non-ASCII characters, it is " +"automatically encoded in :rfc:`2231` format using a ``CHARSET`` of ``utf-8`` " +"and a ``LANGUAGE`` of ``None``." +msgstr "" + +#: ../../library/email.message.rst:287 msgid "Here is an example::" msgstr "" +#: ../../library/email.message.rst:289 msgid "msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" msgstr "" +#: ../../library/email.message.rst:291 msgid "This will add a header that looks like ::" msgstr "" +#: ../../library/email.message.rst:293 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" msgstr "" +#: ../../library/email.message.rst:295 msgid "An example of the extended interface with non-ASCII characters::" msgstr "" +#: ../../library/email.message.rst:297 msgid "" "msg.add_header('Content-Disposition', 'attachment',\n" " filename=('iso-8859-1', '', 'Fußballer.ppt'))" msgstr "" -msgid "Replace a header. Replace the first header found in the message that matches *_name*, retaining header order and field name case of the original header. If no matching header is found, raise a :exc:`KeyError`." +#: ../../library/email.message.rst:303 +msgid "" +"Replace a header. Replace the first header found in the message that " +"matches *_name*, retaining header order and field name case of the original " +"header. If no matching header is found, raise a :exc:`KeyError`." msgstr "" -msgid "Return the message's content type, coerced to lower case of the form :mimetype:`maintype/subtype`. If there is no :mailheader:`Content-Type` header in the message return the value returned by :meth:`get_default_type`. If the :mailheader:`Content-Type` header is invalid, return ``text/plain``." +#: ../../library/email.message.rst:311 +msgid "" +"Return the message's content type, coerced to lower case of the " +"form :mimetype:`maintype/subtype`. If there is no :mailheader:`Content-" +"Type` header in the message return the value returned " +"by :meth:`get_default_type`. If the :mailheader:`Content-Type` header is " +"invalid, return ``text/plain``." msgstr "" -msgid "(According to :rfc:`2045`, messages always have a default type, :meth:`get_content_type` will always return a value. :rfc:`2045` defines a message's default type to be :mimetype:`text/plain` unless it appears inside a :mimetype:`multipart/digest` container, in which case it would be :mimetype:`message/rfc822`. If the :mailheader:`Content-Type` header has an invalid type specification, :rfc:`2045` mandates that the default type be :mimetype:`text/plain`.)" +#: ../../library/email.message.rst:317 +msgid "" +"(According to :rfc:`2045`, messages always have a default " +"type, :meth:`get_content_type` will always return a value. :rfc:`2045` " +"defines a message's default type to be :mimetype:`text/plain` unless it " +"appears inside a :mimetype:`multipart/digest` container, in which case it " +"would be :mimetype:`message/rfc822`. If the :mailheader:`Content-Type` " +"header has an invalid type specification, :rfc:`2045` mandates that the " +"default type be :mimetype:`text/plain`.)" msgstr "" -msgid "Return the message's main content type. This is the :mimetype:`maintype` part of the string returned by :meth:`get_content_type`." +#: ../../library/email.message.rst:328 +msgid "" +"Return the message's main content type. This is the :mimetype:`maintype` " +"part of the string returned by :meth:`get_content_type`." msgstr "" -msgid "Return the message's sub-content type. This is the :mimetype:`subtype` part of the string returned by :meth:`get_content_type`." +#: ../../library/email.message.rst:334 +msgid "" +"Return the message's sub-content type. This is the :mimetype:`subtype` part " +"of the string returned by :meth:`get_content_type`." msgstr "" -msgid "Return the default content type. Most messages have a default content type of :mimetype:`text/plain`, except for messages that are subparts of :mimetype:`multipart/digest` containers. Such subparts have a default content type of :mimetype:`message/rfc822`." +#: ../../library/email.message.rst:340 +msgid "" +"Return the default content type. Most messages have a default content type " +"of :mimetype:`text/plain`, except for messages that are subparts " +"of :mimetype:`multipart/digest` containers. Such subparts have a default " +"content type of :mimetype:`message/rfc822`." msgstr "" -msgid "Set the default content type. *ctype* should either be :mimetype:`text/plain` or :mimetype:`message/rfc822`, although this is not enforced. The default content type is not stored in the :mailheader:`Content-Type` header, so it only affects the return value of the ``get_content_type`` methods when no :mailheader:`Content-Type` header is present in the message." +#: ../../library/email.message.rst:348 +msgid "" +"Set the default content type. *ctype* should either be :mimetype:`text/" +"plain` or :mimetype:`message/rfc822`, although this is not enforced. The " +"default content type is not stored in the :mailheader:`Content-Type` header, " +"so it only affects the return value of the ``get_content_type`` methods when " +"no :mailheader:`Content-Type` header is present in the message." msgstr "" -msgid "Set a parameter in the :mailheader:`Content-Type` header. If the parameter already exists in the header, replace its value with *value*. When *header* is ``Content-Type`` (the default) and the header does not yet exist in the message, add it, set its value to :mimetype:`text/plain`, and append the new parameter value. Optional *header* specifies an alternative header to :mailheader:`Content-Type`." +#: ../../library/email.message.rst:359 +msgid "" +"Set a parameter in the :mailheader:`Content-Type` header. If the parameter " +"already exists in the header, replace its value with *value*. When *header* " +"is ``Content-Type`` (the default) and the header does not yet exist in the " +"message, add it, set its value to :mimetype:`text/plain`, and append the new " +"parameter value. Optional *header* specifies an alternative header " +"to :mailheader:`Content-Type`." msgstr "" -msgid "If the value contains non-ASCII characters, the charset and language may be explicitly specified using the optional *charset* and *language* parameters. Optional *language* specifies the :rfc:`2231` language, defaulting to the empty string. Both *charset* and *language* should be strings. The default is to use the ``utf8`` *charset* and ``None`` for the *language*." +#: ../../library/email.message.rst:366 +msgid "" +"If the value contains non-ASCII characters, the charset and language may be " +"explicitly specified using the optional *charset* and *language* " +"parameters. Optional *language* specifies the :rfc:`2231` language, " +"defaulting to the empty string. Both *charset* and *language* should be " +"strings. The default is to use the ``utf8`` *charset* and ``None`` for the " +"*language*." msgstr "" -msgid "If *replace* is ``False`` (the default) the header is moved to the end of the list of headers. If *replace* is ``True``, the header will be updated in place." +#: ../../library/email.message.rst:373 +msgid "" +"If *replace* is ``False`` (the default) the header is moved to the end of " +"the list of headers. If *replace* is ``True``, the header will be updated " +"in place." msgstr "" -msgid "Use of the *requote* parameter with :class:`EmailMessage` objects is deprecated." +#: ../../library/email.message.rst:377 ../../library/email.message.rst:394 +msgid "" +"Use of the *requote* parameter with :class:`EmailMessage` objects is " +"deprecated." msgstr "" -msgid "Note that existing parameter values of headers may be accessed through the :attr:`~email.headerregistry.ParameterizedMIMEHeader.params` attribute of the header value (for example, ``msg['Content-Type'].params['charset']``)." +#: ../../library/email.message.rst:380 +msgid "" +"Note that existing parameter values of headers may be accessed through " +"the :attr:`~email.headerregistry.ParameterizedMIMEHeader.params` attribute " +"of the header value (for example, ``msg['Content-Type'].params['charset']``)." msgstr "" +#: ../../library/email.message.rst:384 msgid "``replace`` keyword was added." msgstr "" -msgid "Remove the given parameter completely from the :mailheader:`Content-Type` header. The header will be re-written in place without the parameter or its value. Optional *header* specifies an alternative to :mailheader:`Content-Type`." +#: ../../library/email.message.rst:389 +msgid "" +"Remove the given parameter completely from the :mailheader:`Content-Type` " +"header. The header will be re-written in place without the parameter or its " +"value. Optional *header* specifies an alternative to :mailheader:`Content-" +"Type`." msgstr "" -msgid "Return the value of the ``filename`` parameter of the :mailheader:`Content-Disposition` header of the message. If the header does not have a ``filename`` parameter, this method falls back to looking for the ``name`` parameter on the :mailheader:`Content-Type` header. If neither is found, or the header is missing, then *failobj* is returned. The returned string will always be unquoted as per :func:`email.utils.unquote`." +#: ../../library/email.message.rst:400 +msgid "" +"Return the value of the ``filename`` parameter of the :mailheader:`Content-" +"Disposition` header of the message. If the header does not have a " +"``filename`` parameter, this method falls back to looking for the ``name`` " +"parameter on the :mailheader:`Content-Type` header. If neither is found, or " +"the header is missing, then *failobj* is returned. The returned string will " +"always be unquoted as per :func:`email.utils.unquote`." msgstr "" -msgid "Return the value of the ``boundary`` parameter of the :mailheader:`Content-Type` header of the message, or *failobj* if either the header is missing, or has no ``boundary`` parameter. The returned string will always be unquoted as per :func:`email.utils.unquote`." +#: ../../library/email.message.rst:411 +msgid "" +"Return the value of the ``boundary`` parameter of the :mailheader:`Content-" +"Type` header of the message, or *failobj* if either the header is missing, " +"or has no ``boundary`` parameter. The returned string will always be " +"unquoted as per :func:`email.utils.unquote`." msgstr "" -msgid "Set the ``boundary`` parameter of the :mailheader:`Content-Type` header to *boundary*. :meth:`set_boundary` will always quote *boundary* if necessary. A :exc:`~email.errors.HeaderParseError` is raised if the message object has no :mailheader:`Content-Type` header." +#: ../../library/email.message.rst:419 +msgid "" +"Set the ``boundary`` parameter of the :mailheader:`Content-Type` header to " +"*boundary*. :meth:`set_boundary` will always quote *boundary* if " +"necessary. A :exc:`~email.errors.HeaderParseError` is raised if the message " +"object has no :mailheader:`Content-Type` header." msgstr "" -msgid "Note that using this method is subtly different from deleting the old :mailheader:`Content-Type` header and adding a new one with the new boundary via :meth:`add_header`, because :meth:`set_boundary` preserves the order of the :mailheader:`Content-Type` header in the list of headers." +#: ../../library/email.message.rst:424 +msgid "" +"Note that using this method is subtly different from deleting the " +"old :mailheader:`Content-Type` header and adding a new one with the new " +"boundary via :meth:`add_header`, because :meth:`set_boundary` preserves the " +"order of the :mailheader:`Content-Type` header in the list of headers." msgstr "" -msgid "Return the ``charset`` parameter of the :mailheader:`Content-Type` header, coerced to lower case. If there is no :mailheader:`Content-Type` header, or if that header has no ``charset`` parameter, *failobj* is returned." +#: ../../library/email.message.rst:433 +msgid "" +"Return the ``charset`` parameter of the :mailheader:`Content-Type` header, " +"coerced to lower case. If there is no :mailheader:`Content-Type` header, or " +"if that header has no ``charset`` parameter, *failobj* is returned." msgstr "" -msgid "Return a list containing the character set names in the message. If the message is a :mimetype:`multipart`, then the list will contain one element for each subpart in the payload, otherwise, it will be a list of length 1." +#: ../../library/email.message.rst:440 +msgid "" +"Return a list containing the character set names in the message. If the " +"message is a :mimetype:`multipart`, then the list will contain one element " +"for each subpart in the payload, otherwise, it will be a list of length 1." msgstr "" -msgid "Each item in the list will be a string which is the value of the ``charset`` parameter in the :mailheader:`Content-Type` header for the represented subpart. If the subpart has no :mailheader:`Content-Type` header, no ``charset`` parameter, or is not of the :mimetype:`text` main MIME type, then that item in the returned list will be *failobj*." +#: ../../library/email.message.rst:444 +msgid "" +"Each item in the list will be a string which is the value of the ``charset`` " +"parameter in the :mailheader:`Content-Type` header for the represented " +"subpart. If the subpart has no :mailheader:`Content-Type` header, no " +"``charset`` parameter, or is not of the :mimetype:`text` main MIME type, " +"then that item in the returned list will be *failobj*." msgstr "" -msgid "Return ``True`` if there is a :mailheader:`Content-Disposition` header and its (case insensitive) value is ``attachment``, ``False`` otherwise." +#: ../../library/email.message.rst:453 +msgid "" +"Return ``True`` if there is a :mailheader:`Content-Disposition` header and " +"its (case insensitive) value is ``attachment``, ``False`` otherwise." msgstr "" -msgid "is_attachment is now a method instead of a property, for consistency with :meth:`~email.message.Message.is_multipart`." +#: ../../library/email.message.rst:456 +msgid "" +"is_attachment is now a method instead of a property, for consistency " +"with :meth:`~email.message.Message.is_multipart`." msgstr "" -msgid "Return the lowercased value (without parameters) of the message's :mailheader:`Content-Disposition` header if it has one, or ``None``. The possible values for this method are *inline*, *attachment* or ``None`` if the message follows :rfc:`2183`." +#: ../../library/email.message.rst:463 +msgid "" +"Return the lowercased value (without parameters) of the " +"message's :mailheader:`Content-Disposition` header if it has one, or " +"``None``. The possible values for this method are *inline*, *attachment* or " +"``None`` if the message follows :rfc:`2183`." msgstr "" -msgid "The following methods relate to interrogating and manipulating the content (payload) of the message." +#: ../../library/email.message.rst:471 +msgid "" +"The following methods relate to interrogating and manipulating the content " +"(payload) of the message." msgstr "" -msgid "The :meth:`walk` method is an all-purpose generator which can be used to iterate over all the parts and subparts of a message object tree, in depth-first traversal order. You will typically use :meth:`walk` as the iterator in a ``for`` loop; each iteration returns the next subpart." +#: ../../library/email.message.rst:477 +msgid "" +"The :meth:`walk` method is an all-purpose generator which can be used to " +"iterate over all the parts and subparts of a message object tree, in depth-" +"first traversal order. You will typically use :meth:`walk` as the iterator " +"in a ``for`` loop; each iteration returns the next subpart." msgstr "" -msgid "Here's an example that prints the MIME type of every part of a multipart message structure:" +#: ../../library/email.message.rst:482 +msgid "" +"Here's an example that prints the MIME type of every part of a multipart " +"message structure:" msgstr "" +#: ../../library/email.message.rst:491 msgid "" ">>> for part in msg.walk():\n" "... print(part.get_content_type())\n" @@ -272,9 +605,15 @@ msgid "" "text/plain" msgstr "" -msgid "``walk`` iterates over the subparts of any part where :meth:`is_multipart` returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` may return ``False``. We can see this in our example by making use of the ``_structure`` debug helper function:" +#: ../../library/email.message.rst:503 +msgid "" +"``walk`` iterates over the subparts of any part where :meth:`is_multipart` " +"returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` " +"may return ``False``. We can see this in our example by making use of the " +"``_structure`` debug helper function:" msgstr "" +#: ../../library/email.message.rst:509 msgid "" ">>> from email.iterators import _structure\n" ">>> for part in msg.walk():\n" @@ -297,95 +636,264 @@ msgid "" " text/plain" msgstr "" -msgid "Here the ``message`` parts are not ``multiparts``, but they do contain subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the subparts." -msgstr "" - -msgid "Return the MIME part that is the best candidate to be the \"body\" of the message." -msgstr "" - -msgid "*preferencelist* must be a sequence of strings from the set ``related``, ``html``, and ``plain``, and indicates the order of preference for the content type of the part returned." -msgstr "" - -msgid "Start looking for candidate matches with the object on which the ``get_body`` method is called." -msgstr "" - -msgid "If ``related`` is not included in *preferencelist*, consider the root part (or subpart of the root part) of any related encountered as a candidate if the (sub-)part matches a preference." +#: ../../library/email.message.rst:531 +msgid "" +"Here the ``message`` parts are not ``multiparts``, but they do contain " +"subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the " +"subparts." msgstr "" -msgid "When encountering a ``multipart/related``, check the ``start`` parameter and if a part with a matching :mailheader:`Content-ID` is found, consider only it when looking for candidate matches. Otherwise consider only the first (default root) part of the ``multipart/related``." +#: ../../library/email.message.rst:538 +msgid "" +"Return the MIME part that is the best candidate to be the \"body\" of the " +"message." msgstr "" -msgid "If a part has a :mailheader:`Content-Disposition` header, only consider the part a candidate match if the value of the header is ``inline``." +#: ../../library/email.message.rst:541 +msgid "" +"*preferencelist* must be a sequence of strings from the set ``related``, " +"``html``, and ``plain``, and indicates the order of preference for the " +"content type of the part returned." msgstr "" -msgid "If none of the candidates matches any of the preferences in *preferencelist*, return ``None``." +#: ../../library/email.message.rst:545 +msgid "" +"Start looking for candidate matches with the object on which the " +"``get_body`` method is called." msgstr "" -msgid "Notes: (1) For most applications the only *preferencelist* combinations that really make sense are ``('plain',)``, ``('html', 'plain')``, and the default ``('related', 'html', 'plain')``. (2) Because matching starts with the object on which ``get_body`` is called, calling ``get_body`` on a ``multipart/related`` will return the object itself unless *preferencelist* has a non-default value. (3) Messages (or message parts) that do not specify a :mailheader:`Content-Type` or whose :mailheader:`Content-Type` header is invalid will be treated as if they are of type ``text/plain``, which may occasionally cause ``get_body`` to return unexpected results." +#: ../../library/email.message.rst:548 +msgid "" +"If ``related`` is not included in *preferencelist*, consider the root part " +"(or subpart of the root part) of any related encountered as a candidate if " +"the (sub-)part matches a preference." msgstr "" -msgid "Return an iterator over all of the immediate sub-parts of the message that are not candidate \"body\" parts. That is, skip the first occurrence of each of ``text/plain``, ``text/html``, ``multipart/related``, or ``multipart/alternative`` (unless they are explicitly marked as attachments via :mailheader:`Content-Disposition: attachment`), and return all remaining parts. When applied directly to a ``multipart/related``, return an iterator over the all the related parts except the root part (ie: the part pointed to by the ``start`` parameter, or the first part if there is no ``start`` parameter or the ``start`` parameter doesn't match the :mailheader:`Content-ID` of any of the parts). When applied directly to a ``multipart/alternative`` or a non-``multipart``, return an empty iterator." +#: ../../library/email.message.rst:552 +msgid "" +"When encountering a ``multipart/related``, check the ``start`` parameter and " +"if a part with a matching :mailheader:`Content-ID` is found, consider only " +"it when looking for candidate matches. Otherwise consider only the first " +"(default root) part of the ``multipart/related``." msgstr "" -msgid "Return an iterator over all of the immediate sub-parts of the message, which will be empty for a non-``multipart``. (See also :meth:`~email.message.EmailMessage.walk`.)" +#: ../../library/email.message.rst:557 +msgid "" +"If a part has a :mailheader:`Content-Disposition` header, only consider the " +"part a candidate match if the value of the header is ``inline``." msgstr "" -msgid "Call the :meth:`~email.contentmanager.ContentManager.get_content` method of the *content_manager*, passing self as the message object, and passing along any other arguments or keywords as additional arguments. If *content_manager* is not specified, use the ``content_manager`` specified by the current :mod:`~email.policy`." +#: ../../library/email.message.rst:560 +msgid "" +"If none of the candidates matches any of the preferences in " +"*preferencelist*, return ``None``." msgstr "" -msgid "Call the :meth:`~email.contentmanager.ContentManager.set_content` method of the *content_manager*, passing self as the message object, and passing along any other arguments or keywords as additional arguments. If *content_manager* is not specified, use the ``content_manager`` specified by the current :mod:`~email.policy`." +#: ../../library/email.message.rst:563 +msgid "" +"Notes: (1) For most applications the only *preferencelist* combinations that " +"really make sense are ``('plain',)``, ``('html', 'plain')``, and the default " +"``('related', 'html', 'plain')``. (2) Because matching starts with the " +"object on which ``get_body`` is called, calling ``get_body`` on a " +"``multipart/related`` will return the object itself unless *preferencelist* " +"has a non-default value. (3) Messages (or message parts) that do not specify " +"a :mailheader:`Content-Type` or whose :mailheader:`Content-Type` header is " +"invalid will be treated as if they are of type ``text/plain``, which may " +"occasionally cause ``get_body`` to return unexpected results." +msgstr "" + +#: ../../library/email.message.rst:577 +msgid "" +"Return an iterator over all of the immediate sub-parts of the message that " +"are not candidate \"body\" parts. That is, skip the first occurrence of " +"each of ``text/plain``, ``text/html``, ``multipart/related``, or ``multipart/" +"alternative`` (unless they are explicitly marked as attachments " +"via :mailheader:`Content-Disposition: attachment`), and return all remaining " +"parts. When applied directly to a ``multipart/related``, return an iterator " +"over the all the related parts except the root part (ie: the part pointed to " +"by the ``start`` parameter, or the first part if there is no ``start`` " +"parameter or the ``start`` parameter doesn't match the :mailheader:`Content-" +"ID` of any of the parts). When applied directly to a ``multipart/" +"alternative`` or a non-``multipart``, return an empty iterator." +msgstr "" + +#: ../../library/email.message.rst:593 +msgid "" +"Return an iterator over all of the immediate sub-parts of the message, which " +"will be empty for a non-``multipart``. (See " +"also :meth:`~email.message.EmailMessage.walk`.)" msgstr "" -msgid "Convert a non-``multipart`` message into a ``multipart/related`` message, moving any existing :mailheader:`Content-` headers and payload into a (new) first part of the ``multipart``. If *boundary* is specified, use it as the boundary string in the multipart, otherwise leave the boundary to be automatically created when it is needed (for example, when the message is serialized)." +#: ../../library/email.message.rst:600 +msgid "" +"Call the :meth:`~email.contentmanager.ContentManager.get_content` method of " +"the *content_manager*, passing self as the message object, and passing along " +"any other arguments or keywords as additional arguments. If " +"*content_manager* is not specified, use the ``content_manager`` specified by " +"the current :mod:`~email.policy`." msgstr "" -msgid "Convert a non-``multipart`` or a ``multipart/related`` into a ``multipart/alternative``, moving any existing :mailheader:`Content-` headers and payload into a (new) first part of the ``multipart``. If *boundary* is specified, use it as the boundary string in the multipart, otherwise leave the boundary to be automatically created when it is needed (for example, when the message is serialized)." +#: ../../library/email.message.rst:609 +msgid "" +"Call the :meth:`~email.contentmanager.ContentManager.set_content` method of " +"the *content_manager*, passing self as the message object, and passing along " +"any other arguments or keywords as additional arguments. If " +"*content_manager* is not specified, use the ``content_manager`` specified by " +"the current :mod:`~email.policy`." msgstr "" -msgid "Convert a non-``multipart``, a ``multipart/related``, or a ``multipart-alternative`` into a ``multipart/mixed``, moving any existing :mailheader:`Content-` headers and payload into a (new) first part of the ``multipart``. If *boundary* is specified, use it as the boundary string in the multipart, otherwise leave the boundary to be automatically created when it is needed (for example, when the message is serialized)." +#: ../../library/email.message.rst:618 +msgid "" +"Convert a non-``multipart`` message into a ``multipart/related`` message, " +"moving any existing :mailheader:`Content-` headers and payload into a (new) " +"first part of the ``multipart``. If *boundary* is specified, use it as the " +"boundary string in the multipart, otherwise leave the boundary to be " +"automatically created when it is needed (for example, when the message is " +"serialized)." msgstr "" -msgid "If the message is a ``multipart/related``, create a new message object, pass all of the arguments to its :meth:`set_content` method, and :meth:`~email.message.Message.attach` it to the ``multipart``. If the message is a non-``multipart``, call :meth:`make_related` and then proceed as above. If the message is any other type of ``multipart``, raise a :exc:`TypeError`. If *content_manager* is not specified, use the ``content_manager`` specified by the current :mod:`~email.policy`. If the added part has no :mailheader:`Content-Disposition` header, add one with the value ``inline``." +#: ../../library/email.message.rst:628 +msgid "" +"Convert a non-``multipart`` or a ``multipart/related`` into a ``multipart/" +"alternative``, moving any existing :mailheader:`Content-` headers and " +"payload into a (new) first part of the ``multipart``. If *boundary* is " +"specified, use it as the boundary string in the multipart, otherwise leave " +"the boundary to be automatically created when it is needed (for example, " +"when the message is serialized)." msgstr "" -msgid "If the message is a ``multipart/alternative``, create a new message object, pass all of the arguments to its :meth:`set_content` method, and :meth:`~email.message.Message.attach` it to the ``multipart``. If the message is a non-``multipart`` or ``multipart/related``, call :meth:`make_alternative` and then proceed as above. If the message is any other type of ``multipart``, raise a :exc:`TypeError`. If *content_manager* is not specified, use the ``content_manager`` specified by the current :mod:`~email.policy`." +#: ../../library/email.message.rst:638 +msgid "" +"Convert a non-``multipart``, a ``multipart/related``, or a ``multipart-" +"alternative`` into a ``multipart/mixed``, moving any " +"existing :mailheader:`Content-` headers and payload into a (new) first part " +"of the ``multipart``. If *boundary* is specified, use it as the boundary " +"string in the multipart, otherwise leave the boundary to be automatically " +"created when it is needed (for example, when the message is serialized)." msgstr "" -msgid "If the message is a ``multipart/mixed``, create a new message object, pass all of the arguments to its :meth:`set_content` method, and :meth:`~email.message.Message.attach` it to the ``multipart``. If the message is a non-``multipart``, ``multipart/related``, or ``multipart/alternative``, call :meth:`make_mixed` and then proceed as above. If *content_manager* is not specified, use the ``content_manager`` specified by the current :mod:`~email.policy`. If the added part has no :mailheader:`Content-Disposition` header, add one with the value ``attachment``. This method can be used both for explicit attachments (:mailheader:`Content-Disposition: attachment`) and ``inline`` attachments (:mailheader:`Content-Disposition: inline`), by passing appropriate options to the ``content_manager``." +#: ../../library/email.message.rst:648 +msgid "" +"If the message is a ``multipart/related``, create a new message object, pass " +"all of the arguments to its :meth:`set_content` method, " +"and :meth:`~email.message.Message.attach` it to the ``multipart``. If the " +"message is a non-``multipart``, call :meth:`make_related` and then proceed " +"as above. If the message is any other type of ``multipart``, raise " +"a :exc:`TypeError`. If *content_manager* is not specified, use the " +"``content_manager`` specified by the current :mod:`~email.policy`. If the " +"added part has no :mailheader:`Content-Disposition` header, add one with the " +"value ``inline``." +msgstr "" + +#: ../../library/email.message.rst:661 +msgid "" +"If the message is a ``multipart/alternative``, create a new message object, " +"pass all of the arguments to its :meth:`set_content` method, " +"and :meth:`~email.message.Message.attach` it to the ``multipart``. If the " +"message is a non-``multipart`` or ``multipart/related``, " +"call :meth:`make_alternative` and then proceed as above. If the message is " +"any other type of ``multipart``, raise a :exc:`TypeError`. If " +"*content_manager* is not specified, use the ``content_manager`` specified by " +"the current :mod:`~email.policy`." msgstr "" +#: ../../library/email.message.rst:673 +msgid "" +"If the message is a ``multipart/mixed``, create a new message object, pass " +"all of the arguments to its :meth:`set_content` method, " +"and :meth:`~email.message.Message.attach` it to the ``multipart``. If the " +"message is a non-``multipart``, ``multipart/related``, or ``multipart/" +"alternative``, call :meth:`make_mixed` and then proceed as above. If " +"*content_manager* is not specified, use the ``content_manager`` specified by " +"the current :mod:`~email.policy`. If the added part has " +"no :mailheader:`Content-Disposition` header, add one with the value " +"``attachment``. This method can be used both for explicit attachments " +"(:mailheader:`Content-Disposition: attachment`) and ``inline`` attachments " +"(:mailheader:`Content-Disposition: inline`), by passing appropriate options " +"to the ``content_manager``." +msgstr "" + +#: ../../library/email.message.rst:689 msgid "Remove the payload and all of the headers." msgstr "" -msgid "Remove the payload and all of the :mailheader:`!Content-` headers, leaving all other headers intact and in their original order." +#: ../../library/email.message.rst:694 +msgid "" +"Remove the payload and all of the :mailheader:`!Content-` headers, leaving " +"all other headers intact and in their original order." msgstr "" +#: ../../library/email.message.rst:698 msgid ":class:`EmailMessage` objects have the following instance attributes:" msgstr "" -msgid "The format of a MIME document allows for some text between the blank line following the headers, and the first multipart boundary string. Normally, this text is never visible in a MIME-aware mail reader because it falls outside the standard MIME armor. However, when viewing the raw text of the message, or when viewing the message in a non-MIME aware reader, this text can become visible." -msgstr "" - -msgid "The *preamble* attribute contains this leading extra-armor text for MIME documents. When the :class:`~email.parser.Parser` discovers some text after the headers but before the first boundary string, it assigns this text to the message's *preamble* attribute. When the :class:`~email.generator.Generator` is writing out the plain text representation of a MIME message, and it finds the message has a *preamble* attribute, it will write this text in the area between the headers and the first boundary. See :mod:`email.parser` and :mod:`email.generator` for details." +#: ../../library/email.message.rst:703 +msgid "" +"The format of a MIME document allows for some text between the blank line " +"following the headers, and the first multipart boundary string. Normally, " +"this text is never visible in a MIME-aware mail reader because it falls " +"outside the standard MIME armor. However, when viewing the raw text of the " +"message, or when viewing the message in a non-MIME aware reader, this text " +"can become visible." msgstr "" -msgid "Note that if the message object has no preamble, the *preamble* attribute will be ``None``." +#: ../../library/email.message.rst:710 +msgid "" +"The *preamble* attribute contains this leading extra-armor text for MIME " +"documents. When the :class:`~email.parser.Parser` discovers some text after " +"the headers but before the first boundary string, it assigns this text to " +"the message's *preamble* attribute. When " +"the :class:`~email.generator.Generator` is writing out the plain text " +"representation of a MIME message, and it finds the message has a *preamble* " +"attribute, it will write this text in the area between the headers and the " +"first boundary. See :mod:`email.parser` and :mod:`email.generator` for " +"details." +msgstr "" + +#: ../../library/email.message.rst:720 +msgid "" +"Note that if the message object has no preamble, the *preamble* attribute " +"will be ``None``." msgstr "" -msgid "The *epilogue* attribute acts the same way as the *preamble* attribute, except that it contains text that appears between the last boundary and the end of the message. As with the :attr:`~EmailMessage.preamble`, if there is no epilog text this attribute will be ``None``." +#: ../../library/email.message.rst:726 +msgid "" +"The *epilogue* attribute acts the same way as the *preamble* attribute, " +"except that it contains text that appears between the last boundary and the " +"end of the message. As with the :attr:`~EmailMessage.preamble`, if there is " +"no epilog text this attribute will be ``None``." msgstr "" -msgid "The *defects* attribute contains a list of all the problems found when parsing this message. See :mod:`email.errors` for a detailed description of the possible parsing defects." +#: ../../library/email.message.rst:734 +msgid "" +"The *defects* attribute contains a list of all the problems found when " +"parsing this message. See :mod:`email.errors` for a detailed description of " +"the possible parsing defects." msgstr "" -msgid "This class represents a subpart of a MIME message. It is identical to :class:`EmailMessage`, except that no :mailheader:`MIME-Version` headers are added when :meth:`~EmailMessage.set_content` is called, since sub-parts do not need their own :mailheader:`MIME-Version` headers." +#: ../../library/email.message.rst:741 +msgid "" +"This class represents a subpart of a MIME message. It is identical " +"to :class:`EmailMessage`, except that no :mailheader:`MIME-Version` headers " +"are added when :meth:`~EmailMessage.set_content` is called, since sub-parts " +"do not need their own :mailheader:`MIME-Version` headers." msgstr "" +#: ../../library/email.message.rst:748 msgid "Footnotes" msgstr "" -msgid "Originally added in 3.4 as a :term:`provisional module `. Docs for legacy message class moved to :ref:`compat32_message`." +#: ../../library/email.message.rst:749 +msgid "" +"Originally added in 3.4 as a :term:`provisional module `. Docs for legacy message class moved to :ref:`compat32_message`." msgstr "" -msgid "The :class:`EmailMessage` class requires a policy that provides a ``content_manager`` attribute for content management methods like ``set_content()`` and ``get_content()`` to work. The legacy :const:`~email.policy.compat32` policy does not support these methods and should not be used with :class:`EmailMessage`." +#: ../../library/email.message.rst:753 +msgid "" +"The :class:`EmailMessage` class requires a policy that provides a " +"``content_manager`` attribute for content management methods like " +"``set_content()`` and ``get_content()`` to work. The " +"legacy :const:`~email.policy.compat32` policy does not support these methods " +"and should not be used with :class:`EmailMessage`." msgstr "" diff --git a/library/email.mime.po b/library/email.mime.po index 815fe7f90..9165ecde7 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,116 +21,293 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.mime.rst:2 msgid ":mod:`!email.mime`: Creating email and MIME objects from scratch" msgstr "" +#: ../../library/email.mime.rst:7 msgid "**Source code:** :source:`Lib/email/mime/`" msgstr "" -msgid "This module is part of the legacy (``Compat32``) email API. Its functionality is partially replaced by the :mod:`~email.contentmanager` in the new API, but in certain applications these classes may still be useful, even in non-legacy code." +#: ../../library/email.mime.rst:11 +msgid "" +"This module is part of the legacy (``Compat32``) email API. Its " +"functionality is partially replaced by the :mod:`~email.contentmanager` in " +"the new API, but in certain applications these classes may still be useful, " +"even in non-legacy code." msgstr "" -msgid "Ordinarily, you get a message object structure by passing a file or some text to a parser, which parses the text and returns the root message object. However you can also build a complete message structure from scratch, or even individual :class:`~email.message.Message` objects by hand. In fact, you can also take an existing structure and add new :class:`~email.message.Message` objects, move them around, etc. This makes a very convenient interface for slicing-and-dicing MIME messages." +#: ../../library/email.mime.rst:16 +msgid "" +"Ordinarily, you get a message object structure by passing a file or some " +"text to a parser, which parses the text and returns the root message " +"object. However you can also build a complete message structure from " +"scratch, or even individual :class:`~email.message.Message` objects by " +"hand. In fact, you can also take an existing structure and add " +"new :class:`~email.message.Message` objects, move them around, etc. This " +"makes a very convenient interface for slicing-and-dicing MIME messages." msgstr "" -msgid "You can create a new object structure by creating :class:`~email.message.Message` instances, adding attachments and all the appropriate headers manually. For MIME messages though, the :mod:`email` package provides some convenient subclasses to make things easier." +#: ../../library/email.mime.rst:24 +msgid "" +"You can create a new object structure by " +"creating :class:`~email.message.Message` instances, adding attachments and " +"all the appropriate headers manually. For MIME messages though, " +"the :mod:`email` package provides some convenient subclasses to make things " +"easier." msgstr "" +#: ../../library/email.mime.rst:29 msgid "Here are the classes:" msgstr "" +#: ../../library/email.mime.rst:35 msgid "Module: :mod:`email.mime.base`" msgstr "" -msgid "This is the base class for all the MIME-specific subclasses of :class:`~email.message.Message`. Ordinarily you won't create instances specifically of :class:`MIMEBase`, although you could. :class:`MIMEBase` is provided primarily as a convenient base class for more specific MIME-aware subclasses." +#: ../../library/email.mime.rst:37 +msgid "" +"This is the base class for all the MIME-specific subclasses " +"of :class:`~email.message.Message`. Ordinarily you won't create instances " +"specifically of :class:`MIMEBase`, although you could. :class:`MIMEBase` is " +"provided primarily as a convenient base class for more specific MIME-aware " +"subclasses." msgstr "" -msgid "*_maintype* is the :mailheader:`Content-Type` major type (e.g. :mimetype:`text` or :mimetype:`image`), and *_subtype* is the :mailheader:`Content-Type` minor type (e.g. :mimetype:`plain` or :mimetype:`gif`). *_params* is a parameter key/value dictionary and is passed directly to :meth:`Message.add_header `." +#: ../../library/email.mime.rst:43 +msgid "" +"*_maintype* is the :mailheader:`Content-Type` major type " +"(e.g. :mimetype:`text` or :mimetype:`image`), and *_subtype* is " +"the :mailheader:`Content-Type` minor type (e.g. :mimetype:`plain` " +"or :mimetype:`gif`). *_params* is a parameter key/value dictionary and is " +"passed directly to :meth:`Message.add_header " +"`." msgstr "" -msgid "If *policy* is specified, (defaults to the :class:`compat32 ` policy) it will be passed to :class:`~email.message.Message`." +#: ../../library/email.mime.rst:49 +msgid "" +"If *policy* is specified, (defaults to the :class:`compat32 " +"` policy) it will be passed " +"to :class:`~email.message.Message`." msgstr "" -msgid "The :class:`MIMEBase` class always adds a :mailheader:`Content-Type` header (based on *_maintype*, *_subtype*, and *_params*), and a :mailheader:`MIME-Version` header (always set to ``1.0``)." +#: ../../library/email.mime.rst:53 +msgid "" +"The :class:`MIMEBase` class always adds a :mailheader:`Content-Type` header " +"(based on *_maintype*, *_subtype*, and *_params*), and a :mailheader:`MIME-" +"Version` header (always set to ``1.0``)." msgstr "" +#: ../../library/email.mime.rst:57 ../../library/email.mime.rst:104 +#: ../../library/email.mime.rst:135 ../../library/email.mime.rst:169 +#: ../../library/email.mime.rst:205 ../../library/email.mime.rst:225 +#: ../../library/email.mime.rst:259 msgid "Added *policy* keyword-only parameter." msgstr "" +#: ../../library/email.mime.rst:65 msgid "Module: :mod:`email.mime.nonmultipart`" msgstr "" -msgid "A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base class for MIME messages that are not :mimetype:`multipart`. The primary purpose of this class is to prevent the use of the :meth:`~email.message.Message.attach` method, which only makes sense for :mimetype:`multipart` messages. If :meth:`~email.message.Message.attach` is called, a :exc:`~email.errors.MultipartConversionError` exception is raised." +#: ../../library/email.mime.rst:67 +msgid "" +"A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate " +"base class for MIME messages that are not :mimetype:`multipart`. The " +"primary purpose of this class is to prevent the use of " +"the :meth:`~email.message.Message.attach` method, which only makes sense " +"for :mimetype:`multipart` messages. " +"If :meth:`~email.message.Message.attach` is called, " +"a :exc:`~email.errors.MultipartConversionError` exception is raised." msgstr "" +#: ../../library/email.mime.rst:80 msgid "Module: :mod:`email.mime.multipart`" msgstr "" -msgid "A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base class for MIME messages that are :mimetype:`multipart`. Optional *_subtype* defaults to :mimetype:`mixed`, but can be used to specify the subtype of the message. A :mailheader:`Content-Type` header of :mimetype:`multipart/_subtype` will be added to the message object. A :mailheader:`MIME-Version` header will also be added." +#: ../../library/email.mime.rst:82 +msgid "" +"A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate " +"base class for MIME messages that are :mimetype:`multipart`. Optional " +"*_subtype* defaults to :mimetype:`mixed`, but can be used to specify the " +"subtype of the message. A :mailheader:`Content-Type` header " +"of :mimetype:`multipart/_subtype` will be added to the message object. " +"A :mailheader:`MIME-Version` header will also be added." msgstr "" -msgid "Optional *boundary* is the multipart boundary string. When ``None`` (the default), the boundary is calculated when needed (for example, when the message is serialized)." +#: ../../library/email.mime.rst:89 +msgid "" +"Optional *boundary* is the multipart boundary string. When ``None`` (the " +"default), the boundary is calculated when needed (for example, when the " +"message is serialized)." msgstr "" -msgid "*_subparts* is a sequence of initial subparts for the payload. It must be possible to convert this sequence to a list. You can always attach new subparts to the message by using the :meth:`Message.attach ` method." +#: ../../library/email.mime.rst:93 +msgid "" +"*_subparts* is a sequence of initial subparts for the payload. It must be " +"possible to convert this sequence to a list. You can always attach new " +"subparts to the message by using the :meth:`Message.attach " +"` method." msgstr "" -msgid "Optional *policy* argument defaults to :class:`compat32 `." +#: ../../library/email.mime.rst:98 ../../library/email.mime.rst:131 +#: ../../library/email.mime.rst:165 ../../library/email.mime.rst:200 +#: ../../library/email.mime.rst:223 ../../library/email.mime.rst:254 +msgid "" +"Optional *policy* argument defaults to :class:`compat32 " +"`." msgstr "" -msgid "Additional parameters for the :mailheader:`Content-Type` header are taken from the keyword arguments, or passed into the *_params* argument, which is a keyword dictionary." +#: ../../library/email.mime.rst:100 +msgid "" +"Additional parameters for the :mailheader:`Content-Type` header are taken " +"from the keyword arguments, or passed into the *_params* argument, which is " +"a keyword dictionary." msgstr "" +#: ../../library/email.mime.rst:113 msgid "Module: :mod:`email.mime.application`" msgstr "" -msgid "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:`MIMEApplication` class is used to represent MIME message objects of major type :mimetype:`application`. *_data* contains the bytes for the raw application data. Optional *_subtype* specifies the MIME subtype and defaults to :mimetype:`octet-stream`." -msgstr "" - -msgid "Optional *_encoder* is a callable (i.e. function) which will perform the actual encoding of the data for transport. This callable takes one argument, which is the :class:`MIMEApplication` instance. It should use :meth:`~email.message.Message.get_payload` and :meth:`~email.message.Message.set_payload` to change the payload to encoded form. It should also add any :mailheader:`Content-Transfer-Encoding` or other headers to the message object as necessary. The default encoding is base64. See the :mod:`email.encoders` module for a list of the built-in encoders." +#: ../../library/email.mime.rst:115 +msgid "" +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEApplication` class is used to represent MIME message objects " +"of major type :mimetype:`application`. *_data* contains the bytes for the " +"raw application data. Optional *_subtype* specifies the MIME subtype and " +"defaults to :mimetype:`octet-stream`." msgstr "" +#: ../../library/email.mime.rst:121 +msgid "" +"Optional *_encoder* is a callable (i.e. function) which will perform the " +"actual encoding of the data for transport. This callable takes one " +"argument, which is the :class:`MIMEApplication` instance. It should " +"use :meth:`~email.message.Message.get_payload` " +"and :meth:`~email.message.Message.set_payload` to change the payload to " +"encoded form. It should also add any :mailheader:`Content-Transfer-" +"Encoding` or other headers to the message object as necessary. The default " +"encoding is base64. See the :mod:`email.encoders` module for a list of the " +"built-in encoders." +msgstr "" + +#: ../../library/email.mime.rst:133 ../../library/email.mime.rst:167 msgid "*_params* are passed straight through to the base class constructor." msgstr "" +#: ../../library/email.mime.rst:144 msgid "Module: :mod:`email.mime.audio`" msgstr "" -msgid "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:`MIMEAudio` class is used to create MIME message objects of major type :mimetype:`audio`. *_audiodata* contains the bytes for the raw audio data. If this data can be decoded as au, wav, aiff, or aifc, then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the audio subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised." -msgstr "" - -msgid "Optional *_encoder* is a callable (i.e. function) which will perform the actual encoding of the audio data for transport. This callable takes one argument, which is the :class:`MIMEAudio` instance. It should use :meth:`~email.message.Message.get_payload` and :meth:`~email.message.Message.set_payload` to change the payload to encoded form. It should also add any :mailheader:`Content-Transfer-Encoding` or other headers to the message object as necessary. The default encoding is base64. See the :mod:`email.encoders` module for a list of the built-in encoders." +#: ../../library/email.mime.rst:146 +msgid "" +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEAudio` class is used to create MIME message objects of major " +"type :mimetype:`audio`. *_audiodata* contains the bytes for the raw audio " +"data. If this data can be decoded as au, wav, aiff, or aifc, then the " +"subtype will be automatically included in the :mailheader:`Content-Type` " +"header. Otherwise you can explicitly specify the audio subtype via the " +"*_subtype* argument. If the minor type could not be guessed and *_subtype* " +"was not given, then :exc:`TypeError` is raised." msgstr "" +#: ../../library/email.mime.rst:155 +msgid "" +"Optional *_encoder* is a callable (i.e. function) which will perform the " +"actual encoding of the audio data for transport. This callable takes one " +"argument, which is the :class:`MIMEAudio` instance. It should " +"use :meth:`~email.message.Message.get_payload` " +"and :meth:`~email.message.Message.set_payload` to change the payload to " +"encoded form. It should also add any :mailheader:`Content-Transfer-" +"Encoding` or other headers to the message object as necessary. The default " +"encoding is base64. See the :mod:`email.encoders` module for a list of the " +"built-in encoders." +msgstr "" + +#: ../../library/email.mime.rst:178 msgid "Module: :mod:`email.mime.image`" msgstr "" -msgid "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:`MIMEImage` class is used to create MIME message objects of major type :mimetype:`image`. *_imagedata* contains the bytes for the raw image data. If this data type can be detected (jpeg, png, gif, tiff, rgb, pbm, pgm, ppm, rast, xbm, bmp, webp, and exr attempted), then the subtype will be automatically included in the :mailheader:`Content-Type` header. Otherwise you can explicitly specify the image subtype via the *_subtype* argument. If the minor type could not be guessed and *_subtype* was not given, then :exc:`TypeError` is raised." -msgstr "" - -msgid "Optional *_encoder* is a callable (i.e. function) which will perform the actual encoding of the image data for transport. This callable takes one argument, which is the :class:`MIMEImage` instance. It should use :meth:`~email.message.Message.get_payload` and :meth:`~email.message.Message.set_payload` to change the payload to encoded form. It should also add any :mailheader:`Content-Transfer-Encoding` or other headers to the message object as necessary. The default encoding is base64. See the :mod:`email.encoders` module for a list of the built-in encoders." -msgstr "" - -msgid "*_params* are passed straight through to the :class:`~email.mime.base.MIMEBase` constructor." +#: ../../library/email.mime.rst:180 +msgid "" +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEImage` class is used to create MIME message objects of major " +"type :mimetype:`image`. *_imagedata* contains the bytes for the raw image " +"data. If this data type can be detected (jpeg, png, gif, tiff, rgb, pbm, " +"pgm, ppm, rast, xbm, bmp, webp, and exr attempted), then the subtype will be " +"automatically included in the :mailheader:`Content-Type` header. Otherwise " +"you can explicitly specify the image subtype via the *_subtype* argument. If " +"the minor type could not be guessed and *_subtype* was not given, " +"then :exc:`TypeError` is raised." +msgstr "" + +#: ../../library/email.mime.rst:190 +msgid "" +"Optional *_encoder* is a callable (i.e. function) which will perform the " +"actual encoding of the image data for transport. This callable takes one " +"argument, which is the :class:`MIMEImage` instance. It should " +"use :meth:`~email.message.Message.get_payload` " +"and :meth:`~email.message.Message.set_payload` to change the payload to " +"encoded form. It should also add any :mailheader:`Content-Transfer-" +"Encoding` or other headers to the message object as necessary. The default " +"encoding is base64. See the :mod:`email.encoders` module for a list of the " +"built-in encoders." +msgstr "" + +#: ../../library/email.mime.rst:202 +msgid "" +"*_params* are passed straight through to " +"the :class:`~email.mime.base.MIMEBase` constructor." msgstr "" +#: ../../library/email.mime.rst:212 msgid "Module: :mod:`email.mime.message`" msgstr "" -msgid "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:`MIMEMessage` class is used to create MIME objects of main type :mimetype:`message`. *_msg* is used as the payload, and must be an instance of class :class:`~email.message.Message` (or a subclass thereof), otherwise a :exc:`TypeError` is raised." +#: ../../library/email.mime.rst:214 +msgid "" +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEMessage` class is used to create MIME objects of main " +"type :mimetype:`message`. *_msg* is used as the payload, and must be an " +"instance of class :class:`~email.message.Message` (or a subclass thereof), " +"otherwise a :exc:`TypeError` is raised." msgstr "" -msgid "Optional *_subtype* sets the subtype of the message; it defaults to :mimetype:`rfc822`." +#: ../../library/email.mime.rst:220 +msgid "" +"Optional *_subtype* sets the subtype of the message; it defaults " +"to :mimetype:`rfc822`." msgstr "" +#: ../../library/email.mime.rst:232 msgid "Module: :mod:`email.mime.text`" msgstr "" -msgid "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:`MIMEText` class is used to create MIME objects of major type :mimetype:`text`. *_text* is the string for the payload. *_subtype* is the minor type and defaults to :mimetype:`plain`. *_charset* is the character set of the text and is passed as an argument to the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults to ``us-ascii`` if the string contains only ``ascii`` code points, and ``utf-8`` otherwise. The *_charset* parameter accepts either a string or a :class:`~email.charset.Charset` instance." -msgstr "" - -msgid "Unless the *_charset* argument is explicitly set to ``None``, the MIMEText object created will have both a :mailheader:`Content-Type` header with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Encoding` header. This means that a subsequent ``set_payload`` call will not result in an encoded payload, even if a charset is passed in the ``set_payload`` command. You can \"reset\" this behavior by deleting the ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call will automatically encode the new payload (and add a new :mailheader:`Content-Transfer-Encoding` header)." -msgstr "" - +#: ../../library/email.mime.rst:234 +msgid "" +"A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, " +"the :class:`MIMEText` class is used to create MIME objects of major " +"type :mimetype:`text`. *_text* is the string for the payload. *_subtype* is " +"the minor type and defaults to :mimetype:`plain`. *_charset* is the " +"character set of the text and is passed as an argument to " +"the :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it " +"defaults to ``us-ascii`` if the string contains only ``ascii`` code points, " +"and ``utf-8`` otherwise. The *_charset* parameter accepts either a string " +"or a :class:`~email.charset.Charset` instance." +msgstr "" + +#: ../../library/email.mime.rst:244 +msgid "" +"Unless the *_charset* argument is explicitly set to ``None``, the MIMEText " +"object created will have both a :mailheader:`Content-Type` header with a " +"``charset`` parameter, and a :mailheader:`Content-Transfer-Encoding` " +"header. This means that a subsequent ``set_payload`` call will not result " +"in an encoded payload, even if a charset is passed in the ``set_payload`` " +"command. You can \"reset\" this behavior by deleting the ``Content-Transfer-" +"Encoding`` header, after which a ``set_payload`` call will automatically " +"encode the new payload (and add a new :mailheader:`Content-Transfer-" +"Encoding` header)." +msgstr "" + +#: ../../library/email.mime.rst:256 msgid "*_charset* also accepts :class:`~email.charset.Charset` instances." msgstr "" diff --git a/library/email.parser.po b/library/email.parser.po index c777267fe..f4bc0a5fa 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,148 +23,367 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.parser.rst:2 msgid ":mod:`!email.parser`: Parsing email messages" msgstr "" +#: ../../library/email.parser.rst:7 msgid "**Source code:** :source:`Lib/email/parser.py`" msgstr "" -msgid "Message object structures can be created in one of two ways: they can be created from whole cloth by creating an :class:`~email.message.EmailMessage` object, adding headers using the dictionary interface, and adding payload(s) using :meth:`~email.message.EmailMessage.set_content` and related methods, or they can be created by parsing a serialized representation of the email message." -msgstr "" - -msgid "The :mod:`email` package provides a standard parser that understands most email document structures, including MIME documents. You can pass the parser a bytes, string or file object, and the parser will return to you the root :class:`~email.message.EmailMessage` instance of the object structure. For simple, non-MIME messages the payload of this root object will likely be a string containing the text of the message. For MIME messages, the root object will return ``True`` from its :meth:`~email.message.EmailMessage.is_multipart` method, and the subparts can be accessed via the payload manipulation methods, such as :meth:`~email.message.EmailMessage.get_body`, :meth:`~email.message.EmailMessage.iter_parts`, and :meth:`~email.message.EmailMessage.walk`." -msgstr "" - -msgid "There are actually two parser interfaces available for use, the :class:`Parser` API and the incremental :class:`FeedParser` API. The :class:`Parser` API is most useful if you have the entire text of the message in memory, or if the entire message lives in a file on the file system. :class:`FeedParser` is more appropriate when you are reading the message from a stream which might block waiting for more input (such as reading an email message from a socket). The :class:`FeedParser` can consume and parse the message incrementally, and only returns the root object when you close the parser." +#: ../../library/email.parser.rst:11 +msgid "" +"Message object structures can be created in one of two ways: they can be " +"created from whole cloth by creating an :class:`~email.message.EmailMessage` " +"object, adding headers using the dictionary interface, and adding payload(s) " +"using :meth:`~email.message.EmailMessage.set_content` and related methods, " +"or they can be created by parsing a serialized representation of the email " +"message." msgstr "" -msgid "Note that the parser can be extended in limited ways, and of course you can implement your own parser completely from scratch. All of the logic that connects the :mod:`email` package's bundled parser and the :class:`~email.message.EmailMessage` class is embodied in the :class:`~email.policy.Policy` class, so a custom parser can create message object trees any way it finds necessary by implementing custom versions of the appropriate :class:`!Policy` methods." +#: ../../library/email.parser.rst:18 +msgid "" +"The :mod:`email` package provides a standard parser that understands most " +"email document structures, including MIME documents. You can pass the " +"parser a bytes, string or file object, and the parser will return to you the " +"root :class:`~email.message.EmailMessage` instance of the object structure. " +"For simple, non-MIME messages the payload of this root object will likely be " +"a string containing the text of the message. For MIME messages, the root " +"object will return ``True`` from " +"its :meth:`~email.message.EmailMessage.is_multipart` method, and the " +"subparts can be accessed via the payload manipulation methods, such " +"as :meth:`~email.message.EmailMessage.get_body`, :meth:`~email.message.EmailMessage.iter_parts`, " +"and :meth:`~email.message.EmailMessage.walk`." +msgstr "" + +#: ../../library/email.parser.rst:30 +msgid "" +"There are actually two parser interfaces available for use, " +"the :class:`Parser` API and the incremental :class:`FeedParser` API. " +"The :class:`Parser` API is most useful if you have the entire text of the " +"message in memory, or if the entire message lives in a file on the file " +"system. :class:`FeedParser` is more appropriate when you are reading the " +"message from a stream which might block waiting for more input (such as " +"reading an email message from a socket). The :class:`FeedParser` can " +"consume and parse the message incrementally, and only returns the root " +"object when you close the parser." +msgstr "" + +#: ../../library/email.parser.rst:39 +msgid "" +"Note that the parser can be extended in limited ways, and of course you can " +"implement your own parser completely from scratch. All of the logic that " +"connects the :mod:`email` package's bundled parser and " +"the :class:`~email.message.EmailMessage` class is embodied in " +"the :class:`~email.policy.Policy` class, so a custom parser can create " +"message object trees any way it finds necessary by implementing custom " +"versions of the appropriate :class:`!Policy` methods." msgstr "" +#: ../../library/email.parser.rst:49 msgid "FeedParser API" msgstr "" -msgid "The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` module, provides an API that is conducive to incremental parsing of email messages, such as would be necessary when reading the text of an email message from a source that can block (such as a socket). The :class:`BytesFeedParser` can of course be used to parse an email message fully contained in a :term:`bytes-like object`, string, or file, but the :class:`BytesParser` API may be more convenient for such use cases. The semantics and results of the two parser APIs are identical." -msgstr "" - -msgid "The :class:`BytesFeedParser`'s API is simple; you create an instance, feed it a bunch of bytes until there's no more to feed it, then close the parser to retrieve the root message object. The :class:`BytesFeedParser` is extremely accurate when parsing standards-compliant messages, and it does a very good job of parsing non-compliant messages, providing information about how a message was deemed broken. It will populate a message object's :attr:`~email.message.EmailMessage.defects` attribute with a list of any problems it found in a message. See the :mod:`email.errors` module for the list of defects that it can find." +#: ../../library/email.parser.rst:51 +msgid "" +"The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` " +"module, provides an API that is conducive to incremental parsing of email " +"messages, such as would be necessary when reading the text of an email " +"message from a source that can block (such as a socket). " +"The :class:`BytesFeedParser` can of course be used to parse an email message " +"fully contained in a :term:`bytes-like object`, string, or file, but " +"the :class:`BytesParser` API may be more convenient for such use cases. The " +"semantics and results of the two parser APIs are identical." msgstr "" +#: ../../library/email.parser.rst:60 +msgid "" +"The :class:`BytesFeedParser`'s API is simple; you create an instance, feed " +"it a bunch of bytes until there's no more to feed it, then close the parser " +"to retrieve the root message object. The :class:`BytesFeedParser` is " +"extremely accurate when parsing standards-compliant messages, and it does a " +"very good job of parsing non-compliant messages, providing information about " +"how a message was deemed broken. It will populate a message " +"object's :attr:`~email.message.EmailMessage.defects` attribute with a list " +"of any problems it found in a message. See the :mod:`email.errors` module " +"for the list of defects that it can find." +msgstr "" + +#: ../../library/email.parser.rst:70 msgid "Here is the API for the :class:`BytesFeedParser`:" msgstr "" -msgid "Create a :class:`BytesFeedParser` instance. Optional *_factory* is a no-argument callable; if not specified use the :attr:`~email.policy.Policy.message_factory` from the *policy*. Call *_factory* whenever a new message object is needed." +#: ../../library/email.parser.rst:75 +msgid "" +"Create a :class:`BytesFeedParser` instance. Optional *_factory* is a no-" +"argument callable; if not specified use " +"the :attr:`~email.policy.Policy.message_factory` from the *policy*. Call " +"*_factory* whenever a new message object is needed." msgstr "" -msgid "If *policy* is specified use the rules it specifies to update the representation of the message. If *policy* is not set, use the :class:`compat32 ` policy, which maintains backward compatibility with the Python 3.2 version of the email package and provides :class:`~email.message.Message` as the default factory. All other policies provide :class:`~email.message.EmailMessage` as the default *_factory*. For more information on what else *policy* controls, see the :mod:`~email.policy` documentation." +#: ../../library/email.parser.rst:80 +msgid "" +"If *policy* is specified use the rules it specifies to update the " +"representation of the message. If *policy* is not set, use " +"the :class:`compat32 ` policy, which maintains " +"backward compatibility with the Python 3.2 version of the email package and " +"provides :class:`~email.message.Message` as the default factory. All other " +"policies provide :class:`~email.message.EmailMessage` as the default " +"*_factory*. For more information on what else *policy* controls, see " +"the :mod:`~email.policy` documentation." msgstr "" -msgid "Note: **The policy keyword should always be specified**; The default will change to :data:`email.policy.default` in a future version of Python." +#: ../../library/email.parser.rst:89 ../../library/email.parser.rst:145 +msgid "" +"Note: **The policy keyword should always be specified**; The default will " +"change to :data:`email.policy.default` in a future version of Python." msgstr "" +#: ../../library/email.parser.rst:94 ../../library/email.parser.rst:122 msgid "Added the *policy* keyword." msgstr "" +#: ../../library/email.parser.rst:95 msgid "*_factory* defaults to the policy ``message_factory``." msgstr "" -msgid "Feed the parser some more data. *data* should be a :term:`bytes-like object` containing one or more lines. The lines can be partial and the parser will stitch such partial lines together properly. The lines can have any of the three common line endings: carriage return, newline, or carriage return and newline (they can even be mixed)." +#: ../../library/email.parser.rst:100 +msgid "" +"Feed the parser some more data. *data* should be a :term:`bytes-like " +"object` containing one or more lines. The lines can be partial and the " +"parser will stitch such partial lines together properly. The lines can have " +"any of the three common line endings: carriage return, newline, or carriage " +"return and newline (they can even be mixed)." msgstr "" -msgid "Complete the parsing of all previously fed data and return the root message object. It is undefined what happens if :meth:`~feed` is called after this method has been called." +#: ../../library/email.parser.rst:109 +msgid "" +"Complete the parsing of all previously fed data and return the root message " +"object. It is undefined what happens if :meth:`~feed` is called after this " +"method has been called." msgstr "" -msgid "Works like :class:`BytesFeedParser` except that the input to the :meth:`~BytesFeedParser.feed` method must be a string. This is of limited utility, since the only way for such a message to be valid is for it to contain only ASCII text or, if :attr:`~email.policy.EmailPolicy.utf8` is ``True``, no binary attachments." +#: ../../library/email.parser.rst:116 +msgid "" +"Works like :class:`BytesFeedParser` except that the input to " +"the :meth:`~BytesFeedParser.feed` method must be a string. This is of " +"limited utility, since the only way for such a message to be valid is for it " +"to contain only ASCII text or, if :attr:`~email.policy.EmailPolicy.utf8` is " +"``True``, no binary attachments." msgstr "" +#: ../../library/email.parser.rst:126 msgid "Parser API" msgstr "" -msgid "The :class:`BytesParser` class, imported from the :mod:`!email.parser` module, provides an API that can be used to parse a message when the complete contents of the message are available in a :term:`bytes-like object` or file. The :mod:`!email.parser` module also provides :class:`Parser` for parsing strings, and header-only parsers, :class:`BytesHeaderParser` and :class:`HeaderParser`, which can be used if you're only interested in the headers of the message. :class:`BytesHeaderParser` and :class:`HeaderParser` can be much faster in these situations, since they do not attempt to parse the message body, instead setting the payload to the raw body." -msgstr "" - -msgid "Create a :class:`BytesParser` instance. The *_class* and *policy* arguments have the same meaning and semantics as the *_factory* and *policy* arguments of :class:`BytesFeedParser`." +#: ../../library/email.parser.rst:128 +msgid "" +"The :class:`BytesParser` class, imported from the :mod:`!email.parser` " +"module, provides an API that can be used to parse a message when the " +"complete contents of the message are available in a :term:`bytes-like " +"object` or file. The :mod:`!email.parser` module also " +"provides :class:`Parser` for parsing strings, and header-only " +"parsers, :class:`BytesHeaderParser` and :class:`HeaderParser`, which can be " +"used if you're only interested in the headers of the " +"message. :class:`BytesHeaderParser` and :class:`HeaderParser` can be much " +"faster in these situations, since they do not attempt to parse the message " +"body, instead setting the payload to the raw body." +msgstr "" + +#: ../../library/email.parser.rst:141 +msgid "" +"Create a :class:`BytesParser` instance. The *_class* and *policy* arguments " +"have the same meaning and semantics as the *_factory* and *policy* arguments " +"of :class:`BytesFeedParser`." msgstr "" -msgid "Removed the *strict* argument that was deprecated in 2.4. Added the *policy* keyword." +#: ../../library/email.parser.rst:148 +msgid "" +"Removed the *strict* argument that was deprecated in 2.4. Added the " +"*policy* keyword." msgstr "" +#: ../../library/email.parser.rst:151 ../../library/email.parser.rst:200 +#: ../../library/email.parser.rst:280 msgid "*_class* defaults to the policy ``message_factory``." msgstr "" -msgid "Read all the data from the binary file-like object *fp*, parse the resulting bytes, and return the message object. *fp* must support both the :meth:`~io.IOBase.readline` and the :meth:`~io.BufferedIOBase.read` methods." +#: ../../library/email.parser.rst:156 +msgid "" +"Read all the data from the binary file-like object *fp*, parse the resulting " +"bytes, and return the message object. *fp* must support both " +"the :meth:`~io.IOBase.readline` and the :meth:`~io.BufferedIOBase.read` " +"methods." msgstr "" -msgid "The bytes contained in *fp* must be formatted as a block of :rfc:`5322` (or, if :attr:`~email.policy.EmailPolicy.utf8` is ``True``, :rfc:`6532`) style headers and header continuation lines, optionally preceded by an envelope header. The header block is terminated either by the end of the data or by a blank line. Following the header block is the body of the message (which may contain MIME-encoded subparts, including subparts with a :mailheader:`Content-Transfer-Encoding` of ``8bit``)." +#: ../../library/email.parser.rst:161 +msgid "" +"The bytes contained in *fp* must be formatted as a block of :rfc:`5322` (or, " +"if :attr:`~email.policy.EmailPolicy.utf8` is ``True``, :rfc:`6532`) style " +"headers and header continuation lines, optionally preceded by an envelope " +"header. The header block is terminated either by the end of the data or by " +"a blank line. Following the header block is the body of the message (which " +"may contain MIME-encoded subparts, including subparts with " +"a :mailheader:`Content-Transfer-Encoding` of ``8bit``)." msgstr "" -msgid "Optional *headersonly* is a flag specifying whether to stop parsing after reading the headers or not. The default is ``False``, meaning it parses the entire contents of the file." +#: ../../library/email.parser.rst:169 +msgid "" +"Optional *headersonly* is a flag specifying whether to stop parsing after " +"reading the headers or not. The default is ``False``, meaning it parses the " +"entire contents of the file." msgstr "" -msgid "Similar to the :meth:`parse` method, except it takes a :term:`bytes-like object` instead of a file-like object. Calling this method on a :term:`bytes-like object` is equivalent to wrapping *bytes* in a :class:`~io.BytesIO` instance first and calling :meth:`parse`." +#: ../../library/email.parser.rst:176 +msgid "" +"Similar to the :meth:`parse` method, except it takes a :term:`bytes-like " +"object` instead of a file-like object. Calling this method on " +"a :term:`bytes-like object` is equivalent to wrapping *bytes* in " +"a :class:`~io.BytesIO` instance first and calling :meth:`parse`." msgstr "" +#: ../../library/email.parser.rst:181 ../../library/email.parser.rst:221 msgid "Optional *headersonly* is as with the :meth:`parse` method." msgstr "" -msgid "Exactly like :class:`BytesParser`, except that *headersonly* defaults to ``True``." +#: ../../library/email.parser.rst:188 +msgid "" +"Exactly like :class:`BytesParser`, except that *headersonly* defaults to " +"``True``." msgstr "" -msgid "This class is parallel to :class:`BytesParser`, but handles string input." +#: ../../library/email.parser.rst:196 +msgid "" +"This class is parallel to :class:`BytesParser`, but handles string input." msgstr "" +#: ../../library/email.parser.rst:198 ../../library/email.parser.rst:245 +#: ../../library/email.parser.rst:258 ../../library/email.parser.rst:268 +#: ../../library/email.parser.rst:278 msgid "Removed the *strict* argument. Added the *policy* keyword." msgstr "" -msgid "Read all the data from the text-mode file-like object *fp*, parse the resulting text, and return the root message object. *fp* must support both the :meth:`~io.TextIOBase.readline` and the :meth:`~io.TextIOBase.read` methods on file-like objects." +#: ../../library/email.parser.rst:205 +msgid "" +"Read all the data from the text-mode file-like object *fp*, parse the " +"resulting text, and return the root message object. *fp* must support both " +"the :meth:`~io.TextIOBase.readline` and the :meth:`~io.TextIOBase.read` " +"methods on file-like objects." msgstr "" -msgid "Other than the text mode requirement, this method operates like :meth:`BytesParser.parse`." +#: ../../library/email.parser.rst:210 +msgid "" +"Other than the text mode requirement, this method operates " +"like :meth:`BytesParser.parse`." msgstr "" -msgid "Similar to the :meth:`parse` method, except it takes a string object instead of a file-like object. Calling this method on a string is equivalent to wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:`parse`." +#: ../../library/email.parser.rst:216 +msgid "" +"Similar to the :meth:`parse` method, except it takes a string object instead " +"of a file-like object. Calling this method on a string is equivalent to " +"wrapping *text* in a :class:`~io.StringIO` instance first and " +"calling :meth:`parse`." msgstr "" -msgid "Exactly like :class:`Parser`, except that *headersonly* defaults to ``True``." +#: ../../library/email.parser.rst:226 +msgid "" +"Exactly like :class:`Parser`, except that *headersonly* defaults to ``True``." msgstr "" -msgid "Since creating a message object structure from a string or a file object is such a common task, four functions are provided as a convenience. They are available in the top-level :mod:`email` package namespace." +#: ../../library/email.parser.rst:230 +msgid "" +"Since creating a message object structure from a string or a file object is " +"such a common task, four functions are provided as a convenience. They are " +"available in the top-level :mod:`email` package namespace." msgstr "" -msgid "Return a message object structure from a :term:`bytes-like object`. This is equivalent to ``BytesParser().parsebytes(s)``. Optional *_class* and *policy* are interpreted as with the :class:`~email.parser.BytesParser` class constructor." +#: ../../library/email.parser.rst:239 +msgid "" +"Return a message object structure from a :term:`bytes-like object`. This is " +"equivalent to ``BytesParser().parsebytes(s)``. Optional *_class* and " +"*policy* are interpreted as with the :class:`~email.parser.BytesParser` " +"class constructor." msgstr "" -msgid "Return a message object structure tree from an open binary :term:`file object`. This is equivalent to ``BytesParser().parse(fp)``. *_class* and *policy* are interpreted as with the :class:`~email.parser.BytesParser` class constructor." +#: ../../library/email.parser.rst:252 +msgid "" +"Return a message object structure tree from an open binary :term:`file " +"object`. This is equivalent to ``BytesParser().parse(fp)``. *_class* and " +"*policy* are interpreted as with the :class:`~email.parser.BytesParser` " +"class constructor." msgstr "" -msgid "Return a message object structure from a string. This is equivalent to ``Parser().parsestr(s)``. *_class* and *policy* are interpreted as with the :class:`~email.parser.Parser` class constructor." +#: ../../library/email.parser.rst:264 +msgid "" +"Return a message object structure from a string. This is equivalent to " +"``Parser().parsestr(s)``. *_class* and *policy* are interpreted as with " +"the :class:`~email.parser.Parser` class constructor." msgstr "" -msgid "Return a message object structure tree from an open :term:`file object`. This is equivalent to ``Parser().parse(fp)``. *_class* and *policy* are interpreted as with the :class:`~email.parser.Parser` class constructor." +#: ../../library/email.parser.rst:274 +msgid "" +"Return a message object structure tree from an open :term:`file object`. " +"This is equivalent to ``Parser().parse(fp)``. *_class* and *policy* are " +"interpreted as with the :class:`~email.parser.Parser` class constructor." msgstr "" -msgid "Here's an example of how you might use :func:`message_from_bytes` at an interactive Python prompt::" +#: ../../library/email.parser.rst:283 +msgid "" +"Here's an example of how you might use :func:`message_from_bytes` at an " +"interactive Python prompt::" msgstr "" +#: ../../library/email.parser.rst:286 msgid "" ">>> import email\n" ">>> msg = email.message_from_bytes(myBytes)" msgstr "" +#: ../../library/email.parser.rst:291 msgid "Additional notes" msgstr "" +#: ../../library/email.parser.rst:293 msgid "Here are some notes on the parsing semantics:" msgstr "" -msgid "Most non-\\ :mimetype:`multipart` type messages are parsed as a single message object with a string payload. These objects will return ``False`` for :meth:`~email.message.EmailMessage.is_multipart`, and :meth:`~email.message.EmailMessage.iter_parts` will yield an empty list." +#: ../../library/email.parser.rst:295 +msgid "" +"Most non-\\ :mimetype:`multipart` type messages are parsed as a single " +"message object with a string payload. These objects will return ``False`` " +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield an empty list." msgstr "" -msgid "All :mimetype:`multipart` type messages will be parsed as a container message object with a list of sub-message objects for their payload. The outer container message will return ``True`` for :meth:`~email.message.EmailMessage.is_multipart`, and :meth:`~email.message.EmailMessage.iter_parts` will yield a list of subparts." +#: ../../library/email.parser.rst:300 +msgid "" +"All :mimetype:`multipart` type messages will be parsed as a container " +"message object with a list of sub-message objects for their payload. The " +"outer container message will return ``True`` " +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield a list of " +"subparts." msgstr "" -msgid "Most messages with a content type of :mimetype:`message/\\*` (such as :mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also be parsed as container object containing a list payload of length 1. Their :meth:`~email.message.EmailMessage.is_multipart` method will return ``True``. The single element yielded by :meth:`~email.message.EmailMessage.iter_parts` will be a sub-message object." +#: ../../library/email.parser.rst:306 +msgid "" +"Most messages with a content type of :mimetype:`message/\\*` (such " +"as :mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will " +"also be parsed as container object containing a list payload of length 1. " +"Their :meth:`~email.message.EmailMessage.is_multipart` method will return " +"``True``. The single element yielded " +"by :meth:`~email.message.EmailMessage.iter_parts` will be a sub-message " +"object." msgstr "" -msgid "Some non-standards-compliant messages may not be internally consistent about their :mimetype:`multipart`\\ -edness. Such messages may have a :mailheader:`Content-Type` header of type :mimetype:`multipart`, but their :meth:`~email.message.EmailMessage.is_multipart` method may return ``False``. If such messages were parsed with the :class:`~email.parser.FeedParser`, they will have an instance of the :class:`~email.errors.MultipartInvariantViolationDefect` class in their *defects* attribute list. See :mod:`email.errors` for details." +#: ../../library/email.parser.rst:313 +msgid "" +"Some non-standards-compliant messages may not be internally consistent about " +"their :mimetype:`multipart`\\ -edness. Such messages may have " +"a :mailheader:`Content-Type` header of type :mimetype:`multipart`, but " +"their :meth:`~email.message.EmailMessage.is_multipart` method may return " +"``False``. If such messages were parsed with " +"the :class:`~email.parser.FeedParser`, they will have an instance of " +"the :class:`~email.errors.MultipartInvariantViolationDefect` class in their " +"*defects* attribute list. See :mod:`email.errors` for details." msgstr "" diff --git a/library/email.po b/library/email.po index 895ab9333..493d0a509 100644 --- a/library/email.po +++ b/library/email.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,71 +21,176 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.rst:2 msgid ":mod:`!email` --- An email and MIME handling package" msgstr "" +#: ../../library/email.rst:11 msgid "**Source code:** :source:`Lib/email/__init__.py`" msgstr "" -msgid "The :mod:`!email` package is a library for managing email messages. It is specifically *not* designed to do any sending of email messages to SMTP (:rfc:`2821`), NNTP, or other servers; those are functions of modules such as :mod:`smtplib`. The :mod:`!email` package attempts to be as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:`2231`." -msgstr "" - -msgid "The overall structure of the email package can be divided into three major components, plus a fourth component that controls the behavior of the other components." -msgstr "" - -msgid "The central component of the package is an \"object model\" that represents email messages. An application interacts with the package primarily through the object model interface defined in the :mod:`~email.message` sub-module. The application can use this API to ask questions about an existing email, to construct a new email, or to add or remove email subcomponents that themselves use the same object model interface. That is, following the nature of email messages and their MIME subcomponents, the email object model is a tree structure of objects that all provide the :class:`~email.message.EmailMessage` API." -msgstr "" - -msgid "The other two major components of the package are the :mod:`~email.parser` and the :mod:`~email.generator`. The parser takes the serialized version of an email message (a stream of bytes) and converts it into a tree of :class:`~email.message.EmailMessage` objects. The generator takes an :class:`~email.message.EmailMessage` and turns it back into a serialized byte stream. (The parser and generator also handle streams of text characters, but this usage is discouraged as it is too easy to end up with messages that are not valid in one way or another.)" -msgstr "" - -msgid "The control component is the :mod:`~email.policy` module. Every :class:`~email.message.EmailMessage`, every :mod:`~email.generator`, and every :mod:`~email.parser` has an associated :mod:`~email.policy` object that controls its behavior. Usually an application only needs to specify the policy when an :class:`~email.message.EmailMessage` is created, either by directly instantiating an :class:`~email.message.EmailMessage` to create a new email, or by parsing an input stream using a :mod:`~email.parser`. But the policy can be changed when the message is serialized using a :mod:`~email.generator`. This allows, for example, a generic email message to be parsed from disk, but to serialize it using standard SMTP settings when sending it to an email server." +#: ../../library/email.rst:15 +msgid "" +"The :mod:`!email` package is a library for managing email messages. It is " +"specifically *not* designed to do any sending of email messages to SMTP " +"(:rfc:`2821`), NNTP, or other servers; those are functions of modules such " +"as :mod:`smtplib`. The :mod:`!email` package attempts to be as RFC-" +"compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as well as " +"such MIME-related RFCs " +"as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:`2231`." msgstr "" -msgid "The email package does its best to hide the details of the various governing RFCs from the application. Conceptually the application should be able to treat the email message as a structured tree of unicode text and binary attachments, without having to worry about how these are represented when serialized. In practice, however, it is often necessary to be aware of at least some of the rules governing MIME messages and their structure, specifically the names and nature of the MIME \"content types\" and how they identify multipart documents. For the most part this knowledge should only be required for more complex applications, and even then it should only be the high level structure in question, and not the details of how those structures are represented. Since MIME content types are used widely in modern internet software (not just email), this will be a familiar concept to many programmers." +#: ../../library/email.rst:23 +msgid "" +"The overall structure of the email package can be divided into three major " +"components, plus a fourth component that controls the behavior of the other " +"components." msgstr "" -msgid "The following sections describe the functionality of the :mod:`!email` package. We start with the :mod:`~email.message` object model, which is the primary interface an application will use, and follow that with the :mod:`~email.parser` and :mod:`~email.generator` components. Then we cover the :mod:`~email.policy` controls, which completes the treatment of the main components of the library." +#: ../../library/email.rst:27 +msgid "" +"The central component of the package is an \"object model\" that represents " +"email messages. An application interacts with the package primarily through " +"the object model interface defined in the :mod:`~email.message` sub-module. " +"The application can use this API to ask questions about an existing email, " +"to construct a new email, or to add or remove email subcomponents that " +"themselves use the same object model interface. That is, following the " +"nature of email messages and their MIME subcomponents, the email object " +"model is a tree structure of objects that all provide " +"the :class:`~email.message.EmailMessage` API." +msgstr "" + +#: ../../library/email.rst:37 +msgid "" +"The other two major components of the package are the :mod:`~email.parser` " +"and the :mod:`~email.generator`. The parser takes the serialized version of " +"an email message (a stream of bytes) and converts it into a tree " +"of :class:`~email.message.EmailMessage` objects. The generator takes " +"an :class:`~email.message.EmailMessage` and turns it back into a serialized " +"byte stream. (The parser and generator also handle streams of text " +"characters, but this usage is discouraged as it is too easy to end up with " +"messages that are not valid in one way or another.)" msgstr "" -msgid "The next three sections cover the exceptions the package may raise and the defects (non-compliance with the RFCs) that the :mod:`~email.parser` may detect. Then we cover the :mod:`~email.headerregistry` and the :mod:`~email.contentmanager` sub-components, which provide tools for doing more detailed manipulation of headers and payloads, respectively. Both of these components contain features relevant to consuming and producing non-trivial messages, but also document their extensibility APIs, which will be of interest to advanced applications." +#: ../../library/email.rst:46 +msgid "" +"The control component is the :mod:`~email.policy` module. " +"Every :class:`~email.message.EmailMessage`, every :mod:`~email.generator`, " +"and every :mod:`~email.parser` has an associated :mod:`~email.policy` object " +"that controls its behavior. Usually an application only needs to specify " +"the policy when an :class:`~email.message.EmailMessage` is created, either " +"by directly instantiating an :class:`~email.message.EmailMessage` to create " +"a new email, or by parsing an input stream using a :mod:`~email.parser`. " +"But the policy can be changed when the message is serialized using " +"a :mod:`~email.generator`. This allows, for example, a generic email message " +"to be parsed from disk, but to serialize it using standard SMTP settings " +"when sending it to an email server." +msgstr "" + +#: ../../library/email.rst:58 +msgid "" +"The email package does its best to hide the details of the various governing " +"RFCs from the application. Conceptually the application should be able to " +"treat the email message as a structured tree of unicode text and binary " +"attachments, without having to worry about how these are represented when " +"serialized. In practice, however, it is often necessary to be aware of at " +"least some of the rules governing MIME messages and their structure, " +"specifically the names and nature of the MIME \"content types\" and how they " +"identify multipart documents. For the most part this knowledge should only " +"be required for more complex applications, and even then it should only be " +"the high level structure in question, and not the details of how those " +"structures are represented. Since MIME content types are used widely in " +"modern internet software (not just email), this will be a familiar concept " +"to many programmers." +msgstr "" + +#: ../../library/email.rst:71 +msgid "" +"The following sections describe the functionality of the :mod:`!email` " +"package. We start with the :mod:`~email.message` object model, which is the " +"primary interface an application will use, and follow that with " +"the :mod:`~email.parser` and :mod:`~email.generator` components. Then we " +"cover the :mod:`~email.policy` controls, which completes the treatment of " +"the main components of the library." msgstr "" -msgid "Following those is a set of examples of using the fundamental parts of the APIs covered in the preceding sections." +#: ../../library/email.rst:78 +msgid "" +"The next three sections cover the exceptions the package may raise and the " +"defects (non-compliance with the RFCs) that the :mod:`~email.parser` may " +"detect. Then we cover the :mod:`~email.headerregistry` and " +"the :mod:`~email.contentmanager` sub-components, which provide tools for " +"doing more detailed manipulation of headers and payloads, respectively. " +"Both of these components contain features relevant to consuming and " +"producing non-trivial messages, but also document their extensibility APIs, " +"which will be of interest to advanced applications." msgstr "" -msgid "The foregoing represent the modern (unicode friendly) API of the email package. The remaining sections, starting with the :class:`~email.message.Message` class, cover the legacy :data:`~email.policy.compat32` API that deals much more directly with the details of how email messages are represented. The :data:`~email.policy.compat32` API does *not* hide the details of the RFCs from the application, but for applications that need to operate at that level, they can be useful tools. This documentation is also relevant for applications that are still using the :mod:`~email.policy.compat32` API for backward compatibility reasons." +#: ../../library/email.rst:87 +msgid "" +"Following those is a set of examples of using the fundamental parts of the " +"APIs covered in the preceding sections." msgstr "" -msgid "Docs reorganized and rewritten to promote the new :class:`~email.message.EmailMessage`/:class:`~email.policy.EmailPolicy` API." +#: ../../library/email.rst:90 +msgid "" +"The foregoing represent the modern (unicode friendly) API of the email " +"package. The remaining sections, starting with " +"the :class:`~email.message.Message` class, cover the " +"legacy :data:`~email.policy.compat32` API that deals much more directly with " +"the details of how email messages are represented. " +"The :data:`~email.policy.compat32` API does *not* hide the details of the " +"RFCs from the application, but for applications that need to operate at that " +"level, they can be useful tools. This documentation is also relevant for " +"applications that are still using the :mod:`~email.policy.compat32` API for " +"backward compatibility reasons." +msgstr "" + +#: ../../library/email.rst:100 +msgid "" +"Docs reorganized and rewritten to promote the " +"new :class:`~email.message.EmailMessage`/:class:`~email.policy.EmailPolicy` " +"API." msgstr "" +#: ../../library/email.rst:105 msgid "Contents of the :mod:`!email` package documentation:" msgstr "" +#: ../../library/email.rst:120 msgid "Legacy API:" msgstr "" +#: ../../library/email.rst:135 msgid "Module :mod:`smtplib`" msgstr "" +#: ../../library/email.rst:136 msgid "SMTP (Simple Mail Transport Protocol) client" msgstr "" +#: ../../library/email.rst:138 msgid "Module :mod:`poplib`" msgstr "" +#: ../../library/email.rst:139 msgid "POP (Post Office Protocol) client" msgstr "" +#: ../../library/email.rst:141 msgid "Module :mod:`imaplib`" msgstr "" +#: ../../library/email.rst:142 msgid "IMAP (Internet Message Access Protocol) client" msgstr "" +#: ../../library/email.rst:144 msgid "Module :mod:`mailbox`" msgstr "" -msgid "Tools for creating, reading, and managing collections of messages on disk using a variety standard formats." +#: ../../library/email.rst:145 +msgid "" +"Tools for creating, reading, and managing collections of messages on disk " +"using a variety standard formats." msgstr "" diff --git a/library/email.policy.po b/library/email.policy.po index fae0645c9..9f0e7e9b5 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,42 +23,112 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.policy.rst:2 msgid ":mod:`!email.policy`: Policy Objects" msgstr "" +#: ../../library/email.policy.rst:12 msgid "**Source code:** :source:`Lib/email/policy.py`" msgstr "" -msgid "The :mod:`email` package's prime focus is the handling of email messages as described by the various email and MIME RFCs. However, the general format of email messages (a block of header fields each consisting of a name followed by a colon followed by a value, the whole block followed by a blank line and an arbitrary 'body'), is a format that has found utility outside of the realm of email. Some of these uses conform fairly closely to the main email RFCs, some do not. Even when working with email, there are times when it is desirable to break strict compliance with the RFCs, such as generating emails that interoperate with email servers that do not themselves follow the standards, or that implement extensions you want to use in ways that violate the standards." -msgstr "" - -msgid "Policy objects give the email package the flexibility to handle all these disparate use cases." -msgstr "" - -msgid "A :class:`Policy` object encapsulates a set of attributes and methods that control the behavior of various components of the email package during use. :class:`Policy` instances can be passed to various classes and methods in the email package to alter the default behavior. The settable values and their defaults are described below." +#: ../../library/email.policy.rst:16 +msgid "" +"The :mod:`email` package's prime focus is the handling of email messages as " +"described by the various email and MIME RFCs. However, the general format " +"of email messages (a block of header fields each consisting of a name " +"followed by a colon followed by a value, the whole block followed by a blank " +"line and an arbitrary 'body'), is a format that has found utility outside of " +"the realm of email. Some of these uses conform fairly closely to the main " +"email RFCs, some do not. Even when working with email, there are times when " +"it is desirable to break strict compliance with the RFCs, such as generating " +"emails that interoperate with email servers that do not themselves follow " +"the standards, or that implement extensions you want to use in ways that " +"violate the standards." +msgstr "" + +#: ../../library/email.policy.rst:28 +msgid "" +"Policy objects give the email package the flexibility to handle all these " +"disparate use cases." msgstr "" -msgid "There is a default policy used by all classes in the email package. For all of the :mod:`~email.parser` classes and the related convenience functions, and for the :class:`~email.message.Message` class, this is the :class:`Compat32` policy, via its corresponding pre-defined instance :const:`compat32`. This policy provides for complete backward compatibility (in some cases, including bug compatibility) with the pre-Python3.3 version of the email package." +#: ../../library/email.policy.rst:31 +msgid "" +"A :class:`Policy` object encapsulates a set of attributes and methods that " +"control the behavior of various components of the email package during " +"use. :class:`Policy` instances can be passed to various classes and methods " +"in the email package to alter the default behavior. The settable values and " +"their defaults are described below." msgstr "" -msgid "This default value for the *policy* keyword to :class:`~email.message.EmailMessage` is the :class:`EmailPolicy` policy, via its pre-defined instance :data:`~default`." +#: ../../library/email.policy.rst:37 +msgid "" +"There is a default policy used by all classes in the email package. For all " +"of the :mod:`~email.parser` classes and the related convenience functions, " +"and for the :class:`~email.message.Message` class, this is " +"the :class:`Compat32` policy, via its corresponding pre-defined " +"instance :const:`compat32`. This policy provides for complete backward " +"compatibility (in some cases, including bug compatibility) with the pre-" +"Python3.3 version of the email package." msgstr "" -msgid "When a :class:`~email.message.Message` or :class:`~email.message.EmailMessage` object is created, it acquires a policy. If the message is created by a :mod:`~email.parser`, a policy passed to the parser will be the policy used by the message it creates. If the message is created by the program, then the policy can be specified when it is created. When a message is passed to a :mod:`~email.generator`, the generator uses the policy from the message by default, but you can also pass a specific policy to the generator that will override the one stored on the message object." +#: ../../library/email.policy.rst:44 +msgid "" +"This default value for the *policy* keyword " +"to :class:`~email.message.EmailMessage` is the :class:`EmailPolicy` policy, " +"via its pre-defined instance :data:`~default`." msgstr "" -msgid "The default value for the *policy* keyword for the :mod:`email.parser` classes and the parser convenience functions **will be changing** in a future version of Python. Therefore you should **always specify explicitly which policy you want to use** when calling any of the classes and functions described in the :mod:`~email.parser` module." +#: ../../library/email.policy.rst:48 +msgid "" +"When a :class:`~email.message.Message` " +"or :class:`~email.message.EmailMessage` object is created, it acquires a " +"policy. If the message is created by a :mod:`~email.parser`, a policy " +"passed to the parser will be the policy used by the message it creates. If " +"the message is created by the program, then the policy can be specified when " +"it is created. When a message is passed to a :mod:`~email.generator`, the " +"generator uses the policy from the message by default, but you can also pass " +"a specific policy to the generator that will override the one stored on the " +"message object." +msgstr "" + +#: ../../library/email.policy.rst:57 +msgid "" +"The default value for the *policy* keyword for the :mod:`email.parser` " +"classes and the parser convenience functions **will be changing** in a " +"future version of Python. Therefore you should **always specify explicitly " +"which policy you want to use** when calling any of the classes and functions " +"described in the :mod:`~email.parser` module." msgstr "" -msgid "The first part of this documentation covers the features of :class:`Policy`, an :term:`abstract base class` that defines the features that are common to all policy objects, including :const:`compat32`. This includes certain hook methods that are called internally by the email package, which a custom policy could override to obtain different behavior. The second part describes the concrete classes :class:`EmailPolicy` and :class:`Compat32`, which implement the hooks that provide the standard behavior and the backward compatible behavior and features, respectively." +#: ../../library/email.policy.rst:63 +msgid "" +"The first part of this documentation covers the features of :class:`Policy`, " +"an :term:`abstract base class` that defines the features that are common to " +"all policy objects, including :const:`compat32`. This includes certain hook " +"methods that are called internally by the email package, which a custom " +"policy could override to obtain different behavior. The second part " +"describes the concrete classes :class:`EmailPolicy` and :class:`Compat32`, " +"which implement the hooks that provide the standard behavior and the " +"backward compatible behavior and features, respectively." msgstr "" -msgid ":class:`Policy` instances are immutable, but they can be cloned, accepting the same keyword arguments as the class constructor and returning a new :class:`Policy` instance that is a copy of the original but with the specified attributes values changed." +#: ../../library/email.policy.rst:72 +msgid "" +":class:`Policy` instances are immutable, but they can be cloned, accepting " +"the same keyword arguments as the class constructor and returning a " +"new :class:`Policy` instance that is a copy of the original but with the " +"specified attributes values changed." msgstr "" -msgid "As an example, the following code could be used to read an email message from a file on disk and pass it to the system ``sendmail`` program on a Unix system:" +#: ../../library/email.policy.rst:77 +msgid "" +"As an example, the following code could be used to read an email message " +"from a file on disk and pass it to the system ``sendmail`` program on a Unix " +"system:" msgstr "" +#: ../../library/email.policy.rst:92 msgid "" ">>> from email import message_from_binary_file\n" ">>> from email.generator import BytesGenerator\n" @@ -74,12 +144,24 @@ msgid "" ">>> rc = p.wait()" msgstr "" -msgid "Here we are telling :class:`~email.generator.BytesGenerator` to use the RFC correct line separator characters when creating the binary string to feed into ``sendmail's`` ``stdin``, where the default policy would use ``\\n`` line separators." +#: ../../library/email.policy.rst:114 +msgid "" +"Here we are telling :class:`~email.generator.BytesGenerator` to use the RFC " +"correct line separator characters when creating the binary string to feed " +"into ``sendmail's`` ``stdin``, where the default policy would use ``\\n`` " +"line separators." msgstr "" -msgid "Some email package methods accept a *policy* keyword argument, allowing the policy to be overridden for that method. For example, the following code uses the :meth:`~email.message.Message.as_bytes` method of the *msg* object from the previous example and writes the message to a file using the native line separators for the platform on which it is running::" +#: ../../library/email.policy.rst:119 +msgid "" +"Some email package methods accept a *policy* keyword argument, allowing the " +"policy to be overridden for that method. For example, the following code " +"uses the :meth:`~email.message.Message.as_bytes` method of the *msg* object " +"from the previous example and writes the message to a file using the native " +"line separators for the platform on which it is running::" msgstr "" +#: ../../library/email.policy.rst:125 msgid "" ">>> import os\n" ">>> with open('converted.txt', 'wb') as f:\n" @@ -87,18 +169,27 @@ msgid "" "17" msgstr "" -msgid "Policy objects can also be combined using the addition operator, producing a policy object whose settings are a combination of the non-default values of the summed objects::" +#: ../../library/email.policy.rst:130 +msgid "" +"Policy objects can also be combined using the addition operator, producing a " +"policy object whose settings are a combination of the non-default values of " +"the summed objects::" msgstr "" +#: ../../library/email.policy.rst:134 msgid "" ">>> compat_SMTP = policy.compat32.clone(linesep='\\r\\n')\n" ">>> compat_strict = policy.compat32.clone(raise_on_defect=True)\n" ">>> compat_strict_SMTP = compat_SMTP + compat_strict" msgstr "" -msgid "This operation is not commutative; that is, the order in which the objects are added matters. To illustrate::" +#: ../../library/email.policy.rst:138 +msgid "" +"This operation is not commutative; that is, the order in which the objects " +"are added matters. To illustrate::" msgstr "" +#: ../../library/email.policy.rst:141 msgid "" ">>> policy100 = policy.compat32.clone(max_line_length=100)\n" ">>> policy80 = policy.compat32.clone(max_line_length=80)\n" @@ -110,266 +201,613 @@ msgid "" "100" msgstr "" -msgid "This is the :term:`abstract base class` for all policy classes. It provides default implementations for a couple of trivial methods, as well as the implementation of the immutability property, the :meth:`clone` method, and the constructor semantics." +#: ../../library/email.policy.rst:153 +msgid "" +"This is the :term:`abstract base class` for all policy classes. It provides " +"default implementations for a couple of trivial methods, as well as the " +"implementation of the immutability property, the :meth:`clone` method, and " +"the constructor semantics." msgstr "" -msgid "The constructor of a policy class can be passed various keyword arguments. The arguments that may be specified are any non-method properties on this class, plus any additional non-method properties on the concrete class. A value specified in the constructor will override the default value for the corresponding attribute." +#: ../../library/email.policy.rst:158 +msgid "" +"The constructor of a policy class can be passed various keyword arguments. " +"The arguments that may be specified are any non-method properties on this " +"class, plus any additional non-method properties on the concrete class. A " +"value specified in the constructor will override the default value for the " +"corresponding attribute." msgstr "" -msgid "This class defines the following properties, and thus values for the following may be passed in the constructor of any policy class:" +#: ../../library/email.policy.rst:164 +msgid "" +"This class defines the following properties, and thus values for the " +"following may be passed in the constructor of any policy class:" msgstr "" -msgid "The maximum length of any line in the serialized output, not counting the end of line character(s). Default is 78, per :rfc:`5322`. A value of ``0`` or :const:`None` indicates that no line wrapping should be done at all." +#: ../../library/email.policy.rst:170 +msgid "" +"The maximum length of any line in the serialized output, not counting the " +"end of line character(s). Default is 78, per :rfc:`5322`. A value of ``0`` " +"or :const:`None` indicates that no line wrapping should be done at all." msgstr "" -msgid "The string to be used to terminate lines in serialized output. The default is ``\\n`` because that's the internal end-of-line discipline used by Python, though ``\\r\\n`` is required by the RFCs." +#: ../../library/email.policy.rst:178 +msgid "" +"The string to be used to terminate lines in serialized output. The default " +"is ``\\n`` because that's the internal end-of-line discipline used by " +"Python, though ``\\r\\n`` is required by the RFCs." msgstr "" -msgid "Controls the type of Content Transfer Encodings that may be or are required to be used. The possible values are:" +#: ../../library/email.policy.rst:185 +msgid "" +"Controls the type of Content Transfer Encodings that may be or are required " +"to be used. The possible values are:" msgstr "" +#: ../../library/email.policy.rst:191 msgid "``7bit``" msgstr "" -msgid "all data must be \"7 bit clean\" (ASCII-only). This means that where necessary data will be encoded using either quoted-printable or base64 encoding." +#: ../../library/email.policy.rst:191 +msgid "" +"all data must be \"7 bit clean\" (ASCII-only). This means that where " +"necessary data will be encoded using either quoted-printable or base64 " +"encoding." msgstr "" +#: ../../library/email.policy.rst:195 msgid "``8bit``" msgstr "" -msgid "data is not constrained to be 7 bit clean. Data in headers is still required to be ASCII-only and so will be encoded (see :meth:`fold_binary` and :attr:`~EmailPolicy.utf8` below for exceptions), but body parts may use the ``8bit`` CTE." +#: ../../library/email.policy.rst:195 +msgid "" +"data is not constrained to be 7 bit clean. Data in headers is still " +"required to be ASCII-only and so will be encoded (see :meth:`fold_binary` " +"and :attr:`~EmailPolicy.utf8` below for exceptions), but body parts may use " +"the ``8bit`` CTE." msgstr "" -msgid "A ``cte_type`` value of ``8bit`` only works with ``BytesGenerator``, not ``Generator``, because strings cannot contain binary data. If a ``Generator`` is operating under a policy that specifies ``cte_type=8bit``, it will act as if ``cte_type`` is ``7bit``." +#: ../../library/email.policy.rst:201 +msgid "" +"A ``cte_type`` value of ``8bit`` only works with ``BytesGenerator``, not " +"``Generator``, because strings cannot contain binary data. If a " +"``Generator`` is operating under a policy that specifies ``cte_type=8bit``, " +"it will act as if ``cte_type`` is ``7bit``." msgstr "" -msgid "If :const:`True`, any defects encountered will be raised as errors. If :const:`False` (the default), defects will be passed to the :meth:`register_defect` method." +#: ../../library/email.policy.rst:209 +msgid "" +"If :const:`True`, any defects encountered will be raised as errors. " +"If :const:`False` (the default), defects will be passed to " +"the :meth:`register_defect` method." msgstr "" -msgid "If :const:`True`, lines starting with *\"From \"* in the body are escaped by putting a ``>`` in front of them. This parameter is used when the message is being serialized by a generator. Default: :const:`False`." +#: ../../library/email.policy.rst:216 +msgid "" +"If :const:`True`, lines starting with *\"From \"* in the body are escaped by " +"putting a ``>`` in front of them. This parameter is used when the message is " +"being serialized by a generator. Default: :const:`False`." msgstr "" -msgid "A factory function for constructing a new empty message object. Used by the parser when building messages. Defaults to ``None``, in which case :class:`~email.message.Message` is used." +#: ../../library/email.policy.rst:226 +msgid "" +"A factory function for constructing a new empty message object. Used by the " +"parser when building messages. Defaults to ``None``, in which " +"case :class:`~email.message.Message` is used." msgstr "" -msgid "If ``True`` (the default), the generator will raise :exc:`~email.errors.HeaderWriteError` instead of writing a header that is improperly folded or delimited, such that it would be parsed as multiple headers or joined with adjacent data. Such headers can be generated by custom header classes or bugs in the ``email`` module." +#: ../../library/email.policy.rst:235 +msgid "" +"If ``True`` (the default), the generator will " +"raise :exc:`~email.errors.HeaderWriteError` instead of writing a header that " +"is improperly folded or delimited, such that it would be parsed as multiple " +"headers or joined with adjacent data. Such headers can be generated by " +"custom header classes or bugs in the ``email`` module." msgstr "" -msgid "As it's a security feature, this defaults to ``True`` even in the :class:`~email.policy.Compat32` policy. For backwards compatible, but unsafe, behavior, it must be set to ``False`` explicitly." +#: ../../library/email.policy.rst:242 +msgid "" +"As it's a security feature, this defaults to ``True`` even in " +"the :class:`~email.policy.Compat32` policy. For backwards compatible, but " +"unsafe, behavior, it must be set to ``False`` explicitly." msgstr "" -msgid "The following :class:`Policy` method is intended to be called by code using the email library to create policy instances with custom settings:" +#: ../../library/email.policy.rst:250 +msgid "" +"The following :class:`Policy` method is intended to be called by code using " +"the email library to create policy instances with custom settings:" msgstr "" -msgid "Return a new :class:`Policy` instance whose attributes have the same values as the current instance, except where those attributes are given new values by the keyword arguments." +#: ../../library/email.policy.rst:256 +msgid "" +"Return a new :class:`Policy` instance whose attributes have the same values " +"as the current instance, except where those attributes are given new values " +"by the keyword arguments." msgstr "" -msgid "The remaining :class:`Policy` methods are called by the email package code, and are not intended to be called by an application using the email package. A custom policy must implement all of these methods." +#: ../../library/email.policy.rst:261 +msgid "" +"The remaining :class:`Policy` methods are called by the email package code, " +"and are not intended to be called by an application using the email package. " +"A custom policy must implement all of these methods." msgstr "" -msgid "Handle a *defect* found on *obj*. When the email package calls this method, *defect* will always be a subclass of :class:`~email.errors.MessageDefect`." +#: ../../library/email.policy.rst:268 +msgid "" +"Handle a *defect* found on *obj*. When the email package calls this method, " +"*defect* will always be a subclass of :class:`~email.errors.MessageDefect`." msgstr "" -msgid "The default implementation checks the :attr:`raise_on_defect` flag. If it is ``True``, *defect* is raised as an exception. If it is ``False`` (the default), *obj* and *defect* are passed to :meth:`register_defect`." +#: ../../library/email.policy.rst:272 +msgid "" +"The default implementation checks the :attr:`raise_on_defect` flag. If it " +"is ``True``, *defect* is raised as an exception. If it is ``False`` (the " +"default), *obj* and *defect* are passed to :meth:`register_defect`." msgstr "" -msgid "Register a *defect* on *obj*. In the email package, *defect* will always be a subclass of :class:`~email.errors.MessageDefect`." +#: ../../library/email.policy.rst:279 +msgid "" +"Register a *defect* on *obj*. In the email package, *defect* will always be " +"a subclass of :class:`~email.errors.MessageDefect`." msgstr "" -msgid "The default implementation calls the ``append`` method of the ``defects`` attribute of *obj*. When the email package calls :attr:`handle_defect`, *obj* will normally have a ``defects`` attribute that has an ``append`` method. Custom object types used with the email package (for example, custom ``Message`` objects) should also provide such an attribute, otherwise defects in parsed messages will raise unexpected errors." +#: ../../library/email.policy.rst:282 +msgid "" +"The default implementation calls the ``append`` method of the ``defects`` " +"attribute of *obj*. When the email package calls :attr:`handle_defect`, " +"*obj* will normally have a ``defects`` attribute that has an ``append`` " +"method. Custom object types used with the email package (for example, " +"custom ``Message`` objects) should also provide such an attribute, otherwise " +"defects in parsed messages will raise unexpected errors." msgstr "" +#: ../../library/email.policy.rst:292 msgid "Return the maximum allowed number of headers named *name*." msgstr "" -msgid "Called when a header is added to an :class:`~email.message.EmailMessage` or :class:`~email.message.Message` object. If the returned value is not ``0`` or ``None``, and there are already a number of headers with the name *name* greater than or equal to the value returned, a :exc:`ValueError` is raised." +#: ../../library/email.policy.rst:294 +msgid "" +"Called when a header is added to an :class:`~email.message.EmailMessage` " +"or :class:`~email.message.Message` object. If the returned value is not " +"``0`` or ``None``, and there are already a number of headers with the name " +"*name* greater than or equal to the value returned, a :exc:`ValueError` is " +"raised." msgstr "" -msgid "Because the default behavior of ``Message.__setitem__`` is to append the value to the list of headers, it is easy to create duplicate headers without realizing it. This method allows certain headers to be limited in the number of instances of that header that may be added to a ``Message`` programmatically. (The limit is not observed by the parser, which will faithfully produce as many headers as exist in the message being parsed.)" +#: ../../library/email.policy.rst:300 +msgid "" +"Because the default behavior of ``Message.__setitem__`` is to append the " +"value to the list of headers, it is easy to create duplicate headers without " +"realizing it. This method allows certain headers to be limited in the " +"number of instances of that header that may be added to a ``Message`` " +"programmatically. (The limit is not observed by the parser, which will " +"faithfully produce as many headers as exist in the message being parsed.)" msgstr "" +#: ../../library/email.policy.rst:308 msgid "The default implementation returns ``None`` for all header names." msgstr "" -msgid "The email package calls this method with a list of strings, each string ending with the line separation characters found in the source being parsed. The first line includes the field header name and separator. All whitespace in the source is preserved. The method should return the ``(name, value)`` tuple that is to be stored in the ``Message`` to represent the parsed header." +#: ../../library/email.policy.rst:313 +msgid "" +"The email package calls this method with a list of strings, each string " +"ending with the line separation characters found in the source being " +"parsed. The first line includes the field header name and separator. All " +"whitespace in the source is preserved. The method should return the " +"``(name, value)`` tuple that is to be stored in the ``Message`` to represent " +"the parsed header." msgstr "" -msgid "If an implementation wishes to retain compatibility with the existing email package policies, *name* should be the case preserved name (all characters up to the '``:``' separator), while *value* should be the unfolded value (all line separator characters removed, but whitespace kept intact), stripped of leading whitespace." +#: ../../library/email.policy.rst:320 +msgid "" +"If an implementation wishes to retain compatibility with the existing email " +"package policies, *name* should be the case preserved name (all characters " +"up to the '``:``' separator), while *value* should be the unfolded value " +"(all line separator characters removed, but whitespace kept intact), " +"stripped of leading whitespace." msgstr "" +#: ../../library/email.policy.rst:326 msgid "*sourcelines* may contain surrogateescaped binary data." msgstr "" +#: ../../library/email.policy.rst:328 ../../library/email.policy.rst:344 +#: ../../library/email.policy.rst:360 msgid "There is no default implementation" msgstr "" -msgid "The email package calls this method with the name and value provided by the application program when the application program is modifying a ``Message`` programmatically (as opposed to a ``Message`` created by a parser). The method should return the ``(name, value)`` tuple that is to be stored in the ``Message`` to represent the header." +#: ../../library/email.policy.rst:333 +msgid "" +"The email package calls this method with the name and value provided by the " +"application program when the application program is modifying a ``Message`` " +"programmatically (as opposed to a ``Message`` created by a parser). The " +"method should return the ``(name, value)`` tuple that is to be stored in the " +"``Message`` to represent the header." msgstr "" -msgid "If an implementation wishes to retain compatibility with the existing email package policies, the *name* and *value* should be strings or string subclasses that do not change the content of the passed in arguments." +#: ../../library/email.policy.rst:339 +msgid "" +"If an implementation wishes to retain compatibility with the existing email " +"package policies, the *name* and *value* should be strings or string " +"subclasses that do not change the content of the passed in arguments." msgstr "" -msgid "The email package calls this method with the *name* and *value* currently stored in the ``Message`` when that header is requested by the application program, and whatever the method returns is what is passed back to the application as the value of the header being retrieved. Note that there may be more than one header with the same name stored in the ``Message``; the method is passed the specific name and value of the header destined to be returned to the application." +#: ../../library/email.policy.rst:349 +msgid "" +"The email package calls this method with the *name* and *value* currently " +"stored in the ``Message`` when that header is requested by the application " +"program, and whatever the method returns is what is passed back to the " +"application as the value of the header being retrieved. Note that there may " +"be more than one header with the same name stored in the ``Message``; the " +"method is passed the specific name and value of the header destined to be " +"returned to the application." msgstr "" -msgid "*value* may contain surrogateescaped binary data. There should be no surrogateescaped binary data in the value returned by the method." +#: ../../library/email.policy.rst:357 +msgid "" +"*value* may contain surrogateescaped binary data. There should be no " +"surrogateescaped binary data in the value returned by the method." msgstr "" -msgid "The email package calls this method with the *name* and *value* currently stored in the ``Message`` for a given header. The method should return a string that represents that header \"folded\" correctly (according to the policy settings) by composing the *name* with the *value* and inserting :attr:`linesep` characters at the appropriate places. See :rfc:`5322` for a discussion of the rules for folding email headers." +#: ../../library/email.policy.rst:365 +msgid "" +"The email package calls this method with the *name* and *value* currently " +"stored in the ``Message`` for a given header. The method should return a " +"string that represents that header \"folded\" correctly (according to the " +"policy settings) by composing the *name* with the *value* and " +"inserting :attr:`linesep` characters at the appropriate places. " +"See :rfc:`5322` for a discussion of the rules for folding email headers." msgstr "" -msgid "*value* may contain surrogateescaped binary data. There should be no surrogateescaped binary data in the string returned by the method." +#: ../../library/email.policy.rst:372 +msgid "" +"*value* may contain surrogateescaped binary data. There should be no " +"surrogateescaped binary data in the string returned by the method." msgstr "" -msgid "The same as :meth:`fold`, except that the returned value should be a bytes object rather than a string." +#: ../../library/email.policy.rst:378 +msgid "" +"The same as :meth:`fold`, except that the returned value should be a bytes " +"object rather than a string." msgstr "" -msgid "*value* may contain surrogateescaped binary data. These could be converted back into binary data in the returned bytes object." +#: ../../library/email.policy.rst:381 +msgid "" +"*value* may contain surrogateescaped binary data. These could be converted " +"back into binary data in the returned bytes object." msgstr "" -msgid "This concrete :class:`Policy` provides behavior that is intended to be fully compliant with the current email RFCs. These include (but are not limited to) :rfc:`5322`, :rfc:`2047`, and the current MIME RFCs." +#: ../../library/email.policy.rst:388 +msgid "" +"This concrete :class:`Policy` provides behavior that is intended to be fully " +"compliant with the current email RFCs. These include (but are not limited " +"to) :rfc:`5322`, :rfc:`2047`, and the current MIME RFCs." msgstr "" -msgid "This policy adds new header parsing and folding algorithms. Instead of simple strings, headers are ``str`` subclasses with attributes that depend on the type of the field. The parsing and folding algorithm fully implement :rfc:`2047` and :rfc:`5322`." +#: ../../library/email.policy.rst:392 +msgid "" +"This policy adds new header parsing and folding algorithms. Instead of " +"simple strings, headers are ``str`` subclasses with attributes that depend " +"on the type of the field. The parsing and folding algorithm fully " +"implement :rfc:`2047` and :rfc:`5322`." msgstr "" -msgid "The default value for the :attr:`~email.policy.Policy.message_factory` attribute is :class:`~email.message.EmailMessage`." +#: ../../library/email.policy.rst:397 +msgid "" +"The default value for the :attr:`~email.policy.Policy.message_factory` " +"attribute is :class:`~email.message.EmailMessage`." msgstr "" -msgid "In addition to the settable attributes listed above that apply to all policies, this policy adds the following additional attributes:" +#: ../../library/email.policy.rst:400 +msgid "" +"In addition to the settable attributes listed above that apply to all " +"policies, this policy adds the following additional attributes:" msgstr "" +#: ../../library/email.policy.rst:403 msgid "[1]_" msgstr "" -msgid "If ``False``, follow :rfc:`5322`, supporting non-ASCII characters in headers by encoding them as \"encoded words\". If ``True``, follow :rfc:`6532` and use ``utf-8`` encoding for headers. Messages formatted in this way may be passed to SMTP servers that support the ``SMTPUTF8`` extension (:rfc:`6531`)." +#: ../../library/email.policy.rst:408 +msgid "" +"If ``False``, follow :rfc:`5322`, supporting non-ASCII characters in headers " +"by encoding them as \"encoded words\". If ``True``, follow :rfc:`6532` and " +"use ``utf-8`` encoding for headers. Messages formatted in this way may be " +"passed to SMTP servers that support the ``SMTPUTF8`` extension (:rfc:`6531`)." msgstr "" -msgid "If the value for a header in the ``Message`` object originated from a :mod:`~email.parser` (as opposed to being set by a program), this attribute indicates whether or not a generator should refold that value when transforming the message back into serialized form. The possible values are:" +#: ../../library/email.policy.rst:417 +msgid "" +"If the value for a header in the ``Message`` object originated from " +"a :mod:`~email.parser` (as opposed to being set by a program), this " +"attribute indicates whether or not a generator should refold that value when " +"transforming the message back into serialized form. The possible values are:" msgstr "" +#: ../../library/email.policy.rst:424 msgid "``none``" msgstr "" +#: ../../library/email.policy.rst:424 msgid "all source values use original folding" msgstr "" +#: ../../library/email.policy.rst:426 msgid "``long``" msgstr "" -msgid "source values that have any line that is longer than ``max_line_length`` will be refolded" +#: ../../library/email.policy.rst:426 +msgid "" +"source values that have any line that is longer than ``max_line_length`` " +"will be refolded" msgstr "" +#: ../../library/email.policy.rst:429 msgid "``all``" msgstr "" +#: ../../library/email.policy.rst:429 msgid "all values are refolded." msgstr "" +#: ../../library/email.policy.rst:432 msgid "The default is ``long``." msgstr "" -msgid "A callable that takes two arguments, ``name`` and ``value``, where ``name`` is a header field name and ``value`` is an unfolded header field value, and returns a string subclass that represents that header. A default ``header_factory`` (see :mod:`~email.headerregistry`) is provided that supports custom parsing for the various address and date :RFC:`5322` header field types, and the major MIME header field stypes. Support for additional custom parsing will be added in the future." +#: ../../library/email.policy.rst:437 +msgid "" +"A callable that takes two arguments, ``name`` and ``value``, where ``name`` " +"is a header field name and ``value`` is an unfolded header field value, and " +"returns a string subclass that represents that header. A default " +"``header_factory`` (see :mod:`~email.headerregistry`) is provided that " +"supports custom parsing for the various address and date :RFC:`5322` header " +"field types, and the major MIME header field stypes. Support for additional " +"custom parsing will be added in the future." msgstr "" -msgid "An object with at least two methods: get_content and set_content. When the :meth:`~email.message.EmailMessage.get_content` or :meth:`~email.message.EmailMessage.set_content` method of an :class:`~email.message.EmailMessage` object is called, it calls the corresponding method of this object, passing it the message object as its first argument, and any arguments or keywords that were passed to it as additional arguments. By default ``content_manager`` is set to :data:`~email.contentmanager.raw_data_manager`." +#: ../../library/email.policy.rst:448 +msgid "" +"An object with at least two methods: get_content and set_content. When " +"the :meth:`~email.message.EmailMessage.get_content` " +"or :meth:`~email.message.EmailMessage.set_content` method of " +"an :class:`~email.message.EmailMessage` object is called, it calls the " +"corresponding method of this object, passing it the message object as its " +"first argument, and any arguments or keywords that were passed to it as " +"additional arguments. By default ``content_manager`` is set " +"to :data:`~email.contentmanager.raw_data_manager`." msgstr "" -msgid "The class provides the following concrete implementations of the abstract methods of :class:`Policy`:" +#: ../../library/email.policy.rst:460 ../../library/email.policy.rst:618 +msgid "" +"The class provides the following concrete implementations of the abstract " +"methods of :class:`Policy`:" msgstr "" -msgid "Returns the value of the :attr:`~email.headerregistry.BaseHeader.max_count` attribute of the specialized class used to represent the header with the given name." +#: ../../library/email.policy.rst:466 +msgid "" +"Returns the value of the :attr:`~email.headerregistry.BaseHeader.max_count` " +"attribute of the specialized class used to represent the header with the " +"given name." msgstr "" -msgid "The name is parsed as everything up to the '``:``' and returned unmodified. The value is determined by stripping leading whitespace off the remainder of the first line, joining all subsequent lines together, and stripping any trailing carriage return or linefeed characters." +#: ../../library/email.policy.rst:474 ../../library/email.policy.rst:624 +msgid "" +"The name is parsed as everything up to the '``:``' and returned unmodified. " +"The value is determined by stripping leading whitespace off the remainder of " +"the first line, joining all subsequent lines together, and stripping any " +"trailing carriage return or linefeed characters." msgstr "" -msgid "The name is returned unchanged. If the input value has a ``name`` attribute and it matches *name* ignoring case, the value is returned unchanged. Otherwise the *name* and *value* are passed to ``header_factory``, and the resulting header object is returned as the value. In this case a ``ValueError`` is raised if the input value contains CR or LF characters." +#: ../../library/email.policy.rst:482 +msgid "" +"The name is returned unchanged. If the input value has a ``name`` attribute " +"and it matches *name* ignoring case, the value is returned unchanged. " +"Otherwise the *name* and *value* are passed to ``header_factory``, and the " +"resulting header object is returned as the value. In this case a " +"``ValueError`` is raised if the input value contains CR or LF characters." msgstr "" -msgid "If the value has a ``name`` attribute, it is returned to unmodified. Otherwise the *name*, and the *value* with any CR or LF characters removed, are passed to the ``header_factory``, and the resulting header object is returned. Any surrogateescaped bytes get turned into the unicode unknown-character glyph." +#: ../../library/email.policy.rst:492 +msgid "" +"If the value has a ``name`` attribute, it is returned to unmodified. " +"Otherwise the *name*, and the *value* with any CR or LF characters removed, " +"are passed to the ``header_factory``, and the resulting header object is " +"returned. Any surrogateescaped bytes get turned into the unicode unknown-" +"character glyph." msgstr "" -msgid "Header folding is controlled by the :attr:`refold_source` policy setting. A value is considered to be a 'source value' if and only if it does not have a ``name`` attribute (having a ``name`` attribute means it is a header object of some sort). If a source value needs to be refolded according to the policy, it is converted into a header object by passing the *name* and the *value* with any CR and LF characters removed to the ``header_factory``. Folding of a header object is done by calling its ``fold`` method with the current policy." +#: ../../library/email.policy.rst:501 +msgid "" +"Header folding is controlled by the :attr:`refold_source` policy setting. A " +"value is considered to be a 'source value' if and only if it does not have a " +"``name`` attribute (having a ``name`` attribute means it is a header object " +"of some sort). If a source value needs to be refolded according to the " +"policy, it is converted into a header object by passing the *name* and the " +"*value* with any CR and LF characters removed to the ``header_factory``. " +"Folding of a header object is done by calling its ``fold`` method with the " +"current policy." msgstr "" -msgid "Source values are split into lines using :meth:`~str.splitlines`. If the value is not to be refolded, the lines are rejoined using the ``linesep`` from the policy and returned. The exception is lines containing non-ascii binary data. In that case the value is refolded regardless of the ``refold_source`` setting, which causes the binary data to be CTE encoded using the ``unknown-8bit`` charset." +#: ../../library/email.policy.rst:510 +msgid "" +"Source values are split into lines using :meth:`~str.splitlines`. If the " +"value is not to be refolded, the lines are rejoined using the ``linesep`` " +"from the policy and returned. The exception is lines containing non-ascii " +"binary data. In that case the value is refolded regardless of the " +"``refold_source`` setting, which causes the binary data to be CTE encoded " +"using the ``unknown-8bit`` charset." msgstr "" -msgid "The same as :meth:`fold` if :attr:`~Policy.cte_type` is ``7bit``, except that the returned value is bytes." +#: ../../library/email.policy.rst:520 +msgid "" +"The same as :meth:`fold` if :attr:`~Policy.cte_type` is ``7bit``, except " +"that the returned value is bytes." msgstr "" -msgid "If :attr:`~Policy.cte_type` is ``8bit``, non-ASCII binary data is converted back into bytes. Headers with binary data are not refolded, regardless of the ``refold_header`` setting, since there is no way to know whether the binary data consists of single byte characters or multibyte characters." +#: ../../library/email.policy.rst:523 +msgid "" +"If :attr:`~Policy.cte_type` is ``8bit``, non-ASCII binary data is converted " +"back into bytes. Headers with binary data are not refolded, regardless of " +"the ``refold_header`` setting, since there is no way to know whether the " +"binary data consists of single byte characters or multibyte characters." msgstr "" -msgid "The following instances of :class:`EmailPolicy` provide defaults suitable for specific application domains. Note that in the future the behavior of these instances (in particular the ``HTTP`` instance) may be adjusted to conform even more closely to the RFCs relevant to their domains." +#: ../../library/email.policy.rst:530 +msgid "" +"The following instances of :class:`EmailPolicy` provide defaults suitable " +"for specific application domains. Note that in the future the behavior of " +"these instances (in particular the ``HTTP`` instance) may be adjusted to " +"conform even more closely to the RFCs relevant to their domains." msgstr "" -msgid "An instance of ``EmailPolicy`` with all defaults unchanged. This policy uses the standard Python ``\\n`` line endings rather than the RFC-correct ``\\r\\n``." +#: ../../library/email.policy.rst:538 +msgid "" +"An instance of ``EmailPolicy`` with all defaults unchanged. This policy " +"uses the standard Python ``\\n`` line endings rather than the RFC-correct " +"``\\r\\n``." msgstr "" -msgid "Suitable for serializing messages in conformance with the email RFCs. Like ``default``, but with ``linesep`` set to ``\\r\\n``, which is RFC compliant." +#: ../../library/email.policy.rst:545 +msgid "" +"Suitable for serializing messages in conformance with the email RFCs. Like " +"``default``, but with ``linesep`` set to ``\\r\\n``, which is RFC compliant." msgstr "" -msgid "The same as ``SMTP`` except that :attr:`~EmailPolicy.utf8` is ``True``. Useful for serializing messages to a message store without using encoded words in the headers. Should only be used for SMTP transmission if the sender or recipient addresses have non-ASCII characters (the :meth:`smtplib.SMTP.send_message` method handles this automatically)." +#: ../../library/email.policy.rst:552 +msgid "" +"The same as ``SMTP`` except that :attr:`~EmailPolicy.utf8` is ``True``. " +"Useful for serializing messages to a message store without using encoded " +"words in the headers. Should only be used for SMTP transmission if the " +"sender or recipient addresses have non-ASCII characters " +"(the :meth:`smtplib.SMTP.send_message` method handles this automatically)." msgstr "" -msgid "Suitable for serializing headers with for use in HTTP traffic. Like ``SMTP`` except that ``max_line_length`` is set to ``None`` (unlimited)." +#: ../../library/email.policy.rst:561 +msgid "" +"Suitable for serializing headers with for use in HTTP traffic. Like " +"``SMTP`` except that ``max_line_length`` is set to ``None`` (unlimited)." msgstr "" -msgid "Convenience instance. The same as ``default`` except that ``raise_on_defect`` is set to ``True``. This allows any policy to be made strict by writing::" +#: ../../library/email.policy.rst:567 +msgid "" +"Convenience instance. The same as ``default`` except that " +"``raise_on_defect`` is set to ``True``. This allows any policy to be made " +"strict by writing::" msgstr "" +#: ../../library/email.policy.rst:571 msgid "somepolicy + policy.strict" msgstr "" -msgid "With all of these :class:`EmailPolicies <.EmailPolicy>`, the effective API of the email package is changed from the Python 3.2 API in the following ways:" +#: ../../library/email.policy.rst:574 +msgid "" +"With all of these :class:`EmailPolicies <.EmailPolicy>`, the effective API " +"of the email package is changed from the Python 3.2 API in the following " +"ways:" msgstr "" -msgid "Setting a header on a :class:`~email.message.Message` results in that header being parsed and a header object created." +#: ../../library/email.policy.rst:577 +msgid "" +"Setting a header on a :class:`~email.message.Message` results in that header " +"being parsed and a header object created." msgstr "" -msgid "Fetching a header value from a :class:`~email.message.Message` results in that header being parsed and a header object created and returned." +#: ../../library/email.policy.rst:580 +msgid "" +"Fetching a header value from a :class:`~email.message.Message` results in " +"that header being parsed and a header object created and returned." msgstr "" -msgid "Any header object, or any header that is refolded due to the policy settings, is folded using an algorithm that fully implements the RFC folding algorithms, including knowing where encoded words are required and allowed." +#: ../../library/email.policy.rst:584 +msgid "" +"Any header object, or any header that is refolded due to the policy " +"settings, is folded using an algorithm that fully implements the RFC folding " +"algorithms, including knowing where encoded words are required and allowed." msgstr "" -msgid "From the application view, this means that any header obtained through the :class:`~email.message.EmailMessage` is a header object with extra attributes, whose string value is the fully decoded unicode value of the header. Likewise, a header may be assigned a new value, or a new header created, using a unicode string, and the policy will take care of converting the unicode string into the correct RFC encoded form." +#: ../../library/email.policy.rst:589 +msgid "" +"From the application view, this means that any header obtained through " +"the :class:`~email.message.EmailMessage` is a header object with extra " +"attributes, whose string value is the fully decoded unicode value of the " +"header. Likewise, a header may be assigned a new value, or a new header " +"created, using a unicode string, and the policy will take care of converting " +"the unicode string into the correct RFC encoded form." msgstr "" -msgid "The header objects and their attributes are described in :mod:`~email.headerregistry`." +#: ../../library/email.policy.rst:596 +msgid "" +"The header objects and their attributes are described " +"in :mod:`~email.headerregistry`." msgstr "" -msgid "This concrete :class:`Policy` is the backward compatibility policy. It replicates the behavior of the email package in Python 3.2. The :mod:`!policy` module also defines an instance of this class, :const:`compat32`, that is used as the default policy. Thus the default behavior of the email package is to maintain compatibility with Python 3.2." +#: ../../library/email.policy.rst:603 +msgid "" +"This concrete :class:`Policy` is the backward compatibility policy. It " +"replicates the behavior of the email package in Python 3.2. The :mod:`!" +"policy` module also defines an instance of this class, :const:`compat32`, " +"that is used as the default policy. Thus the default behavior of the email " +"package is to maintain compatibility with Python 3.2." msgstr "" -msgid "The following attributes have values that are different from the :class:`Policy` default:" +#: ../../library/email.policy.rst:609 +msgid "" +"The following attributes have values that are different from " +"the :class:`Policy` default:" msgstr "" +#: ../../library/email.policy.rst:615 msgid "The default is ``True``." msgstr "" +#: ../../library/email.policy.rst:632 msgid "The name and value are returned unmodified." msgstr "" -msgid "If the value contains binary data, it is converted into a :class:`~email.header.Header` object using the ``unknown-8bit`` charset. Otherwise it is returned unmodified." +#: ../../library/email.policy.rst:637 +msgid "" +"If the value contains binary data, it is converted into " +"a :class:`~email.header.Header` object using the ``unknown-8bit`` charset. " +"Otherwise it is returned unmodified." msgstr "" -msgid "Headers are folded using the :class:`~email.header.Header` folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the ``max_line_length``. Non-ASCII binary data are CTE encoded using the ``unknown-8bit`` charset." +#: ../../library/email.policy.rst:644 +msgid "" +"Headers are folded using the :class:`~email.header.Header` folding " +"algorithm, which preserves existing line breaks in the value, and wraps each " +"resulting line to the ``max_line_length``. Non-ASCII binary data are CTE " +"encoded using the ``unknown-8bit`` charset." msgstr "" -msgid "Headers are folded using the :class:`~email.header.Header` folding algorithm, which preserves existing line breaks in the value, and wraps each resulting line to the ``max_line_length``. If ``cte_type`` is ``7bit``, non-ascii binary data is CTE encoded using the ``unknown-8bit`` charset. Otherwise the original source header is used, with its existing line breaks and any (RFC invalid) binary data it may contain." +#: ../../library/email.policy.rst:652 +msgid "" +"Headers are folded using the :class:`~email.header.Header` folding " +"algorithm, which preserves existing line breaks in the value, and wraps each " +"resulting line to the ``max_line_length``. If ``cte_type`` is ``7bit``, non-" +"ascii binary data is CTE encoded using the ``unknown-8bit`` charset. " +"Otherwise the original source header is used, with its existing line breaks " +"and any (RFC invalid) binary data it may contain." msgstr "" -msgid "An instance of :class:`Compat32`, providing backward compatibility with the behavior of the email package in Python 3.2." +#: ../../library/email.policy.rst:662 +msgid "" +"An instance of :class:`Compat32`, providing backward compatibility with the " +"behavior of the email package in Python 3.2." msgstr "" -msgid "The :const:`compat32` policy should not be used as a policy for :class:`~email.message.EmailMessage` objects, and should only be used to serialize messages that were created using the :const:`compat32` policy." +#: ../../library/email.policy.rst:667 +msgid "" +"The :const:`compat32` policy should not be used as a policy " +"for :class:`~email.message.EmailMessage` objects, and should only be used to " +"serialize messages that were created using the :const:`compat32` policy." msgstr "" +#: ../../library/email.policy.rst:674 msgid "Footnotes" msgstr "" -msgid "Originally added in 3.3 as a :term:`provisional feature `." +#: ../../library/email.policy.rst:675 +msgid "" +"Originally added in 3.3 as a :term:`provisional feature `." msgstr "" diff --git a/library/email.utils.po b/library/email.utils.po index 1b6d45a3e..2b4e8b4ef 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,60 +23,118 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/email.utils.rst:2 msgid ":mod:`!email.utils`: Miscellaneous utilities" msgstr "" +#: ../../library/email.utils.rst:7 msgid "**Source code:** :source:`Lib/email/utils.py`" msgstr "" -msgid "There are a couple of useful utilities provided in the :mod:`!email.utils` module:" +#: ../../library/email.utils.rst:11 +msgid "" +"There are a couple of useful utilities provided in the :mod:`!email.utils` " +"module:" msgstr "" -msgid "Return local time as an aware datetime object. If called without arguments, return current time. Otherwise *dt* argument should be a :class:`~datetime.datetime` instance, and it is converted to the local time zone according to the system time zone database. If *dt* is naive (that is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time." +#: ../../library/email.utils.rst:16 +msgid "" +"Return local time as an aware datetime object. If called without arguments, " +"return current time. Otherwise *dt* argument should be " +"a :class:`~datetime.datetime` instance, and it is converted to the local " +"time zone according to the system time zone database. If *dt* is naive " +"(that is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time." msgstr "" +#: ../../library/email.utils.rst:24 msgid "The *isdst* parameter." msgstr "" -msgid "Returns a string suitable for an :rfc:`2822`\\ -compliant :mailheader:`Message-ID` header. Optional *idstring* if given, is a string used to strengthen the uniqueness of the message id. Optional *domain* if given provides the portion of the msgid after the '@'. The default is the local hostname. It is not normally necessary to override this default, but may be useful certain cases, such as a constructing distributed system that uses a consistent domain name across multiple hosts." +#: ../../library/email.utils.rst:29 +msgid "" +"Returns a string suitable for an :rfc:`2822`\\ " +"-compliant :mailheader:`Message-ID` header. Optional *idstring* if given, " +"is a string used to strengthen the uniqueness of the message id. Optional " +"*domain* if given provides the portion of the msgid after the '@'. The " +"default is the local hostname. It is not normally necessary to override " +"this default, but may be useful certain cases, such as a constructing " +"distributed system that uses a consistent domain name across multiple hosts." msgstr "" +#: ../../library/email.utils.rst:37 msgid "Added the *domain* keyword." msgstr "" -msgid "The remaining functions are part of the legacy (``Compat32``) email API. There is no need to directly use these with the new API, since the parsing and formatting they provide is done automatically by the header parsing machinery of the new API." +#: ../../library/email.utils.rst:41 +msgid "" +"The remaining functions are part of the legacy (``Compat32``) email API. " +"There is no need to directly use these with the new API, since the parsing " +"and formatting they provide is done automatically by the header parsing " +"machinery of the new API." msgstr "" -msgid "Return a new string with backslashes in *str* replaced by two backslashes, and double quotes replaced by backslash-double quote." +#: ../../library/email.utils.rst:49 +msgid "" +"Return a new string with backslashes in *str* replaced by two backslashes, " +"and double quotes replaced by backslash-double quote." msgstr "" -msgid "Return a new string which is an *unquoted* version of *str*. If *str* ends and begins with double quotes, they are stripped off. Likewise if *str* ends and begins with angle brackets, they are stripped off." +#: ../../library/email.utils.rst:55 +msgid "" +"Return a new string which is an *unquoted* version of *str*. If *str* ends " +"and begins with double quotes, they are stripped off. Likewise if *str* " +"ends and begins with angle brackets, they are stripped off." msgstr "" -msgid "Parse address -- which should be the value of some address-containing field such as :mailheader:`To` or :mailheader:`Cc` -- into its constituent *realname* and *email address* parts. Returns a tuple of that information, unless the parse fails, in which case a 2-tuple of ``('', '')`` is returned." +#: ../../library/email.utils.rst:62 +msgid "" +"Parse address -- which should be the value of some address-containing field " +"such as :mailheader:`To` or :mailheader:`Cc` -- into its constituent " +"*realname* and *email address* parts. Returns a tuple of that information, " +"unless the parse fails, in which case a 2-tuple of ``('', '')`` is returned." msgstr "" -msgid "If *strict* is true, use a strict parser which rejects malformed inputs." +#: ../../library/email.utils.rst:67 ../../library/email.utils.rst:95 +msgid "" +"If *strict* is true, use a strict parser which rejects malformed inputs." msgstr "" +#: ../../library/email.utils.rst:69 ../../library/email.utils.rst:107 msgid "Add *strict* optional parameter and reject malformed inputs by default." msgstr "" -msgid "The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form ``(realname, email_address)`` and returns the string value suitable for a :mailheader:`To` or :mailheader:`Cc` header. If the first element of *pair* is false, then the second element is returned unmodified." +#: ../../library/email.utils.rst:75 +msgid "" +"The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form " +"``(realname, email_address)`` and returns the string value suitable for " +"a :mailheader:`To` or :mailheader:`Cc` header. If the first element of " +"*pair* is false, then the second element is returned unmodified." msgstr "" -msgid "Optional *charset* is the character set that will be used in the :rfc:`2047` encoding of the ``realname`` if the ``realname`` contains non-ASCII characters. Can be an instance of :class:`str` or a :class:`~email.charset.Charset`. Defaults to ``utf-8``." +#: ../../library/email.utils.rst:80 +msgid "" +"Optional *charset* is the character set that will be used in the :rfc:`2047` " +"encoding of the ``realname`` if the ``realname`` contains non-ASCII " +"characters. Can be an instance of :class:`str` or " +"a :class:`~email.charset.Charset`. Defaults to ``utf-8``." msgstr "" +#: ../../library/email.utils.rst:85 msgid "Added the *charset* option." msgstr "" -msgid "This method returns a list of 2-tuples of the form returned by ``parseaddr()``. *fieldvalues* is a sequence of header field values as might be returned by :meth:`Message.get_all `." +#: ../../library/email.utils.rst:91 +msgid "" +"This method returns a list of 2-tuples of the form returned by " +"``parseaddr()``. *fieldvalues* is a sequence of header field values as might " +"be returned by :meth:`Message.get_all `." msgstr "" +#: ../../library/email.utils.rst:97 msgid "Here's a simple example that gets all the recipients of a message::" msgstr "" +#: ../../library/email.utils.rst:99 msgid "" "from email.utils import getaddresses\n" "\n" @@ -87,53 +145,136 @@ msgid "" "all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)" msgstr "" -msgid "Attempts to parse a date according to the rules in :rfc:`2822`. however, some mailers don't follow that format as specified, so :func:`parsedate` tries to guess correctly in such cases. *date* is a string containing an :rfc:`2822` date, such as ``\"Mon, 20 Nov 1995 19:12:08 -0500\"``. If it succeeds in parsing the date, :func:`parsedate` returns a 9-tuple that can be passed directly to :func:`time.mktime`; otherwise ``None`` will be returned. Note that indexes 6, 7, and 8 of the result tuple are not usable." -msgstr "" - -msgid "Performs the same function as :func:`parsedate`, but returns either ``None`` or a 10-tuple; the first 9 elements make up a tuple that can be passed directly to :func:`time.mktime`, and the tenth is the offset of the date's timezone from UTC (which is the official term for Greenwich Mean Time) [#]_. If the input string has no timezone, the last element of the tuple returned is ``0``, which represents UTC. Note that indexes 6, 7, and 8 of the result tuple are not usable." +#: ../../library/email.utils.rst:113 +msgid "" +"Attempts to parse a date according to the rules in :rfc:`2822`. however, " +"some mailers don't follow that format as specified, so :func:`parsedate` " +"tries to guess correctly in such cases. *date* is a string containing " +"an :rfc:`2822` date, such as ``\"Mon, 20 Nov 1995 19:12:08 -0500\"``. If " +"it succeeds in parsing the date, :func:`parsedate` returns a 9-tuple that " +"can be passed directly to :func:`time.mktime`; otherwise ``None`` will be " +"returned. Note that indexes 6, 7, and 8 of the result tuple are not usable." msgstr "" -msgid "The inverse of :func:`format_datetime`. Performs the same function as :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`; otherwise ``ValueError`` is raised if *date* contains an invalid value such as an hour greater than 23 or a timezone offset not between -24 and 24 hours. If the input date has a timezone of ``-0000``, the ``datetime`` will be a naive ``datetime``, and if the date is conforming to the RFCs it will represent a time in UTC but with no indication of the actual source timezone of the message the date comes from. If the input date has any other valid timezone offset, the ``datetime`` will be an aware ``datetime`` with the corresponding a :class:`~datetime.timezone` :class:`~datetime.tzinfo`." +#: ../../library/email.utils.rst:124 +msgid "" +"Performs the same function as :func:`parsedate`, but returns either ``None`` " +"or a 10-tuple; the first 9 elements make up a tuple that can be passed " +"directly to :func:`time.mktime`, and the tenth is the offset of the date's " +"timezone from UTC (which is the official term for Greenwich Mean Time) " +"[#]_. If the input string has no timezone, the last element of the tuple " +"returned is ``0``, which represents UTC. Note that indexes 6, 7, and 8 of " +"the result tuple are not usable." msgstr "" -msgid "Turn a 10-tuple as returned by :func:`parsedate_tz` into a UTC timestamp (seconds since the Epoch). If the timezone item in the tuple is ``None``, assume local time." +#: ../../library/email.utils.rst:134 +msgid "" +"The inverse of :func:`format_datetime`. Performs the same function " +"as :func:`parsedate`, but on success returns a :mod:`~datetime.datetime`; " +"otherwise ``ValueError`` is raised if *date* contains an invalid value such " +"as an hour greater than 23 or a timezone offset not between -24 and 24 " +"hours. If the input date has a timezone of ``-0000``, the ``datetime`` will " +"be a naive ``datetime``, and if the date is conforming to the RFCs it will " +"represent a time in UTC but with no indication of the actual source timezone " +"of the message the date comes from. If the input date has any other valid " +"timezone offset, the ``datetime`` will be an aware ``datetime`` with the " +"corresponding a :class:`~datetime.timezone` :class:`~datetime.tzinfo`." +msgstr "" + +#: ../../library/email.utils.rst:150 +msgid "" +"Turn a 10-tuple as returned by :func:`parsedate_tz` into a UTC timestamp " +"(seconds since the Epoch). If the timezone item in the tuple is ``None``, " +"assume local time." msgstr "" +#: ../../library/email.utils.rst:157 msgid "Returns a date string as per :rfc:`2822`, e.g.::" msgstr "" +#: ../../library/email.utils.rst:159 msgid "Fri, 09 Nov 2001 01:08:47 -0000" msgstr "" -msgid "Optional *timeval* if given is a floating-point time value as accepted by :func:`time.gmtime` and :func:`time.localtime`, otherwise the current time is used." +#: ../../library/email.utils.rst:161 +msgid "" +"Optional *timeval* if given is a floating-point time value as accepted " +"by :func:`time.gmtime` and :func:`time.localtime`, otherwise the current " +"time is used." msgstr "" -msgid "Optional *localtime* is a flag that when ``True``, interprets *timeval*, and returns a date relative to the local timezone instead of UTC, properly taking daylight savings time into account. The default is ``False`` meaning UTC is used." +#: ../../library/email.utils.rst:165 +msgid "" +"Optional *localtime* is a flag that when ``True``, interprets *timeval*, and " +"returns a date relative to the local timezone instead of UTC, properly " +"taking daylight savings time into account. The default is ``False`` meaning " +"UTC is used." msgstr "" -msgid "Optional *usegmt* is a flag that when ``True``, outputs a date string with the timezone as an ascii string ``GMT``, rather than a numeric ``-0000``. This is needed for some protocols (such as HTTP). This only applies when *localtime* is ``False``. The default is ``False``." +#: ../../library/email.utils.rst:170 +msgid "" +"Optional *usegmt* is a flag that when ``True``, outputs a date string with " +"the timezone as an ascii string ``GMT``, rather than a numeric ``-0000``. " +"This is needed for some protocols (such as HTTP). This only applies when " +"*localtime* is ``False``. The default is ``False``." msgstr "" -msgid "Like ``formatdate``, but the input is a :mod:`datetime` instance. If it is a naive datetime, it is assumed to be \"UTC with no information about the source timezone\", and the conventional ``-0000`` is used for the timezone. If it is an aware ``datetime``, then the numeric timezone offset is used. If it is an aware timezone with offset zero, then *usegmt* may be set to ``True``, in which case the string ``GMT`` is used instead of the numeric timezone offset. This provides a way to generate standards conformant HTTP date headers." +#: ../../library/email.utils.rst:178 +msgid "" +"Like ``formatdate``, but the input is a :mod:`datetime` instance. If it is " +"a naive datetime, it is assumed to be \"UTC with no information about the " +"source timezone\", and the conventional ``-0000`` is used for the timezone. " +"If it is an aware ``datetime``, then the numeric timezone offset is used. If " +"it is an aware timezone with offset zero, then *usegmt* may be set to " +"``True``, in which case the string ``GMT`` is used instead of the numeric " +"timezone offset. This provides a way to generate standards conformant HTTP " +"date headers." msgstr "" +#: ../../library/email.utils.rst:192 msgid "Decode the string *s* according to :rfc:`2231`." msgstr "" -msgid "Encode the string *s* according to :rfc:`2231`. Optional *charset* and *language*, if given is the character set name and language name to use. If neither is given, *s* is returned as-is. If *charset* is given but *language* is not, the string is encoded using the empty string for *language*." +#: ../../library/email.utils.rst:197 +msgid "" +"Encode the string *s* according to :rfc:`2231`. Optional *charset* and " +"*language*, if given is the character set name and language name to use. If " +"neither is given, *s* is returned as-is. If *charset* is given but " +"*language* is not, the string is encoded using the empty string for " +"*language*." msgstr "" -msgid "When a header parameter is encoded in :rfc:`2231` format, :meth:`Message.get_param ` may return a 3-tuple containing the character set, language, and value. :func:`collapse_rfc2231_value` turns this into a unicode string. Optional *errors* is passed to the *errors* argument of :class:`str`'s :func:`~str.encode` method; it defaults to ``'replace'``. Optional *fallback_charset* specifies the character set to use if the one in the :rfc:`2231` header is not known by Python; it defaults to ``'us-ascii'``." +#: ../../library/email.utils.rst:205 +msgid "" +"When a header parameter is encoded in :rfc:`2231` " +"format, :meth:`Message.get_param ` may " +"return a 3-tuple containing the character set, language, and " +"value. :func:`collapse_rfc2231_value` turns this into a unicode string. " +"Optional *errors* is passed to the *errors* argument " +"of :class:`str`'s :func:`~str.encode` method; it defaults to ``'replace'``. " +"Optional *fallback_charset* specifies the character set to use if the one in " +"the :rfc:`2231` header is not known by Python; it defaults to ``'us-ascii'``." msgstr "" -msgid "For convenience, if the *value* passed to :func:`collapse_rfc2231_value` is not a tuple, it should be a string and it is returned unquoted." +#: ../../library/email.utils.rst:214 +msgid "" +"For convenience, if the *value* passed to :func:`collapse_rfc2231_value` is " +"not a tuple, it should be a string and it is returned unquoted." msgstr "" -msgid "Decode parameters list according to :rfc:`2231`. *params* is a sequence of 2-tuples containing elements of the form ``(content-type, string-value)``." +#: ../../library/email.utils.rst:220 +msgid "" +"Decode parameters list according to :rfc:`2231`. *params* is a sequence of " +"2-tuples containing elements of the form ``(content-type, string-value)``." msgstr "" +#: ../../library/email.utils.rst:225 msgid "Footnotes" msgstr "" -msgid "Note that the sign of the timezone offset is the opposite of the sign of the ``time.timezone`` variable for the same timezone; the latter variable follows the POSIX standard while this module follows :rfc:`2822`." +#: ../../library/email.utils.rst:226 +msgid "" +"Note that the sign of the timezone offset is the opposite of the sign of the " +"``time.timezone`` variable for the same timezone; the latter variable " +"follows the POSIX standard while this module follows :rfc:`2822`." msgstr "" diff --git a/library/ensurepip.po b/library/ensurepip.po index c94bfe0ca..0476b2ce1 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,122 +23,228 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/ensurepip.rst:2 msgid ":mod:`!ensurepip` --- Bootstrapping the ``pip`` installer" msgstr "" +#: ../../library/ensurepip.rst:10 msgid "**Source code:** :source:`Lib/ensurepip`" msgstr "" -msgid "The :mod:`!ensurepip` package provides support for bootstrapping the ``pip`` installer into an existing Python installation or virtual environment. This bootstrapping approach reflects the fact that ``pip`` is an independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter." +#: ../../library/ensurepip.rst:14 +msgid "" +"The :mod:`!ensurepip` package provides support for bootstrapping the ``pip`` " +"installer into an existing Python installation or virtual environment. This " +"bootstrapping approach reflects the fact that ``pip`` is an independent " +"project with its own release cycle, and the latest available stable version " +"is bundled with maintenance and feature releases of the CPython reference " +"interpreter." msgstr "" -msgid "In most cases, end users of Python shouldn't need to invoke this module directly (as ``pip`` should be bootstrapped by default), but it may be needed if installing ``pip`` was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling ``pip``." +#: ../../library/ensurepip.rst:21 +msgid "" +"In most cases, end users of Python shouldn't need to invoke this module " +"directly (as ``pip`` should be bootstrapped by default), but it may be " +"needed if installing ``pip`` was skipped when installing Python (or when " +"creating a virtual environment) or after explicitly uninstalling ``pip``." msgstr "" -msgid "This module *does not* access the internet. All of the components needed to bootstrap ``pip`` are included as internal parts of the package." +#: ../../library/ensurepip.rst:29 +msgid "" +"This module *does not* access the internet. All of the components needed to " +"bootstrap ``pip`` are included as internal parts of the package." msgstr "" -msgid "This is an :term:`optional module`. If it is missing from your copy of CPython, look for documentation from your distributor (that is, whoever provided Python to you). If you are the distributor, see :ref:`optional-module-requirements`." +#: ../../includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" +#: ../../library/ensurepip.rst:37 msgid ":ref:`installing-index`" msgstr "" +#: ../../library/ensurepip.rst:38 msgid "The end user guide for installing Python packages" msgstr "" +#: ../../library/ensurepip.rst:40 msgid ":pep:`453`: Explicit bootstrapping of pip in Python installations" msgstr "" +#: ../../library/ensurepip.rst:41 msgid "The original rationale and specification for this module." msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +#: ../../includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +#: ../../library/ensurepip.rst:48 msgid "Command-line interface" msgstr "" -msgid "The command line interface is invoked using the interpreter's ``-m`` switch." +#: ../../library/ensurepip.rst:52 +msgid "" +"The command line interface is invoked using the interpreter's ``-m`` switch." msgstr "" +#: ../../library/ensurepip.rst:54 msgid "The simplest possible invocation is::" msgstr "" +#: ../../library/ensurepip.rst:56 msgid "python -m ensurepip" msgstr "" -msgid "This invocation will install ``pip`` if it is not already installed, but otherwise does nothing. To ensure the installed version of ``pip`` is at least as recent as the one available in ``ensurepip``, pass the ``--upgrade`` option::" +#: ../../library/ensurepip.rst:58 +msgid "" +"This invocation will install ``pip`` if it is not already installed, but " +"otherwise does nothing. To ensure the installed version of ``pip`` is at " +"least as recent as the one available in ``ensurepip``, pass the ``--" +"upgrade`` option::" msgstr "" +#: ../../library/ensurepip.rst:63 msgid "python -m ensurepip --upgrade" msgstr "" -msgid "By default, ``pip`` is installed into the current virtual environment (if one is active) or into the system site packages (if there is no active virtual environment). The installation location can be controlled through two additional command line options:" +#: ../../library/ensurepip.rst:65 +msgid "" +"By default, ``pip`` is installed into the current virtual environment (if " +"one is active) or into the system site packages (if there is no active " +"virtual environment). The installation location can be controlled through " +"two additional command line options:" msgstr "" -msgid "Installs ``pip`` relative to the given root directory rather than the root of the currently active virtual environment (if any) or the default root for the current Python installation." +#: ../../library/ensurepip.rst:72 +msgid "" +"Installs ``pip`` relative to the given root directory rather than the root " +"of the currently active virtual environment (if any) or the default root for " +"the current Python installation." msgstr "" -msgid "Installs ``pip`` into the user site packages directory rather than globally for the current Python installation (this option is not permitted inside an active virtual environment)." +#: ../../library/ensurepip.rst:78 +msgid "" +"Installs ``pip`` into the user site packages directory rather than globally " +"for the current Python installation (this option is not permitted inside an " +"active virtual environment)." msgstr "" -msgid "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y stands for the version of Python used to invoke ``ensurepip``). The scripts installed can be controlled through two additional command line options:" +#: ../../library/ensurepip.rst:82 +msgid "" +"By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " +"stands for the version of Python used to invoke ``ensurepip``). The scripts " +"installed can be controlled through two additional command line options:" msgstr "" -msgid "If an alternate installation is requested, the ``pipX`` script will *not* be installed." +#: ../../library/ensurepip.rst:89 +msgid "" +"If an alternate installation is requested, the ``pipX`` script will *not* be " +"installed." msgstr "" -msgid "If a \"default pip\" installation is requested, the ``pip`` script will be installed in addition to the two regular scripts." +#: ../../library/ensurepip.rst:94 +msgid "" +"If a \"default pip\" installation is requested, the ``pip`` script will be " +"installed in addition to the two regular scripts." msgstr "" -msgid "Providing both of the script selection options will trigger an exception." +#: ../../library/ensurepip.rst:97 +msgid "" +"Providing both of the script selection options will trigger an exception." msgstr "" +#: ../../library/ensurepip.rst:100 msgid "Module API" msgstr "" +#: ../../library/ensurepip.rst:102 msgid ":mod:`!ensurepip` exposes two functions for programmatic use:" msgstr "" -msgid "Returns a string specifying the available version of pip that will be installed when bootstrapping an environment." +#: ../../library/ensurepip.rst:106 +msgid "" +"Returns a string specifying the available version of pip that will be " +"installed when bootstrapping an environment." msgstr "" +#: ../../library/ensurepip.rst:113 msgid "Bootstraps ``pip`` into the current or designated environment." msgstr "" -msgid "*root* specifies an alternative root directory to install relative to. If *root* is ``None``, then installation uses the default install location for the current environment." +#: ../../library/ensurepip.rst:115 +msgid "" +"*root* specifies an alternative root directory to install relative to. If " +"*root* is ``None``, then installation uses the default install location for " +"the current environment." msgstr "" -msgid "*upgrade* indicates whether or not to upgrade an existing installation of an earlier version of ``pip`` to the available version." +#: ../../library/ensurepip.rst:119 +msgid "" +"*upgrade* indicates whether or not to upgrade an existing installation of an " +"earlier version of ``pip`` to the available version." msgstr "" -msgid "*user* indicates whether to use the user scheme rather than installing globally." +#: ../../library/ensurepip.rst:122 +msgid "" +"*user* indicates whether to use the user scheme rather than installing " +"globally." msgstr "" -msgid "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y stands for the current version of Python)." +#: ../../library/ensurepip.rst:125 +msgid "" +"By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " +"stands for the current version of Python)." msgstr "" +#: ../../library/ensurepip.rst:128 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." msgstr "" -msgid "If *default_pip* is set, then ``pip`` will be installed in addition to the two regular scripts." +#: ../../library/ensurepip.rst:130 +msgid "" +"If *default_pip* is set, then ``pip`` will be installed in addition to the " +"two regular scripts." msgstr "" -msgid "Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." +#: ../../library/ensurepip.rst:133 +msgid "" +"Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." msgstr "" -msgid "*verbosity* controls the level of output to :data:`sys.stdout` from the bootstrapping operation." +#: ../../library/ensurepip.rst:136 +msgid "" +"*verbosity* controls the level of output to :data:`sys.stdout` from the " +"bootstrapping operation." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with argument ``root``." +#: ../../library/ensurepip.rst:139 +msgid "" +"Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with " +"argument ``root``." msgstr "" -msgid "The bootstrapping process has side effects on both ``sys.path`` and ``os.environ``. Invoking the command line interface in a subprocess instead allows these side effects to be avoided." +#: ../../library/ensurepip.rst:143 +msgid "" +"The bootstrapping process has side effects on both ``sys.path`` and " +"``os.environ``. Invoking the command line interface in a subprocess instead " +"allows these side effects to be avoided." msgstr "" -msgid "The bootstrapping process may install additional modules required by ``pip``, but other software should not assume those dependencies will always be present by default (as the dependencies may be removed in a future version of ``pip``)." +#: ../../library/ensurepip.rst:149 +msgid "" +"The bootstrapping process may install additional modules required by " +"``pip``, but other software should not assume those dependencies will always " +"be present by default (as the dependencies may be removed in a future " +"version of ``pip``)." msgstr "" diff --git a/library/enum.po b/library/enum.po index 81922027c..454d30490 100644 --- a/library/enum.po +++ b/library/enum.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,42 +24,61 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/enum.rst:2 msgid ":mod:`!enum` --- Support for enumerations" msgstr "" +#: ../../library/enum.rst:14 msgid "**Source code:** :source:`Lib/enum.py`" msgstr "" -msgid "This page contains the API reference information. For tutorial information and discussion of more advanced topics, see" +#: ../../library/enum.rst:18 +msgid "" +"This page contains the API reference information. For tutorial information " +"and discussion of more advanced topics, see" msgstr "" +#: ../../library/enum.rst:21 msgid ":ref:`Basic Tutorial `" msgstr "" +#: ../../library/enum.rst:22 msgid ":ref:`Advanced Tutorial `" msgstr "" +#: ../../library/enum.rst:23 msgid ":ref:`Enum Cookbook `" msgstr "" +#: ../../library/enum.rst:27 msgid "An enumeration:" msgstr "" +#: ../../library/enum.rst:29 msgid "is a set of symbolic names (members) bound to unique values" msgstr "" -msgid "can be iterated over to return its canonical (i.e. non-alias) members in definition order" +#: ../../library/enum.rst:30 +msgid "" +"can be iterated over to return its canonical (i.e. non-alias) members in " +"definition order" msgstr "" +#: ../../library/enum.rst:32 msgid "uses *call* syntax to return members by value" msgstr "" +#: ../../library/enum.rst:33 msgid "uses *index* syntax to return members by name" msgstr "" -msgid "Enumerations are created either by using :keyword:`class` syntax, or by using function-call syntax::" +#: ../../library/enum.rst:35 +msgid "" +"Enumerations are created either by using :keyword:`class` syntax, or by " +"using function-call syntax::" msgstr "" +#: ../../library/enum.rst:38 msgid "" ">>> from enum import Enum\n" "\n" @@ -73,222 +92,349 @@ msgid "" ">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" -msgid "Even though we can use :keyword:`class` syntax to create Enums, Enums are not normal Python classes. See :ref:`How are Enums different? ` for more details." +#: ../../library/enum.rst:49 +msgid "" +"Even though we can use :keyword:`class` syntax to create Enums, Enums are " +"not normal Python classes. See :ref:`How are Enums different? ` for more details." msgstr "" +#: ../../library/enum.rst:53 msgid "Nomenclature" msgstr "" +#: ../../library/enum.rst:55 msgid "The class :class:`!Color` is an *enumeration* (or *enum*)" msgstr "" -msgid "The attributes :attr:`!Color.RED`, :attr:`!Color.GREEN`, etc., are *enumeration members* (or *members*) and are functionally constants." +#: ../../library/enum.rst:56 +msgid "" +"The attributes :attr:`!Color.RED`, :attr:`!Color.GREEN`, etc., are " +"*enumeration members* (or *members*) and are functionally constants." msgstr "" -msgid "The enum members have *names* and *values* (the name of :attr:`!Color.RED` is ``RED``, the value of :attr:`!Color.BLUE` is ``3``, etc.)" +#: ../../library/enum.rst:58 +msgid "" +"The enum members have *names* and *values* (the name of :attr:`!Color.RED` " +"is ``RED``, the value of :attr:`!Color.BLUE` is ``3``, etc.)" msgstr "" +#: ../../library/enum.rst:65 msgid "Module contents" msgstr "" +#: ../../library/enum.rst:67 msgid ":class:`EnumType`" msgstr "" +#: ../../library/enum.rst:69 msgid "The ``type`` for Enum and its subclasses." msgstr "" +#: ../../library/enum.rst:71 msgid ":class:`Enum`" msgstr "" +#: ../../library/enum.rst:73 msgid "Base class for creating enumerated constants." msgstr "" +#: ../../library/enum.rst:75 msgid ":class:`IntEnum`" msgstr "" -msgid "Base class for creating enumerated constants that are also subclasses of :class:`int`. (`Notes`_)" +#: ../../library/enum.rst:77 +msgid "" +"Base class for creating enumerated constants that are also subclasses " +"of :class:`int`. (`Notes`_)" msgstr "" +#: ../../library/enum.rst:80 msgid ":class:`StrEnum`" msgstr "" -msgid "Base class for creating enumerated constants that are also subclasses of :class:`str`. (`Notes`_)" +#: ../../library/enum.rst:82 +msgid "" +"Base class for creating enumerated constants that are also subclasses " +"of :class:`str`. (`Notes`_)" msgstr "" +#: ../../library/enum.rst:85 msgid ":class:`Flag`" msgstr "" -msgid "Base class for creating enumerated constants that can be combined using the bitwise operations without losing their :class:`Flag` membership." +#: ../../library/enum.rst:87 +msgid "" +"Base class for creating enumerated constants that can be combined using the " +"bitwise operations without losing their :class:`Flag` membership." msgstr "" +#: ../../library/enum.rst:90 msgid ":class:`IntFlag`" msgstr "" -msgid "Base class for creating enumerated constants that can be combined using the bitwise operators without losing their :class:`IntFlag` membership. :class:`IntFlag` members are also subclasses of :class:`int`. (`Notes`_)" +#: ../../library/enum.rst:92 +msgid "" +"Base class for creating enumerated constants that can be combined using the " +"bitwise operators without losing their :class:`IntFlag` " +"membership. :class:`IntFlag` members are also subclasses of :class:`int`. " +"(`Notes`_)" msgstr "" +#: ../../library/enum.rst:96 msgid ":class:`ReprEnum`" msgstr "" -msgid "Used by :class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag` to keep the :class:`str() ` of the mixed-in type." +#: ../../library/enum.rst:98 +msgid "" +"Used by :class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag` to keep " +"the :class:`str() ` of the mixed-in type." msgstr "" +#: ../../library/enum.rst:101 msgid ":class:`EnumCheck`" msgstr "" -msgid "An enumeration with the values ``CONTINUOUS``, ``NAMED_FLAGS``, and ``UNIQUE``, for use with :func:`verify` to ensure various constraints are met by a given enumeration." +#: ../../library/enum.rst:103 +msgid "" +"An enumeration with the values ``CONTINUOUS``, ``NAMED_FLAGS``, and " +"``UNIQUE``, for use with :func:`verify` to ensure various constraints are " +"met by a given enumeration." msgstr "" +#: ../../library/enum.rst:107 msgid ":class:`FlagBoundary`" msgstr "" -msgid "An enumeration with the values ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP`` which allows for more fine-grained control over how invalid values are dealt with in an enumeration." +#: ../../library/enum.rst:109 +msgid "" +"An enumeration with the values ``STRICT``, ``CONFORM``, ``EJECT``, and " +"``KEEP`` which allows for more fine-grained control over how invalid values " +"are dealt with in an enumeration." msgstr "" +#: ../../library/enum.rst:113 msgid ":class:`EnumDict`" msgstr "" +#: ../../library/enum.rst:115 msgid "A subclass of :class:`dict` for use when subclassing :class:`EnumType`." msgstr "" +#: ../../library/enum.rst:117 msgid ":class:`auto`" msgstr "" -msgid "Instances are replaced with an appropriate value for Enum members. :class:`StrEnum` defaults to the lower-cased version of the member name, while other Enums default to 1 and increase from there." +#: ../../library/enum.rst:119 +msgid "" +"Instances are replaced with an appropriate value for Enum " +"members. :class:`StrEnum` defaults to the lower-cased version of the member " +"name, while other Enums default to 1 and increase from there." msgstr "" -msgid ":func:`~enum.property`" +#: ../../library/enum.rst:123 +msgid ":deco:`~enum.property`" msgstr "" -msgid "Allows :class:`Enum` members to have attributes without conflicting with member names. The ``value`` and ``name`` attributes are implemented this way." +#: ../../library/enum.rst:125 +msgid "" +"Allows :class:`Enum` members to have attributes without conflicting with " +"member names. The ``value`` and ``name`` attributes are implemented this " +"way." msgstr "" -msgid ":func:`unique`" +#: ../../library/enum.rst:129 +msgid ":deco:`unique`" msgstr "" -msgid "Enum class decorator that ensures only one name is bound to any one value." +#: ../../library/enum.rst:131 +msgid "" +"Enum class decorator that ensures only one name is bound to any one value." msgstr "" -msgid ":func:`verify`" +#: ../../library/enum.rst:133 +msgid ":deco:`verify`" msgstr "" -msgid "Enum class decorator that checks user-selectable constraints on an enumeration." +#: ../../library/enum.rst:135 +msgid "" +"Enum class decorator that checks user-selectable constraints on an " +"enumeration." msgstr "" -msgid ":func:`member`" +#: ../../library/enum.rst:138 +msgid ":deco:`member`" msgstr "" +#: ../../library/enum.rst:140 msgid "Make ``obj`` a member. Can be used as a decorator." msgstr "" -msgid ":func:`nonmember`" +#: ../../library/enum.rst:142 +msgid ":deco:`nonmember`" msgstr "" +#: ../../library/enum.rst:144 msgid "Do not make ``obj`` a member. Can be used as a decorator." msgstr "" -msgid ":func:`global_enum`" +#: ../../library/enum.rst:146 +msgid ":deco:`global_enum`" msgstr "" -msgid "Modify the :class:`str() ` and :func:`repr` of an enum to show its members as belonging to the module instead of its class, and export the enum members to the global namespace." +#: ../../library/enum.rst:148 +msgid "" +"Modify the :class:`str() ` and :func:`repr` of an enum to show its " +"members as belonging to the module instead of its class, and export the enum " +"members to the global namespace." msgstr "" +#: ../../library/enum.rst:152 msgid ":func:`show_flag_values`" msgstr "" +#: ../../library/enum.rst:154 msgid "Return a list of all power-of-two integers contained in a flag." msgstr "" +#: ../../library/enum.rst:156 msgid ":func:`enum.bin`" msgstr "" -msgid "Like built-in :func:`bin`, except negative values are represented in two's complement, and the leading bit always indicates sign (``0`` implies positive, ``1`` implies negative)." +#: ../../library/enum.rst:158 ../../library/enum.rst:1081 +msgid "" +"Like built-in :func:`bin`, except negative values are represented in two's " +"complement, and the leading bit always indicates sign (``0`` implies " +"positive, ``1`` implies negative)." msgstr "" +#: ../../library/enum.rst:163 msgid "``Flag``, ``IntFlag``, ``auto``" msgstr "" -msgid "``StrEnum``, ``EnumCheck``, ``ReprEnum``, ``FlagBoundary``, ``property``, ``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" +#: ../../library/enum.rst:164 +msgid "" +"``StrEnum``, ``EnumCheck``, ``ReprEnum``, ``FlagBoundary``, ``property``, " +"``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" msgstr "" +#: ../../library/enum.rst:165 msgid "``EnumDict``" msgstr "" +#: ../../library/enum.rst:170 msgid "Data types" msgstr "" -msgid "*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible to subclass *EnumType* -- see :ref:`Subclassing EnumType ` for details." +#: ../../library/enum.rst:175 +msgid "" +"*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible " +"to subclass *EnumType* -- see :ref:`Subclassing EnumType ` for details." msgstr "" -msgid "``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the final *enum*, as well as creating the enum members, properly handling duplicates, providing iteration over the enum class, etc." +#: ../../library/enum.rst:179 +msgid "" +"``EnumType`` is responsible for setting the correct :meth:`!" +"__repr__`, :meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` " +"methods on the final *enum*, as well as creating the enum members, properly " +"handling duplicates, providing iteration over the enum class, etc." msgstr "" -msgid "Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available as an alias." +#: ../../library/enum.rst:186 +msgid "" +"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " +"as an alias." msgstr "" +#: ../../library/enum.rst:190 msgid "This method is called in two different ways:" msgstr "" +#: ../../library/enum.rst:192 msgid "to look up an existing member:" msgstr "" +#: ../../library/enum.rst:0 msgid "cls" msgstr "" +#: ../../library/enum.rst:194 ../../library/enum.rst:200 msgid "The enum class being called." msgstr "" +#: ../../library/enum.rst:0 msgid "value" msgstr "" +#: ../../library/enum.rst:195 msgid "The value to lookup." msgstr "" -msgid "to use the ``cls`` enum to create a new enum (only if the existing enum does not have any members):" +#: ../../library/enum.rst:197 +msgid "" +"to use the ``cls`` enum to create a new enum (only if the existing enum does " +"not have any members):" msgstr "" +#: ../../library/enum.rst:201 msgid "The name of the new Enum to create." msgstr "" +#: ../../library/enum.rst:0 msgid "names" msgstr "" +#: ../../library/enum.rst:202 msgid "The names/values of the members for the new Enum." msgstr "" +#: ../../library/enum.rst:0 msgid "module" msgstr "" +#: ../../library/enum.rst:203 msgid "The name of the module the new Enum is created in." msgstr "" +#: ../../library/enum.rst:0 msgid "qualname" msgstr "" +#: ../../library/enum.rst:204 msgid "The actual location in the module where this Enum can be found." msgstr "" +#: ../../library/enum.rst:0 msgid "type" msgstr "" +#: ../../library/enum.rst:205 msgid "A mix-in type for the new Enum." msgstr "" +#: ../../library/enum.rst:0 msgid "start" msgstr "" +#: ../../library/enum.rst:206 msgid "The first integer value for the Enum (used by :class:`auto`)." msgstr "" +#: ../../library/enum.rst:0 msgid "boundary" msgstr "" -msgid "How to handle out-of-range values from bit operations (:class:`Flag` only)." +#: ../../library/enum.rst:207 +msgid "" +"How to handle out-of-range values from bit operations (:class:`Flag` only)." msgstr "" +#: ../../library/enum.rst:211 msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "" +#: ../../library/enum.rst:213 msgid "" ">>> some_var = Color.RED\n" ">>> some_var in Color\n" @@ -297,92 +443,137 @@ msgid "" "True" msgstr "" -msgid "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used in a containment check." +#: ../../library/enum.rst:221 +msgid "" +"Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " +"in a containment check." msgstr "" -msgid "Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the names of the members in *cls*::" +#: ../../library/enum.rst:226 +msgid "" +"Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " +"names of the members in *cls*::" msgstr "" +#: ../../library/enum.rst:229 msgid "" ">>> dir(Color)\n" -"['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', '__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', '__module__', '__name__', '__qualname__']" +"['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " +"'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " +"'__module__', '__name__', '__qualname__']" msgstr "" -msgid "Returns the Enum member in *cls* matching *name*, or raises a :exc:`KeyError`::" +#: ../../library/enum.rst:234 +msgid "" +"Returns the Enum member in *cls* matching *name*, or raises " +"a :exc:`KeyError`::" msgstr "" +#: ../../library/enum.rst:236 msgid "" ">>> Color['BLUE']\n" "" msgstr "" +#: ../../library/enum.rst:241 msgid "Returns each member in *cls* in definition order::" msgstr "" +#: ../../library/enum.rst:243 msgid "" ">>> list(Color)\n" "[, , ]" msgstr "" +#: ../../library/enum.rst:248 msgid "Returns the number of members in *cls*::" msgstr "" +#: ../../library/enum.rst:250 msgid "" ">>> len(Color)\n" "3" msgstr "" +#: ../../library/enum.rst:255 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "" +#: ../../library/enum.rst:259 msgid "Returns each member in *cls* in reverse definition order::" msgstr "" +#: ../../library/enum.rst:261 msgid "" ">>> list(reversed(Color))\n" "[, , ]" msgstr "" +#: ../../library/enum.rst:267 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "" +#: ../../library/enum.rst:271 msgid "The name used to define the ``Enum`` member::" msgstr "" +#: ../../library/enum.rst:273 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" msgstr "" +#: ../../library/enum.rst:278 msgid "The value given to the ``Enum`` member::" msgstr "" +#: ../../library/enum.rst:280 msgid "" ">>> Color.RED.value\n" "1" msgstr "" +#: ../../library/enum.rst:283 ../../library/enum.rst:303 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "" +#: ../../library/enum.rst:285 msgid "Enum member values" msgstr "" -msgid "Member values can be anything: :class:`int`, :class:`str`, etc. If the exact value is unimportant you may use :class:`auto` instances and an appropriate value will be chosen for you. See :class:`auto` for the details." +#: ../../library/enum.rst:287 +msgid "" +"Member values can be anything: :class:`int`, :class:`str`, etc. If the " +"exact value is unimportant you may use :class:`auto` instances and an " +"appropriate value will be chosen for you. See :class:`auto` for the details." msgstr "" -msgid "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a mutable :class:`~dataclasses.dataclass`, can be used, they will have a quadratic performance impact during creation relative to the total number of mutable/unhashable values in the enum." +#: ../../library/enum.rst:292 +msgid "" +"While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " +"mutable :class:`~dataclasses.dataclass`, can be used, they will have a " +"quadratic performance impact during creation relative to the total number of " +"mutable/unhashable values in the enum." msgstr "" +#: ../../library/enum.rst:299 msgid "Name of the member." msgstr "" -msgid "No longer used, kept for backward compatibility. (class attribute, removed during class creation)." +#: ../../library/enum.rst:307 +msgid "" +"No longer used, kept for backward compatibility. (class attribute, removed " +"during class creation)." msgstr "" -msgid "The :attr:`~Enum._order_` attribute can be provided to help keep Python 2 / Python 3 code in sync. It will be checked against the actual order of the enumeration and raise an error if the two do not match::" +#: ../../library/enum.rst:310 +msgid "" +"The :attr:`~Enum._order_` attribute can be provided to help keep Python 2 / " +"Python 3 code in sync. It will be checked against the actual order of the " +"enumeration and raise an error if the two do not match::" msgstr "" +#: ../../library/enum.rst:313 msgid "" ">>> class Color(Enum):\n" "... _order_ = 'RED GREEN BLUE'\n" @@ -397,18 +588,32 @@ msgid "" " ['RED', 'GREEN', 'BLUE']" msgstr "" -msgid "In Python 2 code the :attr:`~Enum._order_` attribute is necessary as definition order is lost before it can be recorded." +#: ../../library/enum.rst:327 +msgid "" +"In Python 2 code the :attr:`~Enum._order_` attribute is necessary as " +"definition order is lost before it can be recorded." msgstr "" -msgid "``_ignore_`` is only used during creation and is removed from the enumeration once creation is complete." +#: ../../library/enum.rst:334 +msgid "" +"``_ignore_`` is only used during creation and is removed from the " +"enumeration once creation is complete." msgstr "" -msgid "``_ignore_`` is a list of names that will not become members, and whose names will also be removed from the completed enumeration. See :ref:`TimePeriod ` for an example." +#: ../../library/enum.rst:337 +msgid "" +"``_ignore_`` is a list of names that will not become members, and whose " +"names will also be removed from the completed enumeration. " +"See :ref:`TimePeriod ` for an example." msgstr "" -msgid "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any public methods defined on *self.__class__*::" +#: ../../library/enum.rst:345 +msgid "" +"Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " +"public methods defined on *self.__class__*::" msgstr "" +#: ../../library/enum.rst:348 msgid "" ">>> from enum import Enum\n" ">>> import datetime as dt\n" @@ -425,42 +630,61 @@ msgid "" "... print(f'today is {cls(dt.date.today().isoweekday()).name}')\n" "...\n" ">>> dir(Weekday.SATURDAY)\n" -"['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', 'today', 'value']" +"['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', " +"'today', 'value']" msgstr "" +#: ../../library/enum.rst:0 msgid "name" msgstr "" +#: ../../library/enum.rst:367 msgid "The name of the member being defined (e.g. 'RED')." msgstr "" +#: ../../library/enum.rst:368 msgid "The start value for the Enum; the default is 1." msgstr "" +#: ../../library/enum.rst:0 msgid "count" msgstr "" +#: ../../library/enum.rst:369 msgid "The number of members currently defined, not including this one." msgstr "" +#: ../../library/enum.rst:0 msgid "last_values" msgstr "" +#: ../../library/enum.rst:370 msgid "A list of the previous values." msgstr "" -msgid "A *staticmethod* that is used to determine the next value returned by :class:`auto`." +#: ../../library/enum.rst:372 +msgid "" +"A *staticmethod* that is used to determine the next value returned " +"by :class:`auto`." msgstr "" -msgid "For standard :class:`Enum` classes the next value chosen is the highest value seen incremented by one." +#: ../../library/enum.rst:376 +msgid "" +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" -msgid "For :class:`Flag` classes the next value chosen will be the next highest power-of-two." +#: ../../library/enum.rst:379 +msgid "" +"For :class:`Flag` classes the next value chosen will be the next highest " +"power-of-two." msgstr "" +#: ../../library/enum.rst:382 msgid "This method may be overridden, e.g.::" msgstr "" +#: ../../library/enum.rst:384 msgid "" ">>> from enum import auto, Enum\n" ">>> class PowersOfThree(Enum):\n" @@ -474,21 +698,36 @@ msgid "" "9" msgstr "" -msgid "Prior versions would use the last seen value instead of the highest value." +#: ../../library/enum.rst:396 +msgid "" +"Prior versions would use the last seen value instead of the highest value." msgstr "" -msgid "By default, does nothing. If multiple values are given in the member assignment, those values become separate arguments to ``__init__``; e.g." +#: ../../library/enum.rst:401 +msgid "" +"By default, does nothing. If multiple values are given in the member " +"assignment, those values become separate arguments to ``__init__``; e.g." msgstr "" -msgid "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, 'Mon')``" +#: ../../library/enum.rst:408 +msgid "" +"``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " +"'Mon')``" msgstr "" -msgid "A *classmethod* that is used to further configure subsequent subclasses. By default, does nothing." +#: ../../library/enum.rst:412 +msgid "" +"A *classmethod* that is used to further configure subsequent subclasses. By " +"default, does nothing." msgstr "" -msgid "A *classmethod* for looking up values not found in *cls*. By default it does nothing, but can be overridden to implement custom search behavior::" +#: ../../library/enum.rst:417 +msgid "" +"A *classmethod* for looking up values not found in *cls*. By default it " +"does nothing, but can be overridden to implement custom search behavior::" msgstr "" +#: ../../library/enum.rst:420 msgid "" ">>> from enum import auto, StrEnum\n" ">>> class Build(StrEnum):\n" @@ -508,18 +747,31 @@ msgid "" "" msgstr "" -msgid "By default, doesn't exist. If specified, either in the enum class definition or in a mixin class (such as ``int``), all values given in the member assignment will be passed; e.g." +#: ../../library/enum.rst:441 +msgid "" +"By default, doesn't exist. If specified, either in the enum class " +"definition or in a mixin class (such as ``int``), all values given in the " +"member assignment will be passed; e.g." msgstr "" -msgid "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." +#: ../../library/enum.rst:449 +msgid "" +"results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "" -msgid "When writing a custom ``__new__``, do not use ``super().__new__`` -- call the appropriate ``__new__`` instead." +#: ../../library/enum.rst:453 +msgid "" +"When writing a custom ``__new__``, do not use ``super().__new__`` -- call " +"the appropriate ``__new__`` instead." msgstr "" -msgid "Returns the string used for *repr()* calls. By default, returns the *Enum* name, member name, and value, but can be overridden::" +#: ../../library/enum.rst:458 +msgid "" +"Returns the string used for *repr()* calls. By default, returns the *Enum* " +"name, member name, and value, but can be overridden::" msgstr "" +#: ../../library/enum.rst:461 msgid "" ">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" @@ -530,13 +782,18 @@ msgid "" "... cls_name = self.__class__.__name__\n" "... return f'{cls_name}.{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" msgstr "" -msgid "Returns the string used for *str()* calls. By default, returns the *Enum* name and member name, but can be overridden::" +#: ../../library/enum.rst:475 +msgid "" +"Returns the string used for *str()* calls. By default, returns the *Enum* " +"name and member name, but can be overridden::" msgstr "" +#: ../../library/enum.rst:478 msgid "" ">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" @@ -546,13 +803,18 @@ msgid "" "... def __str__(self):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" msgstr "" -msgid "Returns the string used for *format()* and *f-string* calls. By default, returns :meth:`__str__` return value, but can be overridden::" +#: ../../library/enum.rst:491 +msgid "" +"Returns the string used for *format()* and *f-string* calls. By default, " +"returns :meth:`__str__` return value, but can be overridden::" msgstr "" +#: ../../library/enum.rst:494 msgid "" ">>> from enum import auto, Enum\n" ">>> class OtherStyle(Enum):\n" @@ -562,70 +824,121 @@ msgid "" "... def __format__(self, spec):\n" "... return f'{self.name}'\n" "...\n" -">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle.ALTERNATE}\"\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), " +"f\"{OtherStyle.ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" msgstr "" -msgid "Using :class:`auto` with :class:`Enum` results in integers of increasing value, starting with ``1``." +#: ../../library/enum.rst:507 +msgid "" +"Using :class:`auto` with :class:`Enum` results in integers of increasing " +"value, starting with ``1``." msgstr "" +#: ../../library/enum.rst:510 msgid "Added :ref:`enum-dataclass-support`" msgstr "" +#: ../../library/enum.rst:514 msgid "Adds a new name as an alias to an existing member::" msgstr "" +#: ../../library/enum.rst:516 msgid "" ">>> Color.RED._add_alias_(\"ERROR\")\n" ">>> Color.ERROR\n" "" msgstr "" -msgid "Raises a :exc:`NameError` if the name is already assigned to a different member." +#: ../../library/enum.rst:520 +msgid "" +"Raises a :exc:`NameError` if the name is already assigned to a different " +"member." msgstr "" +#: ../../library/enum.rst:526 msgid "Adds a new value as an alias to an existing member::" msgstr "" +#: ../../library/enum.rst:528 msgid "" ">>> Color.RED._add_value_alias_(42)\n" ">>> Color(42)\n" "" msgstr "" -msgid "Raises a :exc:`ValueError` if the value is already linked with a different member." +#: ../../library/enum.rst:532 +msgid "" +"Raises a :exc:`ValueError` if the value is already linked with a different " +"member." msgstr "" +#: ../../library/enum.rst:533 msgid "See :ref:`multi-value-enum` for an example." msgstr "" -msgid "*IntEnum* is the same as :class:`Enum`, but its members are also integers and can be used anywhere that an integer can be used. If any integer operation is performed with an *IntEnum* member, the resulting value loses its enumeration status." +#: ../../library/enum.rst:540 +msgid "" +"*IntEnum* is the same as :class:`Enum`, but its members are also integers " +"and can be used anywhere that an integer can be used. If any integer " +"operation is performed with an *IntEnum* member, the resulting value loses " +"its enumeration status." msgstr "" -msgid "Using :class:`auto` with :class:`IntEnum` results in integers of increasing value, starting with ``1``." +#: ../../library/enum.rst:561 +msgid "" +"Using :class:`auto` with :class:`IntEnum` results in integers of increasing " +"value, starting with ``1``." msgstr "" -msgid ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the *replacement of existing constants* use-case. :meth:`~object.__format__` was already :meth:`!int.__format__` for that same reason." +#: ../../library/enum.rst:564 +msgid "" +":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " +"*replacement of existing constants* use-case. :meth:`~object.__format__` was " +"already :meth:`!int.__format__` for that same reason." msgstr "" -msgid "*StrEnum* is the same as :class:`Enum`, but its members are also strings and can be used in most of the same places that a string can be used. The result of any string operation performed on or with a *StrEnum* member is not part of the enumeration." +#: ../../library/enum.rst:571 +msgid "" +"*StrEnum* is the same as :class:`Enum`, but its members are also strings and " +"can be used in most of the same places that a string can be used. The result " +"of any string operation performed on or with a *StrEnum* member is not part " +"of the enumeration." msgstr "" -msgid "There are places in the stdlib that check for an exact :class:`str` instead of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of ``isinstance(unknown, str)``), and in those locations you will need to use ``str(MyStrEnum.MY_MEMBER)``." +#: ../../library/enum.rst:592 +msgid "" +"There are places in the stdlib that check for an exact :class:`str` instead " +"of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " +"``isinstance(unknown, str)``), and in those locations you will need to use " +"``str(MyStrEnum.MY_MEMBER)``." msgstr "" -msgid "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member name as the value." +#: ../../library/enum.rst:599 +msgid "" +"Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " +"name as the value." msgstr "" -msgid ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the *replacement of existing constants* use-case. :meth:`~object.__format__` is likewise :meth:`!str.__format__` for that same reason." +#: ../../library/enum.rst:604 +msgid "" +":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " +"*replacement of existing constants* use-case. :meth:`~object.__format__` is " +"likewise :meth:`!str.__format__` for that same reason." msgstr "" -msgid "``Flag`` is the same as :class:`Enum`, but its members support the bitwise operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); the results of those operations are (aliases of) members of the enumeration." +#: ../../library/enum.rst:612 +msgid "" +"``Flag`` is the same as :class:`Enum`, but its members support the bitwise " +"operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " +"the results of those operations are (aliases of) members of the enumeration." msgstr "" +#: ../../library/enum.rst:618 msgid "Returns *True* if value is in self::" msgstr "" +#: ../../library/enum.rst:620 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -645,9 +958,11 @@ msgid "" "False" msgstr "" +#: ../../library/enum.rst:639 msgid "Returns all contained non-alias members::" msgstr "" +#: ../../library/enum.rst:641 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -655,9 +970,11 @@ msgid "" "[, ]" msgstr "" +#: ../../library/enum.rst:650 msgid "Returns number of members in flag::" msgstr "" +#: ../../library/enum.rst:652 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -665,9 +982,11 @@ msgid "" "3" msgstr "" +#: ../../library/enum.rst:661 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "" +#: ../../library/enum.rst:663 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -678,17 +997,21 @@ msgid "" "False" msgstr "" +#: ../../library/enum.rst:673 msgid "Returns current flag binary or'ed with other::" msgstr "" +#: ../../library/enum.rst:675 msgid "" ">>> Color.RED | Color.GREEN\n" "" msgstr "" +#: ../../library/enum.rst:680 msgid "Returns current flag binary and'ed with other::" msgstr "" +#: ../../library/enum.rst:682 msgid "" ">>> purple & white\n" "\n" @@ -696,9 +1019,11 @@ msgid "" "" msgstr "" +#: ../../library/enum.rst:689 msgid "Returns current flag binary xor'ed with other::" msgstr "" +#: ../../library/enum.rst:691 msgid "" ">>> purple ^ white\n" "\n" @@ -706,9 +1031,11 @@ msgid "" "" msgstr "" +#: ../../library/enum.rst:698 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "" +#: ../../library/enum.rst:700 msgid "" ">>> ~white\n" "\n" @@ -718,70 +1045,116 @@ msgid "" "" msgstr "" -msgid "Function used to format any remaining unnamed numeric values. Default is the value's repr; common choices are :func:`hex` and :func:`oct`." +#: ../../library/enum.rst:709 +msgid "" +"Function used to format any remaining unnamed numeric values. Default is " +"the value's repr; common choices are :func:`hex` and :func:`oct`." msgstr "" -msgid "Using :class:`auto` with :class:`Flag` results in integers that are powers of two, starting with ``1``." +#: ../../library/enum.rst:714 +msgid "" +"Using :class:`auto` with :class:`Flag` results in integers that are powers " +"of two, starting with ``1``." msgstr "" +#: ../../library/enum.rst:717 msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "" -msgid "``IntFlag`` is the same as :class:`Flag`, but its members are also integers and can be used anywhere that an integer can be used." +#: ../../library/enum.rst:725 +msgid "" +"``IntFlag`` is the same as :class:`Flag`, but its members are also integers " +"and can be used anywhere that an integer can be used." msgstr "" -msgid "If any integer operation is performed with an *IntFlag* member, the result is not an *IntFlag*::" +#: ../../library/enum.rst:739 +msgid "" +"If any integer operation is performed with an *IntFlag* member, the result " +"is not an *IntFlag*::" msgstr "" +#: ../../library/enum.rst:742 msgid "" ">>> Color.RED + 2\n" "3" msgstr "" +#: ../../library/enum.rst:745 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "" +#: ../../library/enum.rst:747 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "" -msgid "the result is not a valid *IntFlag*: the result depends on the :class:`FlagBoundary` setting" +#: ../../library/enum.rst:748 +msgid "" +"the result is not a valid *IntFlag*: the result depends on " +"the :class:`FlagBoundary` setting" msgstr "" +#: ../../library/enum.rst:750 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" msgstr "" +#: ../../library/enum.rst:752 msgid "" ">>> Color(0)\n" "" msgstr "" -msgid "Using :class:`auto` with :class:`IntFlag` results in integers that are powers of two, starting with ``1``." +#: ../../library/enum.rst:757 +msgid "" +"Using :class:`auto` with :class:`IntFlag` results in integers that are " +"powers of two, starting with ``1``." msgstr "" -msgid ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the *replacement of existing constants* use-case. :meth:`~object.__format__` was already :meth:`!int.__format__` for that same reason." +#: ../../library/enum.rst:762 +msgid "" +":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " +"*replacement of existing constants* use-case. :meth:`~object.__format__` " +"was already :meth:`!int.__format__` for that same reason." msgstr "" -msgid "Inversion of an :class:`!IntFlag` now returns a positive value that is the union of all flags not in the given flag, rather than a negative value. This matches the existing :class:`Flag` behavior." +#: ../../library/enum.rst:766 +msgid "" +"Inversion of an :class:`!IntFlag` now returns a positive value that is the " +"union of all flags not in the given flag, rather than a negative value. This " +"matches the existing :class:`Flag` behavior." msgstr "" -msgid ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, but the :class:`str() ` of the mixed-in data type:" +#: ../../library/enum.rst:772 +msgid "" +":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " +"but the :class:`str() ` of the mixed-in data type:" msgstr "" +#: ../../library/enum.rst:775 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "" +#: ../../library/enum.rst:776 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "" -msgid "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:`format` of the mixed-in data type instead of using the :class:`Enum`-default :meth:`str() `." +#: ../../library/enum.rst:778 +msgid "" +"Inherit from :class:`!ReprEnum` to keep the :class:`str() " +"` / :func:`format` of the mixed-in data type instead of using " +"the :class:`Enum`-default :meth:`str() `." msgstr "" -msgid "*EnumCheck* contains the options used by the :func:`verify` decorator to ensure various constraints; failed constraints result in a :exc:`ValueError`." +#: ../../library/enum.rst:787 +msgid "" +"*EnumCheck* contains the options used by the :func:`verify` decorator to " +"ensure various constraints; failed constraints result in a :exc:`ValueError`." msgstr "" +#: ../../library/enum.rst:792 msgid "Ensure that each value has only one name::" msgstr "" +#: ../../library/enum.rst:794 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -795,9 +1168,13 @@ msgid "" "ValueError: aliases found in : CRIMSON -> RED" msgstr "" -msgid "Ensure that there are no missing values between the lowest-valued member and the highest-valued member::" +#: ../../library/enum.rst:808 +msgid "" +"Ensure that there are no missing values between the lowest-valued member and " +"the highest-valued member::" msgstr "" +#: ../../library/enum.rst:811 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -810,9 +1187,13 @@ msgid "" "ValueError: invalid enum 'Color': missing values 3, 4" msgstr "" -msgid "Ensure that any flag groups/masks contain only named flags -- useful when values are specified instead of being generated by :func:`auto`::" +#: ../../library/enum.rst:823 +msgid "" +"Ensure that any flag groups/masks contain only named flags -- useful when " +"values are specified instead of being generated by :func:`auto`::" msgstr "" +#: ../../library/enum.rst:826 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -824,18 +1205,28 @@ msgid "" "... NEON = 31\n" "Traceback (most recent call last):\n" "...\n" -"ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing combined values of 0x18 [use enum.show_flag_values(value) for details]" +"ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " +"combined values of 0x18 [use enum.show_flag_values(value) for details]" msgstr "" -msgid "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." +#: ../../library/enum.rst:840 +msgid "" +"CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "" -msgid "``FlagBoundary`` controls how out-of-range values are handled in :class:`Flag` and its subclasses." +#: ../../library/enum.rst:846 +msgid "" +"``FlagBoundary`` controls how out-of-range values are handled " +"in :class:`Flag` and its subclasses." msgstr "" -msgid "Out-of-range values cause a :exc:`ValueError` to be raised. This is the default for :class:`Flag`::" +#: ../../library/enum.rst:851 +msgid "" +"Out-of-range values cause a :exc:`ValueError` to be raised. This is the " +"default for :class:`Flag`::" msgstr "" +#: ../../library/enum.rst:854 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -851,9 +1242,13 @@ msgid "" " allowed 0b0 00111" msgstr "" -msgid "Out-of-range values have invalid values removed, leaving a valid :class:`Flag` value::" +#: ../../library/enum.rst:869 +msgid "" +"Out-of-range values have invalid values removed, leaving a " +"valid :class:`Flag` value::" msgstr "" +#: ../../library/enum.rst:872 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -865,12 +1260,19 @@ msgid "" "" msgstr "" -msgid "Out-of-range values lose their :class:`Flag` membership and revert to :class:`int`." +#: ../../library/enum.rst:883 +msgid "" +"Out-of-range values lose their :class:`Flag` membership and revert " +"to :class:`int`." msgstr "" -msgid "Out-of-range values are kept, and the :class:`Flag` membership is kept. This is the default for :class:`IntFlag`::" +#: ../../library/enum.rst:896 +msgid "" +"Out-of-range values are kept, and the :class:`Flag` membership is kept. This " +"is the default for :class:`IntFlag`::" msgstr "" +#: ../../library/enum.rst:899 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -882,102 +1284,198 @@ msgid "" "" msgstr "" -msgid "*EnumDict* is a subclass of :class:`dict` that is used as the namespace for defining enum classes (see :ref:`prepare`). It is exposed to allow subclasses of :class:`EnumType` with advanced behavior like having multiple values per member. It should be called with the name of the enum class being created, otherwise private names and internal classes will not be handled correctly." +#: ../../library/enum.rst:912 +msgid "" +"*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " +"defining enum classes (see :ref:`prepare`). It is exposed to allow " +"subclasses of :class:`EnumType` with advanced behavior like having multiple " +"values per member. It should be called with the name of the enum class being " +"created, otherwise private names and internal classes will not be handled " +"correctly." msgstr "" -msgid "Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be possible to bypass the checks using other :class:`!dict` operations like :meth:`|= `." +#: ../../library/enum.rst:919 +msgid "" +"Note that only the :class:`~collections.abc.MutableMapping` interface " +"(:meth:`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may " +"be possible to bypass the checks using other :class:`!dict` operations " +"like :meth:`|= `." msgstr "" +#: ../../library/enum.rst:926 msgid "A list of member names." msgstr "" +#: ../../library/enum.rst:935 msgid "Supported ``__dunder__`` names" msgstr "" -msgid ":attr:`~EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member`` items. It is only available on the class." +#: ../../library/enum.rst:937 +msgid "" +":attr:`~EnumType.__members__` is a read-only ordered mapping of " +"``member_name``:``member`` items. It is only available on the class." msgstr "" -msgid ":meth:`~Enum.__new__`, if specified, must create and return the enum members; it is also a very good idea to set the member's :attr:`~Enum._value_` appropriately. Once all the members are created it is no longer used." +#: ../../library/enum.rst:940 +msgid "" +":meth:`~Enum.__new__`, if specified, must create and return the enum " +"members; it is also a very good idea to set the " +"member's :attr:`~Enum._value_` appropriately. Once all the members are " +"created it is no longer used." msgstr "" +#: ../../library/enum.rst:946 msgid "Supported ``_sunder_`` names" msgstr "" +#: ../../library/enum.rst:948 msgid ":attr:`~Enum._name_` -- name of the member" msgstr "" +#: ../../library/enum.rst:949 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr "" -msgid ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; may be overridden" +#: ../../library/enum.rst:950 +msgid "" +":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " +"may be overridden" msgstr "" -msgid ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :class:`str`, that will not be transformed into members, and will be removed from the final class" +#: ../../library/enum.rst:952 +msgid "" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" -msgid ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility (class attribute, removed during class creation)" +#: ../../library/enum.rst:955 +msgid "" +":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " +"(class attribute, removed during class creation)" msgstr "" -msgid ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for an enum member; may be overridden" +#: ../../library/enum.rst:958 +msgid "" +":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " +"an enum member; may be overridden" msgstr "" -msgid ":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing member." +#: ../../library/enum.rst:961 +msgid "" +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +"member." msgstr "" -msgid ":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an existing member." +#: ../../library/enum.rst:963 +msgid "" +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +"existing member." msgstr "" -msgid "While ``_sunder_`` names are generally reserved for the further development of the :class:`Enum` class and can not be used, some are explicitly allowed:" +#: ../../library/enum.rst:966 +msgid "" +"While ``_sunder_`` names are generally reserved for the further development " +"of the :class:`Enum` class and can not be used, some are explicitly allowed:" msgstr "" -msgid "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" +#: ../../library/enum.rst:969 +msgid "" +"``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" +#: ../../library/enum.rst:971 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "" +#: ../../library/enum.rst:972 msgid "``_ignore_``" msgstr "" +#: ../../library/enum.rst:973 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" msgstr "" +#: ../../library/enum.rst:979 msgid "Utilities and decorators" msgstr "" -msgid "*auto* can be used in place of a value. If used, the *Enum* machinery will call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate value will be the last value plus one; for :class:`Flag` and :class:`IntFlag` it will be the first power-of-two greater than the highest value; for :class:`StrEnum` it will be the lower-cased version of the member's name. Care must be taken if mixing *auto()* with manually specified values." +#: ../../library/enum.rst:983 +msgid "" +"*auto* can be used in place of a value. If used, the *Enum* machinery will " +"call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " +"appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " +"value will be the last value plus one; for :class:`Flag` " +"and :class:`IntFlag` it will be the first power-of-two greater than the " +"highest value; for :class:`StrEnum` it will be the lower-cased version of " +"the member's name. Care must be taken if mixing *auto()* with manually " +"specified values." msgstr "" -msgid "*auto* instances are only resolved when at the top level of an assignment, either by itself or as part of a tuple:" +#: ../../library/enum.rst:991 +msgid "" +"*auto* instances are only resolved when at the top level of an assignment, " +"either by itself or as part of a tuple:" msgstr "" +#: ../../library/enum.rst:994 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "" -msgid "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` is used to create the ``SECOND`` enum member;" +#: ../../library/enum.rst:995 +msgid "" +"``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " +"is used to create the ``SECOND`` enum member;" msgstr "" -msgid "``THREE = [auto(), -3]`` will *not* work (``[, -3]`` is used to create the ``THREE`` enum member)" +#: ../../library/enum.rst:997 +msgid "" +"``THREE = [auto(), -3]`` will *not* work (``[, -3]`` is used " +"to create the ``THREE`` enum member)" msgstr "" -msgid "In prior versions, ``auto()`` had to be the only thing on the assignment line to work properly." +#: ../../library/enum.rst:1002 +msgid "" +"In prior versions, ``auto()`` had to be the only thing on the assignment " +"line to work properly." msgstr "" -msgid "``_generate_next_value_`` can be overridden to customize the values used by *auto*." +#: ../../library/enum.rst:1005 +msgid "" +"``_generate_next_value_`` can be overridden to customize the values used by " +"*auto*." msgstr "" -msgid "in 3.13 the default ``_generate_next_value_`` will always return the highest member value incremented by 1, and will fail if any member is an incompatible type." +#: ../../library/enum.rst:1008 +msgid "" +"in 3.13 the default ``_generate_next_value_`` will always return the highest " +"member value incremented by 1, and will fail if any member is an " +"incompatible type." msgstr "" -msgid "A decorator similar to the built-in *property*, but specifically for enumerations. It allows member attributes to have the same names as members themselves." +#: ../../library/enum.rst:1014 +msgid "" +"A decorator similar to the built-in :deco:`property`, but specifically for " +"enumerations. It allows member attributes to have the same names as members " +"themselves." msgstr "" -msgid "the *property* and the member must be defined in separate classes; for example, the *value* and *name* attributes are defined in the *Enum* class, and *Enum* subclasses can define members with the names ``value`` and ``name``." +#: ../../library/enum.rst:1018 +msgid "" +"the *property* and the member must be defined in separate classes; for " +"example, the *value* and *name* attributes are defined in the *Enum* class, " +"and *Enum* subclasses can define members with the names ``value`` and " +"``name``." msgstr "" -msgid "A :keyword:`class` decorator specifically for enumerations. It searches an enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; if any are found :exc:`ValueError` is raised with the details::" +#: ../../library/enum.rst:1027 +msgid "" +"A :keyword:`class` decorator specifically for enumerations. It searches an " +"enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " +"if any are found :exc:`ValueError` is raised with the details::" msgstr "" +#: ../../library/enum.rst:1031 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -992,48 +1490,75 @@ msgid "" "ValueError: duplicate values found in : FOUR -> THREE" msgstr "" -msgid "A :keyword:`class` decorator specifically for enumerations. Members from :class:`EnumCheck` are used to specify which constraints should be checked on the decorated enumeration." +#: ../../library/enum.rst:1045 +msgid "" +"A :keyword:`class` decorator specifically for enumerations. Members " +"from :class:`EnumCheck` are used to specify which constraints should be " +"checked on the decorated enumeration." msgstr "" +#: ../../library/enum.rst:1053 msgid "A decorator for use in enums: its target will become a member." msgstr "" +#: ../../library/enum.rst:1059 msgid "A decorator for use in enums: its target will not become a member." msgstr "" -msgid "A decorator to change the :class:`str() ` and :func:`repr` of an enum to show its members as belonging to the module instead of its class. Should only be used when the enum members are exported to the module global namespace (see :class:`re.RegexFlag` for an example)." +#: ../../library/enum.rst:1065 +msgid "" +"A decorator to change the :class:`str() ` and :func:`repr` of an enum " +"to show its members as belonging to the module instead of its class. Should " +"only be used when the enum members are exported to the module global " +"namespace (see :class:`re.RegexFlag` for an example)." msgstr "" +#: ../../library/enum.rst:1075 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "" +#: ../../library/enum.rst:1096 msgid "Notes" msgstr "" +#: ../../library/enum.rst:1098 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr "" -msgid "These three enum types are designed to be drop-in replacements for existing integer- and string-based values; as such, they have extra limitations:" +#: ../../library/enum.rst:1100 +msgid "" +"These three enum types are designed to be drop-in replacements for existing " +"integer- and string-based values; as such, they have extra limitations:" msgstr "" +#: ../../library/enum.rst:1103 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "" -msgid "``__format__``, because it uses ``__str__``, will also use the value of the enum member instead of its name" +#: ../../library/enum.rst:1105 +msgid "" +"``__format__``, because it uses ``__str__``, will also use the value of the " +"enum member instead of its name" msgstr "" -msgid "If you do not need/want those limitations, you can either create your own base class by mixing in the ``int`` or ``str`` type yourself::" +#: ../../library/enum.rst:1108 +msgid "" +"If you do not need/want those limitations, you can either create your own " +"base class by mixing in the ``int`` or ``str`` type yourself::" msgstr "" +#: ../../library/enum.rst:1111 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" "... pass" msgstr "" +#: ../../library/enum.rst:1115 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "" +#: ../../library/enum.rst:1117 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/errno.po b/library/errno.po index 7346accf9..0865e3ffc 100644 --- a/library/errno.po +++ b/library/errno.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,485 +21,695 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/errno.rst:2 msgid ":mod:`!errno` --- Standard errno system symbols" msgstr "" -msgid "This module makes available standard ``errno`` system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from :file:`linux/include/errno.h`, which should be all-inclusive." +#: ../../library/errno.rst:9 +msgid "" +"This module makes available standard ``errno`` system symbols. The value of " +"each symbol is the corresponding integer value. The names and descriptions " +"are borrowed from :file:`linux/include/errno.h`, which should be all-" +"inclusive." msgstr "" -msgid "Dictionary providing a mapping from the errno value to the string name in the underlying system. For instance, ``errno.errorcode[errno.EPERM]`` maps to ``'EPERM'``." +#: ../../library/errno.rst:17 +msgid "" +"Dictionary providing a mapping from the errno value to the string name in " +"the underlying system. For instance, ``errno.errorcode[errno.EPERM]`` maps " +"to ``'EPERM'``." msgstr "" -msgid "To translate a numeric error code to an error message, use :func:`os.strerror`." +#: ../../library/errno.rst:21 +msgid "" +"To translate a numeric error code to an error message, " +"use :func:`os.strerror`." msgstr "" -msgid "Of the following list, symbols that are not used on the current platform are not defined by the module. The specific list of defined symbols is available as ``errno.errorcode.keys()``. Symbols available can include:" +#: ../../library/errno.rst:23 +msgid "" +"Of the following list, symbols that are not used on the current platform are " +"not defined by the module. The specific list of defined symbols is " +"available as ``errno.errorcode.keys()``. Symbols available can include:" msgstr "" -msgid "Operation not permitted. This error is mapped to the exception :exc:`PermissionError`." +#: ../../library/errno.rst:30 +msgid "" +"Operation not permitted. This error is mapped to the " +"exception :exc:`PermissionError`." msgstr "" -msgid "No such file or directory. This error is mapped to the exception :exc:`FileNotFoundError`." +#: ../../library/errno.rst:36 +msgid "" +"No such file or directory. This error is mapped to the " +"exception :exc:`FileNotFoundError`." msgstr "" -msgid "No such process. This error is mapped to the exception :exc:`ProcessLookupError`." +#: ../../library/errno.rst:42 +msgid "" +"No such process. This error is mapped to the " +"exception :exc:`ProcessLookupError`." msgstr "" -msgid "Interrupted system call. This error is mapped to the exception :exc:`InterruptedError`." +#: ../../library/errno.rst:48 +msgid "" +"Interrupted system call. This error is mapped to the " +"exception :exc:`InterruptedError`." msgstr "" +#: ../../library/errno.rst:54 msgid "I/O error" msgstr "" +#: ../../library/errno.rst:59 msgid "No such device or address" msgstr "" +#: ../../library/errno.rst:64 msgid "Arg list too long" msgstr "" +#: ../../library/errno.rst:69 msgid "Exec format error" msgstr "" +#: ../../library/errno.rst:74 msgid "Bad file number" msgstr "" -msgid "No child processes. This error is mapped to the exception :exc:`ChildProcessError`." +#: ../../library/errno.rst:79 +msgid "" +"No child processes. This error is mapped to the " +"exception :exc:`ChildProcessError`." msgstr "" -msgid "Try again. This error is mapped to the exception :exc:`BlockingIOError`." +#: ../../library/errno.rst:85 +msgid "" +"Try again. This error is mapped to the exception :exc:`BlockingIOError`." msgstr "" +#: ../../library/errno.rst:90 msgid "Out of memory" msgstr "" -msgid "Permission denied. This error is mapped to the exception :exc:`PermissionError`." +#: ../../library/errno.rst:95 +msgid "" +"Permission denied. This error is mapped to the " +"exception :exc:`PermissionError`." msgstr "" +#: ../../library/errno.rst:101 msgid "Bad address" msgstr "" +#: ../../library/errno.rst:106 msgid "Block device required" msgstr "" +#: ../../library/errno.rst:111 msgid "Device or resource busy" msgstr "" -msgid "File exists. This error is mapped to the exception :exc:`FileExistsError`." +#: ../../library/errno.rst:116 +msgid "" +"File exists. This error is mapped to the exception :exc:`FileExistsError`." msgstr "" +#: ../../library/errno.rst:122 msgid "Cross-device link" msgstr "" +#: ../../library/errno.rst:127 msgid "No such device" msgstr "" -msgid "Not a directory. This error is mapped to the exception :exc:`NotADirectoryError`." +#: ../../library/errno.rst:132 +msgid "" +"Not a directory. This error is mapped to the " +"exception :exc:`NotADirectoryError`." msgstr "" -msgid "Is a directory. This error is mapped to the exception :exc:`IsADirectoryError`." +#: ../../library/errno.rst:138 +msgid "" +"Is a directory. This error is mapped to the " +"exception :exc:`IsADirectoryError`." msgstr "" +#: ../../library/errno.rst:144 msgid "Invalid argument" msgstr "" +#: ../../library/errno.rst:149 msgid "File table overflow" msgstr "" +#: ../../library/errno.rst:154 msgid "Too many open files" msgstr "" +#: ../../library/errno.rst:159 msgid "Not a typewriter" msgstr "" +#: ../../library/errno.rst:164 msgid "Text file busy" msgstr "" +#: ../../library/errno.rst:169 msgid "File too large" msgstr "" +#: ../../library/errno.rst:174 msgid "No space left on device" msgstr "" +#: ../../library/errno.rst:179 msgid "Illegal seek" msgstr "" +#: ../../library/errno.rst:184 msgid "Read-only file system" msgstr "" +#: ../../library/errno.rst:189 msgid "Too many links" msgstr "" -msgid "Broken pipe. This error is mapped to the exception :exc:`BrokenPipeError`." +#: ../../library/errno.rst:194 +msgid "" +"Broken pipe. This error is mapped to the exception :exc:`BrokenPipeError`." msgstr "" +#: ../../library/errno.rst:200 msgid "Math argument out of domain of func" msgstr "" +#: ../../library/errno.rst:205 msgid "Math result not representable" msgstr "" +#: ../../library/errno.rst:210 msgid "Resource deadlock would occur" msgstr "" +#: ../../library/errno.rst:215 msgid "File name too long" msgstr "" +#: ../../library/errno.rst:220 msgid "No record locks available" msgstr "" +#: ../../library/errno.rst:225 msgid "Function not implemented" msgstr "" +#: ../../library/errno.rst:230 msgid "Directory not empty" msgstr "" +#: ../../library/errno.rst:235 msgid "Too many symbolic links encountered" msgstr "" -msgid "Operation would block. This error is mapped to the exception :exc:`BlockingIOError`." +#: ../../library/errno.rst:240 +msgid "" +"Operation would block. This error is mapped to the " +"exception :exc:`BlockingIOError`." msgstr "" +#: ../../library/errno.rst:246 msgid "No message of desired type" msgstr "" +#: ../../library/errno.rst:251 msgid "Identifier removed" msgstr "" +#: ../../library/errno.rst:256 msgid "Channel number out of range" msgstr "" +#: ../../library/errno.rst:261 msgid "Level 2 not synchronized" msgstr "" +#: ../../library/errno.rst:266 msgid "Level 3 halted" msgstr "" +#: ../../library/errno.rst:271 msgid "Level 3 reset" msgstr "" +#: ../../library/errno.rst:276 msgid "Link number out of range" msgstr "" +#: ../../library/errno.rst:281 msgid "Protocol driver not attached" msgstr "" +#: ../../library/errno.rst:286 msgid "No CSI structure available" msgstr "" +#: ../../library/errno.rst:291 msgid "Level 2 halted" msgstr "" +#: ../../library/errno.rst:296 msgid "Invalid exchange" msgstr "" +#: ../../library/errno.rst:301 msgid "Invalid request descriptor" msgstr "" +#: ../../library/errno.rst:306 msgid "Exchange full" msgstr "" +#: ../../library/errno.rst:311 msgid "No anode" msgstr "" +#: ../../library/errno.rst:316 msgid "Invalid request code" msgstr "" +#: ../../library/errno.rst:321 msgid "Invalid slot" msgstr "" +#: ../../library/errno.rst:326 msgid "File locking deadlock error" msgstr "" +#: ../../library/errno.rst:331 msgid "Bad font file format" msgstr "" +#: ../../library/errno.rst:336 msgid "Device not a stream" msgstr "" +#: ../../library/errno.rst:341 msgid "No data available" msgstr "" +#: ../../library/errno.rst:346 msgid "Timer expired" msgstr "" +#: ../../library/errno.rst:351 msgid "Out of streams resources" msgstr "" +#: ../../library/errno.rst:356 msgid "Machine is not on the network" msgstr "" +#: ../../library/errno.rst:361 msgid "Package not installed" msgstr "" +#: ../../library/errno.rst:366 msgid "Object is remote" msgstr "" +#: ../../library/errno.rst:371 msgid "Link has been severed" msgstr "" +#: ../../library/errno.rst:376 msgid "Advertise error" msgstr "" +#: ../../library/errno.rst:381 msgid "Srmount error" msgstr "" +#: ../../library/errno.rst:386 msgid "Communication error on send" msgstr "" +#: ../../library/errno.rst:391 msgid "Protocol error" msgstr "" +#: ../../library/errno.rst:396 msgid "Multihop attempted" msgstr "" +#: ../../library/errno.rst:401 msgid "RFS specific error" msgstr "" +#: ../../library/errno.rst:406 msgid "Not a data message" msgstr "" +#: ../../library/errno.rst:411 msgid "Value too large for defined data type" msgstr "" +#: ../../library/errno.rst:416 msgid "Name not unique on network" msgstr "" +#: ../../library/errno.rst:421 msgid "File descriptor in bad state" msgstr "" +#: ../../library/errno.rst:426 msgid "Remote address changed" msgstr "" +#: ../../library/errno.rst:431 msgid "Can not access a needed shared library" msgstr "" +#: ../../library/errno.rst:436 msgid "Accessing a corrupted shared library" msgstr "" +#: ../../library/errno.rst:441 msgid ".lib section in a.out corrupted" msgstr "" +#: ../../library/errno.rst:446 msgid "Attempting to link in too many shared libraries" msgstr "" +#: ../../library/errno.rst:451 msgid "Cannot exec a shared library directly" msgstr "" +#: ../../library/errno.rst:456 msgid "Illegal byte sequence" msgstr "" +#: ../../library/errno.rst:461 msgid "Interrupted system call should be restarted" msgstr "" +#: ../../library/errno.rst:466 msgid "Streams pipe error" msgstr "" +#: ../../library/errno.rst:471 msgid "Too many users" msgstr "" +#: ../../library/errno.rst:476 msgid "Socket operation on non-socket" msgstr "" +#: ../../library/errno.rst:481 msgid "Destination address required" msgstr "" +#: ../../library/errno.rst:486 msgid "Message too long" msgstr "" +#: ../../library/errno.rst:491 msgid "Protocol wrong type for socket" msgstr "" +#: ../../library/errno.rst:496 msgid "Protocol not available" msgstr "" +#: ../../library/errno.rst:501 msgid "Protocol not supported" msgstr "" +#: ../../library/errno.rst:506 msgid "Socket type not supported" msgstr "" +#: ../../library/errno.rst:511 msgid "Operation not supported on transport endpoint" msgstr "" +#: ../../library/errno.rst:516 msgid "Operation not supported" msgstr "" +#: ../../library/errno.rst:523 msgid "Protocol family not supported" msgstr "" +#: ../../library/errno.rst:528 msgid "Address family not supported by protocol" msgstr "" +#: ../../library/errno.rst:533 msgid "Address already in use" msgstr "" +#: ../../library/errno.rst:538 msgid "Cannot assign requested address" msgstr "" +#: ../../library/errno.rst:543 msgid "Network is down" msgstr "" +#: ../../library/errno.rst:548 msgid "Network is unreachable" msgstr "" +#: ../../library/errno.rst:553 msgid "Network dropped connection because of reset" msgstr "" -msgid "Software caused connection abort. This error is mapped to the exception :exc:`ConnectionAbortedError`." +#: ../../library/errno.rst:558 +msgid "" +"Software caused connection abort. This error is mapped to the " +"exception :exc:`ConnectionAbortedError`." msgstr "" -msgid "Connection reset by peer. This error is mapped to the exception :exc:`ConnectionResetError`." +#: ../../library/errno.rst:564 +msgid "" +"Connection reset by peer. This error is mapped to the " +"exception :exc:`ConnectionResetError`." msgstr "" +#: ../../library/errno.rst:570 msgid "No buffer space available" msgstr "" +#: ../../library/errno.rst:575 msgid "Transport endpoint is already connected" msgstr "" +#: ../../library/errno.rst:580 msgid "Transport endpoint is not connected" msgstr "" -msgid "Cannot send after transport endpoint shutdown. This error is mapped to the exception :exc:`BrokenPipeError`." +#: ../../library/errno.rst:585 +msgid "" +"Cannot send after transport endpoint shutdown. This error is mapped to the " +"exception :exc:`BrokenPipeError`." msgstr "" +#: ../../library/errno.rst:591 msgid "Too many references: cannot splice" msgstr "" -msgid "Connection timed out. This error is mapped to the exception :exc:`TimeoutError`." +#: ../../library/errno.rst:596 +msgid "" +"Connection timed out. This error is mapped to the " +"exception :exc:`TimeoutError`." msgstr "" -msgid "Connection refused. This error is mapped to the exception :exc:`ConnectionRefusedError`." +#: ../../library/errno.rst:602 +msgid "" +"Connection refused. This error is mapped to the " +"exception :exc:`ConnectionRefusedError`." msgstr "" +#: ../../library/errno.rst:608 msgid "Host is down" msgstr "" +#: ../../library/errno.rst:613 msgid "No route to host" msgstr "" +#: ../../library/errno.rst:618 msgid "Memory page has hardware error." msgstr "" -msgid "Operation already in progress. This error is mapped to the exception :exc:`BlockingIOError`." +#: ../../library/errno.rst:625 +msgid "" +"Operation already in progress. This error is mapped to the " +"exception :exc:`BlockingIOError`." msgstr "" -msgid "Operation now in progress. This error is mapped to the exception :exc:`BlockingIOError`." +#: ../../library/errno.rst:631 +msgid "" +"Operation now in progress. This error is mapped to the " +"exception :exc:`BlockingIOError`." msgstr "" +#: ../../library/errno.rst:637 msgid "Stale NFS file handle" msgstr "" +#: ../../library/errno.rst:642 msgid "Structure needs cleaning" msgstr "" +#: ../../library/errno.rst:647 msgid "Not a XENIX named type file" msgstr "" +#: ../../library/errno.rst:652 msgid "No XENIX semaphores available" msgstr "" +#: ../../library/errno.rst:657 msgid "Is a named type file" msgstr "" +#: ../../library/errno.rst:662 msgid "Remote I/O error" msgstr "" +#: ../../library/errno.rst:667 msgid "Quota exceeded" msgstr "" +#: ../../library/errno.rst:671 msgid "Interface output queue is full" msgstr "" +#: ../../library/errno.rst:678 msgid "No medium found" msgstr "" +#: ../../library/errno.rst:683 msgid "Wrong medium type" msgstr "" +#: ../../library/errno.rst:688 msgid "Required key not available" msgstr "" +#: ../../library/errno.rst:693 msgid "Key has expired" msgstr "" +#: ../../library/errno.rst:698 msgid "Key has been revoked" msgstr "" +#: ../../library/errno.rst:703 msgid "Key was rejected by service" msgstr "" +#: ../../library/errno.rst:708 msgid "Operation not possible due to RF-kill" msgstr "" +#: ../../library/errno.rst:713 msgid "Locked lock was unmapped" msgstr "" +#: ../../library/errno.rst:718 msgid "Facility is not active" msgstr "" +#: ../../library/errno.rst:723 msgid "Authentication error" msgstr "" +#: ../../library/errno.rst:730 msgid "Bad CPU type in executable" msgstr "" +#: ../../library/errno.rst:737 msgid "Bad executable (or shared library)" msgstr "" +#: ../../library/errno.rst:744 msgid "Malformed Mach-o file" msgstr "" +#: ../../library/errno.rst:751 msgid "Device error" msgstr "" +#: ../../library/errno.rst:758 msgid "Inappropriate file type or format" msgstr "" +#: ../../library/errno.rst:765 msgid "Need authenticator" msgstr "" +#: ../../library/errno.rst:772 msgid "Attribute not found" msgstr "" +#: ../../library/errno.rst:779 msgid "Policy not found" msgstr "" +#: ../../library/errno.rst:786 msgid "Too many processes" msgstr "" +#: ../../library/errno.rst:793 msgid "Bad procedure for program" msgstr "" +#: ../../library/errno.rst:800 msgid "Program version wrong" msgstr "" +#: ../../library/errno.rst:807 msgid "RPC prog. not avail" msgstr "" +#: ../../library/errno.rst:814 msgid "Device power is off" msgstr "" +#: ../../library/errno.rst:821 msgid "RPC struct is bad" msgstr "" +#: ../../library/errno.rst:828 msgid "RPC version wrong" msgstr "" +#: ../../library/errno.rst:835 msgid "Shared library version mismatch" msgstr "" -msgid "Capabilities insufficient. This error is mapped to the exception :exc:`PermissionError`." +#: ../../library/errno.rst:842 +msgid "" +"Capabilities insufficient. This error is mapped to the " +"exception :exc:`PermissionError`." msgstr "" +#: ../../library/errno.rst:845 msgid "Availability" msgstr "" +#: ../../library/errno.rst:852 msgid "Operation canceled" msgstr "" +#: ../../library/errno.rst:859 msgid "Owner died" msgstr "" +#: ../../library/errno.rst:866 msgid "State not recoverable" msgstr "" diff --git a/library/exceptions.po b/library/exceptions.po index fa2b80686..e2e79ef31 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -22,69 +22,169 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/exceptions.rst:4 msgid "Built-in Exceptions" msgstr "" -msgid "In Python, all exceptions must be instances of a class that derives from :class:`BaseException`. In a :keyword:`try` statement with an :keyword:`except` clause that mentions a particular class, that clause also handles any exception classes derived from that class (but not exception classes from which *it* is derived). Two exception classes that are not related via subclassing are never equivalent, even if they have the same name." +#: ../../library/exceptions.rst:10 +msgid "" +"In Python, all exceptions must be instances of a class that derives " +"from :class:`BaseException`. In a :keyword:`try` statement with " +"an :keyword:`except` clause that mentions a particular class, that clause " +"also handles any exception classes derived from that class (but not " +"exception classes from which *it* is derived). Two exception classes that " +"are not related via subclassing are never equivalent, even if they have the " +"same name." msgstr "" -msgid "The built-in exceptions listed in this chapter can be generated by the interpreter or built-in functions. Except where mentioned, they have an \"associated value\" indicating the detailed cause of the error. This may be a string or a tuple of several items of information (e.g., an error code and a string explaining the code). The associated value is usually passed as arguments to the exception class's constructor." +#: ../../library/exceptions.rst:19 +msgid "" +"The built-in exceptions listed in this chapter can be generated by the " +"interpreter or built-in functions. Except where mentioned, they have an " +"\"associated value\" indicating the detailed cause of the error. This may " +"be a string or a tuple of several items of information (e.g., an error code " +"and a string explaining the code). The associated value is usually passed " +"as arguments to the exception class's constructor." msgstr "" -msgid "User code can raise built-in exceptions. This can be used to test an exception handler or to report an error condition \"just like\" the situation in which the interpreter raises the same exception; but beware that there is nothing to prevent user code from raising an inappropriate error." +#: ../../library/exceptions.rst:26 +msgid "" +"User code can raise built-in exceptions. This can be used to test an " +"exception handler or to report an error condition \"just like\" the " +"situation in which the interpreter raises the same exception; but beware " +"that there is nothing to prevent user code from raising an inappropriate " +"error." msgstr "" -msgid "The built-in exception classes can be subclassed to define new exceptions; programmers are encouraged to derive new exceptions from the :exc:`Exception` class or one of its subclasses, and not from :exc:`BaseException`. More information on defining exceptions is available in the Python Tutorial under :ref:`tut-userexceptions`." +#: ../../library/exceptions.rst:31 +msgid "" +"The built-in exception classes can be subclassed to define new exceptions; " +"programmers are encouraged to derive new exceptions from " +"the :exc:`Exception` class or one of its subclasses, and not " +"from :exc:`BaseException`. More information on defining exceptions is " +"available in the Python Tutorial under :ref:`tut-userexceptions`." msgstr "" +#: ../../library/exceptions.rst:39 msgid "Exception context" msgstr "" -msgid "Three attributes on exception objects provide information about the context in which the exception was raised:" +#: ../../library/exceptions.rst:46 +msgid "" +"Three attributes on exception objects provide information about the context " +"in which the exception was raised:" msgstr "" -msgid "When raising a new exception while another exception is already being handled, the new exception's :attr:`!__context__` attribute is automatically set to the handled exception. An exception may be handled when an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is used." +#: ../../library/exceptions.rst:53 +msgid "" +"When raising a new exception while another exception is already being " +"handled, the new exception's :attr:`!__context__` attribute is automatically " +"set to the handled exception. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"statement, is used." msgstr "" -msgid "This implicit exception context can be supplemented with an explicit cause by using :keyword:`!from` with :keyword:`raise`::" +#: ../../library/exceptions.rst:59 +msgid "" +"This implicit exception context can be supplemented with an explicit cause " +"by using :keyword:`!from` with :keyword:`raise`::" msgstr "" +#: ../../library/exceptions.rst:63 msgid "raise new_exc from original_exc" msgstr "" -msgid "The expression following :keyword:`from` must be an exception or ``None``. It will be set as :attr:`!__cause__` on the raised exception. Setting :attr:`!__cause__` also implicitly sets the :attr:`!__suppress_context__` attribute to ``True``, so that using ``raise new_exc from None`` effectively replaces the old exception with the new one for display purposes (e.g. converting :exc:`KeyError` to :exc:`AttributeError`), while leaving the old exception available in :attr:`!__context__` for introspection when debugging." +#: ../../library/exceptions.rst:65 +msgid "" +"The expression following :keyword:`from` must be an exception or " +"``None``. It will be set as :attr:`!__cause__` on the raised exception. " +"Setting :attr:`!__cause__` also implicitly sets the :attr:`!" +"__suppress_context__` attribute to ``True``, so that using ``raise new_exc " +"from None`` effectively replaces the old exception with the new one for " +"display purposes (e.g. converting :exc:`KeyError` to :exc:`AttributeError`), " +"while leaving the old exception available in :attr:`!__context__` for " +"introspection when debugging." msgstr "" -msgid "The default traceback display code shows these chained exceptions in addition to the traceback for the exception itself. An explicitly chained exception in :attr:`!__cause__` is always shown when present. An implicitly chained exception in :attr:`!__context__` is shown only if :attr:`!__cause__` is :const:`None` and :attr:`!__suppress_context__` is false." +#: ../../library/exceptions.rst:74 +msgid "" +"The default traceback display code shows these chained exceptions in " +"addition to the traceback for the exception itself. An explicitly chained " +"exception in :attr:`!__cause__` is always shown when present. An implicitly " +"chained exception in :attr:`!__context__` is shown only if :attr:`!" +"__cause__` is :const:`None` and :attr:`!__suppress_context__` is false." msgstr "" -msgid "In either case, the exception itself is always shown after any chained exceptions so that the final line of the traceback always shows the last exception that was raised." +#: ../../library/exceptions.rst:80 +msgid "" +"In either case, the exception itself is always shown after any chained " +"exceptions so that the final line of the traceback always shows the last " +"exception that was raised." msgstr "" +#: ../../library/exceptions.rst:86 msgid "Inheriting from built-in exceptions" msgstr "" -msgid "User code can create subclasses that inherit from an exception type. It's recommended to only subclass one exception type at a time to avoid any possible conflicts between how the bases handle the ``args`` attribute, as well as due to possible memory layout incompatibilities." +#: ../../library/exceptions.rst:88 +msgid "" +"User code can create subclasses that inherit from an exception type. It's " +"recommended to only subclass one exception type at a time to avoid any " +"possible conflicts between how the bases handle the ``args`` attribute, as " +"well as due to possible memory layout incompatibilities." msgstr "" -msgid "Most built-in exceptions are implemented in C for efficiency, see: :source:`Objects/exceptions.c`. Some have custom memory layouts which makes it impossible to create a subclass that inherits from multiple exception types. The memory layout of a type is an implementation detail and might change between Python versions, leading to new conflicts in the future. Therefore, it's recommended to avoid subclassing multiple exception types altogether." +#: ../../library/exceptions.rst:95 +msgid "" +"Most built-in exceptions are implemented in C for efficiency, " +"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which " +"makes it impossible to create a subclass that inherits from multiple " +"exception types. The memory layout of a type is an implementation detail and " +"might change between Python versions, leading to new conflicts in the " +"future. Therefore, it's recommended to avoid subclassing multiple exception " +"types altogether." msgstr "" +#: ../../library/exceptions.rst:105 msgid "Base classes" msgstr "" -msgid "The following exceptions are used mostly as base classes for other exceptions." +#: ../../library/exceptions.rst:107 +msgid "" +"The following exceptions are used mostly as base classes for other " +"exceptions." msgstr "" -msgid "The base class for all built-in exceptions. It is not meant to be directly inherited by user-defined classes (for that, use :exc:`Exception`). If :func:`str` is called on an instance of this class, the representation of the argument(s) to the instance are returned, or the empty string when there were no arguments." +#: ../../library/exceptions.rst:111 +msgid "" +"The base class for all built-in exceptions. It is not meant to be directly " +"inherited by user-defined classes (for that, use :exc:`Exception`). " +"If :func:`str` is called on an instance of this class, the representation of " +"the argument(s) to the instance are returned, or the empty string when there " +"were no arguments." msgstr "" -msgid "The tuple of arguments given to the exception constructor. Some built-in exceptions (like :exc:`OSError`) expect a certain number of arguments and assign a special meaning to the elements of this tuple, while others are usually called only with a single string giving an error message." +#: ../../library/exceptions.rst:119 +msgid "" +"The tuple of arguments given to the exception constructor. Some built-in " +"exceptions (like :exc:`OSError`) expect a certain number of arguments and " +"assign a special meaning to the elements of this tuple, while others are " +"usually called only with a single string giving an error message." msgstr "" -msgid "This method sets *tb* as the new traceback for the exception and returns the exception object. It was more commonly used before the exception chaining features of :pep:`3134` became available. The following example shows how we can convert an instance of ``SomeException`` into an instance of ``OtherException`` while preserving the traceback. Once raised, the current frame is pushed onto the traceback of the ``OtherException``, as would have happened to the traceback of the original ``SomeException`` had we allowed it to propagate to the caller. ::" +#: ../../library/exceptions.rst:126 +msgid "" +"This method sets *tb* as the new traceback for the exception and returns the " +"exception object. It was more commonly used before the exception chaining " +"features of :pep:`3134` became available. The following example shows how " +"we can convert an instance of ``SomeException`` into an instance of " +"``OtherException`` while preserving the traceback. Once raised, the current " +"frame is pushed onto the traceback of the ``OtherException``, as would have " +"happened to the traceback of the original ``SomeException`` had we allowed " +"it to propagate to the caller. ::" msgstr "" +#: ../../library/exceptions.rst:135 msgid "" "try:\n" " ...\n" @@ -93,495 +193,1027 @@ msgid "" " raise OtherException(...).with_traceback(tb)" msgstr "" -msgid "A writable field that holds the :ref:`traceback object ` associated with this exception. See also: :ref:`raise`." +#: ../../library/exceptions.rst:143 +msgid "" +"A writable field that holds the :ref:`traceback object ` " +"associated with this exception. See also: :ref:`raise`." msgstr "" -msgid "Add the string ``note`` to the exception's notes which appear in the standard traceback after the exception string. A :exc:`TypeError` is raised if ``note`` is not a string." +#: ../../library/exceptions.rst:149 +msgid "" +"Add the string ``note`` to the exception's notes which appear in the " +"standard traceback after the exception string. A :exc:`TypeError` is raised " +"if ``note`` is not a string." msgstr "" -msgid "A list of the notes of this exception, which were added with :meth:`add_note`. This attribute is created when :meth:`add_note` is called." +#: ../../library/exceptions.rst:157 +msgid "" +"A list of the notes of this exception, which were added " +"with :meth:`add_note`. This attribute is created when :meth:`add_note` is " +"called." msgstr "" -msgid "All built-in, non-system-exiting exceptions are derived from this class. All user-defined exceptions should also be derived from this class." +#: ../../library/exceptions.rst:165 +msgid "" +"All built-in, non-system-exiting exceptions are derived from this class. " +"All user-defined exceptions should also be derived from this class." msgstr "" -msgid "The base class for those built-in exceptions that are raised for various arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." +#: ../../library/exceptions.rst:171 +msgid "" +"The base class for those built-in exceptions that are raised for various " +"arithmetic " +"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." msgstr "" -msgid "Raised when a :ref:`buffer ` related operation cannot be performed." +#: ../../library/exceptions.rst:178 +msgid "" +"Raised when a :ref:`buffer ` related operation cannot be " +"performed." msgstr "" -msgid "The base class for the exceptions that are raised when a key or index used on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. This can be raised directly by :func:`codecs.lookup`." +#: ../../library/exceptions.rst:184 +msgid "" +"The base class for the exceptions that are raised when a key or index used " +"on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " +"This can be raised directly by :func:`codecs.lookup`." msgstr "" +#: ../../library/exceptions.rst:190 msgid "Concrete exceptions" msgstr "" +#: ../../library/exceptions.rst:192 msgid "The following exceptions are the exceptions that are usually raised." msgstr "" +#: ../../library/exceptions.rst:198 msgid "Raised when an :keyword:`assert` statement fails." msgstr "" -msgid "Raised when an attribute reference (see :ref:`attribute-references`) or assignment fails. (When an object does not support attribute references or attribute assignments at all, :exc:`TypeError` is raised.)" +#: ../../library/exceptions.rst:203 +msgid "" +"Raised when an attribute reference (see :ref:`attribute-references`) or " +"assignment fails. (When an object does not support attribute references or " +"attribute assignments at all, :exc:`TypeError` is raised.)" msgstr "" -msgid "The optional *name* and *obj* keyword-only arguments set the corresponding attributes:" +#: ../../library/exceptions.rst:207 +msgid "" +"The optional *name* and *obj* keyword-only arguments set the corresponding " +"attributes:" msgstr "" +#: ../../library/exceptions.rst:212 msgid "The name of the attribute that was attempted to be accessed." msgstr "" +#: ../../library/exceptions.rst:216 msgid "The object that was accessed for the named attribute." msgstr "" +#: ../../library/exceptions.rst:218 msgid "Added the :attr:`name` and :attr:`obj` attributes." msgstr "" -msgid "Raised when the :func:`input` function hits an end-of-file condition (EOF) without reading any data. (Note: the :meth:`io.TextIOBase.read` and :meth:`io.IOBase.readline` methods return an empty string when they hit EOF.)" +#: ../../library/exceptions.rst:223 +msgid "" +"Raised when the :func:`input` function hits an end-of-file condition (EOF) " +"without reading any data. (Note: the :meth:`io.TextIOBase.read` " +"and :meth:`io.IOBase.readline` methods return an empty string when they hit " +"EOF.)" msgstr "" +#: ../../library/exceptions.rst:230 msgid "Not currently used." msgstr "" -msgid "Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:`generator.close` and :meth:`coroutine.close`. It directly inherits from :exc:`BaseException` instead of :exc:`Exception` since it is technically not an error." +#: ../../library/exceptions.rst:235 +msgid "" +"Raised when a :term:`generator` or :term:`coroutine` is closed; " +"see :meth:`generator.close` and :meth:`coroutine.close`. It directly " +"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is " +"technically not an error." msgstr "" -msgid "Raised when the :keyword:`import` statement has troubles trying to load a module. Also raised when the \"from list\" in ``from ... import`` has a name that cannot be found." +#: ../../library/exceptions.rst:243 +msgid "" +"Raised when the :keyword:`import` statement has troubles trying to load a " +"module. Also raised when the \"from list\" in ``from ... import`` has a " +"name that cannot be found." msgstr "" -msgid "The optional *name* and *path* keyword-only arguments set the corresponding attributes:" +#: ../../library/exceptions.rst:247 +msgid "" +"The optional *name* and *path* keyword-only arguments set the corresponding " +"attributes:" msgstr "" +#: ../../library/exceptions.rst:252 msgid "The name of the module that was attempted to be imported." msgstr "" +#: ../../library/exceptions.rst:256 msgid "The path to any file which triggered the exception." msgstr "" +#: ../../library/exceptions.rst:258 msgid "Added the :attr:`name` and :attr:`path` attributes." msgstr "" -msgid "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a module could not be located. It is also raised when ``None`` is found in :data:`sys.modules`." +#: ../../library/exceptions.rst:263 +msgid "" +"A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " +"module could not be located. It is also raised when ``None`` is found " +"in :data:`sys.modules`." msgstr "" -msgid "Raised when a sequence subscript is out of range. (Slice indices are silently truncated to fall in the allowed range; if an index is not an integer, :exc:`TypeError` is raised.)" +#: ../../library/exceptions.rst:272 +msgid "" +"Raised when a sequence subscript is out of range. (Slice indices are " +"silently truncated to fall in the allowed range; if an index is not an " +"integer, :exc:`TypeError` is raised.)" msgstr "" -msgid "Raised when a mapping (dictionary) key is not found in the set of existing keys." +#: ../../library/exceptions.rst:281 +msgid "" +"Raised when a mapping (dictionary) key is not found in the set of existing " +"keys." msgstr "" -msgid "Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :kbd:`Delete`). During execution, a check for interrupts is made regularly. The exception inherits from :exc:`BaseException` so as to not be accidentally caught by code that catches :exc:`Exception` and thus prevent the interpreter from exiting." +#: ../../library/exceptions.rst:288 +msgid "" +"Raised when the user hits the interrupt key (normally :kbd:`Control-C` " +"or :kbd:`Delete`). During execution, a check for interrupts is made " +"regularly. The exception inherits from :exc:`BaseException` so as to not be " +"accidentally caught by code that catches :exc:`Exception` and thus prevent " +"the interpreter from exiting." msgstr "" -msgid "Catching a :exc:`KeyboardInterrupt` requires special consideration. Because it can be raised at unpredictable points, it may, in some circumstances, leave the running program in an inconsistent state. It is generally best to allow :exc:`KeyboardInterrupt` to end the program as quickly as possible or avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" +#: ../../library/exceptions.rst:296 +msgid "" +"Catching a :exc:`KeyboardInterrupt` requires special consideration. Because " +"it can be raised at unpredictable points, it may, in some circumstances, " +"leave the running program in an inconsistent state. It is generally best to " +"allow :exc:`KeyboardInterrupt` to end the program as quickly as possible or " +"avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" -msgid "Raised when an operation runs out of memory but the situation may still be rescued (by deleting some objects). The associated value is a string indicating what kind of (internal) operation ran out of memory. Note that because of the underlying memory management architecture (C's :c:func:`malloc` function), the interpreter may not always be able to completely recover from this situation; it nevertheless raises an exception so that a stack traceback can be printed, in case a run-away program was the cause." +#: ../../library/exceptions.rst:306 +msgid "" +"Raised when an operation runs out of memory but the situation may still be " +"rescued (by deleting some objects). The associated value is a string " +"indicating what kind of (internal) operation ran out of memory. Note that " +"because of the underlying memory management architecture " +"(C's :c:func:`malloc` function), the interpreter may not always be able to " +"completely recover from this situation; it nevertheless raises an exception " +"so that a stack traceback can be printed, in case a run-away program was the " +"cause." msgstr "" -msgid "Raised when a local or global name is not found. This applies only to unqualified names. The associated value is an error message that includes the name that could not be found." +#: ../../library/exceptions.rst:317 +msgid "" +"Raised when a local or global name is not found. This applies only to " +"unqualified names. The associated value is an error message that includes " +"the name that could not be found." msgstr "" +#: ../../library/exceptions.rst:321 msgid "The optional *name* keyword-only argument sets the attribute:" msgstr "" +#: ../../library/exceptions.rst:325 msgid "The name of the variable that was attempted to be accessed." msgstr "" +#: ../../library/exceptions.rst:327 msgid "Added the :attr:`name` attribute." msgstr "" -msgid "This exception is derived from :exc:`RuntimeError`. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added." +#: ../../library/exceptions.rst:333 +msgid "" +"This exception is derived from :exc:`RuntimeError`. In user defined base " +"classes, abstract methods should raise this exception when they require " +"derived classes to override the method, or while the class is being " +"developed to indicate that the real implementation still needs to be added." msgstr "" -msgid "It should not be used to indicate that an operator or method is not meant to be supported at all -- in that case either leave the operator / method undefined or, if a subclass, set it to :data:`None`." +#: ../../library/exceptions.rst:340 +msgid "" +"It should not be used to indicate that an operator or method is not meant to " +"be supported at all -- in that case either leave the operator / method " +"undefined or, if a subclass, set it to :data:`None`." msgstr "" -msgid ":exc:`!NotImplementedError` and :data:`!NotImplemented` are not interchangeable. This exception should only be used as described above; see :data:`NotImplemented` for details on correct usage of the built-in constant." +#: ../../library/exceptions.rst:346 +msgid "" +":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " +"interchangeable. This exception should only be used as described above; " +"see :data:`NotImplemented` for details on correct usage of the built-in " +"constant." msgstr "" -msgid "This exception is raised when a system function returns a system-related error, including I/O failures such as \"file not found\" or \"disk full\" (not for illegal argument types or other incidental errors)." +#: ../../library/exceptions.rst:357 +msgid "" +"This exception is raised when a system function returns a system-related " +"error, including I/O failures such as \"file not found\" or \"disk full\" " +"(not for illegal argument types or other incidental errors)." msgstr "" -msgid "The second form of the constructor sets the corresponding attributes, described below. The attributes default to :const:`None` if not specified. For backwards compatibility, if three arguments are passed, the :attr:`~BaseException.args` attribute contains only a 2-tuple of the first two constructor arguments." +#: ../../library/exceptions.rst:361 +msgid "" +"The second form of the constructor sets the corresponding attributes, " +"described below. The attributes default to :const:`None` if not specified. " +"For backwards compatibility, if three arguments are passed, " +"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the " +"first two constructor arguments." msgstr "" -msgid "The constructor often actually returns a subclass of :exc:`OSError`, as described in `OS exceptions`_ below. The particular subclass depends on the final :attr:`.errno` value. This behaviour only occurs when constructing :exc:`OSError` directly or via an alias, and is not inherited when subclassing." +#: ../../library/exceptions.rst:367 +msgid "" +"The constructor often actually returns a subclass of :exc:`OSError`, as " +"described in `OS exceptions`_ below. The particular subclass depends on the " +"final :attr:`.errno` value. This behaviour only occurs when " +"constructing :exc:`OSError` directly or via an alias, and is not inherited " +"when subclassing." msgstr "" +#: ../../library/exceptions.rst:375 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "" -msgid "Under Windows, this gives you the native Windows error code. The :attr:`.errno` attribute is then an approximate translation, in POSIX terms, of that native error code." +#: ../../library/exceptions.rst:379 +msgid "" +"Under Windows, this gives you the native Windows error code. " +"The :attr:`.errno` attribute is then an approximate translation, in POSIX " +"terms, of that native error code." msgstr "" -msgid "Under Windows, if the *winerror* constructor argument is an integer, the :attr:`.errno` attribute is determined from the Windows error code, and the *errno* argument is ignored. On other platforms, the *winerror* argument is ignored, and the :attr:`winerror` attribute does not exist." +#: ../../library/exceptions.rst:383 +msgid "" +"Under Windows, if the *winerror* constructor argument is an integer, " +"the :attr:`.errno` attribute is determined from the Windows error code, and " +"the *errno* argument is ignored. On other platforms, the *winerror* " +"argument is ignored, and the :attr:`winerror` attribute does not exist." msgstr "" -msgid "The corresponding error message, as provided by the operating system. It is formatted by the C functions :c:func:`!perror` under POSIX, and :c:func:`!FormatMessage` under Windows." +#: ../../library/exceptions.rst:391 +msgid "" +"The corresponding error message, as provided by the operating system. It is " +"formatted by the C functions :c:func:`!perror` under POSIX, and :c:func:`!" +"FormatMessage` under Windows." msgstr "" -msgid "For exceptions that involve a file system path (such as :func:`open` or :func:`os.unlink`), :attr:`filename` is the file name passed to the function. For functions that involve two file system paths (such as :func:`os.rename`), :attr:`filename2` corresponds to the second file name passed to the function." +#: ../../library/exceptions.rst:399 +msgid "" +"For exceptions that involve a file system path (such as :func:`open` " +"or :func:`os.unlink`), :attr:`filename` is the file name passed to the " +"function. For functions that involve two file system paths (such " +"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name " +"passed to the function." msgstr "" -msgid ":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` and :exc:`!mmap.error` have been merged into :exc:`OSError`, and the constructor may return a subclass." +#: ../../library/exceptions.rst:406 +msgid "" +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " +"and :exc:`!mmap.error` have been merged into :exc:`OSError`, and the " +"constructor may return a subclass." msgstr "" -msgid "The :attr:`filename` attribute is now the original file name passed to the function, instead of the name encoded to or decoded from the :term:`filesystem encoding and error handler`. Also, the *filename2* constructor argument and attribute was added." +#: ../../library/exceptions.rst:412 +msgid "" +"The :attr:`filename` attribute is now the original file name passed to the " +"function, instead of the name encoded to or decoded from " +"the :term:`filesystem encoding and error handler`. Also, the *filename2* " +"constructor argument and attribute was added." msgstr "" -msgid "Raised when the result of an arithmetic operation is too large to be represented. This cannot occur for integers (which would rather raise :exc:`MemoryError` than give up). However, for historical reasons, OverflowError is sometimes raised for integers that are outside a required range. Because of the lack of standardization of floating-point exception handling in C, most floating-point operations are not checked." +#: ../../library/exceptions.rst:421 +msgid "" +"Raised when the result of an arithmetic operation is too large to be " +"represented. This cannot occur for integers (which would rather " +"raise :exc:`MemoryError` than give up). However, for historical reasons, " +"OverflowError is sometimes raised for integers that are outside a required " +"range. Because of the lack of standardization of floating-point exception " +"handling in C, most floating-point operations are not checked." msgstr "" -msgid "This exception is derived from :exc:`RuntimeError`. It is raised when an operation is blocked during interpreter shutdown also known as :term:`Python finalization `." +#: ../../library/exceptions.rst:431 +msgid "" +"This exception is derived from :exc:`RuntimeError`. It is raised when an " +"operation is blocked during interpreter shutdown also known as :term:`Python " +"finalization `." msgstr "" -msgid "Examples of operations which can be blocked with a :exc:`PythonFinalizationError` during the Python finalization:" +#: ../../library/exceptions.rst:435 +msgid "" +"Examples of operations which can be blocked with " +"a :exc:`PythonFinalizationError` during the Python finalization:" msgstr "" +#: ../../library/exceptions.rst:438 msgid "Creating a new Python thread." msgstr "" +#: ../../library/exceptions.rst:439 msgid ":meth:`Joining ` a running daemon thread." msgstr "" +#: ../../library/exceptions.rst:440 msgid ":func:`os.fork`." msgstr "" +#: ../../library/exceptions.rst:442 msgid "See also the :func:`sys.is_finalizing` function." msgstr "" +#: ../../library/exceptions.rst:444 ../../library/exceptions.rst:457 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "" +#: ../../library/exceptions.rst:449 msgid ":meth:`threading.Thread.join` can now raise this exception." msgstr "" -msgid "This exception is derived from :exc:`RuntimeError`. It is raised when the interpreter detects that the maximum recursion depth (see :func:`sys.getrecursionlimit`) is exceeded." +#: ../../library/exceptions.rst:453 +msgid "" +"This exception is derived from :exc:`RuntimeError`. It is raised when the " +"interpreter detects that the maximum recursion depth " +"(see :func:`sys.getrecursionlimit`) is exceeded." msgstr "" -msgid "This exception is raised when a weak reference proxy, created by the :func:`weakref.proxy` function, is used to access an attribute of the referent after it has been garbage collected. For more information on weak references, see the :mod:`weakref` module." +#: ../../library/exceptions.rst:463 +msgid "" +"This exception is raised when a weak reference proxy, created by " +"the :func:`weakref.proxy` function, is used to access an attribute of the " +"referent after it has been garbage collected. For more information on weak " +"references, see the :mod:`weakref` module." msgstr "" -msgid "Raised when an error is detected that doesn't fall in any of the other categories. The associated value is a string indicating what precisely went wrong." +#: ../../library/exceptions.rst:471 +msgid "" +"Raised when an error is detected that doesn't fall in any of the other " +"categories. The associated value is a string indicating what precisely went " +"wrong." msgstr "" -msgid "Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that there are no further items produced by the iterator." +#: ../../library/exceptions.rst:478 +msgid "" +"Raised by built-in function :func:`next` and " +"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " +"there are no further items produced by the iterator." msgstr "" -msgid "The exception object has a single attribute :attr:`!value`, which is given as an argument when constructing the exception, and defaults to :const:`None`." +#: ../../library/exceptions.rst:484 +msgid "" +"The exception object has a single attribute :attr:`!value`, which is given " +"as an argument when constructing the exception, and defaults " +"to :const:`None`." msgstr "" -msgid "When a :term:`generator` or :term:`coroutine` function returns, a new :exc:`StopIteration` instance is raised, and the value returned by the function is used as the :attr:`value` parameter to the constructor of the exception." +#: ../../library/exceptions.rst:488 +msgid "" +"When a :term:`generator` or :term:`coroutine` function returns, a " +"new :exc:`StopIteration` instance is raised, and the value returned by the " +"function is used as the :attr:`value` parameter to the constructor of the " +"exception." msgstr "" -msgid "If a generator code directly or indirectly raises :exc:`StopIteration`, it is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` as the new exception's cause)." +#: ../../library/exceptions.rst:493 +msgid "" +"If a generator code directly or indirectly raises :exc:`StopIteration`, it " +"is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " +"as the new exception's cause)." msgstr "" -msgid "Added ``value`` attribute and the ability for generator functions to use it to return a value." +#: ../../library/exceptions.rst:497 +msgid "" +"Added ``value`` attribute and the ability for generator functions to use it " +"to return a value." msgstr "" -msgid "Introduced the RuntimeError transformation via ``from __future__ import generator_stop``, see :pep:`479`." +#: ../../library/exceptions.rst:501 +msgid "" +"Introduced the RuntimeError transformation via ``from __future__ import " +"generator_stop``, see :pep:`479`." msgstr "" -msgid "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error raised in a generator is transformed into a :exc:`RuntimeError`." +#: ../../library/exceptions.rst:505 +msgid "" +"Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " +"raised in a generator is transformed into a :exc:`RuntimeError`." msgstr "" -msgid "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous iterator` object to stop the iteration." +#: ../../library/exceptions.rst:511 +msgid "" +"Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " +"iterator` object to stop the iteration." msgstr "" -msgid "Raised when the parser encounters a syntax error. This may occur in an :keyword:`import` statement, in a call to the built-in functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script or standard input (also interactively)." +#: ../../library/exceptions.rst:518 +msgid "" +"Raised when the parser encounters a syntax error. This may occur in " +"an :keyword:`import` statement, in a call to the built-in " +"functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading " +"the initial script or standard input (also interactively)." msgstr "" -msgid "The :func:`str` of the exception instance returns only the error message. Details is a tuple whose members are also available as separate attributes." +#: ../../library/exceptions.rst:524 +msgid "" +"The :func:`str` of the exception instance returns only the error message. " +"Details is a tuple whose members are also available as separate attributes." msgstr "" +#: ../../library/exceptions.rst:529 msgid "The name of the file the syntax error occurred in." msgstr "" -msgid "Which line number in the file the error occurred in. This is 1-indexed: the first line in the file has a ``lineno`` of 1." +#: ../../library/exceptions.rst:533 +msgid "" +"Which line number in the file the error occurred in. This is 1-indexed: the " +"first line in the file has a ``lineno`` of 1." msgstr "" -msgid "The column in the line where the error occurred. This is 1-indexed: the first character in the line has an ``offset`` of 1." +#: ../../library/exceptions.rst:538 +msgid "" +"The column in the line where the error occurred. This is 1-indexed: the " +"first character in the line has an ``offset`` of 1." msgstr "" +#: ../../library/exceptions.rst:543 msgid "The source code text involved in the error." msgstr "" -msgid "Which line number in the file the error occurred ends in. This is 1-indexed: the first line in the file has a ``lineno`` of 1." +#: ../../library/exceptions.rst:547 +msgid "" +"Which line number in the file the error occurred ends in. This is 1-indexed: " +"the first line in the file has a ``lineno`` of 1." msgstr "" -msgid "The column in the end line where the error occurred finishes. This is 1-indexed: the first character in the line has an ``offset`` of 1." +#: ../../library/exceptions.rst:552 +msgid "" +"The column in the end line where the error occurred finishes. This is 1-" +"indexed: the first character in the line has an ``offset`` of 1." msgstr "" -msgid "For errors in f-string fields, the message is prefixed by \"f-string: \" and the offsets are offsets in a text constructed from the replacement expression. For example, compiling f'Bad {a b} field' results in this args attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." +#: ../../library/exceptions.rst:555 +msgid "" +"For errors in f-string fields, the message is prefixed by \"f-string: \" and " +"the offsets are offsets in a text constructed from the replacement " +"expression. For example, compiling f'Bad {a b} field' results in this args " +"attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." msgstr "" +#: ../../library/exceptions.rst:560 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "" -msgid "Base class for syntax errors related to incorrect indentation. This is a subclass of :exc:`SyntaxError`." -msgstr "" - -msgid "Raised when indentation contains an inconsistent use of tabs and spaces. This is a subclass of :exc:`IndentationError`." +#: ../../library/exceptions.rst:565 +msgid "" +"Base class for syntax errors related to incorrect indentation. This is a " +"subclass of :exc:`SyntaxError`." msgstr "" -msgid "Raised when the interpreter finds an internal error, but the situation does not look so serious to cause it to abandon all hope. The associated value is a string indicating what went wrong (in low-level terms). In :term:`CPython`, this could be raised by incorrectly using Python's C API, such as returning a ``NULL`` value without an exception set." +#: ../../library/exceptions.rst:571 +msgid "" +"Raised when indentation contains an inconsistent use of tabs and spaces. " +"This is a subclass of :exc:`IndentationError`." msgstr "" -msgid "If you're confident that this exception wasn't your fault, or the fault of a package you're using, you should report this to the author or maintainer of your Python interpreter. Be sure to report the version of the Python interpreter (``sys.version``; it is also printed at the start of an interactive Python session), the exact error message (the exception's associated value) and if possible the source of the program that triggered the error." +#: ../../library/exceptions.rst:577 +msgid "" +"Raised when the interpreter finds an internal error, but the situation does " +"not look so serious to cause it to abandon all hope. The associated value is " +"a string indicating what went wrong (in low-level terms). " +"In :term:`CPython`, this could be raised by incorrectly using Python's C " +"API, such as returning a ``NULL`` value without an exception set." msgstr "" -msgid "This exception is raised by the :func:`sys.exit` function. It inherits from :exc:`BaseException` instead of :exc:`Exception` so that it is not accidentally caught by code that catches :exc:`Exception`. This allows the exception to properly propagate up and cause the interpreter to exit. When it is not handled, the Python interpreter exits; no stack traceback is printed. The constructor accepts the same optional argument passed to :func:`sys.exit`. If the value is an integer, it specifies the system exit status (passed to C's :c:func:`!exit` function); if it is ``None``, the exit status is zero; if it has another type (such as a string), the object's value is printed and the exit status is one." +#: ../../library/exceptions.rst:583 +msgid "" +"If you're confident that this exception wasn't your fault, or the fault of a " +"package you're using, you should report this to the author or maintainer of " +"your Python interpreter. Be sure to report the version of the Python " +"interpreter (``sys.version``; it is also printed at the start of an " +"interactive Python session), the exact error message (the exception's " +"associated value) and if possible the source of the program that triggered " +"the error." msgstr "" -msgid "A call to :func:`sys.exit` is translated into an exception so that clean-up handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be executed, and so that a debugger can execute a script without running the risk of losing control. The :func:`os._exit` function can be used if it is absolutely positively necessary to exit immediately (for example, in the child process after a call to :func:`os.fork`)." +#: ../../library/exceptions.rst:594 +msgid "" +"This exception is raised by the :func:`sys.exit` function. It inherits " +"from :exc:`BaseException` instead of :exc:`Exception` so that it is not " +"accidentally caught by code that catches :exc:`Exception`. This allows the " +"exception to properly propagate up and cause the interpreter to exit. When " +"it is not handled, the Python interpreter exits; no stack traceback is " +"printed. The constructor accepts the same optional argument passed " +"to :func:`sys.exit`. If the value is an integer, it specifies the system " +"exit status (passed to C's :c:func:`!exit` function); if it is ``None``, the " +"exit status is zero; if it has another type (such as a string), the object's " +"value is printed and the exit status is one." +msgstr "" + +#: ../../library/exceptions.rst:605 +msgid "" +"A call to :func:`sys.exit` is translated into an exception so that clean-up " +"handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " +"executed, and so that a debugger can execute a script without running the " +"risk of losing control. The :func:`os._exit` function can be used if it is " +"absolutely positively necessary to exit immediately (for example, in the " +"child process after a call to :func:`os.fork`)." msgstr "" -msgid "The exit status or error message that is passed to the constructor. (Defaults to ``None``.)" +#: ../../library/exceptions.rst:614 +msgid "" +"The exit status or error message that is passed to the constructor. " +"(Defaults to ``None``.)" msgstr "" -msgid "Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch." +#: ../../library/exceptions.rst:620 +msgid "" +"Raised when an operation or function is applied to an object of " +"inappropriate type. The associated value is a string giving details about " +"the type mismatch." msgstr "" -msgid "This exception may be raised by user code to indicate that an attempted operation on an object is not supported, and is not meant to be. If an object is meant to support a given operation but has not yet provided an implementation, :exc:`NotImplementedError` is the proper exception to raise." +#: ../../library/exceptions.rst:623 +msgid "" +"This exception may be raised by user code to indicate that an attempted " +"operation on an object is not supported, and is not meant to be. If an " +"object is meant to support a given operation but has not yet provided an " +"implementation, :exc:`NotImplementedError` is the proper exception to raise." msgstr "" -msgid "Passing arguments of the wrong type (e.g. passing a :class:`list` when an :class:`int` is expected) should result in a :exc:`TypeError`, but passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a :exc:`ValueError`." +#: ../../library/exceptions.rst:628 +msgid "" +"Passing arguments of the wrong type (e.g. passing a :class:`list` when " +"an :class:`int` is expected) should result in a :exc:`TypeError`, but " +"passing arguments with the wrong value (e.g. a number outside expected " +"boundaries) should result in a :exc:`ValueError`." msgstr "" -msgid "Raised when a reference is made to a local variable in a function or method, but no value has been bound to that variable. This is a subclass of :exc:`NameError`." +#: ../../library/exceptions.rst:635 +msgid "" +"Raised when a reference is made to a local variable in a function or method, " +"but no value has been bound to that variable. This is a subclass " +"of :exc:`NameError`." msgstr "" -msgid "Raised when a Unicode-related encoding or decoding error occurs. It is a subclass of :exc:`ValueError`." +#: ../../library/exceptions.rst:642 +msgid "" +"Raised when a Unicode-related encoding or decoding error occurs. It is a " +"subclass of :exc:`ValueError`." msgstr "" -msgid ":exc:`UnicodeError` has attributes that describe the encoding or decoding error. For example, ``err.object[err.start:err.end]`` gives the particular invalid input that the codec failed on." +#: ../../library/exceptions.rst:645 +msgid "" +":exc:`UnicodeError` has attributes that describe the encoding or decoding " +"error. For example, ``err.object[err.start:err.end]`` gives the particular " +"invalid input that the codec failed on." msgstr "" +#: ../../library/exceptions.rst:651 msgid "The name of the encoding that raised the error." msgstr "" +#: ../../library/exceptions.rst:655 msgid "A string describing the specific codec error." msgstr "" +#: ../../library/exceptions.rst:659 msgid "The object the codec was attempting to encode or decode." msgstr "" +#: ../../library/exceptions.rst:663 msgid "The first index of invalid data in :attr:`object`." msgstr "" -msgid "This value should not be negative as it is interpreted as an absolute offset but this constraint is not enforced at runtime." +#: ../../library/exceptions.rst:665 ../../library/exceptions.rst:672 +msgid "" +"This value should not be negative as it is interpreted as an absolute offset " +"but this constraint is not enforced at runtime." msgstr "" +#: ../../library/exceptions.rst:670 msgid "The index after the last invalid data in :attr:`object`." msgstr "" -msgid "Raised when a Unicode-related error occurs during encoding. It is a subclass of :exc:`UnicodeError`." +#: ../../library/exceptions.rst:678 +msgid "" +"Raised when a Unicode-related error occurs during encoding. It is a " +"subclass of :exc:`UnicodeError`." msgstr "" -msgid "Raised when a Unicode-related error occurs during decoding. It is a subclass of :exc:`UnicodeError`." +#: ../../library/exceptions.rst:684 +msgid "" +"Raised when a Unicode-related error occurs during decoding. It is a " +"subclass of :exc:`UnicodeError`." msgstr "" -msgid "Raised when a Unicode-related error occurs during translating. It is a subclass of :exc:`UnicodeError`." +#: ../../library/exceptions.rst:690 +msgid "" +"Raised when a Unicode-related error occurs during translating. It is a " +"subclass of :exc:`UnicodeError`." msgstr "" -msgid "Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as :exc:`IndexError`." +#: ../../library/exceptions.rst:696 +msgid "" +"Raised when an operation or function receives an argument that has the right " +"type but an inappropriate value, and the situation is not described by a " +"more precise exception such as :exc:`IndexError`." msgstr "" -msgid "Raised when the second argument of a division or modulo operation is zero. The associated value is a string indicating the type of the operands and the operation." +#: ../../library/exceptions.rst:703 +msgid "" +"Raised when the second argument of a division or modulo operation is zero. " +"The associated value is a string indicating the type of the operands and the " +"operation." msgstr "" -msgid "The following exceptions are kept for compatibility with previous versions; starting from Python 3.3, they are aliases of :exc:`OSError`." +#: ../../library/exceptions.rst:708 +msgid "" +"The following exceptions are kept for compatibility with previous versions; " +"starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" +#: ../../library/exceptions.rst:717 msgid "Only available on Windows." msgstr "" +#: ../../library/exceptions.rst:721 msgid "OS exceptions" msgstr "" -msgid "The following exceptions are subclasses of :exc:`OSError`, they get raised depending on the system error code." +#: ../../library/exceptions.rst:723 +msgid "" +"The following exceptions are subclasses of :exc:`OSError`, they get raised " +"depending on the system error code." msgstr "" -msgid "Raised when an operation would block on an object (e.g. socket) set for non-blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno.EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` and :py:const:`~errno.EINPROGRESS`." +#: ../../library/exceptions.rst:728 +msgid "" +"Raised when an operation would block on an object (e.g. socket) set for non-" +"blocking operation. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` " +"and :py:const:`~errno.EINPROGRESS`." msgstr "" -msgid "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one more attribute:" +#: ../../library/exceptions.rst:733 +msgid "" +"In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " +"more attribute:" msgstr "" -msgid "An integer containing the number of **bytes** written to the stream before it blocked. This attribute is available when using the buffered I/O classes from the :mod:`io` module." +#: ../../library/exceptions.rst:738 +msgid "" +"An integer containing the number of **bytes** written to the stream before " +"it blocked. This attribute is available when using the buffered I/O classes " +"from the :mod:`io` module." msgstr "" -msgid "Raised when an operation on a child process failed. Corresponds to :c:data:`errno` :py:const:`~errno.ECHILD`." +#: ../../library/exceptions.rst:744 +msgid "" +"Raised when an operation on a child process failed. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECHILD`." msgstr "" +#: ../../library/exceptions.rst:749 msgid "A base class for connection-related issues." msgstr "" -msgid "Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` and :exc:`ConnectionResetError`." +#: ../../library/exceptions.rst:751 +msgid "" +"Subclasses " +"are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " +"and :exc:`ConnectionResetError`." msgstr "" -msgid "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe while the other end has been closed, or trying to write on a socket which has been shutdown for writing. Corresponds to :c:data:`errno` :py:const:`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." +#: ../../library/exceptions.rst:756 +msgid "" +"A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " +"while the other end has been closed, or trying to write on a socket which " +"has been shutdown for writing. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" -msgid "A subclass of :exc:`ConnectionError`, raised when a connection attempt is aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." +#: ../../library/exceptions.rst:763 +msgid "" +"A subclass of :exc:`ConnectionError`, raised when a connection attempt is " +"aborted by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." msgstr "" -msgid "A subclass of :exc:`ConnectionError`, raised when a connection attempt is refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." +#: ../../library/exceptions.rst:769 +msgid "" +"A subclass of :exc:`ConnectionError`, raised when a connection attempt is " +"refused by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." msgstr "" -msgid "A subclass of :exc:`ConnectionError`, raised when a connection is reset by the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." +#: ../../library/exceptions.rst:775 +msgid "" +"A subclass of :exc:`ConnectionError`, raised when a connection is reset by " +"the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." msgstr "" -msgid "Raised when trying to create a file or directory which already exists. Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." +#: ../../library/exceptions.rst:781 +msgid "" +"Raised when trying to create a file or directory which already exists. " +"Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -msgid "Raised when a file or directory is requested but doesn't exist. Corresponds to :c:data:`errno` :py:const:`~errno.ENOENT`." +#: ../../library/exceptions.rst:786 +msgid "" +"Raised when a file or directory is requested but doesn't exist. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -msgid "Raised when a system call is interrupted by an incoming signal. Corresponds to :c:data:`errno` :py:const:`~errno.EINTR`." +#: ../../library/exceptions.rst:791 +msgid "" +"Raised when a system call is interrupted by an incoming signal. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -msgid "Python now retries system calls when a syscall is interrupted by a signal, except if the signal handler raises an exception (see :pep:`475` for the rationale), instead of raising :exc:`InterruptedError`." +#: ../../library/exceptions.rst:794 +msgid "" +"Python now retries system calls when a syscall is interrupted by a signal, " +"except if the signal handler raises an exception (see :pep:`475` for the " +"rationale), instead of raising :exc:`InterruptedError`." msgstr "" -msgid "Raised when a file operation (such as :func:`os.remove`) is requested on a directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." +#: ../../library/exceptions.rst:801 +msgid "" +"Raised when a file operation (such as :func:`os.remove`) is requested on a " +"directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." msgstr "" -msgid "Raised when a directory operation (such as :func:`os.listdir`) is requested on something which is not a directory. On most POSIX platforms, it may also be raised if an operation attempts to open or traverse a non-directory file as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno.ENOTDIR`." +#: ../../library/exceptions.rst:807 +msgid "" +"Raised when a directory operation (such as :func:`os.listdir`) is requested " +"on something which is not a directory. On most POSIX platforms, it may also " +"be raised if an operation attempts to open or traverse a non-directory file " +"as if it were a directory. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ENOTDIR`." msgstr "" -msgid "Raised when trying to run an operation without the adequate access rights - for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, and :py:const:`~errno.ENOTCAPABLE`." +#: ../../library/exceptions.rst:815 +msgid "" +"Raised when trying to run an operation without the adequate access rights - " +"for example filesystem permissions. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, " +"and :py:const:`~errno.ENOTCAPABLE`." msgstr "" -msgid "WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:`PermissionError`." +#: ../../library/exceptions.rst:820 +msgid "" +"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " +"to :exc:`PermissionError`." msgstr "" -msgid "Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :py:const:`~errno.ESRCH`." +#: ../../library/exceptions.rst:826 +msgid "" +"Raised when a given process doesn't exist. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ESRCH`." msgstr "" -msgid "Raised when a system function timed out at the system level. Corresponds to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." +#: ../../library/exceptions.rst:831 +msgid "" +"Raised when a system function timed out at the system level. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" +#: ../../library/exceptions.rst:834 msgid "All the above :exc:`OSError` subclasses were added." msgstr "" +#: ../../library/exceptions.rst:840 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr "" +#: ../../library/exceptions.rst:846 msgid "Warnings" msgstr "" -msgid "The following exceptions are used as warning categories; see the :ref:`warning-categories` documentation for more details." +#: ../../library/exceptions.rst:848 +msgid "" +"The following exceptions are used as warning categories; see " +"the :ref:`warning-categories` documentation for more details." msgstr "" +#: ../../library/exceptions.rst:853 msgid "Base class for warning categories." msgstr "" +#: ../../library/exceptions.rst:858 msgid "Base class for warnings generated by user code." msgstr "" -msgid "Base class for warnings about deprecated features when those warnings are intended for other Python developers." +#: ../../library/exceptions.rst:863 +msgid "" +"Base class for warnings about deprecated features when those warnings are " +"intended for other Python developers." msgstr "" -msgid "Ignored by the default warning filters, except in the ``__main__`` module (:pep:`565`). Enabling the :ref:`Python Development Mode ` shows this warning." +#: ../../library/exceptions.rst:866 +msgid "" +"Ignored by the default warning filters, except in the ``__main__`` module " +"(:pep:`565`). Enabling the :ref:`Python Development Mode ` shows " +"this warning." msgstr "" +#: ../../library/exceptions.rst:870 ../../library/exceptions.rst:886 msgid "The deprecation policy is described in :pep:`387`." msgstr "" -msgid "Base class for warnings about features which are obsolete and expected to be deprecated in the future, but are not deprecated at the moment." +#: ../../library/exceptions.rst:875 +msgid "" +"Base class for warnings about features which are obsolete and expected to be " +"deprecated in the future, but are not deprecated at the moment." msgstr "" -msgid "This class is rarely used as emitting a warning about a possible upcoming deprecation is unusual, and :exc:`DeprecationWarning` is preferred for already active deprecations." +#: ../../library/exceptions.rst:879 +msgid "" +"This class is rarely used as emitting a warning about a possible upcoming " +"deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " +"already active deprecations." msgstr "" -msgid "Ignored by the default warning filters. Enabling the :ref:`Python Development Mode ` shows this warning." +#: ../../library/exceptions.rst:883 ../../library/exceptions.rst:912 +#: ../../library/exceptions.rst:939 +msgid "" +"Ignored by the default warning filters. Enabling the :ref:`Python " +"Development Mode ` shows this warning." msgstr "" +#: ../../library/exceptions.rst:891 msgid "Base class for warnings about dubious syntax." msgstr "" -msgid "This warning is typically emitted when compiling Python source code, and usually won't be reported when running already compiled code." +#: ../../library/exceptions.rst:893 +msgid "" +"This warning is typically emitted when compiling Python source code, and " +"usually won't be reported when running already compiled code." msgstr "" +#: ../../library/exceptions.rst:899 msgid "Base class for warnings about dubious runtime behavior." msgstr "" -msgid "Base class for warnings about deprecated features when those warnings are intended for end users of applications that are written in Python." +#: ../../library/exceptions.rst:904 +msgid "" +"Base class for warnings about deprecated features when those warnings are " +"intended for end users of applications that are written in Python." msgstr "" +#: ../../library/exceptions.rst:910 msgid "Base class for warnings about probable mistakes in module imports." msgstr "" +#: ../../library/exceptions.rst:918 msgid "Base class for warnings related to Unicode." msgstr "" +#: ../../library/exceptions.rst:923 msgid "Base class for warnings related to encodings." msgstr "" +#: ../../library/exceptions.rst:925 msgid "See :ref:`io-encoding-warning` for details." msgstr "" -msgid "Base class for warnings related to :class:`bytes` and :class:`bytearray`." +#: ../../library/exceptions.rst:932 +msgid "" +"Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr "" +#: ../../library/exceptions.rst:937 msgid "Base class for warnings related to resource usage." msgstr "" +#: ../../library/exceptions.rst:948 msgid "Exception groups" msgstr "" -msgid "The following are used when it is necessary to raise multiple unrelated exceptions. They are part of the exception hierarchy so they can be handled with :keyword:`except` like all other exceptions. In addition, they are recognised by :keyword:`except*`, which matches their subgroups based on the types of the contained exceptions." +#: ../../library/exceptions.rst:950 +msgid "" +"The following are used when it is necessary to raise multiple unrelated " +"exceptions. They are part of the exception hierarchy so they can be handled " +"with :keyword:`except` like all other exceptions. In addition, they are " +"recognised by :keyword:`except*`, which matches their subgroups " +"based on the types of the contained exceptions." msgstr "" -msgid "Both of these exception types wrap the exceptions in the sequence ``excs``. The ``msg`` parameter must be a string. The difference between the two classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:`Exception` and it can only wrap subclasses of :exc:`Exception`. This design is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :exc:`BaseExceptionGroup`." +#: ../../library/exceptions.rst:959 +msgid "" +"Both of these exception types wrap the exceptions in the sequence ``excs``. " +"The ``msg`` parameter must be a string. The difference between the two " +"classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " +"it can wrap any exception, while :exc:`ExceptionGroup` " +"extends :exc:`Exception` and it can only wrap subclasses " +"of :exc:`Exception`. This design is so that ``except Exception`` catches " +"an :exc:`ExceptionGroup` but not :exc:`BaseExceptionGroup`." msgstr "" -msgid "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:`Exception` instances, so it can be used to make the selection automatic. The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:`TypeError` if any contained exception is not an :exc:`Exception` subclass." +#: ../../library/exceptions.rst:967 +msgid "" +"The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions " +"are :exc:`Exception` instances, so it can be used to make the selection " +"automatic. The :exc:`ExceptionGroup` constructor, on the other hand, raises " +"a :exc:`TypeError` if any contained exception is not an :exc:`Exception` " +"subclass." msgstr "" -msgid "Exception groups are :ref:`generic ` over the type of their contained exceptions." +#: ../../library/exceptions.rst:974 +msgid "" +"Exception groups are :ref:`generic ` over the type of their " +"contained exceptions." msgstr "" -msgid "The ``excs`` parameter may be any sequence, but lists and tuples are specifically processed more efficiently here. For optimal performance, pass a tuple as ``excs``." +#: ../../library/exceptions.rst:979 +msgid "" +"The ``excs`` parameter may be any sequence, but lists and tuples are " +"specifically processed more efficiently here. For optimal performance, pass " +"a tuple as ``excs``." msgstr "" +#: ../../library/exceptions.rst:985 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "" -msgid "A tuple of the exceptions in the ``excs`` sequence given to the constructor. This is a read-only attribute." +#: ../../library/exceptions.rst:989 +msgid "" +"A tuple of the exceptions in the ``excs`` sequence given to the constructor. " +"This is a read-only attribute." msgstr "" -msgid "Returns an exception group that contains only the exceptions from the current group that match *condition*, or ``None`` if the result is empty." +#: ../../library/exceptions.rst:994 +msgid "" +"Returns an exception group that contains only the exceptions from the " +"current group that match *condition*, or ``None`` if the result is empty." msgstr "" -msgid "The condition can be an exception type or tuple of exception types, in which case each exception is checked for a match using the same check that is used in an ``except`` clause. The condition can also be a callable (other than a type object) that accepts an exception as its single argument and returns true for the exceptions that should be in the subgroup." +#: ../../library/exceptions.rst:997 +msgid "" +"The condition can be an exception type or tuple of exception types, in which " +"case each exception is checked for a match using the same check that is used " +"in an ``except`` clause. The condition can also be a callable (other than a " +"type object) that accepts an exception as its single argument and returns " +"true for the exceptions that should be in the subgroup." msgstr "" -msgid "The nesting structure of the current exception is preserved in the result, as are the values of its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` and :attr:`~BaseException.__notes__` fields. Empty nested groups are omitted from the result." +#: ../../library/exceptions.rst:1003 +msgid "" +"The nesting structure of the current exception is preserved in the result, " +"as are the values of " +"its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields. Empty nested groups are omitted " +"from the result." msgstr "" -msgid "The condition is checked for all exceptions in the nested exception group, including the top-level and any nested exception groups. If the condition is true for such an exception group, it is included in the result in full." +#: ../../library/exceptions.rst:1010 +msgid "" +"The condition is checked for all exceptions in the nested exception group, " +"including the top-level and any nested exception groups. If the condition is " +"true for such an exception group, it is included in the result in full." msgstr "" +#: ../../library/exceptions.rst:1014 msgid "``condition`` can be any callable which is not a type object." msgstr "" -msgid "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where ``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-matching part." +#: ../../library/exceptions.rst:1019 +msgid "" +"Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " +"``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" +"matching part." msgstr "" -msgid "Returns an exception group with the same :attr:`message`, but which wraps the exceptions in ``excs``." +#: ../../library/exceptions.rst:1025 +msgid "" +"Returns an exception group with the same :attr:`message`, but which wraps " +"the exceptions in ``excs``." msgstr "" -msgid "This method is used by :meth:`subgroup` and :meth:`split`, which are used in various contexts to break up an exception group. A subclass needs to override it in order to make :meth:`subgroup` and :meth:`split` return instances of the subclass rather than :exc:`ExceptionGroup`." +#: ../../library/exceptions.rst:1028 +msgid "" +"This method is used by :meth:`subgroup` and :meth:`split`, which are used in " +"various contexts to break up an exception group. A subclass needs to " +"override it in order to make :meth:`subgroup` and :meth:`split` return " +"instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" -msgid ":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` and :attr:`~BaseException.__notes__` fields from the original exception group to the one returned by :meth:`derive`, so these fields do not need to be updated by :meth:`derive`." +#: ../../library/exceptions.rst:1034 +msgid "" +":meth:`subgroup` and :meth:`split` copy " +"the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields from the original exception " +"group to the one returned by :meth:`derive`, so these fields do not need to " +"be updated by :meth:`derive`." msgstr "" +#: ../../library/exceptions.rst:1041 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -598,18 +1230,28 @@ msgid "" "...\n" ">>> match, rest = exc.split(ValueError)\n" ">>> exc, exc.__context__, exc.__cause__, exc.__notes__\n" -"(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])\n" +"(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), " +"Exception('cause'), ['a note'])\n" ">>> match, match.__context__, match.__cause__, match.__notes__\n" -"(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), ['a note'])\n" +"(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), " +"['a note'])\n" ">>> rest, rest.__context__, rest.__cause__, rest.__notes__\n" -"(MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])\n" +"(MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), " +"['a note'])\n" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" msgstr "" -msgid "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so subclasses that need a different constructor signature need to override that rather than :meth:`~object.__init__`. For example, the following defines an exception group subclass which accepts an exit_code and constructs the group's message from it. ::" +#: ../../library/exceptions.rst:1067 +msgid "" +"Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " +"subclasses that need a different constructor signature need to override that " +"rather than :meth:`~object.__init__`. For example, the following defines an " +"exception group subclass which accepts an exit_code and constructs the " +"group's message from it. ::" msgstr "" +#: ../../library/exceptions.rst:1073 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -621,47 +1263,138 @@ msgid "" " return Errors(excs, self.exit_code)" msgstr "" -msgid "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which is also a subclass of :exc:`Exception` can only wrap instances of :exc:`Exception`." +#: ../../library/exceptions.rst:1082 +msgid "" +"Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " +"is also a subclass of :exc:`Exception` can only wrap instances " +"of :exc:`Exception`." msgstr "" +#: ../../library/exceptions.rst:1090 msgid "Exception hierarchy" msgstr "" +#: ../../library/exceptions.rst:1092 msgid "The class hierarchy for built-in exceptions is:" msgstr "" +#: ../../library/exceptions.rst:1094 +msgid "" +"BaseException\n" +" ├── BaseExceptionGroup\n" +" ├── GeneratorExit\n" +" ├── KeyboardInterrupt\n" +" ├── SystemExit\n" +" └── Exception\n" +" ├── ArithmeticError\n" +" │ ├── FloatingPointError\n" +" │ ├── OverflowError\n" +" │ └── ZeroDivisionError\n" +" ├── AssertionError\n" +" ├── AttributeError\n" +" ├── BufferError\n" +" ├── EOFError\n" +" ├── ExceptionGroup [BaseExceptionGroup]\n" +" ├── ImportError\n" +" │ └── ModuleNotFoundError\n" +" ├── LookupError\n" +" │ ├── IndexError\n" +" │ └── KeyError\n" +" ├── MemoryError\n" +" ├── NameError\n" +" │ └── UnboundLocalError\n" +" ├── OSError\n" +" │ ├── BlockingIOError\n" +" │ ├── ChildProcessError\n" +" │ ├── ConnectionError\n" +" │ │ ├── BrokenPipeError\n" +" │ │ ├── ConnectionAbortedError\n" +" │ │ ├── ConnectionRefusedError\n" +" │ │ └── ConnectionResetError\n" +" │ ├── FileExistsError\n" +" │ ├── FileNotFoundError\n" +" │ ├── InterruptedError\n" +" │ ├── IsADirectoryError\n" +" │ ├── NotADirectoryError\n" +" │ ├── PermissionError\n" +" │ ├── ProcessLookupError\n" +" │ └── TimeoutError\n" +" ├── ReferenceError\n" +" ├── RuntimeError\n" +" │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" +" │ └── RecursionError\n" +" ├── StopAsyncIteration\n" +" ├── StopIteration\n" +" ├── SyntaxError\n" +" │ └── IndentationError\n" +" │ └── TabError\n" +" ├── SystemError\n" +" ├── TypeError\n" +" ├── ValueError\n" +" │ └── UnicodeError\n" +" │ ├── UnicodeDecodeError\n" +" │ ├── UnicodeEncodeError\n" +" │ └── UnicodeTranslateError\n" +" └── Warning\n" +" ├── BytesWarning\n" +" ├── DeprecationWarning\n" +" ├── EncodingWarning\n" +" ├── FutureWarning\n" +" ├── ImportWarning\n" +" ├── PendingDeprecationWarning\n" +" ├── ResourceWarning\n" +" ├── RuntimeWarning\n" +" ├── SyntaxWarning\n" +" ├── UnicodeWarning\n" +" └── UserWarning\n" +msgstr "" + +#: ../../library/exceptions.rst:6 ../../library/exceptions.rst:17 +#: ../../library/exceptions.rst:196 msgid "statement" msgstr "" +#: ../../library/exceptions.rst:6 msgid "try" msgstr "" +#: ../../library/exceptions.rst:6 msgid "except" msgstr "" +#: ../../library/exceptions.rst:17 msgid "raise" msgstr "" +#: ../../library/exceptions.rst:41 msgid "exception" msgstr "" +#: ../../library/exceptions.rst:41 msgid "chaining" msgstr "" +#: ../../library/exceptions.rst:41 msgid "__cause__ (exception attribute)" msgstr "" +#: ../../library/exceptions.rst:41 msgid "__context__ (exception attribute)" msgstr "" +#: ../../library/exceptions.rst:41 msgid "__suppress_context__ (exception attribute)" msgstr "" +#: ../../library/exceptions.rst:196 msgid "assert" msgstr "" +#: ../../library/exceptions.rst:355 msgid "module" msgstr "" +#: ../../library/exceptions.rst:355 msgid "errno" msgstr "" diff --git a/library/faulthandler.po b/library/faulthandler.po index 68625edc7..4fe7576b5 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:05+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,162 +24,301 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/faulthandler.rst:2 msgid ":mod:`!faulthandler` --- Dump the Python traceback" msgstr "" -msgid "This module contains functions to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. Call :func:`faulthandler.enable` to install fault handlers for the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, and :const:`~signal.SIGILL` signals. You can also enable them at startup by setting the :envvar:`PYTHONFAULTHANDLER` environment variable or by using the :option:`-X` ``faulthandler`` command line option." +#: ../../library/faulthandler.rst:11 +msgid "" +"This module contains functions to dump Python tracebacks explicitly, on a " +"fault, after a timeout, or on a user signal. " +"Call :func:`faulthandler.enable` to install fault handlers for " +"the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, " +"and :const:`~signal.SIGILL` signals. You can also enable them at startup by " +"setting the :envvar:`PYTHONFAULTHANDLER` environment variable or by using " +"the :option:`-X` ``faulthandler`` command line option." msgstr "" -msgid "The fault handler is compatible with system fault handlers like Apport or the Windows fault handler. The module uses an alternative stack for signal handlers if the :c:func:`!sigaltstack` function is available. This allows it to dump the traceback even on a stack overflow." +#: ../../library/faulthandler.rst:19 +msgid "" +"The fault handler is compatible with system fault handlers like Apport or " +"the Windows fault handler. The module uses an alternative stack for signal " +"handlers if the :c:func:`!sigaltstack` function is available. This allows it " +"to dump the traceback even on a stack overflow." msgstr "" -msgid "The fault handler is called on catastrophic cases and therefore can only use signal-safe functions (e.g. it cannot allocate memory on the heap). Because of this limitation traceback dumping is minimal compared to normal Python tracebacks:" +#: ../../library/faulthandler.rst:24 +msgid "" +"The fault handler is called on catastrophic cases and therefore can only use " +"signal-safe functions (e.g. it cannot allocate memory on the heap). Because " +"of this limitation traceback dumping is minimal compared to normal Python " +"tracebacks:" msgstr "" -msgid "Only ASCII is supported. The ``backslashreplace`` error handler is used on encoding." +#: ../../library/faulthandler.rst:29 +msgid "" +"Only ASCII is supported. The ``backslashreplace`` error handler is used on " +"encoding." msgstr "" +#: ../../library/faulthandler.rst:31 msgid "Each string is limited to 500 characters." msgstr "" -msgid "Only the filename, the function name and the line number are displayed. (no source code)" +#: ../../library/faulthandler.rst:32 +msgid "" +"Only the filename, the function name and the line number are displayed. (no " +"source code)" msgstr "" +#: ../../library/faulthandler.rst:34 msgid "It is limited to 100 frames and 100 threads." msgstr "" +#: ../../library/faulthandler.rst:35 msgid "The order is reversed: the most recent call is shown first." msgstr "" -msgid "By default, the Python traceback is written to :data:`sys.stderr`. To see tracebacks, applications must be run in the terminal. A log file can alternatively be passed to :func:`faulthandler.enable`." +#: ../../library/faulthandler.rst:37 +msgid "" +"By default, the Python traceback is written to :data:`sys.stderr`. To see " +"tracebacks, applications must be run in the terminal. A log file can " +"alternatively be passed to :func:`faulthandler.enable`." msgstr "" -msgid "The module is implemented in C, so tracebacks can be dumped on a crash or when Python is deadlocked." +#: ../../library/faulthandler.rst:41 +msgid "" +"The module is implemented in C, so tracebacks can be dumped on a crash or " +"when Python is deadlocked." msgstr "" -msgid "The :ref:`Python Development Mode ` calls :func:`faulthandler.enable` at Python startup." +#: ../../library/faulthandler.rst:44 +msgid "" +"The :ref:`Python Development Mode ` " +"calls :func:`faulthandler.enable` at Python startup." msgstr "" +#: ../../library/faulthandler.rst:49 msgid "Module :mod:`pdb`" msgstr "" +#: ../../library/faulthandler.rst:50 msgid "Interactive source code debugger for Python programs." msgstr "" +#: ../../library/faulthandler.rst:52 msgid "Module :mod:`traceback`" msgstr "" -msgid "Standard interface to extract, format and print stack traces of Python programs." +#: ../../library/faulthandler.rst:53 +msgid "" +"Standard interface to extract, format and print stack traces of Python " +"programs." msgstr "" +#: ../../library/faulthandler.rst:56 msgid "Dumping the traceback" msgstr "" -msgid "Dump the tracebacks of all threads into *file*. If *all_threads* is ``False``, dump only the current thread." +#: ../../library/faulthandler.rst:60 +msgid "" +"Dump the tracebacks of all threads into *file*. If *all_threads* is " +"``False``, dump only the current thread." msgstr "" -msgid ":func:`traceback.print_tb`, which can be used to print a traceback object." +#: ../../library/faulthandler.rst:63 +msgid "" +":func:`traceback.print_tb`, which can be used to print a traceback object." msgstr "" +#: ../../library/faulthandler.rst:65 ../../library/faulthandler.rst:119 +#: ../../library/faulthandler.rst:165 ../../library/faulthandler.rst:190 msgid "Added support for passing file descriptor to this function." msgstr "" +#: ../../library/faulthandler.rst:70 msgid "Dumping the C stack" msgstr "" +#: ../../library/faulthandler.rst:76 msgid "Dump the C stack trace of the current thread into *file*." msgstr "" -msgid "If the Python build does not support it or the operating system does not provide a stack trace, then this prints an error in place of a dumped C stack." +#: ../../library/faulthandler.rst:78 +msgid "" +"If the Python build does not support it or the operating system does not " +"provide a stack trace, then this prints an error in place of a dumped C " +"stack." msgstr "" +#: ../../library/faulthandler.rst:85 msgid "C Stack Compatibility" msgstr "" -msgid "If the system does not support the C-level :manpage:`backtrace(3)` or :manpage:`dladdr1(3)`, then C stack dumps will not work. An error will be printed instead of the stack." +#: ../../library/faulthandler.rst:87 +msgid "" +"If the system does not support the C-level :manpage:`backtrace(3)` " +"or :manpage:`dladdr1(3)`, then C stack dumps will not work. An error will be " +"printed instead of the stack." msgstr "" -msgid "Additionally, some compilers do not support :term:`CPython's ` implementation of C stack dumps. As a result, a different error may be printed instead of the stack, even if the operating system supports dumping stacks." +#: ../../library/faulthandler.rst:91 +msgid "" +"Additionally, some compilers do not support :term:`CPython's ` " +"implementation of C stack dumps. As a result, a different error may be " +"printed instead of the stack, even if the operating system supports dumping " +"stacks." msgstr "" -msgid "Dumping C stacks can be arbitrarily slow, depending on the DWARF level of the binaries in the call stack." +#: ../../library/faulthandler.rst:97 +msgid "" +"Dumping C stacks can be arbitrarily slow, depending on the DWARF level of " +"the binaries in the call stack." msgstr "" +#: ../../library/faulthandler.rst:101 msgid "Fault handler state" msgstr "" -msgid "Enable the fault handler: install handlers for the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python traceback. If *all_threads* is ``True``, produce tracebacks for every running thread. Otherwise, dump only the current thread." +#: ../../library/faulthandler.rst:105 +msgid "" +"Enable the fault handler: install handlers for " +"the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` " +"and :const:`~signal.SIGILL` signals to dump the Python traceback. If " +"*all_threads* is ``True``, produce tracebacks for every running thread. " +"Otherwise, dump only the current thread." msgstr "" -msgid "The *file* must be kept open until the fault handler is disabled: see :ref:`issue with file descriptors `." +#: ../../library/faulthandler.rst:112 +msgid "" +"The *file* must be kept open until the fault handler is disabled: " +"see :ref:`issue with file descriptors `." msgstr "" -msgid "If *c_stack* is ``True``, then the C stack trace is printed after the Python traceback, unless the system does not support it. See :func:`dump_c_stack` for more information on compatibility." +#: ../../library/faulthandler.rst:115 +msgid "" +"If *c_stack* is ``True``, then the C stack trace is printed after the Python " +"traceback, unless the system does not support it. See :func:`dump_c_stack` " +"for more information on compatibility." msgstr "" +#: ../../library/faulthandler.rst:122 msgid "On Windows, a handler for Windows exception is also installed." msgstr "" -msgid "The dump now mentions if a garbage collector collection is running if *all_threads* is true." +#: ../../library/faulthandler.rst:125 +msgid "" +"The dump now mentions if a garbage collector collection is running if " +"*all_threads* is true." msgstr "" -msgid "Only the current thread is dumped if the :term:`GIL` is disabled to prevent the risk of data races." +#: ../../library/faulthandler.rst:129 +msgid "" +"Only the current thread is dumped if the :term:`GIL` is disabled to prevent " +"the risk of data races." msgstr "" +#: ../../library/faulthandler.rst:133 msgid "The dump now displays the C stack trace if *c_stack* is true." msgstr "" -msgid "Disable the fault handler: uninstall the signal handlers installed by :func:`enable`." +#: ../../library/faulthandler.rst:138 +msgid "" +"Disable the fault handler: uninstall the signal handlers installed " +"by :func:`enable`." msgstr "" +#: ../../library/faulthandler.rst:143 msgid "Check if the fault handler is enabled." msgstr "" +#: ../../library/faulthandler.rst:147 msgid "Dumping the tracebacks after a timeout" msgstr "" -msgid "Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, call :c:func:`!_exit` with status=1 after dumping the tracebacks. (Note :c:func:`!_exit` exits the process immediately, which means it doesn't do any cleanup like flushing file buffers.) If the function is called twice, the new call replaces previous parameters and resets the timeout. The timer has a sub-second resolution." +#: ../../library/faulthandler.rst:151 +msgid "" +"Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or " +"every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, " +"call :c:func:`!_exit` with status=1 after dumping the tracebacks. " +"(Note :c:func:`!_exit` exits the process immediately, which means it doesn't " +"do any cleanup like flushing file buffers.) If the function is called twice, " +"the new call replaces previous parameters and resets the timeout. The timer " +"has a sub-second resolution." msgstr "" -msgid "The *file* must be kept open until the traceback is dumped or :func:`cancel_dump_traceback_later` is called: see :ref:`issue with file descriptors `." +#: ../../library/faulthandler.rst:159 +msgid "" +"The *file* must be kept open until the traceback is dumped " +"or :func:`cancel_dump_traceback_later` is called: see :ref:`issue with file " +"descriptors `." msgstr "" +#: ../../library/faulthandler.rst:163 msgid "This function is implemented using a watchdog thread." msgstr "" +#: ../../library/faulthandler.rst:168 msgid "This function is now always available." msgstr "" +#: ../../library/faulthandler.rst:173 msgid "Cancel the last call to :func:`dump_traceback_later`." msgstr "" +#: ../../library/faulthandler.rst:177 msgid "Dumping the traceback on a user signal" msgstr "" -msgid "Register a user signal: install a handler for the *signum* signal to dump the traceback of all threads, or of the current thread if *all_threads* is ``False``, into *file*. Call the previous handler if chain is ``True``." +#: ../../library/faulthandler.rst:181 +msgid "" +"Register a user signal: install a handler for the *signum* signal to dump " +"the traceback of all threads, or of the current thread if *all_threads* is " +"``False``, into *file*. Call the previous handler if chain is ``True``." msgstr "" -msgid "The *file* must be kept open until the signal is unregistered by :func:`unregister`: see :ref:`issue with file descriptors `." +#: ../../library/faulthandler.rst:185 +msgid "" +"The *file* must be kept open until the signal is unregistered " +"by :func:`unregister`: see :ref:`issue with file descriptors `." msgstr "" +#: ../../library/faulthandler.rst:188 ../../library/faulthandler.rst:199 msgid "Not available on Windows." msgstr "" -msgid "Unregister a user signal: uninstall the handler of the *signum* signal installed by :func:`register`. Return ``True`` if the signal was registered, ``False`` otherwise." +#: ../../library/faulthandler.rst:195 +msgid "" +"Unregister a user signal: uninstall the handler of the *signum* signal " +"installed by :func:`register`. Return ``True`` if the signal was registered, " +"``False`` otherwise." msgstr "" +#: ../../library/faulthandler.rst:205 msgid "Issue with file descriptors" msgstr "" -msgid ":func:`enable`, :func:`dump_traceback_later` and :func:`register` keep the file descriptor of their *file* argument. If the file is closed and its file descriptor is reused by a new file, or if :func:`os.dup2` is used to replace the file descriptor, the traceback will be written into a different file. Call these functions again each time that the file is replaced." +#: ../../library/faulthandler.rst:207 +msgid "" +":func:`enable`, :func:`dump_traceback_later` and :func:`register` keep the " +"file descriptor of their *file* argument. If the file is closed and its file " +"descriptor is reused by a new file, or if :func:`os.dup2` is used to replace " +"the file descriptor, the traceback will be written into a different file. " +"Call these functions again each time that the file is replaced." msgstr "" +#: ../../library/faulthandler.rst:215 msgid "Example" msgstr "" -msgid "Example of a segmentation fault on Linux with and without enabling the fault handler:" +#: ../../library/faulthandler.rst:217 +msgid "" +"Example of a segmentation fault on Linux with and without enabling the fault " +"handler:" msgstr "" +#: ../../library/faulthandler.rst:220 msgid "" "$ python -c \"import ctypes; ctypes.string_at(0)\"\n" "Segmentation fault\n" @@ -194,34 +333,45 @@ msgid "" " File \"\", line 1 in \n" "\n" "Current thread's C stack trace (most recent call first):\n" -" Binary file \"/opt/python/python\", at _Py_DumpStack+0x42 [0x5b27f7d7147e]\n" +" Binary file \"/opt/python/python\", at _Py_DumpStack+0x42 " +"[0x5b27f7d7147e]\n" " Binary file \"/opt/python/python\", at +0x32dcbd [0x5b27f7d85cbd]\n" " Binary file \"/opt/python/python\", at +0x32df8a [0x5b27f7d85f8a]\n" " Binary file \"/usr/lib/libc.so.6\", at +0x3def0 [0x77b73226bef0]\n" " Binary file \"/usr/lib/libc.so.6\", at +0x17ef9c [0x77b7323acf9c]\n" -" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so\", at +0xcdf6 [0x77b7315dddf6]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0xcdf6 [0x77b7315dddf6]\n" " Binary file \"/usr/lib/libffi.so.8\", at +0x7976 [0x77b73158f976]\n" " Binary file \"/usr/lib/libffi.so.8\", at +0x413c [0x77b73158c13c]\n" " Binary file \"/usr/lib/libffi.so.8\", at ffi_call+0x12e [0x77b73158ef0e]\n" -" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so\", at +0x15a33 [0x77b7315e6a33]\n" -" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so\", at +0x164fa [0x77b7315e74fa]\n" -" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-x86_64-linux-gnu.so\", at +0xc624 [0x77b7315dd624]\n" -" Binary file \"/opt/python/python\", at _PyObject_MakeTpCall+0xce [0x5b27f7b73883]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0x15a33 [0x77b7315e6a33]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0x164fa [0x77b7315e74fa]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0xc624 [0x77b7315dd624]\n" +" Binary file \"/opt/python/python\", at _PyObject_MakeTpCall+0xce " +"[0x5b27f7b73883]\n" " Binary file \"/opt/python/python\", at +0x11bab6 [0x5b27f7b73ab6]\n" -" Binary file \"/opt/python/python\", at PyObject_Vectorcall+0x23 [0x5b27f7b73b04]\n" -" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x490c [0x5b27f7cbb302]\n" +" Binary file \"/opt/python/python\", at PyObject_Vectorcall+0x23 " +"[0x5b27f7b73b04]\n" +" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x490c " +"[0x5b27f7cbb302]\n" " Binary file \"/opt/python/python\", at +0x2818e6 [0x5b27f7cd98e6]\n" " Binary file \"/opt/python/python\", at +0x281aab [0x5b27f7cd9aab]\n" -" Binary file \"/opt/python/python\", at PyEval_EvalCode+0xc5 [0x5b27f7cd9ba3]\n" +" Binary file \"/opt/python/python\", at PyEval_EvalCode+0xc5 " +"[0x5b27f7cd9ba3]\n" " Binary file \"/opt/python/python\", at +0x255957 [0x5b27f7cad957]\n" " Binary file \"/opt/python/python\", at +0x255ab4 [0x5b27f7cadab4]\n" -" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x6c3e [0x5b27f7cbd634]\n" +" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x6c3e " +"[0x5b27f7cbd634]\n" " Binary file \"/opt/python/python\", at +0x2818e6 [0x5b27f7cd98e6]\n" " Binary file \"/opt/python/python\", at +0x281aab [0x5b27f7cd9aab]\n" " Binary file \"/opt/python/python\", at +0x11b6e1 [0x5b27f7b736e1]\n" " Binary file \"/opt/python/python\", at +0x11d348 [0x5b27f7b75348]\n" " Binary file \"/opt/python/python\", at +0x11d626 [0x5b27f7b75626]\n" -" Binary file \"/opt/python/python\", at PyObject_Call+0x20 [0x5b27f7b7565e]\n" +" Binary file \"/opt/python/python\", at PyObject_Call+0x20 " +"[0x5b27f7b7565e]\n" " Binary file \"/opt/python/python\", at +0x32a67a [0x5b27f7d8267a]\n" " Binary file \"/opt/python/python\", at +0x32a7f8 [0x5b27f7d827f8]\n" " Binary file \"/opt/python/python\", at +0x32ac1b [0x5b27f7d82c1b]\n" diff --git a/library/fcntl.po b/library/fcntl.po index a5e853fc0..c9f559332 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,90 +23,219 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/fcntl.rst:2 msgid ":mod:`!fcntl` --- The ``fcntl`` and ``ioctl`` system calls" msgstr "" -msgid "This module performs file and I/O control on file descriptors. It is an interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. See the :manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages for full details." +#: ../../library/fcntl.rst:15 +msgid "" +"This module performs file and I/O control on file descriptors. It is an " +"interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. See " +"the :manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages for full " +"details." msgstr "" +#: ../../library/fcntl.rst:20 msgid "Availability" msgstr "" -msgid "All functions in this module take a file descriptor *fd* as their first argument. This can be an integer file descriptor, such as returned by ``sys.stdin.fileno()``, or an :class:`io.IOBase` object, such as ``sys.stdin`` itself, which provides a :meth:`~io.IOBase.fileno` that returns a genuine file descriptor." -msgstr "" - -msgid "Operations in this module used to raise an :exc:`IOError` where they now raise an :exc:`OSError`." +#: ../../library/fcntl.rst:22 +msgid "" +"All functions in this module take a file descriptor *fd* as their first " +"argument. This can be an integer file descriptor, such as returned by " +"``sys.stdin.fileno()``, or an :class:`io.IOBase` object, such as " +"``sys.stdin`` itself, which provides a :meth:`~io.IOBase.fileno` that " +"returns a genuine file descriptor." msgstr "" -msgid "The :mod:`!fcntl` module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and ``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file descriptors." +#: ../../library/fcntl.rst:28 +msgid "" +"Operations in this module used to raise an :exc:`IOError` where they now " +"raise an :exc:`OSError`." msgstr "" -msgid "On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which obtains the path of a file from a file descriptor. On Linux(>=3.15), the :mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and ``F_OFD_SETLKW`` constants, which are used when working with open file description locks." +#: ../../library/fcntl.rst:32 +msgid "" +"The :mod:`!fcntl` module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " +"``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file " +"descriptors." msgstr "" -msgid "On Linux >= 2.6.11, the :mod:`!fcntl` module exposes the ``F_GETPIPE_SZ`` and ``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's size respectively." +#: ../../library/fcntl.rst:37 +msgid "" +"On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which " +"obtains the path of a file from a file descriptor. On Linux(>=3.15), " +"the :mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " +"``F_OFD_SETLKW`` constants, which are used when working with open file " +"description locks." msgstr "" -msgid "On FreeBSD, the :mod:`!fcntl` module exposes the ``F_DUP2FD`` and ``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, the latter setting ``FD_CLOEXEC`` flag in addition." +#: ../../library/fcntl.rst:44 +msgid "" +"On Linux >= 2.6.11, the :mod:`!fcntl` module exposes the ``F_GETPIPE_SZ`` " +"and ``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's " +"size respectively." msgstr "" -msgid "On Linux >= 4.5, the :mod:`!fcntl` module exposes the ``FICLONE`` and ``FICLONERANGE`` constants, which allow to share some data of one file with another file by reflinking on some filesystems (e.g., btrfs, OCFS2, and XFS). This behavior is commonly referred to as \"copy-on-write\"." +#: ../../library/fcntl.rst:49 +msgid "" +"On FreeBSD, the :mod:`!fcntl` module exposes the ``F_DUP2FD`` and " +"``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, " +"the latter setting ``FD_CLOEXEC`` flag in addition." msgstr "" -msgid "On Linux >= 2.6.32, the :mod:`!fcntl` module exposes the ``F_GETOWN_EX``, ``F_SETOWN_EX``, ``F_OWNER_TID``, ``F_OWNER_PID``, ``F_OWNER_PGRP`` constants, which allow to direct I/O availability signals to a specific thread, process, or process group. On Linux >= 4.13, the :mod:`!fcntl` module exposes the ``F_GET_RW_HINT``, ``F_SET_RW_HINT``, ``F_GET_FILE_RW_HINT``, ``F_SET_FILE_RW_HINT``, and ``RWH_WRITE_LIFE_*`` constants, which allow to inform the kernel about the relative expected lifetime of writes on a given inode or via a particular open file description. On Linux >= 5.1 and NetBSD, the :mod:`!fcntl` module exposes the ``F_SEAL_FUTURE_WRITE`` constant for use with ``F_ADD_SEALS`` and ``F_GET_SEALS`` operations. On FreeBSD, the :mod:`!fcntl` module exposes the ``F_READAHEAD``, ``F_ISUNIONSTACK``, and ``F_KINFO`` constants. On macOS and FreeBSD, the :mod:`!fcntl` module exposes the ``F_RDAHEAD`` constant. On NetBSD and AIX, the :mod:`!fcntl` module exposes the ``F_CLOSEM`` constant. On NetBSD, the :mod:`!fcntl` module exposes the ``F_MAXFD`` constant. On macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` and ``F_SETNOSIGPIPE`` constant." +#: ../../library/fcntl.rst:54 +msgid "" +"On Linux >= 4.5, the :mod:`!fcntl` module exposes the ``FICLONE`` and " +"``FICLONERANGE`` constants, which allow to share some data of one file with " +"another file by reflinking on some filesystems (e.g., btrfs, OCFS2, and " +"XFS). This behavior is commonly referred to as \"copy-on-write\"." msgstr "" -msgid "On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY`` to query a file descriptor pointing to the same file." +#: ../../library/fcntl.rst:60 +msgid "" +"On Linux >= 2.6.32, the :mod:`!fcntl` module exposes the ``F_GETOWN_EX``, " +"``F_SETOWN_EX``, ``F_OWNER_TID``, ``F_OWNER_PID``, ``F_OWNER_PGRP`` " +"constants, which allow to direct I/O availability signals to a specific " +"thread, process, or process group. On Linux >= 4.13, the :mod:`!fcntl` " +"module exposes the ``F_GET_RW_HINT``, ``F_SET_RW_HINT``, " +"``F_GET_FILE_RW_HINT``, ``F_SET_FILE_RW_HINT``, and ``RWH_WRITE_LIFE_*`` " +"constants, which allow to inform the kernel about the relative expected " +"lifetime of writes on a given inode or via a particular open file " +"description. On Linux >= 5.1 and NetBSD, the :mod:`!fcntl` module exposes " +"the ``F_SEAL_FUTURE_WRITE`` constant for use with ``F_ADD_SEALS`` and " +"``F_GET_SEALS`` operations. On FreeBSD, the :mod:`!fcntl` module exposes the " +"``F_READAHEAD``, ``F_ISUNIONSTACK``, and ``F_KINFO`` constants. On macOS and " +"FreeBSD, the :mod:`!fcntl` module exposes the ``F_RDAHEAD`` constant. On " +"NetBSD and AIX, the :mod:`!fcntl` module exposes the ``F_CLOSEM`` constant. " +"On NetBSD, the :mod:`!fcntl` module exposes the ``F_MAXFD`` constant. On " +"macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` " +"and ``F_SETNOSIGPIPE`` constant." +msgstr "" + +#: ../../library/fcntl.rst:81 +msgid "" +"On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY`` to " +"query a file descriptor pointing to the same file." msgstr "" +#: ../../library/fcntl.rst:85 msgid "The module defines the following functions:" msgstr "" -msgid "Perform the operation *cmd* on file descriptor *fd* (file objects providing a :meth:`~io.IOBase.fileno` method are accepted as well). The values used for *cmd* are operating system dependent, and are available as constants in the :mod:`!fcntl` module, using the same names as used in the relevant C header files. The argument *arg* can either be an integer value, a :term:`bytes-like object`, or a string. The type and size of *arg* must match the type and size of the argument of the operation as specified in the relevant C documentation." +#: ../../library/fcntl.rst:90 +msgid "" +"Perform the operation *cmd* on file descriptor *fd* (file objects providing " +"a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " +"for *cmd* are operating system dependent, and are available as constants in " +"the :mod:`!fcntl` module, using the same names as used in the relevant C " +"header files. The argument *arg* can either be an integer value, " +"a :term:`bytes-like object`, or a string. The type and size of *arg* must " +"match the type and size of the argument of the operation as specified in the " +"relevant C documentation." msgstr "" -msgid "When *arg* is an integer, the function returns the integer return value of the C :c:func:`fcntl` call." +#: ../../library/fcntl.rst:99 +msgid "" +"When *arg* is an integer, the function returns the integer return value of " +"the C :c:func:`fcntl` call." msgstr "" -msgid "When the argument is bytes-like object, it represents a binary structure, for example, created by :func:`struct.pack`. A string value is encoded to binary using the UTF-8 encoding. The binary data is copied to a buffer whose address is passed to the C :c:func:`fcntl` call. The return value after a successful call is the contents of the buffer, converted to a :class:`bytes` object. The length of the returned object will be the same as the length of the *arg* argument. This is limited to 1024 bytes." +#: ../../library/fcntl.rst:102 +msgid "" +"When the argument is bytes-like object, it represents a binary structure, " +"for example, created by :func:`struct.pack`. A string value is encoded to " +"binary using the UTF-8 encoding. The binary data is copied to a buffer whose " +"address is passed to the C :c:func:`fcntl` call. The return value after a " +"successful call is the contents of the buffer, converted to a :class:`bytes` " +"object. The length of the returned object will be the same as the length of " +"the *arg* argument. This is limited to 1024 bytes." msgstr "" +#: ../../library/fcntl.rst:111 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -msgid "If the type or the size of *arg* does not match the type or size of the argument of the operation (for example, if an integer is passed when a pointer is expected, or the information returned in the buffer by the operating system is larger than 1024 bytes), this is most likely to result in a segmentation violation or a more subtle data corruption." +#: ../../library/fcntl.rst:114 +msgid "" +"If the type or the size of *arg* does not match the type or size of the " +"argument of the operation (for example, if an integer is passed when a " +"pointer is expected, or the information returned in the buffer by the " +"operating system is larger than 1024 bytes), this is most likely to result " +"in a segmentation violation or a more subtle data corruption." msgstr "" -msgid "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments ``fd``, ``cmd``, ``arg``." +#: ../../library/fcntl.rst:121 +msgid "" +"Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " +"``fd``, ``cmd``, ``arg``." msgstr "" -msgid "Add support of arbitrary :term:`bytes-like objects `, not only :class:`bytes`." +#: ../../library/fcntl.rst:123 +msgid "" +"Add support of arbitrary :term:`bytes-like objects `, not " +"only :class:`bytes`." msgstr "" -msgid "This function is identical to the :func:`~fcntl.fcntl` function, except that the argument handling is even more complicated." +#: ../../library/fcntl.rst:130 +msgid "" +"This function is identical to the :func:`~fcntl.fcntl` function, except that " +"the argument handling is even more complicated." msgstr "" -msgid "The *request* parameter is limited to values that can fit in 32-bits or 64-bits, depending on the platform. Additional constants of interest for use as the *request* argument can be found in the :mod:`termios` module, under the same names as used in the relevant C header files." +#: ../../library/fcntl.rst:133 +msgid "" +"The *request* parameter is limited to values that can fit in 32-bits or 64-" +"bits, depending on the platform. Additional constants of interest for use as " +"the *request* argument can be found in the :mod:`termios` module, under the " +"same names as used in the relevant C header files." msgstr "" -msgid "The parameter *arg* can be an integer, a :term:`bytes-like object`, or a string. The type and size of *arg* must match the type and size of the argument of the operation as specified in the relevant C documentation." +#: ../../library/fcntl.rst:139 +msgid "" +"The parameter *arg* can be an integer, a :term:`bytes-like object`, or a " +"string. The type and size of *arg* must match the type and size of the " +"argument of the operation as specified in the relevant C documentation." msgstr "" -msgid "If *arg* does not support the read-write buffer interface or the *mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." +#: ../../library/fcntl.rst:144 +msgid "" +"If *arg* does not support the read-write buffer interface or the " +"*mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." msgstr "" -msgid "If *arg* supports the read-write buffer interface (like :class:`bytearray`) and *mutate_flag* is true (the default), then the buffer is (in effect) passed to the underlying :c:func:`!ioctl` system call, the latter's return code is passed back to the calling Python, and the buffer's new contents reflect the action of the :c:func:`ioctl`. This is a slight simplification, because if the supplied buffer is less than 1024 bytes long it is first copied into a static buffer 1024 bytes long which is then passed to :func:`ioctl` and copied back into the supplied buffer." +#: ../../library/fcntl.rst:148 +msgid "" +"If *arg* supports the read-write buffer interface (like :class:`bytearray`) " +"and *mutate_flag* is true (the default), then the buffer is (in effect) " +"passed to the underlying :c:func:`!ioctl` system call, the latter's return " +"code is passed back to the calling Python, and the buffer's new contents " +"reflect the action of the :c:func:`ioctl`. This is a slight simplification, " +"because if the supplied buffer is less than 1024 bytes long it is first " +"copied into a static buffer 1024 bytes long which is then passed " +"to :func:`ioctl` and copied back into the supplied buffer." msgstr "" -msgid "If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." +#: ../../library/fcntl.rst:157 +msgid "" +"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -msgid "If the type or size of *arg* does not match the type or size of the operation's argument (for example, if an integer is passed when a pointer is expected, or the information returned in the buffer by the operating system is larger than 1024 bytes, or the size of the mutable bytes-like object is too small), this is most likely to result in a segmentation violation or a more subtle data corruption." +#: ../../library/fcntl.rst:160 +msgid "" +"If the type or size of *arg* does not match the type or size of the " +"operation's argument (for example, if an integer is passed when a pointer is " +"expected, or the information returned in the buffer by the operating system " +"is larger than 1024 bytes, or the size of the mutable bytes-like object is " +"too small), this is most likely to result in a segmentation violation or a " +"more subtle data corruption." msgstr "" +#: ../../library/fcntl.rst:168 msgid "An example::" msgstr "" +#: ../../library/fcntl.rst:170 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -120,60 +249,110 @@ msgid "" "array('h', [13341])" msgstr "" -msgid "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments ``fd``, ``request``, ``arg``." +#: ../../library/fcntl.rst:181 +msgid "" +"Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " +"``fd``, ``request``, ``arg``." msgstr "" -msgid "The GIL is always released during a system call. System calls failing with EINTR are automatically retried." +#: ../../library/fcntl.rst:183 +msgid "" +"The GIL is always released during a system call. System calls failing with " +"EINTR are automatically retried." msgstr "" -msgid "Perform the lock operation *operation* on file descriptor *fd* (file objects providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the Unix manual :manpage:`flock(2)` for details. (On some systems, this function is emulated using :c:func:`fcntl`.)" +#: ../../library/fcntl.rst:189 +msgid "" +"Perform the lock operation *operation* on file descriptor *fd* (file objects " +"providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " +"Unix manual :manpage:`flock(2)` for details. (On some systems, this " +"function is emulated using :c:func:`fcntl`.)" msgstr "" -msgid "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." +#: ../../library/fcntl.rst:194 +msgid "" +"If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -msgid "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments ``fd``, ``operation``." +#: ../../library/fcntl.rst:196 +msgid "" +"Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " +"``fd``, ``operation``." msgstr "" -msgid "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. *fd* is the file descriptor (file objects providing a :meth:`~io.IOBase.fileno` method are accepted as well) of the file to lock or unlock, and *cmd* is one of the following values:" +#: ../../library/fcntl.rst:201 +msgid "" +"This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " +"*fd* is the file descriptor (file objects providing " +"a :meth:`~io.IOBase.fileno` method are accepted as well) of the file to lock " +"or unlock, and *cmd* is one of the following values:" msgstr "" +#: ../../library/fcntl.rst:208 msgid "Release an existing lock." msgstr "" +#: ../../library/fcntl.rst:212 msgid "Acquire a shared lock." msgstr "" +#: ../../library/fcntl.rst:216 msgid "Acquire an exclusive lock." msgstr "" -msgid "Bitwise OR with any of the other three ``LOCK_*`` constants to make the request non-blocking." +#: ../../library/fcntl.rst:220 +msgid "" +"Bitwise OR with any of the other three ``LOCK_*`` constants to make the " +"request non-blocking." msgstr "" -msgid "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:`OSError` will be raised and the exception will have an *errno* attribute set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending on the operating system; for portability, check for both values). On at least some systems, :const:`!LOCK_EX` can only be used if the file descriptor refers to a file opened for writing." +#: ../../library/fcntl.rst:223 +msgid "" +"If :const:`!LOCK_NB` is used and the lock cannot be acquired, " +"an :exc:`OSError` will be raised and the exception will have an *errno* " +"attribute set to :const:`~errno.EACCES` or :const:`~errno.EAGAIN` (depending " +"on the operating system; for portability, check for both values). On at " +"least some systems, :const:`!LOCK_EX` can only be used if the file " +"descriptor refers to a file opened for writing." msgstr "" -msgid "*len* is the number of bytes to lock, *start* is the byte offset at which the lock starts, relative to *whence*, and *whence* is as with :func:`io.IOBase.seek`, specifically:" +#: ../../library/fcntl.rst:230 +msgid "" +"*len* is the number of bytes to lock, *start* is the byte offset at which " +"the lock starts, relative to *whence*, and *whence* is as " +"with :func:`io.IOBase.seek`, specifically:" msgstr "" +#: ../../library/fcntl.rst:234 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" +#: ../../library/fcntl.rst:235 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" +#: ../../library/fcntl.rst:236 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -msgid "The default for *start* is 0, which means to start at the beginning of the file. The default for *len* is 0 which means to lock to the end of the file. The default for *whence* is also 0." +#: ../../library/fcntl.rst:238 +msgid "" +"The default for *start* is 0, which means to start at the beginning of the " +"file. The default for *len* is 0 which means to lock to the end of the " +"file. The default for *whence* is also 0." msgstr "" -msgid "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments ``fd``, ``cmd``, ``len``, ``start``, ``whence``." +#: ../../library/fcntl.rst:242 +msgid "" +"Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " +"``fd``, ``cmd``, ``len``, ``start``, ``whence``." msgstr "" +#: ../../library/fcntl.rst:244 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" +#: ../../library/fcntl.rst:246 msgid "" "import struct, fcntl, os\n" "\n" @@ -184,20 +363,33 @@ msgid "" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" msgstr "" -msgid "Note that in the first example the return value variable *rv* will hold an integer value; in the second example it will hold a :class:`bytes` object. The structure lay-out for the *lockdata* variable is system dependent --- therefore using the :func:`flock` call may be better." +#: ../../library/fcntl.rst:254 +msgid "" +"Note that in the first example the return value variable *rv* will hold an " +"integer value; in the second example it will hold a :class:`bytes` object. " +"The structure lay-out for the *lockdata* variable is system dependent --- " +"therefore using the :func:`flock` call may be better." msgstr "" +#: ../../library/fcntl.rst:262 msgid "Module :mod:`os`" msgstr "" -msgid "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are present in the :mod:`os` module (on BSD only), the :func:`os.open` function provides an alternative to the :func:`lockf` and :func:`flock` functions." +#: ../../library/fcntl.rst:263 +msgid "" +"If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " +"present in the :mod:`os` module (on BSD only), the :func:`os.open` function " +"provides an alternative to the :func:`lockf` and :func:`flock` functions." msgstr "" +#: ../../library/fcntl.rst:9 msgid "UNIX" msgstr "" +#: ../../library/fcntl.rst:9 msgid "file control" msgstr "" +#: ../../library/fcntl.rst:9 msgid "I/O control" msgstr "" diff --git a/library/filecmp.po b/library/filecmp.po index 8a468a264..354738607 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,129 +21,230 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/filecmp.rst:2 msgid ":mod:`!filecmp` --- File and Directory Comparisons" msgstr "" +#: ../../library/filecmp.rst:9 msgid "**Source code:** :source:`Lib/filecmp.py`" msgstr "" -msgid "The :mod:`!filecmp` module defines functions to compare files and directories, with various optional time/correctness trade-offs. For comparing files, see also the :mod:`difflib` module." +#: ../../library/filecmp.rst:13 +msgid "" +"The :mod:`!filecmp` module defines functions to compare files and " +"directories, with various optional time/correctness trade-offs. For " +"comparing files, see also the :mod:`difflib` module." msgstr "" +#: ../../library/filecmp.rst:17 msgid "The :mod:`!filecmp` module defines the following functions:" msgstr "" -msgid "Compare the files named *f1* and *f2*, returning ``True`` if they seem equal, ``False`` otherwise." +#: ../../library/filecmp.rst:22 +msgid "" +"Compare the files named *f1* and *f2*, returning ``True`` if they seem " +"equal, ``False`` otherwise." msgstr "" -msgid "If *shallow* is true and the :func:`os.stat` signatures (file type, size, and modification time) of both files are identical, the files are taken to be equal." +#: ../../library/filecmp.rst:25 +msgid "" +"If *shallow* is true and the :func:`os.stat` signatures (file type, size, " +"and modification time) of both files are identical, the files are taken to " +"be equal." msgstr "" -msgid "Otherwise, the files are treated as different if their sizes or contents differ." +#: ../../library/filecmp.rst:29 +msgid "" +"Otherwise, the files are treated as different if their sizes or contents " +"differ." msgstr "" -msgid "Note that no external programs are called from this function, giving it portability and efficiency." +#: ../../library/filecmp.rst:31 +msgid "" +"Note that no external programs are called from this function, giving it " +"portability and efficiency." msgstr "" -msgid "This function uses a cache for past comparisons and the results, with cache entries invalidated if the :func:`os.stat` information for the file changes. The entire cache may be cleared using :func:`clear_cache`." +#: ../../library/filecmp.rst:34 +msgid "" +"This function uses a cache for past comparisons and the results, with cache " +"entries invalidated if the :func:`os.stat` information for the file " +"changes. The entire cache may be cleared using :func:`clear_cache`." msgstr "" -msgid "Compare the files in the two directories *dir1* and *dir2* whose names are given by *common*." +#: ../../library/filecmp.rst:41 +msgid "" +"Compare the files in the two directories *a* and *b* whose names are given " +"by *common*." msgstr "" -msgid "Returns three lists of file names: *match*, *mismatch*, *errors*. *match* contains the list of files that match, *mismatch* contains the names of those that don't, and *errors* lists the names of files which could not be compared. Files are listed in *errors* if they don't exist in one of the directories, the user lacks permission to read them or if the comparison could not be done for some other reason." +#: ../../library/filecmp.rst:44 +msgid "" +"Returns three lists of file names: *match*, *mismatch*, *errors*. *match* " +"contains the list of files that match, *mismatch* contains the names of " +"those that don't, and *errors* lists the names of files which could not be " +"compared. Files are listed in *errors* if they don't exist in one of the " +"directories, the user lacks permission to read them or if the comparison " +"could not be done for some other reason." msgstr "" -msgid "The *shallow* parameter has the same meaning and default value as for :func:`filecmp.cmp`." +#: ../../library/filecmp.rst:51 +msgid "" +"The *shallow* parameter has the same meaning and default value as " +"for :func:`filecmp.cmp`." msgstr "" -msgid "For example, ``cmpfiles('a', 'b', ['c', 'd/e'])`` will compare ``a/c`` with ``b/c`` and ``a/d/e`` with ``b/d/e``. ``'c'`` and ``'d/e'`` will each be in one of the three returned lists." +#: ../../library/filecmp.rst:54 +msgid "" +"For example, ``cmpfiles('a', 'b', ['c', 'd/e'])`` will compare ``a/c`` with " +"``b/c`` and ``a/d/e`` with ``b/d/e``. ``'c'`` and ``'d/e'`` will each be in " +"one of the three returned lists." msgstr "" -msgid "Clear the filecmp cache. This may be useful if a file is compared so quickly after it is modified that it is within the mtime resolution of the underlying filesystem." +#: ../../library/filecmp.rst:61 +msgid "" +"Clear the filecmp cache. This may be useful if a file is compared so quickly " +"after it is modified that it is within the mtime resolution of the " +"underlying filesystem." msgstr "" +#: ../../library/filecmp.rst:71 msgid "The :class:`dircmp` class" msgstr "" -msgid "Construct a new directory comparison object, to compare the directories *a* and *b*. *ignore* is a list of names to ignore, and defaults to :const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and defaults to ``[os.curdir, os.pardir]``." +#: ../../library/filecmp.rst:75 +msgid "" +"Construct a new directory comparison object, to compare the directories *a* " +"and *b*. *ignore* is a list of names to ignore, and defaults " +"to :const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and " +"defaults to ``[os.curdir, os.pardir]``." msgstr "" -msgid "The :class:`dircmp` class compares files by doing *shallow* comparisons as described for :func:`filecmp.cmp` by default using the *shallow* parameter." +#: ../../library/filecmp.rst:80 +msgid "" +"The :class:`dircmp` class compares files by doing *shallow* comparisons as " +"described for :func:`filecmp.cmp` by default using the *shallow* parameter." msgstr "" +#: ../../library/filecmp.rst:86 msgid "Added the *shallow* parameter." msgstr "" +#: ../../library/filecmp.rst:88 msgid "The :class:`dircmp` class provides the following methods:" msgstr "" +#: ../../library/filecmp.rst:92 msgid "Print (to :data:`sys.stdout`) a comparison between *a* and *b*." msgstr "" -msgid "Print a comparison between *a* and *b* and common immediate subdirectories." +#: ../../library/filecmp.rst:96 +msgid "" +"Print a comparison between *a* and *b* and common immediate subdirectories." msgstr "" -msgid "Print a comparison between *a* and *b* and common subdirectories (recursively)." +#: ../../library/filecmp.rst:101 +msgid "" +"Print a comparison between *a* and *b* and common subdirectories " +"(recursively)." msgstr "" -msgid "The :class:`dircmp` class offers a number of interesting attributes that may be used to get various bits of information about the directory trees being compared." +#: ../../library/filecmp.rst:104 +msgid "" +"The :class:`dircmp` class offers a number of interesting attributes that may " +"be used to get various bits of information about the directory trees being " +"compared." msgstr "" -msgid "Note that via :meth:`~object.__getattr__` hooks, all attributes are computed lazily, so there is no speed penalty if only those attributes which are lightweight to compute are used." +#: ../../library/filecmp.rst:108 +msgid "" +"Note that via :meth:`~object.__getattr__` hooks, all attributes are computed " +"lazily, so there is no speed penalty if only those attributes which are " +"lightweight to compute are used." msgstr "" +#: ../../library/filecmp.rst:115 msgid "The directory *a*." msgstr "" +#: ../../library/filecmp.rst:120 msgid "The directory *b*." msgstr "" +#: ../../library/filecmp.rst:125 msgid "Files and subdirectories in *a*, filtered by *hide* and *ignore*." msgstr "" +#: ../../library/filecmp.rst:130 msgid "Files and subdirectories in *b*, filtered by *hide* and *ignore*." msgstr "" +#: ../../library/filecmp.rst:135 msgid "Files and subdirectories in both *a* and *b*." msgstr "" +#: ../../library/filecmp.rst:140 msgid "Files and subdirectories only in *a*." msgstr "" +#: ../../library/filecmp.rst:145 msgid "Files and subdirectories only in *b*." msgstr "" +#: ../../library/filecmp.rst:150 msgid "Subdirectories in both *a* and *b*." msgstr "" +#: ../../library/filecmp.rst:155 msgid "Files in both *a* and *b*." msgstr "" -msgid "Names in both *a* and *b*, such that the type differs between the directories, or names for which :func:`os.stat` reports an error." +#: ../../library/filecmp.rst:160 +msgid "" +"Names in both *a* and *b*, such that the type differs between the " +"directories, or names for which :func:`os.stat` reports an error." msgstr "" -msgid "Files which are identical in both *a* and *b*, using the class's file comparison operator." +#: ../../library/filecmp.rst:166 +msgid "" +"Files which are identical in both *a* and *b*, using the class's file " +"comparison operator." msgstr "" -msgid "Files which are in both *a* and *b*, whose contents differ according to the class's file comparison operator." +#: ../../library/filecmp.rst:172 +msgid "" +"Files which are in both *a* and *b*, whose contents differ according to the " +"class's file comparison operator." msgstr "" +#: ../../library/filecmp.rst:178 msgid "Files which are in both *a* and *b*, but could not be compared." msgstr "" -msgid "A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` instances (or MyDirCmp instances if this instance is of type MyDirCmp, a subclass of :class:`dircmp`)." +#: ../../library/filecmp.rst:183 +msgid "" +"A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` " +"instances (or MyDirCmp instances if this instance is of type MyDirCmp, a " +"subclass of :class:`dircmp`)." msgstr "" -msgid "Previously entries were always :class:`dircmp` instances. Now entries are the same type as *self*, if *self* is a subclass of :class:`dircmp`." +#: ../../library/filecmp.rst:187 +msgid "" +"Previously entries were always :class:`dircmp` instances. Now entries are " +"the same type as *self*, if *self* is a subclass of :class:`dircmp`." msgstr "" +#: ../../library/filecmp.rst:196 msgid "List of directories ignored by :class:`dircmp` by default." msgstr "" -msgid "Here is a simplified example of using the ``subdirs`` attribute to search recursively through two directories to show common different files::" +#: ../../library/filecmp.rst:199 +msgid "" +"Here is a simplified example of using the ``subdirs`` attribute to search " +"recursively through two directories to show common different files::" msgstr "" +#: ../../library/filecmp.rst:202 msgid "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" diff --git a/library/fileformats.po b/library/fileformats.po index 15d15c2f2..fe9493a93 100644 --- a/library/fileformats.po +++ b/library/fileformats.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,8 +21,12 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/fileformats.rst:5 msgid "File Formats" msgstr "" -msgid "The modules described in this chapter parse various miscellaneous file formats that aren't markup languages and are not related to e-mail." +#: ../../library/fileformats.rst:7 +msgid "" +"The modules described in this chapter parse various miscellaneous file " +"formats that aren't markup languages and are not related to e-mail." msgstr "" diff --git a/library/fileinput.po b/library/fileinput.po index a4f443840..9a91d0b0e 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,148 +21,301 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/fileinput.rst:2 msgid ":mod:`!fileinput` --- Iterate over lines from multiple input streams" msgstr "" +#: ../../library/fileinput.rst:10 msgid "**Source code:** :source:`Lib/fileinput.py`" msgstr "" -msgid "This module implements a helper class and functions to quickly write a loop over standard input or a list of files. If you just want to read or write one file see :func:`open`." +#: ../../library/fileinput.rst:14 +msgid "" +"This module implements a helper class and functions to quickly write a loop " +"over standard input or a list of files. If you just want to read or write " +"one file see :func:`open`." msgstr "" +#: ../../library/fileinput.rst:18 msgid "The typical use is::" msgstr "" +#: ../../library/fileinput.rst:20 msgid "" "import fileinput\n" "for line in fileinput.input(encoding=\"utf-8\"):\n" " process(line)" msgstr "" -msgid "This iterates over the lines of all files listed in ``sys.argv[1:]``, defaulting to ``sys.stdin`` if the list is empty. If a filename is ``'-'``, it is also replaced by ``sys.stdin`` and the optional arguments *mode* and *openhook* are ignored. To specify an alternative list of filenames, pass it as the first argument to :func:`.input`. A single file name is also allowed." +#: ../../library/fileinput.rst:24 +msgid "" +"This iterates over the lines of all files listed in ``sys.argv[1:]``, " +"defaulting to ``sys.stdin`` if the list is empty. If a filename is ``'-'``, " +"it is also replaced by ``sys.stdin`` and the optional arguments *mode* and " +"*openhook* are ignored. To specify an alternative list of filenames, pass " +"it as the first argument to :func:`.input`. A single file name is also " +"allowed." msgstr "" -msgid "All files are opened in text mode by default, but you can override this by specifying the *mode* parameter in the call to :func:`.input` or :class:`FileInput`. If an I/O error occurs during opening or reading a file, :exc:`OSError` is raised." +#: ../../library/fileinput.rst:30 +msgid "" +"All files are opened in text mode by default, but you can override this by " +"specifying the *mode* parameter in the call to :func:`.input` " +"or :class:`FileInput`. If an I/O error occurs during opening or reading a " +"file, :exc:`OSError` is raised." msgstr "" +#: ../../library/fileinput.rst:35 msgid ":exc:`IOError` used to be raised; it is now an alias of :exc:`OSError`." msgstr "" -msgid "If ``sys.stdin`` is used more than once, the second and further use will return no lines, except perhaps for interactive use, or if it has been explicitly reset (e.g. using ``sys.stdin.seek(0)``)." +#: ../../library/fileinput.rst:38 +msgid "" +"If ``sys.stdin`` is used more than once, the second and further use will " +"return no lines, except perhaps for interactive use, or if it has been " +"explicitly reset (e.g. using ``sys.stdin.seek(0)``)." msgstr "" -msgid "Empty files are opened and immediately closed; the only time their presence in the list of filenames is noticeable at all is when the last file opened is empty." +#: ../../library/fileinput.rst:42 +msgid "" +"Empty files are opened and immediately closed; the only time their presence " +"in the list of filenames is noticeable at all is when the last file opened " +"is empty." msgstr "" -msgid "Lines are returned with any newlines intact, which means that the last line in a file may not have one." +#: ../../library/fileinput.rst:46 +msgid "" +"Lines are returned with any newlines intact, which means that the last line " +"in a file may not have one." msgstr "" -msgid "You can control how files are opened by providing an opening hook via the *openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The hook must be a function that takes two arguments, *filename* and *mode*, and returns an accordingly opened file-like object. If *encoding* and/or *errors* are specified, they will be passed to the hook as additional keyword arguments. This module provides a :func:`hook_compressed` to support compressed files." +#: ../../library/fileinput.rst:49 +msgid "" +"You can control how files are opened by providing an opening hook via the " +"*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The " +"hook must be a function that takes two arguments, *filename* and *mode*, and " +"returns an accordingly opened file-like object. If *encoding* and/or " +"*errors* are specified, they will be passed to the hook as additional " +"keyword arguments. This module provides a :func:`hook_compressed` to support " +"compressed files." msgstr "" +#: ../../library/fileinput.rst:56 msgid "The following function is the primary interface of this module:" msgstr "" -msgid "Create an instance of the :class:`FileInput` class. The instance will be used as global state for the functions of this module, and is also returned to use during iteration. The parameters to this function will be passed along to the constructor of the :class:`FileInput` class." +#: ../../library/fileinput.rst:61 +msgid "" +"Create an instance of the :class:`FileInput` class. The instance will be " +"used as global state for the functions of this module, and is also returned " +"to use during iteration. The parameters to this function will be passed " +"along to the constructor of the :class:`FileInput` class." msgstr "" -msgid "The :class:`FileInput` instance can be used as a context manager in the :keyword:`with` statement. In this example, *input* is closed after the :keyword:`!with` statement is exited, even if an exception occurs::" +#: ../../library/fileinput.rst:66 +msgid "" +"The :class:`FileInput` instance can be used as a context manager in " +"the :keyword:`with` statement. In this example, *input* is closed after " +"the :keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" +#: ../../library/fileinput.rst:70 msgid "" -"with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding=\"utf-8\") as f:\n" +"with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding=\"utf-8\") as " +"f:\n" " for line in f:\n" " process(line)" msgstr "" +#: ../../library/fileinput.rst:74 ../../library/fileinput.rst:170 msgid "Can be used as a context manager." msgstr "" +#: ../../library/fileinput.rst:77 msgid "The keyword parameters *mode* and *openhook* are now keyword-only." msgstr "" +#: ../../library/fileinput.rst:80 ../../library/fileinput.rst:176 +#: ../../library/fileinput.rst:210 msgid "The keyword-only parameter *encoding* and *errors* are added." msgstr "" -msgid "The following functions use the global state created by :func:`fileinput.input`; if there is no active state, :exc:`RuntimeError` is raised." +#: ../../library/fileinput.rst:84 +msgid "" +"The following functions use the global state created " +"by :func:`fileinput.input`; if there is no active state, :exc:`RuntimeError` " +"is raised." msgstr "" -msgid "Return the name of the file currently being read. Before the first line has been read, returns ``None``." +#: ../../library/fileinput.rst:90 +msgid "" +"Return the name of the file currently being read. Before the first line has " +"been read, returns ``None``." msgstr "" -msgid "Return the integer \"file descriptor\" for the current file. When no file is opened (before the first line and between files), returns ``-1``." +#: ../../library/fileinput.rst:96 +msgid "" +"Return the integer \"file descriptor\" for the current file. When no file is " +"opened (before the first line and between files), returns ``-1``." msgstr "" -msgid "Return the cumulative line number of the line that has just been read. Before the first line has been read, returns ``0``. After the last line of the last file has been read, returns the line number of that line." +#: ../../library/fileinput.rst:102 +msgid "" +"Return the cumulative line number of the line that has just been read. " +"Before the first line has been read, returns ``0``. After the last line of " +"the last file has been read, returns the line number of that line." msgstr "" -msgid "Return the line number in the current file. Before the first line has been read, returns ``0``. After the last line of the last file has been read, returns the line number of that line within the file." +#: ../../library/fileinput.rst:109 +msgid "" +"Return the line number in the current file. Before the first line has been " +"read, returns ``0``. After the last line of the last file has been read, " +"returns the line number of that line within the file." msgstr "" -msgid "Return ``True`` if the line just read is the first line of its file, otherwise return ``False``." +#: ../../library/fileinput.rst:116 +msgid "" +"Return ``True`` if the line just read is the first line of its file, " +"otherwise return ``False``." msgstr "" -msgid "Return ``True`` if the last line was read from ``sys.stdin``, otherwise return ``False``." +#: ../../library/fileinput.rst:122 +msgid "" +"Return ``True`` if the last line was read from ``sys.stdin``, otherwise " +"return ``False``." msgstr "" -msgid "Close the current file so that the next iteration will read the first line from the next file (if any); lines not read from the file will not count towards the cumulative line count. The filename is not changed until after the first line of the next file has been read. Before the first line has been read, this function has no effect; it cannot be used to skip the first file. After the last line of the last file has been read, this function has no effect." +#: ../../library/fileinput.rst:128 +msgid "" +"Close the current file so that the next iteration will read the first line " +"from the next file (if any); lines not read from the file will not count " +"towards the cumulative line count. The filename is not changed until after " +"the first line of the next file has been read. Before the first line has " +"been read, this function has no effect; it cannot be used to skip the first " +"file. After the last line of the last file has been read, this function has " +"no effect." msgstr "" +#: ../../library/fileinput.rst:138 msgid "Close the sequence." msgstr "" -msgid "The class which implements the sequence behavior provided by the module is available for subclassing as well:" +#: ../../library/fileinput.rst:140 +msgid "" +"The class which implements the sequence behavior provided by the module is " +"available for subclassing as well:" msgstr "" -msgid "Class :class:`FileInput` is the implementation; its methods :meth:`filename`, :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:`isfirstline`, :meth:`isstdin`, :meth:`nextfile` and :meth:`close` correspond to the functions of the same name in the module. In addition it is :term:`iterable` and has a :meth:`~io.TextIOBase.readline` method which returns the next input line. The sequence must be accessed in strictly sequential order; random access and :meth:`~io.TextIOBase.readline` cannot be mixed." +#: ../../library/fileinput.rst:146 +msgid "" +"Class :class:`FileInput` is the implementation; its " +"methods :meth:`filename`, :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:`isfirstline`, :meth:`isstdin`, :meth:`nextfile` " +"and :meth:`close` correspond to the functions of the same name in the " +"module. In addition it is :term:`iterable` and has " +"a :meth:`~io.TextIOBase.readline` method which returns the next input line. " +"The sequence must be accessed in strictly sequential order; random access " +"and :meth:`~io.TextIOBase.readline` cannot be mixed." msgstr "" -msgid "With *mode* you can specify which file mode will be passed to :func:`open`. It must be one of ``'r'`` and ``'rb'``." +#: ../../library/fileinput.rst:154 +msgid "" +"With *mode* you can specify which file mode will be passed to :func:`open`. " +"It must be one of ``'r'`` and ``'rb'``." msgstr "" -msgid "The *openhook*, when given, must be a function that takes two arguments, *filename* and *mode*, and returns an accordingly opened file-like object. You cannot use *inplace* and *openhook* together." +#: ../../library/fileinput.rst:157 +msgid "" +"The *openhook*, when given, must be a function that takes two arguments, " +"*filename* and *mode*, and returns an accordingly opened file-like object. " +"You cannot use *inplace* and *openhook* together." msgstr "" -msgid "You can specify *encoding* and *errors* that is passed to :func:`open` or *openhook*." +#: ../../library/fileinput.rst:161 +msgid "" +"You can specify *encoding* and *errors* that is passed to :func:`open` or " +"*openhook*." msgstr "" -msgid "A :class:`FileInput` instance can be used as a context manager in the :keyword:`with` statement. In this example, *input* is closed after the :keyword:`!with` statement is exited, even if an exception occurs::" +#: ../../library/fileinput.rst:163 +msgid "" +"A :class:`FileInput` instance can be used as a context manager in " +"the :keyword:`with` statement. In this example, *input* is closed after " +"the :keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" +#: ../../library/fileinput.rst:167 msgid "" "with FileInput(files=('spam.txt', 'eggs.txt')) as input:\n" " process(input)" msgstr "" +#: ../../library/fileinput.rst:173 msgid "The keyword parameter *mode* and *openhook* are now keyword-only." msgstr "" -msgid "The ``'rU'`` and ``'U'`` modes and the :meth:`!__getitem__` method have been removed." -msgstr "" - -msgid "**Optional in-place filtering:** if the keyword argument ``inplace=True`` is passed to :func:`fileinput.input` or to the :class:`FileInput` constructor, the file is moved to a backup file and standard output is directed to the input file (if a file of the same name as the backup file already exists, it will be replaced silently). This makes it possible to write a filter that rewrites its input file in place. If the *backup* parameter is given (typically as ``backup='.'``), it specifies the extension for the backup file, and the backup file remains around; by default, the extension is ``'.bak'`` and it is deleted when the output file is closed. In-place filtering is disabled when standard input is read." +#: ../../library/fileinput.rst:179 +msgid "" +"The ``'rU'`` and ``'U'`` modes and the :meth:`!__getitem__` method have been " +"removed." msgstr "" +#: ../../library/fileinput.rst:184 +msgid "" +"**Optional in-place filtering:** if the keyword argument ``inplace=True`` is " +"passed to :func:`fileinput.input` or to the :class:`FileInput` constructor, " +"the file is moved to a backup file and standard output is directed to the " +"input file (if a file of the same name as the backup file already exists, it " +"will be replaced silently). This makes it possible to write a filter that " +"rewrites its input file in place. If the *backup* parameter is given " +"(typically as ``backup='.'``), it specifies the extension " +"for the backup file, and the backup file remains around; by default, the " +"extension is ``'.bak'`` and it is deleted when the output file is closed. " +"In-place filtering is disabled when standard input is read." +msgstr "" + +#: ../../library/fileinput.rst:196 msgid "The two following opening hooks are provided by this module:" msgstr "" -msgid "Transparently opens files compressed with gzip and bzip2 (recognized by the extensions ``'.gz'`` and ``'.bz2'``) using the :mod:`gzip` and :mod:`bz2` modules. If the filename extension is not ``'.gz'`` or ``'.bz2'``, the file is opened normally (ie, using :func:`open` without any decompression)." +#: ../../library/fileinput.rst:200 +msgid "" +"Transparently opens files compressed with gzip and bzip2 (recognized by the " +"extensions ``'.gz'`` and ``'.bz2'``) using the :mod:`gzip` and :mod:`bz2` " +"modules. If the filename extension is not ``'.gz'`` or ``'.bz2'``, the file " +"is opened normally (ie, using :func:`open` without any decompression)." msgstr "" -msgid "The *encoding* and *errors* values are passed to :class:`io.TextIOWrapper` for compressed files and open for normal files." +#: ../../library/fileinput.rst:205 +msgid "" +"The *encoding* and *errors* values are passed to :class:`io.TextIOWrapper` " +"for compressed files and open for normal files." msgstr "" -msgid "Usage example: ``fi = fileinput.FileInput(openhook=fileinput.hook_compressed, encoding=\"utf-8\")``" +#: ../../library/fileinput.rst:208 +msgid "" +"Usage example: ``fi = " +"fileinput.FileInput(openhook=fileinput.hook_compressed, encoding=\"utf-8\")``" msgstr "" -msgid "Returns a hook which opens each file with :func:`open`, using the given *encoding* and *errors* to read the file." +#: ../../library/fileinput.rst:216 +msgid "" +"Returns a hook which opens each file with :func:`open`, using the given " +"*encoding* and *errors* to read the file." msgstr "" -msgid "Usage example: ``fi = fileinput.FileInput(openhook=fileinput.hook_encoded(\"utf-8\", \"surrogateescape\"))``" +#: ../../library/fileinput.rst:219 +msgid "" +"Usage example: ``fi = " +"fileinput.FileInput(openhook=fileinput.hook_encoded(\"utf-8\", " +"\"surrogateescape\"))``" msgstr "" +#: ../../library/fileinput.rst:223 msgid "Added the optional *errors* parameter." msgstr "" -msgid "This function is deprecated since :func:`fileinput.input` and :class:`FileInput` now have *encoding* and *errors* parameters." +#: ../../library/fileinput.rst:226 +msgid "" +"This function is deprecated since :func:`fileinput.input` " +"and :class:`FileInput` now have *encoding* and *errors* parameters." msgstr "" diff --git a/library/filesys.po b/library/filesys.po index 767263976..4d032acf2 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,26 +21,42 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/filesys.rst:5 msgid "File and Directory Access" msgstr "" -msgid "The modules described in this chapter deal with disk files and directories. For example, there are modules for reading the properties of files, manipulating paths in a portable way, and creating temporary files. The full list of modules in this chapter is:" +#: ../../library/filesys.rst:7 +msgid "" +"The modules described in this chapter deal with disk files and directories. " +"For example, there are modules for reading the properties of files, " +"manipulating paths in a portable way, and creating temporary files. The " +"full list of modules in this chapter is:" msgstr "" +#: ../../library/filesys.rst:28 msgid "Module :mod:`os`" msgstr "" -msgid "Operating system interfaces, including functions to work with files at a lower level than Python :term:`file objects `." +#: ../../library/filesys.rst:29 +msgid "" +"Operating system interfaces, including functions to work with files at a " +"lower level than Python :term:`file objects `." msgstr "" +#: ../../library/filesys.rst:32 msgid "Module :mod:`io`" msgstr "" -msgid "Python's built-in I/O library, including both abstract classes and some concrete classes such as file I/O." +#: ../../library/filesys.rst:33 +msgid "" +"Python's built-in I/O library, including both abstract classes and some " +"concrete classes such as file I/O." msgstr "" +#: ../../library/filesys.rst:36 msgid "Built-in function :func:`open`" msgstr "" +#: ../../library/filesys.rst:37 msgid "The standard way to open files for reading and writing with Python." msgstr "" diff --git a/library/fnmatch.po b/library/fnmatch.po index a256f822f..e5991375a 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,63 +23,107 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/fnmatch.rst:2 msgid ":mod:`!fnmatch` --- Unix filename pattern matching" msgstr "" +#: ../../library/fnmatch.rst:7 msgid "**Source code:** :source:`Lib/fnmatch.py`" msgstr "" -msgid "This module provides support for Unix shell-style wildcards, which are *not* the same as regular expressions (which are documented in the :mod:`re` module). The special characters used in shell-style wildcards are:" +#: ../../library/fnmatch.rst:15 +msgid "" +"This module provides support for Unix shell-style wildcards, which are *not* " +"the same as regular expressions (which are documented in the :mod:`re` " +"module). The special characters used in shell-style wildcards are:" msgstr "" +#: ../../library/fnmatch.rst:27 msgid "Pattern" msgstr "" +#: ../../library/fnmatch.rst:27 msgid "Meaning" msgstr "" +#: ../../library/fnmatch.rst:29 msgid "``*``" msgstr "" +#: ../../library/fnmatch.rst:29 msgid "matches everything" msgstr "" +#: ../../library/fnmatch.rst:31 msgid "``?``" msgstr "" +#: ../../library/fnmatch.rst:31 msgid "matches any single character" msgstr "" +#: ../../library/fnmatch.rst:33 msgid "``[seq]``" msgstr "" +#: ../../library/fnmatch.rst:33 msgid "matches any character in *seq*" msgstr "" +#: ../../library/fnmatch.rst:35 msgid "``[!seq]``" msgstr "" +#: ../../library/fnmatch.rst:35 msgid "matches any character not in *seq*" msgstr "" -msgid "For a literal match, wrap the meta-characters in brackets. For example, ``'[?]'`` matches the character ``'?'``." +#: ../../library/fnmatch.rst:38 +msgid "" +"For a literal match, wrap the meta-characters in brackets. For example, " +"``'[?]'`` matches the character ``'?'``." msgstr "" -msgid "Note that the filename separator (``'/'`` on Unix) is *not* special to this module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses :func:`.filter` to match pathname segments). Similarly, filenames starting with a period are not special for this module, and are matched by the ``*`` and ``?`` patterns." +#: ../../library/fnmatch.rst:43 +msgid "" +"Note that the filename separator (``'/'`` on Unix) is *not* special to this " +"module. See module :mod:`glob` for pathname expansion (:mod:`glob` " +"uses :func:`.filter` to match pathname segments). Similarly, filenames " +"starting with a period are not special for this module, and are matched by " +"the ``*`` and ``?`` patterns." msgstr "" -msgid "Unless stated otherwise, \"filename string\" and \"pattern string\" either refer to :class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note that the functions documented below do not allow to mix a :class:`!bytes` pattern with a :class:`!str` filename, and vice-versa." +#: ../../library/fnmatch.rst:49 +msgid "" +"Unless stated otherwise, \"filename string\" and \"pattern string\" either " +"refer to :class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note " +"that the functions documented below do not allow to mix a :class:`!bytes` " +"pattern with a :class:`!str` filename, and vice-versa." msgstr "" -msgid "Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768 is used to cache the (typed) compiled regex patterns in the following functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`.filterfalse`." +#: ../../library/fnmatch.rst:54 +msgid "" +"Finally, note that :deco:`functools.lru_cache` with a *maxsize* of 32768 is " +"used to cache the (typed) compiled regex patterns in the following " +"functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`.filterfalse`." msgstr "" -msgid "Test whether the filename string *name* matches the pattern string *pat*, returning ``True`` or ``False``. Both parameters are case-normalized using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a case-sensitive comparison, regardless of whether that's standard for the operating system." +#: ../../library/fnmatch.rst:61 +msgid "" +"Test whether the filename string *name* matches the pattern string *pat*, " +"returning ``True`` or ``False``. Both parameters are case-normalized " +"using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a " +"case-sensitive comparison, regardless of whether that's standard for the " +"operating system." msgstr "" -msgid "This example will print all file names in the current directory with the extension ``.txt``::" +#: ../../library/fnmatch.rst:67 +msgid "" +"This example will print all file names in the current directory with the " +"extension ``.txt``::" msgstr "" +#: ../../library/fnmatch.rst:70 msgid "" "import fnmatch\n" "import os\n" @@ -89,56 +133,86 @@ msgid "" " print(file)" msgstr "" -msgid "Test whether the filename string *name* matches the pattern string *pat*, returning ``True`` or ``False``; the comparison is case-sensitive and does not apply :func:`os.path.normcase`." +#: ../../library/fnmatch.rst:80 +msgid "" +"Test whether the filename string *name* matches the pattern string *pat*, " +"returning ``True`` or ``False``; the comparison is case-sensitive and does " +"not apply :func:`os.path.normcase`." msgstr "" -msgid "Construct a list from those elements of the :term:`iterable` of filename strings *names* that match the pattern string *pat*. It is the same as ``[n for n in names if fnmatch(n, pat)]``, but implemented more efficiently." +#: ../../library/fnmatch.rst:87 +msgid "" +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that match the pattern string *pat*. It is the same as ``[n " +"for n in names if fnmatch(n, pat)]``, but implemented more efficiently." msgstr "" -msgid "Construct a list from those elements of the :term:`iterable` of filename strings *names* that do not match the pattern string *pat*. It is the same as ``[n for n in names if not fnmatch(n, pat)]``, but implemented more efficiently." +#: ../../library/fnmatch.rst:95 +msgid "" +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that do not match the pattern string *pat*. It is the same " +"as ``[n for n in names if not fnmatch(n, pat)]``, but implemented more " +"efficiently." msgstr "" -msgid "Return the shell-style pattern *pat* converted to a regular expression for using with :func:`re.match`. The pattern is expected to be a :class:`str`." +#: ../../library/fnmatch.rst:105 +msgid "" +"Return the shell-style pattern *pat* converted to a regular expression for " +"using with :func:`re.match`. The pattern is expected to be a :class:`str`." msgstr "" +#: ../../library/fnmatch.rst:108 msgid "Example:" msgstr "" +#: ../../library/fnmatch.rst:122 msgid "Module :mod:`glob`" msgstr "" +#: ../../library/fnmatch.rst:123 msgid "Unix shell-style path expansion." msgstr "" +#: ../../library/fnmatch.rst:9 msgid "filenames" msgstr "" +#: ../../library/fnmatch.rst:9 msgid "wildcard expansion" msgstr "" +#: ../../library/fnmatch.rst:11 ../../library/fnmatch.rst:41 msgid "module" msgstr "" +#: ../../library/fnmatch.rst:11 msgid "re" msgstr "" +#: ../../library/fnmatch.rst:19 msgid "* (asterisk)" msgstr "" +#: ../../library/fnmatch.rst:19 msgid "in glob-style wildcards" msgstr "" +#: ../../library/fnmatch.rst:19 msgid "? (question mark)" msgstr "" +#: ../../library/fnmatch.rst:19 msgid "[] (square brackets)" msgstr "" +#: ../../library/fnmatch.rst:19 msgid "! (exclamation)" msgstr "" +#: ../../library/fnmatch.rst:19 msgid "- (minus)" msgstr "" +#: ../../library/fnmatch.rst:41 msgid "glob" msgstr "" diff --git a/library/fractions.po b/library/fractions.po index f3c2ffd07..d91f56c69 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,33 +23,69 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/fractions.rst:2 msgid ":mod:`!fractions` --- Rational numbers" msgstr "" +#: ../../library/fractions.rst:10 msgid "**Source code:** :source:`Lib/fractions.py`" msgstr "" -msgid "The :mod:`!fractions` module provides support for rational number arithmetic." -msgstr "" - -msgid "A Fraction instance can be constructed from a pair of rational numbers, from a single number, or from a string." +#: ../../library/fractions.rst:14 +msgid "" +"The :mod:`!fractions` module provides support for rational number arithmetic." msgstr "" -msgid "The first version requires that *numerator* and *denominator* are instances of :class:`numbers.Rational` and returns a new :class:`Fraction` instance with a value equal to ``numerator/denominator``. If *denominator* is zero, it raises a :exc:`ZeroDivisionError`." +#: ../../library/fractions.rst:17 +msgid "" +"A Fraction instance can be constructed from a pair of rational numbers, from " +"a single number, or from a string." msgstr "" -msgid "The second version requires that *number* is an instance of :class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method (this includes :class:`float` and :class:`decimal.Decimal`). It returns a :class:`Fraction` instance with exactly the same value. Assumed, that the :meth:`!as_integer_ratio` method returns a pair of coprime integers and last one is positive. Note that due to the usual issues with binary point (see :ref:`tut-fp-issues`), the argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might expect. (But see the documentation for the :meth:`limit_denominator` method below.)" +#: ../../library/fractions.rst:26 +msgid "" +"The first version requires that *numerator* and *denominator* are instances " +"of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " +"with a value equal to ``numerator/denominator``. If *denominator* is zero, " +"it raises a :exc:`ZeroDivisionError`." msgstr "" -msgid "The last version of the constructor expects a string. The usual form for this instance is::" +#: ../../library/fractions.rst:31 +msgid "" +"The second version requires that *number* is an instance " +"of :class:`numbers.Rational` or has the :meth:`!as_integer_ratio` method " +"(this includes :class:`float` and :class:`decimal.Decimal`). It returns " +"a :class:`Fraction` instance with exactly the same value. Assumed, that " +"the :meth:`!as_integer_ratio` method returns a pair of coprime integers and " +"last one is positive. Note that due to the usual issues with binary point " +"(see :ref:`tut-fp-issues`), the argument to ``Fraction(1.1)`` is not exactly " +"equal to 11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, " +"10)`` as one might expect. (But see the documentation for " +"the :meth:`limit_denominator` method below.)" +msgstr "" + +#: ../../library/fractions.rst:43 +msgid "" +"The last version of the constructor expects a string. The usual form for " +"this instance is::" msgstr "" +#: ../../library/fractions.rst:46 msgid "[sign] numerator ['/' denominator]" msgstr "" -msgid "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and ``denominator`` (if present) are strings of decimal digits (underscores may be used to delimit digits as with integral literals in code). In addition, any string that represents a finite value and is accepted by the :class:`float` constructor is also accepted by the :class:`Fraction` constructor. In either form the input string may also have leading and/or trailing whitespace. Here are some examples::" +#: ../../library/fractions.rst:48 +msgid "" +"where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " +"``denominator`` (if present) are strings of decimal digits (underscores may " +"be used to delimit digits as with integral literals in code). In addition, " +"any string that represents a finite value and is accepted by " +"the :class:`float` constructor is also accepted by the :class:`Fraction` " +"constructor. In either form the input string may also have leading and/or " +"trailing whitespace. Here are some examples::" msgstr "" +#: ../../library/fractions.rst:57 msgid "" ">>> from fractions import Fraction\n" ">>> Fraction(16, -10)\n" @@ -77,87 +113,179 @@ msgid "" "Fraction(11, 10)" msgstr "" -msgid "The :class:`Fraction` class inherits from the abstract base class :class:`numbers.Rational`, and implements all of the methods and operations from that class. :class:`Fraction` instances are :term:`hashable`, and should be treated as immutable. In addition, :class:`Fraction` has the following properties and methods:" +#: ../../library/fractions.rst:83 +msgid "" +"The :class:`Fraction` class inherits from the abstract base " +"class :class:`numbers.Rational`, and implements all of the methods and " +"operations from that class. :class:`Fraction` instances " +"are :term:`hashable`, and should be treated as immutable. In " +"addition, :class:`Fraction` has the following properties and methods:" msgstr "" -msgid "The :class:`Fraction` constructor now accepts :class:`float` and :class:`decimal.Decimal` instances." +#: ../../library/fractions.rst:89 +msgid "" +"The :class:`Fraction` constructor now accepts :class:`float` " +"and :class:`decimal.Decimal` instances." msgstr "" -msgid "The :func:`math.gcd` function is now used to normalize the *numerator* and *denominator*. :func:`math.gcd` always returns an :class:`int` type. Previously, the GCD type depended on *numerator* and *denominator*." +#: ../../library/fractions.rst:93 +msgid "" +"The :func:`math.gcd` function is now used to normalize the *numerator* and " +"*denominator*. :func:`math.gcd` always returns an :class:`int` type. " +"Previously, the GCD type depended on *numerator* and *denominator*." msgstr "" -msgid "Underscores are now permitted when creating a :class:`Fraction` instance from a string, following :PEP:`515` rules." +#: ../../library/fractions.rst:98 +msgid "" +"Underscores are now permitted when creating a :class:`Fraction` instance " +"from a string, following :PEP:`515` rules." msgstr "" -msgid ":class:`Fraction` implements ``__int__`` now to satisfy ``typing.SupportsInt`` instance checks." +#: ../../library/fractions.rst:102 +msgid "" +":class:`Fraction` implements ``__int__`` now to satisfy " +"``typing.SupportsInt`` instance checks." msgstr "" -msgid "Space is allowed around the slash for string inputs: ``Fraction('2 / 3')``." +#: ../../library/fractions.rst:106 +msgid "" +"Space is allowed around the slash for string inputs: ``Fraction('2 / 3')``." msgstr "" -msgid ":class:`Fraction` instances now support float-style formatting, with presentation types ``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, ``\"G\"`` and ``\"%\"\"``." +#: ../../library/fractions.rst:109 +msgid "" +":class:`Fraction` instances now support float-style formatting, with " +"presentation types ``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, " +"``\"G\"`` and ``\"%\"\"``." msgstr "" -msgid "Formatting of :class:`Fraction` instances without a presentation type now supports fill, alignment, sign handling, minimum width and grouping." +#: ../../library/fractions.rst:114 +msgid "" +"Formatting of :class:`Fraction` instances without a presentation type now " +"supports fill, alignment, sign handling, minimum width and grouping." msgstr "" -msgid "The :class:`Fraction` constructor now accepts any objects with the :meth:`!as_integer_ratio` method." +#: ../../library/fractions.rst:118 +msgid "" +"The :class:`Fraction` constructor now accepts any objects with the :meth:`!" +"as_integer_ratio` method." msgstr "" +#: ../../library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." msgstr "" +#: ../../library/fractions.rst:128 msgid "Denominator of the Fraction in lowest terms. Guaranteed to be positive." msgstr "" -msgid "Return a tuple of two integers, whose ratio is equal to the original Fraction. The ratio is in lowest terms and has a positive denominator." +#: ../../library/fractions.rst:134 +msgid "" +"Return a tuple of two integers, whose ratio is equal to the original " +"Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" +#: ../../library/fractions.rst:142 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -msgid "Alternative constructor which only accepts instances of :class:`float` or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)``." +#: ../../library/fractions.rst:148 +msgid "" +"Alternative constructor which only accepts instances of :class:`float` " +"or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is " +"not the same value as ``Fraction(3, 10)``." msgstr "" -msgid "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance directly from a :class:`float`." +#: ../../library/fractions.rst:154 +msgid "" +"From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " +"directly from a :class:`float`." msgstr "" -msgid "Alternative constructor which only accepts instances of :class:`decimal.Decimal` or :class:`numbers.Integral`." +#: ../../library/fractions.rst:160 +msgid "" +"Alternative constructor which only accepts instances " +"of :class:`decimal.Decimal` or :class:`numbers.Integral`." msgstr "" -msgid "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance directly from a :class:`decimal.Decimal` instance." +#: ../../library/fractions.rst:165 +msgid "" +"From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " +"directly from a :class:`decimal.Decimal` instance." msgstr "" -msgid "Alternative constructor which only accepts instances of :class:`numbers.Integral`, :class:`numbers.Rational`, :class:`float` or :class:`decimal.Decimal`, and objects with the :meth:`!as_integer_ratio` method, but not strings." +#: ../../library/fractions.rst:172 +msgid "" +"Alternative constructor which only accepts instances " +"of :class:`numbers.Integral`, :class:`numbers.Rational`, :class:`float` " +"or :class:`decimal.Decimal`, and objects with the :meth:`!as_integer_ratio` " +"method, but not strings." msgstr "" -msgid "Finds and returns the closest :class:`Fraction` to ``self`` that has denominator at most max_denominator. This method is useful for finding rational approximations to a given floating-point number:" +#: ../../library/fractions.rst:182 +msgid "" +"Finds and returns the closest :class:`Fraction` to ``self`` that has " +"denominator at most max_denominator. This method is useful for finding " +"rational approximations to a given floating-point number:" msgstr "" +#: ../../library/fractions.rst:190 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -msgid "Returns the greatest :class:`int` ``<= self``. This method can also be accessed through the :func:`math.floor` function:" +#: ../../library/fractions.rst:203 +msgid "" +"Returns the greatest :class:`int` ``<= self``. This method can also be " +"accessed through the :func:`math.floor` function:" msgstr "" -msgid "Returns the least :class:`int` ``>= self``. This method can also be accessed through the :func:`math.ceil` function." +#: ../../library/fractions.rst:213 +msgid "" +"Returns the least :class:`int` ``>= self``. This method can also be " +"accessed through the :func:`math.ceil` function." msgstr "" -msgid "The first version returns the nearest :class:`int` to ``self``, rounding half to even. The second version rounds ``self`` to the nearest multiple of ``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again rounding half toward even. This method can also be accessed through the :func:`round` function." +#: ../../library/fractions.rst:220 +msgid "" +"The first version returns the nearest :class:`int` to ``self``, rounding " +"half to even. The second version rounds ``self`` to the nearest multiple of " +"``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " +"rounding half toward even. This method can also be accessed through " +"the :func:`round` function." msgstr "" -msgid "Provides support for formatting of :class:`Fraction` instances via the :meth:`str.format` method, the :func:`format` built-in function, or :ref:`Formatted string literals `." +#: ../../library/fractions.rst:228 +msgid "" +"Provides support for formatting of :class:`Fraction` instances via " +"the :meth:`str.format` method, the :func:`format` built-in function, " +"or :ref:`Formatted string literals `." msgstr "" -msgid "If the ``format_spec`` format specification string does not end with one of the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or ``'%'`` then formatting follows the general rules for fill, alignment, sign handling, minimum width, and grouping as described in the :ref:`format specification mini-language `. The \"alternate form\" flag ``'#'`` is supported: if present, it forces the output string to always include an explicit denominator, even when the value being formatted is an exact integer. The zero-fill flag ``'0'`` is not supported." +#: ../../library/fractions.rst:232 +msgid "" +"If the ``format_spec`` format specification string does not end with one of " +"the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " +"or ``'%'`` then formatting follows the general rules for fill, alignment, " +"sign handling, minimum width, and grouping as described in the :ref:`format " +"specification mini-language `. The \"alternate form\" flag " +"``'#'`` is supported: if present, it forces the output string to always " +"include an explicit denominator, even when the value being formatted is an " +"exact integer. The zero-fill flag ``'0'`` is not supported." msgstr "" -msgid "If the ``format_spec`` format specification string ends with one of the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or ``'%'`` then formatting follows the rules outlined for the :class:`float` type in the :ref:`formatspec` section." +#: ../../library/fractions.rst:242 +msgid "" +"If the ``format_spec`` format specification string ends with one of the " +"presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " +"``'%'`` then formatting follows the rules outlined for the :class:`float` " +"type in the :ref:`formatspec` section." msgstr "" +#: ../../library/fractions.rst:247 msgid "Here are some examples::" msgstr "" +#: ../../library/fractions.rst:249 msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -179,11 +307,14 @@ msgid "" "'34.67% price increase'" msgstr "" +#: ../../library/fractions.rst:271 msgid "Module :mod:`numbers`" msgstr "" +#: ../../library/fractions.rst:272 msgid "The abstract base classes making up the numeric tower." msgstr "" +#: ../../library/fractions.rst:20 msgid "as_integer_ratio()" msgstr "" diff --git a/library/frameworks.po b/library/frameworks.po index 72703c485..bfaf5fea1 100644 --- a/library/frameworks.po +++ b/library/frameworks.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,17 +21,24 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/frameworks.rst:7 msgid "Program frameworks" msgstr "" -msgid "This chapter is no longer maintained, and the modules it contained have been moved to their respective topical documentation." +#: ../../library/frameworks.rst:9 +msgid "" +"This chapter is no longer maintained, and the modules it contained have been " +"moved to their respective topical documentation." msgstr "" +#: ../../library/frameworks.rst:11 msgid ":mod:`cmd` — :doc:`Command Line Interface Libraries <./cmdlinelibs>`" msgstr "" +#: ../../library/frameworks.rst:12 msgid ":mod:`shlex` — :doc:`Unix Specific Services <./unix>`" msgstr "" +#: ../../library/frameworks.rst:13 msgid ":mod:`turtle` — :doc:`Graphical User Interfaces with Tk <./tk>`" msgstr "" diff --git a/library/ftplib.po b/library/ftplib.po index a546cd977..c2733dd98 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,27 +23,43 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/ftplib.rst:2 msgid ":mod:`!ftplib` --- FTP protocol client" msgstr "" +#: ../../library/ftplib.rst:7 msgid "**Source code:** :source:`Lib/ftplib.py`" msgstr "" -msgid "This module defines the class :class:`FTP` and a few related items. The :class:`FTP` class implements the client side of the FTP protocol. You can use this to write Python programs that perform a variety of automated FTP jobs, such as mirroring other FTP servers. It is also used by the module :mod:`urllib.request` to handle URLs that use FTP. For more information on FTP (File Transfer Protocol), see internet :rfc:`959`." +#: ../../library/ftplib.rst:15 +msgid "" +"This module defines the class :class:`FTP` and a few related items. " +"The :class:`FTP` class implements the client side of the FTP protocol. You " +"can use this to write Python programs that perform a variety of automated " +"FTP jobs, such as mirroring other FTP servers. It is also used by the " +"module :mod:`urllib.request` to handle URLs that use FTP. For more " +"information on FTP (File Transfer Protocol), see internet :rfc:`959`." msgstr "" +#: ../../library/ftplib.rst:22 msgid "The default encoding is UTF-8, following :rfc:`2640`." msgstr "" +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/ftplib.rst:26 msgid "Here's a sample session using the :mod:`!ftplib` module::" msgstr "" +#: ../../library/ftplib.rst:28 msgid "" ">>> from ftplib import FTP\n" ">>> ftp = FTP('ftp.us.debian.org') # connect to host, default port\n" @@ -65,222 +81,438 @@ msgid "" "'221 Goodbye.'" msgstr "" +#: ../../library/ftplib.rst:51 msgid "Reference" msgstr "" +#: ../../library/ftplib.rst:56 msgid "FTP objects" msgstr "" +#: ../../library/ftplib.rst:87 msgid "Return a new instance of the :class:`FTP` class." msgstr "" +#: ../../library/ftplib.rst:0 msgid "Parameters" msgstr "" -msgid "The hostname to connect to. If given, :code:`connect(host)` is implicitly called by the constructor." +#: ../../library/ftplib.rst:89 ../../library/ftplib.rst:461 +msgid "" +"The hostname to connect to. If given, :code:`connect(host)` is implicitly " +"called by the constructor." msgstr "" -msgid "|param_doc_user| If given, :code:`login(host, passwd, acct)` is implicitly called by the constructor." +#: ../../library/ftplib.rst:93 ../../library/ftplib.rst:465 +msgid "" +"|param_doc_user| If given, :code:`login(host, passwd, acct)` is implicitly " +"called by the constructor." msgstr "" +#: ../../library/ftplib.rst:98 ../../library/ftplib.rst:212 +#: ../../library/ftplib.rst:470 msgid "|param_doc_passwd|" msgstr "" +#: ../../library/ftplib.rst:101 ../../library/ftplib.rst:215 +#: ../../library/ftplib.rst:473 msgid "|param_doc_acct|" msgstr "" -msgid "A timeout in seconds for blocking operations like :meth:`connect` (default: the global default timeout setting)." +#: ../../library/ftplib.rst:104 +msgid "" +"A timeout in seconds for blocking operations like :meth:`connect` (default: " +"the global default timeout setting)." msgstr "" +#: ../../library/ftplib.rst:109 ../../library/ftplib.rst:183 +#: ../../library/ftplib.rst:488 msgid "|param_doc_source_address|" msgstr "" +#: ../../library/ftplib.rst:113 ../../library/ftplib.rst:492 msgid "|param_doc_encoding|" msgstr "" +#: ../../library/ftplib.rst:116 msgid "The :class:`FTP` class supports the :keyword:`with` statement, e.g.:" msgstr "" +#: ../../library/ftplib.rst:130 msgid "Support for the :keyword:`with` statement was added." msgstr "" +#: ../../library/ftplib.rst:133 ../../library/ftplib.rst:189 msgid "*source_address* parameter was added." msgstr "" -msgid "If the *timeout* parameter is set to be zero, it will raise a :class:`ValueError` to prevent the creation of a non-blocking socket. The *encoding* parameter was added, and the default was changed from Latin-1 to UTF-8 to follow :rfc:`2640`." +#: ../../library/ftplib.rst:136 ../../library/ftplib.rst:505 +msgid "" +"If the *timeout* parameter is set to be zero, it will raise " +"a :class:`ValueError` to prevent the creation of a non-blocking socket. The " +"*encoding* parameter was added, and the default was changed from Latin-1 to " +"UTF-8 to follow :rfc:`2640`." msgstr "" -msgid "Several :class:`!FTP` methods are available in two flavors: one for handling text files and another for binary files. The methods are named for the command which is used followed by ``lines`` for the text version or ``binary`` for the binary version." +#: ../../library/ftplib.rst:142 +msgid "" +"Several :class:`!FTP` methods are available in two flavors: one for handling " +"text files and another for binary files. The methods are named for the " +"command which is used followed by ``lines`` for the text version or " +"``binary`` for the binary version." msgstr "" +#: ../../library/ftplib.rst:147 msgid ":class:`FTP` instances have the following methods:" msgstr "" -msgid "Set the instance's debugging level as an :class:`int`. This controls the amount of debugging output printed. The debug levels are:" +#: ../../library/ftplib.rst:151 +msgid "" +"Set the instance's debugging level as an :class:`int`. This controls the " +"amount of debugging output printed. The debug levels are:" msgstr "" +#: ../../library/ftplib.rst:155 msgid "``0`` (default): No debug output." msgstr "" -msgid "``1``: Produce a moderate amount of debug output, generally a single line per request." +#: ../../library/ftplib.rst:156 +msgid "" +"``1``: Produce a moderate amount of debug output, generally a single line " +"per request." msgstr "" -msgid "``2`` or higher: Produce the maximum amount of debugging output, logging each line sent and received on the control connection." +#: ../../library/ftplib.rst:158 +msgid "" +"``2`` or higher: Produce the maximum amount of debugging output, logging " +"each line sent and received on the control connection." msgstr "" -msgid "Connect to the given host and port. This function should be called only once for each instance; it should not be called if a *host* argument was given when the :class:`FTP` instance was created. All other :class:`!FTP` methods can only be called after a connection has successfully been made." +#: ../../library/ftplib.rst:163 +msgid "" +"Connect to the given host and port. This function should be called only once " +"for each instance; it should not be called if a *host* argument was given " +"when the :class:`FTP` instance was created. All other :class:`!FTP` methods " +"can only be called after a connection has successfully been made." msgstr "" +#: ../../library/ftplib.rst:170 msgid "The host to connect to." msgstr "" -msgid "The TCP port to connect to (default: ``21``, as specified by the FTP protocol specification). It is rarely needed to specify a different port number." +#: ../../library/ftplib.rst:173 +msgid "" +"The TCP port to connect to (default: ``21``, as specified by the FTP " +"protocol specification). It is rarely needed to specify a different port " +"number." msgstr "" -msgid "A timeout in seconds for the connection attempt (default: the global default timeout setting)." +#: ../../library/ftplib.rst:178 +msgid "" +"A timeout in seconds for the connection attempt (default: the global default " +"timeout setting)." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ftplib.connect`` with arguments ``self``, ``host``, ``port``." +#: ../../library/ftplib.rst:187 +msgid "" +"Raises an :ref:`auditing event ` ``ftplib.connect`` with arguments " +"``self``, ``host``, ``port``." msgstr "" -msgid "Return the welcome message sent by the server in reply to the initial connection. (This message sometimes contains disclaimers or help information that may be relevant to the user.)" +#: ../../library/ftplib.rst:195 +msgid "" +"Return the welcome message sent by the server in reply to the initial " +"connection. (This message sometimes contains disclaimers or help " +"information that may be relevant to the user.)" msgstr "" -msgid "Log on to the connected FTP server. This function should be called only once for each instance, after a connection has been established; it should not be called if the *host* and *user* arguments were given when the :class:`FTP` instance was created. Most FTP commands are only allowed after the client has logged in." +#: ../../library/ftplib.rst:202 +msgid "" +"Log on to the connected FTP server. This function should be called only once " +"for each instance, after a connection has been established; it should not be " +"called if the *host* and *user* arguments were given when the :class:`FTP` " +"instance was created. Most FTP commands are only allowed after the client " +"has logged in." msgstr "" +#: ../../library/ftplib.rst:209 msgid "|param_doc_user|" msgstr "" -msgid "Abort a file transfer that is in progress. Using this does not always work, but it's worth a try." +#: ../../library/ftplib.rst:221 +msgid "" +"Abort a file transfer that is in progress. Using this does not always work, " +"but it's worth a try." msgstr "" -msgid "Send a simple command string to the server and return the response string." +#: ../../library/ftplib.rst:227 +msgid "" +"Send a simple command string to the server and return the response string." msgstr "" -msgid "Raises an :ref:`auditing event ` ``ftplib.sendcmd`` with arguments ``self``, ``cmd``." +#: ../../library/ftplib.rst:229 ../../library/ftplib.rst:238 +msgid "" +"Raises an :ref:`auditing event ` ``ftplib.sendcmd`` with arguments " +"``self``, ``cmd``." msgstr "" -msgid "Send a simple command string to the server and handle the response. Return the response string if the response code corresponds to success (codes in the range 200--299). Raise :exc:`error_reply` otherwise." +#: ../../library/ftplib.rst:234 +msgid "" +"Send a simple command string to the server and handle the response. Return " +"the response string if the response code corresponds to success (codes in " +"the range 200--299). Raise :exc:`error_reply` otherwise." msgstr "" +#: ../../library/ftplib.rst:243 msgid "Retrieve a file in binary transfer mode." msgstr "" +#: ../../library/ftplib.rst:245 msgid "An appropriate ``RETR`` command: :samp:`\"RETR {filename}\"`." msgstr "" -msgid "A single parameter callable that is called for each block of data received, with its single argument being the data as :class:`bytes`." +#: ../../library/ftplib.rst:248 +msgid "" +"A single parameter callable that is called for each block of data received, " +"with its single argument being the data as :class:`bytes`." msgstr "" -msgid "The maximum chunk size to read on the low-level :class:`~socket.socket` object created to do the actual transfer. This also corresponds to the largest size of data that will be passed to *callback*. Defaults to ``8192``." +#: ../../library/ftplib.rst:254 +msgid "" +"The maximum chunk size to read on the low-level :class:`~socket.socket` " +"object created to do the actual transfer. This also corresponds to the " +"largest size of data that will be passed to *callback*. Defaults to ``8192``." msgstr "" -msgid "A ``REST`` command to be sent to the server. See the documentation for the *rest* parameter of the :meth:`transfercmd` method." +#: ../../library/ftplib.rst:261 ../../library/ftplib.rst:308 +msgid "" +"A ``REST`` command to be sent to the server. See the documentation for the " +"*rest* parameter of the :meth:`transfercmd` method." msgstr "" -msgid "Retrieve a file or directory listing in the encoding specified by the *encoding* parameter at initialization. *cmd* should be an appropriate ``RETR`` command (see :meth:`retrbinary`) or a command such as ``LIST`` or ``NLST`` (usually just the string ``'LIST'``). ``LIST`` retrieves a list of files and information about those files. ``NLST`` retrieves a list of file names. The *callback* function is called for each line with a string argument containing the line with the trailing CRLF stripped. The default *callback* prints the line to :data:`sys.stdout`." +#: ../../library/ftplib.rst:268 +msgid "" +"Retrieve a file or directory listing in the encoding specified by the " +"*encoding* parameter at initialization. *cmd* should be an appropriate " +"``RETR`` command (see :meth:`retrbinary`) or a command such as ``LIST`` or " +"``NLST`` (usually just the string ``'LIST'``). ``LIST`` retrieves a list of " +"files and information about those files. ``NLST`` retrieves a list of file " +"names. The *callback* function is called for each line with a string " +"argument containing the line with the trailing CRLF stripped. The default " +"*callback* prints the line to :data:`sys.stdout`." msgstr "" -msgid "Enable \"passive\" mode if *val* is true, otherwise disable passive mode. Passive mode is on by default." +#: ../../library/ftplib.rst:281 +msgid "" +"Enable \"passive\" mode if *val* is true, otherwise disable passive mode. " +"Passive mode is on by default." msgstr "" +#: ../../library/ftplib.rst:287 msgid "Store a file in binary transfer mode." msgstr "" +#: ../../library/ftplib.rst:289 msgid "An appropriate ``STOR`` command: :samp:`\"STOR {filename}\"`." msgstr "" -msgid "A file object (opened in binary mode) which is read until EOF, using its :meth:`~io.RawIOBase.read` method in blocks of size *blocksize* to provide the data to be stored." +#: ../../library/ftplib.rst:292 +msgid "" +"A file object (opened in binary mode) which is read until EOF, using " +"its :meth:`~io.RawIOBase.read` method in blocks of size *blocksize* to " +"provide the data to be stored." msgstr "" +#: ../../library/ftplib.rst:298 msgid "The read block size. Defaults to ``8192``." msgstr "" -msgid "A single parameter callable that is called for each block of data sent, with its single argument being the data as :class:`bytes`." +#: ../../library/ftplib.rst:302 +msgid "" +"A single parameter callable that is called for each block of data sent, with " +"its single argument being the data as :class:`bytes`." msgstr "" +#: ../../library/ftplib.rst:312 msgid "The *rest* parameter was added." msgstr "" -msgid "Store a file in line mode. *cmd* should be an appropriate ``STOR`` command (see :meth:`storbinary`). Lines are read until EOF from the :term:`file object` *fp* (opened in binary mode) using its :meth:`~io.IOBase.readline` method to provide the data to be stored. *callback* is an optional single parameter callable that is called on each line after it is sent." -msgstr "" - -msgid "Initiate a transfer over the data connection. If the transfer is active, send an ``EPRT`` or ``PORT`` command and the transfer command specified by *cmd*, and accept the connection. If the server is passive, send an ``EPSV`` or ``PASV`` command, connect to it, and start the transfer command. Either way, return the socket for the connection." +#: ../../library/ftplib.rst:318 +msgid "" +"Store a file in line mode. *cmd* should be an appropriate ``STOR`` command " +"(see :meth:`storbinary`). Lines are read until EOF from the :term:`file " +"object` *fp* (opened in binary mode) using its :meth:`~io.IOBase.readline` " +"method to provide the data to be stored. *callback* is an optional single " +"parameter callable that is called on each line after it is sent." msgstr "" -msgid "If optional *rest* is given, a ``REST`` command is sent to the server, passing *rest* as an argument. *rest* is usually a byte offset into the requested file, telling the server to restart sending the file's bytes at the requested offset, skipping over the initial bytes. Note however that the :meth:`transfercmd` method converts *rest* to a string with the *encoding* parameter specified at initialization, but no check is performed on the string's contents. If the server does not recognize the ``REST`` command, an :exc:`error_reply` exception will be raised. If this happens, simply call :meth:`transfercmd` without a *rest* argument." +#: ../../library/ftplib.rst:327 +msgid "" +"Initiate a transfer over the data connection. If the transfer is active, " +"send an ``EPRT`` or ``PORT`` command and the transfer command specified by " +"*cmd*, and accept the connection. If the server is passive, send an " +"``EPSV`` or ``PASV`` command, connect to it, and start the transfer " +"command. Either way, return the socket for the connection." msgstr "" -msgid "Like :meth:`transfercmd`, but returns a tuple of the data connection and the expected size of the data. If the expected size could not be computed, ``None`` will be returned as the expected size. *cmd* and *rest* means the same thing as in :meth:`transfercmd`." +#: ../../library/ftplib.rst:333 +msgid "" +"If optional *rest* is given, a ``REST`` command is sent to the server, " +"passing *rest* as an argument. *rest* is usually a byte offset into the " +"requested file, telling the server to restart sending the file's bytes at " +"the requested offset, skipping over the initial bytes. Note however that " +"the :meth:`transfercmd` method converts *rest* to a string with the " +"*encoding* parameter specified at initialization, but no check is performed " +"on the string's contents. If the server does not recognize the ``REST`` " +"command, an :exc:`error_reply` exception will be raised. If this happens, " +"simply call :meth:`transfercmd` without a *rest* argument." +msgstr "" + +#: ../../library/ftplib.rst:346 +msgid "" +"Like :meth:`transfercmd`, but returns a tuple of the data connection and the " +"expected size of the data. If the expected size could not be computed, " +"``None`` will be returned as the expected size. *cmd* and *rest* means the " +"same thing as in :meth:`transfercmd`." msgstr "" -msgid "List a directory in a standardized format by using ``MLSD`` command (:rfc:`3659`). If *path* is omitted the current directory is assumed. *facts* is a list of strings representing the type of information desired (e.g. ``[\"type\", \"size\", \"perm\"]``). Return a generator object yielding a tuple of two elements for every file found in path. First element is the file name, the second one is a dictionary containing facts about the file name. Content of this dictionary might be limited by the *facts* argument but server is not guaranteed to return all requested facts." +#: ../../library/ftplib.rst:354 +msgid "" +"List a directory in a standardized format by using ``MLSD`` command " +"(:rfc:`3659`). If *path* is omitted the current directory is assumed. " +"*facts* is a list of strings representing the type of information desired " +"(e.g. ``[\"type\", \"size\", \"perm\"]``). Return a generator object " +"yielding a tuple of two elements for every file found in path. First " +"element is the file name, the second one is a dictionary containing facts " +"about the file name. Content of this dictionary might be limited by the " +"*facts* argument but server is not guaranteed to return all requested facts." msgstr "" -msgid "Return a list of file names as returned by the ``NLST`` command. The optional *argument* is a directory to list (default is the current server directory). Multiple arguments can be used to pass non-standard options to the ``NLST`` command." +#: ../../library/ftplib.rst:368 +msgid "" +"Return a list of file names as returned by the ``NLST`` command. The " +"optional *argument* is a directory to list (default is the current server " +"directory). Multiple arguments can be used to pass non-standard options to " +"the ``NLST`` command." msgstr "" +#: ../../library/ftplib.rst:373 ../../library/ftplib.rst:385 msgid "If your server supports the command, :meth:`mlsd` offers a better API." msgstr "" -msgid "Produce a directory listing as returned by the ``LIST`` command, printing it to standard output. The optional *argument* is a directory to list (default is the current server directory). Multiple arguments can be used to pass non-standard options to the ``LIST`` command. If the last argument is a function, it is used as a *callback* function as for :meth:`retrlines`; the default prints to :data:`sys.stdout`. This method returns ``None``." +#: ../../library/ftplib.rst:378 +msgid "" +"Produce a directory listing as returned by the ``LIST`` command, printing it " +"to standard output. The optional *argument* is a directory to list (default " +"is the current server directory). Multiple arguments can be used to pass " +"non-standard options to the ``LIST`` command. If the last argument is a " +"function, it is used as a *callback* function as for :meth:`retrlines`; the " +"default prints to :data:`sys.stdout`. This method returns ``None``." msgstr "" +#: ../../library/ftplib.rst:390 msgid "Rename file *fromname* on the server to *toname*." msgstr "" -msgid "Remove the file named *filename* from the server. If successful, returns the text of the response, otherwise raises :exc:`error_perm` on permission errors or :exc:`error_reply` on other errors." +#: ../../library/ftplib.rst:395 +msgid "" +"Remove the file named *filename* from the server. If successful, returns " +"the text of the response, otherwise raises :exc:`error_perm` on permission " +"errors or :exc:`error_reply` on other errors." msgstr "" +#: ../../library/ftplib.rst:402 msgid "Set the current directory on the server." msgstr "" +#: ../../library/ftplib.rst:407 msgid "Create a new directory on the server." msgstr "" +#: ../../library/ftplib.rst:412 msgid "Return the pathname of the current directory on the server." msgstr "" +#: ../../library/ftplib.rst:417 msgid "Remove the directory named *dirname* on the server." msgstr "" -msgid "Request the size of the file named *filename* on the server. On success, the size of the file is returned as an integer, otherwise ``None`` is returned. Note that the ``SIZE`` command is not standardized, but is supported by many common server implementations." +#: ../../library/ftplib.rst:422 +msgid "" +"Request the size of the file named *filename* on the server. On success, " +"the size of the file is returned as an integer, otherwise ``None`` is " +"returned. Note that the ``SIZE`` command is not standardized, but is " +"supported by many common server implementations." msgstr "" -msgid "Send a ``QUIT`` command to the server and close the connection. This is the \"polite\" way to close a connection, but it may raise an exception if the server responds with an error to the ``QUIT`` command. This implies a call to the :meth:`close` method which renders the :class:`FTP` instance useless for subsequent calls (see below)." +#: ../../library/ftplib.rst:430 +msgid "" +"Send a ``QUIT`` command to the server and close the connection. This is the " +"\"polite\" way to close a connection, but it may raise an exception if the " +"server responds with an error to the ``QUIT`` command. This implies a call " +"to the :meth:`close` method which renders the :class:`FTP` instance useless " +"for subsequent calls (see below)." msgstr "" -msgid "Close the connection unilaterally. This should not be applied to an already closed connection such as after a successful call to :meth:`~FTP.quit`. After this call the :class:`FTP` instance should not be used any more (after a call to :meth:`close` or :meth:`~FTP.quit` you cannot reopen the connection by issuing another :meth:`login` method)." +#: ../../library/ftplib.rst:439 +msgid "" +"Close the connection unilaterally. This should not be applied to an already " +"closed connection such as after a successful call to :meth:`~FTP.quit`. " +"After this call the :class:`FTP` instance should not be used any more (after " +"a call to :meth:`close` or :meth:`~FTP.quit` you cannot reopen the " +"connection by issuing another :meth:`login` method)." msgstr "" +#: ../../library/ftplib.rst:447 msgid "FTP_TLS objects" msgstr "" -msgid "An :class:`FTP` subclass which adds TLS support to FTP as described in :rfc:`4217`. Connect to port 21 implicitly securing the FTP control connection before authenticating." +#: ../../library/ftplib.rst:452 +msgid "" +"An :class:`FTP` subclass which adds TLS support to FTP as described " +"in :rfc:`4217`. Connect to port 21 implicitly securing the FTP control " +"connection before authenticating." msgstr "" -msgid "The user must explicitly secure the data connection by calling the :meth:`prot_p` method." +#: ../../library/ftplib.rst:458 +msgid "" +"The user must explicitly secure the data connection by calling " +"the :meth:`prot_p` method." msgstr "" -msgid "An SSL context object which allows bundling SSL configuration options, certificates and private keys into a single, potentially long-lived, structure. Please read :ref:`ssl-security` for best practices." +#: ../../library/ftplib.rst:476 +msgid "" +"An SSL context object which allows bundling SSL configuration options, " +"certificates and private keys into a single, potentially long-lived, " +"structure. Please read :ref:`ssl-security` for best practices." msgstr "" -msgid "A timeout in seconds for blocking operations like :meth:`~FTP.connect` (default: the global default timeout setting)." +#: ../../library/ftplib.rst:483 +msgid "" +"A timeout in seconds for blocking operations like :meth:`~FTP.connect` " +"(default: the global default timeout setting)." msgstr "" +#: ../../library/ftplib.rst:497 msgid "Added the *source_address* parameter." msgstr "" -msgid "The class now supports hostname check with :attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." +#: ../../library/ftplib.rst:500 +msgid "" +"The class now supports hostname check " +"with :attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* " +"(see :const:`ssl.HAS_SNI`)." msgstr "" +#: ../../library/ftplib.rst:511 msgid "The deprecated *keyfile* and *certfile* parameters have been removed." msgstr "" +#: ../../library/ftplib.rst:514 msgid "Here's a sample session using the :class:`FTP_TLS` class::" msgstr "" +#: ../../library/ftplib.rst:516 msgid "" ">>> ftps = FTP_TLS('ftp.pureftpd.org')\n" ">>> ftps.login()\n" @@ -288,59 +520,107 @@ msgid "" ">>> ftps.prot_p()\n" "'200 Data protection level set to \"private\"'\n" ">>> ftps.nlst()\n" -"['6jack', 'OpenBSD', 'antilink', 'blogbench', 'bsdcam', 'clockspeed', 'djbdns-jedi', 'docs', 'eaccelerator-jedi', 'favicon.ico', 'francotone', 'fugu', 'ignore', 'libpuzzle', 'metalog', 'minidentd', 'misc', 'mysql-udf-global-user-variables', 'php-jenkins-hash', 'php-skein-hash', 'php-webdav', 'phpaudit', 'phpbench', 'pincaster', 'ping', 'posto', 'pub', 'public', 'public_keys', 'pure-ftpd', 'qscan', 'qtc', 'sharedance', 'skycache', 'sound', 'tmp', 'ucarp']" +"['6jack', 'OpenBSD', 'antilink', 'blogbench', 'bsdcam', 'clockspeed', " +"'djbdns-jedi', 'docs', 'eaccelerator-jedi', 'favicon.ico', 'francotone', " +"'fugu', 'ignore', 'libpuzzle', 'metalog', 'minidentd', 'misc', 'mysql-udf-" +"global-user-variables', 'php-jenkins-hash', 'php-skein-hash', 'php-webdav', " +"'phpaudit', 'phpbench', 'pincaster', 'ping', 'posto', 'pub', 'public', " +"'public_keys', 'pure-ftpd', 'qscan', 'qtc', 'sharedance', 'skycache', " +"'sound', 'tmp', 'ucarp']" msgstr "" -msgid ":class:`!FTP_TLS` class inherits from :class:`FTP`, defining these additional methods and attributes:" +#: ../../library/ftplib.rst:524 +msgid "" +":class:`!FTP_TLS` class inherits from :class:`FTP`, defining these " +"additional methods and attributes:" msgstr "" +#: ../../library/ftplib.rst:529 msgid "The SSL version to use (defaults to :data:`ssl.PROTOCOL_SSLv23`)." msgstr "" -msgid "Set up a secure control connection by using TLS or SSL, depending on what is specified in the :attr:`ssl_version` attribute." +#: ../../library/ftplib.rst:533 +msgid "" +"Set up a secure control connection by using TLS or SSL, depending on what is " +"specified in the :attr:`ssl_version` attribute." msgstr "" -msgid "The method now supports hostname check with :attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." +#: ../../library/ftplib.rst:536 +msgid "" +"The method now supports hostname check " +"with :attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* " +"(see :const:`ssl.HAS_SNI`)." msgstr "" -msgid "Revert control channel back to plaintext. This can be useful to take advantage of firewalls that know how to handle NAT with non-secure FTP without opening fixed ports." +#: ../../library/ftplib.rst:543 +msgid "" +"Revert control channel back to plaintext. This can be useful to take " +"advantage of firewalls that know how to handle NAT with non-secure FTP " +"without opening fixed ports." msgstr "" +#: ../../library/ftplib.rst:551 msgid "Set up secure data connection." msgstr "" +#: ../../library/ftplib.rst:555 msgid "Set up clear text data connection." msgstr "" +#: ../../library/ftplib.rst:559 msgid "Module variables" msgstr "" +#: ../../library/ftplib.rst:563 msgid "Exception raised when an unexpected reply is received from the server." msgstr "" -msgid "Exception raised when an error code signifying a temporary error (response codes in the range 400--499) is received." +#: ../../library/ftplib.rst:568 +msgid "" +"Exception raised when an error code signifying a temporary error (response " +"codes in the range 400--499) is received." msgstr "" -msgid "Exception raised when an error code signifying a permanent error (response codes in the range 500--599) is received." +#: ../../library/ftplib.rst:574 +msgid "" +"Exception raised when an error code signifying a permanent error (response " +"codes in the range 500--599) is received." msgstr "" -msgid "Exception raised when a reply is received from the server that does not fit the response specifications of the File Transfer Protocol, i.e. begin with a digit in the range 1--5." +#: ../../library/ftplib.rst:580 +msgid "" +"Exception raised when a reply is received from the server that does not fit " +"the response specifications of the File Transfer Protocol, i.e. begin with a " +"digit in the range 1--5." msgstr "" -msgid "The set of all exceptions (as a tuple) that methods of :class:`FTP` instances may raise as a result of problems with the FTP connection (as opposed to programming errors made by the caller). This set includes the four exceptions listed above as well as :exc:`OSError` and :exc:`EOFError`." +#: ../../library/ftplib.rst:587 +msgid "" +"The set of all exceptions (as a tuple) that methods of :class:`FTP` " +"instances may raise as a result of problems with the FTP connection (as " +"opposed to programming errors made by the caller). This set includes the " +"four exceptions listed above as well as :exc:`OSError` and :exc:`EOFError`." msgstr "" +#: ../../library/ftplib.rst:595 msgid "Module :mod:`netrc`" msgstr "" -msgid "Parser for the :file:`.netrc` file format. The file :file:`.netrc` is typically used by FTP clients to load user authentication information before prompting the user." +#: ../../library/ftplib.rst:596 +msgid "" +"Parser for the :file:`.netrc` file format. The file :file:`.netrc` is " +"typically used by FTP clients to load user authentication information before " +"prompting the user." msgstr "" +#: ../../library/ftplib.rst:9 msgid "FTP" msgstr "" +#: ../../library/ftplib.rst:9 msgid "protocol" msgstr "" +#: ../../library/ftplib.rst:9 msgid "ftplib (standard module)" msgstr "" diff --git a/library/functional.po b/library/functional.po index f237490d1..2f0c03189 100644 --- a/library/functional.po +++ b/library/functional.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,11 +21,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/functional.rst:3 msgid "Functional Programming Modules" msgstr "" -msgid "The modules described in this chapter provide functions and classes that support a functional programming style, and general operations on callables." +#: ../../library/functional.rst:5 +msgid "" +"The modules described in this chapter provide functions and classes that " +"support a functional programming style, and general operations on callables." msgstr "" +#: ../../library/functional.rst:8 msgid "The following modules are documented in this chapter:" msgstr "" diff --git a/library/functions.po b/library/functions.po index 0f73c73f9..48ac7c7f9 100644 --- a/library/functions.po +++ b/library/functions.po @@ -17,8 +17,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" -"PO-Revision-Date: 2026-08-16 12:46+0330\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" +"PO-Revision-Date: 2026-08-25 20:47+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/)\n" "Language: fa\n" @@ -28,297 +28,407 @@ msgstr "" "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" msgstr "توابع پیش ساخته" -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." -msgstr "مفسر پایتون دارای تعدادی تابع و نوع داده (type) است که در آن بصورت توکار (built-in) همیشه در دسترس می‌باشند. آن‌ها در اینجا به ترتیب حروف الفبا فهرست شده‌اند." +#: ../../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." +msgstr "" +"مفسر پایتون دارای تعدادی تابع و نوع داده (type) است که در آن بصورت توکار (built-in) همیشه در دسترس می‌باشند. آن‌ها در " +"اینجا به ترتیب حروف الفبا فهرست شده‌اند." +#: ../../library/functions.rst:0 msgid "**A**" msgstr "**A**" +#: ../../library/functions.rst:0 msgid ":func:`abs`" msgstr ":func:`abs`" +#: ../../library/functions.rst:0 msgid ":func:`aiter`" msgstr ":func:`aiter`" +#: ../../library/functions.rst:0 msgid ":func:`all`" msgstr ":func:`all`" +#: ../../library/functions.rst:0 msgid ":func:`anext`" msgstr ":func:`anext`" +#: ../../library/functions.rst:0 msgid ":func:`any`" msgstr ":func:`any`" +#: ../../library/functions.rst:0 msgid ":func:`ascii`" msgstr ":func:`ascii`" +#: ../../library/functions.rst:0 msgid "**B**" msgstr "**B**" +#: ../../library/functions.rst:0 msgid ":func:`bin`" msgstr ":func:`bin`" +#: ../../library/functions.rst:0 msgid ":func:`bool`" msgstr ":func:`bool`" +#: ../../library/functions.rst:0 msgid ":func:`breakpoint`" msgstr ":func:`breakpoint`" +#: ../../library/functions.rst:0 msgid "|func-bytearray|_" msgstr "|func-bytearray|_" +#: ../../library/functions.rst:0 msgid "|func-bytes|_" msgstr "|func-bytes|_" +#: ../../library/functions.rst:0 msgid "**C**" msgstr "**C**" +#: ../../library/functions.rst:0 msgid ":func:`callable`" msgstr ":func:`callable`" +#: ../../library/functions.rst:0 msgid ":func:`chr`" msgstr ":func:`chr`" +#: ../../library/functions.rst:0 msgid ":func:`classmethod`" msgstr ":func:`classmethod`" +#: ../../library/functions.rst:0 msgid ":func:`compile`" msgstr ":func:`compile`" +#: ../../library/functions.rst:0 msgid ":func:`complex`" msgstr ":func:`complex`" +#: ../../library/functions.rst:0 msgid "**D**" msgstr "**D**" +#: ../../library/functions.rst:0 msgid ":func:`delattr`" msgstr ":func:`delattr`" +#: ../../library/functions.rst:0 msgid "|func-dict|_" msgstr "|func-dict|_" +#: ../../library/functions.rst:0 msgid ":func:`dir`" msgstr ":func:`dir`" +#: ../../library/functions.rst:0 msgid ":func:`divmod`" msgstr ":func:`divmod`" +#: ../../library/functions.rst:0 msgid "**E**" msgstr "**E**" +#: ../../library/functions.rst:0 msgid ":func:`enumerate`" msgstr ":func:`enumerate`" +#: ../../library/functions.rst:0 msgid ":func:`eval`" msgstr ":func:`eval`" +#: ../../library/functions.rst:0 msgid ":func:`exec`" msgstr ":func:`exec`" +#: ../../library/functions.rst:0 msgid "**F**" msgstr "**F**" +#: ../../library/functions.rst:0 msgid ":func:`filter`" msgstr ":func:`filter`" +#: ../../library/functions.rst:0 msgid ":func:`float`" msgstr ":func:`float`" +#: ../../library/functions.rst:0 msgid ":func:`format`" msgstr ":func:`format`" +#: ../../library/functions.rst:0 msgid "|func-frozenset|_" msgstr "|func-frozenset|_" +#: ../../library/functions.rst:0 msgid "**G**" msgstr "**G**" +#: ../../library/functions.rst:0 msgid ":func:`getattr`" msgstr ":func:`getattr`" +#: ../../library/functions.rst:0 msgid ":func:`globals`" msgstr ":func:`globals`" +#: ../../library/functions.rst:0 msgid "**H**" msgstr "**H**" +#: ../../library/functions.rst:0 msgid ":func:`hasattr`" msgstr ":func:`hasattr`" +#: ../../library/functions.rst:0 msgid ":func:`hash`" msgstr ":func:`hash`" +#: ../../library/functions.rst:0 msgid ":func:`help`" msgstr ":func:`help`" +#: ../../library/functions.rst:0 msgid ":func:`hex`" msgstr ":func:`hex`" +#: ../../library/functions.rst:0 msgid "**I**" msgstr "**I**" +#: ../../library/functions.rst:0 msgid ":func:`id`" msgstr ":func:`id`" +#: ../../library/functions.rst:0 msgid ":func:`input`" msgstr ":func:`input`" +#: ../../library/functions.rst:0 msgid ":func:`int`" msgstr ":func:`int`" +#: ../../library/functions.rst:0 msgid ":func:`isinstance`" msgstr ":func:`isinstance`" +#: ../../library/functions.rst:0 msgid ":func:`issubclass`" msgstr ":func:`issubclass`" +#: ../../library/functions.rst:0 msgid ":func:`iter`" msgstr ":func:`iter`" +#: ../../library/functions.rst:0 msgid "**L**" msgstr "**L**" +#: ../../library/functions.rst:0 msgid ":func:`len`" msgstr ":func:`len`" +#: ../../library/functions.rst:0 msgid "|func-list|_" msgstr "|func-list|_" +#: ../../library/functions.rst:0 msgid ":func:`locals`" msgstr ":func:`locals`" +#: ../../library/functions.rst:0 msgid "**M**" msgstr "**M**" +#: ../../library/functions.rst:0 msgid ":func:`map`" msgstr ":func:`map`" +#: ../../library/functions.rst:0 msgid ":func:`max`" msgstr ":func:`max`" +#: ../../library/functions.rst:0 msgid "|func-memoryview|_" msgstr "|func-memoryview|_" +#: ../../library/functions.rst:0 msgid ":func:`min`" msgstr ":func:`min`" +#: ../../library/functions.rst:0 msgid "**N**" msgstr "**N**" +#: ../../library/functions.rst:0 msgid ":func:`next`" msgstr ":func:`next`" +#: ../../library/functions.rst:0 msgid "**O**" msgstr "**O**" +#: ../../library/functions.rst:0 msgid ":func:`object`" msgstr ":func:`object`" +#: ../../library/functions.rst:0 msgid ":func:`oct`" msgstr ":func:`oct`" +#: ../../library/functions.rst:0 msgid ":func:`open`" msgstr ":func:`open`" +#: ../../library/functions.rst:0 msgid ":func:`ord`" msgstr ":func:`ord`" +#: ../../library/functions.rst:0 msgid "**P**" msgstr "**P**" +#: ../../library/functions.rst:0 msgid ":func:`pow`" msgstr ":func:`pow`" +#: ../../library/functions.rst:0 msgid ":func:`print`" msgstr ":func:`print`" +#: ../../library/functions.rst:0 msgid ":func:`property`" msgstr ":func:`property`" +#: ../../library/functions.rst:0 msgid "**R**" msgstr "**R**" +#: ../../library/functions.rst:0 msgid "|func-range|_" msgstr "|func-range|_" +#: ../../library/functions.rst:0 msgid ":func:`repr`" msgstr ":func:`repr`" +#: ../../library/functions.rst:0 msgid ":func:`reversed`" msgstr ":func:`reversed`" +#: ../../library/functions.rst:0 msgid ":func:`round`" msgstr ":func:`round`" +#: ../../library/functions.rst:0 msgid "**S**" msgstr "**S**" +#: ../../library/functions.rst:0 msgid "|func-set|_" msgstr "|func-set|_" +#: ../../library/functions.rst:0 msgid ":func:`setattr`" msgstr ":func:`setattr`" +#: ../../library/functions.rst:0 msgid ":func:`slice`" msgstr ":func:`slice`" +#: ../../library/functions.rst:0 msgid ":func:`sorted`" msgstr ":func:`sorted`" +#: ../../library/functions.rst:0 msgid ":func:`staticmethod`" msgstr ":func:`staticmethod`" +#: ../../library/functions.rst:0 msgid "|func-str|_" msgstr "|func-str|_" +#: ../../library/functions.rst:0 msgid ":func:`sum`" msgstr ":func:`sum`" +#: ../../library/functions.rst:0 msgid ":func:`super`" msgstr ":func:`super`" +#: ../../library/functions.rst:0 msgid "**T**" msgstr "**T**" +#: ../../library/functions.rst:0 msgid "|func-tuple|_" msgstr "|func-tuple|_" +#: ../../library/functions.rst:0 msgid ":func:`type`" msgstr ":func:`type`" +#: ../../library/functions.rst:0 msgid "**V**" msgstr "**V**" +#: ../../library/functions.rst:0 msgid ":func:`vars`" msgstr ":func:`vars`" +#: ../../library/functions.rst:0 msgid "**Z**" msgstr "**Z**" +#: ../../library/functions.rst:0 msgid ":func:`zip`" msgstr ":func:`zip`" +#: ../../library/functions.rst:0 msgid "**_**" msgstr "**_**" +#: ../../library/functions.rst:0 msgid ":func:`__import__`" msgstr ":func:`__import__`" -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." -msgstr "مقدار قدر مطلق یک عدد را برمی‌گرداند. آرگومان می تواند یک عدد صحیح، یک عدد اعشاری، یا یک شیء که :meth:`~object.__abs__` را پیاده سازی می‌کند، باشد. اگر ارگومان یک عدد مختلط باشد، بزرگی آن بازگردانده می‌شود." +#: ../../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." +msgstr "" +"مقدار قدر مطلق یک عدد را برمی‌گرداند. آرگومان می تواند یک عدد صحیح، یک عدد اعشاری، یا یک شیء " +"که :meth:`~object.__abs__` را پیاده سازی می‌کند، باشد. اگر ارگومان یک عدد مختلط باشد، بزرگی آن بازگردانده می‌شود." -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__()`` است." +#: ../../library/functions.rst:67 +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__()`` " +"است." +#: ../../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`` را برمی گرداند. معادل با::" +#: ../../library/functions.rst:79 msgid "" "def all(iterable):\n" " for element in iterable:\n" @@ -332,18 +442,37 @@ msgstr "" " return False\n" " return True" -msgid "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* را برمی‌گرداند." +#: ../../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." +msgstr "" +"هنگام اِنتظار (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 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` افزایش می یابد." +#: ../../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." +msgstr "" +"این متد :meth:`~object.__anext__` از *async_iterator* را فراخوانی می کند و یک :term:`awaitable` را برمی گرداند. در " +"انتظار این مقدار بعدی تکرار کننده را برمی گرداند. اگر *default* داده شود، اگر تکرار کننده تمام شده باشد، برگردانده " +"می شود، در غیر این صورت :exc:`StopAsyncIteration` افزایش می یابد." -msgid "Return ``True`` if any element of the *iterable* is true. If the iterable is empty, return ``False``. Equivalent to::" -msgstr "اگر هر عنصری از *iterable* درست باشد، ``True`` را برگردانید. اگر iterable خالی باشد، ``False`` را برگردانید. معادل با::" +#: ../../library/functions.rst:104 +msgid "" +"Return ``True`` if any element of the *iterable* is true. If the iterable is empty, return ``False``. Equivalent " +"to::" +msgstr "" +"اگر هر عنصری از *iterable* درست باشد، ``True`` را برگردانید. اگر iterable خالی باشد، ``False`` را برگردانید. معادل " +"با::" +#: ../../library/functions.rst:107 msgid "" "def any(iterable):\n" " for element in iterable:\n" @@ -357,93 +486,207 @@ msgstr "" " return True\n" " return False" -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." -msgstr "مانند تابع :func:`repr`، رشته‌ای حاوی نمایش قابل چاپ یک شیء را برمی‌گرداند، اما نویسه‌های غیر اَسکی (non-ASCII) را در رشته‌ی بازگردانده‌شده توسط تابع :func:`repr`، با استفاده از توالی‌های گریز (escapes) ``\\x``، ``\\u`` یا ``\\U`` اِسکِیپ (escape) می‌کند. این عمل، رشته‌ای مشابه آنچه تابع :func:`repr` در پایتون ۲ بازمی‌گرداند، تولید می‌کند." +#: ../../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." +msgstr "" +"مانند تابع :func:`repr`، رشته‌ای حاوی نمایش قابل چاپ یک شیء را برمی‌گرداند، اما نویسه‌های غیر اَسکی (non-ASCII) را در " +"رشته‌ی بازگردانده‌شده توسط تابع :func:`repr`، با استفاده از توالی‌های گریز (escapes) ``\\x``، ``\\u`` یا ``\\U`` اِسکِیپ " +"(escape) می‌کند. این عمل، رشته‌ای مشابه آنچه تابع :func:`repr` در پایتون ۲ بازمی‌گرداند، تولید می‌کند." -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:" -msgstr "تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک عبارت معتبر پایتون خواهد بود. اگر *integer* یک شیء پایتون :class:`int` نباشد، لازم است یک متد :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. برخی مثال ها:" +#: ../../library/functions.rst:124 +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:" +msgstr "" +"تبدیل یک عدد صحیح به یک رشته باینری که با \"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\" مطلوب باشد یا نباشد، می‌توانید از یکی از روش‌های زیر استفاده کنید." +#: ../../library/functions.rst:141 msgid "See also :func:`enum.bin` to represent negative values as twos-complement." msgstr "همچنین برای نمایش مقادیر منفی به‌صورت مکمل دو، به :func:`enum.bin` مراجعه کنید." +#: ../../library/functions.rst:143 ../../library/functions.rst:956 ../../library/functions.rst:1340 msgid "See also :func:`format` for more information." msgstr "همچنین برای اطلاعات بیشتر، به تابع :func:`format` مراجعه کنید." -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 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` مراجعه کنید)." +#: ../../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 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` مراجعه " +"کنید)." +#: ../../library/functions.rst:158 ../../library/functions.rst:821 msgid "The parameter is now positional-only." msgstr "این آرگومان اکنون فقط‌جایگاهی (positional-only) است." -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` را پرتاب خواهد کرد." - -msgid "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` مراجعه کنید." +#: ../../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` را پرتاب خواهد کرد." + +#: ../../library/functions.rst:175 +msgid "" +"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` مراجعه کنید." +#: ../../library/functions.rst:179 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 "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` مراجعه کنید." +#: ../../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`." +msgstr "" +"یک آرایهٔ جدید از بایت‌ها را برمی‌گرداند. کلاس :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 "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` به بایت‌ها تبدیل می‌کند." +#: ../../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`." +msgstr "" +"اگر *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." -msgstr "اگر «*source*» یک *عدد صحیح* «integer» باشد، آرایه به اندازه همان عدد ایجاد شده و با بایت‌های تهی «null byte» مقداردهی اولیه خواهد شد." +msgstr "" +"اگر «*source*» یک *عدد صحیح* «integer» باشد، آرایه به اندازه همان عدد ایجاد شده و با بایت‌های تهی «null byte» " +"مقداردهی اولیه خواهد شد." -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." -msgstr "اگر آرگومان، شیئی سازگار با :ref:`رابط بافر ` باشد، از یک بافر فقط‌خواندنیِ آن شیء برای مقداردهی اولیهٔ آرایهٔ بایت‌ها استفاده خواهد شد." +#: ../../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." +msgstr "" +"اگر آرگومان، شیئی سازگار با :ref:`رابط بافر ` باشد، از یک بافر فقط‌خواندنیِ آن شیء برای مقداردهی اولیهٔ " +"آرایهٔ بایت‌ها استفاده خواهد شد." -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." -msgstr "اگر «*source*» یک *تکرارپذیر* «iterable» باشد، باید یک تکرارپذیر از اعداد صحیح در بازه ``0 <= x < 256`` باشد، که این اعداد به‌عنوان محتویات اولیه آرایه استفاده می‌شوند." +#: ../../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." +msgstr "" +"اگر «*source*» یک *تکرارپذیر* «iterable» باشد، باید یک تکرارپذیر از اعداد صحیح در بازه ``0 <= x < 256`` باشد، که این " +"اعداد به‌عنوان محتویات اولیه آرایه استفاده می‌شوند." +#: ../../library/functions.rst:212 msgid "Without an argument, an array of size 0 is created." msgstr "بدون آرگومان، یک آرایه با اندازه صفر «0» ایجاد می شود." +#: ../../library/functions.rst:214 msgid "See also :ref:`binaryseq` and :ref:`typebytearray`." msgstr "همچنین به :ref:`binaryseq` و :ref:`typebytearray` مراجعه کنید." -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." -msgstr "یک شیء «bytes» جدید را برمی‌گرداند که دنباله‌ای تغییرناپذیر از اعداد صحیح در بازهٔ ``0 <= x < 256`` است. :class:`bytes` نسخهٔ تغییرناپذیر :class:`bytearray` است؛ همان متدهای غیرتغییردهنده و همان رفتار اندیس‌گذاری و برش (slicing) را دارد." +#: ../../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." +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 "بر این اساس، آرگومان‌های سازنده همانند :func:`bytearray` تفسیر می‌شوند." +#: ../../library/functions.rst:229 msgid "Bytes objects can also be created with literals, see :ref:`strings`." msgstr "اشیای bytes را می‌توان با استفاده از ثابت‌های متنی نیز ایجاد کرد؛ برای اطلاعات بیشتر، :ref:`strings` را ببینید." +#: ../../library/functions.rst:231 msgid "See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`." msgstr "همچنین به :ref:`binaryseq`، :ref:`typebytes` و :ref:`bytes-methods` مراجعه کنید." -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." -msgstr "اگر آرگومان *object* فراخوانی‌پذیر باشد، مقدار :const:`True` و در غیر این صورت مقدار :const:`False` را برمی‌گرداند. اگر نتیجه ``True`` باشد، همچنان ممکن است فراخوانی با شکست مواجه شود؛ اما اگر ``False`` باشد، فراخوانی *object* هرگز موفق نخواهد شد. توجه داشته باشید که کلاس‌ها فراخوانی‌پذیر هستند (فراخوانی یک کلاس یک نمونهٔ جدید برمی‌گرداند) و نمونه‌ها نیز در صورتی فراخوانی‌پذیر هستند که کلاس آن‌ها متد :meth:`~object.__call__` را داشته باشد." +#: ../../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." +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 "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: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`." +msgstr "" +"رشته‌ای را که نویسهٔ متناظر با نقطهٔ کد یونی‌کد مشخص‌شده را نمایش می‌دهد، برمی‌گرداند. برای مثال، ``chr(97)`` رشتهٔ ``'a'`` " +"و ``chr(8364)`` رشتهٔ ``'€'`` را برمی‌گرداند. این تابع معکوس :func:`ord` است." -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." -msgstr "بازهٔ معتبر برای این آرگومان از ۰ تا ۱٬۱۱۴٬۱۱۱ (برابر با 0x10FFFF در مبنای ۱۶) است. اگر مقدار خارج از این بازه باشد، استثنای :exc:`ValueError` پرتاب خواهد شد." +#: ../../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." +msgstr "" +"بازهٔ معتبر برای این آرگومان از ۰ تا ۱٬۱۱۴٬۱۱۱ (برابر با 0x10FFFF در مبنای ۱۶) است. اگر مقدار خارج از این بازه باشد، " +"استثنای :exc:`ValueError` پرتاب خواهد شد." +#: ../../library/functions.rst:259 msgid "Transform a method into a class method." msgstr "یک متد را به متد کلاسی تبدیل می‌کند." -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::" -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::" +msgstr "" +"یک متد کلاس، همان‌طور که متد نمونه، نمونه را به‌عنوان نخستین آرگومان ضمنی دریافت می‌کند، کلاس را به‌عنوان نخستین آرگومان " +"ضمنی دریافت می‌کند. برای تعریف یک متد کلاس، از الگوی زیر استفاده کنید::" +#: ../../library/functions.rst:265 msgid "" "class C:\n" " @classmethod\n" @@ -453,72 +696,179 @@ msgstr "" " @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 "شکل ``@classmethod`` یک :term:`تزئین‌کننده ` تابع است؛ برای جزئیات به :ref:`function` مراجعه کنید." -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." -msgstr "یک متد کلاس را می‌توان هم روی خود کلاس (مانند ``C.f()``) و هم روی یک نمونه (مانند ``C().f()``) فراخوانی کرد. در حالت دوم، نمونه نادیده گرفته می‌شود و فقط کلاس آن در نظر گرفته می‌شود. اگر متد کلاس برای یک کلاس مشتق‌شده فراخوانی شود، شیء کلاس مشتق‌شده به‌عنوان نخستین آرگومان ضمنی ارسال می‌شود." +#: ../../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." +msgstr "" +"یک متد کلاس را می‌توان هم روی خود کلاس (مانند ``C.f()``) و هم روی یک نمونه (مانند ``C().f()``) فراخوانی کرد. در حالت " +"دوم، نمونه نادیده گرفته می‌شود و فقط کلاس آن در نظر گرفته می‌شود. اگر متد کلاس برای یک کلاس مشتق‌شده فراخوانی شود، شیء " +"کلاس مشتق‌شده به‌عنوان نخستین آرگومان ضمنی ارسال می‌شود." -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`." -msgstr "متدهای کلاس با متدهای ایستای زبان‌های ++C یا Java تفاوت دارند. اگر به آن نوع متدها نیاز دارید، به :func:`staticmethod` در همین بخش مراجعه کنید. برای اطلاعات بیشتر دربارهٔ متدهای کلاس، :ref:`types` را ببینید." +#: ../../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`." +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 "اکنون متدهای کلاس می‌توانند سایر :term:`توصیفگرها `، مانند :func:`property`، را دربر بگیرند." -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." -msgstr "اکنون متدهای کلاس ویژگی‌های متد (:attr:`~function.__module__`، :attr:`~function.__name__`، :attr:`~function.__qualname__`، :attr:`~function.__doc__` و :attr:`~function.__annotations__`) را به ارث می‌برند و همچنین دارای ویژگی جدید ``__wrapped__`` هستند." +#: ../../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." +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 "دیگر متدهای کلاس نمی‌توانند سایر :term:`توصیفگرها `، مانند :func:`property`، را دربر بگیرند." -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." -msgstr "*source* را به یک شیء کد یا AST کامپایل می‌کند. اشیای کد را می‌توان با :func:`exec` یا :func:`eval` اجرا کرد. *source* می‌تواند یک رشتهٔ معمولی، یک رشتهٔ بایتی یا یک شیء AST باشد. برای اطلاعات بیشتر دربارهٔ کار با اشیای AST، به مستندات ماژول :mod:`ast` مراجعه کنید." - -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)." -msgstr "آرگومان *filename* باید نام پرونده‌ای را مشخص کند که کد از آن خوانده شده است؛ اگر کد از پرونده خوانده نشده، مقدار قابل تشخیصی را ارسال کنید (معمولاً از ``''`` استفاده می‌شود)." +#: ../../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." +msgstr "" +"*source* را به یک شیء کد یا AST کامپایل می‌کند. اشیای کد را می‌توان با :func:`exec` یا :func:`eval` اجرا کرد. *source* " +"می‌تواند یک رشتهٔ معمولی، یک رشتهٔ بایتی یا یک شیء AST باشد. برای اطلاعات بیشتر دربارهٔ کار با اشیای AST، به مستندات " +"ماژول :mod:`ast` مراجعه کنید." -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)." -msgstr "آرگومان *mode* مشخص می‌کند که چه نوع کدی باید کامپایل شود؛ اگر *source* شامل دنباله‌ای از دستورها باشد، می‌تواند ``'exec'`` باشد؛ اگر شامل تنها یک عبارت باشد، ``'eval'``؛ و اگر شامل تنها یک دستور تعاملی باشد، ``'single'`` (در حالت آخر، اگر عبارت مقداری غیر از ``None`` تولید کند، آن مقدار چاپ خواهد شد)." +#: ../../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)." +msgstr "" +"آرگومان *filename* باید نام پرونده‌ای را مشخص کند که کد از آن خوانده شده است؛ اگر کد از پرونده خوانده نشده، مقدار " +"قابل تشخیصی را ارسال کنید (معمولاً از ``''`` استفاده می‌شود)." -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." -msgstr "آرگومان‌های اختیاری *flags* و *dont_inherit* تعیین می‌کنند که کدام :ref:`گزینه‌های کامپایلر ` فعال شوند و کدام :ref:`قابلیت‌های آینده ` مجاز باشند. اگر هیچ‌یک از آن‌ها ارائه نشوند (یا هر دو صفر باشند)، کد با همان پرچم‌هایی کامپایل می‌شود که بر کدی که :func:`compile` را فراخوانی کرده است اعمال می‌شوند. اگر آرگومان *flags* ارائه شود و *dont_inherit* ارائه نشود (یا صفر باشد)، گزینه‌های کامپایلر و دستورهای future مشخص‌شده توسط *flags* علاوه بر مواردی که به‌طور معمول اعمال می‌شوند، استفاده خواهند شد. اگر *dont_inherit* یک عدد صحیح ناصفر باشد، تنها از *flags* استفاده می‌شود و پرچم‌های (قابلیت‌های future و گزینه‌های کامپایلر) موجود در کد پیرامون نادیده گرفته می‌شوند." +#: ../../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)." +msgstr "" +"آرگومان *mode* مشخص می‌کند که چه نوع کدی باید کامپایل شود؛ اگر *source* شامل دنباله‌ای از دستورها باشد، می‌تواند " +"``'exec'`` باشد؛ اگر شامل تنها یک عبارت باشد، ``'eval'``؛ و اگر شامل تنها یک دستور تعاملی باشد، ``'single'`` (در " +"حالت آخر، اگر عبارت مقداری غیر از ``None`` تولید کند، آن مقدار چاپ خواهد شد)." -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." -msgstr "گزینه‌های کامپایلر و دستورهای future با استفاده از بیت‌هایی مشخص می‌شوند که می‌توان آن‌ها را با عملگر OR بیتی با یکدیگر ترکیب کرد تا چندین گزینه به‌طور هم‌زمان مشخص شوند. بیت‌فیلد لازم برای مشخص کردن هر قابلیت future را می‌توان در ویژگی :attr:`~__future__._Feature.compiler_flag` از نمونهٔ :class:`~__future__._Feature` در ماژول :mod:`__future__` یافت. :ref:`پرچم‌های کامپایلر ` نیز با پیشوند ``PyCF_`` در ماژول :mod:`ast` موجود هستند." +#: ../../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." +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." +msgstr "" +"گزینه‌های کامپایلر و دستورهای future با استفاده از بیت‌هایی مشخص می‌شوند که می‌توان آن‌ها را با عملگر OR بیتی با یکدیگر " +"ترکیب کرد تا چندین گزینه به‌طور هم‌زمان مشخص شوند. بیت‌فیلد لازم برای مشخص کردن هر قابلیت future را می‌توان در " +"ویژگی :attr:`~__future__._Feature.compiler_flag` از نمونهٔ :class:`~__future__._Feature` در ماژول :mod:`__future__` " +"یافت. :ref:`پرچم‌های کامپایلر ` نیز با پیشوند ``PyCF_`` در ماژول :mod:`ast` موجود هستند." -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)." -msgstr "آرگومان *optimize* سطح بهینه‌سازی کامپایلر را مشخص می‌کند؛ مقدار پیش‌فرض ``-1`` سطح بهینه‌سازی مفسر را مطابق گزینه‌های :option:`-O` انتخاب می‌کند. سطوح صریح عبارت‌اند از: ``0`` (بدون بهینه‌سازی؛ ``__debug__`` برابر با true است)، ``1`` (دستورهای assert حذف می‌شوند و ``__debug__`` برابر false است)، و ``2`` (علاوه بر آن، docstringها نیز حذف می‌شوند)." +#: ../../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)." +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 "اگر کد منبع کامپایل‌شده نامعتبر باشد، این تابع استثنای :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 "اگر می‌خواهید کد پایتون را به نمایش AST آن تجزیه کنید، به :func:`ast.parse` مراجعه کنید." -msgid "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: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." +msgstr "" +"یک :ref:`رویداد ممیزی ` با نام ``compile`` و آرگومان‌های ``source`` و ``filename`` پرتاب می‌کند. این رویداد " +"ممکن است در نتیجهٔ کامپایل ضمنی نیز پرتاب شود." -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." -msgstr "هنگام کامپایل یک رشته شامل کد چندخطی در حالت ``'single'`` یا ``'eval'``، ورودی باید دست‌کم با یک نویسهٔ پایان خط خاتمه یابد. این کار تشخیص دستورات ناقص و کامل را در ماژول :mod:`code` تسهیل می‌کند." +#: ../../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." +msgstr "" +"هنگام کامپایل یک رشته شامل کد چندخطی در حالت ``'single'`` یا ``'eval'``، ورودی باید دست‌کم با یک نویسهٔ پایان خط خاتمه " +"یابد. این کار تشخیص دستورات ناقص و کامل را در ماژول :mod:`code` تسهیل می‌کند." -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." -msgstr "به دلیل محدودیت عمق پشته (stack depth) در کامپایلر AST پایتون، کامپایل یک رشتهٔ به‌اندازهٔ کافی بزرگ یا پیچیده به یک شیء AST ممکن است باعث ازکارافتادن (crash) مفسر پایتون شود." +#: ../../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." +msgstr "" +"به دلیل محدودیت عمق پشته (stack depth) در کامپایلر AST پایتون، کامپایل یک رشتهٔ به‌اندازهٔ کافی بزرگ یا پیچیده به یک " +"شیء AST ممکن است باعث ازکارافتادن (crash) مفسر پایتون شود." -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." -msgstr "استفاده از نویسه‌های پایان خط ویندوز و مک مجاز شد. همچنین، ورودی در حالت ``'exec'`` دیگر لازم نیست با یک نویسهٔ پایان خط خاتمه یابد. پارامتر *optimize* نیز اضافه شد." +#: ../../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." +msgstr "" +"استفاده از نویسه‌های پایان خط ویندوز و مک مجاز شد. همچنین، ورودی در حالت ``'exec'`` دیگر لازم نیست با یک نویسهٔ پایان " +"خط خاتمه یابد. پارامتر *optimize* نیز اضافه شد." +#: ../../library/functions.rst:368 msgid "Previously, :exc:`TypeError` was raised when null bytes were encountered in *source*." msgstr "پیش از این، هنگام برخورد با بایت‌های تهی در *source*، استثنای :exc:`TypeError` پرتاب می‌شد." -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``." -msgstr "اکنون می‌توان ``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` را در پرچم‌ها ارسال کرد تا از ``await``، ``async for`` و ``async with`` در سطح بالای کد (top-level) پشتیبانی شود." +#: ../../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``." +msgstr "" +"اکنون می‌توان ``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` را در پرچم‌ها ارسال کرد تا از ``await``، ``async for`` و ``async " +"with`` در سطح بالای کد (top-level) پشتیبانی شود." -msgid "Convert a single string or number to a complex number, or create a complex number from real and imaginary parts." +#: ../../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 "تبدیل یک رشته یا عدد به یک عدد مختلط، یا ایجاد یک عدد مختلط از بخش‌های حقیقی و موهومی یک عدد." +#: ../../library/functions.rst:384 ../../library/functions.rst:764 ../../library/functions.rst:1012 msgid "Examples:" msgstr "مثال‌ها:" +#: ../../library/functions.rst:386 msgid "" ">>> complex('+1.23')\n" "(1.23+0j)\n" @@ -554,78 +904,208 @@ msgstr "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" -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 "اگر آرگومان یک رشته باشد، باید شامل بخش حقیقی (با همان قالبی که برای :func:`float` استفاده می‌شود)، یا بخش موهومی (با همان قالب اما همراه با پسوند ``'j'`` یا ``'J'``)، یا هر دو بخش حقیقی و موهومی باشد (در این حالت، وجود علامت بخش موهومی الزامی است). رشته می‌تواند به‌صورت اختیاری با نویسه‌های فاصلهٔ سفید و پرانتزهای گرد ``'('`` و ``')'`` احاطه شده باشد که نادیده گرفته می‌شوند. همچنین، نباید بین ``'+'``، ``'-'``، پسوند ``'j'`` یا ``'J'`` و عدد ده‌دهی فاصلهٔ سفید وجود داشته باشد. برای مثال، ``complex('1+2j')`` معتبر است، اما ``complex('1 + 2j')`` باعث پرتاب استثنای :exc:`ValueError` می‌شود. به‌طور دقیق‌تر، پس از حذف پرانتزها و نویسه‌های فاصلهٔ سفید ابتدا و انتهای رشته، ورودی باید با قاعدهٔ تولید :token:`~float:complexvalue` در دستور زبان زیر مطابقت داشته باشد:" - -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__`." -msgstr "اگر آرگومان یک عدد باشد، سازنده مانند :class:`int` و :class:`float` به‌عنوان یک تبدیل عددی عمل می‌کند. برای یک شیء عمومی پایتون به نام ``x``، تابع ``complex(x)`` فراخوانی را به ``x.__complex__()`` واگذار می‌کند. اگر :meth:`~object.__complex__` تعریف نشده باشد، به :meth:`~object.__float__` بازمی‌گردد. اگر :meth:`!__float__` نیز تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." +#: ../../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 "" +"اگر آرگومان یک رشته باشد، باید شامل بخش حقیقی (با همان قالبی که برای :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__`." +msgstr "" +"اگر آرگومان یک عدد باشد، سازنده مانند :class:`int` و :class:`float` به‌عنوان یک تبدیل عددی عمل می‌کند. برای یک شیء " +"عمومی پایتون به نام ``x``، تابع ``complex(x)`` فراخوانی را به ``x.__complex__()`` واگذار می‌کند. " +"اگر :meth:`~object.__complex__` تعریف نشده باشد، به :meth:`~object.__float__` بازمی‌گردد. اگر :meth:`!__float__` نیز " +"تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." -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." -msgstr "اگر دو آرگومان ارائه شوند یا از آرگومان‌های کلیدواژه‌ای استفاده شود، هر آرگومان می‌تواند از هر نوع عددی (از جمله اعداد مختلط) باشد. اگر هر دو آرگومان عدد حقیقی باشند، یک عدد مختلط با بخش حقیقی *real* و بخش موهومی *imag* برگردانده می‌شود. اگر هر دو آرگومان عدد مختلط باشند، عدد مختلطی با بخش حقیقی ``real.real-imag.imag`` و بخش موهومی ``real.imag+imag.real`` برگردانده می‌شود. اگر یکی از آرگومان‌ها عدد حقیقی باشد، فقط بخش حقیقی آن در عبارت‌های بالا استفاده می‌شود." +#: ../../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." +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 "همچنین به :meth:`complex.from_number` مراجعه کنید که فقط یک آرگومان عددی را می‌پذیرد." +#: ../../library/functions.rst:445 msgid "If all arguments are omitted, returns ``0j``." msgstr "اگر همهٔ آرگومان‌ها حذف شوند، مقدار ``0j`` برگردانده می‌شود." +#: ../../library/functions.rst:447 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "نوع مختلط در :ref:`typesnumeric` توضیح داده شده است." +#: ../../library/functions.rst:449 ../../library/functions.rst:818 ../../library/functions.rst:1060 msgid "Grouping digits with underscores as in code literals is allowed." 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:452 +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__` بازمی‌گردد." -msgid "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: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." +msgstr "" +"ارسال یک عدد مختلط به‌عنوان آرگومان *real* یا *imag* اکنون منسوخ شده است؛ عدد مختلط باید فقط به‌صورت یک آرگومان مکانی " +"ارسال شود." -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`)." -msgstr "این تابع همتای :func:`setattr` است. آرگومان‌های آن یک شیء و یک رشته هستند. رشته باید نام یکی از ویژگی‌های شیء باشد. در صورت مجاز بودن، این تابع ویژگی نام‌برده را حذف می‌کند. برای مثال، ``delattr(x, 'foobar')`` معادل ``del x.foobar`` است. *name* الزامی ندارد که یک شناسهٔ معتبر پایتون باشد (به :func:`setattr` مراجعه کنید)." +#: ../../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`)." +msgstr "" +"این تابع همتای :func:`setattr` است. آرگومان‌های آن یک شیء و یک رشته هستند. رشته باید نام یکی از ویژگی‌های شیء باشد. در " +"صورت مجاز بودن، این تابع ویژگی نام‌برده را حذف می‌کند. برای مثال، ``delattr(x, 'foobar')`` معادل ``del x.foobar`` است. " +"*name* الزامی ندارد که یک شناسهٔ معتبر پایتون باشد (به :func:`setattr` مراجعه کنید)." -msgid "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:476 +msgid "" +"Create a new dictionary. The :class:`dict` object is the dictionary class. See also :ref:`typesmapping` for " +"documentation about this class." +msgstr "" +"ایجاد یک دیکشنری جدید. شیء :class:`dict` کلاس دیکشنری است. برای مستندات این کلاس، به :ref:`typesmapping` مراجعه " +"کنید." -msgid "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:479 +msgid "" +"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` مراجعه کنید." -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." -msgstr "بدون آرگومان، فهرست نام‌های موجود در دامنهٔ محلیِ فعلی را بازمی‌گرداند. با ارسال یک آرگومان، تلاش می‌کند فهرستی از ویژگی‌های معتبر آن شیء را بازگرداند." +#: ../../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." +msgstr "" +"بدون آرگومان، فهرست نام‌های موجود در دامنهٔ محلیِ فعلی را بازمی‌گرداند. با ارسال یک آرگومان، تلاش می‌کند فهرستی از " +"ویژگی‌های معتبر آن شیء را بازگرداند." -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." -msgstr "اگر شیء متدی با نام :meth:`~object.__dir__` داشته باشد، این متد فراخوانی می‌شود و باید فهرستی از ویژگی‌ها را برگرداند. این امکان را فراهم می‌کند که اشیایی که :func:`~object.__getattr__` یا :func:`~object.__getattribute__` سفارشی را پیاده‌سازی کرده‌اند، نحوهٔ گزارش ویژگی‌های خود توسط :func:`dir` را سفارشی‌سازی کنند." +#: ../../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." +msgstr "" +"اگر شیء متدی با نام :meth:`~object.__dir__` داشته باشد، این متد فراخوانی می‌شود و باید فهرستی از ویژگی‌ها را برگرداند. " +"این امکان را فراهم می‌کند که اشیایی که :func:`~object.__getattr__` یا :func:`~object.__getattribute__` سفارشی را " +"پیاده‌سازی کرده‌اند، نحوهٔ گزارش ویژگی‌های خود توسط :func:`dir` را سفارشی‌سازی کنند." -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__`." -msgstr "اگر شیء متد :meth:`~object.__dir__` را ارائه نکند، این تابع در صورت تعریف شدن، تلاش می‌کند تا حد امکان اطلاعات را از ویژگی :attr:`~object.__dict__` شیء و همچنین از شیء نوع (type object) آن جمع‌آوری کند. فهرست حاصل لزوماً کامل نیست و اگر شیء دارای :func:`~object.__getattr__` سفارشی باشد، ممکن است دقیق هم نباشد." +#: ../../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__`." +msgstr "" +"اگر شیء متد :meth:`~object.__dir__` را ارائه نکند، این تابع در صورت تعریف شدن، تلاش می‌کند تا حد امکان اطلاعات را از " +"ویژگی :attr:`~object.__dict__` شیء و همچنین از شیء نوع (type object) آن جمع‌آوری کند. فهرست حاصل لزوماً کامل نیست و " +"اگر شیء دارای :func:`~object.__getattr__` سفارشی باشد، ممکن است دقیق هم نباشد." -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:" -msgstr "سازوکار پیش‌فرض :func:`dir` بسته به نوع شیء رفتار متفاوتی دارد، زیرا تلاش می‌کند به‌جای ارائهٔ اطلاعات کامل، مرتبط‌ترین اطلاعات را ارائه دهد:" +#: ../../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:" +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 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: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." +msgstr "" +"اگر شیء یک نوع (type) یا کلاس باشد، فهرست شامل نام ویژگی‌های آن و همچنین، به‌صورت بازگشتی، نام ویژگی‌های کلاس‌های پایهٔ " +"آن خواهد بود." -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." -msgstr "در غیر این صورت، فهرست شامل نام ویژگی‌های شیء، نام ویژگی‌های کلاس آن، و همچنین به‌صورت بازگشتی، نام ویژگی‌های کلاس‌های پایهٔ آن خواهد بود." +#: ../../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." +msgstr "" +"در غیر این صورت، فهرست شامل نام ویژگی‌های شیء، نام ویژگی‌های کلاس آن، و همچنین به‌صورت بازگشتی، نام ویژگی‌های کلاس‌های " +"پایهٔ آن خواهد بود." +#: ../../library/functions.rst:516 msgid "The resulting list is sorted alphabetically. For example:" msgstr "فهرست حاصل به‌ترتیب الفبایی مرتب می‌شود. برای مثال:" -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." -msgstr "از آنجا که :func:`dir` در درجهٔ اول برای سهولت استفاده در اعلان تعاملی طراحی شده است، بیشتر تلاش می‌کند مجموعه‌ای مفید از نام‌ها را ارائه دهد تا مجموعه‌ای با تعریف دقیق و سازگار. بنابراین، رفتار دقیق آن ممکن است بین نسخه‌های مختلف تغییر کند. برای مثال، اگر آرگومان یک کلاس باشد، ویژگی‌های فراداده در فهرست نتایج قرار نمی‌گیرند." +#: ../../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." +msgstr "" +"از آنجا که :func:`dir` در درجهٔ اول برای سهولت استفاده در اعلان تعاملی طراحی شده است، بیشتر تلاش می‌کند مجموعه‌ای مفید " +"از نام‌ها را ارائه دهد تا مجموعه‌ای با تعریف دقیق و سازگار. بنابراین، رفتار دقیق آن ممکن است بین نسخه‌های مختلف تغییر " +"کند. برای مثال، اگر آرگومان یک کلاس باشد، ویژگی‌های فراداده در فهرست نتایج قرار نمی‌گیرند." -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)``." -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: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)``." +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)`` برقرار است." -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*." -msgstr "یک شیء enumerate را برمی‌گرداند. *iterable* باید یک دنباله، یک :term:`تکرارگر ` یا هر شیء دیگری باشد که از پیمایش پشتیبانی می‌کند. متد :meth:`~iterator.__next__` تکرارگر بازگردانده‌شده توسط :func:`enumerate`، تاپلی شامل یک شمارنده (که از *start* آغاز می‌شود و مقدار پیش‌فرض آن 0 است) و مقادیر به‌دست‌آمده از پیمایش *iterable* را برمی‌گرداند." +#: ../../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*." +msgstr "" +"یک شیء enumerate را برمی‌گرداند. *iterable* باید یک دنباله، یک :term:`تکرارگر ` یا هر شیء دیگری باشد که از " +"پیمایش پشتیبانی می‌کند. متد :meth:`~iterator.__next__` تکرارگر بازگردانده‌شده توسط :func:`enumerate`، تاپلی شامل یک " +"شمارنده (که از *start* آغاز می‌شود و مقدار پیش‌فرض آن 0 است) و مقادیر به‌دست‌آمده از پیمایش *iterable* را برمی‌گرداند." +#: ../../library/functions.rst:570 msgid "Equivalent to::" msgstr "مساوی است با::" +#: ../../library/functions.rst:572 msgid "" "def enumerate(iterable, start=0):\n" " n = start\n" @@ -639,96 +1119,233 @@ msgstr "" " yield n, elem\n" " n += 1" +#: ../../library/functions.rst:0 msgid "Parameters" msgstr "پارامترها" +#: ../../library/functions.rst:582 msgid "A Python expression." msgstr "یک عبارت پایتون." +#: ../../library/functions.rst:586 msgid "The global namespace (default: ``None``)." msgstr "فضای نام سراسری (پیش‌فرض: ``None``)." +#: ../../library/functions.rst:590 msgid "The local namespace (default: ``None``)." msgstr "فضای نام محلی (پیش‌فرض: ``None``)." +#: ../../library/functions.rst:0 msgid "Returns" msgstr "بازمیگرداند" +#: ../../library/functions.rst:594 msgid "The result of the evaluated expression." msgstr "نتیجهٔ عبارت ارزیابی‌شده." +#: ../../library/functions.rst:0 msgid "raises" msgstr "پرتاب می‌کند" +#: ../../library/functions.rst:595 msgid "Syntax errors are reported as exceptions." msgstr "خطاهای نحوی به‌صورت استثنا گزارش می‌شوند." -msgid "This function executes arbitrary code. Calling it with untrusted user-supplied input will lead to security vulnerabilities." -msgstr "این تابع کد دلخواه را اجرا می‌کند. فراخوانی آن با ورودیِ تأمین‌شده از سوی کاربر که قابل اعتماد نیست، منجر به آسیب‌پذیری‌های امنیتی خواهد شد." - -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 "آرگومان *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:599 ../../library/functions.rst:665 +msgid "" +"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, an :ref:`expression 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* به‌عنوان یک عبارت پایتون (از نظر فنی، یک :ref:`فهرست عبارات `) با استفاده از نگاشت‌های " +"*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:620 msgid "Example:" msgstr "مثال:" -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``." -msgstr "از این تابع همچنین می‌توان برای اجرای اشیای کد دلخواه (مانند اشیایی که توسط :func:`compile` ایجاد شده‌اند) استفاده کرد. در این حالت، به‌جای رشته، یک شیء کد ارسال کنید. اگر شیء کد با آرگومان *mode* برابر ``'exec'`` کامپایل شده باشد، مقدار بازگشتی :func:`eval` برابر ``None`` خواهد بود." +#: ../../library/functions.rst:629 +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``." +msgstr "" +"از این تابع همچنین می‌توان برای اجرای اشیای کد دلخواه (مانند اشیایی که توسط :func:`compile` ایجاد شده‌اند) استفاده " +"کرد. در این حالت، به‌جای رشته، یک شیء کد ارسال کنید. اگر شیء کد با آرگومان *mode* برابر ``'exec'`` کامپایل شده باشد، " +"مقدار بازگشتی :func:`eval` برابر ``None`` خواهد بود." -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`." -msgstr "راهنمایی: اجرای پویای دستورها توسط تابع :func:`exec` پشتیبانی می‌شود. توابع :func:`globals` و :func:`locals` به‌ترتیب دیکشنری سراسری و محلی فعلی را برمی‌گردانند که می‌توان آن‌ها را برای استفاده در :func:`eval` یا :func:`exec` به توابع دیگر ارسال کرد." +#: ../../library/functions.rst:634 +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`." +msgstr "" +"راهنمایی: اجرای پویای دستورها توسط تابع :func:`exec` پشتیبانی می‌شود. توابع :func:`globals` و :func:`locals` به‌ترتیب " +"دیکشنری سراسری و محلی فعلی را برمی‌گردانند که می‌توان آن‌ها را برای استفاده در :func:`eval` یا :func:`exec` به توابع " +"دیگر ارسال کرد." +#: ../../library/functions.rst:639 msgid "If the given source is a string, then leading and trailing spaces and tabs are stripped." msgstr "اگر کد منبع داده‌شده یک رشته باشد، فاصله‌ها و نویسه‌های تب ابتدا و انتهای آن حذف می‌شوند." +#: ../../library/functions.rst:642 msgid "See :func:`ast.literal_eval` for a function to evaluate strings with expressions containing only literals." -msgstr "برای تابعی که رشته‌های حاوی عبارت‌هایی متشکل فقط از مقادیر ثابت را ارزیابی می‌کند، به :func:`ast.literal_eval` مراجعه کنید." +msgstr "" +"برای تابعی که رشته‌های حاوی عبارت‌هایی متشکل فقط از مقادیر ثابت را ارزیابی می‌کند، به :func:`ast.literal_eval` مراجعه " +"کنید." -msgid "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:645 ../../library/functions.rst:647 ../../library/functions.rst:708 +#: ../../library/functions.rst:710 +msgid "" +"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:652 ../../library/functions.rst:730 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "آرگومان‌های *globals* و *locals* اکنون می‌توانند به‌صورت آرگومان کلیدواژه‌ای نیز ارسال شوند." +#: ../../library/functions.rst:656 ../../library/functions.rst:734 msgid "The semantics of the default *locals* namespace have been adjusted as described for the :func:`locals` builtin." msgstr "معنای فضای نام پیش‌فرض *locals* مطابق توضیحات ارائه‌شده برای تابع داخلی :func:`locals` تنظیم شده است." -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``." -msgstr "این تابع از اجرای پویای کد پایتون پشتیبانی می‌کند. *source* باید یا یک رشته باشد یا یک شیء کد. اگر رشته باشد، به‌عنوان مجموعه‌ای از دستورهای پایتون تجزیه و سپس اجرا می‌شود (مگر اینکه خطای نحوی رخ دهد). [#]_ اگر یک شیء کد باشد، مستقیماً اجرا می‌شود. در همهٔ موارد، انتظار می‌رود کد اجراشده به‌عنوان ورودی فایل معتبر باشد (به بخش :ref:`file-input` در راهنمای مرجع مراجعه کنید). توجه داشته باشید که دستورهای :keyword:`nonlocal`، :keyword:`yield` و :keyword:`return` حتی در کدی که از طریق :func:`exec` اجرا می‌شود نیز خارج از تعریف تابع قابل استفاده نیستند. مقدار بازگشتی ``None`` است." +#: ../../library/functions.rst:668 +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``." +msgstr "" +"این تابع از اجرای پویای کد پایتون پشتیبانی می‌کند. *source* باید یا یک رشته باشد یا یک شیء کد. اگر رشته باشد، به‌عنوان " +"مجموعه‌ای از دستورهای پایتون تجزیه و سپس اجرا می‌شود (مگر اینکه خطای نحوی رخ دهد). [#]_ اگر یک شیء کد باشد، مستقیماً " +"اجرا می‌شود. در همهٔ موارد، انتظار می‌رود کد اجراشده به‌عنوان ورودی فایل معتبر باشد (به بخش :ref:`file-input` در راهنمای " +"مرجع مراجعه کنید). توجه داشته باشید که دستورهای :keyword:`nonlocal`، :keyword:`yield` و :keyword:`return` حتی در کدی " +"که از طریق :func:`exec` اجرا می‌شود نیز خارج از تعریف تابع قابل استفاده نیستند. مقدار بازگشتی ``None`` است." -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." -msgstr "در همهٔ حالت‌ها، اگر بخش‌های اختیاری حذف شوند، کد در محدوده فعلی اجرا می‌شود. اگر فقط *globals* ارائه شود، باید یک دیکشنری باشد (و نه یک زیرکلاس از دیکشنری) که هم برای متغیرهای سراسری و هم برای متغیرهای محلی استفاده خواهد شد. اگر هر دو *globals* و *locals* ارائه شوند، به‌ترتیب برای متغیرهای سراسری و محلی استفاده می‌شوند. در صورت ارائه، *locals* می‌تواند هر شیء نگاشتی باشد. به خاطر داشته باشید که در سطح ماژول، globals و locals همان دیکشنری یکسان هستند." +#: ../../library/functions.rst:679 +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." +msgstr "" +"در همهٔ حالت‌ها، اگر بخش‌های اختیاری حذف شوند، کد در محدوده فعلی اجرا می‌شود. اگر فقط *globals* ارائه شود، باید یک " +"دیکشنری باشد (و نه یک زیرکلاس از دیکشنری) که هم برای متغیرهای سراسری و هم برای متغیرهای محلی استفاده خواهد شد. اگر " +"هر دو *globals* و *locals* ارائه شوند، به‌ترتیب برای متغیرهای سراسری و محلی استفاده می‌شوند. در صورت ارائه، *locals* " +"می‌تواند هر شیء نگاشتی باشد. به خاطر داشته باشید که در سطح ماژول، globals و locals همان دیکشنری یکسان هستند." -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)." -msgstr "وقتی ``exec`` دو شیء جداگانه را به‌عنوان *globals* و *locals* دریافت می‌کند، کد به‌گونه‌ای اجرا می‌شود که گویی درون یک تعریف کلاس قرار دارد. این بدان معناست که توابع و کلاس‌های تعریف‌شده در کد اجراشده نمی‌توانند به متغیرهای اختصاص‌یافته در سطح بالا دسترسی داشته باشند (زیرا متغیرهای «سطح بالا» در تعریف کلاس به‌عنوان متغیرهای کلاس در نظر گرفته می‌شوند)." +#: ../../library/functions.rst:689 +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)." +msgstr "" +"وقتی ``exec`` دو شیء جداگانه را به‌عنوان *globals* و *locals* دریافت می‌کند، کد به‌گونه‌ای اجرا می‌شود که گویی درون یک " +"تعریف کلاس قرار دارد. این بدان معناست که توابع و کلاس‌های تعریف‌شده در کد اجراشده نمی‌توانند به متغیرهای اختصاص‌یافته در " +"سطح بالا دسترسی داشته باشند (زیرا متغیرهای «سطح بالا» در تعریف کلاس به‌عنوان متغیرهای کلاس در نظر گرفته می‌شوند)." -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." -msgstr "اگر دیکشنری *globals* مقداری برای کلید ``__builtins__`` نداشته باشد، ارجاعی به دیکشنری ماژول داخلی :mod:`builtins` با همان کلید در آن درج می‌شود. بازنویسی ``__builtins__`` می‌تواند برای محدود کردن یا تغییر نام‌های در دسترس استفاده شود، اما این **یک سازوکار امنیتی نیست**؛ زیرا کدی که اجرا می‌شود همچنان می‌تواند به تمام اشیای داخلی دسترسی داشته باشد." +#: ../../library/functions.rst:695 +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." +msgstr "" +"اگر دیکشنری *globals* مقداری برای کلید ``__builtins__`` نداشته باشد، ارجاعی به دیکشنری ماژول داخلی :mod:`builtins` " +"با همان کلید در آن درج می‌شود. بازنویسی ``__builtins__`` می‌تواند برای محدود کردن یا تغییر نام‌های در دسترس استفاده " +"شود، اما این **یک سازوکار امنیتی نیست**؛ زیرا کدی که اجرا می‌شود همچنان می‌تواند به تمام اشیای داخلی دسترسی داشته باشد." -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." -msgstr "آرگومان *closure* یک closure را مشخص می‌کند؛ یعنی یک تاپل از cellvarها. این آرگومان تنها زمانی معتبر است که *object* یک شیء کد باشد که شامل :term:`متغیرهای آزاد (closure) ` باشد. طول این تاپل باید دقیقاً با طول ویژگی :attr:`~codeobject.co_freevars` شیء کد برابر باشد." +#: ../../library/functions.rst:702 +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." +msgstr "" +"آرگومان *closure* یک closure را مشخص می‌کند؛ یعنی یک تاپل از cellvarها. این آرگومان تنها زمانی معتبر است که *object* " +"یک شیء کد باشد که شامل :term:`متغیرهای آزاد (closure) ` باشد. طول این تاپل باید دقیقاً با طول " +"ویژگی :attr:`~codeobject.co_freevars` شیء کد برابر باشد." -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`." -msgstr "توابع داخلی :func:`globals` و :func:`locals` به‌ترتیب فضای نام سراسری و محلی فعلی را برمی‌گردانند که می‌توانند برای ارسال به‌عنوان آرگومان دوم و سوم تابع :func:`exec` مفید باشند." +#: ../../library/functions.rst:715 +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`." +msgstr "" +"توابع داخلی :func:`globals` و :func:`locals` به‌ترتیب فضای نام سراسری و محلی فعلی را برمی‌گردانند که می‌توانند برای " +"ارسال به‌عنوان آرگومان دوم و سوم تابع :func:`exec` مفید باشند." -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." -msgstr "*locals* پیش‌فرض همان‌گونه عمل می‌کند که در ادامه برای تابع :func:`locals` توضیح داده شده است. اگر لازم است پس از بازگشت تابع :func:`exec` تغییرات اعمال‌شده روی *locals* را مشاهده کنید، یک دیکشنری *locals* صریح ارسال کنید." +#: ../../library/functions.rst:721 +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." +msgstr "" +"*locals* پیش‌فرض همان‌گونه عمل می‌کند که در ادامه برای تابع :func:`locals` توضیح داده شده است. اگر لازم است پس از " +"بازگشت تابع :func:`exec` تغییرات اعمال‌شده روی *locals* را مشاهده کنید، یک دیکشنری *locals* صریح ارسال کنید." +#: ../../library/functions.rst:725 msgid "Added the *closure* parameter." msgstr "پارامتر *closure* اضافه شد." -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." -msgstr "از میان عناصر *iterable*، آن‌هایی را که *function* برایشان مقدار True برمی‌گرداند، انتخاب کرده و یک تکرارگر می‌سازد. *iterable* می‌تواند یک دنباله، یک محفظهٔ تکرارپذیر، یا یک تکرارگر باشد. اگر *function* برابر ``None`` باشد، تابع همانی در نظر گرفته می‌شود؛ یعنی تمام عناصری از *iterable* که نادرست (False) هستند، حذف می‌شوند." +#: ../../library/functions.rst:740 +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." +msgstr "" +"از میان عناصر *iterable*، آن‌هایی را که *function* برایشان مقدار True برمی‌گرداند، انتخاب کرده و یک تکرارگر می‌سازد. " +"*iterable* می‌تواند یک دنباله، یک محفظهٔ تکرارپذیر، یا یک تکرارگر باشد. اگر *function* برابر ``None`` باشد، تابع همانی " +"در نظر گرفته می‌شود؛ یعنی تمام عناصری از *iterable* که نادرست (False) هستند، حذف می‌شوند." -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``." -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:746 +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``." +msgstr "" +"توجه داشته باشید که اگر *function* برابر ``None`` نباشد، ``filter(function, iterable)`` معادل عبارت تولیدگر ``(item " +"for item in iterable if function(item))`` است، و اگر *function* برابر ``None`` باشد، معادل ``(item for item in " +"iterable if item)`` خواهد بود." -msgid "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:751 +msgid "" +"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:762 msgid "Return a floating-point number constructed from a number or a string." msgstr "یک عدد ممیز شناور که از یک عدد یا یک رشته ساخته شده است را برمی‌گرداند." +#: ../../library/functions.rst:766 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -752,102 +1369,254 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -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:" -msgstr "اگر آرگومان یک رشته باشد، باید شامل یک عدد ده‌دهی باشد که به‌صورت اختیاری با یک علامت و همچنین با فاصلهٔ سفید احاطه شده باشد. علامت اختیاری می‌تواند ``'+'`` یا ``'-'`` باشد؛ علامت ``'+'`` تأثیری بر مقدار تولیدشده ندارد. آرگومان همچنین می‌تواند رشته‌ای باشد که یک NaN (عدد نیست) یا بی‌نهایت مثبت یا منفی را نمایش می‌دهد. به‌طور دقیق‌تر، پس از حذف نویسه‌های فاصلهٔ سفید ابتدا و انتهای رشته، ورودی باید با قاعدهٔ تولید :token:`~float:floatvalue` در دستور زبان زیر مطابقت داشته باشد:" +#: ../../library/functions.rst:779 +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:" +msgstr "" +"اگر آرگومان یک رشته باشد، باید شامل یک عدد ده‌دهی باشد که به‌صورت اختیاری با یک علامت و همچنین با فاصلهٔ سفید احاطه شده " +"باشد. علامت اختیاری می‌تواند ``'+'`` یا ``'-'`` باشد؛ علامت ``'+'`` تأثیری بر مقدار تولیدشده ندارد. آرگومان همچنین " +"می‌تواند رشته‌ای باشد که یک NaN (عدد نیست) یا بی‌نهایت مثبت یا منفی را نمایش می‌دهد. به‌طور دقیق‌تر، پس از حذف نویسه‌های " +"فاصلهٔ سفید ابتدا و انتهای رشته، ورودی باید با قاعدهٔ تولید :token:`~float:floatvalue` در دستور زبان زیر مطابقت داشته " +"باشد:" -msgid "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:800 +msgid "" +"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» همگی برای نمایش " +"بی‌نهایت مثبت معتبر هستند." -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." -msgstr "در غیر این صورت، اگر آرگومان یک عدد صحیح یا یک عدد ممیز شناور باشد، یک عدد ممیز شناور با همان مقدار (در محدودهٔ دقت اعداد ممیز شناور پایتون) برگردانده می‌شود. اگر آرگومان خارج از محدودهٔ یک عدد ممیز شناور در پایتون باشد، استثنای :exc:`OverflowError` پرتاب خواهد شد." +#: ../../library/functions.rst:803 +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." +msgstr "" +"در غیر این صورت، اگر آرگومان یک عدد صحیح یا یک عدد ممیز شناور باشد، یک عدد ممیز شناور با همان مقدار (در محدودهٔ دقت " +"اعداد ممیز شناور پایتون) برگردانده می‌شود. اگر آرگومان خارج از محدودهٔ یک عدد ممیز شناور در پایتون باشد، " +"استثنای :exc:`OverflowError` پرتاب خواهد شد." -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__`." -msgstr "برای یک شیء عمومی پایتون به نام ``x``، تابع ``float(x)`` فراخوانی را به ``x.__float__()`` واگذار می‌کند. اگر :meth:`~object.__float__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." +#: ../../library/functions.rst:808 +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__`." +msgstr "" +"برای یک شیء عمومی پایتون به نام ``x``، تابع ``float(x)`` فراخوانی را به ``x.__float__()`` واگذار می‌کند. " +"اگر :meth:`~object.__float__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." +#: ../../library/functions.rst:812 msgid "See also :meth:`float.from_number` which only accepts a numeric argument." msgstr "همچنین به :meth:`float.from_number` مراجعه کنید که فقط یک آرگومان عددی را می‌پذیرد." +#: ../../library/functions.rst:814 msgid "If no argument is given, ``0.0`` is returned." msgstr "اگر هیچ آرگومانی ارائه نشود، مقدار ``0.0`` برگردانده می‌شود." +#: ../../library/functions.rst:816 msgid "The float type is described in :ref:`typesnumeric`." msgstr "نوع ممیز شناور در :ref:`typesnumeric` توضیح داده شده است." +#: ../../library/functions.rst:824 msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not defined." msgstr "اگر :meth:`~object.__float__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." -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`." -msgstr "*value* را مطابق با *format_spec* به یک نمایش قالب‌بندی‌شده تبدیل می‌کند. نحوهٔ تفسیر *format_spec* به نوع آرگومان *value* بستگی دارد؛ با این حال، یک نحو استاندارد برای قالب‌بندی وجود دارد که بیشتر انواع داخلی از آن استفاده می‌کنند: :ref:`formatspec`." +#: ../../library/functions.rst:834 +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`." +msgstr "" +"*value* را مطابق با *format_spec* به یک نمایش قالب‌بندی‌شده تبدیل می‌کند. نحوهٔ تفسیر *format_spec* به نوع آرگومان " +"*value* بستگی دارد؛ با این حال، یک نحو استاندارد برای قالب‌بندی وجود دارد که بیشتر انواع داخلی از آن استفاده " +"می‌کنند: :ref:`formatspec`." -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:839 +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) ` ایجاد " +"می‌کند." -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." -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:842 +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." +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:849 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` پرتاب می‌کند." +msgstr "" +"اگر *format_spec* یک رشتهٔ خالی نباشد، ``object().__format__(format_spec)`` استثنای :exc:`TypeError` پرتاب می‌کند." -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." -msgstr "یک شیء جدید از نوع :class:`frozenset` را برمی‌گرداند که در صورت ارائه، عناصر آن از *iterable* گرفته می‌شوند. ``frozenset`` یک کلاس داخلی است. برای مستندات این کلاس، به :class:`frozenset` و :ref:`types-set` مراجعه کنید." +#: ../../library/functions.rst:858 +msgid "" +"Return a new :class:`frozenset` object, optionally with elements taken from *iterable*. :class:`frozenset` is a " +"built-in class. See also :ref:`types-set` for documentation about this class." +msgstr "" +"یک شیء جدید از نوع :class:`frozenset` را برمی‌گرداند که در صورت ارائه، عناصر آن از *iterable* گرفته می‌شوند. " +":class:`frozenset` یک کلاس داخلی است. برای مستندات این کلاس، به :ref:`types-set` مراجعه کنید." -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." -msgstr "برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`set`، :class:`list`، :class:`tuple` و :class:`dict`، و همچنین ماژول :mod:`collections` مراجعه کنید." +#: ../../library/functions.rst:862 +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." +msgstr "" +"برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`set`، :class:`list`، :class:`tuple` و :class:`dict`، و همچنین " +"ماژول :mod:`collections` مراجعه کنید." -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 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:870 +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 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` مراجعه کنید)." -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`." -msgstr "از آنجا که :ref:`تغییر نام خصوصی ` در زمان کامپایل انجام می‌شود، برای بازیابی یک ویژگی خصوصی (ویژگی‌هایی که با دو زیرخط آغاز می‌شوند) با استفاده از :func:`getattr`، باید نام آن را به‌صورت دستی تغییر دهید." +#: ../../library/functions.rst:879 +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`." +msgstr "" +"از آنجا که :ref:`تغییر نام خصوصی ` در زمان کامپایل انجام می‌شود، برای بازیابی یک ویژگی خصوصی " +"(ویژگی‌هایی که با دو زیرخط آغاز می‌شوند) با استفاده از :func:`getattr`، باید نام آن را به‌صورت دستی تغییر دهید." -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." -msgstr "دیکشنریی را که فضای نام ماژول فعلی را پیاده‌سازی می‌کند، برمی‌گرداند. برای کدهای داخل توابع، این مقدار هنگام تعریف تابع تنظیم می‌شود و بدون توجه به این‌که تابع از کجا فراخوانی شود، ثابت باقی می‌ماند." +#: ../../library/functions.rst:887 +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." +msgstr "" +"دیکشنریی را که فضای نام ماژول فعلی را پیاده‌سازی می‌کند، برمی‌گرداند. برای کدهای داخل توابع، این مقدار هنگام تعریف تابع " +"تنظیم می‌شود و بدون توجه به این‌که تابع از کجا فراخوانی شود، ثابت باقی می‌ماند." -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.)" -msgstr "آرگومان‌ها شامل یک شیء و یک رشته هستند. اگر رشته نام یکی از ویژگی‌های آن شیء باشد، نتیجه ``True`` و در غیر این صورت ``False`` خواهد بود. (این کار با فراخوانی ``getattr(object, name)`` و بررسی اینکه آیا استثنای :exc:`AttributeError` پرتاب می‌شود یا نه، پیاده‌سازی شده است.)" +#: ../../library/functions.rst:894 +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.)" +msgstr "" +"آرگومان‌ها شامل یک شیء و یک رشته هستند. اگر رشته نام یکی از ویژگی‌های آن شیء باشد، نتیجه ``True`` و در غیر این صورت " +"``False`` خواهد بود. (این کار با فراخوانی ``getattr(object, name)`` و بررسی اینکه آیا استثنای :exc:`AttributeError` " +"پرتاب می‌شود یا نه، پیاده‌سازی شده است.)" -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)." -msgstr "مقدار هش شیء را (در صورتی که داشته باشد) برمی‌گرداند. مقادیر هش اعداد صحیح هستند. از آن‌ها برای مقایسهٔ سریع کلیدهای دیکشنری هنگام جست‌وجو در دیکشنری استفاده می‌شود. مقادیر عددی که با یکدیگر برابر مقایسه می‌شوند، مقدار هش یکسانی دارند (حتی اگر از نوع‌های متفاوتی باشند، مانند 1 و 1.0)." +#: ../../library/functions.rst:902 +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)." +msgstr "" +"مقدار هش شیء را (در صورتی که داشته باشد) برمی‌گرداند. مقادیر هش اعداد صحیح هستند. از آن‌ها برای مقایسهٔ سریع کلیدهای " +"دیکشنری هنگام جست‌وجو در دیکشنری استفاده می‌شود. مقادیر عددی که با یکدیگر برابر مقایسه می‌شوند، مقدار هش یکسانی دارند " +"(حتی اگر از نوع‌های متفاوتی باشند، مانند 1 و 1.0)." -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." -msgstr "برای اشیایی که متد :meth:`~object.__hash__` سفارشی دارند، توجه داشته باشید که :func:`hash` مقدار بازگشتی را بر اساس پهنای بیت ماشین میزبان کوتاه می‌کند." +#: ../../library/functions.rst:909 +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." +msgstr "" +"برای اشیایی که متد :meth:`~object.__hash__` سفارشی دارند، توجه داشته باشید که :func:`hash` مقدار بازگشتی را بر اساس " +"پهنای بیت ماشین میزبان کوتاه می‌کند." -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." -msgstr "سامانهٔ راهنمای داخلی را فراخوانی می‌کند. (این تابع برای استفادهٔ تعاملی طراحی شده است.) اگر هیچ آرگومانی ارائه نشود، سامانهٔ راهنمای تعاملی در کنسول مفسر آغاز می‌شود. اگر آرگومان یک رشته باشد، آن رشته به‌عنوان نام یک ماژول، تابع، کلاس، متد، کلیدواژه یا موضوع مستندات جست‌وجو می‌شود و صفحهٔ راهنمای آن در کنسول نمایش داده می‌شود. اگر آرگومان هر نوع شیء دیگری باشد، صفحهٔ راهنمای مربوط به آن شیء تولید می‌شود." +#: ../../library/functions.rst:916 +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." +msgstr "" +"سامانهٔ راهنمای داخلی را فراخوانی می‌کند. (این تابع برای استفادهٔ تعاملی طراحی شده است.) اگر هیچ آرگومانی ارائه نشود، " +"سامانهٔ راهنمای تعاملی در کنسول مفسر آغاز می‌شود. اگر آرگومان یک رشته باشد، آن رشته به‌عنوان نام یک ماژول، تابع، کلاس، " +"متد، کلیدواژه یا موضوع مستندات جست‌وجو می‌شود و صفحهٔ راهنمای آن در کنسول نمایش داده می‌شود. اگر آرگومان هر نوع شیء " +"دیگری باشد، صفحهٔ راهنمای مربوط به آن شیء تولید می‌شود." -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 `." -msgstr "توجه داشته باشید که اگر هنگام فراخوانی :func:`help` یک اسلش (/) در فهرست پارامترهای یک تابع ظاهر شود، به این معناست که پارامترهای قبل از اسلش فقط به‌صورت مکانی قابل ارسال هستند. برای اطلاعات بیشتر، به :ref:`پرسش متداول مربوط به پارامترهای فقط مکانی ` مراجعه کنید." +#: ../../library/functions.rst:923 +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 `." +msgstr "" +"توجه داشته باشید که اگر هنگام فراخوانی :func:`help` یک اسلش (/) در فهرست پارامترهای یک تابع ظاهر شود، به این معناست " +"که پارامترهای قبل از اسلش فقط به‌صورت مکانی قابل ارسال هستند. برای اطلاعات بیشتر، به :ref:`پرسش متداول مربوط به " +"پارامترهای فقط مکانی ` مراجعه کنید." +#: ../../library/functions.rst:928 msgid "This function is added to the built-in namespace by the :mod:`site` module." msgstr "این تابع توسط ماژول :mod:`site` به فضای نام داخلی (built-in namespace) اضافه می‌شود." -msgid "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:930 +msgid "" +"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` باعث شده‌اند امضاهای گزارش‌شده برای اشیای فراخوانی‌پذیر اکنون کامل‌تر " +"و سازگارتر باشند." -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:" -msgstr "یک عدد صحیح را به یک رشتهٔ شانزده‌شانزدهی کوچک‌حرف با پیشوند «0x» تبدیل می‌کند. اگر *integer* یک شیء از نوع :class:`int` پایتون نباشد، باید متدی به نام :meth:`~object.__index__` تعریف کند که یک عدد صحیح برمی‌گرداند. چند نمونه:" +#: ../../library/functions.rst:937 +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:" +msgstr "" +"یک عدد صحیح را به یک رشتهٔ شانزده‌شانزدهی کوچک‌حرف با پیشوند «0x» تبدیل می‌کند. اگر *integer* یک شیء از نوع :class:`int` " +"پایتون نباشد، باید متدی به نام :meth:`~object.__index__` تعریف کند که یک عدد صحیح برمی‌گرداند. چند نمونه:" -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:" -msgstr "اگر می‌خواهید یک عدد صحیح را به یک رشتهٔ شانزده‌شانزدهی با حروف بزرگ یا کوچک، با پیشوند یا بدون آن، تبدیل کنید، می‌توانید از هر یک از روش‌های زیر استفاده کنید:" +#: ../../library/functions.rst:946 +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:" +msgstr "" +"اگر می‌خواهید یک عدد صحیح را به یک رشتهٔ شانزده‌شانزدهی با حروف بزرگ یا کوچک، با پیشوند یا بدون آن، تبدیل کنید، " +"می‌توانید از هر یک از روش‌های زیر استفاده کنید:" +#: ../../library/functions.rst:958 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:963 msgid "To obtain a hexadecimal string representation for a float, use the :meth:`float.hex` method." msgstr "برای به‌دست‌آوردن نمایش شانزدهی یک عدد ممیز شناور، از متد :meth:`float.hex` استفاده کنید." -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." -msgstr "«شناسه» یک شیء را برمی‌گرداند. این مقدار یک عدد صحیح است که در طول عمر آن شیء، یکتا و ثابت بودنش تضمین شده است. دو شیء که طول عمر آن‌ها با یکدیگر هم‌پوشانی ندارد، ممکن است مقدار یکسانی از :func:`id` داشته باشند." +#: ../../library/functions.rst:969 +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." +msgstr "" +"«شناسه» یک شیء را برمی‌گرداند. این مقدار یک عدد صحیح است که در طول عمر آن شیء، یکتا و ثابت بودنش تضمین شده است. دو " +"شیء که طول عمر آن‌ها با یکدیگر هم‌پوشانی ندارد، ممکن است مقدار یکسانی از :func:`id` داشته باشند." +#: ../../library/functions.rst:974 msgid "This is the address of the object in memory." msgstr "این، آدرس شیء در حافظه است." +#: ../../library/functions.rst:976 msgid "Raises an :ref:`auditing event ` ``builtins.id`` with argument ``id``." msgstr "یک :ref:`رویداد ممیزی ` با نام ``builtins.id`` و آرگومان ``id`` پرتاب می‌کند." -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::" -msgstr "اگر آرگومان *prompt* ارائه شود، بدون افزودن نویسهٔ پایان خط در خروجی استاندارد نوشته می‌شود. سپس تابع یک خط از ورودی می‌خواند، آن را به یک رشته تبدیل می‌کند (با حذف نویسهٔ پایان خط انتهایی) و همان را برمی‌گرداند. اگر به انتهای فایل (EOF) برسد، استثنای :exc:`EOFError` پرتاب می‌شود. مثال::" +#: ../../library/functions.rst:982 +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::" +msgstr "" +"اگر آرگومان *prompt* ارائه شود، بدون افزودن نویسهٔ پایان خط در خروجی استاندارد نوشته می‌شود. سپس تابع یک خط از ورودی " +"می‌خواند، آن را به یک رشته تبدیل می‌کند (با حذف نویسهٔ پایان خط انتهایی) و همان را برمی‌گرداند. اگر به انتهای فایل (EOF) " +"برسد، استثنای :exc:`EOFError` پرتاب می‌شود. مثال::" +#: ../../library/functions.rst:987 msgid "" ">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" @@ -859,18 +1628,34 @@ msgstr "" ">>> s\n" "\"Monty Python's Flying Circus\"" -msgid "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:992 +msgid "" +"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:995 ../../library/functions.rst:997 msgid "Raises an :ref:`auditing event ` ``builtins.input`` with argument ``prompt`` before reading input" -msgstr "پیش از خواندن ورودی، یک :ref:`رویداد ممیزی ` با نام ``builtins.input`` و آرگومان ``prompt`` پرتاب می‌کند" +msgstr "" +"پیش از خواندن ورودی، یک :ref:`رویداد ممیزی ` با نام ``builtins.input`` و آرگومان ``prompt`` پرتاب می‌کند" -msgid "Raises an :ref:`auditing event ` ``builtins.input/result`` with the result after successfully reading input." -msgstr "پس از خواندن موفقیت‌آمیز ورودی، یک :ref:`رویداد ممیزی ` با نام ``builtins.input/result`` و نتیجهٔ خوانده‌شده پرتاب می‌کند." +#: ../../library/functions.rst:1000 ../../library/functions.rst:1002 +msgid "" +"Raises an :ref:`auditing event ` ``builtins.input/result`` with the result after successfully reading " +"input." +msgstr "" +"پس از خواندن موفقیت‌آمیز ورودی، یک :ref:`رویداد ممیزی ` با نام ``builtins.input/result`` و نتیجهٔ خوانده‌شده " +"پرتاب می‌کند." +#: ../../library/functions.rst:1009 msgid "Return an integer object constructed from a number or a string, or return ``0`` if no arguments are given." -msgstr "یک شیء عدد صحیح را که از یک عدد یا یک رشته ساخته شده است برمی‌گرداند، یا اگر هیچ آرگومانی داده نشده باشد، مقدار ``0`` را برمی‌گرداند." +msgstr "" +"یک شیء عدد صحیح را که از یک عدد یا یک رشته ساخته شده است برمی‌گرداند، یا اگر هیچ آرگومانی داده نشده باشد، مقدار ``0`` " +"را برمی‌گرداند." +#: ../../library/functions.rst:1014 msgid "" ">>> int(123.45)\n" "123\n" @@ -898,51 +1683,148 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -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." -msgstr "اگر آرگومان متد :meth:`~object.__int__` را تعریف کرده باشد، ``int(x)`` مقدار ``x.__int__()`` را برمی‌گرداند. اگر آرگومان متد :meth:`~object.__index__` را تعریف کرده باشد، مقدار ``x.__index__()`` برگردانده می‌شود. برای اعداد ممیز شناور، این تبدیل بخش اعشاری را در جهت صفر حذف می‌کند." - -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." -msgstr "اگر آرگومان یک عدد نباشد یا *base* مشخص شده باشد، باید نمونه‌ای از :class:`bytes` یا :class:`bytearray` باشد که یک عدد صحیح در مبنای *base* را نمایش می‌دهد. به‌صورت اختیاری، رشته می‌تواند با ``+`` یا ``-`` (بدون فاصله بین آن‌ها و عدد) آغاز شود، دارای صفرهای ابتدایی باشد، با فاصلهٔ سفید احاطه شده باشد و بین رقم‌های آن زیرخط‌های تکی قرار گرفته باشند." +#: ../../library/functions.rst:1029 +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." +msgstr "" +"اگر آرگومان متد :meth:`~object.__int__` را تعریف کرده باشد، ``int(x)`` مقدار ``x.__int__()`` را برمی‌گرداند. اگر " +"آرگومان متد :meth:`~object.__index__` را تعریف کرده باشد، مقدار ``x.__index__()`` برگردانده می‌شود. برای اعداد ممیز " +"شناور، این تبدیل بخش اعشاری را در جهت صفر حذف می‌کند." -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 "یک رشتهٔ عدد صحیح در مبنای 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:1034 +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." +msgstr "" +"اگر آرگومان یک عدد نباشد یا *base* مشخص شده باشد، باید نمونه‌ای از :class:`bytes` یا :class:`bytearray` باشد که یک " +"عدد صحیح در مبنای *base* را نمایش می‌دهد. به‌صورت اختیاری، رشته می‌تواند با ``+`` یا ``-`` (بدون فاصله بین آن‌ها و عدد) " +"آغاز شود، دارای صفرهای ابتدایی باشد، با فاصلهٔ سفید احاطه شده باشد و بین رقم‌های آن زیرخط‌های تکی قرار گرفته باشند." +#: ../../library/functions.rst:1040 +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 "" +"یک رشتهٔ عدد صحیح در مبنای 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:1051 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "نوع عدد صحیح (integer) در :ref:`typesnumeric` توضیح داده شده است." -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__ `." -msgstr "اگر *base* نمونه‌ای از :class:`int` نباشد و شیء *base* متد :meth:`base.__index__ ` را تعریف کرده باشد، آن متد برای به‌دست آوردن یک عدد صحیح به‌عنوان مبنا فراخوانی می‌شود. در نسخه‌های پیشین، به‌جای :meth:`base.__index__ ` از :meth:`base.__int__ ` استفاده می‌شد." +#: ../../library/functions.rst:1053 +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__ `." +msgstr "" +"اگر *base* نمونه‌ای از :class:`int` نباشد و شیء *base* متد :meth:`base.__index__ ` را تعریف کرده " +"باشد، آن متد برای به‌دست آوردن یک عدد صحیح به‌عنوان مبنا فراخوانی می‌شود. در نسخه‌های پیشین، به‌جای :meth:`base.__index__ " +"` از :meth:`base.__int__ ` استفاده می‌شد." +#: ../../library/functions.rst:1063 msgid "The first parameter is now positional-only." msgstr "پارامتر اول اکنون فقط به‌صورت فقط‌جایگاهی قابل ارسال است." +#: ../../library/functions.rst:1066 msgid "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not defined." msgstr "اگر :meth:`~object.__int__` تعریف نشده باشد، به :meth:`~object.__index__` بازمی‌گردد." -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." -msgstr "ورودی‌های رشته‌ای :class:`int` و نمایش‌های رشته‌ای آن را می‌توان برای کمک به جلوگیری از حملات منع سرویس (Denial of Service) محدود کرد. اگر هنگام تبدیل یک رشته به :class:`int` از این محدودیت فراتر رود، یا تبدیل یک :class:`int` به رشته باعث عبور از این محدودیت شود، استثنای :exc:`ValueError` پرتاب می‌شود. برای اطلاعات بیشتر، مستندات :ref:`محدودیت طول تبدیل رشته‌ای اعداد صحیح ` را ببینید." +#: ../../library/functions.rst:1069 +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." +msgstr "" +"ورودی‌های رشته‌ای :class:`int` و نمایش‌های رشته‌ای آن را می‌توان برای کمک به جلوگیری از حملات منع سرویس (Denial of " +"Service) محدود کرد. اگر هنگام تبدیل یک رشته به :class:`int` از این محدودیت فراتر رود، یا تبدیل یک :class:`int` به " +"رشته باعث عبور از این محدودیت شود، استثنای :exc:`ValueError` پرتاب می‌شود. برای اطلاعات بیشتر، مستندات :ref:`محدودیت " +"طول تبدیل رشته‌ای اعداد صحیح ` را ببینید." +#: ../../library/functions.rst:1077 msgid ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." msgstr ":func:`int` دیگر فراخوانی را به متد :meth:`~object.__trunc__` واگذار نمی‌کند." -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." -msgstr "اگر آرگومان *object* نمونه‌ای از *classinfo* یا از یکی از زیرکلاس‌های آن (مستقیم، غیرمستقیم یا :term:`مجازی `) باشد، مقدار ``True`` را برمی‌گرداند. اگر *object* از نوع داده‌شده نباشد، این تابع همیشه ``False`` برمی‌گرداند. اگر *classinfo* یک تاپل از نوع‌ها (یا به‌صورت بازگشتی، تاپل‌هایی از این نوع) یا یک :ref:`types-union` از چندین نوع باشد، در صورتی که *object* نمونه‌ای از هر یک از آن نوع‌ها باشد، مقدار ``True`` برگردانده می‌شود. اگر *classinfo* یک نوع، یا تاپلی از نوع‌ها و تاپل‌های مشابه نباشد، استثنای :exc:`TypeError` پرتاب می‌شود. با این حال، اگر یک بررسیِ زودتر با موفقیت انجام شود، ممکن است برای یک نوع نامعتبر استثنای :exc:`TypeError` پرتاب نشود." - +#: ../../library/functions.rst:1082 +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." +msgstr "" +"اگر آرگومان *object* نمونه‌ای از *classinfo* یا از یکی از زیرکلاس‌های آن (مستقیم، غیرمستقیم یا :term:`مجازی `) باشد، مقدار ``True`` را برمی‌گرداند. اگر *object* از نوع داده‌شده نباشد، این تابع همیشه ``False`` " +"برمی‌گرداند. اگر *classinfo* یک تاپل از نوع‌ها (یا به‌صورت بازگشتی، تاپل‌هایی از این نوع) یا یک :ref:`types-union` از " +"چندین نوع باشد، در صورتی که *object* نمونه‌ای از هر یک از آن نوع‌ها باشد، مقدار ``True`` برگردانده می‌شود. اگر " +"*classinfo* یک نوع، یا تاپلی از نوع‌ها و تاپل‌های مشابه نباشد، استثنای :exc:`TypeError` پرتاب می‌شود. با این حال، اگر " +"یک بررسیِ زودتر با موفقیت انجام شود، ممکن است برای یک نوع نامعتبر استثنای :exc:`TypeError` پرتاب نشود." + +#: ../../library/functions.rst:1093 ../../library/functions.rst:1107 msgid "*classinfo* can be a :ref:`types-union`." msgstr "*classinfo* می‌تواند یک :ref:`types-union` باشد." -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." -msgstr "اگر *class* زیرکلاس (مستقیم، غیرمستقیم یا :term:`مجازی `) *classinfo* باشد، مقدار ``True`` را برمی‌گرداند. هر کلاس، زیرکلاس خودش نیز در نظر گرفته می‌شود. *classinfo* می‌تواند یک تاپل از اشیای کلاس (یا به‌صورت بازگشتی، تاپل‌هایی از این نوع) یا یک :ref:`types-union` باشد؛ در این صورت، اگر *class* زیرکلاس هر یک از اعضای *classinfo* باشد، مقدار ``True`` برگردانده می‌شود. در هر حالت دیگر، استثنای :exc:`TypeError` پرتاب می‌شود." - -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 "یک شیء :term:`تکرارگر ` را برمی‌گرداند. تفسیر آرگومان اول به وجود یا عدم وجود آرگومان دوم بستگی دارد. اگر آرگومان دومی وجود نداشته باشد، آرگومان اول باید یک شیء مجموعه باشد که از پروتکل :term:`تکرارپذیر ` (متد :meth:`~object.__iter__`) پشتیبانی کند، یا از پروتکل دنباله (متد :meth:`~object.__getitem__` با آرگومان‌های صحیح که از ``0`` شروع می‌شوند) پشتیبانی کند. اگر از هیچ‌یک از این پروتکل‌ها پشتیبانی نکند، استثنای :exc:`TypeError` پرتاب می‌شود. اگر آرگومان دوم، یعنی *sentinel*، ارائه شود، آرگومان اول باید یک شیء فراخوانی‌پذیر باشد. تکرارگر ایجادشده در این حالت، در هر فراخوانی متد :meth:`~iterator.__next__`، *callable* را بدون آرگومان فراخوانی می‌کند؛ اگر مقدار بازگردانده‌شده برابر *sentinel* باشد، استثنای :exc:`StopIteration` پرتاب می‌شود؛ در غیر این صورت، همان مقدار برگردانده می‌شود." +#: ../../library/functions.rst:1099 +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." +msgstr "" +"اگر *class* زیرکلاس (مستقیم، غیرمستقیم یا :term:`مجازی `) *classinfo* باشد، مقدار ``True`` را " +"برمی‌گرداند. هر کلاس، زیرکلاس خودش نیز در نظر گرفته می‌شود. *classinfo* می‌تواند یک تاپل از اشیای کلاس (یا به‌صورت " +"بازگشتی، تاپل‌هایی از این نوع) یا یک :ref:`types-union` باشد؛ در این صورت، اگر *class* زیرکلاس هر یک از اعضای " +"*classinfo* باشد، مقدار ``True`` برگردانده می‌شود. در هر حالت دیگر، استثنای :exc:`TypeError` پرتاب می‌شود." +#: ../../library/functions.rst:1114 +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 "" +"یک شیء :term:`تکرارگر ` را برمی‌گرداند. تفسیر آرگومان اول به وجود یا عدم وجود آرگومان دوم بستگی دارد. اگر " +"آرگومان دومی وجود نداشته باشد، آرگومان اول باید یک شیء مجموعه باشد که از پروتکل :term:`تکرارپذیر ` " +"(متد :meth:`~object.__iter__`) پشتیبانی کند، یا از پروتکل دنباله (متد :meth:`~object.__getitem__` با آرگومان‌های صحیح " +"که از ``0`` شروع می‌شوند) پشتیبانی کند. اگر از هیچ‌یک از این پروتکل‌ها پشتیبانی نکند، استثنای :exc:`TypeError` پرتاب " +"می‌شود. اگر آرگومان دوم، یعنی *sentinel*، ارائه شود، آرگومان اول باید یک شیء فراخوانی‌پذیر باشد. تکرارگر ایجادشده در " +"این حالت، در هر فراخوانی متد :meth:`~iterator.__next__`، *callable* را بدون آرگومان فراخوانی می‌کند؛ اگر مقدار " +"بازگردانده‌شده برابر *sentinel* باشد، استثنای :exc:`StopIteration` پرتاب می‌شود؛ در غیر این صورت، همان مقدار برگردانده " +"می‌شود." + +#: ../../library/functions.rst:1128 msgid "See also :ref:`typeiter`." msgstr "همچنین به :ref:`typeiter` مراجعه کنید." -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::" -msgstr "یکی از کاربردهای مفید شکل دوم :func:`iter`، ساختن یک خوانندهٔ بلوکی (block reader) است. برای مثال، خواندن بلوک‌هایی با اندازهٔ ثابت از یک پروندهٔ پایگاه دادهٔ دودویی تا رسیدن به انتهای پرونده::" +#: ../../library/functions.rst:1130 +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::" +msgstr "" +"یکی از کاربردهای مفید شکل دوم :func:`iter`، ساختن یک خوانندهٔ بلوکی (block reader) است. برای مثال، خواندن بلوک‌هایی با " +"اندازهٔ ثابت از یک پروندهٔ پایگاه دادهٔ دودویی تا رسیدن به انتهای پرونده::" +#: ../../library/functions.rst:1134 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -954,219 +1836,549 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -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)." -msgstr "طول یک شیء (تعداد عناصر آن) را برمی‌گرداند. آرگومان می‌تواند یک دنباله (مانند رشته، bytes، تاپل، فهرست یا range) یا یک مجموعه (مانند دیکشنری، set یا frozenset) باشد." +#: ../../library/functions.rst:1142 +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)." +msgstr "" +"طول یک شیء (تعداد عناصر آن) را برمی‌گرداند. آرگومان می‌تواند یک دنباله (مانند رشته، bytes، تاپل، فهرست یا range) یا یک " +"مجموعه (مانند دیکشنری، set یا frozenset) باشد." -msgid "``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:1148 +msgid "" +"``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` پرتاب می‌کند." -msgid "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:1156 +msgid "" +"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` " +"مستند شده است." -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." -msgstr "یک شیء نگاشتی را برمی‌گرداند که جدول نمادهای محلی فعلی را نمایش می‌دهد؛ در آن، نام متغیرها کلیدها و ارجاع‌های فعلی آن‌ها مقادیر هستند." +#: ../../library/functions.rst:1162 +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." +msgstr "" +"یک شیء نگاشتی را برمی‌گرداند که جدول نمادهای محلی فعلی را نمایش می‌دهد؛ در آن، نام متغیرها کلیدها و ارجاع‌های فعلی آن‌ها " +"مقادیر هستند." -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`." -msgstr "در محدوده‌ی ماژول، و همچنین هنگام استفاده از :func:`exec` یا :func:`eval` با یک فضای نام واحد، این تابع همان فضای نامی را برمی‌گرداند که :func:`globals` برمی‌گرداند." +#: ../../library/functions.rst:1166 +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`." +msgstr "" +"در محدوده‌ی ماژول، و همچنین هنگام استفاده از :func:`exec` یا :func:`eval` با یک فضای نام واحد، این تابع همان فضای " +"نامی را برمی‌گرداند که :func:`globals` برمی‌گرداند." +#: ../../library/functions.rst:1170 msgid "At class scope, it returns the namespace that will be passed to the metaclass constructor." msgstr "در محدوده‌ی کلاس، این تابع فضای نامی را برمی‌گرداند که به سازندهٔ فراداده ارسال خواهد شد." -msgid "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:1173 +msgid "" +"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()`` با آرگومان‌های محلی و سراسریِ جداگانه، این تابع فضای نام محلیِ ارسال‌شده به " +"فراخوانی تابع را بازمی‌گرداند." -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 returned mapping object." -msgstr "در همهٔ حالت‌های بالا، هر فراخوانی ``locals()`` در یک قاب (frame) مشخص از اجرا، *همان* شیء نگاشتی را برمی‌گرداند. تغییراتی که از طریق شیء نگاشتیِ بازگردانده‌شده توسط ``locals()`` اعمال شوند، به‌صورت انتساب، انتساب مجدد یا حذف متغیرهای محلی قابل مشاهده خواهند بود، و انتساب، انتساب مجدد یا حذف متغیرهای محلی نیز بلافاصله محتوای شیء نگاشتیِ بازگردانده‌شده را تغییر می‌دهد." +#: ../../library/functions.rst:1176 +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 returned mapping object." +msgstr "" +"در همهٔ حالت‌های بالا، هر فراخوانی ``locals()`` در یک قاب (frame) مشخص از اجرا، *همان* شیء نگاشتی را برمی‌گرداند. " +"تغییراتی که از طریق شیء نگاشتیِ بازگردانده‌شده توسط ``locals()`` اعمال شوند، به‌صورت انتساب، انتساب مجدد یا حذف " +"متغیرهای محلی قابل مشاهده خواهند بود، و انتساب، انتساب مجدد یا حذف متغیرهای محلی نیز بلافاصله محتوای شیء نگاشتیِ " +"بازگردانده‌شده را تغییر می‌دهد." -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." -msgstr "در یک :term:`محدوده‌ی بهینه‌شده ` (از جمله توابع، تولیدگرها و هم‌روال‌ها)، هر فراخوانی ``locals()`` یک دیکشنری جدید برمی‌گرداند که شامل انتساب‌های فعلی متغیرهای محلی تابع و هرگونه ارجاع به سلول‌های غیرمحلی است. در این حالت، تغییرات انتساب نام که از طریق دیکشنری بازگردانده‌شده انجام شوند، به متغیرهای محلی یا ارجاع‌های سلول‌های غیرمحلی متناظر بازنویسی *نمی‌شوند*، و انتساب، انتساب مجدد یا حذف متغیرهای محلی و ارجاع‌های سلول‌های غیرمحلی نیز بر محتوای دیکشنری‌های بازگردانده‌شدهٔ قبلی تأثیری *ندارد*." +#: ../../library/functions.rst:1183 +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." +msgstr "" +"در یک :term:`محدوده‌ی بهینه‌شده ` (از جمله توابع، تولیدگرها و هم‌روال‌ها)، هر فراخوانی ``locals()`` یک " +"دیکشنری جدید برمی‌گرداند که شامل انتساب‌های فعلی متغیرهای محلی تابع و هرگونه ارجاع به سلول‌های غیرمحلی است. در این " +"حالت، تغییرات انتساب نام که از طریق دیکشنری بازگردانده‌شده انجام شوند، به متغیرهای محلی یا ارجاع‌های سلول‌های غیرمحلی " +"متناظر بازنویسی *نمی‌شوند*، و انتساب، انتساب مجدد یا حذف متغیرهای محلی و ارجاع‌های سلول‌های غیرمحلی نیز بر محتوای " +"دیکشنری‌های بازگردانده‌شدهٔ قبلی تأثیری *ندارد*." -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." -msgstr "فراخوانی ``locals()`` درون یک comprehension در یک تابع، تولیدگر یا هم‌روال، معادل فراخوانی آن در محدوده‌ی دربرگیرنده است، با این تفاوت که متغیرهای پیمایشِ مقداردهی‌شدهٔ comprehension نیز در آن گنجانده می‌شوند. در سایر محدوده‌ها رفتار آن به‌گونه‌ای است که گویی comprehension به‌صورت یک تابع تو‌در‌تو اجرا می‌شود." +#: ../../library/functions.rst:1192 +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." +msgstr "" +"فراخوانی ``locals()`` درون یک comprehension در یک تابع، تولیدگر یا هم‌روال، معادل فراخوانی آن در محدوده‌ی دربرگیرنده " +"است، با این تفاوت که متغیرهای پیمایشِ مقداردهی‌شدهٔ comprehension نیز در آن گنجانده می‌شوند. در سایر محدوده‌ها رفتار آن " +"به‌گونه‌ای است که گویی comprehension به‌صورت یک تابع تو‌در‌تو اجرا می‌شود." -msgid "Calling ``locals()`` as part of a generator expression is equivalent to calling it in a nested generator function." +#: ../../library/functions.rst:1198 +msgid "" +"Calling ``locals()`` as part of a generator expression is equivalent to calling it in a nested generator function." msgstr "فراخوانی ``locals()`` درون یک عبارت تولیدگر معادل فراخوانی آن در یک تابع تولیدگر تو‌در‌تو است." +#: ../../library/functions.rst:1201 msgid "The behaviour of ``locals()`` in a comprehension has been updated as described in :pep:`709`." msgstr "رفتار ``locals()`` در comprehensionها مطابق :pep:`709` به‌روزرسانی شده است." -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." -msgstr "به‌عنوان بخشی از :pep:`667`، اکنون معناشناسی تغییر دادن اشیای نگاشتی که این تابع برمی‌گرداند، تعریف شده است. رفتار این تابع در :term:`محدوده‌های بهینه‌شده ` اکنون همان‌گونه است که در بالا توضیح داده شد. به‌جز تعریف رسمی این رفتار، عملکرد آن در سایر محدوده‌ها نسبت به نسخه‌های پیشین تغییری نکرده است." +#: ../../library/functions.rst:1205 +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." +msgstr "" +"به‌عنوان بخشی از :pep:`667`، اکنون معناشناسی تغییر دادن اشیای نگاشتی که این تابع برمی‌گرداند، تعریف شده است. رفتار این " +"تابع در :term:`محدوده‌های بهینه‌شده ` اکنون همان‌گونه است که در بالا توضیح داده شد. به‌جز تعریف رسمی " +"این رفتار، عملکرد آن در سایر محدوده‌ها نسبت به نسخه‌های پیشین تغییری نکرده است." -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`." -msgstr "تکرارگری را برمی‌گرداند که *function* را روی هر عنصر *iterable* اعمال کرده و نتایج را تولید می‌کند. اگر آرگومان‌های *iterables* اضافی ارائه شوند، *function* باید به همان تعداد آرگومان بپذیرد و به‌طور هم‌زمان روی عناصر همهٔ تکرارپذیرها اعمال شود. در صورت وجود چند تکرارپذیر، تکرارگر زمانی متوقف می‌شود که کوتاه‌ترین تکرارپذیر به پایان برسد. اگر *strict* برابر ``True`` باشد و یکی از تکرارپذیرها زودتر از بقیه به پایان برسد، استثنای :exc:`ValueError` پرتاب می‌شود. در مواردی که ورودی‌های تابع از پیش به‌صورت تاپل‌های آرگومان مرتب شده‌اند، به :func:`itertools.starmap` مراجعه کنید." +#: ../../library/functions.rst:1215 +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`." +msgstr "" +"تکرارگری را برمی‌گرداند که *function* را روی هر عنصر *iterable* اعمال کرده و نتایج را تولید می‌کند. اگر آرگومان‌های " +"*iterables* اضافی ارائه شوند، *function* باید به همان تعداد آرگومان بپذیرد و به‌طور هم‌زمان روی عناصر همهٔ تکرارپذیرها " +"اعمال شود. در صورت وجود چند تکرارپذیر، تکرارگر زمانی متوقف می‌شود که کوتاه‌ترین تکرارپذیر به پایان برسد. اگر *strict* " +"برابر ``True`` باشد و یکی از تکرارپذیرها زودتر از بقیه به پایان برسد، استثنای :exc:`ValueError` پرتاب می‌شود. در " +"مواردی که ورودی‌های تابع از پیش به‌صورت تاپل‌های آرگومان مرتب شده‌اند، به :func:`itertools.starmap` مراجعه کنید." +#: ../../library/functions.rst:1224 msgid "Added the *strict* parameter." msgstr "پارامتر *strict* اضافه شد." +#: ../../library/functions.rst:1232 msgid "Return the largest item in an iterable or the largest of two or more arguments." msgstr "بزرگ‌ترین عنصر یک تکرارپذیر، یا بزرگ‌ترین مقدار از میان دو یا چند آرگومان را برمی‌گرداند." -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." -msgstr "اگر یک آرگومان مکانی ارائه شود، باید یک :term:`تکرارپذیر ` باشد. در این صورت، بزرگ‌ترین عنصر آن تکرارپذیر برگردانده می‌شود. اگر دو یا چند آرگومان مکانی ارائه شوند، بزرگ‌ترین آرگومان مکانی برگردانده می‌شود." +#: ../../library/functions.rst:1235 +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." +msgstr "" +"اگر یک آرگومان مکانی ارائه شود، باید یک :term:`تکرارپذیر ` باشد. در این صورت، بزرگ‌ترین عنصر آن تکرارپذیر " +"برگردانده می‌شود. اگر دو یا چند آرگومان مکانی ارائه شوند، بزرگ‌ترین آرگومان مکانی برگردانده می‌شود." -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." -msgstr "دو آرگومان اختیاریِ فقط-کلیدواژه‌ای (keyword-only) وجود دارد. آرگومان *key* یک تابع مرتب‌سازی تک‌آرگومانی، مشابه آنچه در :meth:`list.sort` استفاده می‌شود، مشخص می‌کند. آرگومان *default* شی‌ءای را مشخص می‌کند که در صورت خالی بودن تکرارپذیر بازگردانده شود. اگر تکرارپذیر خالی باشد و *default* ارائه نشده باشد، استثنای :exc:`ValueError` پرتاب می‌شود." +#: ../../library/functions.rst:1240 ../../library/functions.rst:1278 +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." +msgstr "" +"دو آرگومان اختیاریِ فقط-کلیدواژه‌ای (keyword-only) وجود دارد. آرگومان *key* یک تابع مرتب‌سازی تک‌آرگومانی، مشابه آنچه " +"در :meth:`list.sort` استفاده می‌شود، مشخص می‌کند. آرگومان *default* شی‌ءای را مشخص می‌کند که در صورت خالی بودن تکرارپذیر " +"بازگردانده شود. اگر تکرارپذیر خالی باشد و *default* ارائه نشده باشد، استثنای :exc:`ValueError` پرتاب می‌شود." -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)``." -msgstr "اگر چندین عنصر دارای بیشترین مقدار باشند، تابع نخستین موردی را که با آن برخورد کند برمی‌گرداند. این رفتار با سایر ابزارهایی که پایداری مرتب‌سازی را حفظ می‌کنند، مانند ``sorted(iterable, key=keyfunc, reverse=True)[0]`` و ``heapq.nlargest(1, iterable, key=keyfunc)``، سازگار است." +#: ../../library/functions.rst:1246 +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)``." +msgstr "" +"اگر چندین عنصر دارای بیشترین مقدار باشند، تابع نخستین موردی را که با آن برخورد کند برمی‌گرداند. این رفتار با سایر " +"ابزارهایی که پایداری مرتب‌سازی را حفظ می‌کنند، مانند ``sorted(iterable, key=keyfunc, reverse=True)[0]`` و " +"``heapq.nlargest(1, iterable, key=keyfunc)``، سازگار است." +#: ../../library/functions.rst:1251 ../../library/functions.rst:1289 msgid "Added the *default* keyword-only parameter." msgstr "پارامتر فقط-کلیدواژهٔ *default* اضافه شد." +#: ../../library/functions.rst:1254 ../../library/functions.rst:1292 msgid "The *key* can be ``None``." msgstr "*key* می‌تواند ``None`` باشد." -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:1262 +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:1270 msgid "Return the smallest item in an iterable or the smallest of two or more arguments." msgstr "کوچک‌ترین عنصر یک تکرارپذیر، یا کوچک‌ترین مقدار از میان دو یا چند آرگومان را برمی‌گرداند." -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." -msgstr "اگر یک آرگومان مکانی ارائه شود، باید یک :term:`تکرارپذیر ` باشد. در این صورت، کوچک‌ترین عنصر آن تکرارپذیر برگردانده می‌شود. اگر دو یا چند آرگومان مکانی ارائه شوند، کوچک‌ترین آرگومان مکانی برگردانده می‌شود." - -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)``." -msgstr "اگر چندین عنصر دارای کمترین مقدار باشند، تابع نخستین موردی را که با آن برخورد کند برمی‌گرداند. این رفتار با سایر ابزارهایی که پایداری مرتب‌سازی را حفظ می‌کنند، مانند ``sorted(iterable, key=keyfunc)[0]`` و ``heapq.nsmallest(1, iterable, key=keyfunc)``، سازگار است." +#: ../../library/functions.rst:1273 +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." +msgstr "" +"اگر یک آرگومان مکانی ارائه شود، باید یک :term:`تکرارپذیر ` باشد. در این صورت، کوچک‌ترین عنصر آن تکرارپذیر " +"برگردانده می‌شود. اگر دو یا چند آرگومان مکانی ارائه شوند، کوچک‌ترین آرگومان مکانی برگردانده می‌شود." -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." -msgstr "با فراخوانی متد :meth:`~iterator.__next__`، عنصر بعدی را از :term:`تکرارگر ` دریافت می‌کند. اگر *default* مشخص شده باشد، در صورت پایان یافتن تکرارگر همان مقدار برگردانده می‌شود؛ در غیر این صورت، استثنای :exc:`StopIteration` پرتاب می‌شود." +#: ../../library/functions.rst:1284 +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)``." +msgstr "" +"اگر چندین عنصر دارای کمترین مقدار باشند، تابع نخستین موردی را که با آن برخورد کند برمی‌گرداند. این رفتار با سایر " +"ابزارهایی که پایداری مرتب‌سازی را حفظ می‌کنند، مانند ``sorted(iterable, key=keyfunc)[0]`` و ``heapq.nsmallest(1, " +"iterable, key=keyfunc)``، سازگار است." -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." -msgstr "این، کلاس پایهٔ نهایی همهٔ کلاس‌های دیگر است. این کلاس متدهایی را در اختیار دارد که میان تمام نمونه‌های کلاس‌های پایتون مشترک هستند. هنگام فراخوانی سازندهٔ آن، یک شیء جدید و بدون ویژگی ایجاد می‌شود. این سازنده هیچ آرگومانی را نمی‌پذیرد." +#: ../../library/functions.rst:1299 +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." +msgstr "" +"با فراخوانی متد :meth:`~iterator.__next__`، عنصر بعدی را از :term:`تکرارگر ` دریافت می‌کند. اگر *default* " +"مشخص شده باشد، در صورت پایان یافتن تکرارگر همان مقدار برگردانده می‌شود؛ در غیر این صورت، استثنای :exc:`StopIteration` " +"پرتاب می‌شود." -msgid ":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:1306 +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." +msgstr "" +"این، کلاس پایهٔ نهایی همهٔ کلاس‌های دیگر است. این کلاس متدهایی را در اختیار دارد که میان تمام نمونه‌های کلاس‌های پایتون " +"مشترک هستند. هنگام فراخوانی سازندهٔ آن، یک شیء جدید و بدون ویژگی ایجاد می‌شود. این سازنده هیچ آرگومانی را نمی‌پذیرد." -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:" -msgstr "تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک عبارت معتبر پایتون خواهد بود. اگر *integer* یک شیء پایتون :class:`int` نباشد، لازم است یک متد :meth:`~object.__index__` تعریف کند که یک عدد صحیح برگرداند. برخی مثال ها:" +#: ../../library/functions.rst:1313 +msgid "" +":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` اختصاص دهید." -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." -msgstr "اگر می‌خواهید یک عدد صحیح را به یک رشتهٔ هشت‌هشتی، با پیشوند «0o» یا بدون آن، تبدیل کنید، می‌توانید از هر یک از روش‌های زیر استفاده کنید." +#: ../../library/functions.rst:1320 +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:" +msgstr "" +"تبدیل یک عدد صحیح به یک رشته باینری که با \"0b\" پیشوند شده است. نتیجه یک عبارت معتبر پایتون خواهد بود. اگر " +"*integer* یک شیء پایتون :class:`int` نباشد، لازم است یک متد :meth:`~object.__index__` تعریف کند که یک عدد صحیح " +"برگرداند. برخی مثال ها:" -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." -msgstr "*file* را باز کرده و :term:`شیء پرونده ` متناظر با آن را برمی‌گرداند. اگر پرونده قابل باز شدن نباشد، استثنای :exc:`OSError` پرتاب می‌شود. برای مثال‌های بیشتر دربارهٔ نحوهٔ استفاده از این تابع، به :ref:`tut-files` مراجعه کنید." +#: ../../library/functions.rst:1330 +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." +msgstr "" +"اگر می‌خواهید یک عدد صحیح را به یک رشتهٔ هشت‌هشتی، با پیشوند «0o» یا بدون آن، تبدیل کنید، می‌توانید از هر یک از روش‌های " +"زیر استفاده کنید." -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``.)" -msgstr "*file* یک :term:`شیء مسیرمانند ` است که مسیر پرونده (مطلق یا نسبی نسبت به پوشهٔ کاری فعلی) را برای باز شدن مشخص می‌کند، یا یک توصیفگر عددی پرونده مربوط به پرونده‌ای است که باید در یک شیء ورودی/خروجی بسته‌بندی شود. (اگر یک توصیفگر پرونده ارائه شود، هنگام بسته شدن شیء ورودی/خروجیِ بازگشتی نیز بسته خواهد شد، مگر اینکه *closefd* برابر ``False`` تنظیم شده باشد.)" +#: ../../library/functions.rst:1347 +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." +msgstr "" +"*file* را باز کرده و :term:`شیء پرونده ` متناظر با آن را برمی‌گرداند. اگر پرونده قابل باز شدن نباشد، " +"استثنای :exc:`OSError` پرتاب می‌شود. برای مثال‌های بیشتر دربارهٔ نحوهٔ استفاده از این تابع، به :ref:`tut-files` مراجعه " +"کنید." -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* یک رشتهٔ اختیاری است که حالت باز شدن پرونده را مشخص می‌کند. مقدار پیش‌فرض آن ``'r'`` است که به معنای باز کردن پرونده برای خواندن در حالت متنی است. مقادیر رایج دیگر عبارت‌اند از ``'w'`` برای نوشتن (که اگر پرونده از قبل وجود داشته باشد، محتوای آن را حذف می‌کند)، ``'x'`` برای ایجاد انحصاری، و ``'a'`` برای افزودن به انتهای پرونده (که در *برخی* از سیستم‌های یونیکس به این معناست که *تمام* عملیات نوشتن، صرف‌نظر از موقعیت فعلی نشانگر، به انتهای پرونده افزوده می‌شوند). در حالت متنی، اگر *encoding* مشخص نشده باشد، کدگذاری مورد استفاده به سکو بستگی دارد؛ در این حالت، :func:`locale.getencoding` برای دریافت کدگذاری محلی (locale) فعلی فراخوانی می‌شود. (برای خواندن و نوشتن بایت‌های خام، از حالت دودویی استفاده کنید و *encoding* را مشخص نکنید.) حالت‌های موجود عبارت‌اند از:" +#: ../../library/functions.rst:1351 +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``.)" +msgstr "" +"*file* یک :term:`شیء مسیرمانند ` است که مسیر پرونده (مطلق یا نسبی نسبت به پوشهٔ کاری فعلی) را برای " +"باز شدن مشخص می‌کند، یا یک توصیفگر عددی پرونده مربوط به پرونده‌ای است که باید در یک شیء ورودی/خروجی بسته‌بندی شود. (اگر " +"یک توصیفگر پرونده ارائه شود، هنگام بسته شدن شیء ورودی/خروجیِ بازگشتی نیز بسته خواهد شد، مگر اینکه *closefd* برابر " +"``False`` تنظیم شده باشد.)" +#: ../../library/functions.rst:1357 +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* یک رشتهٔ اختیاری است که حالت باز شدن پرونده را مشخص می‌کند. مقدار پیش‌فرض آن ``'r'`` است که به معنای باز کردن " +"پرونده برای خواندن در حالت متنی است. مقادیر رایج دیگر عبارت‌اند از ``'w'`` برای نوشتن (که اگر پرونده از قبل وجود " +"داشته باشد، محتوای آن را حذف می‌کند)، ``'x'`` برای ایجاد انحصاری، و ``'a'`` برای افزودن به انتهای پرونده (که در " +"*برخی* از سیستم‌های یونیکس به این معناست که *تمام* عملیات نوشتن، صرف‌نظر از موقعیت فعلی نشانگر، به انتهای پرونده " +"افزوده می‌شوند). در حالت متنی، اگر *encoding* مشخص نشده باشد، کدگذاری مورد استفاده به سکو بستگی دارد؛ در این " +"حالت، :func:`locale.getencoding` برای دریافت کدگذاری محلی (locale) فعلی فراخوانی می‌شود. (برای خواندن و نوشتن بایت‌های " +"خام، از حالت دودویی استفاده کنید و *encoding* را مشخص نکنید.) حالت‌های موجود عبارت‌اند از:" + +#: ../../library/functions.rst:1374 msgid "Character" msgstr "نویسه" +#: ../../library/functions.rst:1374 msgid "Meaning" msgstr "به معنی" +#: ../../library/functions.rst:1376 msgid "``'r'``" msgstr "``'r'``" +#: ../../library/functions.rst:1376 msgid "open for reading (default)" msgstr "باز کردن برای خواندن (پیش‌فرض)" +#: ../../library/functions.rst:1377 msgid "``'w'``" msgstr "``'w'``" +#: ../../library/functions.rst:1377 msgid "open for writing, truncating the file first" msgstr "باز کردن برای نوشتن؛ ابتدا محتوای پرونده حذف می‌شود." +#: ../../library/functions.rst:1378 msgid "``'x'``" msgstr "``'x'``" +#: ../../library/functions.rst:1378 msgid "open for exclusive creation, failing if the file already exists" msgstr "باز کردن برای ایجاد انحصاری؛ در صورتی که پرونده از قبل وجود داشته باشد، عملیات شکست می‌خورد" +#: ../../library/functions.rst:1379 msgid "``'a'``" msgstr "``'a'``" +#: ../../library/functions.rst:1379 msgid "open for writing, appending to the end of file if it exists" msgstr "باز کردن برای نوشتن؛ اگر پرونده وجود داشته باشد، داده‌ها به انتهای آن افزوده می‌شوند" +#: ../../library/functions.rst:1380 msgid "``'b'``" msgstr "``'b'``" +#: ../../library/functions.rst:1380 ../../library/functions.rst:1524 msgid "binary mode" msgstr "حالت دودویی" +#: ../../library/functions.rst:1381 msgid "``'t'``" msgstr "``'t'``" +#: ../../library/functions.rst:1381 msgid "text mode (default)" msgstr "حالت متن (پیشفرض)" +#: ../../library/functions.rst:1382 msgid "``'+'``" msgstr "``'+'``" +#: ../../library/functions.rst:1382 msgid "open for updating (reading and writing)" msgstr "باز کردن برای به‌روزرسانی (خواندن و نوشتن)" -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." -msgstr "حالت پیش‌فرض ``'r'`` است (باز کردن پرونده برای خواندن متن، که معادل ``'rt'`` است). حالت‌های ``'w+'`` و ``'w+b'`` پرونده را باز کرده و محتوای آن را حذف می‌کنند. حالت‌های ``'r+'`` و ``'r+b'`` پرونده را بدون حذف محتوا باز می‌کنند." - -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." -msgstr "همان‌طور که در :ref:`io-overview` اشاره شد، پایتون بین ورودی/خروجی دودویی و متنی تفاوت قائل می‌شود. پرونده‌هایی که در حالت دودویی باز می‌شوند (یعنی *mode* شامل ``'b'`` باشد)، محتوا را بدون هیچ کدگشایی به‌صورت اشیای :class:`bytes` برمی‌گردانند. در حالت متنی (حالت پیش‌فرض، یا زمانی که *mode* شامل ``'t'`` باشد)، محتوای پرونده به‌صورت :class:`str` برگردانده می‌شود؛ در این حالت، بایت‌ها ابتدا با استفاده از کدگذاری وابسته به سکو یا، در صورت مشخص شدن، با استفاده از *encoding* داده‌شده کدگشایی می‌شوند." +#: ../../library/functions.rst:1385 +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." +msgstr "" +"حالت پیش‌فرض ``'r'`` است (باز کردن پرونده برای خواندن متن، که معادل ``'rt'`` است). حالت‌های ``'w+'`` و ``'w+b'`` " +"پرونده را باز کرده و محتوای آن را حذف می‌کنند. حالت‌های ``'r+'`` و ``'r+b'`` پرونده را بدون حذف محتوا باز می‌کنند." -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." -msgstr "پایتون به مفهوم پروندهٔ متنی در سیستم‌عامل زیربنایی وابسته نیست؛ تمام پردازش‌ها توسط خود پایتون انجام می‌شوند و بنابراین مستقل از سکو هستند." +#: ../../library/functions.rst:1389 +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." +msgstr "" +"همان‌طور که در :ref:`io-overview` اشاره شد، پایتون بین ورودی/خروجی دودویی و متنی تفاوت قائل می‌شود. پرونده‌هایی که در " +"حالت دودویی باز می‌شوند (یعنی *mode* شامل ``'b'`` باشد)، محتوا را بدون هیچ کدگشایی به‌صورت اشیای :class:`bytes` " +"برمی‌گردانند. در حالت متنی (حالت پیش‌فرض، یا زمانی که *mode* شامل ``'t'`` باشد)، محتوای پرونده به‌صورت :class:`str` " +"برگردانده می‌شود؛ در این حالت، بایت‌ها ابتدا با استفاده از کدگذاری وابسته به سکو یا، در صورت مشخص شدن، با استفاده از " +"*encoding* داده‌شده کدگشایی می‌شوند." -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* یک عدد صحیح اختیاری است که برای تعیین سیاست بافرگذاری استفاده می‌شود. برای غیرفعال کردن بافرگذاری مقدار 0 را وارد کنید (که فقط در حالت دودویی مجاز است)، برای انتخاب بافرگذاری خطی مقدار 1 را وارد کنید (که فقط هنگام نوشتن در حالت متنی قابل استفاده است)، و یک عدد صحیح بزرگ‌تر از 1 را برای تعیین اندازهٔ یک بافر با اندازهٔ ثابت (بر حسب بایت) مشخص کنید. توجه داشته باشید که تعیین اندازهٔ بافر به این روش فقط برای ورودی/خروجی دودوییِ بافرشده اعمال می‌شود، اما ``TextIOWrapper`` (یعنی پرونده‌هایی که با ``mode='r+'`` باز می‌شوند) از بافرگذاری دیگری استفاده می‌کند. برای غیرفعال کردن بافرگذاری در ``TextIOWrapper``، استفاده از پرچم ``write_through`` برای :func:`io.TextIOWrapper.reconfigure` را در نظر بگیرید. اگر آرگومان *buffering* مشخص نشود، سیاست پیش‌فرض بافرگذاری به صورت زیر عمل می‌کند:" +#: ../../library/functions.rst:1399 +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." +msgstr "" +"پایتون به مفهوم پروندهٔ متنی در سیستم‌عامل زیربنایی وابسته نیست؛ تمام پردازش‌ها توسط خود پایتون انجام می‌شوند و بنابراین " +"مستقل از سکو هستند." -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." -msgstr "پرونده‌های دودویی در قطعه‌هایی با اندازهٔ ثابت بافر می‌شوند؛ اگر اندازهٔ بلوک دستگاه در دسترس باشد، اندازهٔ بافر برابر با ``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` خواهد بود. در بیشتر سیستم‌ها، اندازهٔ بافر معمولاً ۱۲۸ کیلوبایت است." +#: ../../library/functions.rst:1403 +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* یک عدد صحیح اختیاری است که برای تعیین سیاست بافرگذاری استفاده می‌شود. برای غیرفعال کردن بافرگذاری " +"مقدار 0 را وارد کنید (که فقط در حالت دودویی مجاز است)، برای انتخاب بافرگذاری خطی مقدار 1 را وارد کنید (که فقط هنگام " +"نوشتن در حالت متنی قابل استفاده است)، و یک عدد صحیح بزرگ‌تر از 1 را برای تعیین اندازهٔ یک بافر با اندازهٔ ثابت (بر حسب " +"بایت) مشخص کنید. توجه داشته باشید که تعیین اندازهٔ بافر به این روش فقط برای ورودی/خروجی دودوییِ بافرشده اعمال می‌شود، " +"اما ``TextIOWrapper`` (یعنی پرونده‌هایی که با ``mode='r+'`` باز می‌شوند) از بافرگذاری دیگری استفاده می‌کند. برای " +"غیرفعال کردن بافرگذاری در ``TextIOWrapper``، استفاده از پرچم ``write_through`` " +"برای :func:`io.TextIOWrapper.reconfigure` را در نظر بگیرید. اگر آرگومان *buffering* مشخص نشود، سیاست پیش‌فرض " +"بافرگذاری به صورت زیر عمل می‌کند:" + +#: ../../library/functions.rst:1413 +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." +msgstr "" +"پرونده‌های دودویی در قطعه‌هایی با اندازهٔ ثابت بافر می‌شوند؛ اگر اندازهٔ بلوک دستگاه در دسترس باشد، اندازهٔ بافر برابر با " +"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` خواهد بود. در بیشتر سیستم‌ها، اندازهٔ بافر معمولاً ۱۲۸ کیلوبایت است." -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." -msgstr "پرونده‌های متنی «تعاملی» (پرونده‌هایی که :meth:`~io.IOBase.isatty` برای آن‌ها مقدار ``True`` برمی‌گرداند) از بافرگذاری خطی استفاده می‌کنند. سایر پرونده‌های متنی از سیاستی که در بالا برای پرونده‌های دودویی توضیح داده شده است، پیروی می‌کنند." +#: ../../library/functions.rst:1418 +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." +msgstr "" +"پرونده‌های متنی «تعاملی» (پرونده‌هایی که :meth:`~io.IOBase.isatty` برای آن‌ها مقدار ``True`` برمی‌گرداند) از بافرگذاری " +"خطی استفاده می‌کنند. سایر پرونده‌های متنی از سیاستی که در بالا برای پرونده‌های دودویی توضیح داده شده است، پیروی می‌کنند." -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." -msgstr "*encoding* نام کدگذاری مورد استفاده برای کدگشایی یا کدگذاری پرونده است. این گزینه فقط باید در حالت متنی استفاده شود. کدگذاری پیش‌فرض به سکو بستگی دارد (هر مقداری که :func:`locale.getencoding` برگرداند)، اما می‌توان از هر :term:`کدگذاری متنی ` که توسط پایتون پشتیبانی می‌شود استفاده کرد. برای مشاهدهٔ فهرست کدگذاری‌های پشتیبانی‌شده، به ماژول :mod:`codecs` مراجعه کنید." +#: ../../library/functions.rst:1422 +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." +msgstr "" +"*encoding* نام کدگذاری مورد استفاده برای کدگشایی یا کدگذاری پرونده است. این گزینه فقط باید در حالت متنی استفاده شود. " +"کدگذاری پیش‌فرض به سکو بستگی دارد (هر مقداری که :func:`locale.getencoding` برگرداند)، اما می‌توان از هر :term:`کدگذاری " +"متنی ` که توسط پایتون پشتیبانی می‌شود استفاده کرد. برای مشاهدهٔ فهرست کدگذاری‌های پشتیبانی‌شده، به " +"ماژول :mod:`codecs` مراجعه کنید." -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:" -msgstr "*errors* یک رشتهٔ اختیاری است که مشخص می‌کند خطاهای کدگذاری و کدگشایی چگونه مدیریت شوند؛ این گزینه در حالت دودویی قابل استفاده نیست. مجموعه‌ای از مدیریت‌کننده‌های استاندارد خطا (که در :ref:`error-handlers` فهرست شده‌اند) در دسترس هستند، با این حال هر نام مدیریت خطایی که با :func:`codecs.register_error` ثبت شده باشد نیز معتبر است. نام‌های استاندارد شامل موارد زیر هستند:" +#: ../../library/functions.rst:1428 +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:" +msgstr "" +"*errors* یک رشتهٔ اختیاری است که مشخص می‌کند خطاهای کدگذاری و کدگشایی چگونه مدیریت شوند؛ این گزینه در حالت دودویی قابل " +"استفاده نیست. مجموعه‌ای از مدیریت‌کننده‌های استاندارد خطا (که در :ref:`error-handlers` فهرست شده‌اند) در دسترس هستند، با " +"این حال هر نام مدیریت خطایی که با :func:`codecs.register_error` ثبت شده باشد نیز معتبر است. نام‌های استاندارد شامل " +"موارد زیر هستند:" -msgid "``'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 "" +"``'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:1440 msgid "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to data loss." -msgstr "``'ignore'`` خطاها را نادیده می‌گیرد. توجه داشته باشید که نادیده گرفتن خطاهای کدگذاری ممکن است به از دست رفتن داده‌ها منجر شود." +msgstr "" +"``'ignore'`` خطاها را نادیده می‌گیرد. توجه داشته باشید که نادیده گرفتن خطاهای کدگذاری ممکن است به از دست رفتن داده‌ها " +"منجر شود." +#: ../../library/functions.rst:1443 msgid "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted where there is malformed data." msgstr "``'replace'`` باعث می‌شود در محل داده‌های نادرست، یک نویسهٔ جایگزین (مانند ``'?'``) درج شود." -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." -msgstr "``'surrogateescape'`` هر بایت نادرست را به‌صورت واحدهای کد جانشین پایینی در بازهٔ U+DC80 تا U+DCFF نمایش می‌دهد. سپس، هنگام نوشتن داده‌ها و استفاده از مدیریت‌کنندهٔ خطای ``surrogateescape``، این واحدهای کد جانشین دوباره به همان بایت‌ها تبدیل می‌شوند. این قابلیت برای پردازش پرونده‌هایی با کدگذاری نامشخص مفید است." +#: ../../library/functions.rst:1446 +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." +msgstr "" +"``'surrogateescape'`` هر بایت نادرست را به‌صورت واحدهای کد جانشین پایینی در بازهٔ U+DC80 تا U+DCFF نمایش می‌دهد. سپس، " +"هنگام نوشتن داده‌ها و استفاده از مدیریت‌کنندهٔ خطای ``surrogateescape``، این واحدهای کد جانشین دوباره به همان بایت‌ها " +"تبدیل می‌شوند. این قابلیت برای پردازش پرونده‌هایی با کدگذاری نامشخص مفید است." -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};`." -msgstr "``'xmlcharrefreplace'`` فقط هنگام نوشتن در یک پرونده پشتیبانی می‌شود. نویسه‌هایی که توسط کدگذاری پشتیبانی نمی‌شوند، با ارجاع نویسهٔ XML متناظر آن‌ها به صورت :samp:`&#{nnn};` جایگزین می‌شوند." +#: ../../library/functions.rst:1453 +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};`." +msgstr "" +"``'xmlcharrefreplace'`` فقط هنگام نوشتن در یک پرونده پشتیبانی می‌شود. نویسه‌هایی که توسط کدگذاری پشتیبانی نمی‌شوند، با " +"ارجاع نویسهٔ XML متناظر آن‌ها به صورت :samp:`&#{nnn};` جایگزین می‌شوند." +#: ../../library/functions.rst:1457 msgid "``'backslashreplace'`` replaces malformed data by Python's backslashed escape sequences." msgstr "``'backslashreplace'`` داده‌های نادرست را با توالی‌های گریز دارای بک‌اسلش در پایتون جایگزین می‌کند." -msgid "``'namereplace'`` (also only supported when writing) replaces unsupported characters with ``\\N{...}`` escape sequences." -msgstr "``'namereplace'`` (که آن هم فقط هنگام نوشتن پشتیبانی می‌شود) نویسه‌های پشتیبانی‌نشده را با توالی‌های گریز ``\\N{...}`` جایگزین می‌کند." +#: ../../library/functions.rst:1460 +msgid "" +"``'namereplace'`` (also only supported when writing) replaces unsupported characters with ``\\N{...}`` escape " +"sequences." +msgstr "" +"``'namereplace'`` (که آن هم فقط هنگام نوشتن پشتیبانی می‌شود) نویسه‌های پشتیبانی‌نشده را با توالی‌های گریز ``\\N{...}`` " +"جایگزین می‌کند." -msgid "*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 "" +"*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'`` باشد. عملکرد آن به صورت زیر است:" -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." -msgstr "هنگام خواندن ورودی از جریان، اگر *newline* برابر ``None`` باشد، حالت پایان‌خط‌های همگانی فعال می‌شود. در این حالت، خطوط ورودی می‌توانند با ``'\\n'``، ``'\\r'`` یا ``'\\r\\n'`` پایان یابند و پیش از بازگردانده شدن به فراخواننده، همگی به ``'\\n'`` تبدیل می‌شوند. اگر مقدار آن ``''`` باشد، حالت پایان‌خط‌های همگانی همچنان فعال است، اما نویسه‌های پایان خط بدون تبدیل به فراخواننده بازگردانده می‌شوند. اگر *newline* یکی از مقادیر مجاز دیگر را داشته باشد، خطوط ورودی فقط با همان رشته خاتمه می‌یابند و نویسهٔ پایان خط بدون تبدیل بازگردانده می‌شود." +#: ../../library/functions.rst:1472 +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." +msgstr "" +"هنگام خواندن ورودی از جریان، اگر *newline* برابر ``None`` باشد، حالت پایان‌خط‌های همگانی فعال می‌شود. در این حالت، خطوط " +"ورودی می‌توانند با ``'\\n'``، ``'\\r'`` یا ``'\\r\\n'`` پایان یابند و پیش از بازگردانده شدن به فراخواننده، همگی به " +"``'\\n'`` تبدیل می‌شوند. اگر مقدار آن ``''`` باشد، حالت پایان‌خط‌های همگانی همچنان فعال است، اما نویسه‌های پایان خط بدون " +"تبدیل به فراخواننده بازگردانده می‌شوند. اگر *newline* یکی از مقادیر مجاز دیگر را داشته باشد، خطوط ورودی فقط با همان " +"رشته خاتمه می‌یابند و نویسهٔ پایان خط بدون تبدیل بازگردانده می‌شود." -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." -msgstr "هنگام نوشتن خروجی در جریان، اگر *newline* برابر ``None`` باشد، هر نویسهٔ ``'\\n'`` نوشته‌شده به جداکنندهٔ پیش‌فرض پایان خط سیستم، یعنی :data:`os.linesep`، تبدیل می‌شود. اگر *newline* برابر ``''`` یا ``'\\n'`` باشد، هیچ تبدیلی انجام نمی‌شود. اگر *newline* یکی از مقادیر مجاز دیگر را داشته باشد، هر ``'\\n'`` نوشته‌شده به همان رشتهٔ مشخص‌شده تبدیل خواهد شد." +#: ../../library/functions.rst:1480 +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." +msgstr "" +"هنگام نوشتن خروجی در جریان، اگر *newline* برابر ``None`` باشد، هر نویسهٔ ``'\\n'`` نوشته‌شده به جداکنندهٔ پیش‌فرض پایان " +"خط سیستم، یعنی :data:`os.linesep`، تبدیل می‌شود. اگر *newline* برابر ``''`` یا ``'\\n'`` باشد، هیچ تبدیلی انجام " +"نمی‌شود. اگر *newline* یکی از مقادیر مجاز دیگر را داشته باشد، هر ``'\\n'`` نوشته‌شده به همان رشتهٔ مشخص‌شده تبدیل خواهد " +"شد." -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." -msgstr "اگر *closefd* برابر ``False`` باشد و به‌جای نام پرونده یک توصیفگر پرونده ارائه شده باشد، هنگام بسته شدن پرونده، توصیفگر پروندهٔ زیربنایی باز خواهد ماند. اگر نام پرونده ارائه شود، *closefd* باید برابر ``True`` (مقدار پیش‌فرض) باشد؛ در غیر این صورت، خطا پرتاب خواهد شد." +#: ../../library/functions.rst:1486 +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." +msgstr "" +"اگر *closefd* برابر ``False`` باشد و به‌جای نام پرونده یک توصیفگر پرونده ارائه شده باشد، هنگام بسته شدن پرونده، " +"توصیفگر پروندهٔ زیربنایی باز خواهد ماند. اگر نام پرونده ارائه شود، *closefd* باید برابر ``True`` (مقدار پیش‌فرض) باشد؛ " +"در غیر این صورت، خطا پرتاب خواهد شد." -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``)." -msgstr "با ارسال یک شیء فراخوانی‌پذیر به‌عنوان *opener* می‌توان از یک بازکنندهٔ سفارشی استفاده کرد. در این صورت، توصیفگر پروندهٔ زیربناییِ شیء پرونده با فراخوانی *opener* و ارسال (*file*, *flags*) به آن به‌دست می‌آید. *opener* باید یک توصیفگر پروندهٔ باز برگرداند (ارسال :mod:`os.open` به‌عنوان *opener* رفتاری مشابه ارسال ``None`` خواهد داشت)." +#: ../../library/functions.rst:1491 +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``)." +msgstr "" +"با ارسال یک شیء فراخوانی‌پذیر به‌عنوان *opener* می‌توان از یک بازکنندهٔ سفارشی استفاده کرد. در این صورت، توصیفگر پروندهٔ " +"زیربناییِ شیء پرونده با فراخوانی *opener* و ارسال (*file*, *flags*) به آن به‌دست می‌آید. *opener* باید یک توصیفگر " +"پروندهٔ باز برگرداند (ارسال :mod:`os.open` به‌عنوان *opener* رفتاری مشابه ارسال ``None`` خواهد داشت)." +#: ../../library/functions.rst:1497 msgid "The newly created file is :ref:`non-inheritable `." msgstr "پروندهٔ تازه ایجادشده :ref:`غیرقابل‌وراثت ` است." -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::" -msgstr "مثال زیر از پارامتر :ref:`dir_fd ` تابع :func:`os.open` برای باز کردن پرونده‌ای نسبت به یک پوشه مشخص استفاده می‌کند::" +#: ../../library/functions.rst:1499 +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::" +msgstr "" +"مثال زیر از پارامتر :ref:`dir_fd ` تابع :func:`os.open` برای باز کردن پرونده‌ای نسبت به یک پوشه مشخص استفاده " +"می‌کند::" +#: ../../library/functions.rst:1502 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -1188,69 +2400,155 @@ msgstr "" "...\n" ">>> os.close(dir_fd) # don't leak a file descriptor" -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 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` است، بازگردانده می‌شود." - -msgid "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:1512 +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 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:1533 +msgid "" +"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:1537 msgid "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, ``mode``, ``flags``." msgstr "یک :ref:`رویداد ممیزی ` با نام ``open`` و آرگومان‌های ``path``، ``mode`` و ``flags`` پرتاب می‌کند." +#: ../../library/functions.rst:1539 msgid "The ``mode`` and ``flags`` arguments may have been modified or inferred from the original call." -msgstr "آرگومان‌های ``mode`` و ``flags`` ممکن است بر اساس فراخوانی اولیه تغییر داده شده یا مقدار آن‌ها استنباط شده باشند." +msgstr "" +"آرگومان‌های ``mode`` و ``flags`` ممکن است بر اساس فراخوانی اولیه تغییر داده شده یا مقدار آن‌ها استنباط شده باشند." +#: ../../library/functions.rst:1544 msgid "The *opener* parameter was added." msgstr "پارامتر *opener* اضافه شده است." +#: ../../library/functions.rst:1545 msgid "The ``'x'`` mode was added." msgstr "حالت ``'x'`` اضافه شده است." +#: ../../library/functions.rst:1546 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "در گذشته استثنای :exc:`IOError` پرتاب می‌شد؛ اکنون این استثنا نام مستعاری برای :exc:`OSError` است." +#: ../../library/functions.rst:1547 msgid ":exc:`FileExistsError` is now raised if the file opened in exclusive creation mode (``'x'``) already exists." -msgstr "اگر فایلی که در حالت ایجاد انحصاری (``'x'``) باز می‌شود از قبل وجود داشته باشد، اکنون استثنای :exc:`FileExistsError` پرتاب می‌شود." +msgstr "" +"اگر فایلی که در حالت ایجاد انحصاری (``'x'``) باز می‌شود از قبل وجود داشته باشد، اکنون استثنای :exc:`FileExistsError` " +"پرتاب می‌شود." +#: ../../library/functions.rst:1552 msgid "The file is now non-inheritable." msgstr "اکنون این پرونده غیرقابل‌وراثت است." -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)." -msgstr "اگر فراخوانی سیستمی متوقف شود و مدیریت‌کنندهٔ سیگنال استثنایی پرتاب نکند، اکنون این تابع به‌جای پرتاب استثنای :exc:`InterruptedError`، فراخوانی سیستمی را دوباره امتحان می‌کند (برای دلیل این تغییر، :pep:`475` را ببینید)." +#: ../../library/functions.rst:1556 +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)." +msgstr "" +"اگر فراخوانی سیستمی متوقف شود و مدیریت‌کنندهٔ سیگنال استثنایی پرتاب نکند، اکنون این تابع به‌جای پرتاب " +"استثنای :exc:`InterruptedError`، فراخوانی سیستمی را دوباره امتحان می‌کند (برای دلیل این تغییر، :pep:`475` را ببینید)." +#: ../../library/functions.rst:1559 msgid "The ``'namereplace'`` error handler was added." msgstr "مدیر خطای ``'namereplace'`` اضافه شده است." +#: ../../library/functions.rst:1563 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "پشتیبانی از پذیرش اشیایی که :class:`os.PathLike` را پیاده‌سازی می‌کنند، اضافه شده است." -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:1564 +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:1567 msgid "The ``'U'`` mode has been removed." msgstr "حالت ``'U'`` حذف شده است." +#: ../../library/functions.rst:1572 msgid "Return the ordinal value of a character." msgstr "مقدار ترتیبی (ordinal) یک نویسه را برمی‌گرداند." -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`." -msgstr "اگر آرگومان یک رشتهٔ تک‌نویسه‌ای باشد، نقطهٔ کد یونیکد آن نویسه برگردانده می‌شود. برای مثال، ``ord('a')`` عدد صحیح ``97`` و ``ord('€')`` (نماد یورو) عدد ``8364`` را برمی‌گرداند. این تابع معکوس :func:`chr` است." - -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``." -msgstr "اگر آرگومان یک شیء :class:`bytes` یا :class:`bytearray` با طول ۱ باشد، مقدار تنها بایت آن برگردانده می‌شود. برای مثال، ``ord(b'a')`` عدد صحیح ``97`` را برمی‌گرداند." +#: ../../library/functions.rst:1574 +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`." +msgstr "" +"اگر آرگومان یک رشتهٔ تک‌نویسه‌ای باشد، نقطهٔ کد یونیکد آن نویسه برگردانده می‌شود. برای مثال، ``ord('a')`` عدد صحیح ``97`` " +"و ``ord('€')`` (نماد یورو) عدد ``8364`` را برمی‌گرداند. این تابع معکوس :func:`chr` است." -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``." -msgstr "*base* را به توان *exp* می‌رساند؛ اگر *mod* مشخص شده باشد، مقدار *base* به توان *exp* را به پیمانهٔ *mod* برمی‌گرداند (که کارآمدتر از ``pow(base, exp) % mod`` محاسبه می‌شود). شکل دوآرگومانی ``pow(base, exp)`` معادل استفاده از عملگر توان، یعنی ``base**exp``، است." +#: ../../library/functions.rst:1579 +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``." +msgstr "" +"اگر آرگومان یک شیء :class:`bytes` یا :class:`bytearray` با طول ۱ باشد، مقدار تنها بایت آن برگردانده می‌شود. برای " +"مثال، ``ord(b'a')`` عدد صحیح ``97`` را برمی‌گرداند." -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. 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:1586 +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``." +msgstr "" +"*base* را به توان *exp* می‌رساند؛ اگر *mod* مشخص شده باشد، مقدار *base* به توان *exp* را به پیمانهٔ *mod* برمی‌گرداند " +"(که کارآمدتر از ``pow(base, exp) % mod`` محاسبه می‌شود). شکل دوآرگومانی ``pow(base, exp)`` معادل استفاده از عملگر " +"توان، یعنی ``base**exp``، است." -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*." -msgstr "برای عملوندهای :class:`int` یعنی *base* و *exp*، اگر *mod* ارائه شود، باید از نوع عدد صحیح باشد و مقدار آن نیز نباید صفر باشد. اگر *mod* ارائه شده باشد و *exp* منفی باشد، *base* و *mod* باید نسبت به هم اول باشند. در این حالت، ``pow(inv_base, -exp, mod)`` برگردانده می‌شود که در آن *inv_base* وارونِ *base* به پیمانهٔ *mod* است." +#: ../../library/functions.rst:1591 +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. 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:1603 +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*." +msgstr "" +"برای عملوندهای :class:`int` یعنی *base* و *exp*، اگر *mod* ارائه شود، باید از نوع عدد صحیح باشد و مقدار آن نیز نباید " +"صفر باشد. اگر *mod* ارائه شده باشد و *exp* منفی باشد، *base* و *mod* باید نسبت به هم اول باشند. در این حالت، " +"``pow(inv_base, -exp, mod)`` برگردانده می‌شود که در آن *inv_base* وارونِ *base* به پیمانهٔ *mod* است." +#: ../../library/functions.rst:1609 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "در اینجا مثالی از محاسبهٔ وارون پیمانه‌ایِ ``38`` به پیمانهٔ ``97`` آورده شده است::" +#: ../../library/functions.rst:1611 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -1262,36 +2560,74 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -msgid "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:1616 +msgid "" +"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:1621 msgid "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "امکان استفاده از آرگومان‌های کلیدواژه‌ای اضافه شد. پیش از این، فقط آرگومان‌های مکانی پشتیبانی می‌شدند." -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." -msgstr "*objects* را با جداکنندهٔ *sep* و در انتها با *end* در جریان متنی *file* چاپ می‌کند. اگر *sep*، *end*، *file* یا *flush* مشخص شوند، باید به‌صورت آرگومان‌های کلیدواژه‌ای ارائه شوند." +#: ../../library/functions.rst:1628 +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." +msgstr "" +"*objects* را با جداکنندهٔ *sep* و در انتها با *end* در جریان متنی *file* چاپ می‌کند. اگر *sep*، *end*، *file* یا " +"*flush* مشخص شوند، باید به‌صورت آرگومان‌های کلیدواژه‌ای ارائه شوند." -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*." -msgstr "همهٔ آرگومان‌های غیرکلیدواژه‌ای، همانند :func:`str`، به رشته تبدیل شده و با جداکنندهٔ *sep* از یکدیگر جدا شده و سپس همراه با *end* در جریان (stream) نوشته می‌شوند. هر دو مقدار *sep* و *end* باید رشته باشند؛ همچنین می‌توانند ``None`` باشند که در این صورت از مقادیر پیش‌فرض استفاده می‌شود. اگر هیچ *objects*\\ ی ارائه نشود، :func:`print` فقط مقدار *end* را خواهد نوشت." +#: ../../library/functions.rst:1632 +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*." +msgstr "" +"همهٔ آرگومان‌های غیرکلیدواژه‌ای، همانند :func:`str`، به رشته تبدیل شده و با جداکنندهٔ *sep* از یکدیگر جدا شده و سپس " +"همراه با *end* در جریان (stream) نوشته می‌شوند. هر دو مقدار *sep* و *end* باید رشته باشند؛ همچنین می‌توانند ``None`` " +"باشند که در این صورت از مقادیر پیش‌فرض استفاده می‌شود. اگر هیچ *objects*\\ ی ارائه نشود، :func:`print` فقط مقدار *end* " +"را خواهد نوشت." -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." -msgstr "آرگومان *file* باید شی‌ءای باشد که متد ``write(string)`` را داشته باشد؛ اگر این آرگومان ارائه نشود یا ``None`` باشد، از :data:`sys.stdout` استفاده خواهد شد. از آنجا که آرگومان‌های چاپ‌شده به رشتهٔ متنی تبدیل می‌شوند، :func:`print` را نمی‌توان با اشیای فایل در حالت دودویی استفاده کرد. برای چنین مواردی، به‌جای آن از ``file.write(...)`` استفاده کنید." +#: ../../library/functions.rst:1638 +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." +msgstr "" +"آرگومان *file* باید شی‌ءای باشد که متد ``write(string)`` را داشته باشد؛ اگر این آرگومان ارائه نشود یا ``None`` باشد، " +"از :data:`sys.stdout` استفاده خواهد شد. از آنجا که آرگومان‌های چاپ‌شده به رشتهٔ متنی تبدیل می‌شوند، :func:`print` را " +"نمی‌توان با اشیای فایل در حالت دودویی استفاده کرد. برای چنین مواردی، به‌جای آن از ``file.write(...)`` استفاده کنید." +#: ../../library/functions.rst:1643 msgid "Output buffering is usually determined by *file*. However, if *flush* is true, the stream is forcibly flushed." -msgstr "بافرگذاری خروجی معمولاً توسط *file* تعیین می‌شود. با این حال، اگر *flush* برابر True باشد، جریان داده به‌اجبار تخلیه می‌شود." +msgstr "" +"بافرگذاری خروجی معمولاً توسط *file* تعیین می‌شود. با این حال، اگر *flush* برابر True باشد، جریان داده به‌اجبار تخلیه " +"می‌شود." +#: ../../library/functions.rst:1647 msgid "Added the *flush* keyword argument." msgstr "آرگومان کلیدواژه‌ای *flush* اضافه شد." +#: ../../library/functions.rst:1653 msgid "Return a property attribute." msgstr "یک ویژگی از نوع property را برمی‌گرداند." -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." -msgstr "*fget* تابعی برای دریافت مقدار یک ویژگی است. *fset* تابعی برای تنظیم مقدار یک ویژگی است. *fdel* تابعی برای حذف مقدار یک ویژگی است. همچنین *doc* یک رشتهٔ مستندات برای آن ویژگی ایجاد می‌کند." +#: ../../library/functions.rst:1655 +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." +msgstr "" +"*fget* تابعی برای دریافت مقدار یک ویژگی است. *fset* تابعی برای تنظیم مقدار یک ویژگی است. *fdel* تابعی برای حذف مقدار " +"یک ویژگی است. همچنین *doc* یک رشتهٔ مستندات برای آن ویژگی ایجاد می‌کند." +#: ../../library/functions.rst:1659 msgid "A typical use is to define a managed attribute ``x``::" msgstr "یک کاربرد رایج، تعریف ویژگی مدیریت‌شدهٔ ``x`` به‌صورت زیر است::" +#: ../../library/functions.rst:1661 msgid "" "class C:\n" " def __init__(self):\n" @@ -1323,12 +2659,25 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -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." -msgstr "اگر *c* نمونه‌ای از *C* باشد، عبارت ``c.x`` فراخوانی‌کنندهٔ getter، عبارت ``c.x = value`` فراخوانی‌کنندهٔ setter، و عبارت ``del c.x`` فراخوانی‌کنندهٔ deleter خواهد بود." +#: ../../library/functions.rst:1676 +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." +msgstr "" +"اگر *c* نمونه‌ای از *C* باشد، عبارت ``c.x`` فراخوانی‌کنندهٔ getter، عبارت ``c.x = value`` فراخوانی‌کنندهٔ setter، و عبارت " +"``del c.x`` فراخوانی‌کنندهٔ deleter خواهد بود." -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`::" -msgstr "اگر *doc* مشخص شده باشد، به‌عنوان docstring ویژگی property استفاده خواهد شد. در غیر این صورت، property، docstring مربوط به *fget* را (در صورت وجود) کپی می‌کند. این امکان را فراهم می‌کند که با استفاده از :func:`property` به‌عنوان یک :term:`دکوراتور `، به‌سادگی ویژگی‌های فقط‌خواندنی ایجاد شوند::" +#: ../../library/functions.rst:1679 +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 :deco:`property` as " +"a :term:`decorator`::" +msgstr "" +"اگر *doc* مشخص شده باشد، به‌عنوان docstring ویژگی property استفاده خواهد شد. در غیر این صورت، property، docstring " +"مربوط به *fget* را (در صورت وجود) کپی می‌کند. این امکان را فراهم می‌کند که با استفاده از :deco:`property` به‌عنوان " +"یک :term:`دکوراتور `، به‌سادگی ویژگی‌های فقط‌خواندنی ایجاد شوند::" +#: ../../library/functions.rst:1683 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -1348,12 +2697,25 @@ msgstr "" " \"\"\"Get the current voltage.\"\"\"\n" " return self._voltage" -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.\"" -msgstr "تزئین‌کنندهٔ ``@property`` متد :meth:`!voltage` را به یک «getter» برای ویژگی فقط‌خواندنی‌ای با همان نام تبدیل می‌کند و docstring ویژگی *voltage* را روی «Get the current voltage.» تنظیم می‌کند." +#: ../../library/functions.rst:1692 +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.\"" +msgstr "" +"تزئین‌کنندهٔ ``@property`` متد :meth:`!voltage` را به یک «getter» برای ویژگی فقط‌خواندنی‌ای با همان نام تبدیل می‌کند و " +"docstring ویژگی *voltage* را روی «Get the current voltage.» تنظیم می‌کند." -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:" -msgstr "یک شیء property دارای متدهای ``getter``، ``setter`` و ``deleter`` است که می‌توان از آن‌ها به‌عنوان دکوراتور استفاده کرد. این متدها نسخه‌ای از property را ایجاد می‌کنند که تابع دسترسی متناظر آن با تابع دکوراتورشده جایگزین شده است. این موضوع با یک مثال بهتر توضیح داده می‌شود:" +#: ../../library/functions.rst:1700 +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:" +msgstr "" +"یک شیء property دارای متدهای ``getter``، ``setter`` و ``deleter`` است که می‌توان از آن‌ها به‌عنوان دکوراتور استفاده " +"کرد. این متدها نسخه‌ای از property را ایجاد می‌کنند که تابع دسترسی متناظر آن با تابع دکوراتورشده جایگزین شده است. این " +"موضوع با یک مثال بهتر توضیح داده می‌شود:" +#: ../../library/functions.rst:1705 msgid "" "class C:\n" " def __init__(self):\n" @@ -1389,27 +2751,57 @@ msgstr "" " def x(self):\n" " del self._x" -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.)" -msgstr "این کد دقیقاً معادل مثال اول است. دقت کنید که توابع اضافی نیز همان نام property اصلی (در این مثال ``x``) را داشته باشند." +#: ../../library/functions.rst:1724 +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.)" +msgstr "" +"این کد دقیقاً معادل مثال اول است. دقت کنید که توابع اضافی نیز همان نام property اصلی (در این مثال ``x``) را داشته " +"باشند." -msgid "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:1728 +msgid "" +"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:1731 msgid "The docstrings of property objects are now writeable." msgstr "اکنون docstring اشیای property قابل‌ویرایش است." +#: ../../library/functions.rst:1736 msgid "Attribute holding the name of the property. The name of the property can be changed at runtime." msgstr "ویژگی‌ای که نام property را نگه می‌دارد. نام property را می‌توان در زمان اجرا تغییر داد." -msgid "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:1747 +msgid "" +"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` مستند شده است." -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 raise :exc:`RuntimeError`." -msgstr "رشته‌ای را برمی‌گرداند که نمایش قابل چاپی از یک شیء را در بر دارد. برای بسیاری از نوع‌ها، این تابع تلاش می‌کند رشته‌ای برگرداند که اگر به :func:`eval` داده شود، شی‌ءای با همان مقدار تولید کند؛ در غیر این صورت، نمایش به‌صورت رشته‌ای درون کروشه‌های زاویه‌دار خواهد بود که نام نوع شیء و اطلاعات اضافی، که معمولاً شامل نام و نشانی شیء است، در آن قرار دارد. یک کلاس می‌تواند با تعریف متد :meth:`~object.__repr__` مشخص کند که این تابع برای نمونه‌های آن چه مقداری برگرداند. اگر :func:`sys.displayhook` در دسترس نباشد، این تابع استثنای :exc:`RuntimeError` پرتاب می‌کند." +#: ../../library/functions.rst:1753 +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 raise :exc:`RuntimeError`." +msgstr "" +"رشته‌ای را برمی‌گرداند که نمایش قابل چاپی از یک شیء را در بر دارد. برای بسیاری از نوع‌ها، این تابع تلاش می‌کند رشته‌ای " +"برگرداند که اگر به :func:`eval` داده شود، شی‌ءای با همان مقدار تولید کند؛ در غیر این صورت، نمایش به‌صورت رشته‌ای درون " +"کروشه‌های زاویه‌دار خواهد بود که نام نوع شیء و اطلاعات اضافی، که معمولاً شامل نام و نشانی شیء است، در آن قرار دارد. یک " +"کلاس می‌تواند با تعریف متد :meth:`~object.__repr__` مشخص کند که این تابع برای نمونه‌های آن چه مقداری برگرداند. " +"اگر :func:`sys.displayhook` در دسترس نباشد، این تابع استثنای :exc:`RuntimeError` پرتاب می‌کند." +#: ../../library/functions.rst:1764 msgid "This class has a custom representation that can be evaluated::" msgstr "این کلاس یک نمایش (representation) سفارشی دارد که قابل ارزیابی است::" +#: ../../library/functions.rst:1766 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -1427,81 +2819,198 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -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``)." -msgstr "یک :term:`تکرارگر ` معکوس را برمی‌گرداند. آرگومان باید شی‌ءای باشد که متد :meth:`~object.__reversed__` را داشته باشد یا از پروتکل دنباله (متد :meth:`~object.__len__` و متد :meth:`~object.__getitem__` با آرگومان‌های صحیح که از ``0`` شروع می‌شوند) پشتیبانی کند." +#: ../../library/functions.rst:1777 +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``)." +msgstr "" +"یک :term:`تکرارگر ` معکوس را برمی‌گرداند. آرگومان باید شی‌ءای باشد که متد :meth:`~object.__reversed__` را " +"داشته باشد یا از پروتکل دنباله (متد :meth:`~object.__len__` و متد :meth:`~object.__getitem__` با آرگومان‌های صحیح که " +"از ``0`` شروع می‌شوند) پشتیبانی کند." -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." -msgstr "*number* را با دقت *ndigits* رقم پس از ممیز گرد می‌کند. اگر *ndigits* حذف شده باشد یا برابر ``None`` باشد، نزدیک‌ترین عدد صحیح به ورودی را برمی‌گرداند." +#: ../../library/functions.rst:1785 +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." +msgstr "" +"*number* را با دقت *ndigits* رقم پس از ممیز گرد می‌کند. اگر *ndigits* حذف شده باشد یا برابر ``None`` باشد، نزدیک‌ترین " +"عدد صحیح به ورودی را برمی‌گرداند." -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*." -msgstr "برای انواع داخلی‌ای که از :func:`round` پشتیبانی می‌کنند، مقادیر به نزدیک‌ترین مضرب 10 به توان منفی *ndigits* گرد می‌شوند. اگر دو مضرب به یک اندازه نزدیک باشند، گرد کردن به سمت مقدار زوج انجام می‌شود (برای مثال، هر دو عبارت ``round(0.5)`` و ``round(-0.5)`` برابر ``0`` هستند و ``round(1.5)`` برابر ``2`` است). هر مقدار صحیحی (مثبت، صفر یا منفی) برای *ndigits* معتبر است. اگر *ndigits* حذف شود یا ``None`` باشد، مقدار بازگشتی یک عدد صحیح خواهد بود. در غیر این صورت، مقدار بازگشتی همان نوع *number* را خواهد داشت." +#: ../../library/functions.rst:1789 +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*." +msgstr "" +"برای انواع داخلی‌ای که از :func:`round` پشتیبانی می‌کنند، مقادیر به نزدیک‌ترین مضرب 10 به توان منفی *ndigits* گرد " +"می‌شوند. اگر دو مضرب به یک اندازه نزدیک باشند، گرد کردن به سمت مقدار زوج انجام می‌شود (برای مثال، هر دو عبارت " +"``round(0.5)`` و ``round(-0.5)`` برابر ``0`` هستند و ``round(1.5)`` برابر ``2`` است). هر مقدار صحیحی (مثبت، صفر یا " +"منفی) برای *ndigits* معتبر است. اگر *ndigits* حذف شود یا ``None`` باشد، مقدار بازگشتی یک عدد صحیح خواهد بود. در غیر " +"این صورت، مقدار بازگشتی همان نوع *number* را خواهد داشت." +#: ../../library/functions.rst:1798 msgid "For a general Python object ``number``, ``round`` delegates to ``number.__round__``." msgstr "برای یک شیء عمومی پایتون به نام ``number``، تابع ``round`` فراخوانی را به ``number.__round__`` واگذار می‌کند." -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." -msgstr "رفتار :func:`round` برای اعداد ممیز شناور ممکن است غافلگیرکننده باشد؛ برای مثال، ``round(2.675, 2)`` به‌جای ``2.68`` مقدار ``2.67`` را برمی‌گرداند. این یک باگ نیست؛ بلکه نتیجهٔ این واقعیت است که بیشتر کسرهای ده‌دهی را نمی‌توان به‌طور دقیق به‌صورت عدد ممیز شناور نمایش داد. برای اطلاعات بیشتر به :ref:`tut-fp-issues` مراجعه کنید." +#: ../../library/functions.rst:1803 +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." +msgstr "" +"رفتار :func:`round` برای اعداد ممیز شناور ممکن است غافلگیرکننده باشد؛ برای مثال، ``round(2.675, 2)`` به‌جای ``2.68`` " +"مقدار ``2.67`` را برمی‌گرداند. این یک باگ نیست؛ بلکه نتیجهٔ این واقعیت است که بیشتر کسرهای ده‌دهی را نمی‌توان به‌طور دقیق " +"به‌صورت عدد ممیز شناور نمایش داد. برای اطلاعات بیشتر به :ref:`tut-fp-issues` مراجعه کنید." -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." -msgstr "یک شیء جدید از نوع :class:`set` را برمی‌گرداند که در صورت ارائه، عناصر آن از *iterable* گرفته می‌شوند. ``set`` یک کلاس داخلی است. برای مستندات این کلاس، به :class:`set` و :ref:`types-set` مراجعه کنید." +#: ../../library/functions.rst:1814 +msgid "" +"Return a new :class:`set` object, optionally with elements taken from *iterable*. :class:`set` is a built-in " +"class. See also :ref:`types-set` for documentation about this class." +msgstr "" +"یک شیء جدید از نوع :class:`set` را برمی‌گرداند و به صورت اختیاری، عناصر آن از *iterable* گرفته می‌شوند. :class:`set` " +"یک کلاس داخلی است. برای مستندات این کلاس، به :ref:`types-set` مراجعه کنید." -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." -msgstr "برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`frozenset`، :class:`list`، :class:`tuple` و :class:`dict`، و همچنین ماژول :mod:`collections` مراجعه کنید." +#: ../../library/functions.rst:1818 +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." +msgstr "" +"برای سایر انواع محفظه‌ها، به کلاس‌های داخلی :class:`frozenset`، :class:`list`، :class:`tuple` و :class:`dict`، و " +"همچنین ماژول :mod:`collections` مراجعه کنید." -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``." -msgstr "این تابع همتای :func:`getattr` است. آرگومان‌های آن یک شیء، یک رشته و یک مقدار دلخواه هستند. رشته می‌تواند نام یک ویژگی موجود یا یک ویژگی جدید باشد. در صورت مجاز بودن، تابع مقدار را به آن ویژگی اختصاص می‌دهد. برای مثال، ``setattr(x, 'foobar', 123)`` معادل ``x.foobar = 123`` است." +#: ../../library/functions.rst:1825 +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``." +msgstr "" +"این تابع همتای :func:`getattr` است. آرگومان‌های آن یک شیء، یک رشته و یک مقدار دلخواه هستند. رشته می‌تواند نام یک ویژگی " +"موجود یا یک ویژگی جدید باشد. در صورت مجاز بودن، تابع مقدار را به آن ویژگی اختصاص می‌دهد. برای مثال، ``setattr(x, " +"'foobar', 123)`` معادل ``x.foobar = 123`` است." -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.." -msgstr "*name* لازم نیست یک شناسهٔ پایتون، مطابق تعریف :ref:`identifiers`، باشد؛ مگر اینکه خود شیء این موضوع را اعمال کند، برای مثال در یک :meth:`~object.__getattribute__` سفارشی یا از طریق :attr:`~object.__slots__`. ویژگی‌ای که نام آن یک شناسه نباشد، با استفاده از نماد نقطه قابل دسترسی نیست، اما از طریق :func:`getattr` و توابع مشابه قابل دسترسی خواهد بود." +#: ../../library/functions.rst:1831 +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.." +msgstr "" +"*name* لازم نیست یک شناسهٔ پایتون، مطابق تعریف :ref:`identifiers`، باشد؛ مگر اینکه خود شیء این موضوع را اعمال کند، " +"برای مثال در یک :meth:`~object.__getattribute__` سفارشی یا از طریق :attr:`~object.__slots__`. ویژگی‌ای که نام آن یک " +"شناسه نباشد، با استفاده از نماد نقطه قابل دسترسی نیست، اما از طریق :func:`getattr` و توابع مشابه قابل دسترسی خواهد " +"بود." -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`." -msgstr "از آنجا که :ref:`تغییر نام خصوصی ` در زمان کامپایل انجام می‌شود، برای تنظیم مقدار یک ویژگی خصوصی (ویژگی‌هایی که با دو زیرخط آغاز می‌شوند) با استفاده از :func:`setattr`، باید نام آن را به‌صورت دستی تغییر دهید." +#: ../../library/functions.rst:1839 +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`." +msgstr "" +"از آنجا که :ref:`تغییر نام خصوصی ` در زمان کامپایل انجام می‌شود، برای تنظیم مقدار یک ویژگی " +"خصوصی (ویژگی‌هایی که با دو زیرخط آغاز می‌شوند) با استفاده از :func:`setattr`، باید نام آن را به‌صورت دستی تغییر دهید." -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``." -msgstr "یک شیء :term:`slice` را برمی‌گرداند که مجموعهٔ اندیس‌های مشخص‌شده توسط ``range(start, stop, step)`` را نمایش می‌دهد. آرگومان‌های *start* و *step* به‌طور پیش‌فرض برابر ``None`` هستند." +#: ../../library/functions.rst:1848 +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``." +msgstr "" +"یک شیء :term:`slice` را برمی‌گرداند که مجموعهٔ اندیس‌های مشخص‌شده توسط ``range(start, stop, step)`` را نمایش می‌دهد. " +"آرگومان‌های *start* و *step* به‌طور پیش‌فرض برابر ``None`` هستند." -msgid "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:1852 +msgid "" +"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:1855 msgid "See :func:`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "برای نسخهٔ جایگزینی که یک :term:`تکرارگر ` برمی‌گرداند، به :func:`itertools.islice` مراجعه کنید." -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." -msgstr "این ویژگی‌های فقط‌خواندنی بر اساس مقادیر آرگومان‌ها (یا مقادیر پیش‌فرض آن‌ها) تنظیم می‌شوند. خود آن‌ها قابلیت صریح دیگری ندارند؛ بااین‌حال، توسط NumPy و سایر بسته‌های شخص ثالث استفاده می‌شوند." +#: ../../library/functions.rst:1862 +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." +msgstr "" +"این ویژگی‌های فقط‌خواندنی بر اساس مقادیر آرگومان‌ها (یا مقادیر پیش‌فرض آن‌ها) تنظیم می‌شوند. خود آن‌ها قابلیت صریح دیگری " +"ندارند؛ بااین‌حال، توسط NumPy و سایر بسته‌های شخص ثالث استفاده می‌شوند." -msgid "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:1866 +msgid "" +"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:1872 msgid "Return a new sorted list from the items in *iterable*." msgstr "یک فهرست مرتب‌شدهٔ جدید از عناصر *iterable* را برمی‌گرداند." +#: ../../library/functions.rst:1874 msgid "Has two optional arguments which must be specified as keyword arguments." msgstr "دارای دو آرگومان اختیاری است که باید به‌صورت آرگومان‌های کلیدواژه‌ای مشخص شوند." -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)." -msgstr "*key* تابعی با یک آرگومان را مشخص می‌کند که برای استخراج یک کلید مقایسه از هر عنصر در *iterable* استفاده می‌شود (برای مثال، ``key=str.lower``). مقدار پیش‌فرض آن ``None`` است (در این حالت، عناصر مستقیماً با یکدیگر مقایسه می‌شوند)." +#: ../../library/functions.rst:1876 +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)." +msgstr "" +"*key* تابعی با یک آرگومان را مشخص می‌کند که برای استخراج یک کلید مقایسه از هر عنصر در *iterable* استفاده می‌شود (برای " +"مثال، ``key=str.lower``). مقدار پیش‌فرض آن ``None`` است (در این حالت، عناصر مستقیماً با یکدیگر مقایسه می‌شوند)." -msgid "*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:1880 +msgid "" +"*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:1883 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` استفاده کنید." -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)." -msgstr "تابع داخلی :func:`sorted` تضمین می‌کند که مرتب‌سازی پایدار باشد. مرتب‌سازی پایدار به این معناست که ترتیب نسبی عناصری که با هم برابر مقایسه می‌شوند تغییر نمی‌کند؛ این ویژگی برای مرتب‌سازی چندمرحله‌ای (برای مثال، ابتدا بر اساس دپارتمان و سپس بر اساس ردهٔ حقوق) مفید است." +#: ../../library/functions.rst:1886 +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)." +msgstr "" +"تابع داخلی :func:`sorted` تضمین می‌کند که مرتب‌سازی پایدار باشد. مرتب‌سازی پایدار به این معناست که ترتیب نسبی عناصری که " +"با هم برابر مقایسه می‌شوند تغییر نمی‌کند؛ این ویژگی برای مرتب‌سازی چندمرحله‌ای (برای مثال، ابتدا بر اساس دپارتمان و سپس " +"بر اساس ردهٔ حقوق) مفید است." -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." -msgstr "الگوریتم مرتب‌سازی تنها از مقایسه‌های ``<`` بین عناصر استفاده می‌کند. هرچند تعریف متد :meth:`~object.__lt__` برای مرتب‌سازی کافی است، :PEP:`8` توصیه می‌کند که هر شش عملگر :ref:`مقایسهٔ غنی ` پیاده‌سازی شوند. این کار به جلوگیری از بروز خطا هنگام استفاده از همان داده‌ها با ابزارهای مرتب‌سازی دیگری مانند :func:`max` که به متد زیربنایی متفاوتی متکی هستند کمک می‌کند. همچنین، پیاده‌سازی هر شش مقایسه از سردرگمی در مقایسهٔ انواع مختلف که ممکن است متد بازتابی :meth:`~object.__gt__` را فراخوانی کنند جلوگیری می‌کند." +#: ../../library/functions.rst:1891 +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." +msgstr "" +"الگوریتم مرتب‌سازی تنها از مقایسه‌های ``<`` بین عناصر استفاده می‌کند. هرچند تعریف متد :meth:`~object.__lt__` برای " +"مرتب‌سازی کافی است، :PEP:`8` توصیه می‌کند که هر شش عملگر :ref:`مقایسهٔ غنی ` پیاده‌سازی شوند. این کار به " +"جلوگیری از بروز خطا هنگام استفاده از همان داده‌ها با ابزارهای مرتب‌سازی دیگری مانند :func:`max` که به متد زیربنایی " +"متفاوتی متکی هستند کمک می‌کند. همچنین، پیاده‌سازی هر شش مقایسه از سردرگمی در مقایسهٔ انواع مختلف که ممکن است متد " +"بازتابی :meth:`~object.__gt__` را فراخوانی کنند جلوگیری می‌کند." +#: ../../library/functions.rst:1900 msgid "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "برای مثال‌هایی از مرتب‌سازی و یک آموزش کوتاه دربارهٔ آن، به :ref:`sortinghowto` مراجعه کنید." +#: ../../library/functions.rst:1904 msgid "Transform a method into a static method." msgstr "یک متد را به متد ایستا تبدیل می‌کند." +#: ../../library/functions.rst:1906 msgid "A static method does not receive an implicit first argument. To declare a static method, use this idiom::" msgstr "یک متد ایستا نخستین آرگومان ضمنی دریافت نمی‌کند. برای تعریف یک متد ایستا، از الگوی زیر استفاده کنید::" +#: ../../library/functions.rst:1909 msgid "" "class C:\n" " @staticmethod\n" @@ -1511,18 +3020,39 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." +#: ../../library/functions.rst:1913 msgid "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:`function` for details." msgstr "شکل ``@staticmethod`` یک :term:`تزئین‌کننده ` تابع است؛ برای جزئیات به :ref:`function` مراجعه کنید." -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()``)." -msgstr "یک متد ایستا را می‌توان هم روی خود کلاس (مانند ``C.f()``) و هم روی یک نمونه (مانند ``C().f()``) فراخوانی کرد. علاوه بر این، :term:`توصیفگر ` متد ایستا نیز فراخوانی‌پذیر است؛ بنابراین می‌توان از آن در تعریف کلاس (مانند ``f()``) استفاده کرد." +#: ../../library/functions.rst:1916 +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()``)." +msgstr "" +"یک متد ایستا را می‌توان هم روی خود کلاس (مانند ``C.f()``) و هم روی یک نمونه (مانند ``C().f()``) فراخوانی کرد. علاوه " +"بر این، :term:`توصیفگر ` متد ایستا نیز فراخوانی‌پذیر است؛ بنابراین می‌توان از آن در تعریف کلاس (مانند " +"``f()``) استفاده کرد." -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." -msgstr "متدهای ایستا در پایتون مشابه متدهای ایستای موجود در جاوا یا ++C هستند. همچنین، برای گونه‌ای که در ایجاد سازنده‌های جایگزین برای کلاس مفید است، به :func:`classmethod` مراجعه کنید." +#: ../../library/functions.rst:1921 +msgid "" +"Static methods in Python are similar to those found in Java or C++. Also, see :deco:`classmethod` for a variant that " +"is useful for creating alternate class constructors." +msgstr "" +"متدهای ایستا در پایتون مشابه متدهای ایستای موجود در جاوا یا ++C هستند. همچنین، برای گونه‌ای که در ایجاد سازنده‌های " +"جایگزین برای کلاس مفید است، به :deco:`classmethod` مراجعه کنید." -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::" -msgstr "مانند همهٔ دکوراتورها، می‌توان ``staticmethod`` را نیز به‌صورت یک تابع معمولی فراخوانی کرد و از نتیجهٔ آن استفاده نمود. این کار در برخی موارد که به ارجاعی به یک تابع از درون بدنهٔ کلاس نیاز دارید و می‌خواهید از تبدیل خودکار آن به متد نمونه جلوگیری کنید، ضروری است. در چنین مواردی، از الگوی زیر استفاده کنید::" +#: ../../library/functions.rst:1925 +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::" +msgstr "" +"مانند همهٔ دکوراتورها، می‌توان ``staticmethod`` را نیز به‌صورت یک تابع معمولی فراخوانی کرد و از نتیجهٔ آن استفاده نمود. " +"این کار در برخی موارد که به ارجاعی به یک تابع از درون بدنهٔ کلاس نیاز دارید و می‌خواهید از تبدیل خودکار آن به متد " +"نمونه جلوگیری کنید، ضروری است. در چنین مواردی، از الگوی زیر استفاده کنید::" +#: ../../library/functions.rst:1931 msgid "" "def regular_function():\n" " ...\n" @@ -1536,60 +3066,150 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" +#: ../../library/functions.rst:1937 msgid "For more information on static methods, see :ref:`types`." msgstr "برای اطلاعات بیشتر دربارهٔ متدهای ایستا، به :ref:`types` مراجعه کنید." -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." -msgstr "متدهای ایستا اکنون ویژگی‌های متد (:attr:`~function.__module__`، :attr:`~function.__name__`، :attr:`~function.__qualname__`، :attr:`~function.__doc__` و :attr:`~function.__annotations__`) را به ارث می‌برند، دارای ویژگی جدید ``__wrapped__`` هستند و همچنین اکنون مانند توابع معمولی قابل فراخوانی‌اند." +#: ../../library/functions.rst:1939 +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." +msgstr "" +"متدهای ایستا اکنون ویژگی‌های متد " +"(:attr:`~function.__module__`، :attr:`~function.__name__`، :attr:`~function.__qualname__`، :attr:`~function.__doc__` " +"و :attr:`~function.__annotations__`) را به ارث می‌برند، دارای ویژگی جدید ``__wrapped__`` هستند و همچنین اکنون مانند " +"توابع معمولی قابل فراخوانی‌اند." +#: ../../library/functions.rst:1957 msgid "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "نسخه‌ای از *object* از نوع :class:`str` را برمی‌گرداند. برای جزئیات بیشتر، به :func:`str` مراجعه کنید." +#: ../../library/functions.rst:1959 msgid "``str`` is the built-in string :term:`class`. For general information about strings, see :ref:`textseq`." msgstr "``str`` :term:`کلاس ` رشتهٔ داخلی پایتون است. برای اطلاعات کلی دربارهٔ رشته‌ها، :ref:`textseq` را ببینید." -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." -msgstr "*start* و عناصر *iterable* را از چپ به راست با هم جمع می‌کند و مجموع را برمی‌گرداند. عناصر *iterable* معمولاً عدد هستند و مقدار *start* مجاز نیست رشته باشد." +#: ../../library/functions.rst:1965 +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." +msgstr "" +"*start* و عناصر *iterable* را از چپ به راست با هم جمع می‌کند و مجموع را برمی‌گرداند. عناصر *iterable* معمولاً عدد هستند " +"و مقدار *start* مجاز نیست رشته باشد." -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`." -msgstr "برای برخی کاربردها، جایگزین‌های مناسبی برای :func:`sum` وجود دارد. روش ترجیحی و سریع برای به‌هم‌چسباندن یک دنباله از رشته‌ها، فراخوانی ``''.join(sequence)`` است. برای جمع کردن اعداد ممیز شناور با دقت بیشتر، به :func:`math.fsum` مراجعه کنید. همچنین برای به‌هم‌پیوستن مجموعه‌ای از تکرارپذیرها، استفاده از :func:`itertools.chain` را در نظر بگیرید." +#: ../../library/functions.rst:1969 +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`." +msgstr "" +"برای برخی کاربردها، جایگزین‌های مناسبی برای :func:`sum` وجود دارد. روش ترجیحی و سریع برای به‌هم‌چسباندن یک دنباله از " +"رشته‌ها، فراخوانی ``''.join(sequence)`` است. برای جمع کردن اعداد ممیز شناور با دقت بیشتر، به :func:`math.fsum` مراجعه " +"کنید. همچنین برای به‌هم‌پیوستن مجموعه‌ای از تکرارپذیرها، استفاده از :func:`itertools.chain` را در نظر بگیرید." +#: ../../library/functions.rst:1975 msgid "The *start* parameter can be specified as a keyword argument." msgstr "پارامتر *start* را می‌توان به‌صورت آرگومان کلیدواژه‌ای مشخص کرد." -msgid "Summation of floats switched to an algorithm that gives higher accuracy and better commutativity on most builds." -msgstr "الگوریتم جمع اعداد ممیز شناور به الگوریتمی تغییر یافته است که در بیشتر نسخه‌های ساخت (buildها)، دقت بیشتر و جابجاپذیری بهتری فراهم می‌کند." +#: ../../library/functions.rst:1978 +msgid "" +"Summation of floats switched to an algorithm that gives higher accuracy and better commutativity on most builds." +msgstr "" +"الگوریتم جمع اعداد ممیز شناور به الگوریتمی تغییر یافته است که در بیشتر نسخه‌های ساخت (buildها)، دقت بیشتر و " +"جابجاپذیری بهتری فراهم می‌کند." +#: ../../library/functions.rst:1981 msgid "Added specialization for summation of complexes, using same algorithm as for summation of floats." msgstr "بهینه‌سازی ویژه‌ای برای جمع اعداد مختلط، با استفاده از همان الگوریتم جمع اعداد اعشاری، اضافه شد." -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." -msgstr "یک شیء واسط را برمی‌گرداند که فراخوانی متدها را به یک کلاس والد یا هم‌ردهٔ *type* واگذار می‌کند. این قابلیت برای دسترسی به متدهای به‌ارث‌رسیده‌ای که در یک کلاس بازنویسی شده‌اند، مفید است." - -msgid "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:1989 +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." +msgstr "" +"یک شیء واسط را برمی‌گرداند که فراخوانی متدها را به یک کلاس والد یا هم‌ردهٔ *type* واگذار می‌کند. این قابلیت برای دسترسی " +"به متدهای به‌ارث‌رسیده‌ای که در یک کلاس بازنویسی شده‌اند، مفید است." -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``." -msgstr "برای مثال، اگر :attr:`~type.__mro__` مربوط به *object_or_type* برابر با ``D -> B -> C -> A -> object`` باشد و مقدار *type* برابر ``B`` باشد، در این صورت :func:`super` در مسیر ``C -> A -> object`` جست‌وجو می‌کند." +#: ../../library/functions.rst:1993 +msgid "" +"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* قرار دارد آغاز می‌شود." -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." -msgstr "ویژگی :attr:`~type.__mro__` کلاس متناظر با *object_or_type* ترتیب جست‌وجوی حل متد را که هم توسط :func:`getattr` و هم توسط :func:`super` استفاده می‌شود، فهرست می‌کند. این ویژگی پویا است و هر زمان که سلسله‌مراتب وراثت تغییر کند، ممکن است تغییر یابد." +#: ../../library/functions.rst:1997 +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``." +msgstr "" +"برای مثال، اگر :attr:`~type.__mro__` مربوط به *object_or_type* برابر با ``D -> B -> C -> A -> object`` باشد و مقدار " +"*type* برابر ``B`` باشد، در این صورت :func:`super` در مسیر ``C -> A -> object`` جست‌وجو می‌کند." -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)." -msgstr "اگر آرگومان دوم حذف شود، شیء super بازگردانده‌شده بدون اتصال (unbound) خواهد بود. اگر آرگومان دوم یک شیء باشد، باید ``isinstance(obj, type)`` برقرار باشد. اگر آرگومان دوم یک نوع (type) باشد، باید ``issubclass(type2, type)`` برقرار باشد (این مورد برای متدهای کلاس مفید است)." +#: ../../library/functions.rst:2001 +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." +msgstr "" +"ویژگی :attr:`~type.__mro__` کلاس متناظر با *object_or_type* ترتیب جست‌وجوی حل متد را که هم توسط :func:`getattr` و هم " +"توسط :func:`super` استفاده می‌شود، فهرست می‌کند. این ویژگی پویا است و هر زمان که سلسله‌مراتب وراثت تغییر کند، ممکن است " +"تغییر یابد." -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.)" -msgstr "هنگامی که این تابع مستقیماً درون یک متد معمولیِ یک کلاس فراخوانی شود، هر دو آرگومان را می‌توان حذف کرد («:func:`!super` بدون آرگومان»). در این حالت، *type* همان کلاسِ محصورکننده خواهد بود و *obj* اولین آرگومانِ تابعِ بلافاصله محصورکننده (معمولاً ``self``) خواهد بود. (این بدان معناست که :func:`!super` بدون آرگومان در توابع تو‌در‌تو، از جمله عبارت‌های تولیدگر که به‌طور ضمنی توابع تو‌در‌تو ایجاد می‌کنند، مطابق انتظار عمل نخواهد کرد.)" +#: ../../library/functions.rst:2006 +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)." +msgstr "" +"اگر آرگومان دوم حذف شود، شیء super بازگردانده‌شده بدون اتصال (unbound) خواهد بود. اگر آرگومان دوم یک شیء باشد، باید " +"``isinstance(obj, type)`` برقرار باشد. اگر آرگومان دوم یک نوع (type) باشد، باید ``issubclass(type2, type)`` برقرار " +"باشد (این مورد برای متدهای کلاس مفید است)." -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." -msgstr "دو کاربرد متداول برای *super* وجود دارد. در سلسله‌مراتب کلاسی با وراثت تکی، می‌توان از *super* برای ارجاع به کلاس‌های والد بدون نام بردن صریح از آن‌ها استفاده کرد و در نتیجه نگهداری کد را آسان‌تر ساخت. این کاربرد بسیار مشابه استفاده از *super* در سایر زبان‌های برنامه‌نویسی است." +#: ../../library/functions.rst:2011 +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.)" +msgstr "" +"هنگامی که این تابع مستقیماً درون یک متد معمولیِ یک کلاس فراخوانی شود، هر دو آرگومان را می‌توان حذف کرد («:func:`!super` " +"بدون آرگومان»). در این حالت، *type* همان کلاسِ محصورکننده خواهد بود و *obj* اولین آرگومانِ تابعِ بلافاصله محصورکننده " +"(معمولاً ``self``) خواهد بود. (این بدان معناست که :func:`!super` بدون آرگومان در توابع تو‌در‌تو، از جمله عبارت‌های " +"تولیدگر که به‌طور ضمنی توابع تو‌در‌تو ایجاد می‌کنند، مطابق انتظار عمل نخواهد کرد.)" -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)." -msgstr "کاربرد متداول دوم، پشتیبانی از وراثت چندگانهٔ مشارکتی در یک محیط اجرای پویا است. این کاربرد مختص پایتون است و در زبان‌های کامپایل‌شوندهٔ ایستا یا زبان‌هایی که فقط از وراثت تکی پشتیبانی می‌کنند وجود ندارد. این قابلیت امکان پیاده‌سازی «الگوهای الماسی» را فراهم می‌کند؛ جایی که چندین کلاس پایه یک متد یکسان را پیاده‌سازی می‌کنند. طراحی مناسب ایجاب می‌کند که چنین پیاده‌سازی‌هایی در همهٔ موارد امضای فراخوانی یکسانی داشته باشند (زیرا ترتیب فراخوانی‌ها در زمان اجرا تعیین می‌شود، با تغییرات سلسله‌مراتب کلاس تطبیق می‌یابد و ممکن است شامل کلاس‌های هم‌سطحی باشد که پیش از زمان اجرا ناشناخته هستند)." +#: ../../library/functions.rst:2018 +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." +msgstr "" +"دو کاربرد متداول برای *super* وجود دارد. در سلسله‌مراتب کلاسی با وراثت تکی، می‌توان از *super* برای ارجاع به کلاس‌های " +"والد بدون نام بردن صریح از آن‌ها استفاده کرد و در نتیجه نگهداری کد را آسان‌تر ساخت. این کاربرد بسیار مشابه استفاده از " +"*super* در سایر زبان‌های برنامه‌نویسی است." +#: ../../library/functions.rst:2023 +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)." +msgstr "" +"کاربرد متداول دوم، پشتیبانی از وراثت چندگانهٔ مشارکتی در یک محیط اجرای پویا است. این کاربرد مختص پایتون است و در " +"زبان‌های کامپایل‌شوندهٔ ایستا یا زبان‌هایی که فقط از وراثت تکی پشتیبانی می‌کنند وجود ندارد. این قابلیت امکان پیاده‌سازی " +"«الگوهای الماسی» را فراهم می‌کند؛ جایی که چندین کلاس پایه یک متد یکسان را پیاده‌سازی می‌کنند. طراحی مناسب ایجاب می‌کند " +"که چنین پیاده‌سازی‌هایی در همهٔ موارد امضای فراخوانی یکسانی داشته باشند (زیرا ترتیب فراخوانی‌ها در زمان اجرا تعیین " +"می‌شود، با تغییرات سلسله‌مراتب کلاس تطبیق می‌یابد و ممکن است شامل کلاس‌های هم‌سطحی باشد که پیش از زمان اجرا ناشناخته " +"هستند)." + +#: ../../library/functions.rst:2033 msgid "For both use cases, a typical superclass call looks like this::" msgstr "در هر دو مورد استفاده، یک فراخوانی معمول به ابرکلاس به صورت زیر است::" +#: ../../library/functions.rst:2035 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -1601,72 +3221,177 @@ msgstr "" " super().method(arg) # This does the same thing as:\n" " # super(C, self).method(arg)" -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." -msgstr "علاوه بر جست‌وجوی متدها، :func:`super` برای جست‌وجوی ویژگی‌ها نیز عمل می‌کند. یکی از کاربردهای ممکن آن، فراخوانی :term:`توصیفگرها ` در یک کلاس والد یا هم‌رده است." +#: ../../library/functions.rst:2040 +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." +msgstr "" +"علاوه بر جست‌وجوی متدها، :func:`super` برای جست‌وجوی ویژگی‌ها نیز عمل می‌کند. یکی از کاربردهای ممکن آن، " +"فراخوانی :term:`توصیفگرها ` در یک کلاس والد یا هم‌رده است." -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]``." -msgstr "توجه داشته باشید که :func:`super` به‌عنوان بخشی از فرایند اتصال برای جست‌وجوی صریح ویژگی‌ها با نماد نقطه، مانند ``super().__getitem__(name)``, پیاده‌سازی شده است. این کار از طریق پیاده‌سازی متد :meth:`~object.__getattribute__` خودش انجام می‌شود تا کلاس‌ها را با ترتیبی قابل پیش‌بینی جست‌وجو کند؛ ترتیبی که از وراثت چندگانهٔ مشارکتی (cooperative multiple inheritance) پشتیبانی می‌کند. بر این اساس، رفتار :func:`super` برای جست‌وجوهای ضمنی که با دستورها یا عملگرهایی مانند ``super()[name]`` انجام می‌شوند، تعریف نشده است." +#: ../../library/functions.rst:2044 +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]``." +msgstr "" +"توجه داشته باشید که :func:`super` به‌عنوان بخشی از فرایند اتصال برای جست‌وجوی صریح ویژگی‌ها با نماد نقطه، مانند " +"``super().__getitem__(name)``, پیاده‌سازی شده است. این کار از طریق پیاده‌سازی متد :meth:`~object.__getattribute__` " +"خودش انجام می‌شود تا کلاس‌ها را با ترتیبی قابل پیش‌بینی جست‌وجو کند؛ ترتیبی که از وراثت چندگانهٔ مشارکتی (cooperative " +"multiple inheritance) پشتیبانی می‌کند. بر این اساس، رفتار :func:`super` برای جست‌وجوهای ضمنی که با دستورها یا " +"عملگرهایی مانند ``super()[name]`` انجام می‌شوند، تعریف نشده است." -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 accessing the current instance for ordinary methods." -msgstr "همچنین توجه داشته باشید که، به‌جز حالت بدون آرگومان، :func:`super` محدود به استفاده درون متدها نیست. شکل دوآرگومانی، آرگومان‌ها را دقیقاً همان‌گونه که داده شده‌اند استفاده کرده و ارجاعات مناسب را ایجاد می‌کند. شکل بدون آرگومان فقط درون تعریف یک کلاس کار می‌کند، زیرا کامپایلر جزئیات لازم را برای بازیابی صحیح کلاس در حال تعریف و همچنین دسترسی به نمونهٔ فعلی در متدهای معمولی به‌طور خودکار فراهم می‌کند." +#: ../../library/functions.rst:2052 +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 accessing the current instance for ordinary methods." +msgstr "" +"همچنین توجه داشته باشید که، به‌جز حالت بدون آرگومان، :func:`super` محدود به استفاده درون متدها نیست. شکل دوآرگومانی، " +"آرگومان‌ها را دقیقاً همان‌گونه که داده شده‌اند استفاده کرده و ارجاعات مناسب را ایجاد می‌کند. شکل بدون آرگومان فقط درون " +"تعریف یک کلاس کار می‌کند، زیرا کامپایلر جزئیات لازم را برای بازیابی صحیح کلاس در حال تعریف و همچنین دسترسی به نمونهٔ " +"فعلی در متدهای معمولی به‌طور خودکار فراهم می‌کند." -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 "" +"For practical suggestions on how to design cooperative classes using :func:`super`, see `guide to using super() " +"`_." +msgstr "" +"برای پیشنهادهای کاربردی دربارهٔ طراحی کلاس‌های مشارکتی با استفاده از :func:`super`، به `راهنمای استفاده از super() " +"`_ مراجعه کنید." +#: ../../library/functions.rst:2063 msgid ":class:`super` objects are now :mod:`pickleable ` and :mod:`copyable `." msgstr "اکنون اشیای :class:`super` از :mod:`سریال‌سازی با pickle ` و :mod:`کپی شدن ` پشتیبانی می‌کنند." -msgid "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` مستند شده است." - -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__`." -msgstr "در صورت ارسال یک آرگومان، نوعِ یک *object* را بازمی‌گرداند. مقدار بازگشتی یک شیء از نوع type است و معمولاً همان شی‌ءای است که توسط :attr:`object.__class__` بازگردانده می‌شود." +#: ../../library/functions.rst:2072 +msgid "" +"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` مستند شده است." -msgid "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:2081 +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__`." +msgstr "" +"در صورت ارسال یک آرگومان، نوعِ یک *object* را بازمی‌گرداند. مقدار بازگشتی یک شیء از نوع type است و معمولاً همان شی‌ءای " +"است که توسط :attr:`object.__class__` بازگردانده می‌شود." -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:" -msgstr "در صورت ارسال سه آرگومان، یک شیء type جدید بازمی‌گرداند. این در واقع شکل پویای دستور :keyword:`class` است. رشتهٔ *name* نام کلاس را مشخص می‌کند و به ویژگی :attr:`~type.__name__` تبدیل می‌شود. تاپل *bases* کلاس‌های پایه را در خود نگه می‌دارد و به ویژگی :attr:`~type.__bases__` تبدیل می‌شود؛ اگر خالی باشد، :class:`object`، که کلاس پایهٔ نهایی همهٔ کلاس‌ها است، به آن افزوده می‌شود. دیکشنری *dict* شامل تعریف ویژگی‌ها و متدهای بدنهٔ کلاس است؛ این دیکشنری ممکن است پیش از تبدیل شدن به ویژگی :attr:`~type.__dict__` کپی یا در یک wrapper قرار داده شود. دو دستور زیر اشیای :class:`!type` یکسانی ایجاد می‌کنند:" +#: ../../library/functions.rst:2085 +msgid "" +"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:2088 +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:" +msgstr "" +"در صورت ارسال سه آرگومان، یک شیء type جدید بازمی‌گرداند. این در واقع شکل پویای دستور :keyword:`class` است. رشتهٔ " +"*name* نام کلاس را مشخص می‌کند و به ویژگی :attr:`~type.__name__` تبدیل می‌شود. تاپل *bases* کلاس‌های پایه را در خود نگه " +"می‌دارد و به ویژگی :attr:`~type.__bases__` تبدیل می‌شود؛ اگر خالی باشد، :class:`object`، که کلاس پایهٔ نهایی همهٔ کلاس‌ها " +"است، به آن افزوده می‌شود. دیکشنری *dict* شامل تعریف ویژگی‌ها و متدهای بدنهٔ کلاس است؛ این دیکشنری ممکن است پیش از تبدیل " +"شدن به ویژگی :attr:`~type.__dict__` کپی یا در یک wrapper قرار داده شود. دو دستور زیر اشیای :class:`!type` یکسانی " +"ایجاد می‌کنند:" + +#: ../../library/functions.rst:2103 msgid "See also:" msgstr "همچنین ببینید:" +#: ../../library/functions.rst:2105 msgid ":ref:`Documentation on attributes and methods on classes `." msgstr ":ref:`مستندات ویژگی‌ها و متدهای کلاس‌ها `." +#: ../../library/functions.rst:2106 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -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." -msgstr "آرگومان‌های کلیدواژه‌ای که به شکل سه‌آرگومانی ارسال می‌شوند، همانند کلیدواژه‌های موجود در تعریف یک کلاس (به‌جز *فرا‌داده*) به سازوکار مناسب فراداده (معمولاً :meth:`~object.__init_subclass__`) ارسال می‌شوند." +#: ../../library/functions.rst:2108 +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." +msgstr "" +"آرگومان‌های کلیدواژه‌ای که به شکل سه‌آرگومانی ارسال می‌شوند، همانند کلیدواژه‌های موجود در تعریف یک کلاس (به‌جز *فرا‌داده*) " +"به سازوکار مناسب فراداده (معمولاً :meth:`~object.__init_subclass__`) ارسال می‌شوند." + +#: ../../library/functions.rst:2113 +msgid "" +"Unlike a :keyword:`class` statement, the three argument form does not call the metaclass ``__prepare__`` method " +"(see :ref:`prepare`). Use :func:`types.new_class` to dynamically create a class using the appropriate metaclass." +msgstr "" +"برخلاف دستور :keyword:`class`، فرم سه‌آرگومانی متد ``__prepare__`` فراکلاس را فراخوانی نمی‌کند (به :ref:`prepare` " +"مراجعه کنید). برای ایجاد پویای یک کلاس با استفاده از فراکلاس مناسب، از :func:`types.new_class` استفاده کنید." +#: ../../library/functions.rst:2118 msgid "See also :ref:`class-customization`." msgstr "همچنین به :ref:`class-customization` مراجعه کنید." -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." -msgstr "زیرکلاس‌های :class:`!type` که ``type.__new__`` را بازنویسی نمی‌کنند، دیگر نمی‌توانند از شکل تک‌آرگومانی برای دریافت نوع یک شیء استفاده کنند." +#: ../../library/functions.rst:2120 +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." +msgstr "" +"زیرکلاس‌های :class:`!type` که ``type.__new__`` را بازنویسی نمی‌کنند، دیگر نمی‌توانند از شکل تک‌آرگومانی برای دریافت نوع " +"یک شیء استفاده کنند." -msgid "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:2127 +msgid "" +"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__` باشد را " +"برمی‌گرداند." -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)." -msgstr "اشیایی مانند ماژول‌ها و نمونه‌ها دارای ویژگی :attr:`~object.__dict__` قابل‌به‌روزرسانی هستند؛ با این حال، برخی اشیای دیگر ممکن است محدودیت‌هایی برای نوشتن در ویژگی :attr:`!__dict__` خود داشته باشند (برای مثال، کلاس‌ها از :class:`types.MappingProxyType` برای جلوگیری از به‌روزرسانی مستقیم دیکشنری استفاده می‌کنند)." +#: ../../library/functions.rst:2130 +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)." +msgstr "" +"اشیایی مانند ماژول‌ها و نمونه‌ها دارای ویژگی :attr:`~object.__dict__` قابل‌به‌روزرسانی هستند؛ با این حال، برخی اشیای " +"دیگر ممکن است محدودیت‌هایی برای نوشتن در ویژگی :attr:`!__dict__` خود داشته باشند (برای مثال، کلاس‌ها " +"از :class:`types.MappingProxyType` برای جلوگیری از به‌روزرسانی مستقیم دیکشنری استفاده می‌کنند)." +#: ../../library/functions.rst:2135 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "در صورت نداشتن آرگومان، :func:`vars` همانند :func:`locals` عمل می‌کند." -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)." -msgstr "اگر شی‌ءای مشخص شود اما دارای ویژگی :attr:`~object.__dict__` نباشد (برای مثال، اگر کلاس آن ویژگی :attr:`~object.__slots__` را تعریف کرده باشد)، استثنای :exc:`TypeError` پرتاب می‌شود." +#: ../../library/functions.rst:2137 +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)." +msgstr "" +"اگر شی‌ءای مشخص شود اما دارای ویژگی :attr:`~object.__dict__` نباشد (برای مثال، اگر کلاس آن " +"ویژگی :attr:`~object.__slots__` را تعریف کرده باشد)، استثنای :exc:`TypeError` پرتاب می‌شود." -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:2143 +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:2149 msgid "Iterate over several iterables in parallel, producing tuples with an item from each one." -msgstr "روی چندین تکرارپذیر به‌طور هم‌زمان پیمایش می‌کند و تاپل‌هایی تولید می‌کند که هر یک شامل یک عنصر از هر تکرارپذیر هستند." +msgstr "" +"روی چندین تکرارپذیر به‌طور هم‌زمان پیمایش می‌کند و تاپل‌هایی تولید می‌کند که هر یک شامل یک عنصر از هر تکرارپذیر هستند." +#: ../../library/functions.rst:2152 msgid "Example::" msgstr "مثال::" +#: ../../library/functions.rst:2154 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -1682,21 +3407,49 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -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." -msgstr "به‌طور دقیق‌تر، :func:`zip` یک تکرارگر از تاپل‌ها برمی‌گرداند که در آن، تاپل *i*\\ ام شامل عنصر *i*\\ ام از هر یک از تکرارپذیرهای آرگومان‌ها است." +#: ../../library/functions.rst:2161 +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." +msgstr "" +"به‌طور دقیق‌تر، :func:`zip` یک تکرارگر از تاپل‌ها برمی‌گرداند که در آن، تاپل *i*\\ ام شامل عنصر *i*\\ ام از هر یک از " +"تکرارپذیرهای آرگومان‌ها است." -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 `_." -msgstr "راه دیگری برای درک :func:`zip` این است که سطرها را به ستون‌ها و ستون‌ها را به سطرها تبدیل می‌کند. این کار مشابه `ترانهادهٔ یک ماتریس `_ است." +#: ../../library/functions.rst:2164 +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 `_." +msgstr "" +"راه دیگری برای درک :func:`zip` این است که سطرها را به ستون‌ها و ستون‌ها را به سطرها تبدیل می‌کند. این کار مشابه " +"`ترانهادهٔ یک ماتریس `_ است." -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`." -msgstr ":func:`zip` تنبل است؛ عناصر تا زمانی که روی تکرارپذیر پیمایش انجام نشود، پردازش نمی‌شوند؛ برای مثال، با یک حلقهٔ :keyword:`!for` یا با قرار دادن آن در :class:`list`." +#: ../../library/functions.rst:2168 +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`." +msgstr "" +":func:`zip` تنبل است؛ عناصر تا زمانی که روی تکرارپذیر پیمایش انجام نشود، پردازش نمی‌شوند؛ برای مثال، با یک " +"حلقهٔ :keyword:`!for` یا با قرار دادن آن در :class:`list`." -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:" -msgstr "یکی از نکاتی که باید در نظر داشت این است که تکرارپذیرهای ارسال‌شده به :func:`zip` ممکن است طول‌های متفاوتی داشته باشند؛ گاهی این موضوع عمدی است و گاهی به دلیل وجود یک باگ در کدی است که این تکرارپذیرها را آماده کرده است. پایتون سه روش مختلف برای برخورد با این مسئله ارائه می‌دهد:" +#: ../../library/functions.rst:2172 +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:" +msgstr "" +"یکی از نکاتی که باید در نظر داشت این است که تکرارپذیرهای ارسال‌شده به :func:`zip` ممکن است طول‌های متفاوتی داشته " +"باشند؛ گاهی این موضوع عمدی است و گاهی به دلیل وجود یک باگ در کدی است که این تکرارپذیرها را آماده کرده است. پایتون سه " +"روش مختلف برای برخورد با این مسئله ارائه می‌دهد:" -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::" -msgstr "به‌طور پیش‌فرض، :func:`zip` زمانی متوقف می‌شود که کوتاه‌ترین تکرارپذیر به پایان برسد. در این حالت، عناصر باقی‌مانده در تکرارپذیرهای بلندتر نادیده گرفته می‌شوند و طول نتیجه برابر با طول کوتاه‌ترین تکرارپذیر خواهد بود::" +#: ../../library/functions.rst:2177 +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::" +msgstr "" +"به‌طور پیش‌فرض، :func:`zip` زمانی متوقف می‌شود که کوتاه‌ترین تکرارپذیر به پایان برسد. در این حالت، عناصر باقی‌مانده در " +"تکرارپذیرهای بلندتر نادیده گرفته می‌شوند و طول نتیجه برابر با طول کوتاه‌ترین تکرارپذیر خواهد بود::" +#: ../../library/functions.rst:2181 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -1704,9 +3457,15 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -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`::" -msgstr "از :func:`zip` اغلب در مواردی استفاده می‌شود که فرض بر این است تکرارپذیرها طول یکسانی دارند. در چنین مواردی، توصیه می‌شود از گزینهٔ ``strict=True`` استفاده کنید. خروجی آن با :func:`zip` معمولی یکسان است::" +#: ../../library/functions.rst:2184 +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`::" +msgstr "" +"از :func:`zip` اغلب در مواردی استفاده می‌شود که فرض بر این است تکرارپذیرها طول یکسانی دارند. در چنین مواردی، توصیه " +"می‌شود از گزینهٔ ``strict=True`` استفاده کنید. خروجی آن با :func:`zip` معمولی یکسان است::" +#: ../../library/functions.rst:2188 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -1714,27 +3473,55 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" +#: ../../library/functions.rst:2191 msgid "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable is exhausted before the others:" msgstr "برخلاف رفتار پیش‌فرض، اگر یکی از تکرارپذیرها پیش از بقیه به پایان برسد، استثنای :exc:`ValueError` پرتاب می‌کند:" -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." -msgstr "بدون آرگومان ``strict=True``، هر اشکالی که باعث شود تکرارشونده‌ها طول‌های متفاوتی داشته باشند، بی‌صدا نادیده گرفته می‌شود و ممکن است در بخش دیگری از برنامه به‌صورت یک باگ دشوار برای یافتن ظاهر شود." +#: ../../library/functions.rst:2209 +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." +msgstr "" +"بدون آرگومان ``strict=True``، هر اشکالی که باعث شود تکرارشونده‌ها طول‌های متفاوتی داشته باشند، بی‌صدا نادیده گرفته " +"می‌شود و ممکن است در بخش دیگری از برنامه به‌صورت یک باگ دشوار برای یافتن ظاهر شود." -msgid "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:2213 +msgid "" +"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` انجام می‌شود." -msgid "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:2217 +msgid "" +"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:2220 msgid "Tips and tricks:" msgstr "نکته‌ها و ترفندها:" -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." -msgstr "ترتیب ارزیابی تکرارپذیرها از چپ به راست تضمین شده است. این موضوع امکان استفاده از الگوی ``zip(*[iter(s)]*n, strict=True)`` را برای گروه‌بندی یک دنبالهٔ داده به گروه‌هایی با طول n فراهم می‌کند. در این روش، *همان* تکرارگر ``n`` بار تکرار می‌شود تا هر تاپل خروجی حاصل ``n`` فراخوانی از همان تکرارگر باشد. نتیجهٔ این کار تقسیم ورودی به قطعاتی با طول n است." +#: ../../library/functions.rst:2222 +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." +msgstr "" +"ترتیب ارزیابی تکرارپذیرها از چپ به راست تضمین شده است. این موضوع امکان استفاده از الگوی ``zip(*[iter(s)]*n, " +"strict=True)`` را برای گروه‌بندی یک دنبالهٔ داده به گروه‌هایی با طول n فراهم می‌کند. در این روش، *همان* تکرارگر ``n`` " +"بار تکرار می‌شود تا هر تاپل خروجی حاصل ``n`` فراخوانی از همان تکرارگر باشد. نتیجهٔ این کار تقسیم ورودی به قطعاتی با " +"طول n است." +#: ../../library/functions.rst:2228 msgid ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a list::" msgstr "می‌توان از :func:`zip` همراه با عملگر ``*`` برای بازکردن یک فهرست استفاده کرد::" +#: ../../library/functions.rst:2231 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -1752,42 +3539,93 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" +#: ../../library/functions.rst:2239 msgid "Added the ``strict`` argument." msgstr "آرگومان ``strict`` اضافه شد." -msgid "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:2251 +msgid "" +"This is an advanced function that is not needed in everyday Python programming, " +"unlike :func:`importlib.import_module`." +msgstr "" +"این تابع پیشرفته‌ای است که برخلاف :func:`importlib.import_module` در برنامه‌نویسی روزمرهٔ پایتون معمولاً به آن نیازی " +"نخواهید داشت." -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`." -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 "" +"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` توصیه نمی‌شود." -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." -msgstr "این تابع ماژول *name* را ایمپورت می‌کند و در صورت نیاز از *globals* و *locals* داده‌شده برای تعیین نحوهٔ تفسیر نام در زمینهٔ یک بسته استفاده می‌کند. آرگومان *fromlist* نام اشیا یا زیرماژول‌هایی را مشخص می‌کند که باید از ماژول مشخص‌شده توسط *name* وارد شوند. پیاده‌سازی استاندارد اصلاً از آرگومان *locals* استفاده نمی‌کند و از *globals* تنها برای تعیین زمینهٔ بسته در دستور :keyword:`import` بهره می‌برد." +#: ../../library/functions.rst:2263 +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." +msgstr "" +"این تابع ماژول *name* را ایمپورت می‌کند و در صورت نیاز از *globals* و *locals* داده‌شده برای تعیین نحوهٔ تفسیر نام در " +"زمینهٔ یک بسته استفاده می‌کند. آرگومان *fromlist* نام اشیا یا زیرماژول‌هایی را مشخص می‌کند که باید از ماژول مشخص‌شده توسط " +"*name* وارد شوند. پیاده‌سازی استاندارد اصلاً از آرگومان *locals* استفاده نمی‌کند و از *globals* تنها برای تعیین زمینهٔ " +"بسته در دستور :keyword:`import` بهره می‌برد." -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)." -msgstr "*level* مشخص می‌کند که از ایمپورت مطلق استفاده شود یا نسبی. مقدار ``0`` (که مقدار پیش‌فرض است) به این معناست که فقط ایمپورت مطلق انجام شود. مقادیر مثبت برای *level* تعداد پوشه‌های والد را مشخص می‌کنند که باید نسبت به پوشهٔ ماژولی که :func:`__import__` را فراخوانی کرده است جست‌وجو شوند (برای جزئیات، :pep:`328` را ببینید)." +#: ../../library/functions.rst:2270 +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)." +msgstr "" +"*level* مشخص می‌کند که از ایمپورت مطلق استفاده شود یا نسبی. مقدار ``0`` (که مقدار پیش‌فرض است) به این معناست که فقط " +"ایمپورت مطلق انجام شود. مقادیر مثبت برای *level* تعداد پوشه‌های والد را مشخص می‌کنند که باید نسبت به پوشهٔ ماژولی " +"که :func:`__import__` را فراخوانی کرده است جست‌وجو شوند (برای جزئیات، :pep:`328` را ببینید)." -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." -msgstr "وقتی متغیر *name* به شکل ``package.module`` باشد، به‌طور معمول بستهٔ سطح بالا (بخشی از نام تا اولین نقطه) بازگردانده می‌شود، نه ماژولی که *name* به آن اشاره می‌کند. با این حال، اگر آرگومان *fromlist* ناتهی باشد، ماژول مشخص‌شده توسط *name* بازگردانده می‌شود." +#: ../../library/functions.rst:2276 +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." +msgstr "" +"وقتی متغیر *name* به شکل ``package.module`` باشد، به‌طور معمول بستهٔ سطح بالا (بخشی از نام تا اولین نقطه) بازگردانده " +"می‌شود، نه ماژولی که *name* به آن اشاره می‌کند. با این حال، اگر آرگومان *fromlist* ناتهی باشد، ماژول مشخص‌شده توسط " +"*name* بازگردانده می‌شود." +#: ../../library/functions.rst:2281 msgid "For example, the statement ``import spam`` results in bytecode resembling the following code::" msgstr "برای مثال، دستور ``import spam`` به بایت‌کدی مشابه کد زیر تبدیل می‌شود::" +#: ../../library/functions.rst:2284 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" +#: ../../library/functions.rst:2286 msgid "The statement ``import spam.ham`` results in this call::" msgstr "دستور ``import spam.ham`` منجر به این فراخوانی می‌شود::" +#: ../../library/functions.rst:2288 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -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." -msgstr "توجه داشته باشید که :func:`__import__` در اینجا ماژول سطح بالا را برمی‌گرداند، زیرا این همان شی‌ءای است که توسط دستور :keyword:`import` به یک نام منتسب می‌شود." +#: ../../library/functions.rst:2290 +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." +msgstr "" +"توجه داشته باشید که :func:`__import__` در اینجا ماژول سطح بالا را برمی‌گرداند، زیرا این همان شی‌ءای است که توسط " +"دستور :keyword:`import` به یک نام منتسب می‌شود." +#: ../../library/functions.rst:2293 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:2296 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -1797,101 +3635,149 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -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." -msgstr "در اینجا، ماژول ``spam.ham`` از :func:`__import__` بازگردانده می‌شود. سپس، نام‌هایی که باید ایمپورت شوند از این شیء استخراج شده و به نام‌های متناظر خود اختصاص داده می‌شوند." +#: ../../library/functions.rst:2300 +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." +msgstr "" +"در اینجا، ماژول ``spam.ham`` از :func:`__import__` بازگردانده می‌شود. سپس، نام‌هایی که باید ایمپورت شوند از این شیء " +"استخراج شده و به نام‌های متناظر خود اختصاص داده می‌شوند." -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:2304 +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:2307 msgid "Negative values for *level* are no longer supported (which also changes the default value to 0)." msgstr "مقادیر منفی برای *level* دیگر پشتیبانی نمی‌شوند (در نتیجه، مقدار پیش‌فرض آن نیز به 0 تغییر کرده است)." -msgid "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:2311 +msgid "" +"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:2316 msgid "Footnotes" msgstr "پاورقی‌ها" -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." -msgstr "توجه داشته باشید که تجزیه‌کننده (parser) فقط قرارداد پایان خط به سبک یونیکس را می‌پذیرد. اگر کد را از یک پرونده می‌خوانید، مطمئن شوید که از حالت تبدیل نویسهٔ پایان خط برای تبدیل پایان خط‌های ویندوز یا مک استفاده می‌کنید." +#: ../../library/functions.rst:2317 +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." +msgstr "" +"توجه داشته باشید که تجزیه‌کننده (parser) فقط قرارداد پایان خط به سبک یونیکس را می‌پذیرد. اگر کد را از یک پرونده " +"می‌خوانید، مطمئن شوید که از حالت تبدیل نویسهٔ پایان خط برای تبدیل پایان خط‌های ویندوز یا مک استفاده می‌کنید." +#: ../../library/functions.rst:156 msgid "Boolean" msgstr "بولی" +#: ../../library/functions.rst:156 ../../library/functions.rst:2079 msgid "type" msgstr "نوع" +#: ../../library/functions.rst:659 msgid "built-in function" msgstr "تابع پیش ساخته" +#: ../../library/functions.rst:659 msgid "exec" msgstr "exec" +#: ../../library/functions.rst:758 msgid "NaN" msgstr "NaN" +#: ../../library/functions.rst:758 msgid "Infinity" msgstr "بی‌نهایت" +#: ../../library/functions.rst:828 msgid "__format__" msgstr "__format__" +#: ../../library/functions.rst:828 ../../library/functions.rst:1947 msgid "string" msgstr "رشته" +#: ../../library/functions.rst:828 msgid "format() (built-in function)" msgstr "format() (تابع پیش ساخته)" +#: ../../library/functions.rst:1342 msgid "file object" msgstr "شیء پرونده" +#: ../../library/functions.rst:1342 ../../library/functions.rst:1463 msgid "open() built-in function" msgstr "تابع داخلی open()" +#: ../../library/functions.rst:1370 msgid "file" msgstr "پرونده" +#: ../../library/functions.rst:1370 msgid "modes" msgstr "حالات" +#: ../../library/functions.rst:1463 msgid "universal newlines" msgstr "پایان‌خط‌های همگانی" +#: ../../library/functions.rst:1524 msgid "line-buffered I/O" msgstr "ورودی/خروجی با بافرگذاری خطی" +#: ../../library/functions.rst:1524 msgid "unbuffered I/O" msgstr "ورودی/خروجی بافرگذاری‌نشده" +#: ../../library/functions.rst:1524 msgid "buffer size, I/O" msgstr "اندازهٔ بافر، ورودی/خروجی" +#: ../../library/functions.rst:1524 msgid "I/O control" msgstr "کنترل ورودی/خروجی" +#: ../../library/functions.rst:1524 msgid "buffering" msgstr "بافرگذاری" +#: ../../library/functions.rst:1524 msgid "text mode" msgstr "حالت متن" +#: ../../library/functions.rst:1524 ../../library/functions.rst:2245 msgid "module" msgstr "ماژول" +#: ../../library/functions.rst:1524 msgid "sys" msgstr "sys" +#: ../../library/functions.rst:1947 msgid "str() (built-in function)" msgstr "str() (تابع داخلی)" +#: ../../library/functions.rst:2079 msgid "object" msgstr "شیء" +#: ../../library/functions.rst:2245 msgid "statement" msgstr "دستور" +#: ../../library/functions.rst:2245 msgid "import" msgstr "ایمپورت" +#: ../../library/functions.rst:2245 msgid "builtins" msgstr "پیش ساخته‌ها" diff --git a/library/functools.po b/library/functools.po index fa599fe56..6ace7f04d 100644 --- a/library/functools.po +++ b/library/functools.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,27 +23,46 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid ":mod:`!functools` --- Higher-order functions and operations on callable objects" +#: ../../library/functools.rst:2 +msgid "" +":mod:`!functools` --- Higher-order functions and operations on callable " +"objects" msgstr "" +#: ../../library/functools.rst:14 msgid "**Source code:** :source:`Lib/functools.py`" msgstr "" -msgid "The :mod:`!functools` module is for higher-order functions: functions that act on or return other functions. In general, any callable object can be treated as a function for the purposes of this module." +#: ../../library/functools.rst:23 +msgid "" +"The :mod:`!functools` module is for higher-order functions: functions that " +"act on or return other functions. In general, any callable object can be " +"treated as a function for the purposes of this module." msgstr "" +#: ../../library/functools.rst:27 msgid "The :mod:`!functools` module defines the following functions:" msgstr "" -msgid "Simple lightweight unbounded function cache. Sometimes called `\"memoize\" `_." +#: ../../library/functools.rst:31 +msgid "" +"Simple lightweight unbounded function cache. Sometimes called `\"memoize\" " +"`_." msgstr "" -msgid "Returns the same as ``lru_cache(maxsize=None)``, creating a thin wrapper around a dictionary lookup for the function arguments. Because it never needs to evict old values, this is smaller and faster than :func:`lru_cache` with a size limit." +#: ../../library/functools.rst:34 +msgid "" +"Returns the same as ``lru_cache(maxsize=None)``, creating a thin wrapper " +"around a dictionary lookup for the function arguments. Because it never " +"needs to evict old values, this is smaller and faster than :deco:`lru_cache` " +"with a size limit." msgstr "" +#: ../../library/functools.rst:39 ../../library/functools.rst:297 msgid "For example::" msgstr "" +#: ../../library/functools.rst:41 msgid "" "@cache\n" "def factorial(n):\n" @@ -57,18 +76,34 @@ msgid "" "479001600" msgstr "" -msgid "The cache is threadsafe so that the wrapped function can be used in multiple threads. This means that the underlying data structure will remain coherent during concurrent updates." +#: ../../library/functools.rst:52 ../../library/functools.rst:158 +msgid "" +"The cache is threadsafe so that the wrapped function can be used in multiple " +"threads. This means that the underlying data structure will remain coherent " +"during concurrent updates." msgstr "" -msgid "It is possible for the wrapped function to be called more than once if another thread makes an additional call before the initial call has been completed and cached." +#: ../../library/functools.rst:56 ../../library/functools.rst:162 +msgid "" +"It is possible for the wrapped function to be called more than once if " +"another thread makes an additional call before the initial call has been " +"completed and cached." msgstr "" -msgid "Transform a method of a class into a property whose value is computed once and then cached as a normal attribute for the life of the instance. Similar to :func:`property`, with the addition of caching. Useful for expensive computed properties of instances that are otherwise effectively immutable." +#: ../../library/functools.rst:65 +msgid "" +"Transform a method of a class into a property whose value is computed once " +"and then cached as a normal attribute for the life of the instance. Similar " +"to :deco:`property`, with the addition of caching. Useful for expensive " +"computed properties of instances that are otherwise effectively immutable." msgstr "" +#: ../../library/functools.rst:70 ../../library/functools.rst:142 +#: ../../library/functools.rst:438 msgid "Example::" msgstr "" +#: ../../library/functools.rst:72 msgid "" "class DataSet:\n" "\n" @@ -80,96 +115,224 @@ msgid "" " return statistics.stdev(self._data)" msgstr "" -msgid "The mechanics of :func:`cached_property` are somewhat different from :func:`property`. A regular property blocks attribute writes unless a setter is defined. In contrast, a *cached_property* allows writes." +#: ../../library/functools.rst:81 +msgid "" +"The mechanics of :deco:`cached_property` are somewhat different " +"from :deco:`property`. A regular property blocks attribute writes unless a " +"setter is defined. In contrast, a *cached_property* allows writes." msgstr "" -msgid "The *cached_property* decorator only runs on lookups and only when an attribute of the same name doesn't exist. When it does run, the *cached_property* writes to the attribute with the same name. Subsequent attribute reads and writes take precedence over the *cached_property* method and it works like a normal attribute." +#: ../../library/functools.rst:85 +msgid "" +"The *cached_property* decorator only runs on lookups and only when an " +"attribute of the same name doesn't exist. When it does run, the " +"*cached_property* writes to the attribute with the same name. Subsequent " +"attribute reads and writes take precedence over the *cached_property* method " +"and it works like a normal attribute." msgstr "" -msgid "The cached value can be cleared by deleting the attribute. This allows the *cached_property* method to run again." +#: ../../library/functools.rst:91 +msgid "" +"The cached value can be cleared by deleting the attribute. This allows the " +"*cached_property* method to run again." msgstr "" -msgid "The *cached_property* does not prevent a possible race condition in multi-threaded usage. The getter function could run more than once on the same instance, with the latest run setting the cached value. If the cached property is idempotent or otherwise not harmful to run more than once on an instance, this is fine. If synchronization is needed, implement the necessary locking inside the decorated getter function or around the cached property access." +#: ../../library/functools.rst:94 +msgid "" +"The *cached_property* does not prevent a possible race condition in multi-" +"threaded usage. The getter function could run more than once on the same " +"instance, with the latest run setting the cached value. If the cached " +"property is idempotent or otherwise not harmful to run more than once on an " +"instance, this is fine. If synchronization is needed, implement the " +"necessary locking inside the decorated getter function or around the cached " +"property access." msgstr "" -msgid "Note, this decorator interferes with the operation of :pep:`412` key-sharing dictionaries. This means that instance dictionaries can take more space than usual." +#: ../../library/functools.rst:102 +msgid "" +"Note, this decorator interferes with the operation of :pep:`412` key-sharing " +"dictionaries. This means that instance dictionaries can take more space " +"than usual." msgstr "" -msgid "Also, this decorator requires that the ``__dict__`` attribute on each instance be a mutable mapping. This means it will not work with some types, such as metaclasses (since the ``__dict__`` attributes on type instances are read-only proxies for the class namespace), and those that specify ``__slots__`` without including ``__dict__`` as one of the defined slots (as such classes don't provide a ``__dict__`` attribute at all)." +#: ../../library/functools.rst:106 +msgid "" +"Also, this decorator requires that the ``__dict__`` attribute on each " +"instance be a mutable mapping. This means it will not work with some types, " +"such as metaclasses (since the ``__dict__`` attributes on type instances are " +"read-only proxies for the class namespace), and those that specify " +"``__slots__`` without including ``__dict__`` as one of the defined slots (as " +"such classes don't provide a ``__dict__`` attribute at all)." msgstr "" -msgid "If a mutable mapping is not available or if space-efficient key sharing is desired, an effect similar to :func:`cached_property` can also be achieved by stacking :func:`property` on top of :func:`lru_cache`. See :ref:`faq-cache-method-calls` for more details on how this differs from :func:`cached_property`." +#: ../../library/functools.rst:113 +msgid "" +"If a mutable mapping is not available or if space-efficient key sharing is " +"desired, an effect similar to :deco:`cached_property` can also be achieved " +"by stacking :deco:`property` on top of :deco:`lru_cache`. See :ref:`faq-" +"cache-method-calls` for more details on how this differs " +"from :deco:`cached_property`." msgstr "" -msgid "Prior to Python 3.12, ``cached_property`` included an undocumented lock to ensure that in multi-threaded usage the getter function was guaranteed to run only once per instance. However, the lock was per-property, not per-instance, which could result in unacceptably high lock contention. In Python 3.12+ this locking is removed." +#: ../../library/functools.rst:120 +msgid "" +"Prior to Python 3.12, :deco:`!cached_property` included an undocumented lock " +"to ensure that in multi-threaded usage the getter function was guaranteed to " +"run only once per instance. However, the lock was per-property, not per-" +"instance, which could result in unacceptably high lock contention. In Python " +"3.12+ this locking is removed." msgstr "" -msgid "Transform an old-style comparison function to a :term:`key function`. Used with tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition tool for programs being converted from Python 2 which supported the use of comparison functions." +#: ../../library/functools.rst:130 +msgid "" +"Transform an old-style comparison function to a :term:`key function`. Used " +"with tools that accept key functions (such " +"as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). " +"This function is primarily used as a transition tool for programs being " +"converted from Python 2 which supported the use of comparison functions." msgstr "" -msgid "A comparison function is any callable that accepts two arguments, compares them, and returns a negative number for less-than, zero for equality, or a positive number for greater-than. A key function is a callable that accepts one argument and returns another value to be used as the sort key." +#: ../../library/functools.rst:137 +msgid "" +"A comparison function is any callable that accepts two arguments, compares " +"them, and returns a negative number for less-than, zero for equality, or a " +"positive number for greater-than. A key function is a callable that accepts " +"one argument and returns another value to be used as the sort key." msgstr "" -msgid "sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order" +#: ../../library/functools.rst:144 +msgid "" +"sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order" msgstr "" -msgid "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." +#: ../../library/functools.rst:146 +msgid "" +"For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -msgid "Decorator to wrap a function with a memoizing callable that saves up to the *maxsize* most recent calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments." +#: ../../library/functools.rst:154 +msgid "" +"Decorator to wrap a function with a memoizing callable that saves up to the " +"*maxsize* most recent calls. It can save time when an expensive or I/O " +"bound function is periodically called with the same arguments." msgstr "" -msgid "Since a dictionary is used to cache results, the positional and keyword arguments to the function must be :term:`hashable`." +#: ../../library/functools.rst:166 +msgid "" +"Since a dictionary is used to cache results, the positional and keyword " +"arguments to the function must be :term:`hashable`." msgstr "" -msgid "Distinct argument patterns may be considered to be distinct calls with separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` differ in their keyword argument order and may have two separate cache entries." +#: ../../library/functools.rst:169 +msgid "" +"Distinct argument patterns may be considered to be distinct calls with " +"separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` " +"differ in their keyword argument order and may have two separate cache " +"entries." msgstr "" -msgid "If *user_function* is specified, it must be a callable. This allows the *lru_cache* decorator to be applied directly to a user function, leaving the *maxsize* at its default value of 128::" +#: ../../library/functools.rst:174 +msgid "" +"If *user_function* is specified, it must be a callable. This allows the " +"*lru_cache* decorator to be applied directly to a user function, leaving the " +"*maxsize* at its default value of 128::" msgstr "" +#: ../../library/functools.rst:178 msgid "" "@lru_cache\n" "def count_vowels(sentence):\n" " return sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')" msgstr "" -msgid "If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can grow without bound." +#: ../../library/functools.rst:182 +msgid "" +"If *maxsize* is set to ``None``, the LRU feature is disabled and the cache " +"can grow without bound." msgstr "" -msgid "If *typed* is set to true, function arguments of different types will be cached separately. If *typed* is false, the implementation will usually regard them as equivalent calls and only cache a single result. (Some types such as *str* and *int* may be cached separately even when *typed* is false.)" +#: ../../library/functools.rst:185 +msgid "" +"If *typed* is set to true, function arguments of different types will be " +"cached separately. If *typed* is false, the implementation will usually " +"regard them as equivalent calls and only cache a single result. (Some types " +"such as *str* and *int* may be cached separately even when *typed* is false.)" msgstr "" -msgid "Note, type specificity applies only to the function's immediate arguments rather than their contents. The scalar arguments, ``Decimal(42)`` and ``Fraction(42)`` are treated as distinct calls with distinct results. In contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', Fraction(42))`` are treated as equivalent." +#: ../../library/functools.rst:191 +msgid "" +"Note, type specificity applies only to the function's immediate arguments " +"rather than their contents. The scalar arguments, ``Decimal(42)`` and " +"``Fraction(42)`` are treated as distinct calls with distinct results. In " +"contrast, the tuple arguments ``('answer', Decimal(42))`` and ``('answer', " +"Fraction(42))`` are treated as equivalent." msgstr "" -msgid "The wrapped function is instrumented with a :func:`!cache_parameters` function that returns a new :class:`dict` showing the values for *maxsize* and *typed*. This is for information purposes only. Mutating the values has no effect." +#: ../../library/functools.rst:197 +msgid "" +"The wrapped function is instrumented with a :func:`!cache_parameters` " +"function that returns a new :class:`dict` showing the values for *maxsize* " +"and *typed*. This is for information purposes only. Mutating the values " +"has no effect." msgstr "" -msgid "To help measure the effectiveness of the cache and tune the *maxsize* parameter, the wrapped function is instrumented with a :func:`!cache_info` function that returns a :term:`named tuple` showing *hits*, *misses*, *maxsize* and *currsize*." +#: ../../library/functools.rst:205 +msgid "" +"To help measure the effectiveness of the cache and tune the *maxsize* " +"parameter, the wrapped function is instrumented with a :func:`!cache_info` " +"function that returns a :term:`named tuple` showing *hits*, *misses*, " +"*maxsize* and *currsize*." msgstr "" -msgid "The decorator also provides a :func:`!cache_clear` function for clearing or invalidating the cache." +#: ../../library/functools.rst:213 +msgid "" +"The decorator also provides a :func:`!cache_clear` function for clearing or " +"invalidating the cache." msgstr "" -msgid "The original underlying function is accessible through the :attr:`__wrapped__` attribute. This is useful for introspection, for bypassing the cache, or for rewrapping the function with a different cache." +#: ../../library/functools.rst:216 +msgid "" +"The original underlying function is accessible through " +"the :attr:`__wrapped__` attribute. This is useful for introspection, for " +"bypassing the cache, or for rewrapping the function with a different cache." msgstr "" -msgid "The cache keeps references to the arguments and return values until they age out of the cache or until the cache is cleared." +#: ../../library/functools.rst:220 +msgid "" +"The cache keeps references to the arguments and return values until they age " +"out of the cache or until the cache is cleared." msgstr "" -msgid "If a method is cached, the ``self`` instance argument is included in the cache. See :ref:`faq-cache-method-calls`" +#: ../../library/functools.rst:223 +msgid "" +"If a method is cached, the ``self`` instance argument is included in the " +"cache. See :ref:`faq-cache-method-calls`" msgstr "" -msgid "An `LRU (least recently used) cache `_ works best when the most recent calls are the best predictors of upcoming calls (for example, the most popular articles on a news server tend to change each day). The cache's size limit assures that the cache does not grow without bound on long-running processes such as web servers." +#: ../../library/functools.rst:226 +msgid "" +"An `LRU (least recently used) cache `_ works best when the " +"most recent calls are the best predictors of upcoming calls (for example, " +"the most popular articles on a news server tend to change each day). The " +"cache's size limit assures that the cache does not grow without bound on " +"long-running processes such as web servers." msgstr "" -msgid "In general, the LRU cache should only be used when you want to reuse previously computed values. Accordingly, it doesn't make sense to cache functions with side-effects, functions that need to create distinct mutable objects on each call (such as generators and async functions), or impure functions such as time() or random()." +#: ../../library/functools.rst:233 +msgid "" +"In general, the LRU cache should only be used when you want to reuse " +"previously computed values. Accordingly, it doesn't make sense to cache " +"functions with side-effects, functions that need to create distinct mutable " +"objects on each call (such as generators and async functions), or impure " +"functions such as time() or random()." msgstr "" +#: ../../library/functools.rst:239 msgid "Example of an LRU cache for static web content::" msgstr "" +#: ../../library/functools.rst:241 msgid "" "@lru_cache(maxsize=32)\n" "def get_pep(num):\n" @@ -189,9 +352,15 @@ msgid "" "CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)" msgstr "" -msgid "Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic programming `_ technique::" +#: ../../library/functools.rst:258 +msgid "" +"Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a " +"`dynamic programming `_ " +"technique::" msgstr "" +#: ../../library/functools.rst:264 msgid "" "@lru_cache(maxsize=None)\n" "def fib(n):\n" @@ -206,21 +375,34 @@ msgid "" "CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)" msgstr "" +#: ../../library/functools.rst:278 msgid "Added the *typed* option." msgstr "" +#: ../../library/functools.rst:281 msgid "Added the *user_function* option." msgstr "" +#: ../../library/functools.rst:284 msgid "Added the function :func:`!cache_parameters`" msgstr "" -msgid "Given a class defining one or more rich comparison ordering methods, this class decorator supplies the rest. This simplifies the effort involved in specifying all of the possible rich comparison operations:" +#: ../../library/functools.rst:289 +msgid "" +"Given a class defining one or more rich comparison ordering methods, this " +"class decorator supplies the rest. This simplifies the effort involved in " +"specifying all of the possible rich comparison operations:" msgstr "" -msgid "The class must define one of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, the class should supply an :meth:`~object.__eq__` method." +#: ../../library/functools.rst:293 +msgid "" +"The class must define one " +"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"or :meth:`~object.__ge__`. In addition, the class should supply " +"an :meth:`~object.__eq__` method." msgstr "" +#: ../../library/functools.rst:299 msgid "" "@total_ordering\n" "class Student:\n" @@ -239,21 +421,45 @@ msgid "" " (other.lastname.lower(), other.firstname.lower()))" msgstr "" -msgid "While this decorator makes it easy to create well behaved totally ordered types, it *does* come at the cost of slower execution and more complex stack traces for the derived comparison methods. If performance benchmarking indicates this is a bottleneck for a given application, implementing all six rich comparison methods instead is likely to provide an easy speed boost." +#: ../../library/functools.rst:317 +msgid "" +"While this decorator makes it easy to create well behaved totally ordered " +"types, it *does* come at the cost of slower execution and more complex stack " +"traces for the derived comparison methods. If performance benchmarking " +"indicates this is a bottleneck for a given application, implementing all six " +"rich comparison methods instead is likely to provide an easy speed boost." msgstr "" -msgid "This decorator makes no attempt to override methods that have been declared in the class *or its superclasses*. Meaning that if a superclass defines a comparison operator, *total_ordering* will not implement it again, even if the original method is abstract." +#: ../../library/functools.rst:326 +msgid "" +"This decorator makes no attempt to override methods that have been declared " +"in the class *or its superclasses*. Meaning that if a superclass defines a " +"comparison operator, *total_ordering* will not implement it again, even if " +"the original method is abstract." msgstr "" -msgid "Returning ``NotImplemented`` from the underlying comparison function for unrecognised types is now supported." +#: ../../library/functools.rst:333 +msgid "" +"Returning ``NotImplemented`` from the underlying comparison function for " +"unrecognised types is now supported." msgstr "" -msgid "A singleton object used as a sentinel to reserve a place for positional arguments when calling :func:`partial` and :func:`partialmethod`." +#: ../../library/functools.rst:339 +msgid "" +"A singleton object used as a sentinel to reserve a place for positional " +"arguments when calling :func:`partial` and :func:`partialmethod`." msgstr "" -msgid "Return a new :ref:`partial object` which when called will behave like *func* called with the positional arguments *args* and keyword arguments *keywords*. If more arguments are supplied to the call, they are appended to *args*. If additional keyword arguments are supplied, they extend and override *keywords*. Roughly equivalent to::" +#: ../../library/functools.rst:347 +msgid "" +"Return a new :ref:`partial object` which when called will " +"behave like *func* called with the positional arguments *args* and keyword " +"arguments *keywords*. If more arguments are supplied to the call, they are " +"appended to *args*. If additional keyword arguments are supplied, they " +"extend and override *keywords*. Roughly equivalent to::" msgstr "" +#: ../../library/functools.rst:354 msgid "" "def partial(func, /, *args, **keywords):\n" " def newfunc(*more_args, **more_keywords):\n" @@ -264,9 +470,16 @@ msgid "" " return newfunc" msgstr "" -msgid "The :func:`!partial` function is used for partial function application which \"freezes\" some portion of a function's arguments and/or keywords resulting in a new object with a simplified signature. For example, :func:`partial` can be used to create a callable that behaves like the :func:`int` function where the *base* argument defaults to ``2``:" +#: ../../library/functools.rst:362 +msgid "" +"The :func:`!partial` function is used for partial function application which " +"\"freezes\" some portion of a function's arguments and/or keywords resulting " +"in a new object with a simplified signature. For example, :func:`partial` " +"can be used to create a callable that behaves like the :func:`int` function " +"where the *base* argument defaults to ``2``:" msgstr "" +#: ../../library/functools.rst:368 msgid "" ">>> basetwo = partial(int, base=2)\n" ">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n" @@ -274,24 +487,45 @@ msgid "" "18" msgstr "" -msgid "If :data:`Placeholder` sentinels are present in *args*, they will be filled first when :func:`!partial` is called. This makes it possible to pre-fill any positional argument with a call to :func:`!partial`; without :data:`!Placeholder`, only the chosen number of leading positional arguments can be pre-filled." +#: ../../library/functools.rst:375 +msgid "" +"If :data:`Placeholder` sentinels are present in *args*, they will be filled " +"first when :func:`!partial` is called. This makes it possible to pre-fill " +"any positional argument with a call to :func:`!partial`; without :data:`!" +"Placeholder`, only the chosen number of leading positional arguments can be " +"pre-filled." msgstr "" -msgid "If any :data:`!Placeholder` sentinels are present, all must be filled at call time:" +#: ../../library/functools.rst:380 +msgid "" +"If any :data:`!Placeholder` sentinels are present, all must be filled at " +"call time:" msgstr "" +#: ../../library/functools.rst:382 msgid "" ">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" ">>> say_to_world('Hello', 'dear')\n" "Hello dear world!" msgstr "" -msgid "Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only one positional argument is provided, but there are two placeholders that must be filled in." +#: ../../library/functools.rst:388 +msgid "" +"Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only " +"one positional argument is provided, but there are two placeholders that " +"must be filled in." msgstr "" -msgid "If :func:`!partial` is applied to an existing :func:`!partial` object, :data:`!Placeholder` sentinels of the input object are filled in with new positional arguments. A placeholder can be retained by inserting a new :data:`!Placeholder` sentinel to the place held by a previous :data:`!Placeholder`:" +#: ../../library/functools.rst:392 +msgid "" +"If :func:`!partial` is applied to an existing :ref:`partial object `, :data:`!Placeholder` sentinels of the input object are filled in " +"with new positional arguments. A placeholder can be retained by inserting a " +"new :data:`!Placeholder` sentinel to the place held by a previous :data:`!" +"Placeholder`:" msgstr "" +#: ../../library/functools.rst:398 msgid "" ">>> from functools import partial, Placeholder as _\n" ">>> remove = partial(str.replace, _, _, '')\n" @@ -306,24 +540,48 @@ msgid "" "'Hello, dear world!'" msgstr "" -msgid ":data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword argument." +#: ../../library/functools.rst:412 +msgid "" +":data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword " +"argument." msgstr "" +#: ../../library/functools.rst:414 msgid "Added support for :data:`Placeholder` in positional arguments." msgstr "" -msgid "Return a new :class:`partialmethod` descriptor which behaves like :class:`partial` except that it is designed to be used as a method definition rather than being directly callable." +#: ../../library/functools.rst:419 +msgid "" +"Return a new :class:`partialmethod` descriptor which behaves " +"like :class:`partial` except that it is designed to be used as a method " +"definition rather than being directly callable." msgstr "" -msgid "*func* must be a :term:`descriptor` or a callable (objects which are both, like normal functions, are handled as descriptors)." +#: ../../library/functools.rst:423 +msgid "" +"*func* must be a :term:`descriptor` or a callable (objects which are both, " +"like normal functions, are handled as descriptors)." msgstr "" -msgid "When *func* is a descriptor (such as a normal Python function, :func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or another instance of :class:`partialmethod`), calls to ``__get__`` are delegated to the underlying descriptor, and an appropriate :ref:`partial object` returned as the result." +#: ../../library/functools.rst:426 +msgid "" +"When *func* is a descriptor (such as a normal Python " +"function, :func:`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` " +"or another instance of :class:`partialmethod`), calls to ``__get__`` are " +"delegated to the underlying descriptor, and an appropriate :ref:`partial " +"object` returned as the result." msgstr "" -msgid "When *func* is a non-descriptor callable, an appropriate bound method is created dynamically. This behaves like a normal Python function when used as a method: the *self* argument will be inserted as the first positional argument, even before the *args* and *keywords* supplied to the :class:`partialmethod` constructor." +#: ../../library/functools.rst:432 +msgid "" +"When *func* is a non-descriptor callable, an appropriate bound method is " +"created dynamically. This behaves like a normal Python function when used as " +"a method: the *self* argument will be inserted as the first positional " +"argument, even before the *args* and *keywords* supplied to " +"the :class:`partialmethod` constructor." msgstr "" +#: ../../library/functools.rst:440 msgid "" ">>> class Cell:\n" "... def __init__(self):\n" @@ -344,12 +602,24 @@ msgid "" "True" msgstr "" -msgid "Apply *function* of two arguments cumulatively to the items of *iterable*, from left to right, so as to reduce the iterable to a single value. For example, ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates ``((((1+2)+3)+4)+5)``. The left argument, *x*, is the accumulated value and the right argument, *y*, is the update value from the *iterable*. If the optional *initial* is present, it is placed before the items of the iterable in the calculation, and serves as a default when the iterable is empty. If *initial* is not given and *iterable* contains only one item, the first item is returned." -msgstr "" - +#: ../../library/functools.rst:463 +msgid "" +"Apply *function* of two arguments cumulatively to the items of *iterable*, " +"from left to right, so as to reduce the iterable to a single value. For " +"example, ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates " +"``((((1+2)+3)+4)+5)``. The left argument, *x*, is the accumulated value and " +"the right argument, *y*, is the update value from the *iterable*. If the " +"optional *initial* is present, it is placed before the items of the iterable " +"in the calculation, and serves as a default when the iterable is empty. If " +"*initial* is not given and *iterable* contains only one item, the first item " +"is returned." +msgstr "" + +#: ../../library/functools.rst:472 msgid "Roughly equivalent to::" msgstr "" +#: ../../library/functools.rst:474 msgid "" "initial_missing = object()\n" "\n" @@ -364,18 +634,30 @@ msgid "" " return value" msgstr "" -msgid "See :func:`itertools.accumulate` for an iterator that yields all intermediate values." +#: ../../library/functools.rst:486 +msgid "" +"See :func:`itertools.accumulate` for an iterator that yields all " +"intermediate values." msgstr "" +#: ../../library/functools.rst:489 msgid "*initial* is now supported as a keyword argument." msgstr "" -msgid "Transform a function into a :term:`single-dispatch ` :term:`generic function`." +#: ../../library/functools.rst:494 +msgid "" +"Transform a function into a :term:`single-dispatch ` :term:`generic function`." msgstr "" -msgid "To define a generic function, decorate it with the ``@singledispatch`` decorator. When defining a function using ``@singledispatch``, note that the dispatch happens on the type of the first argument::" +#: ../../library/functools.rst:497 +msgid "" +"To define a generic function, decorate it with the ``@singledispatch`` " +"decorator. When defining a function using ``@singledispatch``, note that the " +"dispatch happens on the type of the first argument::" msgstr "" +#: ../../library/functools.rst:501 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -385,9 +667,15 @@ msgid "" "... print(arg)" msgstr "" -msgid "To add overloaded implementations to the function, use the :func:`!register` attribute of the generic function, which can be used as a decorator. For functions annotated with types, the decorator will infer the type of the first argument automatically::" +#: ../../library/functools.rst:511 +msgid "" +"To add overloaded implementations to the function, use the :func:`!register` " +"attribute of the generic function, which can be used as a decorator. For " +"functions annotated with types, the decorator will infer the type of the " +"first argument automatically::" msgstr "" +#: ../../library/functools.rst:516 msgid "" ">>> @fun.register\n" "... def _(arg: int, verbose=False):\n" @@ -403,9 +691,11 @@ msgid "" "... print(i, elem)" msgstr "" +#: ../../library/functools.rst:529 msgid ":class:`typing.Union` can also be used::" msgstr "" +#: ../../library/functools.rst:531 msgid "" ">>> @fun.register\n" "... def _(arg: int | float, verbose=False):\n" @@ -423,9 +713,13 @@ msgid "" "..." msgstr "" -msgid "For code which doesn't use type annotations, the appropriate type argument can be passed explicitly to the decorator itself::" +#: ../../library/functools.rst:546 +msgid "" +"For code which doesn't use type annotations, the appropriate type argument " +"can be passed explicitly to the decorator itself::" msgstr "" +#: ../../library/functools.rst:549 msgid "" ">>> @fun.register(complex)\n" "... def _(arg, verbose=False):\n" @@ -435,9 +729,15 @@ msgid "" "..." msgstr "" -msgid "For code that dispatches on a collections type (e.g., ``list``), but wants to typehint the items of the collection (e.g., ``list[int]``), the dispatch type should be passed explicitly to the decorator itself with the typehint going into the function definition::" +#: ../../library/functools.rst:556 +msgid "" +"For code that dispatches on a collections type (e.g., ``list``), but wants " +"to typehint the items of the collection (e.g., ``list[int]``), the dispatch " +"type should be passed explicitly to the decorator itself with the typehint " +"going into the function definition::" msgstr "" +#: ../../library/functools.rst:561 msgid "" ">>> @fun.register(list)\n" "... def _(arg: list[int], verbose=False):\n" @@ -447,12 +747,22 @@ msgid "" "... print(i, elem)" msgstr "" -msgid "At runtime the function will dispatch on an instance of a list regardless of the type contained within the list i.e. ``[1,2,3]`` will be dispatched the same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this example is for static type checkers only and has no runtime impact." +#: ../../library/functools.rst:570 +msgid "" +"At runtime the function will dispatch on an instance of a list regardless of " +"the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " +"same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this " +"example is for static type checkers only and has no runtime impact." msgstr "" -msgid "To enable registering :term:`lambdas` and pre-existing functions, the :func:`~singledispatch.register` attribute can also be used in a functional form::" +#: ../../library/functools.rst:576 +msgid "" +"To enable registering :term:`lambdas` and pre-existing functions, " +"the :func:`~singledispatch.register` attribute can also be used in a " +"functional form::" msgstr "" +#: ../../library/functools.rst:579 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" @@ -460,9 +770,14 @@ msgid "" ">>> fun.register(type(None), nothing)" msgstr "" -msgid "The :func:`~singledispatch.register` attribute returns the undecorated function. This enables decorator stacking, :mod:`pickling`, and the creation of unit tests for each variant independently::" +#: ../../library/functools.rst:584 +msgid "" +"The :func:`~singledispatch.register` attribute returns the undecorated " +"function. This enables decorator stacking, :mod:`pickling`, and the " +"creation of unit tests for each variant independently::" msgstr "" +#: ../../library/functools.rst:588 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -475,9 +790,13 @@ msgid "" "False" msgstr "" -msgid "When called, the generic function dispatches on the type of the first argument::" +#: ../../library/functools.rst:598 +msgid "" +"When called, the generic function dispatches on the type of the first " +"argument::" msgstr "" +#: ../../library/functools.rst:601 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -497,12 +816,23 @@ msgid "" "0.615" msgstr "" -msgid "Where there is no registered implementation for a specific type, its method resolution order is used to find a more generic implementation. The original function decorated with ``@singledispatch`` is registered for the base :class:`object` type, which means it is used if no better implementation is found." +#: ../../library/functools.rst:618 +msgid "" +"Where there is no registered implementation for a specific type, its method " +"resolution order is used to find a more generic implementation. The original " +"function decorated with ``@singledispatch`` is registered for the " +"base :class:`object` type, which means it is used if no better " +"implementation is found." msgstr "" -msgid "If an implementation is registered to an :term:`abstract base class`, virtual subclasses of the base class will be dispatched to that implementation::" +#: ../../library/functools.rst:624 +msgid "" +"If an implementation is registered to an :term:`abstract base class`, " +"virtual subclasses of the base class will be dispatched to that " +"implementation::" msgstr "" +#: ../../library/functools.rst:628 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -516,9 +846,13 @@ msgid "" "a => b" msgstr "" -msgid "To check which implementation the generic function will choose for a given type, use the ``dispatch()`` attribute::" +#: ../../library/functools.rst:639 +msgid "" +"To check which implementation the generic function will choose for a given " +"type, use the ``dispatch()`` attribute::" msgstr "" +#: ../../library/functools.rst:642 msgid "" ">>> fun.dispatch(float)\n" "\n" @@ -526,9 +860,13 @@ msgid "" "" msgstr "" -msgid "To access all registered implementations, use the read-only ``registry`` attribute::" +#: ../../library/functools.rst:647 +msgid "" +"To access all registered implementations, use the read-only ``registry`` " +"attribute::" msgstr "" +#: ../../library/functools.rst:650 msgid "" ">>> fun.registry.keys()\n" "dict_keys([, , ,\n" @@ -540,18 +878,33 @@ msgid "" "" msgstr "" -msgid "The :func:`~singledispatch.register` attribute now supports using type annotations." +#: ../../library/functools.rst:661 +msgid "" +"The :func:`~singledispatch.register` attribute now supports using type " +"annotations." msgstr "" -msgid "The :func:`~singledispatch.register` attribute now supports :class:`typing.Union` as a type annotation." +#: ../../library/functools.rst:664 +msgid "" +"The :func:`~singledispatch.register` attribute now " +"supports :class:`typing.Union` as a type annotation." msgstr "" -msgid "Transform a method into a :term:`single-dispatch ` :term:`generic function`." +#: ../../library/functools.rst:671 +msgid "" +"Transform a method into a :term:`single-dispatch ` :term:`generic function`." msgstr "" -msgid "To define a generic method, decorate it with the ``@singledispatchmethod`` decorator. When defining a method using ``@singledispatchmethod``, note that the dispatch happens on the type of the first non-*self* or non-*cls* argument::" +#: ../../library/functools.rst:674 +msgid "" +"To define a generic method, decorate it with the ``@singledispatchmethod`` " +"decorator. When defining a method using ``@singledispatchmethod``, note that " +"the dispatch happens on the type of the first non-*self* or non-*cls* " +"argument::" msgstr "" +#: ../../library/functools.rst:679 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -567,9 +920,16 @@ msgid "" " return not arg" msgstr "" -msgid "``@singledispatchmethod`` supports nesting with other decorators such as :deco:`classmethod`. Note that to allow for ``dispatcher.register``, ``singledispatchmethod`` must be the *outer most* decorator. Here is the ``Negator`` class with the ``neg`` methods bound to the class, rather than an instance of the class::" +#: ../../library/functools.rst:692 +msgid "" +"``@singledispatchmethod`` supports nesting with other decorators such " +"as :deco:`classmethod`. Note that to allow for ``dispatcher.register``, " +"``singledispatchmethod`` must be the *outer most* decorator. Here is the " +"``Negator`` class with the ``neg`` methods bound to the class, rather than " +"an instance of the class::" msgstr "" +#: ../../library/functools.rst:698 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -588,33 +948,81 @@ msgid "" " return not arg" msgstr "" -msgid "The same pattern can be used for other similar decorators: :deco:`staticmethod`, :deco:`~abc.abstractmethod`, and others." -msgstr "" - -msgid "Update a *wrapper* function to look like the *wrapped* function. The optional arguments are tuples to specify which attributes of the original function are assigned directly to the matching attributes on the wrapper function and which attributes of the wrapper function are updated with the corresponding attributes from the original function. The default values for these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` (which assigns to the wrapper function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function.__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's :attr:`~function.__dict__`, i.e. the instance dictionary)." +#: ../../library/functools.rst:714 +msgid "" +"The same pattern can be used for other similar " +"decorators: :deco:`staticmethod`, :deco:`~abc.abstractmethod`, and others." msgstr "" -msgid "To allow access to the original function for introspection and other purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), this function automatically adds a ``__wrapped__`` attribute to the wrapper that refers to the function being wrapped." +#: ../../library/functools.rst:722 +msgid "" +"Update a *wrapper* function to look like the *wrapped* function. The " +"optional arguments are tuples to specify which attributes of the original " +"function are assigned directly to the matching attributes on the wrapper " +"function and which attributes of the wrapper function are updated with the " +"corresponding attributes from the original function. The default values for " +"these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " +"(which assigns to the wrapper " +"function's :attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__annotations__`, :attr:`~function.__type_params__`, " +"and :attr:`~function.__doc__`, the documentation string) and " +"``WRAPPER_UPDATES`` (which updates the wrapper " +"function's :attr:`~function.__dict__`, i.e. the instance dictionary)." +msgstr "" + +#: ../../library/functools.rst:734 +msgid "" +"To allow access to the original function for introspection and other " +"purposes (e.g. bypassing a caching decorator such as :deco:`lru_cache`), " +"this function automatically adds a ``__wrapped__`` attribute to the wrapper " +"that refers to the function being wrapped." msgstr "" -msgid "The main intended use for this function is in :term:`decorator` functions which wrap the decorated function and return the wrapper. If the wrapper function is not updated, the metadata of the returned function will reflect the wrapper definition rather than the original function definition, which is typically less than helpful." +#: ../../library/functools.rst:739 +msgid "" +"The main intended use for this function is in :term:`decorator` functions " +"which wrap the decorated function and return the wrapper. If the wrapper " +"function is not updated, the metadata of the returned function will reflect " +"the wrapper definition rather than the original function definition, which " +"is typically less than helpful." msgstr "" -msgid ":func:`update_wrapper` may be used with callables other than functions. Any attributes named in *assigned* or *updated* that are missing from the object being wrapped are ignored (i.e. this function will not attempt to set them on the wrapper function). :exc:`AttributeError` is still raised if the wrapper function itself is missing any attributes named in *updated*." +#: ../../library/functools.rst:745 +msgid "" +":func:`update_wrapper` may be used with callables other than functions. Any " +"attributes named in *assigned* or *updated* that are missing from the object " +"being wrapped are ignored (i.e. this function will not attempt to set them " +"on the wrapper function). :exc:`AttributeError` is still raised if the " +"wrapper function itself is missing any attributes named in *updated*." msgstr "" -msgid "The ``__wrapped__`` attribute is now automatically added. The :attr:`~function.__annotations__` attribute is now copied by default. Missing attributes no longer trigger an :exc:`AttributeError`." +#: ../../library/functools.rst:751 +msgid "" +"The ``__wrapped__`` attribute is now automatically added. " +"The :attr:`~function.__annotations__` attribute is now copied by default. " +"Missing attributes no longer trigger an :exc:`AttributeError`." msgstr "" -msgid "The ``__wrapped__`` attribute now always refers to the wrapped function, even if that function defined a ``__wrapped__`` attribute. (see :issue:`17482`)" +#: ../../library/functools.rst:756 +msgid "" +"The ``__wrapped__`` attribute now always refers to the wrapped function, " +"even if that function defined a ``__wrapped__`` attribute. " +"(see :issue:`17482`)" msgstr "" -msgid "The :attr:`~function.__type_params__` attribute is now copied by default." +#: ../../library/functools.rst:761 +msgid "" +"The :attr:`~function.__type_params__` attribute is now copied by default." msgstr "" -msgid "This is a convenience function for invoking :func:`update_wrapper` as a function decorator when defining a wrapper function. It is equivalent to ``partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)``. For example::" +#: ../../library/functools.rst:767 +msgid "" +"This is a convenience function for invoking :func:`update_wrapper` as a " +"function decorator when defining a wrapper function. It is equivalent to " +"``partial(update_wrapper, wrapped=wrapped, assigned=assigned, " +"updated=updated)``. For example::" msgstr "" +#: ../../library/functools.rst:772 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -638,23 +1046,46 @@ msgid "" "'Docstring'" msgstr "" -msgid "Without the use of this decorator factory, the name of the example function would have been ``'wrapper'``, and the docstring of the original :func:`!example` would have been lost." +#: ../../library/functools.rst:793 +msgid "" +"Without the use of this decorator factory, the name of the example function " +"would have been ``'wrapper'``, and the docstring of the original :func:`!" +"example` would have been lost." msgstr "" +#: ../../library/functools.rst:801 msgid ":class:`partial` Objects" msgstr "" -msgid ":class:`partial` objects are callable objects created by :func:`partial`. They have three read-only attributes:" +#: ../../library/functools.rst:803 +msgid "" +":class:`partial` objects are callable objects created by :func:`partial`. " +"They have three read-only attributes:" msgstr "" -msgid "A callable object or function. Calls to the :class:`partial` object will be forwarded to :attr:`func` with new arguments and keywords." +#: ../../library/functools.rst:809 +msgid "" +"A callable object or function. Calls to the :class:`partial` object will be " +"forwarded to :attr:`func` with new arguments and keywords." msgstr "" -msgid "The leftmost positional arguments that will be prepended to the positional arguments provided to a :class:`partial` object call." +#: ../../library/functools.rst:815 +msgid "" +"The leftmost positional arguments that will be prepended to the positional " +"arguments provided to a :class:`partial` object call." msgstr "" -msgid "The keyword arguments that will be supplied when the :class:`partial` object is called." +#: ../../library/functools.rst:821 +msgid "" +"The keyword arguments that will be supplied when the :class:`partial` object " +"is called." msgstr "" -msgid ":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have attributes. There are some important differences. For instance, the :attr:`~definition.__name__` and :attr:`~definition.__doc__` attributes are not created automatically." +#: ../../library/functools.rst:824 +msgid "" +":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " +"attributes. There are some important differences. For instance, " +"the :attr:`~definition.__name__` and :attr:`~definition.__doc__` attributes " +"are not created automatically." msgstr "" diff --git a/library/gc.po b/library/gc.po index 688293fff..5c0c6829c 100644 --- a/library/gc.po +++ b/library/gc.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,117 +21,250 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/gc.rst:2 msgid ":mod:`!gc` --- Garbage Collector interface" msgstr "" -msgid "This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. It also provides access to unreachable objects that the collector found but cannot free. Since the collector supplements the reference counting already used in Python, you can disable the collector if you are sure your program does not create reference cycles. Automatic collection can be disabled by calling ``gc.disable()``. To debug a leaking program call ``gc.set_debug(gc.DEBUG_LEAK)``. Notice that this includes ``gc.DEBUG_SAVEALL``, causing garbage-collected objects to be saved in gc.garbage for inspection." -msgstr "" - +#: ../../library/gc.rst:12 +msgid "" +"This module provides an interface to the optional garbage collector. It " +"provides the ability to disable the collector, tune the collection " +"frequency, and set debugging options. It also provides access to " +"unreachable objects that the collector found but cannot free. Since the " +"collector supplements the reference counting already used in Python, you can " +"disable the collector if you are sure your program does not create reference " +"cycles. Automatic collection can be disabled by calling ``gc.disable()``. " +"To debug a leaking program call ``gc.set_debug(gc.DEBUG_LEAK)``. Notice that " +"this includes ``gc.DEBUG_SAVEALL``, causing garbage-collected objects to be " +"saved in gc.garbage for inspection." +msgstr "" + +#: ../../library/gc.rst:23 msgid "The :mod:`!gc` module provides the following functions:" msgstr "" +#: ../../library/gc.rst:28 msgid "Enable automatic garbage collection." msgstr "" +#: ../../library/gc.rst:33 msgid "Disable automatic garbage collection." msgstr "" +#: ../../library/gc.rst:38 msgid "Return ``True`` if automatic collection is enabled." msgstr "" -msgid "With no arguments, run a full collection. The optional argument *generation* may be an integer specifying which generation to collect (from 0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. The sum of collected objects and uncollectable objects is returned." +#: ../../library/gc.rst:43 +msgid "" +"With no arguments, run a full collection. The optional argument " +"*generation* may be an integer specifying which generation to collect (from " +"0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. " +"The sum of collected objects and uncollectable objects is returned." msgstr "" -msgid "The free lists maintained for a number of built-in types are cleared whenever a full collection or collection of the highest generation (2) is run. Not all items in some free lists may be freed due to the particular implementation, in particular :class:`float`." +#: ../../library/gc.rst:48 +msgid "" +"The free lists maintained for a number of built-in types are cleared " +"whenever a full collection or collection of the highest generation (2) is " +"run. Not all items in some free lists may be freed due to the particular " +"implementation, in particular :class:`float`." msgstr "" -msgid "The effect of calling ``gc.collect()`` while the interpreter is already performing a collection is undefined." +#: ../../library/gc.rst:53 +msgid "" +"The effect of calling ``gc.collect()`` while the interpreter is already " +"performing a collection is undefined." msgstr "" +#: ../../library/gc.rst:56 msgid "``generation=1`` performs an increment of collection." msgstr "" +#: ../../library/gc.rst:59 msgid "``generation=1`` performs collection of the middle generation." msgstr "" -msgid "Set the garbage collection debugging flags. Debugging information will be written to ``sys.stderr``. See below for a list of debugging flags which can be combined using bit operations to control debugging." +#: ../../library/gc.rst:65 +msgid "" +"Set the garbage collection debugging flags. Debugging information will be " +"written to ``sys.stderr``. See below for a list of debugging flags which " +"can be combined using bit operations to control debugging." msgstr "" +#: ../../library/gc.rst:72 msgid "Return the debugging flags currently set." msgstr "" -msgid "Returns a list of all objects tracked by the collector, excluding the list returned. If *generation* is not ``None``, return only the objects tracked by the collector that are in that generation." +#: ../../library/gc.rst:77 +msgid "" +"Returns a list of all objects tracked by the collector, excluding the list " +"returned. If *generation* is not ``None``, return only the objects tracked " +"by the collector that are in that generation." msgstr "" +#: ../../library/gc.rst:81 msgid "New *generation* parameter." msgstr "" +#: ../../library/gc.rst:84 msgid "Generation 1 is removed" msgstr "" +#: ../../library/gc.rst:87 msgid "Generation 1 is reintroduced to maintain GC behavior from 3.13." msgstr "" -msgid "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument ``generation``." +#: ../../library/gc.rst:90 +msgid "" +"Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " +"``generation``." msgstr "" -msgid "Return a list of three per-generation dictionaries containing collection statistics since interpreter start. The number of keys may change in the future, but currently each dictionary will contain the following items:" +#: ../../library/gc.rst:94 +msgid "" +"Return a list of three per-generation dictionaries containing collection " +"statistics since interpreter start. The number of keys may change in the " +"future, but currently each dictionary will contain the following items:" msgstr "" +#: ../../library/gc.rst:99 msgid "``collections`` is the number of times this generation was collected;" msgstr "" -msgid "``collected`` is the total number of objects collected inside this generation;" -msgstr "" - -msgid "``uncollectable`` is the total number of objects which were found to be uncollectable (and were therefore moved to the :data:`garbage` list) inside this generation." +#: ../../library/gc.rst:101 +msgid "" +"``collected`` is the total number of objects collected inside this " +"generation;" msgstr "" -msgid "Set the garbage collection thresholds (the collection frequency). Setting *threshold0* to zero disables collection." +#: ../../library/gc.rst:104 +msgid "" +"``uncollectable`` is the total number of objects which were found to be " +"uncollectable (and were therefore moved to the :data:`garbage` list) inside " +"this generation." msgstr "" -msgid "The GC classifies objects into three generations depending on how many collection sweeps they have survived. New objects are placed in the youngest generation (generation ``0``). If an object survives a collection it is moved into the next older generation. Since generation ``2`` is the oldest generation, objects in that generation remain there after a collection. In order to decide when to run, the collector keeps track of the number object allocations and deallocations since the last collection. When the number of allocations minus the number of deallocations exceeds *threshold0*, collection starts. Initially only generation ``0`` is examined. If generation ``0`` has been examined more than *threshold1* times since generation ``1`` has been examined, then generation ``1`` is examined as well. With the third generation, things are a bit more complicated, see `Collecting the oldest generation `_ for more information." +#: ../../library/gc.rst:113 +msgid "" +"Set the garbage collection thresholds (the collection frequency). Setting " +"*threshold0* to zero disables collection." msgstr "" -msgid "In the free-threaded build, the increase in process memory usage is also checked before running the collector. If the memory usage has not increased by 10% since the last collection and the net number of object allocations has not exceeded 40 times *threshold0*, the collection is not run." +#: ../../library/gc.rst:116 +msgid "" +"The GC classifies objects into three generations depending on how many " +"collection sweeps they have survived. New objects are placed in the " +"youngest generation (generation ``0``). If an object survives a collection " +"it is moved into the next older generation. Since generation ``2`` is the " +"oldest generation, objects in that generation remain there after a " +"collection. In order to decide when to run, the collector keeps track of " +"the number object allocations and deallocations since the last collection. " +"When the number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. Initially only generation ``0`` is " +"examined. If generation ``0`` has been examined more than *threshold1* " +"times since generation ``1`` has been examined, then generation ``1`` is " +"examined as well. With the third generation, things are a bit more " +"complicated, see `Collecting the oldest generation `_ for more " +"information." +msgstr "" + +#: ../../library/gc.rst:130 +msgid "" +"In the free-threaded build, the increase in process memory usage is also " +"checked before running the collector. If the memory usage has not increased " +"by 10% since the last collection and the net number of object allocations " +"has not exceeded 40 times *threshold0*, the collection is not run." msgstr "" -msgid "See `Garbage collector design `_ for more information." +#: ../../library/gc.rst:135 +msgid "" +"See `Garbage collector design `_ for more information." msgstr "" +#: ../../library/gc.rst:137 msgid "*threshold2* is ignored" msgstr "" +#: ../../library/gc.rst:140 msgid "*threshold2* is restored to match Python 3.13 behavior." msgstr "" -msgid "Return the current collection counts as a tuple of ``(count0, count1, count2)``." -msgstr "" - -msgid "Return the current collection thresholds as a tuple of ``(threshold0, threshold1, threshold2)``." +#: ../../library/gc.rst:146 +msgid "" +"Return the current collection counts as a tuple of ``(count0, count1, " +"count2)``." msgstr "" -msgid "Return the list of objects that directly refer to any of objs. This function will only locate those containers which support garbage collection; extension types which do refer to other objects but do not support garbage collection will not be found." +#: ../../library/gc.rst:152 +msgid "" +"Return the current collection thresholds as a tuple of ``(threshold0, " +"threshold1, threshold2)``." msgstr "" -msgid "Note that objects which have already been dereferenced, but which live in cycles and have not yet been collected by the garbage collector can be listed among the resulting referrers. To get only currently live objects, call :func:`collect` before calling :func:`get_referrers`." +#: ../../library/gc.rst:158 +msgid "" +"Return the list of objects that directly refer to any of objs. This function " +"will only locate those containers which support garbage collection; " +"extension types which do refer to other objects but do not support garbage " +"collection will not be found." msgstr "" -msgid "Care must be taken when using objects returned by :func:`get_referrers` because some of them could still be under construction and hence in a temporarily invalid state. Avoid using :func:`get_referrers` for any purpose other than debugging." +#: ../../library/gc.rst:163 +msgid "" +"Note that objects which have already been dereferenced, but which live in " +"cycles and have not yet been collected by the garbage collector can be " +"listed among the resulting referrers. To get only currently live objects, " +"call :func:`collect` before calling :func:`get_referrers`." msgstr "" -msgid "Raises an :ref:`auditing event ` ``gc.get_referrers`` with argument ``objs``." +#: ../../library/gc.rst:169 +msgid "" +"Care must be taken when using objects returned by :func:`get_referrers` " +"because some of them could still be under construction and hence in a " +"temporarily invalid state. Avoid using :func:`get_referrers` for any purpose " +"other than debugging." msgstr "" -msgid "Return a list of objects directly referred to by any of the arguments. The referents returned are those objects visited by the arguments' C-level :c:member:`~PyTypeObject.tp_traverse` methods (if any), and may not be all objects actually directly reachable. :c:member:`~PyTypeObject.tp_traverse` methods are supported only by objects that support garbage collection, and are only required to visit objects that may be involved in a cycle. So, for example, if an integer is directly reachable from an argument, that integer object may or may not appear in the result list." +#: ../../library/gc.rst:174 +msgid "" +"Raises an :ref:`auditing event ` ``gc.get_referrers`` with " +"argument ``objs``." msgstr "" -msgid "Raises an :ref:`auditing event ` ``gc.get_referents`` with argument ``objs``." +#: ../../library/gc.rst:179 +msgid "" +"Return a list of objects directly referred to by any of the arguments. The " +"referents returned are those objects visited by the arguments' C-" +"level :c:member:`~PyTypeObject.tp_traverse` methods (if any), and may not be " +"all objects actually directly " +"reachable. :c:member:`~PyTypeObject.tp_traverse` methods are supported only " +"by objects that support garbage collection, and are only required to visit " +"objects that may be involved in a cycle. So, for example, if an integer is " +"directly reachable from an argument, that integer object may or may not " +"appear in the result list." +msgstr "" + +#: ../../library/gc.rst:187 +msgid "" +"Raises an :ref:`auditing event ` ``gc.get_referents`` with " +"argument ``objs``." msgstr "" -msgid "Returns ``True`` if the object is currently tracked by the garbage collector, ``False`` otherwise. As a general rule, instances of atomic types aren't tracked and instances of non-atomic types (containers, user-defined objects...) are. However, some type-specific optimizations can be present in order to suppress the garbage collector footprint of simple instances (e.g. dicts containing only atomic keys and values)::" +#: ../../library/gc.rst:191 +msgid "" +"Returns ``True`` if the object is currently tracked by the garbage " +"collector, ``False`` otherwise. As a general rule, instances of atomic " +"types aren't tracked and instances of non-atomic types (containers, user-" +"defined objects...) are. However, some type-specific optimizations can be " +"present in order to suppress the garbage collector footprint of simple " +"instances (e.g. dicts containing only atomic keys and values)::" msgstr "" +#: ../../library/gc.rst:198 msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -145,9 +278,13 @@ msgid "" "True" msgstr "" -msgid "Returns ``True`` if the given object has been finalized by the garbage collector, ``False`` otherwise. ::" +#: ../../library/gc.rst:214 +msgid "" +"Returns ``True`` if the given object has been finalized by the garbage " +"collector, ``False`` otherwise. ::" msgstr "" +#: ../../library/gc.rst:217 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -163,83 +300,163 @@ msgid "" "True" msgstr "" -msgid "Freeze all the objects tracked by the garbage collector; move them to a permanent generation and ignore them in all the future collections." +#: ../../library/gc.rst:235 +msgid "" +"Freeze all the objects tracked by the garbage collector; move them to a " +"permanent generation and ignore them in all the future collections." msgstr "" -msgid "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-on-write in child processes will maximize memory sharing and reduce overall memory usage. This requires both avoiding creation of freed \"holes\" in memory pages in the parent process and ensuring that GC collections in child processes won't touch the ``gc_refs`` counter of long-lived objects originating in the parent process. To accomplish both, call ``gc.disable()`` early in the parent process, ``gc.freeze()`` right before ``fork()``, and ``gc.enable()`` early in child processes." +#: ../../library/gc.rst:238 +msgid "" +"If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" +"on-write in child processes will maximize memory sharing and reduce overall " +"memory usage. This requires both avoiding creation of freed \"holes\" in " +"memory pages in the parent process and ensuring that GC collections in child " +"processes won't touch the ``gc_refs`` counter of long-lived objects " +"originating in the parent process. To accomplish both, call ``gc.disable()`` " +"early in the parent process, ``gc.freeze()`` right before ``fork()``, and " +"``gc.enable()`` early in child processes." msgstr "" -msgid "Unfreeze the objects in the permanent generation, put them back into the oldest generation." +#: ../../library/gc.rst:252 +msgid "" +"Unfreeze the objects in the permanent generation, put them back into the " +"oldest generation." msgstr "" +#: ../../library/gc.rst:260 msgid "Return the number of objects in the permanent generation." msgstr "" -msgid "The following variables are provided for read-only access (you can mutate the values but should not rebind them):" +#: ../../library/gc.rst:265 +msgid "" +"The following variables are provided for read-only access (you can mutate " +"the values but should not rebind them):" msgstr "" -msgid "A list of objects which the collector found to be unreachable but could not be freed (uncollectable objects). Starting with Python 3.4, this list should be empty most of the time, except when using instances of C extension types with a non-``NULL`` ``tp_del`` slot." +#: ../../library/gc.rst:270 +msgid "" +"A list of objects which the collector found to be unreachable but could not " +"be freed (uncollectable objects). Starting with Python 3.4, this list " +"should be empty most of the time, except when using instances of C extension " +"types with a non-``NULL`` ``tp_del`` slot." msgstr "" -msgid "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added to this list rather than freed." +#: ../../library/gc.rst:275 +msgid "" +"If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " +"to this list rather than freed." msgstr "" -msgid "If this list is non-empty at :term:`interpreter shutdown`, a :exc:`ResourceWarning` is emitted, which is silent by default. If :const:`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable objects are printed." +#: ../../library/gc.rst:278 +msgid "" +"If this list is non-empty at :term:`interpreter shutdown`, " +"a :exc:`ResourceWarning` is emitted, which is silent by default. " +"If :const:`DEBUG_UNCOLLECTABLE` is set, in addition all uncollectable " +"objects are printed." msgstr "" -msgid "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't end up in :data:`gc.garbage` anymore." +#: ../../library/gc.rst:284 +msgid "" +"Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " +"end up in :data:`gc.garbage` anymore." msgstr "" -msgid "A list of callbacks that will be invoked by the garbage collector before and after collection. The callbacks will be called with two arguments, *phase* and *info*." +#: ../../library/gc.rst:290 +msgid "" +"A list of callbacks that will be invoked by the garbage collector before and " +"after collection. The callbacks will be called with two arguments, *phase* " +"and *info*." msgstr "" +#: ../../library/gc.rst:294 msgid "*phase* can be one of two values:" msgstr "" +#: ../../library/gc.rst:296 msgid "\"start\": The garbage collection is about to start." msgstr "" +#: ../../library/gc.rst:298 msgid "\"stop\": The garbage collection has finished." msgstr "" -msgid "*info* is a dict providing more information for the callback. The following keys are currently defined:" +#: ../../library/gc.rst:300 +msgid "" +"*info* is a dict providing more information for the callback. The following " +"keys are currently defined:" msgstr "" +#: ../../library/gc.rst:303 msgid "\"generation\": The oldest generation being collected." msgstr "" -msgid "\"collected\": When *phase* is \"stop\", the number of objects successfully collected." +#: ../../library/gc.rst:305 +msgid "" +"\"collected\": When *phase* is \"stop\", the number of objects successfully " +"collected." msgstr "" -msgid "\"uncollectable\": When *phase* is \"stop\", the number of objects that could not be collected and were put in :data:`garbage`." +#: ../../library/gc.rst:308 +msgid "" +"\"uncollectable\": When *phase* is \"stop\", the number of objects that " +"could not be collected and were put in :data:`garbage`." msgstr "" -msgid "Applications can add their own callbacks to this list. The primary use cases are:" +#: ../../library/gc.rst:311 +msgid "" +"Applications can add their own callbacks to this list. The primary use " +"cases are:" msgstr "" -msgid "Gathering statistics about garbage collection, such as how often various generations are collected, and how long the collection takes." +#: ../../library/gc.rst:314 +msgid "" +"Gathering statistics about garbage collection, such as how often various " +"generations are collected, and how long the collection takes." msgstr "" -msgid "Allowing applications to identify and clear their own uncollectable types when they appear in :data:`garbage`." +#: ../../library/gc.rst:318 +msgid "" +"Allowing applications to identify and clear their own uncollectable types " +"when they appear in :data:`garbage`." msgstr "" +#: ../../library/gc.rst:324 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "" -msgid "Print statistics during collection. This information can be useful when tuning the collection frequency." +#: ../../library/gc.rst:329 +msgid "" +"Print statistics during collection. This information can be useful when " +"tuning the collection frequency." msgstr "" +#: ../../library/gc.rst:335 msgid "Print information on collectable objects found." msgstr "" -msgid "Print information of uncollectable objects found (objects which are not reachable but cannot be freed by the collector). These objects will be added to the ``garbage`` list." +#: ../../library/gc.rst:340 +msgid "" +"Print information of uncollectable objects found (objects which are not " +"reachable but cannot be freed by the collector). These objects will be " +"added to the ``garbage`` list." msgstr "" -msgid "Also print the contents of the :data:`garbage` list at :term:`interpreter shutdown`, if it isn't empty." +#: ../../library/gc.rst:344 +msgid "" +"Also print the contents of the :data:`garbage` list at :term:`interpreter " +"shutdown`, if it isn't empty." msgstr "" -msgid "When set, all unreachable objects found will be appended to *garbage* rather than being freed. This can be useful for debugging a leaking program." +#: ../../library/gc.rst:350 +msgid "" +"When set, all unreachable objects found will be appended to *garbage* rather " +"than being freed. This can be useful for debugging a leaking program." msgstr "" -msgid "The debugging flags necessary for the collector to print information about a leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL``)." +#: ../../library/gc.rst:356 +msgid "" +"The debugging flags necessary for the collector to print information about a " +"leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " +"DEBUG_SAVEALL``)." msgstr "" diff --git a/library/getopt.po b/library/getopt.po index a2e44afab..9ca0a67c1 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,60 +21,150 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/getopt.rst:2 msgid ":mod:`!getopt` --- C-style parser for command line options" msgstr "" +#: ../../library/getopt.rst:8 msgid "**Source code:** :source:`Lib/getopt.py`" msgstr "" -msgid "This module is considered feature complete. A more declarative and extensible alternative to this API is provided in the :mod:`optparse` module. Further functional enhancements for command line parameter processing are provided either as third party modules on PyPI, or else as features in the :mod:`argparse` module." +#: ../../library/getopt.rst:12 +msgid "" +"This module is considered feature complete. A more declarative and " +"extensible alternative to this API is provided in the :mod:`optparse` " +"module. Further functional enhancements for command line parameter " +"processing are provided either as third party modules on PyPI, or else as " +"features in the :mod:`argparse` module." msgstr "" -msgid "This module helps scripts to parse the command line arguments in ``sys.argv``. It supports the same conventions as the Unix :c:func:`!getopt` function (including the special meanings of arguments of the form '``-``' and '``--``'). Long options similar to those supported by GNU software may be used as well via an optional third argument." +#: ../../library/getopt.rst:20 +msgid "" +"This module helps scripts to parse the command line arguments in " +"``sys.argv``. It supports the same conventions as the Unix :c:func:`!getopt` " +"function (including the special meanings of arguments of the form '``-``' " +"and '``--``'). Long options similar to those supported by GNU software may " +"be used as well via an optional third argument." msgstr "" -msgid "Users who are unfamiliar with the Unix :c:func:`!getopt` function should consider using the :mod:`argparse` module instead. Users who are familiar with the Unix :c:func:`!getopt` function, but would like to get equivalent behavior while writing less code and getting better help and error messages should consider using the :mod:`optparse` module. See :ref:`choosing-an-argument-parser` for additional details." +#: ../../library/getopt.rst:26 +msgid "" +"Users who are unfamiliar with the Unix :c:func:`!getopt` function should " +"consider using the :mod:`argparse` module instead. Users who are familiar " +"with the Unix :c:func:`!getopt` function, but would like to get equivalent " +"behavior while writing less code and getting better help and error messages " +"should consider using the :mod:`optparse` module. See :ref:`choosing-an-" +"argument-parser` for additional details." msgstr "" +#: ../../library/getopt.rst:33 msgid "This module provides two functions and an exception:" msgstr "" -msgid "Parses command line options and parameter list. *args* is the argument list to be parsed, without the leading reference to the running program. Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option letters that the script wants to recognize, with options that require an argument followed by a colon (``':'``) and options that accept an optional argument followed by two colons (``'::'``); i.e., the same format that Unix :c:func:`!getopt` uses." -msgstr "" - -msgid "Unlike GNU :c:func:`!getopt`, after a non-option argument, all further arguments are considered also non-options. This is similar to the way non-GNU Unix systems work." +#: ../../library/getopt.rst:39 +msgid "" +"Parses command line options and parameter list. *args* is the argument list " +"to be parsed, without the leading reference to the running program. " +"Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option " +"letters that the script wants to recognize, with options that require an " +"argument followed by a colon (``':'``) and options that accept an optional " +"argument followed by two colons (``'::'``); i.e., the same format that " +"Unix :c:func:`!getopt` uses." msgstr "" -msgid "*longopts*, if specified, must be a list of strings with the names of the long options which should be supported. The leading ``'--'`` characters should not be included in the option name. Long options which require an argument should be followed by an equal sign (``'='``). Long options which accept an optional argument should be followed by an equal sign and question mark (``'=?'``). To accept only long options, *shortopts* should be an empty string. Long options on the command line can be recognized so long as they provide a prefix of the option name that matches exactly one of the accepted options. For example, if *longopts* is ``['foo', 'frob']``, the option ``--fo`` will match as ``--foo``, but ``--f`` will not match uniquely, so :exc:`GetoptError` will be raised." +#: ../../library/getopt.rst:48 +msgid "" +"Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " +"arguments are considered also non-options. This is similar to the way non-" +"GNU Unix systems work." msgstr "" -msgid "The return value consists of two elements: the first is a list of ``(option, value)`` pairs; the second is the list of program arguments left after the option list was stripped (this is a trailing slice of *args*). Each option-and-value pair returned has the option as its first element, prefixed with a hyphen for short options (e.g., ``'-x'``) or two hyphens for long options (e.g., ``'--long-option'``), and the option argument as its second element, or an empty string if the option has no argument. The options occur in the list in the same order in which they were found, thus allowing multiple occurrences. Long and short options may be mixed." +#: ../../library/getopt.rst:52 +msgid "" +"*longopts*, if specified, must be a list of strings with the names of the " +"long options which should be supported. The leading ``'--'`` characters " +"should not be included in the option name. Long options which require an " +"argument should be followed by an equal sign (``'='``). Long options which " +"accept an optional argument should be followed by an equal sign and question " +"mark (``'=?'``). To accept only long options, *shortopts* should be an empty " +"string. Long options on the command line can be recognized so long as they " +"provide a prefix of the option name that matches exactly one of the accepted " +"options. For example, if *longopts* is ``['foo', 'frob']``, the option ``--" +"fo`` will match as ``--foo``, but ``--f`` will not match uniquely, " +"so :exc:`GetoptError` will be raised." +msgstr "" + +#: ../../library/getopt.rst:65 +msgid "" +"If *longopts* is a string it gets treated as a list of a single element." msgstr "" +#: ../../library/getopt.rst:67 +msgid "" +"The return value consists of two elements: the first is a list of ``(option, " +"value)`` pairs; the second is the list of program arguments left after the " +"option list was stripped (this is a trailing slice of *args*). Each option-" +"and-value pair returned has the option as its first element, prefixed with a " +"hyphen for short options (e.g., ``'-x'``) or two hyphens for long options " +"(e.g., ``'--long-option'``), and the option argument as its second element, " +"or an empty string if the option has no argument. The options occur in the " +"list in the same order in which they were found, thus allowing multiple " +"occurrences. Long and short options may be mixed." +msgstr "" + +#: ../../library/getopt.rst:77 msgid "Optional arguments are supported." msgstr "" -msgid "This function works like :func:`getopt`, except that GNU style scanning mode is used by default. This means that option and non-option arguments may be intermixed. The :func:`getopt` function stops processing options as soon as a non-option argument is encountered." +#: ../../library/getopt.rst:83 +msgid "" +"This function works like :func:`getopt`, except that GNU style scanning mode " +"is used by default. This means that option and non-option arguments may be " +"intermixed. The :func:`getopt` function stops processing options as soon as " +"a non-option argument is encountered." msgstr "" -msgid "If the first character of the option string is ``'+'``, or if the environment variable :envvar:`!POSIXLY_CORRECT` is set, then option processing stops as soon as a non-option argument is encountered." +#: ../../library/getopt.rst:88 +msgid "" +"If the first character of the option string is ``'+'``, or if the " +"environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " +"processing stops as soon as a non-option argument is encountered." msgstr "" -msgid "If the first character of the option string is ``'-'``, non-option arguments that are followed by options are added to the list of option-and-value pairs as a pair that has ``None`` as its first element and the list of non-option arguments as its second element. The second element of the :func:`!gnu_getopt` result is a list of program arguments after the last option." +#: ../../library/getopt.rst:92 +msgid "" +"If the first character of the option string is ``'-'``, non-option arguments " +"that are followed by options are added to the list of option-and-value pairs " +"as a pair that has ``None`` as its first element and the list of non-option " +"arguments as its second element. The second element of the :func:`!" +"gnu_getopt` result is a list of program arguments after the last option." msgstr "" -msgid "Support for returning intermixed options and non-option arguments in order." +#: ../../library/getopt.rst:99 +msgid "" +"Support for returning intermixed options and non-option arguments in order." msgstr "" -msgid "This is raised when an unrecognized option is found in the argument list or when an option requiring an argument is given none. The argument to the exception is a string indicating the cause of the error. For long options, an argument given to an option which does not require one will also cause this exception to be raised. The attributes :attr:`!msg` and :attr:`!opt` give the error message and related option; if there is no specific option to which the exception relates, :attr:`!opt` is an empty string." +#: ../../library/getopt.rst:105 +msgid "" +"This is raised when an unrecognized option is found in the argument list or " +"when an option requiring an argument is given none. The argument to the " +"exception is a string indicating the cause of the error. For long options, " +"an argument given to an option which does not require one will also cause " +"this exception to be raised. The attributes :attr:`!msg` and :attr:`!opt` " +"give the error message and related option; if there is no specific option to " +"which the exception relates, :attr:`!opt` is an empty string." msgstr "" +#: ../../library/getopt.rst:116 msgid "Alias for :exc:`GetoptError`; for backward compatibility." msgstr "" +#: ../../library/getopt.rst:118 msgid "An example using only Unix style options:" msgstr "" +#: ../../library/getopt.rst:120 msgid "" ">>> import getopt\n" ">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" @@ -87,25 +177,31 @@ msgid "" "['a1', 'a2']" msgstr "" +#: ../../library/getopt.rst:132 msgid "Using long option names is equally easy:" msgstr "" +#: ../../library/getopt.rst:134 msgid "" ">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" ">>> args = s.split()\n" ">>> args\n" -"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" ">>> optlist, args = getopt.getopt(args, 'x', [\n" "... 'condition=', 'output-file=', 'testing'])\n" ">>> optlist\n" -"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" ">>> args\n" "['a1', 'a2']" msgstr "" +#: ../../library/getopt.rst:147 msgid "Optional arguments should be specified explicitly:" msgstr "" +#: ../../library/getopt.rst:149 msgid "" ">>> s = '-Con -C --color=off --color a1 a2'\n" ">>> args = s.split()\n" @@ -118,9 +214,11 @@ msgid "" "['a1', 'a2']" msgstr "" +#: ../../library/getopt.rst:161 msgid "The order of options and non-option arguments can be preserved:" msgstr "" +#: ../../library/getopt.rst:163 msgid "" ">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" ">>> args = s.split()\n" @@ -133,18 +231,22 @@ msgid "" "['a6']" msgstr "" +#: ../../library/getopt.rst:175 msgid "In a script, typical usage is something like this:" msgstr "" +#: ../../library/getopt.rst:177 msgid "" "import getopt, sys\n" "\n" "def main():\n" " try:\n" -" opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", \"output=\"])\n" +" opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", " +"\"output=\"])\n" " except getopt.GetoptError as err:\n" " # print help information and exit:\n" -" print(err) # will print something like \"option -a not recognized\"\n" +" print(err) # will print something like \"option -a not " +"recognized\"\n" " usage()\n" " sys.exit(2)\n" " output = None\n" @@ -165,9 +267,14 @@ msgid "" " main()" msgstr "" -msgid "Note that an equivalent command line interface could be produced with less code and more informative help and error messages by using the :mod:`optparse` module:" +#: ../../library/getopt.rst:206 +msgid "" +"Note that an equivalent command line interface could be produced with less " +"code and more informative help and error messages by using " +"the :mod:`optparse` module:" msgstr "" +#: ../../library/getopt.rst:209 msgid "" "import optparse\n" "\n" @@ -179,9 +286,13 @@ msgid "" " process(args, output=opts.output, verbose=opts.verbose)" msgstr "" -msgid "A roughly equivalent command line interface for this case can also be produced by using the :mod:`argparse` module:" +#: ../../library/getopt.rst:220 +msgid "" +"A roughly equivalent command line interface for this case can also be " +"produced by using the :mod:`argparse` module:" msgstr "" +#: ../../library/getopt.rst:223 msgid "" "import argparse\n" "\n" @@ -194,17 +305,25 @@ msgid "" " process(args.rest, output=args.output, verbose=args.verbose)" msgstr "" -msgid "See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` version of this code differs in behaviour from the ``optparse`` (and ``getopt``) version." +#: ../../library/getopt.rst:235 +msgid "" +"See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` " +"version of this code differs in behaviour from the ``optparse`` (and " +"``getopt``) version." msgstr "" +#: ../../library/getopt.rst:241 msgid "Module :mod:`optparse`" msgstr "" +#: ../../library/getopt.rst:242 msgid "Declarative command line option parsing." msgstr "" +#: ../../library/getopt.rst:244 msgid "Module :mod:`argparse`" msgstr "" +#: ../../library/getopt.rst:245 msgid "More opinionated command line option and argument parsing library." msgstr "" diff --git a/library/getpass.po b/library/getpass.po index 35c99c4f0..abf7c8740 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" "Language: fa\n" @@ -21,50 +21,95 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/getpass.rst:2 msgid ":mod:`!getpass` --- Portable password input" msgstr "" +#: ../../library/getpass.rst:11 msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "" +#: ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" -msgid "This module does not work or is not available on WebAssembly. See :ref:`wasm-availability` for more information." +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" +#: ../../library/getpass.rst:17 msgid "The :mod:`!getpass` module provides two functions:" msgstr "" -msgid "Prompt the user for a password without echoing. The user is prompted using the string *prompt*, which defaults to ``'Password: '``. On Unix, the prompt is written to the file-like object *stream* using the replace error handler if needed. *stream* defaults to the controlling terminal (:file:`/dev/tty`) or if that is unavailable to ``sys.stderr`` (this argument is ignored on Windows)." +#: ../../library/getpass.rst:21 +msgid "" +"Prompt the user for a password without echoing. The user is prompted using " +"the string *prompt*, which defaults to ``'Password: '``. On Unix, the " +"prompt is written to the file-like object *stream* using the replace error " +"handler if needed. *stream* defaults to the controlling terminal (:file:`/" +"dev/tty`) or if that is unavailable to ``sys.stderr`` (this argument is " +"ignored on Windows)." msgstr "" -msgid "The *echo_char* argument controls how user input is displayed while typing. If *echo_char* is ``None`` (default), input remains hidden. Otherwise, *echo_char* must be a single printable ASCII character and each typed character is replaced by it. For example, ``echo_char='*'`` will display asterisks instead of the actual input." +#: ../../library/getpass.rst:28 +msgid "" +"The *echo_char* argument controls how user input is displayed while typing. " +"If *echo_char* is ``None`` (default), input remains hidden. Otherwise, " +"*echo_char* must be a single printable ASCII character and each typed " +"character is replaced by it. For example, ``echo_char='*'`` will display " +"asterisks instead of the actual input." msgstr "" -msgid "If echo free input is unavailable getpass() falls back to printing a warning message to *stream* and reading from ``sys.stdin`` and issuing a :exc:`GetPassWarning`." +#: ../../library/getpass.rst:34 +msgid "" +"If echo free input is unavailable getpass() falls back to printing a warning " +"message to *stream* and reading from ``sys.stdin`` and issuing " +"a :exc:`GetPassWarning`." msgstr "" -msgid "If you call getpass from within IDLE, the input may be done in the terminal you launched IDLE from rather than the idle window itself." +#: ../../library/getpass.rst:39 +msgid "" +"If you call getpass from within IDLE, the input may be done in the terminal " +"you launched IDLE from rather than the idle window itself." msgstr "" -msgid "On Unix systems, when *echo_char* is set, the terminal will be configured to operate in :manpage:`noncanonical mode `. In particular, this means that line editing shortcuts such as :kbd:`Ctrl+U` will not work and may insert unexpected characters into the input." +#: ../../library/getpass.rst:43 +msgid "" +"On Unix systems, when *echo_char* is set, the terminal will be configured to " +"operate in :manpage:`noncanonical mode " +"`. In particular, this means " +"that line editing shortcuts such as :kbd:`Ctrl+U` will not work and may " +"insert unexpected characters into the input." msgstr "" +#: ../../library/getpass.rst:50 msgid "Added the *echo_char* parameter for keyboard feedback." msgstr "" +#: ../../library/getpass.rst:55 msgid "A :exc:`UserWarning` subclass issued when password input may be echoed." msgstr "" +#: ../../library/getpass.rst:60 msgid "Return the \"login name\" of the user." msgstr "" -msgid "This function checks the environment variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the value of the first one which is set to a non-empty string. If none are set, the login name from the password database is returned on systems which support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." +#: ../../library/getpass.rst:62 +msgid "" +"This function checks the environment " +"variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " +"and :envvar:`USERNAME`, in order, and returns the value of the first one " +"which is set to a non-empty string. If none are set, the login name from " +"the password database is returned on systems which support the :mod:`pwd` " +"module, otherwise, an :exc:`OSError` is raised." msgstr "" +#: ../../library/getpass.rst:69 msgid "In general, this function should be preferred over :func:`os.getlogin`." msgstr "" +#: ../../library/getpass.rst:71 msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." msgstr "" diff --git a/library/gettext.po b/library/gettext.po index 08935f313..814922834 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,57 +23,122 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/gettext.rst:2 msgid ":mod:`!gettext` --- Multilingual internationalization services" msgstr "" +#: ../../library/gettext.rst:10 msgid "**Source code:** :source:`Lib/gettext.py`" msgstr "" -msgid "The :mod:`!gettext` module provides internationalization (I18N) and localization (L10N) services for your Python modules and applications. It supports both the GNU :program:`gettext` message catalog API and a higher level, class-based API that may be more appropriate for Python files. The interface described below allows you to write your module and application messages in one natural language, and provide a catalog of translated messages for running under different natural languages." +#: ../../library/gettext.rst:14 +msgid "" +"The :mod:`!gettext` module provides internationalization (I18N) and " +"localization (L10N) services for your Python modules and applications. It " +"supports both the GNU :program:`gettext` message catalog API and a higher " +"level, class-based API that may be more appropriate for Python files. The " +"interface described below allows you to write your module and application " +"messages in one natural language, and provide a catalog of translated " +"messages for running under different natural languages." msgstr "" -msgid "Some hints on localizing your Python modules and applications are also given." +#: ../../library/gettext.rst:22 +msgid "" +"Some hints on localizing your Python modules and applications are also given." msgstr "" +#: ../../library/gettext.rst:26 msgid "GNU :program:`gettext` API" msgstr "" -msgid "The :mod:`!gettext` module defines the following API, which is very similar to the GNU :program:`gettext` API. If you use this API you will affect the translation of your entire application globally. Often this is what you want if your application is monolingual, with the choice of language dependent on the locale of your user. If you are localizing a Python module, or if your application needs to switch languages on the fly, you probably want to use the class-based API instead." +#: ../../library/gettext.rst:28 +msgid "" +"The :mod:`!gettext` module defines the following API, which is very similar " +"to the GNU :program:`gettext` API. If you use this API you will affect the " +"translation of your entire application globally. Often this is what you " +"want if your application is monolingual, with the choice of language " +"dependent on the locale of your user. If you are localizing a Python " +"module, or if your application needs to switch languages on the fly, you " +"probably want to use the class-based API instead." msgstr "" -msgid "Bind the *domain* to the locale directory *localedir*. More concretely, :mod:`!gettext` will look for binary :file:`.mo` files for the given domain using the path (on Unix): :file:`{localedir}/{language}/LC_MESSAGES/{domain}.mo`, where *language* is searched for in the environment variables :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, and :envvar:`LANG` respectively." +#: ../../library/gettext.rst:39 +msgid "" +"Bind the *domain* to the locale directory *localedir*. More " +"concretely, :mod:`!gettext` will look for binary :file:`.mo` files for the " +"given domain using the path (on Unix): :file:`{localedir}/{language}/" +"LC_MESSAGES/{domain}.mo`, where *language* is searched for in the " +"environment " +"variables :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, " +"and :envvar:`LANG` respectively." msgstr "" -msgid "If *localedir* is omitted or ``None``, then the current binding for *domain* is returned. [#]_" +#: ../../library/gettext.rst:45 +msgid "" +"If *localedir* is omitted or ``None``, then the current binding for *domain* " +"is returned. [#]_" msgstr "" -msgid "Change or query the current global domain. If *domain* is ``None``, then the current global domain is returned, otherwise the global domain is set to *domain*, which is returned." +#: ../../library/gettext.rst:51 +msgid "" +"Change or query the current global domain. If *domain* is ``None``, then " +"the current global domain is returned, otherwise the global domain is set to " +"*domain*, which is returned." msgstr "" -msgid "Return the localized translation of *message*, based on the current global domain, language, and locale directory. This function is usually aliased as :func:`!_` in the local namespace (see examples below)." +#: ../../library/gettext.rst:59 +msgid "" +"Return the localized translation of *message*, based on the current global " +"domain, language, and locale directory. This function is usually aliased " +"as :func:`!_` in the local namespace (see examples below)." msgstr "" -msgid "Like :func:`.gettext`, but look the message up in the specified *domain*." +#: ../../library/gettext.rst:66 +msgid "" +"Like :func:`.gettext`, but look the message up in the specified *domain*." msgstr "" -msgid "Like :func:`.gettext`, but consider plural forms. If a translation is found, apply the plural formula to *n*, and return the resulting message (some languages have more than two plural forms). If no translation is found, return *singular* if *n* is 1; return *plural* otherwise." +#: ../../library/gettext.rst:71 +msgid "" +"Like :func:`.gettext`, but consider plural forms. If a translation is found, " +"apply the plural formula to *n*, and return the resulting message (some " +"languages have more than two plural forms). If no translation is found, " +"return *singular* if *n* is 1; return *plural* otherwise." msgstr "" -msgid "The Plural formula is taken from the catalog header. It is a C or Python expression that has a free variable *n*; the expression evaluates to the index of the plural in the catalog. See `the GNU gettext documentation `__ for the precise syntax to be used in :file:`.po` files and the formulas for a variety of languages." +#: ../../library/gettext.rst:76 +msgid "" +"The Plural formula is taken from the catalog header. It is a C or Python " +"expression that has a free variable *n*; the expression evaluates to the " +"index of the plural in the catalog. See `the GNU gettext documentation " +"`__ for the " +"precise syntax to be used in :file:`.po` files and the formulas for a " +"variety of languages." msgstr "" -msgid "Like :func:`ngettext`, but look the message up in the specified *domain*." +#: ../../library/gettext.rst:86 +msgid "" +"Like :func:`ngettext`, but look the message up in the specified *domain*." msgstr "" -msgid "Similar to the corresponding functions without the ``p`` in the prefix (that is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`), but the translation is restricted to the given message *context*." +#: ../../library/gettext.rst:94 +msgid "" +"Similar to the corresponding functions without the ``p`` in the prefix (that " +"is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`), " +"but the translation is restricted to the given message *context*." msgstr "" -msgid "Note that GNU :program:`gettext` also defines a :func:`!dcgettext` method, but this was deemed not useful and so it is currently unimplemented." +#: ../../library/gettext.rst:101 +msgid "" +"Note that GNU :program:`gettext` also defines a :func:`!dcgettext` method, " +"but this was deemed not useful and so it is currently unimplemented." msgstr "" +#: ../../library/gettext.rst:104 msgid "Here's an example of typical usage for this API::" msgstr "" +#: ../../library/gettext.rst:106 msgid "" "import gettext\n" "gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')\n" @@ -83,147 +148,317 @@ msgid "" "print(_('This is a translatable string.'))" msgstr "" +#: ../../library/gettext.rst:115 msgid "Class-based API" msgstr "" -msgid "The class-based API of the :mod:`!gettext` module gives you more flexibility and greater convenience than the GNU :program:`gettext` API. It is the recommended way of localizing your Python applications and modules. :mod:`!gettext` defines a :class:`GNUTranslations` class which implements the parsing of GNU :file:`.mo` format files, and has methods for returning strings. Instances of this class can also install themselves in the built-in namespace as the function :func:`!_`." +#: ../../library/gettext.rst:117 +msgid "" +"The class-based API of the :mod:`!gettext` module gives you more flexibility " +"and greater convenience than the GNU :program:`gettext` API. It is the " +"recommended way of localizing your Python applications and modules. :mod:`!" +"gettext` defines a :class:`GNUTranslations` class which implements the " +"parsing of GNU :file:`.mo` format files, and has methods for returning " +"strings. Instances of this class can also install themselves in the built-in " +"namespace as the function :func:`!_`." msgstr "" -msgid "This function implements the standard :file:`.mo` file search algorithm. It takes a *domain*, identical to what :func:`textdomain` takes. Optional *localedir* is as in :func:`bindtextdomain`. Optional *languages* is a list of strings, where each string is a language code." +#: ../../library/gettext.rst:127 +msgid "" +"This function implements the standard :file:`.mo` file search algorithm. It " +"takes a *domain*, identical to what :func:`textdomain` takes. Optional " +"*localedir* is as in :func:`bindtextdomain`. Optional *languages* is a list " +"of strings, where each string is a language code." msgstr "" -msgid "If *localedir* is not given, then the default system locale directory is used. [#]_ If *languages* is not given, then the following environment variables are searched: :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, and :envvar:`LANG`. The first one returning a non-empty value is used for the *languages* variable. The environment variables should contain a colon separated list of languages, which will be split on the colon to produce the expected list of language code strings." +#: ../../library/gettext.rst:132 +msgid "" +"If *localedir* is not given, then the default system locale directory is " +"used. [#]_ If *languages* is not given, then the following environment " +"variables are " +"searched: :envvar:`LANGUAGE`, :envvar:`LC_ALL`, :envvar:`LC_MESSAGES`, " +"and :envvar:`LANG`. The first one returning a non-empty value is used for " +"the *languages* variable. The environment variables should contain a colon " +"separated list of languages, which will be split on the colon to produce the " +"expected list of language code strings." msgstr "" -msgid ":func:`find` then expands and normalizes the languages, and then iterates through them, searching for an existing file built of these components:" +#: ../../library/gettext.rst:140 +msgid "" +":func:`find` then expands and normalizes the languages, and then iterates " +"through them, searching for an existing file built of these components:" msgstr "" +#: ../../library/gettext.rst:143 msgid ":file:`{localedir}/{language}/LC_MESSAGES/{domain}.mo`" msgstr "" -msgid "The first such file name that exists is returned by :func:`find`. If no such file is found, then ``None`` is returned. If *all* is given, it returns a list of all file names, in the order in which they appear in the languages list or the environment variables." +#: ../../library/gettext.rst:145 +msgid "" +"The first such file name that exists is returned by :func:`find`. If no such " +"file is found, then ``None`` is returned. If *all* is given, it returns a " +"list of all file names, in the order in which they appear in the languages " +"list or the environment variables." msgstr "" -msgid "Return a ``*Translations`` instance based on the *domain*, *localedir*, and *languages*, which are first passed to :func:`find` to get a list of the associated :file:`.mo` file paths. Instances with identical :file:`.mo` file names are cached. The actual class instantiated is *class_* if provided, otherwise :class:`GNUTranslations`. The class's constructor must take a single :term:`file object` argument." +#: ../../library/gettext.rst:153 +msgid "" +"Return a ``*Translations`` instance based on the *domain*, *localedir*, and " +"*languages*, which are first passed to :func:`find` to get a list of the " +"associated :file:`.mo` file paths. Instances with identical :file:`.mo` " +"file names are cached. The actual class instantiated is *class_* if " +"provided, otherwise :class:`GNUTranslations`. The class's constructor must " +"take a single :term:`file object` argument." msgstr "" -msgid "If multiple files are found, later files are used as fallbacks for earlier ones. To allow setting the fallback, :func:`copy.copy` is used to clone each translation object from the cache; the actual instance data is still shared with the cache." +#: ../../library/gettext.rst:160 +msgid "" +"If multiple files are found, later files are used as fallbacks for earlier " +"ones. To allow setting the fallback, :func:`copy.copy` is used to clone each " +"translation object from the cache; the actual instance data is still shared " +"with the cache." msgstr "" -msgid "If no :file:`.mo` file is found, this function raises :exc:`OSError` if *fallback* is false (which is the default), and returns a :class:`NullTranslations` instance if *fallback* is true." +#: ../../library/gettext.rst:165 +msgid "" +"If no :file:`.mo` file is found, this function raises :exc:`OSError` if " +"*fallback* is false (which is the default), and returns " +"a :class:`NullTranslations` instance if *fallback* is true." msgstr "" +#: ../../library/gettext.rst:169 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "" +#: ../../library/gettext.rst:172 msgid "*codeset* parameter is removed." msgstr "" -msgid "This installs the function :func:`!_` in Python's builtins namespace, based on *domain* and *localedir* which are passed to the function :func:`translation`." +#: ../../library/gettext.rst:177 +msgid "" +"This installs the function :func:`!_` in Python's builtins namespace, based " +"on *domain* and *localedir* which are passed to the " +"function :func:`translation`." msgstr "" -msgid "For the *names* parameter, please see the description of the translation object's :meth:`~NullTranslations.install` method." +#: ../../library/gettext.rst:180 +msgid "" +"For the *names* parameter, please see the description of the translation " +"object's :meth:`~NullTranslations.install` method." msgstr "" -msgid "As seen below, you usually mark the strings in your application that are candidates for translation, by wrapping them in a call to the :func:`!_` function, like this::" +#: ../../library/gettext.rst:183 +msgid "" +"As seen below, you usually mark the strings in your application that are " +"candidates for translation, by wrapping them in a call to the :func:`!_` " +"function, like this::" msgstr "" +#: ../../library/gettext.rst:187 msgid "print(_('This string will be translated.'))" msgstr "" -msgid "For convenience, you want the :func:`!_` function to be installed in Python's builtins namespace, so it is easily accessible in all modules of your application." +#: ../../library/gettext.rst:189 +msgid "" +"For convenience, you want the :func:`!_` function to be installed in " +"Python's builtins namespace, so it is easily accessible in all modules of " +"your application." msgstr "" +#: ../../library/gettext.rst:193 msgid "*names* is now a keyword-only parameter." msgstr "" +#: ../../library/gettext.rst:197 msgid "The :class:`NullTranslations` class" msgstr "" -msgid "Translation classes are what actually implement the translation of original source file message strings to translated message strings. The base class used by all translation classes is :class:`NullTranslations`; this provides the basic interface you can use to write your own specialized translation classes. Here are the methods of :class:`!NullTranslations`:" +#: ../../library/gettext.rst:199 +msgid "" +"Translation classes are what actually implement the translation of original " +"source file message strings to translated message strings. The base class " +"used by all translation classes is :class:`NullTranslations`; this provides " +"the basic interface you can use to write your own specialized translation " +"classes. Here are the methods of :class:`!NullTranslations`:" msgstr "" -msgid "Takes an optional :term:`file object` *fp*, which is ignored by the base class. Initializes \"protected\" instance variables *_info* and *_charset* which are set by derived classes, as well as *_fallback*, which is set through :meth:`add_fallback`. It then calls ``self._parse(fp)`` if *fp* is not ``None``." +#: ../../library/gettext.rst:208 +msgid "" +"Takes an optional :term:`file object` *fp*, which is ignored by the base " +"class. Initializes \"protected\" instance variables *_info* and *_charset* " +"which are set by derived classes, as well as *_fallback*, which is set " +"through :meth:`add_fallback`. It then calls ``self._parse(fp)`` if *fp* is " +"not ``None``." msgstr "" -msgid "No-op in the base class, this method takes file object *fp*, and reads the data from the file, initializing its message catalog. If you have an unsupported message catalog file format, you should override this method to parse your format." +#: ../../library/gettext.rst:216 +msgid "" +"No-op in the base class, this method takes file object *fp*, and reads the " +"data from the file, initializing its message catalog. If you have an " +"unsupported message catalog file format, you should override this method to " +"parse your format." msgstr "" -msgid "Add *fallback* as the fallback object for the current translation object. A translation object should consult the fallback if it cannot provide a translation for a given message." +#: ../../library/gettext.rst:224 +msgid "" +"Add *fallback* as the fallback object for the current translation object. A " +"translation object should consult the fallback if it cannot provide a " +"translation for a given message." msgstr "" -msgid "If a fallback has been set, forward :meth:`!gettext` to the fallback. Otherwise, return *message*. Overridden in derived classes." +#: ../../library/gettext.rst:231 +msgid "" +"If a fallback has been set, forward :meth:`!gettext` to the fallback. " +"Otherwise, return *message*. Overridden in derived classes." msgstr "" -msgid "If a fallback has been set, forward :meth:`!ngettext` to the fallback. Otherwise, return *singular* if *n* is 1; return *plural* otherwise. Overridden in derived classes." +#: ../../library/gettext.rst:237 +msgid "" +"If a fallback has been set, forward :meth:`!ngettext` to the fallback. " +"Otherwise, return *singular* if *n* is 1; return *plural* otherwise. " +"Overridden in derived classes." msgstr "" -msgid "If a fallback has been set, forward :meth:`pgettext` to the fallback. Otherwise, return the translated message. Overridden in derived classes." +#: ../../library/gettext.rst:244 +msgid "" +"If a fallback has been set, forward :meth:`pgettext` to the fallback. " +"Otherwise, return the translated message. Overridden in derived classes." msgstr "" -msgid "If a fallback has been set, forward :meth:`npgettext` to the fallback. Otherwise, return the translated message. Overridden in derived classes." +#: ../../library/gettext.rst:252 +msgid "" +"If a fallback has been set, forward :meth:`npgettext` to the fallback. " +"Otherwise, return the translated message. Overridden in derived classes." msgstr "" -msgid "Return a dictionary containing the metadata found in the message catalog file." +#: ../../library/gettext.rst:260 +msgid "" +"Return a dictionary containing the metadata found in the message catalog " +"file." msgstr "" +#: ../../library/gettext.rst:266 msgid "Return the encoding of the message catalog file." msgstr "" -msgid "This method installs :meth:`.gettext` into the built-in namespace, binding it to ``_``." +#: ../../library/gettext.rst:271 +msgid "" +"This method installs :meth:`.gettext` into the built-in namespace, binding " +"it to ``_``." msgstr "" -msgid "If the *names* parameter is given, it must be a sequence containing the names of functions you want to install in the builtins namespace in addition to :func:`!_`. Supported names are ``'gettext'``, ``'ngettext'``, ``'pgettext'``, and ``'npgettext'``." +#: ../../library/gettext.rst:274 +msgid "" +"If the *names* parameter is given, it must be a sequence containing the " +"names of functions you want to install in the builtins namespace in addition " +"to :func:`!_`. Supported names are ``'gettext'``, ``'ngettext'``, " +"``'pgettext'``, and ``'npgettext'``." msgstr "" -msgid "Note that this is only one way, albeit the most convenient way, to make the :func:`!_` function available to your application. Because it affects the entire application globally, and specifically the built-in namespace, localized modules should never install :func:`!_`. Instead, they should use this code to make :func:`!_` available to their module::" +#: ../../library/gettext.rst:279 +msgid "" +"Note that this is only one way, albeit the most convenient way, to make " +"the :func:`!_` function available to your application. Because it affects " +"the entire application globally, and specifically the built-in namespace, " +"localized modules should never install :func:`!_`. Instead, they should use " +"this code to make :func:`!_` available to their module::" msgstr "" +#: ../../library/gettext.rst:285 msgid "" "import gettext\n" "t = gettext.translation('mymodule', ...)\n" "_ = t.gettext" msgstr "" -msgid "This puts :func:`!_` only in the module's global namespace and so only affects calls within this module." +#: ../../library/gettext.rst:289 +msgid "" +"This puts :func:`!_` only in the module's global namespace and so only " +"affects calls within this module." msgstr "" +#: ../../library/gettext.rst:292 msgid "Added ``'pgettext'`` and ``'npgettext'``." msgstr "" +#: ../../library/gettext.rst:297 msgid "The :class:`GNUTranslations` class" msgstr "" -msgid "The :mod:`!gettext` module provides one additional class derived from :class:`NullTranslations`: :class:`GNUTranslations`. This class overrides :meth:`!_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files in both big-endian and little-endian format." -msgstr "" - -msgid ":class:`GNUTranslations` parses optional metadata out of the translation catalog. It is convention with GNU :program:`gettext` to include metadata as the translation for the empty string. This metadata is in :rfc:`822`\\ -style ``key: value`` pairs, and should contain the ``Project-Id-Version`` key. If the key ``Content-Type`` is found, then the ``charset`` property is used to initialize the \"protected\" :attr:`!_charset` instance variable, defaulting to ``None`` if not found. If the charset encoding is specified, then all message ids and message strings read from the catalog are converted to Unicode using this encoding, else ASCII is assumed." +#: ../../library/gettext.rst:299 +msgid "" +"The :mod:`!gettext` module provides one additional class derived " +"from :class:`NullTranslations`: :class:`GNUTranslations`. This class " +"overrides :meth:`!_parse` to enable reading GNU :program:`gettext` " +"format :file:`.mo` files in both big-endian and little-endian format." msgstr "" -msgid "Since message ids are read as Unicode strings too, all ``*gettext()`` methods will assume message ids as Unicode strings, not byte strings." +#: ../../library/gettext.rst:304 +msgid "" +":class:`GNUTranslations` parses optional metadata out of the translation " +"catalog. It is convention with GNU :program:`gettext` to include metadata as " +"the translation for the empty string. This metadata is in :rfc:`822`\\ " +"-style ``key: value`` pairs, and should contain the ``Project-Id-Version`` " +"key. If the key ``Content-Type`` is found, then the ``charset`` property is " +"used to initialize the \"protected\" :attr:`!_charset` instance variable, " +"defaulting to ``None`` if not found. If the charset encoding is specified, " +"then all message ids and message strings read from the catalog are converted " +"to Unicode using this encoding, else ASCII is assumed." +msgstr "" + +#: ../../library/gettext.rst:314 +msgid "" +"Since message ids are read as Unicode strings too, all ``*gettext()`` " +"methods will assume message ids as Unicode strings, not byte strings." msgstr "" -msgid "The entire set of key/value pairs are placed into a dictionary and set as the \"protected\" :attr:`!_info` instance variable." +#: ../../library/gettext.rst:317 +msgid "" +"The entire set of key/value pairs are placed into a dictionary and set as " +"the \"protected\" :attr:`!_info` instance variable." msgstr "" -msgid "If the :file:`.mo` file's magic number is invalid, the major version number is unexpected, or if other problems occur while reading the file, instantiating a :class:`GNUTranslations` class can raise :exc:`OSError`." +#: ../../library/gettext.rst:320 +msgid "" +"If the :file:`.mo` file's magic number is invalid, the major version number " +"is unexpected, or if other problems occur while reading the file, " +"instantiating a :class:`GNUTranslations` class can raise :exc:`OSError`." msgstr "" -msgid "The following methods are overridden from the base class implementation:" +#: ../../library/gettext.rst:326 +msgid "" +"The following methods are overridden from the base class implementation:" msgstr "" -msgid "Look up the *message* id in the catalog and return the corresponding message string, as a Unicode string. If there is no entry in the catalog for the *message* id, and a fallback has been set, the look up is forwarded to the fallback's :meth:`~NullTranslations.gettext` method. Otherwise, the *message* id is returned." +#: ../../library/gettext.rst:330 +msgid "" +"Look up the *message* id in the catalog and return the corresponding message " +"string, as a Unicode string. If there is no entry in the catalog for the " +"*message* id, and a fallback has been set, the look up is forwarded to the " +"fallback's :meth:`~NullTranslations.gettext` method. Otherwise, the " +"*message* id is returned." msgstr "" -msgid "Do a plural-forms lookup of a message id. *singular* is used as the message id for purposes of lookup in the catalog, while *n* is used to determine which plural form to use. The returned message string is a Unicode string." +#: ../../library/gettext.rst:339 +msgid "" +"Do a plural-forms lookup of a message id. *singular* is used as the message " +"id for purposes of lookup in the catalog, while *n* is used to determine " +"which plural form to use. The returned message string is a Unicode string." msgstr "" -msgid "If the message id is not found in the catalog, and a fallback is specified, the request is forwarded to the fallback's :meth:`~NullTranslations.ngettext` method. Otherwise, when *n* is 1 *singular* is returned, and *plural* is returned in all other cases." +#: ../../library/gettext.rst:343 +msgid "" +"If the message id is not found in the catalog, and a fallback is specified, " +"the request is forwarded to the " +"fallback's :meth:`~NullTranslations.ngettext` method. Otherwise, when *n* " +"is 1 *singular* is returned, and *plural* is returned in all other cases." msgstr "" +#: ../../library/gettext.rst:348 msgid "Here is an example::" msgstr "" +#: ../../library/gettext.rst:350 msgid "" "n = len(os.listdir('.'))\n" "cat = GNUTranslations(somefile)\n" @@ -233,27 +468,52 @@ msgid "" " n) % {'num': n}" msgstr "" -msgid "Look up the *context* and *message* id in the catalog and return the corresponding message string, as a Unicode string. If there is no entry in the catalog for the *message* id and *context*, and a fallback has been set, the look up is forwarded to the fallback's :meth:`pgettext` method. Otherwise, the *message* id is returned." +#: ../../library/gettext.rst:360 +msgid "" +"Look up the *context* and *message* id in the catalog and return the " +"corresponding message string, as a Unicode string. If there is no entry in " +"the catalog for the *message* id and *context*, and a fallback has been set, " +"the look up is forwarded to the fallback's :meth:`pgettext` method. " +"Otherwise, the *message* id is returned." msgstr "" -msgid "Do a plural-forms lookup of a message id. *singular* is used as the message id for purposes of lookup in the catalog, while *n* is used to determine which plural form to use." +#: ../../library/gettext.rst:371 +msgid "" +"Do a plural-forms lookup of a message id. *singular* is used as the message " +"id for purposes of lookup in the catalog, while *n* is used to determine " +"which plural form to use." msgstr "" -msgid "If the message id for *context* is not found in the catalog, and a fallback is specified, the request is forwarded to the fallback's :meth:`npgettext` method. Otherwise, when *n* is 1 *singular* is returned, and *plural* is returned in all other cases." +#: ../../library/gettext.rst:375 +msgid "" +"If the message id for *context* is not found in the catalog, and a fallback " +"is specified, the request is forwarded to the fallback's :meth:`npgettext` " +"method. Otherwise, when *n* is 1 *singular* is returned, and *plural* is " +"returned in all other cases." msgstr "" +#: ../../library/gettext.rst:384 msgid "Solaris message catalog support" msgstr "" -msgid "The Solaris operating system defines its own binary :file:`.mo` file format, but since no documentation can be found on this format, it is not supported at this time." +#: ../../library/gettext.rst:386 +msgid "" +"The Solaris operating system defines its own binary :file:`.mo` file format, " +"but since no documentation can be found on this format, it is not supported " +"at this time." msgstr "" +#: ../../library/gettext.rst:392 msgid "The Catalog constructor" msgstr "" -msgid "GNOME uses a version of the :mod:`!gettext` module by James Henstridge, but this version has a slightly different API. Its documented usage was::" +#: ../../library/gettext.rst:396 +msgid "" +"GNOME uses a version of the :mod:`!gettext` module by James Henstridge, but " +"this version has a slightly different API. Its documented usage was::" msgstr "" +#: ../../library/gettext.rst:399 msgid "" "import gettext\n" "cat = gettext.Catalog(domain, localedir)\n" @@ -261,33 +521,61 @@ msgid "" "print(_('hello world'))" msgstr "" -msgid "For compatibility with this older module, the function :func:`!Catalog` is an alias for the :func:`translation` function described above." +#: ../../library/gettext.rst:404 +msgid "" +"For compatibility with this older module, the function :func:`!Catalog` is " +"an alias for the :func:`translation` function described above." msgstr "" -msgid "One difference between this module and Henstridge's: his catalog objects supported access through a mapping API, but this appears to be unused and so is not currently supported." +#: ../../library/gettext.rst:407 +msgid "" +"One difference between this module and Henstridge's: his catalog objects " +"supported access through a mapping API, but this appears to be unused and so " +"is not currently supported." msgstr "" +#: ../../library/gettext.rst:414 msgid "Internationalizing your programs and modules" msgstr "" -msgid "Internationalization (I18N) refers to the operation by which a program is made aware of multiple languages. Localization (L10N) refers to the adaptation of your program, once internationalized, to the local language and cultural habits. In order to provide multilingual messages for your Python programs, you need to take the following steps:" +#: ../../library/gettext.rst:416 +msgid "" +"Internationalization (I18N) refers to the operation by which a program is " +"made aware of multiple languages. Localization (L10N) refers to the " +"adaptation of your program, once internationalized, to the local language " +"and cultural habits. In order to provide multilingual messages for your " +"Python programs, you need to take the following steps:" msgstr "" -msgid "prepare your program or module by specially marking translatable strings" +#: ../../library/gettext.rst:422 +msgid "" +"prepare your program or module by specially marking translatable strings" msgstr "" -msgid "run a suite of tools over your marked files to generate raw messages catalogs" +#: ../../library/gettext.rst:424 +msgid "" +"run a suite of tools over your marked files to generate raw messages catalogs" msgstr "" +#: ../../library/gettext.rst:426 msgid "create language-specific translations of the message catalogs" msgstr "" -msgid "use the :mod:`!gettext` module so that message strings are properly translated" +#: ../../library/gettext.rst:428 +msgid "" +"use the :mod:`!gettext` module so that message strings are properly " +"translated" msgstr "" -msgid "In order to prepare your code for I18N, you need to look at all the strings in your files. Any string that needs to be translated should be marked by wrapping it in ``_('...')`` --- that is, a call to the function :func:`_ `. For example::" +#: ../../library/gettext.rst:430 +msgid "" +"In order to prepare your code for I18N, you need to look at all the strings " +"in your files. Any string that needs to be translated should be marked by " +"wrapping it in ``_('...')`` --- that is, a call to the function :func:`_ " +"`. For example::" msgstr "" +#: ../../library/gettext.rst:434 msgid "" "filename = 'mylog.txt'\n" "message = _('writing a log message')\n" @@ -295,67 +583,140 @@ msgid "" " fp.write(message)" msgstr "" -msgid "In this example, the string ``'writing a log message'`` is marked as a candidate for translation, while the strings ``'mylog.txt'`` and ``'w'`` are not." -msgstr "" - -msgid "There are a few tools to extract the strings meant for translation. The original GNU :program:`gettext` only supported C or C++ source code but its extended version :program:`xgettext` scans code written in a number of languages, including Python, to find strings marked as translatable. `Babel `__ is a Python internationalization library that includes a :file:`pybabel` script to extract and compile message catalogs. François Pinard's program called :program:`xpot` does a similar job and is available as part of his `po-utils package `__." -msgstr "" - -msgid "(Python also includes pure-Python versions of these programs, called :program:`pygettext.py` and :program:`msgfmt.py`; some Python distributions will install them for you. :program:`pygettext.py` is similar to :program:`xgettext`, but only understands Python source code and cannot handle other programming languages such as C or C++. :program:`pygettext.py` supports a command-line interface similar to :program:`xgettext`; for details on its use, run ``pygettext.py --help``. :program:`msgfmt.py` is binary compatible with GNU :program:`msgfmt`. With these two programs, you may not need the GNU :program:`gettext` package to internationalize your Python applications.)" +#: ../../library/gettext.rst:439 +msgid "" +"In this example, the string ``'writing a log message'`` is marked as a " +"candidate for translation, while the strings ``'mylog.txt'`` and ``'w'`` are " +"not." msgstr "" -msgid ":program:`xgettext`, :program:`pygettext`, and similar tools generate :file:`.po` files that are message catalogs. They are structured human-readable files that contain every marked string in the source code, along with a placeholder for the translated versions of these strings." +#: ../../library/gettext.rst:442 +msgid "" +"There are a few tools to extract the strings meant for translation. The " +"original GNU :program:`gettext` only supported C or C++ source code but its " +"extended version :program:`xgettext` scans code written in a number of " +"languages, including Python, to find strings marked as translatable. `Babel " +"`__ is a Python internationalization library that " +"includes a :file:`pybabel` script to extract and compile message catalogs. " +"François Pinard's program called :program:`xpot` does a similar job and is " +"available as part of his `po-utils package `__." +msgstr "" + +#: ../../library/gettext.rst:452 +msgid "" +"(Python also includes pure-Python versions of these programs, " +"called :program:`pygettext.py` and :program:`msgfmt.py`; some Python " +"distributions will install them for you. :program:`pygettext.py` is similar " +"to :program:`xgettext`, but only understands Python source code and cannot " +"handle other programming languages such as C or C++. :program:`pygettext.py` " +"supports a command-line interface similar to :program:`xgettext`; for " +"details on its use, run ``pygettext.py --help``. :program:`msgfmt.py` is " +"binary compatible with GNU :program:`msgfmt`. With these two programs, you " +"may not need the GNU :program:`gettext` package to internationalize your " +"Python applications.)" +msgstr "" + +#: ../../library/gettext.rst:464 +msgid "" +":program:`xgettext`, :program:`pygettext`, and similar tools " +"generate :file:`.po` files that are message catalogs. They are structured " +"human-readable files that contain every marked string in the source code, " +"along with a placeholder for the translated versions of these strings." msgstr "" -msgid "Copies of these :file:`.po` files are then handed over to the individual human translators who write translations for every supported natural language. They send back the completed language-specific versions as a :file:`.po` file that's compiled into a machine-readable :file:`.mo` binary catalog file using the :program:`msgfmt` program. The :file:`.mo` files are used by the :mod:`!gettext` module for the actual translation processing at run-time." +#: ../../library/gettext.rst:470 +msgid "" +"Copies of these :file:`.po` files are then handed over to the individual " +"human translators who write translations for every supported natural " +"language. They send back the completed language-specific versions as " +"a :file:`.po` file that's compiled into a machine-" +"readable :file:`.mo` binary catalog file using the :program:`msgfmt` " +"program. The :file:`.mo` files are used by the :mod:`!gettext` module for " +"the actual translation processing at run-time." msgstr "" -msgid "How you use the :mod:`!gettext` module in your code depends on whether you are internationalizing a single module or your entire application. The next two sections will discuss each case." +#: ../../library/gettext.rst:479 +msgid "" +"How you use the :mod:`!gettext` module in your code depends on whether you " +"are internationalizing a single module or your entire application. The next " +"two sections will discuss each case." msgstr "" +#: ../../library/gettext.rst:485 msgid "Localizing your module" msgstr "" -msgid "If you are localizing your module, you must take care not to make global changes, e.g. to the built-in namespace. You should not use the GNU :program:`gettext` API but instead the class-based API." +#: ../../library/gettext.rst:487 +msgid "" +"If you are localizing your module, you must take care not to make global " +"changes, e.g. to the built-in namespace. You should not use the " +"GNU :program:`gettext` API but instead the class-based API." msgstr "" -msgid "Let's say your module is called \"spam\" and the module's various natural language translation :file:`.mo` files reside in :file:`/usr/share/locale` in GNU :program:`gettext` format. Here's what you would put at the top of your module::" +#: ../../library/gettext.rst:491 +msgid "" +"Let's say your module is called \"spam\" and the module's various natural " +"language translation :file:`.mo` files reside in :file:`/usr/share/locale` " +"in GNU :program:`gettext` format. Here's what you would put at the top of " +"your module::" msgstr "" +#: ../../library/gettext.rst:496 msgid "" "import gettext\n" "t = gettext.translation('spam', '/usr/share/locale')\n" "_ = t.gettext" msgstr "" +#: ../../library/gettext.rst:502 msgid "Localizing your application" msgstr "" -msgid "If you are localizing your application, you can install the :func:`!_` function globally into the built-in namespace, usually in the main driver file of your application. This will let all your application-specific files just use ``_('...')`` without having to explicitly install it in each file." +#: ../../library/gettext.rst:504 +msgid "" +"If you are localizing your application, you can install the :func:`!_` " +"function globally into the built-in namespace, usually in the main driver " +"file of your application. This will let all your application-specific files " +"just use ``_('...')`` without having to explicitly install it in each file." msgstr "" -msgid "In the simple case then, you need only add the following bit of code to the main driver file of your application::" +#: ../../library/gettext.rst:509 +msgid "" +"In the simple case then, you need only add the following bit of code to the " +"main driver file of your application::" msgstr "" +#: ../../library/gettext.rst:512 msgid "" "import gettext\n" "gettext.install('myapplication')" msgstr "" -msgid "If you need to set the locale directory, you can pass it into the :func:`install` function::" +#: ../../library/gettext.rst:515 +msgid "" +"If you need to set the locale directory, you can pass it into " +"the :func:`install` function::" msgstr "" +#: ../../library/gettext.rst:518 msgid "" "import gettext\n" "gettext.install('myapplication', '/usr/share/locale')" msgstr "" +#: ../../library/gettext.rst:523 msgid "Changing languages on the fly" msgstr "" -msgid "If your program needs to support many languages at the same time, you may want to create multiple translation instances and then switch between them explicitly, like so::" +#: ../../library/gettext.rst:525 +msgid "" +"If your program needs to support many languages at the same time, you may " +"want to create multiple translation instances and then switch between them " +"explicitly, like so::" msgstr "" +#: ../../library/gettext.rst:529 msgid "" "import gettext\n" "\n" @@ -373,12 +734,18 @@ msgid "" "lang3.install()" msgstr "" +#: ../../library/gettext.rst:546 msgid "Deferred translations" msgstr "" -msgid "In most coding situations, strings are translated where they are coded. Occasionally however, you need to mark strings for translation, but defer actual translation until later. A classic example is::" +#: ../../library/gettext.rst:548 +msgid "" +"In most coding situations, strings are translated where they are coded. " +"Occasionally however, you need to mark strings for translation, but defer " +"actual translation until later. A classic example is::" msgstr "" +#: ../../library/gettext.rst:552 msgid "" "animals = ['mollusk',\n" " 'albatross',\n" @@ -390,12 +757,18 @@ msgid "" " print(a)" msgstr "" -msgid "Here, you want to mark the strings in the ``animals`` list as being translatable, but you don't actually want to translate them until they are printed." +#: ../../library/gettext.rst:561 +msgid "" +"Here, you want to mark the strings in the ``animals`` list as being " +"translatable, but you don't actually want to translate them until they are " +"printed." msgstr "" +#: ../../library/gettext.rst:565 msgid "Here is one way you can handle this situation::" msgstr "" +#: ../../library/gettext.rst:567 msgid "" "def _(message): return message\n" "\n" @@ -412,15 +785,27 @@ msgid "" " print(_(a))" msgstr "" -msgid "This works because the dummy definition of :func:`!_` simply returns the string unchanged. And this dummy definition will temporarily override any definition of :func:`!_` in the built-in namespace (until the :keyword:`del` command). Take care, though if you have a previous definition of :func:`!_` in the local namespace." +#: ../../library/gettext.rst:581 +msgid "" +"This works because the dummy definition of :func:`!_` simply returns the " +"string unchanged. And this dummy definition will temporarily override any " +"definition of :func:`!_` in the built-in namespace (until the :keyword:`del` " +"command). Take care, though if you have a previous definition of :func:`!_` " +"in the local namespace." msgstr "" -msgid "Note that the second use of :func:`!_` will not identify \"a\" as being translatable to the :program:`gettext` program, because the parameter is not a string literal." +#: ../../library/gettext.rst:587 +msgid "" +"Note that the second use of :func:`!_` will not identify \"a\" as being " +"translatable to the :program:`gettext` program, because the parameter is not " +"a string literal." msgstr "" +#: ../../library/gettext.rst:591 msgid "Another way to handle this is with the following example::" msgstr "" +#: ../../library/gettext.rst:593 msgid "" "def N_(message): return message\n" "\n" @@ -435,53 +820,88 @@ msgid "" " print(_(a))" msgstr "" -msgid "In this case, you are marking translatable strings with the function :func:`!N_`, which won't conflict with any definition of :func:`!_`. However, you will need to teach your message extraction program to look for translatable strings marked with :func:`!N_`. :program:`xgettext`, :program:`pygettext`, ``pybabel extract``, and :program:`xpot` all support this through the use of the :option:`!-k` command-line switch. The choice of :func:`!N_` here is totally arbitrary; it could have just as easily been :func:`!MarkThisStringForTranslation`." +#: ../../library/gettext.rst:605 +msgid "" +"In this case, you are marking translatable strings with the function :func:`!" +"N_`, which won't conflict with any definition of :func:`!_`. However, you " +"will need to teach your message extraction program to look for translatable " +"strings marked with :func:`!N_`. :program:`xgettext`, :program:`pygettext`, " +"``pybabel extract``, and :program:`xpot` all support this through the use of " +"the :option:`!-k` command-line switch. The choice of :func:`!N_` here is " +"totally arbitrary; it could have just as easily been :func:`!" +"MarkThisStringForTranslation`." msgstr "" +#: ../../library/gettext.rst:616 msgid "Acknowledgements" msgstr "" -msgid "The following people contributed code, feedback, design suggestions, previous implementations, and valuable experience to the creation of this module:" +#: ../../library/gettext.rst:618 +msgid "" +"The following people contributed code, feedback, design suggestions, " +"previous implementations, and valuable experience to the creation of this " +"module:" msgstr "" +#: ../../library/gettext.rst:621 msgid "Peter Funk" msgstr "" +#: ../../library/gettext.rst:623 msgid "James Henstridge" msgstr "" +#: ../../library/gettext.rst:625 msgid "Juan David Ibáñez Palomar" msgstr "" +#: ../../library/gettext.rst:627 msgid "Marc-André Lemburg" msgstr "" +#: ../../library/gettext.rst:629 msgid "Martin von Löwis" msgstr "" +#: ../../library/gettext.rst:631 msgid "François Pinard" msgstr "" +#: ../../library/gettext.rst:633 msgid "Barry Warsaw" msgstr "" +#: ../../library/gettext.rst:635 msgid "Gustavo Niemeyer" msgstr "" +#: ../../library/gettext.rst:638 msgid "Footnotes" msgstr "" -msgid "The default locale directory is system dependent; for example, on Red Hat Linux it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/locale`. The :mod:`!gettext` module does not try to support these system dependent defaults; instead its default is :file:`{sys.base_prefix}/share/locale` (see :data:`sys.base_prefix`). For this reason, it is always best to call :func:`bindtextdomain` with an explicit absolute path at the start of your application." +#: ../../library/gettext.rst:639 +msgid "" +"The default locale directory is system dependent; for example, on Red Hat " +"Linux it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/" +"locale`. The :mod:`!gettext` module does not try to support these system " +"dependent defaults; instead its default is :file:`{sys.base_prefix}/share/" +"locale` (see :data:`sys.base_prefix`). For this reason, it is always best to " +"call :func:`bindtextdomain` with an explicit absolute path at the start of " +"your application." msgstr "" +#: ../../library/gettext.rst:647 msgid "See the footnote for :func:`bindtextdomain` above." msgstr "" +#: ../../library/gettext.rst:56 msgid "_ (underscore)" msgstr "" +#: ../../library/gettext.rst:56 msgid "gettext" msgstr "" +#: ../../library/gettext.rst:394 msgid "GNOME" msgstr "" diff --git a/library/glob.po b/library/glob.po index 7438b069d..2d72c09ba 100644 --- a/library/glob.po +++ b/library/glob.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,99 +24,201 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/glob.rst:2 msgid ":mod:`!glob` --- Unix style pathname pattern expansion" msgstr "" +#: ../../library/glob.rst:7 msgid "**Source code:** :source:`Lib/glob.py`" msgstr "" -msgid "The :mod:`!glob` module finds pathnames using pattern matching rules similar to the Unix shell. No tilde expansion is done, but ``*``, ``?``, and character ranges expressed with ``[]`` will be correctly matched. This is done by using the :func:`os.scandir` and :func:`fnmatch.fnmatch` functions in concert, and not by actually invoking a subshell." +#: ../../library/glob.rst:21 +msgid "" +"The :mod:`!glob` module finds pathnames using pattern matching rules similar " +"to the Unix shell. No tilde expansion is done, but ``*``, ``?``, and " +"character ranges expressed with ``[]`` will be correctly matched. This is " +"done by using the :func:`os.scandir` and :func:`fnmatch.fnmatch` functions " +"in concert, and not by actually invoking a subshell." msgstr "" -msgid "The pathnames are returned in no particular order. If you need a specific order, sort the results." +#: ../../library/glob.rst:29 +msgid "" +"The pathnames are returned in no particular order. If you need a specific " +"order, sort the results." msgstr "" -msgid "Files beginning with a dot (``.``) can only be matched by patterns that also start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib.Path.glob`. For tilde and shell variable expansion, use :func:`os.path.expanduser` and :func:`os.path.expandvars`." +#: ../../library/glob.rst:32 +msgid "" +"By default, files beginning with a dot (``.``) can only be matched by " +"patterns that also start with a dot, unlike :func:`fnmatch.fnmatch` " +"or :func:`pathlib.Path.glob`. For tilde and shell variable expansion, " +"use :func:`os.path.expanduser` and :func:`os.path.expandvars`." msgstr "" -msgid "For a literal match, wrap the meta-characters in brackets. For example, ``'[?]'`` matches the character ``'?'``." +#: ../../library/glob.rst:38 +msgid "" +"For a literal match, wrap the meta-characters in brackets. For example, " +"``'[?]'`` matches the character ``'?'``." msgstr "" +#: ../../library/glob.rst:41 msgid "The :mod:`!glob` module defines the following functions:" msgstr "" -msgid "Return a possibly empty list of path names that match *pathname*, which must be a string containing a path specification. *pathname* can be either absolute (like :file:`/usr/src/Python-1.5/Makefile`) or relative (like :file:`../../Tools/\\*/\\*.gif`), and can contain shell-style wildcards. Broken symlinks are included in the results (as in the shell). Whether or not the results are sorted depends on the file system. If a file that satisfies conditions is removed or added during the call of this function, whether a path name for that file will be included is unspecified." +#: ../../library/glob.rst:47 +msgid "" +"Return a possibly empty list of path names that match *pathname*, which must " +"be a string containing a path specification. *pathname* can be either " +"absolute (like :file:`/usr/src/Python-1.5/Makefile`) or relative " +"(like :file:`../../Tools/\\*/\\*.gif`), and can contain shell-style " +"wildcards. Broken symlinks are included in the results (as in the shell). " +"Whether or not the results are sorted depends on the file system. If a file " +"that satisfies conditions is removed or added during the call of this " +"function, whether a path name for that file will be included is unspecified." msgstr "" -msgid "If *root_dir* is not ``None``, it should be a :term:`path-like object` specifying the root directory for searching. It has the same effect on :func:`!glob` as changing the current directory before calling it. If *pathname* is relative, the result will contain paths relative to *root_dir*." +#: ../../library/glob.rst:56 +msgid "" +"If *root_dir* is not ``None``, it should be a :term:`path-like object` " +"specifying the root directory for searching. It has the same effect " +"on :func:`!glob` as changing the current directory before calling it. If " +"*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" -msgid "This function can support :ref:`paths relative to directory descriptors ` with the *dir_fd* parameter." +#: ../../library/glob.rst:62 +msgid "" +"This function can support :ref:`paths relative to directory descriptors " +"` with the *dir_fd* parameter." msgstr "" -msgid "If *recursive* is true, the pattern \"``**``\" will match any files and zero or more directories, subdirectories and symbolic links to directories. If the pattern is followed by an :data:`os.sep` or :data:`os.altsep` then files will not match." +#: ../../library/glob.rst:68 +msgid "" +"If *recursive* is true, the pattern \"``**``\" will match any files and zero " +"or more directories, subdirectories and symbolic links to directories. If " +"the pattern is followed by an :data:`os.sep` or :data:`os.altsep` then files " +"will not match." msgstr "" -msgid "If *include_hidden* is true, \"``**``\" pattern will match hidden directories." +#: ../../library/glob.rst:73 +msgid "" +"If *include_hidden* is true, wildcards can match path segments that begin " +"with a dot (``.``)." msgstr "" -msgid "Raises an :ref:`auditing event ` ``glob.glob`` with arguments ``pathname``, ``recursive``." +#: ../../library/glob.rst:76 ../../library/glob.rst:108 +msgid "" +"Raises an :ref:`auditing event ` ``glob.glob`` with arguments " +"``pathname``, ``recursive``." msgstr "" -msgid "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments ``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." +#: ../../library/glob.rst:77 ../../library/glob.rst:109 +msgid "" +"Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " +"``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." msgstr "" -msgid "Using the \"``**``\" pattern in large directory trees may consume an inordinate amount of time." +#: ../../library/glob.rst:80 +msgid "" +"Using the \"``**``\" pattern in large directory trees may consume an " +"inordinate amount of time." msgstr "" -msgid "This function may return duplicate path names if *pathname* contains multiple \"``**``\" patterns and *recursive* is true." +#: ../../library/glob.rst:84 ../../library/glob.rst:112 +msgid "" +"This function may return duplicate path names if *pathname* contains " +"multiple \"``**``\" patterns and *recursive* is true." msgstr "" -msgid "Any :exc:`OSError` exceptions raised from scanning the filesystem are suppressed. This includes :exc:`PermissionError` when accessing directories without read permission." +#: ../../library/glob.rst:88 ../../library/glob.rst:116 +msgid "" +"Any :exc:`OSError` exceptions raised from scanning the filesystem are " +"suppressed. This includes :exc:`PermissionError` when accessing directories " +"without read permission." msgstr "" +#: ../../library/glob.rst:92 ../../library/glob.rst:120 msgid "Support for recursive globs using \"``**``\"." msgstr "" +#: ../../library/glob.rst:95 ../../library/glob.rst:123 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "" +#: ../../library/glob.rst:98 ../../library/glob.rst:126 msgid "Added the *include_hidden* parameter." msgstr "" -msgid "Return an :term:`iterator` which yields the same values as :func:`glob` without actually storing them all simultaneously." +#: ../../library/glob.rst:105 +msgid "" +"Return an :term:`iterator` which yields the same values as :func:`glob` " +"without actually storing them all simultaneously." msgstr "" -msgid "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful if you want to match an arbitrary literal string that may have special characters in it. Special characters in drive/UNC sharepoints are not escaped, e.g. on Windows ``escape('//?/c:/Quo vadis?.txt')`` returns ``'//?/c:/Quo vadis[?].txt'``." +#: ../../library/glob.rst:132 +msgid "" +"Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " +"if you want to match an arbitrary literal string that may have special " +"characters in it. Special characters in drive/UNC sharepoints are not " +"escaped, for example on Windows ``escape('//?/c:/Quo vadis?.txt')`` returns " +"``'//?/c:/Quo vadis[?].txt'``." msgstr "" -msgid "Convert the given path specification to a regular expression for use with :func:`re.match`. The path specification can contain shell-style wildcards." +#: ../../library/glob.rst:143 +msgid "" +"Convert the given path specification to a regular expression for use " +"with :func:`re.match`. The path specification can contain shell-style " +"wildcards." msgstr "" +#: ../../library/glob.rst:146 msgid "For example:" msgstr "" -msgid "Path separators and segments are meaningful to this function, unlike :func:`fnmatch.translate`. By default wildcards do not match path separators, and ``*`` pattern segments match precisely one path segment." +#: ../../library/glob.rst:157 +msgid "" +"Path separators and segments are meaningful to this function, " +"unlike :func:`fnmatch.translate`. By default wildcards do not match path " +"separators, and ``*`` pattern segments match precisely one path segment." msgstr "" -msgid "If *recursive* is true, the pattern segment \"``**``\" will match any number of path segments." +#: ../../library/glob.rst:161 +msgid "" +"If *recursive* is true, the pattern segment \"``**``\" will match any number " +"of path segments." msgstr "" -msgid "If *include_hidden* is true, wildcards can match path segments that start with a dot (``.``)." +#: ../../library/glob.rst:164 +msgid "" +"If *include_hidden* is true, wildcards can match path segments that start " +"with a dot (``.``)." msgstr "" -msgid "A sequence of path separators may be supplied to the *seps* argument. If not given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." +#: ../../library/glob.rst:167 +msgid "" +"A sequence of path separators may be supplied to the *seps* argument. If not " +"given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." msgstr "" -msgid ":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, which call this function to implement pattern matching and globbing." +#: ../../library/glob.rst:172 +msgid "" +":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, " +"which call this function to implement pattern matching and globbing." msgstr "" +#: ../../library/glob.rst:180 msgid "Examples" msgstr "" -msgid "Consider a directory containing the following files: :file:`1.gif`, :file:`2.txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only the file :file:`3.txt`. :func:`glob` will produce the following results. Notice how any leading components of the path are preserved. ::" +#: ../../library/glob.rst:182 +msgid "" +"Consider a directory containing the following " +"files: :file:`1.gif`, :file:`2.txt`, :file:`card.gif` and a " +"subdirectory :file:`sub` which contains only the " +"file :file:`3.txt`. :func:`glob` will produce the following results. " +"Notice how any leading components of the path are preserved. ::" msgstr "" +#: ../../library/glob.rst:188 msgid "" ">>> import glob\n" ">>> glob.glob('./[0-9].*')\n" @@ -131,9 +233,14 @@ msgid "" "['./', './sub/']" msgstr "" -msgid "If the directory contains files starting with ``.`` they won't be matched by default. For example, consider a directory containing :file:`card.gif` and :file:`.card.gif`::" +#: ../../library/glob.rst:200 +msgid "" +"If the directory contains files starting with ``.`` they won't be matched by " +"default. For example, consider a directory containing :file:`card.gif` " +"and :file:`.card.gif`::" msgstr "" +#: ../../library/glob.rst:204 msgid "" ">>> import glob\n" ">>> glob.glob('*.gif')\n" @@ -142,38 +249,51 @@ msgid "" "['.card.gif']" msgstr "" -msgid "The :mod:`fnmatch` module offers shell-style filename (not path) expansion." +#: ../../library/glob.rst:211 +msgid "" +"The :mod:`fnmatch` module offers shell-style filename (not path) expansion." msgstr "" +#: ../../library/glob.rst:214 msgid "The :mod:`pathlib` module offers high-level path objects." msgstr "" +#: ../../library/glob.rst:9 msgid "filenames" msgstr "" +#: ../../library/glob.rst:9 msgid "pathname expansion" msgstr "" +#: ../../library/glob.rst:13 msgid "* (asterisk)" msgstr "" +#: ../../library/glob.rst:13 ../../library/glob.rst:65 msgid "in glob-style wildcards" msgstr "" +#: ../../library/glob.rst:13 msgid "? (question mark)" msgstr "" +#: ../../library/glob.rst:13 msgid "[] (square brackets)" msgstr "" +#: ../../library/glob.rst:13 msgid "! (exclamation)" msgstr "" +#: ../../library/glob.rst:13 msgid "- (minus)" msgstr "" +#: ../../library/glob.rst:13 msgid ". (dot)" msgstr "" +#: ../../library/glob.rst:65 msgid "**" msgstr "" diff --git a/library/graphlib.po b/library/graphlib.po index 93929cc3b..606108acd 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:06+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,39 +23,77 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -msgid ":mod:`!graphlib` --- Functionality to operate with graph-like structures" +#: ../../library/graphlib.rst:2 +msgid "" +":mod:`!graphlib` --- Functionality to operate with graph-like structures" msgstr "" +#: ../../library/graphlib.rst:8 msgid "**Source code:** :source:`Lib/graphlib.py`" msgstr "" -msgid "Provides functionality to topologically sort a graph of :term:`hashable` nodes." +#: ../../library/graphlib.rst:20 +msgid "" +"Provides functionality to topologically sort a graph of :term:`hashable` " +"nodes." msgstr "" -msgid "A topological order is a linear ordering of the vertices in a graph such that for every directed edge u -> v from vertex u to vertex v, vertex u comes before vertex v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, and the edges may represent constraints that one task must be performed before another; in this example, a topological ordering is just a valid sequence for the tasks. A complete topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph." +#: ../../library/graphlib.rst:22 +msgid "" +"A topological order is a linear ordering of the vertices in a graph such " +"that for every directed edge u -> v from vertex u to vertex v, vertex u " +"comes before vertex v in the ordering. For instance, the vertices of the " +"graph may represent tasks to be performed, and the edges may represent " +"constraints that one task must be performed before another; in this example, " +"a topological ordering is just a valid sequence for the tasks. A complete " +"topological ordering is possible if and only if the graph has no directed " +"cycles, that is, if it is a directed acyclic graph." msgstr "" -msgid "If the optional *graph* argument is provided it must be a dictionary representing a directed acyclic graph where the keys are nodes and the values are iterables of all predecessors of that node in the graph (the nodes that have edges that point to the value in the key). Additional nodes can be added to the graph using the :meth:`~TopologicalSorter.add` method." +#: ../../library/graphlib.rst:31 +msgid "" +"If the optional *graph* argument is provided it must be a dictionary " +"representing a directed acyclic graph where the keys are nodes and the " +"values are iterables of all predecessors of that node in the graph (the " +"nodes that have edges that point to the value in the key). Additional nodes " +"can be added to the graph using the :meth:`~TopologicalSorter.add` method." msgstr "" -msgid "In the general case, the steps required to perform the sorting of a given graph are as follows:" +#: ../../library/graphlib.rst:37 +msgid "" +"In the general case, the steps required to perform the sorting of a given " +"graph are as follows:" msgstr "" -msgid "Create an instance of the :class:`TopologicalSorter` with an optional initial graph." +#: ../../library/graphlib.rst:40 +msgid "" +"Create an instance of the :class:`TopologicalSorter` with an optional " +"initial graph." msgstr "" +#: ../../library/graphlib.rst:42 msgid "Add additional nodes to the graph." msgstr "" +#: ../../library/graphlib.rst:43 msgid "Call :meth:`~TopologicalSorter.prepare` on the graph." msgstr "" -msgid "While :meth:`~TopologicalSorter.is_active` is ``True``, iterate over the nodes returned by :meth:`~TopologicalSorter.get_ready` and process them. Call :meth:`~TopologicalSorter.done` on each node as it finishes processing." +#: ../../library/graphlib.rst:44 +msgid "" +"While :meth:`~TopologicalSorter.is_active` is ``True``, iterate over the " +"nodes returned by :meth:`~TopologicalSorter.get_ready` and process them. " +"Call :meth:`~TopologicalSorter.done` on each node as it finishes processing." msgstr "" -msgid "In case just an immediate sorting of the nodes in the graph is required and no parallelism is involved, the convenience method :meth:`TopologicalSorter.static_order` can be used directly:" +#: ../../library/graphlib.rst:49 +msgid "" +"In case just an immediate sorting of the nodes in the graph is required and " +"no parallelism is involved, the convenience " +"method :meth:`TopologicalSorter.static_order` can be used directly:" msgstr "" +#: ../../library/graphlib.rst:53 msgid "" ">>> graph = {\"D\": {\"B\", \"C\"}, \"C\": {\"A\"}, \"B\": {\"A\"}}\n" ">>> ts = TopologicalSorter(graph)\n" @@ -63,9 +101,13 @@ msgid "" "('A', 'C', 'B', 'D')" msgstr "" -msgid "The class is designed to easily support parallel processing of the nodes as they become ready. For instance::" +#: ../../library/graphlib.rst:60 +msgid "" +"The class is designed to easily support parallel processing of the nodes as " +"they become ready. For instance::" msgstr "" +#: ../../library/graphlib.rst:63 msgid "" "topological_sorter = TopologicalSorter()\n" "\n" @@ -90,61 +132,125 @@ msgid "" " topological_sorter.done(node)" msgstr "" -msgid "Add a new node and its predecessors to the graph. Both the *node* and all elements in *predecessors* must be :term:`hashable`." +#: ../../library/graphlib.rst:87 +msgid "" +"Add a new node and its predecessors to the graph. Both the *node* and all " +"elements in *predecessors* must be :term:`hashable`." msgstr "" -msgid "If called multiple times with the same node argument, the set of dependencies will be the union of all dependencies passed in." +#: ../../library/graphlib.rst:90 +msgid "" +"If called multiple times with the same node argument, the set of " +"dependencies will be the union of all dependencies passed in." msgstr "" -msgid "It is possible to add a node with no dependencies (*predecessors* is not provided) or to provide a dependency twice. If a node that has not been provided before is included among *predecessors* it will be automatically added to the graph with no predecessors of its own." +#: ../../library/graphlib.rst:93 +msgid "" +"It is possible to add a node with no dependencies (*predecessors* is not " +"provided) or to provide a dependency twice. If a node that has not been " +"provided before is included among *predecessors* it will be automatically " +"added to the graph with no predecessors of its own." msgstr "" -msgid "Raises :exc:`ValueError` if called after :meth:`~TopologicalSorter.prepare`." +#: ../../library/graphlib.rst:98 +msgid "" +"Raises :exc:`ValueError` if called after :meth:`~TopologicalSorter.prepare`." msgstr "" -msgid "Mark the graph as finished and check for cycles in the graph. If any cycle is detected, :exc:`CycleError` will be raised, but :meth:`~TopologicalSorter.get_ready` can still be used to obtain as many nodes as possible until cycles block more progress. After a call to this function, the graph cannot be modified, and therefore no more nodes can be added using :meth:`~TopologicalSorter.add`." +#: ../../library/graphlib.rst:102 +msgid "" +"Mark the graph as finished and check for cycles in the graph. If any cycle " +"is detected, :exc:`CycleError` will be raised, " +"but :meth:`~TopologicalSorter.get_ready` can still be used to obtain as many " +"nodes as possible until cycles block more progress. After a call to this " +"function, the graph cannot be modified, and therefore no more nodes can be " +"added using :meth:`~TopologicalSorter.add`." msgstr "" -msgid "A :exc:`ValueError` will be raised if the sort has been started by :meth:`~.static_order` or :meth:`~.get_ready`." +#: ../../library/graphlib.rst:109 +msgid "" +"A :exc:`ValueError` will be raised if the sort has been started " +"by :meth:`~.static_order` or :meth:`~.get_ready`." msgstr "" -msgid "``prepare()`` can now be called more than once as long as the sort has not started. Previously this raised :exc:`ValueError`." +#: ../../library/graphlib.rst:114 +msgid "" +"``prepare()`` can now be called more than once as long as the sort has not " +"started. Previously this raised :exc:`ValueError`." msgstr "" -msgid "Returns ``True`` if more progress can be made and ``False`` otherwise. Progress can be made if cycles do not block the resolution and either there are still nodes ready that haven't yet been returned by :meth:`TopologicalSorter.get_ready` or the number of nodes marked :meth:`TopologicalSorter.done` is less than the number that have been returned by :meth:`TopologicalSorter.get_ready`." +#: ../../library/graphlib.rst:119 +msgid "" +"Returns ``True`` if more progress can be made and ``False`` otherwise. " +"Progress can be made if cycles do not block the resolution and either there " +"are still nodes ready that haven't yet been returned " +"by :meth:`TopologicalSorter.get_ready` or the number of nodes " +"marked :meth:`TopologicalSorter.done` is less than the number that have been " +"returned by :meth:`TopologicalSorter.get_ready`." msgstr "" -msgid "The :meth:`~object.__bool__` method of this class defers to this function, so instead of::" +#: ../../library/graphlib.rst:126 +msgid "" +"The :meth:`~object.__bool__` method of this class defers to this function, " +"so instead of::" msgstr "" +#: ../../library/graphlib.rst:129 msgid "" "if ts.is_active():\n" " ..." msgstr "" +#: ../../library/graphlib.rst:132 msgid "it is possible to simply do::" msgstr "" +#: ../../library/graphlib.rst:134 msgid "" "if ts:\n" " ..." msgstr "" -msgid "Raises :exc:`ValueError` if called without calling :meth:`~TopologicalSorter.prepare` previously." +#: ../../library/graphlib.rst:137 ../../library/graphlib.rst:160 +msgid "" +"Raises :exc:`ValueError` if called without " +"calling :meth:`~TopologicalSorter.prepare` previously." msgstr "" -msgid "Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as processed, unblocking any successor of each node in *nodes* for being returned in the future by a call to :meth:`TopologicalSorter.get_ready`." +#: ../../library/graphlib.rst:142 +msgid "" +"Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as " +"processed, unblocking any successor of each node in *nodes* for being " +"returned in the future by a call to :meth:`TopologicalSorter.get_ready`." msgstr "" -msgid "Raises :exc:`ValueError` if any node in *nodes* has already been marked as processed by a previous call to this method or if a node was not added to the graph by using :meth:`TopologicalSorter.add`, if called without calling :meth:`~TopologicalSorter.prepare` or if node has not yet been returned by :meth:`~TopologicalSorter.get_ready`." +#: ../../library/graphlib.rst:146 +msgid "" +"Raises :exc:`ValueError` if any node in *nodes* has already been marked as " +"processed by a previous call to this method or if a node was not added to " +"the graph by using :meth:`TopologicalSorter.add`, if called without " +"calling :meth:`~TopologicalSorter.prepare` or if node has not yet been " +"returned by :meth:`~TopologicalSorter.get_ready`." msgstr "" -msgid "Returns a ``tuple`` with all the nodes that are ready. Initially it returns all nodes with no predecessors, and once those are marked as processed by calling :meth:`TopologicalSorter.done`, further calls will return all new nodes that have all their predecessors already processed. Once no more progress can be made, empty tuples are returned." +#: ../../library/graphlib.rst:154 +msgid "" +"Returns a ``tuple`` with all the nodes that are ready. Initially it returns " +"all nodes with no predecessors, and once those are marked as processed by " +"calling :meth:`TopologicalSorter.done`, further calls will return all new " +"nodes that have all their predecessors already processed. Once no more " +"progress can be made, empty tuples are returned." msgstr "" -msgid "Returns an iterator object which will iterate over nodes in a topological order. When using this method, :meth:`~TopologicalSorter.prepare` and :meth:`~TopologicalSorter.done` should not be called. This method is equivalent to::" +#: ../../library/graphlib.rst:165 +msgid "" +"Returns an iterator object which will iterate over nodes in a topological " +"order. When using this method, :meth:`~TopologicalSorter.prepare` " +"and :meth:`~TopologicalSorter.done` should not be called. This method is " +"equivalent to::" msgstr "" +#: ../../library/graphlib.rst:170 msgid "" "def static_order(self):\n" " self.prepare()\n" @@ -154,9 +260,13 @@ msgid "" " self.done(*node_group)" msgstr "" -msgid "The particular order that is returned may depend on the specific order in which the items were inserted in the graph. For example:" +#: ../../library/graphlib.rst:177 +msgid "" +"The particular order that is returned may depend on the specific order in " +"which the items were inserted in the graph. For example:" msgstr "" +#: ../../library/graphlib.rst:180 msgid "" ">>> ts = TopologicalSorter()\n" ">>> ts.add(3, 2, 1)\n" @@ -171,20 +281,39 @@ msgid "" "[0, 2, 1, 3]" msgstr "" -msgid "This is due to the fact that \"0\" and \"2\" are in the same level in the graph (they would have been returned in the same call to :meth:`~TopologicalSorter.get_ready`) and the order between them is determined by the order of insertion." +#: ../../library/graphlib.rst:194 +msgid "" +"This is due to the fact that \"0\" and \"2\" are in the same level in the " +"graph (they would have been returned in the same call " +"to :meth:`~TopologicalSorter.get_ready`) and the order between them is " +"determined by the order of insertion." msgstr "" +#: ../../library/graphlib.rst:200 msgid "If any cycle is detected, :exc:`CycleError` will be raised." msgstr "" +#: ../../library/graphlib.rst:206 msgid "Exceptions" msgstr "" +#: ../../library/graphlib.rst:207 msgid "The :mod:`!graphlib` module defines the following exception classes:" msgstr "" -msgid "Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if cycles exist in the working graph. If multiple cycles exist, only one undefined choice among them will be reported and included in the exception." +#: ../../library/graphlib.rst:211 +msgid "" +"Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if " +"cycles exist in the working graph. If multiple cycles exist, only one " +"undefined choice among them will be reported and included in the exception." msgstr "" -msgid "The detected cycle can be accessed via the second element in the :attr:`~BaseException.args` attribute of the exception instance and consists in a list of nodes, such that each node is, in the graph, an immediate predecessor of the next node in the list. In the reported list, the first and the last node will be the same, to make it clear that it is cyclic." +#: ../../library/graphlib.rst:215 +msgid "" +"The detected cycle can be accessed via the second element in " +"the :attr:`~BaseException.args` attribute of the exception instance and " +"consists in a list of nodes, such that each node is, in the graph, an " +"immediate predecessor of the next node in the list. In the reported list, " +"the first and the last node will be the same, to make it clear that it is " +"cyclic." msgstr "" diff --git a/library/grp.po b/library/grp.po index e9877e110..d413577c4 100644 --- a/library/grp.po +++ b/library/grp.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,83 +24,127 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/grp.rst:2 msgid ":mod:`!grp` --- The group database" msgstr "" -msgid "This module provides access to the Unix group database. It is available on all Unix versions." +#: ../../library/grp.rst:9 +msgid "" +"This module provides access to the Unix group database. It is available on " +"all Unix versions." msgstr "" +#: ../../library/grp.rst:12 msgid "Availability" msgstr "" -msgid "Group database entries are reported as a tuple-like object, whose attributes correspond to the members of the ``group`` structure (Attribute field below, see ````):" +#: ../../library/grp.rst:14 +msgid "" +"Group database entries are reported as a tuple-like object, whose attributes " +"correspond to the members of the ``group`` structure (Attribute field below, " +"see ````):" msgstr "" +#: ../../library/grp.rst:19 msgid "Index" msgstr "" +#: ../../library/grp.rst:19 msgid "Attribute" msgstr "" +#: ../../library/grp.rst:19 msgid "Meaning" msgstr "" +#: ../../library/grp.rst:21 msgid "0" msgstr "" +#: ../../library/grp.rst:21 msgid "gr_name" msgstr "" +#: ../../library/grp.rst:21 msgid "the name of the group" msgstr "" +#: ../../library/grp.rst:23 msgid "1" msgstr "" +#: ../../library/grp.rst:23 msgid "gr_passwd" msgstr "" +#: ../../library/grp.rst:23 msgid "the (encrypted) group password; often empty" msgstr "" +#: ../../library/grp.rst:26 msgid "2" msgstr "" +#: ../../library/grp.rst:26 msgid "gr_gid" msgstr "" +#: ../../library/grp.rst:26 msgid "the numerical group ID" msgstr "" +#: ../../library/grp.rst:28 msgid "3" msgstr "" +#: ../../library/grp.rst:28 msgid "gr_mem" msgstr "" +#: ../../library/grp.rst:28 msgid "all the group member's user names" msgstr "" -msgid "The gid is an integer, name and password are strings, and the member list is a list of strings. (Note that most users are not explicitly listed as members of the group they are in according to the password database. Check both databases to get complete membership information. Also note that a ``gr_name`` that starts with a ``+`` or ``-`` is likely to be a YP/NIS reference and may not be accessible via :func:`getgrnam` or :func:`getgrgid`.)" +#: ../../library/grp.rst:32 +msgid "" +"The gid is an integer, name and password are strings, and the member list is " +"a list of strings. (Note that most users are not explicitly listed as " +"members of the group they are in according to the password database. Check " +"both databases to get complete membership information. Also note that a " +"``gr_name`` that starts with a ``+`` or ``-`` is likely to be a YP/NIS " +"reference and may not be accessible via :func:`getgrnam` " +"or :func:`getgrgid`.)" msgstr "" +#: ../../library/grp.rst:39 msgid "It defines the following items:" msgstr "" -msgid "Return the group database entry for the given numeric group ID. :exc:`KeyError` is raised if the entry asked for cannot be found." +#: ../../library/grp.rst:44 +msgid "" +"Return the group database entry for the given numeric group " +"ID. :exc:`KeyError` is raised if the entry asked for cannot be found." msgstr "" -msgid ":exc:`TypeError` is raised for non-integer arguments like floats or strings." +#: ../../library/grp.rst:47 +msgid "" +":exc:`TypeError` is raised for non-integer arguments like floats or strings." msgstr "" -msgid "Return the group database entry for the given group name. :exc:`KeyError` is raised if the entry asked for cannot be found." +#: ../../library/grp.rst:52 +msgid "" +"Return the group database entry for the given group name. :exc:`KeyError` is " +"raised if the entry asked for cannot be found." msgstr "" +#: ../../library/grp.rst:58 msgid "Return a list of all available group entries, in arbitrary order." msgstr "" +#: ../../library/grp.rst:63 msgid "Module :mod:`pwd`" msgstr "" +#: ../../library/grp.rst:64 msgid "An interface to the user database, similar to this." msgstr "" diff --git a/library/gzip.po b/library/gzip.po index e7b65db06..07cc36b6b 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,168 +23,338 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/gzip.rst:2 msgid ":mod:`!gzip` --- Support for :program:`gzip` files" msgstr "" +#: ../../library/gzip.rst:7 msgid "**Source code:** :source:`Lib/gzip.py`" msgstr "" -msgid "This module provides a simple interface to compress and decompress files just like the GNU programs :program:`gzip` and :program:`gunzip` would." +#: ../../library/gzip.rst:11 +msgid "" +"This module provides a simple interface to compress and decompress files " +"just like the GNU programs :program:`gzip` and :program:`gunzip` would." msgstr "" -msgid "This is an :term:`optional module`. If it is missing from your copy of CPython, look for documentation from your distributor (that is, whoever provided Python to you). If you are the distributor, see :ref:`optional-module-requirements`." +#: ../../includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" +#: ../../library/gzip.rst:16 msgid "The data compression is provided by the :mod:`zlib` module." msgstr "" -msgid "The :mod:`!gzip` module provides the :class:`GzipFile` class, as well as the :func:`.open`, :func:`compress` and :func:`decompress` convenience functions. The :class:`GzipFile` class reads and writes :program:`gzip`\\ -format files, automatically compressing or decompressing the data so that it looks like an ordinary :term:`file object`." +#: ../../library/gzip.rst:18 +msgid "" +"The :mod:`!gzip` module provides the :class:`GzipFile` class, as well as " +"the :func:`.open`, :func:`compress` and :func:`decompress` convenience " +"functions. The :class:`GzipFile` class reads and writes :program:`gzip`\\ " +"-format files, automatically compressing or decompressing the data so that " +"it looks like an ordinary :term:`file object`." msgstr "" -msgid "Note that additional file formats which can be decompressed by the :program:`gzip` and :program:`gunzip` programs, such as those produced by :program:`compress` and :program:`pack`, are not supported by this module." +#: ../../library/gzip.rst:24 +msgid "" +"Note that additional file formats which can be decompressed by " +"the :program:`gzip` and :program:`gunzip` programs, such as those produced " +"by :program:`compress` and :program:`pack`, are not supported by this module." msgstr "" +#: ../../library/gzip.rst:28 msgid "The module defines the following items:" msgstr "" -msgid "Open a gzip-compressed file in binary or text mode, returning a :term:`file object`." +#: ../../library/gzip.rst:33 +msgid "" +"Open a gzip-compressed file in binary or text mode, returning a :term:`file " +"object`." msgstr "" -msgid "The *filename* argument can be an actual filename (a :class:`str` or :class:`bytes` object), or an existing file object to read from or write to." +#: ../../library/gzip.rst:36 +msgid "" +"The *filename* argument can be an actual filename (a :class:`str` " +"or :class:`bytes` object), or an existing file object to read from or write " +"to." msgstr "" -msgid "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, ``'w'``, ``'wb'``, ``'x'`` or ``'xb'`` for binary mode, or ``'rt'``, ``'at'``, ``'wt'``, or ``'xt'`` for text mode. The default is ``'rb'``." +#: ../../library/gzip.rst:39 +msgid "" +"The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, " +"``'w'``, ``'wb'``, ``'x'`` or ``'xb'`` for binary mode, or ``'rt'``, " +"``'at'``, ``'wt'``, or ``'xt'`` for text mode. The default is ``'rb'``." msgstr "" -msgid "The *compresslevel* argument is an integer from 0 to 9, as for the :class:`GzipFile` constructor." +#: ../../library/gzip.rst:43 +msgid "" +"The *compresslevel* argument is an integer from 0 to 9, as for " +"the :class:`GzipFile` constructor." msgstr "" -msgid "For binary mode, this function is equivalent to the :class:`GzipFile` constructor: ``GzipFile(filename, mode, compresslevel)``. In this case, the *encoding*, *errors* and *newline* arguments must not be provided." +#: ../../library/gzip.rst:46 +msgid "" +"For binary mode, this function is equivalent to the :class:`GzipFile` " +"constructor: ``GzipFile(filename, mode, compresslevel)``. In this case, the " +"*encoding*, *errors* and *newline* arguments must not be provided." msgstr "" -msgid "For text mode, a :class:`GzipFile` object is created, and wrapped in an :class:`io.TextIOWrapper` instance with the specified encoding, error handling behavior, and line ending(s)." +#: ../../library/gzip.rst:50 +msgid "" +"For text mode, a :class:`GzipFile` object is created, and wrapped in " +"an :class:`io.TextIOWrapper` instance with the specified encoding, error " +"handling behavior, and line ending(s)." msgstr "" -msgid "Added support for *filename* being a file object, support for text mode, and the *encoding*, *errors* and *newline* arguments." +#: ../../library/gzip.rst:54 +msgid "" +"Added support for *filename* being a file object, support for text mode, and " +"the *encoding*, *errors* and *newline* arguments." msgstr "" +#: ../../library/gzip.rst:58 msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "" +#: ../../library/gzip.rst:61 ../../library/gzip.rst:175 msgid "Accepts a :term:`path-like object`." msgstr "" -msgid "An exception raised for invalid gzip files. It inherits from :exc:`OSError`. :exc:`EOFError` and :exc:`zlib.error` can also be raised for invalid gzip files." +#: ../../library/gzip.rst:66 +msgid "" +"An exception raised for invalid gzip files. It inherits " +"from :exc:`OSError`. :exc:`EOFError` and :exc:`zlib.error` can also be " +"raised for invalid gzip files." msgstr "" -msgid "Constructor for the :class:`GzipFile` class, which simulates most of the methods of a :term:`file object`, with the exception of the :meth:`~io.IOBase.truncate` method. At least one of *fileobj* and *filename* must be given a non-trivial value." +#: ../../library/gzip.rst:74 +msgid "" +"Constructor for the :class:`GzipFile` class, which simulates most of the " +"methods of a :term:`file object`, with the exception of " +"the :meth:`~io.IOBase.truncate` method. At least one of *fileobj* and " +"*filename* must be given a non-trivial value." msgstr "" -msgid "The new class instance is based on *fileobj*, which can be a regular file, an :class:`io.BytesIO` object, or any other object which simulates a file. It defaults to ``None``, in which case *filename* is opened to provide a file object." +#: ../../library/gzip.rst:79 +msgid "" +"The new class instance is based on *fileobj*, which can be a regular file, " +"an :class:`io.BytesIO` object, or any other object which simulates a file. " +"It defaults to ``None``, in which case *filename* is opened to provide a " +"file object." msgstr "" -msgid "When *fileobj* is not ``None``, the *filename* argument is only used to be included in the :program:`gzip` file header, which may include the original filename of the uncompressed file. It defaults to the filename of *fileobj*, if discernible; otherwise, it defaults to the empty string, and in this case the original filename is not included in the header." +#: ../../library/gzip.rst:84 +msgid "" +"When *fileobj* is not ``None``, the *filename* argument is only used to be " +"included in the :program:`gzip` file header, which may include the original " +"filename of the uncompressed file. It defaults to the filename of " +"*fileobj*, if discernible; otherwise, it defaults to the empty string, and " +"in this case the original filename is not included in the header." msgstr "" -msgid "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, ``'w'``, ``'wb'``, ``'x'``, or ``'xb'``, depending on whether the file will be read or written. The default is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``. In future Python releases the mode of *fileobj* will not be used. It is better to always specify *mode* for writing." +#: ../../library/gzip.rst:90 +msgid "" +"The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, " +"``'w'``, ``'wb'``, ``'x'``, or ``'xb'``, depending on whether the file will " +"be read or written. The default is the mode of *fileobj* if discernible; " +"otherwise, the default is ``'rb'``. In future Python releases the mode of " +"*fileobj* will not be used. It is better to always specify *mode* for " +"writing." msgstr "" -msgid "Note that the file is always opened in binary mode. To open a compressed file in text mode, use :func:`.open` (or wrap your :class:`GzipFile` with an :class:`io.TextIOWrapper`)." +#: ../../library/gzip.rst:96 +msgid "" +"Note that the file is always opened in binary mode. To open a compressed " +"file in text mode, use :func:`.open` (or wrap your :class:`GzipFile` with " +"an :class:`io.TextIOWrapper`)." msgstr "" -msgid "The *compresslevel* argument is an integer from ``0`` to ``9`` controlling the level of compression; ``1`` is fastest and produces the least compression, and ``9`` is slowest and produces the most compression. ``0`` is no compression. The default is ``9``." +#: ../../library/gzip.rst:100 +msgid "" +"The *compresslevel* argument is an integer from ``0`` to ``9`` controlling " +"the level of compression; ``1`` is fastest and produces the least " +"compression, and ``9`` is slowest and produces the most compression. ``0`` " +"is no compression. The default is ``9``." msgstr "" -msgid "The optional *mtime* argument is the timestamp requested by gzip. The time is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. If *mtime* is omitted or ``None``, the current time is used. Use *mtime* = 0 to generate a compressed stream that does not depend on creation time." +#: ../../library/gzip.rst:105 +msgid "" +"The optional *mtime* argument is the timestamp requested by gzip. The time " +"is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. If " +"*mtime* is omitted or ``None``, the current time is used. Use *mtime* = 0 to " +"generate a compressed stream that does not depend on creation time." msgstr "" -msgid "See below for the :attr:`mtime` attribute that is set when decompressing." +#: ../../library/gzip.rst:110 +msgid "" +"See below for the :attr:`mtime` attribute that is set when decompressing." msgstr "" -msgid "Calling a :class:`GzipFile` object's :meth:`!close` method does not close *fileobj*, since you might wish to append more material after the compressed data. This also allows you to pass an :class:`io.BytesIO` object opened for writing as *fileobj*, and retrieve the resulting memory buffer using the :class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." +#: ../../library/gzip.rst:112 +msgid "" +"Calling a :class:`GzipFile` object's :meth:`!close` method does not close " +"*fileobj*, since you might wish to append more material after the compressed " +"data. This also allows you to pass an :class:`io.BytesIO` object opened for " +"writing as *fileobj*, and retrieve the resulting memory buffer using " +"the :class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." msgstr "" -msgid ":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, including iteration and the :keyword:`with` statement. Only the :meth:`~io.IOBase.truncate` method isn't implemented." +#: ../../library/gzip.rst:118 +msgid "" +":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, " +"including iteration and the :keyword:`with` statement. Only " +"the :meth:`~io.IOBase.truncate` method isn't implemented." msgstr "" +#: ../../library/gzip.rst:122 msgid ":class:`GzipFile` also provides the following method and attribute:" msgstr "" -msgid "Read *n* uncompressed bytes without advancing the file position. The number of bytes returned may be more or less than requested." +#: ../../library/gzip.rst:126 +msgid "" +"Read *n* uncompressed bytes without advancing the file position. The number " +"of bytes returned may be more or less than requested." msgstr "" -msgid "While calling :meth:`peek` does not change the file position of the :class:`GzipFile`, it may change the position of the underlying file object (e.g. if the :class:`GzipFile` was constructed with the *fileobj* parameter)." +#: ../../library/gzip.rst:129 +msgid "" +"While calling :meth:`peek` does not change the file position of " +"the :class:`GzipFile`, it may change the position of the underlying file " +"object (e.g. if the :class:`GzipFile` was constructed with the *fileobj* " +"parameter)." msgstr "" +#: ../../library/gzip.rst:138 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" +#: ../../library/gzip.rst:140 msgid "In previous versions it was an integer ``1`` or ``2``." msgstr "" -msgid "When decompressing, this attribute is set to the last timestamp in the most recently read header. It is an integer, holding the number of seconds since the Unix epoch (00:00:00 UTC, January 1, 1970). The initial value before reading any headers is ``None``." +#: ../../library/gzip.rst:145 +msgid "" +"When decompressing, this attribute is set to the last timestamp in the most " +"recently read header. It is an integer, holding the number of seconds since " +"the Unix epoch (00:00:00 UTC, January 1, 1970). The initial value before " +"reading any headers is ``None``." msgstr "" -msgid "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. Equivalent to the output of :func:`os.fspath` on the original input path, with no other normalization, resolution or expansion." +#: ../../library/gzip.rst:152 +msgid "" +"The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " +"Equivalent to the output of :func:`os.fspath` on the original input path, " +"with no other normalization, resolution or expansion." msgstr "" -msgid "Support for the :keyword:`with` statement was added, along with the *mtime* constructor argument and :attr:`mtime` attribute." +#: ../../library/gzip.rst:156 +msgid "" +"Support for the :keyword:`with` statement was added, along with the *mtime* " +"constructor argument and :attr:`mtime` attribute." msgstr "" +#: ../../library/gzip.rst:160 msgid "Support for zero-padded and unseekable files was added." msgstr "" +#: ../../library/gzip.rst:163 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." msgstr "" +#: ../../library/gzip.rst:166 msgid "Added support for the ``'x'`` and ``'xb'`` modes." msgstr "" -msgid "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument of ``None``." +#: ../../library/gzip.rst:169 +msgid "" +"Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " +"of ``None``." msgstr "" -msgid "Opening :class:`GzipFile` for writing without specifying the *mode* argument is deprecated." +#: ../../library/gzip.rst:178 +msgid "" +"Opening :class:`GzipFile` for writing without specifying the *mode* argument " +"is deprecated." msgstr "" -msgid "Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute instead." +#: ../../library/gzip.rst:182 +msgid "" +"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " +"instead." msgstr "" -msgid "Compress the *data*, returning a :class:`bytes` object containing the compressed data. *compresslevel* and *mtime* have the same meaning as in the :class:`GzipFile` constructor above, but *mtime* defaults to 0 for reproducible output." +#: ../../library/gzip.rst:189 +msgid "" +"Compress the *data*, returning a :class:`bytes` object containing the " +"compressed data. *compresslevel* and *mtime* have the same meaning as in " +"the :class:`GzipFile` constructor above, but *mtime* defaults to 0 for " +"reproducible output." msgstr "" +#: ../../library/gzip.rst:195 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -msgid "Speed is improved by compressing all data at once instead of in a streamed fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib.compress` for better speed. In this situation the output may contain a gzip header \"OS\" byte value other than 255 \"unknown\" as supplied by the underlying zlib implementation." +#: ../../library/gzip.rst:197 +msgid "" +"Speed is improved by compressing all data at once instead of in a streamed " +"fashion. Calls with *mtime* set to ``0`` are delegated " +"to :func:`zlib.compress` for better speed. In this situation the output may " +"contain a gzip header \"OS\" byte value other than 255 \"unknown\" as " +"supplied by the underlying zlib implementation." msgstr "" -msgid "The gzip header OS byte is guaranteed to be set to 255 when this function is used as was the case in 3.10 and earlier." +#: ../../library/gzip.rst:204 +msgid "" +"The gzip header OS byte is guaranteed to be set to 255 when this function is " +"used as was the case in 3.10 and earlier." msgstr "" -msgid "The *mtime* parameter now defaults to 0 for reproducible output. For the previous behaviour of using the current time, pass ``None`` to *mtime*." +#: ../../library/gzip.rst:207 +msgid "" +"The *mtime* parameter now defaults to 0 for reproducible output. For the " +"previous behaviour of using the current time, pass ``None`` to *mtime*." msgstr "" -msgid "Decompress the *data*, returning a :class:`bytes` object containing the uncompressed data. This function is capable of decompressing multi-member gzip data (multiple gzip blocks concatenated together). When the data is certain to contain only one member the :func:`zlib.decompress` function with *wbits* set to 31 is faster." +#: ../../library/gzip.rst:214 +msgid "" +"Decompress the *data*, returning a :class:`bytes` object containing the " +"uncompressed data. This function is capable of decompressing multi-member " +"gzip data (multiple gzip blocks concatenated together). When the data is " +"certain to contain only one member the :func:`zlib.decompress` function with " +"*wbits* set to 31 is faster." msgstr "" -msgid "Speed is improved by decompressing members at once in memory instead of in a streamed fashion." +#: ../../library/gzip.rst:221 +msgid "" +"Speed is improved by decompressing members at once in memory instead of in a " +"streamed fashion." msgstr "" +#: ../../library/gzip.rst:228 msgid "Examples of usage" msgstr "" +#: ../../library/gzip.rst:230 msgid "Example of how to read a compressed file::" msgstr "" +#: ../../library/gzip.rst:232 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" msgstr "" +#: ../../library/gzip.rst:236 msgid "Example of how to create a compressed GZIP file::" msgstr "" +#: ../../library/gzip.rst:238 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -192,9 +362,11 @@ msgid "" " f.write(content)" msgstr "" +#: ../../library/gzip.rst:243 msgid "Example of how to GZIP compress an existing file::" msgstr "" +#: ../../library/gzip.rst:245 msgid "" "import gzip\n" "import shutil\n" @@ -203,50 +375,73 @@ msgid "" " shutil.copyfileobj(f_in, f_out)" msgstr "" +#: ../../library/gzip.rst:251 msgid "Example of how to GZIP compress a binary string::" msgstr "" +#: ../../library/gzip.rst:253 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" msgstr "" +#: ../../library/gzip.rst:259 msgid "Module :mod:`zlib`" msgstr "" -msgid "The basic data compression module needed to support the :program:`gzip` file format." +#: ../../library/gzip.rst:260 +msgid "" +"The basic data compression module needed to support the :program:`gzip` file " +"format." msgstr "" -msgid "In case gzip (de)compression is a bottleneck, the `python-isal`_ package speeds up (de)compression with a mostly compatible API." +#: ../../library/gzip.rst:263 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." msgstr "" +#: ../../library/gzip.rst:273 msgid "Command-line interface" msgstr "" -msgid "The :mod:`!gzip` module provides a simple command line interface to compress or decompress files." +#: ../../library/gzip.rst:275 +msgid "" +"The :mod:`!gzip` module provides a simple command line interface to compress " +"or decompress files." msgstr "" +#: ../../library/gzip.rst:278 msgid "Once executed the :mod:`!gzip` module keeps the input file(s)." msgstr "" -msgid "Add a new command line interface with a usage. By default, when you will execute the CLI, the default compression level is 6." +#: ../../library/gzip.rst:282 +msgid "" +"Add a new command line interface with a usage. By default, when you will " +"execute the CLI, the default compression level is 6." msgstr "" +#: ../../library/gzip.rst:286 msgid "Command-line options" msgstr "" +#: ../../library/gzip.rst:290 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "" +#: ../../library/gzip.rst:294 msgid "Indicates the fastest compression method (less compression)." msgstr "" +#: ../../library/gzip.rst:298 msgid "Indicates the slowest compression method (best compression)." msgstr "" +#: ../../library/gzip.rst:302 msgid "Decompress the given file." msgstr "" +#: ../../library/gzip.rst:306 msgid "Show the help message." msgstr "" diff --git a/library/hashlib.po b/library/hashlib.po index 0ace06831..15c184500 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -16,7 +16,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -26,362 +26,677 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/hashlib.rst:2 msgid ":mod:`!hashlib` --- Secure hashes and message digests" msgstr "" +#: ../../library/hashlib.rst:10 msgid "**Source code:** :source:`Lib/hashlib.py`" msgstr "" -msgid "This module implements a common interface to many different hash algorithms. Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512, (defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the FIPS 202 standard`_) as well as the legacy algorithms SHA1 (`formerly part of FIPS`_) and the MD5 algorithm (defined in internet :rfc:`1321`)." +#: ../../library/hashlib.rst:23 +msgid "" +"This module implements a common interface to many different hash algorithms. " +"Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512, " +"(defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the " +"FIPS 202 standard`_) as well as the legacy algorithms SHA1 (`formerly part " +"of FIPS`_) and the MD5 algorithm (defined in internet :rfc:`1321`)." msgstr "" -msgid "If you want the adler32 or crc32 hash functions, they are available in the :mod:`zlib` module." +#: ../../library/hashlib.rst:31 +msgid "" +"If you want the adler32 or crc32 hash functions, they are available in " +"the :mod:`zlib` module." msgstr "" +#: ../../library/hashlib.rst:38 msgid "Hash algorithms" msgstr "" -msgid "There is one constructor method named for each type of :dfn:`hash`. All return a hash object with the same simple interface. For example: use :func:`sha256` to create a SHA-256 hash object. You can now feed this object with :term:`bytes-like objects ` (normally :class:`bytes`) using the :meth:`update` method. At any point you can ask it for the :dfn:`digest` of the concatenation of the data fed to it so far using the :meth:`digest()` or :meth:`hexdigest()` methods." +#: ../../library/hashlib.rst:40 +msgid "" +"There is one constructor method named for each type of :dfn:`hash`. All " +"return a hash object with the same simple interface. For example: " +"use :func:`sha256` to create a SHA-256 hash object. You can now feed this " +"object with :term:`bytes-like objects ` " +"(normally :class:`bytes`) using the :meth:`update` method. At " +"any point you can ask it for the :dfn:`digest` of the concatenation of the " +"data fed to it so far using the :meth:`digest()` " +"or :meth:`hexdigest()` methods." msgstr "" -msgid "To allow multithreading, the Python :term:`GIL` is released while computing a hash supplied more than 2047 bytes of data at once in its constructor or :meth:`.update` method." +#: ../../library/hashlib.rst:48 +msgid "" +"To allow multithreading, the Python :term:`GIL` is released while computing " +"a hash supplied more than 2047 bytes of data at once in its constructor " +"or :meth:`.update` method." msgstr "" -msgid "Constructors for hash algorithms that are always present in this module are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, and :func:`blake2s`. :func:`md5` is normally available as well, though it may be missing or blocked if you are using a rare \"FIPS compliant\" build of Python. These correspond to :data:`algorithms_guaranteed`." +#: ../../library/hashlib.rst:55 +msgid "" +"Constructors for hash algorithms that are always present in this module " +"are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, " +"and :func:`blake2s`. :func:`md5` is normally available as well, though it " +"may be missing or blocked if you are using a rare \"FIPS compliant\" build " +"of Python. These correspond to :data:`algorithms_guaranteed`." msgstr "" -msgid "Additional algorithms may also be available if your Python distribution's :mod:`!hashlib` was linked against a build of OpenSSL that provides others. Others *are not guaranteed available* on all installations and will only be accessible by name via :func:`new`. See :data:`algorithms_available`." +#: ../../library/hashlib.rst:63 +msgid "" +"Additional algorithms may also be available if your Python " +"distribution's :mod:`!hashlib` was linked against a build of OpenSSL that " +"provides others. Others *are not guaranteed available* on all installations " +"and will only be accessible by name via :func:`new`. " +"See :data:`algorithms_available`." msgstr "" -msgid "Some algorithms have known hash collision weaknesses (including MD5 and SHA1). Refer to `Attacks on cryptographic hash algorithms`_ and the `hashlib-seealso`_ section at the end of this document." +#: ../../library/hashlib.rst:70 +msgid "" +"Some algorithms have known hash collision weaknesses (including MD5 and " +"SHA1). Refer to `Attacks on cryptographic hash algorithms`_ and the `hashlib-" +"seealso`_ section at the end of this document." msgstr "" -msgid "SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were added. :func:`blake2b` and :func:`blake2s` were added." +#: ../../library/hashlib.rst:74 +msgid "" +"SHA3 (Keccak) and SHAKE " +"constructors :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` " +"were added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" -msgid "All hashlib constructors take a keyword-only argument *usedforsecurity* with default value ``True``. A false value allows the use of insecure and blocked hashing algorithms in restricted environments. ``False`` indicates that the hashing algorithm is not used in a security context, e.g. as a non-cryptographic one-way compression function." +#: ../../library/hashlib.rst:82 +msgid "" +"All hashlib constructors take a keyword-only argument *usedforsecurity* with " +"default value ``True``. A false value allows the use of insecure and blocked " +"hashing algorithms in restricted environments. ``False`` indicates that the " +"hashing algorithm is not used in a security context, e.g. as a non-" +"cryptographic one-way compression function." msgstr "" +#: ../../library/hashlib.rst:89 msgid "Hashlib now uses SHA3 and SHAKE from OpenSSL if it provides it." msgstr "" -msgid "For any of the MD5, SHA1, SHA2, or SHA3 algorithms that the linked OpenSSL does not provide we fall back to a verified implementation from the `HACL\\* project`_." +#: ../../library/hashlib.rst:92 +msgid "" +"For any of the MD5, SHA1, SHA2, or SHA3 algorithms that the linked OpenSSL " +"does not provide we fall back to a verified implementation from the `HACL\\* " +"project`_." msgstr "" +#: ../../library/hashlib.rst:98 msgid "Usage" msgstr "" -msgid "To obtain the digest of the byte string ``b\"Nobody inspects the spammish repetition\"``::" +#: ../../library/hashlib.rst:100 +msgid "" +"To obtain the digest of the byte string ``b\"Nobody inspects the spammish " +"repetition\"``::" msgstr "" +#: ../../library/hashlib.rst:103 msgid "" ">>> import hashlib\n" ">>> m = hashlib.sha256()\n" ">>> m.update(b\"Nobody inspects\")\n" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" -"b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" msgstr "" +#: ../../library/hashlib.rst:112 msgid "More condensed:" msgstr "" +#: ../../library/hashlib.rst:118 msgid "Constructors" msgstr "" -msgid "Is a generic constructor that takes the string *name* of the desired algorithm as its first parameter. It also exists to allow access to the above listed hashes as well as any other algorithms that your OpenSSL library may offer." +#: ../../library/hashlib.rst:122 +msgid "" +"Is a generic constructor that takes the string *name* of the desired " +"algorithm as its first parameter. It also exists to allow access to the " +"above listed hashes as well as any other algorithms that your OpenSSL " +"library may offer." msgstr "" +#: ../../library/hashlib.rst:127 msgid "Using :func:`new` with an algorithm name:" msgstr "" -msgid "Named constructors such as these are faster than passing an algorithm name to :func:`new`." +#: ../../library/hashlib.rst:146 +msgid "" +"Named constructors such as these are faster than passing an algorithm name " +"to :func:`new`." msgstr "" +#: ../../library/hashlib.rst:150 msgid "Attributes" msgstr "" +#: ../../library/hashlib.rst:152 msgid "Hashlib provides the following constant module attributes:" msgstr "" -msgid "A set containing the names of the hash algorithms guaranteed to be supported by this module on all platforms. Note that 'md5' is in this list despite some upstream vendors offering an odd \"FIPS compliant\" Python build that excludes it." +#: ../../library/hashlib.rst:156 +msgid "" +"A set containing the names of the hash algorithms guaranteed to be supported " +"by this module on all platforms. Note that 'md5' is in this list despite " +"some upstream vendors offering an odd \"FIPS compliant\" Python build that " +"excludes it." msgstr "" -msgid "A set containing the names of the hash algorithms that are available in the running Python interpreter. These names will be recognized when passed to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The same algorithm may appear multiple times in this set under different names (thanks to OpenSSL)." +#: ../../library/hashlib.rst:165 +msgid "" +"A set containing the names of the hash algorithms that are available in the " +"running Python interpreter. These names will be recognized when passed " +"to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " +"same algorithm may appear multiple times in this set under different names " +"(thanks to OpenSSL)." msgstr "" +#: ../../library/hashlib.rst:174 msgid "Hash Objects" msgstr "" -msgid "The following values are provided as constant attributes of the hash objects returned by the constructors:" +#: ../../library/hashlib.rst:176 +msgid "" +"The following values are provided as constant attributes of the hash objects " +"returned by the constructors:" msgstr "" +#: ../../library/hashlib.rst:181 msgid "The size of the resulting hash in bytes." msgstr "" +#: ../../library/hashlib.rst:185 msgid "The internal block size of the hash algorithm in bytes." msgstr "" +#: ../../library/hashlib.rst:187 msgid "A hash object has the following attributes:" msgstr "" -msgid "The canonical name of this hash, always lowercase and always suitable as a parameter to :func:`new` to create another hash of this type." +#: ../../library/hashlib.rst:191 +msgid "" +"The canonical name of this hash, always lowercase and always suitable as a " +"parameter to :func:`new` to create another hash of this type." msgstr "" -msgid "The name attribute has been present in CPython since its inception, but until Python 3.4 was not formally specified, so may not exist on some platforms." +#: ../../library/hashlib.rst:194 +msgid "" +"The name attribute has been present in CPython since its inception, but " +"until Python 3.4 was not formally specified, so may not exist on some " +"platforms." msgstr "" +#: ../../library/hashlib.rst:199 msgid "A hash object has the following methods:" msgstr "" -msgid "Update the hash object with the :term:`bytes-like object`. Repeated calls are equivalent to a single call with the concatenation of all the arguments: ``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." +#: ../../library/hashlib.rst:204 +msgid "" +"Update the hash object with the :term:`bytes-like object`. Repeated calls " +"are equivalent to a single call with the concatenation of all the arguments: " +"``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" -msgid "Return the digest of the data passed to the :meth:`update` method so far. This is a bytes object of size :attr:`digest_size` which may contain bytes in the whole range from 0 to 255." +#: ../../library/hashlib.rst:212 +msgid "" +"Return the digest of the data passed to the :meth:`update` method so far. " +"This is a bytes object of size :attr:`digest_size` which may contain bytes " +"in the whole range from 0 to 255." msgstr "" -msgid "Like :meth:`digest` except the digest is returned as a string object of double length, containing only hexadecimal digits. This may be used to exchange the value safely in email or other non-binary environments." +#: ../../library/hashlib.rst:219 +msgid "" +"Like :meth:`digest` except the digest is returned as a string object of " +"double length, containing only hexadecimal digits. This may be used to " +"exchange the value safely in email or other non-binary environments." msgstr "" -msgid "Return a copy (\"clone\") of the hash object. This can be used to efficiently compute the digests of data sharing a common initial substring." +#: ../../library/hashlib.rst:226 +msgid "" +"Return a copy (\"clone\") of the hash object. This can be used to " +"efficiently compute the digests of data sharing a common initial substring." msgstr "" +#: ../../library/hashlib.rst:231 msgid "SHAKE variable length digests" msgstr "" -msgid "The :func:`shake_128` and :func:`shake_256` algorithms provide variable length digests with length_in_bits//2 up to 128 or 256 bits of security. As such, their digest methods require a length. Maximum length is not limited by the SHAKE algorithm." +#: ../../library/hashlib.rst:236 +msgid "" +"The :func:`shake_128` and :func:`shake_256` algorithms provide variable " +"length digests with length_in_bits//2 up to 128 or 256 bits of security. As " +"such, their digest methods require a length. Maximum length is not limited " +"by the SHAKE algorithm." msgstr "" -msgid "Return the digest of the data passed to the :meth:`~hash.update` method so far. This is a bytes object of size *length* which may contain bytes in the whole range from 0 to 255." +#: ../../library/hashlib.rst:243 +msgid "" +"Return the digest of the data passed to the :meth:`~hash.update` method so " +"far. This is a bytes object of size *length* which may contain bytes in the " +"whole range from 0 to 255." msgstr "" -msgid "Like :meth:`digest` except the digest is returned as a string object of double length, containing only hexadecimal digits. This may be used to exchange the value in email or other non-binary environments." +#: ../../library/hashlib.rst:250 +msgid "" +"Like :meth:`digest` except the digest is returned as a string object of " +"double length, containing only hexadecimal digits. This may be used to " +"exchange the value in email or other non-binary environments." msgstr "" +#: ../../library/hashlib.rst:254 msgid "Example use:" msgstr "" +#: ../../library/hashlib.rst:261 msgid "File hashing" msgstr "" -msgid "The hashlib module provides a helper function for efficient hashing of a file or file-like object." +#: ../../library/hashlib.rst:263 +msgid "" +"The hashlib module provides a helper function for efficient hashing of a " +"file or file-like object." msgstr "" -msgid "Return a digest object that has been updated with contents of file object." +#: ../../library/hashlib.rst:268 +msgid "" +"Return a digest object that has been updated with contents of file object." msgstr "" -msgid "*fileobj* must be a file-like object opened for reading in binary mode. It accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` instances, SocketIO objects from :meth:`socket.socket.makefile`, and similar. *fileobj* must be opened in blocking mode, otherwise a :exc:`BlockingIOError` may be raised." +#: ../../library/hashlib.rst:270 +msgid "" +"*fileobj* must be a file-like object opened for reading in binary mode. It " +"accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " +"instances, SocketIO objects from :meth:`socket.socket.makefile`, and " +"similar. *fileobj* must be opened in blocking mode, otherwise " +"a :exc:`BlockingIOError` may be raised." msgstr "" -msgid "The function may bypass Python's I/O and use the file descriptor from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in an unknown state after this function returns or raises. It is up to the caller to close *fileobj*." +#: ../../library/hashlib.rst:276 +msgid "" +"The function may bypass Python's I/O and use the file descriptor " +"from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " +"an unknown state after this function returns or raises. It is up to the " +"caller to close *fileobj*." msgstr "" -msgid "*digest* must either be a hash algorithm name as a *str*, a hash constructor, or a callable that returns a hash object." +#: ../../library/hashlib.rst:281 +msgid "" +"*digest* must either be a hash algorithm name as a *str*, a hash " +"constructor, or a callable that returns a hash object." msgstr "" +#: ../../library/hashlib.rst:284 msgid "Example:" msgstr "" -msgid "Now raises a :exc:`BlockingIOError` if the file is opened in non-blocking mode. Previously, spurious null bytes were added to the digest." +#: ../../library/hashlib.rst:305 +msgid "" +"Now raises a :exc:`BlockingIOError` if the file is opened in non-blocking " +"mode. Previously, spurious null bytes were added to the digest." msgstr "" +#: ../../library/hashlib.rst:311 msgid "Key derivation" msgstr "" -msgid "Key derivation and key stretching algorithms are designed for secure password hashing. Naive algorithms such as ``sha1(password)`` are not resistant against brute-force attacks. A good password hashing function must be tunable, slow, and include a `salt `_." +#: ../../library/hashlib.rst:313 +msgid "" +"Key derivation and key stretching algorithms are designed for secure " +"password hashing. Naive algorithms such as ``sha1(password)`` are not " +"resistant against brute-force attacks. A good password hashing function must " +"be tunable, slow, and include a `salt `_." msgstr "" -msgid "The function provides PKCS#5 password-based key derivation function 2. It uses HMAC as pseudorandom function." +#: ../../library/hashlib.rst:321 +msgid "" +"The function provides PKCS#5 password-based key derivation function 2. It " +"uses HMAC as pseudorandom function." msgstr "" -msgid "The string *hash_name* is the desired name of the hash digest algorithm for HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as buffers of bytes. Applications and libraries should limit *password* to a sensible length (e.g. 1024). *salt* should be about 16 or more bytes from a proper source, e.g. :func:`os.urandom`." +#: ../../library/hashlib.rst:324 +msgid "" +"The string *hash_name* is the desired name of the hash digest algorithm for " +"HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as " +"buffers of bytes. Applications and libraries should limit *password* to a " +"sensible length (e.g. 1024). *salt* should be about 16 or more bytes from a " +"proper source, e.g. :func:`os.urandom`." msgstr "" -msgid "The number of *iterations* should be chosen based on the hash algorithm and computing power. As of 2022, hundreds of thousands of iterations of SHA-256 are suggested. For rationale as to why and how to choose what is best for your application, read *Appendix A.2.2* of NIST-SP-800-132_. The answers on the `stackexchange pbkdf2 iterations question`_ explain in detail." +#: ../../library/hashlib.rst:330 +msgid "" +"The number of *iterations* should be chosen based on the hash algorithm and " +"computing power. As of 2022, hundreds of thousands of iterations of SHA-256 " +"are suggested. For rationale as to why and how to choose what is best for " +"your application, read *Appendix A.2.2* of NIST-SP-800-132_. The answers on " +"the `stackexchange pbkdf2 iterations question`_ explain in detail." msgstr "" -msgid "*dklen* is the length of the derived key in bytes. If *dklen* is ``None`` then the digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512." +#: ../../library/hashlib.rst:336 +msgid "" +"*dklen* is the length of the derived key in bytes. If *dklen* is ``None`` " +"then the digest size of the hash algorithm *hash_name* is used, e.g. 64 for " +"SHA-512." msgstr "" +#: ../../library/hashlib.rst:345 msgid "Function only available when Python is compiled with OpenSSL." msgstr "" -msgid "Function now only available when Python is built with OpenSSL. The slow pure Python implementation has been removed." +#: ../../library/hashlib.rst:349 +msgid "" +"Function now only available when Python is built with OpenSSL. The slow pure " +"Python implementation has been removed." msgstr "" -msgid "The function provides scrypt password-based key derivation function as defined in :rfc:`7914`." +#: ../../library/hashlib.rst:355 +msgid "" +"The function provides scrypt password-based key derivation function as " +"defined in :rfc:`7914`." msgstr "" -msgid "*password* and *salt* must be :term:`bytes-like objects `. Applications and libraries should limit *password* to a sensible length (e.g. 1024). *salt* should be about 16 or more bytes from a proper source, e.g. :func:`os.urandom`." +#: ../../library/hashlib.rst:358 +msgid "" +"*password* and *salt* must be :term:`bytes-like objects `. Applications and libraries should limit *password* to a sensible " +"length (e.g. 1024). *salt* should be about 16 or more bytes from a proper " +"source, e.g. :func:`os.urandom`." msgstr "" -msgid "*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). *dklen* is the length of the derived key in bytes." +#: ../../library/hashlib.rst:363 +msgid "" +"*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization " +"factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). " +"*dklen* is the length of the derived key in bytes." msgstr "" +#: ../../library/hashlib.rst:373 msgid "BLAKE2" msgstr "" -msgid "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes in two flavors:" +#: ../../library/hashlib.rst:380 +msgid "" +"BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " +"in two flavors:" msgstr "" -msgid "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size between 1 and 64 bytes," +#: ../../library/hashlib.rst:383 +msgid "" +"**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " +"between 1 and 64 bytes," msgstr "" -msgid "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of any size between 1 and 32 bytes." +#: ../../library/hashlib.rst:386 +msgid "" +"**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " +"any size between 1 and 32 bytes." msgstr "" -msgid "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), **salted hashing**, **personalization**, and **tree hashing**." +#: ../../library/hashlib.rst:389 +msgid "" +"BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " +"**salted hashing**, **personalization**, and **tree hashing**." msgstr "" -msgid "Hash objects from this module follow the API of standard library's :mod:`!hashlib` objects." +#: ../../library/hashlib.rst:392 +msgid "" +"Hash objects from this module follow the API of standard library's :mod:`!" +"hashlib` objects." msgstr "" +#: ../../library/hashlib.rst:397 msgid "Creating hash objects" msgstr "" +#: ../../library/hashlib.rst:399 msgid "New hash objects are created by calling constructor functions:" msgstr "" -msgid "These functions return the corresponding hash objects for calculating BLAKE2b or BLAKE2s. They optionally take these general parameters:" +#: ../../library/hashlib.rst:413 +msgid "" +"These functions return the corresponding hash objects for calculating " +"BLAKE2b or BLAKE2s. They optionally take these general parameters:" msgstr "" -msgid "*data*: initial chunk of data to hash, which must be :term:`bytes-like object`. It can be passed only as positional argument." +#: ../../library/hashlib.rst:416 +msgid "" +"*data*: initial chunk of data to hash, which must be :term:`bytes-like " +"object`. It can be passed only as positional argument." msgstr "" +#: ../../library/hashlib.rst:419 msgid "*digest_size*: size of output digest in bytes." msgstr "" -msgid "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for BLAKE2s)." +#: ../../library/hashlib.rst:421 +msgid "" +"*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " +"BLAKE2s)." msgstr "" -msgid "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 bytes for BLAKE2s)." +#: ../../library/hashlib.rst:424 +msgid "" +"*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " +"bytes for BLAKE2s)." msgstr "" -msgid "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes for BLAKE2s)." +#: ../../library/hashlib.rst:427 +msgid "" +"*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " +"for BLAKE2s)." msgstr "" +#: ../../library/hashlib.rst:430 msgid "The following table shows limits for general parameters (in bytes):" msgstr "" +#: ../../library/hashlib.rst:433 msgid "Hash" msgstr "" +#: ../../library/hashlib.rst:433 msgid "digest_size" msgstr "" +#: ../../library/hashlib.rst:433 msgid "len(key)" msgstr "" +#: ../../library/hashlib.rst:433 msgid "len(salt)" msgstr "" +#: ../../library/hashlib.rst:433 msgid "len(person)" msgstr "" +#: ../../library/hashlib.rst:435 msgid "BLAKE2b" msgstr "" +#: ../../library/hashlib.rst:435 msgid "64" msgstr "" +#: ../../library/hashlib.rst:435 msgid "16" msgstr "" +#: ../../library/hashlib.rst:436 msgid "BLAKE2s" msgstr "" +#: ../../library/hashlib.rst:436 msgid "32" msgstr "" +#: ../../library/hashlib.rst:436 msgid "8" msgstr "" -msgid "BLAKE2 specification defines constant lengths for salt and personalization parameters, however, for convenience, this implementation accepts byte strings of any size up to the specified length. If the length of the parameter is less than specified, it is padded with zeros, thus, for example, ``b'salt'`` and ``b'salt\\x00'`` is the same value. (This is not the case for *key*.)" +#: ../../library/hashlib.rst:441 +msgid "" +"BLAKE2 specification defines constant lengths for salt and personalization " +"parameters, however, for convenience, this implementation accepts byte " +"strings of any size up to the specified length. If the length of the " +"parameter is less than specified, it is padded with zeros, thus, for " +"example, ``b'salt'`` and ``b'salt\\x00'`` is the same value. (This is not " +"the case for *key*.)" msgstr "" +#: ../../library/hashlib.rst:448 msgid "These sizes are available as module `constants`_ described below." msgstr "" -msgid "Constructor functions also accept the following tree hashing parameters:" +#: ../../library/hashlib.rst:450 +msgid "" +"Constructor functions also accept the following tree hashing parameters:" msgstr "" +#: ../../library/hashlib.rst:452 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "" -msgid "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential mode)." +#: ../../library/hashlib.rst:454 +msgid "" +"*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " +"mode)." msgstr "" -msgid "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited or in sequential mode)." +#: ../../library/hashlib.rst:457 +msgid "" +"*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " +"or in sequential mode)." msgstr "" -msgid "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." +#: ../../library/hashlib.rst:460 +msgid "" +"*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " +"for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." msgstr "" -msgid "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." +#: ../../library/hashlib.rst:463 +msgid "" +"*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "" -msgid "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 in sequential mode)." +#: ../../library/hashlib.rst:465 +msgid "" +"*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " +"in sequential mode)." msgstr "" -msgid "*last_node*: boolean indicating whether the processed node is the last one (``False`` for sequential mode)." +#: ../../library/hashlib.rst:468 +msgid "" +"*last_node*: boolean indicating whether the processed node is the last one " +"(``False`` for sequential mode)." msgstr "" +#: ../../library/hashlib.rst:471 msgid "Explanation of tree mode parameters." msgstr "" -msgid "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." +#: ../../library/hashlib.rst:475 +msgid "" +"See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." msgstr "" +#: ../../library/hashlib.rst:481 msgid "Constants" msgstr "" +#: ../../library/hashlib.rst:486 msgid "Salt length (maximum length accepted by constructors)." msgstr "" -msgid "Personalization string length (maximum length accepted by constructors)." +#: ../../library/hashlib.rst:492 +msgid "" +"Personalization string length (maximum length accepted by constructors)." msgstr "" +#: ../../library/hashlib.rst:498 msgid "Maximum key size." msgstr "" +#: ../../library/hashlib.rst:504 msgid "Maximum digest size that the hash function can output." msgstr "" +#: ../../library/hashlib.rst:508 msgid "Examples" msgstr "" +#: ../../library/hashlib.rst:511 msgid "Simple hashing" msgstr "" -msgid "To calculate hash of some data, you should first construct a hash object by calling the appropriate constructor function (:func:`blake2b` or :func:`blake2s`), then update it with the data by calling :meth:`~hash.update` on the object, and, finally, get the digest out of the object by calling :meth:`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." +#: ../../library/hashlib.rst:513 +msgid "" +"To calculate hash of some data, you should first construct a hash object by " +"calling the appropriate constructor function (:func:`blake2b` " +"or :func:`blake2s`), then update it with the data by " +"calling :meth:`~hash.update` on the object, and, finally, get the digest out " +"of the object by calling :meth:`~hash.digest` (or :meth:`~hash.hexdigest` " +"for hex-encoded string)." msgstr "" -msgid "As a shortcut, you can pass the first chunk of data to update directly to the constructor as the positional argument:" +#: ../../library/hashlib.rst:526 +msgid "" +"As a shortcut, you can pass the first chunk of data to update directly to " +"the constructor as the positional argument:" msgstr "" -msgid "You can call :meth:`hash.update` as many times as you need to iteratively update the hash:" +#: ../../library/hashlib.rst:533 +msgid "" +"You can call :meth:`hash.update` as many times as you need to iteratively " +"update the hash:" msgstr "" +#: ../../library/hashlib.rst:547 msgid "Using different digest sizes" msgstr "" -msgid "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to 32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without changing the size of output, we can tell BLAKE2b to produce 20-byte digests:" +#: ../../library/hashlib.rst:549 +msgid "" +"BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " +"32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " +"changing the size of output, we can tell BLAKE2b to produce 20-byte digests:" msgstr "" -msgid "Hash objects with different digest sizes have completely different outputs (shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s produce different outputs even if the output length is the same:" +#: ../../library/hashlib.rst:563 +msgid "" +"Hash objects with different digest sizes have completely different outputs " +"(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " +"produce different outputs even if the output length is the same:" msgstr "" +#: ../../library/hashlib.rst:579 msgid "Keyed hashing" msgstr "" -msgid "Keyed hashing can be used for authentication as a faster and simpler replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-MAC mode thanks to the indifferentiability property inherited from BLAKE." +#: ../../library/hashlib.rst:581 +msgid "" +"Keyed hashing can be used for authentication as a faster and simpler " +"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-" +"MAC mode thanks to the indifferentiability property inherited from BLAKE." msgstr "" -msgid "This example shows how to get a (hex-encoded) 128-bit authentication code for message ``b'message data'`` with key ``b'pseudorandom key'``::" +#: ../../library/hashlib.rst:587 +msgid "" +"This example shows how to get a (hex-encoded) 128-bit authentication code " +"for message ``b'message data'`` with key ``b'pseudorandom key'``::" msgstr "" +#: ../../library/hashlib.rst:590 msgid "" ">>> from hashlib import blake2b\n" ">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" @@ -390,9 +705,13 @@ msgid "" "'3d363ff7401e02026f4a4687d4863ced'" msgstr "" -msgid "As a practical example, a web application can symmetrically sign cookies sent to users and later verify them to make sure they weren't tampered with::" +#: ../../library/hashlib.rst:597 +msgid "" +"As a practical example, a web application can symmetrically sign cookies " +"sent to users and later verify them to make sure they weren't tampered with::" msgstr "" +#: ../../library/hashlib.rst:600 msgid "" ">>> from hashlib import blake2b\n" ">>> from hmac import compare_digest\n" @@ -421,9 +740,13 @@ msgid "" "False" msgstr "" -msgid "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be used in HMAC construction with :mod:`hmac` module::" +#: ../../library/hashlib.rst:626 +msgid "" +"Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " +"used in HMAC construction with :mod:`hmac` module::" msgstr "" +#: ../../library/hashlib.rst:629 msgid "" ">>> import hmac, hashlib\n" ">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" @@ -432,39 +755,90 @@ msgid "" "'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" msgstr "" +#: ../../library/hashlib.rst:637 msgid "Randomized hashing" msgstr "" -msgid "By setting *salt* parameter users can introduce randomization to the hash function. Randomized hashing is useful for protecting against collision attacks on the hash function used in digital signatures." -msgstr "" - -msgid "Randomized hashing is designed for situations where one party, the message preparer, generates all or part of a message to be signed by a second party, the message signer. If the message preparer is able to find cryptographic hash function collisions (i.e., two messages producing the same hash value), then they might prepare meaningful versions of the message that would produce the same hash value and digital signature, but with different results (e.g., transferring $1,000,000 to an account, rather than $10). Cryptographic hash functions have been designed with collision resistance as a major goal, but the current concentration on attacking cryptographic hash functions may result in a given cryptographic hash function providing less collision resistance than expected. Randomized hashing offers the signer additional protection by reducing the likelihood that a preparer can generate two or more messages that ultimately yield the same hash value during the digital signature generation process --- even if it is practical to find collisions for the hash function. However, the use of randomized hashing may reduce the amount of security provided by a digital signature when all portions of the message are prepared by the signer." +#: ../../library/hashlib.rst:639 +msgid "" +"By setting *salt* parameter users can introduce randomization to the hash " +"function. Randomized hashing is useful for protecting against collision " +"attacks on the hash function used in digital signatures." msgstr "" -msgid "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" +#: ../../library/hashlib.rst:643 +msgid "" +"Randomized hashing is designed for situations where one party, the message " +"preparer, generates all or part of a message to be signed by a second party, " +"the message signer. If the message preparer is able to find cryptographic " +"hash function collisions (i.e., two messages producing the same hash value), " +"then they might prepare meaningful versions of the message that would " +"produce the same hash value and digital signature, but with different " +"results (e.g., transferring $1,000,000 to an account, rather than $10). " +"Cryptographic hash functions have been designed with collision resistance as " +"a major goal, but the current concentration on attacking cryptographic hash " +"functions may result in a given cryptographic hash function providing less " +"collision resistance than expected. Randomized hashing offers the signer " +"additional protection by reducing the likelihood that a preparer can " +"generate two or more messages that ultimately yield the same hash value " +"during the digital signature generation process --- even if it is practical " +"to find collisions for the hash function. However, the use of randomized " +"hashing may reduce the amount of security provided by a digital signature " +"when all portions of the message are prepared by the signer." +msgstr "" + +#: ../../library/hashlib.rst:662 +msgid "" +"(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" msgstr "" -msgid "In BLAKE2 the salt is processed as a one-time input to the hash function during initialization, rather than as an input to each compression function." +#: ../../library/hashlib.rst:665 +msgid "" +"In BLAKE2 the salt is processed as a one-time input to the hash function " +"during initialization, rather than as an input to each compression function." msgstr "" -msgid "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose cryptographic hash function, such as SHA-256, is not suitable for hashing passwords. See `BLAKE2 FAQ `_ for more information." +#: ../../library/hashlib.rst:670 +msgid "" +"*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " +"cryptographic hash function, such as SHA-256, is not suitable for hashing " +"passwords. See `BLAKE2 FAQ `_ for more " +"information." msgstr "" +#: ../../library/hashlib.rst:693 msgid "Personalization" msgstr "" -msgid "Sometimes it is useful to force hash function to produce different digests for the same input for different purposes. Quoting the authors of the Skein hash function:" +#: ../../library/hashlib.rst:695 +msgid "" +"Sometimes it is useful to force hash function to produce different digests " +"for the same input for different purposes. Quoting the authors of the Skein " +"hash function:" msgstr "" -msgid "We recommend that all application designers seriously consider doing this; we have seen many protocols where a hash that is computed in one part of the protocol can be used in an entirely different part because two hash computations were done on similar or related data, and the attacker can force the application to make the hash inputs the same. Personalizing each hash function used in the protocol summarily stops this type of attack." +#: ../../library/hashlib.rst:699 +msgid "" +"We recommend that all application designers seriously consider doing this; " +"we have seen many protocols where a hash that is computed in one part of the " +"protocol can be used in an entirely different part because two hash " +"computations were done on similar or related data, and the attacker can " +"force the application to make the hash inputs the same. Personalizing each " +"hash function used in the protocol summarily stops this type of attack." msgstr "" -msgid "(`The Skein Hash Function Family `_, p. 21)" +#: ../../library/hashlib.rst:706 +msgid "" +"(`The Skein Hash Function Family `_, p. 21)" msgstr "" +#: ../../library/hashlib.rst:710 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "" +#: ../../library/hashlib.rst:712 msgid "" ">>> from hashlib import blake2b\n" ">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" @@ -479,24 +853,34 @@ msgid "" "'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" msgstr "" -msgid "Personalization together with the keyed mode can also be used to derive different keys from a single one." +#: ../../library/hashlib.rst:724 +msgid "" +"Personalization together with the keyed mode can also be used to derive " +"different keys from a single one." msgstr "" +#: ../../library/hashlib.rst:738 msgid "Tree mode" msgstr "" +#: ../../library/hashlib.rst:740 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "" +#: ../../library/hashlib.rst:742 msgid "" " 10\n" " / \\\n" "00 01" msgstr "" -msgid "This example uses 64-byte internal digests, and returns the 32-byte final digest::" +#: ../../library/hashlib.rst:746 +msgid "" +"This example uses 64-byte internal digests, and returns the 32-byte final " +"digest::" msgstr "" +#: ../../library/hashlib.rst:749 msgid "" ">>> from hashlib import blake2b\n" ">>>\n" @@ -525,95 +909,151 @@ msgid "" "'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" msgstr "" +#: ../../library/hashlib.rst:776 msgid "Credits" msgstr "" -msgid "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ created by *Jean-Philippe Aumasson*, *Luca Henzen*, *Willi Meier*, and *Raphael C.-W. Phan*." +#: ../../library/hashlib.rst:778 +msgid "" +"BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " +"Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " +"created by *Jean-Philippe Aumasson*, *Luca Henzen*, *Willi Meier*, and " +"*Raphael C.-W. Phan*." msgstr "" -msgid "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. Bernstein*." +#: ../../library/hashlib.rst:783 +msgid "" +"It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " +"Bernstein*." msgstr "" -msgid "The stdlib implementation is based on pyblake2_ module. It was written by *Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The documentation was copied from pyblake2_ and written by *Dmitry Chestnykh*." +#: ../../library/hashlib.rst:785 +msgid "" +"The stdlib implementation is based on pyblake2_ module. It was written by " +"*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " +"documentation was copied from pyblake2_ and written by *Dmitry Chestnykh*." msgstr "" +#: ../../library/hashlib.rst:789 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "" -msgid "The following public domain dedication applies for both C hash function implementation, extension code, and this documentation:" +#: ../../library/hashlib.rst:791 +msgid "" +"The following public domain dedication applies for both C hash function " +"implementation, extension code, and this documentation:" msgstr "" -msgid "To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty." +#: ../../library/hashlib.rst:794 +msgid "" +"To the extent possible under law, the author(s) have dedicated all copyright " +"and related and neighboring rights to this software to the public domain " +"worldwide. This software is distributed without any warranty." msgstr "" -msgid "You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see https://creativecommons.org/publicdomain/zero/1.0/." +#: ../../library/hashlib.rst:798 +msgid "" +"You should have received a copy of the CC0 Public Domain Dedication along " +"with this software. If not, see https://creativecommons.org/publicdomain/" +"zero/1.0/." msgstr "" -msgid "The following people have helped with development or contributed their changes to the project and the public domain according to the Creative Commons Public Domain Dedication 1.0 Universal:" +#: ../../library/hashlib.rst:802 +msgid "" +"The following people have helped with development or contributed their " +"changes to the project and the public domain according to the Creative " +"Commons Public Domain Dedication 1.0 Universal:" msgstr "" +#: ../../library/hashlib.rst:806 msgid "*Alexandr Sokolovskiy*" msgstr "" +#: ../../library/hashlib.rst:827 msgid "Module :mod:`hmac`" msgstr "" +#: ../../library/hashlib.rst:828 msgid "A module to generate message authentication codes using hashes." msgstr "" +#: ../../library/hashlib.rst:830 msgid "Module :mod:`base64`" msgstr "" +#: ../../library/hashlib.rst:831 msgid "Another way to encode binary hashes for non-binary environments." msgstr "" +#: ../../library/hashlib.rst:833 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" msgstr "" +#: ../../library/hashlib.rst:834 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "" +#: ../../library/hashlib.rst:836 msgid "https://csrc.nist.gov/pubs/fips/202/final" msgstr "" +#: ../../library/hashlib.rst:837 msgid "The FIPS 202 publication on the SHA-3 Standard." msgstr "" +#: ../../library/hashlib.rst:839 msgid "https://www.blake2.net/" msgstr "" +#: ../../library/hashlib.rst:840 msgid "Official BLAKE2 website." msgstr "" +#: ../../library/hashlib.rst:842 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" msgstr "" -msgid "Wikipedia article with information on which algorithms have known issues and what that means regarding their use." +#: ../../library/hashlib.rst:843 +msgid "" +"Wikipedia article with information on which algorithms have known issues and " +"what that means regarding their use." msgstr "" +#: ../../library/hashlib.rst:846 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "" +#: ../../library/hashlib.rst:847 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "" -msgid "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" +#: ../../library/hashlib.rst:849 +msgid "" +"https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" +#: ../../library/hashlib.rst:850 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "" +#: ../../library/hashlib.rst:12 msgid "message digest, MD5" msgstr "" -msgid "secure hash algorithm, SHA1, SHA2, SHA224, SHA256, SHA384, SHA512, SHA3, Shake, Blake2" +#: ../../library/hashlib.rst:12 +msgid "" +"secure hash algorithm, SHA1, SHA2, SHA224, SHA256, SHA384, SHA512, SHA3, " +"Shake, Blake2" msgstr "" +#: ../../library/hashlib.rst:53 msgid "OpenSSL" msgstr "" +#: ../../library/hashlib.rst:53 msgid "(use in module hashlib)" msgstr "" +#: ../../library/hashlib.rst:377 msgid "blake2b, blake2s" msgstr "" diff --git a/library/heapq.po b/library/heapq.po index 4b0fc2117..da3157bc5 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,120 +23,256 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/heapq.rst:2 msgid ":mod:`!heapq` --- Heap queue algorithm" msgstr "" +#: ../../library/heapq.rst:12 msgid "**Source code:** :source:`Lib/heapq.py`" msgstr "" -msgid "This module provides an implementation of the heap queue algorithm, also known as the priority queue algorithm." +#: ../../library/heapq.rst:16 +msgid "" +"This module provides an implementation of the heap queue algorithm, also " +"known as the priority queue algorithm." msgstr "" -msgid "Min-heaps are binary trees for which every parent node has a value less than or equal to any of its children. We refer to this condition as the heap invariant." +#: ../../library/heapq.rst:19 +msgid "" +"Min-heaps are binary trees for which every parent node has a value less than " +"or equal to any of its children. We refer to this condition as the heap " +"invariant." msgstr "" -msgid "For min-heaps, this implementation uses lists for which ``heap[k] <= heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k* for which the compared elements exist. Elements are counted from zero. The interesting property of a min-heap is that its smallest element is always the root, ``heap[0]``." +#: ../../library/heapq.rst:23 +msgid "" +"For min-heaps, this implementation uses lists for which ``heap[k] <= " +"heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k* for which the " +"compared elements exist. Elements are counted from zero. The interesting " +"property of a min-heap is that its smallest element is always the root, " +"``heap[0]``." msgstr "" -msgid "Max-heaps satisfy the reverse invariant: every parent node has a value *greater* than any of its children. These are implemented as lists for which ``maxheap[2*k+1] <= maxheap[k]`` and ``maxheap[2*k+2] <= maxheap[k]`` for all *k* for which the compared elements exist. The root, ``maxheap[0]``, contains the *largest* element; ``heap.sort(reverse=True)`` maintains the max-heap invariant." +#: ../../library/heapq.rst:29 +msgid "" +"Max-heaps satisfy the reverse invariant: every parent node has a value " +"*greater* than any of its children. These are implemented as lists for " +"which ``maxheap[2*k+1] <= maxheap[k]`` and ``maxheap[2*k+2] <= maxheap[k]`` " +"for all *k* for which the compared elements exist. The root, ``maxheap[0]``, " +"contains the *largest* element; ``heap.sort(reverse=True)`` maintains the " +"max-heap invariant." msgstr "" -msgid "The :mod:`!heapq` API differs from textbook heap algorithms in two aspects: (a) We use zero-based indexing. This makes the relationship between the index for a node and the indexes for its children slightly less obvious, but is more suitable since Python uses zero-based indexing. (b) Textbooks often focus on max-heaps, due to their suitability for in-place sorting. Our implementation favors min-heaps as they better correspond to Python :class:`lists `." +#: ../../library/heapq.rst:36 +msgid "" +"The :mod:`!heapq` API differs from textbook heap algorithms in two aspects: " +"(a) We use zero-based indexing. This makes the relationship between the " +"index for a node and the indexes for its children slightly less obvious, but " +"is more suitable since Python uses zero-based indexing. (b) Textbooks often " +"focus on max-heaps, due to their suitability for in-place sorting. Our " +"implementation favors min-heaps as they better correspond to " +"Python :class:`lists `." msgstr "" -msgid "These two aspects make it possible to view the heap as a regular Python list without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` maintains the heap invariant!" +#: ../../library/heapq.rst:43 +msgid "" +"These two aspects make it possible to view the heap as a regular Python list " +"without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` " +"maintains the heap invariant!" msgstr "" -msgid "Like :meth:`list.sort`, this implementation uses only the ``<`` operator for comparisons, for both min-heaps and max-heaps." +#: ../../library/heapq.rst:47 +msgid "" +"Like :meth:`list.sort`, this implementation uses only the ``<`` operator for " +"comparisons, for both min-heaps and max-heaps." msgstr "" -msgid "In the API below, and in this documentation, the unqualified term *heap* generally refers to a min-heap. The API for max-heaps is named using a ``_max`` suffix." +#: ../../library/heapq.rst:50 +msgid "" +"In the API below, and in this documentation, the unqualified term *heap* " +"generally refers to a min-heap. The API for max-heaps is named using a " +"``_max`` suffix." msgstr "" -msgid "To create a heap, use a list initialized as ``[]``, or transform an existing list into a min-heap or max-heap using the :func:`heapify` or :func:`heapify_max` functions, respectively." +#: ../../library/heapq.rst:54 +msgid "" +"To create a heap, use a list initialized as ``[]``, or transform an existing " +"list into a min-heap or max-heap using the :func:`heapify` " +"or :func:`heapify_max` functions, respectively." msgstr "" +#: ../../library/heapq.rst:58 msgid "The following functions are provided for min-heaps:" msgstr "" +#: ../../library/heapq.rst:63 msgid "Transform list *x* into a min-heap, in-place, in linear time." msgstr "" -msgid "Push the value *item* onto the *heap*, maintaining the min-heap invariant." +#: ../../library/heapq.rst:68 +msgid "" +"Push the value *item* onto the *heap*, maintaining the min-heap invariant." msgstr "" -msgid "Pop and return the smallest item from the *heap*, maintaining the min-heap invariant. If the heap is empty, :exc:`IndexError` is raised. To access the smallest item without popping it, use ``heap[0]``." +#: ../../library/heapq.rst:73 +msgid "" +"Pop and return the smallest item from the *heap*, maintaining the min-heap " +"invariant. If the heap is empty, :exc:`IndexError` is raised. To access " +"the smallest item without popping it, use ``heap[0]``." msgstr "" -msgid "Push *item* on the heap, then pop and return the smallest item from the *heap*. The combined action runs more efficiently than :func:`heappush` followed by a separate call to :func:`heappop`." +#: ../../library/heapq.rst:80 +msgid "" +"Push *item* on the heap, then pop and return the smallest item from the " +"*heap*. The combined action runs more efficiently than :func:`heappush` " +"followed by a separate call to :func:`heappop`." msgstr "" -msgid "Pop and return the smallest item from the *heap*, and also push the new *item*. The heap size doesn't change. If the heap is empty, :exc:`IndexError` is raised." +#: ../../library/heapq.rst:87 +msgid "" +"Pop and return the smallest item from the *heap*, and also push the new " +"*item*. The heap size doesn't change. If the heap is " +"empty, :exc:`IndexError` is raised." msgstr "" -msgid "This one step operation is more efficient than a :func:`heappop` followed by :func:`heappush` and can be more appropriate when using a fixed-size heap. The pop/push combination always returns an element from the heap and replaces it with *item*." +#: ../../library/heapq.rst:90 +msgid "" +"This one step operation is more efficient than a :func:`heappop` followed " +"by :func:`heappush` and can be more appropriate when using a fixed-size " +"heap. The pop/push combination always returns an element from the heap and " +"replaces it with *item*." msgstr "" -msgid "The value returned may be larger than the *item* added. If that isn't desired, consider using :func:`heappushpop` instead. Its push/pop combination returns the smaller of the two values, leaving the larger value on the heap." +#: ../../library/heapq.rst:95 +msgid "" +"The value returned may be larger than the *item* added. If that isn't " +"desired, consider using :func:`heappushpop` instead. Its push/pop " +"combination returns the smaller of the two values, leaving the larger value " +"on the heap." msgstr "" +#: ../../library/heapq.rst:101 msgid "For max-heaps, the following functions are provided:" msgstr "" +#: ../../library/heapq.rst:106 msgid "Transform list *x* into a max-heap, in-place, in linear time." msgstr "" -msgid "Push the value *item* onto the max-heap *heap*, maintaining the max-heap invariant." +#: ../../library/heapq.rst:113 +msgid "" +"Push the value *item* onto the max-heap *heap*, maintaining the max-heap " +"invariant." msgstr "" -msgid "Pop and return the largest item from the max-heap *heap*, maintaining the max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. To access the largest item without popping it, use ``maxheap[0]``." +#: ../../library/heapq.rst:121 +msgid "" +"Pop and return the largest item from the max-heap *heap*, maintaining the " +"max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. " +"To access the largest item without popping it, use ``maxheap[0]``." msgstr "" -msgid "Push *item* on the max-heap *heap*, then pop and return the largest item from *heap*. The combined action runs more efficiently than :func:`heappush_max` followed by a separate call to :func:`heappop_max`." +#: ../../library/heapq.rst:130 +msgid "" +"Push *item* on the max-heap *heap*, then pop and return the largest item " +"from *heap*. The combined action runs more efficiently " +"than :func:`heappush_max` followed by a separate call to :func:`heappop_max`." msgstr "" -msgid "Pop and return the largest item from the max-heap *heap* and also push the new *item*. The max-heap size doesn't change. If the max-heap is empty, :exc:`IndexError` is raised." +#: ../../library/heapq.rst:140 +msgid "" +"Pop and return the largest item from the max-heap *heap* and also push the " +"new *item*. The max-heap size doesn't change. If the max-heap is " +"empty, :exc:`IndexError` is raised." msgstr "" -msgid "The value returned may be smaller than the *item* added. Refer to the analogous function :func:`heapreplace` for detailed usage notes." +#: ../../library/heapq.rst:145 +msgid "" +"The value returned may be smaller than the *item* added. Refer to the " +"analogous function :func:`heapreplace` for detailed usage notes." msgstr "" +#: ../../library/heapq.rst:151 msgid "The module also offers three general purpose functions based on heaps." msgstr "" -msgid "Merge multiple sorted inputs into a single sorted output (for example, merge timestamped entries from multiple log files). Returns an :term:`iterator` over the sorted values." +#: ../../library/heapq.rst:156 +msgid "" +"Merge multiple sorted inputs into a single sorted output (for example, merge " +"timestamped entries from multiple log files). Returns an :term:`iterator` " +"over the sorted values." msgstr "" -msgid "Similar to ``sorted(itertools.chain(*iterables))`` but returns an iterable, does not pull the data into memory all at once, and assumes that each of the input streams is already sorted (smallest to largest)." +#: ../../library/heapq.rst:160 +msgid "" +"Similar to ``sorted(itertools.chain(*iterables))`` but returns an iterable, " +"does not pull the data into memory all at once, and assumes that each of the " +"input streams is already sorted (smallest to largest)." msgstr "" -msgid "Has two optional arguments which must be specified as keyword arguments." +#: ../../library/heapq.rst:164 +msgid "" +"Has two optional arguments which must be specified as keyword arguments." msgstr "" -msgid "*key* specifies a :term:`key function` of one argument that is used to extract a comparison key from each input element. The default value is ``None`` (compare the elements directly)." +#: ../../library/heapq.rst:166 +msgid "" +"*key* specifies a :term:`key function` of one argument that is used to " +"extract a comparison key from each input element. The default value is " +"``None`` (compare the elements directly)." msgstr "" -msgid "*reverse* is a boolean value. If set to ``True``, then the input elements are merged as if each comparison were reversed. To achieve behavior similar to ``sorted(itertools.chain(*iterables), reverse=True)``, all iterables must be sorted from largest to smallest." +#: ../../library/heapq.rst:170 +msgid "" +"*reverse* is a boolean value. If set to ``True``, then the input elements " +"are merged as if each comparison were reversed. To achieve behavior similar " +"to ``sorted(itertools.chain(*iterables), reverse=True)``, all iterables must " +"be sorted from largest to smallest." msgstr "" +#: ../../library/heapq.rst:175 msgid "Added the optional *key* and *reverse* parameters." msgstr "" -msgid "Return a list with the *n* largest elements from the dataset defined by *iterable*. *key*, if provided, specifies a function of one argument that is used to extract a comparison key from each element in *iterable* (for example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key, reverse=True)[:n]``." +#: ../../library/heapq.rst:181 +msgid "" +"Return a list with the *n* largest elements from the dataset defined by " +"*iterable*. *key*, if provided, specifies a function of one argument that " +"is used to extract a comparison key from each element in *iterable* (for " +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key, " +"reverse=True)[:n]``." msgstr "" -msgid "Return a list with the *n* smallest elements from the dataset defined by *iterable*. *key*, if provided, specifies a function of one argument that is used to extract a comparison key from each element in *iterable* (for example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:n]``." +#: ../../library/heapq.rst:190 +msgid "" +"Return a list with the *n* smallest elements from the dataset defined by " +"*iterable*. *key*, if provided, specifies a function of one argument that " +"is used to extract a comparison key from each element in *iterable* (for " +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)" +"[:n]``." msgstr "" -msgid "The latter two functions perform best for smaller values of *n*. For larger values, it is more efficient to use the :func:`sorted` function. Also, when ``n==1``, it is more efficient to use the built-in :func:`min` and :func:`max` functions. If repeated usage of these functions is required, consider turning the iterable into an actual heap." +#: ../../library/heapq.rst:196 +msgid "" +"The latter two functions perform best for smaller values of *n*. For larger " +"values, it is more efficient to use the :func:`sorted` function. Also, when " +"``n==1``, it is more efficient to use the built-in :func:`min` " +"and :func:`max` functions. If repeated usage of these functions is " +"required, consider turning the iterable into an actual heap." msgstr "" +#: ../../library/heapq.rst:204 msgid "Basic Examples" msgstr "" -msgid "A `heapsort `_ can be implemented by pushing all values onto a heap and then popping off the smallest values one at a time::" +#: ../../library/heapq.rst:206 +msgid "" +"A `heapsort `_ can be implemented by " +"pushing all values onto a heap and then popping off the smallest values one " +"at a time::" msgstr "" +#: ../../library/heapq.rst:210 msgid "" ">>> def heapsort(iterable):\n" "... h = []\n" @@ -148,12 +284,19 @@ msgid "" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" msgstr "" -msgid "This is similar to ``sorted(iterable)``, but unlike :func:`sorted`, this implementation is not stable." +#: ../../library/heapq.rst:219 +msgid "" +"This is similar to ``sorted(iterable)``, but unlike :func:`sorted`, this " +"implementation is not stable." msgstr "" -msgid "Heap elements can be tuples. This is useful for assigning comparison values (such as task priorities) alongside the main record being tracked::" +#: ../../library/heapq.rst:222 +msgid "" +"Heap elements can be tuples. This is useful for assigning comparison values " +"(such as task priorities) alongside the main record being tracked::" msgstr "" +#: ../../library/heapq.rst:225 msgid "" ">>> h = []\n" ">>> heappush(h, (5, 'write code'))\n" @@ -164,15 +307,29 @@ msgid "" "(1, 'write spec')" msgstr "" +#: ../../library/heapq.rst:235 msgid "Other Applications" msgstr "" -msgid "`Medians `_ are a measure of central tendency for a set of numbers. In distributions skewed by outliers, the median provides a more stable estimate than an average (arithmetic mean). A running median is an `online algorithm `_ that updates continuously as new data arrives." +#: ../../library/heapq.rst:237 +msgid "" +"`Medians `_ are a measure of central " +"tendency for a set of numbers. In distributions skewed by outliers, the " +"median provides a more stable estimate than an average (arithmetic mean). A " +"running median is an `online algorithm `_ that updates continuously as new data arrives." msgstr "" -msgid "A running median can be efficiently implemented by balancing two heaps, a max-heap for values at or below the midpoint and a min-heap for values above the midpoint. When the two heaps have the same size, the new median is the average of the tops of the two heaps; otherwise, the median is at the top of the larger heap::" +#: ../../library/heapq.rst:244 +msgid "" +"A running median can be efficiently implemented by balancing two heaps, a " +"max-heap for values at or below the midpoint and a min-heap for values above " +"the midpoint. When the two heaps have the same size, the new median is the " +"average of the tops of the two heaps; otherwise, the median is at the top of " +"the larger heap::" msgstr "" +#: ../../library/heapq.rst:250 msgid "" "def running_median(iterable):\n" " \"Yields the cumulative median of values seen so far.\"\n" @@ -189,38 +346,67 @@ msgid "" " yield (lo[0] + hi[0]) / 2" msgstr "" +#: ../../library/heapq.rst:264 msgid "For example::" msgstr "" +#: ../../library/heapq.rst:266 msgid "" ">>> list(running_median([5.0, 9.0, 4.0, 12.0, 8.0, 9.0]))\n" "[5.0, 7.0, 5.0, 7.0, 8.0, 8.5]" msgstr "" +#: ../../library/heapq.rst:271 msgid "Priority Queue Implementation Notes" msgstr "" -msgid "A `priority queue `_ is common use for a heap, and it presents several implementation challenges:" +#: ../../library/heapq.rst:273 +msgid "" +"A `priority queue `_ is common " +"use for a heap, and it presents several implementation challenges:" msgstr "" -msgid "Sort stability: how do you get two tasks with equal priorities to be returned in the order they were originally added?" +#: ../../library/heapq.rst:276 +msgid "" +"Sort stability: how do you get two tasks with equal priorities to be " +"returned in the order they were originally added?" msgstr "" -msgid "Tuple comparison breaks for (priority, task) pairs if the priorities are equal and the tasks do not have a default comparison order." +#: ../../library/heapq.rst:279 +msgid "" +"Tuple comparison breaks for (priority, task) pairs if the priorities are " +"equal and the tasks do not have a default comparison order." msgstr "" -msgid "If the priority of a task changes, how do you move it to a new position in the heap?" +#: ../../library/heapq.rst:282 +msgid "" +"If the priority of a task changes, how do you move it to a new position in " +"the heap?" msgstr "" -msgid "Or if a pending task needs to be deleted, how do you find it and remove it from the queue?" +#: ../../library/heapq.rst:285 +msgid "" +"Or if a pending task needs to be deleted, how do you find it and remove it " +"from the queue?" msgstr "" -msgid "A solution to the first two challenges is to store entries as 3-element list including the priority, an entry count, and the task. The entry count serves as a tie-breaker so that two tasks with the same priority are returned in the order they were added. And since no two entry counts are the same, the tuple comparison will never attempt to directly compare two tasks." +#: ../../library/heapq.rst:288 +msgid "" +"A solution to the first two challenges is to store entries as 3-element list " +"including the priority, an entry count, and the task. The entry count " +"serves as a tie-breaker so that two tasks with the same priority are " +"returned in the order they were added. And since no two entry counts are the " +"same, the tuple comparison will never attempt to directly compare two tasks." msgstr "" -msgid "Another solution to the problem of non-comparable tasks is to create a wrapper class that ignores the task item and only compares the priority field::" +#: ../../library/heapq.rst:294 +msgid "" +"Another solution to the problem of non-comparable tasks is to create a " +"wrapper class that ignores the task item and only compares the priority " +"field::" msgstr "" +#: ../../library/heapq.rst:297 msgid "" "from dataclasses import dataclass, field\n" "from typing import Any\n" @@ -231,12 +417,21 @@ msgid "" " item: Any=field(compare=False)" msgstr "" -msgid "The remaining challenges revolve around finding a pending task and making changes to its priority or removing it entirely. Finding a task can be done with a dictionary pointing to an entry in the queue." +#: ../../library/heapq.rst:305 +msgid "" +"The remaining challenges revolve around finding a pending task and making " +"changes to its priority or removing it entirely. Finding a task can be done " +"with a dictionary pointing to an entry in the queue." msgstr "" -msgid "Removing the entry or changing its priority is more difficult because it would break the heap structure invariants. So, a possible solution is to mark the entry as removed and add a new entry with the revised priority::" +#: ../../library/heapq.rst:309 +msgid "" +"Removing the entry or changing its priority is more difficult because it " +"would break the heap structure invariants. So, a possible solution is to " +"mark the entry as removed and add a new entry with the revised priority::" msgstr "" +#: ../../library/heapq.rst:313 msgid "" "pq = [] # list of entries arranged in a heap\n" "entry_finder = {} # mapping of tasks to entries\n" @@ -267,15 +462,25 @@ msgid "" " raise KeyError('pop from an empty priority queue')" msgstr "" +#: ../../library/heapq.rst:343 msgid "Theory" msgstr "" -msgid "Heaps are arrays for which ``a[k] <= a[2*k+1]`` and ``a[k] <= a[2*k+2]`` for all *k*, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that ``a[0]`` is always its smallest element." +#: ../../library/heapq.rst:345 +msgid "" +"Heaps are arrays for which ``a[k] <= a[2*k+1]`` and ``a[k] <= a[2*k+2]`` for " +"all *k*, counting elements from 0. For the sake of comparison, non-existing " +"elements are considered to be infinite. The interesting property of a heap " +"is that ``a[0]`` is always its smallest element." msgstr "" -msgid "The strange invariant above is meant to be an efficient memory representation for a tournament. The numbers below are *k*, not ``a[k]``::" +#: ../../library/heapq.rst:350 +msgid "" +"The strange invariant above is meant to be an efficient memory " +"representation for a tournament. The numbers below are *k*, not ``a[k]``::" msgstr "" +#: ../../library/heapq.rst:353 msgid "" " 0\n" "\n" @@ -288,29 +493,95 @@ msgid "" "15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30" msgstr "" -msgid "In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a usual binary tournament we see in sports, each cell is the winner over the two cells it tops, and we can trace the winner down the tree to see all opponents s/he had. However, in many computer applications of such tournaments, we do not need to trace the history of a winner. To be more memory efficient, when a winner is promoted, we try to replace it by something else at a lower level, and the rule becomes that a cell and the two cells it tops contain three different items, but the top cell \"wins\" over the two topped cells." -msgstr "" - -msgid "If this heap invariant is protected at all time, index 0 is clearly the overall winner. The simplest algorithmic way to remove it and find the \"next\" winner is to move some loser (let's say cell 30 in the diagram above) into the 0 position, and then percolate this new 0 down the tree, exchanging values, until the invariant is re-established. This is clearly logarithmic on the total number of items in the tree. By iterating over all items, you get an *O*\\ (*n* log *n*) sort." -msgstr "" - -msgid "A nice feature of this sort is that you can efficiently insert new items while the sort is going on, provided that the inserted items are not \"better\" than the last 0'th element you extracted. This is especially useful in simulation contexts, where the tree holds all incoming events, and the \"win\" condition means the smallest scheduled time. When an event schedules other events for execution, they are scheduled into the future, so they can easily go into the heap. So, a heap is a good structure for implementing schedulers (this is what I used for my MIDI sequencer :-)." +#: ../../library/heapq.rst:363 +msgid "" +"In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a " +"usual binary tournament we see in sports, each cell is the winner over the " +"two cells it tops, and we can trace the winner down the tree to see all " +"opponents s/he had. However, in many computer applications of such " +"tournaments, we do not need to trace the history of a winner. To be more " +"memory efficient, when a winner is promoted, we try to replace it by " +"something else at a lower level, and the rule becomes that a cell and the " +"two cells it tops contain three different items, but the top cell \"wins\" " +"over the two topped cells." +msgstr "" + +#: ../../library/heapq.rst:372 +msgid "" +"If this heap invariant is protected at all time, index 0 is clearly the " +"overall winner. The simplest algorithmic way to remove it and find the " +"\"next\" winner is to move some loser (let's say cell 30 in the diagram " +"above) into the 0 position, and then percolate this new 0 down the tree, " +"exchanging values, until the invariant is re-established. This is clearly " +"logarithmic on the total number of items in the tree. By iterating over all " +"items, you get an *O*\\ (*n* log *n*) sort." msgstr "" -msgid "Various structures for implementing schedulers have been extensively studied, and heaps are good for this, as they are reasonably speedy, the speed is almost constant, and the worst case is not much different than the average case. However, there are other representations which are more efficient overall, yet the worst cases might be terrible." +#: ../../library/heapq.rst:379 +msgid "" +"A nice feature of this sort is that you can efficiently insert new items " +"while the sort is going on, provided that the inserted items are not " +"\"better\" than the last 0'th element you extracted. This is especially " +"useful in simulation contexts, where the tree holds all incoming events, and " +"the \"win\" condition means the smallest scheduled time. When an event " +"schedules other events for execution, they are scheduled into the future, so " +"they can easily go into the heap. So, a heap is a good structure for " +"implementing schedulers (this is what I used for my MIDI sequencer :-)." msgstr "" -msgid "Heaps are also very useful in big disk sorts. You most probably all know that a big sort implies producing \"runs\" (which are pre-sorted sequences, whose size is usually related to the amount of CPU memory), followed by a merging passes for these runs, which merging is often very cleverly organised [#]_. It is very important that the initial sort produces the longest runs possible. Tournaments are a good way to achieve that. If, using all the memory available to hold a tournament, you replace and percolate items that happen to fit the current run, you'll produce runs which are twice the size of the memory for random input, and much better for input fuzzily ordered." +#: ../../library/heapq.rst:388 +msgid "" +"Various structures for implementing schedulers have been extensively " +"studied, and heaps are good for this, as they are reasonably speedy, the " +"speed is almost constant, and the worst case is not much different than the " +"average case. However, there are other representations which are more " +"efficient overall, yet the worst cases might be terrible." msgstr "" -msgid "Moreover, if you output the 0'th item on disk and get an input which may not fit in the current tournament (because the value \"wins\" over the last output value), it cannot fit in the heap, so the size of the heap decreases. The freed memory could be cleverly reused immediately for progressively building a second heap, which grows at exactly the same rate the first heap is melting. When the first heap completely vanishes, you switch heaps and start a new run. Clever and quite effective!" +#: ../../library/heapq.rst:394 +msgid "" +"Heaps are also very useful in big disk sorts. You most probably all know " +"that a big sort implies producing \"runs\" (which are pre-sorted sequences, " +"whose size is usually related to the amount of CPU memory), followed by a " +"merging passes for these runs, which merging is often very cleverly " +"organised [#]_. It is very important that the initial sort produces the " +"longest runs possible. Tournaments are a good way to achieve that. If, " +"using all the memory available to hold a tournament, you replace and " +"percolate items that happen to fit the current run, you'll produce runs " +"which are twice the size of the memory for random input, and much better for " +"input fuzzily ordered." +msgstr "" + +#: ../../library/heapq.rst:404 +msgid "" +"Moreover, if you output the 0'th item on disk and get an input which may not " +"fit in the current tournament (because the value \"wins\" over the last " +"output value), it cannot fit in the heap, so the size of the heap " +"decreases. The freed memory could be cleverly reused immediately for " +"progressively building a second heap, which grows at exactly the same rate " +"the first heap is melting. When the first heap completely vanishes, you " +"switch heaps and start a new run. Clever and quite effective!" msgstr "" -msgid "In a word, heaps are useful memory structures to know. I use them in a few applications, and I think it is good to keep a 'heap' module around. :-)" +#: ../../library/heapq.rst:412 +msgid "" +"In a word, heaps are useful memory structures to know. I use them in a few " +"applications, and I think it is good to keep a 'heap' module around. :-)" msgstr "" +#: ../../library/heapq.rst:416 msgid "Footnotes" msgstr "" -msgid "The disk balancing algorithms which are current, nowadays, are more annoying than clever, and this is a consequence of the seeking capabilities of the disks. On devices which cannot seek, like big tape drives, the story was quite different, and one had to be very clever to ensure (far in advance) that each tape movement will be the most effective possible (that is, will best participate at \"progressing\" the merge). Some tapes were even able to read backwards, and this was also used to avoid the rewinding time. Believe me, real good tape sorts were quite spectacular to watch! From all times, sorting has always been a Great Art! :-)" +#: ../../library/heapq.rst:417 +msgid "" +"The disk balancing algorithms which are current, nowadays, are more annoying " +"than clever, and this is a consequence of the seeking capabilities of the " +"disks. On devices which cannot seek, like big tape drives, the story was " +"quite different, and one had to be very clever to ensure (far in advance) " +"that each tape movement will be the most effective possible (that is, will " +"best participate at \"progressing\" the merge). Some tapes were even able " +"to read backwards, and this was also used to avoid the rewinding time. " +"Believe me, real good tape sorts were quite spectacular to watch! From all " +"times, sorting has always been a Great Art! :-)" msgstr "" diff --git a/library/hmac.po b/library/hmac.po index 253109dfb..ee9b242e5 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,83 +23,164 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/hmac.rst:2 msgid ":mod:`!hmac` --- Keyed-Hashing for Message Authentication" msgstr "" +#: ../../library/hmac.rst:10 msgid "**Source code:** :source:`Lib/hmac.py`" msgstr "" -msgid "This module implements the HMAC algorithm as described by :rfc:`2104`. The interface allows to use any hash function with a *fixed* digest size. In particular, extendable output functions such as SHAKE-128 or SHAKE-256 cannot be used with HMAC." +#: ../../library/hmac.rst:14 +msgid "" +"This module implements the HMAC algorithm as described by :rfc:`2104`. The " +"interface allows to use any hash function with a *fixed* digest size. In " +"particular, extendable output functions such as SHAKE-128 or SHAKE-256 " +"cannot be used with HMAC." msgstr "" -msgid "Return a new hmac object. *key* is a bytes or bytearray object giving the secret key. If *msg* is present, the method call ``update(msg)`` is made. *digestmod* is the digest name, digest constructor or module for the HMAC object to use. It may be any name suitable to :func:`hashlib.new`. Despite its argument position, it is required." +#: ../../library/hmac.rst:22 +msgid "" +"Return a new hmac object. *key* is a bytes or bytearray object giving the " +"secret key. If *msg* is present, the method call ``update(msg)`` is made. " +"*digestmod* is the digest name, digest constructor or module for the HMAC " +"object to use. It may be any name suitable to :func:`hashlib.new`. Despite " +"its argument position, it is required." msgstr "" -msgid "Parameter *key* can be a bytes or bytearray object. Parameter *msg* can be of any type supported by :mod:`hashlib`. Parameter *digestmod* can be the name of a hash algorithm." +#: ../../library/hmac.rst:28 +msgid "" +"Parameter *key* can be a bytes or bytearray object. Parameter *msg* can be " +"of any type supported by :mod:`hashlib`. Parameter *digestmod* can be the " +"name of a hash algorithm." msgstr "" -msgid "The *digestmod* argument is now required. Pass it as a keyword argument to avoid awkwardness when you do not have an initial *msg*." +#: ../../library/hmac.rst:33 +msgid "" +"The *digestmod* argument is now required. Pass it as a keyword argument to " +"avoid awkwardness when you do not have an initial *msg*." msgstr "" -msgid "Return digest of *msg* for given secret *key* and *digest*. The function is equivalent to ``HMAC(key, msg, digest).digest()``, but uses an optimized C or inline implementation, which is faster for messages that fit into memory. The parameters *key*, *msg*, and *digest* have the same meaning as in :func:`~hmac.new`." +#: ../../library/hmac.rst:40 +msgid "" +"Return digest of *msg* for given secret *key* and *digest*. The function is " +"equivalent to ``HMAC(key, msg, digest).digest()``, but uses an optimized C " +"or inline implementation, which is faster for messages that fit into memory. " +"The parameters *key*, *msg*, and *digest* have the same meaning as " +"in :func:`~hmac.new`." msgstr "" -msgid "CPython implementation detail, the optimized C implementation is only used when *digest* is a string and name of a digest algorithm, which is supported by OpenSSL." +#: ../../library/hmac.rst:46 +msgid "" +"CPython implementation detail, the optimized C implementation is only used " +"when *digest* is a string and name of a digest algorithm, which is supported " +"by OpenSSL." msgstr "" +#: ../../library/hmac.rst:55 msgid "An HMAC object has the following methods:" msgstr "" -msgid "Update the hmac object with *msg*. Repeated calls are equivalent to a single call with the concatenation of all the arguments: ``m.update(a); m.update(b)`` is equivalent to ``m.update(a + b)``." +#: ../../library/hmac.rst:59 +msgid "" +"Update the hmac object with *msg*. Repeated calls are equivalent to a " +"single call with the concatenation of all the arguments: ``m.update(a); " +"m.update(b)`` is equivalent to ``m.update(a + b)``." msgstr "" +#: ../../library/hmac.rst:63 msgid "Parameter *msg* can be of any type supported by :mod:`hashlib`." msgstr "" -msgid "Return the digest of the bytes passed to the :meth:`update` method so far. This bytes object will be the same length as the *digest_size* of the digest given to the constructor. It may contain non-ASCII bytes, including NUL bytes." +#: ../../library/hmac.rst:69 +msgid "" +"Return the digest of the bytes passed to the :meth:`update` method so far. " +"This bytes object will be the same length as the *digest_size* of the digest " +"given to the constructor. It may contain non-ASCII bytes, including NUL " +"bytes." msgstr "" -msgid "When comparing the output of :meth:`digest` to an externally supplied digest during a verification routine, it is recommended to use the :func:`compare_digest` function instead of the ``==`` operator to reduce the vulnerability to timing attacks." +#: ../../library/hmac.rst:76 +msgid "" +"When comparing the output of :meth:`digest` to an externally supplied digest " +"during a verification routine, it is recommended to use " +"the :func:`compare_digest` function instead of the ``==`` operator to reduce " +"the vulnerability to timing attacks." msgstr "" -msgid "Like :meth:`digest` except the digest is returned as a string twice the length containing only hexadecimal digits. This may be used to exchange the value safely in email or other non-binary environments." +#: ../../library/hmac.rst:84 +msgid "" +"Like :meth:`digest` except the digest is returned as a string twice the " +"length containing only hexadecimal digits. This may be used to exchange the " +"value safely in email or other non-binary environments." msgstr "" -msgid "When comparing the output of :meth:`hexdigest` to an externally supplied digest during a verification routine, it is recommended to use the :func:`compare_digest` function instead of the ``==`` operator to reduce the vulnerability to timing attacks." +#: ../../library/hmac.rst:90 +msgid "" +"When comparing the output of :meth:`hexdigest` to an externally supplied " +"digest during a verification routine, it is recommended to use " +"the :func:`compare_digest` function instead of the ``==`` operator to reduce " +"the vulnerability to timing attacks." msgstr "" -msgid "Return a copy (\"clone\") of the hmac object. This can be used to efficiently compute the digests of strings that share a common initial substring." +#: ../../library/hmac.rst:98 +msgid "" +"Return a copy (\"clone\") of the hmac object. This can be used to " +"efficiently compute the digests of strings that share a common initial " +"substring." msgstr "" +#: ../../library/hmac.rst:102 msgid "A hash object has the following attributes:" msgstr "" +#: ../../library/hmac.rst:106 msgid "The size of the resulting HMAC digest in bytes." msgstr "" +#: ../../library/hmac.rst:110 msgid "The internal block size of the hash algorithm in bytes." msgstr "" +#: ../../library/hmac.rst:116 msgid "The canonical name of this HMAC, always lowercase, e.g. ``hmac-md5``." msgstr "" -msgid "Removed the undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``, and ``HMAC.outer``." +#: ../../library/hmac.rst:121 +msgid "" +"Removed the undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``, " +"and ``HMAC.outer``." msgstr "" +#: ../../library/hmac.rst:125 msgid "This module also provides the following helper function:" msgstr "" -msgid "Return ``a == b``. This function uses an approach designed to prevent timing analysis by avoiding content-based short circuiting behaviour, making it appropriate for cryptography. *a* and *b* must both be of the same type: either :class:`str` (ASCII only, as e.g. returned by :meth:`HMAC.hexdigest`), or a :term:`bytes-like object`." +#: ../../library/hmac.rst:129 +msgid "" +"Return ``a == b``. This function uses an approach designed to prevent " +"timing analysis by avoiding content-based short circuiting behaviour, making " +"it appropriate for cryptography. *a* and *b* must both be of the same type: " +"either :class:`str` (ASCII only, as e.g. returned " +"by :meth:`HMAC.hexdigest`), or a :term:`bytes-like object`." msgstr "" -msgid "If *a* and *b* are of different lengths, or if an error occurs, a timing attack could theoretically reveal information about the types and lengths of *a* and *b*—but not their values." +#: ../../library/hmac.rst:137 +msgid "" +"If *a* and *b* are of different lengths, or if an error occurs, a timing " +"attack could theoretically reveal information about the types and lengths of " +"*a* and *b*—but not their values." msgstr "" -msgid "The function uses OpenSSL's ``CRYPTO_memcmp()`` internally when available." +#: ../../library/hmac.rst:145 +msgid "" +"The function uses OpenSSL's ``CRYPTO_memcmp()`` internally when available." msgstr "" +#: ../../library/hmac.rst:151 msgid "Module :mod:`hashlib`" msgstr "" +#: ../../library/hmac.rst:152 msgid "The Python module providing secure hash functions." msgstr "" diff --git a/library/html.entities.po b/library/html.entities.po index 4e7de802c..50ef936fe 100644 --- a/library/html.entities.po +++ b/library/html.entities.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -23,29 +23,51 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/html.entities.rst:2 msgid ":mod:`!html.entities` --- Definitions of HTML general entities" msgstr "" +#: ../../library/html.entities.rst:9 msgid "**Source code:** :source:`Lib/html/entities.py`" msgstr "" -msgid "This module defines four dictionaries, :data:`html5`, :data:`name2codepoint`, :data:`codepoint2name`, and :data:`entitydefs`." +#: ../../library/html.entities.rst:13 +msgid "" +"This module defines four " +"dictionaries, :data:`html5`, :data:`name2codepoint`, :data:`codepoint2name`, " +"and :data:`entitydefs`." msgstr "" -msgid "A dictionary that maps HTML5 named character references [#]_ to the equivalent Unicode character(s), e.g. ``html5['gt;'] == '>'``. Note that the trailing semicolon is included in the name (e.g. ``'gt;'``), however some of the names are accepted by the standard even without the semicolon: in this case the name is present with and without the ``';'``. See also :func:`html.unescape`." +#: ../../library/html.entities.rst:19 +msgid "" +"A dictionary that maps HTML5 named character references [#]_ to the " +"equivalent Unicode character(s), e.g. ``html5['gt;'] == '>'``. Note that the " +"trailing semicolon is included in the name (e.g. ``'gt;'``), however some of " +"the names are accepted by the standard even without the semicolon: in this " +"case the name is present with and without the ``';'``. See " +"also :func:`html.unescape`." msgstr "" -msgid "A dictionary mapping XHTML 1.0 entity definitions to their replacement text in ISO Latin-1." +#: ../../library/html.entities.rst:31 +msgid "" +"A dictionary mapping XHTML 1.0 entity definitions to their replacement text " +"in ISO Latin-1." msgstr "" +#: ../../library/html.entities.rst:37 msgid "A dictionary that maps HTML4 entity names to the Unicode code points." msgstr "" +#: ../../library/html.entities.rst:42 msgid "A dictionary that maps Unicode code points to HTML4 entity names." msgstr "" +#: ../../library/html.entities.rst:46 msgid "Footnotes" msgstr "" -msgid "See https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references" +#: ../../library/html.entities.rst:47 +msgid "" +"See https://html.spec.whatwg.org/multipage/named-characters.html#named-" +"character-references" msgstr "" diff --git a/library/html.parser.po b/library/html.parser.po index 6e69b424e..9ec5eddca 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-08-18 04:30+0000\n" +"POT-Creation-Date: 2026-08-25 20:39+0330\n" "PO-Revision-Date: 2021-06-28 01:07+0000\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/revisto/python-docs-fa/fa/)\n" @@ -24,45 +24,78 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" +#: ../../library/html.parser.rst:2 msgid ":mod:`!html.parser` --- Simple HTML and XHTML parser" msgstr "" +#: ../../library/html.parser.rst:7 msgid "**Source code:** :source:`Lib/html/parser.py`" msgstr "" -msgid "This module defines a class :class:`HTMLParser` which serves as the basis for parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML." +#: ../../library/html.parser.rst:15 +msgid "" +"This module defines a class :class:`HTMLParser` which serves as the basis " +"for parsing text files formatted in HTML (HyperText Mark-up Language) and " +"XHTML." msgstr "" +#: ../../library/html.parser.rst:20 msgid "Create a parser instance able to parse invalid markup." msgstr "" -msgid "If *convert_charrefs* is true (the default), all character references (except the ones in elements like ``script`` and ``style``) are automatically converted to the corresponding Unicode characters." +#: ../../library/html.parser.rst:22 +msgid "" +"If *convert_charrefs* is true (the default), all character references " +"(except the ones in elements like ``script`` and ``style``) are " +"automatically converted to the corresponding Unicode characters." msgstr "" -msgid "If *scripting* is false (the default), the content of the ``noscript`` element is parsed normally; if it's true, it's returned as is without being parsed." +#: ../../library/html.parser.rst:26 +msgid "" +"If *scripting* is false (the default), the content of the ``noscript`` " +"element is parsed normally; if it's true, it's returned as is without being " +"parsed." msgstr "" -msgid "An :class:`.HTMLParser` instance is fed HTML data and calls handler methods when start tags, end tags, text, comments, and other markup elements are encountered. The user should subclass :class:`.HTMLParser` and override its methods to implement the desired behavior." +#: ../../library/html.parser.rst:30 +msgid "" +"An :class:`.HTMLParser` instance is fed HTML data and calls handler methods " +"when start tags, end tags, text, comments, and other markup elements are " +"encountered. The user should subclass :class:`.HTMLParser` and override its " +"methods to implement the desired behavior." msgstr "" -msgid "This parser does not check that end tags match start tags or call the end-tag handler for elements which are closed implicitly by closing an outer element." +#: ../../library/html.parser.rst:35 +msgid "" +"This parser does not check that end tags match start tags or call the end-" +"tag handler for elements which are closed implicitly by closing an outer " +"element." msgstr "" +#: ../../library/html.parser.rst:38 msgid "*convert_charrefs* keyword argument added." msgstr "" +#: ../../library/html.parser.rst:41 msgid "The default value for argument *convert_charrefs* is now ``True``." msgstr "" +#: ../../library/html.parser.rst:44 msgid "Added the *scripting* parameter." msgstr "" +#: ../../library/html.parser.rst:49 msgid "Example HTML Parser Application" msgstr "" -msgid "As a basic example, below is a simple HTML parser that uses the :class:`HTMLParser` class to print out start tags, end tags, and data as they are encountered:" +#: ../../library/html.parser.rst:51 +msgid "" +"As a basic example, below is a simple HTML parser that uses " +"the :class:`HTMLParser` class to print out start tags, end tags, and data as " +"they are encountered:" msgstr "" +#: ../../library/html.parser.rst:55 msgid "" "from html.parser import HTMLParser\n" "\n" @@ -81,9 +114,11 @@ msgid "" " '

Parse me!

')" msgstr "" +#: ../../library/html.parser.rst:73 msgid "The output will then be:" msgstr "" +#: ../../library/html.parser.rst:75 msgid "" "Encountered a start tag: html\n" "Encountered a start tag: head\n" @@ -99,93 +134,195 @@ msgid "" "Encountered an end tag : html" msgstr "" +#: ../../library/html.parser.rst:92 msgid ":class:`.HTMLParser` Methods" msgstr "" +#: ../../library/html.parser.rst:94 msgid ":class:`HTMLParser` instances have the following methods:" msgstr "" -msgid "Feed some text to the parser. It is processed insofar as it consists of complete elements; incomplete data is buffered until more data is fed or :meth:`close` is called. *data* must be :class:`str`." +#: ../../library/html.parser.rst:99 +msgid "" +"Feed some text to the parser. It is processed insofar as it consists of " +"complete elements; incomplete data is buffered until more data is fed " +"or :meth:`close` is called. *data* must be :class:`str`." msgstr "" -msgid "Force processing of all buffered data as if it were followed by an end-of-file mark. This method may be redefined by a derived class to define additional processing at the end of the input, but the redefined version should always call the :class:`HTMLParser` base class method :meth:`close`." +#: ../../library/html.parser.rst:106 +msgid "" +"Force processing of all buffered data as if it were followed by an end-of-" +"file mark. This method may be redefined by a derived class to define " +"additional processing at the end of the input, but the redefined version " +"should always call the :class:`HTMLParser` base class method :meth:`close`." msgstr "" -msgid "Reset the instance. Loses all unprocessed data. This is called implicitly at instantiation time." +#: ../../library/html.parser.rst:114 +msgid "" +"Reset the instance. Loses all unprocessed data. This is called implicitly " +"at instantiation time." msgstr "" +#: ../../library/html.parser.rst:120 msgid "Return current line number and offset." msgstr "" -msgid "Return the text of the most recently opened start tag. This should not normally be needed for structured processing, but may be useful in dealing with HTML \"as deployed\" or for re-generating input with minimal changes (whitespace between attributes can be preserved, etc.)." +#: ../../library/html.parser.rst:125 +msgid "" +"Return the text of the most recently opened start tag. This should not " +"normally be needed for structured processing, but may be useful in dealing " +"with HTML \"as deployed\" or for re-generating input with minimal changes " +"(whitespace between attributes can be preserved, etc.)." msgstr "" -msgid "The following methods are called when data or markup elements are encountered and they are meant to be overridden in a subclass. The base class implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):" +#: ../../library/html.parser.rst:131 +msgid "" +"The following methods are called when data or markup elements are " +"encountered and they are meant to be overridden in a subclass. The base " +"class implementations do nothing (except " +"for :meth:`~HTMLParser.handle_startendtag`):" msgstr "" -msgid "This method is called to handle the start tag of an element (e.g. ``
``)." +#: ../../library/html.parser.rst:138 +msgid "" +"This method is called to handle the start tag of an element (e.g. ``
``)." msgstr "" -msgid "The *tag* argument is the name of the tag converted to lower case. The *attrs* argument is a list of ``(name, value)`` pairs containing the attributes found inside the tag's ``<>`` brackets. The *name* will be translated to lower case, and quotes in the *value* have been removed, and character and entity references have been replaced. For empty attributes, *value* is ``None``." +#: ../../library/html.parser.rst:140 +msgid "" +"The *tag* argument is the name of the tag converted to lower case. The " +"*attrs* argument is a list of ``(name, value)`` pairs containing the " +"attributes found inside the tag's ``<>`` brackets. The *name* will be " +"translated to lower case, and quotes in the *value* have been removed, and " +"character and entity references have been replaced. For empty attributes, " +"*value* is ``None``." msgstr "" -msgid "For instance, for the tag ````, this method would be called as ``handle_starttag('a', [('href', 'https://www.cwi.nl/')])``." +#: ../../library/html.parser.rst:146 +msgid "" +"For instance, for the tag ````, this method " +"would be called as ``handle_starttag('a', [('href', 'https://" +"www.cwi.nl/')])``." msgstr "" -msgid "All entity references from :mod:`html.entities` are replaced in the attribute values." +#: ../../library/html.parser.rst:149 +msgid "" +"All entity references from :mod:`html.entities` are replaced in the " +"attribute values." msgstr "" -msgid "This method is called to handle the end tag of an element (e.g. ``
``)." +#: ../../library/html.parser.rst:155 +msgid "" +"This method is called to handle the end tag of an element (e.g. ``
``)." msgstr "" +#: ../../library/html.parser.rst:157 msgid "The *tag* argument is the name of the tag converted to lower case." msgstr "" -msgid "Similar to :meth:`handle_starttag`, but called when the parser encounters an XHTML-style empty tag (````). This method may be overridden by subclasses which require this particular lexical information; the default implementation simply calls :meth:`handle_starttag` and :meth:`handle_endtag`." +#: ../../library/html.parser.rst:162 +msgid "" +"Similar to :meth:`handle_starttag`, but called when the parser encounters an " +"XHTML-style empty tag (````). This method may be overridden by " +"subclasses which require this particular lexical information; the default " +"implementation simply calls :meth:`handle_starttag` " +"and :meth:`handle_endtag`." msgstr "" -msgid "This method is called to process arbitrary data (e.g. text nodes and the content of elements like ``script`` and ``style``)." +#: ../../library/html.parser.rst:170 +msgid "" +"This method is called to process arbitrary data (e.g. text nodes and the " +"content of elements like ``script`` and ``style``)." msgstr "" -msgid "This method is called to process a named character reference of the form ``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. ``'gt'``). This method is only called if *convert_charrefs* is false." +#: ../../library/html.parser.rst:176 +msgid "" +"This method is called to process a named character reference of the form " +"``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. " +"``'gt'``). This method is only called if *convert_charrefs* is false." msgstr "" -msgid "This method is called to process decimal and hexadecimal numeric character references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, the decimal equivalent for ``>`` is ``>``, whereas the hexadecimal is ``>``; in this case the method will receive ``'62'`` or ``'x3E'``. This method is only called if *convert_charrefs* is false." +#: ../../library/html.parser.rst:184 +msgid "" +"This method is called to process decimal and hexadecimal numeric character " +"references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, " +"the decimal equivalent for ``>`` is ``>``, whereas the hexadecimal is " +"``>``; in this case the method will receive ``'62'`` or ``'x3E'``. This " +"method is only called if *convert_charrefs* is false." msgstr "" -msgid "This method is called when a comment is encountered (e.g. ````)." +#: ../../library/html.parser.rst:193 +msgid "" +"This method is called when a comment is encountered (e.g. ```` will cause this method to be called with the argument ``' comment '``." +#: ../../library/html.parser.rst:195 +msgid "" +"For example, the comment ```` will cause this method to be " +"called with the argument ``' comment '``." msgstr "" -msgid "The content of Internet Explorer conditional comments (condcoms) will also be sent to this method, so, for ````, this method will receive ``'[if IE 9]>IE9-specific contentIE9-specific content``, this method will receive ``'[if IE 9]>IE9-specific content``)." +#: ../../library/html.parser.rst:205 +msgid "" +"This method is called to handle an HTML doctype declaration (e.g. ````)." msgstr "" -msgid "The *decl* parameter will be the entire contents of the declaration inside the ```` markup (e.g. ``'DOCTYPE html'``)." +#: ../../library/html.parser.rst:208 +msgid "" +"The *decl* parameter will be the entire contents of the declaration inside " +"the ```` markup (e.g. ``'DOCTYPE html'``)." msgstr "" -msgid "Method called when a processing instruction is encountered. The *data* parameter will contain the entire processing instruction. For example, for the processing instruction ````, this method would be called as ``handle_pi(\"proc color='red'\")``. It is intended to be overridden by a derived class; the base class implementation does nothing." +#: ../../library/html.parser.rst:214 +msgid "" +"Method called when a processing instruction is encountered. The *data* " +"parameter will contain the entire processing instruction. For example, for " +"the processing instruction ````, this method would be " +"called as ``handle_pi(\"proc color='red'\")``. It is intended to be " +"overridden by a derived class; the base class implementation does nothing." msgstr "" -msgid "The :class:`HTMLParser` class uses the SGML syntactic rules for processing instructions. An XHTML processing instruction using the trailing ``'?'`` will cause the ``'?'`` to be included in *data*." +#: ../../library/html.parser.rst:222 +msgid "" +"The :class:`HTMLParser` class uses the SGML syntactic rules for processing " +"instructions. An XHTML processing instruction using the trailing ``'?'`` " +"will cause the ``'?'`` to be included in *data*." msgstr "" -msgid "This method is called when an unrecognized declaration is read by the parser." +#: ../../library/html.parser.rst:229 +msgid "" +"This method is called when an unrecognized declaration is read by the parser." msgstr "" -msgid "The *data* parameter will be the entire contents of the declaration inside the ```` markup. It is sometimes useful to be overridden by a derived class. The base class implementation does nothing." +#: ../../library/html.parser.rst:231 +msgid "" +"The *data* parameter will be the entire contents of the declaration inside " +"the ```` markup. It is sometimes useful to be overridden by a " +"derived class. The base class implementation does nothing." msgstr "" +#: ../../library/html.parser.rst:239 msgid "Examples" msgstr "" -msgid "The following class implements a parser that will be used to illustrate more examples:" +#: ../../library/html.parser.rst:241 +msgid "" +"The following class implements a parser that will be used to illustrate more " +"examples:" msgstr "" +#: ../../library/html.parser.rst:244 msgid "" "from html.parser import HTMLParser\n" "from html.entities import name2codepoint\n" @@ -222,18 +359,23 @@ msgid "" "parser = MyHTMLParser()" msgstr "" +#: ../../library/html.parser.rst:280 msgid "Parsing a doctype:" msgstr "" +#: ../../library/html.parser.rst:282 msgid "" ">>> parser.feed('')\n" -"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"" +"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://" +"www.w3.org/TR/html4/strict.dtd\"" msgstr "" +#: ../../library/html.parser.rst:288 msgid "Parsing an element with a few attributes and a title:" msgstr "" +#: ../../library/html.parser.rst:290 msgid "" ">>> parser.feed('\"The')\n" "Start tag: img\n" @@ -246,11 +388,16 @@ msgid "" "End tag : h1" msgstr "" -msgid "The content of elements like ``script`` and ``style`` is returned as is, without further parsing:" +#: ../../library/html.parser.rst:302 +msgid "" +"The content of elements like ``script`` and ``style`` is returned as is, " +"without further parsing:" msgstr "" +#: ../../library/html.parser.rst:305 msgid "" -">>> parser.feed('')\n" +">>> parser.feed('