moat-lib-codec


Namemoat-lib-codec JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA simple command/stream multiplexer
upload_time2024-11-18 09:02:03
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/df/b0/ff7a678ae2de1b253fb319d1f08f4c60e75343e6eb1c9099870b6f3c582b/moat_lib_codec-0.3.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.3.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": "40dfa4616e3ee5f33e8950c34742f37fa52b3665801b40c34710ded30fab352d",
                "md5": "ae356b4c421148970e3a4845fa589c3f",
                "sha256": "6ddab687bb47fbf50e2545580ae07c430b76a266b3bfd0e2b236a0218efc1769"
            },
            "downloads": -1,
            "filename": "moat_lib_codec-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ae356b4c421148970e3a4845fa589c3f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12073,
            "upload_time": "2024-11-18T09:02:02",
            "upload_time_iso_8601": "2024-11-18T09:02:02.772977Z",
            "url": "https://files.pythonhosted.org/packages/40/df/a4616e3ee5f33e8950c34742f37fa52b3665801b40c34710ded30fab352d/moat_lib_codec-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfb0ff7a678ae2de1b253fb319d1f08f4c60e75343e6eb1c9099870b6f3c582b",
                "md5": "cbf4c1e6b0ff570003c5161db009e626",
                "sha256": "75f814ba95ca84ef00b264891ee5f78e24fe196a7ef4dc785d24a9b88dc4826f"
            },
            "downloads": -1,
            "filename": "moat_lib_codec-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cbf4c1e6b0ff570003c5161db009e626",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13172,
            "upload_time": "2024-11-18T09:02:03",
            "upload_time_iso_8601": "2024-11-18T09:02:03.847073Z",
            "url": "https://files.pythonhosted.org/packages/df/b0/ff7a678ae2de1b253fb319d1f08f4c60e75343e6eb1c9099870b6f3c582b/moat_lib_codec-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 09:02:03",
    "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.40651s