#NEWLINE# def iterate_filters( self , filter_dict ) : #NEWLINE# #INDENT# "\n        Iterate over the filters defined in `config` and execute them.\n\n        :arg filter_dict: The configuration dictionary\n\n        .. note:: `filter_dict` should be a dictionary with the following form:\n        .. code-block:: python\n\n                { 'filters' : [\n                        {\n                            'filtertype': 'the_filter_type',\n                            'key1' : 'value1',\n                            ...\n                            'keyN' : 'valueN'\n                        }\n                    ]\n                }\n\n        " #NEWLINE# self . loggit . debug ( 'Iterating over a list of filters' ) #NEWLINE# if ( ( not ( 'filters' in filter_dict ) ) or ( len ( filter_dict [ 'filters' ] ) < 1 ) ) : #NEWLINE# #INDENT# logger . info ( 'No filters in config.  Returning unaltered object.' ) #NEWLINE# return #NEWLINE# #UNINDENT# self . loggit . debug ( 'All filters: {0}' . format ( filter_dict [ 'filters' ] ) ) #NEWLINE# for f in filter_dict [ 'filters' ] : #NEWLINE# #INDENT# self . loggit . debug ( 'Top of the loop: {0}' . format ( self . indices ) ) #NEWLINE# logger . debug ( 'Un-parsed filter args: {0}' . format ( f ) ) #NEWLINE# f_args = None #NEWLINE# if ( not ( 'filtertype' in f ) ) : #NEWLINE# #INDENT# raise ConfigurationError ( 'No "filtertype" in filter definition.' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ft = f [ 'filtertype' ] . lower ( ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# raise ValueError ( 'Invalid value for "filtertype": {0}' . format ( f [ 'filtertype' ] ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# f_args = IDX_FILTER_DEFAULTS [ ft ] #NEWLINE# method = self . __map_method ( ft ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise ConfigurationError ( 'Unrecognized filtertype: {0}' . format ( ft ) ) #NEWLINE# #UNINDENT# del f [ 'filtertype' ] #NEWLINE# if f_args : #NEWLINE# #INDENT# f_args . update ( prune_nones ( f ) ) #NEWLINE# logger . debug ( 'Filter args: {0}' . format ( f_args ) ) #NEWLINE# logger . debug ( 'Pre-instance: {0}' . format ( self . indices ) ) #NEWLINE# method ( ** f_args ) #NEWLINE# logger . debug ( 'Post-instance: {0}' . format ( self . indices ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# method ( )