Return the Python type annotation for this return.
(self)
| 542 | |
| 543 | @property |
| 544 | def py_annotation(self): |
| 545 | """Return the Python type annotation for this return.""" |
| 546 | if self.items: |
| 547 | if self.items.ref: |
| 548 | py_ref = ref_to_python(self.items.ref) |
| 549 | ann = f"typing.List[{py_ref}]" |
| 550 | else: |
| 551 | py_type = CdpPrimitiveType.get_annotation(self.items.type) |
| 552 | ann = f"typing.List[{py_type}]" |
| 553 | else: |
| 554 | if self.ref: |
| 555 | py_ref = ref_to_python(self.ref) |
| 556 | ann = f"{py_ref}" |
| 557 | else: |
| 558 | ann = CdpPrimitiveType.get_annotation(self.type) |
| 559 | if self.optional: |
| 560 | ann = f"typing.Optional[{ann}]" |
| 561 | return ann |
| 562 | |
| 563 | def generate_doc(self): |
| 564 | """Generate the docstring for this return.""" |
nothing calls this directly
no test coverage detected