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