setdoc 1.2.9__tar.gz → 1.2.11__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setdoc
3
- Version: 1.2.9
3
+ Version: 1.2.11
4
4
  Summary: This project helps to set the doc string.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -1,7 +1,7 @@
1
1
  [build-system]
2
2
  build-backend = "setuptools.build_meta"
3
3
  requires = [
4
- "setuptools>=61.0",
4
+ "setuptools>=64.0",
5
5
  ]
6
6
 
7
7
  [project]
@@ -24,7 +24,7 @@ keywords = []
24
24
  name = "setdoc"
25
25
  readme = "README.rst"
26
26
  requires-python = ">=3.11"
27
- version = "1.2.9"
27
+ version = "1.2.11"
28
28
 
29
29
  [project.license]
30
30
  file = "LICENSE.txt"
@@ -0,0 +1,18 @@
1
+ import enum
2
+ import functools
3
+ import tomllib
4
+ from importlib import resources
5
+ from typing import *
6
+
7
+ __all__ = ["Cfg"]
8
+
9
+
10
+ class Cfg(enum.Enum):
11
+ cfg = None
12
+
13
+ @functools.cached_property
14
+ def data(self: Self) -> dict:
15
+ "This cached property holds the cfg data."
16
+ text: str
17
+ text = resources.read_text("setdoc._uitls", "cfg.toml")
18
+ return tomllib.loads(text)
@@ -0,0 +1,16 @@
1
+ import dataclasses
2
+ from typing import *
3
+
4
+ __all__ = ["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
@@ -0,0 +1,7 @@
1
+ from setdoc.core.basic import basic
2
+ from setdoc.core.getbasicdoc import getbasicdoc
3
+ from setdoc.core.SetDoc import SetDoc
4
+
5
+ __all__ = ["SetDoc", "basic", "getbasicdoc", "setdoc"]
6
+
7
+ setdoc = SetDoc # legacy
@@ -0,0 +1,11 @@
1
+ from typing import *
2
+
3
+ from setdoc.core.getbasicdoc import getbasicdoc
4
+
5
+ __all__ = ["basic"]
6
+
7
+
8
+ def basic(value: Any) -> Any:
9
+ "This decorator sets the docstring of the given value to what is suggested by its name."
10
+ value.__doc__ = getbasicdoc(value.__name__)
11
+ return value
@@ -0,0 +1,10 @@
1
+ from typing import *
2
+
3
+ from setdoc._utils import Cfg
4
+
5
+ __all__ = ["getbasicdoc"]
6
+
7
+
8
+ def getbasicdoc(name: str) -> str:
9
+ "This function returns the basic docstring for a given name."
10
+ return Cfg.cfg.data["basic"][name]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: setdoc
3
- Version: 1.2.9
3
+ Version: 1.2.11
4
4
  Summary: This project helps to set the doc string.
5
5
  Author-email: Johannes <johannes.programming@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -8,7 +8,11 @@ src/setdoc.egg-info/PKG-INFO
8
8
  src/setdoc.egg-info/SOURCES.txt
9
9
  src/setdoc.egg-info/dependency_links.txt
10
10
  src/setdoc.egg-info/top_level.txt
11
+ src/setdoc/_utils/__init__.py
12
+ src/setdoc/_utils/cfg.toml
13
+ src/setdoc/core/SetDoc.py
11
14
  src/setdoc/core/__init__.py
12
- src/setdoc/core/cfg.toml
15
+ src/setdoc/core/basic.py
16
+ src/setdoc/core/getbasicdoc.py
13
17
  src/setdoc/tests/__init__.py
14
18
  src/setdoc/tests/test_core.py
@@ -1,45 +0,0 @@
1
- import dataclasses
2
- import enum
3
- import functools
4
- import tomllib
5
- from importlib import resources
6
- from typing import *
7
-
8
- __all__ = ["SetDoc", "basic", "getbasicdoc", "setdoc"]
9
-
10
-
11
- class Util(enum.Enum):
12
- util = None
13
-
14
- @functools.cached_property
15
- def data(self: Self) -> dict:
16
- "This cached property holds the cfg data."
17
- text: str
18
- text = resources.read_text("setdoc.core", "cfg.toml")
19
- return tomllib.loads(text)
20
-
21
-
22
- @dataclasses.dataclass
23
- class SetDoc:
24
- "This class helps to set doc strings."
25
-
26
- doc: Any
27
-
28
- def __call__(self: Self, target: Any) -> Any:
29
- "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."
30
- target.__doc__ = self.doc
31
- return target
32
-
33
-
34
- setdoc = SetDoc # legacy
35
-
36
-
37
- def basic(value: Any) -> Any:
38
- "This decorator sets the docstring of the given value to what is suggested by its name."
39
- value.__doc__ = getbasicdoc(value.__name__)
40
- return value
41
-
42
-
43
- def getbasicdoc(name: str) -> str:
44
- "This function returns the basic docstring for a given name."
45
- return Util.util.data["basic"][name]
File without changes
File without changes
File without changes
File without changes
File without changes