MCPcopy Index your code
hub / github.com/aws/aws-cli / RequestExampleDocumenter

Class RequestExampleDocumenter

awscli/botocore/docs/example.py:192–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190
191
192class RequestExampleDocumenter(BaseExampleDocumenter):
193 EVENT_NAME = 'request-example'
194
195 def document_shape_type_structure(
196 self, section, shape, history, include=None, exclude=None, **kwargs
197 ):
198 param_format = '\'%s\''
199 operator = ': '
200 start = '{'
201 end = '}'
202
203 if len(history) <= 1:
204 operator = '='
205 start = '('
206 end = ')'
207 param_format = '%s'
208 section = section.add_new_section('structure-value')
209 self._start_nested_param(section, start)
210 input_members = self._add_members_to_shape(shape.members, include)
211
212 for i, param in enumerate(input_members):
213 if exclude and param in exclude:
214 continue
215 param_section = section.add_new_section(param)
216 param_section.write(param_format % param)
217 param_section.write(operator)
218 param_shape = input_members[param]
219 param_value_section = param_section.add_new_section(
220 'member-value', context={'shape': param_shape.name}
221 )
222 self.traverse_and_document_shape(
223 section=param_value_section,
224 shape=param_shape,
225 history=history,
226 name=param,
227 )
228 if i < len(input_members) - 1:
229 ending_comma_section = param_section.add_new_section(
230 'ending-comma'
231 )
232 ending_comma_section.write(',')
233 ending_comma_section.style.new_line()
234 self._end_structure(section, start, end)

Callers 4

setUpMethod · 0.90
setUpMethod · 0.90

Calls

no outgoing calls

Tested by 3

setUpMethod · 0.72
setUpMethod · 0.72