mkapi-fix 0.0.17__tar.gz → 0.1.1__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.
- {mkapi-fix-0.0.17/mkapi_fix.egg-info → mkapi-fix-0.1.1}/PKG-INFO +1 -1
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/__init__.py +1 -1
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/docstring.py +13 -1
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/module.py +19 -7
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/object.py +8 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/plugins/api.py +10 -6
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/utils.py +1 -1
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1/mkapi_fix.egg-info}/PKG-INFO +1 -1
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/setup.cfg +4 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/LICENSE +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/MANIFEST.in +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/README.md +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/__init__.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/attribute.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/base.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/code.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/inherit.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/linker.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/node.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/page.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/postprocess.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/preprocess.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/regex.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/renderer.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/signature.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/core/structure.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/main.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/plugins/__init__.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/plugins/mkdocs.py +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/bases.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/code.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/docstring.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/items.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/macros.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/member.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/module.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/node.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/templates/object.jinja2 +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/theme/css/mkapi-common.css +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/theme/css/mkapi-ivory.css +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/theme/css/mkapi-mkdocs.css +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/theme/css/mkapi-readthedocs.css +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/theme/js/mkapi.js +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi/theme/mkapi.yml +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi_fix.egg-info/SOURCES.txt +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi_fix.egg-info/dependency_links.txt +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi_fix.egg-info/entry_points.txt +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi_fix.egg-info/requires.txt +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/mkapi_fix.egg-info/top_level.txt +0 -0
- {mkapi-fix-0.0.17 → mkapi-fix-0.1.1}/setup.py +0 -0
|
@@ -31,6 +31,10 @@ SECTIONS = [
|
|
|
31
31
|
"Warns",
|
|
32
32
|
"Yield",
|
|
33
33
|
"Yields",
|
|
34
|
+
"Input",
|
|
35
|
+
"Output",
|
|
36
|
+
"Envs",
|
|
37
|
+
"Requires",
|
|
34
38
|
]
|
|
35
39
|
|
|
36
40
|
|
|
@@ -179,7 +183,15 @@ def get_section(name: str, doc: str, style: str) -> Section:
|
|
|
179
183
|
type = ""
|
|
180
184
|
markdown = ""
|
|
181
185
|
items = []
|
|
182
|
-
if name in [
|
|
186
|
+
if name in [
|
|
187
|
+
"Parameters",
|
|
188
|
+
"Attributes",
|
|
189
|
+
"Raises",
|
|
190
|
+
"Input",
|
|
191
|
+
"Output",
|
|
192
|
+
"Envs",
|
|
193
|
+
"Requires",
|
|
194
|
+
]:
|
|
183
195
|
items = parse_parameters(doc, style)
|
|
184
196
|
elif name in ["Returns", "Yields"]:
|
|
185
197
|
type, markdown = parse_returns(doc, style)
|
|
@@ -4,7 +4,9 @@ import os
|
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
from typing import Dict, Iterator, List, Optional
|
|
6
6
|
|
|
7
|
-
from mkapi.core.node import Node
|
|
7
|
+
from mkapi.core.node import Node
|
|
8
|
+
from mkapi.core.node import get_members as get_node_members
|
|
9
|
+
from mkapi.core.node import get_node
|
|
8
10
|
from mkapi.core.object import get_object
|
|
9
11
|
from mkapi.core.structure import Tree
|
|
10
12
|
|
|
@@ -30,10 +32,13 @@ class Module(Tree):
|
|
|
30
32
|
def __iter__(self) -> Iterator["Module"]:
|
|
31
33
|
if self.docstring:
|
|
32
34
|
yield self
|
|
33
|
-
elif self.object.kind
|
|
35
|
+
elif self.object.kind in ["package", "module"] and any(
|
|
36
|
+
m.docstring for m in self.members
|
|
37
|
+
):
|
|
34
38
|
yield self
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
if self.object.kind == "package":
|
|
40
|
+
for member in self.members:
|
|
41
|
+
yield from member
|
|
37
42
|
|
|
38
43
|
def get_kind(self) -> str:
|
|
39
44
|
if not self.sourcefile or self.sourcefile.endswith("__init__.py"):
|
|
@@ -41,9 +46,9 @@ class Module(Tree):
|
|
|
41
46
|
else:
|
|
42
47
|
return "module"
|
|
43
48
|
|
|
44
|
-
def get_members(self) -> List
|
|
49
|
+
def get_members(self) -> List:
|
|
45
50
|
if self.object.kind == "module":
|
|
46
|
-
return
|
|
51
|
+
return get_node_members(self.obj)
|
|
47
52
|
else:
|
|
48
53
|
return get_members(self.obj)
|
|
49
54
|
|
|
@@ -82,7 +87,14 @@ def get_members(obj) -> List[Module]:
|
|
|
82
87
|
module = get_module(name)
|
|
83
88
|
if module is not None:
|
|
84
89
|
members.append(module)
|
|
85
|
-
|
|
90
|
+
packages = []
|
|
91
|
+
modules = []
|
|
92
|
+
for member in members:
|
|
93
|
+
if member.object.kind == "package":
|
|
94
|
+
packages.append(member)
|
|
95
|
+
else:
|
|
96
|
+
modules.append(member)
|
|
97
|
+
return modules + packages
|
|
86
98
|
|
|
87
99
|
|
|
88
100
|
modules: Dict[str, Module] = {}
|
|
@@ -74,6 +74,9 @@ def get_fullname(obj: Any, name: str) -> str:
|
|
|
74
74
|
return ""
|
|
75
75
|
obj = getattr(obj, name)
|
|
76
76
|
|
|
77
|
+
if isinstance(obj, property):
|
|
78
|
+
return ""
|
|
79
|
+
|
|
77
80
|
return ".".join(split_prefix_and_name(obj))
|
|
78
81
|
|
|
79
82
|
|
|
@@ -207,6 +210,10 @@ def get_origin(obj: Any) -> Any:
|
|
|
207
210
|
return get_origin(obj.fget)
|
|
208
211
|
if not callable(obj):
|
|
209
212
|
return obj
|
|
213
|
+
# if hasattr(obj, "__wrapped__"):
|
|
214
|
+
# return get_origin(obj.__wrapped__)
|
|
215
|
+
# if hasattr(obj, "__pytest_wrapped__"):
|
|
216
|
+
# return get_origin(obj.__pytest_wrapped__.obj)
|
|
210
217
|
try:
|
|
211
218
|
if hasattr(obj, "__wrapped__"):
|
|
212
219
|
return get_origin(obj.__wrapped__)
|
|
@@ -214,4 +221,5 @@ def get_origin(obj: Any) -> Any:
|
|
|
214
221
|
return get_origin(obj.__pytest_wrapped__.obj)
|
|
215
222
|
except Exception:
|
|
216
223
|
pass
|
|
224
|
+
|
|
217
225
|
return obj
|
|
@@ -3,7 +3,7 @@ import logging
|
|
|
3
3
|
import os
|
|
4
4
|
import shutil
|
|
5
5
|
import sys
|
|
6
|
-
from typing import Dict, List, Tuple
|
|
6
|
+
from typing import Dict, List, Optional, Tuple
|
|
7
7
|
|
|
8
8
|
from mkapi import utils
|
|
9
9
|
from mkapi.core.module import Module, get_module
|
|
@@ -44,32 +44,36 @@ def collect(path: str, docs_dir: str, config_dir, global_filters) -> Tuple[list,
|
|
|
44
44
|
package_path, filters = utils.split_filters(package_path)
|
|
45
45
|
filters = utils.update_filters(global_filters, filters)
|
|
46
46
|
|
|
47
|
-
module = get_module(package_path)
|
|
48
47
|
nav = []
|
|
49
48
|
abs_api_paths = []
|
|
50
49
|
modules: Dict[str, str] = {}
|
|
51
50
|
package = None
|
|
52
51
|
|
|
53
|
-
def add_page(module: Module):
|
|
52
|
+
def add_page(module: Module, package: Optional[str]):
|
|
54
53
|
page_file = module.object.id + ".md"
|
|
55
54
|
abs_path = os.path.join(abs_api_path, page_file)
|
|
56
55
|
abs_api_paths.append(abs_path)
|
|
57
56
|
create_page(abs_path, module, filters)
|
|
58
|
-
|
|
57
|
+
page_name = module.object.id
|
|
58
|
+
if package and "short_nav" in filters and page_name != package:
|
|
59
|
+
page_name = page_name[len(package) + 1 :]
|
|
60
|
+
modules[page_name] = os.path.join(api_path, page_file)
|
|
59
61
|
|
|
60
62
|
abs_path = os.path.join(abs_api_path, "source", page_file)
|
|
61
63
|
create_source_page(abs_path, module, filters)
|
|
62
64
|
|
|
65
|
+
module = get_module(package_path)
|
|
63
66
|
for m in module:
|
|
67
|
+
# print(m)
|
|
64
68
|
if m.object.kind == "package":
|
|
65
69
|
if package and modules:
|
|
66
70
|
nav.append({package: modules})
|
|
67
71
|
package = m.object.id
|
|
68
72
|
modules = {}
|
|
69
73
|
if m.docstring or any(s.docstring for s in m.members):
|
|
70
|
-
add_page(m)
|
|
74
|
+
add_page(m, package)
|
|
71
75
|
else:
|
|
72
|
-
add_page(m)
|
|
76
|
+
add_page(m, package)
|
|
73
77
|
if package and modules:
|
|
74
78
|
nav.append({package: modules})
|
|
75
79
|
|
|
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
|
|
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
|
|
File without changes
|