parameters: (self, path, refresh=False)
docstring: Directory tree generator, like os.walk.
  
          Generator version of what is in s3fs, which yields a flattened list of
          files.
docstring_summary: Directory tree generator, like os.walk.
docstring_tokens: Directory tree generator like os . walk .
function: def walk(self, path, refresh=False):
          """
          Directory tree generator, like os.walk.
  
          Generator version of what is in s3fs, which yields a flattened list of
          files.
          """
          path = _sanitize_s3(_stringify_path(path))
          directories = set()
          files = set()
  
          for key in list(self.fs._ls(path, refresh=refresh)):
              path = key['Key']
              if key['StorageClass'] == 'DIRECTORY':
                  directories.add(path)
              elif key['StorageClass'] == 'BUCKET':
                  pass
              else:
                  files.add(path)
  
          # s3fs creates duplicate 'DIRECTORY' entries
          files = sorted([posixpath.split(f)[1] for f in files
                          if f not in directories])
          directories = sorted([posixpath.split(x)[1]
                                for x in directories])
  
          yield path, directories, files
  
          for directory in directories:
              yield from self.walk(directory, refresh=refresh)
function_tokens: def walk ( self , path , refresh = False ) : path = _sanitize_s3 ( _stringify_path ( path ) ) directories = set ( ) files = set ( ) for key in list ( self . fs . _ls ( path , refresh = refresh ) ) : path = key [ 'Key' ] if key [ 'StorageClass' ] == 'DIRECTORY' : directories . add ( path ) elif key [ 'StorageClass' ] == 'BUCKET' : pass else : files . add ( path ) # s3fs creates duplicate 'DIRECTORY' entries files = sorted ( [ posixpath . split ( f ) [ 1 ] for f in files if f not in directories ] ) directories = sorted ( [ posixpath . split ( x ) [ 1 ] for x in directories ] ) yield path , directories , files for directory in directories : yield from self . walk ( directory , refresh = refresh )