setdoc 0.1.2__tar.gz → 0.1.4__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,8 +1,8 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: setdoc
3
- Version: 0.1.2
4
- Summary: Set the doc string.
5
- Author-email: Johannes <johannes-programming@mailfence.com>
3
+ Version: 0.1.4
4
+ Summary: This project helps to set the doc string.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
7
7
 
8
8
  Copyright (c) 2024 Johannes
@@ -24,22 +24,25 @@ 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/setdoc
28
27
  Project-URL: Download, https://pypi.org/project/setdoc/#files
29
28
  Project-URL: Index, https://pypi.org/project/setdoc/
30
29
  Project-URL: Source, https://github.com/johannes-programming/setdoc/
31
30
  Project-URL: Website, https://setdoc.johannes-programming.online/
32
31
  Classifier: Development Status :: 3 - Alpha
33
32
  Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Natural Language :: English
34
+ Classifier: Operating System :: OS Independent
34
35
  Classifier: Programming Language :: Python
35
36
  Classifier: Programming Language :: Python :: 3
36
37
  Classifier: Programming Language :: Python :: 3 :: Only
37
- Requires-Python: >=3.12.5
38
+ Classifier: Typing :: Typed
39
+ Requires-Python: >=3.11
38
40
  Description-Content-Type: text/x-rst
39
41
  License-File: LICENSE.txt
42
+ Dynamic: license-file
40
43
 
41
44
  ======
42
45
  setdoc
43
46
  ======
44
47
 
45
- Visit the website `https://setdoc.johannes-programming.online <https://setdoc.johannes-programming.online>`_ for more information.
48
+ Visit the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_ for more information.
@@ -0,0 +1,5 @@
1
+ ======
2
+ setdoc
3
+ ======
4
+
5
+ Visit the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_ for more information.
@@ -6,28 +6,30 @@ requires = [
6
6
 
7
7
  [project]
8
8
  authors = [
9
- { email = "johannes-programming@mailfence.com", name = "Johannes" },
9
+ { email = "johannes.programming@gmail.com", name = "Johannes" },
10
10
  ]
11
11
  classifiers = [
12
12
  "Development Status :: 3 - Alpha",
13
13
  "License :: OSI Approved :: MIT License",
14
+ "Natural Language :: English",
15
+ "Operating System :: OS Independent",
14
16
  "Programming Language :: Python",
15
17
  "Programming Language :: Python :: 3",
16
18
  "Programming Language :: Python :: 3 :: Only",
19
+ "Typing :: Typed",
17
20
  ]
18
21
  dependencies = []
19
- description = "Set the doc string."
22
+ description = "This project helps to set the doc string."
20
23
  keywords = []
21
24
  name = "setdoc"
22
25
  readme = "README.rst"
23
- requires-python = ">=3.12.5"
24
- version = "0.1.2"
26
+ requires-python = ">=3.11"
27
+ version = "0.1.4"
25
28
 
26
29
  [project.license]
27
30
  file = "LICENSE.txt"
28
31
 
29
32
  [project.urls]
30
- Documentation = "https://pypi.org/project/setdoc"
31
33
  Download = "https://pypi.org/project/setdoc/#files"
32
34
  Index = "https://pypi.org/project/setdoc/"
33
35
  Source = "https://github.com/johannes-programming/setdoc/"
@@ -0,0 +1,19 @@
1
+ import dataclasses
2
+ from typing import *
3
+
4
+ __all__ = ["SetDoc", "setdoc"]
5
+
6
+
7
+ @dataclasses.dataclass
8
+ class SetDoc:
9
+ "This class helps to set doc strings."
10
+
11
+ doc: Any
12
+
13
+ def __call__(self: Self, target: Any) -> Any:
14
+ "This magic method implements calling the current instance. It sets the doc string of the passed target to the value stored in the doc field of the setdoc object."
15
+ target.__doc__ = self.doc
16
+ return target
17
+
18
+
19
+ setdoc = SetDoc
@@ -0,0 +1,11 @@
1
+ import unittest
2
+
3
+ __all__ = ["test"]
4
+
5
+
6
+ def test() -> unittest.TextTestResult:
7
+ loader: unittest.TestLoader = unittest.TestLoader()
8
+ tests: unittest.TestSuite = loader.discover(start_dir="setdoc.tests")
9
+ runner: unittest.TextTestRunner = unittest.TextTestRunner()
10
+ result: unittest.TextTestResult = runner.run(tests)
11
+ return result
@@ -6,15 +6,15 @@ from setdoc.core import setdoc
6
6
 
7
7
  class TestSetDocDecorator(unittest.TestCase):
8
8
 
9
- def test_setdoc_on_function(self):
9
+ def test_setdoc_on_function(self: Self) -> None:
10
10
  # Test the decorator on a standalone function
11
11
  @setdoc("This is a test function")
12
- def test_func():
12
+ def test_func() -> None:
13
13
  pass
14
14
 
15
15
  self.assertEqual(test_func.__doc__, "This is a test function")
16
16
 
17
- def test_setdoc_on_class(self):
17
+ def test_setdoc_on_class(self: Self) -> None:
18
18
  # Test the decorator on a class
19
19
  @setdoc("This is a test class")
20
20
  class TestClass:
@@ -22,75 +22,75 @@ class TestSetDocDecorator(unittest.TestCase):
22
22
 
23
23
  self.assertEqual(TestClass.__doc__, "This is a test class")
24
24
 
25
- def test_setdoc_on_class_method(self):
25
+ def test_setdoc_on_class_method(self: Self) -> None:
26
26
  # Test the decorator on a class method
27
27
  class MyClass:
28
28
  @setdoc("This is a test method")
29
- def my_method(self):
29
+ def my_method(self: Self) -> None:
30
30
  pass
31
31
 
32
32
  instance = MyClass()
33
33
  self.assertEqual(instance.my_method.__doc__, "This is a test method")
34
34
 
35
- def test_setdoc_on_static_method(self):
35
+ def test_setdoc_on_static_method(self: Self) -> None:
36
36
  # Test the decorator on a static method
37
37
  class MyClass:
38
38
  @staticmethod
39
39
  @setdoc("This is a static method")
40
- def my_static_method():
40
+ def my_static_method() -> None:
41
41
  pass
42
42
 
43
43
  self.assertEqual(MyClass.my_static_method.__doc__, "This is a static method")
44
44
 
45
- def test_setdoc_on_class_with_init(self):
45
+ def test_setdoc_on_class_with_init(self: Self) -> None:
46
46
  # Test the decorator on a class that has an __init__ method
47
47
  @setdoc("This is a class with __init__")
48
48
  class InitClass:
49
49
  def __init__(self, x):
50
50
  self.x = x
51
51
 
52
- instance = InitClass(5)
52
+ instance: InitClass = InitClass(5)
53
53
  self.assertEqual(InitClass.__doc__, "This is a class with __init__")
54
54
  self.assertEqual(instance.__doc__, "This is a class with __init__")
55
55
 
56
- def test_setdoc_with_none_doc(self):
56
+ def test_setdoc_with_none_doc(self: Self) -> None:
57
57
  # Test with None to see if it handles absence of documentation
58
58
  @setdoc(None)
59
- def none_doc_func():
59
+ def none_doc_func() -> None:
60
60
  pass
61
61
 
62
62
  self.assertIsNone(none_doc_func.__doc__)
63
63
 
64
- def test_setdoc_on_class_property(self):
64
+ def test_setdoc_on_class_property(self: Self) -> None:
65
65
  # Test the decorator on a property
66
66
  class PropertyClass:
67
- def __init__(self, value):
67
+ def __init__(self: Self, value: Any) -> None:
68
68
  self._value = value
69
69
 
70
70
  @property
71
71
  @setdoc("This is a property")
72
- def value(self):
72
+ def value(self: Self) -> None:
73
73
  return self._value
74
74
 
75
- instance = PropertyClass(10)
75
+ instance: PropertyClass = PropertyClass(10)
76
76
  self.assertEqual(PropertyClass.value.__doc__, "This is a property")
77
77
  self.assertEqual(instance.value, 10)
78
78
 
79
- def test_setdoc_on_classmethod(self):
79
+ def test_setdoc_on_classmethod(self: Self) -> None:
80
80
  # Test the decorator on a class method
81
81
  class MyClass:
82
82
  @classmethod
83
83
  @setdoc("This is a class method")
84
- def my_class_method(cls):
84
+ def my_class_method(cls: type) -> None:
85
85
  pass
86
86
 
87
87
  self.assertEqual(MyClass.my_class_method.__doc__, "This is a class method")
88
88
 
89
- def test_setdoc_on_nested_function(self):
89
+ def test_setdoc_on_nested_function(self: Self) -> None:
90
90
  # Test the decorator on a nested function
91
- def outer_func():
91
+ def outer_func() -> None:
92
92
  @setdoc("This is a nested function")
93
- def inner_func():
93
+ def inner_func() -> None:
94
94
  pass
95
95
 
96
96
  return inner_func
@@ -98,11 +98,11 @@ class TestSetDocDecorator(unittest.TestCase):
98
98
  nested_func = outer_func()
99
99
  self.assertEqual(nested_func.__doc__, "This is a nested function")
100
100
 
101
- def test_setdoc_on_function_with_existing_doc(self):
101
+ def test_setdoc_on_function_with_existing_doc(self: Self) -> None:
102
102
  # Test if decorator replaces an existing docstring
103
103
  @setdoc("New docstring")
104
- def pre_doc_func():
105
- """Old docstring"""
104
+ def pre_doc_func() -> None:
105
+ "Old docstring"
106
106
  pass
107
107
 
108
108
  self.assertEqual(pre_doc_func.__doc__, "New docstring")
@@ -1,8 +1,8 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: setdoc
3
- Version: 0.1.2
4
- Summary: Set the doc string.
5
- Author-email: Johannes <johannes-programming@mailfence.com>
3
+ Version: 0.1.4
4
+ Summary: This project helps to set the doc string.
5
+ Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
7
7
 
8
8
  Copyright (c) 2024 Johannes
@@ -24,22 +24,25 @@ 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/setdoc
28
27
  Project-URL: Download, https://pypi.org/project/setdoc/#files
29
28
  Project-URL: Index, https://pypi.org/project/setdoc/
30
29
  Project-URL: Source, https://github.com/johannes-programming/setdoc/
31
30
  Project-URL: Website, https://setdoc.johannes-programming.online/
32
31
  Classifier: Development Status :: 3 - Alpha
33
32
  Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Natural Language :: English
34
+ Classifier: Operating System :: OS Independent
34
35
  Classifier: Programming Language :: Python
35
36
  Classifier: Programming Language :: Python :: 3
36
37
  Classifier: Programming Language :: Python :: 3 :: Only
37
- Requires-Python: >=3.12.5
38
+ Classifier: Typing :: Typed
39
+ Requires-Python: >=3.11
38
40
  Description-Content-Type: text/x-rst
39
41
  License-File: LICENSE.txt
42
+ Dynamic: license-file
40
43
 
41
44
  ======
42
45
  setdoc
43
46
  ======
44
47
 
45
- Visit the website `https://setdoc.johannes-programming.online <https://setdoc.johannes-programming.online>`_ for more information.
48
+ Visit the website `https://setdoc.johannes-programming.online/ <https://setdoc.johannes-programming.online/>`_ for more information.
@@ -10,5 +10,4 @@ src/setdoc.egg-info/SOURCES.txt
10
10
  src/setdoc.egg-info/dependency_links.txt
11
11
  src/setdoc.egg-info/top_level.txt
12
12
  src/setdoc/tests/__init__.py
13
- src/setdoc/tests/test_1984.py
14
13
  src/setdoc/tests/test_core.py
setdoc-0.1.2/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,15 +0,0 @@
1
- import dataclasses
2
- from typing import *
3
-
4
- __all__ = ["setdoc"]
5
-
6
-
7
- @dataclasses.dataclass
8
- class setdoc:
9
- "A class to set doc strings."
10
- doc: Any
11
-
12
- def __call__(self, target: Any) -> Any:
13
- "Set the doc string of the passed target " "to the value stored in the doc field " "of the setdoc object."
14
- target.__doc__ = self.doc
15
- return target
@@ -1,11 +0,0 @@
1
- import unittest
2
-
3
- __all__ = ["test"]
4
-
5
-
6
- def test():
7
- loader = unittest.TestLoader()
8
- tests = loader.discover(start_dir="setdoc.tests")
9
- runner = unittest.TextTestRunner()
10
- result = runner.run(tests)
11
- return result
@@ -1,10 +0,0 @@
1
- import unittest
2
-
3
-
4
- class Test1984(unittest.TestCase):
5
- def test_1984(self):
6
- self.assertEqual(2 + 2, 4, "Ignorance is Strength")
7
-
8
-
9
- if __name__ == "__main__":
10
- unittest.main()
File without changes
File without changes
File without changes
File without changes