Skip to content

Commit

Permalink
Merge pull request #33 from int-brain-lab/ucla
Browse files Browse the repository at this point in the history
iter session returns the session path if a session path is provided
  • Loading branch information
oliche authored Feb 3, 2022
2 parents 5a51782 + 6462251 commit c19de3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions one/alf/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ def iter_sessions(root_dir):
pathlib.Path
The next session path in lexicographical order
"""
if spec.is_session_path(root_dir):
yield root_dir
for path in sorted(Path(root_dir).rglob('*')):
if path.is_dir() and spec.is_session_path(path):
yield path
Expand Down
2 changes: 2 additions & 0 deletions one/tests/alf/test_alf_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@ def test_iter_sessions(self):
valid_sessions = alfio.iter_sessions(self.tempdir.name)
self.assertEqual(next(valid_sessions), self.session_path)
self.assertFalse(next(valid_sessions, False))
# makes sure that the session path returns itself on the iterator
self.assertEqual(self.session_path, next(alfio.iter_sessions(self.session_path)))


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

setup(
name='ONE-api',
version='1.7.2',
version='1.7.3',
python_requires='>={}.{}'.format(*REQUIRED_PYTHON),
description='Open Neurophysiology Environment',
license="MIT",
Expand Down

0 comments on commit c19de3e

Please sign in to comment.