pythonic-fp-circulararray 5.4.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.
Files changed (21) hide show
  1. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/CHANGELOG.rst +17 -5
  2. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/PKG-INFO +1 -1
  3. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/pyproject.toml +1 -1
  4. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/src/pythonic_fp/circulararray/auto.py +16 -17
  5. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/src/pythonic_fp/circulararray/fixed.py +40 -46
  6. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/auto/test_ca.py +10 -0
  7. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/fixed/test_caf.py +21 -10
  8. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/fixed/test_caf_capacity.py +3 -3
  9. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/fixed/test_repr_str_fixed.py +3 -3
  10. pythonic_fp_circulararray-5.4.0/src/pythonic_fp/circulararray/__init__.pyi +0 -0
  11. pythonic_fp_circulararray-5.4.0/src/pythonic_fp/circulararray/auto.pyi +0 -52
  12. pythonic_fp_circulararray-5.4.0/src/pythonic_fp/circulararray/fixed.pyi +0 -44
  13. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/.gitignore +0 -0
  14. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/LICENSE +0 -0
  15. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/README.rst +0 -0
  16. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/src/pythonic_fp/circulararray/__init__.py +0 -0
  17. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/src/pythonic_fp/circulararray/py.typed +0 -0
  18. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/auto/test_ca_capacity.py +0 -0
  19. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/auto/test_ca_fold_with_none.py +0 -0
  20. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/auto/test_repr_str_auto.py +0 -0
  21. {pythonic_fp_circulararray-5.4.0 → pythonic_fp_circulararray-6.0.0}/tests/fixed/test_caf_fold_with_none.py +0 -0
@@ -17,12 +17,20 @@ See `Semantic Versioning 2.0.0 <https://semver.org>`_.
17
17
  Releases and Important Milestones
18
18
  ---------------------------------
19
19
 
20
- PyPI 5.4.0 - TBD
21
- ~~~~~~~~~~~~~~~~
20
+ PyPI 6.0.0 - 2025-09-25
21
+ ~~~~~~~~~~~~~~~~~~~~~~~
22
22
 
23
- - updated README.rst
23
+ Changed how "optional" iterator in initializer signature is handled.
24
24
 
25
- - previous version never fully updated for two circular array types
25
+ - same trick as is done in queues project.
26
+ - no longer need to use a sentinel in the signature
27
+ - less typing boilerplate
28
+ - required a bump in major version number
29
+
30
+ PyPI 5.4.0 - 2025-09-25
31
+ ~~~~~~~~~~~~~~~~~~~~~~~
32
+
33
+ Gave both circular arrays the ability to store None as a value.
26
34
 
27
35
  - realized that both circular array types cannot store None as a value
28
36
 
@@ -30,10 +38,14 @@ PyPI 5.4.0 - TBD
30
38
 
31
39
  - typing for foldl & foldr a bit quirky (mypy bug?)
32
40
 
33
- - bumping minor version number
41
+ - bumping minor version number to 5.4.0
34
42
 
35
43
  - more than a bug fix but not really an API change either
36
44
 
45
+ - updated README.rst for last two PyPI releases
46
+
47
+ - previous version never fully updated for two circular array types
48
+
37
49
  PyPI 5.3.3 - 2025-09-21
38
50
  ~~~~~~~~~~~~~~~~~~~~~~~
39
51
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonic-fp-circulararray
3
- Version: 5.4.0
3
+ Version: 6.0.0
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pythonic-fp-circulararray"
3
- version = "5.4.0"
3
+ version = "6.0.0"
4
4
  readme = "README.rst"
5
5
  requires-python = ">=3.13"
6
6
  license = { file = "LICENSE" }
@@ -41,22 +41,21 @@ nada: Final[NoValue] = NoValue()
41
41
  class CA[I]:
42
42
  __slots__ = '_items', '_cnt', '_cap', '_front', '_rear'
43
43
 
44
- @overload
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:
44
+ def __init__(self, *items: Iterable[I]) -> None:
50
45
  """
51
- :param items: "Optional" iterable to initial populate circular array.
52
- :raises TypeError: When ``items`` not Iterable.
46
+ :param items: "Optionally" takes a single iterable to populate circular array.
47
+ :raises TypeError: When ``items[0]`` not iterable.
48
+ :raises ValueError: If more than 1 iterable is given.
53
49
  """
54
- if items is nada:
55
- self._items: list[I | NoValue] = [nada, nada]
56
- else:
57
- values: list[I | NoValue] = list(cast(Iterable[I | NoValue], items))
50
+ if (size := len(items)) > 1:
51
+ msg = f'CA expects at most 1 argument, got {size}'
52
+ raise ValueError(msg)
53
+ if size:
54
+ values: list[I | NoValue] = list(cast(Iterable[I | NoValue], items[0]))
58
55
  self._items = [nada] + values + [nada]
59
- self._cap = cap = len(self._items)
56
+ else:
57
+ self._items = [nada, nada]
58
+ self._cap = (cap := len(self._items))
60
59
  self._cnt = cap - 2
61
60
  if cap == 2:
62
61
  self._front = 0
@@ -292,10 +291,10 @@ class CA[I]:
292
291
 
293
292
  (
294
293
  front1,
295
- count1,
294
+ cnt1,
296
295
  capacity1,
297
296
  front2,
298
- count2,
297
+ cnt2,
299
298
  capacity2,
300
299
  ) = (
301
300
  self._front,
@@ -306,10 +305,10 @@ class CA[I]:
306
305
  other._cap,
307
306
  )
308
307
 
309
- if count1 != count2:
308
+ if cnt1 != cnt2:
310
309
  return False
311
310
 
312
- for nn in range(count1):
311
+ for nn in range(cnt1):
313
312
  if (
314
313
  self._items[(front1 + nn) % capacity1]
315
314
  is other._items[(front2 + nn) % capacity2]
@@ -40,44 +40,38 @@ nada: Final[NoValue] = NoValue()
40
40
  class CAF[I]:
41
41
  __slots__ = '_items', '_cnt', '_cap', '_front', '_rear'
42
42
 
43
- @overload
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:
43
+ def __init__(self, *items: Iterable[I], cap: int = 2) -> None:
53
44
  """
54
- :param items: "Optional" iterable to initial populate circular array.
55
- :param capacity: Minimum fixed storage capacity of circular array.
56
- :raises TypeError: When ``items`` not Iterable,
45
+ :param items: "Optionally" takes a single iterable to populate circular array.
46
+ :param cap: Minimum fixed storage capacity of circular array.
47
+ :raises TypeError: When ``items[0]`` not iterable,
48
+ :raises ValueError: If more than 1 iterable is given.
57
49
  """
58
- capacity = max(2, capacity)
59
- if items is nada:
60
- self._items: list[I | NoValue] = [nada] * capacity
61
- count = 0
50
+ cap = max(2, cap)
51
+ if (size := len(items)) > 1:
52
+ msg = f'CAF expects at most 1 argument, got {size}'
53
+ raise ValueError(msg)
54
+ if size:
55
+ values: list[I | NoValue] = list(cast(Iterable[I | NoValue], items[0]))
56
+ cnt = len(values)
57
+ cap = max(cnt, cap)
58
+ self._items = values + [nada] * (cap - cnt)
62
59
  else:
63
- values: list[I | NoValue] = list(cast(Iterable[I | NoValue], items))
64
- dlist: list[I | NoValue] = list(values)
65
- count = len(dlist)
66
- capacity = max(count, capacity)
67
- self._items = dlist + [nada] * (capacity - count)
68
- self._cap: Final[int] = capacity
69
- self._cnt = count
70
- if count == 0:
60
+ self._items = [nada] * cap
61
+ cnt = 0
62
+ self._cap: Final[int] = cap
63
+ self._cnt = cnt
64
+ if cnt == 0:
71
65
  self._front = 0
72
- self._rear = capacity - 1
66
+ self._rear = cap - 1
73
67
  else:
74
68
  self._front = 0
75
- self._rear = count - 1
69
+ self._rear = cnt - 1
76
70
 
77
71
  def __iter__(self) -> Iterator[I]:
78
72
  if self._cnt > 0:
79
73
  (
80
- capacity,
74
+ cap,
81
75
  rear,
82
76
  position,
83
77
  current_state,
@@ -90,13 +84,13 @@ class CAF[I]:
90
84
 
91
85
  while position != rear:
92
86
  yield cast(I, current_state[position])
93
- position = (position + 1) % capacity
87
+ position = (position + 1) % cap
94
88
  yield cast(I, current_state[position])
95
89
 
96
90
  def __reversed__(self) -> Iterator[I]:
97
91
  if self._cnt > 0:
98
92
  (
99
- capacity,
93
+ cap,
100
94
  front,
101
95
  position,
102
96
  current_state,
@@ -109,7 +103,7 @@ class CAF[I]:
109
103
 
110
104
  while position != front:
111
105
  yield cast(I, current_state[position])
112
- position = (position - 1) % capacity
106
+ position = (position - 1) % cap
113
107
  yield cast(I, current_state[position])
114
108
 
115
109
  def __repr__(self) -> str:
@@ -159,7 +153,7 @@ class CAF[I]:
159
153
  def __delitem__(self, idx: int) -> None:
160
154
  item_list = list(self)
161
155
  del item_list[idx]
162
- _ca = CAF(item_list, self._cap)
156
+ _ca = CAF(item_list, cap = self._cap)
163
157
  (
164
158
  self._items,
165
159
  self._cnt,
@@ -181,11 +175,11 @@ class CAF[I]:
181
175
 
182
176
  (
183
177
  front1,
184
- count1,
185
- capacity1,
178
+ cnt1,
179
+ cap1,
186
180
  front2,
187
- count2,
188
- capacity2,
181
+ cnt2,
182
+ cap2,
189
183
  ) = (
190
184
  self._front,
191
185
  self._cnt,
@@ -195,18 +189,18 @@ class CAF[I]:
195
189
  other._cap,
196
190
  )
197
191
 
198
- if count1 != count2:
192
+ if cnt1 != cnt2:
199
193
  return False
200
194
 
201
- for nn in range(count1):
195
+ for nn in range(cnt1):
202
196
  if (
203
- self._items[(front1 + nn) % capacity1]
204
- is other._items[(front2 + nn) % capacity2]
197
+ self._items[(front1 + nn) % cap1]
198
+ is other._items[(front2 + nn) % cap2]
205
199
  ):
206
200
  continue
207
201
  if (
208
- self._items[(front1 + nn) % capacity1]
209
- != other._items[(front2 + nn) % capacity2]
202
+ self._items[(front1 + nn) % cap1]
203
+ != other._items[(front2 + nn) % cap2]
210
204
  ):
211
205
  return False
212
206
  return True
@@ -409,7 +403,7 @@ class CAF[I]:
409
403
  :param f: Callable from type ``I`` to type ``U``.
410
404
  :returns: New fixed capacity circular array instance.
411
405
  """
412
- return CAF(map(f, self), self._cap)
406
+ return CAF(map(f, self), cap = self._cap)
413
407
 
414
408
  @overload
415
409
  def foldl[L](self, f: Callable[[I, I], I]) -> I: ...
@@ -500,11 +494,11 @@ class CAF[I]:
500
494
  return self._cnt / self._cap
501
495
 
502
496
 
503
- def caf[T](*items: T, capacity: int = 2) -> CAF[T]:
497
+ def caf[T](*items: T, cap: int = 2) -> CAF[T]:
504
498
  """Produce a circular array from a variable number of arguments.
505
499
 
506
500
  :param items: Initial items for a new fixed capacity :circular array.
507
- :param capacity: The minimum storage capacity to set.
501
+ :param cap: The minimum storage capacity to set.
508
502
  :returns: New fixed storage capacity circular array.
509
503
  """
510
- return CAF(items, capacity=capacity)
504
+ return CAF(items, cap=cap)
@@ -485,3 +485,13 @@ class TestCircularArrayResizing:
485
485
  assert baz == ca(3, 2, 1, 3, 4, 0, 6, 1, 8, 2, 10)
486
486
  del baz[6:10:2]
487
487
  assert baz == ca(3, 2, 1, 3, 4, 0, 1, 2, 10)
488
+
489
+ def test_store_none(self) -> None:
490
+ ca1 = ca(1, 'a', None, (), 42)
491
+ assert ca1.popl() == 1
492
+ assert ca1.popr() == 42
493
+ assert ca1
494
+ assert ca1.popl() == 'a'
495
+ assert ca1.popl() is None
496
+ assert ca1.popr() == ()
497
+ assert not ca1
@@ -20,7 +20,7 @@ class TestCircularArrayFixed:
20
20
 
21
21
  def test_mutate_returns_none(self) -> None:
22
22
  """Test for builtin behaviors"""
23
- ca1: CAF[int] = caf(capacity=4)
23
+ ca1: CAF[int] = caf(cap=4)
24
24
  assert not ca1
25
25
  assert ca1.pushl(1) is None # type: ignore[func-returns-value]
26
26
  assert ca1
@@ -63,7 +63,7 @@ class TestCircularArrayFixed:
63
63
 
64
64
  def test_push_then_pop(self) -> None:
65
65
  """Functionality test"""
66
- ca0: CAF[str] = caf(capacity=42)
66
+ ca0: CAF[str] = caf(cap=42)
67
67
  pushed1 = '42'
68
68
  ca0.pushl(pushed1)
69
69
  popped1 = ca0.popl()
@@ -156,8 +156,8 @@ class TestCircularArrayFixed:
156
156
 
157
157
  def test_equality(self) -> None:
158
158
  """Functionality test"""
159
- c1: CAF[object] = caf(1, 2, 3, 'Forty-Two', (7, 11, 'foobar'), capacity=7)
160
- c2: CAF[object] = caf(2, 3, 'Forty-Two', capacity=7)
159
+ c1: CAF[object] = caf(1, 2, 3, 'Forty-Two', (7, 11, 'foobar'), cap=7)
160
+ c2: CAF[object] = caf(2, 3, 'Forty-Two', cap=7)
161
161
  c2.pushl(1)
162
162
  c2.pushr((7, 11, 'foobar'))
163
163
  assert c1 == c2
@@ -175,7 +175,7 @@ class TestCircularArrayFixed:
175
175
  assert c1 == c2
176
176
 
177
177
  hold_a = c1.popl()
178
- c1 = CAF(c1, 42)
178
+ c1 = CAF(c1, cap=42)
179
179
  hold_b = c1.popl()
180
180
  hold_c = c1.popr()
181
181
  c1.pushl(hold_b)
@@ -312,7 +312,7 @@ class TestCircularArrayFixed:
312
312
 
313
313
  def test_readme(self) -> None:
314
314
  """Functionality test"""
315
- ca0 = caf(1, 2, 3, capacity=10)
315
+ ca0 = caf(1, 2, 3, cap=10)
316
316
  assert ca0.popl() == 1
317
317
  assert ca0.popr() == 3
318
318
  ca0.pushr(42)
@@ -340,7 +340,7 @@ class TestCircularArrayFixed:
340
340
 
341
341
  def test_pop(self) -> None:
342
342
  """Functionality test"""
343
- ca1 = caf(1, 2, 3, capacity=4)
343
+ ca1 = caf(1, 2, 3, cap=4)
344
344
  assert ca1.popld(42) == 1
345
345
  assert ca1.poprd(42) == 3
346
346
  assert ca1.popld(42) == 2
@@ -348,7 +348,7 @@ class TestCircularArrayFixed:
348
348
  assert ca1.popld(42) == 42
349
349
  assert len(ca1) == 0
350
350
 
351
- ca2: CAF[int] = caf(0, 1, 2, 3, 4, 5, 6, capacity=10)
351
+ ca2: CAF[int] = caf(0, 1, 2, 3, 4, 5, 6, cap=10)
352
352
  assert ca2.popl() == 0
353
353
  assert ca2.popr() == 6
354
354
  assert ca2 == caf(1, 2, 3, 4, 5)
@@ -437,8 +437,8 @@ class TestCircularArrayFixed:
437
437
  (4, 1),
438
438
  (4, 3),
439
439
  )
440
- foo = caf(0, 1, 2, 3, 4, capacity=10)
441
- bar = CAF[tuple[int, int]]((), capacity=100)
440
+ foo = caf(0, 1, 2, 3, 4, cap=10)
441
+ bar = CAF[tuple[int, int]]((), cap=100)
442
442
 
443
443
  for ii in foo:
444
444
  if ii % 2 == 1:
@@ -489,3 +489,14 @@ class TestCircularArrayFixed:
489
489
  assert False
490
490
  else:
491
491
  assert bar == 0
492
+
493
+ def test_store_none(self) -> None:
494
+ caf1 = caf(1, 'a', None, (), 42)
495
+ assert not caf1
496
+ assert caf1.popl() == 1
497
+ assert caf1.popr() == 42
498
+ assert caf1
499
+ assert caf1.popl() == 'a'
500
+ assert caf1.popl() is None
501
+ assert caf1.popr() == ()
502
+ assert not caf1
@@ -22,7 +22,7 @@ class TestCapacityFixed:
22
22
  ca0: CAF[int] = CAF()
23
23
  assert ca0.capacity() == 2
24
24
 
25
- ca0 = caf(1, 2, capacity=8)
25
+ ca0 = caf(1, 2, cap=8)
26
26
  assert ca0.fraction_filled() == 2 / 8
27
27
 
28
28
  ca0.pushl(0)
@@ -49,7 +49,7 @@ class TestCapacityFixed:
49
49
 
50
50
  def test_empty(self) -> None:
51
51
  """Functionality test"""
52
- c: CAF[int] = caf(capacity=401)
52
+ c: CAF[int] = caf(cap=401)
53
53
  assert c == caf()
54
54
  assert len(c) == 0
55
55
  for ii in 1, 2, 3, 4, 5:
@@ -73,7 +73,7 @@ class TestCapacityFixed:
73
73
 
74
74
  def test_one(self) -> None:
75
75
  """Functionality test"""
76
- c = caf(42, capacity=5)
76
+ c = caf(42, cap=5)
77
77
  assert c.capacity() == 5
78
78
  assert len(c) == 1
79
79
  popped = c.popld(0)
@@ -25,7 +25,7 @@ class TestReprFixed:
25
25
  bar: CAF[int] = eval(repr(ca0))
26
26
  assert foo == bar
27
27
 
28
- ca1: CAF[str|int] = CAF((), capacity=10)
28
+ ca1: CAF[str|int] = CAF((), cap=10)
29
29
  assert repr(ca1) == 'caf()'
30
30
  ca2: CAF[int|str] = eval(repr(ca1))
31
31
  assert ca2 == ca1
@@ -51,7 +51,7 @@ class TestReprFixed:
51
51
  assert ca2 == ca1
52
52
  assert ca2 is not ca1
53
53
 
54
- ca3: CAF[int] = caf(1, 10, 0, 42, capacity=10)
54
+ ca3: CAF[int] = caf(1, 10, 0, 42, cap=10)
55
55
  ca3.pushr(2)
56
56
  ca3.pushr(100)
57
57
  ca3.pushr(3)
@@ -65,7 +65,7 @@ class TestReprFixed:
65
65
  ca3.pushr(3)
66
66
  assert repr(ca3) == 'caf(8, 9, 10, 0, 42, 1, 2, 3)'
67
67
 
68
- ca4: CAF[int] = CAF([1, 10, 0, 42], capacity=100)
68
+ ca4: CAF[int] = CAF([1, 10, 0, 42], cap=100)
69
69
  ca4.pushr(2)
70
70
  ca4.pushr(100)
71
71
  ca4.pushr(3)
@@ -1,52 +0,0 @@
1
- from collections.abc import Callable, Iterable, Iterator
2
- from typing import overload
3
-
4
- __all__ = ['CA', 'ca']
5
-
6
- class CA[I]:
7
- @overload
8
- def __init__(self) -> None: ...
9
- @overload
10
- def __init__(self, items: Iterable[I]) -> None: ...
11
- def __iter__(self) -> Iterator[I]: ...
12
- def __reversed__(self) -> Iterator[I]: ...
13
- def __bool__(self) -> bool: ...
14
- def __len__(self) -> int: ...
15
- @overload
16
- def __getitem__(self, idx: int) -> I: ...
17
- @overload
18
- def __getitem__(self, idx: slice) -> CA[I]: ...
19
- @overload
20
- def __setitem__(self, idx: int, vals: I) -> None: ...
21
- @overload
22
- def __setitem__(self, idx: slice, vals: Iterable[I]) -> None: ...
23
- @overload
24
- def __delitem__(self, idx: int) -> None: ...
25
- @overload
26
- def __delitem__(self, idx: slice) -> None: ...
27
- def __eq__(self, other: object) -> bool: ...
28
- def pushl(self, *items: I) -> None: ...
29
- def pushr(self, *items: I) -> None: ...
30
- def popl(self) -> I: ...
31
- def popr(self) -> I: ...
32
- def popld(self, default: I) -> I: ...
33
- def poprd(self, default: I) -> I: ...
34
- def poplt(self, maximum: int) -> tuple[I, ...]: ...
35
- def poprt(self, maximum: int) -> tuple[I, ...]: ...
36
- def rotl(self, n: int = 1) -> None: ...
37
- def rotr(self, n: int = 1) -> None: ...
38
- def map[U](self, f: Callable[[I], U]) -> CA[U]: ...
39
- @overload
40
- def foldl[L](self, f: Callable[[I, I], I]) -> I: ...
41
- @overload
42
- def foldl[L](self, f: Callable[[L, I], L], start: L) -> L: ...
43
- @overload
44
- def foldr[R](self, f: Callable[[I, I], I]) -> I: ...
45
- @overload
46
- def foldr[R](self, f: Callable[[I, R], R], start: R) -> R: ...
47
- def capacity(self) -> int: ...
48
- def empty(self) -> None: ...
49
- def fraction_filled(self) -> float: ...
50
- def resize(self, minimum_capacity: int = 2) -> None: ...
51
-
52
- def ca[T](*items: T) -> CA[T]: ...
@@ -1,44 +0,0 @@
1
- from collections.abc import Callable, Iterable, Iterator
2
- from typing import overload
3
-
4
- __all__ = ['CAF', 'caf']
5
-
6
- class CAF[I]:
7
- @overload
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: ...
13
- def __iter__(self) -> Iterator[I]: ...
14
- def __reversed__(self) -> Iterator[I]: ...
15
- def __bool__(self) -> bool: ...
16
- def __len__(self) -> int: ...
17
- def __getitem__(self, idx: int) -> I: ...
18
- def __setitem__(self, idx: int, val: I) -> None: ...
19
- def __delitem__(self, idx: int) -> None: ...
20
- def __eq__(self, other: object) -> bool: ...
21
- def pushl(self, item: I) -> None: ...
22
- def pushr(self, item: I) -> None: ...
23
- def popl(self) -> I: ...
24
- def popr(self) -> I: ...
25
- def popld(self, default: I) -> I: ...
26
- def poprd(self, default: I) -> I: ...
27
- def poplt(self, maximum: int) -> tuple[I, ...]: ...
28
- def poprt(self, maximum: int) -> tuple[I, ...]: ...
29
- def rotl(self, n: int = 1) -> None: ...
30
- def rotr(self, n: int = 1) -> None: ...
31
- def map[U](self, f: Callable[[I], U]) -> CAF[U]: ...
32
- @overload
33
- def foldl[L](self, f: Callable[[I, I], I]) -> I: ...
34
- @overload
35
- def foldl[L](self, f: Callable[[L, I], L], start: L) -> L: ...
36
- @overload
37
- def foldr[R](self, f: Callable[[I, I], I]) -> I: ...
38
- @overload
39
- def foldr[R](self, f: Callable[[I, R], R], start: R) -> R: ...
40
- def capacity(self) -> int: ...
41
- def empty(self) -> None: ...
42
- def fraction_filled(self) -> float: ...
43
-
44
- def caf[T](*items: T, capacity: int = 2) -> CAF[T]: ...