chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
90ebe3a4-16df-4b18-8aaf-994137e6e01e | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,900 | supabase-export-v2 | 8180d2c47c66b77f | .. function:: register_dialect(name, /, dialect='excel', **fmtparams)
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. Fo... | trusted_official_docs | CPython Docs | .. function:: register_dialect(name, /, dialect='excel', **fmtparams)
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. Fo... | .. function:: register_dialect(name, /, dialect='excel', **fmtparams)
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. Fo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9365b5bc-2605-4718-9005-bc35e001304f | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,912 | supabase-export-v2 | 91d0cb7cf3dbb265 | 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.
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 omit... | trusted_official_docs | CPython Docs | 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.
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 omit... | 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.
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 omit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9783e2fa-f508-437e-ac2b-a44a50690987 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,919 | supabase-export-v2 | 47f02f32d993396a | A short usage example::
>>> import csv
>>> with open('names.csv', newline='') as csvfile:
... reader = csv.DictReader(csvfile)
... for row in reader:
... print(row['first_name'], row['last_name'])
... Eric Idle
John Cleese | trusted_official_docs | CPython Docs | A short usage example::
>>> import csv
>>> with open('names.csv', newline='') as csvfile:
... reader = csv.DictReader(csvfile)
... for row in reader:
... print(row['first_name'], row['last_name'])
... Eric Idle
John Cleese | A short usage example::
>>> import csv
>>> with open('names.csv', newline='') as csvfile:
... reader = csv.DictReader(csvfile)
... for row in reader:
... print(row['first_name'], row['last_name'])
... Eric Idle
John Cleese | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9a4cc6f7-0092-45b8-8e34-133541730b29 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 20,015 | supabase-export-v2 | 001ff5aa0ad5be48 | Writer Objects --------------
: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... | trusted_official_docs | CPython Docs | Writer Objects --------------
: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... | Writer Objects --------------
: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... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9d628c52-a06c-413c-a545-5c2d449584b9 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,969 | supabase-export-v2 | 6b40cad1f81e156e | .. data:: QUOTE_STRINGS
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. | trusted_official_docs | CPython Docs | .. data:: QUOTE_STRINGS
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. | .. data:: QUOTE_STRINGS
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a17df8a6-bd5d-4692-80d0-8f9364ca6c41 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,924 | supabase-export-v2 | f374de8dd53cf867 | Note that unlike the :class:`DictReader` class, the *fieldnames* parameter of the :class:`DictWriter` class is not optional.
If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`. | trusted_official_docs | CPython Docs | Note that unlike the :class:`DictReader` class, the *fieldnames* parameter of the :class:`DictWriter` class is not optional.
If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`. | Note that unlike the :class:`DictReader` class, the *fieldnames* parameter of the :class:`DictWriter` class is not optional.
If the argument passed to *fieldnames* is an iterator, it will be coerced to a :class:`list`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a219fd26-2f54-40c9-91ef-cf5bdd0498af | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,994 | supabase-export-v2 | 72ac6f9c16e987d3 | .. attribute:: Dialect.quotechar
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 esca... | trusted_official_docs | CPython Docs | .. attribute:: Dialect.quotechar
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 esca... | .. attribute:: Dialect.quotechar
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 esca... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a291ca18-1310-4976-a08e-8c1a760ea533 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,893 | supabase-export-v2 | b258470283819bc6 | A short usage example::
>>> import csv
>>> with open('eggs.csv', newline='') as csvfile:
... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
... for row in spamreader:
... print(', '.join(row))
Spam, Spam, Spam, Spam, Spam, Baked Beans
Spam, Lovely Spam, Wonderful Spam | trusted_official_docs | CPython Docs | A short usage example::
>>> import csv
>>> with open('eggs.csv', newline='') as csvfile:
... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
... for row in spamreader:
... print(', '.join(row))
Spam, Spam, Spam, Spam, Spam, Baked Beans
Spam, Lovely Spam, Wonderful Spam | A short usage example::
>>> import csv
>>> with open('eggs.csv', newline='') as csvfile:
... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
... for row in spamreader:
... print(', '.join(row))
Spam, Spam, Spam, Spam, Spam, Baked Beans
Spam, Lovely Spam, Wonderful Spam | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a41c7936-2b40-428b-90e0-039af3e88a2f | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,978 | supabase-export-v2 | 7b06028f3f9165c1 | 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.
Dialects support the following attributes: | trusted_official_docs | CPython Docs | 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.
Dialects support the following attributes: | 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.
Dialects support the following attributes: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a50d96c2-b283-43dc-904f-088091b4e8f9 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,963 | supabase-export-v2 | 1d1cbde2f6cbb9ce | .. data:: QUOTE_NONE
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... | trusted_official_docs | CPython Docs | .. data:: QUOTE_NONE
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... | .. data:: QUOTE_NONE
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... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a895a0b7-db50-46b9-ac07-9d490e8db65e | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 20,042 | supabase-export-v2 | 7a0330c3db7ca6b1 | = 'some.csv' with open(filename, newline='') as f: reader = csv.reader(f) try: for row in reader: print(row) except csv.Error as e: sys.exit(f'file {filename}, line {reader.line_num}: {e}')
And while the module doesn't directly support parsing strings, it can easily be
done:: | trusted_official_docs | CPython Docs | = 'some.csv' with open(filename, newline='') as f: reader = csv.reader(f) try: for row in reader: print(row) except csv.Error as e: sys.exit(f'file {filename}, line {reader.line_num}: {e}')
And while the module doesn't directly support parsing strings, it can easily be
done:: | = 'some.csv' with open(filename, newline='') as f: reader = csv.reader(f) try: for row in reader: print(row) except csv.Error as e: sys.exit(f'file {filename}, line {reader.line_num}: {e}')
And while the module doesn't directly support parsing strings, it can easily be
done:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ab652a23-a70f-40d8-a8b7-aa5dcea3bafe | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,977 | supabase-export-v2 | bdb7baa0b76d0bd9 | Dialects and Formatting Parameters ----------------------------------
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 C... | trusted_official_docs | CPython Docs | Dialects and Formatting Parameters ----------------------------------
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 C... | Dialects and Formatting Parameters ----------------------------------
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 C... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bb2b132a-8eaf-479f-b080-178d94fc4adb | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,961 | supabase-export-v2 | f0eadc892d3fac82 | Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`.
.. note::
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_NON... | trusted_official_docs | CPython Docs | Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`.
.. note::
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_NON... | Instructs :class:`reader` objects to convert all non-quoted fields to type :class:`float`.
.. note::
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_NON... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bd20602f-fb90-4400-8578-1196cd4604f6 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,896 | supabase-export-v2 | d86191cd3340abbd | 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 e... | trusted_official_docs | CPython Docs | 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 e... | 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 e... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
be98e85b-0bf2-4eae-8070-11e81c4040f2 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,995 | supabase-export-v2 | 3d707b63b392acca | 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`.
.. versionchanged:: 3.11
An empty *quotechar* is not allowed. | trusted_official_docs | CPython Docs | 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`.
.. versionchanged:: 3.11
An empty *quotechar* is not allowed. | 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`.
.. versionchanged:: 3.11
An empty *quotechar* is not allowed. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bed7af7c-5f21-438f-b003-307e10cf504c | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,938 | supabase-export-v2 | e75ca9c4aa67758e | .. class:: unix_dialect()
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'``. | trusted_official_docs | CPython Docs | .. class:: unix_dialect()
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'``. | .. class:: unix_dialect()
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'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cc824c35-6d4e-4405-9084-66badfcf0360 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,914 | supabase-export-v2 | ff107dc6183dd014 | 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``).
All other optional or keyword arguments are passed to the underlying
:class:`reader` instance. | trusted_official_docs | CPython Docs | 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``).
All other optional or keyword arguments are passed to the underlying
:class:`reader` instance. | 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``).
All other optional or keyword arguments are passed to the underlying
:class:`reader` instance. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d6f8b6aa-087a-4a8e-ae2d-ec3fc128dcf6 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,982 | supabase-export-v2 | bb6181b54990db86 | .. attribute:: Dialect.doublequote
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`. | trusted_official_docs | CPython Docs | .. attribute:: Dialect.doublequote
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`. | .. attribute:: Dialect.doublequote
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`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d866eb08-62a0-471f-8bb2-5612062f17d0 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,911 | supabase-export-v2 | e732295cd144c497 | .. class:: DictReader(f, fieldnames=None, restkey=None, restval=None, \ dialect='excel', *args, **kwds)
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. | trusted_official_docs | CPython Docs | .. class:: DictReader(f, fieldnames=None, restkey=None, restval=None, \ dialect='excel', *args, **kwds)
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. | .. class:: DictReader(f, fieldnames=None, restkey=None, restval=None, \ dialect='excel', *args, **kwds)
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d894ad3d-31fb-45ab-82cd-0154e9a05493 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,920 | supabase-export-v2 | 9e3b2d6d42b8e0f6 | import csv >>> with open('names.csv', newline='') as csvfile: ... reader = csv.DictReader(csvfile) ... for row in reader: ... print(row['first_name'], row['last_name']) ... Eric Idle John Cleese
>>> print(row)
{'first_name': 'John', 'last_name': 'Cleese'} | trusted_official_docs | CPython Docs | import csv >>> with open('names.csv', newline='') as csvfile: ... reader = csv.DictReader(csvfile) ... for row in reader: ... print(row['first_name'], row['last_name']) ... Eric Idle John Cleese
>>> print(row)
{'first_name': 'John', 'last_name': 'Cleese'} | import csv >>> with open('names.csv', newline='') as csvfile: ... reader = csv.DictReader(csvfile) ... for row in reader: ... print(row['first_name'], row['last_name']) ... Eric Idle John Cleese
>>> print(row)
{'first_name': 'John', 'last_name': 'Cleese'} | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dada73d3-2174-4510-b7b1-af39a28e261a | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,923 | supabase-export-v2 | 8885bb64494312d8 | 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.
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter
of the :class:`DictWriter` class is not optional. | trusted_official_docs | CPython Docs | 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.
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter
of the :class:`DictWriter` class is not optional. | 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.
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter
of the :class:`DictWriter` class is not optional. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dbfebdbe-1639-4a0c-ae5b-f6a0fad5ee51 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,966 | supabase-export-v2 | dda032344025df26 | .. data:: QUOTE_NOTNULL
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. | trusted_official_docs | CPython Docs | .. data:: QUOTE_NOTNULL
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. | .. data:: QUOTE_NOTNULL
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df85058a-a3a7-4cbd-b13f-90e4434bcdc9 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,899 | supabase-export-v2 | 32d1d5ece63cf740 | csv with open('eggs.csv', 'w', newline='') as csvfile: spamwriter = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['Spam'] * 5 + ['Baked Beans']) spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
.. function:: register_dialect(name, /, dialect='excel', **f... | trusted_official_docs | CPython Docs | csv with open('eggs.csv', 'w', newline='') as csvfile: spamwriter = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['Spam'] * 5 + ['Baked Beans']) spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
.. function:: register_dialect(name, /, dialect='excel', **f... | csv with open('eggs.csv', 'w', newline='') as csvfile: spamwriter = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL) spamwriter.writerow(['Spam'] * 5 + ['Baked Beans']) spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
.. function:: register_dialect(name, /, dialect='excel', **f... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dfbf8465-78e2-4e9a-b06e-16f831227347 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,929 | supabase-export-v2 | 70a86ecc9a5acec4 | .. class:: Dialect
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:`r... | trusted_official_docs | CPython Docs | .. class:: Dialect
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:`r... | .. class:: Dialect
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:`r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2242eb0-ae33-42d1-91d8-ba5a244a2232 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,922 | supabase-export-v2 | 9c2edbae51db8245 | .. class:: DictWriter(f, fieldnames, restval='', extrasaction='raise', \ dialect='excel', *args, **kwds)
Create an object which operates like a regular writer but maps dictionaries
onto output rows. The *fieldnames* parameter is a :mod:`sequence
<collections.abc>` of keys that identify the order in which values in th... | trusted_official_docs | CPython Docs | .. class:: DictWriter(f, fieldnames, restval='', extrasaction='raise', \ dialect='excel', *args, **kwds)
Create an object which operates like a regular writer but maps dictionaries
onto output rows. The *fieldnames* parameter is a :mod:`sequence
<collections.abc>` of keys that identify the order in which values in th... | .. class:: DictWriter(f, fieldnames, restval='', extrasaction='raise', \ dialect='excel', *args, **kwds)
Create an object which operates like a regular writer but maps dictionaries
onto output rows. The *fieldnames* parameter is a :mod:`sequence
<collections.abc>` of keys that identify the order in which values in th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2c6dcac-df1b-487f-a6d6-e46aedee83ad | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 20,035 | supabase-export-v2 | 906cd61ce28cea40 | import csv with open('some.csv', 'w', newline='') as f: writer = csv.writer(f) writer.writerows(someiterable)
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... | trusted_official_docs | CPython Docs | import csv with open('some.csv', 'w', newline='') as f: writer = csv.writer(f) writer.writerows(someiterable)
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... | import csv with open('some.csv', 'w', newline='') as f: writer = csv.writer(f) writer.writerows(someiterable)
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... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e32fb7ac-c093-45a8-95b9-3dca9385f6f4 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 20,006 | supabase-export-v2 | c068d5418aa3e4fb | 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)``.
Reader objects have the following public attributes: | trusted_official_docs | CPython Docs | 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)``.
Reader objects have the following public attributes: | 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)``.
Reader objects have the following public attributes: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e38d361a-e58e-45a3-8a02-a70262496ebe | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 19,895 | supabase-export-v2 | e939aa767c9eacee | .. function:: writer(csvfile, /, dialect='excel', **fmtparams)
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
``newl... | trusted_official_docs | CPython Docs | .. function:: writer(csvfile, /, dialect='excel', **fmtparams)
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
``newl... | .. function:: writer(csvfile, /, dialect='excel', **fmtparams)
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
``newl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e4a7f12c-a09d-4143-b70f-f71d3a76e1d5 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 20,037 | supabase-export-v2 | 7200224b7d3b8bb0 | import csv with open('some.csv', newline='', encoding='utf-8') as f: reader = csv.reader(f) for row in reader: print(row)
The same applies to writing in something other than the system default
encoding: specify the encoding argument when opening the output file. | trusted_official_docs | CPython Docs | import csv with open('some.csv', newline='', encoding='utf-8') as f: reader = csv.reader(f) for row in reader: print(row)
The same applies to writing in something other than the system default
encoding: specify the encoding argument when opening the output file. | import csv with open('some.csv', newline='', encoding='utf-8') as f: reader = csv.reader(f) for row in reader: print(row)
The same applies to writing in something other than the system default
encoding: specify the encoding argument when opening the output file. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f5ee3a90-147d-4ddf-8b8d-0c8c469eb9a2 | CPython Docs | file://datasets/cpython/Doc/library/csv.rst | unknown | ce4608c4-a14b-4139-ac99-bb1402e602b2 | 20,041 | supabase-export-v2 | aab136b261d1191a | A slightly more advanced use of the reader --- catching and reporting errors::
import csv, sys
filename = 'some.csv'
with open(filename, newline='') as f:
reader = csv.reader(f)
try:
for row in reader:
print(row)
except csv.Error as e:
sys.exit(f'file {filename}, line {reader.line_num}: {e}') | trusted_official_docs | CPython Docs | A slightly more advanced use of the reader --- catching and reporting errors::
import csv, sys
filename = 'some.csv'
with open(filename, newline='') as f:
reader = csv.reader(f)
try:
for row in reader:
print(row)
except csv.Error as e:
sys.exit(f'file {filename}, line {reader.line_num}: {e}') | A slightly more advanced use of the reader --- catching and reporting errors::
import csv, sys
filename = 'some.csv'
with open(filename, newline='') as f:
reader = csv.reader(f)
try:
for row in reader:
print(row)
except csv.Error as e:
sys.exit(f'file {filename}, line {reader.line_num}: {e}') | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
129010b0-5c60-4c5c-adc8-29c8feb8476d | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,055 | supabase-export-v2 | c3efdafadbf02c71 | no longer processes general external entities by default to increase security by default. To enable processing of external entities, pass a custom parser instance in::
from xml.dom.pulldom import parse
from xml.sax import make_parser
from xml.sax.handler import feature_external_ges | trusted_official_docs | CPython Docs | no longer processes general external entities by default to increase security by default. To enable processing of external entities, pass a custom parser instance in::
from xml.dom.pulldom import parse
from xml.sax import make_parser
from xml.sax.handler import feature_external_ges | no longer processes general external entities by default to increase security by default. To enable processing of external entities, pass a custom parser instance in::
from xml.dom.pulldom import parse
from xml.sax import make_parser
from xml.sax.handler import feature_external_ges | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
424236a1-fcdc-4d0b-9b4b-44f42bb0650c | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,084 | supabase-export-v2 | 692bb5505a68bfc9 | from xml.dom import pulldom
xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'
doc = pulldom.parseString(xml)
for event, node in doc:
if event == pulldom.START_ELEMENT and node.tagName == 'p':
# Following statement only prints '<p/>'
print(node.toxml())
doc.expandNode(node)
# Following... | trusted_official_docs | CPython Docs | from xml.dom import pulldom
xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'
doc = pulldom.parseString(xml)
for event, node in doc:
if event == pulldom.START_ELEMENT and node.tagName == 'p':
# Following statement only prints '<p/>'
print(node.toxml())
doc.expandNode(node)
# Following... | from xml.dom import pulldom
xml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'
doc = pulldom.parseString(xml)
for event, node in doc:
if event == pulldom.START_ELEMENT and node.tagName == 'p':
# Following statement only prints '<p/>'
print(node.toxml())
doc.expandNode(node)
# Following... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4f56338e-73e0-4d78-b3d9-079c8d8dfd1d | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,062 | supabase-export-v2 | 4814363d183158d0 | ``node`` is an object of type :class:`xml.dom.minidom.Document`, :class:`xml.dom.minidom.Element` or :class:`xml.dom.minidom.Text`.
Since the document is treated as a "flat" stream of events, the document "tree"
is implicitly traversed and the desired elements are found regardless of their
depth in the tree. In other w... | trusted_official_docs | CPython Docs | ``node`` is an object of type :class:`xml.dom.minidom.Document`, :class:`xml.dom.minidom.Element` or :class:`xml.dom.minidom.Text`.
Since the document is treated as a "flat" stream of events, the document "tree"
is implicitly traversed and the desired elements are found regardless of their
depth in the tree. In other w... | ``node`` is an object of type :class:`xml.dom.minidom.Document`, :class:`xml.dom.minidom.Element` or :class:`xml.dom.minidom.Text`.
Since the document is treated as a "flat" stream of events, the document "tree"
is implicitly traversed and the desired elements are found regardless of their
depth in the tree. In other w... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
98f3c2b8-8ad5-41ca-aecb-73636f295c7a | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,054 | supabase-export-v2 | bfc30aee6b07951c | .. versionchanged:: 3.7.1
The SAX parser no longer processes general external entities by default to
increase security by default. To enable processing of external entities,
pass a custom parser instance in:: | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7.1
The SAX parser no longer processes general external entities by default to
increase security by default. To enable processing of external entities,
pass a custom parser instance in:: | .. versionchanged:: 3.7.1
The SAX parser no longer processes general external entities by default to
increase security by default. To enable processing of external entities,
pass a custom parser instance in:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aae5e0b7-4090-4fe2-bf5d-32aa7c8e7fac | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,050 | supabase-export-v2 | bb81c5be02ab47e8 | --------------
The :mod:`!xml.dom.pulldom` module provides a "pull parser" which can also be
asked to produce DOM-accessible fragments of the document where necessary. The
basic concept involves pulling "events" from a stream of incoming XML and
processing them. In contrast to SAX which also employs an event-driven
pro... | trusted_official_docs | CPython Docs | --------------
The :mod:`!xml.dom.pulldom` module provides a "pull parser" which can also be
asked to produce DOM-accessible fragments of the document where necessary. The
basic concept involves pulling "events" from a stream of incoming XML and
processing them. In contrast to SAX which also employs an event-driven
pro... | --------------
The :mod:`!xml.dom.pulldom` module provides a "pull parser" which can also be
asked to produce DOM-accessible fragments of the document where necessary. The
basic concept involves pulling "events" from a stream of incoming XML and
processing them. In contrast to SAX which also employs an event-driven
pro... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c22f809f-55bd-4011-bfcc-778142f7741d | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,059 | supabase-export-v2 | fe68369da5be7df7 | doc = pulldom.parse('sales_items.xml') for event, node in doc: if event == pulldom.START_ELEMENT and node.tagName == 'item': if int(node.getAttribute('price')) > 50: doc.expandNode(node) print(node.toxml())
``event`` is a constant and can be one of: | trusted_official_docs | CPython Docs | doc = pulldom.parse('sales_items.xml') for event, node in doc: if event == pulldom.START_ELEMENT and node.tagName == 'item': if int(node.getAttribute('price')) > 50: doc.expandNode(node) print(node.toxml())
``event`` is a constant and can be one of: | doc = pulldom.parse('sales_items.xml') for event, node in doc: if event == pulldom.START_ELEMENT and node.tagName == 'item': if int(node.getAttribute('price')) > 50: doc.expandNode(node) print(node.toxml())
``event`` is a constant and can be one of: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
df97fa08-bb02-455b-b28b-4f31bf213972 | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,080 | supabase-export-v2 | db00a4694d55f0ca | .. method:: getEvent()
Return a tuple containing *event* and the current *node* as
:class:`xml.dom.minidom.Document` if event equals :data:`START_DOCUMENT`,
:class:`xml.dom.minidom.Element` if event equals :data:`START_ELEMENT` or
:data:`END_ELEMENT` or :class:`xml.dom.minidom.Text` if event equals
:data:`CHARACTER... | trusted_official_docs | CPython Docs | .. method:: getEvent()
Return a tuple containing *event* and the current *node* as
:class:`xml.dom.minidom.Document` if event equals :data:`START_DOCUMENT`,
:class:`xml.dom.minidom.Element` if event equals :data:`START_ELEMENT` or
:data:`END_ELEMENT` or :class:`xml.dom.minidom.Text` if event equals
:data:`CHARACTER... | .. method:: getEvent()
Return a tuple containing *event* and the current *node* as
:class:`xml.dom.minidom.Document` if event equals :data:`START_DOCUMENT`,
:class:`xml.dom.minidom.Element` if event equals :data:`START_ELEMENT` or
:data:`END_ELEMENT` or :class:`xml.dom.minidom.Text` if event equals
:data:`CHARACTER... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ecc01a20-769c-4e1a-9b0f-054556fbf60f | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,069 | supabase-export-v2 | f506d54e28747311 | change the document handler of the parser and activate namespace support; other parser configuration (like setting an entity resolver) must have been done in advance.
If you have XML in a string, you can use the :func:`parseString` function instead: | trusted_official_docs | CPython Docs | change the document handler of the parser and activate namespace support; other parser configuration (like setting an entity resolver) must have been done in advance.
If you have XML in a string, you can use the :func:`parseString` function instead: | change the document handler of the parser and activate namespace support; other parser configuration (like setting an entity resolver) must have been done in advance.
If you have XML in a string, you can use the :func:`parseString` function instead: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f353a1b4-c023-4617-8aab-584e511ba1d1 | CPython Docs | file://datasets/cpython/Doc/library/xml.dom.pulldom.rst | unknown | 7cd61e4e-ab45-4885-a8a6-d4dbc87f3c70 | 20,068 | supabase-export-v2 | b8350522022d8e52 | .. function:: parse(stream_or_string, parser=None, bufsize=None)
Return a :class:`DOMEventStream` from the given input. *stream_or_string* may be
either a file name, or a file-like object. *parser*, if given, must be an
:class:`~xml.sax.xmlreader.XMLReader` object. This function will change the
document handler of t... | trusted_official_docs | CPython Docs | .. function:: parse(stream_or_string, parser=None, bufsize=None)
Return a :class:`DOMEventStream` from the given input. *stream_or_string* may be
either a file name, or a file-like object. *parser*, if given, must be an
:class:`~xml.sax.xmlreader.XMLReader` object. This function will change the
document handler of t... | .. function:: parse(stream_or_string, parser=None, bufsize=None)
Return a :class:`DOMEventStream` from the given input. *stream_or_string* may be
either a file name, or a file-like object. *parser*, if given, must be an
:class:`~xml.sax.xmlreader.XMLReader` object. This function will change the
document handler of t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f4192b1-8f86-40be-81ba-676905ae3511 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,135 | supabase-export-v2 | da83ea2400e38a6a | raw_shm = smm.SharedMemory(size=128) >>> another_sl = smm.ShareableList('alpha') >>> another_sl ShareableList(['a', 'l', 'p', 'h', 'a'], name='psm_6572_12221') >>> smm.shutdown() # Calls unlink() on sl, raw_shm, and another_sl
The following example depicts a potentially more convenient pattern for using
:class:`~multip... | trusted_official_docs | CPython Docs | raw_shm = smm.SharedMemory(size=128) >>> another_sl = smm.ShareableList('alpha') >>> another_sl ShareableList(['a', 'l', 'p', 'h', 'a'], name='psm_6572_12221') >>> smm.shutdown() # Calls unlink() on sl, raw_shm, and another_sl
The following example depicts a potentially more convenient pattern for using
:class:`~multip... | raw_shm = smm.SharedMemory(size=128) >>> another_sl = smm.ShareableList('alpha') >>> another_sl ShareableList(['a', 'l', 'p', 'h', 'a'], name='psm_6572_12221') >>> smm.shutdown() # Calls unlink() on sl, raw_shm, and another_sl
The following example depicts a potentially more convenient pattern for using
:class:`~multip... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0f941fa6-6396-44c4-bcdc-a01227e01505 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,140 | supabase-export-v2 | 84adfe682889a556 | .. class:: ShareableList(sequence=None, *, name=None)
Provide a mutable list-like object where all values stored within are
stored in a shared memory block. This constrains storable values to the following built-in data types: | trusted_official_docs | CPython Docs | .. class:: ShareableList(sequence=None, *, name=None)
Provide a mutable list-like object where all values stored within are
stored in a shared memory block. This constrains storable values to the following built-in data types: | .. class:: ShareableList(sequence=None, *, name=None)
Provide a mutable list-like object where all values stored within are
stored in a shared memory block. This constrains storable values to the following built-in data types: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0fa34484-2065-44d3-9c0f-528c0aeac06b | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,107 | supabase-export-v2 | fc6716a526a6f729 | called in any order, but trying to access data inside a shared memory block after :meth:`unlink` may result in memory access errors, depending on platform.
This method has no effect on Windows, where the only way to delete a
shared memory block is to close all handles. | trusted_official_docs | CPython Docs | called in any order, but trying to access data inside a shared memory block after :meth:`unlink` may result in memory access errors, depending on platform.
This method has no effect on Windows, where the only way to delete a
shared memory block is to close all handles. | called in any order, but trying to access data inside a shared memory block after :meth:`unlink` may result in memory access errors, depending on platform.
This method has no effect on Windows, where the only way to delete a
shared memory block is to close all handles. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
18d3e720-e2ac-4508-a0a3-5b00bfc25b63 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,122 | supabase-export-v2 | c5bac373036e02b3 | >>> # Clean up from within the second Python shell >>> del c # Unnecessary; merely emphasizing the array is no longer used >>> existing_shm.close()
>>> # Clean up from within the first Python shell
>>> del b # Unnecessary; merely emphasizing the array is no longer used
>>> shm.close()
>>> shm.unlink() # Free and rel... | trusted_official_docs | CPython Docs | >>> # Clean up from within the second Python shell >>> del c # Unnecessary; merely emphasizing the array is no longer used >>> existing_shm.close()
>>> # Clean up from within the first Python shell
>>> del b # Unnecessary; merely emphasizing the array is no longer used
>>> shm.close()
>>> shm.unlink() # Free and rel... | >>> # Clean up from within the second Python shell >>> del c # Unnecessary; merely emphasizing the array is no longer used >>> existing_shm.close()
>>> # Clean up from within the first Python shell
>>> del b # Unnecessary; merely emphasizing the array is no longer used
>>> shm.close()
>>> shm.unlink() # Free and rel... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19edaf25-c12d-4a2f-8853-ea764bbe2ac0 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,092 | supabase-export-v2 | a99fb6b05de59a13 | --------------
This module provides a class, :class:`SharedMemory`, for the allocation
and management of shared memory to be accessed by one or more processes
on a multicore or symmetric multiprocessor (SMP) machine. To assist with
the life-cycle management of shared memory especially across distinct
processes, a :clas... | trusted_official_docs | CPython Docs | --------------
This module provides a class, :class:`SharedMemory`, for the allocation
and management of shared memory to be accessed by one or more processes
on a multicore or symmetric multiprocessor (SMP) machine. To assist with
the life-cycle management of shared memory especially across distinct
processes, a :clas... | --------------
This module provides a class, :class:`SharedMemory`, for the allocation
and management of shared memory to be accessed by one or more processes
on a multicore or symmetric multiprocessor (SMP) machine. To assist with
the life-cycle management of shared memory especially across distinct
processes, a :clas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1d1e369c-5582-4d48-a2d6-3b73e7bb079a | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,115 | supabase-export-v2 | e52db98ba6be9b7e | The following example demonstrates low-level use of :class:`SharedMemory` instances::
>>> from multiprocessing import shared_memory
>>> shm_a = shared_memory.SharedMemory(create=True, size=10)
>>> type(shm_a.buf)
<class 'memoryview'>
>>> buffer = shm_a.buf
>>> len(buffer)
10
>>> buffer[:4] = bytearray([22, 33, 4... | trusted_official_docs | CPython Docs | The following example demonstrates low-level use of :class:`SharedMemory` instances::
>>> from multiprocessing import shared_memory
>>> shm_a = shared_memory.SharedMemory(create=True, size=10)
>>> type(shm_a.buf)
<class 'memoryview'>
>>> buffer = shm_a.buf
>>> len(buffer)
10
>>> buffer[:4] = bytearray([22, 33, 4... | The following example demonstrates low-level use of :class:`SharedMemory` instances::
>>> from multiprocessing import shared_memory
>>> shm_a = shared_memory.SharedMemory(create=True, size=10)
>>> type(shm_a.buf)
<class 'memoryview'>
>>> buffer = shm_a.buf
>>> len(buffer)
10
>>> buffer[:4] = bytearray([22, 33, 4... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
20b56d56-775f-4010-9883-15109c4a4a24 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,165 | supabase-export-v2 | d78b3b4ff80b0212 | >>> deserialized_sl = pickle.loads(pickle.dumps(sl)) >>> list(deserialized_sl) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> sl[0] = -1
>>> deserialized_sl[1] = -2
>>> list(sl)
[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(deserialized_sl)
[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9] | trusted_official_docs | CPython Docs | >>> deserialized_sl = pickle.loads(pickle.dumps(sl)) >>> list(deserialized_sl) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> sl[0] = -1
>>> deserialized_sl[1] = -2
>>> list(sl)
[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(deserialized_sl)
[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9] | >>> deserialized_sl = pickle.loads(pickle.dumps(sl)) >>> list(deserialized_sl) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> sl[0] = -1
>>> deserialized_sl[1] = -2
>>> list(sl)
[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(deserialized_sl)
[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
28d28ce5-98af-4dbd-b7ef-91e655c17531 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,121 | supabase-export-v2 | fc526027d2fb95b3 | >>> # Back in the first Python interactive shell, b reflects this change >>> b array([ 1, 1, 2, 3, 5, 888])
>>> # Clean up from within the second Python shell
>>> del c # Unnecessary; merely emphasizing the array is no longer used
>>> existing_shm.close() | trusted_official_docs | CPython Docs | >>> # Back in the first Python interactive shell, b reflects this change >>> b array([ 1, 1, 2, 3, 5, 888])
>>> # Clean up from within the second Python shell
>>> del c # Unnecessary; merely emphasizing the array is no longer used
>>> existing_shm.close() | >>> # Back in the first Python interactive shell, b reflects this change >>> b array([ 1, 1, 2, 3, 5, 888])
>>> # Clean up from within the second Python shell
>>> del c # Unnecessary; merely emphasizing the array is no longer used
>>> existing_shm.close() | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b2fafc7-9039-4a6e-bf92-a294f4eaf058 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,163 | supabase-export-v2 | 4e61fa39afef9e8c | deserialized object has the same unique name and is just attached to an existing object with the same name (if the object is still alive):
>>> import pickle
>>> from multiprocessing import shared_memory
>>> sl = shared_memory.ShareableList(range(10))
>>> list(sl)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | trusted_official_docs | CPython Docs | deserialized object has the same unique name and is just attached to an existing object with the same name (if the object is still alive):
>>> import pickle
>>> from multiprocessing import shared_memory
>>> sl = shared_memory.ShareableList(range(10))
>>> list(sl)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | deserialized object has the same unique name and is just attached to an existing object with the same name (if the object is still alive):
>>> import pickle
>>> from multiprocessing import shared_memory
>>> sl = shared_memory.ShareableList(range(10))
>>> list(sl)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34b503f4-fc5a-47cd-b081-676b860023bc | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,137 | supabase-export-v2 | 5e56378e84f2bb64 | .. doctest:: :options: +SKIP
>>> with SharedMemoryManager() as smm:
... sl = smm.ShareableList(range(2000))
... # Divide the work among two processes, storing partial results in sl
... p1 = Process(target=do_work, args=(sl, 0, 1000))
... p2 = Process(target=do_work, args=(sl, 1000, 2000))
... p1.start()
... p2.st... | trusted_official_docs | CPython Docs | .. doctest:: :options: +SKIP
>>> with SharedMemoryManager() as smm:
... sl = smm.ShareableList(range(2000))
... # Divide the work among two processes, storing partial results in sl
... p1 = Process(target=do_work, args=(sl, 0, 1000))
... p2 = Process(target=do_work, args=(sl, 1000, 2000))
... p1.start()
... p2.st... | .. doctest:: :options: +SKIP
>>> with SharedMemoryManager() as smm:
... sl = smm.ShareableList(range(2000))
... # Divide the work among two processes, storing partial results in sl
... p1 = Process(target=do_work, args=(sl, 0, 1000))
... p2 = Process(target=do_work, args=(sl, 1000, 2000))
... p1.start()
... p2.st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3aa89856-49a0-4529-93dc-ac504b48a6a3 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,118 | supabase-export-v2 | a38a8a94ab334fa1 | .. doctest:: :options: +SKIP
>>> # In the first Python interactive shell
>>> import numpy as np
>>> a = np.array([1, 1, 2, 3, 5, 8]) # Start with an existing NumPy array
>>> from multiprocessing import shared_memory
>>> shm = shared_memory.SharedMemory(create=True, size=a.nbytes)
>>> # Now create a NumPy array bac... | trusted_official_docs | CPython Docs | .. doctest:: :options: +SKIP
>>> # In the first Python interactive shell
>>> import numpy as np
>>> a = np.array([1, 1, 2, 3, 5, 8]) # Start with an existing NumPy array
>>> from multiprocessing import shared_memory
>>> shm = shared_memory.SharedMemory(create=True, size=a.nbytes)
>>> # Now create a NumPy array bac... | .. doctest:: :options: +SKIP
>>> # In the first Python interactive shell
>>> import numpy as np
>>> a = np.array([1, 1, 2, 3, 5, 8]) # Start with an existing NumPy array
>>> from multiprocessing import shared_memory
>>> shm = shared_memory.SharedMemory(create=True, size=a.nbytes)
>>> # Now create a NumPy array bac... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3b4fee10-22f2-4086-a1ee-2483037dc641 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,125 | supabase-export-v2 | 69a717878e0896bd | A subclass of :class:`multiprocessing.managers.BaseManager` which can be used for the management of shared memory blocks across processes.
A call to :meth:`~multiprocessing.managers.BaseManager.start` on a
:class:`!SharedMemoryManager` instance causes a new process to be started. This new process's sole purpose is to ... | trusted_official_docs | CPython Docs | A subclass of :class:`multiprocessing.managers.BaseManager` which can be used for the management of shared memory blocks across processes.
A call to :meth:`~multiprocessing.managers.BaseManager.start` on a
:class:`!SharedMemoryManager` instance causes a new process to be started. This new process's sole purpose is to ... | A subclass of :class:`multiprocessing.managers.BaseManager` which can be used for the management of shared memory blocks across processes.
A call to :meth:`~multiprocessing.managers.BaseManager.start` on a
:class:`!SharedMemoryManager` instance causes a new process to be started. This new process's sole purpose is to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3d08babb-bc64-4c85-939c-27d7656acd78 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,097 | supabase-export-v2 | 5156652c0a67dce6 | should be called. When a shared memory block is no longer needed by any process, the :meth:`unlink` method should be called to ensure proper cleanup.
:param name:
The unique name for the requested shared memory, specified as a string. When creating a new shared memory block, if ``None`` (the default)
is supplied for ... | trusted_official_docs | CPython Docs | should be called. When a shared memory block is no longer needed by any process, the :meth:`unlink` method should be called to ensure proper cleanup.
:param name:
The unique name for the requested shared memory, specified as a string. When creating a new shared memory block, if ``None`` (the default)
is supplied for ... | should be called. When a shared memory block is no longer needed by any process, the :meth:`unlink` method should be called to ensure proper cleanup.
:param name:
The unique name for the requested shared memory, specified as a string. When creating a new shared memory block, if ``None`` (the default)
is supplied for ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3fc07208-d13c-4f76-a933-f8af5e5076f9 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,123 | supabase-export-v2 | e287d63c0a8eae8b | Unnecessary; merely emphasizing the array is no longer used >>> shm.close() >>> shm.unlink() # Free and release the shared memory block at the very end
.. class:: SharedMemoryManager([address[, authkey]])
:module: multiprocessing.managers | trusted_official_docs | CPython Docs | Unnecessary; merely emphasizing the array is no longer used >>> shm.close() >>> shm.unlink() # Free and release the shared memory block at the very end
.. class:: SharedMemoryManager([address[, authkey]])
:module: multiprocessing.managers | Unnecessary; merely emphasizing the array is no longer used >>> shm.close() >>> shm.unlink() # Free and release the shared memory block at the very end
.. class:: SharedMemoryManager([address[, authkey]])
:module: multiprocessing.managers | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4239c5eb-f877-4725-b3cf-49b05a531d6a | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,134 | supabase-export-v2 | 54f07ff119125a43 | .. doctest:: :options: +SKIP
>>> from multiprocessing.managers import SharedMemoryManager
>>> smm = SharedMemoryManager()
>>> smm.start() # Start the process that manages the shared memory blocks
>>> sl = smm.ShareableList(range(4))
>>> sl
ShareableList([0, 1, 2, 3], name='psm_6572_7512')
>>> raw_shm = smm.Shared... | trusted_official_docs | CPython Docs | .. doctest:: :options: +SKIP
>>> from multiprocessing.managers import SharedMemoryManager
>>> smm = SharedMemoryManager()
>>> smm.start() # Start the process that manages the shared memory blocks
>>> sl = smm.ShareableList(range(4))
>>> sl
ShareableList([0, 1, 2, 3], name='psm_6572_7512')
>>> raw_shm = smm.Shared... | .. doctest:: :options: +SKIP
>>> from multiprocessing.managers import SharedMemoryManager
>>> smm = SharedMemoryManager()
>>> smm.start() # Start the process that manages the shared memory blocks
>>> sl = smm.ShareableList(range(4))
>>> sl
ShareableList([0, 1, 2, 3], name='psm_6572_7512')
>>> raw_shm = smm.Shared... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4301bd37-019f-4526-a6eb-9e3d75db2c3b | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,094 | supabase-export-v2 | bb94b7fe1631d22b | via memory can provide significant performance benefits compared to sharing data via disk or socket or other communications requiring the serialization/deserialization and copying of data.
.. class:: SharedMemory(name=None, create=False, size=0, *, track=True) | trusted_official_docs | CPython Docs | via memory can provide significant performance benefits compared to sharing data via disk or socket or other communications requiring the serialization/deserialization and copying of data.
.. class:: SharedMemory(name=None, create=False, size=0, *, track=True) | via memory can provide significant performance benefits compared to sharing data via disk or socket or other communications requiring the serialization/deserialization and copying of data.
.. class:: SharedMemory(name=None, create=False, size=0, *, track=True) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43bb60d7-32a2-44ff-8a07-deb4f0136809 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,143 | supabase-export-v2 | e96373481f063608 | lists can not change their overall length (i.e. no :meth:`!append`, :meth:`!insert`, etc.) and do not support the dynamic creation of new :class:`!ShareableList` instances via slicing.
*sequence* is used in populating a new :class:`!ShareableList` full of values. Set to ``None`` to instead attach to an already existing... | trusted_official_docs | CPython Docs | lists can not change their overall length (i.e. no :meth:`!append`, :meth:`!insert`, etc.) and do not support the dynamic creation of new :class:`!ShareableList` instances via slicing.
*sequence* is used in populating a new :class:`!ShareableList` full of values. Set to ``None`` to instead attach to an already existing... | lists can not change their overall length (i.e. no :meth:`!append`, :meth:`!insert`, etc.) and do not support the dynamic creation of new :class:`!ShareableList` instances via slicing.
*sequence* is used in populating a new :class:`!ShareableList` full of values. Set to ``None`` to instead attach to an already existing... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4983def4-8160-4f2e-be49-6561edff77db | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,127 | supabase-export-v2 | 7ef573e5e357aa68 | This class provides methods for creating and returning :class:`SharedMemory` instances and for creating a list-like object (:class:`ShareableList`) backed by shared memory.
Refer to :class:`~multiprocessing.managers.BaseManager` for a description
of the inherited *address* and *authkey* optional input arguments and ho... | trusted_official_docs | CPython Docs | This class provides methods for creating and returning :class:`SharedMemory` instances and for creating a list-like object (:class:`ShareableList`) backed by shared memory.
Refer to :class:`~multiprocessing.managers.BaseManager` for a description
of the inherited *address* and *authkey* optional input arguments and ho... | This class provides methods for creating and returning :class:`SharedMemory` instances and for creating a list-like object (:class:`ShareableList`) backed by shared memory.
Refer to :class:`~multiprocessing.managers.BaseManager` for a description
of the inherited *address* and *authkey* optional input arguments and ho... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4bb8e159-ee04-41a0-ab35-eff4b1b09f5b | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,093 | supabase-export-v2 | 4b1b7a89264804e6 | machine. To assist with the life-cycle management of shared memory especially across distinct processes, a :class:`~multiprocessing.managers.BaseManager` subclass, :class:`~multiprocessing.managers.SharedMemoryManager`, is also provided in the :mod:`multiprocessing.managers` module.
In this module, shared memory refers... | trusted_official_docs | CPython Docs | machine. To assist with the life-cycle management of shared memory especially across distinct processes, a :class:`~multiprocessing.managers.BaseManager` subclass, :class:`~multiprocessing.managers.SharedMemoryManager`, is also provided in the :mod:`multiprocessing.managers` module.
In this module, shared memory refers... | machine. To assist with the life-cycle management of shared memory especially across distinct processes, a :class:`~multiprocessing.managers.BaseManager` subclass, :class:`~multiprocessing.managers.SharedMemoryManager`, is also provided in the :mod:`multiprocessing.managers` module.
In this module, shared memory refers... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4fae98fa-ba8d-4f83-b95d-038d37a853ae | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,161 | supabase-export-v2 | 8935de6aa3dae6cc | following example depicts how one, two, or many processes may access the same :class:`ShareableList` by supplying the name of the shared memory block behind it:
>>> b = shared_memory.ShareableList(range(5)) # In a first process
>>> c = shared_memory.ShareableList(name=b.shm.name) # In a second process
>>> c
Shareabl... | trusted_official_docs | CPython Docs | following example depicts how one, two, or many processes may access the same :class:`ShareableList` by supplying the name of the shared memory block behind it:
>>> b = shared_memory.ShareableList(range(5)) # In a first process
>>> c = shared_memory.ShareableList(name=b.shm.name) # In a second process
>>> c
Shareabl... | following example depicts how one, two, or many processes may access the same :class:`ShareableList` by supplying the name of the shared memory block behind it:
>>> b = shared_memory.ShareableList(range(5)) # In a first process
>>> c = shared_memory.ShareableList(name=b.shm.name) # In a second process
>>> c
Shareabl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
618ec002-ed1d-45fa-b519-cfdbf734a007 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,147 | supabase-export-v2 | bf7bb11166ea18b5 | stripped* when fetching them by index from the :class:`!ShareableList`. This ``.rstrip(b'\x00')`` behavior is considered a bug and may go away in the future. See :gh:`106939`.
For applications where rstripping of trailing nulls is a problem,
work around it by always unconditionally appending an extra non-0
byte to th... | trusted_official_docs | CPython Docs | stripped* when fetching them by index from the :class:`!ShareableList`. This ``.rstrip(b'\x00')`` behavior is considered a bug and may go away in the future. See :gh:`106939`.
For applications where rstripping of trailing nulls is a problem,
work around it by always unconditionally appending an extra non-0
byte to th... | stripped* when fetching them by index from the :class:`!ShareableList`. This ``.rstrip(b'\x00')`` behavior is considered a bug and may go away in the future. See :gh:`106939`.
For applications where rstripping of trailing nulls is a problem,
work around it by always unconditionally appending an extra non-0
byte to th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
61a58925-3895-439e-839e-c7afcb495d86 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,160 | supabase-export-v2 | 16207b23c4087372 | 6 >>> a.count(b'howdy') 0 >>> a.count(b'HoWdY') 1 >>> a.shm.close() >>> a.shm.unlink() >>> del a # Use of a ShareableList after call to unlink() is unsupported
The following example depicts how one, two, or many processes may access the
same :class:`ShareableList` by supplying the name of the shared memory block
behind... | trusted_official_docs | CPython Docs | 6 >>> a.count(b'howdy') 0 >>> a.count(b'HoWdY') 1 >>> a.shm.close() >>> a.shm.unlink() >>> del a # Use of a ShareableList after call to unlink() is unsupported
The following example depicts how one, two, or many processes may access the
same :class:`ShareableList` by supplying the name of the shared memory block
behind... | 6 >>> a.count(b'howdy') 0 >>> a.count(b'HoWdY') 1 >>> a.shm.close() >>> a.shm.unlink() >>> del a # Use of a ShareableList after call to unlink() is unsupported
The following example depicts how one, two, or many processes may access the
same :class:`ShareableList` by supplying the name of the shared memory block
behind... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6238cfc3-16f6-4e68-8b9a-2380538c6ea5 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,142 | supabase-export-v2 | a8f7dc456bdd956b | 64-bit) * :class:`float` * :class:`bool` * :class:`str` (less than 10M bytes each when encoded as UTF-8) * :class:`bytes` (less than 10M bytes each) * ``None``
It also notably differs from the built-in :class:`list` type
in that these lists can not change their overall length
(i.e. no :meth:`!append`, :meth:`!insert`... | trusted_official_docs | CPython Docs | 64-bit) * :class:`float` * :class:`bool` * :class:`str` (less than 10M bytes each when encoded as UTF-8) * :class:`bytes` (less than 10M bytes each) * ``None``
It also notably differs from the built-in :class:`list` type
in that these lists can not change their overall length
(i.e. no :meth:`!append`, :meth:`!insert`... | 64-bit) * :class:`float` * :class:`bool` * :class:`str` (less than 10M bytes each when encoded as UTF-8) * :class:`bytes` (less than 10M bytes each) * ``None``
It also notably differs from the built-in :class:`list` type
in that these lists can not change their overall length
(i.e. no :meth:`!append`, :meth:`!insert`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
698d6ac1-eb10-444e-b80f-3195ee3d23c6 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,119 | supabase-export-v2 | 4ac81e0f682752ae | 8]) >>> type(b) <class 'numpy.ndarray'> >>> type(a) <class 'numpy.ndarray'> >>> shm.name # We did not specify a name so one was chosen for us 'psm_21467_46075'
>>> # In either the same shell or a new Python shell on the same machine
>>> import numpy as np
>>> from multiprocessing import shared_memory
>>> # Attach to... | trusted_official_docs | CPython Docs | 8]) >>> type(b) <class 'numpy.ndarray'> >>> type(a) <class 'numpy.ndarray'> >>> shm.name # We did not specify a name so one was chosen for us 'psm_21467_46075'
>>> # In either the same shell or a new Python shell on the same machine
>>> import numpy as np
>>> from multiprocessing import shared_memory
>>> # Attach to... | 8]) >>> type(b) <class 'numpy.ndarray'> >>> type(a) <class 'numpy.ndarray'> >>> shm.name # We did not specify a name so one was chosen for us 'psm_21467_46075'
>>> # In either the same shell or a new Python shell on the same machine
>>> import numpy as np
>>> from multiprocessing import shared_memory
>>> # Attach to... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7f1b375d-d656-41c8-ab9e-c9146360faa1 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,102 | supabase-export-v2 | 24c70f48107d15cb | the bookkeeping. *track* is ignored on Windows, which has its own tracking and automatically deletes shared memory when all handles to it have been closed.
.. versionchanged:: 3.13
Added the *track* parameter. | trusted_official_docs | CPython Docs | the bookkeeping. *track* is ignored on Windows, which has its own tracking and automatically deletes shared memory when all handles to it have been closed.
.. versionchanged:: 3.13
Added the *track* parameter. | the bookkeeping. *track* is ignored on Windows, which has its own tracking and automatically deletes shared memory when all handles to it have been closed.
.. versionchanged:: 3.13
Added the *track* parameter. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80d1ac27-8e9e-4f6e-9cff-cc81e1890303 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,095 | supabase-export-v2 | cdf09660fcb624b8 | .. class:: SharedMemory(name=None, create=False, size=0, *, track=True)
Create an instance of the :class:`!SharedMemory` class for either
creating a new shared memory block or attaching to an existing shared
memory block. Each shared memory block is assigned a unique name. In this way, one process can create a shared... | trusted_official_docs | CPython Docs | .. class:: SharedMemory(name=None, create=False, size=0, *, track=True)
Create an instance of the :class:`!SharedMemory` class for either
creating a new shared memory block or attaching to an existing shared
memory block. Each shared memory block is assigned a unique name. In this way, one process can create a shared... | .. class:: SharedMemory(name=None, create=False, size=0, *, track=True)
Create an instance of the :class:`!SharedMemory` class for either
creating a new shared memory block or attaching to an existing shared
memory block. Each shared memory block is assigned a unique name. In this way, one process can create a shared... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
81073c29-0237-4b67-a3e8-8bb1672b0b0f | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,144 | supabase-export-v2 | f6faf237e8cee2f1 | in populating a new :class:`!ShareableList` full of values. Set to ``None`` to instead attach to an already existing :class:`!ShareableList` by its unique shared memory name.
*name* is the unique name for the requested shared memory, as described
in the definition for :class:`SharedMemory`. When attaching to an
exist... | trusted_official_docs | CPython Docs | in populating a new :class:`!ShareableList` full of values. Set to ``None`` to instead attach to an already existing :class:`!ShareableList` by its unique shared memory name.
*name* is the unique name for the requested shared memory, as described
in the definition for :class:`SharedMemory`. When attaching to an
exist... | in populating a new :class:`!ShareableList` full of values. Set to ``None`` to instead attach to an already existing :class:`!ShareableList` by its unique shared memory name.
*name* is the unique name for the requested shared memory, as described
in the definition for :class:`SharedMemory`. When attaching to an
exist... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
840c4576-eab5-4b3b-ab82-39e4b2e199fc | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,164 | supabase-export-v2 | 7ea691ae1558da72 | >>> import pickle >>> from multiprocessing import shared_memory >>> sl = shared_memory.ShareableList(range(10)) >>> list(sl) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> deserialized_sl = pickle.loads(pickle.dumps(sl))
>>> list(deserialized_sl)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | trusted_official_docs | CPython Docs | >>> import pickle >>> from multiprocessing import shared_memory >>> sl = shared_memory.ShareableList(range(10)) >>> list(sl) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> deserialized_sl = pickle.loads(pickle.dumps(sl))
>>> list(deserialized_sl)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | >>> import pickle >>> from multiprocessing import shared_memory >>> sl = shared_memory.ShareableList(range(10)) >>> list(sl) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> deserialized_sl = pickle.loads(pickle.dumps(sl))
>>> list(deserialized_sl)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
902cdb3a-a2e2-4239-9a4c-c832ac508c50 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,100 | supabase-export-v2 | 5a942bb2761feece | shared memory block may be larger or equal to the size requested. When attaching to an existing shared memory block, the *size* parameter is ignored.
:param bool track:
When ``True``, register the shared memory block with a resource
tracker process on platforms where the OS does not do this automatically. The resourc... | trusted_official_docs | CPython Docs | shared memory block may be larger or equal to the size requested. When attaching to an existing shared memory block, the *size* parameter is ignored.
:param bool track:
When ``True``, register the shared memory block with a resource
tracker process on platforms where the OS does not do this automatically. The resourc... | shared memory block may be larger or equal to the size requested. When attaching to an existing shared memory block, the *size* parameter is ignored.
:param bool track:
When ``True``, register the shared memory block with a resource
tracker process on platforms where the OS does not do this automatically. The resourc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
966a001d-c89f-491a-9201-02f0c2088ad1 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,159 | supabase-export-v2 | e9ba82a229e6ab10 | The following example demonstrates basic use of a :class:`ShareableList` instance:
>>> from multiprocessing import shared_memory
>>> a = shared_memory.ShareableList(['howdy', b'HoWdY', -273.154, 100, None, True, 42])
>>> [ type(entry) for entry in a ]
[<class 'str'>, <class 'bytes'>, <class 'float'>, <class 'int'>, ... | trusted_official_docs | CPython Docs | The following example demonstrates basic use of a :class:`ShareableList` instance:
>>> from multiprocessing import shared_memory
>>> a = shared_memory.ShareableList(['howdy', b'HoWdY', -273.154, 100, None, True, 42])
>>> [ type(entry) for entry in a ]
[<class 'str'>, <class 'bytes'>, <class 'float'>, <class 'int'>, ... | The following example demonstrates basic use of a :class:`ShareableList` instance:
>>> from multiprocessing import shared_memory
>>> a = shared_memory.ShareableList(['howdy', b'HoWdY', -273.154, 100, None, True, 42])
>>> [ type(entry) for entry in a ]
[<class 'str'>, <class 'bytes'>, <class 'float'>, <class 'int'>, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9c2c584e-90d4-43ea-a5ce-7e0766c72604 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,106 | supabase-export-v2 | 92847c1df7413855 | .. method:: unlink()
Delete the underlying shared memory block. This should be called only
once per shared memory block regardless of the number of handles to it,
even in other processes. :meth:`unlink` and :meth:`close` can be called in any order, but
trying to access data inside a shared memory block after :meth:`... | trusted_official_docs | CPython Docs | .. method:: unlink()
Delete the underlying shared memory block. This should be called only
once per shared memory block regardless of the number of handles to it,
even in other processes. :meth:`unlink` and :meth:`close` can be called in any order, but
trying to access data inside a shared memory block after :meth:`... | .. method:: unlink()
Delete the underlying shared memory block. This should be called only
once per shared memory block regardless of the number of handles to it,
even in other processes. :meth:`unlink` and :meth:`close` can be called in any order, but
trying to access data inside a shared memory block after :meth:`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9cb77f3f-1372-4c7c-83c8-53b2877f996b | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,101 | supabase-export-v2 | e3b8ad16c13a8fc8 | accessing shared memory with *track* enabled. This will cause the shared memory to be deleted by the resource tracker of the first process that terminates.
To avoid this issue, users of :mod:`subprocess` or standalone Python
processes should set *track* to ``False`` when there is already another
process in place that... | trusted_official_docs | CPython Docs | accessing shared memory with *track* enabled. This will cause the shared memory to be deleted by the resource tracker of the first process that terminates.
To avoid this issue, users of :mod:`subprocess` or standalone Python
processes should set *track* to ``False`` when there is already another
process in place that... | accessing shared memory with *track* enabled. This will cause the shared memory to be deleted by the resource tracker of the first process that terminates.
To avoid this issue, users of :mod:`subprocess` or standalone Python
processes should set *track* to ``False`` when there is already another
process in place that... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9cbd0e99-355b-4df0-a970-623909687c02 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,149 | supabase-export-v2 | a873cd3b9fef7cc6 | .. doctest::
>>> from multiprocessing import shared_memory
>>> nul_bug_demo = shared_memory.ShareableList(['?\x00', b'\x03\x02\x01\x00\x00\x00'])
>>> nul_bug_demo[0]
'?'
>>> nul_bug_demo[1]
b'\x03\x02\x01'
>>> nul_bug_demo.shm.unlink()
>>> padded = shared_memory.ShareableList(['?\x00\x07', b'\x03\x02\x01\x00\x00... | trusted_official_docs | CPython Docs | .. doctest::
>>> from multiprocessing import shared_memory
>>> nul_bug_demo = shared_memory.ShareableList(['?\x00', b'\x03\x02\x01\x00\x00\x00'])
>>> nul_bug_demo[0]
'?'
>>> nul_bug_demo[1]
b'\x03\x02\x01'
>>> nul_bug_demo.shm.unlink()
>>> padded = shared_memory.ShareableList(['?\x00\x07', b'\x03\x02\x01\x00\x00... | .. doctest::
>>> from multiprocessing import shared_memory
>>> nul_bug_demo = shared_memory.ShareableList(['?\x00', b'\x03\x02\x01\x00\x00\x00'])
>>> nul_bug_demo[0]
'?'
>>> nul_bug_demo[1]
b'\x03\x02\x01'
>>> nul_bug_demo.shm.unlink()
>>> padded = shared_memory.ShareableList(['?\x00\x07', b'\x03\x02\x01\x00\x00... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9d272144-ee65-4100-b0c6-fe85bf9882c6 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,120 | supabase-export-v2 | 171f1ce8840b4262 | = np.ndarray((6,), dtype=np.int64, buffer=existing_shm.buf) >>> c array([1, 1, 2, 3, 5, 8]) >>> c[-1] = 888 >>> c array([ 1, 1, 2, 3, 5, 888])
>>> # Back in the first Python interactive shell, b reflects this change
>>> b
array([ 1, 1, 2, 3, 5, 888]) | trusted_official_docs | CPython Docs | = np.ndarray((6,), dtype=np.int64, buffer=existing_shm.buf) >>> c array([1, 1, 2, 3, 5, 8]) >>> c[-1] = 888 >>> c array([ 1, 1, 2, 3, 5, 888])
>>> # Back in the first Python interactive shell, b reflects this change
>>> b
array([ 1, 1, 2, 3, 5, 888]) | = np.ndarray((6,), dtype=np.int64, buffer=existing_shm.buf) >>> c array([1, 1, 2, 3, 5, 8]) >>> c[-1] = 888 >>> c array([ 1, 1, 2, 3, 5, 888])
>>> # Back in the first Python interactive shell, b reflects this change
>>> b
array([ 1, 1, 2, 3, 5, 888]) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a4534a38-7ac0-40a5-82b0-6ba4a0fe66ae | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,138 | supabase-export-v2 | 9491c90c8657961f | p1.join() ... p2.join() # Wait for all work to complete in both processes ... total_result = sum(sl) # Consolidate the partial results now in sl
When using a :class:`~multiprocessing.managers.SharedMemoryManager`
in a :keyword:`with` statement, the shared memory blocks created using that
manager are all released when t... | trusted_official_docs | CPython Docs | p1.join() ... p2.join() # Wait for all work to complete in both processes ... total_result = sum(sl) # Consolidate the partial results now in sl
When using a :class:`~multiprocessing.managers.SharedMemoryManager`
in a :keyword:`with` statement, the shared memory blocks created using that
manager are all released when t... | p1.join() ... p2.join() # Wait for all work to complete in both processes ... total_result = sum(sl) # Consolidate the partial results now in sl
When using a :class:`~multiprocessing.managers.SharedMemoryManager`
in a :keyword:`with` statement, the shared memory blocks created using that
manager are all released when t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a521a1d2-9a4e-443e-8c8f-22ed217a367c | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,096 | supabase-export-v2 | 2145511d30cca531 | create a shared memory block with a particular name and a different process can attach to that same shared memory block using that same name.
As a resource for sharing data across processes, shared memory blocks
may outlive the original process that created them. When one process
no longer needs access to a shared me... | trusted_official_docs | CPython Docs | create a shared memory block with a particular name and a different process can attach to that same shared memory block using that same name.
As a resource for sharing data across processes, shared memory blocks
may outlive the original process that created them. When one process
no longer needs access to a shared me... | create a shared memory block with a particular name and a different process can attach to that same shared memory block using that same name.
As a resource for sharing data across processes, shared memory blocks
may outlive the original process that created them. When one process
no longer needs access to a shared me... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aa5c37c4-fe98-4150-9e3e-f04b8f1cb2f1 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,162 | supabase-export-v2 | 8047963a9008e69f | In a second process >>> c ShareableList([0, 1, 2, 3, 4], name='...') >>> c[-1] = -999 >>> b[-1] -999 >>> b.shm.close() >>> c.shm.close() >>> c.shm.unlink()
The following examples demonstrates that :class:`ShareableList`
(and underlying :class:`SharedMemory`) objects
can be pickled and unpickled if needed. Note, that it... | trusted_official_docs | CPython Docs | In a second process >>> c ShareableList([0, 1, 2, 3, 4], name='...') >>> c[-1] = -999 >>> b[-1] -999 >>> b.shm.close() >>> c.shm.close() >>> c.shm.unlink()
The following examples demonstrates that :class:`ShareableList`
(and underlying :class:`SharedMemory`) objects
can be pickled and unpickled if needed. Note, that it... | In a second process >>> c ShareableList([0, 1, 2, 3, 4], name='...') >>> c[-1] = -999 >>> b[-1] -999 >>> b.shm.close() >>> c.shm.close() >>> c.shm.unlink()
The following examples demonstrates that :class:`ShareableList`
(and underlying :class:`SharedMemory`) objects
can be pickled and unpickled if needed. Note, that it... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c890300d-25d5-42a9-b874-1326041ec347 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,141 | supabase-export-v2 | 453a65e361aa20fb | mutable list-like object where all values stored within are stored in a shared memory block. This constrains storable values to the following built-in data types:
* :class:`int` (signed 64-bit)
* :class:`float`
* :class:`bool`
* :class:`str` (less than 10M bytes each when encoded as UTF-8)
* :class:`bytes` (less th... | trusted_official_docs | CPython Docs | mutable list-like object where all values stored within are stored in a shared memory block. This constrains storable values to the following built-in data types:
* :class:`int` (signed 64-bit)
* :class:`float`
* :class:`bool`
* :class:`str` (less than 10M bytes each when encoded as UTF-8)
* :class:`bytes` (less th... | mutable list-like object where all values stored within are stored in a shared memory block. This constrains storable values to the following built-in data types:
* :class:`int` (signed 64-bit)
* :class:`float`
* :class:`bool`
* :class:`str` (less than 10M bytes each when encoded as UTF-8)
* :class:`bytes` (less th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d28833f3-0a1e-4541-b081-23cf51937d4c | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,126 | supabase-export-v2 | 4c5d00d7374079a1 | the process itself. By creating :class:`!SharedMemory` instances through a :class:`!SharedMemoryManager`, we avoid the need to manually track and trigger the freeing of shared memory resources.
This class provides methods for creating and returning :class:`SharedMemory`
instances and for creating a list-like object (:... | trusted_official_docs | CPython Docs | the process itself. By creating :class:`!SharedMemory` instances through a :class:`!SharedMemoryManager`, we avoid the need to manually track and trigger the freeing of shared memory resources.
This class provides methods for creating and returning :class:`SharedMemory`
instances and for creating a list-like object (:... | the process itself. By creating :class:`!SharedMemory` instances through a :class:`!SharedMemoryManager`, we avoid the need to manually track and trigger the freeing of shared memory resources.
This class provides methods for creating and returning :class:`SharedMemory`
instances and for creating a list-like object (:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3dd692c-b0d0-404a-ae18-dae56d2038e6 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,098 | supabase-export-v2 | 5df8dc9ff54b3dc1 | a new shared memory block, if ``None`` (the default) is supplied for the name, a novel name will be generated. :type name: str | None
:param bool create:
Control whether a new shared memory block is created (``True``)
or an existing shared memory block is attached (``False``). | trusted_official_docs | CPython Docs | a new shared memory block, if ``None`` (the default) is supplied for the name, a novel name will be generated. :type name: str | None
:param bool create:
Control whether a new shared memory block is created (``True``)
or an existing shared memory block is attached (``False``). | a new shared memory block, if ``None`` (the default) is supplied for the name, a novel name will be generated. :type name: str | None
:param bool create:
Control whether a new shared memory block is created (``True``)
or an existing shared memory block is attached (``False``). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d63005ad-f039-4fa2-aac3-b5151b0a7763 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,139 | supabase-export-v2 | f4714e68a2d15a65 | a :class:`~multiprocessing.managers.SharedMemoryManager` in a :keyword:`with` statement, the shared memory blocks created using that manager are all released when the :keyword:`!with` statement's code block finishes execution.
.. class:: ShareableList(sequence=None, *, name=None) | trusted_official_docs | CPython Docs | a :class:`~multiprocessing.managers.SharedMemoryManager` in a :keyword:`with` statement, the shared memory blocks created using that manager are all released when the :keyword:`!with` statement's code block finishes execution.
.. class:: ShareableList(sequence=None, *, name=None) | a :class:`~multiprocessing.managers.SharedMemoryManager` in a :keyword:`with` statement, the shared memory blocks created using that manager are all released when the :keyword:`!with` statement's code block finishes execution.
.. class:: ShareableList(sequence=None, *, name=None) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e2272620-7f61-453c-b5d0-f89ce0ee469f | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,146 | supabase-export-v2 | 927f4e14ff117b12 | .. note::
A known issue exists for :class:`bytes` and :class:`str` values. If they end with ``\x00`` nul bytes or characters, those may be
*silently stripped* when fetching them by index from the
:class:`!ShareableList`. This ``.rstrip(b'\x00')`` behavior is
considered a bug and may go away in the future. See :gh:`1... | trusted_official_docs | CPython Docs | .. note::
A known issue exists for :class:`bytes` and :class:`str` values. If they end with ``\x00`` nul bytes or characters, those may be
*silently stripped* when fetching them by index from the
:class:`!ShareableList`. This ``.rstrip(b'\x00')`` behavior is
considered a bug and may go away in the future. See :gh:`1... | .. note::
A known issue exists for :class:`bytes` and :class:`str` values. If they end with ``\x00`` nul bytes or characters, those may be
*silently stripped* when fetching them by index from the
:class:`!ShareableList`. This ``.rstrip(b'\x00')`` behavior is
considered a bug and may go away in the future. See :gh:`1... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e3316c0f-3af6-47f8-86df-d3b6746fac8e | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,116 | supabase-export-v2 | b0ba261765ae0372 | Access via shm_a b'howdy' >>> shm_b.close() # Close each SharedMemory instance >>> shm_a.close() >>> shm_a.unlink() # Call unlink only once to release the shared memory
The following example demonstrates a practical use of the :class:`SharedMemory`
class with `NumPy arrays <https://numpy.org/>`_, accessing the
same :cl... | trusted_official_docs | CPython Docs | Access via shm_a b'howdy' >>> shm_b.close() # Close each SharedMemory instance >>> shm_a.close() >>> shm_a.unlink() # Call unlink only once to release the shared memory
The following example demonstrates a practical use of the :class:`SharedMemory`
class with `NumPy arrays <https://numpy.org/>`_, accessing the
same :cl... | Access via shm_a b'howdy' >>> shm_b.close() # Close each SharedMemory instance >>> shm_a.close() >>> shm_a.unlink() # Call unlink only once to release the shared memory
The following example demonstrates a practical use of the :class:`SharedMemory`
class with `NumPy arrays <https://numpy.org/>`_, accessing the
same :cl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ebc01c23-69db-4727-bc61-17f02b5b6cef | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,104 | supabase-export-v2 | f4f1609ba3dc6c78 | .. method:: close()
Close the file descriptor/handle to the shared memory from this
instance. :meth:`close` should be called once access to the shared
memory block from this instance is no longer needed. Depending
on operating system, the underlying memory may or may not be freed
even if all handles to it have been... | trusted_official_docs | CPython Docs | .. method:: close()
Close the file descriptor/handle to the shared memory from this
instance. :meth:`close` should be called once access to the shared
memory block from this instance is no longer needed. Depending
on operating system, the underlying memory may or may not be freed
even if all handles to it have been... | .. method:: close()
Close the file descriptor/handle to the shared memory from this
instance. :meth:`close` should be called once access to the shared
memory block from this instance is no longer needed. Depending
on operating system, the underlying memory may or may not be freed
even if all handles to it have been... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fd9e6d70-cab7-47d9-9697-7a4641668067 | CPython Docs | file://datasets/cpython/Doc/library/multiprocessing.shared_memory.rst | unknown | 2cab9431-b629-4b36-955c-c722c297187c | 20,099 | supabase-export-v2 | b482dade7ad32f8d | :param bool create: Control whether a new shared memory block is created (``True``) or an existing shared memory block is attached (``False``).
:param int size:
The requested number of bytes when creating a new shared memory block. Because some platforms choose to allocate chunks of memory
based upon that platform's ... | trusted_official_docs | CPython Docs | :param bool create: Control whether a new shared memory block is created (``True``) or an existing shared memory block is attached (``False``).
:param int size:
The requested number of bytes when creating a new shared memory block. Because some platforms choose to allocate chunks of memory
based upon that platform's ... | :param bool create: Control whether a new shared memory block is created (``True``) or an existing shared memory block is attached (``False``).
:param int size:
The requested number of bytes when creating a new shared memory block. Because some platforms choose to allocate chunks of memory
based upon that platform's ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0114e70c-fbe6-432f-a941-96b1cd57e0fb | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,554 | supabase-export-v2 | 8f5fa57f3971ebb4 | :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`.
If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the
third-party :pypi:`idna` mo... | trusted_official_docs | CPython Docs | :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`.
If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the
third-party :pypi:`idna` mo... | :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`.
If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the
third-party :pypi:`idna` mo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
021fdfda-f422-48d4-98b6-6902f79c7ffa | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,295 | supabase-export-v2 | 4fc00ba957ca61dd | .. tabularcolumns:: |l|L|
+-------------------------+-----------------------------------------------+
| Value | Meaning |
+=========================+===============================================+
| ``'strict'`` | Raise :exc:`UnicodeError` (or a subclass), |
| | this is the default. Implemented in |
| | :func:`strict_... | trusted_official_docs | CPython Docs | .. tabularcolumns:: |l|L|
+-------------------------+-----------------------------------------------+
| Value | Meaning |
+=========================+===============================================+
| ``'strict'`` | Raise :exc:`UnicodeError` (or a subclass), |
| | this is the default. Implemented in |
| | :func:`strict_... | .. tabularcolumns:: |l|L|
+-------------------------+-----------------------------------------------+
| Value | Meaning |
+=========================+===============================================+
| ``'strict'`` | Raise :exc:`UnicodeError` (or a subclass), |
| | this is the default. Implemented in |
| | :func:`strict_... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02274cae-6a74-4525-a94d-52ca9697ff3d | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,511 | supabase-export-v2 | 42a36d7d47dbddf7 | | | +----------------------+------------------+------------------------------+------------------------------+ | zlib_codec | zip, zlib | Compress the operand using | :meth:`zlib.compress` / | | | | gzip. | :meth:`zlib.decompress` | +----------------------+------------------+------------------------------+--------------... | trusted_official_docs | CPython Docs | | | +----------------------+------------------+------------------------------+------------------------------+ | zlib_codec | zip, zlib | Compress the operand using | :meth:`zlib.compress` / | | | | gzip. | :meth:`zlib.decompress` | +----------------------+------------------+------------------------------+--------------... | | | +----------------------+------------------+------------------------------+------------------------------+ | zlib_codec | zip, zlib | Compress the operand using | :meth:`zlib.compress` / | | | | gzip. | :meth:`zlib.decompress` | +----------------------+------------------+------------------------------+--------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0448a599-3707-4035-b3dd-b660f68f438c | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,217 | supabase-export-v2 | 99cd28b297800331 | Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below.
This function first normalizes the *encoding*: all ASCII letters are
converted to lower case, spaces are replaced with hyphens. Then encoding is looked up in the registry's cache. If not found, the list of
r... | trusted_official_docs | CPython Docs | Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below.
This function first normalizes the *encoding*: all ASCII letters are
converted to lower case, spaces are replaced with hyphens. Then encoding is looked up in the registry's cache. If not found, the list of
r... | Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below.
This function first normalizes the *encoding*: all ASCII letters are
converted to lower case, spaces are replaced with hyphens. Then encoding is looked up in the registry's cache. If not found, the list of
r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05cadbc7-7aba-43bd-b3f6-c5f925782eef | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,465 | supabase-export-v2 | 46315ee07d6997a2 | The least significant bit of the Unicode character is the rightmost x bit.
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``. | trusted_official_docs | CPython Docs | The least significant bit of the Unicode character is the rightmost x bit.
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``. | The least significant bit of the Unicode character is the rightmost x bit.
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``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
06329847-edc8-4795-93dd-65f0f66c97e6 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,269 | supabase-export-v2 | e9e1ca2f643440d7 | If *file_encoding* is not given, it defaults to *data_encoding*.
*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. | trusted_official_docs | CPython Docs | If *file_encoding* is not given, it defaults to *data_encoding*.
*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. | If *file_encoding* is not given, it defaults to *data_encoding*.
*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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
075cdf58-cd87-40ac-96ce-2aa280588efd | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,351 | supabase-export-v2 | 84331f9e737f6269 | The *errors* argument defines the error handling to apply. It defaults to ``'strict'`` handling.
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. | trusted_official_docs | CPython Docs | The *errors* argument defines the error handling to apply. It defaults to ``'strict'`` handling.
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. | The *errors* argument defines the error handling to apply. It defaults to ``'strict'`` handling.
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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
07b47bf8-6496-43d1-a274-c4c50d8be908 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,259 | supabase-export-v2 | 0b31d12f276b5290 | 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.
*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 support... | trusted_official_docs | CPython Docs | 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.
*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 support... | 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.
*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 support... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
086ce9a5-72a5-470c-b43d-e7763a2472d3 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,507 | supabase-export-v2 | 553ef03d99c92658 | .. tabularcolumns:: |l|L|L|L|
+----------------------+------------------+------------------------------+------------------------------+
| Codec | Aliases | Meaning | Encoder / decoder |
+======================+==================+==============================+==============================+
| base64_codec [#b64]_ | bas... | trusted_official_docs | CPython Docs | .. tabularcolumns:: |l|L|L|L|
+----------------------+------------------+------------------------------+------------------------------+
| Codec | Aliases | Meaning | Encoder / decoder |
+======================+==================+==============================+==============================+
| base64_codec [#b64]_ | bas... | .. tabularcolumns:: |l|L|L|L|
+----------------------+------------------+------------------------------+------------------------------+
| Codec | Aliases | Meaning | Encoder / decoder |
+======================+==================+==============================+==============================+
| base64_codec [#b64]_ | bas... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09b48119-d945-4c88-bce6-da4d455e93ce | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,270 | supabase-export-v2 | de3d71289e28cfd4 | *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.
.. function:: iterencode(iterator, encoding, errors='strict', **kwargs) | trusted_official_docs | CPython Docs | *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.
.. function:: iterencode(iterator, encoding, errors='strict', **kwargs) | *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.
.. function:: iterencode(iterator, encoding, errors='strict', **kwargs) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0b93eb2c-9282-4fa8-8ede-2771d5ea60cd | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,553 | supabase-export-v2 | 09389dd5d55d4ab2 | .. module:: encodings.idna :synopsis: Internationalized Domain Names implementation
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... | trusted_official_docs | CPython Docs | .. module:: encodings.idna :synopsis: Internationalized Domain Names implementation
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... | .. module:: encodings.idna :synopsis: Internationalized Domain Names implementation
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... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d8415df-8c83-4c7b-a17d-e2428b71c23d | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,497 | supabase-export-v2 | ca4d26a632dd20c8 | .. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
+--------------------+---------+---------------------------+
| Codec | Aliases | Meaning |
+====================+=========+===========================+
| idna | | Implement :rfc:`3490`, |
| | | see also |
| | | :mod:`encodings.idna`. |
| | | Only ``errors='stric... | trusted_official_docs | CPython Docs | .. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
+--------------------+---------+---------------------------+
| Codec | Aliases | Meaning |
+====================+=========+===========================+
| idna | | Implement :rfc:`3490`, |
| | | see also |
| | | :mod:`encodings.idna`. |
| | | Only ``errors='stric... | .. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
+--------------------+---------+---------------------------+
| Codec | Aliases | Meaning |
+====================+=========+===========================+
| idna | | Implement :rfc:`3490`, |
| | | see also |
| | | :mod:`encodings.idna`. |
| | | Only ``errors='stric... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
110afbf8-04e3-4223-ad66-030ac66325b6 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,331 | supabase-export-v2 | 8583efbcfdc245ce | 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}`.
.. versionchanged:: 3.5
Works with decoding and translating. | trusted_official_docs | CPython Docs | 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}`.
.. versionchanged:: 3.5
Works with decoding and translating. | 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}`.
.. versionchanged:: 3.5
Works with decoding and translating. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1184b8f8-3665-4081-99e0-271fb6699090 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,277 | supabase-export-v2 | 45b59122cad48cae | .. function:: readbuffer_encode(buffer, errors=None, /)
Return a :class:`tuple` containing the raw bytes of *buffer*, a
:ref:`buffer-compatible object <bufferobjects>` or :class:`str`
(encoded to UTF-8 before processing), and their length in bytes. | trusted_official_docs | CPython Docs | .. function:: readbuffer_encode(buffer, errors=None, /)
Return a :class:`tuple` containing the raw bytes of *buffer*, a
:ref:`buffer-compatible object <bufferobjects>` or :class:`str`
(encoded to UTF-8 before processing), and their length in bytes. | .. function:: readbuffer_encode(buffer, errors=None, /)
Return a :class:`tuple` containing the raw bytes of *buffer*, a
:ref:`buffer-compatible object <bufferobjects>` or :class:`str`
(encoded to UTF-8 before processing), and their length in bytes. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13f46b81-b99c-4d6e-8ed1-f94fcad39b50 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,352 | supabase-export-v2 | db7d446569326142 | 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.
The decoder must be able to handle zero length input and return an empty object
of the output object type in this situation. | trusted_official_docs | CPython Docs | 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.
The decoder must be able to handle zero length input and return an empty object
of the output object type in this situation. | 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.
The decoder must be able to handle zero length input and return an empty object
of the output object type in this situation. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
13f60b0d-5362-4139-bad2-9b63f6cb5937 | CPython Docs | file://datasets/cpython/Doc/library/codecs.rst | unknown | 3e420f97-233c-496e-a921-94cd1be6c850 | 20,489 | supabase-export-v2 | 3cac3f5aaab242f4 | all languages | +-----------------+--------------------------------+--------------------------------+ | utf_8 | U8, UTF, utf8, cp65001 | all languages | +-----------------+--------------------------------+--------------------------------+ | utf_8_sig | utf8-sig | all languages | +-----------------+---------------------... | trusted_official_docs | CPython Docs | all languages | +-----------------+--------------------------------+--------------------------------+ | utf_8 | U8, UTF, utf8, cp65001 | all languages | +-----------------+--------------------------------+--------------------------------+ | utf_8_sig | utf8-sig | all languages | +-----------------+---------------------... | all languages | +-----------------+--------------------------------+--------------------------------+ | utf_8 | U8, UTF, utf8, cp65001 | all languages | +-----------------+--------------------------------+--------------------------------+ | utf_8_sig | utf8-sig | all languages | +-----------------+---------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.