setdoc 1.1.0__tar.gz → 1.1.2__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.
@@ -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.
@@ -0,0 +1,2 @@
1
+ recursive-include docs *.rst
2
+ recursive-include src/setdoc *.toml
setdoc-1.1.2/PKG-INFO ADDED
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: setdoc
3
+ Version: 1.1.2
4
+ Summary: This project helps to set the doc string.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Download, https://pypi.org/project/setdoc/#files
8
+ Project-URL: Index, https://pypi.org/project/setdoc/
9
+ Project-URL: Source, https://github.com/johannes-programming/setdoc/
10
+ Project-URL: Website, https://setdoc.johannes-programming.online/
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE.txt
21
+ Dynamic: license-file
22
+
23
+ ======
24
+ setdoc
25
+ ======
26
+
27
+ Each minor version has its own documentation.
28
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
29
+ They can also be viewed on the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_.
@@ -0,0 +1,7 @@
1
+ ======
2
+ setdoc
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://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_.
@@ -0,0 +1,106 @@
1
+ Introduction
2
+ ------------
3
+
4
+ This project helps to set the doc string.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ To install ``setdoc``, you can use ``pip``.
10
+ Open your terminal and run:
11
+
12
+ .. code-block:: shell
13
+
14
+ pip install setdoc
15
+
16
+ Typing
17
+ ------
18
+
19
+ This project is (not strictly) typed in accordance with ``mypy``.
20
+
21
+ Features
22
+ --------
23
+
24
+ ``class setdoc.SetDoc(doc: Any)``
25
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
+
27
+ The instances of this ``dataclass`` work as decorators
28
+ that set the docstring of the decorated ``target`` to ``doc``.
29
+
30
+ Usage:
31
+
32
+ .. code-block:: python
33
+
34
+ from typing import *
35
+ from setdoc import SetDoc
36
+
37
+ # Create a setdoc instance with the desired docstring
38
+ doc_updater: SetDoc
39
+ doc_updater = SetDoc("This function adds two numbers.")
40
+
41
+ # Apply it to a target function
42
+ @doc_updater
43
+ def add(a: int, b: int) -> int:
44
+ return a + b
45
+
46
+ # The function now has an updated docstring
47
+ print(add.__doc__)
48
+ # Output: This function adds two numbers.
49
+
50
+ # Apply it directly to another target function
51
+ @SetDoc("This function multiplies two numbers.")
52
+ def mul(a: int, b: int) -> int:
53
+ return a * b
54
+
55
+ # The function now has an updated docstring
56
+ print(mul.__doc__)
57
+ # Output: This function multiplies two numbers.
58
+
59
+ ``__call__(target: Any) -> Any``
60
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
+
62
+ This magic method implements calling the current instance.
63
+ It sets ``target.__doc__`` to ``doc``.
64
+
65
+ ``doc: Any``
66
+ ^^^^^^^^^^^^
67
+
68
+ This value that is used for ``__doc__``.
69
+
70
+ ``setdoc.setdoc = setdoc.SetDoc``
71
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
+
73
+ This module variable is alias for ``SetDoc`` included for legacy.
74
+
75
+ ``setdoc.tests.test() -> unittest.TextTestResult``
76
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77
+
78
+ This project can be tested through its test function.
79
+
80
+ .. code-block:: python
81
+
82
+ import setdoc.tests
83
+ setdoc.tests.test()
84
+
85
+ License
86
+ -------
87
+
88
+ This project is licensed under the MIT License.
89
+
90
+ Links
91
+ -----
92
+
93
+ - Download: https://pypi.org/project/setdoc/#files
94
+ - Index: https://pypi.org/project/setdoc/
95
+ - Source: https://github.com/johannes-programming/setdoc/
96
+ - Website: https://setdoc.johannes-programming.online/
97
+
98
+ Impressum
99
+ ---------
100
+
101
+ **Johannes Programming**
102
+
103
+ - Name: Johannes
104
+ - Email: johannes.programming@gmail.com
105
+ - Homepage: https://www.johannes-programming.online/
106
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -0,0 +1,113 @@
1
+ Introduction
2
+ ------------
3
+
4
+ This project helps to set the doc string.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ To install ``setdoc``, you can use ``pip``.
10
+ Open your terminal and run:
11
+
12
+ .. code-block:: shell
13
+
14
+ pip install setdoc
15
+
16
+ Typing
17
+ ------
18
+
19
+ This project is (not strictly) typed in accordance with ``mypy``.
20
+
21
+ Features
22
+ --------
23
+
24
+ ``class setdoc.SetDoc(doc: Any)``
25
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26
+
27
+ The instances of this ``dataclass`` work as decorators
28
+ that set the docstring of the decorated ``target`` to ``doc``.
29
+
30
+ Usage:
31
+
32
+ .. code-block:: python
33
+
34
+ from typing import *
35
+ from setdoc import SetDoc
36
+
37
+ # Create a setdoc instance with the desired docstring
38
+ doc_updater: SetDoc
39
+ doc_updater = SetDoc("This function adds two numbers.")
40
+
41
+ # Apply it to a target function
42
+ @doc_updater
43
+ def add(a: int, b: int) -> int:
44
+ return a + b
45
+
46
+ # The function now has an updated docstring
47
+ print(add.__doc__)
48
+ # Output: This function adds two numbers.
49
+
50
+ # Apply it directly to another target function
51
+ @SetDoc("This function multiplies two numbers.")
52
+ def mul(a: int, b: int) -> int:
53
+ return a * b
54
+
55
+ # The function now has an updated docstring
56
+ print(mul.__doc__)
57
+ # Output: This function multiplies two numbers.
58
+
59
+ ``__call__(target: Any) -> Any``
60
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
+
62
+ This magic method implements calling the current instance.
63
+ It sets ``target.__doc__`` to ``doc``.
64
+
65
+ ``doc: Any``
66
+ ^^^^^^^^^^^^
67
+
68
+ This value that is used for ``__doc__``.
69
+
70
+ ``setdoc.basic(value: Any) -> Any``
71
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
+
73
+ .. container:: versionadded
74
+
75
+ **Added in version 1.1.**
76
+
77
+ ``setdoc.setdoc = setdoc.SetDoc``
78
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79
+
80
+ This module variable is alias for ``SetDoc`` included for legacy.
81
+
82
+ ``setdoc.tests.test() -> unittest.TextTestResult``
83
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84
+
85
+ This project can be tested through its test function.
86
+
87
+ .. code-block:: python
88
+
89
+ import setdoc.tests
90
+ setdoc.tests.test()
91
+
92
+ License
93
+ -------
94
+
95
+ This project is licensed under the MIT License.
96
+
97
+ Links
98
+ -----
99
+
100
+ - Download: https://pypi.org/project/setdoc/#files
101
+ - Index: https://pypi.org/project/setdoc/
102
+ - Source: https://github.com/johannes-programming/setdoc/
103
+ - Website: https://setdoc.johannes-programming.online/
104
+
105
+ Impressum
106
+ ---------
107
+
108
+ **Johannes Programming**
109
+
110
+ - Name: Johannes
111
+ - Email: johannes.programming@gmail.com
112
+ - Homepage: https://www.johannes-programming.online/
113
+ - Gravatar: https://www.johannes-programming.fyi/
@@ -10,7 +10,6 @@ authors = [
10
10
  ]
11
11
  classifiers = [
12
12
  "Development Status :: 5 - Production/Stable",
13
- "License :: OSI Approved :: MIT License",
14
13
  "Natural Language :: English",
15
14
  "Operating System :: OS Independent",
16
15
  "Programming Language :: Python",
@@ -21,16 +20,24 @@ classifiers = [
21
20
  dependencies = []
22
21
  description = "This project helps to set the doc string."
23
22
  keywords = []
23
+ license = "MIT"
24
+ license-files = [
25
+ "LICENSE.txt",
26
+ ]
24
27
  name = "setdoc"
25
28
  readme = "README.rst"
26
29
  requires-python = ">=3.11"
27
- version = "1.1.0"
28
-
29
- [project.license]
30
- file = "LICENSE.txt"
30
+ version = "1.1.2"
31
31
 
32
32
  [project.urls]
33
33
  Download = "https://pypi.org/project/setdoc/#files"
34
34
  Index = "https://pypi.org/project/setdoc/"
35
35
  Source = "https://github.com/johannes-programming/setdoc/"
36
36
  Website = "https://setdoc.johannes-programming.online/"
37
+
38
+ [tool.mypy]
39
+ files = [
40
+ ".",
41
+ ]
42
+ python_version = "3.11"
43
+ strict = false
@@ -0,0 +1 @@
1
+ from setdoc.core import *
@@ -1,11 +1,29 @@
1
1
  [basic]
2
2
  __add__ = "This magic method implements self+other."
3
3
  __and__ = "This magic method implements self&other."
4
+ __contains__ = "This magic method implements other in self."
5
+ __delitem__ = "This magic method implements del self[key]."
4
6
  __divmod__ = "This magic method implements divmod(self, other)."
5
7
  __eq__ = "This magic method implements self==other."
6
8
  __floordiv__ = "This magic method implements self//other."
7
9
  __ge__ = "This magic method implements self>=other."
10
+ __getitem__ = "This magic method implements self[key]."
8
11
  __gt__ = "This magic method implements self>other."
12
+ __iadd__ = "This magic method implements self+=other."
13
+ __iand__ = "This magic method implements self&=other."
14
+ __ifloordiv__ = "This magic method implements self//=other."
15
+ __ilshift__ = "This magic method implements self<<=other."
16
+ __imatmul__ = "This magic method implements self@=other."
17
+ __imod__ = "This magic method implements self%=other."
18
+ __imul__ = "This magic method implements self*=other."
19
+ __ior__ = "This magic method implements self|=other."
20
+ __ipow__ = "This magic method implements self**=other."
21
+ __irshift__ = "This magic method implements self>>=other."
22
+ __isub__ = "This magic method implements self-=other."
23
+ __itruediv__ = "This magic method implements self/=other."
24
+ __ixor__ = "This magic method implements self^=other."
25
+ __iter__ = "This magic method implements iter(self)."
26
+ __init__ = "This magic method initializes self."
9
27
  __int__ = "This magic method implements int(self)."
10
28
  __le__ = "This magic method implements self<=other."
11
29
  __len__ = "This magic method implements len(self)."
@@ -35,6 +53,7 @@ __rshift__ = "This magic method implements self>>other."
35
53
  __rsub__ = "This magic method implements other-self."
36
54
  __rtruediv__ = "This magic method implements other/self."
37
55
  __rxor__ = "This magic method implements other^self."
56
+ __setitem__ = "This magic method implements self[key]=value."
38
57
  __str__ = "This magic method implements str(self)."
39
58
  __sub__ = "This magic method implements self-other."
40
59
  __truediv__ = "This magic method implements self/other."
@@ -88,13 +88,14 @@ class TestSetDocDecorator(unittest.TestCase):
88
88
 
89
89
  def test_setdoc_on_nested_function(self: Self) -> None:
90
90
  # Test the decorator on a nested function
91
- def outer_func() -> None:
91
+ def outer_func() -> Any:
92
92
  @setdoc("This is a nested function")
93
93
  def inner_func() -> None:
94
94
  pass
95
95
 
96
96
  return inner_func
97
97
 
98
+ nested_func: Any
98
99
  nested_func = outer_func()
99
100
  self.assertEqual(nested_func.__doc__, "This is a nested function")
100
101
 
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.4
2
+ Name: setdoc
3
+ Version: 1.1.2
4
+ Summary: This project helps to set the doc string.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Download, https://pypi.org/project/setdoc/#files
8
+ Project-URL: Index, https://pypi.org/project/setdoc/
9
+ Project-URL: Source, https://github.com/johannes-programming/setdoc/
10
+ Project-URL: Website, https://setdoc.johannes-programming.online/
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/x-rst
20
+ License-File: LICENSE.txt
21
+ Dynamic: license-file
22
+
23
+ ======
24
+ setdoc
25
+ ======
26
+
27
+ Each minor version has its own documentation.
28
+ These docs can be found as rst-files in the ``docs/`` directory of this project.
29
+ They can also be viewed on the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_.
@@ -3,6 +3,8 @@ MANIFEST.in
3
3
  README.rst
4
4
  pyproject.toml
5
5
  setup.cfg
6
+ docs/v1.0.rst
7
+ docs/v1.1.rst
6
8
  src/setdoc/__init__.py
7
9
  src/setdoc.egg-info/PKG-INFO
8
10
  src/setdoc.egg-info/SOURCES.txt
setdoc-1.1.0/MANIFEST.in DELETED
@@ -1 +0,0 @@
1
- recursive-include src/setdoc *.toml
setdoc-1.1.0/PKG-INFO DELETED
@@ -1,48 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: setdoc
3
- Version: 1.1.0
4
- Summary: This project helps to set the doc string.
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/setdoc/#files
28
- Project-URL: Index, https://pypi.org/project/setdoc/
29
- Project-URL: Source, https://github.com/johannes-programming/setdoc/
30
- Project-URL: Website, https://setdoc.johannes-programming.online/
31
- Classifier: Development Status :: 5 - Production/Stable
32
- Classifier: License :: OSI Approved :: MIT License
33
- Classifier: Natural Language :: English
34
- Classifier: Operating System :: OS Independent
35
- Classifier: Programming Language :: Python
36
- Classifier: Programming Language :: Python :: 3
37
- Classifier: Programming Language :: Python :: 3 :: Only
38
- Classifier: Typing :: Typed
39
- Requires-Python: >=3.11
40
- Description-Content-Type: text/x-rst
41
- License-File: LICENSE.txt
42
- Dynamic: license-file
43
-
44
- ======
45
- setdoc
46
- ======
47
-
48
- Visit the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_ for more information.
setdoc-1.1.0/README.rst DELETED
@@ -1,5 +0,0 @@
1
- ======
2
- setdoc
3
- ======
4
-
5
- Visit the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_ for more information.
@@ -1,2 +0,0 @@
1
- from setdoc.core import *
2
- from setdoc.tests import *
@@ -1,48 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: setdoc
3
- Version: 1.1.0
4
- Summary: This project helps to set the doc string.
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/setdoc/#files
28
- Project-URL: Index, https://pypi.org/project/setdoc/
29
- Project-URL: Source, https://github.com/johannes-programming/setdoc/
30
- Project-URL: Website, https://setdoc.johannes-programming.online/
31
- Classifier: Development Status :: 5 - Production/Stable
32
- Classifier: License :: OSI Approved :: MIT License
33
- Classifier: Natural Language :: English
34
- Classifier: Operating System :: OS Independent
35
- Classifier: Programming Language :: Python
36
- Classifier: Programming Language :: Python :: 3
37
- Classifier: Programming Language :: Python :: 3 :: Only
38
- Classifier: Typing :: Typed
39
- Requires-Python: >=3.11
40
- Description-Content-Type: text/x-rst
41
- License-File: LICENSE.txt
42
- Dynamic: license-file
43
-
44
- ======
45
- setdoc
46
- ======
47
-
48
- Visit the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_ for more information.
File without changes