Return a newly added |_Relationship| instance.
(
self, reltype: str, target: Part | str, rId: str, is_external: bool = False
)
| 19 | self._target_parts_by_rId: dict[str, Any] = {} |
| 20 | |
| 21 | def add_relationship( |
| 22 | self, reltype: str, target: Part | str, rId: str, is_external: bool = False |
| 23 | ) -> "_Relationship": |
| 24 | """Return a newly added |_Relationship| instance.""" |
| 25 | rel = _Relationship(rId, reltype, target, self._baseURI, is_external) |
| 26 | self[rId] = rel |
| 27 | if not is_external: |
| 28 | self._target_parts_by_rId[rId] = target |
| 29 | return rel |
| 30 | |
| 31 | def get_or_add(self, reltype: str, target_part: Part) -> _Relationship: |
| 32 | """Return relationship of `reltype` to `target_part`, newly added if not already |