# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # Alireza Shabani (Revisto) , 2025 # Danial Behzadi , 2025 # Rafael Fontenelle , 2025 # Sepehr Rasouli , 2026 # arman mohebali , 2026 # msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-01 14:41+0330\n" "PO-Revision-Date: 2026-09-15 13:23+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/python/python-docs-fa/)\n" "Language: fa\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.6\n" msgid "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." msgstr "برخی از اشیاء موجود در پایتون، دسترسی به یک آرایه حافظه یا *بافر* زیرین را پوشش می‌دهند. چنین اشیایی شامل :class:`bytes` و :class:`bytearray` توکار و برخی نوع‌های توسعه‌ای مانند :class:`array.array` هستند. کتابخانه‌های شخص ثالث ممکن است برای مقاصد خاص، مانند پردازش تصویر یا تحلیل عددی، نوع‌های خود را تعریف کنند." 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:" msgstr "پایتون چنین امکانی را در سطح C و پایتون به شکل :ref:`پروتکل بافر ` فراهم می‌کند. این پروتکل دو سمت دارد:" 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 "در سمت تولید‌کننده، یک نوع می‌تواند «رابط بافر» را ارائه کند که به اشیاء آن نوع اجازه می‌دهد تا اطلاعاتی درباره‌ی بافر زیرین خود را آشکار کنند. این رابط در بخش :ref:`buffer-structs` شرح داده شده است؛ برای پایتون به :ref:`python-buffer-protocol` مراجعه کنید." 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 "در سمت مصرف‌کننده، چندین روش برای به دست آوردن اشاره‌گر به داده‌های خام زیربنایی یک شیء (برای مثال، یک پارامتر متد) در دسترس است. برای پایتون به :class:`memoryview` مراجعه کنید." 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 "اشیاء ساده‌ای مانند :class:`bytes` و :class:`bytearray` بافر زیرین خود را به شکل بایت‌محور در دسترس قرار می‌دهند. شکل‌های دیگری نیز ممکن است؛ برای مثال، عناصری که یک :class:`array.array` در دسترس قرار می‌دهد می‌توانند مقادیر چندبایتی باشند." 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 "نمونه‌ای از مصرف‌کنندگان رابط بافر، متد :meth:`~io.BufferedIOBase.write` در شیءهای پرونده است: هر شیء‌ای که بتواند دنباله‌ای از بایت‌ها را از طریق رابط بافر اکسپورت کند، می‌تواند در پرونده‌ای نوشته شود. در حالی که :meth:`!write` تنها به دسترسی فقط‌خواندنی به محتوای درونی شیء‌ای که به آن پاس داده شده نیاز دارد، متدهای دیگری مانند :meth:`~io.BufferedIOBase.readinto` به دسترسی نوشتن به محتوای آرگومان خود نیاز دارند. رابط بافر به شیءها اجازه می‌دهد تا اکسپورت کردن بافرهای خواندنی-نوشتنی و فقط‌خواندنی را به‌صورت انتخابی بپذیرند یا رد کنند." msgid "There are two ways for a consumer of the buffer interface to acquire a buffer over a target object:" msgstr "دو راه وجود دارد که مصرف‌کننده‌ی رابط بافر بتواند بافری را روی یک شیء هدف به دست آورد:" msgid "call :c:func:`PyObject_GetBuffer` with the right parameters;" msgstr ":c:func:`PyObject_GetBuffer` را با پارامترهای درست فراخوانی کنید؛" msgid "call :c:func:`PyArg_ParseTuple` (or one of its siblings) with one of the ``y*``, ``w*`` or ``s*`` :ref:`format codes `." msgstr "تابع :c:func:`PyArg_ParseTuple` (یا یکی از توابع هم‌خانواده‌ی آن) را با یکی از :ref:`کدهای قالب ` ``y*``، ``w*`` یا ``s*`` فراخوانی کنید." 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 "در هر دو مورد، :c:func:`PyBuffer_Release` باید زمانی که دیگر به بافر نیازی نیست فراخوانی شود. عدم انجام این کار می‌تواند به مشکلات مختلفی مانند نشت منابع منجر شود." msgid "The buffer protocol is now accessible in Python, see :ref:`python-buffer-protocol` and :class:`memoryview`." msgstr "پروتکل بافر اکنون در پایتون دسترسی‌پذیر است؛ به :ref:`python-buffer-protocol` و :class:`memoryview` مراجعه کنید." 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." msgstr "ساختارهای بافر (یا به‌سادگی «بافرها») به‌عنوان راهی برای افشای داده‌های دودویی از یک شیء دیگر به برنامه‌نویس پایتون مفید هستند. همچنین می‌توان از آن‌ها به‌عنوان سازوکاری برای اسلایس‌کردن بدون کپی استفاده کرد. با استفاده از توانایی آن‌ها در ارجاع به یک بلوک حافظه، می‌توان هر داده‌ای را به‌سادگی به برنامه‌نویس پایتون افشا کرد. این حافظه می‌تواند یک آرایه‌ی بزرگ و ثابت در یک توسعه C باشد، می‌تواند یک بلوک خام حافظه برای دستکاری پیش از انتقال به یک کتابخانه‌ی سیستم‌عامل باشد، یا می‌تواند برای به‌گردش درآوردن داده‌های ساختاریافته در قالب بومی و درون‌حافظه‌ای خود استفاده شود." 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 "برخلاف بیشتر نوع‌های داده‌ای که مفسر پایتون ارائه می‌کند، بافرها اشاره‌گرهای :c:type:`PyObject` نیستند، بلکه ساختارهای ساده‌ی C هستند. این امر امکان می‌دهد که آن‌ها به‌سادگی ساخته و کپی شوند. وقتی به یک دربرگیرنده‌ی عام برای بافر نیاز باشد، می‌توان یک شیء :ref:`memoryview ` ایجاد کرد." 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 "برای دستورالعمل‌های کوتاه درباره‌ی نحوه‌ی نوشتن یک شیء اکسپورتکننده (exporting object)، به :ref:`ساختارهای شیء بافر ` مراجعه کنید. برای به دست آوردن یک بافر، به :c:func:`PyObject_GetBuffer` مراجعه کنید." 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 "اشاره‌گری به ابتدای ساختار منطقی‌ای که توسط فیلدهای بافر توصیف می‌شود. این می‌تواند هر مکانی درون بلوک حافظه فیزیکی زیرین اکسپورتکننده باشد. برای مثال، با :c:member:`~Py_buffer.strides` منفی، مقدار ممکن است به انتهای بلوک حافظه اشاره کند." msgid "For :term:`contiguous` arrays, the value points to the beginning of the memory block." msgstr "برای آرایه‌های :term:`پیوسته `، مقدار به ابتدای بلوک حافظه اشاره می‌کند." 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 "ارجاعی جدید به شیء اکسپورتکننده. این ارجاع در مالکیت مصرف‌کننده است و به‌طور خودکار توسط :c:func:`PyBuffer_Release` آزاد می‌شود (یعنی شمارش ارجاع کاهش می‌یابد) و به ``NULL`` تنظیم می‌شود. این فیلد معادل مقدار بازگشتی هر تابع استاندارد C-API است." 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 "به‌عنوان یک مورد خاص، برای بافرهای *موقتی* که توسط :c:func:`PyMemoryView_FromBuffer` یا :c:func:`PyBuffer_FillInfo` پوشش داده می‌شوند، این فیلد ``NULL`` است. به‌طور کلی، اشیاء اکسپورتکننده به هیچ وجه نباید از این طرح استفاده کنند." 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 "``product(shape) * itemsize``. برای آرایه‌های پیوسته، این مقدار طول بلوک حافظه‌ی زیرین است. برای آرایه‌های ناپیوسته، این مقدار طولی است که ساختار منطقی در صورت کپی شدن به یک نمایش پیوسته خواهد داشت." 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 "دسترسی به ``((char *)buf)[0] up to ((char *)buf)[len-1]`` تنها زمانی معتبر است که بافر از طریق درخواستی که پیوستگی را تضمین می‌کند به دست آمده باشد. در بیشتر موارد، چنین درخواستی :c:macro:`PyBUF_SIMPLE` یا :c:macro:`PyBUF_WRITABLE` خواهد بود." msgid "An indicator of whether the buffer is read-only. This field is controlled by the :c:macro:`PyBUF_WRITABLE` flag." msgstr "نشانگری که مشخص می‌کند بافر فقط‌خواندنی است یا خیر. این فیلد توسط پرچم :c:macro:`PyBUF_WRITABLE` کنترل می‌شود." 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 "اندازه‌ی آیتم به بایت برای یک عنصر منفرد. همانند مقدار :func:`struct.calcsize` است که روی مقادیر غیر ``NULL`` :c:member:`~Py_buffer.format` فراخوانی می‌شود." 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 "استثنای مهم: اگر مصرف‌کننده‌ای بافر را بدون پرچم :c:macro:`PyBUF_FORMAT` درخواست کند، :c:member:`~Py_buffer.format` برابر ``NULL`` قرار می‌گیرد، اما :c:member:`~Py_buffer.itemsize` همچنان مقدار مربوط به قالب اصلی را دارد." 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 "اگر :c:member:`~Py_buffer.shape` موجود باشد، برابری ``product(shape) * itemsize == len`` همچنان برقرار است و مصرف‌کننده می‌تواند از :c:member:`~Py_buffer.itemsize` برای پیمایش بافر استفاده کند." 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 "اگر :c:member:`~Py_buffer.shape` در نتیجه‌ی درخواست :c:macro:`PyBUF_SIMPLE` یا :c:macro:`PyBUF_WRITABLE` برابر ``NULL`` باشد، مصرف‌کننده باید :c:member:`~Py_buffer.itemsize` را نادیده بگیرد و فرض کند که ``itemsize == 1`` است." 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 "رشته‌ای خاتمه‌یافته با *NULL* به سبک سینتکس ماژول :mod:`struct` که محتویات یک آیتم منفرد را توصیف می‌کند. اگر این ``NULL`` باشد، ``\"B\"`` (بایت‌های بدون علامت) فرض می‌شود." msgid "This field is controlled by the :c:macro:`PyBUF_FORMAT` flag." msgstr "این فیلد توسط پرچم :c:macro:`PyBUF_FORMAT` کنترل می‌شود." 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 "تعداد ابعادی که حافظه به‌صورت یک آرایه‌ی n-بعدی بازنمایی می‌کند. اگر ``0`` باشد، :c:member:`~Py_buffer.buf` به یک آیتم واحد اشاره می‌کند که نمایانگر یک اسکالر است. در این حالت، :c:member:`~Py_buffer.shape`، :c:member:`~Py_buffer.strides` و :c:member:`~Py_buffer.suboffsets` باید ``NULL`` باشند. حداکثر تعداد ابعاد توسط :c:macro:`PyBUF_MAX_NDIM` تعیین می‌شود." 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 "آرایه‌ای از :c:type:`Py_ssize_t` به طول :c:member:`~Py_buffer.ndim` که شکل حافظه را به‌عنوان یک آرایه‌ی n-بعدی نشان می‌دهد. توجه داشته باشید که ``shape[0] * ... * shape[ndim-1] * itemsize`` حتماً باید با :c:member:`~Py_buffer.len` برابر باشد." msgid "Shape values are restricted to ``shape[n] >= 0``. The case ``shape[n] == 0`` requires special attention. See `complex arrays`_ for further information." msgstr "مقادیر شکل به ``shape[n] >= 0`` محدود هستند. مورد ``shape[n] == 0`` نیاز به توجه ویژه دارد. برای اطلاعات بیشتر به `complex arrays`_ مراجعه کنید." 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." msgstr "آرایه‌ای از :c:type:`Py_ssize_t` به طول :c:member:`~Py_buffer.ndim` که مشخص می‌کند برای رسیدن به عنصر جدید در هر بُعد باید چند بایت را رد کرد." 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 "مقادیر گام (stride) می‌توانند هر عدد صحیحی باشند. برای آرایه‌های معمولی، گام‌ها معمولاً مثبت هستند، اما مصرف‌کننده باید حتماً بتواند مورد ``strides[n] <= 0`` را مدیریت کند. برای اطلاعات بیشتر به `complex arrays`_ مراجعه کنید." msgid "The strides array is read-only for the consumer." msgstr "آرایه‌ی strides برای مصرف‌کننده فقط‌خواندنی است." 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 "آرایه‌ای از :c:type:`Py_ssize_t` به طول :c:member:`~Py_buffer.ndim`. اگر ``suboffsets[n] >= 0`` باشد، مقادیر ذخیره‌شده در راستای بعد n-اُم اشاره‌گر هستند و مقدار زیرآفست تعیین می‌کند که پس از ارجاع‌زدایی (de-referencing)، چند بایت باید به هر اشاره‌گر افزوده شود. مقدار منفیِ زیرآفست نشان می‌دهد که نباید ارجاع‌زدایی انجام شود (گام‌برداری (striding) در یک بلوک حافظه‌ی پیوسته)." msgid "If all suboffsets are negative (i.e. no de-referencing is needed), then this field must be ``NULL`` (the default value)." msgstr "اگر همه‌ی suboffsets منفی باشند (یعنی نیازی به ارجاع‌زدایی نیست)، آن‌گاه این فیلد باید ``NULL`` باشد (مقدار پیش‌فرض)." 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 "این نوع نمایش آرایه توسط Python Imaging Library (PIL) استفاده می‌شود. برای اطلاعات بیشتر درباره‌ی نحوه‌ی دسترسی به عناصر چنین آرایه‌ای، به `complex arrays`_ مراجعه کنید." msgid "The suboffsets array is read-only for the consumer." msgstr "آرایه‌ی suboffsets برای مصرف‌کننده فقط‌خواندنی است." 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 "این مورد برای استفاده داخلی توسط شیء اکسپورتکننده است. برای مثال، اکسپورتکننده ممکن است آن را به یک عدد صحیح قالب‌ریزی مجدد کند و از آن برای ذخیره پرچم‌هایی استفاده کند که مشخص می‌کنند آرایه‌های shape، strides و suboffsets هنگام رها شدن بافر باید آزاد شوند یا خیر. مصرف‌کننده به هیچ وجه نباید این مقدار را تغییر دهد." 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." msgstr "حداکثر تعداد ابعادی که حافظه بازنمایی می‌کند. اکسپورتکنندگان باید (MUST) این محدودیت را رعایت کنند و بهتر است (SHOULD) مصرف‌کنندگان بافرهای چندبعدی بتوانند تا :c:macro:`!PyBUF_MAX_NDIM` بعد را مدیریت کنند. در حال حاضر روی ۶۴ تنظیم شده است." 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." msgstr "بافرها معمولاً با ارسال درخواست بافر به یک شیء اکسپورتکننده از طریق :c:func:`PyObject_GetBuffer` به دست می‌آیند. از آنجا که پیچیدگی ساختار منطقی حافظه می‌تواند به‌شدت متفاوت باشد، مصرف‌کننده از آرگومان *پرچم‌ها* برای تعیین نوع دقیق بافری که می‌تواند آن را مدیریت کند استفاده می‌کند." msgid "All :c:type:`Py_buffer` fields are unambiguously defined by the request type." msgstr "همه‌ی فیلدهای :c:type:`Py_buffer` به‌طور بی‌ابهام توسط نوع درخواست تعریف می‌شوند." 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`." msgstr "فیلد‌های زیر تحت تأثیر *پرچم‌ها* قرار نمی‌گیرند و همیشه باید با مقادیر صحیح پر شوند: :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`." 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." msgstr "فیلد :c:member:`~Py_buffer.readonly` را کنترل می‌کند. اگر تنظیم شده باشد، اکسپورتکننده باید یا بافر نوشتنی فراهم کند یا شکست را گزارش دهد. در غیر این صورت، اکسپورتکننده می‌تواند بافر فقط‌خواندنی یا نوشتنی فراهم کند، اما این انتخاب باید برای همه‌ی مصرف‌کنندگان یکسان باشد. برای مثال، می‌توان از :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE` برای درخواست یک بافر نوشتنی ساده استفاده کرد." msgid "This is an alias to :c:macro:`PyBUF_WRITABLE`." msgstr "این یک نام مستعار برای :c:macro:`PyBUF_WRITABLE` است." 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 "فیلد :c:member:`~Py_buffer.format` را کنترل می‌کند. اگر تنظیم شده باشد، این فیلد باید به‌درستی پر شود. در غیر این صورت، این فیلد باید ``NULL`` باشد." 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 "می‌توان :c:macro:`PyBUF_WRITABLE` را با هر یک از پرچم‌های بخش بعدی از طریق عملگر \\| ترکیب کرد. از آنجا که :c:macro:`PyBUF_SIMPLE` به صورت 0 تعریف شده است، می‌توان از :c:macro:`PyBUF_WRITABLE` به عنوان یک پرچم مستقل برای درخواست یک بافر ساده‌ی نوشتنی استفاده کرد." 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:macro:`PyBUF_FORMAT` باید با عملگر \\| به هر یک از پرچم‌ها به‌جز :c:macro:`PyBUF_SIMPLE` اضافه شود، زیرا مورد دوم از قبل قالب ``B`` (بایت‌های بدون علامت) را در بر می‌گیرد. :c:macro:`!PyBUF_FORMAT` را نمی‌توان به‌تنهایی استفاده کرد." msgid "shape, strides, suboffsets" msgstr "شکل، گام‌ها (strides)، زیرآفست‌ها (suboffsets)" 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 "پرچم‌هایی که ساختار منطقی حافظه را کنترل می‌کنند، به ترتیب نزولی پیچیدگی فهرست شده‌اند. توجه داشته باشید که هر پرچم، تمام بیت‌های پرچم‌های پایین‌تر از آن را در بر می‌گیرد." msgid "Request" msgstr "درخواست" msgid "shape" msgstr "شکل" msgid "strides" msgstr "گام‌ها" msgid "suboffsets" msgstr "suboffsets" msgid "yes" msgstr "بله" msgid "if needed" msgstr "در صورت نیاز" msgid "NULL" msgstr "NULL" 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." msgstr "می‌توان :term:`پیوستگی ` به سبک C یا Fortran را به‌طور صریح درخواست کرد، هم به همراه اطلاعات گام (stride) و هم بدون آن. بدون اطلاعات گام، بافر باید پیوسته به سبک C (C-contiguous) باشد." msgid "contig" msgstr "پیوسته" msgid "C" msgstr "C" msgid "F" msgstr "F" msgid "C or F" msgstr "C یا F" msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" 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." msgstr "تمامی درخواست‌های ممکن به‌طور کامل با ترکیبی از پرچم‌های بخش قبلی تعریف می‌شوند. برای راحتی، پروتکل بافر ترکیب‌های پرکاربرد را به‌صورت پرچم‌های تکی فراهم می‌کند." msgid "In the following table *U* stands for undefined contiguity. The consumer would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "در جدول زیر *U* نمایانگر پیوستگی تعریف‌نشده است. مصرف‌کننده برای تعیین پیوستگی باید :c:func:`PyBuffer_IsContiguous` را فراخوانی کند." msgid "readonly" msgstr "فقط‌خواندنی" msgid "format" msgstr "قالب" msgid "U" msgstr "U" msgid "0" msgstr "0" msgid "1 or 0" msgstr "۱ یا ۰" msgid "Complex arrays" msgstr "آرایه‌های پیچیده" msgid "NumPy-style: shape and strides" msgstr "به سبک NumPy: شکل و گام‌ها" 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 "ساختار منطقی آرایه‌های به سبک NumPy توسط :c:member:`~Py_buffer.itemsize`، :c:member:`~Py_buffer.ndim`، :c:member:`~Py_buffer.shape` و :c:member:`~Py_buffer.strides` تعریف می‌شود." 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 "اگر ``ndim == 0`` باشد، مکان حافظه‌ای که :c:member:`~Py_buffer.buf` به آن اشاره می‌کند، به‌عنوان یک اسکالر با اندازه‌ی :c:member:`~Py_buffer.itemsize` تفسیر می‌شود. در این حالت، هر دو :c:member:`~Py_buffer.shape` و :c:member:`~Py_buffer.strides` برابر ``NULL`` هستند." 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:member:`~Py_buffer.strides` برابر ``NULL`` باشد، آرایه به‌عنوان یک آرایه‌ی C استاندارد n-بعدی تفسیر می‌شود. در غیر این صورت، مصرف‌کننده باید به یک آرایه‌ی n-بعدی به شرح زیر دسترسی داشته باشد:" msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];\n" "item = *((typeof(item) *)ptr);" msgstr "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];\n" "item = *((typeof(item) *)ptr);" 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:member:`~Py_buffer.buf` می‌تواند به هر مکانی درون بلوک حافظه‌ی واقعی اشاره کند. یک اکسپورتکننده (exporter) می‌تواند اعتبار یک بافر را با این تابع بررسی کند:" msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" " the bounds of the allocated memory:\n" " char *mem: start of the physical memory block\n" " memlen: length of the physical memory block\n" " offset: (char *)buf - mem\n" " \"\"\"\n" " if offset % itemsize:\n" " return False\n" " if offset < 0 or offset+itemsize > memlen:\n" " return False\n" " if any(v % itemsize for v in strides):\n" " return False\n" "\n" " if ndim <= 0:\n" " return ndim == 0 and not shape and not strides\n" " if 0 in shape:\n" " return True\n" "\n" " imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" " if strides[j] <= 0)\n" " imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" " if strides[j] > 0)\n" "\n" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" " the bounds of the allocated memory:\n" " char *mem: start of the physical memory block\n" " memlen: length of the physical memory block\n" " offset: (char *)buf - mem\n" " \"\"\"\n" " if offset % itemsize:\n" " return False\n" " if offset < 0 or offset+itemsize > memlen:\n" " return False\n" " if any(v % itemsize for v in strides):\n" " return False\n" "\n" " if ndim <= 0:\n" " return ndim == 0 and not shape and not strides\n" " if 0 in shape:\n" " return True\n" "\n" " imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" " if strides[j] <= 0)\n" " imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" " if strides[j] > 0)\n" "\n" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgid "PIL-style: shape, strides and suboffsets" msgstr "به سبک PIL: shape، strides و suboffsets" 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 "علاوه بر آیتم‌های معمولی، آرایه‌های به سبک PIL می‌توانند شامل اشاره‌گرهایی باشند که برای رسیدن به عنصر بعدی در یک بعد باید دنبال شوند. برای مثال، آرایه سه‌بعدی معمولی C یعنی ``char v[2][2][3]`` را می‌توان به‌صورت آرایه‌ای از ۲ اشاره‌گر به ۲ آرایه دوبعدی نیز در نظر گرفت: ``char (*v[2])[2][3]``. در نمایش زیرآفست‌ها (suboffsets)، این دو اشاره‌گر می‌توانند در ابتدای :c:member:`~Py_buffer.buf` تعبیه شوند و به دو آرایه ``char x[2][3]`` اشاره کنند که می‌توانند در هر جای حافظه قرار داشته باشند." 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 "تابع زیر وقتی که هم گام‌ها و هم زیرآفست‌ها (suboffsets) غیر ``NULL`` باشند، اشاره‌گر به عنصری در آرایه‌ی N-بعدی را که یک اندیس N-بعدی به آن اشاره می‌کند برمی‌گرداند::" msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" " char *pointer = (char*)buf;\n" " int i;\n" " for (i = 0; i < ndim; i++) {\n" " pointer += strides[i] * indices[i];\n" " if (suboffsets[i] >=0 ) {\n" " pointer = *((char**)pointer) + suboffsets[i];\n" " }\n" " }\n" " return (void*)pointer;\n" "}" msgstr "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" " char *pointer = (char*)buf;\n" " int i;\n" " for (i = 0; i < ndim; i++) {\n" " pointer += strides[i] * indices[i];\n" " if (suboffsets[i] >=0 ) {\n" " pointer = *((char**)pointer) + suboffsets[i];\n" " }\n" " }\n" " return (void*)pointer;\n" "}" 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." msgstr "اگر *obj* از رابط بافر پشتیبانی کند، ``1`` و در غیر این صورت ``0`` را برمی‌گرداند. برگرداندن ``1`` تضمین نمی‌کند که :c:func:`PyObject_GetBuffer` موفق شود. این تابع همیشه موفق است." 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 "درخواستی به *اکسپورتکننده* ارسال می‌شود تا *نما* را همان‌طور که *پرچم‌ها* مشخص کرده‌اند، پر کند. اگر اکسپورتکننده نتواند بافری از دقیقاً همان نوع ارائه دهد، باید استثنای :exc:`BufferError` را برانگیزد، ``view->obj`` را بر ``NULL`` تنظیم کند و ``-1`` برگرداند." 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 "در صورت موفقیت، *view* را پر می‌کند، ``view->obj`` را به ارجاع جدیدی به *exporter* تنظیم می‌کند و 0 را برمی‌گرداند. در مورد زنجیره‌ای از ارائه‌دهندگان بافر که درخواست‌ها را به یک شیء واحد هدایت مجدد می‌کنند، ``view->obj`` می‌تواند به‌جای *exporter* به این شیء اشاره کند (به :ref:`ساختارهای شیء بافر ` مراجعه کنید)." 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 "فراخوانی‌های موفق :c:func:`PyObject_GetBuffer` باید با فراخوانی‌های :c:func:`PyBuffer_Release` جفت شوند، مشابه :c:func:`malloc` و :c:func:`free`. بنابراین، پس از آنکه مصرف‌کننده کار خود را با بافر به پایان برد، :c:func:`PyBuffer_Release` باید دقیقاً یک‌بار فراخوانی شود." 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 "*نمای* بافر را آزاد می‌کند و :term:`ارجاع قوی ` (یعنی کاهش شمارش ارجاع) به شیء پشتیبان نما، ``view->obj``، را آزاد می‌کند. این تابع باید زمانی که دیگر از بافر استفاده نمی‌شود حتماً فراخوانی شود، در غیر این صورت ممکن است نشت ارجاع رخ دهد." msgid "It is an error to call this function on a buffer that was not obtained via :c:func:`PyObject_GetBuffer`." msgstr "فراخوانی این تابع روی بافری که از طریق :c:func:`PyObject_GetBuffer` به دست نیامده است، خطا است." msgid "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:`~Py_buffer.format`. On error, raise an exception and return -1." msgstr ":c:member:`~Py_buffer.itemsize` ضمنی را از :c:member:`~Py_buffer.format` برمی‌گرداند. در صورت خطا، یک استثنا مطرح می‌کند و -1 برمی‌گرداند." 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 "اگر حافظه‌ی تعریف‌شده توسط *view* به سبک C (*order* برابر ``'C'`` است) یا به سبک Fortran (*order* برابر ``'F'`` است) :term:`پیوسته ` باشد یا هر یک از این دو (*order* برابر ``'A'`` است)، ``1`` را برمی‌گرداند. در غیر این صورت ``0`` برمی‌گرداند. این تابع همیشه موفق می‌شود." 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 "به دست آوردن ناحیه حافظه‌ای درون *view* داده‌شده که *indices* به آن اشاره می‌کند. *indices* باید به آرایه‌ای از ``view->ndim`` اندیس اشاره کند." msgid "Copy contiguous *len* bytes from *buf* to *view*. *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 "تعداد *len* بایت پیوسته را از *buf* به *view* کپی کنید. پارامتر *order* می‌تواند ``'C'``، ``'F'`` یا ``'A'`` باشد (به ترتیب برای ترتیب‌بندی سبک C، سبک فرترن یا هرکدام). در صورت موفقیت ``0`` و در صورت خطا ``-1`` برگردانده می‌شود." 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 "*len* بایت از *src* را به نمایش پیوسته‌ی آن در *buf* کپی می‌کند. *order* می‌تواند ``'C'`` یا ``'F'`` یا ``'A'`` باشد (برای ترتیب به سبک C یا سبک Fortran یا هر یک از این دو). در صورت موفقیت ``0`` و در صورت خطا ``-1`` برگردانده می‌شود." msgid "This function fails if *len* != *src->len*." msgstr "این تابع در صورتی که *len* != *src->len* باشد شکست می‌خورد." msgid "Copy data from *src* to *dest* buffer. Can convert between C-style and or Fortran-style buffers." msgstr "داده‌ها را از بافر *src* به بافر *dest* کپی می‌کند. می‌تواند بین بافرهای سبک C و یا سبک Fortran تبدیل انجام دهد." msgid "``0`` is returned on success, ``-1`` on error." msgstr "در صورت موفقیت ``0`` و در صورت خطا ``-1`` برگردانده می‌شود." 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 "آرایه‌ی *strides* را با گام‌های بایتی (byte-strides) یک آرایه‌ی :term:`پیوسته ` (به سبک C اگر *order* برابر با ``'C'`` باشد، یا به سبک Fortran اگر *order* برابر با ``'F'`` باشد) که شکل داده‌شده و تعداد بایت داده‌شده به ازای هر عنصر را دارد، پر کنید." 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 "درخواست‌های بافر را برای اکسپورتکننده‌ای (exporter) که می‌خواهد *buf* را با اندازه‌ی *len* و با قابلیت نوشتنِ تنظیم‌شده بر اساس *readonly* افشا کند، مدیریت می‌کند. *buf* به‌عنوان دنباله‌ای از بایت‌های بدون علامت تفسیر می‌شود." 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 "آرگومان *flags* نوع درخواست را نشان می‌دهد. این تابع همیشه *view* را مطابق با flags پر می‌کند، مگر آنکه *buf* به‌عنوان فقط‌خواندنی تعیین‌شده باشد و :c:macro:`PyBUF_WRITABLE` در *flags* تنظیم‌شده باشد." 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 "در صورت موفقیت، ``view->obj`` را برابر ارجاعی جدید به *exporter* قرار دهید و 0 را برگردانید. در غیر این صورت، استثنای :exc:`BufferError` را raise کنید، ``view->obj`` را برابر ``NULL`` قرار دهید و ``-1`` را برگردانید؛" 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 "اگر این تابع به عنوان بخشی از :ref:`getbufferproc ` استفاده شود، *exporter* باید برابر با شیء اکسپورتکننده تنظیم شود و *flags* باید دست‌نخورده ارسال شود. در غیر این صورت، *exporter* باید ``NULL`` باشد." msgid "buffer protocol" msgstr "پروتکل بافر" msgid "buffer interface" msgstr "رابط بافر" msgid "(see buffer protocol)" msgstr "(به پروتکل بافر مراجعه کنید)" msgid "buffer object" msgstr "شیء بافر" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs (نوع C)" msgid "contiguous" msgstr "پیوسته" msgid "C-contiguous" msgstr "پیوسته به سبک C" msgid "Fortran contiguous" msgstr "پیوسته به سبک فورترن"