summaryrefslogtreecommitdiffstats
path: root/Lib/collections
Commit message (Collapse)AuthorAgeFilesLines
* gh-108751: Add copy.replace() function (GH-108752)Serhiy Storchaka2023-09-061-0/+1
| | | | | | | | | It creates a modified copy of an object by calling the object's __replace__() method. It is a generalization of dataclasses.replace(), named tuple's _replace() method and replace() methods in various classes, and supports all these stdlib classes.
* gh-105736: Sync pure python version of OrderedDict with the C version (#108098)Raymond Hettinger2023-08-211-7/+9
|
* gh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (#104424)Alex Waygood2023-05-131-9/+0
|
* gh-91896: Improve visibility of `ByteString` deprecation warnings (#104294)Alex Waygood2023-05-121-0/+9
|
* gh-103092: Isolate `_collections` (#103093)Erlend E. Aasland2023-04-121-0/+5
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-101446: Change `repr` of `collections.OrderedDict` (#101661)Nikita Sobolev2023-02-081-1/+1
|
* gh-86682: Adds sys._getframemodulename as an alternative to using _getframe ↵Steve Dower2023-01-131-3/+6
| | | | | (GH-99520) Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
* GH-98766: Modest speed-up from ChainMap.__iter__ (GH-98946)Raymond Hettinger2022-11-011-2/+2
|
* bpo-39264: Fix UserDict.get() to account for __missing__() (GH-17910)Bar Harel2022-05-101-1/+8
| | | | | | Here's the patch according to the discussion at the [Python-Dev mailing list](https://mail.python.org/archives/list/python-dev@python.org/thread/SDXOEMAEM6KQ3CQCJVBVRT5QNSPAVU6X/). UserDict.get() will match dict's behavior and not call `__missing__`. Automerge-Triggered-By: GH:rhettinger
* bpo-26579: Add object.__getstate__(). (GH-2821)Serhiy Storchaka2022-04-061-4/+16
| | | | | | | Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.
* Fix minor details in the Counter docs (GH-31029)Raymond Hettinger2022-02-021-0/+4
|
* Minor code rearrangement to group related methods together. (GH-30813)Raymond Hettinger2022-01-231-40/+38
| | | | * Make example more focused with math.prod() * Move comparison tests to the multiset operations section
* bpo-27275: Change popitem() and pop() methods of collections.OrderedDict ↵Serhiy Storchaka2021-08-031-4/+12
| | | | | | | | | | | | | | | | | (GH-27530) * Unify the C and Python implementations of OrderedDict.popitem(). The C implementation no longer calls ``__getitem__`` and ``__delitem__`` methods of the OrderedDict subclasses. * Change popitem() and pop() methods of collections.OrderedDict For consistency with dict both implementations (pure Python and C) of these methods in OrderedDict no longer call __getitem__ and __delitem__ methods of the OrderedDict subclasses. Previously only the Python implementation of popitem() did not call them.
* bpo-25478: Add total() method to collections.Counter (GH-25829)Raymond Hettinger2021-05-031-0/+4
|
* bpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788)Kamil Turek2021-03-141-2/+5
|
* bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)Brandt Bucher2021-02-261-0/+1
| | | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Talin <viridia@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-43102: Set namedtuple __new__'s internal builtins to a dict. (GH-24439)Raymond Hettinger2021-02-041-1/+1
|
* bpo-37324: Remove ABC aliases from collections (GH-23754)Hugo van Kemenade2021-01-121-16/+0
| | | | Remove deprecated aliases to Abstract Base Classes from the collections module.
* bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and ↵kj2020-12-131-0/+1
| | | | typing (GH-23060)
* bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ ↵Andreas Poehlmann2020-11-301-1/+1
| | | | (GH-23534)
* Revert "Fix all Python Cookbook links (#22205)" (GH-22424)Andre Delfino2020-09-271-1/+1
| | | This commit reverts commit ac0333e1e117b7f61ed7ef1dbcdb6e515ada603b as the original links are working again and they provide extended features such as comments and alternative versions.
* Fix all Python Cookbook links (#22205)Andre Delfino2020-09-151-1/+1
|
* bpo-41006: collections imports lazily heap (GH-20940)Victor Stinner2020-06-171-2/+4
| | | | The collections module now imports lazily the heapq modules in the Counter.most_common() method to speedup Python startup time.
* Collections module reformatting and minor code refactoring (GH-20772)Raymond Hettinger2020-06-111-91/+271
|
* Minor improvement to the namedtuple implementation (GH-20741)Raymond Hettinger2020-06-081-1/+4
| | | | | * Cleaner way to build the arg list with a trailing comma when required * Fix appearance of __new__ in help()
* Deny eval() direct access to builtins (GH-20713)Raymond Hettinger2020-06-081-1/+2
|
* Update comments to reflect the current API (GH-20682)Raymond Hettinger2020-06-061-4/+6
|
* bpo-40755: Add rich comparisons to Counter (GH-20548)Raymond Hettinger2020-05-311-86/+36
|
* bpo-40755: Add missing multiset operations to Counter() (GH-20339)Raymond Hettinger2020-05-281-6/+104
|
* Simplify creation of the __new__ method in namedtuple() (GH-20361)Raymond Hettinger2020-05-261-4/+2
|
* Expand the implementation comments (GH-19699)Raymond Hettinger2020-04-241-0/+7
|
* bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)sweeneyde2020-04-221-0/+8
| | | | | Added str.removeprefix and str.removesuffix methods and corresponding bytes, bytearray, and collections.UserString methods to remove affixes from a string if present. See PEP 616 for a full description.
* bpo-36144: Add PEP 584 operators to collections.ChainMap (#18832)Curtis Bucher2020-03-231-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update ChainMap to include | and |= Created __ior__, __or__ and __ror__ methods in ChainMap class. * Update ACKS * Update docs * Update test_collections.py to include test_issue584(). Added testing for | and |= operators for ChainMap objects. * Update test_union_operators Renamed test_union operators, fixed errors and style problems raised by brandtbucher. * Update test_union_operators in TestChainMap Added testing for union operator between ChainMap and iterable of key-value pairs. * Update test_union operators in test_collections.py Gave more descriptive variable names and eliminated unnecessary tmp variable. * Update test_union_operators in test_collections.py Added cm3 * Check .maps rather than Chainmap equality. * Add news entry * Update Lib/test/test_collections.py Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com> * Removed whitespace * Added Guido's changes * Fixed Docs * Removed whitespace Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-36144: OrderedDict Union (PEP 584) (#18967)Brandt Bucher2020-03-131-0/+18
|
* bpo-36144: Dictionary Union (PEP 584) (#12088)Brandt Bucher2020-02-251-0/+20
|
* bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in ↵Victor Stinner2020-02-181-0/+15
| | | | | | | | the collections module. (GH-10596)" (GH-18545) This reverts commit ef092fe9905f61ca27889092ca1248a11aa74498. Update collections __getattr__() and documentation to defer aliases removal to Python 3.10.
* bpo-36321: Fix misspelled attribute name in namedtuple() (GH-16858)Raymond Hettinger2019-10-201-2/+0
|
* bpo-25988: Do not expose abstract collection classes in the collections ↵Serhiy Storchaka2019-10-071-15/+0
| | | | module. (GH-10596)
* bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138)Daniel Fortunov2019-08-281-6/+4
|
* Add missing space to warning message (GH-14915)Florian Bruhin2019-08-221-1/+1
| | | This typo was introduced in GH-13409 when changing the message text.
* Fix typos in docs, comments and test assert messages (#14872)Min ho Kim2019-07-211-1/+1
|
* [3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)Serhiy Storchaka2019-06-051-17/+1
| | | Turn deprecation warnings added in 3.8 into TypeError.
* bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)Serhiy Storchaka2019-06-011-36/+10
|
* bpo-36953: Delay removal of ABCs from collections. (GH-13409)Matthias Bussonnier2019-05-301-2/+2
| | | | | | | Bump the removal to 3.9, indicate collections.abc available since 3.3, replace version-changed directive to deprecated-removed. https://bugs.python.org/issue36953
* bpo-25652: Fix __rmod__ of UserString (GH-13326)Batuhan Taşkaya2019-05-211-3/+2
| | | | | | The ``__rmod__`` method of ``collections.UserString`` class had a bug that made it unusable. https://bugs.python.org/issue25652
* bpo-27141: Fix collections.UserList and UserDict shallow copy. (GH-4094)Bar Harel2019-05-191-0/+14
|
* bpo-27639: Correct return type for UserList slicing operation (#13169)Michael Blahay2019-05-071-1/+5
| | | | | | | * BPO-27639: Correct return type for UserList slicing operation Added logic to __getitem__ magic method for UserList to ensure that the return type matches that of self.
* bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)Serhiy Storchaka2019-05-061-0/+2
|
* Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) ↵Slam2019-04-021-1/+1
| | | | | instead of len() (GH-12139) Semantically the same, but more idiomatic by checking against `kwargs` instead of `len(kwargs)`.
* bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375)Raymond Hettinger2019-03-181-0/+2
|