def Compile(self, filter_implementation):
    """Compiles the filter implementation.

    Args:
      filter_implementation: a filter object (instance of objectfilter.TODO).

    Returns:
      A filter operator (instance of TODO).

    Raises:
      ParserError: if an unknown operator is provided.
    """
    self.attribute = self.swap_source.get(self.attribute, self.attribute)
    arguments = [self.attribute]
    op_str = self.operator.lower()
    operator = filter_implementation.OPS.get(op_str, None)

    if not operator:
      raise errors.ParseError('Unknown operator {0:s} provided.'.format(
          self.operator))

    # Plaso specific implementation - if we are comparing a timestamp
    # to a value, we use our specific implementation that compares
    # timestamps in a "human readable" format.
    if self.attribute == 'timestamp':
      args = []
      for argument in self.args:
        args.append(DateCompareObject(argument))
      self.args = args

    for argument in self.args:
      if isinstance(argument, DateCompareObject):
        if 'Less' in str(operator):
          TimeRangeCache.SetUpperTimestamp(argument.data)
        else:
          TimeRangeCache.SetLowerTimestamp(argument.data)
    arguments.extend(self.args)
    expander = filter_implementation.FILTERS['ValueExpander']
    ops = operator(arguments=arguments, value_expander=expander)
    if not self.bool_value:
      if hasattr(ops, 'FlipBool'):
        ops.FlipBool()

    return ops
def Compile ( self , filter_implementation ) : self . attribute = self . swap_source . get ( self . attribute , self . attribute ) arguments = [ self . attribute ] op_str = self . operator . lower ( ) operator = filter_implementation . OPS . get ( op_str , None ) if not operator : raise errors . ParseError ( 'Unknown operator {0:s} provided.' . format ( self . operator ) ) if self . attribute == 'timestamp' : args = [ ] for argument in self . args : args . append ( DateCompareObject ( argument ) ) self . args = args for argument in self . args : if isinstance ( argument , DateCompareObject ) : if 'Less' in str ( operator ) : TimeRangeCache . SetUpperTimestamp ( argument . data ) else : TimeRangeCache . SetLowerTimestamp ( argument . data ) arguments . extend ( self . args ) expander = filter_implementation . FILTERS [ 'ValueExpander' ] ops = operator ( arguments = arguments , value_expander = expander ) if not self . bool_value : if hasattr ( ops , 'FlipBool' ) : ops . FlipBool ( ) return ops
Compiles the filter implementation.

    Args:
      filter_implementation: a filter object (instance of objectfilter.TODO).

    Returns:
      A filter operator (instance of TODO).

    Raises:
      ParserError: if an unknown operator is provided.