moat-lib-codec


Namemoat-lib-codec JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
SummaryA simple command/stream multiplexer
upload_time2024-11-24 13:45:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords moat
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ======================
The MoaT-Codec library
======================

This library packages various codecs used for MoaT protocols
in a way that's reason- and stream-able.

Interface
+++++++++

Codec
-----

* encode(obj)

  Encode the object to a bytestream.

* decode(bytes)

  Decode the given bytes to a single object.

* feed(bytes, final=False)

  Data stream. Returns an array of objects.

  This method only exists when a sequence of encoded objects can be streamed,
  i.e. contains built-in message boundaries.

  if @final is ``True``, raise an exception if there is an incomplete
  object in the buffer after this call.

* getstate(), setstate(\*args)

  A streaming decoder may store partially-decoded state (unprocessed
  buffer) here.

The list of accepted objects is implementation dependent.

Extension
---------

Extension types vary by whether they carry binary data as in (msgpack), or
objects (as in cbor).

* binary (classvar): True if msgpack-style, False if cbor-style

* encoder(cls, key, fn)

  Encode an object ``obj`` of type ``type``. ``fn(codec, obj)`` must return
  a bytestring / an encodeable object. If the registration key is ``None``
  the function must return a tuple with the key as first element.

* decoder(key, fn)

  Add a decoder (key, data) to an object. ``fn(codec, data)`` is called with a
  bytestring / a decoded object, and returns whatever has been encoded.

Extensions get the codec as their first argument. They can use it to store
data, e.g. references. The extension object is available as ``codec.ext``.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "moat-lib-codec",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Matthias Urlichs <matthias@urlichs.de>",
    "keywords": "MoaT",
    "author": null,
    "author_email": "Matthias Urlichs <matthias@urlichs.de>",
    "download_url": "https://files.pythonhosted.org/packages/a1/02/6bdd9001277fd7eca3e707170d02f4964f901a4dab0f9f3eac5c31770199/moat_lib_codec-0.4.0.tar.gz",
    "platform": null,
    "description": "======================\nThe MoaT-Codec library\n======================\n\nThis library packages various codecs used for MoaT protocols\nin a way that's reason- and stream-able.\n\nInterface\n+++++++++\n\nCodec\n-----\n\n* encode(obj)\n\n  Encode the object to a bytestream.\n\n* decode(bytes)\n\n  Decode the given bytes to a single object.\n\n* feed(bytes, final=False)\n\n  Data stream. Returns an array of objects.\n\n  This method only exists when a sequence of encoded objects can be streamed,\n  i.e. contains built-in message boundaries.\n\n  if @final is ``True``, raise an exception if there is an incomplete\n  object in the buffer after this call.\n\n* getstate(), setstate(\\*args)\n\n  A streaming decoder may store partially-decoded state (unprocessed\n  buffer) here.\n\nThe list of accepted objects is implementation dependent.\n\nExtension\n---------\n\nExtension types vary by whether they carry binary data as in (msgpack), or\nobjects (as in cbor).\n\n* binary (classvar): True if msgpack-style, False if cbor-style\n\n* encoder(cls, key, fn)\n\n  Encode an object ``obj`` of type ``type``. ``fn(codec, obj)`` must return\n  a bytestring / an encodeable object. If the registration key is ``None``\n  the function must return a tuple with the key as first element.\n\n* decoder(key, fn)\n\n  Add a decoder (key, data) to an object. ``fn(codec, data)`` is called with a\n  bytestring / a decoded object, and returns whatever has been encoded.\n\nExtensions get the codec as their first argument. They can use it to store\ndata, e.g. references. The extension object is available as ``codec.ext``.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple command/stream multiplexer",
    "version": "0.4.0",
    "project_urls": {
        "homepage": "https://m-o-a-t.org",
        "repository": "https://github.com/M-o-a-T/moat-lib-codec"
    },
    "split_keywords": [
        "moat"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f04134a1b191edcc0fa16ac5d74c4ce42261c9e5547f6bb2b0a0066fe075245",
                "md5": "c757a8e7f4a462f904d94b1cf7d880dd",
                "sha256": "34dbd98dc6b27edc094375f84ce02f84c1f8cd5d7ab7ffbd393df12f0a785512"
            },
            "downloads": -1,
            "filename": "moat_lib_codec-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c757a8e7f4a462f904d94b1cf7d880dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12082,
            "upload_time": "2024-11-24T13:45:22",
            "upload_time_iso_8601": "2024-11-24T13:45:22.880434Z",
            "url": "https://files.pythonhosted.org/packages/0f/04/134a1b191edcc0fa16ac5d74c4ce42261c9e5547f6bb2b0a0066fe075245/moat_lib_codec-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a1026bdd9001277fd7eca3e707170d02f4964f901a4dab0f9f3eac5c31770199",
                "md5": "9e908f5f72662c9f2d7baa0a06eccd89",
                "sha256": "6d2c39d69eb7590663dfcec6d65e2f7175a18f3b6811505531b0a2ba51636927"
            },
            "downloads": -1,
            "filename": "moat_lib_codec-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9e908f5f72662c9f2d7baa0a06eccd89",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13187,
            "upload_time": "2024-11-24T13:45:25",
            "upload_time_iso_8601": "2024-11-24T13:45:25.292289Z",
            "url": "https://files.pythonhosted.org/packages/a1/02/6bdd9001277fd7eca3e707170d02f4964f901a4dab0f9f3eac5c31770199/moat_lib_codec-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-24 13:45:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "M-o-a-T",
    "github_project": "moat-lib-codec",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "moat-lib-codec"
}
        
Elapsed time: 0.88378s