Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring updates: fix zip_longest -> enumerate #31

Merged
merged 3 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<p>

<a href="https://github.com/olirice/flupy/actions"><img src="https://github.com/olirice/flupy/workflows/Tests/badge.svg" alt="Tests" height="18"></a>
<a href="https://flupy.readthedocs.io/en/latest/?badge=latest"><img src="https://readthedocs.org/projects/flupy/badge/?version=latest" alt="Tests" height="18"></a>
<a href="https://codecov.io/gh/olirice/flupy"><img src="https://codecov.io/gh/olirice/flupy/branch/master/graph/badge.svg" height="18"></a>
<a href="https://github.com/psf/black">
Expand Down
14 changes: 5 additions & 9 deletions src/flupy/fluent.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
from itertools import dropwhile, groupby, islice, product, takewhile, tee, zip_longest
from random import sample
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Container,
ContextManager,
Deque,
Generator,
Generic,
Expand All @@ -20,7 +17,6 @@
Iterator,
List,
Optional,
Sequence,
Set,
Tuple,
Type,
Expand Down Expand Up @@ -546,7 +542,7 @@ def zip(
"Fluent[Tuple[T, _T1, _T2, _T3]]",
]:
"""Yields tuples containing the i-th element from the i-th
argument in the chainable, and the iterable
argument in the instance, and the iterable

>>> flu(range(5)).zip(range(3, 0, -1)).to_list()
[(0, 3), (1, 2), (2, 1)]
Expand All @@ -558,7 +554,7 @@ def zip(

def zip_longest(self, *iterable: Iterable[_T1], fill_value: Any = None) -> "Fluent[Tuple[T, ...]]":
"""Yields tuples containing the i-th element from the i-th
argument in the chainable, and the iterable
argument in the instance, and the iterable
Iteration continues until the longest iterable is exhaused.
If iterables are uneven in length, missing values are filled in with fill value

Expand All @@ -572,11 +568,11 @@ def zip_longest(self, *iterable: Iterable[_T1], fill_value: Any = None) -> "Flue
return Fluent(zip_longest(self, *iterable, fillvalue=fill_value))

def enumerate(self, start: int = 0) -> "Fluent[Tuple[int, T]]":
"""Yields tuples from the chainable where the first element
"""Yields tuples from the instance where the first element
is a count from initial value *start*.

>>> flu(range(5)).zip_longest(range(3, 0, -1)).to_list()
[(0, 3), (1, 2), (2, 1), (3, None), (4, None)]
>>> flu([3,4,5]).enumerate().to_list()
[(0, 3), (1, 4), (2, 5)]
"""
return Fluent(enumerate(self, start=start))

Expand Down