Skip to content

Commit c455e9c

Browse files
committed
handle None; split do_main; link eval types
1 parent 559d022 commit c455e9c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

paths_cli/compiling/_gendocs/json_type_handlers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def _is_listof(json_type):
5353
)
5454

5555

56+
handle_none = JsonTypeHandler(
57+
is_my_type=lambda obj: obj is None,
58+
handler=lambda json_type: "type information missing",
59+
)
60+
61+
5662
class RefTypeHandler(JsonTypeHandler):
5763
"""Handle JSON types of the form {"$ref": "#/definitions/..."}
5864
@@ -122,13 +128,17 @@ class EvalHandler(RefTypeHandler):
122128
to the anchor given by ``link_to``
123129
"""
124130
def __init__(self, type_name, link_to=None):
131+
if link_to is None:
132+
link_to = type_name
133+
125134
super().__init__(
126135
type_name=type_name, def_string=type_name, link_to=link_to
127136
)
128137

129138

130139
JSON_TYPE_HANDLERS = [
131140
handle_object,
141+
handle_none,
132142
handle_listof,
133143
CategoryHandler("engine"),
134144
CategoryHandler("cv"),

paths_cli/compiling/gendocs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
@click.option("--stdout", type=bool, is_flag=True, default=False)
1010
def main(config_file, stdout):
1111
"""Generate documentation for installed compiling plugins."""
12+
do_main(config_file, stdout)
13+
14+
15+
def do_main(config_file, stdout=False):
16+
"""Separate method so this can be imported and run"""
1217
register_installed_plugins()
1318
config = load_config(config_file)
1419
generator = DocsGenerator(config)

0 commit comments

Comments
 (0)