#NEWLINE# def get_files( self , path , directory ) : #NEWLINE# #INDENT# def _strip_path( name , path ) : #NEWLINE# #INDENT# if name . startswith ( path ) : #NEWLINE# #INDENT# return name . replace ( path , '' , 1 ) #NEWLINE# #UNINDENT# return name #NEWLINE# #UNINDENT# def _remove_trailing_slash( name ) : #NEWLINE# #INDENT# return name [ : ( - 1 ) ] #NEWLINE# #UNINDENT# def _iso_to_epoch( timestamp ) : #NEWLINE# #INDENT# dt = time . strptime ( timestamp . split ( '.' ) [ 0 ] , '%Y-%m-%dT%H:%M:%S' ) #NEWLINE# return int ( time . mktime ( dt ) ) #NEWLINE# #UNINDENT# files = [ ] #NEWLINE# directories = [ ] #NEWLINE# if ( path and ( not path . endswith ( self . separator ) ) ) : #NEWLINE# #INDENT# path += self . separator #NEWLINE# #UNINDENT# for key in self . bucket . list ( path , self . separator ) : #NEWLINE# #INDENT# if ( key . name == path ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if isinstance ( key , Prefix ) : #NEWLINE# #INDENT# name = _remove_trailing_slash ( _strip_path ( key . name , path ) ) #NEWLINE# key_name = _remove_trailing_slash ( key . name ) #NEWLINE# directories . append ( ( name , key_name , True , 0 , 0 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# last_modified = _iso_to_epoch ( key . last_modified ) #NEWLINE# name = _strip_path ( key . name , path ) #NEWLINE# files . append ( ( name , key . name , False , key . size , last_modified ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ( directories + files )