You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 3, 2023. It is now read-only.
It's a query language, similar to datomic "selector/pull-pattern"
The quey that I need to run is something like [{(:a {:b 42}) [:c]}]
But when I try, i get errors like
Traceback (most recent call last):
File "...", line 243, in <module>
cmap_issue()
File "....", line 226, in cmap_issue
t.frozendict([[in_key, in_value]]), ## This will throw because in_key isn't hashable
File ".../site-packages/transit/transit_types.py", line 167, in __init__
self._dict = dict(*args, **kwargs)
File ".../site-packages/transit/transit_types.py", line 124, in __hash__
return reduce(lambda a, b: hash(a) ^ hash(b), self.rep, 0)
NameError: name 'reduce' is not defined
Here the code that I use
frompprintimportpprintimportiofromtransit.writerimportWriterfromtransit.readerimportReaderimporttransit.transit_typesastdefcmap_issue():
## value: [{(:a {:b 42}) [:c]}]in_key=t.List([t.Keyword("a"), t.frozendict({t.Keyword("b"): 42})])
## in_key = t.Keyword("a") ## << this one works!in_value=t.Vector([t.Keyword("c")])
input=t.Vector([
t.frozendict([[in_key, in_value]]), ## This will throw because in_input isn't hashablet.TaggedValue("cmap", [in_key, in_value]) ## This way works with both inputs, but uses internal "cmap" concept
])
baos=io.StringIO()
writer=Writer(baos, "json")
writer.write(input)
transit=baos.getvalue()
bais=io.StringIO(transit)
reader=Reader("json")
output=reader.read(bais)
pprint([
"input", input,
"transit", transit.encode("ascii"),
"output", output,
])
You can remove the second in_key comment to make the code work
Activity