pythonic-fp.iterables 5.2.0__tar.gz → 6.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/PKG-INFO +9 -9
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/README.md +3 -3
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/pyproject.toml +21 -7
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/drop_take.py +2 -0
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/folding.py +11 -7
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/merging.py +4 -4
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/LICENSE +0 -0
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/__init__.py +0 -0
- {pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/py.typed +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonic-fp-iterables
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.0
|
|
4
4
|
Summary: Composing and iterating iterables.
|
|
5
5
|
Keywords: iterables,iterators
|
|
6
6
|
Author-email: "Geoffrey R. Scheller" <geoffrey@scheller.com>
|
|
7
7
|
Requires-Python: >=3.14
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
|
-
Classifier: Development Status ::
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Framework :: Pytest
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -15,11 +15,11 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.15
|
|
16
16
|
Classifier: Typing :: Typed
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: pythonic-fp-fptools>=6
|
|
19
|
-
Requires-Dist: pythonic-fp-gadgets>=
|
|
18
|
+
Requires-Dist: pythonic-fp-fptools>=6.2,<7
|
|
19
|
+
Requires-Dist: pythonic-fp-gadgets>=6,<7
|
|
20
20
|
Project-URL: Changelog, https://github.com/grscheller/pythonic-fp-iterables/blob/main/CHANGELOG.md
|
|
21
|
-
Project-URL: Documentation, https://grscheller.github.io/pythonic-fp-iterables
|
|
22
|
-
Project-URL: Homepage, https://grscheller.github.io/pythonic-fp
|
|
21
|
+
Project-URL: Documentation, https://grscheller.github.io/pythonic-fp-iterables
|
|
22
|
+
Project-URL: Homepage, https://grscheller.github.io/pythonic-fp
|
|
23
23
|
Project-URL: Source, https://github.com/grscheller/pythonic-fp-iterables
|
|
24
24
|
|
|
25
25
|
# Pythonic FP - Tools for iterables
|
|
@@ -29,13 +29,13 @@ Library of functions for iterating iterables.
|
|
|
29
29
|
PyPI project
|
|
30
30
|
[pythonic-fp-iterators](https://pypi.org/project/pythonic-fp-iterables).
|
|
31
31
|
Part of the
|
|
32
|
-
[pythonic-fp](https://grscheller.github.io/pythonic-fp
|
|
32
|
+
[pythonic-fp](https://grscheller.github.io/pythonic-fp)
|
|
33
33
|
PyPI projects.
|
|
34
34
|
|
|
35
35
|
## Documentation
|
|
36
36
|
|
|
37
37
|
Documentation and other links for this project are hosted on
|
|
38
|
-
[GitHub Pages](https://grscheller.github.io/pythonic-fp
|
|
38
|
+
[GitHub Pages](https://grscheller.github.io/pythonic-fp-iterables).
|
|
39
39
|
|
|
40
40
|
- Concatenating and merging iterables
|
|
41
41
|
- Dropping and taking values from iterables
|
|
@@ -44,7 +44,7 @@ Documentation and other links for this project are hosted on
|
|
|
44
44
|
- iterables are not necessarily iterators
|
|
45
45
|
- at all times iterator protocol is assumed to be followed
|
|
46
46
|
- all iterators are assumed to be iterable
|
|
47
|
-
- for all iterators
|
|
47
|
+
- for all iterators `foo` we assume `iter(foo)` is `foo`
|
|
48
48
|
|
|
49
49
|
## Copyright and License
|
|
50
50
|
|
|
@@ -5,13 +5,13 @@ Library of functions for iterating iterables.
|
|
|
5
5
|
PyPI project
|
|
6
6
|
[pythonic-fp-iterators](https://pypi.org/project/pythonic-fp-iterables).
|
|
7
7
|
Part of the
|
|
8
|
-
[pythonic-fp](https://grscheller.github.io/pythonic-fp
|
|
8
|
+
[pythonic-fp](https://grscheller.github.io/pythonic-fp)
|
|
9
9
|
PyPI projects.
|
|
10
10
|
|
|
11
11
|
## Documentation
|
|
12
12
|
|
|
13
13
|
Documentation and other links for this project are hosted on
|
|
14
|
-
[GitHub Pages](https://grscheller.github.io/pythonic-fp
|
|
14
|
+
[GitHub Pages](https://grscheller.github.io/pythonic-fp-iterables).
|
|
15
15
|
|
|
16
16
|
- Concatenating and merging iterables
|
|
17
17
|
- Dropping and taking values from iterables
|
|
@@ -20,7 +20,7 @@ Documentation and other links for this project are hosted on
|
|
|
20
20
|
- iterables are not necessarily iterators
|
|
21
21
|
- at all times iterator protocol is assumed to be followed
|
|
22
22
|
- all iterators are assumed to be iterable
|
|
23
|
-
- for all iterators
|
|
23
|
+
- for all iterators `foo` we assume `iter(foo)` is `foo`
|
|
24
24
|
|
|
25
25
|
## Copyright and License
|
|
26
26
|
|
|
@@ -4,10 +4,10 @@ build-backend = "flit_core.buildapi"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pythonic-fp-iterables"
|
|
7
|
-
version = "
|
|
7
|
+
version = "6.0.0"
|
|
8
8
|
description = "Composing and iterating iterables."
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.14" # floor: PEP 649/749 deferred annotations — class-level self-reference
|
|
10
|
+
requires-python = ">=3.14" # floor: PEP 649/749 deferred annotations — class-level self-reference NameErrors on <3.14
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "Geoffrey R. Scheller", email = "geoffrey@scheller.com" },
|
|
13
13
|
]
|
|
@@ -16,7 +16,7 @@ keywords = [
|
|
|
16
16
|
"iterators",
|
|
17
17
|
]
|
|
18
18
|
classifiers = [
|
|
19
|
-
"Development Status ::
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
20
|
"Framework :: Pytest",
|
|
21
21
|
"Intended Audience :: Developers",
|
|
22
22
|
"License :: OSI Approved :: Apache Software License",
|
|
@@ -26,14 +26,14 @@ classifiers = [
|
|
|
26
26
|
"Typing :: Typed",
|
|
27
27
|
]
|
|
28
28
|
dependencies = [
|
|
29
|
-
"pythonic-fp-fptools>=6
|
|
30
|
-
"pythonic-fp-gadgets>=
|
|
29
|
+
"pythonic-fp-fptools>=6.2,<7",
|
|
30
|
+
"pythonic-fp-gadgets>=6,<7",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
[project.urls]
|
|
34
34
|
Changelog = "https://github.com/grscheller/pythonic-fp-iterables/blob/main/CHANGELOG.md"
|
|
35
|
-
Documentation ="https://grscheller.github.io/pythonic-fp-iterables
|
|
36
|
-
Homepage = "https://grscheller.github.io/pythonic-fp
|
|
35
|
+
Documentation ="https://grscheller.github.io/pythonic-fp-iterables"
|
|
36
|
+
Homepage = "https://grscheller.github.io/pythonic-fp"
|
|
37
37
|
Source = "https://github.com/grscheller/pythonic-fp-iterables"
|
|
38
38
|
|
|
39
39
|
[dependency-groups]
|
|
@@ -52,6 +52,11 @@ name = "pythonic_fp.iterables"
|
|
|
52
52
|
exclude = [
|
|
53
53
|
"docs/",
|
|
54
54
|
"tests/",
|
|
55
|
+
"**/.mypy_cache/",
|
|
56
|
+
"**/.ruff_cache/",
|
|
57
|
+
"**/.pytest_cache/",
|
|
58
|
+
"**/__pycache__/",
|
|
59
|
+
"**/.dmypy.json",
|
|
55
60
|
]
|
|
56
61
|
|
|
57
62
|
[tool.pytest]
|
|
@@ -63,10 +68,15 @@ testpaths = ["tests/"]
|
|
|
63
68
|
explicit_package_bases = true
|
|
64
69
|
local_partial_types = true
|
|
65
70
|
namespace_packages = true
|
|
71
|
+
strict = true
|
|
66
72
|
warn_redundant_casts = true
|
|
67
73
|
warn_return_any = true
|
|
68
74
|
warn_unused_configs = true
|
|
69
75
|
|
|
76
|
+
[[tool.mypy.overrides]]
|
|
77
|
+
module = ["tests.*"]
|
|
78
|
+
strict_equality = false
|
|
79
|
+
|
|
70
80
|
[tool.ruff]
|
|
71
81
|
target-version = "py314"
|
|
72
82
|
|
|
@@ -85,3 +95,7 @@ docstring-quotes = "double"
|
|
|
85
95
|
[tool.ruff.format]
|
|
86
96
|
quote-style = "single"
|
|
87
97
|
docstring-code-line-length = 72
|
|
98
|
+
|
|
99
|
+
[tool.uv.sources]
|
|
100
|
+
pythonic-fp-fptools = { path = "../pythonic-fp-fptools", editable = true }
|
|
101
|
+
pythonic-fp-gadgets = { path = "../pythonic-fp-gadgets", editable = true }
|
{pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/folding.py
RENAMED
|
@@ -20,10 +20,13 @@
|
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
from collections.abc import Callable, Iterable, Iterator
|
|
23
|
-
from typing import cast
|
|
23
|
+
from typing import cast
|
|
24
|
+
|
|
24
25
|
from pythonic_fp.fptools.function import negate, swap
|
|
25
26
|
from pythonic_fp.fptools.maybe import MayBe
|
|
27
|
+
from pythonic_fp.fptools.recoverable import RECOVERABLE
|
|
26
28
|
from pythonic_fp.gadgets.sentinels.novalue import NoValue
|
|
29
|
+
|
|
27
30
|
from .drop_take import drop_while, take_while_split
|
|
28
31
|
|
|
29
32
|
__all__ = [
|
|
@@ -34,10 +37,11 @@ __all__ = [
|
|
|
34
37
|
'sc_reduce_left',
|
|
35
38
|
'sc_reduce_right',
|
|
36
39
|
]
|
|
40
|
+
novalue = NoValue()
|
|
37
41
|
|
|
38
42
|
|
|
39
43
|
def accumulate[D, L](
|
|
40
|
-
iterable: Iterable[D], f: Callable[[L, D], L], initial: L | NoValue =
|
|
44
|
+
iterable: Iterable[D], f: Callable[[L, D], L], initial: L | NoValue = novalue
|
|
41
45
|
) -> Iterator[L]:
|
|
42
46
|
"""
|
|
43
47
|
.. admonition:: accumulate
|
|
@@ -83,7 +87,7 @@ def accumulate[D, L](
|
|
|
83
87
|
yield acc
|
|
84
88
|
|
|
85
89
|
|
|
86
|
-
def reduce_left[D](iterable: Iterable[D], f: Callable[[D, D], D]) -> D
|
|
90
|
+
def reduce_left[D](iterable: Iterable[D], f: Callable[[D, D], D]) -> D:
|
|
87
91
|
"""
|
|
88
92
|
.. admonition:: reduce left
|
|
89
93
|
|
|
@@ -117,7 +121,7 @@ def reduce_left[D](iterable: Iterable[D], f: Callable[[D, D], D]) -> D | Never:
|
|
|
117
121
|
|
|
118
122
|
def fold_left[D, L](
|
|
119
123
|
iterable: Iterable[D], f: Callable[[L, D], L], initial: L
|
|
120
|
-
) -> L
|
|
124
|
+
) -> L:
|
|
121
125
|
"""
|
|
122
126
|
.. admonition:: fold left
|
|
123
127
|
|
|
@@ -146,8 +150,8 @@ def fold_left[D, L](
|
|
|
146
150
|
|
|
147
151
|
|
|
148
152
|
def maybe_fold_left[D, L](
|
|
149
|
-
iterable: Iterable[D], f: Callable[[L, D], L], initial: L | NoValue =
|
|
150
|
-
) -> MayBe[L]
|
|
153
|
+
iterable: Iterable[D], f: Callable[[L, D], L], initial: L | NoValue = novalue
|
|
154
|
+
) -> MayBe[L]:
|
|
151
155
|
"""
|
|
152
156
|
.. admonition:: maybe fold left
|
|
153
157
|
|
|
@@ -181,7 +185,7 @@ def maybe_fold_left[D, L](
|
|
|
181
185
|
for v in it:
|
|
182
186
|
try:
|
|
183
187
|
acc = f(acc, v)
|
|
184
|
-
except
|
|
188
|
+
except RECOVERABLE:
|
|
185
189
|
return MayBe()
|
|
186
190
|
|
|
187
191
|
return MayBe(acc)
|
{pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/merging.py
RENAMED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
from collections.abc import Iterable, Iterator
|
|
23
|
-
from enum import
|
|
23
|
+
from enum import Enum, auto
|
|
24
24
|
|
|
25
25
|
__all__ = [
|
|
26
26
|
'MergeEnum',
|
|
@@ -63,7 +63,7 @@ def concat[D](*iterables: Iterable[D]) -> Iterator[D]:
|
|
|
63
63
|
Performant to the standard library's ``itertools.chain``.
|
|
64
64
|
|
|
65
65
|
"""
|
|
66
|
-
for iterator in
|
|
66
|
+
for iterator in (iter(x) for x in iterables):
|
|
67
67
|
while True:
|
|
68
68
|
try:
|
|
69
69
|
item = next(iterator)
|
|
@@ -93,7 +93,7 @@ def merge[D](*iterables: Iterable[D], yield_partials: bool = False) -> Iterator[
|
|
|
93
93
|
iterators with external references.
|
|
94
94
|
|
|
95
95
|
"""
|
|
96
|
-
iter_list =
|
|
96
|
+
iter_list = [iter(x) for x in iterables]
|
|
97
97
|
items = []
|
|
98
98
|
if (num_iters := len(iter_list)) > 0:
|
|
99
99
|
while True:
|
|
@@ -119,7 +119,7 @@ def exhaust[D](*iterables: Iterable[D]) -> Iterator[D]:
|
|
|
119
119
|
iterables are exhausted.
|
|
120
120
|
|
|
121
121
|
"""
|
|
122
|
-
iter_list =
|
|
122
|
+
iter_list = [iter(x) for x in iterables]
|
|
123
123
|
if (num_iters := len(iter_list)) > 0:
|
|
124
124
|
ii = 0
|
|
125
125
|
items = []
|
|
File without changes
|
{pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/__init__.py
RENAMED
|
File without changes
|
{pythonic_fp_iterables-5.2.0 → pythonic_fp_iterables-6.0.0}/src/pythonic_fp/iterables/py.typed
RENAMED
|
File without changes
|