Substitute specific `Expr` parameters Parameters ---------- substitutions: Mapping of parameter keys to new values. Keys that are not found in ``self._parameters`` will be ignored.
(self, substitutions: dict)
| 673 | return self |
| 674 | |
| 675 | def substitute_parameters(self, substitutions: dict) -> Expr: |
| 676 | """Substitute specific `Expr` parameters |
| 677 | |
| 678 | Parameters |
| 679 | ---------- |
| 680 | substitutions: |
| 681 | Mapping of parameter keys to new values. Keys that |
| 682 | are not found in ``self._parameters`` will be ignored. |
| 683 | """ |
| 684 | if not substitutions: |
| 685 | return self |
| 686 | |
| 687 | changed = False |
| 688 | new_operands = [] |
| 689 | for i, operand in enumerate(self.operands): |
| 690 | if i < len(self._parameters) and self._parameters[i] in substitutions: |
| 691 | new_operands.append(substitutions[self._parameters[i]]) |
| 692 | changed = True |
| 693 | else: |
| 694 | new_operands.append(operand) |
| 695 | if changed: |
| 696 | return type(self)(*new_operands) |
| 697 | return self |
| 698 | |
| 699 | def _node_label_args(self): |
| 700 | """Operands to include in the node label by `visualize`""" |
no outgoing calls