{ "info": { "author": "Wouter Bolsterlee", "author_email": "uws@xs4all.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "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 :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "========\nqualname\n========\n\nPython module to emulate the ``__qualname__`` attribute for classes and methods\n(Python 3.3+) in older Python versions. See `PEP 3155`__ for details.\n\n__ https://www.python.org/dev/peps/pep-3155/\n\n.. image:: https://travis-ci.org/wbolster/qualname.svg?branch=master\n :target: https://travis-ci.org/wbolster/qualname\n\n.. image:: https://pypip.in/download/qualname/badge.svg\n :target: https://pypi.python.org/pypi/qualname/\n :alt: Downloads\n\n.. image:: https://pypip.in/version/qualname/badge.svg\n :target: https://pypi.python.org/pypi/qualname/\n :alt: Latest Version\n\n.. image:: https://pypip.in/py_versions/qualname/badge.svg\n :target: https://pypi.python.org/pypi/qualname/\n :alt: Supported Python versions\n\n.. image:: https://pypip.in/status/qualname/badge.svg\n :target: https://pypi.python.org/pypi/qualname/\n :alt: Development Status\n\n.. image:: https://pypip.in/license/qualname/badge.svg\n :target: https://pypi.python.org/pypi/qualname/\n :alt: License\n\nInstallation\n============\n\n::\n\n pip install qualname\n\n\nUsage\n=====\n\nAssume these definitions:\n\n::\n\n class C:\n def f():\n pass\n\n class D:\n def g():\n pass\n\nIn Python 3.3+, classes have a ``__qualname__`` property::\n\n >>> C.__qualname__\n 'C'\n >>> C.f.__qualname__\n 'C.f'\n >>> C.D.__qualname__\n 'C.D'\n >>> C.D.g.__qualname__\n 'C.D.g'\n\nUnfortunately, Python 2 and early Python 3 versions do not have an (obvious)\nequivalent. ``qualname`` to the rescue::\n\n from qualname import qualname\n\n >>> qualname(C)\n 'C'\n >>> qualname(C.f)\n 'C.f'\n >>> qualname(C.D)\n 'C.D'\n >>> qualname(C.D.g)\n 'C.D.g'\n\nVictory!\n\n\nHow does it work?\n=================\n\nGlad you ask.\n\nThis module uses source code inspection to figure out how (nested) classes and\nfunctions are defined in order to determine the qualified names for them. That\nmeans parsing the source file, and traversing the AST (abstract syntax tree).\nThis sounds very hacky, and it is, but the Python interpreter itself does not\nhave the necessary information, so this justifies extreme measures.\n\nNow that you know how it works, you'll also understand that this module only\nworks when the source file is available. Fortunately this is the case in most\ncircumstances.\n\n\nLicense\n=======\n\nBSD.\n\n\nFeedback? Issues?\n=================\n\nhttps://github.com/wbolster/qualname", "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/wbolster/qualname", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "qualname", "package_url": "https://pypi.org/project/qualname/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/qualname/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/wbolster/qualname" }, "release_url": "https://pypi.org/project/qualname/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "__qualname__ emulation for older Python versions", "version": "0.1.0" }, "last_serial": 1501758, "releases": { "0.0.1": [], "0.1.0": [ { "comment_text": "", "digests": { "md5": "fdc9b7a3174000908fab184a295f9622", "sha256": "277cf6aa4b2ad36beed1153cfa7bf521b210d54fbecb3d8eea0c5679cecc9ed8" }, "downloads": -1, "filename": "qualname-0.1.0.tar.gz", "has_sig": false, "md5_digest": "fdc9b7a3174000908fab184a295f9622", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3088, "upload_time": "2015-04-11T22:51:43", "url": "https://files.pythonhosted.org/packages/d9/55/8701163104e69773bb3c9371094372b1f9057fd5fbf33ca8d3236a63a9c1/qualname-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fdc9b7a3174000908fab184a295f9622", "sha256": "277cf6aa4b2ad36beed1153cfa7bf521b210d54fbecb3d8eea0c5679cecc9ed8" }, "downloads": -1, "filename": "qualname-0.1.0.tar.gz", "has_sig": false, "md5_digest": "fdc9b7a3174000908fab184a295f9622", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3088, "upload_time": "2015-04-11T22:51:43", "url": "https://files.pythonhosted.org/packages/d9/55/8701163104e69773bb3c9371094372b1f9057fd5fbf33ca8d3236a63a9c1/qualname-0.1.0.tar.gz" } ] }