Repository: Avaiga/taipy
File: taipy/core/_entity/submittable.py (Python)

Code before:

        Returns:
            The set of output data nodes.
        """
        dag = self._build_dag()
        return self.__get_outputs(dag)

    def __get_outputs(self, dag: nx.DiGraph) -> set[DataNode]:
        return {node for node, degree in dict(dag.out_degree).items() if degree == 0 and isinstance(node, DataNode)}

    def get_intermediate(self) -> Set[DataNode]:
        """Return the set of intermediate data nodes of the submittable entity.

        Returns:
            The set of intermediate data nodes.
        """
        dag = self._build_dag()
        all_data_nodes_in_dag = {node for node in dag.nodes if isinstance(node, DataNode)}
        return all_data_nodes_in_dag - self.__get_inputs(dag) - self.__get_outputs(dag)

    def is_ready_to_run(self) -> Reason:
        """Indicate if the entity is ready to be run.

        Returns:
            A Reason object that can function as a Boolean value.
            True if the given entity is ready to be run. False otherwise.
        """
        reason = Reason(self._submittable_id)

        for node in self.get_inputs():
            if node._edit_in_progress:
                reason._add_reason(node.id, node._build_edit_in_progress_reason())
            if not node._last_edit_date:
                reason._add_reason(node.id, node._build_not_written_reason())

        return reason

    def data_nodes_being_edited(self) -> Set[DataNode]:
        """Return the set of data nodes of the submittable entity that are being edited.

        Returns:
            The set of data nodes that are being edited.
        """
        dag = self._build_dag()
        return {node for node in dag.nodes if isinstance(node, DataNode) and node.edit_in_progress}

    @abc.abstractmethod
    def subscribe(self, callback: Callable[[Submittable, Job], None], params: Optional[List[Any]] = None):
        raise NotImplementedError

    @abc.abstractmethod

Review comment (suggestion):
Just want to make it clearer
```suggestion
            A Reason object that can function as a Boolean value,
            which is True if the given entity is ready to be run or there is no reason to be blocked, False otherwise.
```

Code after:

        Returns:
            The set of output data nodes.
        """
        dag = self._build_dag()
        return self.__get_outputs(dag)

    def __get_outputs(self, dag: nx.DiGraph) -> set[DataNode]:
        return {node for node, degree in dict(dag.out_degree).items() if degree == 0 and isinstance(node, DataNode)}

    def get_intermediate(self) -> Set[DataNode]:
        """Return the set of intermediate data nodes of the submittable entity.

        Returns:
            The set of intermediate data nodes.
        """
        dag = self._build_dag()
        all_data_nodes_in_dag = {node for node in dag.nodes if isinstance(node, DataNode)}
        return all_data_nodes_in_dag - self.__get_inputs(dag) - self.__get_outputs(dag)

    def is_ready_to_run(self) -> Reason:
        """Indicate if the entity is ready to be run.

        Returns:
            A Reason object that can function as a Boolean value.
            which is True if the given entity is ready to be run or there is no reason to be blocked, False otherwise.
        """
        reason = Reason(self._submittable_id)

        for node in self.get_inputs():
            if node._edit_in_progress:
                reason._add_reason(node.id, node._build_edit_in_progress_reason())
            if not node._last_edit_date:
                reason._add_reason(node.id, node._build_not_written_reason())

        return reason

    def data_nodes_being_edited(self) -> Set[DataNode]:
        """Return the set of data nodes of the submittable entity that are being edited.

        Returns:
            The set of data nodes that are being edited.
        """
        dag = self._build_dag()
        return {node for node in dag.nodes if isinstance(node, DataNode) and node.edit_in_progress}

    @abc.abstractmethod
    def subscribe(self, callback: Callable[[Submittable, Job], None], params: Optional[List[Any]] = None):
        raise NotImplementedError

    @abc.abstractmethod