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

Function output_range

tools/fromschema.py:100–122  ·  view source on GitHub ↗
(properties)

Source from the content-addressed store, hash-verified

98
99
100def output_range(properties):
101 if 'maximum' and 'minimum' in properties:
102 output(' ({} to {} inclusive)'.format(properties['minimum'], properties['maximum']))
103 elif 'maximum' in properties:
104 output(' (max {})'.format(properties['maximum']))
105 elif 'minimum' in properties:
106 output(' (min {})'.format(properties['minimum']))
107
108 if 'maxLength' and 'minLength' in properties:
109 if properties['minLength'] == properties['maxLength']:
110 output(' (always {} characters)'.format(properties['minLength']))
111 else:
112 output(' ({} to {} characters)'.format(properties['minLength'], properties['maxLength']))
113 elif 'maxLength' in properties:
114 output(' (up to {} characters)'.format(properties['maxLength']))
115 elif 'minLength' in properties:
116 output(' (at least {} characters)'.format(properties['minLength']))
117
118 if 'enum' in properties:
119 if len(properties['enum']) == 1:
120 output(" (always {})".format(json_value(properties['enum'][0])))
121 else:
122 output(' (one of {})'.format(', '.join([json_value(p) for p in properties['enum']])))
123
124
125def fmt_propname(propname):

Callers 1

output_memberFunction · 0.85

Calls 3

outputFunction · 0.85
json_valueFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected