Documents the signature of a model-driven method :param section: The section to write the documentation to. :param name: The name of the method :param operation_model: The operation model for the method :type include: Dictionary where keys are parameter names and values a
(
section, name, operation_model, include=None, exclude=None
)
| 44 | |
| 45 | |
| 46 | def document_model_driven_signature( |
| 47 | section, name, operation_model, include=None, exclude=None |
| 48 | ): |
| 49 | """Documents the signature of a model-driven method |
| 50 | |
| 51 | :param section: The section to write the documentation to. |
| 52 | |
| 53 | :param name: The name of the method |
| 54 | |
| 55 | :param operation_model: The operation model for the method |
| 56 | |
| 57 | :type include: Dictionary where keys are parameter names and |
| 58 | values are the shapes of the parameter names. |
| 59 | :param include: The parameter shapes to include in the documentation. |
| 60 | |
| 61 | :type exclude: List of the names of the parameters to exclude. |
| 62 | :param exclude: The names of the parameters to exclude from |
| 63 | documentation. |
| 64 | """ |
| 65 | params = {} |
| 66 | if operation_model.input_shape: |
| 67 | params = operation_model.input_shape.members |
| 68 | |
| 69 | parameter_names = list(params.keys()) |
| 70 | |
| 71 | if include is not None: |
| 72 | for member in include: |
| 73 | parameter_names.append(member.name) |
| 74 | |
| 75 | if exclude is not None: |
| 76 | for member in exclude: |
| 77 | if member in parameter_names: |
| 78 | parameter_names.remove(member) |
| 79 | |
| 80 | signature_params = '' |
| 81 | if parameter_names: |
| 82 | signature_params = '**kwargs' |
| 83 | section.style.start_sphinx_py_method(name, signature_params) |
| 84 | |
| 85 | |
| 86 | def document_custom_signature( |