egglog 10.0.1__cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 10.0.2__cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of egglog might be problematic. Click here for more details.
- egglog/bindings.cpython-313-aarch64-linux-gnu.so +0 -0
- egglog/builtins.py +10 -9
- egglog/declarations.py +3 -3
- egglog/egraph.py +10 -16
- egglog/exp/array_api.py +9 -9
- egglog/exp/program_gen.py +4 -3
- egglog/runtime.py +6 -4
- egglog/thunk.py +6 -4
- egglog/type_constraint_solver.py +1 -1
- egglog/version_compat.py +87 -0
- {egglog-10.0.1.dist-info → egglog-10.0.2.dist-info}/METADATA +1 -1
- {egglog-10.0.1.dist-info → egglog-10.0.2.dist-info}/RECORD +37 -36
- {egglog-10.0.1.dist-info → egglog-10.0.2.dist-info}/WHEEL +1 -1
- {egglog-10.0.1.dist-info → egglog-10.0.2.dist-info}/licenses/LICENSE +0 -0
|
Binary file
|
egglog/builtins.py
CHANGED
|
@@ -9,7 +9,7 @@ from collections.abc import Callable
|
|
|
9
9
|
from fractions import Fraction
|
|
10
10
|
from functools import partial, reduce
|
|
11
11
|
from types import FunctionType, MethodType
|
|
12
|
-
from typing import TYPE_CHECKING, Generic, Protocol, TypeAlias, TypeVar,
|
|
12
|
+
from typing import TYPE_CHECKING, Generic, Protocol, TypeAlias, TypeVar, cast, overload
|
|
13
13
|
|
|
14
14
|
from typing_extensions import TypeVarTuple, Unpack
|
|
15
15
|
|
|
@@ -101,8 +101,6 @@ def join(*strings: StringLike) -> String: ...
|
|
|
101
101
|
|
|
102
102
|
converter(str, String, String)
|
|
103
103
|
|
|
104
|
-
BoolLike: TypeAlias = Union["Bool", bool]
|
|
105
|
-
|
|
106
104
|
|
|
107
105
|
class Bool(BuiltinExpr, egg_sort="bool"):
|
|
108
106
|
@method(preserve=True)
|
|
@@ -133,10 +131,10 @@ class Bool(BuiltinExpr, egg_sort="bool"):
|
|
|
133
131
|
def implies(self, other: BoolLike) -> Bool: ...
|
|
134
132
|
|
|
135
133
|
|
|
136
|
-
|
|
134
|
+
BoolLike: TypeAlias = Bool | bool
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
|
|
137
|
+
converter(bool, Bool, Bool)
|
|
140
138
|
|
|
141
139
|
|
|
142
140
|
class i64(BuiltinExpr): # noqa: N801
|
|
@@ -248,6 +246,9 @@ class i64(BuiltinExpr): # noqa: N801
|
|
|
248
246
|
def bool_ge(self, other: i64Like) -> Bool: ...
|
|
249
247
|
|
|
250
248
|
|
|
249
|
+
# The types which can be convertered into an i64
|
|
250
|
+
i64Like: TypeAlias = i64 | int # noqa: N816, PYI042
|
|
251
|
+
|
|
251
252
|
converter(int, i64, i64)
|
|
252
253
|
|
|
253
254
|
|
|
@@ -255,9 +256,6 @@ converter(int, i64, i64)
|
|
|
255
256
|
def count_matches(s: StringLike, pattern: StringLike) -> i64: ...
|
|
256
257
|
|
|
257
258
|
|
|
258
|
-
f64Like: TypeAlias = Union["f64", float] # noqa: N816, PYI042
|
|
259
|
-
|
|
260
|
-
|
|
261
259
|
class f64(BuiltinExpr): # noqa: N801
|
|
262
260
|
@method(preserve=True)
|
|
263
261
|
def eval(self) -> float:
|
|
@@ -337,6 +335,9 @@ class f64(BuiltinExpr): # noqa: N801
|
|
|
337
335
|
def to_string(self) -> String: ...
|
|
338
336
|
|
|
339
337
|
|
|
338
|
+
f64Like: TypeAlias = f64 | float # noqa: N816, PYI042
|
|
339
|
+
|
|
340
|
+
|
|
340
341
|
converter(float, f64, f64)
|
|
341
342
|
|
|
342
343
|
|
egglog/declarations.py
CHANGED
|
@@ -93,7 +93,7 @@ class DelayedDeclerations:
|
|
|
93
93
|
# Catch attribute error, so that it isn't bubbled up as a missing attribute and fallbacks on `__getattr__`
|
|
94
94
|
# instead raise explicitly
|
|
95
95
|
except AttributeError as err:
|
|
96
|
-
msg = f"Cannot resolve
|
|
96
|
+
msg = f"Cannot resolve declarations for {self}"
|
|
97
97
|
raise RuntimeError(msg) from err
|
|
98
98
|
|
|
99
99
|
|
|
@@ -308,11 +308,11 @@ class ClassTypeVarRef:
|
|
|
308
308
|
module: str
|
|
309
309
|
|
|
310
310
|
def to_just(self) -> JustTypeRef:
|
|
311
|
-
msg = "egglog does not support generic classes yet."
|
|
311
|
+
msg = f"{self}: egglog does not support generic classes yet."
|
|
312
312
|
raise NotImplementedError(msg)
|
|
313
313
|
|
|
314
314
|
def __str__(self) -> str:
|
|
315
|
-
return
|
|
315
|
+
return str(self.to_type_var())
|
|
316
316
|
|
|
317
317
|
@classmethod
|
|
318
318
|
def from_type_var(cls, typevar: TypeVar) -> ClassTypeVarRef:
|
egglog/egraph.py
CHANGED
|
@@ -16,7 +16,6 @@ from typing import (
|
|
|
16
16
|
ClassVar,
|
|
17
17
|
Generic,
|
|
18
18
|
Literal,
|
|
19
|
-
Never,
|
|
20
19
|
TypeAlias,
|
|
21
20
|
TypedDict,
|
|
22
21
|
TypeVar,
|
|
@@ -26,7 +25,7 @@ from typing import (
|
|
|
26
25
|
)
|
|
27
26
|
|
|
28
27
|
import graphviz
|
|
29
|
-
from typing_extensions import ParamSpec, Self, Unpack, assert_never
|
|
28
|
+
from typing_extensions import Never, ParamSpec, Self, Unpack, assert_never
|
|
30
29
|
|
|
31
30
|
from . import bindings
|
|
32
31
|
from .conversion import *
|
|
@@ -36,6 +35,7 @@ from .ipython_magic import IN_IPYTHON
|
|
|
36
35
|
from .pretty import pretty_decl
|
|
37
36
|
from .runtime import *
|
|
38
37
|
from .thunk import *
|
|
38
|
+
from .version_compat import *
|
|
39
39
|
|
|
40
40
|
if TYPE_CHECKING:
|
|
41
41
|
from .builtins import String, Unit
|
|
@@ -169,8 +169,9 @@ def check_eq(x: BASE_EXPR, y: BASE_EXPR, schedule: Schedule | None = None, *, ad
|
|
|
169
169
|
except bindings.EggSmolError as err:
|
|
170
170
|
if display:
|
|
171
171
|
egraph.display()
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
raise add_note(
|
|
173
|
+
f"Failed:\n{eq(x).to(y)}\n\nExtracted:\n {eq(egraph.extract(x)).to(egraph.extract(y))})", err
|
|
174
|
+
) from None
|
|
174
175
|
return egraph
|
|
175
176
|
|
|
176
177
|
|
|
@@ -492,8 +493,7 @@ def _generate_class_decls( # noqa: C901,PLR0912
|
|
|
492
493
|
reverse_args=reverse_args,
|
|
493
494
|
)
|
|
494
495
|
except Exception as e:
|
|
495
|
-
|
|
496
|
-
raise
|
|
496
|
+
raise add_note(f"Error processing {cls_name}.{method_name}", e) from None
|
|
497
497
|
|
|
498
498
|
if not builtin and not isinstance(ref, InitRef) and not mutates:
|
|
499
499
|
add_default_funcs.append(add_rewrite)
|
|
@@ -569,16 +569,11 @@ def _fn_decl(
|
|
|
569
569
|
if not isinstance(fn, FunctionType):
|
|
570
570
|
raise NotImplementedError(f"Can only generate function decls for functions not {fn} {type(fn)}")
|
|
571
571
|
|
|
572
|
-
hint_globals = fn.__globals__.copy()
|
|
573
|
-
# Copy Callable into global if not present bc sometimes it gets automatically removed by ruff to type only block
|
|
574
|
-
# https://docs.astral.sh/ruff/rules/typing-only-standard-library-import/
|
|
575
|
-
if "Callable" not in hint_globals:
|
|
576
|
-
hint_globals["Callable"] = Callable
|
|
577
572
|
# Instead of passing both globals and locals, just pass the globals. Otherwise, for some reason forward references
|
|
578
573
|
# won't be resolved correctly
|
|
579
574
|
# We need this to be false so it returns "__forward_value__" https://github.com/python/cpython/blob/440ed18e08887b958ad50db1b823e692a747b671/Lib/typing.py#L919
|
|
580
575
|
# https://github.com/egraphs-good/egglog-python/issues/210
|
|
581
|
-
hint_globals.
|
|
576
|
+
hint_globals = {**fn.__globals__, **hint_locals}
|
|
582
577
|
hints = get_type_hints(fn, hint_globals)
|
|
583
578
|
|
|
584
579
|
params = list(signature(fn).parameters.values())
|
|
@@ -632,7 +627,7 @@ def _fn_decl(
|
|
|
632
627
|
)
|
|
633
628
|
decls |= merged
|
|
634
629
|
|
|
635
|
-
# defer this in generator so it
|
|
630
|
+
# defer this in generator so it doesn't resolve for builtins eagerly
|
|
636
631
|
args = (TypedExprDecl(tp.to_just(), VarDecl(name, False)) for name, tp in zip(arg_names, arg_types, strict=True))
|
|
637
632
|
res_ref: FunctionRef | MethodRef | ClassMethodRef | PropertyRef | InitRef | UnnamedFunctionRef
|
|
638
633
|
res_thunk: Callable[[], object]
|
|
@@ -676,7 +671,7 @@ def _fn_decl(
|
|
|
676
671
|
)
|
|
677
672
|
res_ref = ref
|
|
678
673
|
decls.set_function_decl(ref, decl)
|
|
679
|
-
res_thunk = Thunk.fn(_create_default_value, decls, ref, fn, args, ruleset)
|
|
674
|
+
res_thunk = Thunk.fn(_create_default_value, decls, ref, fn, args, ruleset, context=f"creating {ref}")
|
|
680
675
|
return res_ref, Thunk.fn(_add_default_rewrite_function, decls, res_ref, return_type, ruleset, res_thunk, subsume)
|
|
681
676
|
|
|
682
677
|
|
|
@@ -1045,8 +1040,7 @@ class EGraph:
|
|
|
1045
1040
|
bindings.ActionCommand(bindings.Extract(span(2), expr, bindings.Lit(span(2), bindings.Int(n))))
|
|
1046
1041
|
)
|
|
1047
1042
|
except BaseException as e:
|
|
1048
|
-
|
|
1049
|
-
raise
|
|
1043
|
+
raise add_note("Extracting: " + str(expr), e) # noqa: B904
|
|
1050
1044
|
extract_report = self._egraph.extract_report()
|
|
1051
1045
|
if not extract_report:
|
|
1052
1046
|
msg = "No extract report saved"
|
egglog/exp/array_api.py
CHANGED
|
@@ -69,6 +69,7 @@ import numpy as np
|
|
|
69
69
|
|
|
70
70
|
from egglog import *
|
|
71
71
|
from egglog.runtime import RuntimeExpr
|
|
72
|
+
from egglog.version_compat import add_note
|
|
72
73
|
|
|
73
74
|
from .program_gen import *
|
|
74
75
|
|
|
@@ -1198,13 +1199,13 @@ class NDArray(Expr, ruleset=array_api_ruleset):
|
|
|
1198
1199
|
|
|
1199
1200
|
NDArrayLike: TypeAlias = NDArray | ValueLike | TupleValueLike
|
|
1200
1201
|
|
|
1201
|
-
converter(NDArray, IndexKey, IndexKey.ndarray)
|
|
1202
|
-
converter(Value, NDArray, NDArray.scalar)
|
|
1202
|
+
converter(NDArray, IndexKey, lambda v: IndexKey.ndarray(v))
|
|
1203
|
+
converter(Value, NDArray, lambda v: NDArray.scalar(v))
|
|
1203
1204
|
# Need this if we want to use ints in slices of arrays coming from 1d arrays, but make it more expensive
|
|
1204
1205
|
# to prefer upcasting in the other direction when we can, which is safer at runtime
|
|
1205
1206
|
converter(NDArray, Value, lambda n: n.to_value(), 100)
|
|
1206
|
-
converter(TupleValue, NDArray, NDArray.vector)
|
|
1207
|
-
converter(TupleInt, TupleValue, TupleValue.from_tuple_int)
|
|
1207
|
+
converter(TupleValue, NDArray, lambda v: NDArray.vector(v))
|
|
1208
|
+
converter(TupleInt, TupleValue, lambda v: TupleValue.from_tuple_int(v))
|
|
1208
1209
|
|
|
1209
1210
|
|
|
1210
1211
|
@array_api_ruleset.register
|
|
@@ -1383,8 +1384,8 @@ class IntOrTuple(Expr, ruleset=array_api_ruleset):
|
|
|
1383
1384
|
def tuple(cls, value: TupleIntLike) -> IntOrTuple: ...
|
|
1384
1385
|
|
|
1385
1386
|
|
|
1386
|
-
converter(Int, IntOrTuple, IntOrTuple.int)
|
|
1387
|
-
converter(TupleInt, IntOrTuple, IntOrTuple.tuple)
|
|
1387
|
+
converter(Int, IntOrTuple, lambda v: IntOrTuple.int(v))
|
|
1388
|
+
converter(TupleInt, IntOrTuple, lambda v: IntOrTuple.tuple(v))
|
|
1388
1389
|
|
|
1389
1390
|
|
|
1390
1391
|
class OptionalIntOrTuple(Expr, ruleset=array_api_ruleset):
|
|
@@ -1395,7 +1396,7 @@ class OptionalIntOrTuple(Expr, ruleset=array_api_ruleset):
|
|
|
1395
1396
|
|
|
1396
1397
|
|
|
1397
1398
|
converter(type(None), OptionalIntOrTuple, lambda _: OptionalIntOrTuple.none)
|
|
1398
|
-
converter(IntOrTuple, OptionalIntOrTuple, OptionalIntOrTuple.some)
|
|
1399
|
+
converter(IntOrTuple, OptionalIntOrTuple, lambda v: OptionalIntOrTuple.some(v))
|
|
1399
1400
|
|
|
1400
1401
|
|
|
1401
1402
|
@function
|
|
@@ -1980,6 +1981,5 @@ def try_evaling(egraph: EGraph, schedule: Schedule, expr: Expr, prim_expr: Built
|
|
|
1980
1981
|
extracted = egraph.extract(prim_expr)
|
|
1981
1982
|
except BaseException as e:
|
|
1982
1983
|
# egraph.display(n_inline_leaves=1, split_primitive_outputs=True)
|
|
1983
|
-
|
|
1984
|
-
raise
|
|
1984
|
+
raise add_note(f"Cannot evaluate {egraph.extract(expr)}", e) # noqa: B904
|
|
1985
1985
|
return extracted.eval() # type: ignore[attr-defined]
|
egglog/exp/program_gen.py
CHANGED
|
@@ -5,12 +5,10 @@ Builds up imperative string expressions from a functional expression.
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
-
from typing import TypeAlias
|
|
8
|
+
from typing import TypeAlias
|
|
9
9
|
|
|
10
10
|
from egglog import *
|
|
11
11
|
|
|
12
|
-
ProgramLike: TypeAlias = Union["Program", StringLike]
|
|
13
|
-
|
|
14
12
|
|
|
15
13
|
class Program(Expr):
|
|
16
14
|
"""
|
|
@@ -97,6 +95,9 @@ class Program(Expr):
|
|
|
97
95
|
"""
|
|
98
96
|
|
|
99
97
|
|
|
98
|
+
ProgramLike: TypeAlias = Program | StringLike
|
|
99
|
+
|
|
100
|
+
|
|
100
101
|
converter(String, Program, Program)
|
|
101
102
|
|
|
102
103
|
|
egglog/runtime.py
CHANGED
|
@@ -22,6 +22,7 @@ from .declarations import *
|
|
|
22
22
|
from .pretty import *
|
|
23
23
|
from .thunk import Thunk
|
|
24
24
|
from .type_constraint_solver import *
|
|
25
|
+
from .version_compat import *
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
27
28
|
from collections.abc import Iterable
|
|
@@ -249,8 +250,7 @@ class RuntimeClass(DelayedDeclerations):
|
|
|
249
250
|
try:
|
|
250
251
|
cls_decl = self.__egg_decls__._classes[self.__egg_tp__.name]
|
|
251
252
|
except Exception as e:
|
|
252
|
-
|
|
253
|
-
raise
|
|
253
|
+
raise add_note(f"Error processing class {self.__egg_tp__.name}", e) from None
|
|
254
254
|
|
|
255
255
|
preserved_methods = cls_decl.preserved_methods
|
|
256
256
|
if name in preserved_methods:
|
|
@@ -281,6 +281,9 @@ class RuntimeClass(DelayedDeclerations):
|
|
|
281
281
|
def __str__(self) -> str:
|
|
282
282
|
return str(self.__egg_tp__)
|
|
283
283
|
|
|
284
|
+
def __repr__(self) -> str:
|
|
285
|
+
return str(self)
|
|
286
|
+
|
|
284
287
|
# Make hashable so can go in Union
|
|
285
288
|
def __hash__(self) -> int:
|
|
286
289
|
return hash((id(self.__egg_decls_thunk__), self.__egg_tp__))
|
|
@@ -315,8 +318,7 @@ class RuntimeFunction(DelayedDeclerations):
|
|
|
315
318
|
try:
|
|
316
319
|
signature = self.__egg_decls__.get_callable_decl(self.__egg_ref__).signature
|
|
317
320
|
except Exception as e:
|
|
318
|
-
|
|
319
|
-
raise
|
|
321
|
+
raise add_note(f"Failed to find callable {self}", e) # noqa: B904
|
|
320
322
|
decls = self.__egg_decls__.copy()
|
|
321
323
|
# Special case function application bc we dont support variadic generics yet generally
|
|
322
324
|
if signature == "fn-app":
|
egglog/thunk.py
CHANGED
|
@@ -41,13 +41,13 @@ class Thunk(Generic[T, Unpack[TS]]):
|
|
|
41
41
|
state: Resolved[T] | Unresolved[T, Unpack[TS]] | Resolving | Error
|
|
42
42
|
|
|
43
43
|
@classmethod
|
|
44
|
-
def fn(cls, fn: Callable[[Unpack[TS]], T], *args: Unpack[TS]) -> Thunk[T, Unpack[TS]]:
|
|
44
|
+
def fn(cls, fn: Callable[[Unpack[TS]], T], *args: Unpack[TS], context: str | None = None) -> Thunk[T, Unpack[TS]]:
|
|
45
45
|
"""
|
|
46
46
|
Create a thunk based on some functions and some partial args.
|
|
47
47
|
|
|
48
48
|
If the function is called while it is being resolved recursively it will raise an exception.
|
|
49
49
|
"""
|
|
50
|
-
return cls(Unresolved(fn, args))
|
|
50
|
+
return cls(Unresolved(fn, args, context))
|
|
51
51
|
|
|
52
52
|
@classmethod
|
|
53
53
|
def value(cls, value: T) -> Thunk[T]:
|
|
@@ -57,12 +57,12 @@ class Thunk(Generic[T, Unpack[TS]]):
|
|
|
57
57
|
match self.state:
|
|
58
58
|
case Resolved(value):
|
|
59
59
|
return value
|
|
60
|
-
case Unresolved(fn, args):
|
|
60
|
+
case Unresolved(fn, args, context):
|
|
61
61
|
self.state = Resolving()
|
|
62
62
|
try:
|
|
63
63
|
res = fn(*args)
|
|
64
64
|
except Exception as e:
|
|
65
|
-
self.state = Error(e)
|
|
65
|
+
self.state = Error(e, context)
|
|
66
66
|
raise e from None
|
|
67
67
|
else:
|
|
68
68
|
self.state = Resolved(res)
|
|
@@ -83,6 +83,7 @@ class Resolved(Generic[T]):
|
|
|
83
83
|
class Unresolved(Generic[T, Unpack[TS]]):
|
|
84
84
|
fn: Callable[[Unpack[TS]], T]
|
|
85
85
|
args: tuple[Unpack[TS]]
|
|
86
|
+
context: str | None
|
|
86
87
|
|
|
87
88
|
|
|
88
89
|
@dataclass
|
|
@@ -93,3 +94,4 @@ class Resolving:
|
|
|
93
94
|
@dataclass
|
|
94
95
|
class Error:
|
|
95
96
|
e: Exception
|
|
97
|
+
context: str | None
|
egglog/type_constraint_solver.py
CHANGED
|
@@ -107,7 +107,7 @@ class TypeConstraintSolver:
|
|
|
107
107
|
try:
|
|
108
108
|
return self._cls_typevar_index_to_type[cls_name][tp]
|
|
109
109
|
except KeyError as e:
|
|
110
|
-
raise TypeConstraintError(f"Not enough bound typevars for {tp} in class {cls_name}") from e
|
|
110
|
+
raise TypeConstraintError(f"Not enough bound typevars for {tp!r} in class {cls_name}") from e
|
|
111
111
|
case TypeRefWithVars(name, args):
|
|
112
112
|
return JustTypeRef(name, tuple(self.substitute_typevars(arg, cls_name) for arg in args))
|
|
113
113
|
assert_never(tp)
|
egglog/version_compat.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import collections
|
|
2
|
+
import sys
|
|
3
|
+
import types
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
BEFORE_3_11 = sys.version_info < (3, 11)
|
|
7
|
+
|
|
8
|
+
__all__ = ["add_note"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def add_note(message: str, exc: BaseException) -> BaseException:
|
|
12
|
+
"""
|
|
13
|
+
Backwards compatible add_note for Python <= 3.10
|
|
14
|
+
"""
|
|
15
|
+
if BEFORE_3_11:
|
|
16
|
+
return exc
|
|
17
|
+
exc.add_note(message)
|
|
18
|
+
return exc
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# For Python version 3.10 need to monkeypatch this function so that RuntimeClass type parameters
|
|
22
|
+
# will be collected as typevars
|
|
23
|
+
if BEFORE_3_11:
|
|
24
|
+
|
|
25
|
+
@typing.no_type_check
|
|
26
|
+
def _collect_type_vars_monkeypatch(types_, typevar_types=None):
|
|
27
|
+
"""
|
|
28
|
+
Collect all type variable contained
|
|
29
|
+
in types in order of first appearance (lexicographic order). For example::
|
|
30
|
+
|
|
31
|
+
_collect_type_vars((T, List[S, T])) == (T, S)
|
|
32
|
+
"""
|
|
33
|
+
from .runtime import RuntimeClass
|
|
34
|
+
|
|
35
|
+
if typevar_types is None:
|
|
36
|
+
typevar_types = typing.TypeVar
|
|
37
|
+
tvars = []
|
|
38
|
+
for t in types_:
|
|
39
|
+
if isinstance(t, typevar_types) and t not in tvars:
|
|
40
|
+
tvars.append(t)
|
|
41
|
+
# **MONKEYPATCH CHANGE HERE TO ADD RuntimeClass**
|
|
42
|
+
if isinstance(t, (typing._GenericAlias, typing.GenericAlias, types.UnionType, RuntimeClass)): # type: ignore[name-defined]
|
|
43
|
+
tvars.extend([t for t in t.__parameters__ if t not in tvars])
|
|
44
|
+
return tuple(tvars)
|
|
45
|
+
|
|
46
|
+
typing._collect_type_vars = _collect_type_vars_monkeypatch # type: ignore[attr-defined]
|
|
47
|
+
|
|
48
|
+
@typing.no_type_check
|
|
49
|
+
@typing._tp_cache
|
|
50
|
+
def __getitem__monkeypatch(self, params): # noqa: C901, PLR0912
|
|
51
|
+
from .runtime import RuntimeClass
|
|
52
|
+
|
|
53
|
+
if self.__origin__ in (typing.Generic, typing.Protocol):
|
|
54
|
+
# Can't subscript Generic[...] or Protocol[...].
|
|
55
|
+
raise TypeError(f"Cannot subscript already-subscripted {self}")
|
|
56
|
+
if not isinstance(params, tuple):
|
|
57
|
+
params = (params,)
|
|
58
|
+
params = tuple(typing._type_convert(p) for p in params)
|
|
59
|
+
if self._paramspec_tvars and any(isinstance(t, typing.ParamSpec) for t in self.__parameters__):
|
|
60
|
+
params = typing._prepare_paramspec_params(self, params)
|
|
61
|
+
else:
|
|
62
|
+
typing._check_generic(self, params, len(self.__parameters__))
|
|
63
|
+
|
|
64
|
+
subst = dict(zip(self.__parameters__, params, strict=False))
|
|
65
|
+
new_args = []
|
|
66
|
+
for arg in self.__args__:
|
|
67
|
+
if isinstance(arg, self._typevar_types):
|
|
68
|
+
if isinstance(arg, typing.ParamSpec):
|
|
69
|
+
arg = subst[arg] # noqa: PLW2901
|
|
70
|
+
if not typing._is_param_expr(arg):
|
|
71
|
+
raise TypeError(f"Expected a list of types, an ellipsis, ParamSpec, or Concatenate. Got {arg}")
|
|
72
|
+
else:
|
|
73
|
+
arg = subst[arg] # noqa: PLW2901
|
|
74
|
+
# **MONKEYPATCH CHANGE HERE TO ADD RuntimeClass**
|
|
75
|
+
elif isinstance(arg, (typing._GenericAlias, typing.GenericAlias, types.UnionType, RuntimeClass)):
|
|
76
|
+
subparams = arg.__parameters__
|
|
77
|
+
if subparams:
|
|
78
|
+
subargs = tuple(subst[x] for x in subparams)
|
|
79
|
+
arg = arg[subargs] # noqa: PLW2901
|
|
80
|
+
# Required to flatten out the args for CallableGenericAlias
|
|
81
|
+
if self.__origin__ == collections.abc.Callable and isinstance(arg, tuple):
|
|
82
|
+
new_args.extend(arg)
|
|
83
|
+
else:
|
|
84
|
+
new_args.append(arg)
|
|
85
|
+
return self.copy_with(tuple(new_args))
|
|
86
|
+
|
|
87
|
+
typing._GenericAlias.__getitem__ = __getitem__monkeypatch # type: ignore[attr-defined]
|
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
egglog-10.0.
|
|
2
|
-
egglog-10.0.
|
|
3
|
-
egglog-10.0.
|
|
4
|
-
egglog/
|
|
5
|
-
egglog/
|
|
6
|
-
egglog/builtins.py,sha256=7cZk-MxUvOA3OT9RSX7WkYBoj1whAfp3tOB3a82ZTH0,29636
|
|
7
|
-
egglog/exp/array_api_numba.py,sha256=X3H1TnCjPL92uVm6OvcWMJ11IeorAE58zWiOX6huPv4,2696
|
|
8
|
-
egglog/exp/program_gen.py,sha256=9q8-ihkXLgeRU_BrINF3t3gThdS74KCzTo4UiRIR6Dk,13027
|
|
9
|
-
egglog/exp/array_api_program_gen.py,sha256=0FpWZZJ3VqIod9vIYfQYUIiyswfj4h4K_4s6GZb8SJY,21742
|
|
10
|
-
egglog/exp/siu_examples.py,sha256=yZ-sgH2Y12iTdwBUumP7D2OtCGL83M6pPW7PMobVFXc,719
|
|
11
|
-
egglog/exp/__init__.py,sha256=nPtzrH1bz1LVZhZCuS0S9Qild8m5gEikjOVqWAFIa88,49
|
|
12
|
-
egglog/exp/array_api.py,sha256=jKQoDg3bYg0TGGEJLwXF3okWDkgi4JA4ayXzwf-9XB4,63706
|
|
13
|
-
egglog/exp/array_api_jit.py,sha256=90RmyivRoCKzVtiYWnTBkK2q2FDkD2p1iq7vzbh68b4,1546
|
|
14
|
-
egglog/exp/array_api_loopnest.py,sha256=-kbyorlGxvlaNsLx1nmLfEZHQM7VMEBwSKtV0l-bs0g,2444
|
|
15
|
-
egglog/type_constraint_solver.py,sha256=_y52JJoxWJDzokvS07-QHJ4sQpvWE86_Dk43RAUqhAk,4516
|
|
16
|
-
egglog/runtime.py,sha256=vyzN52njMucBaf8sRl4A5FVBrqDMfNaV8PlG8lzNxhc,25741
|
|
17
|
-
egglog/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1
|
+
egglog-10.0.2.dist-info/METADATA,sha256=nrigKD2eQUrzq8tSqrq5jJ2sgwo0NafPEJonhqBrQg4,4009
|
|
2
|
+
egglog-10.0.2.dist-info/WHEEL,sha256=T9di0PMmgWlFwXPjZHqGr_DRLhstyG3P0gQtvMbyU3o,131
|
|
3
|
+
egglog-10.0.2.dist-info/licenses/LICENSE,sha256=w7VlVv5O_FPZRo8Z-4Zb_q7D5ac3YDs8JUkMZ4Gq9CE,1070
|
|
4
|
+
egglog/__init__.py,sha256=5n2nas3VbxxgsvYeT8CutVNHbC2jggXQtDQ3RzX3vCM,315
|
|
5
|
+
egglog/bindings.cpython-313-aarch64-linux-gnu.so,sha256=ATXZK9PFtzkX9L6f7_1-fUH1UhL2BZEIXp1vPORiRNI,5848216
|
|
18
6
|
egglog/bindings.pyi,sha256=b0osaWlb6Yqh7Cw7I_DnRjU-6NTeXq1XOolvOvYMMcI,13830
|
|
7
|
+
egglog/builtins.py,sha256=eCzpE6zle-L6WTiP5Yv6B3FO82AYGwJariUCYfpzwBA,29606
|
|
19
8
|
egglog/config.py,sha256=yM3FIcVCKnhWZmHD0pxkzx7ah7t5PxZx3WUqKtA9tjU,168
|
|
20
|
-
egglog/declarations.py,sha256=UzpOjoZz21T9QfodmS3U00vx5VcTcryXmAw11CALix8,22193
|
|
21
|
-
egglog/__init__.py,sha256=5n2nas3VbxxgsvYeT8CutVNHbC2jggXQtDQ3RzX3vCM,315
|
|
22
|
-
egglog/thunk.py,sha256=BwdqvNhY8g3KdSE5DtT1yIoxCF3mNGcqoODy8nXm9z8,2168
|
|
23
|
-
egglog/pretty.py,sha256=5hcc5-tAGnhcpz_aClJ1PgE3StOvFqQRYXYFDWXbNP0,20476
|
|
24
9
|
egglog/conversion.py,sha256=lE9a3myOWyxlYbCVqOMKnqXw2_Ul24DJuJlVZ50HCA0,9989
|
|
25
|
-
egglog/
|
|
26
|
-
egglog/
|
|
27
|
-
egglog/
|
|
28
|
-
egglog/visualizer.css,sha256=eL0POoThQRc0P4OYnDT-d808ln9O5Qy6DizH9Z5LgWc,259398
|
|
29
|
-
egglog/visualizer.js,sha256=2qZZ-9W_INJx4gZMYjnVXl27IjT_JNuQyEeI2dbjWoU,3753315
|
|
30
|
-
egglog/examples/schedule_demo.py,sha256=JbXdPII7_adxtgyKVAiqCyV2sj88VZ-DhomYrdn8vuc,618
|
|
10
|
+
egglog/declarations.py,sha256=CNzW-CXWo4W5YRnFbaApwEBc7rOBqmz5hYeWWV0KvfQ,22197
|
|
11
|
+
egglog/egraph.py,sha256=la8u-rOFYMsN75qCUA4BEgQq62idcQUOHK-1mDgqTbY,62646
|
|
12
|
+
egglog/egraph_state.py,sha256=KxP4aXfh21vVqx1HbQMtb2PRxJg4Gzp1Po6Jp5Zppk0,28086
|
|
31
13
|
egglog/examples/README.rst,sha256=ztTvpofR0eotSqGoCy_C1fPLDPCncjvcqDanXtLHNNU,232
|
|
14
|
+
egglog/examples/__init__.py,sha256=wm9evUbMPfbtylXIjbDdRTAVMLH4OjT4Z77PCBFyaPU,31
|
|
15
|
+
egglog/examples/bignum.py,sha256=LziQqBdOaYNhO3VQS6ZokHDO7_QSsOMV4Whyrj6-6nA,536
|
|
16
|
+
egglog/examples/bool.py,sha256=e0z2YoYJsLlhpSADZK1yRYHzilyxSZWGiYAaM0DQ_Gw,695
|
|
17
|
+
egglog/examples/eqsat_basic.py,sha256=2xtM81gG9Br72mr58N-2BUeksR7C_UXnZJ4MvzSPplc,869
|
|
32
18
|
egglog/examples/fib.py,sha256=BOHxKWA7jGx4FURBmfmuZKfLo6xq9-uXAwAXjYid7LU,492
|
|
33
|
-
egglog/examples/
|
|
19
|
+
egglog/examples/higher_order_functions.py,sha256=DNLIQfPJCX_DOLbHNiaYsfvcFIYCYOsRUqp99r9bpc8,1063
|
|
34
20
|
egglog/examples/lambda_.py,sha256=iQvwaXVhp2VNOMS7j1WwceZaiq3dqqilwUkMcW5GFBE,8194
|
|
35
|
-
egglog/examples/multiset.py,sha256=fdEPvNFkHe_XmzBv90JCP8SCxoKgpg_CIDsR8HWcbnY,1447
|
|
36
|
-
egglog/examples/bignum.py,sha256=LziQqBdOaYNhO3VQS6ZokHDO7_QSsOMV4Whyrj6-6nA,536
|
|
37
21
|
egglog/examples/matrix.py,sha256=7_mPcMcgE-t_GJDyf76-nv3xhPIeN2mvFkc_p_Gnr8g,4961
|
|
38
|
-
egglog/examples/
|
|
39
|
-
egglog/examples/higher_order_functions.py,sha256=DNLIQfPJCX_DOLbHNiaYsfvcFIYCYOsRUqp99r9bpc8,1063
|
|
40
|
-
egglog/examples/bool.py,sha256=e0z2YoYJsLlhpSADZK1yRYHzilyxSZWGiYAaM0DQ_Gw,695
|
|
22
|
+
egglog/examples/multiset.py,sha256=fdEPvNFkHe_XmzBv90JCP8SCxoKgpg_CIDsR8HWcbnY,1447
|
|
41
23
|
egglog/examples/ndarrays.py,sha256=mfr410eletH8gfdg-P8L90vlF6TUifvYV_-ryOwvZZE,4042
|
|
42
|
-
egglog/examples/
|
|
43
|
-
egglog/
|
|
44
|
-
egglog
|
|
24
|
+
egglog/examples/resolution.py,sha256=BJd5JClA3DBVGfiVRa-H0gbbFvIqeP3uYbhCXHblSQc,2119
|
|
25
|
+
egglog/examples/schedule_demo.py,sha256=JbXdPII7_adxtgyKVAiqCyV2sj88VZ-DhomYrdn8vuc,618
|
|
26
|
+
egglog/exp/__init__.py,sha256=nPtzrH1bz1LVZhZCuS0S9Qild8m5gEikjOVqWAFIa88,49
|
|
27
|
+
egglog/exp/array_api.py,sha256=DmyN7nOCXVEQ9nVGdpQhtU7f-NUyvAeUKgKLFB89CR0,63843
|
|
28
|
+
egglog/exp/array_api_jit.py,sha256=90RmyivRoCKzVtiYWnTBkK2q2FDkD2p1iq7vzbh68b4,1546
|
|
29
|
+
egglog/exp/array_api_loopnest.py,sha256=-kbyorlGxvlaNsLx1nmLfEZHQM7VMEBwSKtV0l-bs0g,2444
|
|
30
|
+
egglog/exp/array_api_numba.py,sha256=X3H1TnCjPL92uVm6OvcWMJ11IeorAE58zWiOX6huPv4,2696
|
|
31
|
+
egglog/exp/array_api_program_gen.py,sha256=0FpWZZJ3VqIod9vIYfQYUIiyswfj4h4K_4s6GZb8SJY,21742
|
|
32
|
+
egglog/exp/program_gen.py,sha256=oLhDEFvX9neeSTWiI7pbwEBqRHuj8cXhUCpsyVNZqCw,13013
|
|
33
|
+
egglog/exp/siu_examples.py,sha256=yZ-sgH2Y12iTdwBUumP7D2OtCGL83M6pPW7PMobVFXc,719
|
|
34
|
+
egglog/functionalize.py,sha256=VMqiWcDbn1pYrY3FMxT143Bk90dMaxo2VapUL60-fvE,3847
|
|
35
|
+
egglog/ipython_magic.py,sha256=2hs3g2cSiyDmbCvE2t1OINmu17Bb8MWV--2DpEWwO7I,1189
|
|
36
|
+
egglog/pretty.py,sha256=5hcc5-tAGnhcpz_aClJ1PgE3StOvFqQRYXYFDWXbNP0,20476
|
|
37
|
+
egglog/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
+
egglog/runtime.py,sha256=82y3vtYtG8is_kPl_R2Go1UbS1RdD7NoGxE-I__j4XE,25830
|
|
39
|
+
egglog/thunk.py,sha256=MrAlPoGK36VQrUrq8PWSaJFu42sPL0yupwiH18lNips,2271
|
|
40
|
+
egglog/type_constraint_solver.py,sha256=U2GjLgbebTLv5QY8_TU0As5wMKL5_NxkHLen9rpfMwI,4518
|
|
41
|
+
egglog/version_compat.py,sha256=wK5J4QrAWTqFVB7pm7gnBPxR9snb-_jTw7ap3UZvQ5E,3508
|
|
42
|
+
egglog/visualizer.css,sha256=eL0POoThQRc0P4OYnDT-d808ln9O5Qy6DizH9Z5LgWc,259398
|
|
43
|
+
egglog/visualizer.js,sha256=2qZZ-9W_INJx4gZMYjnVXl27IjT_JNuQyEeI2dbjWoU,3753315
|
|
44
|
+
egglog/visualizer_widget.py,sha256=LtVfzOtv2WeKtNuILQQ_9SOHWvRr8YdBYQDKQSgry_s,1319
|
|
45
|
+
egglog-10.0.2.dist-info/RECORD,,
|
|
File without changes
|