parameters: (self, wantdirs=False)
return_statement: return [os.path.join(*path_tuple) for path_tuple in
                  sorted(os.path.split(path) for path in result)]
docstring: Return sorted files in directory order
docstring_summary: Return sorted files in directory order
docstring_tokens: Return sorted files in directory order
function: def sorted(self, wantdirs=False):
          """
          Return sorted files in directory order
          """
  
          def add_dir(dirs, d):
              dirs.add(d)
              logger.debug('add_dir added %s', d)
              if d != self.base:
                  parent, _ = os.path.split(d)
                  assert parent not in ('', '/')
                  add_dir(dirs, parent)
  
          result = set(self.files)    # make a copy!
          if wantdirs:
              dirs = set()
              for f in result:
                  add_dir(dirs, os.path.dirname(f))
              result |= dirs
          return [os.path.join(*path_tuple) for path_tuple in
                  sorted(os.path.split(path) for path in result)]
function_tokens: def sorted ( self , wantdirs = False ) : def add_dir ( dirs , d ) : dirs . add ( d ) logger . debug ( 'add_dir added %s' , d ) if d != self . base : parent , _ = os . path . split ( d ) assert parent not in ( '' , '/' ) add_dir ( dirs , parent ) result = set ( self . files ) # make a copy! if wantdirs : dirs = set ( ) for f in result : add_dir ( dirs , os . path . dirname ( f ) ) result |= dirs return [ os . path . join ( * path_tuple ) for path_tuple in sorted ( os . path . split ( path ) for path in result ) ]