def set_name()

in pythonflow/core.py [0:0]


    def set_name(self, name):
        """
        Set the name of the operation and update the graph.

        Parameters
        ----------
        value : str
            Unique name of the operation.

        Returns
        -------
        self : Operation
            This operation.

        Raises
        ------
        ValueError
            If an operation with `value` already exists in the associated graph.
        KeyError
            If the current name of the operation cannot be found in the associated graph.
        """
        if name in self.graph.operations:
            raise ValueError(f"duplicate name '{name}'")
        if self._name is not None:
            self.graph.operations.pop(self._name)
        self.graph.operations[name] = self
        self._name = name
        return self