Skip to content

Commit dfb5785

Browse files
Merge pull request #36 from metadsl/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2 parents 3df7157 + 9e5dabb commit dfb5785

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/pycqa/flake8
16-
rev: 6.0.0
16+
rev: 6.1.0
1717
hooks:
1818
- id: flake8
1919
- repo: local

python/egglog/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _resolve_literal(tp: TypeOrVarRef, arg: object) -> RuntimeExpr:
9494
else:
9595
arg_type = type(arg)
9696
# If this value has a custom metaclass, let's use that as our index instead of the type
97-
if type(arg_type) != type:
97+
if type(arg_type) != type: # noqa: E721
9898
arg_type = type(arg_type)
9999

100100
# If we have any type variables, dont bother trying to resolve the literal, just return the arg

python/tests/test_convert.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from egglog import *
2+
3+
4+
def test_conversion_custom_metaclass():
5+
class MyMeta(type):
6+
pass
7+
8+
class MyType(metaclass=MyMeta):
9+
pass
10+
11+
egraph = EGraph()
12+
13+
@egraph.class_
14+
class MyTypeExpr(Expr):
15+
def __init__(self):
16+
...
17+
18+
converter(MyMeta, MyTypeExpr, lambda x: MyTypeExpr())
19+
assert expr_parts(convert(MyType(), MyTypeExpr)) == expr_parts(MyTypeExpr())
20+
21+
22+
def test_conversion():
23+
egraph = EGraph()
24+
25+
class MyType:
26+
pass
27+
28+
@egraph.class_
29+
class MyTypeExpr(Expr):
30+
def __init__(self):
31+
...
32+
33+
converter(MyType, MyTypeExpr, lambda x: MyTypeExpr())
34+
35+
assert expr_parts(convert(MyType(), MyTypeExpr)) == expr_parts(MyTypeExpr())

0 commit comments

Comments
 (0)