{ "info": { "author": "Christoffer Hjortlund", "author_email": "hjortlund@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "TimedDict\n=========\n\nRequirements\n-------------\n\n* Python -- one of the following:\n\n - CPython_ : >= 3.3\n - PyPy_ : Latest version\n\n.. _CPython: https://www.python.org/\n.. _PyPy: https://pypy.org/\n\nInstallation\n------------\n\nPackage is uploaded on `PyPI `_.\n\nYou can install it with pip::\n\n $ python3 -m pip install TimedDict\n\n\nBackwards compatibility\n-----------------------\n\nBackwards compatibility is only guaranteed between minor versions above the stable version (1.0)\nTherefore it's advised to to pin the module on a version ether the specific version like:\nTimedDict==X.X.X\n\nor get the latest minor version:\nTimedDict~=X.X.X\n\nSee more examples of how to pin version in `PEP-440 `_.\n\n\nDocumentation\n-------------\n\nFor support, please refer to `StackOverflow `_.\n\nExample\n-------\n\nThe following example showcases\n\n.. code:: python\n\n import time\n from TimedDict import timeddict\n\n events_window = timeddict.TimedDict()\n\n now = time.time()\n\n # Assign values like a normal dict like:\n events_window[now] = 'value_1'\n events_window[now + 1] = 'value_2'\n\n # ...or like:\n events_window.update({now + 2: {'values': {'value_3', 'value_4'}}})\n\n print('Raw data:')\n print(events_window)\n\n # NOTE:\n # As the TimedDict has a thread running purging old elements, it's important to ether\n # use the protect() or pause() followed by a resume() when iterating.\n\n # Automatic by the use of context manager, protect() approach\n with events_window.protect():\n print('\\n- protect()')\n for event in events_window:\n print(event)\n\n # Manual setting, pause() and resume() approach\n events_window.pause()\n print('\\n- pause() followed by resume()')\n\n for event in events_window:\n print(event)\n\n events_window.resume()\n\n # TTL example\n print('\\nLength of the TimedDict: {}'.format(len(events_window)))\n print(events_window)\n time.sleep(1.1)\n print(events_window)\n time.sleep(1)\n print(events_window)\n time.sleep(1)\n print(events_window)\n\n # Gracefully stop the purge thread\n events_window.stop()\n\nThis example will print:\n\n.. code:: python\n\n Raw data:\n {1534608053.6948583: 'value_1', 1534608054.6948583: 'value_2', 1534608055.6948583: {'values': {'value_4', 'value_3'}}}\n\n - protect()\n 1534608053.6948583\n 1534608054.6948583\n 1534608055.6948583\n\n - pause() followed by resume()\n 1534608053.6948583\n 1534608054.6948583\n 1534608055.6948583\n\n Length of the TimedDict: 3\n {1534608053.6948583: 'value_1', 1534608054.6948583: 'value_2', 1534608055.6948583: {'values': {'value_4', 'value_3'}}}\n {1534608054.6948583: 'value_2', 1534608055.6948583: {'values': {'value_4', 'value_3'}}}\n {1534608055.6948583: {'values': {'value_4', 'value_3'}}}\n {}\n\nLicense\n-------\n\nTimedDict is released under the MIT License. See LICENSE for more information.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hjortlund/TimedDict", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "TimedDict", "package_url": "https://pypi.org/project/TimedDict/", "platform": "", "project_url": "https://pypi.org/project/TimedDict/", "project_urls": { "Homepage": "https://github.com/hjortlund/TimedDict" }, "release_url": "https://pypi.org/project/TimedDict/0.2.4/", "requires_dist": null, "requires_python": "", "summary": "Extending the dict data type, with a rolling window feature, that automatically purge elements falling outside the defined window.", "version": "0.2.4" }, "last_serial": 4530339, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6d732519904fab9eb3647599dd289afb", "sha256": "627544b62671f9910fd485cce78373b1faf8786d521f322d8f800caa8cf425cb" }, "downloads": -1, "filename": "TimedDict-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6d732519904fab9eb3647599dd289afb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3324, "upload_time": "2018-08-20T13:45:53", "url": "https://files.pythonhosted.org/packages/8a/ff/5e3bbdae2503188386408ddf5cde7917f6fb0df873923d36b853f7262f1b/TimedDict-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "65ed084c1b8aee5c7446e358eca7d24d", "sha256": "0ed3886b918d6a5cfef1e35867258761d1328426c76b0a789c70c6f04a6b991a" }, "downloads": -1, "filename": "TimedDict-0.2.0.tar.gz", "has_sig": false, "md5_digest": "65ed084c1b8aee5c7446e358eca7d24d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2334, "upload_time": "2018-11-20T15:40:07", "url": "https://files.pythonhosted.org/packages/5d/d6/242a5b807b75d46eb6e75fc2c7d212aba91023555a7219a0491295e7fc1b/TimedDict-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "fffa46e165d7f75e96b1cafc1c7e4d5a", "sha256": "ff391f98556ddae697f85af175c92f24941bbdf764c18da7798656f0eab0cd3e" }, "downloads": -1, "filename": "TimedDict-0.2.1.tar.gz", "has_sig": false, "md5_digest": "fffa46e165d7f75e96b1cafc1c7e4d5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3603, "upload_time": "2018-11-20T15:53:39", "url": "https://files.pythonhosted.org/packages/2d/39/cb5ac75ac3f957bcfbc2a453df142561d5a4d452390da3c1070c3cc2513a/TimedDict-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "a5a9dedcca80158ecc9f0e74ba888cbf", "sha256": "746581e50a48ffc723ee440aa16962c92b86d22aad88ea4d8258d3ce1f738dce" }, "downloads": -1, "filename": "TimedDict-0.2.2.tar.gz", "has_sig": false, "md5_digest": "a5a9dedcca80158ecc9f0e74ba888cbf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3656, "upload_time": "2018-11-20T15:55:37", "url": "https://files.pythonhosted.org/packages/3f/93/56b88a3a58a087d9d0f31177cb17bbfbea71d4c494d2de7b4be2dc71d338/TimedDict-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "39827e8636b31275ee93254f2adfaba9", "sha256": "186eaadaf935be8802036dfcdd84c2f68c2d28b27e54950b14dbd675d4417bde" }, "downloads": -1, "filename": "TimedDict-0.2.3.tar.gz", "has_sig": false, "md5_digest": "39827e8636b31275ee93254f2adfaba9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3643, "upload_time": "2018-11-20T16:00:46", "url": "https://files.pythonhosted.org/packages/13/82/fb8574bb0f3e70e8c078e12bb74a59f232c46e69240fd048364034234768/TimedDict-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "4c8e4b921b98f82e583f8c6dd9b792f0", "sha256": "b3cadf03b9690d6d96114d8c1ca4168915ca04812c3a8df303567fdee0ca7ed1" }, "downloads": -1, "filename": "TimedDict-0.2.4.tar.gz", "has_sig": false, "md5_digest": "4c8e4b921b98f82e583f8c6dd9b792f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4206, "upload_time": "2018-11-26T16:55:25", "url": "https://files.pythonhosted.org/packages/bd/4f/908d8f51a6d6dc7c3793f965f6b9efe8529ec0c41888b0fffe1a058ea4dc/TimedDict-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c8e4b921b98f82e583f8c6dd9b792f0", "sha256": "b3cadf03b9690d6d96114d8c1ca4168915ca04812c3a8df303567fdee0ca7ed1" }, "downloads": -1, "filename": "TimedDict-0.2.4.tar.gz", "has_sig": false, "md5_digest": "4c8e4b921b98f82e583f8c6dd9b792f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4206, "upload_time": "2018-11-26T16:55:25", "url": "https://files.pythonhosted.org/packages/bd/4f/908d8f51a6d6dc7c3793f965f6b9efe8529ec0c41888b0fffe1a058ea4dc/TimedDict-0.2.4.tar.gz" } ] }