The doc AST slice node evaluating method. Parameters ---------- fields : Dict[str, Any] The dictionary of slice information, e.g., lower bound, upper bound, step. Returns ------- res : slice The evaluation result.
(self, fields: dict[str, Any])
| 402 | raise TypeError(f"Expected Python bool or TIR bool, but got {type(test)}") |
| 403 | |
| 404 | def _eval_slice(self, fields: dict[str, Any]) -> slice: |
| 405 | """The doc AST slice node evaluating method. |
| 406 | |
| 407 | Parameters |
| 408 | ---------- |
| 409 | fields : Dict[str, Any] |
| 410 | The dictionary of slice information, |
| 411 | e.g., lower bound, upper bound, step. |
| 412 | |
| 413 | Returns |
| 414 | ------- |
| 415 | res : slice |
| 416 | The evaluation result. |
| 417 | """ |
| 418 | lower, upper, step = fields["lower"], fields["upper"], fields["step"] |
| 419 | |
| 420 | lower = self._eval_expr(lower) if lower is not None else None |
| 421 | upper = self._eval_expr(upper) if upper is not None else None |
| 422 | step = self._eval_expr(step) if step is not None else None |
| 423 | |
| 424 | return slice(lower, upper, step) |
| 425 | |
| 426 | def _eval_expr(self, v: Any) -> Any: |
| 427 | """The doc AST expression node evaluating method. |