class_docstr: Helper to collect/pass statistics on carried out actions
  
  It also keeps track of total counts, which do not get reset by
  reset() call, and "total" stat could be obtained by .get_total()
  Could be done so many other ways
class_docstr_tok: ["Helper","to","collect\/pass","statistics","on","carried","out","actions","It","also","keeps","track","of","total","counts",",","which","do","not","get","reset","by","reset","(",")","call",",","and","``","total","''","stat","could","be","obtained","by",".get_total","(",")","Could","be","done","so","many","other","ways"]
docstr: Parameters
  ----------
  mode : {'full', 'line'}
docstr_tok: ["Parameters","--","--","--","--","--","mode",":","{","'full","'",",","'line","'","}"]
code: def as_str(self, mode="full"):
      """
  
      Parameters
      ----------
      mode : {'full', 'line'}
      """
  
      # Example
      # """
      # URLs processed: {urls}
      # downloaded: {downloaded}
      # downloaded size: {downloaded_size}
      # Files processed: {files}
      # skipped: {skipped}
      # renamed: {renamed}
      # removed: {removed}
      # added to git: {add_git}
      # added to annex: {add_annex}
      # overwritten: {overwritten}
      # Branches merged:
      #  upstream -> master
      # """
  
      # TODO: improve
      entries = self.as_dict()
      entries.update(
          {
              k: (_FORMATTERS[k](entries[k]) if entries[k] else "")
              for k in _FORMATTERS
          }
      )
  
      out_formats = [
          ("URLs processed", "urls"),
          (" downloaded", "downloaded"),
          (" size", "downloaded_size"),
          ("Files processed", "files"),
          (" skipped", "skipped"),
          (" renamed", "renamed"),
          (" removed", "removed"),
          (" overwritten", "overwritten"),
          (" +git", "add_git"),
          (" +annex", "add_annex"),
          ("Branches merged", "merges"),
          ("Datasets crawled", "datasets_crawled"),
          (" failed", "datasets_crawl_failed"),
      ]
      # Filter out empty/0 ones
      out = [
          "%s: " % s + str(entries[m])
          for s, m in out_formats
          if entries[m]
      ]
      if mode == "full":
          return "\n".join(out)
      elif mode == "line":
          for i, o in enumerate(out):
              if o[0] != " ":
                  out[i] = "  " + o
          return ",".join(out).lstrip()
          # return "{files} files (git/annex: {add_git}/{add_annex}), " \
          #       "{skipped} skipped, {renamed} renamed, {overwritten} overwritten".format(
          #           **entries)
      else:
          raise ValueError("Unknown mode %s" % mode)
  
file_path: datalad/datalad/support/stats.py
imports: import humanize
label_desc: Use image node_id 15 for calling the ActivityStats obj's underlying member method code with example usage: obj.as_str(mode) and returns: str, str