Shantanu
1ca071a732
collections.Counter: fix default values, allow passing None ( #3699 )
2020-02-01 09:25:03 -08:00
Sebastian Rittau
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
c32e1e2280
Enable --disallow-any-generics for stubs ( #3288 )
2019-10-01 05:31:34 -07:00
Sebastian Rittau
9ccf9356bf
Remove Python 3.4 support ( #3147 )
...
Closes #3123
2019-07-27 10:58:21 +02:00
Michael Lee
efb67946f8
Use variable annotations everywhere ( #2909 )
2019-04-13 10:40:52 +02:00
Joel Rosdahl
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
744f572c68
deque init() optional maxlen ( #2585 )
...
Closes #2581
2018-11-04 23:06:47 +01:00
Lourens Veen
703c03e4b0
Add UserString and UserList data attribute ( #2518 )
2018-10-16 10:36:17 +02:00
Michael R. Crusoe
2e0af18dda
slices of MutableSequences are also MutableSequences ( #2428 )
2018-09-25 13:06:59 -07:00
Jelle Zijlstra
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
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
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
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
7faa41984b
Closes python/mypy/#5141 ( #2191 )
2018-06-03 21:52:19 -07:00
Jelle Zijlstra
c7e3e9890d
add UserDict.__init__ for Python 3 ( #2083 )
...
Fixes #2075
2018-04-27 14:38:00 -07:00
Martijn Pieters
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
54ecefef04
removals in Python 3.7 ( #2018 )
...
Last part of #1965 .
2018-04-06 11:11:29 -07:00
Jelle Zijlstra
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
c2c48424da
Add missing collections.defaultdict.__init__ overloads ( #1957 ) ( #1958 )
2018-03-17 08:22:11 -07:00
Jelle Zijlstra
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
6b82088e20
Add UserDict attribute data for Python 3 ( #1863 )
2018-02-09 07:55:58 -08:00
Chad Dombrova
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
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
817c270c32
Clean out the pytype blacklist ( #1667 )
2017-10-24 10:38:34 -07:00
Suren Nihalani
898299969c
typeshed: declare that ordereddict's copy returns ordereddict ( #1656 )
2017-10-08 21:15:11 -07:00
Jelle Zijlstra
2d97894fa9
collections: make UserDict, UserList, and UserString concrete ( #1477 )
...
* collections: make UserDict, UserList, and UserString concrete
* add version checks
573b44c18f
* remove redundant methods
2017-07-26 16:34:43 -07:00
Jelle Zijlstra
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
5db571a8f3
Update typing.MutableMapping.update stubs to allow keyword-only arguments ( #1370 )
2017-05-30 21:44:10 -07:00
Semyon Proshev
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
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
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
6582a8fb59
Add collections.abc.Collection ( #1177 )
2017-04-18 21:08:06 -07:00
David Euresti
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
Ivan Levkivskyi
b430318ac0
Fix non-subscriptable type aliases ( #993 )
2017-03-13 17:24:34 -07:00
Jelle Zijlstra
e80b25d1be
allow instantiating ChainMap ( #929 )
...
A previous PR led mypy to refuse to instantiate ChainMap,
because it had unimplemented abstract methods.
This PR adds the abstract methods to the stub,
which is enough to persuade mypy to allow instantiating
ChainMap.
2017-02-11 10:10:13 -08:00
Mike Patek
c760a4e949
Make OrderedDict inherit from Reversible ( #912 )
...
Fixes #904
2017-02-01 09:23:43 -08:00
Jelle Zijlstra
6e84021f56
ChainMap fixes ( #878 )
...
- It didn't exist before 3.3 (https://docs.python.org/3/library/collections.html#chainmap-objects )
- It's not a subclass of dict
2017-01-29 20:29:29 -08:00
Jelle Zijlstra
df9d11bf71
add AsyncGenerator to typing.pyi, collections/abc.pyi and collections/__init__.pyi ( #815 )
...
This parallels https://github.com/python/typing/pull/346
2017-01-18 13:24:28 -08:00
Luiz
d17f7236a1
Add missing imports from collections.abc ( #818 )
...
Fixes #817
2017-01-09 17:13:27 -08:00
Lukasz Langa
fe0e3744cc
Fixing flake8 E261 errors
2016-12-19 22:09:35 -08:00
Hong Minhee
5fc1b4b948
Add missing MutableSet abstract base class ( #680 )
2016-11-10 14:10:10 -08:00
Hong Minhee
13b1cdc834
Stubs for collections.abc ( #671 )
...
The ABC types were moved to collections.abc in 3.3 (but still exist in collections too).
2016-11-08 21:37:33 -08:00
Roy Williams
1b30761802
Small changes by @rowilla to collections.pyi and urllib/requests.pyi.
...
(Extracted from PR #530.)
2016-11-08 19:40:10 -08:00
Reiner Gerecke
5624e7fd4b
Add collections.Container to Python 2/3 ( #608 )
2016-10-15 08:16:02 -07:00
Manuel Krebber
aa549db5e5
Added missing operations to collections.Counter stub. ( #575 )
2016-09-27 10:07:57 -07:00
Elazar
e25b882041
Full signature for namedtuple ( #541 )
2016-09-13 16:17:26 -07:00
Tomasz Elendt
34175b888d
Fix __setitem__(slice, ...) of various mutable sequences ( #496 )
...
Adds support of assigning iterables to slice of mutable sequences and
bytes to bytearray's slice.
2016-08-23 19:02:50 -07:00
speezepearson
e815c803a6
add ChainMap class to collections module ( #361 )
...
* add ChainMap class to collections module
* ...and add it for Python 2 as well.
2016-07-13 06:16:37 -07:00
Alvaro Caceres
d0ac66f5f8
Use "..." for attribute values, instead of None, [], {}
2016-06-15 14:10:04 -05:00
rwbarton
2b80cdf75e
Use overloading rather than Union for MutableMapping.update ( #174 )
...
See https://github.com/python/mypy/issues/1430 for motivation.
2016-05-01 17:50:01 +01:00