Toan Quach преди 1 година
родител
ревизия
2a90f63637

+ 3 - 3
taipy/core/data/_abstract_file.py

@@ -13,9 +13,9 @@ import pathlib
 import shutil
 
 
-class _AbstractFileDataNodeMixin(object):
-    """Abstract base class for data node implementations (CSVDataNode, ParquetDataNode, ExcelDataNode,
-    PickleDataNode and JSONDataNode) that are file based."""
+class _FileDataNodeMixin(object):
+    """Mixin class designed to handle file-based data nodes
+    (CSVDataNode, ParquetDataNode, ExcelDataNode, PickleDataNode, JSONDataNode, etc.)."""
 
     __EXTENSION_MAP = {"csv": "csv", "excel": "xlsx", "parquet": "parquet", "pickle": "p", "json": "json"}
 

+ 4 - 4
taipy/core/data/_abstract_sql.py

@@ -25,12 +25,12 @@ from taipy.config.common.scope import Scope
 from .._version._version_manager_factory import _VersionManagerFactory
 from ..data.operator import JoinOperator, Operator
 from ..exceptions.exceptions import MissingRequiredProperty, UnknownDatabaseEngine
-from ._abstract_tabular import _AbstractTabularDataNodeMixin
+from ._abstract_tabular import _TabularDataNodeMixin
 from .data_node import DataNode
 from .data_node_id import DataNodeId, Edit
 
 
-class _AbstractSQLDataNode(DataNode, _AbstractTabularDataNodeMixin):
+class _AbstractSQLDataNode(DataNode, _TabularDataNodeMixin):
     """Abstract base class for data node implementations (SQLDataNode and SQLTableDataNode) that use SQL."""
 
     __STORAGE_TYPE = "NOT_IMPLEMENTED"
@@ -95,7 +95,7 @@ class _AbstractSQLDataNode(DataNode, _AbstractTabularDataNodeMixin):
             properties = {}
         self._check_required_properties(properties)
 
-        properties[self._EXPOSED_TYPE_PROPERTY] = _AbstractTabularDataNodeMixin._get_valid_exposed_type(properties)
+        properties[self._EXPOSED_TYPE_PROPERTY] = _TabularDataNodeMixin._get_valid_exposed_type(properties)
         self._check_exposed_type(properties[self._EXPOSED_TYPE_PROPERTY])
 
         DataNode.__init__(
@@ -114,7 +114,7 @@ class _AbstractSQLDataNode(DataNode, _AbstractTabularDataNodeMixin):
             editor_expiration_date,
             **properties,
         )
-        _AbstractTabularDataNodeMixin.__init__(self, **properties)
+        _TabularDataNodeMixin.__init__(self, **properties)
         self._engine = None
         if not self._last_edit_date:  # type: ignore
             self._last_edit_date = datetime.now()

+ 3 - 3
taipy/core/data/_abstract_tabular.py

@@ -17,9 +17,9 @@ import pandas as pd
 from ..exceptions.exceptions import InvalidExposedType
 
 
-class _AbstractTabularDataNodeMixin(object):
-    """Abstract base class for tabular data node implementations (CSVDataNode, ParquetDataNode, ExcelDataNode,
-    SQLTableDataNode and SQLDataNode) that are tabular representable."""
+class _TabularDataNodeMixin(object):
+    """Mixin class designed to handle tabular representable data nodes
+    (CSVDataNode, ParquetDataNode, ExcelDataNode, SQLTableDataNode and SQLDataNode)."""
 
     _HAS_HEADER_PROPERTY = "has_header"
     _EXPOSED_TYPE_PROPERTY = "exposed_type"

+ 5 - 5
taipy/core/data/csv.py

@@ -23,13 +23,13 @@ from taipy.config.common.scope import Scope
 from .._entity._reload import _self_reload
 from .._version._version_manager_factory import _VersionManagerFactory
 from ..job.job_id import JobId
-from ._abstract_file import _AbstractFileDataNodeMixin
-from ._abstract_tabular import _AbstractTabularDataNodeMixin
+from ._abstract_file import _FileDataNodeMixin
+from ._abstract_tabular import _TabularDataNodeMixin
 from .data_node import DataNode
 from .data_node_id import DataNodeId, Edit
 
 
-class CSVDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNodeMixin):
+class CSVDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
     """Data Node stored as a CSV file.
 
     Attributes:
@@ -97,7 +97,7 @@ class CSVDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNode
         if self._HAS_HEADER_PROPERTY not in properties.keys():
             properties[self._HAS_HEADER_PROPERTY] = True
 
-        properties[self._EXPOSED_TYPE_PROPERTY] = _AbstractTabularDataNodeMixin._get_valid_exposed_type(properties)
+        properties[self._EXPOSED_TYPE_PROPERTY] = _TabularDataNodeMixin._get_valid_exposed_type(properties)
         self._check_exposed_type(properties[self._EXPOSED_TYPE_PROPERTY])
 
         DataNode.__init__(
@@ -116,7 +116,7 @@ class CSVDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNode
             editor_expiration_date,
             **properties,
         )
-        _AbstractTabularDataNodeMixin.__init__(self, **properties)
+        _TabularDataNodeMixin.__init__(self, **properties)
 
         self._path = properties.get(self.__PATH_KEY, properties.get(self.__DEFAULT_PATH_KEY))
         if self._path and ".data" in self._path:

+ 8 - 8
taipy/core/data/excel.py

@@ -24,13 +24,13 @@ from .._entity._reload import _self_reload
 from .._version._version_manager_factory import _VersionManagerFactory
 from ..exceptions.exceptions import ExposedTypeLengthMismatch, NonExistingExcelSheet, SheetNameLengthMismatch
 from ..job.job_id import JobId
-from ._abstract_file import _AbstractFileDataNodeMixin
-from ._abstract_tabular import _AbstractTabularDataNodeMixin
+from ._abstract_file import _FileDataNodeMixin
+from ._abstract_tabular import _TabularDataNodeMixin
 from .data_node import DataNode
 from .data_node_id import DataNodeId, Edit
 
 
-class ExcelDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNodeMixin):
+class ExcelDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
     """Data Node stored as an Excel file.
 
     The Excel file format is _xlsx_.
@@ -101,7 +101,7 @@ class ExcelDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNo
             properties[self.__SHEET_NAME_PROPERTY] = None
         if self._HAS_HEADER_PROPERTY not in properties.keys():
             properties[self._HAS_HEADER_PROPERTY] = True
-        properties[self._EXPOSED_TYPE_PROPERTY] = _AbstractTabularDataNodeMixin._get_valid_exposed_type(properties)
+        properties[self._EXPOSED_TYPE_PROPERTY] = _TabularDataNodeMixin._get_valid_exposed_type(properties)
         self._check_exposed_type(properties[self._EXPOSED_TYPE_PROPERTY])
 
         DataNode.__init__(
@@ -120,7 +120,7 @@ class ExcelDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNo
             editor_expiration_date,
             **properties,
         )
-        _AbstractTabularDataNodeMixin.__init__(self, **properties)
+        _TabularDataNodeMixin.__init__(self, **properties)
         if self._path and ".data" in self._path:
             self._path = self._migrate_path(self.storage_type(), self._path)
 
@@ -172,13 +172,13 @@ class ExcelDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNo
     @staticmethod
     def _check_exposed_type(exposed_type):
         if isinstance(exposed_type, str):
-            _AbstractTabularDataNodeMixin._check_exposed_type(exposed_type)
+            _TabularDataNodeMixin._check_exposed_type(exposed_type)
         elif isinstance(exposed_type, list):
             for t in exposed_type:
-                _AbstractTabularDataNodeMixin._check_exposed_type(t)
+                _TabularDataNodeMixin._check_exposed_type(t)
         elif isinstance(exposed_type, dict):
             for t in exposed_type.values():
-                _AbstractTabularDataNodeMixin._check_exposed_type(t)
+                _TabularDataNodeMixin._check_exposed_type(t)
 
     def _read(self):
         if self.properties[self._EXPOSED_TYPE_PROPERTY] == self._EXPOSED_TYPE_PANDAS:

+ 2 - 2
taipy/core/data/json.py

@@ -22,12 +22,12 @@ from taipy.config.common.scope import Scope
 
 from .._entity._reload import _self_reload
 from .._version._version_manager_factory import _VersionManagerFactory
-from ._abstract_file import _AbstractFileDataNodeMixin
+from ._abstract_file import _FileDataNodeMixin
 from .data_node import DataNode
 from .data_node_id import DataNodeId, Edit
 
 
-class JSONDataNode(DataNode, _AbstractFileDataNodeMixin):
+class JSONDataNode(DataNode, _FileDataNodeMixin):
     """Data Node stored as a JSON file.
 
     Attributes:

+ 5 - 5
taipy/core/data/parquet.py

@@ -23,13 +23,13 @@ from .._entity._reload import _self_reload
 from .._version._version_manager_factory import _VersionManagerFactory
 from ..exceptions.exceptions import UnknownCompressionAlgorithm, UnknownParquetEngine
 from ..job.job_id import JobId
-from ._abstract_file import _AbstractFileDataNodeMixin
-from ._abstract_tabular import _AbstractTabularDataNodeMixin
+from ._abstract_file import _FileDataNodeMixin
+from ._abstract_tabular import _TabularDataNodeMixin
 from .data_node import DataNode
 from .data_node_id import DataNodeId, Edit
 
 
-class ParquetDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularDataNodeMixin):
+class ParquetDataNode(DataNode, _FileDataNodeMixin, _TabularDataNodeMixin):
     """Data Node stored as a Parquet file.
 
     Attributes:
@@ -134,7 +134,7 @@ class ParquetDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularData
         if self.__WRITE_KWARGS_PROPERTY not in properties.keys():
             properties[self.__WRITE_KWARGS_PROPERTY] = {}
 
-        properties[self._EXPOSED_TYPE_PROPERTY] = _AbstractTabularDataNodeMixin._get_valid_exposed_type(properties)
+        properties[self._EXPOSED_TYPE_PROPERTY] = _TabularDataNodeMixin._get_valid_exposed_type(properties)
         self._check_exposed_type(properties[self._EXPOSED_TYPE_PROPERTY])
 
         DataNode.__init__(
@@ -153,7 +153,7 @@ class ParquetDataNode(DataNode, _AbstractFileDataNodeMixin, _AbstractTabularData
             editor_expiration_date,
             **properties,
         )
-        _AbstractTabularDataNodeMixin.__init__(self, **properties)
+        _TabularDataNodeMixin.__init__(self, **properties)
 
         self._path = properties.get(self.__PATH_KEY, properties.get(self.__DEFAULT_PATH_KEY))
 

+ 2 - 2
taipy/core/data/pickle.py

@@ -18,12 +18,12 @@ from taipy.config.common.scope import Scope
 
 from .._entity._reload import _self_reload
 from .._version._version_manager_factory import _VersionManagerFactory
-from ._abstract_file import _AbstractFileDataNodeMixin
+from ._abstract_file import _FileDataNodeMixin
 from .data_node import DataNode
 from .data_node_id import DataNodeId, Edit
 
 
-class PickleDataNode(DataNode, _AbstractFileDataNodeMixin):
+class PickleDataNode(DataNode, _FileDataNodeMixin):
     """Data Node stored as a pickle file.
 
     Attributes:

+ 3 - 3
taipy/gui_core/_context.py

@@ -52,7 +52,7 @@ from taipy.core import (
 from taipy.core import delete as core_delete
 from taipy.core import get as core_get
 from taipy.core import submit as core_submit
-from taipy.core.data._abstract_tabular import _AbstractTabularDataNodeMixin
+from taipy.core.data._abstract_tabular import _TabularDataNodeMixin
 from taipy.core.notification import CoreEventConsumerBase, EventEntityType
 from taipy.core.notification.event import Event, EventOperation
 from taipy.core.notification.notifier import Notifier
@@ -724,7 +724,7 @@ class _GuiCoreContext(CoreEventConsumerBase):
 
     @staticmethod
     def __is_tabular_data(datanode: DataNode, value: t.Any):
-        if isinstance(datanode, _AbstractTabularDataNodeMixin):
+        if isinstance(datanode, _TabularDataNodeMixin):
             return True
         if datanode.is_ready_for_reading:
             return isinstance(value, (pd.DataFrame, pd.Series, list, tuple, dict))
@@ -739,7 +739,7 @@ class _GuiCoreContext(CoreEventConsumerBase):
             and isinstance(dn, DataNode)
         ):
             if dn._last_edit_date:
-                if isinstance(dn, _AbstractTabularDataNodeMixin):
+                if isinstance(dn, _TabularDataNodeMixin):
                     return (None, None, True, None)
                 try:
                     value = dn.read()