pythonic-fp-circulararray 5.4.0__py3-none-any.whl → 6.0.1__py3-none-any.whl
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/circulararray/__init__.py +13 -12
- pythonic_fp/circulararray/auto.py +47 -37
- pythonic_fp/circulararray/auto.pyi +1 -4
- pythonic_fp/circulararray/fixed.py +67 -63
- pythonic_fp/circulararray/fixed.pyi +2 -7
- {pythonic_fp_circulararray-5.4.0.dist-info → pythonic_fp_circulararray-6.0.1.dist-info}/METADATA +6 -6
- pythonic_fp_circulararray-6.0.1.dist-info/RECORD +11 -0
- pythonic_fp_circulararray-5.4.0.dist-info/RECORD +0 -11
- {pythonic_fp_circulararray-5.4.0.dist-info → pythonic_fp_circulararray-6.0.1.dist-info}/WHEEL +0 -0
- {pythonic_fp_circulararray-5.4.0.dist-info → pythonic_fp_circulararray-6.0.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -16,21 +16,22 @@
|
|
|
16
16
|
Circular Array
|
|
17
17
|
--------------
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
.. admonition:: Stateful circular array data structures.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
+-------------------------------------+-------------------------------------------+
|
|
22
|
+
| Module | Description |
|
|
23
|
+
+=====================================+===========================================+
|
|
24
|
+
| **pythonic_fp.circulararray.auto** | Variable storage capacity circular array. |
|
|
25
|
+
+-------------------------------------+-------------------------------------------+
|
|
26
|
+
| **pythonic_fp.circulararray.fixed** | Fixed storage capacity circular array. |
|
|
27
|
+
+-------------------------------------+-------------------------------------------+
|
|
28
|
+
|
|
29
|
+
- O(1) pops and pushes either end
|
|
30
|
+
- O(1) size determination
|
|
31
|
+
- O(1) indexing
|
|
24
32
|
|
|
25
|
-
+-------------------------------------+-------------------------------------------+
|
|
26
|
-
| Module | Description |
|
|
27
|
-
+=====================================+===========================================+
|
|
28
|
-
| **pythonic_fp.circulararray.auto** | Variable storage capacity circular array. |
|
|
29
|
-
+-------------------------------------+-------------------------------------------+
|
|
30
|
-
| **pythonic_fp.circulararray.fixed** | Fixed storage capacity circular array. |
|
|
31
|
-
+-------------------------------------+-------------------------------------------+
|
|
32
33
|
"""
|
|
33
34
|
|
|
34
35
|
__author__ = 'Geoffrey R. Scheller'
|
|
35
|
-
__copyright__ = 'Copyright (c) 2023-
|
|
36
|
+
__copyright__ = 'Copyright (c) 2023-2026 Geoffrey R. Scheller'
|
|
36
37
|
__license__ = 'Apache License 2.0'
|
|
@@ -13,19 +13,16 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
"""
|
|
16
|
-
Variable
|
|
17
|
-
=========================
|
|
16
|
+
.. admonition:: Variable storage capacity circular array.**
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- O(1)
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- in boolean context, falsy when empty, otherwise truthy
|
|
28
|
-
- function ``ca`` produces auto-resizing circular array from arguments
|
|
18
|
+
- O(1) pops either end
|
|
19
|
+
- O(1) amortized pushes either end
|
|
20
|
+
- O(1) indexing, fully supports slicing
|
|
21
|
+
- auto-resizing more storage capacity when necessary, manually compatible
|
|
22
|
+
- iterable, safely mutates while iterators iterating over previous state
|
|
23
|
+
- comparisons compare identity before equality, like builtins
|
|
24
|
+
- in boolean context, falsy when empty, otherwise truthy
|
|
25
|
+
- function ``ca`` produces auto-resizing circular array from arguments
|
|
29
26
|
|
|
30
27
|
"""
|
|
31
28
|
|
|
@@ -41,22 +38,22 @@ nada: Final[NoValue] = NoValue()
|
|
|
41
38
|
class CA[I]:
|
|
42
39
|
__slots__ = '_items', '_cnt', '_cap', '_front', '_rear'
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
def __init__(self) -> None: ...
|
|
46
|
-
@overload
|
|
47
|
-
def __init__(self, items: Iterable[I]) -> None: ...
|
|
48
|
-
|
|
49
|
-
def __init__(self, items: Iterable[I | NoValue] | NoValue = nada) -> None:
|
|
41
|
+
def __init__(self, *items: Iterable[I]) -> None:
|
|
50
42
|
"""
|
|
51
|
-
:param items:
|
|
52
|
-
|
|
43
|
+
:param items: Optionally takes a single iterable to
|
|
44
|
+
initially populate the circular array.
|
|
45
|
+
:raises TypeError: When ``items[0]`` not iterable.
|
|
46
|
+
:raises ValueError: If more than 1 iterable is given.
|
|
53
47
|
"""
|
|
54
|
-
if items
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
if (size := len(items)) > 1:
|
|
49
|
+
msg = f'CA expects at most 1 argument, got {size}'
|
|
50
|
+
raise ValueError(msg)
|
|
51
|
+
if size:
|
|
52
|
+
values: list[I | NoValue] = list(cast(Iterable[I | NoValue], items[0]))
|
|
58
53
|
self._items = [nada] + values + [nada]
|
|
59
|
-
|
|
54
|
+
else:
|
|
55
|
+
self._items = [nada, nada]
|
|
56
|
+
self._cap = (cap := len(self._items))
|
|
60
57
|
self._cnt = cap - 2
|
|
61
58
|
if cap == 2:
|
|
62
59
|
self._front = 0
|
|
@@ -285,6 +282,12 @@ class CA[I]:
|
|
|
285
282
|
del _ca
|
|
286
283
|
|
|
287
284
|
def __eq__(self, other: object) -> bool:
|
|
285
|
+
"""
|
|
286
|
+
:param other: The object to be compared to.
|
|
287
|
+
:returns: ``True`` if object is another CA whose items compare
|
|
288
|
+
as equal to the corresponding items in the CA,
|
|
289
|
+
otherwise ``False``.
|
|
290
|
+
"""
|
|
288
291
|
if self is other:
|
|
289
292
|
return True
|
|
290
293
|
if not isinstance(other, type(self)):
|
|
@@ -292,10 +295,10 @@ class CA[I]:
|
|
|
292
295
|
|
|
293
296
|
(
|
|
294
297
|
front1,
|
|
295
|
-
|
|
298
|
+
cnt1,
|
|
296
299
|
capacity1,
|
|
297
300
|
front2,
|
|
298
|
-
|
|
301
|
+
cnt2,
|
|
299
302
|
capacity2,
|
|
300
303
|
) = (
|
|
301
304
|
self._front,
|
|
@@ -306,10 +309,10 @@ class CA[I]:
|
|
|
306
309
|
other._cap,
|
|
307
310
|
)
|
|
308
311
|
|
|
309
|
-
if
|
|
312
|
+
if cnt1 != cnt2:
|
|
310
313
|
return False
|
|
311
314
|
|
|
312
|
-
for nn in range(
|
|
315
|
+
for nn in range(cnt1):
|
|
313
316
|
if (
|
|
314
317
|
self._items[(front1 + nn) % capacity1]
|
|
315
318
|
is other._items[(front2 + nn) % capacity2]
|
|
@@ -459,7 +462,8 @@ class CA[I]:
|
|
|
459
462
|
def poplt(self, maximum: int) -> tuple[I, ...]:
|
|
460
463
|
"""Pop multiple items from left side of circular array.
|
|
461
464
|
|
|
462
|
-
:param maximum: Maximum number of items to pop, may pop less
|
|
465
|
+
:param maximum: Maximum number of items to pop, may pop less
|
|
466
|
+
if not enough items.
|
|
463
467
|
:returns: Tuple of items in the order popped, left to right.
|
|
464
468
|
"""
|
|
465
469
|
item_list: list[I] = []
|
|
@@ -477,7 +481,8 @@ class CA[I]:
|
|
|
477
481
|
def poprt(self, maximum: int) -> tuple[I, ...]:
|
|
478
482
|
"""Pop multiple items from right side of circular array.
|
|
479
483
|
|
|
480
|
-
:param maximum: Maximum number of items to pop, may pop less
|
|
484
|
+
:param maximum: Maximum number of items to pop, may pop less
|
|
485
|
+
if not enough items.
|
|
481
486
|
:returns: Tuple of items in the order popped, right to left.
|
|
482
487
|
"""
|
|
483
488
|
item_list: list[I] = []
|
|
@@ -526,10 +531,12 @@ class CA[I]:
|
|
|
526
531
|
def foldl[L](self, f: Callable[[L, I], L], start: L | NoValue = NoValue()) -> L:
|
|
527
532
|
"""Fold left with a function and optional starting item.
|
|
528
533
|
|
|
529
|
-
:param f: Folding function, first argument to ``f`` is for
|
|
534
|
+
:param f: Folding function, first argument to ``f`` is for
|
|
535
|
+
the accumulator.
|
|
530
536
|
:param start: "Optional" starting item.
|
|
531
537
|
:returns: Reduced value produced by the left fold.
|
|
532
|
-
:raises ValueError: When circular array empty and no starting
|
|
538
|
+
:raises ValueError: When circular array empty and no starting
|
|
539
|
+
item given.
|
|
533
540
|
"""
|
|
534
541
|
if self._cnt == 0:
|
|
535
542
|
if start is nada:
|
|
@@ -556,10 +563,12 @@ class CA[I]:
|
|
|
556
563
|
def foldr[R](self, f: Callable[[I, R], R], start: R | NoValue = nada) -> R:
|
|
557
564
|
"""Fold right with a function and an optional starting item.
|
|
558
565
|
|
|
559
|
-
:param f: Folding function, second argument to ``f`` is for
|
|
560
|
-
|
|
566
|
+
:param f: Folding function, second argument to ``f`` is for
|
|
567
|
+
the accumulator.
|
|
568
|
+
:param start: Optional starting item.
|
|
561
569
|
:returns: Reduced value produced by the right fold.
|
|
562
|
-
:raises ValueError: When circular array empty and no starting
|
|
570
|
+
:raises ValueError: When circular array empty and no starting
|
|
571
|
+
item given.
|
|
563
572
|
"""
|
|
564
573
|
if self._cnt == 0:
|
|
565
574
|
if start is nada:
|
|
@@ -611,7 +620,8 @@ class CA[I]:
|
|
|
611
620
|
storage capacity. To just compact the circular array, do not
|
|
612
621
|
provide ``minimum_capacity``.
|
|
613
622
|
|
|
614
|
-
:param minimum_capacity: Minimum storage capacity to compact
|
|
623
|
+
:param minimum_capacity: Minimum storage capacity to compact
|
|
624
|
+
the circular array.
|
|
615
625
|
"""
|
|
616
626
|
self._compact_storage_capacity()
|
|
617
627
|
if (min_cap := minimum_capacity) > self._cap:
|
|
@@ -4,10 +4,7 @@ from typing import overload
|
|
|
4
4
|
__all__ = ['CA', 'ca']
|
|
5
5
|
|
|
6
6
|
class CA[I]:
|
|
7
|
-
|
|
8
|
-
def __init__(self) -> None: ...
|
|
9
|
-
@overload
|
|
10
|
-
def __init__(self, items: Iterable[I]) -> None: ...
|
|
7
|
+
def __init__(self, *items: Iterable[I]) -> None: ...
|
|
11
8
|
def __iter__(self) -> Iterator[I]: ...
|
|
12
9
|
def __reversed__(self) -> Iterator[I]: ...
|
|
13
10
|
def __bool__(self) -> bool: ...
|
|
@@ -13,18 +13,15 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
"""
|
|
16
|
-
Fixed
|
|
17
|
-
======================
|
|
16
|
+
.. admonition:: Fixed storage capacity circular array.**
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- in boolean context, falsy when either empty or full, otherwise truthy
|
|
27
|
-
- function ``caf`` produces fixed capacity circular array from arguments
|
|
18
|
+
- O(1) pops and pushes either end
|
|
19
|
+
- O(1) indexing, does not support slicing
|
|
20
|
+
- fixed total storage capacity
|
|
21
|
+
- iterable, safely mutates while iterators iterating over previous state
|
|
22
|
+
- comparisons compare identity before equality, like builtins
|
|
23
|
+
- in boolean context, falsy when either empty or full, otherwise truthy
|
|
24
|
+
- function ``caf`` produces fixed capacity circular array from arguments
|
|
28
25
|
|
|
29
26
|
"""
|
|
30
27
|
|
|
@@ -40,44 +37,39 @@ nada: Final[NoValue] = NoValue()
|
|
|
40
37
|
class CAF[I]:
|
|
41
38
|
__slots__ = '_items', '_cnt', '_cap', '_front', '_rear'
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
def __init__(self) -> None: ...
|
|
45
|
-
@overload
|
|
46
|
-
def __init__(self, items: Iterable[I]) -> None: ...
|
|
47
|
-
@overload
|
|
48
|
-
def __init__(self, items: Iterable[I], capacity: int) -> None: ...
|
|
49
|
-
|
|
50
|
-
def __init__(
|
|
51
|
-
self, items: Iterable[I | NoValue] | NoValue = nada, capacity: int = 2
|
|
52
|
-
) -> None:
|
|
40
|
+
def __init__(self, *items: Iterable[I], cap: int = 2) -> None:
|
|
53
41
|
"""
|
|
54
|
-
:param items:
|
|
55
|
-
|
|
56
|
-
:
|
|
42
|
+
:param items: Optionally takes a single iterable to
|
|
43
|
+
initially populate the circular array.
|
|
44
|
+
:param cap: Minimum fixed storage capacity of circular array.
|
|
45
|
+
:raises TypeError: When ``items[0]`` not iterable,
|
|
46
|
+
:raises ValueError: If more than 1 iterable is given.
|
|
57
47
|
"""
|
|
58
|
-
|
|
59
|
-
if items
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
cap = max(2, cap)
|
|
49
|
+
if (size := len(items)) > 1:
|
|
50
|
+
msg = f'CAF expects at most 1 argument, got {size}'
|
|
51
|
+
raise ValueError(msg)
|
|
52
|
+
if size:
|
|
53
|
+
values: list[I | NoValue] = list(cast(Iterable[I | NoValue], items[0]))
|
|
54
|
+
cnt = len(values)
|
|
55
|
+
cap = max(cnt, cap)
|
|
56
|
+
self._items = values + [nada] * (cap - cnt)
|
|
62
57
|
else:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
self._cap: Final[int] = capacity
|
|
69
|
-
self._cnt = count
|
|
70
|
-
if count == 0:
|
|
58
|
+
self._items = [nada] * cap
|
|
59
|
+
cnt = 0
|
|
60
|
+
self._cap: Final[int] = cap
|
|
61
|
+
self._cnt = cnt
|
|
62
|
+
if cnt == 0:
|
|
71
63
|
self._front = 0
|
|
72
|
-
self._rear =
|
|
64
|
+
self._rear = cap - 1
|
|
73
65
|
else:
|
|
74
66
|
self._front = 0
|
|
75
|
-
self._rear =
|
|
67
|
+
self._rear = cnt - 1
|
|
76
68
|
|
|
77
69
|
def __iter__(self) -> Iterator[I]:
|
|
78
70
|
if self._cnt > 0:
|
|
79
71
|
(
|
|
80
|
-
|
|
72
|
+
cap,
|
|
81
73
|
rear,
|
|
82
74
|
position,
|
|
83
75
|
current_state,
|
|
@@ -90,13 +82,13 @@ class CAF[I]:
|
|
|
90
82
|
|
|
91
83
|
while position != rear:
|
|
92
84
|
yield cast(I, current_state[position])
|
|
93
|
-
position = (position + 1) %
|
|
85
|
+
position = (position + 1) % cap
|
|
94
86
|
yield cast(I, current_state[position])
|
|
95
87
|
|
|
96
88
|
def __reversed__(self) -> Iterator[I]:
|
|
97
89
|
if self._cnt > 0:
|
|
98
90
|
(
|
|
99
|
-
|
|
91
|
+
cap,
|
|
100
92
|
front,
|
|
101
93
|
position,
|
|
102
94
|
current_state,
|
|
@@ -109,7 +101,7 @@ class CAF[I]:
|
|
|
109
101
|
|
|
110
102
|
while position != front:
|
|
111
103
|
yield cast(I, current_state[position])
|
|
112
|
-
position = (position - 1) %
|
|
104
|
+
position = (position - 1) % cap
|
|
113
105
|
yield cast(I, current_state[position])
|
|
114
106
|
|
|
115
107
|
def __repr__(self) -> str:
|
|
@@ -159,7 +151,7 @@ class CAF[I]:
|
|
|
159
151
|
def __delitem__(self, idx: int) -> None:
|
|
160
152
|
item_list = list(self)
|
|
161
153
|
del item_list[idx]
|
|
162
|
-
_ca = CAF(item_list, self._cap)
|
|
154
|
+
_ca = CAF(item_list, cap = self._cap)
|
|
163
155
|
(
|
|
164
156
|
self._items,
|
|
165
157
|
self._cnt,
|
|
@@ -174,6 +166,12 @@ class CAF[I]:
|
|
|
174
166
|
del _ca
|
|
175
167
|
|
|
176
168
|
def __eq__(self, other: object) -> bool:
|
|
169
|
+
"""
|
|
170
|
+
:param other: The object to be compared to.
|
|
171
|
+
:returns: ``True`` if object is another CAF whose items compare
|
|
172
|
+
as equal to the corresponding items in the CAF,
|
|
173
|
+
otherwise ``False``.
|
|
174
|
+
"""
|
|
177
175
|
if self is other:
|
|
178
176
|
return True
|
|
179
177
|
if not isinstance(other, type(self)):
|
|
@@ -181,11 +179,11 @@ class CAF[I]:
|
|
|
181
179
|
|
|
182
180
|
(
|
|
183
181
|
front1,
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
cnt1,
|
|
183
|
+
cap1,
|
|
186
184
|
front2,
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
cnt2,
|
|
186
|
+
cap2,
|
|
189
187
|
) = (
|
|
190
188
|
self._front,
|
|
191
189
|
self._cnt,
|
|
@@ -195,18 +193,18 @@ class CAF[I]:
|
|
|
195
193
|
other._cap,
|
|
196
194
|
)
|
|
197
195
|
|
|
198
|
-
if
|
|
196
|
+
if cnt1 != cnt2:
|
|
199
197
|
return False
|
|
200
198
|
|
|
201
|
-
for nn in range(
|
|
199
|
+
for nn in range(cnt1):
|
|
202
200
|
if (
|
|
203
|
-
self._items[(front1 + nn) %
|
|
204
|
-
is other._items[(front2 + nn) %
|
|
201
|
+
self._items[(front1 + nn) % cap1]
|
|
202
|
+
is other._items[(front2 + nn) % cap2]
|
|
205
203
|
):
|
|
206
204
|
continue
|
|
207
205
|
if (
|
|
208
|
-
self._items[(front1 + nn) %
|
|
209
|
-
!= other._items[(front2 + nn) %
|
|
206
|
+
self._items[(front1 + nn) % cap1]
|
|
207
|
+
!= other._items[(front2 + nn) % cap2]
|
|
210
208
|
):
|
|
211
209
|
return False
|
|
212
210
|
return True
|
|
@@ -352,7 +350,8 @@ class CAF[I]:
|
|
|
352
350
|
def poplt(self, maximum: int) -> tuple[I, ...]:
|
|
353
351
|
"""Pop multiple items from left side of circular array.
|
|
354
352
|
|
|
355
|
-
:param maximum: Maximum number of items to pop, may pop less
|
|
353
|
+
:param maximum: Maximum number of items to pop, may pop less
|
|
354
|
+
if not enough items.
|
|
356
355
|
:returns: Tuple of items in the order popped, left to right.
|
|
357
356
|
"""
|
|
358
357
|
item_list: list[I] = []
|
|
@@ -370,7 +369,8 @@ class CAF[I]:
|
|
|
370
369
|
def poprt(self, maximum: int) -> tuple[I, ...]:
|
|
371
370
|
"""Pop multiple items from right side of circular array.
|
|
372
371
|
|
|
373
|
-
:param maximum: Maximum number of items to pop, may pop less
|
|
372
|
+
:param maximum: Maximum number of items to pop, may pop less
|
|
373
|
+
if not enough items.
|
|
374
374
|
:returns: Tuple of items in the order popped, right to left.
|
|
375
375
|
"""
|
|
376
376
|
item_list: list[I] = []
|
|
@@ -409,7 +409,7 @@ class CAF[I]:
|
|
|
409
409
|
:param f: Callable from type ``I`` to type ``U``.
|
|
410
410
|
:returns: New fixed capacity circular array instance.
|
|
411
411
|
"""
|
|
412
|
-
return CAF(map(f, self), self._cap)
|
|
412
|
+
return CAF(map(f, self), cap = self._cap)
|
|
413
413
|
|
|
414
414
|
@overload
|
|
415
415
|
def foldl[L](self, f: Callable[[I, I], I]) -> I: ...
|
|
@@ -419,10 +419,12 @@ class CAF[I]:
|
|
|
419
419
|
def foldl[L](self, f: Callable[[L, I], L], start: L | NoValue = nada) -> L:
|
|
420
420
|
"""Fold left with a function and optional stating item.
|
|
421
421
|
|
|
422
|
-
:param f: Folding function, first argument to ``f`` is for
|
|
422
|
+
:param f: Folding function, first argument to ``f`` is for
|
|
423
|
+
the accumulator.
|
|
423
424
|
:param start: Optional starting item.
|
|
424
425
|
:returns: Reduced value produced by the left fold.
|
|
425
|
-
:raises ValueError: When circular array empty and no starting
|
|
426
|
+
:raises ValueError: When circular array empty and no starting
|
|
427
|
+
item given.
|
|
426
428
|
"""
|
|
427
429
|
if self._cnt == 0:
|
|
428
430
|
if start is nada:
|
|
@@ -449,10 +451,12 @@ class CAF[I]:
|
|
|
449
451
|
def foldr[R](self, f: Callable[[I, R], R], start: R | NoValue = nada) -> R:
|
|
450
452
|
"""Fold right with a function and an optional starting item.
|
|
451
453
|
|
|
452
|
-
:param f: Folding function, second argument to ``f`` is for
|
|
454
|
+
:param f: Folding function, second argument to ``f`` is for
|
|
455
|
+
the accumulator.
|
|
453
456
|
:param start: Optional starting item.
|
|
454
457
|
:returns: Reduced value produced by the right fold.
|
|
455
|
-
:raises ValueError: When circular array empty and no starting
|
|
458
|
+
:raises ValueError: When circular array empty and no starting
|
|
459
|
+
item given.
|
|
456
460
|
"""
|
|
457
461
|
if self._cnt == 0:
|
|
458
462
|
if start is nada:
|
|
@@ -500,11 +504,11 @@ class CAF[I]:
|
|
|
500
504
|
return self._cnt / self._cap
|
|
501
505
|
|
|
502
506
|
|
|
503
|
-
def caf[T](*items: T,
|
|
507
|
+
def caf[T](*items: T, cap: int = 2) -> CAF[T]:
|
|
504
508
|
"""Produce a circular array from a variable number of arguments.
|
|
505
509
|
|
|
506
510
|
:param items: Initial items for a new fixed capacity :circular array.
|
|
507
|
-
:param
|
|
511
|
+
:param cap: The minimum storage capacity to set.
|
|
508
512
|
:returns: New fixed storage capacity circular array.
|
|
509
513
|
"""
|
|
510
|
-
return CAF(items,
|
|
514
|
+
return CAF(items, cap=cap)
|
|
@@ -4,12 +4,7 @@ from typing import overload
|
|
|
4
4
|
__all__ = ['CAF', 'caf']
|
|
5
5
|
|
|
6
6
|
class CAF[I]:
|
|
7
|
-
|
|
8
|
-
def __init__(self) -> None: ...
|
|
9
|
-
@overload
|
|
10
|
-
def __init__(self, items: Iterable[I]) -> None: ...
|
|
11
|
-
@overload
|
|
12
|
-
def __init__(self, items: Iterable[I], capacity: int) -> None: ...
|
|
7
|
+
def __init__(self, *items: Iterable[I], cap: int = 2) -> None: ...
|
|
13
8
|
def __iter__(self) -> Iterator[I]: ...
|
|
14
9
|
def __reversed__(self) -> Iterator[I]: ...
|
|
15
10
|
def __bool__(self) -> bool: ...
|
|
@@ -41,4 +36,4 @@ class CAF[I]:
|
|
|
41
36
|
def empty(self) -> None: ...
|
|
42
37
|
def fraction_filled(self) -> float: ...
|
|
43
38
|
|
|
44
|
-
def caf[T](*items: T,
|
|
39
|
+
def caf[T](*items: T, cap: int = 2) -> CAF[T]: ...
|
{pythonic_fp_circulararray-5.4.0.dist-info → pythonic_fp_circulararray-6.0.1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonic-fp-circulararray
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.0.1
|
|
4
4
|
Summary: Circular Array
|
|
5
5
|
Keywords: auto resizing,circular array,circulararray,dequeue,indexable,pop,push
|
|
6
6
|
Author-email: "Geoffrey R. Scheller" <geoffrey@scheller.com>
|
|
@@ -14,11 +14,11 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Classifier: Typing :: Typed
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist: pythonic-fp-gadgets>=
|
|
17
|
+
Requires-Dist: pythonic-fp-gadgets>=4.0.2
|
|
18
18
|
Requires-Dist: pytest>=8.4.1 ; extra == "test"
|
|
19
19
|
Project-URL: Changelog, https://github.com/grscheller/pythonic-fp-circulararray/blob/main/CHANGELOG.rst
|
|
20
|
-
Project-URL: Documentation, https://grscheller.github.io/pythonic-fp/circulararray/development/build/html/
|
|
21
|
-
Project-URL: Homepage, https://github.
|
|
20
|
+
Project-URL: Documentation, https://grscheller.github.io/pythonic-fp/circulararray/development/build/html/
|
|
21
|
+
Project-URL: Homepage, https://grscheller.github.io/pythonic-fp/homepage/build/html/
|
|
22
22
|
Project-URL: Source, https://github.com/grscheller/pythonic-fp-circulararray
|
|
23
23
|
Provides-Extra: test
|
|
24
24
|
|
|
@@ -54,7 +54,7 @@ Python module implementing stateful circular array data structures.
|
|
|
54
54
|
|
|
55
55
|
Part of the
|
|
56
56
|
`pythonic-fp
|
|
57
|
-
<https://grscheller.github.io/pythonic-fp
|
|
57
|
+
<https://grscheller.github.io/pythonic-fp>`_
|
|
58
58
|
PyPI projects.
|
|
59
59
|
|
|
60
60
|
Documentation
|
|
@@ -62,7 +62,7 @@ Documentation
|
|
|
62
62
|
|
|
63
63
|
Documentation for this project is hosted on
|
|
64
64
|
`GitHub Pages
|
|
65
|
-
<https://grscheller.github.io/pythonic-fp/circulararray
|
|
65
|
+
<https://grscheller.github.io/pythonic-fp/circulararray>`_.
|
|
66
66
|
|
|
67
67
|
Copyright and License
|
|
68
68
|
---------------------
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pythonic_fp/circulararray/__init__.py,sha256=LBeypPlXTlFvBa4DgScR1uh6aPCIOaon9xRmPxr00jQ,1528
|
|
2
|
+
pythonic_fp/circulararray/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
pythonic_fp/circulararray/auto.py,sha256=a6sIoGYJRuWdKyIOr_nppX3YRd9LtYkKcqSGx3vVOV4,19930
|
|
4
|
+
pythonic_fp/circulararray/auto.pyi,sha256=k92FjH9PblzfusOS3RFF29LtwgKAjaxAocuqENuhPEw,1798
|
|
5
|
+
pythonic_fp/circulararray/fixed.py,sha256=atsagw_M6Bl9S3AAeV9ymNf-CFa-0KgR6y6iiTaQHVE,15873
|
|
6
|
+
pythonic_fp/circulararray/fixed.pyi,sha256=n0A0ENgy7vSugeBNcgIUiMZtXzUii05CnuTTRj7VELI,1509
|
|
7
|
+
pythonic_fp/circulararray/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
pythonic_fp_circulararray-6.0.1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
9
|
+
pythonic_fp_circulararray-6.0.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
10
|
+
pythonic_fp_circulararray-6.0.1.dist-info/METADATA,sha256=3vyieYyMYDVKTLuWyXnzsII9R8Xnb6q5E7xlqJUxZao,2697
|
|
11
|
+
pythonic_fp_circulararray-6.0.1.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
pythonic_fp/circulararray/__init__.py,sha256=uR0KASmw1Zraz9l3VPbqPm9WUKzWk-0_tUGT0opabzQ,1515
|
|
2
|
-
pythonic_fp/circulararray/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
pythonic_fp/circulararray/auto.py,sha256=mM5kAZnSo4etgA0uSp05VUMGpIOeKXIoCCQ1C3pIETo,19457
|
|
4
|
-
pythonic_fp/circulararray/auto.pyi,sha256=DegIbRFv66Ws4N1J1dExQ6cQJOTZw-XXUEJHi1OgIBk,1861
|
|
5
|
-
pythonic_fp/circulararray/fixed.py,sha256=VhCWBcE0C8toYqGyd9aKJ1bSJu8sHA46AQGJ7mGxYBE,15700
|
|
6
|
-
pythonic_fp/circulararray/fixed.pyi,sha256=Uk0QnXn3_q_6urXeRFEMxsL0gS-3Xa4UsyDRVXk8YoY,1648
|
|
7
|
-
pythonic_fp/circulararray/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
pythonic_fp_circulararray-5.4.0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
9
|
-
pythonic_fp_circulararray-5.4.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
10
|
-
pythonic_fp_circulararray-5.4.0.dist-info/METADATA,sha256=x6ZQX_ItPF3ndJZFS15JOOqKPK01yM6YEf0Y3e9PsK8,2761
|
|
11
|
-
pythonic_fp_circulararray-5.4.0.dist-info/RECORD,,
|
{pythonic_fp_circulararray-5.4.0.dist-info → pythonic_fp_circulararray-6.0.1.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|