in bowler/query.py [0:0]
def filter(self, filter_callback: Union[str, Filter]) -> "Query":
if isinstance(filter_callback, str):
code = compile(filter_callback, "<string>", "eval")
def callback(node: Node, capture: Capture, filename: Filename) -> bool:
return bool(eval(code)) # noqa: developer tool
filter_callback = cast(Filter, filter_callback)
self.current.filters.append(filter_callback)
return self