class_docstr: Representation of a Git repository
  
      
docstr: Call git, yield output lines when available. Output lines are split
  at line ends or `sep` if `sep` is not None.
  
  Parameters
  ----------
  sep : str, optional
    Use sep as line separator. Does not create an empty last line if
    the input ends on sep.
  
  All other parameters match those described for `call_git`.
  
  Returns
  -------
  Generator that yields stdout items, i.e. lines with the line ending or
  separator removed.
  
  Please note, this method is meant to be used to process output that is
  meant for 'interactive' interpretation. It is not intended to return
  stdout from a command like "git cat-file". The reason is that
  it strips of the line endings (or separator) from the result lines,
  unless 'keep_ends' is True. If 'keep_ends' is False, you will not know
  which line ending was stripped (if 'separator' is None) or whether a
  line ending (or separator) was stripped at all, because the last line
  may not have a line ending (or separator).
  
  If you want to reliably recreate the output set 'keep_ends' to True and
  "".join() the result, or use 'GitRepo.call_git()' instead.
  
  Raises
  ------
  CommandError if the call exits with a non-zero status.
docstr_tok: ["Call","git",",","yield","output","lines","when","available",".","Output","lines","are","split","at","line","ends","or","`","sep","`","if","`","sep","`","is","not","None",".","Parameters","--","--","--","--","--","sep",":","str",",","optional","Use","sep","as","line","separator",".","Does","not","create","an","empty","last","line","if","the","input","ends","on","sep.","All","other","parameters","match","those","described","for","`","call_git","`",".","Returns","--","--","--","-","Generator","that","yields","stdout","items",",","i.e",".","lines","with","the","line","ending","or","separator","removed",".","Please","note",",","this","method","is","meant","to","be","used","to","process","output","that","is","meant","for","'interactive","'","interpretation",".","It","is","not","intended","to","return","stdout","from","a","command","like","``","git","cat-file","''",".","The","reason","is","that","it","strips","of","the","line","endings","(","or","separator",")","from","the","result","lines",",","unless","'keep_ends","'","is","True",".","If","'keep_ends","'","is","False",",","you","will","not","know","which","line","ending","was","stripped","(","if","'separator","'","is","None",")","or","whether","a","line","ending","(","or","separator",")","was","stripped","at","all",",","because","the","last","line","may","not","have","a","line","ending","(","or","separator",")",".","If","you","want","to","reliably","recreate","the","output","set","'keep_ends","'","to","True","and","''","''",".join","(",")","the","result",",","or","use","'GitRepo.call_git","(",")","'","instead",".","Raises","--","--","--","CommandError","if","the","call","exits","with","a","non-zero","status","."]
code: def call_git_items_(
      self,
      args,
      files=None,
      expect_stderr=False,
      expect_fail=False,
      env=None,
      pathspec_from_file: Optional[bool] = False,
      read_only=False,
      sep=None,
      keep_ends=False,
  ):
      """
      Call git, yield output lines when available. Output lines are split
      at line ends or `sep` if `sep` is not None.
  
      Parameters
      ----------
      sep : str, optional
        Use sep as line separator. Does not create an empty last line if
        the input ends on sep.
  
      All other parameters match those described for `call_git`.
  
      Returns
      -------
      Generator that yields stdout items, i.e. lines with the line ending or
      separator removed.
  
      Please note, this method is meant to be used to process output that is
      meant for 'interactive' interpretation. It is not intended to return
      stdout from a command like "git cat-file". The reason is that
      it strips of the line endings (or separator) from the result lines,
      unless 'keep_ends' is True. If 'keep_ends' is False, you will not know
      which line ending was stripped (if 'separator' is None) or whether a
      line ending (or separator) was stripped at all, because the last line
      may not have a line ending (or separator).
  
      If you want to reliably recreate the output set 'keep_ends' to True and
      "".join() the result, or use 'GitRepo.call_git()' instead.
  
      Raises
      ------
      CommandError if the call exits with a non-zero status.
      """
  
      read_write = not read_only
      if read_write and self._fake_dates_enabled:
          env = self.add_fake_dates_to_env(
              env if env else self._git_runner.env
          )
  
      stderr_lines = []
  
      with lock_if_required(
          read_write, self._write_lock
      ), git_ignore_check(expect_fail, None, stderr_lines):
          for file_no, line in self._generator_call_git(
              args,
              files=files,
              env=env,
              pathspec_from_file=pathspec_from_file,
              sep=sep,
          ):
              if file_no == STDOUT_FILENO:
                  if keep_ends is True:
                      yield line
                  else:
                      if sep:
                          yield line.rstrip(sep)
                      else:
                          yield line.rstrip()
              else:
                  stderr_lines.append(line)
  
      stderr_log_level = {True: 5, False: 11}[expect_stderr]
      for line in stderr_lines:
          lgr.log(stderr_log_level, "stderr| " + line.strip("\n"))
  
imports: import logging
  import re
  import threading
  import time
  from contextlib import contextmanager
  from locale import getpreferredencoding
  from os import environ
  from os.path import lexists
  from typing import Optional
  from weakref import finalize, WeakValueDictionary
  from datalad.cmd import GitWitlessRunner, StdOutErrCapture
  from datalad.config import ConfigManager
  from datalad.dataset.repo import PathBasedFlyweight, RepoInterface, path_based_str_repr
  from datalad.runner.nonasyncrunner import STDERR_FILENO, STDOUT_FILENO
  from datalad.runner.protocol import GeneratorMixIn
  from datalad.runner.utils import AssemblingDecoderMixIn, LineSplitter
  from datalad.support.exceptions import CommandError, GitIgnoreError, InvalidGitRepositoryError, PathKnownToRepositoryError
  from datalad.utils import ensure_list, lock_if_required, Path
label_desc: Use image node_id 14 for calling the GitRepo obj's underlying member method code with example usage: obj.call_git_items_(args, files, expect_stderr, expect_fail, env, pathspec_from_file, read_only, sep, keep_ends) without return types