(self, query_filter)
Extract chips from a query_filter.
Extract chips from a query_filter.
Extract chips from a query_filter .
def _extract_chips(self, query_filter):
        """Extract chips from a query_filter."""
        chips = query_filter.get('chips', [])
        if not chips:
            return

        for chip_dict in chips:
            chip_type = chip_dict.get('type')
            if not chip_type:
                continue

            chip = None
            if chip_type == 'datetime_interval':
                chip = DateIntervalChip()
            elif chip_type == 'datetime_range':
                chip = DateRangeChip()
            elif chip_type == 'label':
                chip = LabelChip()
            elif chip_type == 'term':
                chip = TermChip()

            if not chip:
                continue
            chip.from_dict(chip_dict)

            active = chip_dict.get('active', True)
            chip.active = active

            operator = chip_dict.get('operator', 'must')
            if operator == 'must':
                chip.set_include()
            elif operator == 'must_not':
                chip.set_exclude()

            self.add_chip(chip)
def _extract_chips ( self , query_filter ) : chips = query_filter . get ( 'chips' , [ ] ) if not chips : return for chip_dict in chips : chip_type = chip_dict . get ( 'type' ) if not chip_type : continue chip = None if chip_type == 'datetime_interval' : chip = DateIntervalChip ( ) elif chip_type == 'datetime_range' : chip = DateRangeChip ( ) elif chip_type == 'label' : chip = LabelChip ( ) elif chip_type == 'term' : chip = TermChip ( ) if not chip : continue chip . from_dict ( chip_dict ) active = chip_dict . get ( 'active' , True ) chip . active = active operator = chip_dict . get ( 'operator' , 'must' ) if operator == 'must' : chip . set_include ( ) elif operator == 'must_not' : chip . set_exclude ( ) self . add_chip ( chip )