class_docstr: Helper for globbing paths.
  
  Parameters
  ----------
  patterns : list of str
      Call `glob.glob` with each of these patterns. "." is considered as
      datalad's special "." path argument; it is not passed to glob and is
      always left unexpanded. Each set of glob results is sorted
      alphabetically.
  pwd : str, optional
      Glob in this directory.
  expand : bool, optional
     Whether the `paths` property returns unexpanded or expanded paths.
class_docstr_tok: ["Helper","for","globbing","paths",".","Parameters","--","--","--","--","--","patterns",":","list","of","str","Call","`","glob.glob","`","with","each","of","these","patterns",".","``",".","''","is","considered","as","datalad","'s","special","``",".","''","path","argument",";","it","is","not","passed","to","glob","and","is","always","left","unexpanded",".","Each","set","of","glob","results","is","sorted","alphabetically",".","pwd",":","str",",","optional","Glob","in","this","directory",".","expand",":","bool",",","optional","Whether","the","`","paths","`","property","returns","unexpanded","or","expanded","paths","."]
code: def _chain(self, what: str) -> list[str]:
      if self._patterns:
          if "hits" not in self._cache:
              self.expand()
          # Note: This assumes a preserved insertion order for dicts, which
          # is true with our current minimum python version (3.6) and part of
          # the language spec as of 3.7.
          return list(chain(*self._cache[what].values()))
      return []
  
imports: from __future__ import annotations
  import glob
  import logging
  import os.path
  from functools import lru_cache
  from itertools import chain
  from typing import Iterable, Optional
  from datalad.utils import chpwd, ensure_unicode, getpwd, partition
label_desc: Use image node_id 7 for calling the GlobbedPaths obj's underlying member method code with example usage: obj._chain(what) and returns: list, list