{ "info": { "author": "Martin Matusiak", "author_email": "numerodix@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "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", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "printobject\n===========\n\n.. image:: https://badge.fury.io/py/printobject.png\n :target: https://badge.fury.io/py/printobject\n\n.. image:: https://travis-ci.org/numerodix/printobject.png?branch=master\n :target: https://travis-ci.org/numerodix/printobject\n\n.. image:: https://pypip.in/license/printobject/badge.png\n :target: https://pypi.python.org/pypi/printobject/\n\n\nPython version support: CPython 2.6, 2.7, 3.2, 3.3 and PyPy.\n\n\nInstallation\n------------\n\n.. code:: bash\n\n $ pip install printobject\n\n\nUsage\n-----\n\nThe standard library ``pprint`` module is great at visualizing all kinds of\nbuilt-in types like lists, dicts and tuples. But it does not attempt to\nintrospect user defined types. This is where ``printobject`` comes in. It\ndumps the internals of any object as a dict, and pretty prints using\n``pprint``.\n\nKey points:\n\n- Any type of object can printed, but depending on the type the output\n will be more or less insightful.\n- Object introspection is based on the use of ``dir`` rather than ``__dict__``\n directly.\n- Object attributes only include attributes owned by the object, omitting\n class attributes.\n- Callables are omitted when introspecting objects. The goal is to visualize\n the data in objects.\n- The synthetic attributes ``___name___`` and ``___type___`` (yes, that's three\n underscores!!!) are included in order to provide some metadata about the\n object being printed.\n\n\nModules\n^^^^^^^\n\nThis modules defines a number of ``test_xxx`` functions at module level. They\nare included in a ``tests`` list and visible in the output, but not listed\nat top level because they are callables.\n\n.. code:: python\n\n >>> import sys\n >>> from printobject import pp\n\n >>> pp(sys.modules[__name__])\n\n {'___name___': '__main__',\n '___type___': '',\n '__builtins__': ,\n '__cached__': None,\n '__file__': '/home/user/code/printobject/printobject/demos.py',\n '__loader__': <_frozen_importlib.SourceFileLoader object at 0xb71c520c>,\n '__name__': '__main__',\n '__package__': 'printobject',\n 'absolute_import': _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 16384),\n 'defaults': ('Module',),\n 're': ,\n 'sys': ,\n 'tests': [,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ,\n ]}\n\n\nClasses\n^^^^^^^\n\n.. code:: python\n\n >>> class Node(object):\n ... classatt = 'hidden'\n ... def __init__(self, name):\n ... self.name = name\n\n >>> from printobject import pp\n >>> pp(Node)\n\n {'___name___': 'Node',\n '___type___': '',\n '__weakref__': {'___name___': '__weakref__',\n '___type___': ''},\n 'classatt': \"'hidden'\"}\n\n\nInstances\n^^^^^^^^^\n\nObject graphs often aren't fully acyclic. Where cycles exist it usually doesn't\nmake sense to unroll them, so an object encountered more than once is displayed\nwith the ``dup`` tag. Objects also get assigned id's, so that in the case\nbelow it's clear that ``dup ``, which appears in the ``refs``\nattribute of ``c``, is referring back to ``a``.\n\n\n.. code:: python\n\n >>> a, b, c, d = Node('A'), Node('B'), Node('C'), Node('D')\n >>> a.refs = [b, d]\n >>> b.refs = [c]\n >>> c.refs = [a]\n >>> d.refs = [c]\n\n >>> from printobject import pp\n >>> pp(a)\n\n {'___type___': '',\n 'name': \"'A'\",\n 'refs': [{'___type___': '',\n 'name': \"'B'\",\n 'refs': [{'___type___': '',\n 'name': \"'C'\",\n 'refs': ['dup ']}]},\n {'___type___': '',\n 'name': \"'D'\",\n 'refs': [{'___type___': '',\n 'name': \"'C'\",\n 'refs': ['dup ']}]}]}\n\n\nIn the example above ``c`` is printed in expanded form twice, because both\noccurrences are found at the same level of recursion. This can make the output\nquite verbose if the same object is referenced numerous times, so an\nalternative is to expand it only the first time and emit ``dup`` entries\nsubsequently, as shown below.\n\n\n.. code:: python\n\n >>> pp(a, collapse_duplicates=True)\n\n {'___type___': '',\n 'name': \"'A'\",\n 'refs': [{'___type___': '',\n 'name': \"'B'\",\n 'refs': [{'___type___': '',\n 'name': \"'C'\",\n 'refs': ['dup ']}]},\n {'___type___': '',\n 'name': \"'D'\",\n 'refs': ['dup ']}]}\n\n\nOld style classes (Python 2.x only)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n >>> class Node():\n ... classatt = 'hidden'\n ... def __init__(self, name):\n ... self.name = name\n\n >>> from printobject import pp\n >>> pp(Node)\n\n {'___name___': 'Node',\n '___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\"}\n\n\nOld style instances (Python 2.x only)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nInstances of old style classes don't look much different from \ninstances of new style classes. The difference is that they \nidentity as ``instance`` type, which is visible in the \n``___type___`` value.\n\n.. code:: python\n\n >>> a, b, c, d = Node('A'), Node('B'), Node('C'), Node('D')\n >>> a.refs = [b, d]\n >>> b.refs = [c]\n >>> c.refs = [a]\n >>> d.refs = [c]\n\n >>> from printobject import pp\n >>> pp(a)\n\n {'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'A'\",\n 'refs': [{'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'B'\",\n 'refs': [{'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'C'\",\n 'refs': ['dup ']}]},\n {'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'D'\",\n 'refs': [{'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'C'\",\n 'refs': ['dup ']}]}]}\n\nIn collapsed form:\n\n.. code:: python\n\n >>> pp(a, collapse_duplicates=True)\n\n {'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'A'\",\n 'refs': [{'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'B'\",\n 'refs': [{'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'C'\",\n 'refs': ['dup ']}]},\n {'___type___': '',\n '__module__': \"'__main__'\",\n 'classatt': \"'hidden'\",\n 'name': \"'D'\",\n 'refs': ['dup ']}]}\n\n\nCallables\n^^^^^^^^^\n\nCallables can also be printed, but they are less interesting since they\nhave no public attributes.\n\n\nFunctions:\n\n.. code:: python\n\n >>> from printobject import pp\n >>> pp(pp)\n {'___name___': 'pp', '___type___': ''}\n\n\nMethods:\n\n.. code:: python\n\n >>> from printobject import Dumper\n >>> pp(Dumper.dump)\n {'___name___': 'dump', '___type___': ''}\n\n\nLambdas:\n\n.. code:: python\n\n >>> pp(lambda x: x)\n {'___name___': '', '___type___': ''}\n\n\nIterables\n^^^^^^^^^\n\nIterables are printed using their normal ``__repr__``. In this case\nthere are no ``___type___`` and ``___name___`` attributes synthesized\nin the output.\n\n.. code:: python\n\n\n >>> it = frozenset(range(10))\n\n >>> from printobject import pp\n >>> pp(it)\n\n ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n\n\nGenerators\n^^^^^^^^^^\n\nGenerators are a special case of iterables, because the values are\ncreated dynamically. Printing generators isn't insightful without\nunrolling them, so they will be materialized first. But this means that\nif the generator is infinite the function will never return.\n\n.. code:: python\n\n >>> gen = (x for x in range(10))\n\n >>> from printobject import pp\n >>> pp(gen)\n\n ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\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/numerodix/printobject", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "printobject", "package_url": "https://pypi.org/project/printobject/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/printobject/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/numerodix/printobject" }, "release_url": "https://pypi.org/project/printobject/0.1.6/", "requires_dist": null, "requires_python": null, "summary": "Generic pretty printer of python objects", "version": "0.1.6" }, "last_serial": 1032840, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8b1e114d60f5ee44249d1762256c1ab1", "sha256": "4c8c1e3ad20c9a954152304d78c3b219f9dc32f7694dbef1d18213338fc03526" }, "downloads": -1, "filename": "printobject-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8b1e114d60f5ee44249d1762256c1ab1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4553, "upload_time": "2014-03-16T12:36:34", "url": "https://files.pythonhosted.org/packages/41/7f/f8a3dbbf9951c7242bfa658a8c121fc5ff5d226ff0f7dba78eba268091df/printobject-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61c681ed497efe7266fd7062bc8da08a", "sha256": "c15334c9bb224a38a044fd261555c42e91e79f099d675ed11e8434b010e713db" }, "downloads": -1, "filename": "printobject-0.1.0.tar.gz", "has_sig": false, "md5_digest": "61c681ed497efe7266fd7062bc8da08a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3213, "upload_time": "2014-03-16T12:36:32", "url": "https://files.pythonhosted.org/packages/d5/33/41d5b7194549d803f616841e98a25c20872de51158d3a8f60931fb40a70b/printobject-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "5989c2735cc4715c59ef9f4b0a645d2e", "sha256": "ccbcbfedacb7e1a679f2cdf7b1d537b9eac407cbff20e351787e9fcdff687780" }, "downloads": -1, "filename": "printobject-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5989c2735cc4715c59ef9f4b0a645d2e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4660, "upload_time": "2014-03-16T13:00:26", "url": "https://files.pythonhosted.org/packages/97/54/05aebd261e4ebaa6c5788b03e10887b73eaa691e827c7fa9b5c74a71d8c4/printobject-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "582fcd1caae86f7d5328ebe9d5236a61", "sha256": "82b4652f356f769b49cffcc14cb38699df9dbafa054d289180e37a1cb36f2d22" }, "downloads": -1, "filename": "printobject-0.1.1.tar.gz", "has_sig": false, "md5_digest": "582fcd1caae86f7d5328ebe9d5236a61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3293, "upload_time": "2014-03-16T13:00:22", "url": "https://files.pythonhosted.org/packages/b0/1f/e2ff447875db4dd5e35e758aa891ec1d817e91910effaab4d28661f57297/printobject-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "4c87308758d42b277e453bc8bd813bf6", "sha256": "27543d7d14c137967b85c63e2a0e34e3a003fda5586ef0cfdf9ddb4eb727ffb0" }, "downloads": -1, "filename": "printobject-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4c87308758d42b277e453bc8bd813bf6", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4713, "upload_time": "2014-03-16T14:41:45", "url": "https://files.pythonhosted.org/packages/6e/e1/d4a6a1aca35f5964cb29baf5001b6429f8eea795716d8750f83d7983e064/printobject-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd82384d83f6fb345f024dec085f450f", "sha256": "5174e4223124a1d84de75ddfc3c5b7b245781ad3598467e470ab55d39c8e7093" }, "downloads": -1, "filename": "printobject-0.1.2.tar.gz", "has_sig": false, "md5_digest": "fd82384d83f6fb345f024dec085f450f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3697, "upload_time": "2014-03-16T14:41:43", "url": "https://files.pythonhosted.org/packages/bb/06/506984830156544131cb399d1bc89673d8f0a09248d41ec7acc28e43260f/printobject-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "ad9ffeb2aec676a6aaa37d1caaa384bb", "sha256": "7b90b1a34a32b4d30be8a21ef4519eceb1be1054326c4cda06471fca15733054" }, "downloads": -1, "filename": "printobject-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ad9ffeb2aec676a6aaa37d1caaa384bb", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4715, "upload_time": "2014-03-16T15:27:57", "url": "https://files.pythonhosted.org/packages/78/2b/ca6e9aa2d5efe9d46040f53fd96527f1e973aa2cbf40dabbcf6fcc934467/printobject-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "39a1bafd75775eb54c5dc332ef3e8ab2", "sha256": "3ae8b38205a9f6a496dba32042d8cebb91de73d92a08e36dfcf9b6f9f4242346" }, "downloads": -1, "filename": "printobject-0.1.3.tar.gz", "has_sig": false, "md5_digest": "39a1bafd75775eb54c5dc332ef3e8ab2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4429, "upload_time": "2014-03-16T15:27:54", "url": "https://files.pythonhosted.org/packages/74/6f/b4abb56ff2039f524e938ab094c196ae2eb9d9eddaf243b1f1fe83ab5129/printobject-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2d1c467dbc52bbf5061151e8c6df003c", "sha256": "7e3f09dc9c0a7170ac85a7ca932f94fe22cff46c8770423696ddcb890d22e3ec" }, "downloads": -1, "filename": "printobject-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2d1c467dbc52bbf5061151e8c6df003c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4713, "upload_time": "2014-03-16T16:03:15", "url": "https://files.pythonhosted.org/packages/0c/9c/27952eb29fba75230002f145458216390077d8d4dc47a0273053baac9355/printobject-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0ed7d1b9900a77741d6ecbcf842e2383", "sha256": "5f195b2107fddce11048327193a1b60cb16ff5772378fbe85bf67ed49bd90821" }, "downloads": -1, "filename": "printobject-0.1.4.tar.gz", "has_sig": false, "md5_digest": "0ed7d1b9900a77741d6ecbcf842e2383", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4805, "upload_time": "2014-03-16T16:03:12", "url": "https://files.pythonhosted.org/packages/71/ac/c955dff99c214661360d5ba9d7ffe795fc60509734acc29d30d531bcbb00/printobject-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "b7a93fd7c63af9e5e82248f3c842b232", "sha256": "aadaa492af2f9acebcb22e5a3f9854ae605211773f11041544199b4ec54f4143" }, "downloads": -1, "filename": "printobject-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b7a93fd7c63af9e5e82248f3c842b232", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4716, "upload_time": "2014-03-16T17:11:30", "url": "https://files.pythonhosted.org/packages/d7/dc/e3f39818ae5045687192394d6d08ab724239e298be0d1f616c13ece9729b/printobject-0.1.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa3bb2bbfb993b71766a9a3eda206b1a", "sha256": "3907c87a312b7bd561d89ba74097893fd9890a905a9749b3bc38bfe8f22a6769" }, "downloads": -1, "filename": "printobject-0.1.5.tar.gz", "has_sig": false, "md5_digest": "aa3bb2bbfb993b71766a9a3eda206b1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5436, "upload_time": "2014-03-16T17:11:28", "url": "https://files.pythonhosted.org/packages/c4/95/514877d27d8a41daaf45b954ea315225f0ccf555f0de68d93b1d1709a9c1/printobject-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "1a5e984ce374d8cf8f783aaccbd8dc23", "sha256": "e535cdf7f34c7c422cb34ec38705c58e98942f68712d907ef9eadef9fdd7033e" }, "downloads": -1, "filename": "printobject-0.1.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1a5e984ce374d8cf8f783aaccbd8dc23", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4722, "upload_time": "2014-03-17T20:16:14", "url": "https://files.pythonhosted.org/packages/fc/15/3312ee0182fc88b43ab86f3b23a4338b167647d7767d4c7582e9953a8799/printobject-0.1.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "818088dfb8b955b3f07491bef44d7186", "sha256": "69bef26876ed27c81db4165a58028ec55f1c1469c89cf65a8cbf505dfecaa7a5" }, "downloads": -1, "filename": "printobject-0.1.6.tar.gz", "has_sig": false, "md5_digest": "818088dfb8b955b3f07491bef44d7186", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5444, "upload_time": "2014-03-17T20:16:11", "url": "https://files.pythonhosted.org/packages/e0/07/9d4d34fb031bd2d3de9a31877eaa3a14a11e5c17de77f470f8b533dfd975/printobject-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1a5e984ce374d8cf8f783aaccbd8dc23", "sha256": "e535cdf7f34c7c422cb34ec38705c58e98942f68712d907ef9eadef9fdd7033e" }, "downloads": -1, "filename": "printobject-0.1.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1a5e984ce374d8cf8f783aaccbd8dc23", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4722, "upload_time": "2014-03-17T20:16:14", "url": "https://files.pythonhosted.org/packages/fc/15/3312ee0182fc88b43ab86f3b23a4338b167647d7767d4c7582e9953a8799/printobject-0.1.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "818088dfb8b955b3f07491bef44d7186", "sha256": "69bef26876ed27c81db4165a58028ec55f1c1469c89cf65a8cbf505dfecaa7a5" }, "downloads": -1, "filename": "printobject-0.1.6.tar.gz", "has_sig": false, "md5_digest": "818088dfb8b955b3f07491bef44d7186", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5444, "upload_time": "2014-03-17T20:16:11", "url": "https://files.pythonhosted.org/packages/e0/07/9d4d34fb031bd2d3de9a31877eaa3a14a11e5c17de77f470f8b533dfd975/printobject-0.1.6.tar.gz" } ] }