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)
| 658 | return self |
| 659 | |
| 660 | def substitute_parameters(self, substitutions: dict) -> Expr: |
| 661 | """Substitute specific `Expr` parameters |
| 662 | |
| 663 | Parameters |
| 664 | ---------- |
| 665 | substitutions: |
| 666 | Mapping of parameter keys to new values. Keys that |
| 667 | are not found in ``self._parameters`` will be ignored. |
| 668 | """ |
| 669 | if not substitutions: |
| 670 | return self |
| 671 | |
| 672 | changed = False |
| 673 | new_operands = [] |
| 674 | for i, operand in enumerate(self.operands): |
| 675 | if i < len(self._parameters) and self._parameters[i] in substitutions: |
| 676 | new_operands.append(substitutions[self._parameters[i]]) |
| 677 | changed = True |
| 678 | else: |
| 679 | new_operands.append(operand) |
| 680 | if changed: |
| 681 | return type(self)(*new_operands) |
| 682 | return self |
| 683 | |
| 684 | def _node_label_args(self): |
| 685 | """Operands to include in the node label by `visualize`""" |
no outgoing calls