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

Code before:
    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)


class NotGlobalScope(Reason):
    """
    NotGlobalScope holds the reason the data node config does not have a GLOBAL scope,
    which prevents certain actions from being performed.

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

    def __init__(self, config_id: str):

Review comment (suggestion):
```suggestion
    A config id is not a valid expected config, which prevents specific actions from being performed.
```

Code after:


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}'
        else:
            reason = f'Object "{config_id}" is not a valid config to be created'

        Reason.__init__(self, reason)


class NotGlobalScope(Reason):
    """
    A data node config does not have a GLOBAL scope, which prevents specific actions from being performed.

    Attributes:
        config_id (str): The identifier of the config.