Commit Graph

18 Commits

Author SHA1 Message Date
Utkarsh Gupta
6d8e610d75 itertools.pyi: Replace Iterable with Iterator. (#2943)
Fixes #2931
2019-04-30 14:53:59 -07:00
Sebastian Rittau
0989d9507e Fix groupby with key=None (#2794)
Cf #2790
2019-02-13 08:45:24 -08:00
Alun Champion
9b545a01ab Added Optional[] around the itertools.groupby() key attribute to allow None to pass the type (#2790)
Fixes #2788
2019-02-12 11:59:37 +01:00
Tomer Keren
be99a2a5f0 Use a more accurate type for predicates in itertools (#2732)
The only constraint on the return value of a predicate is to be "boolable".
Because `bool` recives an object in the constructor https://github.com/python/typeshed/blob/master/stdlib/2and3/builtins.pyi#L803 this is a more accurate description of a predicate.
2019-01-10 11:30:28 -08:00
Utkarsh Gupta
9f9d15e311 itertools.pyi: Allow omitting repeat argument in Python 3 (#2659)
Fixes #2561
2018-11-30 15:58:21 -08:00
Jelle Zijlstra
d2469c0e89 fix type for itertools.product (#2129)
Fixes #1850.

The fix was already applied to Python 2, but the typevar-based solution there
leads to "cannot infer value of type variable" in mypy. I used the following
script to check:

```python
from itertools import product

reveal_type(product([1]))
reveal_type(product([1], ['x'], [False], [3.0], [(1,)], [('x',)], [{1}], [{1: 2}], repeat=5))
```
2018-06-11 15:52:44 -07:00
Zac Hatfield-Dodds
d5929ada4d itertools.islice allows step=None (#2142) 2018-05-17 09:35:02 -04:00
Svend Sorensen
6c1dffed58 Make islice start and stop parameters optional (#2031)
From the documentation [1]: "If start is None, then iteration starts at zero."

[1] https://docs.python.org/3/library/itertools.html#itertools.islice.

PR #1603 made this change for Python 2.
2018-04-10 20:55:06 -07:00
hashstat
97b16a0b34 itertools.count() can take floats as well as ints (#1650) 2017-10-07 08:30:07 -07:00
Matthias Kramm
ed6dc176da make itertools.product more precise (#1393) 2017-06-12 20:10:08 -07:00
Matthias Kramm
8d8a34cb83 Patch from @sfreilich: make itertools.ifilter predicate parameter Optional (#1257)
From Samuel Freilich:
In Python 2, the predicate parameter in itertools.ifilter and
itertools.ifilterfalse can be None, indicating that true or false values
should be retained (functionally equivalent to passing "bool" as the
predicate). In Python 3, filter and itertools.filterfalse have
the same behavior.
2017-05-09 17:50:11 -07:00
Manuel Krebber
2d96eecd30 Itertools update (#1233)
* Updated the typehints for itertools.

* Removed the overload because it caused problems and cleaned up the imports.

* Update itertools.pyi

Added back optionality of second argument for itertools.permutations.

* Update itertools.pyi

Moved the Optional which I accidentially put on the wrong function -.-
2017-05-03 08:53:48 -07:00
syrrim
9625cc738f Update accumulate signature to account for optional function arg (#896)
See https://docs.python.org/3/library/itertools.html#itertools.accumulate
2017-01-30 13:22:06 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Yegor Roganov
2d8ff30e7a Improve itertools.islice type (#610)
`stop` parameter to `islice` can be `None`,
which is important when checking with --strict-optional
2016-10-15 14:14:36 -07:00
Guido van Rossum
dca8eeb1fe Ouch. The itertools.chain situation is slightly more complicated. 2016-04-07 15:34:45 -07:00
Guido van Rossum
17e74036f5 Implement itertools.chain.from_iterable(). 2016-04-07 14:48:38 -07:00
Guido van Rossum
8c2118bace Move contents of builtins/* to stdlib/*. This simplifies finding stubs. 2016-01-12 12:53:18 -08:00