Generates an example based on a shape :param section: The section to write the documentation to. :param shape: The shape of the operation. :param prefix: Anything to be included before the example :type include: Dictionary where keys are parameter names and
(
self, section, shape, prefix=None, include=None, exclude=None
)
| 16 | |
| 17 | class BaseExampleDocumenter(ShapeDocumenter): |
| 18 | def document_example( |
| 19 | self, section, shape, prefix=None, include=None, exclude=None |
| 20 | ): |
| 21 | """Generates an example based on a shape |
| 22 | |
| 23 | :param section: The section to write the documentation to. |
| 24 | |
| 25 | :param shape: The shape of the operation. |
| 26 | |
| 27 | :param prefix: Anything to be included before the example |
| 28 | |
| 29 | :type include: Dictionary where keys are parameter names and |
| 30 | values are the shapes of the parameter names. |
| 31 | :param include: The parameter shapes to include in the documentation. |
| 32 | |
| 33 | :type exclude: List of the names of the parameters to exclude. |
| 34 | :param exclude: The names of the parameters to exclude from |
| 35 | documentation. |
| 36 | """ |
| 37 | history = [] |
| 38 | section.style.new_line() |
| 39 | section.style.start_codeblock() |
| 40 | if prefix is not None: |
| 41 | section.write(prefix) |
| 42 | self.traverse_and_document_shape( |
| 43 | section=section, |
| 44 | shape=shape, |
| 45 | history=history, |
| 46 | include=include, |
| 47 | exclude=exclude, |
| 48 | ) |
| 49 | |
| 50 | def document_recursive_shape(self, section, shape, **kwargs): |
| 51 | section.write('{\'... recursive ...\'}') |