Skip to content

Commit

Permalink
skip mac sidecars (#470)
Browse files Browse the repository at this point in the history
* skip mac sidecars

* moved skip to right after glob

* added test for ._ nwb file

* updated changelog

* trigger pre-commit

* trigger pre-commit

* trigger pre-commit

* reformat line break

* added non-matching timestamps to sidecar file

* changed ._ file to last one in the list

---------

Co-authored-by: Cody Baker <[email protected]>
  • Loading branch information
pauladkisson and CodyCBakerPhD authored May 30, 2024
1 parent 4fa24bf commit 9f242ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Fixed the suggested rate in `check_regular_timestamps` to be in Hz [#467](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/467)

* Added a skip for mac sidecar files (._*): [#470](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/470)

# v0.4.35

### Fixes
Expand Down
3 changes: 3 additions & 0 deletions src/nwbinspector/nwbinspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ def inspect_all(
in_path = Path(path)
if in_path.is_dir():
nwbfiles = list(in_path.rglob("*.nwb"))

# Remove any macOS sidecar files
nwbfiles = [nwbfile for nwbfile in nwbfiles if not nwbfile.name.startswith("._")]
elif in_path.is_file():
nwbfiles = [in_path]
else:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def setUpClass(cls):
check_data_orientation,
check_timestamps_match_first_dimension,
]
num_nwbfiles = 3
num_nwbfiles = 4
nwbfiles = list()
for j in range(num_nwbfiles):
nwbfiles.append(make_minimal_nwbfile())
Expand All @@ -100,9 +100,11 @@ def setUpClass(cls):
add_non_matching_timestamps_dimension(nwbfiles[0])
add_simple_table(nwbfiles[0])
add_regular_timestamps(nwbfiles[1])
# Last file to be left without violations
# Third file to be left without violations
add_non_matching_timestamps_dimension(nwbfiles[3])

cls.nwbfile_paths = [str(cls.tempdir / f"testing{j}.nwb") for j in range(num_nwbfiles)]
cls.nwbfile_paths[3] = str(cls.tempdir / f"._testing3.nwb")
for nwbfile_path, nwbfile in zip(cls.nwbfile_paths, nwbfiles):
with NWBHDF5IO(path=nwbfile_path, mode="w") as io:
io.write(nwbfile)
Expand Down

0 comments on commit 9f242ff

Please sign in to comment.