Skip to content

Commit

Permalink
refactor: remove deprecated functions;
Browse files Browse the repository at this point in the history
  • Loading branch information
WenjieDu committed Jan 15, 2024
1 parent fa3aac1 commit 4765a77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 115 deletions.
25 changes: 9 additions & 16 deletions tsdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@
#
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
__version__ = "0.3"
__version__ = "0.3.1"

from .utils.file import migrate
from .data_processing import (
list,
load,
download_and_extract,
list_cache,
delete_cache,
purge_path,
CACHED_DATASET_DIR,
)
from .utils.file import (
purge_path,
pickle_dump,
pickle_load,
# below are deprecated functions, import for now, will be removed in v0.2
list_database,
list_available_datasets,
list_cached_data,
load_dataset,
delete_cached_data,
migrate,
migrate_cache,
)

__all__ = [
Expand All @@ -49,15 +46,11 @@
"download_and_extract",
"list_cache",
"delete_cache",
"purge_path",
"CACHED_DATASET_DIR",
# file
"purge_path",
"pickle_dump",
"pickle_load",
"migrate",
# below are deprecated functions, import for now, will be removed in v0.2
"list_database",
"list_available_datasets",
"list_cached_data",
"load_dataset",
"delete_cached_data",
"migrate_cache",
]
99 changes: 0 additions & 99 deletions tsdb/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,102 +166,3 @@ def delete_cache(dataset_name=None) -> None:
dir_to_delete = CACHED_DATASET_DIR
logger.info(f"Purging all cached data under {CACHED_DATASET_DIR}...")
purge_path(dir_to_delete)


# deprecated functions below


def list_available_datasets():
"""List all available datasets.
Returns
-------
AVAILABLE_DATASETS : list
A list contains all datasets' names.
Warnings
--------
The method list_available_datasets is deprecated. Please use ``list()`` instead.
"""
logger.warning(
"🚨DeprecationWarning: The method list_available_datasets is deprecated. Please use `list()` instead."
)
return list()


def list_database():
"""List the database.
Returns
-------
DATABASE : dict
A dict contains all datasets' names and download links.
Warnings
--------
The method list_available_datasets is deprecated. Please use `list()` instead.
"""
logger.warning(
"🚨DeprecationWarning: The method list_available_datasets is deprecated. Please use `list()` instead."
)
return list()


def list_cached_data():
"""List names of all cached datasets.
Returns
-------
list,
A list contains all cached datasets' names.
Warnings
--------
The method list_cached_data is deprecated. Please use `list_cache()` instead.
"""
logger.warning(
"🚨DeprecationWarning: The method list_cached_data is deprecated. Please use `list_cache()` instead."
)
return list_cache()


def load_dataset(dataset_name, use_cache=True):
"""Load dataset with given name.
Parameters
----------
dataset_name : str,
The name of the specific dataset in database.DATABASE.
use_cache : bool,
Whether to use cache (including data downloading and processing)
Returns
-------
result:
Loaded dataset in a Python dict.
Warnings
--------
The method load_dataset is deprecated. Please use `load()` instead.
"""
logger.warning(
"🚨DeprecationWarning: The method load_dataset is deprecated. Please use `load()` instead."
)
return load(dataset_name, use_cache)


def delete_cached_data(dataset_name=None):
"""Delete CACHED_DATASET_DIR if exists.
Warnings
--------
The method delete_cached_data is deprecated. Please use `delete_cache()` instead.
"""
logger.warning(
"🚨DeprecationWarning: The method delete_cached_data is deprecated. Please use `delete_cache()` instead."
)
delete_cache(dataset_name)

0 comments on commit 4765a77

Please sign in to comment.