Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raising importErr when data is not available for testing. #27

Merged
merged 9 commits into from
Nov 26, 2024

Conversation

Jad-yehya
Copy link
Collaborator

No description provided.

datasets/wadi.py Outdated
Comment on lines 8 to 19
path = get_data_path(key="WADI")
if (
not (path / "WADI_14days_new.csv").exists()
) or (
not (path / "WADI_attackdataLABLE.csv").exists()
):
raise ImportError(
"Test data not found. Please download the data "
"from the official repository "
"https://itrust.sutd.edu.sg/itrust-labs_datasets/dataset_info/"
f" and place it in {path}"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a function check_data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good idea

Copy link
Member

@tomMoral tomMoral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more comments

"from the official repository "
f"{official_repo[dataset]}"
f"and place it in {data_path}"
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking more of putting this function in each dataset, but it can be ok like this if you prefer.

raise ValueError("dataset must be either 'WADI' or 'SWaT'")

for file in required_files:
if not os.path.exists(os.path.join(data_path, file)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use os.path but use pathlib.Path.

benchmark_utils/__init__.py Outdated Show resolved Hide resolved
benchmark_utils/__init__.py Outdated Show resolved Hide resolved
benchmark_utils/__init__.py Outdated Show resolved Hide resolved
datasets/swat.py Outdated

with safe_import_context() as import_ctx:
import pandas as pd

# Checking if the data is available
path = get_data_path(key="SWaT")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use a global variable, make it all capital.

@tomMoral tomMoral merged commit 6727b4c into main Nov 26, 2024
3 of 4 checks passed
@tomMoral tomMoral deleted the datasets-importerr branch November 26, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants