curry.icurry.json module
- class curry.icurry.json.Encoder(compact=True, **kwds)[source]
Bases:
JSONEncoderEncodes ICurry as JSON.
The compact form, the default, has no space after a comma or a colon. Both forms escape every character outside ASCII. The toolchain writes the compact form into the
.json.zcaches.- KEY_MAP = {'IDataType': 'IType', 'IModule': 'IProg', 'filename': None, 'fullname': 'name', 'symbolname': 'name'}
- VALUE_MAP = {'aliases': <function Encoder.<lambda>>, 'functions': <function Encoder.<lambda>>, 'imports': <function Encoder.<lambda>>, 'types': <function Encoder.<lambda>>}
- default(obj)[source]
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o)