|
36 | 36 | "MapLike", |
37 | 37 | "MultiSet", |
38 | 38 | "PyObject", |
39 | | - "Rational", |
40 | 39 | "Set", |
41 | 40 | "SetLike", |
42 | 41 | "String", |
@@ -527,91 +526,92 @@ def __add__(self, other: MultiSet[T]) -> MultiSet[T]: ... |
527 | 526 | def map(self, f: Callable[[T], T]) -> MultiSet[T]: ... |
528 | 527 |
|
529 | 528 |
|
530 | | -class Rational(BuiltinExpr): |
531 | | - @method(preserve=True) |
532 | | - def eval(self) -> Fraction: |
533 | | - call = _extract_call(self) |
534 | | - if call.callable != InitRef("Rational"): |
535 | | - msg = "Rational can only be initialized with the Rational constructor." |
536 | | - raise BuiltinEvalError(msg) |
| 529 | +# Removed until egglog experimental supports new backend |
| 530 | +# class Rational(BuiltinExpr): |
| 531 | +# @method(preserve=True) |
| 532 | +# def eval(self) -> Fraction: |
| 533 | +# call = _extract_call(self) |
| 534 | +# if call.callable != InitRef("Rational"): |
| 535 | +# msg = "Rational can only be initialized with the Rational constructor." |
| 536 | +# raise BuiltinEvalError(msg) |
537 | 537 |
|
538 | | - def _to_int(e: TypedExprDecl) -> int: |
539 | | - expr = e.expr |
540 | | - if not isinstance(expr, LitDecl): |
541 | | - msg = "Rational can only be initialized with literals" |
542 | | - raise BuiltinEvalError(msg) |
543 | | - assert isinstance(expr.value, int) |
544 | | - return expr.value |
| 538 | +# def _to_int(e: TypedExprDecl) -> int: |
| 539 | +# expr = e.expr |
| 540 | +# if not isinstance(expr, LitDecl): |
| 541 | +# msg = "Rational can only be initialized with literals" |
| 542 | +# raise BuiltinEvalError(msg) |
| 543 | +# assert isinstance(expr.value, int) |
| 544 | +# return expr.value |
545 | 545 |
|
546 | | - num, den = call.args |
547 | | - return Fraction(_to_int(num), _to_int(den)) |
| 546 | +# num, den = call.args |
| 547 | +# return Fraction(_to_int(num), _to_int(den)) |
548 | 548 |
|
549 | | - @method(preserve=True) |
550 | | - def __float__(self) -> float: |
551 | | - return float(self.eval()) |
| 549 | +# @method(preserve=True) |
| 550 | +# def __float__(self) -> float: |
| 551 | +# return float(self.eval()) |
552 | 552 |
|
553 | | - @method(preserve=True) |
554 | | - def __int__(self) -> int: |
555 | | - return int(self.eval()) |
| 553 | +# @method(preserve=True) |
| 554 | +# def __int__(self) -> int: |
| 555 | +# return int(self.eval()) |
556 | 556 |
|
557 | | - @method(egg_fn="rational") |
558 | | - def __init__(self, num: i64Like, den: i64Like) -> None: ... |
| 557 | +# @method(egg_fn="rational") |
| 558 | +# def __init__(self, num: i64Like, den: i64Like) -> None: ... |
559 | 559 |
|
560 | | - @method(egg_fn="to-f64") |
561 | | - def to_f64(self) -> f64: ... |
| 560 | +# @method(egg_fn="to-f64") |
| 561 | +# def to_f64(self) -> f64: ... |
562 | 562 |
|
563 | | - @method(egg_fn="+") |
564 | | - def __add__(self, other: Rational) -> Rational: ... |
| 563 | +# @method(egg_fn="+") |
| 564 | +# def __add__(self, other: Rational) -> Rational: ... |
565 | 565 |
|
566 | | - @method(egg_fn="-") |
567 | | - def __sub__(self, other: Rational) -> Rational: ... |
| 566 | +# @method(egg_fn="-") |
| 567 | +# def __sub__(self, other: Rational) -> Rational: ... |
568 | 568 |
|
569 | | - @method(egg_fn="*") |
570 | | - def __mul__(self, other: Rational) -> Rational: ... |
| 569 | +# @method(egg_fn="*") |
| 570 | +# def __mul__(self, other: Rational) -> Rational: ... |
571 | 571 |
|
572 | | - @method(egg_fn="/") |
573 | | - def __truediv__(self, other: Rational) -> Rational: ... |
| 572 | +# @method(egg_fn="/") |
| 573 | +# def __truediv__(self, other: Rational) -> Rational: ... |
574 | 574 |
|
575 | | - @method(egg_fn="min") |
576 | | - def min(self, other: Rational) -> Rational: ... |
| 575 | +# @method(egg_fn="min") |
| 576 | +# def min(self, other: Rational) -> Rational: ... |
577 | 577 |
|
578 | | - @method(egg_fn="max") |
579 | | - def max(self, other: Rational) -> Rational: ... |
| 578 | +# @method(egg_fn="max") |
| 579 | +# def max(self, other: Rational) -> Rational: ... |
580 | 580 |
|
581 | | - @method(egg_fn="neg") |
582 | | - def __neg__(self) -> Rational: ... |
| 581 | +# @method(egg_fn="neg") |
| 582 | +# def __neg__(self) -> Rational: ... |
583 | 583 |
|
584 | | - @method(egg_fn="abs") |
585 | | - def __abs__(self) -> Rational: ... |
| 584 | +# @method(egg_fn="abs") |
| 585 | +# def __abs__(self) -> Rational: ... |
586 | 586 |
|
587 | | - @method(egg_fn="floor") |
588 | | - def floor(self) -> Rational: ... |
| 587 | +# @method(egg_fn="floor") |
| 588 | +# def floor(self) -> Rational: ... |
589 | 589 |
|
590 | | - @method(egg_fn="ceil") |
591 | | - def ceil(self) -> Rational: ... |
| 590 | +# @method(egg_fn="ceil") |
| 591 | +# def ceil(self) -> Rational: ... |
592 | 592 |
|
593 | | - @method(egg_fn="round") |
594 | | - def round(self) -> Rational: ... |
| 593 | +# @method(egg_fn="round") |
| 594 | +# def round(self) -> Rational: ... |
595 | 595 |
|
596 | | - @method(egg_fn="pow") |
597 | | - def __pow__(self, other: Rational) -> Rational: ... |
| 596 | +# @method(egg_fn="pow") |
| 597 | +# def __pow__(self, other: Rational) -> Rational: ... |
598 | 598 |
|
599 | | - @method(egg_fn="log") |
600 | | - def log(self) -> Rational: ... |
| 599 | +# @method(egg_fn="log") |
| 600 | +# def log(self) -> Rational: ... |
601 | 601 |
|
602 | | - @method(egg_fn="sqrt") |
603 | | - def sqrt(self) -> Rational: ... |
| 602 | +# @method(egg_fn="sqrt") |
| 603 | +# def sqrt(self) -> Rational: ... |
604 | 604 |
|
605 | | - @method(egg_fn="cbrt") |
606 | | - def cbrt(self) -> Rational: ... |
| 605 | +# @method(egg_fn="cbrt") |
| 606 | +# def cbrt(self) -> Rational: ... |
607 | 607 |
|
608 | | - @method(egg_fn="numer") # type: ignore[misc] |
609 | | - @property |
610 | | - def numer(self) -> i64: ... |
| 608 | +# @method(egg_fn="numer") # type: ignore[misc] |
| 609 | +# @property |
| 610 | +# def numer(self) -> i64: ... |
611 | 611 |
|
612 | | - @method(egg_fn="denom") # type: ignore[misc] |
613 | | - @property |
614 | | - def denom(self) -> i64: ... |
| 612 | +# @method(egg_fn="denom") # type: ignore[misc] |
| 613 | +# @property |
| 614 | +# def denom(self) -> i64: ... |
615 | 615 |
|
616 | 616 |
|
617 | 617 | class BigInt(BuiltinExpr): |
|
0 commit comments