From 0db326af4e13237e589e1b86916b70bd16f84daa Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Wed, 17 Jan 2024 17:45:29 +0200 Subject: [PATCH] hotfix 2.5.5 resolves #111 --- CHANGELOG.md | 10 ++++++++-- one/__init__.py | 2 +- one/api.py | 3 ++- one/tests/test_one.py | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee170ba7..81d06d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog -## [Latest](https://github.com/int-brain-lab/ONE/commits/main) [2.5.4] +## [Latest](https://github.com/int-brain-lab/ONE/commits/main) [2.5.5] + +### Modified + +- HOTFIX: no eid in frame index when calling list_datasets with eid and details = True + +## [2.5.4] ### Modified @@ -23,7 +29,7 @@ - HOTFIX: exclude irrelevant s3 objects with source name in key, e.g. for foo/bar exclude foo/bar_baz/ key -## [Latest](https://github.com/int-brain-lab/ONE/commits/main) [2.5.0] +## [2.5.0] ### Added diff --git a/one/__init__.py b/one/__init__.py index c72fcb00..d319c051 100644 --- a/one/__init__.py +++ b/one/__init__.py @@ -1,2 +1,2 @@ """The Open Neurophysiology Environment (ONE) API.""" -__version__ = '2.5.4' +__version__ = '2.5.5' diff --git a/one/api.py b/one/api.py index 7b1d6b03..e896f83a 100644 --- a/one/api.py +++ b/one/api.py @@ -1722,8 +1722,9 @@ def list_datasets(self, eid=None, filename=None, collection=None, revision=None, self._update_cache_from_records(sessions=session, datasets=datasets.copy()) if datasets is None or datasets.empty: return self._cache['datasets'].iloc[0:0] if details else [] # Return empty + assert set(datasets.index.unique('eid')) == {eid} datasets = util.filter_datasets( - datasets, assert_unique=False, wildcards=self.wildcards, **filters) + datasets.droplevel('eid'), assert_unique=False, wildcards=self.wildcards, **filters) # Return only the relative path return datasets if details else datasets['rel_path'].sort_values().values.tolist() diff --git a/one/tests/test_one.py b/one/tests/test_one.py index 3dac9436..86ce63cd 100644 --- a/one/tests/test_one.py +++ b/one/tests/test_one.py @@ -323,10 +323,12 @@ def test_list_datasets(self): dsets = self.one.list_datasets(details=True) self.assertEqual(len(dsets), len(self.one._cache.datasets)) self.assertFalse(dsets is self.one._cache.datasets) + self.assertEqual(2, dsets.index.nlevels, 'details data frame should be with eid index') # Test list for eid dsets = self.one.list_datasets('KS005/2019-04-02/001', details=True) self.assertEqual(27, len(dsets)) + self.assertEqual(1, dsets.index.nlevels, 'details data frame should be without eid index') # Test filters filename = {'attribute': ['times', 'intervals'], 'extension': 'npy'} @@ -1281,6 +1283,7 @@ def test_list_datasets(self): dsets = self.one.list_datasets(self.eid, details=True, query_type='remote') self.assertEqual(171, len(dsets)) # this may change after a BWM release or patch + self.assertEqual(1, dsets.index.nlevels, 'details data frame should be without eid index') # Test missing eid dsets = self.one.list_datasets('FMR019/2021-03-18/008', details=True, query_type='remote')