code: def __call__(dataset, pattern, ref_dir=".", makedirs=False):
      # could be extended to accept actual largefile expressions
      from os.path import join as opj
      from os.path import isabs
      from os.path import exists
      from os import makedirs as makedirsfx
      from datalad.distribution.dataset import require_dataset
      from datalad.support.annexrepo import AnnexRepo
      from datalad.utils import ensure_list
  
      pattern = ensure_list(pattern)
      ds = require_dataset(
          dataset,
          check_installed=True,
          purpose="no_annex configuration",
      )
  
      res_kwargs = dict(
          path=ds.path,
          type="dataset",
          action="no_annex",
      )
  
      # all the ways we refused to cooperate
      if not isinstance(ds.repo, AnnexRepo):
          yield dict(
              res_kwargs,
              status="notneeded",
              message="dataset has no annex",
          )
          return
      if any(isabs(p) for p in pattern):
          yield dict(
              res_kwargs,
              status="error",
              message=(
                  "path pattern for `no_annex` configuration must be relative paths: %s",
                  pattern,
              ),
          )
          return
      if isabs(ref_dir):
          yield dict(
              res_kwargs,
              status="error",
              message=(
                  "`ref_dir` for `no_annex` configuration must be a relative path: %s",
                  ref_dir,
              ),
          )
          return
  
      gitattr_dir = opj(ds.path, ref_dir)
      if not exists(gitattr_dir):
          if makedirs:
              makedirsfx(gitattr_dir)
          else:
              yield dict(
                  res_kwargs,
                  status="error",
                  message="target directory for `no_annex` does not exist (consider makedirs=True)",
              )
              return
  
      gitattr_file = opj(gitattr_dir, ".gitattributes")
      ds.repo.set_gitattributes(
          [(p, {"annex.largefiles": "nothing"}) for p in pattern],
          attrfile=gitattr_file,
      )
      yield dict(res_kwargs, status="ok")
  
      yield from ds.save(
          gitattr_file,
          to_git=True,
          message="[DATALAD] exclude paths from annex'ing",
          result_filter=None,
          result_xfm=None,
          return_type="generator",
          result_renderer="disabled",
      )
  
imports: from datalad.interface.base import Interface
  from datalad.interface.base import build_doc
label_desc: Use image node_id 1 for calling the NoAnnex obj's underlying member method code with example usage: obj.__call__(dataset, pattern, ref_dir, makedirs) without return types