{ "info": { "author": "Andreas Gschossmann", "author_email": "ghandi_84@hotmail.com", "bugtrack_url": null, "classifiers": [], "description": "========\nbringbuf\n========\n\n*bringbuf* is very basic circular buffer implementation. Its purpose is to handle byte streams (for instance from a serial port). It is based on enque, which is a efficient way to handle queues in Python. First bytes written to the buffer, are first bytes read from the buffer. If the buffer is full it overflows and overwrites the oldest data.\n\nThe code is available at `github`_.\n\n.. _github: https://github.com/ticktronaut/bringbuf\n\nInstall\n-------\n\nRequirements\n````````````\n\nThere are no requirements. *bringbuf* has view dependencies (*collections*, *itertools* and *warnings*), which are core modules.\n\nSetup\n`````\n\nInstall *bringbuf* using the following command:\n\n::\n\n $ [sudo] pip install bringbuf \n\nUsage\n-----\n\n.. code-block:: python\n\n #!/usr/bin/env python\n #coding=utf-8\n\n # The following example shows the basic usage of bRingBuf class\n\n from bringbuf.bringbuf import bRingBuf\n\n # define a ring buffer with the size of 5 bytes\n buf = bRingBuf(5)\n\n # the buffers length initially is zero\n print(buf.len)\n\n # check if buffer is empty (True)\n print(buf.is_empty())\n\n # enqueue 6 bytes to the buffer\n # (note that the buffer will overflow)\n buf.enqueue([0x01, 0x02, 0x03, 0x04, 0x05, 0x06])\n\n # now five bytes are in the buffer (maximal number of bytes)\n print(buf.len)\n\n # check if buffer is empty (False) \n print(buf.is_empty())\n\n # read content of the whole buffer without removing any bytes\n print(buf.read(buf.len))\n\n # read and remove three bytes from the buffer \n print(buf.dequeue(3))\n\n # read content of the whole buffer without removing any bytes\n print(buf.read(buf.len))\n\n # enque four new bytes\n buf.enqueue([0x07, 0x08, 0x09])\n\n # read content of the whole buffer without removing any bytes\n print(buf.read(buf.len))\n\n # check whether buffer contains a pattern?\n # this might be solved by buf.index, which also returns the index,\n # but this is a more descriptive way to check\n print(buf.contains([0x02, 0x08]), buf.contains([0x07, 0x08, 0x09]))\n\n # index of patterns\n print(buf.index([0x02, 0x08]), buf.index([0x07, 0x08, 0x09]))\n\n # contains pattern (with offset)?\n print(buf.contains([0x02, 0x08], 2), buf.contains([0x07, 0x08, 0x09], offset=2))\n\n # index of patterns (with offset)\n print(buf.index([0x02, 0x08], 2), buf.index([0x07, 0x08, 0x09], 2))\n\n # read with offset\n print(buf.read(3, 3))\n\n # enqueue a single byte\n buf.enqueue_byte(0xff)\n\n print(buf.read(buf.len))\n\n # dequeue a single byte\n print(buf.dequeue_byte())\n\nLicense\n-------\n\nCopyright (c) 2016 Andreas Gschossmann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ticktronaut/bringbuf", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "bringbuf", "package_url": "https://pypi.org/project/bringbuf/", "platform": "", "project_url": "https://pypi.org/project/bringbuf/", "project_urls": { "Homepage": "http://github.com/ticktronaut/bringbuf" }, "release_url": "https://pypi.org/project/bringbuf/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "A simple circular buffer to handle byte streams (for instance from a serial port), heavily based on enque.", "version": "0.1.2" }, "last_serial": 3692317, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "45fa1f5a6b5cc387b60d8e585e04e5a7", "sha256": "cd60313e6c2e77792abd865139db87be7b6ec7e8d27a465083e4ad376d2f9b92" }, "downloads": -1, "filename": "bringbuf-0.1.0.tar.gz", "has_sig": false, "md5_digest": "45fa1f5a6b5cc387b60d8e585e04e5a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4377, "upload_time": "2018-03-21T14:28:32", "url": "https://files.pythonhosted.org/packages/51/4b/39d9f949cc36d7b394e59b713d4e899686aa092c3484fe4f8b241ffec53d/bringbuf-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a2c939370a6a5aa5f90c0698f3dcccd7", "sha256": "e6070b11d4c5ff8cf8a64149693c54659251562625b9b1553a5ae5cf82d26b57" }, "downloads": -1, "filename": "bringbuf-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "a2c939370a6a5aa5f90c0698f3dcccd7", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6931, "upload_time": "2018-03-21T16:06:50", "url": "https://files.pythonhosted.org/packages/f3/40/99616a93fbc3481576d68379e0651b0739d62555e54b8a618435bb1790a9/bringbuf-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fded299f45c58aefc30111616b9a5713", "sha256": "1c082fa120e026e6002192755c632f240017332e5920c8fcd902f2bfd2e318cf" }, "downloads": -1, "filename": "bringbuf-0.1.1.tar.gz", "has_sig": false, "md5_digest": "fded299f45c58aefc30111616b9a5713", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4374, "upload_time": "2018-03-21T14:33:35", "url": "https://files.pythonhosted.org/packages/e9/2e/cc3cca65372cbb8b9c73b46815a01610cca4ec398a07723769a2c84cae06/bringbuf-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "fcbe905ca2a2372fc18f0c2ce875bbc1", "sha256": "070491565fbd4e4347b29cadb54dda057081a95c20f90e4f492f327a2a9db9d8" }, "downloads": -1, "filename": "bringbuf-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "fcbe905ca2a2372fc18f0c2ce875bbc1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6936, "upload_time": "2018-03-21T16:24:53", "url": "https://files.pythonhosted.org/packages/ad/1f/ee127a8551e9fe94d2b25d421c686c9a98c6d450e491840a02fd0ed70f8a/bringbuf-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9cd1979150b0e780fed2111faa674e6", "sha256": "134fb386f02ad39d8b850b836b2b4fe833e00faaec916d4b07cab8f4743f0ee6" }, "downloads": -1, "filename": "bringbuf-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b9cd1979150b0e780fed2111faa674e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4381, "upload_time": "2018-03-21T16:24:54", "url": "https://files.pythonhosted.org/packages/d8/ac/6fce3c3a3afdac13c5fa819b11c6476658f7f831190820860773667f6365/bringbuf-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fcbe905ca2a2372fc18f0c2ce875bbc1", "sha256": "070491565fbd4e4347b29cadb54dda057081a95c20f90e4f492f327a2a9db9d8" }, "downloads": -1, "filename": "bringbuf-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "fcbe905ca2a2372fc18f0c2ce875bbc1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6936, "upload_time": "2018-03-21T16:24:53", "url": "https://files.pythonhosted.org/packages/ad/1f/ee127a8551e9fe94d2b25d421c686c9a98c6d450e491840a02fd0ed70f8a/bringbuf-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9cd1979150b0e780fed2111faa674e6", "sha256": "134fb386f02ad39d8b850b836b2b4fe833e00faaec916d4b07cab8f4743f0ee6" }, "downloads": -1, "filename": "bringbuf-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b9cd1979150b0e780fed2111faa674e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4381, "upload_time": "2018-03-21T16:24:54", "url": "https://files.pythonhosted.org/packages/d8/ac/6fce3c3a3afdac13c5fa819b11c6476658f7f831190820860773667f6365/bringbuf-0.1.2.tar.gz" } ] }