Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lingyielia committed Nov 8, 2023
1 parent 0632ec9 commit a17d88a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions vizro-core/src/vizro/managers/_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def set_cache_config(self, timeout: int = None, unless: Callable = None):
"""Sets the cache configuration for the dataset."""
self._cache_arguments["timeout"] = timeout
self._cache_arguments["unless"] = unless
print(f"set_cache_config: {self._cache_arguments}")
logger.debug(f"set_cache_config: {self._cache_arguments}")


class DataManager:
Expand Down Expand Up @@ -65,21 +65,19 @@ def __setitem__(self, dataset_name: DatasetName, data: Union[pd.DataFrame, pd_La
raise ValueError(f"Dataset {dataset_name} already exists.")

if callable(data):
# self.__lazy_data[dataset_name] = data
data = VizroDataSet(data)
elif isinstance(data, pd.DataFrame):
self.__original_data[dataset_name] = data
elif isinstance(data, VizroDataSet):
pass
# self.__lazy_data[dataset_name] = data.data
# self.__cache_dataset_arguments[dataset_name] = data.get_cache_config()
else:
raise TypeError(
f"Dataset {dataset_name} must be a pandas DataFrame or callable that returns pandas DataFrame."
f"Additionally, it can be a VizroDataSet object."
)

if isinstance(data, VizroDataSet):
self.__lazy_data[dataset_name] = data
# self.__cache_dataset_arguments[dataset_name] = data.get_cache_config()

def __getitem__(self, dataset_name: DatasetName) -> VizroDataSet:
"""Returns the `VizroDataSet` object associated with `dataset_name`."""
Expand Down

0 comments on commit a17d88a

Please sign in to comment.