pythonic-fp-gadgets 2.2.0__py3-none-any.whl → 3.0.0__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.
@@ -12,19 +12,21 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- """Simple Gadgets.
15
+ """
16
+ Simple Gadgets
17
+ ==============
16
18
 
17
19
  Library of simple, but useful, functions and classes with minimal dependencies.
18
20
 
19
- +-------------------------------------+-----------------------------------+------------------------------+
20
- | Gadget | Description | Module |
21
- +=====================================+===================================+==============================+
22
- | class ``Box`` | Single item box | ``pythonic_fp.gadgets.box`` |
23
- +-------------------------------------+-----------------------------------+------------------------------+
24
- | function ``it`` | Returns iterator of its arguments | ``pythonic_fp.gadgets.it`` |
25
- +-------------------------------------+-----------------------------------+------------------------------+
26
- | function ``latest_common_ancestor`` | Find least common base class | ``pythonic_fp.gadgets.lca`` |
27
- +-------------------------------------+-----------------------------------+------------------------------+
21
+ +------------------------------+------------------+------------------------------------------------+
22
+ | Description | Gadget | Module |
23
+ +==============================+==================+================================================+
24
+ | Single item box | class ``Box`` | ``pythonic_fp.gadgets.box`` |
25
+ +------------------------------+------------------+------------------------------------------------+
26
+ | Return Iterator of arguments | function ``ita`` | ``pythonic_fp.gadgets.iterate_arguments`` |
27
+ +------------------------------+------------------+------------------------------------------------+
28
+ | Find least common base class | function ``lca`` | ``pythonic_fp.gadgets.latest_common_ancestor`` |
29
+ +------------------------------+------------------+------------------------------------------------+
28
30
 
29
31
  """
30
32
 
@@ -17,11 +17,9 @@
17
17
  __all__ = ['Box']
18
18
 
19
19
  from collections.abc import Callable, Iterator
20
- from typing import ClassVar, cast, Final, Never, overload, TypeVar
20
+ from typing import ClassVar, cast, Final, overload
21
21
  from pythonic_fp.sentinels.flavored import Sentinel
22
22
 
23
- T = TypeVar('T')
24
-
25
23
 
26
24
  class Box[T]:
27
25
  """Container holding at most one item of a given type.
@@ -83,11 +81,11 @@ class Box[T]:
83
81
  return False
84
82
 
85
83
  @overload
86
- def get(self) -> T | Never: ...
84
+ def get(self) -> T: ...
87
85
  @overload
88
86
  def get(self, alt: T) -> T: ...
89
87
 
90
- def get(self, alt: T | Sentinel[str] = Sentinel('_Box')) -> T | Never:
88
+ def get(self, alt: T | Sentinel[str] = Sentinel('_Box')) -> T:
91
89
  """Return the contained item if it exists, otherwise an alternate item.
92
90
 
93
91
  :param alt: an "optional" item of type ``T`` to return if ``Box`` is empty
@@ -102,7 +100,7 @@ class Box[T]:
102
100
  raise ValueError(msg)
103
101
  return cast(T, alt)
104
102
 
105
- def pop(self) -> T | Never:
103
+ def pop(self) -> T:
106
104
  """Pop the contained item if ``Box`` is not empty.
107
105
 
108
106
  :returns: item contained in the ``Box``
@@ -116,7 +114,7 @@ class Box[T]:
116
114
  self._item = self._sentinel
117
115
  return popped
118
116
 
119
- def push(self, item: T) -> None | Never:
117
+ def push(self, item: T) -> None:
120
118
  """Push an item into an empty ``Box``.
121
119
 
122
120
  :param item: Item to push into the empty ``Box``.
@@ -134,7 +132,7 @@ class Box[T]:
134
132
  """Put an item in the Box. Discard any previous contents."""
135
133
  self._item = item
136
134
 
137
- def exchange(self, new_item: T) -> T | Never:
135
+ def exchange(self, new_item: T) -> T:
138
136
  """Exchange an item with what is in the Box.
139
137
 
140
138
  :param ``new_item``: New item to exchange for current item.
@@ -1,14 +1,11 @@
1
1
  from _typeshed import Incomplete
2
2
  from collections.abc import Callable, Iterator
3
- from typing import Never, TypeVar, overload
3
+ from typing import overload
4
4
 
5
5
  __all__ = ['Box']
6
6
 
7
- T = TypeVar('T')
8
-
9
7
  class Box[T]:
10
8
  __match_args__: Incomplete
11
- T = TypeVar('T')
12
9
  @overload
13
10
  def __init__(self) -> None: ...
14
11
  @overload
@@ -18,12 +15,12 @@ class Box[T]:
18
15
  def __len__(self) -> int: ...
19
16
  def __eq__(self, other: object) -> bool: ...
20
17
  @overload
21
- def get(self) -> T | Never: ...
18
+ def get(self) -> T: ...
22
19
  @overload
23
20
  def get(self, alt: T) -> T: ...
24
- def pop(self) -> T | Never: ...
25
- def push(self, item: T) -> None | Never: ...
21
+ def pop(self) -> T: ...
22
+ def push(self, item: T) -> None: ...
26
23
  def put(self, item: T) -> None: ...
27
- def exchange(self, new_item: T) -> T | Never: ...
24
+ def exchange(self, new_item: T) -> T: ...
28
25
  def map[U](self, f: Callable[[T], U]) -> Box[U]: ...
29
26
  def bind[U](self, f: Callable[[T], 'Box[U]']) -> Box[U]: ...
@@ -16,10 +16,10 @@
16
16
 
17
17
  from collections.abc import Iterator
18
18
 
19
- __all__ = ['it']
19
+ __all__ = ['ita']
20
20
 
21
21
 
22
- def it[A](*args: A) -> Iterator[A]:
22
+ def ita[A](*args: A) -> Iterator[A]:
23
23
  """Function returning an iterator of its arguments.
24
24
 
25
25
  .. note::
@@ -0,0 +1,5 @@
1
+ from collections.abc import Iterator
2
+
3
+ __all__ = ['ita']
4
+
5
+ def ita[A](*args: A) -> Iterator[A]: ...
@@ -12,15 +12,14 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- """Lastest Common Ancestor of Two Classes."""
15
+ """Last Common Ancestor of Two Classes."""
16
16
 
17
17
  from inspect import getmro
18
- from typing import Never
19
18
 
20
- __all__ = ['latest_common_ancestor']
19
+ __all__ = ['lca']
21
20
 
22
21
 
23
- def latest_common_ancestor(cls1: type, cls2: type) -> type | Never:
22
+ def lca(cls1: type, cls2: type) -> type:
24
23
  """Find the least upper bound in the inheritance graph
25
24
  of two classes.
26
25
 
@@ -0,0 +1,3 @@
1
+ __all__ = ['lca']
2
+
3
+ def lca(cls1: type, cls2: type) -> type: ...
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonic-fp-gadgets
3
- Version: 2.2.0
4
- Summary: Simple Gadgets.
3
+ Version: 3.0.0
4
+ Summary: Simple Gadgets
5
5
  Keywords: gadgets
6
6
  Author-email: "Geoffrey R. Scheller" <geoffrey@scheller.com>
7
7
  Requires-Python: >=3.13
@@ -26,7 +26,7 @@ Pythonic FP - Gadgets
26
26
  =====================
27
27
 
28
28
  PyPI project
29
- `pythonic-fp
29
+ `pythonic-fp-gadgets
30
30
  <https://pypi.org/project/pythonic-fp>`_.
31
31
 
32
32
  Library of simple, but useful, data structures with minimal dependencies.
@@ -0,0 +1,12 @@
1
+ pythonic_fp/gadgets/__init__.py,sha256=2nrTFkbHHW2ZbbEwmMypXrU5aO70JwLZrQt131pdF7E,1755
2
+ pythonic_fp/gadgets/box.py,sha256=VR_MOCRDH5tyM6BaM7uFcHW-jKqDJlxfb_WbxKuZ6fs,5244
3
+ pythonic_fp/gadgets/box.pyi,sha256=4TAYuLnnxzXsADX8JwblsH-020pYkXJRsPqeDqkK44Q,813
4
+ pythonic_fp/gadgets/iterate_arguments.py,sha256=7gFQgqn8vpBQIxOPYlpAgW26Fyzfjnux3Y2cxHYZuSM,1057
5
+ pythonic_fp/gadgets/iterate_arguments.pyi,sha256=BXyRZUTToIVQls9jpIbRGAtp8PCmZ-onJeKH29UzQkM,98
6
+ pythonic_fp/gadgets/latest_common_ancestor.py,sha256=CHN5q82p8n05XPuA5rTq9gwtOkvuz9U-QMJEqOjlqqM,1689
7
+ pythonic_fp/gadgets/latest_common_ancestor.pyi,sha256=dDta0kOY7T4mjPknJnMWDV9X4pveW4euxi_0V176hbc,64
8
+ pythonic_fp/gadgets/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ pythonic_fp_gadgets-3.0.0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
10
+ pythonic_fp_gadgets-3.0.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
11
+ pythonic_fp_gadgets-3.0.0.dist-info/METADATA,sha256=uWPQwLeEFGtq5Mzsd2dpYd5FVcpDVr61aT33DTmnAYM,1828
12
+ pythonic_fp_gadgets-3.0.0.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- from collections.abc import Iterator
2
-
3
- __all__ = ['it']
4
-
5
- def it[A](*args: A) -> Iterator[A]: ...
@@ -1,5 +0,0 @@
1
- from typing import Never
2
-
3
- __all__ = ['latest_common_ancestor']
4
-
5
- def latest_common_ancestor(cls1: type, cls2: type) -> type | Never: ...
@@ -1,12 +0,0 @@
1
- pythonic_fp/gadgets/__init__.py,sha256=lXVeP7kcS60TErlGUjUCfnZ8uWNF0FAoVTQ5dLHjOB0,1794
2
- pythonic_fp/gadgets/box.py,sha256=_3OA7Idvy7Oce3V8hp1pg8YSG7ch8kq36LVcU7OgHU8,5318
3
- pythonic_fp/gadgets/box.pyi,sha256=yap1syNrDMbO05bi8rltaKtaZssZrKdy7mQ1LXWKNt8,900
4
- pythonic_fp/gadgets/it.py,sha256=Zwk0ZE49sky_LRKwvzKjjv-_64cq7omVT1JZO5irxhI,1055
5
- pythonic_fp/gadgets/it.pyi,sha256=BI_0BuEd5lYSRhx591iUsQbfR2tSAcRiz5jn1Go4ASg,96
6
- pythonic_fp/gadgets/lca.py,sha256=I841udZLmm6WbF7SLI8xHzGCGUKM-QIp1bNHgGycklI,1763
7
- pythonic_fp/gadgets/lca.pyi,sha256=PYWPpmrM7238cpXmYyi5uPlSUsAiYVA0Chgq3VUUbyY,136
8
- pythonic_fp/gadgets/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- pythonic_fp_gadgets-2.2.0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
10
- pythonic_fp_gadgets-2.2.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
11
- pythonic_fp_gadgets-2.2.0.dist-info/METADATA,sha256=ys2SZaA5nNiMrLa_D2WW8uBv6AYXPXpdehJtvcTNbHo,1821
12
- pythonic_fp_gadgets-2.2.0.dist-info/RECORD,,