{ "info": { "author": "Tudor Aursulesei", "author_email": "thestick613@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Documentation", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Installation/Setup", "Topic :: System :: Software Distribution" ], "description": "=========================\n Probabilistic Counter\n=========================\n\nA simple and efficient probabilistic counter, suited for rate limiting and counting efficiently, without uploading every action to the remote database.\n\nUsage\n=============\n\n\nInstructions\n------------\n\n.. code:: python\n\n from probcount import ProbCounter\n from functools import partial\n\n pc = ProbCounter()\n\n def old_increase_function(counter_name, value):\n # run the real call to the DB increasing the counter\n # for a redis\n # return redis.Redis().incrby(name=counter_name, amount=value)\n # or a MongoDB\n # return (pymongo.MongoClient().database_name.collection_name.find_one_and_update({\"_id\": counter_name},\n {\"$inc\": {\"value\": value}},\n {\"value\": 1}).get(\"value\", 0) + value)\n pass\n\n def old_get_function(counter_name):\n # run the real call to the DB increasing the counter\n # for a redis\n # redis.Redis().get(name=counter_name)\n # or a MongoDB\n # pymongo.MongoClient().database_name.collection_name.find_one({\"_id\": counter_name}, {\"value\": 1}).value\n pass\n\n\n pc.create(\"name_of_counter\", partial(old_increase_function, \"name_of_counter\"), partial(old_get_function, \"name_of_counter\"))\n pc.inc(\"name_of_counter\", 42.0)\n pc.get(\"name_of_counter\")\n\n\nSupported Python Versions\n=========================\n\nPython Project Template supports the following versions out of the box:\n\n* CPython 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, 3.7\n* PyPy 1.9\n\nAuthors\n=======\n\n* Tudor Aursulesei\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/thestick613/probcount", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "probcount", "package_url": "https://pypi.org/project/probcount/", "platform": "", "project_url": "https://pypi.org/project/probcount/", "project_urls": { "Homepage": "http://github.com/thestick613/probcount" }, "release_url": "https://pypi.org/project/probcount/0.1/", "requires_dist": null, "requires_python": "", "summary": "A simple probabilistic counter.", "version": "0.1" }, "last_serial": 3428250, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e9cc96268af84f1ec93bda97bb8a8872", "sha256": "6a2ee525e7cd6868ec3fc3bfa5893192e605bd211db7fb2366165c2dbcd020d9" }, "downloads": -1, "filename": "probcount-0.1.tar.gz", "has_sig": false, "md5_digest": "e9cc96268af84f1ec93bda97bb8a8872", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17304, "upload_time": "2017-12-19T13:15:00", "url": "https://files.pythonhosted.org/packages/1c/ca/d33fbeba0f9b9fdf835e93757a3caf95bd31b82e83a639144801490a78d6/probcount-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e9cc96268af84f1ec93bda97bb8a8872", "sha256": "6a2ee525e7cd6868ec3fc3bfa5893192e605bd211db7fb2366165c2dbcd020d9" }, "downloads": -1, "filename": "probcount-0.1.tar.gz", "has_sig": false, "md5_digest": "e9cc96268af84f1ec93bda97bb8a8872", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17304, "upload_time": "2017-12-19T13:15:00", "url": "https://files.pythonhosted.org/packages/1c/ca/d33fbeba0f9b9fdf835e93757a3caf95bd31b82e83a639144801490a78d6/probcount-0.1.tar.gz" } ] }