{ "info": { "author": "Rui Jorge Rei", "author_email": "rui.jorge.rei@googlemail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "=========\r\nrr.pretty\r\n=========\r\n\r\nThis module exposes a few functions and a class decorator to make the task of writing ``__repr__()`` and ``__str__()`` for custom classes much easier. It will display a list of nicely formatted ``(attr, val)`` pairs with custmizable separator and formatting for each pair.\r\n\r\nLet's look at an example:\r\n\r\n.. code-block:: python\r\n\r\n from rr import pretty\r\n\r\n class foo(object):\r\n __str__ = pretty.str\r\n __repr__ = pretty.repr\r\n __info__ = pretty.info([\"x\", \"y\", \"z\"])\r\n\r\n def __init__(self, x, y, z):\r\n self.x = x\r\n self.y = y\r\n self.z = z\r\n\r\n f = foo(1, 2, 3)\r\n print repr(f) # see for yourself :)\r\n print str(f)\r\n\r\nNow, let's do the same, only this time we'll use the ``klass()`` class decorator:\r\n\r\n.. code-block:: python\r\n\r\n from rr import pretty\r\n\r\n @pretty.klass\r\n class foo(object):\r\n def __init__(self, x, y, z):\r\n self.x = x\r\n self.y = y\r\n self.z = z\r\n\r\n f = foo(1, 2, 3)\r\n print repr(f) # see for yourself :)\r\n print str(f)\r\n\r\nWe even left out the attribute list, and ``pretty.info()`` (which is what ``pretty.klass()`` uses behind the scenes) builds it for us. That's it! You get nice ``__repr__()`` and ``__str__()`` methods for free.\r\n\r\n\r\nInstallation\r\n============\r\n\r\n>From PyPI (\"stable\" release):\r\n\r\n.. code-block:: bash\r\n\r\n pip install rr.pretty\r\n\r\n>From the Git repo:\r\n\r\n.. code-block:: bash\r\n\r\n git clone https://github.com/2xR/rr.pretty.git\r\n pip install ./rr.pretty\r\n\r\n\r\nContributing\r\n============\r\n\r\nContributions are welcome through github pull requests (tests would be nice to have... :P)\r\n\r\nAnd if you're using the library and would like to say *\"thanks!\"* and/or keep me working on it, why not `buy me a beer `_?", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/2xR/rr.pretty", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "rr.pretty", "package_url": "https://pypi.org/project/rr.pretty/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rr.pretty/", "project_urls": { "Homepage": "https://github.com/2xR/rr.pretty" }, "release_url": "https://pypi.org/project/rr.pretty/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "Helpers for creation of nicer repr() and str().", "version": "0.1.0" }, "last_serial": 2186141, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "15e9ec99fb2ef82ac0e9422bcc90d3d1", "sha256": "e671cedd08b3350780baafde3cef73efd30c61f1c0b98d0fa78bdf47036e4b5c" }, "downloads": -1, "filename": "rr.pretty-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "15e9ec99fb2ef82ac0e9422bcc90d3d1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6473, "upload_time": "2016-06-24T23:07:55", "url": "https://files.pythonhosted.org/packages/9a/36/9540cce35610f41dc33f76b98fb000d53f298eccaf6402a38c9e37a20c67/rr.pretty-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "125639e1fbf894ff5e7c12bfb82033d4", "sha256": "359569472c243644715e773d34cfe19d7d5a8dbfdb8f36ff8060dad9c336115c" }, "downloads": -1, "filename": "rr.pretty-0.1.0.zip", "has_sig": false, "md5_digest": "125639e1fbf894ff5e7c12bfb82033d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7771, "upload_time": "2016-06-24T23:08:23", "url": "https://files.pythonhosted.org/packages/f6/33/6d4c4e0bfbd9948d410998005e94d1e0812f2c861a12f7df67c510cc61dd/rr.pretty-0.1.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "15e9ec99fb2ef82ac0e9422bcc90d3d1", "sha256": "e671cedd08b3350780baafde3cef73efd30c61f1c0b98d0fa78bdf47036e4b5c" }, "downloads": -1, "filename": "rr.pretty-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "15e9ec99fb2ef82ac0e9422bcc90d3d1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6473, "upload_time": "2016-06-24T23:07:55", "url": "https://files.pythonhosted.org/packages/9a/36/9540cce35610f41dc33f76b98fb000d53f298eccaf6402a38c9e37a20c67/rr.pretty-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "125639e1fbf894ff5e7c12bfb82033d4", "sha256": "359569472c243644715e773d34cfe19d7d5a8dbfdb8f36ff8060dad9c336115c" }, "downloads": -1, "filename": "rr.pretty-0.1.0.zip", "has_sig": false, "md5_digest": "125639e1fbf894ff5e7c12bfb82033d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7771, "upload_time": "2016-06-24T23:08:23", "url": "https://files.pythonhosted.org/packages/f6/33/6d4c4e0bfbd9948d410998005e94d1e0812f2c861a12f7df67c510cc61dd/rr.pretty-0.1.0.zip" } ] }