From c9d265aee0582f9787cb4a3d1749500c4cf16a2f Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Tue, 17 Dec 2024 12:52:36 +0100 Subject: [PATCH] chore: fix format problems --- datalad_remake/annexremotes/remake_remote.py | 5 ++++- datalad_remake/annexremotes/tests/test_hierarchies.py | 4 +++- datalad_remake/annexremotes/tests/test_priority.py | 4 ++-- .../annexremotes/tests/test_remake_remote.py | 3 +-- datalad_remake/commands/tests/test_collection.py | 2 +- datalad_remake/commands/tests/test_make.py | 10 +++++----- datalad_remake/commands/tests/test_provision.py | 8 ++++---- datalad_remake/utils/getconfig.py | 6 ++---- datalad_remake/utils/tests/test_verification.py | 2 +- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/datalad_remake/annexremotes/remake_remote.py b/datalad_remake/annexremotes/remake_remote.py index 5850f0d..46ba6e4 100644 --- a/datalad_remake/annexremotes/remake_remote.py +++ b/datalad_remake/annexremotes/remake_remote.py @@ -161,7 +161,10 @@ def transfer_retrieve(self, key: str, file_name: str) -> None: dataset_id = self.config_manager.get('datalad.dataset.id').value self.annex.debug(f'TRANSFER RETRIEVE dataset_id: {dataset_id!r}') - self.annex.debug(f'TRANSFER RETRIEVE get_allow_untrusted_execution: {get_allow_untrusted_execution(dataset_id)}') + self.annex.debug( + 'TRANSFER RETRIEVE get_allow_untrusted_execution: ' + f'{get_allow_untrusted_execution(dataset_id)}' + ) if get_allow_untrusted_execution(dataset_id): trusted_key_ids = None else: diff --git a/datalad_remake/annexremotes/tests/test_hierarchies.py b/datalad_remake/annexremotes/tests/test_hierarchies.py index c9390f5..f9c943a 100644 --- a/datalad_remake/annexremotes/tests/test_hierarchies.py +++ b/datalad_remake/annexremotes/tests/test_hierarchies.py @@ -112,7 +112,9 @@ def test_end_to_end(tmp_path, cfgman, monkeypatch, output_pattern): # Allow the special remote to execute untrusted operations on the # dataset `root_dataset/d2_subds0/d2_subds1` allow_untrusted_execution_key - + Dataset(root_dataset.pathobj / 'd2_subds0' / 'd2_subds1').id: ConfigItem('true'), + + Dataset(root_dataset.pathobj / 'd2_subds0' / 'd2_subds1').id: ConfigItem( + 'true' + ), } ): # Drop all computed content diff --git a/datalad_remake/annexremotes/tests/test_priority.py b/datalad_remake/annexremotes/tests/test_priority.py index 2f4456e..66d3c15 100644 --- a/datalad_remake/annexremotes/tests/test_priority.py +++ b/datalad_remake/annexremotes/tests/test_priority.py @@ -29,7 +29,7 @@ @skip_if_on_windows @pytest.mark.parametrize('priority', [['alpha', 'beta'], ['beta', 'alpha']]) -def test_compute_remote_priority(tmp_path, cfgman, monkeypatch, priority): # noqa: F811 +def test_compute_remote_priority(tmp_path, cfgman, monkeypatch, priority): dataset = create_ds_hierarchy( tmp_path=tmp_path, name='ds1', @@ -91,7 +91,7 @@ def test_compute_remote_priority(tmp_path, cfgman, monkeypatch, priority): # no ).read_text().strip() == f'from {priority[0]}: {priority[0]}_parameter' -def test_config_precedence(existing_dataset, tmp_path, cfgman, monkeypatch): # noqa: F811 +def test_config_precedence(existing_dataset, tmp_path, cfgman, monkeypatch): existing_dataset.config.add('datalad.make.priority', '1', scope='branch') monkeypatch.setattr( diff --git a/datalad_remake/annexremotes/tests/test_remake_remote.py b/datalad_remake/annexremotes/tests/test_remake_remote.py index ee9bcdc..0b5def1 100644 --- a/datalad_remake/annexremotes/tests/test_remake_remote.py +++ b/datalad_remake/annexremotes/tests/test_remake_remote.py @@ -24,7 +24,7 @@ @skip_if_on_windows @pytest.mark.parametrize('trusted', [True, False]) -def test_compute_remote_main(tmp_path, cfgman, monkeypatch, trusted): # noqa: F811 +def test_compute_remote_main(tmp_path, cfgman, monkeypatch, trusted): if trusted: gpg_homedir = tmp_path / 'tmp_gpg_dir' tmp_home = tmp_path / 'tmp_home' @@ -70,7 +70,6 @@ def test_compute_remote_main(tmp_path, cfgman, monkeypatch, trusted): # noqa: F { trusted_keys_config_key: ConfigItem(signing_key), allow_untrusted_execution_key + dataset.id: ConfigItem('true'), - } ): run_remake_remote(tmp_path, [url]) diff --git a/datalad_remake/commands/tests/test_collection.py b/datalad_remake/commands/tests/test_collection.py index 53c16ca..743180d 100644 --- a/datalad_remake/commands/tests/test_collection.py +++ b/datalad_remake/commands/tests/test_collection.py @@ -8,7 +8,7 @@ @skip_if_on_windows -def test_collect(tmp_path, cfgman): +def test_collect(tmp_path): dataset = create_ds_hierarchy(tmp_path, 'ds1', 1)[0][2] worktree_dir = tmp_path / 'ds1_worktree' diff --git a/datalad_remake/commands/tests/test_make.py b/datalad_remake/commands/tests/test_make.py index f0987c0..a52d9a7 100644 --- a/datalad_remake/commands/tests/test_make.py +++ b/datalad_remake/commands/tests/test_make.py @@ -42,11 +42,11 @@ def test_speculative_computation(tmp_path, cfgman): ) with cfgman.overrides( - { - # Allow the special remote to execute untrusted operations on this - # dataset - allow_untrusted_execution_key + root_dataset.id: ConfigItem('true'), - } + { + # Allow the special remote to execute untrusted operations on this + # dataset + allow_untrusted_execution_key + root_dataset.id: ConfigItem('true'), + } ): # Perform the speculative computation root_dataset.get('spec.txt', result_renderer='disabled') diff --git a/datalad_remake/commands/tests/test_provision.py b/datalad_remake/commands/tests/test_provision.py index 9fc4480..c928cfc 100644 --- a/datalad_remake/commands/tests/test_provision.py +++ b/datalad_remake/commands/tests/test_provision.py @@ -32,7 +32,7 @@ @skip_if_on_windows -def test_worktree_basic(tmp_path, cfgman): +def test_worktree_basic(tmp_path): dataset = create_ds_hierarchy(tmp_path, 'ds1', 3)[0][2] inputs = [ 'a.txt', @@ -69,7 +69,7 @@ def check_deleted_worktrees(ds: Dataset): @skip_if_on_windows -def test_worktree_globbing(tmp_path, cfgman): +def test_worktree_globbing(tmp_path): dataset = create_ds_hierarchy(tmp_path, 'ds1', 3)[0][2] result = dataset.provision( worktree_dir=tmp_path / 'ds1_worktree2', @@ -122,7 +122,7 @@ def get_file_list( @skip_if_on_windows -def test_provision_context(tmp_path, cfgman): +def test_provision_context(tmp_path): dataset = create_ds_hierarchy(tmp_path, 'ds1')[0][2] with provide_context(dataset, branch=None, input_patterns=['**']) as worktree: files = set(get_file_list(worktree)) @@ -131,7 +131,7 @@ def test_provision_context(tmp_path, cfgman): @skip_if_on_windows -def test_branch_deletion_after_provision(tmp_path, cfgman): +def test_branch_deletion_after_provision(tmp_path): dataset = create_ds_hierarchy(tmp_path, 'ds1', 3)[0][2] with provide_context( dataset=dataset, branch=None, input_patterns=['a.txt'] diff --git a/datalad_remake/utils/getconfig.py b/datalad_remake/utils/getconfig.py index 0a075a9..c380623 100644 --- a/datalad_remake/utils/getconfig.py +++ b/datalad_remake/utils/getconfig.py @@ -19,8 +19,7 @@ def get_trusted_keys(config_manager: ConfigManager | None = None) -> list[str]: def get_allow_untrusted_execution( - dataset_id: str, - config_manager: ConfigManager | None = None + dataset_id: str, config_manager: ConfigManager | None = None ) -> bool: """Get an allow-untrusted-execution indicator for a dataset.""" value = get_protected_config( @@ -31,8 +30,7 @@ def get_allow_untrusted_execution( def get_protected_config( - config_key: str, - config_manager: ConfigManager | None = None + config_key: str, config_manager: ConfigManager | None = None ) -> str: if config_manager is None: config_manager = get_manager() diff --git a/datalad_remake/utils/tests/test_verification.py b/datalad_remake/utils/tests/test_verification.py index 08e9743..ba8d664 100644 --- a/datalad_remake/utils/tests/test_verification.py +++ b/datalad_remake/utils/tests/test_verification.py @@ -7,7 +7,7 @@ from datalad_remake.utils.verify import verify_file -def test_whitelist(tmp_path, cfgman, monkeypatch): +def test_whitelist(tmp_path, monkeypatch, cfgman): # noqa ARG001 gpg_dir = tmp_path / 'gpg' tmp_home = tmp_path / 'tmp_home'