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

Code before:
    Attributes:
        datanode_id (str): The identifier of the `DataNode^`.
    """

    def __init__(self, datanode_id: str):
        Reason.__init__(self, f"DataNode {datanode_id} is being edited")
        _DataNodeReasonMixin.__init__(self, datanode_id)


class DataNodeIsNotWritten(Reason, _DataNodeReasonMixin):
    """
    DataNodeIsNotWritten holds the reason a `DataNode^` is not yet written,
    which prevents specific actions from being performed.

    Attributes:
        datanode_id (str): The identifier of the `DataNode^`.
    """

    def __init__(self, datanode_id: str):
        Reason.__init__(self, f"DataNode {datanode_id} is not written")
        _DataNodeReasonMixin.__init__(self, datanode_id)


class EntityIsNotSubmittableEntity(Reason):
    """
    EntityIsNotSubmittableEntity holds the reason an entity is not submittable.

    Attributes:
        entity_id (str): The identifier of the `Entity^`.
    """

    def __init__(self, entity_id: str):
        Reason.__init__(self, f"Entity {entity_id} is not a submittable entity")


class WrongConfigType(Reason):
    """
    WrongConfigType holds the reason the provided config is not the valid config expected.

    Attributes:
        config_id (str): The identifier of the config.
        config_type (str): The expected config type.
    """

    def __init__(self, config_id: str, config_type: Optional[str]):
        if config_type:
            reason = f'Object "{config_id}" must be a valid {config_type}'
        else:
            reason = f'Object "{config_id}" is not a valid config to be created'

        Reason.__init__(self, reason)

Review comment (suggestion):
```suggestion
    An entity is not a submittable entity, which prevents specific actions from being performed.
```

Code after:

class DataNodeEditInProgress(Reason, _DataNodeReasonMixin):
    """
    A `DataNode^` is being edited, which prevents specific actions from being performed.

    Attributes:
        datanode_id (str): The identifier of the `DataNode^`.
    """

    def __init__(self, datanode_id: str):
        Reason.__init__(self, f"DataNode {datanode_id} is being edited")
        _DataNodeReasonMixin.__init__(self, datanode_id)


class DataNodeIsNotWritten(Reason, _DataNodeReasonMixin):
    """
    A `DataNode^` has never been written, which prevents specific actions from being performed.

    Attributes:
        datanode_id (str): The identifier of the `DataNode^`.
    """

    def __init__(self, datanode_id: str):
        Reason.__init__(self, f"DataNode {datanode_id} is not written")
        _DataNodeReasonMixin.__init__(self, datanode_id)


class EntityIsNotSubmittableEntity(Reason):
    """
    An entity is not a submittable entity, which prevents specific actions from being performed.

    Attributes:
        entity_id (str): The identifier of the `Entity^`.
    """

    def __init__(self, entity_id: str):
        Reason.__init__(self, f"Entity {entity_id} is not a submittable entity")


class WrongConfigType(Reason):
    """
    A config id is not a valid expected config, which prevents specific actions from being performed.

    Attributes:
        config_id (str): The identifier of the config.
        config_type (str): The expected config type.
    """

    def __init__(self, config_id: str, config_type: Optional[str]):
        if config_type:
            reason = f'Object "{config_id}" must be a valid {config_type}'