MCPcopy Create free account
hub / github.com/ElementsProject/lightning / generate_footer

Function generate_footer

tools/fromschema.py:510–542  ·  view source on GitHub ↗

Output sections which should be printed after return value

(schema, name)

Source from the content-addressed store, hash-verified

508
509
510def generate_footer(schema, name):
511 """Output sections which should be printed after return value"""
512 for key in FOOTER_KEY_SEQUENCE:
513 if key not in schema:
514 continue
515 if key == 'see_also':
516 output_title(key.replace('_', ' ').upper(), '-', 1)
517 # Wrap see_also list with comma separated values
518 output(esc_underscores(', '.join(schema[key])))
519 elif key == 'example_notifications' and len(schema[key]) > 0:
520 output_title(key.replace('_', ' ').upper(), '-', 1)
521 for i, notification in enumerate(schema.get(key, [])):
522 output('{}**Notification {}**: {}\n'.format('' if i == 0 else '\n\n', i + 1, '\n'.join(notification.get('description', ''))))
523 output('```json\n')
524 output(json.dumps(notification, indent=2).strip() + '\n')
525 output('```')
526 elif key == 'examples' and len(schema[key]) > 0:
527 output_title(key.replace('_', ' ').upper(), '-', 1)
528 for i, example in enumerate(schema.get('examples', [])):
529 output('\n{}**Example {}**: {}\n'.format('' if i == 0 else '\n', i + 1, '\n'.join(example.get('description', ''))))
530 output('\nRequest:\n')
531 create_shell_command(name, example)
532 output('```json\n')
533 output(json.dumps(example['request'], indent=2).strip() + '\n')
534 output('```\n')
535 output('\nResponse:\n')
536 output('```json\n')
537 output(json.dumps(example['response'], indent=2).strip() + '\n')
538 output('```')
539 else:
540 output_title(key.replace('_', ' ').upper(), '-', 1)
541 outputs(schema[key], '\n')
542 output('\n')
543
544
545def get_schema_type(schema, capitalize=False):

Callers 1

mainFunction · 0.85

Calls 7

output_titleFunction · 0.85
outputFunction · 0.85
esc_underscoresFunction · 0.85
create_shell_commandFunction · 0.85
outputsFunction · 0.85
joinMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected