Evaluate the match expression. :param matcher: Given an identifier, should return whether it matches or not. Should be prepared to handle arbitrary strings as input. :returns: Whether the expression matches or not.
(self, matcher: Callable[[str], bool])
| 213 | return Expression(code) |
| 214 | |
| 215 | def evaluate(self, matcher: Callable[[str], bool]) -> bool: |
| 216 | """Evaluate the match expression. |
| 217 | |
| 218 | :param matcher: |
| 219 | Given an identifier, should return whether it matches or not. |
| 220 | Should be prepared to handle arbitrary strings as input. |
| 221 | |
| 222 | :returns: Whether the expression matches or not. |
| 223 | """ |
| 224 | ret: bool = eval(self.code, {"__builtins__": {}}, MatcherAdapter(matcher)) |
| 225 | return ret |