tofunc 1.0.0__tar.gz → 1.0.1.dev0__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 @@
1
+ include src/tofunc/tests/*.toml
@@ -1,8 +1,8 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: tofunc
3
- Version: 1.0.0
4
- Summary: Convert any callable into a function.
5
- Author-email: Johannes <johannes-programming@mailfence.com>
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
6
  License: The MIT License (MIT)
7
7
 
8
8
  Copyright (c) 2024 Johannes
@@ -24,92 +24,26 @@ License: The MIT License (MIT)
24
24
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
- Project-URL: Documentation, https://pypi.org/project/tofunc
28
27
  Project-URL: Download, https://pypi.org/project/tofunc/#files
29
- Project-URL: Source, https://github.com/johannes-programming/tofunc
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
30
32
  Classifier: Intended Audience :: Developers
31
33
  Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Natural Language :: English
35
+ Classifier: Operating System :: OS Independent
32
36
  Classifier: Programming Language :: Python
33
37
  Classifier: Programming Language :: Python :: 3
34
38
  Classifier: Programming Language :: Python :: 3 :: Only
35
- Requires-Python: >=3.8
39
+ Classifier: Typing :: Typed
40
+ Requires-Python: >=3.11
36
41
  Description-Content-Type: text/x-rst
37
42
  License-File: LICENSE.txt
43
+ Dynamic: license-file
38
44
 
39
45
  ======
40
46
  tofunc
41
47
  ======
42
48
 
43
- Overview
44
- --------
45
-
46
- Convert any callable into a function. Useful to circumvent method binding.
47
-
48
- Installation
49
- ------------
50
-
51
- To install ``tofunc``, you can use ``pip``. Open your terminal and run:
52
-
53
- .. code-block:: bash
54
-
55
- pip install tofunc
56
-
57
- Implementation
58
- --------------
59
-
60
- .. code-block:: python
61
-
62
- import functools
63
-
64
- __all__ = ["tofunc"]
65
-
66
- def tofunc(old, /):
67
- def new(*args, **kwargs):
68
- return old(*args, **kwargs)
69
- try:
70
- new = functools.wraps(old)(new)
71
- except:
72
- pass
73
- return new
74
-
75
- Example
76
- -------
77
-
78
- .. code-block:: python
79
-
80
- from tofunc import tofunc
81
- import functools
82
-
83
- def join(self, b="beta", c="gamma"):
84
- return "%s %s %s" % (self, b, c)
85
-
86
- hello = functools.partial(join, c="hello")
87
- class Foo:
88
- ...
89
- Foo.greet = hello
90
- print(Foo().greet("Alice"))
91
- # Output: Alice beta hello
92
- hello = tofunc(hello)
93
- Foo.greet = hello
94
- print(Foo().greet("Bob"))
95
- # Output: <__main__.Foo object at 0x1443bfce0> Bob hello
96
-
97
- License
98
- -------
99
-
100
- This project is licensed under the MIT License.
101
-
102
- Links
103
- -----
104
-
105
- * `Documentation <https://pypi.org/project/tofunc>`_
106
- * `Download <https://pypi.org/project/tofunc/#files>`_
107
- * `Source <https://github.com/johannes-programming/tofunc>`_
108
-
109
- Credits
110
- -------
111
-
112
- * Author: Johannes
113
- * Email: `johannes-programming@mailfence.com <mailto:johannes-programming@mailfence.com>`_
114
-
115
- Thank you for using ``tofunc``!
49
+ Visit the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_ for more information.
@@ -0,0 +1,5 @@
1
+ ======
2
+ tofunc
3
+ ======
4
+
5
+ Visit the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_ for more information.
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [
4
+ "setuptools>=61.0",
5
+ ]
6
+
7
+ [project]
8
+ authors = [
9
+ { email = "johannes.programming@gmail.com", name = "Johannes" },
10
+ ]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Natural Language :: English",
16
+ "Operating System :: OS Independent",
17
+ "Programming Language :: Python",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Typing :: Typed",
21
+ ]
22
+ dependencies = []
23
+ description = "This project allows converting any callable into a function."
24
+ keywords = []
25
+ name = "tofunc"
26
+ readme = "README.rst"
27
+ requires-python = ">=3.11"
28
+ version = "1.0.1.dev0"
29
+
30
+ [project.license]
31
+ file = "LICENSE.txt"
32
+
33
+ [project.urls]
34
+ Download = "https://pypi.org/project/tofunc/#files"
35
+ Index = "https://pypi.org/project/tofunc/"
36
+ Source = "https://github.com/johannes-programming/tofunc/"
37
+ Website = "https://tofunc.johannes-programming.online/"
@@ -0,0 +1,2 @@
1
+ from tofunc.core import *
2
+ from tofunc.tests import *
@@ -0,0 +1,17 @@
1
+ import functools
2
+ import types
3
+ from typing import *
4
+
5
+ __all__ = ["tofunc"]
6
+
7
+
8
+ def tofunc(old: Callable, /) -> types.FunctionType:
9
+ def new(*args: Any, **kwargs: Any) -> Any:
10
+ return old(*args, **kwargs)
11
+
12
+ ans: types.FunctionType
13
+ try:
14
+ ans = functools.wraps(old)(new)
15
+ except:
16
+ ans = new
17
+ return ans
@@ -0,0 +1,12 @@
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,22 +1,24 @@
1
1
  import functools
2
+ import types
2
3
  import unittest
4
+ from typing import *
3
5
 
4
6
  from tofunc import tofunc
5
7
 
6
8
 
7
9
  class TestHello(unittest.TestCase):
8
- def test_hello(self):
9
- def join(self, b="beta", c="gamma"):
10
+ def test_hello(self: Self) -> None:
11
+ def join(self: Self, b: Any = "beta", c: Any = "gamma") -> str:
10
12
  return "%s %s %s" % (self, b, c)
11
13
 
12
14
  class Foo: ...
13
15
 
14
- hello = functools.partial(join, c="hello")
16
+ hello: functools.partial = functools.partial(join, c="hello")
15
17
  Foo.greet = hello
16
18
  self.assertEqual(Foo().greet("Alice"), "Alice beta hello")
17
- hello = tofunc(hello)
19
+ hello: types.FunctionType = tofunc(hello)
18
20
  Foo.greet = hello
19
- text = Foo().greet("Bob")
21
+ text: str = Foo().greet("Bob")
20
22
  self.assertTrue(text.endswith("Bob hello"))
21
23
  self.assertTrue("Foo" in text)
22
24
 
@@ -1,8 +1,8 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: tofunc
3
- Version: 1.0.0
4
- Summary: Convert any callable into a function.
5
- Author-email: Johannes <johannes-programming@mailfence.com>
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
6
  License: The MIT License (MIT)
7
7
 
8
8
  Copyright (c) 2024 Johannes
@@ -24,92 +24,26 @@ License: The MIT License (MIT)
24
24
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
- Project-URL: Documentation, https://pypi.org/project/tofunc
28
27
  Project-URL: Download, https://pypi.org/project/tofunc/#files
29
- Project-URL: Source, https://github.com/johannes-programming/tofunc
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
30
32
  Classifier: Intended Audience :: Developers
31
33
  Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Natural Language :: English
35
+ Classifier: Operating System :: OS Independent
32
36
  Classifier: Programming Language :: Python
33
37
  Classifier: Programming Language :: Python :: 3
34
38
  Classifier: Programming Language :: Python :: 3 :: Only
35
- Requires-Python: >=3.8
39
+ Classifier: Typing :: Typed
40
+ Requires-Python: >=3.11
36
41
  Description-Content-Type: text/x-rst
37
42
  License-File: LICENSE.txt
43
+ Dynamic: license-file
38
44
 
39
45
  ======
40
46
  tofunc
41
47
  ======
42
48
 
43
- Overview
44
- --------
45
-
46
- Convert any callable into a function. Useful to circumvent method binding.
47
-
48
- Installation
49
- ------------
50
-
51
- To install ``tofunc``, you can use ``pip``. Open your terminal and run:
52
-
53
- .. code-block:: bash
54
-
55
- pip install tofunc
56
-
57
- Implementation
58
- --------------
59
-
60
- .. code-block:: python
61
-
62
- import functools
63
-
64
- __all__ = ["tofunc"]
65
-
66
- def tofunc(old, /):
67
- def new(*args, **kwargs):
68
- return old(*args, **kwargs)
69
- try:
70
- new = functools.wraps(old)(new)
71
- except:
72
- pass
73
- return new
74
-
75
- Example
76
- -------
77
-
78
- .. code-block:: python
79
-
80
- from tofunc import tofunc
81
- import functools
82
-
83
- def join(self, b="beta", c="gamma"):
84
- return "%s %s %s" % (self, b, c)
85
-
86
- hello = functools.partial(join, c="hello")
87
- class Foo:
88
- ...
89
- Foo.greet = hello
90
- print(Foo().greet("Alice"))
91
- # Output: Alice beta hello
92
- hello = tofunc(hello)
93
- Foo.greet = hello
94
- print(Foo().greet("Bob"))
95
- # Output: <__main__.Foo object at 0x1443bfce0> Bob hello
96
-
97
- License
98
- -------
99
-
100
- This project is licensed under the MIT License.
101
-
102
- Links
103
- -----
104
-
105
- * `Documentation <https://pypi.org/project/tofunc>`_
106
- * `Download <https://pypi.org/project/tofunc/#files>`_
107
- * `Source <https://github.com/johannes-programming/tofunc>`_
108
-
109
- Credits
110
- -------
111
-
112
- * Author: Johannes
113
- * Email: `johannes-programming@mailfence.com <mailto:johannes-programming@mailfence.com>`_
114
-
115
- Thank you for using ``tofunc``!
49
+ Visit the website `https://tofunc.johannes-programming.online/ <https://tofunc.johannes-programming.online/>`_ for more information.
@@ -8,5 +8,6 @@ src/tofunc.egg-info/PKG-INFO
8
8
  src/tofunc.egg-info/SOURCES.txt
9
9
  src/tofunc.egg-info/dependency_links.txt
10
10
  src/tofunc.egg-info/top_level.txt
11
+ src/tofunc/core/__init__.py
11
12
  src/tofunc/tests/__init__.py
12
13
  src/tofunc/tests/test_hello.py
tofunc-1.0.0/MANIFEST.in DELETED
File without changes
tofunc-1.0.0/README.rst DELETED
@@ -1,77 +0,0 @@
1
- ======
2
- tofunc
3
- ======
4
-
5
- Overview
6
- --------
7
-
8
- Convert any callable into a function. Useful to circumvent method binding.
9
-
10
- Installation
11
- ------------
12
-
13
- To install ``tofunc``, you can use ``pip``. Open your terminal and run:
14
-
15
- .. code-block:: bash
16
-
17
- pip install tofunc
18
-
19
- Implementation
20
- --------------
21
-
22
- .. code-block:: python
23
-
24
- import functools
25
-
26
- __all__ = ["tofunc"]
27
-
28
- def tofunc(old, /):
29
- def new(*args, **kwargs):
30
- return old(*args, **kwargs)
31
- try:
32
- new = functools.wraps(old)(new)
33
- except:
34
- pass
35
- return new
36
-
37
- Example
38
- -------
39
-
40
- .. code-block:: python
41
-
42
- from tofunc import tofunc
43
- import functools
44
-
45
- def join(self, b="beta", c="gamma"):
46
- return "%s %s %s" % (self, b, c)
47
-
48
- hello = functools.partial(join, c="hello")
49
- class Foo:
50
- ...
51
- Foo.greet = hello
52
- print(Foo().greet("Alice"))
53
- # Output: Alice beta hello
54
- hello = tofunc(hello)
55
- Foo.greet = hello
56
- print(Foo().greet("Bob"))
57
- # Output: <__main__.Foo object at 0x1443bfce0> Bob hello
58
-
59
- License
60
- -------
61
-
62
- This project is licensed under the MIT License.
63
-
64
- Links
65
- -----
66
-
67
- * `Documentation <https://pypi.org/project/tofunc>`_
68
- * `Download <https://pypi.org/project/tofunc/#files>`_
69
- * `Source <https://github.com/johannes-programming/tofunc>`_
70
-
71
- Credits
72
- -------
73
-
74
- * Author: Johannes
75
- * Email: `johannes-programming@mailfence.com <mailto:johannes-programming@mailfence.com>`_
76
-
77
- Thank you for using ``tofunc``!
@@ -1,32 +0,0 @@
1
- [build-system]
2
- build-backend = "setuptools.build_meta"
3
- requires = [
4
- "setuptools>=61.0.0",
5
- ]
6
-
7
- [project]
8
- authors = [
9
- { email = "johannes-programming@mailfence.com", name = "Johannes" },
10
- ]
11
- classifiers = [
12
- "Intended Audience :: Developers",
13
- "License :: OSI Approved :: MIT License",
14
- "Programming Language :: Python",
15
- "Programming Language :: Python :: 3",
16
- "Programming Language :: Python :: 3 :: Only",
17
- ]
18
- dependencies = []
19
- description = "Convert any callable into a function."
20
- keywords = []
21
- name = "tofunc"
22
- readme = "README.rst"
23
- requires-python = ">=3.8"
24
- version = "1.0.0"
25
-
26
- [project.license]
27
- file = "LICENSE.txt"
28
-
29
- [project.urls]
30
- Documentation = "https://pypi.org/project/tofunc"
31
- Download = "https://pypi.org/project/tofunc/#files"
32
- Source = "https://github.com/johannes-programming/tofunc"
@@ -1,14 +0,0 @@
1
- import functools
2
-
3
- __all__ = ["tofunc"]
4
-
5
-
6
- def tofunc(old, /):
7
- def new(*args, **kwargs):
8
- return old(*args, **kwargs)
9
-
10
- try:
11
- new = functools.wraps(old)(new)
12
- except:
13
- pass
14
- return new
File without changes
File without changes
File without changes