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