6aa5cc691c
Add _collections_abc module ( #4000 )
...
* Add _collections_abc module
* Rearrange collections.abc and collections to re-export from _collections_abc
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2021-01-23 16:17:57 +01:00
Wolf Honore and GitHub
b85f46eb07
Fix (start/end)swith arguments ( #4949 )
2021-01-23 15:06:06 +01:00
Lourens Veen and GitHub
ee69dd4de7
Fix collections.Userstring.encode() ( #4787 )
...
* Revert Python 2 part of ba223399 , the stub was correct
* Describe UserString.encode() return type correctly for Python <3.8
2020-11-24 17:27:29 -08:00
Nate McMaster and GitHub
62546ed827
Add annotation for collections.ChainMap.__missing__(key) ( #4784 )
...
This method has been present in the CPython implementation since its introduction in 3.3.
https://github.com/python/cpython/blob/v3.3.0/Lib/collections/__init__.py\#L783
2020-11-23 08:32:22 +01:00
Lourens Veen and GitHub
ba223399a6
collections.UserString.encode() returns bytes ( #4781 )
2020-11-20 13:14:13 -08:00
Sebastian Rittau and GitHub
d2a7889fe0
Drop support for Python 3.5 ( #4675 )
...
Python 3.5 EOL was on 2020-09-30.
2020-11-02 16:18:20 +01:00
6ff5b88ca7
typeshed: remove crufty comments ( #4699 )
...
Co-authored-by: hauntsaninja <>
2020-10-23 09:40:06 +02:00
faf827bc36
mark some positional-only arguments ( #4693 )
...
https://github.com/python/mypy/pull/9626 will make stubtest a little bit
stricter about positional-only arguments for dunders like __init__
Co-authored-by: hauntsaninja <>
2020-10-22 13:31:23 +02:00
7e378a7554
PEP 584: add or operators to dict ( #4671 )
...
Co-authored-by: hauntsaninja <>
2020-10-15 13:42:01 +02:00
e3889c776e
pep 484: explicit reexport as intended ( #4586 )
...
See discussion on typing-sig.
This doesn't take care of some third_party libraries, will follow up on
those.
Co-authored-by: hauntsaninja <>
2020-09-30 10:04:23 -07:00
Jelle Zijlstra and GitHub
5f9fd3d127
upgrade black version ( #4486 )
...
Manually removed a number of trailing commas to prevent black from unnecessarily
exploding some collections.
2020-08-26 18:36:01 +02:00
04c74640f0
Removed imported symbols that are not accessed or re-exported ( #4387 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com >
2020-08-05 22:49:17 -07:00
Adam Hitchcock and GitHub
3b6925b955
mark deque.rotate arg as having a default ( #4386 )
2020-08-05 17:35:22 -07:00
Sebastian Rittau and GitHub
36356b3368
Remove argument from deque.pop() ( #4367 )
...
Closes : #4364
2020-07-27 06:49:56 -07:00
Sebastian Rittau and GitHub
5e76f51930
Upgrade to isort 5 ( #4323 )
...
This now also reformats imports not at the top of files.
2020-07-16 07:01:57 -07:00
Jelle Zijlstra and GitHub
5d553c9584
apply black and isort ( #4287 )
...
* apply black and isort
* move some type ignores
2020-06-28 13:31:00 -07:00
Shantanu and GitHub
fd203e663e
py39: add PEP 616 methods ( #4090 )
2020-05-27 19:24:25 -07:00
Shantanu and GitHub
1ca071a732
collections.Counter: fix default values, allow passing None ( #3699 )
2020-02-01 09:25:03 -08:00
Sebastian Rittau and GitHub
de26a3d109
Remove raise statements from function bodies ( #3355 )
...
While it may eventually be useful to mark the exceptions that can be
raised from a function or method, the semantics are currently undefined
and unclear.
2019-10-13 21:51:43 +02:00
Sebastian Rittau and Jelle Zijlstra
c32e1e2280
Enable --disallow-any-generics for stubs ( #3288 )
2019-10-01 05:31:34 -07:00
Sebastian Rittau and GitHub
9ccf9356bf
Remove Python 3.4 support ( #3147 )
...
Closes #3123
2019-07-27 10:58:21 +02:00
Michael Lee and Sebastian Rittau
efb67946f8
Use variable annotations everywhere ( #2909 )
2019-04-13 10:40:52 +02:00
Joel Rosdahl and Sebastian Rittau
3eb66ba633
Add type annotation for collections.deque.__iadd__ ( #2774 )
...
* Add type annotation for collections.deque.__iadd__
Fixes #2771 .
2019-02-01 19:39:09 +01:00
MatthewPScott81 and Sebastian Rittau
744f572c68
deque init() optional maxlen ( #2585 )
...
Closes #2581
2018-11-04 23:06:47 +01:00
Lourens Veen and Sebastian Rittau
703c03e4b0
Add UserString and UserList data attribute ( #2518 )
2018-10-16 10:36:17 +02:00
Michael R. Crusoe and Jelle Zijlstra
2e0af18dda
slices of MutableSequences are also MutableSequences ( #2428 )
2018-09-25 13:06:59 -07:00
Jelle Zijlstra and Ivan Levkivskyi
9e023e7586
minor namedtuple fixes ( #2227 )
...
- The extra arguments aren't keyword-only in 2.7.
- Added the `defaults` argument in 3.7 (https://docs.python.org/3.7/library/collections.html#collections.namedtuple ).
2018-08-19 03:47:10 +01:00
Matt Gilson and Jelle Zijlstra
ebea29a0ed
Make defaultdict.default_factory Optional. ( #2401 )
...
The API allows for setting this to `None`. It makes the defaultdict behave more like a regular dict.
Fixes #2375 .
2018-08-18 19:22:15 -07:00
Sebastian Rittau and Jelle Zijlstra
95eff73ab2
Drop Python 3.3 support from several stubs ( #2265 )
...
* Drop Python 3.3 support from several stubs
* Revert wrong socketserver changes
2018-06-20 16:49:47 -07:00
Jelle Zijlstra and GitHub
94ab32ba59
Fix abstract classes for Python 3 ( #2239 )
...
* add metaclass=ABCMeta to some classes
* mark some more classes as explicitly abstract
* make some more classes concrete
2018-06-16 10:18:54 -07:00
Hanaasagi and Jelle Zijlstra
7faa41984b
Closes python/mypy/#5141 ( #2191 )
2018-06-03 21:52:19 -07:00
Jelle Zijlstra and Matthias Kramm
c7e3e9890d
add UserDict.__init__ for Python 3 ( #2083 )
...
Fixes #2075
2018-04-27 14:38:00 -07:00
Martijn Pieters and Jelle Zijlstra
ecae01a37d
collections.OrderedDict dict views are reversible ( #2079 )
...
Add the *View subclasses for OrderedDict use, with appropriate __reversed__
hints.
Fixes python/typeshed#2078
2018-04-25 19:44:25 -07:00
Jelle Zijlstra and Guido van Rossum
54ecefef04
removals in Python 3.7 ( #2018 )
...
Last part of #1965 .
2018-04-06 11:11:29 -07:00
Jelle Zijlstra and GitHub
103056eecf
fix some TODOs ( #1994 )
...
- Made deque.maxlen read-only
- We don't support 3.2, so we don't care about signature changes in it
- There don't seem to be any missing set operations (I compared the dir() of this class to that of builtins.set)
2018-03-28 18:40:13 -07:00
z33ky and Jelle Zijlstra
c2c48424da
Add missing collections.defaultdict.__init__ overloads ( #1957 ) ( #1958 )
2018-03-17 08:22:11 -07:00
Jelle Zijlstra and GitHub
35d3effe03
Remove version check for deque.insert and deque.index ( #1916 )
...
Otherwise, deque is not instantiable in Python 3.4. We could do a dynamic base class instead
but that doesn't seem worth it.
2018-02-24 11:12:56 -08:00
Rhys Parry and Guido van Rossum
6b82088e20
Add UserDict attribute data for Python 3 ( #1863 )
2018-02-09 07:55:58 -08:00
Chad Dombrova and Ivan Levkivskyi
ed9d08e93b
Collections that inherit from dict should should override copy() ( #1856 )
...
Solves issue #1642 . A previous attempt at this, #1656 ,
added __copy__ but omitted copy, and it did not properly use self-type.
2018-02-09 00:26:37 +00:00
FichteFoll and Jelle Zijlstra
f933b9384c
Refine str.maketrans and str.translate ( #1613 )
...
str.translate requires a Mapping or Sequence (in essence, anything
with __getitem__), not a Dict.
str.maketrans in the one-argument form only converts character string
keys to their unicode ordinal, leaving any of the values untouched.
This mapping may use both integers or strings as keys at the same time.
str.maketrans in the multi-argument form returns a dict with any of the
values str, int or None, as recognized by str.translate.
2017-11-07 18:55:05 -08:00
Martin DeMello and Matthias Kramm
817c270c32
Clean out the pytype blacklist ( #1667 )
2017-10-24 10:38:34 -07:00
Suren Nihalani and Jelle Zijlstra
898299969c
typeshed: declare that ordereddict's copy returns ordereddict ( #1656 )
2017-10-08 21:15:11 -07:00
Jelle Zijlstra and Matthias Kramm
2d97894fa9
collections: make UserDict, UserList, and UserString concrete ( #1477 )
...
* collections: make UserDict, UserList, and UserString concrete
* add version checks
https://github.com/python/cpython/commit/573b44c18f69307d7dbc95c950aab57ef7ea303e
* remove redundant methods
2017-07-26 16:34:43 -07:00
Jelle Zijlstra and Łukasz Langa
be7490322b
Counter: fix return value of most_common() ( #1491 )
...
https://docs.python.org/3/library/collections.html#collections.Counter.most_common
https://docs.python.org/2/library/collections.html#collections.Counter.most_common
2017-07-19 20:29:32 +03:00
Semyon Proshev and Jelle Zijlstra
5db571a8f3
Update typing.MutableMapping.update stubs to allow keyword-only arguments ( #1370 )
2017-05-30 21:44:10 -07:00
Semyon Proshev and Jelle Zijlstra
f9872cafd8
Update collections and typing.NamedTuple ( #1276 )
...
* Update stubs for `collections` module in both Pythons.
* Update `typing.NamedTuple` stub to have `_source` attribute.
* Fix compatibility of `deque.index` signature with supertype `Sequence`
2017-05-27 15:01:40 -07:00
Jelle Zijlstra and Matthias Kramm
72a745b2f8
remove collections.MutableString ( #1356 )
...
It does not exist (some StackOverflow question I found suggests it was removed in 2.6).
2017-05-25 19:36:08 -07:00
Jelle Zijlstra and Guido van Rossum
b084bcd037
review exported names in collections stubs ( #1197 )
...
Fixes #709
I looked at dir(collections) in 2.7 and 3.6 and made sure the list of names matched the stubs.
2017-04-30 09:59:37 -07:00
Sam Dunster and Jelle Zijlstra
6582a8fb59
Add collections.abc.Collection ( #1177 )
2017-04-18 21:08:06 -07:00
David Euresti and Łukasz Langa
d43f3be914
Unify stdlib/{2,3}/typing.pyi
...
Also fix signature of IO.seek, IO.truncate, IO.write, and MutableMapping.update
Fixes #1016
Note: I couldn't put typing.pyi in 2and3 because of an import cycle when adding `import sys` to 2/typing.pyi
2017-03-19 09:43:40 -07:00