code: def test_drop_allkeys(origpath=None, clonepath=None):
      # create a dataset with two keys, belonging to two files,
      # in two different branches
      ds = Dataset(origpath).create()
      repo = ds.repo
      repo.call_git(["checkout", "-b", "otherbranch"])
      (ds.pathobj / "file1").write_text("file1")
      ds.save()
      repo.call_git(["checkout", DEFAULT_BRANCH])
      (ds.pathobj / "file2").write_text("file2")
      ds.save()
  
      # confirm we have two keys
      eq_(2, repo.call_annex_records(["info"])[0]["local annex keys"])
  
      # do it wrong first
      assert_in_results(
          ds.drop("some", what="allkeys", on_failure="ignore"),
          status="impossible",
          type="dataset",
          action="drop",
          message=(
              "cannot drop %s, with path constraints given: %s",
              "allkeys",
              [ds.pathobj / "some"],
          ),
      )
      # confirm we still have two keys
      eq_(2, repo.call_annex_records(["info"])[0]["local annex keys"])
  
      # clone the beast and get all keys into the clone
      dsclone = clone(ds.path, clonepath)
      dsclone.repo.call_annex(["get", "--all"])
      # confirm we have two keys in the clone
      eq_(
          2,
          dsclone.repo.call_annex_records(["info"])[0][
              "local annex keys"
          ],
      )
  
      # now cripple availability by dropping the "hidden" key at origin
      repo.call_annex(["drop", "--branch", "otherbranch", "--force"])
      # confirm one key left
      eq_(1, repo.call_annex_records(["info"])[0]["local annex keys"])
  
      # and now drop all keys from the clone, one is redundant and can be
      # dropped, the other is not and must fail
      res = dsclone.drop(what="allkeys", jobs=2, on_failure="ignore")
      # confirm one key gone, one left
      eq_(
          1,
          dsclone.repo.call_annex_records(["info"])[0][
              "local annex keys"
          ],
      )
      assert_result_count(
          res, 1, action="drop", status="error", type="key"
      )
      assert_result_count(
          res, 1, action="drop", status="ok", type="key"
      )
      # now force it
      res = dsclone.drop(
          what="allkeys", reckless="availability", on_failure="ignore"
      )
      assert_result_count(res, 1)
      assert_result_count(
          res, 1, action="drop", status="ok", type="key"
      )
      # all gone
      eq_(
          0,
          dsclone.repo.call_annex_records(["info"])[0][
              "local annex keys"
          ],
      )
  
imports: import os
  import os.path
  from pathlib import Path
  from unittest.mock import patch
  from datalad.api import Dataset, clone, create, drop
  from datalad.distributed.drop import _detect_nondead_annex_at_remotes, _detect_unpushed_revs
  from datalad.support.exceptions import IncompleteResultsError, NoDatasetFound
  from datalad.support.gitrepo import GitRepo
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, OBSCURE_FILENAME, assert_in, assert_in_results, assert_raises, assert_repo_status, assert_result_count, assert_status, eq_, get_deeply_nested_structure, known_failure_githubci_win, nok_, ok_, with_tempfile
  from datalad.utils import chpwd
label_desc: Use image node_id 2 for calling a global function with example usage: test_drop_allkeys(origpath, clonepath) without return types