Documents parameter value constraints
(self, model, doc)
| 377 | doc.style.end_note() |
| 378 | |
| 379 | def _document_constraints(self, model, doc): |
| 380 | """Documents parameter value constraints""" |
| 381 | if not hasattr(model, 'metadata'): |
| 382 | return |
| 383 | constraints = ['min', 'max', 'pattern'] |
| 384 | if not any( |
| 385 | [constraint in model.metadata for constraint in constraints] |
| 386 | ): |
| 387 | return |
| 388 | doc.style.new_paragraph() |
| 389 | doc.write('Constraints:') |
| 390 | doc.style.start_ul() |
| 391 | for constraint in constraints: |
| 392 | if (val := model.metadata.get(constraint)) is not None: |
| 393 | doc.style.li(f'{constraint}: ``{val}``') |
| 394 | doc.style.end_ul() |
| 395 | |
| 396 | |
| 397 | class ProviderDocumentEventHandler(CLIDocumentEventHandler): |
no test coverage detected