#NEWLINE# def walk( self , depthfirst = False ) : #NEWLINE# #INDENT# "Mimic os.walk, iterating over each container and the items within\n        in. Each iteration yields:\n\n            container, (iterator for items)\n\n        Since all AD items are effectively containers, don't bother producing\n        a separate iterator for them.\n\n        :param depthfirst: Whether to use breadth-first (the default) or depth-first traversal\n        :returns: yield container, (iterator for items)\n        " #NEWLINE# top = self #NEWLINE# ( containers , items ) = ( [ ] , [ ] ) #NEWLINE# for item in self : #NEWLINE# #INDENT# if isinstance ( f , Dir ) : #NEWLINE# #INDENT# dirs . append ( f ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nondirs . append ( f ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not self ) : #NEWLINE# #INDENT# ( yield ( top , dirs , nondirs ) ) #NEWLINE# #UNINDENT# for d in dirs : #NEWLINE# #INDENT# for x in d . walk ( depthfirst = depthfirst , ignore_access_errors = ignore_access_errors ) : #NEWLINE# #INDENT# ( yield x ) #NEWLINE# #UNINDENT# #UNINDENT# if depthfirst : #NEWLINE# #INDENT# ( yield ( top , dirs , nondirs ) )