Alex Waygood
c527eb1c2a
gh-91896: Revert some very noisy DeprecationWarnings for `ByteString` ( #104424 )
2023-05-13 09:55:35 +01:00
Alex Waygood
f0f5bb3204
gh-91896: Improve visibility of `ByteString` deprecation warnings ( #104294 )
2023-05-11 23:01:31 -07:00
Erlend E. Aasland
52f96d3ea3
gh-103092: Isolate `_collections` ( #103093 )
...
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-12 18:21:28 +05:30
Nikita Sobolev
790ff6bc6a
gh-101446: Change `repr` of `collections.OrderedDict` ( #101661 )
2023-02-07 20:01:10 -06:00
Steve Dower
b5d4347950
gh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520)
...
Also updates calls in collections, doctest, enum, and typing modules to use _getframemodulename first when available.
2023-01-13 11:31:06 +00:00
Raymond Hettinger
f5afb7f233
GH-98766: Modest speed-up from ChainMap.__iter__ (GH-98946)
2022-10-31 23:44:40 -05:00
Bar Harel
30a43586f0
bpo-39264: Fix UserDict.get() to account for __missing__() (GH-17910)
...
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
2022-05-10 14:23:45 -07:00
Serhiy Storchaka
884eba3c76
bpo-26579: Add object.__getstate__(). (GH-2821)
...
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.
2022-04-06 20:00:14 +03:00
Raymond Hettinger
f77beacf01
Fix minor details in the Counter docs (GH-31029)
2022-02-01 22:18:11 -06:00
Raymond Hettinger
bcacab47bf
Minor code rearrangement to group related methods together. (GH-30813)
...
* Make example more focused with math.prod()
* Move comparison tests to the multiset operations section
2022-01-22 18:47:22 -06:00
Serhiy Storchaka
8c9f847997
bpo-27275: Change popitem() and pop() methods of collections.OrderedDict (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.
2021-08-03 13:00:55 +02:00
Raymond Hettinger
8c598dbb94
bpo-25478: Add total() method to collections.Counter (GH-25829)
2021-05-02 20:19:51 -07:00
Kamil Turek
9923df9641
bpo-43245: Add keyword argument support to ChainMap.new_child() (GH-24788)
2021-03-13 19:15:44 -08:00
Brandt Bucher
145bf269df
bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)
...
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Talin <viridia@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-02-26 14:51:55 -08:00
Raymond Hettinger
b6d68aa08b
bpo-43102: Set namedtuple __new__'s internal builtins to a dict. (GH-24439)
2021-02-04 15:52:16 -08:00
Hugo van Kemenade
c47c78b878
bpo-37324: Remove ABC aliases from collections (GH-23754)
...
Remove deprecated aliases to Abstract Base Classes from the
collections module.
2021-01-13 00:16:37 +01:00
kj
463c7d3d14
bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and typing (GH-23060)
2020-12-13 10:38:24 -08:00
Andreas Poehlmann
0be9ce305f
bpo-42487: don't call __getitem__ of underlying maps in ChainMap.__iter__ (GH-23534)
2020-11-30 08:34:15 -08:00
Andre Delfino
e8a2076e14
Revert "Fix all Python Cookbook links ( #22205 )" (GH-22424)
...
This commit reverts commit ac0333e1e1
as the original links are working again and they provide extended features such as comments and alternative versions.
2020-09-27 01:47:25 +01:00
Andre Delfino
ac0333e1e1
Fix all Python Cookbook links ( #22205 )
2020-09-15 21:13:26 +01:00
Victor Stinner
7824cc05bf
bpo-41006: collections imports lazily heap (GH-20940)
...
The collections module now imports lazily the heapq modules in the
Counter.most_common() method to speedup Python startup time.
2020-06-17 19:10:47 +02:00
Raymond Hettinger
31d17798d6
Collections module reformatting and minor code refactoring (GH-20772)
2020-06-10 23:17:58 -07:00
Raymond Hettinger
0a40849eb9
Minor improvement to the namedtuple implementation (GH-20741)
...
* Cleaner way to build the arg list with a trailing comma when required
* Fix appearance of __new__ in help()
2020-06-08 12:38:41 -07:00
Raymond Hettinger
3ff51d425e
Deny eval() direct access to builtins (GH-20713)
2020-06-07 23:51:40 -07:00
Raymond Hettinger
0e96c419d7
Update comments to reflect the current API (GH-20682)
2020-06-06 12:42:54 -07:00
Raymond Hettinger
b7d79b4f36
bpo-40755: Add rich comparisons to Counter (GH-20548)
2020-05-31 14:57:42 -07:00
Raymond Hettinger
60398512c8
bpo-40755: Add missing multiset operations to Counter() (GH-20339)
2020-05-28 08:35:46 -07:00
Raymond Hettinger
3cfe5b7b8f
Simplify creation of the __new__ method in namedtuple() (GH-20361)
2020-05-25 21:39:00 -07:00
Raymond Hettinger
4cc4d6048e
Expand the implementation comments (GH-19699)
2020-04-24 02:33:07 -07:00
sweeneyde
a81849b031
bpo-39939: Add str.removeprefix and str.removesuffix (GH-18939)
...
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.
2020-04-22 23:05:48 +02:00
Curtis Bucher
f393b2c588
bpo-36144: Add PEP 584 operators to collections.ChainMap ( #18832 )
...
* 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>
2020-03-23 12:02:05 -07:00
Brandt Bucher
6d674a1bf4
bpo-36144: OrderedDict Union (PEP 584) ( #18967 )
2020-03-13 09:06:04 -07:00
Brandt Bucher
eb8ac57af2
bpo-36144: Dictionary Union (PEP 584) ( #12088 )
2020-02-24 19:47:34 -08:00
Victor Stinner
af5ee3ff61
bpo-39674: Revert "bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596)" (GH-18545)
...
This reverts commit ef092fe990
.
Update collections __getattr__() and documentation to defer aliases
removal to Python 3.10.
2020-02-18 16:28:53 +01:00
Raymond Hettinger
58ccd201fa
bpo-36321: Fix misspelled attribute name in namedtuple() (GH-16858)
2019-10-20 10:19:47 -07:00
Serhiy Storchaka
ef092fe990
bpo-25988: Do not expose abstract collection classes in the collections module. (GH-10596)
2019-10-07 12:10:15 +03:00
Daniel Fortunov
2a16eea71f
bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138)
2019-08-27 21:38:09 -07:00
Florian Bruhin
c4106af38b
Add missing space to warning message (GH-14915)
...
This typo was introduced in GH-13409 when changing the message text.
2019-08-21 23:06:51 -07:00
Min ho Kim
96e12d5f4f
Fix typos in docs, comments and test assert messages ( #14872 )
2019-07-21 16:12:33 -04:00
Serhiy Storchaka
142566c028
[3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)
...
Turn deprecation warnings added in 3.8 into TypeError.
2019-06-05 18:22:31 +03:00
Serhiy Storchaka
2085bd0877
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)
2019-06-01 11:00:15 +03:00
Matthias Bussonnier
eea47e0939
bpo-36953: Delay removal of ABCs from collections. (GH-13409)
...
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
2019-05-30 14:45:48 -07:00
Batuhan Taşkaya
7abf8c6081
bpo-25652: Fix __rmod__ of UserString (GH-13326)
...
The ``__rmod__`` method of ``collections.UserString`` class had a bug that made it unusable.
https://bugs.python.org/issue25652
2019-05-21 13:27:36 -07:00
Bar Harel
f4e1babf44
bpo-27141: Fix collections.UserList and UserDict shallow copy. (GH-4094)
2019-05-19 16:57:13 +03:00
Michael Blahay
b1c3167c23
bpo-27639: Correct return type for UserList slicing operation ( #13169 )
...
* 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.
2019-05-07 17:41:06 -04:00
Serhiy Storchaka
d53cf99dca
bpo-36542: Allow to overwrite the signature for Python functions. (GH-12705)
2019-05-06 22:40:27 +03:00
Slam
76b387bf74
Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) instead of len() (GH-12139)
...
Semantically the same, but more idiomatic by checking against `kwargs` instead of `len(kwargs)`.
2019-04-02 14:47:41 -07:00
Raymond Hettinger
23581c018f
bpo-36321: Fix misspelled attribute in namedtuple() (GH-12375)
2019-03-18 00:27:39 -07:00
Raymond Hettinger
407c734326
bpo-36057 Update docs and tests for ordering in collections.Counter [no behavior change] ( #11962 )
...
* Add tests for Counter order. No behavior change.
* Update docs and tests
* Fix doctest output and capitalization
2019-02-21 09:19:00 -08:00
Raymond Hettinger
64360ada0f
Complete and neaten-up namedtuple's replacement of builtin function lookups with derefs (GH-11794)
2019-02-08 10:37:39 -08:00