{ "info": { "author": "Justas Birgiolas, Chitral Verma", "author_email": "justas@asu.edu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "[![Build Status](https://travis-ci.com/JustasB/linetimer.svg?branch=master)](https://travis-ci.com/JustasB/linetimer)\n[![codecov](https://codecov.io/gh/JustasB/linetimer/branch/master/graph/badge.svg)](https://codecov.io/gh/JustasB/linetimer)\n[![PyPI version](https://badge.fury.io/py/linetimer.svg)](https://badge.fury.io/py/linetimer)\n\n# linetimer: A small Python class to measure the time taken by indented lines.\n\n[linetimer](https://pypi.org/project/linetimer/) is a small Python class to quickly measure the time taken by a block of indented lines\n\n# Installation\n\nTo install the library, simply type in `pip install linetimer` in your terminal.\n\n# Usage\n\nThe basic usage is:\n\n```\nfrom linetimer import CodeTimer\n\nwith CodeTimer():\n line_to_measure()\n another_line()\n # etc...\n```\n\nWhich will show the following after the indented line(s) finishes executing:\n\n```\nCode block took: x.xxx ms\n```\n\nYou can also **name the code blocks** you want to measure:\n\n```\nwith CodeTimer('loop 1'):\n for i in range(100000):\n pass\n\nwith CodeTimer('loop 2'):\n for i in range(100000):\n pass\n\nCode block 'loop 1' took: 4.991 ms\nCode block 'loop 2' took: 3.666 ms\n```\n\nAnd **nest** them:\n\n```\nwith CodeTimer('Outer'):\n for i in range(100000):\n pass\n\n with CodeTimer('Inner'):\n for i in range(100000):\n pass\n\n for i in range(100000):\n pass\n\nCode block 'Inner' took: 2.382 ms\nCode block 'Outer' took: 10.466 ms\n```\n\nTo **get the time taken in different units**, use the `unit` parameter:\n```\nwith CodeTimer('Block', unit='h'):\n slow_function()\n\nCode block 'Block' took: 2.382 h\n```\n\nSupported units are ms, s , m, h corresponding to milliseconds, seconds, minutes, hours.\n\nIf you need to **retain the time taken**, you can do it with:\n```\nct = CodeTimer()\n\nwith ct:\n slow_function()\n\nct.took # This contains the time taken as per the unit provided (milliseconds by default)\n```\n\nSometimes you want to **use your own dedicated logger**, you can do it with:\n```\nimport logging\nmy_logger = logging.get_logger('xyz')\n\nwith CodeTimer('Block', unit='h', logger_func = my_logger.info):\n slow_function()\n```\nThis will log to an appropriate handler,\n```\nINFO - Code block 'Block' took: 2.382 h\n```\n\nFinally, if you need to **turn off the printed statements**, use the `silent=True` argument\n\n```\nwith CodeTimer(silent=True):\n slow_function()\n\n# There will be no printed output\n```\n\nIf you like this package, [upvote it on StackOverflow](https://stackoverflow.com/a/52749808/407108).\n\n# Issues\nIf you encounter a problem, create an [issue on Github](https://github.com/JustasB/linetimer/issues).\n\n# Contributing\nTo contribute, please [open an issue](https://github.com/JustasB/linetimer/issues) first and discuss your plan for contributing. Then fork this repository and commit [a pull-request](https://help.github.com/en/articles/about-pull-requests) with your changes.\n\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/justasb/linetimer", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "linetimer", "package_url": "https://pypi.org/project/linetimer/", "platform": "", "project_url": "https://pypi.org/project/linetimer/", "project_urls": { "Homepage": "https://github.com/justasb/linetimer" }, "release_url": "https://pypi.org/project/linetimer/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "A small Python class to quickly measure the time taken while executing a block of indented lines", "version": "0.1.3" }, "last_serial": 5497544, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "c7509598c0f1130934596dcd72a80467", "sha256": "456b3e9e581ec1a8e7e08a4246c93deaed44e9005b2a2c17acc825611e4c98ce" }, "downloads": -1, "filename": "linetimer-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "c7509598c0f1130934596dcd72a80467", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3268, "upload_time": "2019-04-23T02:02:36", "url": "https://files.pythonhosted.org/packages/c2/38/7e8aa746f3b09e372a52183f3df863a0b90cea043664e8d082b56f8897ef/linetimer-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5cf598f4f0988e1022c400cf78a2d634", "sha256": "dc2c1341727fc19c448791613d3fd0824af628252b1bb86eb36c18168a2e03be" }, "downloads": -1, "filename": "linetimer-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5cf598f4f0988e1022c400cf78a2d634", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2452, "upload_time": "2019-04-23T02:02:38", "url": "https://files.pythonhosted.org/packages/41/a0/36839b1a45797b21b3337d73bc692a64bba9d93ef09f4cdefb68066a3bd8/linetimer-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7fec43e3aac9f208b8e55dccdb8ca0fb", "sha256": "dd9069350165dde02459491a81e685c0f003ae6fa9a81bda39974f1cb80587bd" }, "downloads": -1, "filename": "linetimer-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7fec43e3aac9f208b8e55dccdb8ca0fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2091, "upload_time": "2019-04-23T02:02:39", "url": "https://files.pythonhosted.org/packages/e9/aa/592586f07a7a6456a9ec22eefbbef6f747c22453a2f6e7a99625a90e6545/linetimer-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d7556a3670ea87f2dcd7073dd0eed115", "sha256": "ac1f3685542ae0fed9f74aa8a6c2fe8bb483c38bd41eaefc41c8e86d46fecaea" }, "downloads": -1, "filename": "linetimer-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d7556a3670ea87f2dcd7073dd0eed115", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3456, "upload_time": "2019-05-28T03:52:03", "url": "https://files.pythonhosted.org/packages/15/2b/6f3c8b3dc066252e69e60bb31bafb86fcbca5265a84a59a8ef40f009d869/linetimer-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "82a857c3f92de3dd53eb9ddb53090208", "sha256": "0ecc6ac0f487de6d1a9a824952b817bd71a8fb67542067bb0de0c7071b6a497d" }, "downloads": -1, "filename": "linetimer-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "82a857c3f92de3dd53eb9ddb53090208", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2641, "upload_time": "2019-05-28T03:52:04", "url": "https://files.pythonhosted.org/packages/1b/84/3204e9c0ecd4864a130085193aeab41135a51aa988c7224d05cc4e68673d/linetimer-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "079aea1228e9581126f4231757223660", "sha256": "80f448d619e6a73c6b54b14bfe32f4082463dbbdcde6c87e33a4748cebfc0b51" }, "downloads": -1, "filename": "linetimer-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "079aea1228e9581126f4231757223660", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3660, "upload_time": "2019-06-10T19:38:24", "url": "https://files.pythonhosted.org/packages/71/79/b3ef13d2829c65afdedcfe1db859cfe502028c50d49e52ab22646103be1f/linetimer-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a49365ece4a799cb4e39b2ab595043af", "sha256": "ec548663eca934ce6d05abbafd4d4bd3d3e841f8261fabce6e20a08afb753a50" }, "downloads": -1, "filename": "linetimer-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a49365ece4a799cb4e39b2ab595043af", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2844, "upload_time": "2019-06-10T19:38:25", "url": "https://files.pythonhosted.org/packages/35/c8/1b15e4bcbaa31cfcaa09935cf8534e061d2c03d96b081d7438cd7a96697c/linetimer-0.1.2-py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "d7b1fe7627d5c603b9522ec38f6d8c44", "sha256": "89066dbc2fb49f6b6397bdf129672ba6a4525ac2fcca4df5ff80e981f882edee" }, "downloads": -1, "filename": "linetimer-0.1.3-py2-none-any.whl", "has_sig": false, "md5_digest": "d7b1fe7627d5c603b9522ec38f6d8c44", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3825, "upload_time": "2019-07-07T16:46:28", "url": "https://files.pythonhosted.org/packages/ae/e3/c86d5f84f6b4cfc7dc2c156d910f0bc0291208c82e84cd7b5eeb2035aa4d/linetimer-0.1.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4438bb52d5c64f9593369b14859f192", "sha256": "c54f17f2069cbeedf753f6f551d1fc05ce6d05bb970ba91f3cf0a59804ddaeb7" }, "downloads": -1, "filename": "linetimer-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f4438bb52d5c64f9593369b14859f192", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3009, "upload_time": "2019-07-07T16:46:29", "url": "https://files.pythonhosted.org/packages/58/98/a8fc73e46dfa5bda230d8b8056fd05ee763505ac9579da89661a82460064/linetimer-0.1.3-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d7b1fe7627d5c603b9522ec38f6d8c44", "sha256": "89066dbc2fb49f6b6397bdf129672ba6a4525ac2fcca4df5ff80e981f882edee" }, "downloads": -1, "filename": "linetimer-0.1.3-py2-none-any.whl", "has_sig": false, "md5_digest": "d7b1fe7627d5c603b9522ec38f6d8c44", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 3825, "upload_time": "2019-07-07T16:46:28", "url": "https://files.pythonhosted.org/packages/ae/e3/c86d5f84f6b4cfc7dc2c156d910f0bc0291208c82e84cd7b5eeb2035aa4d/linetimer-0.1.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4438bb52d5c64f9593369b14859f192", "sha256": "c54f17f2069cbeedf753f6f551d1fc05ce6d05bb970ba91f3cf0a59804ddaeb7" }, "downloads": -1, "filename": "linetimer-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f4438bb52d5c64f9593369b14859f192", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3009, "upload_time": "2019-07-07T16:46:29", "url": "https://files.pythonhosted.org/packages/58/98/a8fc73e46dfa5bda230d8b8056fd05ee763505ac9579da89661a82460064/linetimer-0.1.3-py3-none-any.whl" } ] }