{ "info": { "author": "Mike Jarrett", "author_email": "mike.d.jarrett at gmail dot com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development" ], "description": "MJ Helpers\n==========\n\nA collection of helper functions and decorators that I occasionally use to get\nmy life in order.\n\nInstallation\n------------\n\n pip install mj_helpers\n\nprofileit\n---------\n\nA decorator to profile function calls.\n\nUsage::\n\n from mj_helpers.decorators import profileit\n\n @profileit\n def foo():\n return do_stuff()\n\n\nIn a Python shell::\n\n >>> from .foo import foo\n >>> foo()\n >>> from pstats import Stats\n >>> stats = Stats('/tmp/foo.profile')\n >>> stats.sort_stats('cumulative').print_stats(50)\n\n Fri Nov 27 08:34:14 2015 /tmp/foo.profile\n 2 function calls in 0.000 seconds\n\n Ordered by: cumulative time\n ncalls tottime percall cumtime percall filename:lineno(function)\n 1 0.000 0.000 0.000 0.000 :1(foo)\n 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}\n \nIf installed via pip or python setup.py::\n\n mj_stats /tmp/foo.profile /tmp/bar.profile --sorting=cumulative --limit=50\n\nlog_function_io\n---------------\n\nLogging decorator that logs function name, args and kwargs.\n\nIn Python:: \n\n from mj_helpers.log_decorator import log_function_io\n \n @log_function_io\n def foo(bar, spam=None, *args, **kwargs):\n return do_stuff()\n\n\n class Thing(object):\n pass\n\n\n class Bar(object):\n\n @staticmethod\n @log_function_io\n def static_method(spam, eggs='eggs'):\n return True\n\n @classmethod\n @log_function_io\n def class_method(cls, foo='foo', bar=None):\n return False\n\n\n @log_function_io\n def function(self, thing):\n return Thing()\n\n \nConsole::\n\n >>> foo('a', *['first star', 'second star'], **{'something': 'boo'})\n 2016-02-02 05:04:50,963 - __main__ - DEBUG - [FUN] foo [ARG] bar: 'a', spam: 'first star', something: 'boo' *('second star',)\n 2016-02-02 05:04:50,963 - __main__ - DEBUG - [FUN] foo [RET] None\n\n >>> Bar.static_method('spam')\n 2016-02-02 05:09:30,426 - __main__ - DEBUG - [FUN] static_method [ARG] spam: 'spam'\n 2016-02-02 05:09:30,426 - __main__ - DEBUG - [FUN] static_method [RET] True\n\n >>> Bar.class_method(bar='spam')\n 2016-02-02 05:11:39,753 - __main__ - DEBUG - [FUN] class_method [ARG] bar: 'spam'\n 2016-02-02 05:11:39,753 - __main__ - DEBUG - [FUN] class_method [RET] False\n\n >>> Bar().function(thing='spam')\n 2016-02-02 05:13:01,679 - __main__ - DEBUG - [FUN] function [ARG] thing: 'spam'\n 2016-02-02 05:13:01,679 - __main__ - DEBUG - [FUN] function [RET] <__main__.Thing object at 0x7f33d8627f90>\n\ncache_it\n--------\n\nCaching decorator to assist in caching function calls / returns.\n\nIn Python::\n\n from mj_helpers.decorators import cache_it\n\n @cache_it()\n def foo(bar, spam=None, *args, **kwargs):\n return do_stuff()\n\n # If using memoize instead of django's cache you can see the cache by:\n >>> cache_it._cache\n {\n : {\n \"(('a', 'first star', 'second star'), (('something', 'boo'),))\":\n (None, 1454391947.614329)\n }\n }", "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/mikejarrett/mj-helpers", "keywords": "logging profiling decorators", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "mj-helpers", "package_url": "https://pypi.org/project/mj-helpers/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mj-helpers/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mikejarrett/mj-helpers" }, "release_url": "https://pypi.org/project/mj-helpers/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "A collection of helper functions and decorators that I occasionally use to get my life in order.", "version": "0.0.1" }, "last_serial": 1963073, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "4ff58f0d40882a84aec833d711227982", "sha256": "2f46a9bda8920e9d9f1bd28ee1dfab889299982b7dc341680ae0ece482ad6534" }, "downloads": -1, "filename": "mj_helpers-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4ff58f0d40882a84aec833d711227982", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7521, "upload_time": "2015-11-27T12:53:35", "url": "https://files.pythonhosted.org/packages/2a/cb/2cb169287c6672e09a8d161691970d5ee6b6b799ec7df4f6f57f529145ef/mj_helpers-0.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "900c6bdf2da3e6c420b31823ad5e65c9", "sha256": "158e22b8046552251144891b3f08e39d3e414c0fc74da69b94e0cfd98ee3807b" }, "downloads": -1, "filename": "mj_helpers-0.0.0.tar.gz", "has_sig": false, "md5_digest": "900c6bdf2da3e6c420b31823ad5e65c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5208, "upload_time": "2015-11-27T12:53:56", "url": "https://files.pythonhosted.org/packages/a5/f0/8dcdf95c70813ecfd414c127754240fa960c6778fa930d2babd8743d4078/mj_helpers-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "a7a85bb146fc799345137f262ac94847", "sha256": "34b9797f8017e34cf3c5700eee6e16766432c77b40d5ba3dd72efd23ea697c08" }, "downloads": -1, "filename": "mj_helpers-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a7a85bb146fc799345137f262ac94847", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6968, "upload_time": "2016-02-18T11:22:51", "url": "https://files.pythonhosted.org/packages/3f/d8/4905e61b24a2f78d36a882ba1f55d4c6a16e3eb6cf29ae1409253c6da98c/mj_helpers-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a7a85bb146fc799345137f262ac94847", "sha256": "34b9797f8017e34cf3c5700eee6e16766432c77b40d5ba3dd72efd23ea697c08" }, "downloads": -1, "filename": "mj_helpers-0.0.1.tar.gz", "has_sig": false, "md5_digest": "a7a85bb146fc799345137f262ac94847", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6968, "upload_time": "2016-02-18T11:22:51", "url": "https://files.pythonhosted.org/packages/3f/d8/4905e61b24a2f78d36a882ba1f55d4c6a16e3eb6cf29ae1409253c6da98c/mj_helpers-0.0.1.tar.gz" } ] }