#NEWLINE# def expand_path( path ) : #NEWLINE# #INDENT# 'Expands directories and globs in given path.' #NEWLINE# paths = [ ] #NEWLINE# path = os . path . expanduser ( path ) #NEWLINE# path = os . path . expandvars ( path ) #NEWLINE# if os . path . isdir ( path ) : #NEWLINE# #INDENT# for ( dir , dirs , files ) in os . walk ( path ) : #NEWLINE# #INDENT# for file in files : #NEWLINE# #INDENT# paths . append ( os . path . join ( dir , file ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# paths . extend ( glob ( path ) ) #NEWLINE# #UNINDENT# return paths