original_docstring: 
          Get a list of directories for the target environment using pygit2
          
docstring: Get a list of directories for the target environment using pygit2
docstring_tokens: Get a list of directories for the target environment using pygit2
code: def dir_list(self, tgt_env):
          '''
          Get a list of directories for the target environment using pygit2
          '''
          def _traverse(tree, blobs, prefix):
              '''
              Traverse through a pygit2 Tree object recursively, accumulating all
              the empty directories within it in the "blobs" list
              '''
              for entry in iter(tree):
                  if entry.oid not in self.repo:
                      # Entry is a submodule, skip it
                      continue
                  blob = self.repo[entry.oid]
                  if not isinstance(blob, pygit2.Tree):
                      continue
                  blobs.append(salt.utils.path_join(prefix, entry.name))
                  if len(blob):
                      _traverse(blob, blobs, salt.utils.path_join(prefix, entry.name))
  
          ret = set()
          tree = self.get_tree(tgt_env)
          if not tree:
              return ret
          if self.root(tgt_env):
              try:
                  oid = tree[self.root(tgt_env)].oid
                  tree = self.repo[oid]
              except KeyError:
                  return ret
              if not isinstance(tree, pygit2.Tree):
                  return ret
              relpath = lambda path: os.path.relpath(path, self.root(tgt_env))
          else:
              relpath = lambda path: path
          blobs = []
          if len(tree):
              _traverse(tree, blobs, self.root(tgt_env))
          add_mountpoint = lambda path: salt.utils.path_join(self.mountpoint(tgt_env), path)
          for blob in blobs:
              ret.add(add_mountpoint(relpath(blob)))
          if self.mountpoint(tgt_env):
              ret.add(self.mountpoint(tgt_env))
          return ret
code_tokens: def dir_list ( self , tgt_env ) : def _traverse ( tree , blobs , prefix ) : '''
              Traverse through a pygit2 Tree object recursively, accumulating all
              the empty directories within it in the "blobs" list
              ''' for entry in iter ( tree ) : if entry . oid not in self . repo : continue blob = self . repo [ entry . oid ] if not isinstance ( blob , pygit2 . Tree ) : continue blobs . append ( salt . utils . path_join ( prefix , entry . name ) ) if len ( blob ) : _traverse ( blob , blobs , salt . utils . path_join ( prefix , entry . name ) ) ret = set ( ) tree = self . get_tree ( tgt_env ) if not tree : return ret if self . root ( tgt_env ) : try : oid = tree [ self . root ( tgt_env ) ] . oid tree = self . repo [ oid ] except KeyError : return ret if not isinstance ( tree , pygit2 . Tree ) : return ret relpath = lambda path : os . path . relpath ( path , self . root ( tgt_env ) ) else : relpath = lambda path : path blobs = [ ] if len ( tree ) : _traverse ( tree , blobs , self . root ( tgt_env ) ) add_mountpoint = lambda path : salt . utils . path_join ( self . mountpoint ( tgt_env ) , path ) for blob in blobs : ret . add ( add_mountpoint ( relpath ( blob ) ) ) if self . mountpoint ( tgt_env ) : ret . add ( self . mountpoint ( tgt_env ) ) return ret
short_docstring: Get a list of directories for the target environment using pygit2
short_docstring_tokens: Get a list of directories for the target environment using pygit2
comment: '''
          Get a list of directories for the target environment using pygit2
          '''$SEP$'''
              Traverse through a pygit2 Tree object recursively, accumulating all
              the empty directories within it in the "blobs" list
              '''$SEP$# Entry is a submodule, skip it