This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
forked from dandi/dandi-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RF: pre-commit all files (excluding versioneer related)
- Loading branch information
1 parent
563a949
commit 9ce9165
Showing
9 changed files
with
35 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ dist/ | |
pip-wheel-metadata/ | ||
sandbox/ | ||
venvs/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,3 @@ | |
too cubmersome. yoh thinks he saw a bit more lightweight somewhere. | ||
e.g. girder-client | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
""" | ||
Various utilities, typically to support use of external modules etc | ||
""" | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,30 @@ | ||
from datetime import ( | ||
datetime, | ||
) | ||
from datetime import datetime | ||
from dateutil.tz import tzutc | ||
|
||
import pynwb | ||
from ..pynwb_utils import ( | ||
metadata_fields, | ||
) | ||
from ..pynwb_utils import metadata_fields | ||
|
||
import pytest | ||
|
||
# TODO: move into some common fixtures. We might produce a number of files | ||
# and also carry some small ones directly in git for regression testing | ||
@pytest.fixture(scope='session') | ||
@pytest.fixture(scope="session") | ||
def simple1_nwb_metadata(tmpdir_factory): | ||
# very simple assignment with the same values as the key with 1 as suffix | ||
metadata = {f: "{}1".format(f) for f in metadata_fields} | ||
# tune specific ones: | ||
# Needs an explicit time zone since otherwise pynwb would add one | ||
# But then comparison breaks anyways any ways yoh have tried to set it | ||
# for datetime.now. Taking example from pynwb tests | ||
metadata['session_start_time'] = datetime(2017, 4, 15, 12, tzinfo=tzutc()) | ||
metadata['keywords'] = ['keyword1', 'keyword 2'] | ||
metadata["session_start_time"] = datetime(2017, 4, 15, 12, tzinfo=tzutc()) | ||
metadata["keywords"] = ["keyword1", "keyword 2"] | ||
return metadata | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
@pytest.fixture(scope="session") | ||
def simple1_nwb(simple1_nwb_metadata, tmpdir_factory): | ||
filename = str(tmpdir_factory.mktemp('data').join('simple1.nwb')) | ||
filename = str(tmpdir_factory.mktemp("data").join("simple1.nwb")) | ||
nwbfile = pynwb.NWBFile(**simple1_nwb_metadata) | ||
with pynwb.NWBHDF5IO(filename, 'w') as io: | ||
with pynwb.NWBHDF5IO(filename, "w") as io: | ||
io.write(nwbfile, cache_spec=False) | ||
return filename | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
import pynwb | ||
|
||
from ..pynwb_utils import ( | ||
get_metadata, | ||
) | ||
|
||
from ..pynwb_utils import get_metadata | ||
|
||
|
||
def test_get_metadata(simple1_nwb, simple1_nwb_metadata): | ||
target_metadata = simple1_nwb_metadata.copy() | ||
# we will also get some counts | ||
target_metadata['number_of_electrodes'] = 0 | ||
target_metadata['number_of_units'] = 0 | ||
target_metadata["number_of_electrodes"] = 0 | ||
target_metadata["number_of_units"] = 0 | ||
# subject_id is also nohow specified in that file yet | ||
target_metadata['subject_id'] = None | ||
target_metadata["subject_id"] = None | ||
assert target_metadata == get_metadata(str(simple1_nwb)) | ||
|
||
|
||
def test_pynwb_io(simple1_nwb): | ||
# To verify that our dependencies spec is sufficient to avoid | ||
# stepping into known pynwb/hdmf issues | ||
with pynwb.NWBHDF5IO(str(simple1_nwb), 'r', load_namespaces=True) as reader: | ||
with pynwb.NWBHDF5IO(str(simple1_nwb), "r", load_namespaces=True) as reader: | ||
nwbfile = reader.read() | ||
assert repr(nwbfile) | ||
assert str(nwbfile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters