{ "info": { "author": "Eugene M. Kim", "author_email": "astralblue@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "========\nctorrepr\n========\n\n\n.. image:: https://img.shields.io/pypi/v/ctorrepr.svg\n :target: https://pypi.python.org/pypi/ctorrepr\n\n.. image:: https://img.shields.io/travis/astralblue/ctorrepr.svg\n :target: https://travis-ci.org/astralblue/ctorrepr\n\n.. image:: https://readthedocs.org/projects/ctorrepr/badge/?version=latest\n :target: https://ctorrepr.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://pyup.io/repos/github/astralblue/ctorrepr/shield.svg\n :target: https://pyup.io/repos/github/astralblue/ctorrepr/\n :alt: Updates\n\n\nA mix-in that provides __repr__() from constructor arguments.\n\n\n* Free software: MIT license\n* Documentation: https://ctorrepr.readthedocs.io.\n\n\nUsage\n-----\n\nTo use, simply inherit from `~ctorrepr.CtorRepr` then implement its\n`~ctorrepr.CtorRepr._collect_repr_args()` to match your existing\n``__init__()`` method::\n\n >>> from ctorrepr import CtorRepr\n >>> class X(CtorRepr):\n ... def __init__(self, x1='x1', x2='x2', *poargs, **kwargs):\n ... super().__init__(*poargs, **kwargs)\n ... self.x1 = x1\n ... self.x2 = x2\n ... def _collect_repr_args(self, poargs, kwargs):\n ... super()._collect_repr_args(poargs, kwargs)\n ... poargs[:0] = self.x1, self.x2\n >>> class Y(CtorRepr):\n ... def __init__(self, *y, **kwargs):\n ... super().__init__(**kwargs)\n ... self.y = y # completely consumes positional args\n ... def _collect_repr_args(self, poargs, kwargs):\n ... super()._collect_repr_args(poargs, kwargs)\n ... poargs[:0] = self.y\n >>> class Z(CtorRepr):\n ... def __init__(self, *poargs, zk='zk', **kwargs):\n ... super().__init__(*poargs, **kwargs)\n ... self.zk = zk\n ... def _collect_repr_args(self, poargs, kwargs):\n ... super()._collect_repr_args(poargs, kwargs)\n ... kwargs.update(zk=self.zk)\n >>> class W(X, Y, Z):\n ... def __str__(self):\n ... return repr(self)\n >>> print(' '.join(t.__name__ for t in W.mro()))\n W X Y Z CtorRepr object\n >>> print(W())\n W('x1', 'x2', zk='zk')\n >>> print(W(24))\n W(24, 'x2', zk='zk')\n >>> w = W(24, 25, 'y1', 'y2')\n >>> w.y\n ('y1', 'y2')\n >>> print(w)\n W(24, 25, 'y1', 'y2', zk='zk')\n >>> print(W(zk=100))\n W('x1', 'x2', zk=100)\n\nCredits\n---------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n\n=======\nHistory\n=======\n\n0.1.0 (2017-07-31)\n------------------\n\n* First release on PyPI.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/astralblue/ctorrepr", "keywords": "ctorrepr", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "ctorrepr", "package_url": "https://pypi.org/project/ctorrepr/", "platform": "", "project_url": "https://pypi.org/project/ctorrepr/", "project_urls": { "Homepage": "https://github.com/astralblue/ctorrepr" }, "release_url": "https://pypi.org/project/ctorrepr/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "A mix-in that provides __repr__() from constructor arguments.", "version": "0.1.2" }, "last_serial": 3063228, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "74778b46e042829796b59f38f7ec30f9", "sha256": "024a77115c05283e7629216e687276cefd68ba1cba6352c2cf23280e37f2b53a" }, "downloads": -1, "filename": "ctorrepr-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "74778b46e042829796b59f38f7ec30f9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4924, "upload_time": "2017-08-01T03:13:51", "url": "https://files.pythonhosted.org/packages/dc/0d/54c792598904da0e5c176992f2595e4fab7ed40c22c643d1874514b52bf1/ctorrepr-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "16a1af646476611ed91f69203f5b87eb", "sha256": "5bde58f3b531751ae8b9823b84540ef6df0b2c6f94ad4b212de4cbb2fb32c1f7" }, "downloads": -1, "filename": "ctorrepr-0.1.2.tar.gz", "has_sig": false, "md5_digest": "16a1af646476611ed91f69203f5b87eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11136, "upload_time": "2017-08-01T03:13:52", "url": "https://files.pythonhosted.org/packages/05/e8/9e57bc01bfde3f14b64378df6dda605cf45187f57756fef1b0147484f203/ctorrepr-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "74778b46e042829796b59f38f7ec30f9", "sha256": "024a77115c05283e7629216e687276cefd68ba1cba6352c2cf23280e37f2b53a" }, "downloads": -1, "filename": "ctorrepr-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "74778b46e042829796b59f38f7ec30f9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4924, "upload_time": "2017-08-01T03:13:51", "url": "https://files.pythonhosted.org/packages/dc/0d/54c792598904da0e5c176992f2595e4fab7ed40c22c643d1874514b52bf1/ctorrepr-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "16a1af646476611ed91f69203f5b87eb", "sha256": "5bde58f3b531751ae8b9823b84540ef6df0b2c6f94ad4b212de4cbb2fb32c1f7" }, "downloads": -1, "filename": "ctorrepr-0.1.2.tar.gz", "has_sig": false, "md5_digest": "16a1af646476611ed91f69203f5b87eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11136, "upload_time": "2017-08-01T03:13:52", "url": "https://files.pythonhosted.org/packages/05/e8/9e57bc01bfde3f14b64378df6dda605cf45187f57756fef1b0147484f203/ctorrepr-0.1.2.tar.gz" } ] }