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","."]
docstr: Return paths with the globs expanded.
  
  Globbing is done with `glob.glob`. If a pattern doesn't have a match,
  the trailing path component of the pattern is removed and, if any globs
  remain, `glob.glob` is called again with the new pattern. This
  procedure is repeated until a pattern matches or there are no more
  patterns.
  
  Parameters
  ----------
  full : bool, optional
      Return full paths rather than paths relative to `pwd`.
  dot : bool, optional
      Include the "." pattern if it was specified.
  refresh : bool, optional
      Run glob regardless of whether there are cached values. This is
      useful if there may have been changes on the file system.
  include_partial : bool, optional
      Whether the results include sub-pattern hits (see description
      above) when the full pattern doesn't match.
  include_misses : : bool, optional
      Whether the results include the original pattern when there are no
      matches for a pattern or its sub-patterns (see description above).
docstr_tok: ["Return","paths","with","the","globs","expanded",".","Globbing","is","done","with","`","glob.glob","`",".","If","a","pattern","does","n't","have","a","match",",","the","trailing","path","component","of","the","pattern","is","removed","and",",","if","any","globs","remain",",","`","glob.glob","`","is","called","again","with","the","new","pattern",".","This","procedure","is","repeated","until","a","pattern","matches","or","there","are","no","more","patterns",".","Parameters","--","--","--","--","--","full",":","bool",",","optional","Return","full","paths","rather","than","paths","relative","to","`","pwd","`",".","dot",":","bool",",","optional","Include","the","``",".","''","pattern","if","it","was","specified",".","refresh",":","bool",",","optional","Run","glob","regardless","of","whether","there","are","cached","values",".","This","is","useful","if","there","may","have","been","changes","on","the","file","system",".","include_partial",":","bool",",","optional","Whether","the","results","include","sub-pattern","hits","(","see","description","above",")","when","the","full","pattern","does","n't","match",".","include_misses",":",":","bool",",","optional","Whether","the","results","include","the","original","pattern","when","there","are","no","matches","for","a","pattern","or","its","sub-patterns","(","see","description","above",")","."]
code: def expand(
      self,
      full: bool = False,
      dot: bool = True,
      refresh: bool = False,
      include_partial: bool = True,
      include_misses: bool = True,
  ) -> list[str]:
      """Return paths with the globs expanded.
  
      Globbing is done with `glob.glob`. If a pattern doesn't have a match,
      the trailing path component of the pattern is removed and, if any globs
      remain, `glob.glob` is called again with the new pattern. This
      procedure is repeated until a pattern matches or there are no more
      patterns.
  
      Parameters
      ----------
      full : bool, optional
          Return full paths rather than paths relative to `pwd`.
      dot : bool, optional
          Include the "." pattern if it was specified.
      refresh : bool, optional
          Run glob regardless of whether there are cached values. This is
          useful if there may have been changes on the file system.
      include_partial : bool, optional
          Whether the results include sub-pattern hits (see description
          above) when the full pattern doesn't match.
      include_misses : : bool, optional
          Whether the results include the original pattern when there are no
          matches for a pattern or its sub-patterns (see description above).
      """
      if refresh:
          self._cache = {}
          self._expanded_cache = {}
  
      maybe_dot = self._maybe_dot if dot else []
      if not self._patterns:
          return maybe_dot + []
  
      if "hits" not in self._cache:
          hits, partial_hits, misses = self._expand_globs()
          self._cache["hits"] = hits
          self._cache["partial_hits"] = partial_hits
          self._cache["misses"] = misses
      else:
          hits = self._cache["hits"]
          partial_hits = self._cache["partial_hits"]
          misses = self._cache["misses"]
  
      key_suffix = (include_partial, include_misses)
      key_expanded = ("expanded",) + key_suffix
      if key_expanded not in self._expanded_cache:
          sources = [hits]
          if include_partial:
              sources.append(partial_hits)
          if include_misses:
              sources.append(misses)
  
          paths = []
          for pattern in self._patterns:
              for source in sources:
                  if pattern in source:
                      paths.extend(source[pattern])
                      break
          self._expanded_cache[key_expanded] = paths
      else:
          paths = self._expanded_cache[key_expanded]
  
      if full:
          key_full = ("expanded_full",) + key_suffix
          if key_full not in self._expanded_cache:
              paths = [op.join(self.pwd, p) for p in paths]
              self._expanded_cache[key_full] = paths
          else:
              paths = self._expanded_cache[key_full]
  
      return maybe_dot + paths
  
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 5 for calling the GlobbedPaths obj's underlying member method code with example usage: obj.expand(full, dot, refresh, include_partial, include_misses) and returns: unknown, unknown