1
0
Fork 0
python-docs-fr/library/collections.po

1165 lines
39 KiB
Plaintext

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2016, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-08 09:58+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../Doc/library/collections.rst:2
msgid ":mod:`collections` --- Container datatypes"
msgstr ""
#: ../Doc/library/collections.rst:10
msgid "**Source code:** :source:`Lib/collections/__init__.py`"
msgstr ""
#: ../Doc/library/collections.rst:20
msgid ""
"This module implements specialized container datatypes providing "
"alternatives to Python's general purpose built-in containers, :class:"
"`dict`, :class:`list`, :class:`set`, and :class:`tuple`."
msgstr ""
#: ../Doc/library/collections.rst:25
msgid ":func:`namedtuple`"
msgstr ":func:`namedtuple`"
#: ../Doc/library/collections.rst:25
msgid "factory function for creating tuple subclasses with named fields"
msgstr ""
#: ../Doc/library/collections.rst:26
msgid ":class:`deque`"
msgstr ":class:`deque`"
#: ../Doc/library/collections.rst:26
msgid "list-like container with fast appends and pops on either end"
msgstr ""
#: ../Doc/library/collections.rst:27
msgid ":class:`ChainMap`"
msgstr ":class:`ChainMap`"
#: ../Doc/library/collections.rst:27
msgid "dict-like class for creating a single view of multiple mappings"
msgstr ""
#: ../Doc/library/collections.rst:28
msgid ":class:`Counter`"
msgstr ":class:`Counter`"
#: ../Doc/library/collections.rst:28
msgid "dict subclass for counting hashable objects"
msgstr ""
#: ../Doc/library/collections.rst:29
msgid ":class:`OrderedDict`"
msgstr ":class:`OrderedDict`"
#: ../Doc/library/collections.rst:29
msgid "dict subclass that remembers the order entries were added"
msgstr ""
#: ../Doc/library/collections.rst:30
msgid ":class:`defaultdict`"
msgstr ":class:`defaultdict`"
#: ../Doc/library/collections.rst:30
msgid "dict subclass that calls a factory function to supply missing values"
msgstr ""
#: ../Doc/library/collections.rst:31
msgid ":class:`UserDict`"
msgstr ":class:`UserDict`"
#: ../Doc/library/collections.rst:31
msgid "wrapper around dictionary objects for easier dict subclassing"
msgstr ""
#: ../Doc/library/collections.rst:32
msgid ":class:`UserList`"
msgstr ":class:`UserList`"
#: ../Doc/library/collections.rst:32
msgid "wrapper around list objects for easier list subclassing"
msgstr ""
#: ../Doc/library/collections.rst:33
msgid ":class:`UserString`"
msgstr ":class:`UserString`"
#: ../Doc/library/collections.rst:33
msgid "wrapper around string objects for easier string subclassing"
msgstr ""
#: ../Doc/library/collections.rst:36
msgid ""
"Moved :ref:`collections-abstract-base-classes` to the :mod:`collections.abc` "
"module. For backwards compatibility, they continue to be visible in this "
"module as well."
msgstr ""
#: ../Doc/library/collections.rst:43
msgid ":class:`ChainMap` objects"
msgstr ":class:`ChainMap` objects"
#: ../Doc/library/collections.rst:47
msgid ""
"A :class:`ChainMap` class is provided for quickly linking a number of "
"mappings so they can be treated as a single unit. It is often much faster "
"than creating a new dictionary and running multiple :meth:`~dict.update` "
"calls."
msgstr ""
#: ../Doc/library/collections.rst:51
msgid ""
"The class can be used to simulate nested scopes and is useful in templating."
msgstr ""
#: ../Doc/library/collections.rst:55
msgid ""
"A :class:`ChainMap` groups multiple dicts or other mappings together to "
"create a single, updateable view. If no *maps* are specified, a single "
"empty dictionary is provided so that a new chain always has at least one "
"mapping."
msgstr ""
#: ../Doc/library/collections.rst:59
msgid ""
"The underlying mappings are stored in a list. That list is public and can "
"be accessed or updated using the *maps* attribute. There is no other state."
msgstr ""
#: ../Doc/library/collections.rst:62
msgid ""
"Lookups search the underlying mappings successively until a key is found. "
"In contrast, writes, updates, and deletions only operate on the first "
"mapping."
msgstr ""
#: ../Doc/library/collections.rst:65
msgid ""
"A :class:`ChainMap` incorporates the underlying mappings by reference. So, "
"if one of the underlying mappings gets updated, those changes will be "
"reflected in :class:`ChainMap`."
msgstr ""
#: ../Doc/library/collections.rst:69
msgid ""
"All of the usual dictionary methods are supported. In addition, there is a "
"*maps* attribute, a method for creating new subcontexts, and a property for "
"accessing all but the first mapping:"
msgstr ""
#: ../Doc/library/collections.rst:75
msgid ""
"A user updateable list of mappings. The list is ordered from first-searched "
"to last-searched. It is the only stored state and can be modified to change "
"which mappings are searched. The list should always contain at least one "
"mapping."
msgstr ""
#: ../Doc/library/collections.rst:82
msgid ""
"Returns a new :class:`ChainMap` containing a new map followed by all of the "
"maps in the current instance. If ``m`` is specified, it becomes the new map "
"at the front of the list of mappings; if not specified, an empty dict is "
"used, so that a call to ``d.new_child()`` is equivalent to: ``ChainMap({}, "
"*d.maps)``. This method is used for creating subcontexts that can be "
"updated without altering values in any of the parent mappings."
msgstr ""
#: ../Doc/library/collections.rst:90
msgid "The optional ``m`` parameter was added."
msgstr ""
#: ../Doc/library/collections.rst:95
msgid ""
"Property returning a new :class:`ChainMap` containing all of the maps in the "
"current instance except the first one. This is useful for skipping the "
"first map in the search. Use cases are similar to those for the :keyword:"
"`nonlocal` keyword used in :term:`nested scopes <nested scope>`. The use "
"cases also parallel those for the built-in :func:`super` function. A "
"reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``."
msgstr ""
#: ../Doc/library/collections.rst:106
msgid ""
"The `MultiContext class <https://github.com/enthought/codetools/blob/4.0.0/"
"codetools/contexts/multi_context.py>`_ in the Enthought `CodeTools package "
"<https://github.com/enthought/codetools>`_ has options to support writing to "
"any mapping in the chain."
msgstr ""
#: ../Doc/library/collections.rst:112
msgid ""
"Django's `Context class <https://github.com/django/django/blob/master/django/"
"template/context.py>`_ for templating is a read-only chain of mappings. It "
"also features pushing and popping of contexts similar to the :meth:"
"`~collections.ChainMap.new_child` method and the :meth:`~collections."
"ChainMap.parents` property."
msgstr ""
#: ../Doc/library/collections.rst:119
msgid ""
"The `Nested Contexts recipe <https://code.activestate.com/recipes/577434/>`_ "
"has options to control whether writes and other mutations apply only to the "
"first mapping or to any mapping in the chain."
msgstr ""
#: ../Doc/library/collections.rst:124
msgid ""
"A `greatly simplified read-only version of Chainmap <https://code."
"activestate.com/recipes/305268/>`_."
msgstr ""
#: ../Doc/library/collections.rst:129
msgid ":class:`ChainMap` Examples and Recipes"
msgstr ""
#: ../Doc/library/collections.rst:131
msgid "This section shows various approaches to working with chained maps."
msgstr ""
#: ../Doc/library/collections.rst:134
msgid "Example of simulating Python's internal lookup chain::"
msgstr ""
#: ../Doc/library/collections.rst:139
msgid ""
"Example of letting user specified command-line arguments take precedence "
"over environment variables which in turn take precedence over default "
"values::"
msgstr ""
#: ../Doc/library/collections.rst:156
msgid ""
"Example patterns for using the :class:`ChainMap` class to simulate nested "
"contexts::"
msgstr ""
#: ../Doc/library/collections.rst:175
msgid ""
"The :class:`ChainMap` class only makes updates (writes and deletions) to the "
"first mapping in the chain while lookups will search the full chain. "
"However, if deep writes and deletions are desired, it is easy to make a "
"subclass that updates keys found deeper in the chain::"
msgstr ""
#: ../Doc/library/collections.rst:205
msgid ":class:`Counter` objects"
msgstr ""
#: ../Doc/library/collections.rst:207
msgid ""
"A counter tool is provided to support convenient and rapid tallies. For "
"example::"
msgstr ""
#: ../Doc/library/collections.rst:226
msgid ""
"A :class:`Counter` is a :class:`dict` subclass for counting hashable "
"objects. It is an unordered collection where elements are stored as "
"dictionary keys and their counts are stored as dictionary values. Counts "
"are allowed to be any integer value including zero or negative counts. The :"
"class:`Counter` class is similar to bags or multisets in other languages."
msgstr ""
#: ../Doc/library/collections.rst:232
msgid ""
"Elements are counted from an *iterable* or initialized from another "
"*mapping* (or counter):"
msgstr ""
#: ../Doc/library/collections.rst:240
msgid ""
"Counter objects have a dictionary interface except that they return a zero "
"count for missing items instead of raising a :exc:`KeyError`:"
msgstr ""
#: ../Doc/library/collections.rst:247
msgid ""
"Setting a count to zero does not remove an element from a counter. Use "
"``del`` to remove it entirely:"
msgstr ""
#: ../Doc/library/collections.rst:256
msgid ""
"Counter objects support three methods beyond those available for all "
"dictionaries:"
msgstr ""
#: ../Doc/library/collections.rst:261
msgid ""
"Return an iterator over elements repeating each as many times as its count. "
"Elements are returned in arbitrary order. If an element's count is less "
"than one, :meth:`elements` will ignore it."
msgstr ""
#: ../Doc/library/collections.rst:271
msgid ""
"Return a list of the *n* most common elements and their counts from the most "
"common to the least. If *n* is omitted or ``None``, :func:`most_common` "
"returns *all* elements in the counter. Elements with equal counts are "
"ordered arbitrarily:"
msgstr ""
#: ../Doc/library/collections.rst:281
msgid ""
"Elements are subtracted from an *iterable* or from another *mapping* (or "
"counter). Like :meth:`dict.update` but subtracts counts instead of "
"replacing them. Both inputs and outputs may be zero or negative."
msgstr ""
#: ../Doc/library/collections.rst:293
msgid ""
"The usual dictionary methods are available for :class:`Counter` objects "
"except for two which work differently for counters."
msgstr ""
#: ../Doc/library/collections.rst:298
msgid "This class method is not implemented for :class:`Counter` objects."
msgstr ""
#: ../Doc/library/collections.rst:302
msgid ""
"Elements are counted from an *iterable* or added-in from another *mapping* "
"(or counter). Like :meth:`dict.update` but adds counts instead of replacing "
"them. Also, the *iterable* is expected to be a sequence of elements, not a "
"sequence of ``(key, value)`` pairs."
msgstr ""
#: ../Doc/library/collections.rst:307
msgid "Common patterns for working with :class:`Counter` objects::"
msgstr ""
#: ../Doc/library/collections.rst:319
msgid ""
"Several mathematical operations are provided for combining :class:`Counter` "
"objects to produce multisets (counters that have counts greater than zero). "
"Addition and subtraction combine counters by adding or subtracting the "
"counts of corresponding elements. Intersection and union return the minimum "
"and maximum of corresponding counts. Each operation can accept inputs with "
"signed counts, but the output will exclude results with counts of zero or "
"less."
msgstr ""
#: ../Doc/library/collections.rst:337
msgid ""
"Unary addition and subtraction are shortcuts for adding an empty counter or "
"subtracting from an empty counter."
msgstr ""
#: ../Doc/library/collections.rst:346
msgid ""
"Added support for unary plus, unary minus, and in-place multiset operations."
msgstr ""
#: ../Doc/library/collections.rst:351
msgid ""
"Counters were primarily designed to work with positive integers to represent "
"running counts; however, care was taken to not unnecessarily preclude use "
"cases needing other types or negative values. To help with those use cases, "
"this section documents the minimum range and type restrictions."
msgstr ""
#: ../Doc/library/collections.rst:356
msgid ""
"The :class:`Counter` class itself is a dictionary subclass with no "
"restrictions on its keys and values. The values are intended to be numbers "
"representing counts, but you *could* store anything in the value field."
msgstr ""
#: ../Doc/library/collections.rst:360
msgid ""
"The :meth:`most_common` method requires only that the values be orderable."
msgstr ""
#: ../Doc/library/collections.rst:362
msgid ""
"For in-place operations such as ``c[key] += 1``, the value type need only "
"support addition and subtraction. So fractions, floats, and decimals would "
"work and negative values are supported. The same is also true for :meth:"
"`update` and :meth:`subtract` which allow negative and zero values for both "
"inputs and outputs."
msgstr ""
#: ../Doc/library/collections.rst:368
msgid ""
"The multiset methods are designed only for use cases with positive values. "
"The inputs may be negative or zero, but only outputs with positive values "
"are created. There are no type restrictions, but the value type needs to "
"support addition, subtraction, and comparison."
msgstr ""
#: ../Doc/library/collections.rst:373
msgid ""
"The :meth:`elements` method requires integer counts. It ignores zero and "
"negative counts."
msgstr ""
#: ../Doc/library/collections.rst:378
msgid ""
"`Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag."
"html>`_ in Smalltalk."
msgstr ""
#: ../Doc/library/collections.rst:381
msgid ""
"Wikipedia entry for `Multisets <https://en.wikipedia.org/wiki/Multiset>`_."
msgstr ""
#: ../Doc/library/collections.rst:383
msgid ""
"`C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/"
"Catalog0380__set-multiset.htm>`_ tutorial with examples."
msgstr ""
#: ../Doc/library/collections.rst:386
msgid ""
"For mathematical operations on multisets and their use cases, see *Knuth, "
"Donald. The Art of Computer Programming Volume II, Section 4.6.3, Exercise "
"19*."
msgstr ""
#: ../Doc/library/collections.rst:390
msgid ""
"To enumerate all distinct multisets of a given size over a given set of "
"elements, see :func:`itertools.combinations_with_replacement`:"
msgstr ""
#: ../Doc/library/collections.rst:393
msgid ""
"map(Counter, combinations_with_replacement('ABC', 2)) --> AA AB AC BB BC CC"
msgstr ""
#: ../Doc/library/collections.rst:397
msgid ":class:`deque` objects"
msgstr ""
#: ../Doc/library/collections.rst:401
msgid ""
"Returns a new deque object initialized left-to-right (using :meth:`append`) "
"with data from *iterable*. If *iterable* is not specified, the new deque is "
"empty."
msgstr ""
#: ../Doc/library/collections.rst:404
msgid ""
"Deques are a generalization of stacks and queues (the name is pronounced "
"\"deck\" and is short for \"double-ended queue\"). Deques support thread-"
"safe, memory efficient appends and pops from either side of the deque with "
"approximately the same O(1) performance in either direction."
msgstr ""
#: ../Doc/library/collections.rst:409
msgid ""
"Though :class:`list` objects support similar operations, they are optimized "
"for fast fixed-length operations and incur O(n) memory movement costs for "
"``pop(0)`` and ``insert(0, v)`` operations which change both the size and "
"position of the underlying data representation."
msgstr ""
#: ../Doc/library/collections.rst:415
msgid ""
"If *maxlen* is not specified or is ``None``, deques may grow to an arbitrary "
"length. Otherwise, the deque is bounded to the specified maximum length. "
"Once a bounded length deque is full, when new items are added, a "
"corresponding number of items are discarded from the opposite end. Bounded "
"length deques provide functionality similar to the ``tail`` filter in Unix. "
"They are also useful for tracking transactions and other pools of data where "
"only the most recent activity is of interest."
msgstr ""
#: ../Doc/library/collections.rst:424
msgid "Deque objects support the following methods:"
msgstr ""
#: ../Doc/library/collections.rst:428
msgid "Add *x* to the right side of the deque."
msgstr ""
#: ../Doc/library/collections.rst:433
msgid "Add *x* to the left side of the deque."
msgstr ""
#: ../Doc/library/collections.rst:438
msgid "Remove all elements from the deque leaving it with length 0."
msgstr ""
#: ../Doc/library/collections.rst:443
msgid "Create a shallow copy of the deque."
msgstr ""
#: ../Doc/library/collections.rst:450
msgid "Count the number of deque elements equal to *x*."
msgstr ""
#: ../Doc/library/collections.rst:457
msgid ""
"Extend the right side of the deque by appending elements from the iterable "
"argument."
msgstr ""
#: ../Doc/library/collections.rst:463
msgid ""
"Extend the left side of the deque by appending elements from *iterable*. "
"Note, the series of left appends results in reversing the order of elements "
"in the iterable argument."
msgstr ""
#: ../Doc/library/collections.rst:470
msgid ""
"Return the position of *x* in the deque (at or after index *start* and "
"before index *stop*). Returns the first match or raises :exc:`ValueError` "
"if not found."
msgstr ""
#: ../Doc/library/collections.rst:479
msgid "Insert *x* into the deque at position *i*."
msgstr ""
#: ../Doc/library/collections.rst:481
msgid ""
"If the insertion would cause a bounded deque to grow beyond *maxlen*, an :"
"exc:`IndexError` is raised."
msgstr ""
#: ../Doc/library/collections.rst:489
msgid ""
"Remove and return an element from the right side of the deque. If no "
"elements are present, raises an :exc:`IndexError`."
msgstr ""
#: ../Doc/library/collections.rst:495
msgid ""
"Remove and return an element from the left side of the deque. If no elements "
"are present, raises an :exc:`IndexError`."
msgstr ""
#: ../Doc/library/collections.rst:501
msgid ""
"Remove the first occurrence of *value*. If not found, raises a :exc:"
"`ValueError`."
msgstr ""
#: ../Doc/library/collections.rst:507
msgid "Reverse the elements of the deque in-place and then return ``None``."
msgstr ""
#: ../Doc/library/collections.rst:514
msgid ""
"Rotate the deque *n* steps to the right. If *n* is negative, rotate to the "
"left."
msgstr ""
#: ../Doc/library/collections.rst:517
msgid ""
"When the deque is not empty, rotating one step to the right is equivalent to "
"``d.appendleft(d.pop())``, and rotating one step to the left is equivalent "
"to ``d.append(d.popleft())``."
msgstr ""
#: ../Doc/library/collections.rst:522
msgid "Deque objects also provide one read-only attribute:"
msgstr ""
#: ../Doc/library/collections.rst:526
msgid "Maximum size of a deque or ``None`` if unbounded."
msgstr ""
#: ../Doc/library/collections.rst:531
msgid ""
"In addition to the above, deques support iteration, pickling, ``len(d)``, "
"``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing "
"with the :keyword:`in` operator, and subscript references such as "
"``d[-1]``. Indexed access is O(1) at both ends but slows to O(n) in the "
"middle. For fast random access, use lists instead."
msgstr ""
#: ../Doc/library/collections.rst:537
msgid ""
"Starting in version 3.5, deques support ``__add__()``, ``__mul__()``, and "
"``__imul__()``."
msgstr ""
#: ../Doc/library/collections.rst:540
msgid "Example:"
msgstr "Exemple :"
#: ../Doc/library/collections.rst:597
msgid ":class:`deque` Recipes"
msgstr ""
#: ../Doc/library/collections.rst:599
msgid "This section shows various approaches to working with deques."
msgstr ""
#: ../Doc/library/collections.rst:601
msgid ""
"Bounded length deques provide functionality similar to the ``tail`` filter "
"in Unix::"
msgstr ""
#: ../Doc/library/collections.rst:609
msgid ""
"Another approach to using deques is to maintain a sequence of recently added "
"elements by appending to the right and popping to the left::"
msgstr ""
#: ../Doc/library/collections.rst:624
msgid ""
"The :meth:`rotate` method provides a way to implement :class:`deque` slicing "
"and deletion. For example, a pure Python implementation of ``del d[n]`` "
"relies on the :meth:`rotate` method to position elements to be popped::"
msgstr ""
#: ../Doc/library/collections.rst:633
msgid ""
"To implement :class:`deque` slicing, use a similar approach applying :meth:"
"`rotate` to bring a target element to the left side of the deque. Remove old "
"entries with :meth:`popleft`, add new entries with :meth:`extend`, and then "
"reverse the rotation. With minor variations on that approach, it is easy to "
"implement Forth style stack manipulations such as ``dup``, ``drop``, "
"``swap``, ``over``, ``pick``, ``rot``, and ``roll``."
msgstr ""
#: ../Doc/library/collections.rst:643
msgid ":class:`defaultdict` objects"
msgstr ""
#: ../Doc/library/collections.rst:647
msgid ""
"Returns a new dictionary-like object. :class:`defaultdict` is a subclass of "
"the built-in :class:`dict` class. It overrides one method and adds one "
"writable instance variable. The remaining functionality is the same as for "
"the :class:`dict` class and is not documented here."
msgstr ""
#: ../Doc/library/collections.rst:652
msgid ""
"The first argument provides the initial value for the :attr:"
"`default_factory` attribute; it defaults to ``None``. All remaining "
"arguments are treated the same as if they were passed to the :class:`dict` "
"constructor, including keyword arguments."
msgstr ""
#: ../Doc/library/collections.rst:658
msgid ""
":class:`defaultdict` objects support the following method in addition to the "
"standard :class:`dict` operations:"
msgstr ""
#: ../Doc/library/collections.rst:663
msgid ""
"If the :attr:`default_factory` attribute is ``None``, this raises a :exc:"
"`KeyError` exception with the *key* as argument."
msgstr ""
#: ../Doc/library/collections.rst:666
msgid ""
"If :attr:`default_factory` is not ``None``, it is called without arguments "
"to provide a default value for the given *key*, this value is inserted in "
"the dictionary for the *key*, and returned."
msgstr ""
#: ../Doc/library/collections.rst:670
msgid ""
"If calling :attr:`default_factory` raises an exception this exception is "
"propagated unchanged."
msgstr ""
#: ../Doc/library/collections.rst:673
msgid ""
"This method is called by the :meth:`__getitem__` method of the :class:`dict` "
"class when the requested key is not found; whatever it returns or raises is "
"then returned or raised by :meth:`__getitem__`."
msgstr ""
#: ../Doc/library/collections.rst:677
msgid ""
"Note that :meth:`__missing__` is *not* called for any operations besides :"
"meth:`__getitem__`. This means that :meth:`get` will, like normal "
"dictionaries, return ``None`` as a default rather than using :attr:"
"`default_factory`."
msgstr ""
#: ../Doc/library/collections.rst:683
msgid ":class:`defaultdict` objects support the following instance variable:"
msgstr ""
#: ../Doc/library/collections.rst:688
msgid ""
"This attribute is used by the :meth:`__missing__` method; it is initialized "
"from the first argument to the constructor, if present, or to ``None``, if "
"absent."
msgstr ""
#: ../Doc/library/collections.rst:694
msgid ":class:`defaultdict` Examples"
msgstr ""
#: ../Doc/library/collections.rst:696
msgid ""
"Using :class:`list` as the :attr:`default_factory`, it is easy to group a "
"sequence of key-value pairs into a dictionary of lists:"
msgstr ""
#: ../Doc/library/collections.rst:707
msgid ""
"When each key is encountered for the first time, it is not already in the "
"mapping; so an entry is automatically created using the :attr:"
"`default_factory` function which returns an empty :class:`list`. The :meth:"
"`list.append` operation then attaches the value to the new list. When keys "
"are encountered again, the look-up proceeds normally (returning the list for "
"that key) and the :meth:`list.append` operation adds another value to the "
"list. This technique is simpler and faster than an equivalent technique "
"using :meth:`dict.setdefault`:"
msgstr ""
#: ../Doc/library/collections.rst:722
msgid ""
"Setting the :attr:`default_factory` to :class:`int` makes the :class:"
"`defaultdict` useful for counting (like a bag or multiset in other "
"languages):"
msgstr ""
#: ../Doc/library/collections.rst:734
msgid ""
"When a letter is first encountered, it is missing from the mapping, so the :"
"attr:`default_factory` function calls :func:`int` to supply a default count "
"of zero. The increment operation then builds up the count for each letter."
msgstr ""
#: ../Doc/library/collections.rst:738
msgid ""
"The function :func:`int` which always returns zero is just a special case of "
"constant functions. A faster and more flexible way to create constant "
"functions is to use a lambda function which can supply any constant value "
"(not just zero):"
msgstr ""
#: ../Doc/library/collections.rst:750
msgid ""
"Setting the :attr:`default_factory` to :class:`set` makes the :class:"
"`defaultdict` useful for building a dictionary of sets:"
msgstr ""
#: ../Doc/library/collections.rst:763
msgid ":func:`namedtuple` Factory Function for Tuples with Named Fields"
msgstr ""
#: ../Doc/library/collections.rst:765
msgid ""
"Named tuples assign meaning to each position in a tuple and allow for more "
"readable, self-documenting code. They can be used wherever regular tuples "
"are used, and they add the ability to access fields by name instead of "
"position index."
msgstr ""
#: ../Doc/library/collections.rst:771
msgid ""
"Returns a new tuple subclass named *typename*. The new subclass is used to "
"create tuple-like objects that have fields accessible by attribute lookup as "
"well as being indexable and iterable. Instances of the subclass also have a "
"helpful docstring (with typename and field_names) and a helpful :meth:"
"`__repr__` method which lists the tuple contents in a ``name=value`` format."
msgstr ""
#: ../Doc/library/collections.rst:777
msgid ""
"The *field_names* are a sequence of strings such as ``['x', 'y']``. "
"Alternatively, *field_names* can be a single string with each fieldname "
"separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``."
msgstr ""
#: ../Doc/library/collections.rst:781
msgid ""
"Any valid Python identifier may be used for a fieldname except for names "
"starting with an underscore. Valid identifiers consist of letters, digits, "
"and underscores but do not start with a digit or underscore and cannot be a :"
"mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or *raise*."
msgstr ""
#: ../Doc/library/collections.rst:787
msgid ""
"If *rename* is true, invalid fieldnames are automatically replaced with "
"positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is "
"converted to ``['abc', '_1', 'ghi', '_3']``, eliminating the keyword ``def`` "
"and the duplicate fieldname ``abc``."
msgstr ""
#: ../Doc/library/collections.rst:792
msgid ""
"If *verbose* is true, the class definition is printed after it is built. "
"This option is outdated; instead, it is simpler to print the :attr:`_source` "
"attribute."
msgstr ""
#: ../Doc/library/collections.rst:796
msgid ""
"If *module* is defined, the ``__module__`` attribute of the named tuple is "
"set to that value."
msgstr ""
#: ../Doc/library/collections.rst:799
msgid ""
"Named tuple instances do not have per-instance dictionaries, so they are "
"lightweight and require no more memory than regular tuples."
msgstr ""
#: ../Doc/library/collections.rst:802
msgid "Added support for *rename*."
msgstr ""
#: ../Doc/library/collections.rst:805
msgid ""
"The *verbose* and *rename* parameters became :ref:`keyword-only arguments "
"<keyword-only_parameter>`."
msgstr ""
#: ../Doc/library/collections.rst:809
msgid "Added the *module* parameter."
msgstr ""
#: ../Doc/library/collections.rst:828
msgid ""
"Named tuples are especially useful for assigning field names to result "
"tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::"
msgstr ""
#: ../Doc/library/collections.rst:844
msgid ""
"In addition to the methods inherited from tuples, named tuples support three "
"additional methods and two attributes. To prevent conflicts with field "
"names, the method and attribute names start with an underscore."
msgstr ""
#: ../Doc/library/collections.rst:850
msgid ""
"Class method that makes a new instance from an existing sequence or iterable."
msgstr ""
#: ../Doc/library/collections.rst:860
msgid ""
"Return a new :class:`OrderedDict` which maps field names to their "
"corresponding values:"
msgstr ""
#: ../Doc/library/collections.rst:869
msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`."
msgstr ""
#: ../Doc/library/collections.rst:874
msgid ""
"Return a new instance of the named tuple replacing specified fields with new "
"values::"
msgstr ""
#: ../Doc/library/collections.rst:886
msgid ""
"A string with the pure Python source code used to create the named tuple "
"class. The source makes the named tuple self-documenting. It can be "
"printed, executed using :func:`exec`, or saved to a file and imported."
msgstr ""
#: ../Doc/library/collections.rst:895
msgid ""
"Tuple of strings listing the field names. Useful for introspection and for "
"creating new named tuple types from existing named tuples."
msgstr ""
#: ../Doc/library/collections.rst:908
msgid ""
"To retrieve a field whose name is stored in a string, use the :func:"
"`getattr` function:"
msgstr ""
#: ../Doc/library/collections.rst:914
msgid ""
"To convert a dictionary to a named tuple, use the double-star-operator (as "
"described in :ref:`tut-unpacking-arguments`):"
msgstr ""
#: ../Doc/library/collections.rst:921
msgid ""
"Since a named tuple is a regular Python class, it is easy to add or change "
"functionality with a subclass. Here is how to add a calculated field and a "
"fixed-width print format:"
msgstr ""
#: ../Doc/library/collections.rst:940
msgid ""
"The subclass shown above sets ``__slots__`` to an empty tuple. This helps "
"keep memory requirements low by preventing the creation of instance "
"dictionaries."
msgstr ""
#: ../Doc/library/collections.rst:943
msgid ""
"Subclassing is not useful for adding new, stored fields. Instead, simply "
"create a new named tuple type from the :attr:`_fields` attribute:"
msgstr ""
#: ../Doc/library/collections.rst:948
msgid ""
"Docstrings can be customized by making direct assignments to the ``__doc__`` "
"fields:"
msgstr ""
#: ../Doc/library/collections.rst:957
msgid "Property docstrings became writeable."
msgstr ""
#: ../Doc/library/collections.rst:960
msgid ""
"Default values can be implemented by using :meth:`_replace` to customize a "
"prototype instance:"
msgstr ""
#: ../Doc/library/collections.rst:971
msgid ""
"`Recipe for named tuple abstract base class with a metaclass mix-in <https://"
"code.activestate.com/recipes/577629-namedtupleabc-abstract-base-class-mix-in-"
"for-named/>`_ by Jan Kaliszewski. Besides providing an :term:`abstract base "
"class` for named tuples, it also supports an alternate :term:`metaclass`-"
"based constructor that is convenient for use cases where named tuples are "
"being subclassed."
msgstr ""
#: ../Doc/library/collections.rst:978
msgid ""
"See :meth:`types.SimpleNamespace` for a mutable namespace based on an "
"underlying dictionary instead of a tuple."
msgstr ""
#: ../Doc/library/collections.rst:981
msgid ""
"See :meth:`typing.NamedTuple` for a way to add type hints for named tuples."
msgstr ""
#: ../Doc/library/collections.rst:985
msgid ":class:`OrderedDict` objects"
msgstr ""
#: ../Doc/library/collections.rst:987
msgid ""
"Ordered dictionaries are just like regular dictionaries but they remember "
"the order that items were inserted. When iterating over an ordered "
"dictionary, the items are returned in the order their keys were first added."
msgstr ""
#: ../Doc/library/collections.rst:993
msgid ""
"Return an instance of a dict subclass, supporting the usual :class:`dict` "
"methods. An *OrderedDict* is a dict that remembers the order that keys were "
"first inserted. If a new entry overwrites an existing entry, the original "
"insertion position is left unchanged. Deleting an entry and reinserting it "
"will move it to the end."
msgstr ""
#: ../Doc/library/collections.rst:1003
msgid ""
"The :meth:`popitem` method for ordered dictionaries returns and removes a "
"(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-"
"out)` order if *last* is true or :abbr:`FIFO (first-in, first-out)` order if "
"false."
msgstr ""
#: ../Doc/library/collections.rst:1010
msgid ""
"Move an existing *key* to either end of an ordered dictionary. The item is "
"moved to the right end if *last* is true (the default) or to the beginning "
"if *last* is false. Raises :exc:`KeyError` if the *key* does not exist::"
msgstr ""
#: ../Doc/library/collections.rst:1025
msgid ""
"In addition to the usual mapping methods, ordered dictionaries also support "
"reverse iteration using :func:`reversed`."
msgstr ""
#: ../Doc/library/collections.rst:1028
msgid ""
"Equality tests between :class:`OrderedDict` objects are order-sensitive and "
"are implemented as ``list(od1.items())==list(od2.items())``. Equality tests "
"between :class:`OrderedDict` objects and other :class:`~collections.abc."
"Mapping` objects are order-insensitive like regular dictionaries. This "
"allows :class:`OrderedDict` objects to be substituted anywhere a regular "
"dictionary is used."
msgstr ""
#: ../Doc/library/collections.rst:1035
msgid ""
"The items, keys, and values :term:`views <dictionary view>` of :class:"
"`OrderedDict` now support reverse iteration using :func:`reversed`."
msgstr ""
#: ../Doc/library/collections.rst:1039
msgid ""
"With the acceptance of :pep:`468`, order is retained for keyword arguments "
"passed to the :class:`OrderedDict` constructor and its :meth:`update` method."
msgstr ""
#: ../Doc/library/collections.rst:1045
msgid ":class:`OrderedDict` Examples and Recipes"
msgstr ""
#: ../Doc/library/collections.rst:1047
msgid ""
"Since an ordered dictionary remembers its insertion order, it can be used in "
"conjunction with sorting to make a sorted dictionary::"
msgstr ""
#: ../Doc/library/collections.rst:1065
msgid ""
"The new sorted dictionaries maintain their sort order when entries are "
"deleted. But when new keys are added, the keys are appended to the end and "
"the sort is not maintained."
msgstr ""
#: ../Doc/library/collections.rst:1069
msgid ""
"It is also straight-forward to create an ordered dictionary variant that "
"remembers the order the keys were *last* inserted. If a new entry overwrites "
"an existing entry, the original insertion position is changed and moved to "
"the end::"
msgstr ""
#: ../Doc/library/collections.rst:1082
msgid ""
"An ordered dictionary can be combined with the :class:`Counter` class so "
"that the counter remembers the order elements are first encountered::"
msgstr ""
#: ../Doc/library/collections.rst:1096
msgid ":class:`UserDict` objects"
msgstr ""
#: ../Doc/library/collections.rst:1098
msgid ""
"The class, :class:`UserDict` acts as a wrapper around dictionary objects. "
"The need for this class has been partially supplanted by the ability to "
"subclass directly from :class:`dict`; however, this class can be easier to "
"work with because the underlying dictionary is accessible as an attribute."
msgstr ""
#: ../Doc/library/collections.rst:1106
msgid ""
"Class that simulates a dictionary. The instance's contents are kept in a "
"regular dictionary, which is accessible via the :attr:`data` attribute of :"
"class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is "
"initialized with its contents; note that a reference to *initialdata* will "
"not be kept, allowing it be used for other purposes."
msgstr ""
#: ../Doc/library/collections.rst:1112
msgid ""
"In addition to supporting the methods and operations of mappings, :class:"
"`UserDict` instances provide the following attribute:"
msgstr ""
#: ../Doc/library/collections.rst:1117
msgid ""
"A real dictionary used to store the contents of the :class:`UserDict` class."
msgstr ""
#: ../Doc/library/collections.rst:1123
msgid ":class:`UserList` objects"
msgstr ""
#: ../Doc/library/collections.rst:1125
msgid ""
"This class acts as a wrapper around list objects. It is a useful base class "
"for your own list-like classes which can inherit from them and override "
"existing methods or add new ones. In this way, one can add new behaviors to "
"lists."
msgstr ""
#: ../Doc/library/collections.rst:1130
msgid ""
"The need for this class has been partially supplanted by the ability to "
"subclass directly from :class:`list`; however, this class can be easier to "
"work with because the underlying list is accessible as an attribute."
msgstr ""
#: ../Doc/library/collections.rst:1136
msgid ""
"Class that simulates a list. The instance's contents are kept in a regular "
"list, which is accessible via the :attr:`data` attribute of :class:"
"`UserList` instances. The instance's contents are initially set to a copy "
"of *list*, defaulting to the empty list ``[]``. *list* can be any iterable, "
"for example a real Python list or a :class:`UserList` object."
msgstr ""
#: ../Doc/library/collections.rst:1142
msgid ""
"In addition to supporting the methods and operations of mutable sequences, :"
"class:`UserList` instances provide the following attribute:"
msgstr ""
#: ../Doc/library/collections.rst:1147
msgid ""
"A real :class:`list` object used to store the contents of the :class:"
"`UserList` class."
msgstr ""
#: ../Doc/library/collections.rst:1150
msgid ""
"**Subclassing requirements:** Subclasses of :class:`UserList` are expected "
"to offer a constructor which can be called with either no arguments or one "
"argument. List operations which return a new sequence attempt to create an "
"instance of the actual implementation class. To do so, it assumes that the "
"constructor can be called with a single parameter, which is a sequence "
"object used as a data source."
msgstr ""
#: ../Doc/library/collections.rst:1157
msgid ""
"If a derived class does not wish to comply with this requirement, all of the "
"special methods supported by this class will need to be overridden; please "
"consult the sources for information about the methods which need to be "
"provided in that case."
msgstr ""
#: ../Doc/library/collections.rst:1163
msgid ":class:`UserString` objects"
msgstr ""
#: ../Doc/library/collections.rst:1165
msgid ""
"The class, :class:`UserString` acts as a wrapper around string objects. The "
"need for this class has been partially supplanted by the ability to subclass "
"directly from :class:`str`; however, this class can be easier to work with "
"because the underlying string is accessible as an attribute."
msgstr ""
#: ../Doc/library/collections.rst:1173
msgid ""
"Class that simulates a string or a Unicode string object. The instance's "
"content is kept in a regular string object, which is accessible via the :"
"attr:`data` attribute of :class:`UserString` instances. The instance's "
"contents are initially set to a copy of *sequence*. The *sequence* can be "
"an instance of :class:`bytes`, :class:`str`, :class:`UserString` (or a "
"subclass) or an arbitrary sequence which can be converted into a string "
"using the built-in :func:`str` function."
msgstr ""
#: ../Doc/library/collections.rst:1181
msgid ""
"New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, "
"``isprintable``, and ``maketrans``."
msgstr ""