code: def _push_data(
      ds,
      target,
      content,
      data,
      force,
      jobs,
      res_kwargs,
      got_path_arg=False,
  ):
      if ds.config.getbool(
          "remote.{}".format(target), "annex-ignore", False
      ):
          lgr.debug(
              "Target '%s' is set to annex-ignore, exclude from data-push.",
              target,
          )
          return
  
      ds_repo = ds.repo
  
      res_kwargs["target"] = target
      if not ds.config.get(
          ".".join(("remote", target, "annex-uuid")), None
      ):
          # this remote either isn't an annex,
          # or hasn't been properly initialized
          # given that there was no annex-ignore, let's try to init it
          # see https://github.com/datalad/datalad/issues/5143 for the story
          ds_repo.localsync(target)
  
          if not ds.config.get(
              ".".join(("remote", target, "annex-uuid")), None
          ):
              # still nothing
              # rather than barfing tons of messages for each file, do one
              # for the entire dataset
              yield dict(
                  res_kwargs,
                  action="copy",
                  status="impossible"
                  if force in ("all", "checkdatapresent")
                  else "notneeded",
                  message=(
                      "Target '%s' does not appear to be an annex remote",
                      target,
                  ),
              )
              return
  
      # it really looks like we will transfer files, get info on what annex
      # has in store
      # paths must be recoded to a dataset REPO root (in case of a symlinked
      # location
      annex_info_init = (
          {
              ds_repo.pathobj
              / Path(c["path"]).relative_to(ds.pathobj): c
              for c in content
          }
          if ds.pathobj != ds_repo.pathobj
          else {Path(c["path"]): c for c in content}
      )
      content = ds.repo.get_content_annexinfo(
          # paths are taken from `annex_info_init`
          paths=None,
          init=annex_info_init,
          ref="HEAD",
          # this is an expensive operation that is only needed
          # to perform a warning below, and for more accurate
          # progress reporting (exclude unavailable content).
          # limit to cases with explicit paths provided
          eval_availability=True if got_path_arg else False,
      )
      # figure out which of the reported content (after evaluating
      # `since` and `path` arguments needs transport
      to_transfer = [
          c
          for c in content.values()
          # by force
          if (
              (
                  force in ("all", "checkdatapresent")
                  or
                  # or by modification report
                  c.get("state", None) not in ("clean", "deleted")
              )
              # only consider annex'ed files
              and "key" in c
          )
      ]
      if got_path_arg:
          for c in [
              c for c in to_transfer if not c.get("has_content", False)
          ]:
              yield dict(
                  res_kwargs,
                  type=c["type"],
                  path=c["path"],
                  action="copy",
                  status="impossible",
                  message="Slated for transport, but no content present",
              )
  
      cmd = ["copy", "--batch", "-z", "--to", target]
  
      if jobs:
          cmd.extend(["--jobs", str(jobs)])
  
      # Since we got here - we already have some  data != "nothing"
      if (data == "auto") or (
          (data == "auto-if-wanted")
          and ds_repo.get_preferred_content("wanted", target)
      ):
          lgr.debug("Invoking copy --auto")
          cmd.append("--auto")
  
      if force not in ("all", "checkdatapresent"):
          # if we force, we do not trust local knowledge and do the checks
          cmd.append("--fast")
  
      lgr.debug("Pushing data from %s to '%s'", ds, target)
  
      # input has type=dataset, but now it is about files
      res_kwargs.pop("type", None)
  
      # A set and a dict is used to track files pointing to the
      # same key.  The set could be dropped, using a single dictionary
      # that has an entry for every seen key and a (likely empty) list
      # of redundant files, but that would mean looping over potentially
      # many keys to yield likely few if any notneeded results.
      seen_keys = set()
      repkey_paths = dict()
  
      # produce final path list. use knowledge that annex command will
      # run in the root of the dataset and compact paths to be relative
      # to this location
      file_list = b""
      nbytes = 0
      for c in to_transfer:
          key = c["key"]
          if key in seen_keys:
              repkey_paths.setdefault(key, []).append(c["path"])
          else:
              file_list += bytes(
                  Path(c["path"]).relative_to(ds.pathobj)
              )
              file_list += b"\0"
              nbytes += c.get("bytesize", 0)
              seen_keys.add(key)
      lgr.debug("Counted %d bytes of annex data to transfer", nbytes)
  
      # and go
      res = ds_repo._call_annex_records(
          cmd,
          git_options=[
              "-c",
              "annex.retry={}".format(
                  ds_repo.config.obtain("datalad.annex.retry")
              ),
          ]
          if ds_repo.config.get("annex.retry")
          else None,
          stdin=file_list,
          progress=True,
          # tailor the progress protocol with the total number of files
          # to be transferred
          total_nbytes=nbytes,
      )
      for j in res:
          yield annexjson2result(j, ds, type="file", **res_kwargs)
  
      for annex_key, paths in repkey_paths.items():
          for path in paths:
              yield dict(
                  res_kwargs,
                  action="copy",
                  type="file",
                  status="notneeded",
                  path=path,
                  annexkey=annex_key,
                  message="Another file points to the same key",
              )
      return
  
imports: from itertools import chain
  import logging
  import re
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.common_opts import jobs_opt, recursion_limit, recursion_flag
  from datalad.interface.utils import render_action_summary
  from datalad.interface.results import annexjson2result
  from datalad.log import log_progress
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.gitrepo import GitRepo
  from datalad.support.param import Parameter
  from datalad.support.constraints import EnsureStr, EnsureNone, EnsureChoice
  from datalad.support.exceptions import CommandError
  from datalad.utils import Path, ensure_list, todo_interface_for_extensions
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset, resolve_path
  from datalad.core.local.diff import diff_dataset
label_desc: Use image node_id 6 for calling a global function with example usage: _push_data(ds, target, content, data, force, jobs, res_kwargs, got_path_arg) without return types