Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature docs pprint #1897

Merged
merged 11 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ def run_confdocs(_):
ctors = ('synapse.axon.Axon',
'synapse.cortex.Cortex',
'synapse.cryotank.CryoCell',
'synapse.tools.sync_200.SyncMigrator',
)
for ctor in ctors:
args = baseargs.copy()
Expand Down
1 change: 0 additions & 1 deletion docs/synapse/devguides/index_autoconf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ Synapse package. These boot-time options may be set using information found at :
../autodocs/conf_axon
../autodocs/conf_cortex
../autodocs/conf_cryocell
../autodocs/conf_syncmigrator
51 changes: 46 additions & 5 deletions synapse/tools/autodoc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import json
import asyncio
import inspect
import logging
Expand Down Expand Up @@ -178,7 +179,6 @@ def processTypes(rst, dochelp, types):
Returns:
None
'''

rst.addHead('Types', lvl=1, link='.. _dm-types:')

rst.addLines('',
Expand Down Expand Up @@ -217,8 +217,51 @@ def processTypes(rst, dochelp, types):
f'The type ``{name}`` has the following options set:',
''
)
for k, v in sorted(topt.items(), key=lambda x: x[0]):
rst.addLines(f' * {k}: ``{v}``')

for key, valu in sorted(topt.items(), key=lambda x: x[0]):
if key == 'enums':
if valu is None:
rst.addLines(f' * {key}: ``{valu}``')
continue
lines = [f' * {key}:\n']
valu = sorted(valu, key=lambda x: x[0])
elines = []

maxa, maxb = len('int'), len('valu')
for (a, b) in valu:
maxa = max(len(str(a)), maxa)
maxb = max(len(b), maxb)

line = f'{"=" * maxa} {"=" * maxb}'
elines.append(line)
line = f'int{" " * (maxa - 3)} valu{" " * (maxb - 4)}'
elines.append(line)
line = f'{"=" * maxa} {"=" * maxb}'
elines.append(line)

for (a, b) in valu:
line = f'{a}{" " * (maxa - len(str(a)))} {b}{" " * (maxb - len(b))}'
elines.append(line)

line = f'{"=" * maxa} {"=" * maxb}'
elines.append(line)
elines = [' ' + line for line in elines]
lines.extend(elines)
lines.append('\n')
rst.addLines(*lines)
elif key in ('fields',
'schema',
):
if len(str(valu)) < 80:
rst.addLines(f' * {key}: ``{valu}``')
continue
lines = [f' * {key}:\n', ' ::\n\n']
json_lines = json.dumps(valu, indent=1, sort_keys=True)
json_lines = [' ' + line for line in json_lines.split('\n')]
lines.extend(json_lines)
rst.addLines(*lines)
else:
rst.addLines(f' * {key}: ``{valu}``')

for key in info_ignores:
info.pop(key, None)
Expand Down Expand Up @@ -408,8 +451,6 @@ async def docModel(outp,
processFormsProps(rst2, dochelp, forms, univ_names)
processUnivs(rst2, dochelp, univs)

# outp.printf(rst.getRstText())
# outp.printf(rst2.getRstText())
return rst, rst2

async def docConfdefs(ctor, reflink=':ref:`devops-cell-config`'):
Expand Down