As a parameter in a function signature.
(self)
| 628 | yield doc("\n\n".join(doc_parts)) |
| 629 | |
| 630 | def as_param(self) -> str: |
| 631 | """As a parameter in a function signature.""" |
| 632 | type_ = "Self" if self.is_self else self.type |
| 633 | out = f"{self.name}: {type_}" |
| 634 | if self.default_is_mutable: |
| 635 | if not out.endswith("| None"): |
| 636 | out = f"{out} | None" |
| 637 | out = f"{out} = None" |
| 638 | elif self.has_default: |
| 639 | out = f"{out} = {self.default_value}" |
| 640 | return out |
| 641 | |
| 642 | @joiner |
| 643 | def as_doc(self) -> Iterator[str]: |
no outgoing calls