code: def test_run_explicit(origpath=None, path=None):
      origds = Dataset(origpath).create()
      (origds.pathobj / "test-annex.dat").write_text("content")
      origds.save()
      ds = clone(origpath, path)
  
      assert_false(ds.repo.file_has_content("test-annex.dat"))
  
      create_tree(
          ds.path,
          {"dirt_untracked": "untracked", "dirt_modified": "modified"},
      )
      ds.save("dirt_modified", to_git=True)
      with open(op.join(path, "dirt_modified"), "a") as ofh:
          ofh.write(", more")
  
      # We need explicit=True to run with dirty repo.
      assert_status(
          "impossible",
          ds.run(
              f"{cat_command} test-annex.dat test-annex.dat >doubled.dat",
              inputs=["test-annex.dat"],
              on_failure="ignore",
          ),
      )
  
      hexsha_initial = ds.repo.get_hexsha()
      # If we specify test-annex.dat as an input, it will be retrieved before the
      # run.
      ds.run(
          f"{cat_command} test-annex.dat test-annex.dat >doubled.dat",
          inputs=["test-annex.dat"],
          explicit=True,
          result_renderer="disabled",
      )
      ok_(ds.repo.file_has_content("test-annex.dat"))
      # We didn't commit anything because outputs weren't specified.
      assert_false(ds.repo.file_has_content("doubled.dat"))
      eq_(hexsha_initial, ds.repo.get_hexsha())
  
      # If an input doesn't exist, we just show the standard warning.
      with assert_raises(IncompleteResultsError):
          ds.run(
              "ls",
              inputs=["not-there"],
              explicit=True,
              on_failure="stop",
              result_renderer="disabled",
          )
  
      remove(op.join(path, "doubled.dat"))
  
      hexsha_initial = ds.repo.get_hexsha()
      ds.run(
          f"{cat_command} test-annex.dat test-annex.dat >doubled.dat",
          inputs=["test-annex.dat"],
          outputs=["doubled.dat"],
          explicit=True,
          result_renderer="disabled",
      )
      ok_(ds.repo.file_has_content("doubled.dat"))
      assert_repo_status(
          ds.path,
          modified=["dirt_modified"],
          untracked=["dirt_untracked"],
      )
      neq_(hexsha_initial, ds.repo.get_hexsha())
  
      # Saving explicit outputs works from subdirectories.
      subdir = op.join(path, "subdir")
      mkdir(subdir)
      with chpwd(subdir):
          run(
              "echo insubdir >foo",
              explicit=True,
              outputs=["foo"],
              result_renderer="disabled",
          )
      ok_(ds.repo.file_has_content(op.join("subdir", "foo")))
  
imports: import logging
  import os
  import os.path
  import sys
  from os import mkdir, remove
  from unittest.mock import patch
  from datalad.api import clone, run
  from datalad.cli.main import main
  from datalad.core.local.run import _format_iospecs, _get_substitutions, format_command, run_command
  from datalad.distribution.dataset import Dataset
  from datalad.support.exceptions import CommandError, IncompleteResultsError, NoDatasetFound
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, OBSCURE_FILENAME, assert_false, assert_in, assert_in_results, assert_not_in, assert_not_in_results, assert_raises, assert_repo_status, assert_result_count, assert_status, create_tree, eq_, known_failure_windows, neq_, ok_, ok_exists, ok_file_has_content, patch_config, swallow_logs, swallow_outputs, with_tempfile, with_tree
  from datalad.utils import chpwd, ensure_unicode, on_windows
label_desc: Use image node_id 10 for calling a global function with example usage: test_run_explicit(origpath, path) without return types