Skip to content

Commit 3f6619a

Browse files
committed
resolve conflicts
2 parents b33337b + 467f22f commit 3f6619a

16 files changed

Lines changed: 105 additions & 77 deletions

src/nwb2bids/_command_line_interface/_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ def _run_convert_nwb_dataset(
128128
}
129129
run_config = RunConfig(**non_missing_run_config_kwargs)
130130

131-
converter = convert_nwb_dataset(nwb_paths=handled_nwb_paths, run_config=run_config)
131+
dataset_converter = convert_nwb_dataset(nwb_paths=handled_nwb_paths, run_config=run_config)
132132

133133
if silent:
134134
return
135135

136-
notifications = converter.notifications
136+
notifications = dataset_converter.notifications
137137
notifications_by_severity: dict[Severity, list[Notification]] = collections.defaultdict(list)
138138
for notification in notifications:
139139
notifications_by_severity[notification.severity].append(notification)

src/nwb2bids/_core/_convert_nwb_dataset.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def convert_nwb_dataset(
4141
4242
Returns
4343
-------
44-
converter : DatasetConverter
44+
dataset_converter : DatasetConverter
4545
The DatasetConverter used to perform the conversion.
4646
Contains notifications and other contextual information about the conversion process.
4747
"""
48-
converter = DatasetConverter.from_nwb_paths(nwb_paths=nwb_paths, run_config=run_config)
49-
converter.extract_metadata()
50-
converter.convert_to_bids_dataset()
48+
dataset_converter = DatasetConverter.from_nwb_paths(nwb_paths=nwb_paths, run_config=run_config)
49+
dataset_converter.extract_metadata()
50+
dataset_converter.convert_to_bids_dataset()
5151

52-
return converter
52+
return dataset_converter
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/integration/test_conversion_with_sanitization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def test_convert_nwb_dataset_basic_sanitization(
1313
bids_directory=temporary_bids_directory,
1414
sanitization_config=nwb2bids.sanitization.SanitizationConfig(sub_labels=True, ses_labels=True),
1515
)
16-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
16+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
17+
assert len(dataset_converter.notifications) == 4
1718

18-
assert len(converter.notifications) == 4
1919
expected_structure = {
2020
temporary_bids_directory: {
2121
"directories": {"sub-bad+subject+id"},

tests/integration/test_convert_nwb_dataset.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def test_minimal_convert_nwb_dataset_from_directory(
1313
):
1414
nwb_paths = [minimal_nwbfile_path.parent]
1515
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
16-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
17-
assert len(converter.notifications) < 3
16+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
17+
assert not any(dataset_converter.notifications)
1818

1919
expected_structure = {
2020
temporary_bids_directory: {
@@ -46,8 +46,8 @@ def test_minimal_convert_nwb_dataset_from_directory(
4646
directory=temporary_bids_directory, expected_structure=expected_structure
4747
)
4848

49-
assert converter.run_config.notifications_json_file_path.exists()
50-
with converter.run_config.notifications_json_file_path.open(mode="r") as file_stream:
49+
assert dataset_converter.run_config.notifications_json_file_path.exists()
50+
with dataset_converter.run_config.notifications_json_file_path.open(mode="r") as file_stream:
5151
notifications_json = json.load(fp=file_stream)
5252
expected_notification_json = []
5353
assert notifications_json == expected_notification_json
@@ -58,7 +58,8 @@ def test_minimal_convert_nwb_dataset_from_file_path(
5858
):
5959
nwb_paths = [minimal_nwbfile_path]
6060
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
61-
nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
61+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
62+
assert not any(dataset_converter.notifications)
6263

6364
expected_structure = {
6465
temporary_bids_directory: {
@@ -96,8 +97,8 @@ def test_ecephys_tutorial_convert_nwb_dataset(
9697
):
9798
nwb_paths = [ecephys_tutorial_nwbfile_path]
9899
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
99-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
100-
assert not any(converter.notifications)
100+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
101+
assert not any(dataset_converter.notifications)
101102

102103
expected_structure = {
103104
temporary_bids_directory: {
@@ -184,8 +185,8 @@ def test_ecephys_minimal_convert_nwb_dataset(
184185
):
185186
nwb_paths = [ecephys_minimal_nwbfile_path]
186187
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
187-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
188-
assert not any(converter.notifications)
188+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
189+
assert not any(dataset_converter.notifications)
189190

190191
expected_structure = {
191192
temporary_bids_directory: {
@@ -274,7 +275,8 @@ def test_implicit_bids_directory(
274275
monkeypatch.chdir(temporary_bids_directory)
275276

276277
nwb_paths = [minimal_nwbfile_path]
277-
nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths)
278+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths)
279+
assert not any(dataset_converter.notifications)
278280

279281
expected_structure = {
280282
implicit_bids_directory: {
@@ -316,9 +318,8 @@ def test_implicit_bids_directory_with_relative_nwb_paths(
316318
nwb_relative = minimal_nwbfile_path.relative_to(temporary_run_directory.parent)
317319
nwb_paths = [pathlib.Path("..") / nwb_relative]
318320

319-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths)
320-
321-
assert not any(converter.notifications)
321+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths)
322+
assert not any(dataset_converter.notifications)
322323

323324
expected_structure = {
324325
temporary_run_directory: {

tests/integration/test_edge_cases.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def test_convert_nwb_dataset_with_additional_metadata(
2424
run_config = nwb2bids.RunConfig(
2525
bids_directory=temporary_bids_directory, additional_metadata_file_path=additional_metadata_file_path
2626
)
27-
nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
27+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
28+
assert not any(dataset_converter.notifications)
2829

2930
expected_structure = {
3031
temporary_bids_directory: {
@@ -60,11 +61,8 @@ def test_convert_nwb_dataset_on_mock_datalad_dataset(
6061
):
6162
nwb_paths = [mock_datalad_dataset]
6263
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
63-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
64-
notifications = converter.notifications
65-
66-
errors = [notification for notification in notifications if notification.severity == nwb2bids.Severity.ERROR]
67-
assert len(errors) == 0, f"Errors were raised during conversion: {errors}"
64+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
65+
assert not any(dataset_converter.notifications)
6866

6967
expected_structure = {
7068
temporary_bids_directory: {
@@ -100,13 +98,11 @@ def test_convert_nwb_dataset_on_mock_datalad_dataset_with_broken_symlink(
10098
):
10199
broken_symlink = mock_datalad_dataset / "broken_symlink.nwb"
102100
broken_symlink.symlink_to(target="non_existent_file.nwb")
101+
103102
nwb_paths = [mock_datalad_dataset]
104103
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
105-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
106-
notifications = converter.notifications
107-
108-
errors = [notification for notification in notifications if notification.severity == nwb2bids.Severity.ERROR]
109-
assert len(errors) == 0, f"Errors were raised during conversion: {errors}"
104+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
105+
assert not any(dataset_converter.notifications)
110106

111107
expected_structure = {
112108
temporary_bids_directory: {
@@ -144,8 +140,8 @@ def test_convert_nwb_dataset_with_subject_mismatch(
144140
):
145141
nwb_paths = [minimal_nwbfile_path, minimal_mismatch_nwbfile_path]
146142
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
147-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
148-
assert len(converter.notifications) == 1
143+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
144+
assert len(dataset_converter.notifications) == 1
149145

150146
expected_structure = {
151147
temporary_bids_directory: {
@@ -207,7 +203,8 @@ def test_symlink_resolves_correctly_with_relative_path(
207203

208204
nwb_paths = [relative_nwb_path]
209205
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory, file_mode="symlink")
210-
nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
206+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
207+
assert not any(dataset_converter.notifications)
211208

212209
symlink_path = temporary_bids_directory / "sub-123" / "ses-456" / "ecephys" / "sub-123_ses-456_ecephys.nwb"
213210

tests/integration/test_events.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
def test_trials_events(trials_events_nwbfile_path: pathlib.Path, temporary_bids_directory: pathlib.Path):
1212
nwb_paths = [trials_events_nwbfile_path]
1313
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
14-
converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
15-
16-
assert not any(converter.notifications)
14+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
15+
assert not any(dataset_converter.notifications)
1716

1817
expected_structure = {
1918
temporary_bids_directory: {
@@ -79,7 +78,8 @@ def test_trials_events(trials_events_nwbfile_path: pathlib.Path, temporary_bids_
7978
def test_epochs_events(epochs_events_nwbfile_path: pathlib.Path, temporary_bids_directory: pathlib.Path):
8079
nwb_paths = [epochs_events_nwbfile_path]
8180
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
82-
nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
81+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
82+
assert not any(dataset_converter.notifications)
8383

8484
expected_structure = {
8585
temporary_bids_directory: {
@@ -133,7 +133,8 @@ def test_epochs_events(epochs_events_nwbfile_path: pathlib.Path, temporary_bids_
133133
def test_multiple_events(multiple_events_nwbfile_path: pathlib.Path, temporary_bids_directory: pathlib.Path):
134134
nwb_paths = [multiple_events_nwbfile_path]
135135
run_config = nwb2bids.RunConfig(bids_directory=temporary_bids_directory)
136-
nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
136+
dataset_converter = nwb2bids.convert_nwb_dataset(nwb_paths=nwb_paths, run_config=run_config)
137+
assert not any(dataset_converter.notifications)
137138

138139
expected_structure = {
139140
temporary_bids_directory: {

0 commit comments

Comments
 (0)