Skip to content

Commit

Permalink
chore: fix format problems
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-monch committed Dec 17, 2024
1 parent 6a70a1a commit c9d265a
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 21 deletions.
5 changes: 4 additions & 1 deletion datalad_remake/annexremotes/remake_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion datalad_remake/annexremotes/tests/test_hierarchies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions datalad_remake/annexremotes/tests/test_priority.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions datalad_remake/annexremotes/tests/test_remake_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion datalad_remake/commands/tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions datalad_remake/commands/tests/test_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions datalad_remake/commands/tests/test_provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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))
Expand All @@ -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']
Expand Down
6 changes: 2 additions & 4 deletions datalad_remake/utils/getconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion datalad_remake/utils/tests/test_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit c9d265a

Please sign in to comment.