setdoc 1.3.7__tar.gz → 1.3.9__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.
- {setdoc-1.3.7/src/setdoc.egg-info → setdoc-1.3.9}/PKG-INFO +1 -1
- {setdoc-1.3.7 → setdoc-1.3.9}/pyproject.toml +1 -1
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/_utils/__init__.py +5 -1
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/_utils/cfg.toml +2 -0
- setdoc-1.3.9/src/setdoc/core/getbasicdoc.py +10 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/tests/test_core.py +8 -3
- {setdoc-1.3.7 → setdoc-1.3.9/src/setdoc.egg-info}/PKG-INFO +1 -1
- setdoc-1.3.7/src/setdoc/core/getbasicdoc.py +0 -10
- {setdoc-1.3.7 → setdoc-1.3.9}/LICENSE.txt +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/MANIFEST.in +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/README.rst +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/docs/v1.0.rst +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/docs/v1.1.rst +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/docs/v1.2.rst +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/docs/v1.3.rst +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/setup.cfg +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/__init__.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/core/SetDoc.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/core/__init__.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/core/basic.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/py.typed +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/tests/__init__.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/typing/SupportsDoc.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/typing/SupportsDocAndName.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc/typing/__init__.py +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc.egg-info/SOURCES.txt +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc.egg-info/dependency_links.txt +0 -0
- {setdoc-1.3.7 → setdoc-1.3.9}/src/setdoc.egg-info/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ import enum
|
|
|
2
2
|
import functools
|
|
3
3
|
import tomllib
|
|
4
4
|
from importlib import resources
|
|
5
|
-
from typing import Any, Self
|
|
5
|
+
from typing import Any, Self, cast
|
|
6
6
|
|
|
7
7
|
__all__ = ["Cfg"]
|
|
8
8
|
|
|
@@ -10,6 +10,10 @@ __all__ = ["Cfg"]
|
|
|
10
10
|
class Cfg(enum.Enum):
|
|
11
11
|
cfg = None
|
|
12
12
|
|
|
13
|
+
@functools.cached_property
|
|
14
|
+
def basic(self: Self) -> dict[str, Any]:
|
|
15
|
+
return cast(dict[str, Any], self.data["basic"])
|
|
16
|
+
|
|
13
17
|
@functools.cached_property
|
|
14
18
|
def data(self: Self) -> dict[str, Any]:
|
|
15
19
|
"This cached property holds the cfg data."
|
|
@@ -76,8 +76,10 @@ __str__ = "This magic method implements str(self)."
|
|
|
76
76
|
__sub__ = "This magic method implements self-other."
|
|
77
77
|
__truediv__ = "This magic method implements self/other."
|
|
78
78
|
__xor__ = "This magic method implements self^other."
|
|
79
|
+
append = "This method appends item at the end of self."
|
|
79
80
|
copy = "This method returns a new copy of self."
|
|
80
81
|
data = "This property represents the underlying data."
|
|
82
|
+
get = "This method returns self[key] if it exists, otherwise default."
|
|
81
83
|
index = "This method returns the index of the first occurrence."
|
|
82
84
|
insert = "This method inserts value at index."
|
|
83
85
|
isdisjoint = "This method determines if self and other have no intersection."
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from typing import Optional, cast
|
|
2
|
+
|
|
3
|
+
from setdoc._utils import Cfg
|
|
4
|
+
|
|
5
|
+
__all__ = ["getbasicdoc"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def getbasicdoc(name: str) -> Optional[str]:
|
|
9
|
+
"This function returns the basic docstring for a given name."
|
|
10
|
+
return cast(Optional[str], Cfg.cfg.basic.get(name))
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import types
|
|
2
1
|
import unittest
|
|
3
2
|
from typing import Any, Self
|
|
4
3
|
|
|
5
4
|
from setdoc.core.SetDoc import SetDoc
|
|
6
5
|
|
|
6
|
+
__all__ = ["TestSetDocDecorator"]
|
|
7
|
+
|
|
7
8
|
|
|
8
9
|
class TestSetDocDecorator(unittest.TestCase):
|
|
9
10
|
|
|
@@ -42,7 +43,9 @@ class TestSetDocDecorator(unittest.TestCase):
|
|
|
42
43
|
def my_static_method() -> None:
|
|
43
44
|
pass
|
|
44
45
|
|
|
45
|
-
self.assertEqual(
|
|
46
|
+
self.assertEqual(
|
|
47
|
+
MyClass.my_static_method.__doc__, "This is a static method"
|
|
48
|
+
)
|
|
46
49
|
|
|
47
50
|
def test_setdoc_on_class_with_init(self: Self) -> None:
|
|
48
51
|
# Test the decorator on a class that has an __init__ method
|
|
@@ -88,7 +91,9 @@ class TestSetDocDecorator(unittest.TestCase):
|
|
|
88
91
|
def my_class_method(cls: type) -> None:
|
|
89
92
|
pass
|
|
90
93
|
|
|
91
|
-
self.assertEqual(
|
|
94
|
+
self.assertEqual(
|
|
95
|
+
MyClass.my_class_method.__doc__, "This is a class method"
|
|
96
|
+
)
|
|
92
97
|
|
|
93
98
|
def test_setdoc_on_nested_function(self: Self) -> None:
|
|
94
99
|
# Test the decorator on a nested function
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|