def _render(self): text = self.base for key in self.path: if is_number(key): text += "[{}]".format(key) else: text += ".{}".format(key) return text
def from_python(cls, value): if value is None: return Null() elif isinstance(value, bool): return Boolean(value) elif is_number(value): return Number(value) elif is_string(value): return String(value) else: raise EqlCompileError("Unknown type {} for value {}".format(type(value).__name__, value))
def _number(arg, base=10): # type: (str, int) -> int|float if is_number(arg): return arg elif is_string(arg): if '.' in arg: return float(arg) if arg.startswith('0x'): arg = arg[2:] base = 16 try: return int(arg, base) except ValueError: return None
def types_match(x, y): return (type(x) == type(y) or is_string(x) and is_string(y) or is_number(x) and is_number(y))
def query_multiple_events(self): # type: () -> (int, Field) """Get the index into the event array and query.""" if self.base == Field.EVENTS and len(self.path) >= 2: if is_number(self.path[0]) and is_string(self.path[1]): return self.path[0], Field(self.path[1], self.path[2:]) return 0, self