diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json index eb6a40f38..4788daeb2 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/biorxiv.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Aguillon-Rodriguez, Valeria; Angelaki, Dora E.; Bayer, Hannah M.; Bonacchi, Niccol\u00f2; Carandini, Matteo; Cazettes, Fanny; Chapuis, Gaelle A.; Churchland, Anne K.; Dan, Yang; Dewitt, Eric E. J.; Faulkner, Mayo; Forrest, Hamish; Haetzel, Laura M.; Hausser, Michael; Hofer, Sonja B.; Hu, Fei; Khanal, Anup; Krasniak, Christopher S.; Laranjeira, In\u00eas; Mainen, Zachary F.; Meijer, Guido T.; Miska, Nathaniel J.; Mrsic-Flogel, Thomas D.; Murakami, Masayoshi; Noel, Jean-Paul; Pan-Vazquez, Alejandro; Rossant, Cyrille; Sanders, Joshua I.; Socha, Karolina Z.; Terry, Rebecca; Urai, Anne E.; Vergara, Hernando M.; Wells, Miles J.; Wilson, Christian J.; Witten, Ilana B.; Wool, Lauren E.; Zador, Anthony (2023) Standardized and reproducible measurement of decision-making in mice (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000001/draft", + "citation": "Aguillon-Rodriguez, Valeria; Angelaki, Dora E.; Bayer, Hannah M.; Bonacchi, Niccol\u00f2; Carandini, Matteo; Cazettes, Fanny; Chapuis, Gaelle A.; Churchland, Anne K.; Dan, Yang; Dewitt, Eric E. J.; Faulkner, Mayo; Forrest, Hamish; Haetzel, Laura M.; Hausser, Michael; Hofer, Sonja B.; Hu, Fei; Khanal, Anup; Krasniak, Christopher S.; Laranjeira, In\u00eas; Mainen, Zachary F.; Meijer, Guido T.; Miska, Nathaniel J.; Mrsic-Flogel, Thomas D.; Murakami, Masayoshi; Noel, Jean-Paul; Pan-Vazquez, Alejandro; Rossant, Cyrille; Sanders, Joshua I.; Socha, Karolina Z.; Terry, Rebecca; Urai, Anne E.; Vergara, Hernando M.; Wells, Miles J.; Wilson, Christian J.; Witten, Ilana B.; Wool, Lauren E.; Zador, Anthony (2024) Standardized and reproducible measurement of decision-making in mice (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000001/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000001", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json index 7008fa0ab..c46657ef2 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/elife.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Chowdhury, Raeed H; Glaser, Joshua I; Miller, Lee E (2023) Area 2 of primary somatosensory cortex encodes kinematics of the whole arm (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000004/draft", + "citation": "Chowdhury, Raeed H; Glaser, Joshua I; Miller, Lee E (2024) Area 2 of primary somatosensory cortex encodes kinematics of the whole arm (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000004/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000004", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json index ebed2dcaf..05a80bcbb 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/jneurosci.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Ito, Makoto; Doya, Kenji (2023) Validation of Decision-Making Models and Analysis of Decision Variables in the Rat Basal Ganglia (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000002/draft", + "citation": "Ito, Makoto; Doya, Kenji (2024) Validation of Decision-Making Models and Analysis of Decision Variables in the Rat Basal Ganglia (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000002/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000002", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json b/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json index 17f456374..abdadf0fe 100644 --- a/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json +++ b/lincbrain/cli/tests/data/update_dandiset_from_doi/nature.json @@ -13,7 +13,7 @@ ], "version": "draft", "@context": "https://raw.githubusercontent.com/dandi/schema/master/releases/0.6.4/context.json", - "citation": "Sit, Kevin K.; Goard, Michael J. (2023) Coregistration of heading to visual cues in retrosplenial cortex (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000005/draft", + "citation": "Sit, Kevin K.; Goard, Michael J. (2024) Coregistration of heading to visual cues in retrosplenial cortex (Version draft) [Data set]. DANDI archive. http://localhost:8085/dandiset/000005/draft", "schemaKey": "Dandiset", "identifier": "DANDI:000005", "repository": "http://localhost:8085", diff --git a/lincbrain/cli/tests/test_download.py b/lincbrain/cli/tests/test_download.py index 0a8131cff..fc5915ede 100644 --- a/lincbrain/cli/tests/test_download.py +++ b/lincbrain/cli/tests/test_download.py @@ -11,7 +11,7 @@ def test_download_defaults(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -29,7 +29,7 @@ def test_download_defaults(mocker): def test_download_all_types(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "all"]) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -47,7 +47,7 @@ def test_download_all_types(mocker): def test_download_metadata_only(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "dandiset.yaml"]) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -65,7 +65,7 @@ def test_download_metadata_only(mocker): def test_download_assets_only(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "assets"]) assert r.exit_code == 0 mock_download.assert_called_once_with( @@ -83,7 +83,7 @@ def test_download_assets_only(mocker): def test_download_bad_type(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke(download, ["--download", "foo"], standalone_mode=False) assert r.exit_code != 0 assert isinstance(r.exception, click.UsageError) @@ -95,7 +95,7 @@ def test_download_bad_type(mocker): def test_download_gui_instance_in_dandiset(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") runner = CliRunner() with runner.isolated_filesystem(): Path(dandiset_metadata_file).write_text("identifier: '123456'\n") @@ -120,7 +120,7 @@ def test_download_gui_instance_in_dandiset(mocker): reason="this instance now has GUI URL", ) def test_download_api_instance_in_dandiset(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") runner = CliRunner() with runner.isolated_filesystem(): Path(dandiset_metadata_file).write_text("identifier: '123456'\n") @@ -141,7 +141,7 @@ def test_download_api_instance_in_dandiset(mocker): def test_download_url_instance_match(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke( download, [ @@ -166,7 +166,7 @@ def test_download_url_instance_match(mocker): def test_download_url_instance_conflict(mocker): - mock_download = mocker.patch("dandi.download.download") + mock_download = mocker.patch("lincbrain.download.download") r = CliRunner().invoke( download, ["-i", "dandi", "http://localhost:8000/api/dandisets/123456/"], diff --git a/lincbrain/cli/tests/test_move.py b/lincbrain/cli/tests/test_move.py index 9eca9545a..e0fae0fe3 100644 --- a/lincbrain/cli/tests/test_move.py +++ b/lincbrain/cli/tests/test_move.py @@ -76,14 +76,14 @@ def test_move_command( mocker: MockerFixture, cmdline: list[str], srcs: list[str], kwargs: dict[str, Any] ) -> None: - mock_move = mocker.patch("dandi.move.move") + mock_move = mocker.patch("lincbrain.move.move") r = CliRunner().invoke(move, cmdline) assert r.exit_code == 0 mock_move.assert_called_once_with(*srcs, **kwargs) def test_move_command_too_few_paths(mocker: MockerFixture) -> None: - mock_move = mocker.patch("dandi.move.move") + mock_move = mocker.patch("lincbrain.move.move") r = CliRunner().invoke(move, ["foo"], standalone_mode=False) assert r.exit_code != 0 # This is a ClickException when map_to_click_exceptions is in effect and a diff --git a/lincbrain/support/digests.py b/lincbrain/support/digests.py index 1748ad5cd..1edb568be 100644 --- a/lincbrain/support/digests.py +++ b/lincbrain/support/digests.py @@ -28,7 +28,7 @@ from .threaded_walk import threaded_walk from ..utils import Hasher, exclude_from_zarr -lgr = logging.getLogger("dandi.support.digests") +lgr = logging.getLogger("lincbrain.support.digests") @dataclass diff --git a/lincbrain/tests/test_dandiapi.py b/lincbrain/tests/test_dandiapi.py index 0aa9e8170..6c3f5f8f8 100644 --- a/lincbrain/tests/test_dandiapi.py +++ b/lincbrain/tests/test_dandiapi.py @@ -123,11 +123,11 @@ def test_authenticate_bad_key_good_key_input( backend_mock = mocker.Mock(spec=["set_password"]) keyring_lookup_mock = mocker.patch( - "dandi.dandiapi.keyring_lookup", return_value=(backend_mock, None) + "lincbrain.dandiapi.keyring_lookup", return_value=(backend_mock, None) ) - input_mock = mocker.patch("dandi.dandiapi.input", side_effect=[bad_key, good_key]) + input_mock = mocker.patch("lincbrain.dandiapi.input", side_effect=[bad_key, good_key]) is_interactive_mock = mocker.patch( - "dandi.dandiapi.is_interactive", return_value=True + "lincbrain.dandiapi.is_interactive", return_value=True ) confirm_mock = mocker.patch("click.confirm", return_value=True) @@ -156,7 +156,7 @@ def test_authenticate_good_key_keyring( backend_mock = mocker.Mock(spec=["set_password"]) keyring_lookup_mock = mocker.patch( - "dandi.dandiapi.keyring_lookup", return_value=(backend_mock, good_key) + "lincbrain.dandiapi.keyring_lookup", return_value=(backend_mock, good_key) ) input_spy = mocker.spy(builtins, "input") is_interactive_spy = mocker.spy(dandiapi, "is_interactive") @@ -186,11 +186,11 @@ def test_authenticate_bad_key_keyring_good_key_input( backend_mock = mocker.Mock(spec=["set_password"]) keyring_lookup_mock = mocker.patch( - "dandi.dandiapi.keyring_lookup", return_value=(backend_mock, bad_key) + "lincbrain.dandiapi.keyring_lookup", return_value=(backend_mock, bad_key) ) - input_mock = mocker.patch("dandi.dandiapi.input", return_value=good_key) + input_mock = mocker.patch("lincbrain.dandiapi.input", return_value=good_key) is_interactive_mock = mocker.patch( - "dandi.dandiapi.is_interactive", return_value=True + "lincbrain.dandiapi.is_interactive", return_value=True ) confirm_mock = mocker.patch("click.confirm", return_value=True) diff --git a/lincbrain/tests/test_download.py b/lincbrain/tests/test_download.py index c5badf85f..041901538 100644 --- a/lincbrain/tests/test_download.py +++ b/lincbrain/tests/test_download.py @@ -218,7 +218,7 @@ def test_download_sync( dspath = tmp_path / text_dandiset.dandiset_id os.rename(text_dandiset.dspath, dspath) confirm_mock = mocker.patch( - "dandi.download.abbrev_prompt", return_value="yes" if confirm else "no" + "lincbrain.download.abbrev_prompt", return_value="yes" if confirm else "no" ) download( f"dandi://{text_dandiset.api.instance_id}/{text_dandiset.dandiset_id}", @@ -238,7 +238,7 @@ def test_download_sync_folder( ) -> None: text_dandiset.dandiset.get_asset_by_path("file.txt").delete() text_dandiset.dandiset.get_asset_by_path("subdir2/banana.txt").delete() - confirm_mock = mocker.patch("dandi.download.abbrev_prompt", return_value="yes") + confirm_mock = mocker.patch("lincbrain.download.abbrev_prompt", return_value="yes") download( f"dandi://{text_dandiset.api.instance_id}/{text_dandiset.dandiset_id}/subdir2/", text_dandiset.dspath, @@ -259,7 +259,7 @@ def test_download_sync_list( text_dandiset.dandiset.get_asset_by_path("file.txt").delete() dspath = tmp_path / text_dandiset.dandiset_id os.rename(text_dandiset.dspath, dspath) - input_mock = mocker.patch("dandi.utils.input", side_effect=["list", "yes"]) + input_mock = mocker.patch("lincbrain.utils.input", side_effect=["list", "yes"]) download( f"dandi://{text_dandiset.api.instance_id}/{text_dandiset.dandiset_id}", tmp_path, @@ -280,7 +280,7 @@ def test_download_sync_zarr( zarr_dandiset.dandiset.get_asset_by_path("sample.zarr").delete() dspath = tmp_path / zarr_dandiset.dandiset_id os.rename(zarr_dandiset.dspath, dspath) - confirm_mock = mocker.patch("dandi.download.abbrev_prompt", return_value="yes") + confirm_mock = mocker.patch("lincbrain.download.abbrev_prompt", return_value="yes") download( zarr_dandiset.dandiset.version_api_url, tmp_path, @@ -856,7 +856,7 @@ def test_download_sync_glob( ) -> None: text_dandiset.dandiset.get_asset_by_path("file.txt").delete() text_dandiset.dandiset.get_asset_by_path("subdir2/banana.txt").delete() - confirm_mock = mocker.patch("dandi.download.abbrev_prompt", return_value="yes") + confirm_mock = mocker.patch("lincbrain.download.abbrev_prompt", return_value="yes") download( f"{text_dandiset.dandiset.version_api_url}assets/?glob=s*.Txt", text_dandiset.dspath, diff --git a/lincbrain/tests/test_keyring.py b/lincbrain/tests/test_keyring.py index 84bae065d..c2568bfca 100644 --- a/lincbrain/tests/test_keyring.py +++ b/lincbrain/tests/test_keyring.py @@ -32,7 +32,7 @@ def test_dandi_authenticate_no_env_var( monkeypatch.delenv("DANDI_API_KEY", raising=False) monkeypatch.setenv("PYTHON_KEYRING_BACKEND", "keyring.backends.null.Keyring") inputmock = mocker.patch( - "dandi.dandiapi.input", return_value=local_dandi_api.api_key + "lincbrain.dandiapi.input", return_value=local_dandi_api.api_key ) DandiAPIClient(local_dandi_api.api_url).dandi_authenticate() inputmock.assert_called_once_with( @@ -145,7 +145,7 @@ def test_keyring_lookup_default_no_password( ) -> None: monkeypatch.delenv("PYTHON_KEYRING_BACKEND", raising=False) kb0 = null.Keyring() - get_keyring = mocker.patch("dandi.keyring.get_keyring", return_value=kb0) + get_keyring = mocker.patch("lincbrain.keyring.get_keyring", return_value=kb0) kb, password = keyring_lookup("testservice", "testusername") assert kb is kb0 assert password is None @@ -159,7 +159,7 @@ def test_keyring_lookup_default_password( monkeypatch.delenv("PYTHON_KEYRING_BACKEND", raising=False) kb0 = keyfile.PlaintextKeyring() kb0.set_password("testservice", "testusername", "testpassword") - get_keyring = mocker.patch("dandi.keyring.get_keyring", return_value=kb0) + get_keyring = mocker.patch("lincbrain.keyring.get_keyring", return_value=kb0) kb, password = keyring_lookup("testservice", "testusername") assert kb is kb0 assert password == "testpassword" @@ -176,7 +176,7 @@ def test_keyring_lookup_fail_default_encrypted( ) -> None: monkeypatch.delenv("PYTHON_KEYRING_BACKEND", raising=False) get_keyring = mocker.patch( - "dandi.keyring.get_keyring", return_value=EncryptedFailure() + "lincbrain.keyring.get_keyring", return_value=EncryptedFailure() ) with pytest.raises(KeyringError): keyring_lookup("testservice", "testusername")