def _iter_dir(dir_, saltenv):
 ret = []
 for fn_ in os.listdir(dir_):
  path = os.path.join(dir_, fn_)
  if os.path.isdir(path):
   (yield _iter_dir(path, saltenv))
  elif os.path.isfile(path):
   with salt.utils.fopen(path) as fp_:
    if salt.utils.istextfile(fp_):
     ret.append({'path': six.text_type(path), 'saltenv': six.text_type(saltenv), 'content': six.text_type(fp_.read())})
    else:
     ret.append({'path': six.text_type(path), 'saltenv': six.text_type(saltenv), 'content': u'bin'})
 (yield ret)

def _iter_dir ( dir_ , saltenv ) : ret = [ ] for fn_ in os . listdir ( dir_ ) : path = os . path . join ( dir_ , fn_ ) if os . path . isdir ( path ) : ( yield _iter_dir ( path , saltenv ) ) elif os . path . isfile ( path ) : with salt . utils . fopen ( path ) as fp_ : if salt . utils . istextfile ( fp_ ) : ret . append ( { 'path' : six . text_type ( path ) , 'saltenv' : six . text_type ( saltenv ) , 'content' : six . text_type ( fp_ . read ( ) ) } ) else : ret . append ( { 'path' : six . text_type ( path ) , 'saltenv' : six . text_type ( saltenv ) , 'content' : u'bin' } ) ( yield ret )
walk a dir path looking for files and marking their content type .