dreid / edn Goto Github PK
View Code? Open in Web Editor NEWAn edn library for python.
License: Other
An edn library for python.
License: Other
recording for posterity.
...............E.........................................................................................
======================================================================
ERROR: test_tag (edn.tests.test_ast.EDNTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/callen/code/edn/edn/tests/test_ast.py", line 179, in test_tag
('#foo {}', TaggedValue(Symbol('foo'), frozendict({})))
File "/Users/callen/.virtualenv/sweden/lib/python2.7/site-packages/Parsley-1.2-py2.7.egg/terml/nodes.py", line 144, in mkterm
tuple([coerceToTerm(a) for a in args]),
File "/Users/callen/.virtualenv/sweden/lib/python2.7/site-packages/Parsley-1.2-py2.7.egg/terml/nodes.py", line 138, in coerceToTerm
raise ValueError("Could not coerce %r to Term" % (val,))
ValueError: Could not coerce frozendict({}) to Term
----------------------------------------------------------------------
Ran 105 tests in 0.181s
FAILED (errors=1)
If I get a workable fix together, I'll PR it with my test(s).
Currently there's no support for loading edn data that contains multiple elements.
Relatedly, there's no support for taking a stream as input and parsing it incrementally.
At the moment, there's no Character
type, which means that characters parsed by edn cannot be reliably unparsed as characters, as there's no way to distinguish a single-element string from a character in Python.
I don't know if this is such a bad thing.
I think it would be fair if I were listed as a joint copyright holder.
No accompanying patch, because I don't want to publish a version which has incorrect LICENSE information.
Not 100% sure this is a good idea, but here we go.
The natural way to use maps in Clojure is to use keywords for the keys. In Python, the natural way is to use strings for keys. When writing Python code that works with Clojure code via edn, it becomes tedious to make dicts with Keywords as keys.
So, perhaps it's worth adding a convenience class which is a dict where all of the keys are keywords, but can be accessed & updated using string syntax, but are stored internally as keywords.
These examples are meant to be illustrative, not prescriptive.
>>> x = keyworddict()
>>> x.with_pair('foo', 'bar')
>>> repr(x)
{Keyword(Symbol('foo')): 'bar'}
>>> x['foo']
'bar'
>>> dumps(x)
{:foo "bar"}
>>> x.with_pair(42, 'qux')
Traceback (most recent call last):
...
ValueError: Invalid keyword: 42
And also,
>>> x = keyworddict(prefix="myproject")
>>> x.with_pair('foo', 'bar')
>>> repr(x)
{Keyword(Symbol('foo', 'myproject')): 'bar'}
>>> x['foo']
'bar'
>>> dumps(x)
{:myproject/foo "bar"}
We currently have a very basic formatter / printer / unparser (we really must settle on a term), but no pretty printer. Everyone loves a pretty printer. We should have one.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.