evilutils 0.1.0__tar.gz → 0.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: evilutils
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: All of the utils I don't want to write twice.
5
5
  Author-email: Ernest Izdebski <44341687+ernieIzde8ski@users.noreply.github.com>
6
6
  License: Copyright 2025-present Ernest Izdebski
@@ -3,7 +3,7 @@
3
3
  from functools import cache, cached_property, partial, partialmethod, wraps
4
4
 
5
5
  from .compose import compose
6
- from .decorators import immediate, map_result
6
+ from .decorators import immediate
7
7
 
8
8
  __all__ = [
9
9
  "partial",
@@ -13,5 +13,4 @@ __all__ = [
13
13
  "compose",
14
14
  "wraps",
15
15
  "immediate",
16
- "map_result",
17
16
  ]
@@ -0,0 +1,23 @@
1
+ from collections.abc import Callable
2
+ from typing import ParamSpec, TypeVar
3
+
4
+ __all__ = ["immediate"]
5
+
6
+ P = ParamSpec("P")
7
+ RT = TypeVar("RT")
8
+ MT = TypeVar("MT")
9
+
10
+ TT = TypeVar("TT", bound=type)
11
+
12
+
13
+ def immediate(func: Callable[[], RT]) -> RT:
14
+ """Immediately evaluate the given function, returning its output.
15
+
16
+ >>> @immediate
17
+ ... def VALUES():
18
+ ... return (0, 1)
19
+ >>>
20
+ >>> VALUES
21
+ (0, 1)
22
+ """
23
+ return func()
@@ -2,5 +2,5 @@ __author__ = "Ernest Izdebski"
2
2
  __copyright__ = "Copyright 2025-present, Ernest Izdebski"
3
3
  __credits__ = ["Ernest Izdebski"]
4
4
  __license__ = "MIT"
5
- __version__ = "0.1.0"
5
+ __version__ = "0.1.1"
6
6
  __maintainer__ = "Ernest Izdebski"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: evilutils
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: All of the utils I don't want to write twice.
5
5
  Author-email: Ernest Izdebski <44341687+ernieIzde8ski@users.noreply.github.com>
6
6
  License: Copyright 2025-present Ernest Izdebski
@@ -1,44 +0,0 @@
1
- from collections.abc import Callable
2
- from functools import partial
3
- from typing import ParamSpec, TypeVar
4
-
5
- from .compose import compose
6
-
7
- __all__ = ["immediate", "map_result"]
8
-
9
- P = ParamSpec("P")
10
- RT = TypeVar("RT")
11
- MT = TypeVar("MT")
12
-
13
- TT = TypeVar("TT", bound=type)
14
-
15
-
16
- def immediate(func: Callable[[], RT]) -> RT:
17
- """Immediately evaluate the given function, returning its output.
18
-
19
- >>> @immediate
20
- ... def VALUES():
21
- ... return (0, 1)
22
- >>>
23
- >>> VALUES
24
- (0, 1)
25
- """
26
- return func()
27
-
28
-
29
- def map_result(
30
- mapper: Callable[[RT], MT],
31
- ) -> Callable[[Callable[P, RT]], Callable[P, MT]]:
32
- """Map the returned value of a function using another function.
33
-
34
- This is especially designed with generators in mind, though one
35
- could easily find other uses.
36
-
37
- >>> @map_result(tuple)
38
- ... def __generate_values(a: int):
39
- ... yield from (a, 1)
40
- >>>
41
- >>> __generate_values(0)
42
- (0, 1)
43
- """
44
- return partial(compose, mapper)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes