Commit Graph

30 Commits

Author SHA1 Message Date
Mark 39008d51c1 Make itertools.cycle a type (#3732) 2020-02-09 13:34:41 +01:00
Naman 9379cedfa7 remove itertools.accumulate from Python 2 stubs (#3135) 2019-07-19 22:31:32 -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
Sebastian Rittau 006a79220f Flake8 fixes (#2549)
* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
2018-10-24 07:20:53 -07: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
rchen152 29acda6431 Add itertools.imap signatures for more than two iterables. (#1815) 2018-01-04 19:03:41 -08:00
David Novakovic b4e89a078c Second param of islice allows None. (#1603) 2017-09-20 14:55:16 -07:00
rchen152 8d5a233c6b Fix the definition of itertools.tee() (#1584) 2017-09-05 16:21:14 -07:00
Matthias Kramm 5d1aacfed3 special-case overload for itertools.product with 'repeat' (#1410)
Add an additional overload for the `repeat = n` case. Since we don't know 
the numeric value of `repeat`, this just produces an iterator over an 
arbitrary-length tuple.
2017-06-15 19:13:46 +01:00
Guido van Rossum 4fbdcf5b03 Revert "add back 'repeat' argument to itertools.product (#1407)" (#1409)
This reverts commit d5e7663f93.
2017-06-14 13:10:29 -07:00
Matthias Kramm d5e7663f93 add back 'repeat' argument to itertools.product (#1407)
Fixes a regression introduced by #1393.
2017-06-14 09:33:37 -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
Semyon Proshev df4c5c81e8 Add n-ary stub for itertools.izip (#1071) 2017-03-22 07:35:21 -07:00
Günther Noack b621b2f5ff Remove fallback again 2017-03-20 21:38:16 +01:00
Günther Noack 4149a2637b Update itertools.pyi 2017-03-20 21:30:33 +01:00
Günther Noack 4e62b05e7d Update itertools.pyi 2017-03-20 21:12:02 +01:00
Günther Noack 4152283115 Update itertools.pyi 2017-03-20 21:02:08 +01:00
Günther Noack cd949ba284 Fix fallback. 2017-03-20 20:45:34 +01:00
Günther Noack 62efd05201 Add support for 6-ary izip and generic n-ary case
Using izip with up to 6 arguments will retain the arguments' type information,
using izip with 7 and more arguments will discard type information about the
generated tuple items.
2017-03-20 20:36:50 +01:00
Günther Noack 014a23ae06 Define _T5 2017-03-20 17:29:39 +01:00
Günther Noack 8e0d38fd77 Update itertools.pyi 2017-03-20 17:16:26 +01:00
Günther Noack 536d192897 Update itertools.pyi 2017-03-20 16:56:55 +01:00
Günther Noack 42f37c0f04 5-ary izip 2017-03-20 15:17:39 +01:00
rchen152 f34c550f04 Correct some return types in itertools.pyi from Iterable to Iterator. (#947)
* Fix a few return types in stdlib/2/inspect.pyi.

* Rename _FrameRecord to _FrameInfo

* Correct some return types in itertools.pyi from Iterable to Iterator.
2017-03-07 06:42:50 -08:00
Lukasz Langa fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Guido van Rossum cb97bb54c0 Move 2.7 to 2 (#635)
Closes #579.
2016-10-26 16:24:49 -07:00