(self, eval_ctx: t.Optional[EvalContext] = None)
| 497 | abstract = True |
| 498 | |
| 499 | def as_const(self, eval_ctx: t.Optional[EvalContext] = None) -> t.Any: |
| 500 | eval_ctx = get_eval_context(self, eval_ctx) |
| 501 | |
| 502 | # intercepted operators cannot be folded at compile time |
| 503 | if ( |
| 504 | eval_ctx.environment.sandboxed |
| 505 | and self.operator in eval_ctx.environment.intercepted_binops # type: ignore |
| 506 | ): |
| 507 | raise Impossible() |
| 508 | f = _binop_to_func[self.operator] |
| 509 | try: |
| 510 | return f(self.left.as_const(eval_ctx), self.right.as_const(eval_ctx)) |
| 511 | except Exception as e: |
| 512 | raise Impossible() from e |
| 513 | |
| 514 | |
| 515 | class UnaryExpr(Expr): |
nothing calls this directly
no test coverage detected