(self, eval_ctx: t.Optional[EvalContext] = None)
| 519 | abstract = True |
| 520 | |
| 521 | def as_const(self, eval_ctx: t.Optional[EvalContext] = None) -> t.Any: |
| 522 | eval_ctx = get_eval_context(self, eval_ctx) |
| 523 | |
| 524 | # intercepted operators cannot be folded at compile time |
| 525 | if ( |
| 526 | eval_ctx.environment.sandboxed |
| 527 | and self.operator in eval_ctx.environment.intercepted_unops # type: ignore |
| 528 | ): |
| 529 | raise Impossible() |
| 530 | f = _uaop_to_func[self.operator] |
| 531 | try: |
| 532 | return f(self.node.as_const(eval_ctx)) |
| 533 | except Exception as e: |
| 534 | raise Impossible() from e |
| 535 | |
| 536 | |
| 537 | class Name(Expr): |
nothing calls this directly
no test coverage detected