{ "info": { "author": "Ilya Konovalov", "author_email": "aragaer@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Utilities" ], "description": "# Channels [![Build Status](https://travis-ci.com/aragaer/channels.svg?branch=master)](https://travis-ci.com/aragaer/channels) [![codecov](https://codecov.io/gh/aragaer/channels/branch/master/graph/badge.svg)](https://codecov.io/gh/aragaer/channels) [![BCH compliance](https://bettercodehub.com/edge/badge/aragaer/channels?branch=master)](https://bettercodehub.com/results/aragaer/channels) [![donate using paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=aragaer@gmail.com&lc=RU&item_name=CHANNELS¤cy_code=USD&bn=PP-DonationsBF:btn_donate_SM.gif:NonHosted)\n\nSimple wrapper around file objects and sockets that provides uniform\ninterface to both.\n\nExample:\n\n pipe_chan = PipeChannel(sys.stdin.fileno(), sys.stdout.fileno())\n\tsock_chan = SocketChannel(socket.create_connection(('127.0.0.1', 8080))\n\n## Classes\n\n### Channel\nChannel is the base class for different channels. Every channel\nimplements the following methods:\n\n`read(self)`\n\nPerforms a non-blocking read and returns any bytes available. Raises\n`EndpointClosedException` if the channel is closed.\n\n`write(self, *data)`\n\nWrites chunks of bytes to the channel. Raises `EndpointClosedException`.\n\n`close(self)`\n\nCloses the channel and frees up the resources.\n\n`get_fd(self)`\n\nReturns a file descriptor number that can be used for `poll` or\n`epoll` for reading. Raises `NotImplementedError` if (custom) channel\ndoesn't support reading.\n\nEvery channel has a `buffering` property (read-only). It is equal to\n`'line'` for line-buffered channels. It should be `'bytes'` otherwise\nbut any value other than `'line'` works.\n\nThe following channel classes are implemented:\n\n### PipeChannel\n\n`PipeChannel(faucet=None, sink=None, *, buffering='bytes')`\n\n`faucet` should be a file descriptor open for reading. `sink` should\nbe a file descriptor open for writing. If both are provided, the\nchannel is bi-directional. Sets `faucet` to non-blocking mode.\n\nIf `buffering` is set to `'line'` the channel uses line-buffering for\nreading. Every `read` call will return `b''` if there is no complete\nline available even if there is any data at all. If channel is closed\nbut there is data in buffer, calls to `read` will return lines from\nbuffer until it is exhausted. Last line maybe an incomplete line (no\n`'\\n'` in the end).\n\n### SocketChannel\n\n`SocketChannel(sock, *, buffering='bytes')`\n\nWraps a socket for non-blocking IO. See PipeChannel for more info on\n`buffering` parameter.\n\n### TestChannel\n\n(in package channels.testing)\n\n`TestChannel(*, buffering='bytes')`\n\nSee PipeChannel for more info on `buffering` parameter.\n\nProvides `put` and `get` methods to to feed data to `read` and fetch\n\"written\" data respectively.\n\n### Poller\nPoller is a wrapper for `select.poll` that also supports accepting and\nkeeping track of TCP/Unix clients.\n\n`Poller(*, buffering='bytes')`\n\nCreates a poller object. All accepted client channels inherit the\n`buffering` parameter.\n\n`register(self, channel)`\n\nRegisters the channel for polling.\n\n`add_server(self, sock)`\n\nRegisters a server socket. Poller will accept incoming connections and\nautomatically register clients.\n\n`unregister(self, channel)`\n\nRemoves a registered channel. Silently does nothing if channel is not\nregistered.\n\n`close_all(self)`\n\nCloses all registered channels and servers.\n\n`poll(self, timeout=None)`\n\nPerforms a single call to `select.poll()`. `timeout` is the number of\nseconds for polling or `None` for infinite polling. Return value is a\nlist of pairs in format of `(data, channel)` for channels and `((addr,\nclient_channel), sock)` for server sockets. `addr` depends on socket\ntype. For line-based channels single `poll` call will return one\nresult for every line available.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/aragaer/channels", "keywords": "socket pipe", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "yet-another-io-channels-library", "package_url": "https://pypi.org/project/yet-another-io-channels-library/", "platform": "UNIX", "project_url": "https://pypi.org/project/yet-another-io-channels-library/", "project_urls": { "Homepage": "https://github.com/aragaer/channels" }, "release_url": "https://pypi.org/project/yet-another-io-channels-library/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "Simple IO channels library", "version": "0.2.2" }, "last_serial": 4453615, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "3b3d9f7afa852453f648296fd7474aab", "sha256": "d0f20cc18c83d21619da15fa430d7c16f56439e6819a2eafe0554a5def05466d" }, "downloads": -1, "filename": "yet_another_io_channels_library-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3b3d9f7afa852453f648296fd7474aab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5875, "upload_time": "2018-10-14T16:13:55", "url": "https://files.pythonhosted.org/packages/f4/eb/3b551c68ad399bf9fa12c1c290fb4aa2bc1ba2465905a3addbff9d5d2d5d/yet_another_io_channels_library-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "39fad0f6182370f3a87b09bc1cb5cfbc", "sha256": "caf47cc40389c1281bdc117dfcda68852f10dc738f85cc48a816a913273ae5de" }, "downloads": -1, "filename": "yet-another-io-channels-library-0.1.1.tar.gz", "has_sig": false, "md5_digest": "39fad0f6182370f3a87b09bc1cb5cfbc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4118, "upload_time": "2018-10-14T16:13:56", "url": "https://files.pythonhosted.org/packages/9e/b1/b49abb508c527b2e58b21e4f400507a56be92540434bddb4983d8608e211/yet-another-io-channels-library-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "6515cec0276a2b9336205aeda0656ad0", "sha256": "ab43af998e35f4e837119527aa0f77ee16ab4b2ee78fcbbb6ba5efbdc8c66d28" }, "downloads": -1, "filename": "yet_another_io_channels_library-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "6515cec0276a2b9336205aeda0656ad0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6291, "upload_time": "2018-10-25T21:02:15", "url": "https://files.pythonhosted.org/packages/01/ab/213ce4f80a19ff51745d8e56d1e1f7e6b79dfd8677b3607e0de8a865008b/yet_another_io_channels_library-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7798dc8a4f60555c1dbfc38ad2f8dd7a", "sha256": "ef4e82e7436edea389749769b9bd2681fad75c7d92a328d7caa6deec086b5246" }, "downloads": -1, "filename": "yet-another-io-channels-library-0.2.0.tar.gz", "has_sig": false, "md5_digest": "7798dc8a4f60555c1dbfc38ad2f8dd7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4536, "upload_time": "2018-10-25T21:02:16", "url": "https://files.pythonhosted.org/packages/f5/82/3b07de1664dcbf5684331cd506208a1b5287e1f982b9ffcd2b7be59b3979/yet-another-io-channels-library-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "6ffae7445e35c45ef74e076c253235a2", "sha256": "af47dd952d63e9792f0d4765d9c266d61076c76ba467e36f084f03af8513c16e" }, "downloads": -1, "filename": "yet_another_io_channels_library-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6ffae7445e35c45ef74e076c253235a2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6430, "upload_time": "2018-11-05T13:15:51", "url": "https://files.pythonhosted.org/packages/f7/b7/5f4dddc88062ed6c4c9e45b23119b29a443b77d8dfa1a6b54da8e9e1d493/yet_another_io_channels_library-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ccb07b8e404b6ed87cb618b39af7ddb", "sha256": "45b072ec1786f09307693da4aae9a4a88c42d279453350a9586c56ea37fea756" }, "downloads": -1, "filename": "yet-another-io-channels-library-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1ccb07b8e404b6ed87cb618b39af7ddb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4699, "upload_time": "2018-11-05T13:15:53", "url": "https://files.pythonhosted.org/packages/b2/39/d311218089e5c6fb297906a415784158d6fc25a251d875373ace594fbf8d/yet-another-io-channels-library-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "f1625d78791c6920a6ab55440424b163", "sha256": "478d757b9c657e6378b385ea743ecbf48e903d5ae4d1dfa2390331a41e23f1e1" }, "downloads": -1, "filename": "yet_another_io_channels_library-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f1625d78791c6920a6ab55440424b163", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6489, "upload_time": "2018-11-05T16:39:29", "url": "https://files.pythonhosted.org/packages/67/b9/7abf8ac1e8629eba2055ba9f07de93b18786cc6953f699d1785088b5d806/yet_another_io_channels_library-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a6078f87bc758f1cd90220a3974f869d", "sha256": "00b1c077e13955248afe3f6d7bac86643a18d28d9f1d595a6daf9f993cd0edc1" }, "downloads": -1, "filename": "yet-another-io-channels-library-0.2.2.tar.gz", "has_sig": false, "md5_digest": "a6078f87bc758f1cd90220a3974f869d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4754, "upload_time": "2018-11-05T16:39:30", "url": "https://files.pythonhosted.org/packages/eb/e2/512a537cdb2dbd6fef19d4b87275d4ca14b5c1581abf4880cd6b2094aad4/yet-another-io-channels-library-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1625d78791c6920a6ab55440424b163", "sha256": "478d757b9c657e6378b385ea743ecbf48e903d5ae4d1dfa2390331a41e23f1e1" }, "downloads": -1, "filename": "yet_another_io_channels_library-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f1625d78791c6920a6ab55440424b163", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6489, "upload_time": "2018-11-05T16:39:29", "url": "https://files.pythonhosted.org/packages/67/b9/7abf8ac1e8629eba2055ba9f07de93b18786cc6953f699d1785088b5d806/yet_another_io_channels_library-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a6078f87bc758f1cd90220a3974f869d", "sha256": "00b1c077e13955248afe3f6d7bac86643a18d28d9f1d595a6daf9f993cd0edc1" }, "downloads": -1, "filename": "yet-another-io-channels-library-0.2.2.tar.gz", "has_sig": false, "md5_digest": "a6078f87bc758f1cd90220a3974f869d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4754, "upload_time": "2018-11-05T16:39:30", "url": "https://files.pythonhosted.org/packages/eb/e2/512a537cdb2dbd6fef19d4b87275d4ca14b5c1581abf4880cd6b2094aad4/yet-another-io-channels-library-0.2.2.tar.gz" } ] }