{ "info": { "author": "Cameron Simpson", "author_email": "cs@cskk.id.au", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Stuff to do with counters, sequences and iterables.\n\nNote that any function accepting an iterable\nwill consume some or all of the derived iterator\nin the course of its function.\n\n## Function `first(iterable)`\n\nReturn the first item from an iterable; raise IndexError on empty iterables.\n\n## Function `get0(iterable, default=None)`\n\nReturn first element of an iterable, or the default.\n\n## Function `imerge(*iters, **kw)`\n\nMerge an iterable of ordered iterables in order.\n\nParameters:\n* `iters`: an iterable of iterators\n* `reverse`: keyword parameter: if true, yield items in reverse order.\n This requires the iterables themselves to also be in\n reversed order.\n\nThis function relies on the source iterables being ordered\nand their elements being comparable, through slightly misordered\niterables (for example, as extracted from web server logs)\nwill produce only slightly misordered results, as the merging\nis done on the basis of the front elements of each iterable.\n\n## Function `isordered(s, reverse=False, strict=False)`\n\nTest whether an iterable is ordered.\nNote that the iterable is iterated, so this is a destructive\ntest for nonsequences.\n\n## Function `last(iterable)`\n\nReturn the last item from an iterable; raise IndexError on empty iterables.\n\n## Function `onetomany(func)`\n\nA decorator for a method of a sequence to merge the results of\npassing every element of the sequence to the function, expecting\nmultiple values back.\n\nExample:\n\n class X(list):\n @onetomany\n def chars(self, item):\n return item\n strs = X(['Abc', 'Def'])\n all_chars = X.chars()\n\n## Function `onetoone(func)`\n\nA decorator for a method of a sequence to merge the results of\npassing every element of the sequence to the function, expecting a\nsingle value back.\n\nExample:\n\n class X(list):\n @onetoone\n def lower(self, item):\n return item.lower()\n strs = X(['Abc', 'Def'])\n lower_strs = X.lower()\n\n## Class `Seq`\n\nA thread safe wrapper for itertools.count().\n\n## Function `seq()`\n\nReturn a new sequential value.\n\n## Class `StatefulIterator`\n\nA trivial iterator which wraps another iterator to expose some tracking state.\n\nThis has 2 attributes:\n* `.it`: the internal iterator which should yield `(item,new_state)`\n* `.state`: the last state value from the internal iterator\n\nThe originating use case is resuse of an iterator by independent\ncalls that are typically sequential, specificly the .read\nmethod of file like objects. Naive sequential reads require\nthe underlying storage to locate the data on every call, even\nthough the previous call has just performed this task for the\nprevious read. Saving the iterator used from the preceeding\ncall allows the iterator to pick up directly if the file\noffset hasn't been fiddled in the meantime.\n\n## Function `tee(iterable, *Qs)`\n\nA generator yielding the items from an iterable\nwhich also copies those items to a series of queues.\n\nParameters:\n* `iterable`: the iterable to copy\n* `Qs`: the queues, objects accepting a `.put` method.\n\nNote: the item is `.put` onto every queue\nbefore being yielded from this generator.\n\n## Function `the(iterable, context=None)`\n\nReturns the first element of an iterable, but requires there to be\nexactly one.\n\n## Class `TrackingCounter`\n\nA wrapper for a counter which can be incremented and decremented.\n\nA facility is provided to wait for the counter to reach a specific value.\nThe .inc and .dec methods also accept a `tag` argument to keep\nindividual counts based on the tag to aid debugging.\n\nTODO: add `strict` option to error and abort if any counter tries\nto go below zero.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/cameron_simpson/css/commits/all", "keywords": "python2,python3", "license": "", "maintainer": "", "maintainer_email": "", "name": "cs.seq", "package_url": "https://pypi.org/project/cs.seq/", "platform": "", "project_url": "https://pypi.org/project/cs.seq/", "project_urls": { "Homepage": "https://bitbucket.org/cameron_simpson/css/commits/all" }, "release_url": "https://pypi.org/project/cs.seq/20190103/", "requires_dist": null, "requires_python": "", "summary": "Stuff to do with counters, sequences and iterables.", "version": "20190103" }, "last_serial": 4654376, "releases": { "20150118": [ { "comment_text": "", "digests": { "md5": "61f07274c4c220bde38aa47f78e87298", "sha256": "5d093ae65db89090b37fd27183b97e7480cd0bd088dc05351965b24504ad20ee" }, "downloads": -1, "filename": "cs.seq-20150118.tar.gz", "has_sig": false, "md5_digest": "61f07274c4c220bde38aa47f78e87298", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3806, "upload_time": "2015-01-18T06:08:16", "url": "https://files.pythonhosted.org/packages/2c/f0/d7d81b77f5954771d601ba45080c75970afa46f30405146eead7f0535c69/cs.seq-20150118.tar.gz" } ], "20160827": [ { "comment_text": "", "digests": { "md5": "194c74097faed9acd0a71c9c50d461cc", "sha256": "75a18f574b0fc58023525850bed6802e620c8a470303fc8c7aad7e4ab88df96e" }, "downloads": -1, "filename": "cs.seq-20160827.tar.gz", "has_sig": false, "md5_digest": "194c74097faed9acd0a71c9c50d461cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3838, "upload_time": "2016-08-27T03:29:39", "url": "https://files.pythonhosted.org/packages/29/e3/0400b807b7e8aeae58381548bc9a4f7d68b6c69a0a5b019b6ba0fadd8b07/cs.seq-20160827.tar.gz" } ], "20160828": [ { "comment_text": "", "digests": { "md5": "99adb651ffcfb2eb6f70e515966a69c4", "sha256": "044422cc9338d6407915c40d835199e34cfd28bff4c62a2881464ad38001e093" }, "downloads": -1, "filename": "cs.seq-20160828.tar.gz", "has_sig": false, "md5_digest": "99adb651ffcfb2eb6f70e515966a69c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4191, "upload_time": "2016-08-28T06:11:09", "url": "https://files.pythonhosted.org/packages/ca/55/6e15eda875564b28d092f28fc94b24bc1ff370393eea42c7fe58b9d5f381/cs.seq-20160828.tar.gz" } ], "20160918": [ { "comment_text": "", "digests": { "md5": "ac9d60b9a695f2f507a46a4e5d2781ae", "sha256": "6fe0a051eb018c026aec254cfb3942c4af04aad70af1552b053df779f50e8161" }, "downloads": -1, "filename": "cs.seq-20160918.tar.gz", "has_sig": false, "md5_digest": "ac9d60b9a695f2f507a46a4e5d2781ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4189, "upload_time": "2016-09-18T05:04:47", "url": "https://files.pythonhosted.org/packages/35/14/40fb65214d58cfdde553b8fe010042204c928f48c0f8f79f707a1151e0e5/cs.seq-20160918.tar.gz" } ], "20171231": [ { "comment_text": "", "digests": { "md5": "20adae3b369ccdd4c445e2ccabaa9323", "sha256": "522c0970264b4cb44dba9e64456760634e481d6891deb9593d6536d56b926d27" }, "downloads": -1, "filename": "cs.seq-20171231.tar.gz", "has_sig": false, "md5_digest": "20adae3b369ccdd4c445e2ccabaa9323", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4118, "upload_time": "2017-12-30T23:32:53", "url": "https://files.pythonhosted.org/packages/5f/6b/414602255f04bbe68c197152f7755a74e6b8798707dff1fba514f443d61d/cs.seq-20171231.tar.gz" } ], "20190101": [ { "comment_text": "", "digests": { "md5": "4eb28fd6de7777f84d19e2c61c2d22b6", "sha256": "21ebe01d38bf9ac9089ddb6ad0702fa062b18f7ea5768895e3236a4183162c85" }, "downloads": -1, "filename": "cs.seq-20190101.tar.gz", "has_sig": false, "md5_digest": "4eb28fd6de7777f84d19e2c61c2d22b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5207, "upload_time": "2019-01-01T00:37:18", "url": "https://files.pythonhosted.org/packages/5f/26/0ccd0daf14880a5ced724442f395cd74ed8cbfaf125414ef64d24fe2ca94/cs.seq-20190101.tar.gz" } ], "20190103": [ { "comment_text": "", "digests": { "md5": "40c2605d88e13bc0631c7c0e70378ba9", "sha256": "5c4ac7926cf985cd1d28d41daa595031b635f3006aa5e7ca1848445824c96b4a" }, "downloads": -1, "filename": "cs.seq-20190103.tar.gz", "has_sig": false, "md5_digest": "40c2605d88e13bc0631c7c0e70378ba9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5328, "upload_time": "2019-01-02T22:30:26", "url": "https://files.pythonhosted.org/packages/ae/a8/42535b2f9276987ba42ca5dd68471a9fc600c4162bab9e91703abcc32c44/cs.seq-20190103.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "40c2605d88e13bc0631c7c0e70378ba9", "sha256": "5c4ac7926cf985cd1d28d41daa595031b635f3006aa5e7ca1848445824c96b4a" }, "downloads": -1, "filename": "cs.seq-20190103.tar.gz", "has_sig": false, "md5_digest": "40c2605d88e13bc0631c7c0e70378ba9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5328, "upload_time": "2019-01-02T22:30:26", "url": "https://files.pythonhosted.org/packages/ae/a8/42535b2f9276987ba42ca5dd68471a9fc600c4162bab9e91703abcc32c44/cs.seq-20190103.tar.gz" } ] }