#NEWLINE# def filter( self , table , images , filter_string ) : #NEWLINE# #INDENT# self . filter_string = filter_string #NEWLINE# categories = self . categorize ( table , images ) #NEWLINE# self . categories = defaultdict ( list , categories ) #NEWLINE# for button in self . fixed_buttons : #NEWLINE# #INDENT# button [ 'count' ] = len ( self . categories [ button [ 'value' ] ] ) #NEWLINE# #UNINDENT# if ( not filter_string ) : #NEWLINE# #INDENT# return images #NEWLINE# #UNINDENT# return self . categories [ filter_string ]