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

Code before:
from ..common.scope import Scope
from ._file_datanode_mixin import _FileDataNodeMixin
from ._tabular_datanode_mixin import _TabularDataNodeMixin
from .data_node import DataNode
from .data_node_id import DataNodeId, Edit


class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
    """Data Node stored as a CSV file.

    The *properties* attribute can contain the following optional entries:

    - *encoding* (`str`): The encoding of the CSV file. The default value is `utf-8`.
    - *default_path* (`str`): The default path of the CSV file used at the instantiation of the
        data node.
    - *default_data*: The default data of the data node. It is used at the data node instantiation
        to write the data to the CSV file.
    - *has_header* (`bool`): If True, indicates that the CSV file has a header.
    - *separator* (`str`): The separator used in the CSV file. The default value is `,`.
    - *exposed_type*: The exposed type of the data read from CSV file. The default value is `pandas`.
    """

    __STORAGE_TYPE = "csv"
    _ENCODING_KEY = "encoding"
    _SEPARATOR_KEY = "separator"

    _REQUIRED_PROPERTIES: List[str] = []

    def __init__(
        self,
        config_id: str,
        scope: Scope,
        id: Optional[DataNodeId] = None,
        owner_id: Optional[str] = None,
        parent_ids: Optional[Set[str]] = None,
        last_edit_date: Optional[datetime] = None,
        edits: Optional[List[Edit]] = None,
        version: Optional[str] = None,
        validity_period: Optional[timedelta] = None,
        edit_in_progress: bool = False,
        editor_id: Optional[str] = None,
        editor_expiration_date: Optional[datetime] = None,
        properties: Optional[Dict] = None,
    ) -> None:
        self.id = id or self._new_id(config_id)

        if properties is None:
            properties = {}

        if self._ENCODING_KEY not in properties.keys():
            properties[self._ENCODING_KEY] = "utf-8"

Review comment (suggestion):
```suggestion
    _SEPARATOR_KEY = "separator"
    _DEFAULT_SEPARATOR_VALUE = ","
```

Code after:
from ..common.scope import Scope
from ._file_datanode_mixin import _FileDataNodeMixin
from ._tabular_datanode_mixin import _TabularDataNodeMixin
from .data_node import DataNode
from .data_node_id import DataNodeId, Edit


class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
    """Data Node stored as a CSV file.

    The *properties* attribute can contain the following optional entries:

    - *encoding* (`str`): The encoding of the CSV file. The default value is `utf-8`.
    - *default_path* (`str`): The default path of the CSV file used at the instantiation of the
        data node.
    - *default_data*: The default data of the data node. It is used at the data node instantiation
        to write the data to the CSV file.
    - *has_header* (`bool`): If True, indicates that the CSV file has a header.
    - *separator* (`str`): The separator used in the CSV file. The default value is `,`.
    - *exposed_type*: The exposed type of the data read from CSV file. The default value is `pandas`.
    """

    __STORAGE_TYPE = "csv"
    _ENCODING_KEY = "encoding"
    _DEFAULT_ENCODING_VALUE = "utf-8"
    _SEPARATOR_KEY = "separator"
    _DEFAULT_SEPARATOR_VALUE = ","

    _REQUIRED_PROPERTIES: List[str] = []

    def __init__(
        self,
        config_id: str,
        scope: Scope,
        id: Optional[DataNodeId] = None,
        owner_id: Optional[str] = None,
        parent_ids: Optional[Set[str]] = None,
        last_edit_date: Optional[datetime] = None,
        edits: Optional[List[Edit]] = None,
        version: Optional[str] = None,
        validity_period: Optional[timedelta] = None,
        edit_in_progress: bool = False,
        editor_id: Optional[str] = None,
        editor_expiration_date: Optional[datetime] = None,
        properties: Optional[Dict] = None,
    ) -> None:
        self.id = id or self._new_id(config_id)

        if properties is None:
            properties = {}