evilutils 0.1.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.
@@ -0,0 +1,7 @@
1
+ Copyright 2025-present Ernest Izdebski
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include src/*/py.typed
2
+ include requirements.txt
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.2
2
+ Name: evilutils
3
+ Version: 0.1.0
4
+ Summary: All of the utils I don't want to write twice.
5
+ Author-email: Ernest Izdebski <44341687+ernieIzde8ski@users.noreply.github.com>
6
+ License: Copyright 2025-present Ernest Izdebski
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+
14
+ Project-URL: Homepage, https://github.com/ernieIzde8ski/evilutils
15
+ Project-URL: Issues, https://github.com/ernieIzde8ski/evilutils/issues
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: typing_extensions>=4.12.2
23
+
24
+ # evilutils
25
+
26
+ All of the utils I don't want to write twice.
27
+
28
+ ## Development
29
+
30
+ This project uses [`pre-commit`](https://pre-commit.com) for formatting purposes
31
+ and `make` for compilation purposes. See `Makefile` for available rules.
@@ -0,0 +1,8 @@
1
+ # evilutils
2
+
3
+ All of the utils I don't want to write twice.
4
+
5
+ ## Development
6
+
7
+ This project uses [`pre-commit`](https://pre-commit.com) for formatting purposes
8
+ and `make` for compilation purposes. See `Makefile` for available rules.
@@ -0,0 +1,55 @@
1
+ # dev tools
2
+ [tool.ruff]
3
+ line-length = 90
4
+ indent-width = 4
5
+ target-version = "py312"
6
+
7
+ [tool.ruff.format]
8
+ docstring-code-format = true
9
+ line-ending = "lf"
10
+ skip-magic-trailing-comma = true
11
+
12
+ [tool.isort]
13
+ profile = "black"
14
+ line_length = 90
15
+
16
+ [tool.black]
17
+ line-length = 90
18
+ target-version = ["py312", "py313"]
19
+ skip-magic-trailing-comma = true
20
+
21
+ [tool.basedpyright]
22
+ reportImplicitStringConcatenation = false
23
+ pythonVersion = "3.12"
24
+
25
+ # packaging
26
+ [build-system]
27
+ requires = ["setuptools>=61.0"]
28
+ build-backend = "setuptools.build_meta"
29
+
30
+ [project]
31
+ name = "evilutils"
32
+ authors = [
33
+ { name="Ernest Izdebski", email="44341687+ernieIzde8ski@users.noreply.github.com" }
34
+ ]
35
+ description = "All of the utils I don't want to write twice."
36
+ readme = { file = "README.md", content-type="text/markdown" }
37
+ requires-python = ">=3.12"
38
+ classifiers = [
39
+ "Programming Language :: Python :: 3",
40
+ "License :: OSI Approved :: MIT License",
41
+ "Operating System :: OS Independent",
42
+ ]
43
+ dynamic = ["dependencies", "version"]
44
+ license = { file = "LICENSE" }
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/ernieIzde8ski/evilutils"
48
+ Issues = "https://github.com/ernieIzde8ski/evilutils/issues"
49
+
50
+ [tool.setuptools.dynamic]
51
+ dependencies = { file = "requirements.txt" }
52
+ version = { attr = "evilutils.__version__" }
53
+
54
+ [tool.setuptools.packages.find]
55
+ where = ["src"]
@@ -0,0 +1 @@
1
+ typing_extensions>=4.12.2
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,17 @@
1
+ """Extensions upon the `functools` library."""
2
+
3
+ from functools import cache, cached_property, partial, partialmethod, wraps
4
+
5
+ from .compose import compose
6
+ from .decorators import immediate, map_result
7
+
8
+ __all__ = [
9
+ "partial",
10
+ "partialmethod",
11
+ "cache",
12
+ "cached_property",
13
+ "compose",
14
+ "wraps",
15
+ "immediate",
16
+ "map_result",
17
+ ]
@@ -0,0 +1,58 @@
1
+ from collections.abc import Callable
2
+ from functools import partial, wraps
3
+ from typing import overload
4
+
5
+ __all__ = ["compose"]
6
+
7
+ type Fn[_AT, _RT] = Callable[[_AT], _RT]
8
+
9
+ type PartialComposition[**P, RT, MT] = Callable[[Callable[P, RT]], Callable[P, MT]]
10
+ type AnyComposition[**P, RT, MT] = Callable[P, MT] | PartialComposition[P, RT, MT]
11
+
12
+
13
+ @overload
14
+ def compose[**P, RT, MT](F: Fn[RT, MT]) -> PartialComposition[P, RT, MT]:
15
+ """
16
+ A partial composition of F. This overload can be used as a decorator.
17
+ """
18
+ ...
19
+
20
+
21
+ @overload
22
+ def compose[**P, RT, MT](F: Fn[RT, MT], G: Callable[P, RT]) -> Callable[P, MT]:
23
+ """
24
+ A composition `F o G`.
25
+
26
+ See also: `Function composition`_
27
+
28
+ .. Function composition: https://en.wikipedia.org/wiki/Function_composition_(computer_science)
29
+ """
30
+ ...
31
+
32
+
33
+ def compose[**P, RT, MT](
34
+ F: Fn[RT, MT], G: Callable[P, RT] | None = None
35
+ ) -> AnyComposition[P, RT, MT]:
36
+ """
37
+ >>> double = lambda n: n * 2
38
+ >>> @compose(double)
39
+ ... def two() -> int:
40
+ ... return 1
41
+ >>>
42
+ >>> two()
43
+ 2
44
+
45
+ >>> plus_one = lambda n: n + 1
46
+ >>> plus_two = compose(plus_one, plus_one)
47
+ >>> plus_two(2)
48
+ 4
49
+ """
50
+
51
+ if G is None:
52
+ return partial(compose, F)
53
+
54
+ @wraps(G)
55
+ def composition(*args: P.args, **kwargs: P.kwargs) -> MT:
56
+ return F(G(*args, **kwargs))
57
+
58
+ return composition
@@ -0,0 +1,44 @@
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
@@ -0,0 +1,23 @@
1
+ """
2
+ All of the utils I don't want to write twice.
3
+
4
+ Note that this package is a dummy package. Use the other packages.
5
+ """
6
+
7
+ from .info import (
8
+ __author__,
9
+ __copyright__,
10
+ __credits__,
11
+ __license__,
12
+ __maintainer__,
13
+ __version__,
14
+ )
15
+
16
+ __all__ = [
17
+ "__author__",
18
+ "__copyright__",
19
+ "__credits__",
20
+ "__license__",
21
+ "__version__",
22
+ "__maintainer__",
23
+ ]
@@ -0,0 +1,4 @@
1
+ from .info import __copyright__, __version__
2
+
3
+ print(f"{__package__} v{__version__}")
4
+ print(__copyright__)
@@ -0,0 +1,6 @@
1
+ __author__ = "Ernest Izdebski"
2
+ __copyright__ = "Copyright 2025-present, Ernest Izdebski"
3
+ __credits__ = ["Ernest Izdebski"]
4
+ __license__ = "MIT"
5
+ __version__ = "0.1.0"
6
+ __maintainer__ = "Ernest Izdebski"
File without changes
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.2
2
+ Name: evilutils
3
+ Version: 0.1.0
4
+ Summary: All of the utils I don't want to write twice.
5
+ Author-email: Ernest Izdebski <44341687+ernieIzde8ski@users.noreply.github.com>
6
+ License: Copyright 2025-present Ernest Izdebski
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+
14
+ Project-URL: Homepage, https://github.com/ernieIzde8ski/evilutils
15
+ Project-URL: Issues, https://github.com/ernieIzde8ski/evilutils/issues
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: typing_extensions>=4.12.2
23
+
24
+ # evilutils
25
+
26
+ All of the utils I don't want to write twice.
27
+
28
+ ## Development
29
+
30
+ This project uses [`pre-commit`](https://pre-commit.com) for formatting purposes
31
+ and `make` for compilation purposes. See `Makefile` for available rules.
@@ -0,0 +1,18 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ requirements.txt
6
+ src/evilfunctools/__init__.py
7
+ src/evilfunctools/compose.py
8
+ src/evilfunctools/decorators.py
9
+ src/evilfunctools/py.typed
10
+ src/evilutils/__init__.py
11
+ src/evilutils/__main__.py
12
+ src/evilutils/info.py
13
+ src/evilutils/py.typed
14
+ src/evilutils.egg-info/PKG-INFO
15
+ src/evilutils.egg-info/SOURCES.txt
16
+ src/evilutils.egg-info/dependency_links.txt
17
+ src/evilutils.egg-info/requires.txt
18
+ src/evilutils.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ typing_extensions>=4.12.2
@@ -0,0 +1,2 @@
1
+ evilfunctools
2
+ evilutils