preserves/python/0.992.1/search/search_index.json

1 line
108 KiB
JSON
Raw Normal View History

2023-11-10 16:38:10 +00:00
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Overview","text":"<pre><code>pip install preserves\n</code></pre> <p>This package (<code>preserves</code> on pypi.org) implements Preserves for Python 3.x. It provides the core semantics as well as both the human-readable text syntax (a superset of JSON) and machine-oriented binary format (including canonicalization) for Preserves. It also implements Preserves Schema and Preserves Path.</p> <ul> <li>Main package API: preserves</li> </ul>"},{"location":"#what-is-preserves","title":"What is Preserves?","text":"<p>Preserves is a data model, with associated serialization formats.</p> <p>It supports records with user-defined labels, embedded references, and the usual suite of atomic and compound data types, including binary data as a distinct type from text strings. Its annotations allow separation of data from metadata such as comments, trace information, and provenance information.</p> <p>Preserves departs from many other data languages in defining how to compare two values. Comparison is based on the data model, not on syntax or on data structures of any particular implementation language.</p>"},{"location":"#mapping-between-preserves-values-and-python-values","title":"Mapping between Preserves values and Python values","text":"<p>Preserves <code>Value</code>s are categorized in the following way:</p> <pre><code> Value = Atom\n | Compound\n | Embedded\n\n Atom = Boolean\n | Float\n | Double\n | SignedInteger\n | String\n | ByteString\n | Symbol\n\n Compound = Record\n | Sequence\n | Set\n | Dictionary\n</code></pre> <p>Python's strings, byte strings, integers, booleans, and double-precision floats stand directly for their Preserves counterparts. Wrapper objects for Float and Symbol complete the suite of atomic types.</p> <p>Python's lists and tuples correspond to Preserves <code>Sequence</code>s, and dicts and sets to <code>Dictionary</code> and <code>Set</code> values, respectively. Preserves <code>Record</code>s are represented by Record objects. Finally, embedded values are represented by Embedded objects.</p>"},{"location":"api/","title":"The top-level preserves package","text":"<pre><code>import preserves\n</code></pre> <p>The main package re-exports a subset of the exports of its constituent modules:</p> <ul> <li> <p>From preserves.values:</p> <ul> <li>Annotated</li> <li>Embedded</li> <li>Float</li> <li>ImmutableDict</li> <li>Record</li> <li>Symbol</li> <li>annotate</li> <li>is_annotated</li> <li>preserve</li> <li>strip_annotations</li> </ul> </li> <li> <p>From preserves.error:</p> <ul> <li>DecodeError</li> <li>EncodeError</li> <li>ShortPacket</li> </ul> </li> <li> <p>From preserves.binary:</p> <ul> <li>Decoder</li> <li>Encoder</li> <li>canonicalize</li> <li>decode</li> <li>decode_with_annotations</li> <li>encode</li> </ul> </li> <li> <p>From preserves.text:</p> <ul> <li>Formatter</li> <li>Parser</li> <li>parse</li> <li>parse_with_annotations</li> <li>stringify</li> </ul> </li> <li> <p>From preserves.compare:</p> <ul> <li>cmp</li> </ul> </li> <li> <p>From preserves.merge:</p> <ul> <li>merge</li> </ul> </li> </ul> <p>It also exports the compare and fold modules themselves, permitting patterns like</p> <pre><code>&gt;&gt;&gt; from preserves import *\n&gt;&gt;&gt; compare.cmp(123, 234)\n-1\n</code></pre> <p>Finally, it provides a few utility aliases for common tasks:</p>"},{"location":"api/#preserves.dumps","title":"<code>dumps = stringify</code> <code>module-attribute</code>","text":"<p>This alias for <code>stringify</code> provides a familiar pythonesque name for converting a Preserves <code>Value</code> to a string.</p>"},{"location":"api/#preserves.load