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

Function output_conditional_params

tools/fromschema.py:74–86  ·  view source on GitHub ↗

Output request parameters with appropriate separator based on the separator

(conditional_sub_array, condition)

Source from the content-addressed store, hash-verified

72
73
74def output_conditional_params(conditional_sub_array, condition):
75 """Output request parameters with appropriate separator based on the separator"""
76 # If the request has 'oneOfMany', then print them in one param section with OR (|) sign.
77 # 'oneOfMany' example `plugin`: [*plugin|directory*]
78 # If the request has 'pairedWith', then print them in one param section separated with space.
79 # 'pairedWith' example `delpay`: [*partid* *groupid*]
80 # If the request has 'dependentUpon', then print them in one param section separated with space.
81 # 'dependentUpon' example `listforwards`: [*index* [*start*] [*limit*]]
82 separator = {'oneOfMany': '|', 'pairedWith': '* *', 'dependentUpon': '*] [*'}.get(condition, '')
83 # Join all keys with the separator
84 keysfoundstr = format(esc_underscores(separator.join(conditional_sub_array)))
85 # Print the merged keys
86 output('{}'.format(fmt_paramname(keysfoundstr, True, condition != 'dependentUpon')))
87
88
89def output_type(properties, is_optional):

Callers 1

generate_headerFunction · 0.85

Calls 6

formatEnum · 0.85
esc_underscoresFunction · 0.85
outputFunction · 0.85
fmt_paramnameFunction · 0.85
joinMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected