tofunc 1.0.1.dev0__tar.gz → 1.0.3__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.
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/LICENSE.txt +1 -1
- tofunc-1.0.3/MANIFEST.in +2 -0
- tofunc-1.0.3/PKG-INFO +30 -0
- tofunc-1.0.3/README.rst +7 -0
- tofunc-1.0.3/docs/v1.0.rst +60 -0
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/pyproject.toml +14 -7
- tofunc-1.0.3/src/tofunc/__init__.py +1 -0
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/src/tofunc/core/__init__.py +2 -2
- tofunc-1.0.3/src/tofunc/py.typed +0 -0
- tofunc-1.0.3/src/tofunc/tests/__init__.py +12 -0
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/src/tofunc/tests/test_hello.py +14 -6
- tofunc-1.0.3/src/tofunc.egg-info/PKG-INFO +30 -0
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/src/tofunc.egg-info/SOURCES.txt +2 -0
- tofunc-1.0.1.dev0/MANIFEST.in +0 -1
- tofunc-1.0.1.dev0/PKG-INFO +0 -49
- tofunc-1.0.1.dev0/README.rst +0 -5
- tofunc-1.0.1.dev0/src/tofunc/__init__.py +0 -2
- tofunc-1.0.1.dev0/src/tofunc/tests/__init__.py +0 -12
- tofunc-1.0.1.dev0/src/tofunc.egg-info/PKG-INFO +0 -49
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/setup.cfg +0 -0
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/src/tofunc.egg-info/dependency_links.txt +0 -0
- {tofunc-1.0.1.dev0 → tofunc-1.0.3}/src/tofunc.egg-info/top_level.txt +0 -0
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
tofunc-1.0.3/MANIFEST.in
ADDED
tofunc-1.0.3/PKG-INFO
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tofunc
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: This project allows converting any callable into a function.
|
|
5
|
+
Author-email: Johannes <johannes.programming@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Download, https://pypi.org/project/tofunc/#files
|
|
8
|
+
Project-URL: Index, https://pypi.org/project/tofunc/
|
|
9
|
+
Project-URL: Source, https://github.com/johannes-programming/tofunc/
|
|
10
|
+
Project-URL: Website, https://tofunc.johannes-programming.online/
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/x-rst
|
|
21
|
+
License-File: LICENSE.txt
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
======
|
|
25
|
+
tofunc
|
|
26
|
+
======
|
|
27
|
+
|
|
28
|
+
Each minor version has its own documentation.
|
|
29
|
+
These docs can be found as rst-files in the ``docs/`` directory of this project.
|
|
30
|
+
They can also be viewed on the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_.
|
tofunc-1.0.3/README.rst
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
======
|
|
2
|
+
tofunc
|
|
3
|
+
======
|
|
4
|
+
|
|
5
|
+
Each minor version has its own documentation.
|
|
6
|
+
These docs can be found as rst-files in the ``docs/`` directory of this project.
|
|
7
|
+
They can also be viewed on the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Overview
|
|
2
|
+
--------
|
|
3
|
+
|
|
4
|
+
This project allows converting any callable into a function.
|
|
5
|
+
|
|
6
|
+
Installation
|
|
7
|
+
------------
|
|
8
|
+
|
|
9
|
+
To install ``tofunc``, you can use ``pip``.
|
|
10
|
+
Open your terminal and run:
|
|
11
|
+
|
|
12
|
+
.. code-block:: shell
|
|
13
|
+
|
|
14
|
+
pip install tofunc
|
|
15
|
+
|
|
16
|
+
Typing
|
|
17
|
+
------
|
|
18
|
+
|
|
19
|
+
This project is (not strictly) typed with ``mypy``.
|
|
20
|
+
|
|
21
|
+
Features
|
|
22
|
+
--------
|
|
23
|
+
|
|
24
|
+
``tofunc.tofunc(old: Callable, /) -> types.FunctionType``
|
|
25
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
26
|
+
|
|
27
|
+
This function returns a new function that is wrapped around the given old callable.
|
|
28
|
+
|
|
29
|
+
``tofunc.tests.test() -> unittest.TextTestResult``
|
|
30
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
31
|
+
|
|
32
|
+
This project can be tested through its ``test`` function.
|
|
33
|
+
|
|
34
|
+
.. code-block:: python
|
|
35
|
+
|
|
36
|
+
import tofunc.tests
|
|
37
|
+
tofunc.tests.test()
|
|
38
|
+
|
|
39
|
+
License
|
|
40
|
+
-------
|
|
41
|
+
|
|
42
|
+
This project is licensed under the MIT License.
|
|
43
|
+
|
|
44
|
+
Links
|
|
45
|
+
-----
|
|
46
|
+
|
|
47
|
+
- Download: https://pypi.org/project/tofunc/#files
|
|
48
|
+
- Index: https://pypi.org/project/tofunc/
|
|
49
|
+
- Source: https://github.com/johannes-programming/tofunc/
|
|
50
|
+
- Website: https://tofunc.johannes-programming.online/
|
|
51
|
+
|
|
52
|
+
Impressum
|
|
53
|
+
---------
|
|
54
|
+
|
|
55
|
+
**Johannes Programming**
|
|
56
|
+
|
|
57
|
+
- Name: Johannes
|
|
58
|
+
- Email: johannes.programming@gmail.com
|
|
59
|
+
- Homepage: https://www.johannes-programming.online/
|
|
60
|
+
- Gravatar: https://www.johannes-programming.fyi/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
build-backend = "setuptools.build_meta"
|
|
3
3
|
requires = [
|
|
4
|
-
"setuptools>=
|
|
4
|
+
"setuptools>=77.0",
|
|
5
5
|
]
|
|
6
6
|
|
|
7
7
|
[project]
|
|
@@ -9,9 +9,8 @@ authors = [
|
|
|
9
9
|
{ email = "johannes.programming@gmail.com", name = "Johannes" },
|
|
10
10
|
]
|
|
11
11
|
classifiers = [
|
|
12
|
-
"Development Status ::
|
|
12
|
+
"Development Status :: 5 - Production/Stable",
|
|
13
13
|
"Intended Audience :: Developers",
|
|
14
|
-
"License :: OSI Approved :: MIT License",
|
|
15
14
|
"Natural Language :: English",
|
|
16
15
|
"Operating System :: OS Independent",
|
|
17
16
|
"Programming Language :: Python",
|
|
@@ -22,16 +21,24 @@ classifiers = [
|
|
|
22
21
|
dependencies = []
|
|
23
22
|
description = "This project allows converting any callable into a function."
|
|
24
23
|
keywords = []
|
|
24
|
+
license = "MIT"
|
|
25
|
+
license-files = [
|
|
26
|
+
"LICENSE.txt",
|
|
27
|
+
]
|
|
25
28
|
name = "tofunc"
|
|
26
29
|
readme = "README.rst"
|
|
27
30
|
requires-python = ">=3.11"
|
|
28
|
-
version = "1.0.
|
|
29
|
-
|
|
30
|
-
[project.license]
|
|
31
|
-
file = "LICENSE.txt"
|
|
31
|
+
version = "1.0.3"
|
|
32
32
|
|
|
33
33
|
[project.urls]
|
|
34
34
|
Download = "https://pypi.org/project/tofunc/#files"
|
|
35
35
|
Index = "https://pypi.org/project/tofunc/"
|
|
36
36
|
Source = "https://github.com/johannes-programming/tofunc/"
|
|
37
37
|
Website = "https://tofunc.johannes-programming.online/"
|
|
38
|
+
|
|
39
|
+
[tool.mypy]
|
|
40
|
+
files = [
|
|
41
|
+
".",
|
|
42
|
+
]
|
|
43
|
+
python_version = "3.11"
|
|
44
|
+
strict = false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from tofunc.core import tofunc
|
|
@@ -9,9 +9,9 @@ def tofunc(old: Callable, /) -> types.FunctionType:
|
|
|
9
9
|
def new(*args: Any, **kwargs: Any) -> Any:
|
|
10
10
|
return old(*args, **kwargs)
|
|
11
11
|
|
|
12
|
-
ans:
|
|
12
|
+
ans: Any
|
|
13
13
|
try:
|
|
14
14
|
ans = functools.wraps(old)(new)
|
|
15
|
-
except:
|
|
15
|
+
except BaseException:
|
|
16
16
|
ans = new
|
|
17
17
|
return ans
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
__all__ = ["test"]
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test() -> unittest.TextTestResult:
|
|
7
|
+
"This function runs all the tests."
|
|
8
|
+
loader: unittest.TestLoader
|
|
9
|
+
suite: unittest.TestSuite
|
|
10
|
+
loader = unittest.TestLoader()
|
|
11
|
+
suite = loader.discover(start_dir="tofunc.tests")
|
|
12
|
+
return unittest.TextTestRunner().run(suite)
|
|
@@ -5,19 +5,27 @@ from typing import *
|
|
|
5
5
|
|
|
6
6
|
from tofunc import tofunc
|
|
7
7
|
|
|
8
|
+
__all__ = ["TestHello"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Bar:
|
|
12
|
+
def join(self: Self, b: Any = "beta", c: Any = "gamma") -> str:
|
|
13
|
+
return "%s %s %s" % (self, b, c)
|
|
14
|
+
|
|
8
15
|
|
|
9
16
|
class TestHello(unittest.TestCase):
|
|
10
17
|
def test_hello(self: Self) -> None:
|
|
11
|
-
def join(self: Self, b: Any = "beta", c: Any = "gamma") -> str:
|
|
12
|
-
return "%s %s %s" % (self, b, c)
|
|
13
18
|
|
|
14
|
-
class Foo:
|
|
19
|
+
class Foo:
|
|
20
|
+
greet: Any
|
|
15
21
|
|
|
16
|
-
hello: functools.partial
|
|
22
|
+
hello: functools.partial
|
|
23
|
+
hello_: types.FunctionType
|
|
24
|
+
hello = functools.partial(Bar.join, c="hello")
|
|
17
25
|
Foo.greet = hello
|
|
18
26
|
self.assertEqual(Foo().greet("Alice"), "Alice beta hello")
|
|
19
|
-
|
|
20
|
-
Foo.greet =
|
|
27
|
+
hello_ = tofunc(hello)
|
|
28
|
+
Foo.greet = hello_
|
|
21
29
|
text: str = Foo().greet("Bob")
|
|
22
30
|
self.assertTrue(text.endswith("Bob hello"))
|
|
23
31
|
self.assertTrue("Foo" in text)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tofunc
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: This project allows converting any callable into a function.
|
|
5
|
+
Author-email: Johannes <johannes.programming@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Download, https://pypi.org/project/tofunc/#files
|
|
8
|
+
Project-URL: Index, https://pypi.org/project/tofunc/
|
|
9
|
+
Project-URL: Source, https://github.com/johannes-programming/tofunc/
|
|
10
|
+
Project-URL: Website, https://tofunc.johannes-programming.online/
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Description-Content-Type: text/x-rst
|
|
21
|
+
License-File: LICENSE.txt
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
======
|
|
25
|
+
tofunc
|
|
26
|
+
======
|
|
27
|
+
|
|
28
|
+
Each minor version has its own documentation.
|
|
29
|
+
These docs can be found as rst-files in the ``docs/`` directory of this project.
|
|
30
|
+
They can also be viewed on the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_.
|
tofunc-1.0.1.dev0/MANIFEST.in
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include src/tofunc/tests/*.toml
|
tofunc-1.0.1.dev0/PKG-INFO
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tofunc
|
|
3
|
-
Version: 1.0.1.dev0
|
|
4
|
-
Summary: This project allows converting any callable into a function.
|
|
5
|
-
Author-email: Johannes <johannes.programming@gmail.com>
|
|
6
|
-
License: The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024 Johannes
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
Project-URL: Download, https://pypi.org/project/tofunc/#files
|
|
28
|
-
Project-URL: Index, https://pypi.org/project/tofunc/
|
|
29
|
-
Project-URL: Source, https://github.com/johannes-programming/tofunc/
|
|
30
|
-
Project-URL: Website, https://tofunc.johannes-programming.online/
|
|
31
|
-
Classifier: Development Status :: 3 - Alpha
|
|
32
|
-
Classifier: Intended Audience :: Developers
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Natural Language :: English
|
|
35
|
-
Classifier: Operating System :: OS Independent
|
|
36
|
-
Classifier: Programming Language :: Python
|
|
37
|
-
Classifier: Programming Language :: Python :: 3
|
|
38
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
39
|
-
Classifier: Typing :: Typed
|
|
40
|
-
Requires-Python: >=3.11
|
|
41
|
-
Description-Content-Type: text/x-rst
|
|
42
|
-
License-File: LICENSE.txt
|
|
43
|
-
Dynamic: license-file
|
|
44
|
-
|
|
45
|
-
======
|
|
46
|
-
tofunc
|
|
47
|
-
======
|
|
48
|
-
|
|
49
|
-
Visit the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_ for more information.
|
tofunc-1.0.1.dev0/README.rst
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import unittest
|
|
2
|
-
|
|
3
|
-
__all__ = ["test"]
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def test() -> unittest.TextTestRunner:
|
|
7
|
-
"This function runs all the tests."
|
|
8
|
-
loader: unittest.TestLoader = unittest.TestLoader()
|
|
9
|
-
tests: unittest.TestSuite = loader.discover(start_dir="tofunc.tests")
|
|
10
|
-
runner: unittest.TextTestRunner = unittest.TextTestRunner()
|
|
11
|
-
result: unittest.TextTestResult = runner.run(tests)
|
|
12
|
-
return result
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tofunc
|
|
3
|
-
Version: 1.0.1.dev0
|
|
4
|
-
Summary: This project allows converting any callable into a function.
|
|
5
|
-
Author-email: Johannes <johannes.programming@gmail.com>
|
|
6
|
-
License: The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024 Johannes
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
Project-URL: Download, https://pypi.org/project/tofunc/#files
|
|
28
|
-
Project-URL: Index, https://pypi.org/project/tofunc/
|
|
29
|
-
Project-URL: Source, https://github.com/johannes-programming/tofunc/
|
|
30
|
-
Project-URL: Website, https://tofunc.johannes-programming.online/
|
|
31
|
-
Classifier: Development Status :: 3 - Alpha
|
|
32
|
-
Classifier: Intended Audience :: Developers
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Natural Language :: English
|
|
35
|
-
Classifier: Operating System :: OS Independent
|
|
36
|
-
Classifier: Programming Language :: Python
|
|
37
|
-
Classifier: Programming Language :: Python :: 3
|
|
38
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
39
|
-
Classifier: Typing :: Typed
|
|
40
|
-
Requires-Python: >=3.11
|
|
41
|
-
Description-Content-Type: text/x-rst
|
|
42
|
-
License-File: LICENSE.txt
|
|
43
|
-
Dynamic: license-file
|
|
44
|
-
|
|
45
|
-
======
|
|
46
|
-
tofunc
|
|
47
|
-
======
|
|
48
|
-
|
|
49
|
-
Visit the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_ for more information.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|