Repository: aeon-toolkit/aeon
Pull request #1353 (2024-03-27 20:05:34)

[BUG] Stop joining Nones
fix incorrect usage of os.join("FOO",None) in edge test configuration

aeon-actions-bot[bot]: 
## Thank you for contributing to `aeon`

I have added the following labels to this PR based on the title: **[ $\\color{#d73a4a}{\\textsf{bug}}$ ]**.
I would have added the following labels to this PR based on the changes made: **[ $\\color{#0B1D38}{\\textsf{datasets}}$ ]**, however some package labels are already present.

The [Checks](https://github.com/aeon-toolkit/aeon/pull/1353/checks) tab will show the status of our automated tests. You can click on individual test runs in the tab or "Details" in the panel below to see more information if there is a failure.

If our `pre-commit` code quality check fails, any trivial fixes will automatically be pushed to your PR unless it is a draft.

Don't hesitate to ask questions on the `aeon` [Slack](
https://join.slack.com/t/aeon-toolkit/shared_invite/zt-22vwvut29-HDpCu~7VBUozyfL_8j3dLA) channel if you have any.
    

Patch:
diff --git a/aeon/datasets/_data_loaders.py b/aeon/datasets/_data_loaders.py
index cd6a55ee..58578249 100644
--- a/aeon/datasets/_data_loaders.py
+++ b/aeon/datasets/_data_loaders.py
@@ -1272,18 +1272,21 @@ def load_classification(
     else:
         local_module = MODULE
         local_dirname = "data"
-    if not os.path.exists(os.path.join(local_module, local_dirname)):
-        os.makedirs(os.path.join(local_module, local_dirname))
-    path = os.path.join(local_module, local_dirname)
+    if local_dirname is None:
+        path = local_module
+    else:
+        path = os.path.join(local_module, local_dirname)
+    if not os.path.exists(path):
+        os.makedirs(path)
     if name not in get_downloaded_tsc_tsr_datasets(path):
         if extract_path is None:
             local_dirname = "local_data"
             path = os.path.join(local_module, local_dirname)
-        if not os.path.exists(os.path.join(local_module, local_dirname)):
-            os.makedirs(os.path.join(local_module, local_dirname))
-        if name not in get_downloaded_tsc_tsr_datasets(
-            os.path.join(local_module, local_dirname)
-        ):
+        else:
+            path = extract_path
+        if not os.path.exists(path):
+            os.makedirs(path)
+        if name not in get_downloaded_tsc_tsr_datasets(path):
             # Check if on timeseriesclassification.com
             url = f"https://timeseriesclassification.com/aeon-toolkit/{name}.zip"
             # Test if file exists to generate more informative error
@@ -1299,7 +1302,7 @@ def load_classification(
                 # Check the status code of the response
                 if response.status != 200:
                     raise ValueError(msg)
-            except HTTPError:
+            except (HTTPError, URLError, TimeoutError):
                 raise ValueError(msg)
             try:
                 _download_and_extract(


Test patch:
diff --git a/aeon/datasets/tests/test_data_loaders.py b/aeon/datasets/tests/test_data_loaders.py
index 0b465ed7..85adeb35 100644
--- a/aeon/datasets/tests/test_data_loaders.py
+++ b/aeon/datasets/tests/test_data_loaders.py
@@ -60,9 +60,7 @@ def test_load_forecasting_from_repo():
 )
 def test_load_classification_from_repo():
     name = "FOO"
-    with pytest.raises(
-        ValueError, match=f"dataset name ={name} is not available on extract path"
-    ):
+    with pytest.raises(ValueError):
         load_classification(name)
     name = "SonyAIBORobotSurface1"
     X, y, meta = load_classification(name, return_metadata=True)