{ "info": { "author": "David Czarnecki", "author_email": "me@davidczarnecki.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Communications", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# streak\n\nstreak is a library for calculating win/loss streaks. It uses Redis as its backend for collecting the data. \nThis is a Python port of the original [streak](https://github.com/czarneckid/streak) Ruby gem.\n\n## Installation\n\n## Usage\n\n```python\n>>> from streak import Streak\n>>> streak = Streak()\n>>> streak.aggregate('david', 3)\n>>> streak.aggregate('david', -2)\n>>> streak.aggregate('david', 5)\n>>> streak.aggregate('david', -1)\n>>> statistics = streak.statistics('david')\n>>> print statistics\n{'losses_streak': 2, 'wins_streak': 5, 'wins': 0, 'losses_total': 3, 'losses': 1, 'wins_total': 8, 'total': 11}\n>>> streak.reset_statistics('david')\n>>> statistics = streak.statistics('david')\n>>> print statistics\n{'losses_streak': 0, 'wins_streak': 0, 'wins': 0, 'losses_total': 0, 'losses': 0, 'wins_total': 0, 'total': 0}\n>>> \n```\n\nYou can also configure the keys used in Redis:\n\n```python\n>>> streak = Streak(dict(\n namespace = 'streak',\n positive_key = 'kills',\n positive_total_key = 'kills_total',\n positive_streak_key = 'kills_streak',\n negative_key = 'deaths',\n negative_total_key = 'deaths_total',\n negative_streak_key = 'deaths_streak',\n total_key = 'total'\n))\n```\n\nIf you need to set the Redis instance to something other than `localhost:6379/0`, you can do:\n\n```python\nstreak.redis = redis.StrictRedis(host = 'some.host', port = 6379, db = 7)\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Added some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Copyright\n\nCopyright (c) 2012 David Czarnecki. See LICENSE for further details.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/czarneckid/streak-python", "keywords": "python,redis,win/loss", "license": "LICENSE", "maintainer": null, "maintainer_email": null, "name": "streak", "package_url": "https://pypi.org/project/streak/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/streak/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/czarneckid/streak-python" }, "release_url": "https://pypi.org/project/streak/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Library for calculating win/loss streaks using Redis as a backend", "version": "0.0.1" }, "last_serial": 423001, "releases": { "0.0.1": [] }, "urls": [] }